summaryrefslogtreecommitdiff
path: root/xc
diff options
context:
space:
mode:
Diffstat (limited to 'xc')
-rw-r--r--xc/config/cf/Library.tmpl35
-rw-r--r--xc/config/cf/X11.tmpl3
-rw-r--r--xc/config/cf/xfree86.cf1
-rw-r--r--xc/lib/FS/FSClServ.c86
-rw-r--r--xc/lib/FS/FSCloseFt.c63
-rw-r--r--xc/lib/FS/FSConnServ.c269
-rw-r--r--xc/lib/FS/FSErrDis.c114
-rw-r--r--xc/lib/FS/FSErrHndlr.c77
-rw-r--r--xc/lib/FS/FSFlush.c56
-rw-r--r--xc/lib/FS/FSFontInfo.c323
-rw-r--r--xc/lib/FS/FSFtNames.c119
-rw-r--r--xc/lib/FS/FSGetCats.c102
-rw-r--r--xc/lib/FS/FSListCats.c120
-rw-r--r--xc/lib/FS/FSListExt.c112
-rw-r--r--xc/lib/FS/FSMisc.c57
-rw-r--r--xc/lib/FS/FSNextEv.c72
-rw-r--r--xc/lib/FS/FSOpenFont.c85
-rw-r--r--xc/lib/FS/FSOpenServ.c272
-rw-r--r--xc/lib/FS/FSQGlyphs.c182
-rw-r--r--xc/lib/FS/FSQXExt.c159
-rw-r--r--xc/lib/FS/FSQXInfo.c118
-rw-r--r--xc/lib/FS/FSQuExt.c75
-rw-r--r--xc/lib/FS/FSServName.c70
-rw-r--r--xc/lib/FS/FSSetCats.c87
-rw-r--r--xc/lib/FS/FSSync.c74
-rw-r--r--xc/lib/FS/FSSynchro.c84
-rw-r--r--xc/lib/FS/FSlib.h315
-rw-r--r--xc/lib/FS/FSlibInt.c1347
-rw-r--r--xc/lib/FS/FSlibint.h401
-rw-r--r--xc/lib/FS/FSlibos.h326
-rw-r--r--xc/lib/FS/Imakefile48
-rw-r--r--xc/lib/ICE/ICE-def.cpp64
-rw-r--r--xc/lib/ICE/ICE.h98
-rw-r--r--xc/lib/ICE/ICEconn.h245
-rw-r--r--xc/lib/ICE/ICElib.h534
-rw-r--r--xc/lib/ICE/ICElibint.h584
-rw-r--r--xc/lib/ICE/ICEmsg.h298
-rw-r--r--xc/lib/ICE/ICEos2.def134
-rw-r--r--xc/lib/ICE/ICEos2.rsp6
-rw-r--r--xc/lib/ICE/ICEproto.h170
-rw-r--r--xc/lib/ICE/ICEutil.h133
-rw-r--r--xc/lib/ICE/Imakefile92
-rw-r--r--xc/lib/ICE/accept.c181
-rw-r--r--xc/lib/ICE/authutil.c542
-rw-r--r--xc/lib/ICE/connect.c555
-rw-r--r--xc/lib/ICE/error.c638
-rw-r--r--xc/lib/ICE/getauth.c266
-rw-r--r--xc/lib/ICE/globals.h63
-rw-r--r--xc/lib/ICE/iceauth.c276
-rw-r--r--xc/lib/ICE/listen.c276
-rw-r--r--xc/lib/ICE/listenwk.c154
-rw-r--r--xc/lib/ICE/locking.c60
-rw-r--r--xc/lib/ICE/misc.c619
-rw-r--r--xc/lib/ICE/ping.c59
-rw-r--r--xc/lib/ICE/process.c2509
-rw-r--r--xc/lib/ICE/protosetup.c285
-rw-r--r--xc/lib/ICE/register.c249
-rw-r--r--xc/lib/ICE/replywait.c154
-rw-r--r--xc/lib/ICE/setauth.c114
-rw-r--r--xc/lib/ICE/shutdown.c321
-rw-r--r--xc/lib/ICE/watch.c199
-rw-r--r--xc/lib/Imakefile2
-rw-r--r--xc/lib/PEX5/Imakefile87
-rw-r--r--xc/lib/PEX5/PEX.h1222
-rw-r--r--xc/lib/PEX5/PEX5-def.cpp283
-rw-r--r--xc/lib/PEX5/PEX5os2.def429
-rw-r--r--xc/lib/PEX5/PEX5os2.rsp6
-rw-r--r--xc/lib/PEX5/PEXlib.h4426
-rw-r--r--xc/lib/PEX5/PEXlibint.h1052
-rw-r--r--xc/lib/PEX5/PEXproto.h2241
-rw-r--r--xc/lib/PEX5/PEXprotost.h678
-rw-r--r--xc/lib/PEX5/jump_funcs417
-rw-r--r--xc/lib/PEX5/jump_ignore3
-rw-r--r--xc/lib/PEX5/jump_vars10
-rw-r--r--xc/lib/PEX5/pl_convert.c234
-rw-r--r--xc/lib/PEX5/pl_convert.h345
-rw-r--r--xc/lib/PEX5/pl_escape.c195
-rw-r--r--xc/lib/PEX5/pl_extract.h1160
-rw-r--r--xc/lib/PEX5/pl_font.c671
-rw-r--r--xc/lib/PEX5/pl_free.c551
-rw-r--r--xc/lib/PEX5/pl_global.h422
-rw-r--r--xc/lib/PEX5/pl_lut.c1588
-rw-r--r--xc/lib/PEX5/pl_lut.h56
-rw-r--r--xc/lib/PEX5/pl_nameset.c298
-rw-r--r--xc/lib/PEX5/pl_oc_attr.c1979
-rw-r--r--xc/lib/PEX5/pl_oc_dec.c1925
-rw-r--r--xc/lib/PEX5/pl_oc_enc.c2138
-rw-r--r--xc/lib/PEX5/pl_oc_prim.c2448
-rw-r--r--xc/lib/PEX5/pl_oc_str.c199
-rw-r--r--xc/lib/PEX5/pl_oc_util.c2961
-rw-r--r--xc/lib/PEX5/pl_oc_util.h838
-rw-r--r--xc/lib/PEX5/pl_pc.c1218
-rw-r--r--xc/lib/PEX5/pl_pick.c1213
-rw-r--r--xc/lib/PEX5/pl_rdr.c1114
-rw-r--r--xc/lib/PEX5/pl_sc.c596
-rw-r--r--xc/lib/PEX5/pl_startup.c961
-rw-r--r--xc/lib/PEX5/pl_store.h975
-rw-r--r--xc/lib/PEX5/pl_struct.c1312
-rw-r--r--xc/lib/PEX5/pl_util.c3279
-rw-r--r--xc/lib/PEX5/pl_util.h110
-rw-r--r--xc/lib/PEX5/pl_wks.c1574
-rw-r--r--xc/lib/PEX5/pl_xdata.h244
-rw-r--r--xc/lib/SM/Imakefile52
-rw-r--r--xc/lib/SM/SM-def.cpp41
-rw-r--r--xc/lib/SM/SM.h126
-rw-r--r--xc/lib/SM/SMlib.h655
-rw-r--r--xc/lib/SM/SMlibint.h516
-rw-r--r--xc/lib/SM/SMos2.def63
-rw-r--r--xc/lib/SM/SMos2.rsp4
-rw-r--r--xc/lib/SM/SMproto.h202
-rw-r--r--xc/lib/SM/globals.h64
-rw-r--r--xc/lib/SM/sm_auth.c36
-rw-r--r--xc/lib/SM/sm_client.c624
-rw-r--r--xc/lib/SM/sm_error.c333
-rw-r--r--xc/lib/SM/sm_genid.c179
-rw-r--r--xc/lib/SM/sm_manager.c366
-rw-r--r--xc/lib/SM/sm_misc.c210
-rw-r--r--xc/lib/SM/sm_process.c871
-rw-r--r--xc/lib/XIE/Imakefile74
-rw-r--r--xc/lib/XIE/XIE-def.cpp113
-rw-r--r--xc/lib/XIE/XIElib.h1910
-rw-r--r--xc/lib/XIE/XIElibint.h313
-rw-r--r--xc/lib/XIE/XIEos2.def207
-rw-r--r--xc/lib/XIE/XIEos2.rsp5
-rw-r--r--xc/lib/XIE/abort.c54
-rw-r--r--xc/lib/XIE/await.c54
-rw-r--r--xc/lib/XIE/clientdata.c128
-rw-r--r--xc/lib/XIE/colorlist.c154
-rw-r--r--xc/lib/XIE/conven.c1447
-rw-r--r--xc/lib/XIE/elements.c1191
-rw-r--r--xc/lib/XIE/elements.h102
-rw-r--r--xc/lib/XIE/errors.c133
-rw-r--r--xc/lib/XIE/events.c160
-rw-r--r--xc/lib/XIE/free.c117
-rw-r--r--xc/lib/XIE/globals.h120
-rw-r--r--xc/lib/XIE/ieee.c192
-rw-r--r--xc/lib/XIE/init.c452
-rw-r--r--xc/lib/XIE/init.h39
-rw-r--r--xc/lib/XIE/jump_funcs197
-rw-r--r--xc/lib/XIE/jump_ignore3
-rw-r--r--xc/lib/XIE/jump_vars6
-rw-r--r--xc/lib/XIE/lut.c77
-rw-r--r--xc/lib/XIE/photoflo.c301
-rw-r--r--xc/lib/XIE/photomap.c134
-rw-r--r--xc/lib/XIE/photospace.c120
-rw-r--r--xc/lib/XIE/roi.c77
-rw-r--r--xc/lib/XIE/technique.c1329
-rw-r--r--xc/lib/XIE/technique.h81
-rw-r--r--xc/lib/XIE/utils.c105
-rw-r--r--xc/lib/Xaw/Actions.c1130
-rw-r--r--xc/lib/Xaw/AllWidgets.c117
-rw-r--r--xc/lib/Xaw/AllWidgets.h32
-rw-r--r--xc/lib/Xaw/AsciiSink.c1908
-rw-r--r--xc/lib/Xaw/AsciiSink.h78
-rw-r--r--xc/lib/Xaw/AsciiSinkP.h97
-rw-r--r--xc/lib/Xaw/AsciiSrc.c1869
-rw-r--r--xc/lib/Xaw/AsciiSrc.h171
-rw-r--r--xc/lib/Xaw/AsciiSrcP.h141
-rw-r--r--xc/lib/Xaw/AsciiText.c353
-rw-r--r--xc/lib/Xaw/AsciiText.h124
-rw-r--r--xc/lib/Xaw/AsciiTextP.h165
-rw-r--r--xc/lib/Xaw/Box.c668
-rw-r--r--xc/lib/Xaw/Box.h104
-rw-r--r--xc/lib/Xaw/BoxP.h99
-rw-r--r--xc/lib/Xaw/CHANGES153
-rw-r--r--xc/lib/Xaw/Cardinals.h39
-rw-r--r--xc/lib/Xaw/Changelog1370
-rw-r--r--xc/lib/Xaw/Command.c622
-rw-r--r--xc/lib/Xaw/Command.h115
-rw-r--r--xc/lib/Xaw/CommandP.h113
-rw-r--r--xc/lib/Xaw/Converters.c698
-rw-r--r--xc/lib/Xaw/Dialog.c451
-rw-r--r--xc/lib/Xaw/Dialog.h97
-rw-r--r--xc/lib/Xaw/DialogP.h100
-rw-r--r--xc/lib/Xaw/DisplayList.c2250
-rw-r--r--xc/lib/Xaw/Form.c1118
-rw-r--r--xc/lib/Xaw/Form.h167
-rw-r--r--xc/lib/Xaw/FormP.h132
-rw-r--r--xc/lib/Xaw/Grip.c181
-rw-r--r--xc/lib/Xaw/Grip.h95
-rw-r--r--xc/lib/Xaw/GripP.h87
-rw-r--r--xc/lib/Xaw/Imakefile200
-rw-r--r--xc/lib/Xaw/Label.c813
-rw-r--r--xc/lib/Xaw/Label.h131
-rw-r--r--xc/lib/Xaw/LabelP.h117
-rw-r--r--xc/lib/Xaw/List.c1238
-rw-r--r--xc/lib/Xaw/List.h232
-rw-r--r--xc/lib/Xaw/ListP.h110
-rw-r--r--xc/lib/Xaw/MenuButtoP.h76
-rw-r--r--xc/lib/Xaw/MenuButton.c225
-rw-r--r--xc/lib/Xaw/MenuButton.h87
-rw-r--r--xc/lib/Xaw/MultiSink.c969
-rw-r--r--xc/lib/Xaw/MultiSink.h109
-rw-r--r--xc/lib/Xaw/MultiSinkP.h137
-rw-r--r--xc/lib/Xaw/MultiSrc.c1604
-rw-r--r--xc/lib/Xaw/MultiSrc.h129
-rw-r--r--xc/lib/Xaw/MultiSrcP.h178
-rw-r--r--xc/lib/Xaw/OS.c60
-rw-r--r--xc/lib/Xaw/Paned.c2058
-rw-r--r--xc/lib/Xaw/Paned.h260
-rw-r--r--xc/lib/Xaw/PanedP.h176
-rw-r--r--xc/lib/Xaw/Panner.c1077
-rw-r--r--xc/lib/Xaw/Panner.h102
-rw-r--r--xc/lib/Xaw/PannerP.h104
-rw-r--r--xc/lib/Xaw/Pixmap.c931
-rw-r--r--xc/lib/Xaw/Porthole.c371
-rw-r--r--xc/lib/Xaw/Porthole.h58
-rw-r--r--xc/lib/Xaw/PortholeP.h60
-rw-r--r--xc/lib/Xaw/Private.h154
-rw-r--r--xc/lib/Xaw/Repeater.c293
-rw-r--r--xc/lib/Xaw/Repeater.h71
-rw-r--r--xc/lib/Xaw/RepeaterP.h80
-rw-r--r--xc/lib/Xaw/Reports.h50
-rw-r--r--xc/lib/Xaw/Scrollbar.c873
-rw-r--r--xc/lib/Xaw/Scrollbar.h133
-rw-r--r--xc/lib/Xaw/ScrollbarP.h105
-rw-r--r--xc/lib/Xaw/Simple.c458
-rw-r--r--xc/lib/Xaw/Simple.h112
-rw-r--r--xc/lib/Xaw/SimpleMenP.h97
-rw-r--r--xc/lib/Xaw/SimpleMenu.c1815
-rw-r--r--xc/lib/Xaw/SimpleMenu.h169
-rw-r--r--xc/lib/Xaw/SimpleP.h91
-rw-r--r--xc/lib/Xaw/Sme.c265
-rw-r--r--xc/lib/Xaw/Sme.h68
-rw-r--r--xc/lib/Xaw/SmeBSB.c765
-rw-r--r--xc/lib/Xaw/SmeBSB.h94
-rw-r--r--xc/lib/Xaw/SmeBSBP.h90
-rw-r--r--xc/lib/Xaw/SmeLine.c260
-rw-r--r--xc/lib/Xaw/SmeLine.h67
-rw-r--r--xc/lib/Xaw/SmeLineP.h71
-rw-r--r--xc/lib/Xaw/SmeP.h80
-rw-r--r--xc/lib/Xaw/StripCharP.h106
-rw-r--r--xc/lib/Xaw/StripChart.c572
-rw-r--r--xc/lib/Xaw/StripChart.h107
-rw-r--r--xc/lib/Xaw/Template.c191
-rw-r--r--xc/lib/Xaw/Template.h58
-rw-r--r--xc/lib/Xaw/TemplateP.h60
-rw-r--r--xc/lib/Xaw/Text.c4116
-rw-r--r--xc/lib/Xaw/Text.h369
-rw-r--r--xc/lib/Xaw/TextAction.c4301
-rw-r--r--xc/lib/Xaw/TextP.h304
-rw-r--r--xc/lib/Xaw/TextPop.c1526
-rw-r--r--xc/lib/Xaw/TextSink.c1795
-rw-r--r--xc/lib/Xaw/TextSink.h360
-rw-r--r--xc/lib/Xaw/TextSinkP.h302
-rw-r--r--xc/lib/Xaw/TextSrc.c1963
-rw-r--r--xc/lib/Xaw/TextSrc.h276
-rw-r--r--xc/lib/Xaw/TextSrcP.h253
-rw-r--r--xc/lib/Xaw/TextTr.c155
-rw-r--r--xc/lib/Xaw/Tip.c629
-rw-r--r--xc/lib/Xaw/Tip.h120
-rw-r--r--xc/lib/Xaw/TipP.h77
-rw-r--r--xc/lib/Xaw/Toggle.c624
-rw-r--r--xc/lib/Xaw/Toggle.h177
-rw-r--r--xc/lib/Xaw/ToggleP.h91
-rw-r--r--xc/lib/Xaw/Tree.c1010
-rw-r--r--xc/lib/Xaw/Tree.h134
-rw-r--r--xc/lib/Xaw/TreeP.h137
-rw-r--r--xc/lib/Xaw/Vendor.c499
-rw-r--r--xc/lib/Xaw/VendorEP.h80
-rw-r--r--xc/lib/Xaw/Viewport.c1093
-rw-r--r--xc/lib/Xaw/Viewport.h117
-rw-r--r--xc/lib/Xaw/ViewportP.h105
-rw-r--r--xc/lib/Xaw/Xaw-def.cpp134
-rw-r--r--xc/lib/Xaw/Xaw.man555
-rw-r--r--xc/lib/Xaw/XawI18n.c97
-rw-r--r--xc/lib/Xaw/XawI18n.h115
-rw-r--r--xc/lib/Xaw/XawIm.c1611
-rw-r--r--xc/lib/Xaw/XawImP.h209
-rw-r--r--xc/lib/Xaw/XawInit.c51
-rw-r--r--xc/lib/Xaw/XawInit.h45
-rw-r--r--xc/lib/Xaw/Xawos2.def193
-rw-r--r--xc/lib/Xaw/Xawos2.rsp9
-rwxr-xr-xxc/lib/Xaw/genlist.sh41
-rw-r--r--xc/lib/Xaw/jump_funcs113
-rw-r--r--xc/lib/Xaw/jump_ignore3
-rw-r--r--xc/lib/Xaw/jump_vars79
-rw-r--r--xc/lib/Xaw/sharedlib.c167
-rw-r--r--xc/lib/Xaw6/Imakefile170
-rw-r--r--xc/lib/Xaw6/Xaw6os2.def205
-rw-r--r--xc/lib/Xaw6/Xaw6os2.rsp10
-rw-r--r--xc/lib/Xfontcache/FontCache.c213
-rw-r--r--xc/lib/Xfontcache/Imakefile33
-rw-r--r--xc/lib/Xft/Imakefile80
-rw-r--r--xc/lib/Xft/Xft-def.cpp146
-rw-r--r--xc/lib/Xft/Xft.h524
-rw-r--r--xc/lib/Xft/Xft.man181
-rw-r--r--xc/lib/Xft/XftConfig.cpp36
-rw-r--r--xc/lib/Xft/XftFreetype.h164
-rw-r--r--xc/lib/Xft/xftcache.c608
-rw-r--r--xc/lib/Xft/xftcfg.c665
-rw-r--r--xc/lib/Xft/xftcolor.c125
-rw-r--r--xc/lib/Xft/xftcore.c247
-rw-r--r--xc/lib/Xft/xftdbg.c221
-rw-r--r--xc/lib/Xft/xftdir.c78
-rw-r--r--xc/lib/Xft/xftdpy.c425
-rw-r--r--xc/lib/Xft/xftdraw.c482
-rw-r--r--xc/lib/Xft/xftextent.c190
-rw-r--r--xc/lib/Xft/xftfont.c327
-rw-r--r--xc/lib/Xft/xftfreetype.c678
-rw-r--r--xc/lib/Xft/xftfs.c74
-rw-r--r--xc/lib/Xft/xftglyphs.c495
-rw-r--r--xc/lib/Xft/xftgram.y452
-rw-r--r--xc/lib/Xft/xftinit.c48
-rw-r--r--xc/lib/Xft/xftint.h488
-rw-r--r--xc/lib/Xft/xftlex.l275
-rw-r--r--xc/lib/Xft/xftlist.c328
-rw-r--r--xc/lib/Xft/xftmatch.c330
-rw-r--r--xc/lib/Xft/xftmatrix.c104
-rw-r--r--xc/lib/Xft/xftname.c391
-rw-r--r--xc/lib/Xft/xftpat.c411
-rw-r--r--xc/lib/Xft/xftrender.c527
-rw-r--r--xc/lib/Xft/xftstr.c259
-rw-r--r--xc/lib/Xft/xftxlfd.c335
-rw-r--r--xc/lib/Xi/Imakefile103
-rw-r--r--xc/lib/Xi/XAllowDv.c84
-rw-r--r--xc/lib/Xi/XChgDCtl.c126
-rw-r--r--xc/lib/Xi/XChgFCtl.c203
-rw-r--r--xc/lib/Xi/XChgKMap.c90
-rw-r--r--xc/lib/Xi/XChgKbd.c84
-rw-r--r--xc/lib/Xi/XChgPnt.c88
-rw-r--r--xc/lib/Xi/XChgProp.c94
-rw-r--r--xc/lib/Xi/XCloseDev.c81
-rw-r--r--xc/lib/Xi/XDevBell.c85
-rw-r--r--xc/lib/Xi/XExtInt.c658
-rw-r--r--xc/lib/Xi/XExtToWire.c448
-rw-r--r--xc/lib/Xi/XFreeLst.c68
-rw-r--r--xc/lib/Xi/XGMotion.c138
-rw-r--r--xc/lib/Xi/XGetBMap.c104
-rw-r--r--xc/lib/Xi/XGetDCtl.c169
-rw-r--r--xc/lib/Xi/XGetFCtl.c269
-rw-r--r--xc/lib/Xi/XGetKMap.c116
-rw-r--r--xc/lib/Xi/XGetMMap.c100
-rw-r--r--xc/lib/Xi/XGetProp.c116
-rw-r--r--xc/lib/Xi/XGetVers.c106
-rw-r--r--xc/lib/Xi/XGrDvBut.c110
-rw-r--r--xc/lib/Xi/XGrDvKey.c113
-rw-r--r--xc/lib/Xi/XGrabDev.c105
-rw-r--r--xc/lib/Xi/XGtFocus.c88
-rw-r--r--xc/lib/Xi/XGtSelect.c142
-rw-r--r--xc/lib/Xi/XIint.h12
-rw-r--r--xc/lib/Xi/XListDev.c255
-rw-r--r--xc/lib/Xi/XOpenDev.c109
-rw-r--r--xc/lib/Xi/XQueryDv.c194
-rw-r--r--xc/lib/Xi/XSelect.c90
-rw-r--r--xc/lib/Xi/XSetBMap.c89
-rw-r--r--xc/lib/Xi/XSetDVal.c96
-rw-r--r--xc/lib/Xi/XSetMMap.c87
-rw-r--r--xc/lib/Xi/XSetMode.c84
-rw-r--r--xc/lib/Xi/XSndExEv.c119
-rw-r--r--xc/lib/Xi/XStFocus.c83
-rw-r--r--xc/lib/Xi/XUngrDev.c82
-rw-r--r--xc/lib/Xi/XUngrDvB.c89
-rw-r--r--xc/lib/Xi/XUngrDvK.c89
-rw-r--r--xc/lib/Xi/Xi-def.cpp49
-rw-r--r--xc/lib/Xi/Xios2.def53
-rw-r--r--xc/lib/Xi/Xios2.rsp9
-rw-r--r--xc/lib/Xinerama/Imakefile29
-rw-r--r--xc/lib/Xinerama/Xinerama.c315
-rw-r--r--xc/lib/Xmu/AllCmap.c151
-rw-r--r--xc/lib/Xmu/Atoms.c146
-rw-r--r--xc/lib/Xmu/Atoms.h120
-rw-r--r--xc/lib/Xmu/CharSet.h73
-rw-r--r--xc/lib/Xmu/ClientWin.c87
-rw-r--r--xc/lib/Xmu/Clip.c1614
-rw-r--r--xc/lib/Xmu/CloseHook.c295
-rw-r--r--xc/lib/Xmu/CloseHook.h68
-rw-r--r--xc/lib/Xmu/CmapAlloc.c339
-rw-r--r--xc/lib/Xmu/Converters.h276
-rw-r--r--xc/lib/Xmu/CrCmap.c530
-rw-r--r--xc/lib/Xmu/CrPixFBit.c78
-rw-r--r--xc/lib/Xmu/CurUtil.h45
-rw-r--r--xc/lib/Xmu/CursorName.c133
-rw-r--r--xc/lib/Xmu/CvtCache.c140
-rw-r--r--xc/lib/Xmu/CvtCache.h58
-rw-r--r--xc/lib/Xmu/CvtStdSel.c340
-rw-r--r--xc/lib/Xmu/DefErrMsg.c166
-rw-r--r--xc/lib/Xmu/DelCmap.c66
-rw-r--r--xc/lib/Xmu/DisplayQue.c189
-rw-r--r--xc/lib/Xmu/DisplayQue.h151
-rw-r--r--xc/lib/Xmu/Distinct.c87
-rw-r--r--xc/lib/Xmu/DrRndRect.c175
-rw-r--r--xc/lib/Xmu/DrawLogo.c148
-rw-r--r--xc/lib/Xmu/Drawing.h158
-rw-r--r--xc/lib/Xmu/Editres.h38
-rw-r--r--xc/lib/Xmu/EditresCom.c2205
-rw-r--r--xc/lib/Xmu/EditresP.h405
-rw-r--r--xc/lib/Xmu/Error.h53
-rw-r--r--xc/lib/Xmu/ExtAgent.c39
-rw-r--r--xc/lib/Xmu/ExtAgent.h39
-rw-r--r--xc/lib/Xmu/FToCback.c41
-rw-r--r--xc/lib/Xmu/GetHost.c81
-rw-r--r--xc/lib/Xmu/GrayPixmap.c132
-rw-r--r--xc/lib/Xmu/Imakefile172
-rw-r--r--xc/lib/Xmu/Initer.c110
-rw-r--r--xc/lib/Xmu/Initer.h53
-rw-r--r--xc/lib/Xmu/LocBitmap.c265
-rw-r--r--xc/lib/Xmu/Lookup.c272
-rw-r--r--xc/lib/Xmu/Lookup.h128
-rw-r--r--xc/lib/Xmu/LookupCmap.c323
-rw-r--r--xc/lib/Xmu/Lower.c163
-rw-r--r--xc/lib/Xmu/Misc.h61
-rw-r--r--xc/lib/Xmu/README8
-rw-r--r--xc/lib/Xmu/RdBitF.c394
-rw-r--r--xc/lib/Xmu/ScrOfWin.c53
-rw-r--r--xc/lib/Xmu/ShapeWidg.c244
-rw-r--r--xc/lib/Xmu/StdCmap.c229
-rw-r--r--xc/lib/Xmu/StdCmap.h115
-rw-r--r--xc/lib/Xmu/StdSel.h52
-rw-r--r--xc/lib/Xmu/StrToBS.c142
-rw-r--r--xc/lib/Xmu/StrToBmap.c143
-rw-r--r--xc/lib/Xmu/StrToCurs.c343
-rw-r--r--xc/lib/Xmu/StrToGrav.c144
-rw-r--r--xc/lib/Xmu/StrToJust.c133
-rw-r--r--xc/lib/Xmu/StrToLong.c76
-rw-r--r--xc/lib/Xmu/StrToOrnt.c123
-rw-r--r--xc/lib/Xmu/StrToShap.c118
-rw-r--r--xc/lib/Xmu/StrToWidg.c218
-rw-r--r--xc/lib/Xmu/SysUtil.h49
-rw-r--r--xc/lib/Xmu/UpdMapHint.c55
-rw-r--r--xc/lib/Xmu/VisCmap.c176
-rw-r--r--xc/lib/Xmu/WhitePoint.h61
-rw-r--r--xc/lib/Xmu/WidgetNode.c303
-rw-r--r--xc/lib/Xmu/WidgetNode.h93
-rw-r--r--xc/lib/Xmu/WinUtil.h60
-rw-r--r--xc/lib/Xmu/Xct.c685
-rw-r--r--xc/lib/Xmu/Xct.h164
-rw-r--r--xc/lib/Xmu/Xmu-def.cpp100
-rw-r--r--xc/lib/Xmu/Xmu.h115
-rw-r--r--xc/lib/Xmu/Xmuos2.def128
-rw-r--r--xc/lib/Xmu/Xmuos2.rsp11
-rw-r--r--xc/lib/Xmu/sharedlib.c67
-rw-r--r--xc/lib/Xmuu/Imakefile64
-rw-r--r--xc/lib/Xmuu/Xmuu-def.cpp20
-rw-r--r--xc/lib/Xp/Imakefile108
-rw-r--r--xc/lib/Xp/Xp-def.cpp40
-rw-r--r--xc/lib/Xp/XpAttr.c211
-rw-r--r--xc/lib/Xp/XpContext.c252
-rw-r--r--xc/lib/Xp/XpDoc.c155
-rw-r--r--xc/lib/Xp/XpExtUtil.c336
-rw-r--r--xc/lib/Xp/XpExtUtil.h35
-rw-r--r--xc/lib/Xp/XpExtVer.c116
-rw-r--r--xc/lib/Xp/XpGetData.c212
-rw-r--r--xc/lib/Xp/XpImageRes.c116
-rw-r--r--xc/lib/Xp/XpInput.c104
-rw-r--r--xc/lib/Xp/XpJob.c201
-rw-r--r--xc/lib/Xp/XpLocale.c265
-rw-r--r--xc/lib/Xp/XpNotifyPdm.c893
-rw-r--r--xc/lib/Xp/XpPage.c155
-rw-r--r--xc/lib/Xp/XpPageDim.c87
-rw-r--r--xc/lib/Xp/XpPrinter.c247
-rw-r--r--xc/lib/Xp/XpPutData.c97
-rw-r--r--xc/lib/Xp/XpScreens.c117
-rw-r--r--xc/lib/Xp/Xpos2.def45
-rw-r--r--xc/lib/Xp/Xpos2.rsp5
-rw-r--r--xc/lib/Xpm/Imakefile98
-rw-r--r--xc/lib/Xpm/Xpm-def.cpp39
-rw-r--r--xc/lib/Xpm/Xpmos2.def41
-rw-r--r--xc/lib/Xpm/Xpmos2.rsp7
-rw-r--r--xc/lib/Xrandr/Imakefile33
-rw-r--r--xc/lib/Xrandr/Xrandr-def.cpp18
-rw-r--r--xc/lib/Xrandr/Xrandr.c472
-rw-r--r--xc/lib/Xrandr/Xrandr.h107
-rw-r--r--xc/lib/Xrandr/Xrandrint.h67
-rw-r--r--xc/lib/Xrandr/test.c21
-rw-r--r--xc/lib/Xrender/Composite.c65
-rw-r--r--xc/lib/Xrender/FillRect.c104
-rw-r--r--xc/lib/Xrender/FillRects.c77
-rw-r--r--xc/lib/Xrender/Glyph.c176
-rw-r--r--xc/lib/Xrender/Imakefile39
-rw-r--r--xc/lib/Xrender/Picture.c136
-rw-r--r--xc/lib/Xrender/Xrender-def.cpp28
-rw-r--r--xc/lib/Xrender/Xrender.c336
-rw-r--r--xc/lib/Xrender/Xrender.h203
-rw-r--r--xc/lib/Xrender/Xrenderint.h50
-rw-r--r--xc/lib/Xss/Imakefile32
-rw-r--r--xc/lib/Xss/XScrnSaver.c441
-rw-r--r--xc/lib/Xss/Xss-def.cpp14
-rw-r--r--xc/lib/Xss/Xssos2.def19
-rw-r--r--xc/lib/Xss/Xssos2.rsp3
-rw-r--r--xc/lib/Xt/ActionHook.c127
-rw-r--r--xc/lib/Xt/Alloc.c492
-rw-r--r--xc/lib/Xt/ArgList.c72
-rw-r--r--xc/lib/Xt/Callback.c735
-rw-r--r--xc/lib/Xt/CallbackI.h130
-rw-r--r--xc/lib/Xt/ClickTime.c86
-rw-r--r--xc/lib/Xt/Composite.c279
-rw-r--r--xc/lib/Xt/Composite.h114
-rw-r--r--xc/lib/Xt/CompositeP.h107
-rw-r--r--xc/lib/Xt/ConstrainP.h90
-rw-r--r--xc/lib/Xt/Constraint.c127
-rw-r--r--xc/lib/Xt/Constraint.h56
-rw-r--r--xc/lib/Xt/Convert.c1168
-rw-r--r--xc/lib/Xt/ConvertI.h99
-rw-r--r--xc/lib/Xt/Converters.c1883
-rw-r--r--xc/lib/Xt/Core.c393
-rw-r--r--xc/lib/Xt/Core.h62
-rw-r--r--xc/lib/Xt/CoreP.h167
-rw-r--r--xc/lib/Xt/Create.c824
-rw-r--r--xc/lib/Xt/Destroy.c379
-rw-r--r--xc/lib/Xt/Display.c831
-rw-r--r--xc/lib/Xt/Error.c732
-rw-r--r--xc/lib/Xt/Event.c1842
-rw-r--r--xc/lib/Xt/EventI.h123
-rw-r--r--xc/lib/Xt/EventUtil.c217
-rw-r--r--xc/lib/Xt/Functions.c224
-rw-r--r--xc/lib/Xt/GCManager.c346
-rw-r--r--xc/lib/Xt/Geometry.c823
-rw-r--r--xc/lib/Xt/GetActKey.c95
-rw-r--r--xc/lib/Xt/GetResList.c187
-rw-r--r--xc/lib/Xt/GetValues.c246
-rw-r--r--xc/lib/Xt/HookObj.c126
-rw-r--r--xc/lib/Xt/HookObjI.h67
-rw-r--r--xc/lib/Xt/Hooks.c159
-rw-r--r--xc/lib/Xt/Imakefile259
-rw-r--r--xc/lib/Xt/InitialI.h456
-rw-r--r--xc/lib/Xt/Initialize.c1041
-rw-r--r--xc/lib/Xt/Intrinsic.c1648
-rw-r--r--xc/lib/Xt/Intrinsic.h3210
-rw-r--r--xc/lib/Xt/IntrinsicI.h274
-rw-r--r--xc/lib/Xt/IntrinsicP.h357
-rw-r--r--xc/lib/Xt/Keyboard.c850
-rw-r--r--xc/lib/Xt/Manage.c495
-rw-r--r--xc/lib/Xt/NextEvent.c1648
-rw-r--r--xc/lib/Xt/Object.c290
-rw-r--r--xc/lib/Xt/Object.h56
-rw-r--r--xc/lib/Xt/ObjectP.h135
-rw-r--r--xc/lib/Xt/PassivGraI.h191
-rw-r--r--xc/lib/Xt/PassivGrab.c1115
-rw-r--r--xc/lib/Xt/Pointer.c108
-rw-r--r--xc/lib/Xt/Popup.c207
-rw-r--r--xc/lib/Xt/PopupCB.c77
-rw-r--r--xc/lib/Xt/RectObj.c184
-rw-r--r--xc/lib/Xt/RectObj.h56
-rw-r--r--xc/lib/Xt/RectObjP.h125
-rw-r--r--xc/lib/Xt/ResConfig.c1010
-rw-r--r--xc/lib/Xt/ResConfigP.h59
-rw-r--r--xc/lib/Xt/ResourceI.h84
-rw-r--r--xc/lib/Xt/Resources.c1292
-rw-r--r--xc/lib/Xt/Selection.c2302
-rw-r--r--xc/lib/Xt/SelectionI.h166
-rw-r--r--xc/lib/Xt/SetSens.c127
-rw-r--r--xc/lib/Xt/SetValues.c434
-rw-r--r--xc/lib/Xt/SetWMCW.c148
-rw-r--r--xc/lib/Xt/Shell.c3432
-rw-r--r--xc/lib/Xt/ShellI.h12
-rw-r--r--xc/lib/Xt/ShellP.h424
-rw-r--r--xc/lib/Xt/TMaction.c1065
-rw-r--r--xc/lib/Xt/TMgrab.c338
-rw-r--r--xc/lib/Xt/TMkey.c740
-rw-r--r--xc/lib/Xt/TMparse.c2140
-rw-r--r--xc/lib/Xt/TMprint.c885
-rw-r--r--xc/lib/Xt/TMstate.c2335
-rw-r--r--xc/lib/Xt/Threads.c469
-rw-r--r--xc/lib/Xt/ThreadsI.h130
-rw-r--r--xc/lib/Xt/TranslateI.h651
-rw-r--r--xc/lib/Xt/VarCreate.c505
-rw-r--r--xc/lib/Xt/VarGet.c347
-rw-r--r--xc/lib/Xt/Varargs.c561
-rw-r--r--xc/lib/Xt/VarargsI.h80
-rw-r--r--xc/lib/Xt/Vendor.c133
-rw-r--r--xc/lib/Xt/Vendor.h65
-rw-r--r--xc/lib/Xt/VendorP.h99
-rw-r--r--xc/lib/Xt/Xt-def.cpp341
-rw-r--r--xc/lib/Xt/Xtos.h71
-rw-r--r--xc/lib/Xt/Xtos2.def475
-rw-r--r--xc/lib/Xt/Xtos2.rsp12
-rw-r--r--xc/lib/Xt/jump_funcs752
-rw-r--r--xc/lib/Xt/jump_ignore11
-rw-r--r--xc/lib/Xt/jump_vars67
-rw-r--r--xc/lib/Xt/libXt.elist42
-rw-r--r--xc/lib/Xt/sharedlib.c299
-rw-r--r--xc/lib/Xt/util/Shell.ht95
-rw-r--r--xc/lib/Xt/util/StrDefs.ct53
-rw-r--r--xc/lib/Xt/util/StrDefs.ht63
-rw-r--r--xc/lib/Xt/util/string.list399
-rw-r--r--xc/lib/Xtst/Imakefile27
-rw-r--r--xc/lib/Xtst/XRecord.c1102
-rw-r--r--xc/lib/Xtst/XTest.c485
-rw-r--r--xc/lib/Xtst/Xtst-def.cpp32
-rw-r--r--xc/lib/Xtst/Xtstos2.def37
-rw-r--r--xc/lib/Xtst/Xtstos2.rsp3
-rw-r--r--xc/lib/Xv/Imakefile29
-rw-r--r--xc/lib/Xv/Xv.c873
-rw-r--r--xc/lib/Xv/Xvlibint.h99
-rw-r--r--xc/lib/XvMC/Imakefile29
-rw-r--r--xc/lib/XvMC/XvMC.c468
-rw-r--r--xc/lib/XvMC/XvMClibint.h40
-rw-r--r--xc/lib/Xxf86dga/Imakefile32
-rw-r--r--xc/lib/Xxf86dga/XF86DGA.c715
-rw-r--r--xc/lib/Xxf86dga/XF86DGA2.c941
-rw-r--r--xc/lib/Xxf86dga/Xxf86dga-def.cpp16
-rw-r--r--xc/lib/Xxf86dga/Xxf86dgaos2.def18
-rw-r--r--xc/lib/Xxf86dga/Xxf86dgaos2.rsp3
-rw-r--r--xc/lib/Xxf86misc/Imakefile32
-rw-r--r--xc/lib/Xxf86misc/XF86Misc.c230
-rw-r--r--xc/lib/Xxf86misc/Xxf86misc-def.cpp13
-rw-r--r--xc/lib/Xxf86misc/Xxf86miscos2.def13
-rw-r--r--xc/lib/Xxf86misc/Xxf86miscos2.rsp3
-rw-r--r--xc/lib/Xxf86rush/Imakefile31
-rw-r--r--xc/lib/Xxf86rush/XF86Rush.c291
-rw-r--r--xc/lib/Xxf86vm/Imakefile32
-rw-r--r--xc/lib/Xxf86vm/XF86VMode.c1111
-rw-r--r--xc/lib/Xxf86vm/Xxf86vm-def.cpp16
-rw-r--r--xc/lib/Xxf86vm/Xxf86vmos2.def16
-rw-r--r--xc/lib/Xxf86vm/Xxf86vmos2.rsp3
-rw-r--r--xc/lib/dps/DPSCAP.h77
-rw-r--r--xc/lib/dps/DPSCAPClient.h142
-rw-r--r--xc/lib/dps/DPSCAPproto.h180
-rw-r--r--xc/lib/dps/Imakefile319
-rw-r--r--xc/lib/dps/XDPS.c2330
-rw-r--r--xc/lib/dps/Xlibnet.h277
-rw-r--r--xc/lib/dps/Xstreams.h218
-rw-r--r--xc/lib/dps/csconndi.c852
-rw-r--r--xc/lib/dps/csfindNX.c658
-rw-r--r--xc/lib/dps/csfindNX.h100
-rw-r--r--xc/lib/dps/cslibext.c759
-rw-r--r--xc/lib/dps/cslibint.c2003
-rw-r--r--xc/lib/dps/cslibint.h291
-rw-r--r--xc/lib/dps/csopendi.c571
-rw-r--r--xc/lib/dps/csstartNX.c236
-rw-r--r--xc/lib/dps/csstartNX.h73
-rw-r--r--xc/lib/dps/dps-def.cpp991
-rw-r--r--xc/lib/dps/dpsNXprops.h91
-rw-r--r--xc/lib/dps/dpsXclient.c1136
-rw-r--r--xc/lib/dps/dpsXcmu.c1618
-rw-r--r--xc/lib/dps/dpsXint.h101
-rw-r--r--xc/lib/dps/dpsXops.psw80
-rw-r--r--xc/lib/dps/dpsXpriv.c530
-rw-r--r--xc/lib/dps/dpsXpriv.h138
-rw-r--r--xc/lib/dps/dpsXtdisp.c112
-rw-r--r--xc/lib/dps/dpsabbrev.c362
-rw-r--r--xc/lib/dps/dpsassert.h55
-rw-r--r--xc/lib/dps/dpsclient.c2918
-rw-r--r--xc/lib/dps/dpsclrops.psw81
-rw-r--r--xc/lib/dps/dpsctrlops.psw114
-rw-r--r--xc/lib/dps/dpsctxtops.psw110
-rw-r--r--xc/lib/dps/dpsdataops.psw258
-rw-r--r--xc/lib/dps/dpsdict.c184
-rw-r--r--xc/lib/dps/dpsdict.h77
-rw-r--r--xc/lib/dps/dpsendif.txt7
-rw-r--r--xc/lib/dps/dpsexcept.c73
-rw-r--r--xc/lib/dps/dpsfontops.psw109
-rw-r--r--xc/lib/dps/dpsgsttops.psw213
-rw-r--r--xc/lib/dps/dpsifdef.txt5
-rw-r--r--xc/lib/dps/dpsint.h104
-rw-r--r--xc/lib/dps/dpsioops.psw153
-rw-r--r--xc/lib/dps/dpsl2ops.psw208
-rw-r--r--xc/lib/dps/dpsmathops.psw125
-rw-r--r--xc/lib/dps/dpsmiscops.psw53
-rw-r--r--xc/lib/dps/dpsmtrxops.psw65
-rw-r--r--xc/lib/dps/dpsname.txt4
-rw-r--r--xc/lib/dps/dpsops.h.os21601
-rw-r--r--xc/lib/dps/dpsopstack.psw96
-rw-r--r--xc/lib/dps/dpsos2.def854
-rw-r--r--xc/lib/dps/dpsos2.rsp13
-rw-r--r--xc/lib/dps/dpspathops.psw169
-rw-r--r--xc/lib/dps/dpspntops.psw129
-rw-r--r--xc/lib/dps/dpsprintf.c103
-rw-r--r--xc/lib/dps/dpsprivate.h171
-rw-r--r--xc/lib/dps/dpssimpint.h88
-rw-r--r--xc/lib/dps/dpssysnames.c444
-rw-r--r--xc/lib/dps/dpssysops.psw149
-rw-r--r--xc/lib/dps/dpswinops.psw65
-rw-r--r--xc/lib/dps/else.txt6
-rw-r--r--xc/lib/dps/genheader.cmd14
-rw-r--r--xc/lib/dps/header.txt35
-rw-r--r--xc/lib/dps/psXops.psw80
-rw-r--r--xc/lib/dps/psclrops.psw81
-rw-r--r--xc/lib/dps/psctrlops.psw113
-rw-r--r--xc/lib/dps/psctxtops.psw109
-rw-r--r--xc/lib/dps/psdataops.psw257
-rw-r--r--xc/lib/dps/psendif.txt7
-rw-r--r--xc/lib/dps/psfontops.psw109
-rw-r--r--xc/lib/dps/psgsttops.psw213
-rw-r--r--xc/lib/dps/psifdef.txt5
-rw-r--r--xc/lib/dps/psioops.psw153
-rw-r--r--xc/lib/dps/psl2ops.psw208
-rw-r--r--xc/lib/dps/psmathops.psw125
-rw-r--r--xc/lib/dps/psmiscops.psw53
-rw-r--r--xc/lib/dps/psmtrxops.psw65
-rw-r--r--xc/lib/dps/psname.txt3
-rw-r--r--xc/lib/dps/psops.h.os21602
-rw-r--r--xc/lib/dps/psopstack.psw96
-rw-r--r--xc/lib/dps/pspathops.psw169
-rw-r--r--xc/lib/dps/pspntops.psw129
-rw-r--r--xc/lib/dps/pssysops.psw150
-rw-r--r--xc/lib/dps/pswinops.psw66
-rw-r--r--xc/lib/dps/publictypes.h70
-rw-r--r--xc/lib/dpstk/CSBwraps.psw343
-rw-r--r--xc/lib/dpstk/ColorSB.c3393
-rw-r--r--xc/lib/dpstk/ColorSelect.ad162
-rw-r--r--xc/lib/dpstk/DPSScrollW.c3531
-rw-r--r--xc/lib/dpstk/DSWwraps.psw75
-rw-r--r--xc/lib/dpstk/FSBwraps.psw491
-rw-r--r--xc/lib/dpstk/FontCreato.c1643
-rw-r--r--xc/lib/dpstk/FontSB.c4909
-rw-r--r--xc/lib/dpstk/FontSBI.h74
-rw-r--r--xc/lib/dpstk/FontSample.c1852
-rw-r--r--xc/lib/dpstk/FontSelect.ad415
-rw-r--r--xc/lib/dpstk/Imakefile85
-rw-r--r--xc/lib/dpstk/XDPSpreview.c649
-rw-r--r--xc/lib/dpstk/XDPSpwraps.psw97
-rw-r--r--xc/lib/dpstk/XDPSshare.c760
-rw-r--r--xc/lib/dpstk/XDPSswraps.psw110
-rw-r--r--xc/lib/dpstk/XDPSuserpath.c239
-rw-r--r--xc/lib/dpstk/dpsXcommonI.h73
-rw-r--r--xc/lib/dpstk/dpstk-def.cpp65
-rw-r--r--xc/lib/dpstk/dpstkos2.def69
-rw-r--r--xc/lib/dpstk/dpstkos2.rsp4
-rw-r--r--xc/lib/dpstk/eyedrop16.xbm8
-rw-r--r--xc/lib/dpstk/eyedrop32.xbm16
-rw-r--r--xc/lib/dpstk/eyedropmask16.xbm8
-rw-r--r--xc/lib/dpstk/eyedropmask32.xbm16
-rw-r--r--xc/lib/dpstk/heyedrop.xbm7
-rw-r--r--xc/lib/dpstk/square.xbm8
-rw-r--r--xc/lib/dpstk/squaremask.xbm6
-rw-r--r--xc/lib/fontenc/Imakefile28
-rw-r--r--xc/lib/freetype2/Imakefile105
-rw-r--r--xc/lib/freetype2/freetype-def.cpp160
-rw-r--r--xc/lib/freetype2/freetype/Imakefile56
-rw-r--r--xc/lib/freetype2/freetype/cache/Imakefile23
-rw-r--r--xc/lib/freetype2/freetype/config/Imakefile19
-rw-r--r--xc/lib/freetype2/freetype/internal/Imakefile49
-rw-r--r--xc/lib/oldX/Imakefile40
-rw-r--r--xc/lib/oldX/X10.h85
-rw-r--r--xc/lib/oldX/XCrAssoc.c68
-rw-r--r--xc/lib/oldX/XDelAssoc.c75
-rw-r--r--xc/lib/oldX/XDestAssoc.c60
-rw-r--r--xc/lib/oldX/XDraw.c705
-rw-r--r--xc/lib/oldX/XLookAssoc.c71
-rw-r--r--xc/lib/oldX/XMakeAssoc.c106
-rw-r--r--xc/lib/oldX/oldX-def.cpp11
-rw-r--r--xc/lib/psres/Imakefile30
-rw-r--r--xc/lib/psres/PSres.c1667
-rw-r--r--xc/lib/psres/psres-def.cpp11
-rw-r--r--xc/lib/psres/psresos2.def29
-rw-r--r--xc/lib/psres/psresos2.rsp3
-rw-r--r--xc/lib/xkbfile/Imakefile13
-rw-r--r--xc/lib/xkbui/Imakefile20
-rw-r--r--xc/lib/xkbui/XKBui.c836
-rw-r--r--xc/lib/xkbui/XKBui.h217
-rw-r--r--xc/lib/xkbui/XKBuiPriv.h71
743 files changed, 40 insertions, 271871 deletions
diff --git a/xc/config/cf/Library.tmpl b/xc/config/cf/Library.tmpl
index fb0079037..8342ff32d 100644
--- a/xc/config/cf/Library.tmpl
+++ b/xc/config/cf/Library.tmpl
@@ -14,12 +14,12 @@
* Define LargePICTable YES if large (32-bit) PIC tables are needed.
*/
-XCOMM $TOG: Library.tmpl /main/44 1997/04/28 11:47:53 kaleb $
+XCOMM $Xorg: Library.tmpl,v 1.3 2000/08/17 19:41:46 cpqbld Exp $
-XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.11 1999/08/28 09:00:17 dawes Exp $
+XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.14 2001/07/25 14:30:03 alanh Exp $
#ifndef LibraryCplusplusOptions
# if DoSharedLib && defined(SharedLibraryCplusplusOptions)
@@ -34,11 +34,13 @@ XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.11 1999/08/28 09:00:17 dawes Exp $
#ifndef LibraryDebugOpt
# define LibraryDebugOpt /**/
#endif
+/* Note: Changing LibraryCDebugFlags has no effect because CDEBUGFLAGS is over-
+ ridden by PassCDebugFlags in the parent Makefile or toplevel xmakefile. */
#ifndef LibraryCDebugFlags
-# define LibraryCDebugFlags DefaultCDebugFlags LibraryDebugOpt
+# define LibraryCDebugFlags DefaultCDebugFlags
#endif
#ifndef LibraryCplusplusDebugFlags
-# define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags LibraryDebugOpt
+# define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags
#endif
#ifndef SeparateSharedCompile
# define SeparateSharedCompile YES
@@ -64,6 +66,8 @@ XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.11 1999/08/28 09:00:17 dawes Exp $
CCOPTIONS = LibraryCCOptions
STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
CDEBUGFLAGS = LibraryCDebugFlags
+CLIBDEBUGFLAGS = LibraryDebugOpt
+ CFLAGS = $(CDEBUGFLAGS) $(CLIBDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(ALLDEFINES)
# if defined(LargePICTable) && LargePICTable && defined(LargePositionIndependentCFlags)
PICFLAGS = LargePositionIndependentCFlags
# endif
@@ -87,6 +91,8 @@ CDEBUGFLAGS = LibraryCDebugFlags
CXXOPTIONS = LibraryCplusplusOptions
STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
CXXDEBUGFLAGS = LibraryCplusplusDebugFlags
+CXXLIBDEBUGFLAGS = LibraryDebugOpt
+ CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXLIBDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES)
# if defined(LargePICTable) && LargePICTable
# ifdef LargePositionIndependentCplusplusFlags
CXXPICFLAGS = LargePositionIndependentCplusplusFlags
@@ -296,13 +302,14 @@ CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
#ifndef MakeStringsDependency
# define MakeStringsDependency @@\
MAKESTRS = $(CONFIGSRC)/util/makestrs @@\
-NoCmpScript(ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf) @@\
+NoCmpScript(HostProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf) @@\
@@\
-ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf: @@\
- cd $(CONFIGSRC)/util && $(MAKE) ProgramTargetName(makestrs) @@\
+HostProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf: @@\
+ cd $(CONFIGSRC)/util && $(MAKE) HostProgramTargetName(makestrs) @@\
@@\
-includes:: ProgramTargetName($(MAKESTRS))
+includes:: HostProgramTargetName($(MAKESTRS))
#endif
+
#ifndef ToolkitMakeStrings
# if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
# define ToolkitMakeStrings(files,source,options,depends,dest) @@\
@@ -358,6 +365,10 @@ LibraryObjectRule()
# define _LinkBuildLibrary(lib) $(_NULLCMD_)
# endif
+# if defined(LibBuild) && !LibBuild
+# define LibCreate NO
+# endif
+
# if !defined(LibCreate) || LibCreate
# if DoSharedLib
# if HugeLibrary && defined(SharedLibraryTarget3)
@@ -417,13 +428,15 @@ LintLibraryTarget($(LIBNAME),$(SRCS))
InstallLintLibrary($(LIBNAME),$(LINTLIBDIR))
# endif
# else /* not LibCreate */
-# if HugeLibrary
+# if LibBuild
+# if HugeLibrary
AllTarget($(OBJS1))
AllTarget($(OBJS2))
AllTarget($(OBJS3))
-# else
+# else
AllTarget($(OBJS))
-# endif
+# endif
+# endif /* LibBuild */
# endif /* LibCreate */
# ifdef IncSubdir
# ifdef IncSubSubdir
diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl
index aaea1ef6c..fb7f332d0 100644
--- a/xc/config/cf/X11.tmpl
+++ b/xc/config/cf/X11.tmpl
@@ -331,6 +331,9 @@ VENDORMANVERSION = XVendorManVersionString
#ifndef BuildXKBuilib
#define BuildXKBuilib (BuildXKB && !BuildServersOnly)
#endif
+#ifndef BuildXKBfilelib
+#define BuildXKBfilelib (BuildXKB && !BuildServersOnly)
+#endif
/*
* WARNING: Setting UseXKBInClients to YES cause incompatibilities
* between many clients (such as xterm) and pre-XKB shared
diff --git a/xc/config/cf/xfree86.cf b/xc/config/cf/xfree86.cf
index 8fb1c4342..fab97186b 100644
--- a/xc/config/cf/xfree86.cf
+++ b/xc/config/cf/xfree86.cf
@@ -125,6 +125,7 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $
#define BuildXF86MiscLibrary YES
#define BuildXF86VidModeLibrary YES
#define BuildXKBlib YES
+#define BuildXKBfilelib YES
#define BuildXKBuilib YES
#endif
diff --git a/xc/lib/FS/FSClServ.c b/xc/lib/FS/FSClServ.c
deleted file mode 100644
index 637ac6df4..000000000
--- a/xc/lib/FS/FSClServ.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $TOG: FSClServ.c /main/9 1998/05/01 12:50:19 kaleb $ */
-
-/* @(#)FSClServ.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSClServ.c,v 1.3 1999/02/20 15:07:12 hohndel Exp $ */
-
-/*
-
-Copyright 1987, 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 "FSlib.h"
-#include "FSlibint.h"
-
-extern FSServer *_FSHeadOfServerList;
-
-int
-FSCloseServer(svr)
- FSServer *svr;
-{
- _FSExtension *ext;
- FSServer **sv = &_FSHeadOfServerList;
- FSServer *s = _FSHeadOfServerList;
-
- svr->flags |= FSlibServerClosing;
- (void) FSSync(svr, 1); /* throw out pending events */
- ext = svr->ext_procs;
- while (ext) {
- if (ext->close_server != NULL)
- (*ext->close_server) (svr, &ext->codes);
- ext = ext->next;
- }
- _FSDisconnectServer(svr->trans_conn);
- while (s != NULL) {
- if (s == svr) {
- *sv = s->next;
- _FSFreeServerStructure(svr);
- break;
- }
- sv = &(s->next);
- s = *sv;
- }
- if (_FSHeadOfServerList == NULL) {
- _FSFreeQ();
- }
- return 1;
-}
diff --git a/xc/lib/FS/FSCloseFt.c b/xc/lib/FS/FSCloseFt.c
deleted file mode 100644
index a2445aeec..000000000
--- a/xc/lib/FS/FSCloseFt.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $TOG: FSCloseFt.c /main/7 1998/05/01 12:50:25 kaleb $ */
-
-/* @(#)FSCloseFt.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 "FSlibint.h"
-
-
-int
-FSCloseFont(svr, fid)
- FSServer *svr;
- Font fid;
-{
- fsResourceReq *req;
-
- GetResReq(CloseFont, fid, req);
- SyncHandle();
- return 1;
-}
diff --git a/xc/lib/FS/FSConnServ.c b/xc/lib/FS/FSConnServ.c
deleted file mode 100644
index c3f801f81..000000000
--- a/xc/lib/FS/FSConnServ.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $TOG: FSConnServ.c /main/29 1998/05/01 11:34:29 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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/lib/FS/FSConnServ.c,v 3.6 1998/10/03 08:41:06 dawes Exp $ */
-
-#include <stdio.h>
-#include "FSlibint.h"
-#include "X11/Xpoll.h"
-#ifdef NCD
-#include <fcntl.h>
-#endif
-#ifdef WIN32
-#define ECHECK(err) (WSAGetLastError() == err)
-#else
-#ifdef ISC
-#define ECHECK(err) ((errno == err) || errno == EAGAIN || errno == EWOULDBLOCK)
-#else
-#define ECHECK(err) (errno == err)
-#endif
-#endif
-
-#ifdef MINIX
-#include <sys/nbio.h>
-#define select(n,r,w,x,t) nbio_select(n,r,w,x,t)
-#endif
-
-/*
- * Attempts to connect to server, given server name. Returns transport
- * connection object or NULL if connection fails.
- */
-
-#define FS_CONNECTION_RETRIES 5
-
-XtransConnInfo
-_FSConnectServer(server_name)
- char *server_name;
-{
- XtransConnInfo trans_conn; /* transport connection object */
- int retry, connect_stat;
- int madeConnection = 0;
-
- /*
- * Open the network connection.
- */
-
- for (retry = FS_CONNECTION_RETRIES; retry >= 0; retry--)
- {
- if ((trans_conn = _FSTransOpenCOTSClient(server_name)) == NULL)
- {
- break;
- }
-
- if ((connect_stat = _FSTransConnect(trans_conn,server_name)) < 0)
- {
- _FSTransClose(trans_conn);
-
- if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
- {
- sleep(1);
- continue;
- }
- else
- break;
- }
- else
- {
- madeConnection = 1;
- break;
- }
- }
-
- if (!madeConnection)
- return (NULL);
-
-
- /*
- * set it non-blocking. This is so we can read data when blocked for
- * writing in the library.
- */
-
- _FSTransSetOption(trans_conn, TRANS_NONBLOCKING, 1);
-
- return (trans_conn);
-}
-
-/*
- * Disconnect from server.
- */
-
-void
-_FSDisconnectServer(trans_conn)
- XtransConnInfo trans_conn;
-
-{
- (void) _FSTransClose(trans_conn);
-}
-
-#ifndef __NetBSD__
-#undef NULL
-#define NULL ((char *) 0)
-#endif
-/*
- * This is an OS dependent routine which:
- * 1) returns as soon as the connection can be written on....
- * 2) if the connection can be read, must enqueue events and handle errors,
- * until the connection is writable.
- */
-void _FSWaitForWritable(svr)
- FSServer *svr;
-{
- fd_set r_mask;
- fd_set w_mask;
- int nfound;
-
- FD_ZERO(&r_mask);
- FD_ZERO(&w_mask);
-
- while (1) {
- FD_SET(svr->fd, &r_mask);
- FD_SET(svr->fd, &w_mask);
-
- do {
-#ifndef AMOEBA
- nfound = Select(svr->fd + 1, &r_mask, &w_mask, NULL, NULL);
-#else /* AMOEBA */
- if (_FSTransAmSelect(svr->fd, 0) > 0) {
- BITSET(r_mask, svr->fd);
- } else {
- CLEARBITS(r_mask);
- }
- /* Always immediately writable because data is enqueued to be
- * written by separate virtual circuit threads.
- */
- nfound = 1;
- BITSET(w_mask, svr->fd);
-#endif /* AMOEBA */
- if (nfound < 0 && !ECHECK(EINTR))
- (*_FSIOErrorFunction) (svr);
- } while (nfound <= 0);
-
- if (XFD_ANYSET(&r_mask)) {
- char buf[BUFSIZE];
- BytesReadable_t pend_not_register;
- register BytesReadable_t pend;
- register fsEvent *ev;
-
- /* find out how much data can be read */
- if (_FSTransBytesReadable(svr->trans_conn, &pend_not_register) < 0)
- (*_FSIOErrorFunction) (svr);
- pend = pend_not_register;
-
- /*
- * must read at least one fsEvent; if none is pending, then we'll
- * just block waiting for it
- */
- if (pend < SIZEOF(fsEvent))
- pend = SIZEOF(fsEvent);
-
- /* but we won't read more than the max buffer size */
- if (pend > BUFSIZE)
- pend = BUFSIZE;
-
- /* round down to an integral number of FSReps */
- pend = (pend / SIZEOF(fsEvent)) * SIZEOF(fsEvent);
-
- _FSRead(svr, buf, pend);
-
- /* no space between comma and type or else macro will die */
- STARTITERATE(ev, fsEvent, buf, (pend > 0),
- (pend -= SIZEOF(fsEvent))) {
- if (ev->type == FS_Error)
- _FSError(svr, (fsError *) ev);
- else /* it's an event packet; enqueue it */
- _FSEnq(svr, ev);
- }
- ENDITERATE
- }
- if (XFD_ANYSET(&w_mask))
- return;
- }
-}
-
-
-void _FSWaitForReadable(svr)
- FSServer *svr;
-{
- fd_set r_mask;
- int result;
-
- FD_ZERO(&r_mask);
- do {
- FD_SET(svr->fd, &r_mask);
-#ifndef AMOEBA
- result = Select(svr->fd + 1, &r_mask, NULL, NULL, NULL);
-#else
- if ((result = _FSTransAmSelect(svr->fd, 0)) > 0) {
- BITSET(r_mask, svr->fd);
- } else {
- CLEARBITS(r_mask);
- }
-#endif
- if (result == -1 && !ECHECK(EINTR))
- (*_FSIOErrorFunction) (svr);
- } while (result <= 0);
-}
-
-void _FSSendClientPrefix(svr, client)
- FSServer *svr;
- fsConnClientPrefix *client;
-{
- struct iovec iovarray[5],
- *iov = iovarray;
- int niov = 0;
-
-#define add_to_iov(b,l) \
- { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; }
-
- add_to_iov((caddr_t) client, SIZEOF(fsConnClientPrefix));
-
-#undef add_to_iov
-
- (void) _FSTransWritev(svr->trans_conn, iovarray, niov);
- return;
-}
diff --git a/xc/lib/FS/FSErrDis.c b/xc/lib/FS/FSErrDis.c
deleted file mode 100644
index f25a9b0d7..000000000
--- a/xc/lib/FS/FSErrDis.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $TOG: FSErrDis.c /main/8 1998/05/01 12:50:29 kaleb $ */
-
-/* @(#)FSErrDis.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 <stdio.h>
-#include "FSlibint.h"
-#include <X11/Xos.h>
-
-char *FSErrorList[] = {
- /* FSBadRequest */ "BadRequest, invalid request code or no such operation",
- /* FSBadFormat */ "BadFormat, bad font format mask",
- /* FSBadFont */ "BadFont, invalid Font parameter",
- /* FSBadRange */ "BadRange, invalid character range attributes",
- /* FSBadEventMask */ "BadEventMask, illegal event mask",
- /* FSBadAccessContext */ "BadAccessContext, insufficient permissions for operation",
- /* FSBadIDChoice */ "BadIDChoice, invalid resource ID chosen for this connection",
- /* FSBadName */ "BadName, named font does not exist",
- /* FSBadResolution */ "BadResolution, improperly formatted resolution",
- /* FSBadAlloc */ "BadAlloc, insufficient resources for operation",
- /* FSBadLength */ "BadLength, request too large or internal FSlib length error",
- /* FSBadImplementation */ "BadImplementation, request unsupported",
-};
-int FSErrorListSize = sizeof(FSErrorList);
-
-
-/* ARGSUSED */
-int FSGetErrorDatabaseText(svr, name, type, defaultp, buffer, nbytes)
- register char *name,
- *type;
- char *defaultp;
- FSServer *svr;
- char *buffer;
- int nbytes;
-{
- if (nbytes == 0)
- return 0;
- (void) strncpy(buffer, (char *) defaultp, nbytes);
- if ((strlen(defaultp) + 1) > nbytes)
- buffer[nbytes - 1] = '\0';
- return 1;
-}
-
-int FSGetErrorText(svr, code, buffer, nbytes)
- register int code;
- register FSServer *svr;
- char *buffer;
- int nbytes;
-{
-
- char *defaultp = NULL;
- char buf[32];
- register _FSExtension *ext;
-
- if (nbytes == 0)
- return 0;
- sprintf(buf, "%d", code);
- if (code <= (FSErrorListSize / sizeof(char *)) && code > 0) {
- defaultp = FSErrorList[code];
- FSGetErrorDatabaseText(svr, "FSProtoError", buf, defaultp, buffer, nbytes);
- }
- ext = svr->ext_procs;
- while (ext) { /* call out to any extensions interested */
- if (ext->error_string != NULL)
- (*ext->error_string) (svr, code, &ext->codes, buffer, nbytes);
- ext = ext->next;
- }
- return 1;
-}
-
diff --git a/xc/lib/FS/FSErrHndlr.c b/xc/lib/FS/FSErrHndlr.c
deleted file mode 100644
index 355bd208b..000000000
--- a/xc/lib/FS/FSErrHndlr.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $TOG: FSErrHndlr.c /main/5 1998/02/06 13:42:28 kaleb $ */
-
-/* @(#)FSErrHndlr.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSErrHndlr.c,v 1.3 1999/02/20 15:07:12 hohndel Exp $ */
-
-/*
-
-Copyright 1987, 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 "FSlibint.h"
-
-FSErrorHandler
-FSSetErrorHandler(FSErrorHandler handler)
-{
- FSErrorHandler oldhandler = _FSErrorFunction;
-
- if (handler != NULL) {
- _FSErrorFunction = handler;
- } else {
- _FSErrorFunction = _FSDefaultError;
- }
- return oldhandler;
-}
-
-FSIOErrorHandler
-FSSetIOErrorHandler(FSIOErrorHandler handler)
-{
- FSIOErrorHandler oldhandler = _FSIOErrorFunction;
-
- if (handler != NULL) {
- _FSIOErrorFunction = handler;
- } else {
- _FSIOErrorFunction = _FSDefaultIOError;
- }
- return oldhandler;
-}
diff --git a/xc/lib/FS/FSFlush.c b/xc/lib/FS/FSFlush.c
deleted file mode 100644
index 116c2250b..000000000
--- a/xc/lib/FS/FSFlush.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $TOG: FSFlush.c /main/6 1998/05/01 11:34:38 kaleb $ */
-
-/* @(#)FSFlush.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 "FSlibint.h"
-
-int FSFlush(svr)
- FSServer *svr;
-{
- _FSFlush(svr);
- return 1;
-}
diff --git a/xc/lib/FS/FSFontInfo.c b/xc/lib/FS/FSFontInfo.c
deleted file mode 100644
index 986be4a13..000000000
--- a/xc/lib/FS/FSFontInfo.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* $TOG: FSFontInfo.c /main/9 1998/05/01 12:50:34 kaleb $ */
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-char **
-FSListFontsWithXInfo(svr, pattern, maxNames, count, info, pprops, offsets, prop_data)
- FSServer *svr;
- char *pattern;
- int maxNames;
- int *count;
- FSXFontInfoHeader ***info;
- FSPropInfo ***pprops;
- FSPropOffset ***offsets;
- unsigned char ***prop_data;
-{
- long nbytes;
- int i,
- j;
- int size = 0;
- FSXFontInfoHeader **fhdr = (FSXFontInfoHeader **) 0;
- FSPropInfo **pi = (FSPropInfo **) 0;
- FSPropOffset **po = (FSPropOffset **) 0;
- unsigned char **pd = (unsigned char **) 0;
- char **flist = NULL;
- fsListFontsWithXInfoReply reply;
- fsListFontsWithXInfoReq *req;
- fsPropInfo local_pi;
- fsPropOffset local_po;
- Status status;
-
- GetReq(ListFontsWithXInfo, req);
- req->maxNames = maxNames;
- nbytes = req->nbytes = pattern ? strlen(pattern) : 0;
- req->length += (nbytes + 3) >> 2;
- _FSSend(svr, pattern, nbytes);
-
- for (i = 0;; i++) {
- if (FSProtocolVersion(svr) > 1)
- {
- status = _FSReply(svr, (fsReply *) &reply, 0, fsFalse);
- if (status != 0 && reply.nameLength == 0) /* got last reply */
- break;
- if (status)
- _FSRead(svr, ((char *) &reply) + SIZEOF(fsGenericReply),
- SIZEOF(fsListFontsWithXInfoReply) -
- SIZEOF(fsGenericReply));
- } else {
- status = _FSReply(svr, (fsReply *) & reply,
- ((SIZEOF(fsListFontsWithXInfoReply) -
- SIZEOF(fsGenericReply)) >> 2), fsFalse);
- }
- if (!status) {
- for (j = (i - 1); j >= 0; j--) {
- FSfree((char *) fhdr[j]);
- FSfree((char *) pi[j]);
- FSfree((char *) po[j]);
- FSfree((char *) pd[j]);
- FSfree(flist[j]);
- }
- if (flist)
- FSfree((char *) flist);
- if (fhdr)
- FSfree((char *) fhdr);
- if (pi)
- FSfree((char *) pi);
- if (po)
- FSfree((char *) po);
- if (pd)
- FSfree((char *) pd);
-
- SyncHandle();
- return (char **) NULL;
- }
- if (reply.nameLength == 0) /* got last reply in version 1 */
- break;
- if ((i + reply.nReplies) >= size) {
- size = i + reply.nReplies + 1;
-
- if (fhdr) {
- FSXFontInfoHeader **tmp_fhdr = (FSXFontInfoHeader **)
- FSrealloc((char *) fhdr,
- (unsigned) (sizeof(FSXFontInfoHeader *) * size));
- char **tmp_flist = (char **) FSrealloc((char *) flist,
- (unsigned) (sizeof(char *) * size));
- FSPropInfo **tmp_pi = (FSPropInfo **)
- FSrealloc((char *) pi,
- (unsigned) (sizeof(FSPropInfo *) * size));
- FSPropOffset **tmp_po = (FSPropOffset **)
- FSrealloc((char *) po,
- (unsigned) (sizeof(FSPropOffset *) * size));
- unsigned char **tmp_pd = (unsigned char **)
- FSrealloc((char *) pd,
- (unsigned) (sizeof(unsigned char *) * size));
-
- if (!tmp_fhdr || !tmp_flist || !tmp_pi || !tmp_po || !tmp_pd) {
- for (j = (i - 1); j >= 0; j--) {
- FSfree((char *) flist[j]);
- FSfree((char *) fhdr[j]);
- FSfree((char *) pi[j]);
- FSfree((char *) po[j]);
- FSfree((char *) pd[j]);
- }
- if (tmp_flist)
- FSfree((char *) tmp_flist);
- else
- FSfree((char *) flist);
- if (tmp_fhdr)
- FSfree((char *) tmp_fhdr);
- else
- FSfree((char *) fhdr);
- if (tmp_pi)
- FSfree((char *) tmp_pi);
- else
- FSfree((char *) pi);
- if (tmp_po)
- FSfree((char *) tmp_po);
- else
- FSfree((char *) po);
- if (tmp_pd)
- FSfree((char *) tmp_pd);
- else
- FSfree((char *) pd);
- goto clearwire;
- }
- fhdr = tmp_fhdr;
- flist = tmp_flist;
- pi = tmp_pi;
- po = tmp_po;
- pd = tmp_pd;
- } else {
- if (!(fhdr = (FSXFontInfoHeader **)
- FSmalloc((unsigned) (sizeof(FSXFontInfoHeader *) * size))))
- goto clearwire;
- if (!(flist = (char **)
- FSmalloc((unsigned) (sizeof(char *) * size)))) {
- FSfree((char *) fhdr);
- goto clearwire;
- }
- if (!(pi = (FSPropInfo **)
- FSmalloc((unsigned) (sizeof(FSPropInfo *) * size)))) {
- FSfree((char *) fhdr);
- FSfree((char *) flist);
- goto clearwire;
- }
- if (!(po = (FSPropOffset **)
- FSmalloc((unsigned) (sizeof(FSPropOffset *) * size)))) {
- FSfree((char *) fhdr);
- FSfree((char *) flist);
- FSfree((char *) pi);
- goto clearwire;
- }
- if (!(pd = (unsigned char **)
- FSmalloc((unsigned) (sizeof(unsigned char *) * size)))) {
- FSfree((char *) fhdr);
- FSfree((char *) flist);
- FSfree((char *) pi);
- FSfree((char *) po);
- goto clearwire;
- }
- }
- }
- fhdr[i] = (FSXFontInfoHeader *) FSmalloc(sizeof(FSXFontInfoHeader));
- if (!fhdr[i]) {
- goto badmem;
- }
- FSUnpack_XFontInfoHeader(&reply, fhdr[i], FSProtocolVersion(svr));
-
- /* alloc space for the name */
- flist[i] = (char *) FSmalloc((unsigned int) (reply.nameLength + 1));
- if (FSProtocolVersion(svr) == 1)
- {
- /* get the name */
- if (!flist[i]) {
- nbytes = (reply.nameLength + 3) & ~3;
- _FSEatData(svr, (unsigned long) nbytes);
- goto badmem;
- }
- _FSReadPad(svr, flist[i], (long) reply.nameLength);
- flist[i][reply.nameLength] = '\0';
- }
-
- pi[i] = (FSPropInfo *) FSmalloc(sizeof(FSPropInfo));
- if (!pi[i]) {
- FSfree((char *) fhdr[i]);
- goto badmem;
- }
- _FSReadPad(svr, (char *) &local_pi, SIZEOF(fsPropInfo));
- pi[i]->num_offsets = local_pi.num_offsets;
- pi[i]->data_len = local_pi.data_len;
-
- po[i] = (FSPropOffset *)
- FSmalloc(pi[i]->num_offsets * sizeof(FSPropOffset));
- if (!po[i]) {
- FSfree((char *) fhdr[i]);
- FSfree((char *) pi[i]);
- goto badmem;
- }
- pd[i] = (unsigned char *) FSmalloc(pi[i]->data_len);
- if (!pd[i]) {
- FSfree((char *) fhdr[i]);
- FSfree((char *) pi[i]);
- FSfree((char *) po[i]);
- goto badmem;
- }
- /* get offsets */
- for (j=0; j<pi[i]->num_offsets; j++)
- {
- _FSReadPad(svr, (char *) &local_po, SIZEOF(fsPropOffset));
- po[i][j].name.position = local_po.name.position;
- po[i][j].name.length = local_po.name.length;
- po[i][j].value.position = local_po.value.position;
- po[i][j].value.length = local_po.value.length;
- po[i][j].type = local_po.type;
- }
-
- /* get prop data */
- if (FSProtocolVersion(svr) == 1)
- _FSReadPad(svr, (char *) pd[i], pi[i]->data_len);
- else
- _FSRead(svr, (char *) pd[i], pi[i]->data_len);
-
- if (FSProtocolVersion(svr) != 1)
- {
- /* get the name */
- if (!flist[i]) {
- nbytes = (reply.nameLength + 3) & ~3;
- _FSEatData(svr, (unsigned long) nbytes);
- goto badmem;
- }
- _FSRead(svr, flist[i], (long) reply.nameLength);
- flist[i][reply.nameLength] = '\0';
-
- nbytes = pi[i]->data_len + reply.nameLength;
- _FSEatData(svr, (unsigned long) (((nbytes+3)&~3) - nbytes));
- }
- }
- *info = fhdr;
- *count = i;
- *pprops = pi;
- *offsets = po;
- *prop_data = pd;
- SyncHandle();
- return flist;
-
-badmem:
- for (j = (i - 1); j >= 0; j--) {
- FSfree((char *) pi[j]);
- FSfree((char *) po[j]);
- FSfree((char *) pd[j]);
- FSfree(flist[j]);
- FSfree((char *) fhdr[j]);
- }
- if (flist)
- FSfree((char *) flist);
- if (fhdr)
- FSfree((char *) fhdr);
- if (pi)
- FSfree((char *) pi);
- if (po)
- FSfree((char *) po);
- if (pd)
- FSfree((char *) pd);
-
-
-clearwire:
- do {
- fsPropInfo ti;
-
- _FSEatData(svr, (reply.nameLength + 3) & ~3);
- _FSReadPad(svr, (char *) &ti, SIZEOF(fsPropInfo));
- _FSEatData(svr, (SIZEOF(fsPropOffset) * ti.num_offsets));
- _FSEatData(svr, ti.data_len);
- } while (_FSReply(svr, (fsReply *) & reply,
- ((SIZEOF(fsListFontsWithXInfoReply)
- - SIZEOF(fsGenericReply)) >> 2), fsFalse) && (reply.nameLength != 0));
- SyncHandle();
- return (char **) NULL;
-}
diff --git a/xc/lib/FS/FSFtNames.c b/xc/lib/FS/FSFtNames.c
deleted file mode 100644
index b7c9d8a85..000000000
--- a/xc/lib/FS/FSFtNames.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $TOG: FSFtNames.c /main/7 1998/05/01 11:34:42 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 "FSlibint.h"
-
-char **
-FSListFonts(svr, pattern, maxNames, actualCount)
- FSServer *svr;
- char *pattern;
- int maxNames;
- int *actualCount;
-{
- long nbytes;
- int i,
- length;
- char **flist;
- char *c;
- fsListFontsReply rep;
- fsListFontsReq *req;
- long rlen;
-
- GetReq(ListFonts, req);
- req->maxNames = maxNames;
- nbytes = req->nbytes = pattern ? strlen(pattern) : 0;
- req->length += (nbytes + 3) >> 2;
- _FSSend(svr, pattern, nbytes);
- if (!_FSReply(svr, (fsReply *) & rep,
- (SIZEOF(fsListFontsReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse))
- return (char **) 0;
-
- if (rep.nFonts) {
- flist = (char **) FSmalloc((unsigned) rep.nFonts * sizeof(char *));
- rlen = (rep.length << 2) - SIZEOF(fsListFontsReply);
- c = (char *) FSmalloc((unsigned) (rlen + 1));
-
- if ((!flist) || (!c)) {
- if (flist)
- FSfree((char *) flist);
- if (c)
- FSfree(c);
- _FSEatData(svr, (unsigned long) rlen);
- SyncHandle();
- return (char **) NULL;
- }
- _FSReadPad(svr, c, rlen);
- /* unpack */
- length = *(unsigned char *)c;
- for (i = 0; i < rep.nFonts; i++) {
- flist[i] = c + 1;
- c += length + 1;
- length = *(unsigned char *)c;
- *c = '\0';
- }
- } else {
-
- flist = (char **) NULL;
- }
-
- *actualCount = rep.nFonts;
- SyncHandle();
- return flist;
-
-}
-
-int FSFreeFontNames(list)
- char **list;
-{
- if (list) {
- FSfree(list[0] - 1);
- FSfree((char *) list);
- }
- return 1;
-}
diff --git a/xc/lib/FS/FSGetCats.c b/xc/lib/FS/FSGetCats.c
deleted file mode 100644
index 84687abc0..000000000
--- a/xc/lib/FS/FSGetCats.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $TOG: FSGetCats.c /main/4 1998/02/06 13:42:48 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-char **
-FSGetCatalogues(svr, num)
- FSServer *svr;
- int *num;
-{
- fsGetCataloguesReply rep;
- char **list;
- char *c;
- int i,
- length;
- fsReq *req;
- long rlen;
-
- GetEmptyReq(GetCatalogues, req);
-
- if (!_FSReply(svr, (fsReply *) & rep, 0, fsFalse)) {
- SyncHandle();
- return (char **) NULL;
- }
- if (rep.num_catalogues) {
- list = (char **)
- FSmalloc((unsigned) (rep.num_catalogues * sizeof(char *)));
- rlen = (rep.length << 2) - SIZEOF(fsGetCataloguesReply);
- c = (char *) FSmalloc((unsigned) rlen + 1);
- if ((!list) || (!c)) {
- if (list)
- FSfree((char *) list);
- if (c)
- FSfree(c);
- _FSEatData(svr, (unsigned long) rlen);
- SyncHandle();
- return (char **) NULL;
- }
- _FSReadPad(svr, c, rlen);
- /*
- * unpack the strings
- */
- length = *c;
- for (i = 0; i < (int)rep.num_catalogues; i++) {
- list[i] = c + 1; /* skip length */
- c += length + 1; /* find next length */
- length = *c;
- *c = '\0'; /* change length to NULL */
- }
- } else {
- list = (char **) NULL;
- }
- SyncHandle();
- *num = rep.num_catalogues;
- return list;
-}
diff --git a/xc/lib/FS/FSListCats.c b/xc/lib/FS/FSListCats.c
deleted file mode 100644
index b1520a9b7..000000000
--- a/xc/lib/FS/FSListCats.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $TOG: FSListCats.c /main/6 1998/05/01 12:58:31 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-char **
-FSListCatalogues(svr, pattern, maxNames, actualCount)
- FSServer *svr;
- char *pattern;
- int maxNames;
- int *actualCount;
-{
- long nbytes;
- int i,
- length;
- char **clist;
- char *c;
- fsListCataloguesReply rep;
- fsListCataloguesReq *req;
- long rlen;
-
- GetReq(ListCatalogues, req);
- req->maxNames = maxNames;
- nbytes = req->nbytes = pattern ? strlen(pattern) : 0;
- req->length += (nbytes + 3) >> 2;
- _FSSend(svr, pattern, nbytes);
- if (!_FSReply(svr, (fsReply *) & rep,
- (SIZEOF(fsListCataloguesReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse))
- return (char **) 0;
-
- if (rep.num_catalogues) {
- clist = (char **)
- FSmalloc((unsigned) rep.num_catalogues * sizeof(char *));
- rlen = (rep.length << 2) - SIZEOF(fsListCataloguesReply);
- c = (char *) FSmalloc((unsigned) (rlen + 1));
-
- if ((!clist) || (!c)) {
- if (clist)
- FSfree((char *) clist);
- if (c)
- FSfree(c);
- _FSEatData(svr, (unsigned long) rlen);
- SyncHandle();
- return (char **) NULL;
- }
- _FSReadPad(svr, c, rlen);
- /* unpack */
- length = *c;
- for (i = 0; i < rep.num_catalogues; i++) {
- clist[i] = c + 1;
- c += length + 1;
- length = *c;
- *c = '\0';
- }
- } else {
-
- clist = (char **) NULL;
- }
-
- *actualCount = rep.num_catalogues;
- SyncHandle();
- return clist;
-
-}
-
-int FSFreeCatalogues(list)
- char **list;
-{
- if (list) {
- FSfree(list[0] - 1);
- FSfree((char *) list);
- }
- return 1;
-}
diff --git a/xc/lib/FS/FSListExt.c b/xc/lib/FS/FSListExt.c
deleted file mode 100644
index f781a54e0..000000000
--- a/xc/lib/FS/FSListExt.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $TOG: FSListExt.c /main/7 1998/05/01 11:34:51 kaleb $ */
-
-/* @(#)FSListExt.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 "FSlibint.h"
-
-char **
-FSListExtensions(svr, next)
- FSServer *svr;
- int *next;
-{
- fsListExtensionsReply rep;
- char **list;
- char *c;
- int i,
- length;
- fsReq *req;
- long rlen;
-
- GetEmptyReq(ListExtensions, req);
-
- if (!_FSReply(svr, (fsReply *) & rep, 0, fsFalse)) {
- SyncHandle();
- return (char **) NULL;
- }
- if (rep.nExtensions) {
- list = (char **) FSmalloc((unsigned)(rep.nExtensions * sizeof(char *)));
- rlen = (rep.length << 2) - SIZEOF(fsListExtensionsReply);
- c = (char *) FSmalloc((unsigned) rlen + 1);
- if ((!list) || (!c)) {
- if (list)
- FSfree((char *) list);
- if (c)
- FSfree(c);
- _FSEatData(svr, (unsigned long) rlen);
- SyncHandle();
- return (char **) NULL;
- }
- _FSReadPad(svr, c, rlen);
- /*
- * unpack the strings
- */
- length = *c;
- for (i = 0; i < rep.nExtensions; i++) {
- list[i] = c + 1; /* skip length */
- c += length + 1; /* find next length */
- length = *c;
- *c = '\0'; /* change length to NULL */
- }
- } else {
- list = (char **) NULL;
- }
- SyncHandle();
- *next = rep.nExtensions;
- return list;
-
-}
-
-int FSFreeExtensionList(list)
- char **list;
-{
- if (list != NULL) {
- FSfree(list[0] - 1);
- FSfree((char *) list);
- }
- return 1;
-}
diff --git a/xc/lib/FS/FSMisc.c b/xc/lib/FS/FSMisc.c
deleted file mode 100644
index 721c6c30a..000000000
--- a/xc/lib/FS/FSMisc.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $TOG: FSMisc.c /main/5 1998/02/06 13:43:27 kaleb $ */
-
-/* @(#)FSMisc.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 "FSlibint.h"
-
-long
-FSMaxRequestSize(svr)
- FSServer *svr;
-{
- return svr->max_request_size;
-}
diff --git a/xc/lib/FS/FSNextEv.c b/xc/lib/FS/FSNextEv.c
deleted file mode 100644
index 131397e34..000000000
--- a/xc/lib/FS/FSNextEv.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $TOG: FSNextEv.c /main/7 1998/05/01 11:34:56 kaleb $ */
-
-/* @(#)FSNextEv.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 "FSlibint.h"
-
-extern _FSQEvent *_FSqfree;
-
-int FSNextEvent(svr, event)
- FSServer *svr;
- FSEvent *event;
-{
- _FSQEvent *qelt;
-
- if (svr->head == NULL)
- _FSReadEvents(svr);
- qelt = svr->head;
- *event = qelt->event;
-
- if ((svr->head = qelt->next) == NULL)
- svr->tail = NULL;
- qelt->next = _FSqfree;
- _FSqfree = qelt;
- svr->qlen--;
-
- return 1;
-}
diff --git a/xc/lib/FS/FSOpenFont.c b/xc/lib/FS/FSOpenFont.c
deleted file mode 100644
index 341d2dc31..000000000
--- a/xc/lib/FS/FSOpenFont.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $TOG: FSOpenFont.c /main/8 1998/05/17 16:30:48 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSOpenFont.c,v 1.4 1999/02/25 06:00:55 dawes Exp $ */
-
-/*
-
-Copyright 1987, 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 "FSlibint.h"
-
-Font
-FSOpenBitmapFont(svr, hint, fmask, name, otherid)
- FSServer *svr;
- FSBitmapFormat hint;
- FSBitmapFormatMask fmask;
- char *name;
- Font *otherid;
-{
- unsigned char nbytes;
- fsOpenBitmapFontReq *req;
- fsOpenBitmapFontReply reply;
- Font fid;
- char buf[256];
-
- nbytes = name ? strlen(name) : 0;
- if (nbytes > 255) return 0;
- GetReq(OpenBitmapFont, req);
- buf[0] = nbytes;
- memcpy(&buf[1], name, nbytes);
- nbytes++;
- req->fid = fid = svr->resource_id++;
- req->format_hint = hint;
- req->format_mask = fmask;
- req->length += (nbytes + 3) >> 2;
- _FSSend(svr, buf, (long) nbytes);
- if (!_FSReply(svr, (fsReply *) & reply,
- (SIZEOF(fsOpenBitmapFontReply)-SIZEOF(fsGenericReply)) >> 2,
- fsFalse))
- return 0;
- *otherid = reply.otherid;
- SyncHandle();
- return fid;
-}
diff --git a/xc/lib/FS/FSOpenServ.c b/xc/lib/FS/FSOpenServ.c
deleted file mode 100644
index 9c4943347..000000000
--- a/xc/lib/FS/FSOpenServ.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* $TOG: FSOpenServ.c /main/8 1998/05/01 11:35:00 kaleb $ */
-
-/* @(#)FSOpenServ.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSOpenServ.c,v 1.3 1999/02/20 15:07:13 hohndel Exp $ */
-
-/*
-
-Copyright 1987, 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.
-
-*/
-
-/*
- * does initial handshake w/ font server
- */
-
-#include <stdio.h>
-#include "FSlibint.h"
-#include <X11/Xtrans.h>
-
-int _FSdebug = 0;
-
-static fsReq _dummy_request = {
- 0, 0, 0
-};
-
-static void OutOfMemory ( FSServer *svr, char *setup );
-
-FSServer *_FSHeadOfServerList = NULL;
-
-void _FSFreeServerStructure(svr)
- FSServer *svr;
-{
- if (svr->server_name)
- FSfree(svr->server_name);
- if (svr->vendor)
- FSfree(svr->vendor);
-
- if (svr->buffer)
- FSfree(svr->buffer);
-
- FSfree((char *) svr);
-}
-
-static
-void OutOfMemory(svr, setup)
- FSServer *svr;
- char *setup;
-{
-
- _FSDisconnectServer(svr->trans_conn);
- _FSFreeServerStructure(svr);
- FSfree(setup);
- errno = ENOMEM;
-}
-
-/*
- * connects to a server, makes a FSServer object and returns a pointer
- * to it
- */
-
-FSServer *
-FSOpenServer(server)
- char *server;
-{
- FSServer *svr;
- int i;
- int endian;
- fsConnClientPrefix client;
- fsConnSetup prefix;
- char *setup;
- fsConnSetupAccept conn;
- char *auth_data;
- char *alt_data,
- *ad;
- AlternateServer *alts;
- int altlen;
- char *vendor_string;
- long setuplength;
-#ifdef X_NOT_STDC_ENV
- extern char *getenv();
-#endif
-
- if (server == NULL || *server == '\0') {
- if ((server = getenv("FONTSERVER")) == NULL) {
- return (FSServer *) NULL;
- }
- }
-
- if ((svr = (FSServer *) FScalloc(1, sizeof(FSServer))) == NULL) {
- errno = ENOMEM;
- return (FSServer *) NULL;
- }
- if ((svr->trans_conn = _FSConnectServer(server)) == NULL) {
- FSfree((char *) svr);
- return (FSServer *) NULL;
- }
-
- svr->fd = _FSTransGetConnectionNumber (svr->trans_conn);
-
- endian = 1;
- if (*(char *) &endian)
- client.byteOrder = 'l';
- else
- client.byteOrder = 'B';
- client.major_version = FS_PROTOCOL;
- client.minor_version = FS_PROTOCOL_MINOR;
-/* XXX -- fix this when we have some auths */
- client.num_auths = 0;
- client.auth_len = 0;
- _FSSendClientPrefix(svr, &client);
-
-/* see if connection was accepted */
- _FSRead(svr, (char *) &prefix, (long) SIZEOF(fsConnSetup));
-
- setuplength = prefix.alternate_len << 2;
- if ((alt_data = (char *)
- (setup = FSmalloc((unsigned) setuplength))) == NULL) {
- errno = ENOMEM;
- FSfree((char *) svr);
- return (FSServer *) NULL;
- }
- _FSRead(svr, (char *) alt_data, setuplength);
- ad = alt_data;
-
- alts = (AlternateServer *)
- FSmalloc(sizeof(AlternateServer) * prefix.num_alternates);
- if (!alts) {
- errno = ENOMEM;
- FSfree((char *) svr);
- return (FSServer *) 0;
- }
- for (i = 0; i < prefix.num_alternates; i++) {
- alts[i].subset = (Bool) *ad++;
- altlen = (int) *ad++;
- alts[i].name = (char *) FSmalloc(altlen + 1);
- if (!alts[i].name) {
- while (--i) {
- FSfree((char *) alts[i].name);
- }
- FSfree((char *) alts);
- FSfree((char *) alt_data);
- FSfree((char *) svr);
- errno = ENOMEM;
- return (FSServer *) 0;
- }
- bcopy(ad, alts[i].name, altlen);
- alts[i].name[altlen] = '\0';
- ad += altlen + ((4 - (altlen + 2)) & 3);
- }
- FSfree((char *) alt_data);
-
- svr->alternate_servers = alts;
- svr->num_alternates = prefix.num_alternates;
-
- setuplength = prefix.auth_len << 2;
- if ((auth_data = (char *)
- (setup = FSmalloc((unsigned) setuplength))) == NULL) {
- errno = ENOMEM;
- FSfree((char *) svr);
- return (FSServer *) NULL;
- }
- _FSRead(svr, (char *) auth_data, setuplength);
-
- if (prefix.status != AuthSuccess) {
- fprintf(stderr, "%s: connection to \"%s\" refused by server\r\n%s: ",
- "FSlib", server, "FSlib");
- FSfree((char *) svr);
- FSfree(setup);
- return (FSServer *) NULL;
- }
- /* get rest */
- _FSRead(svr, (char *) &conn, (long) SIZEOF(fsConnSetupAccept));
-
- if ((vendor_string = (char *)
- FSmalloc((unsigned) conn.vendor_len + 1)) == NULL) {
- errno = ENOMEM;
- FSfree((char *) svr);
- return (FSServer *) NULL;
- }
- _FSReadPad(svr, (char *) vendor_string, conn.vendor_len);
-
- /* move the data into the FSServer struct */
- svr->next = (FSServer *) NULL;
- svr->proto_version = prefix.major_version;
- svr->release = conn.release_number;
- svr->max_request_size = conn.max_request_len;
-
- svr->event_vec[FS_Error] = _FSUnknownWireEvent;
- svr->event_vec[FS_Reply] = _FSUnknownWireEvent;
- svr->wire_vec[FS_Error] = _FSUnknownNativeEvent;
- svr->wire_vec[FS_Reply] = _FSUnknownNativeEvent;
- for (i = FSLASTEvent; i < 128; i++) {
- svr->event_vec[i] = _FSUnknownWireEvent;
- svr->wire_vec[i] = _FSUnknownNativeEvent;
- }
- svr->resource_id = 1;
-
- svr->vendor = vendor_string;
- svr->vendor[conn.vendor_len] = '\0';
-
- svr->vnumber = FS_PROTOCOL;
- svr->request = 0;
- svr->last_request_read = 0;
- svr->last_req = (char *) &_dummy_request;
-
- if ((svr->server_name = FSmalloc((unsigned) (strlen(server) + 1)))
- == NULL) {
- OutOfMemory(svr, setup);
- return (FSServer *) NULL;
- }
- (void) strcpy(svr->server_name, server);
-
- /* setup the output buffers */
- if ((svr->bufptr = svr->buffer = FSmalloc(BUFSIZE)) == NULL) {
- OutOfMemory(svr, setup);
- return (FSServer *) NULL;
- }
- svr->bufmax = svr->buffer + BUFSIZE;
-
- /* set up input event queue */
- svr->head = svr->tail = NULL;
- svr->qlen = 0;
-
- FSfree(setup);
-
- (void) FSSynchronize(svr, _FSdebug);
-
- svr->next = _FSHeadOfServerList;
- _FSHeadOfServerList = svr;
-
- return (svr);
-}
-
diff --git a/xc/lib/FS/FSQGlyphs.c b/xc/lib/FS/FSQGlyphs.c
deleted file mode 100644
index 7155926d0..000000000
--- a/xc/lib/FS/FSQGlyphs.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* $TOG: FSQGlyphs.c /main/7 1998/02/06 13:43:46 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-int
-FSQueryXBitmaps8(svr, fid, format, range_type, str, str_len, offsets, glyphdata)
- FSServer *svr;
- Font fid;
- FSBitmapFormat format;
- Bool range_type;
- unsigned char *str;
- unsigned long str_len;
- FSOffset **offsets;
- unsigned char **glyphdata;
-{
- fsQueryXBitmaps8Req *req;
- fsQueryXBitmaps8Reply reply;
- FSOffset *offs;
- fsOffset32 local_offs;
- unsigned char *gd;
- int left;
- int i;
-
- GetReq(QueryXBitmaps8, req);
- req->fid = fid;
- req->range = range_type;
- req->format = format;
- req->num_ranges = str_len;
- req->length += (str_len + 3) >> 2;
- _FSSend(svr, (char *) str, str_len);
-
- /* get back the info */
- if (!_FSReply(svr, (fsReply *) & reply,
- (SIZEOF(fsQueryXBitmaps8Reply) - SIZEOF(fsGenericReply)) >> 2, fsFalse))
- return FSBadAlloc;
-
- offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars);
- *offsets = offs;
- if (!offs)
- return FSBadAlloc;
- left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps8Reply)
- - (SIZEOF(fsOffset32) * reply.num_chars);
- gd = (unsigned char *) FSmalloc(left);
- *glyphdata = gd;
- if (!gd) {
- FSfree((char *) offs);
- return FSBadAlloc;
- }
- for (i=0; i<reply.num_chars; i++)
- {
- _FSReadPad(svr, (char *) &local_offs, (SIZEOF(fsOffset32)));
- offs->position = local_offs.position;
- offs->length = local_offs.length;
- offs++;
- }
- _FSReadPad(svr, (char *) gd, left);
-
- SyncHandle();
- return FSSuccess;
-}
-
-int
-FSQueryXBitmaps16(svr, fid, format, range_type, str, str_len,
- offsets, glyphdata)
- FSServer *svr;
- Font fid;
- FSBitmapFormat format;
- Bool range_type;
- FSChar2b *str;
- unsigned long str_len;
- FSOffset **offsets;
- unsigned char **glyphdata;
-{
- fsQueryXBitmaps16Req *req;
- fsQueryXBitmaps16Reply reply;
- FSOffset *offs;
- fsOffset32 local_offs;
- unsigned char *gd;
- int left;
- int i;
-
- GetReq(QueryXBitmaps16, req);
- req->fid = fid;
- req->range = range_type;
- req->format = format;
- req->num_ranges = str_len;
- req->length += ((str_len * SIZEOF(fsChar2b)) + 3) >> 2;
- if (FSProtocolVersion(svr) == 1)
- {
- int i;
- fsChar2b_version1 *swapped_str;
-
- swapped_str = (fsChar2b_version1 *)
- FSmalloc(SIZEOF(fsChar2b_version1) * str_len);
- if (!swapped_str)
- return FSBadAlloc;
- for (i = 0; i < str_len; i++) {
- swapped_str[i].low = str[i].low;
- swapped_str[i].high = str[i].high;
- }
- _FSSend(svr, (char *)swapped_str, (str_len*SIZEOF(fsChar2b_version1)));
- FSfree(swapped_str);
- } else
- _FSSend(svr, (char *) str, (str_len * SIZEOF(fsChar2b)));
-
- /* get back the info */
- if (!_FSReply(svr, (fsReply *) & reply,
- (SIZEOF(fsQueryXBitmaps16Reply) - SIZEOF(fsGenericReply)) >> 2,
- fsFalse))
- return FSBadAlloc;
-
- offs = (FSOffset *) FSmalloc(sizeof(FSOffset) * reply.num_chars);
- *offsets = offs;
- if (!offs)
- return FSBadAlloc;
- left = (reply.length << 2) - SIZEOF(fsQueryXBitmaps16Reply)
- - (SIZEOF(fsOffset32) * reply.num_chars);
- gd = (unsigned char *) FSmalloc(left);
- *glyphdata = gd;
- if (!gd) {
- FSfree((char *) offs);
- return FSBadAlloc;
- }
- for (i=0; i<reply.num_chars; i++)
- {
- _FSReadPad(svr, (char *) &local_offs, (SIZEOF(fsOffset32)));
- offs->position = local_offs.position;
- offs->length = local_offs.length;
- offs++;
- }
- _FSReadPad(svr, (char *) gd, left);
-
- SyncHandle();
- return FSSuccess;
-}
diff --git a/xc/lib/FS/FSQXExt.c b/xc/lib/FS/FSQXExt.c
deleted file mode 100644
index fc4375f45..000000000
--- a/xc/lib/FS/FSQXExt.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $TOG: FSQXExt.c /main/7 1998/02/06 13:43:56 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSQXExt.c,v 1.3 1999/02/20 15:07:13 hohndel 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.
-
-*/
-
-#include "FSlibint.h"
-
-static void
-_FS_convert_char_info(fsXCharInfo *src, FSXCharInfo *dst)
-{
- dst->ascent = src->ascent;
- dst->descent = src->descent;
- dst->left = src->left;
- dst->right = src->right;
- dst->width = src->width;
- dst->attributes = src->attributes;
-}
-
-int
-FSQueryXExtents8(svr, fid, range_type, str, str_len, extents)
- FSServer *svr;
- Font fid;
- Bool range_type;
- unsigned char *str;
- unsigned long str_len;
- FSXCharInfo **extents;
-{
- fsQueryXExtents8Req *req;
- fsQueryXExtents8Reply reply;
- FSXCharInfo *ext;
- fsXCharInfo local_exts;
- int i;
-
- GetReq(QueryXExtents8, req);
- req->fid = fid;
- req->range = range_type;
- req->num_ranges = str_len;
- req->length += (str_len + 3) >> 2;
- _FSSend(svr, (char *) str, str_len);
-
- /* get back the info */
- if (!_FSReply(svr, (fsReply *) & reply,
- (SIZEOF(fsQueryXExtents8Reply) - SIZEOF(fsGenericReply)) >> 2,
- fsFalse))
- return FSBadAlloc;
-
- ext = (FSXCharInfo *) FSmalloc(sizeof(FSXCharInfo) * reply.num_extents);
- *extents = ext;
- if (!ext)
- return FSBadAlloc;
- for (i = 0; i < reply.num_extents; i++) {
- _FSReadPad(svr, (char *) &local_exts, SIZEOF(fsXCharInfo));
- _FS_convert_char_info(&local_exts, &ext[i]);
- }
-
- SyncHandle();
- return FSSuccess;
-}
-
-int
-FSQueryXExtents16(svr, fid, range_type, str, str_len, extents)
- FSServer *svr;
- Font fid;
- Bool range_type;
- FSChar2b *str;
- unsigned long str_len;
- FSXCharInfo **extents;
-{
- fsQueryXExtents16Req *req;
- fsQueryXExtents16Reply reply;
- FSXCharInfo *ext;
- fsXCharInfo local_exts;
- int i;
-
- GetReq(QueryXExtents16, req);
- req->fid = fid;
- req->range = range_type;
- req->num_ranges = str_len;
- req->length += ((str_len * SIZEOF(fsChar2b)) + 3) >> 2;
- if (FSProtocolVersion(svr) == 1)
- {
- fsChar2b_version1 *swapped_str;
-
- swapped_str = (fsChar2b_version1 *)
- FSmalloc(SIZEOF(fsChar2b_version1) * str_len);
- if (!swapped_str)
- return FSBadAlloc;
- for (i = 0; i < str_len; i++) {
- swapped_str[i].low = str[i].low;
- swapped_str[i].high = str[i].high;
- }
- _FSSend(svr, (char *)swapped_str, (str_len*SIZEOF(fsChar2b_version1)));
- FSfree(swapped_str);
- } else
- _FSSend(svr, (char *) str, (str_len * SIZEOF(fsChar2b)));
-
- /* get back the info */
- if (!_FSReply(svr, (fsReply *) & reply,
- (SIZEOF(fsQueryXExtents16Reply) - SIZEOF(fsGenericReply)) >> 2,
- fsFalse))
- return FSBadAlloc;
-
- ext = (FSXCharInfo *) FSmalloc(sizeof(FSXCharInfo) * reply.num_extents);
- *extents = ext;
- if (!ext)
- return FSBadAlloc;
- for (i = 0; i < reply.num_extents; i++) {
- _FSReadPad(svr, (char *) &local_exts, SIZEOF(fsXCharInfo));
- _FS_convert_char_info(&local_exts, &ext[i]);
- }
-
- SyncHandle();
- return FSSuccess;
-}
diff --git a/xc/lib/FS/FSQXInfo.c b/xc/lib/FS/FSQXInfo.c
deleted file mode 100644
index 67c6ff50e..000000000
--- a/xc/lib/FS/FSQXInfo.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $TOG: FSQXInfo.c /main/6 1998/02/06 13:44:01 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-/*
- * Note: only the range in the first FSQuery is sent to the server.
- * the others exist as return values only.
- */
-
-int
-FSQueryXInfo(svr, fid, info, props, offsets, prop_data)
- FSServer *svr;
- Font fid;
- FSXFontInfoHeader *info;
- FSPropInfo *props;
- FSPropOffset **offsets;
- unsigned char **prop_data;
-{
- fsQueryXInfoReq *req;
- fsQueryXInfoReply reply;
- FSPropOffset *offset_data;
- unsigned char *pdata;
- fsPropInfo local_pi;
- fsPropOffset local_po;
- int j;
-
- GetReq(QueryXInfo, req);
- req->id = fid;
-
- /* get back the info */
- if (!_FSReply(svr, (fsReply *) & reply, ((SIZEOF(fsQueryXInfoReply) -
- SIZEOF(fsGenericReply)) >> 2), fsFalse)) {
- return FSBadAlloc;
- }
-
- FSUnpack_XFontInfoHeader(&reply, info, FSProtocolVersion(svr));
-
- /* get the prop header */
- _FSReadPad(svr, (char *) &local_pi, SIZEOF(fsPropInfo));
- props->num_offsets = local_pi.num_offsets;
- props->data_len = local_pi.data_len;
-
- /* prepare for prop data */
- offset_data = (FSPropOffset *)
- FSmalloc(props->num_offsets * sizeof(FSPropOffset));
- if (!offset_data)
- return FSBadAlloc;
- pdata = (unsigned char *) FSmalloc(props->data_len);
- if (!pdata) {
- FSfree((char *) offset_data);
- return FSBadAlloc;
- }
- /* get offsets */
- for (j=0; j<props->num_offsets; j++)
- {
- _FSReadPad(svr, (char *) &local_po, SIZEOF(fsPropOffset));
- offset_data[j].name.position = local_po.name.position;
- offset_data[j].name.length = local_po.name.length;
- offset_data[j].value.position = local_po.value.position;
- offset_data[j].value.length = local_po.value.length;
- offset_data[j].type = local_po.type;
- }
-
- /* get data */
- _FSReadPad(svr, (char *) pdata, props->data_len);
- *offsets = offset_data;
- *prop_data = pdata;
-
- SyncHandle();
- return FSSuccess;
-}
diff --git a/xc/lib/FS/FSQuExt.c b/xc/lib/FS/FSQuExt.c
deleted file mode 100644
index 0710a33a8..000000000
--- a/xc/lib/FS/FSQuExt.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $TOG: FSQuExt.c /main/5 1998/02/06 13:43:52 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-Bool
-FSQueryExtension(svr, name, major_opcode, first_event, first_error)
- FSServer *svr;
- char *name;
- int *major_opcode;
- int *first_event;
- int *first_error;
-{
- fsQueryExtensionReply rep;
- fsQueryExtensionReq *req;
-
- GetReq(QueryExtension, req);
- req->nbytes = name ? strlen(name) : 0;
- req->length += (req->nbytes + 3) >> 2;
- _FSSend(svr, name, (long) req->nbytes);
- if (!_FSReply(svr, (fsReply *) & rep,
- (SIZEOF(fsQueryExtensionReply) - SIZEOF(fsGenericReply)) >> 2, fsFalse))
- return FSBadAlloc;
- *major_opcode = rep.major_opcode;
- *first_event = rep.first_event;
- *first_error = rep.first_error;
- SyncHandle();
- return (rep.present);
-}
diff --git a/xc/lib/FS/FSServName.c b/xc/lib/FS/FSServName.c
deleted file mode 100644
index b966470f7..000000000
--- a/xc/lib/FS/FSServName.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $TOG: FSServName.c /main/6 1998/02/06 13:44:07 kaleb $ */
-
-/* @(#)FSServName.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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 <stdio.h>
-
-#include <X11/Xosdefs.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-char *getenv();
-#endif
-
-char *
-FSServerName(server)
- char *server;
-{
- char *s;
-
- if (server != NULL && *server != '\0')
- return server;
- if ((s = getenv("FONTSERVER")) != NULL)
- return s;
- return NULL;
-}
diff --git a/xc/lib/FS/FSSetCats.c b/xc/lib/FS/FSSetCats.c
deleted file mode 100644
index 6a8d8f43f..000000000
--- a/xc/lib/FS/FSSetCats.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $TOG: FSSetCats.c /main/5 1998/05/17 16:30:54 kaleb $ */
-
-/* @(#)FSFlush.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSSetCats.c,v 1.3 1999/03/14 03:20:36 dawes Exp $ */
-
-/*
-
-Copyright 1987, 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 "FSlibint.h"
-
-int
-FSSetCatalogues(svr, num, cats)
- FSServer *svr;
- int num;
- char **cats;
-{
- int nbytes;
- fsSetCataloguesReq *req;
- char buf[256];
- int i;
- int len, tlen, tnum;
-
- for (i = 0, tnum = 0, len = 0; i < num; i++) {
- if ((tlen = strlen(cats[i])) < 256) {
- len += tlen;
- tnum++;
- }
- }
-
- GetReq(SetCatalogues, req);
- req->num_catalogues = tnum;
- req->length += (len + 3) >> 2;
-
- for (i = 0; i < num; i++) {
- nbytes = strlen(cats[i]);
- if (nbytes < 256) {
- buf[0] = nbytes;
- memcpy(&buf[1], cats[i], nbytes);
- nbytes++;
- _FSSend(svr, buf, (long) nbytes);
- }
- }
- SyncHandle();
- return FSSuccess;
-}
diff --git a/xc/lib/FS/FSSync.c b/xc/lib/FS/FSSync.c
deleted file mode 100644
index 4f82c97dc..000000000
--- a/xc/lib/FS/FSSync.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $TOG: FSSync.c /main/7 1998/05/01 11:35:05 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "FSlibint.h"
-
-extern _FSQEvent *_FSqfree;
-
-/* synchronize with errors and events */
-
-int FSSync(svr, discard)
- FSServer *svr;
- Bool discard;
-{
- fsListExtensionsReply rep;
- fsReq *req;
-
- GetEmptyReq(ListExtensions, req);
- (void) _FSReply(svr, (fsReply *) & rep, 0, fsTrue);
-
- if (discard && svr->head) {
- ((_FSQEvent *) svr->tail)->next = _FSqfree;
- _FSqfree = (_FSQEvent *) svr->head;
- svr->head = svr->tail = NULL;
- svr->qlen = 0;
- }
-
- return 1;
-}
diff --git a/xc/lib/FS/FSSynchro.c b/xc/lib/FS/FSSynchro.c
deleted file mode 100644
index fee61bc77..000000000
--- a/xc/lib/FS/FSSynchro.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $TOG: FSSynchro.c /main/7 1998/05/01 12:50:38 kaleb $ */
-
-/* @(#)FSSynchro.c 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSSynchro.c,v 1.3 1999/02/20 15:07:13 hohndel Exp $ */
-
-/*
-
-Copyright 1987, 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 "FSlib.h"
-#include "FSlibint.h"
-
-static int
-_FSSyncFunction(FSServer *svr)
-{
-
- return FSSync(svr, 0);
-}
-
-FSSyncHandler
-FSSynchronize(FSServer *svr, int onoff)
-{
- FSSyncHandler temp;
-
- temp = svr->synchandler;
- if (onoff)
- svr->synchandler = _FSSyncFunction;
- else
- svr->synchandler = NULL;
- return temp;
-}
-
-FSSyncHandler
-FSSetAfterFunction(svr, func)
- FSServer *svr;
- FSSyncHandler func;
-{
- FSSyncHandler temp;
-
- temp = svr->synchandler;
- svr->synchandler = func;
- return temp;
-}
diff --git a/xc/lib/FS/FSlib.h b/xc/lib/FS/FSlib.h
deleted file mode 100644
index 0bdd39b4e..000000000
--- a/xc/lib/FS/FSlib.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $TOG: FSlib.h /main/10 1998/02/06 13:43:12 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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/lib/FS/FSlib.h,v 1.3 1999/02/20 15:07:14 hohndel Exp $ */
-
-/*
-
-Copyright 1987, 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.
-
-*/
-
-/*
- * Font server C interface library
- */
-
-#ifndef _FSLIB_H_
-#define _FSLIB_H_
-
-#include <FS.h>
-#include <FSproto.h>
-
-#define Bool int
-#define Status int
-#define True 1
-#define False 0
-
-#define QueuedAlready 0
-#define QueuedAfterReading 1
-#define QueuedAfterFlush 2
-
-#define FSServerString(svr) ((svr)->server_name)
-#define FSVendorRelease(svr) ((svr)->release)
-#define FSProtocolVersion(svr) ((svr)->proto_version)
-#define FSServerVendor(svr) ((svr)->vendor)
-#define FSAuthorizationData(svr) ((svr)->auth_data)
-#define FSAlternateServers(svr) ((svr)->alternate_servers)
-#define FSNumAlternateServers(svr) ((svr)->num_alternates)
-
-#ifdef QLength
-#undef QLength
-#endif
-#define QLength(svr) ((svr)->qlen)
-#ifdef NextRequest
-#undef NextRequest
-#endif
-#define NextRequest(svr) ((svr)->request + 1)
-#ifdef LastKnownRequestProcessed
-#undef LastKnownRequestProcessed
-#endif
-#define LastKnownRequestProcessed(svr) ((svr)->last_request_read)
-
-#define FSAllocID(svr) ((*(svr)->resource_alloc)((svr)))
-
-typedef struct _alternate {
- Bool subset;
- char *name;
-} AlternateServer;
-
-/* extension stuff */
-typedef struct _FSExtData {
- int number; /* number returned by FSRegisterExtension */
- struct _FSExtData *next; /* next item on list of data for structure */
- int (*free_private) (char *); /* called to free private storage */
- char *private_data; /* data private to this extension. */
-} FSExtData;
-
-
-typedef struct { /* public to extension, cannot be changed */
- int extension; /* extension number */
- int major_opcode; /* major op-code assigned by server */
- int first_event; /* first event number for the extension */
- int first_error; /* first error number for the extension */
-} FSExtCodes;
-
-typedef struct _FSServer FSServer;
-typedef union _FSEvent FSEvent;
-
-typedef struct _FSExtent {
- struct _FSExtent *next; /* next in list */
- FSExtCodes codes; /* public information, all extension told */
- int (*close_server) (FSServer *, FSExtCodes *); /* routine to call when connection
- * closed */
- int (*error) (FSServer *, fsError *, FSExtCodes *, int *); /* who to call when an error occurs */
- int (*error_string) (FSServer *, int, FSExtCodes *, char *, int); /* routine to supply error string */
- char *name;
-} _FSExtension;
-
-typedef int (*FSSyncHandler)(FSServer *);
-
-/* server data structure */
-struct _FSServer {
- struct _FSServer *next;
- int fd;
- int proto_version;
- char *vendor;
- int byte_order;
- int vnumber;
- int release;
- int resource_id;
- struct _FSQEvent *head,
- *tail;
- int qlen;
- unsigned long last_request_read;
- unsigned long request;
- char *last_req;
- char *buffer;
- char *bufptr;
- char *bufmax;
- unsigned max_request_size;
- char *server_name;
- char *auth_data;
- AlternateServer *alternate_servers;
- int num_alternates;
- FSExtData *ext_data;
- _FSExtension *ext_procs;
- int ext_number;
- Bool (*event_vec[132]) (FSServer *, FSEvent *, fsEvent *);
- Status (*wire_vec[132]) (FSServer *, FSEvent *, fsEvent *);
- char *scratch_buffer;
- unsigned long scratch_length;
- FSSyncHandler synchandler;
- unsigned long flags;
- struct _XtransConnInfo *trans_conn; /* transport connection object */
-};
-
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- FSServer *server;
-} FSAnyEvent;
-
-typedef struct {
- int type;
- FSServer *server;
- FSID resourceid;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
-} FSErrorEvent;
-
-union _FSEvent {
- int type;
- FSAnyEvent fsany;
-};
-
-typedef struct _FSQEvent {
- struct _FSQEvent *next;
- FSEvent event;
-} _FSQEvent;
-
-
-/* protocol-related stuctures */
-
-typedef unsigned long FSBitmapFormat;
-typedef unsigned long FSBitmapFormatMask;
-
-typedef struct _FSChar2b {
- unsigned char high;
- unsigned char low;
-} FSChar2b;
-
-typedef struct _FSRange {
- FSChar2b min_char;
- FSChar2b max_char;
-} FSRange;
-
-typedef struct _FSOffset {
- unsigned int position;
- unsigned int length;
-} FSOffset;
-
-/* use names as in xCharInfo? */
-typedef struct _FSXCharInfo {
- short left;
- short right;
- short width;
- short ascent;
- short descent;
- unsigned short attributes;
-} FSXCharInfo;
-
-typedef struct _FSPropOffset {
- FSOffset name;
- FSOffset value;
- unsigned char type;
-} FSPropOffset;
-
-typedef struct _FSPropInfo {
- unsigned int num_offsets;
- unsigned int data_len;
-} FSPropInfo;
-
-/* should names match FontInfoRec? */
-typedef struct _FSXFontInfoHeader {
- int flags;
- FSRange char_range;
- unsigned draw_direction;
- FSChar2b default_char;
- FSXCharInfo min_bounds;
- FSXCharInfo max_bounds;
- short font_ascent;
- short font_descent;
-} FSXFontInfoHeader;
-
-
-
-/* function decls */
-
-extern FSServer * FSOpenServer ( char *server );
-
-extern FSSyncHandler FSSynchronize(FSServer *, int);
-extern FSSyncHandler FSSetAfterFunction(FSServer *, FSSyncHandler);
-
-extern char * FSServerName ( char *server );
-extern char ** FSListExtensions ( FSServer *svr, int *next );
-extern int FSQueryExtension ( FSServer *svr, char *name, int *major_opcode,
- int *first_event, int *first_error );
-
-extern char ** FSListCatalogues ( FSServer *svr, char *pattern,
- int maxNames, int *actualCount );
-extern char ** FSGetCatalogues ( FSServer *svr, int *num );
-
-extern long FSMaxRequestSize ( FSServer *svr );
-
-extern char ** FSListFonts ( FSServer *svr, char *pattern, int maxNames,
- int *actualCount );
-extern char ** FSListFontsWithXInfo ( FSServer *svr, char *pattern,
- int maxNames, int *count,
- FSXFontInfoHeader ***info,
- FSPropInfo ***pprops,
- FSPropOffset ***offsets,
- unsigned char ***prop_data );
-extern Font FSOpenBitmapFont ( FSServer *svr, FSBitmapFormat hint,
- FSBitmapFormatMask fmask, char *name,
- Font *otherid );
-
-extern int FSSync ( FSServer *svr, Bool discard );
-
-extern int FSCloseServer ( FSServer *svr );
-extern int FSCloseFont ( FSServer *svr, Font fid );
-extern int FSGetErrorDatabaseText ( FSServer *svr, char *name, char *type,
- char *defaultp, char *buffer, int nbytes );
-extern int FSGetErrorText ( FSServer *svr, int code, char *buffer,
-
- int nbytes );
-extern int FSFlush ( FSServer *svr );
-extern int FSFreeFontNames ( char **list );
-extern int FSFreeCatalogues ( char **list );
-extern int FSFreeExtensionList ( char **list );
-extern int FSNextEvent ( FSServer *svr, FSEvent *event );
-extern int FSQueryXBitmaps8 ( FSServer *svr, Font fid, FSBitmapFormat format,
- int range_type, unsigned char *str,
- unsigned long str_len, FSOffset **offsets,
- unsigned char **glyphdata );
-extern int FSQueryXBitmaps16 ( FSServer *svr, Font fid, FSBitmapFormat format,
- int range_type, FSChar2b *str,
- unsigned long str_len, FSOffset **offsets,
- unsigned char **glyphdata );
-extern int FSQueryXExtents8 ( FSServer *svr, Font fid, int range_type,
- unsigned char *str, unsigned long str_len,
- FSXCharInfo **extents );
-extern int FSQueryXExtents16 ( FSServer *svr, Font fid, int range_type,
- FSChar2b *str, unsigned long str_len,
- FSXCharInfo **extents );
-extern int FSQueryXInfo ( FSServer *svr, Font fid, FSXFontInfoHeader *info,
- FSPropInfo *props, FSPropOffset **offsets,
- unsigned char **prop_data );
-extern int FSSetCatalogues ( FSServer *svr, int num, char **cats );
-extern int FSSync ( FSServer *svr, int discard );
-extern int FSFree ( char *data );
-extern unsigned char * FSMalloc ( unsigned size );
-
-
-#endif /* _FSLIB_H_ */
diff --git a/xc/lib/FS/FSlibInt.c b/xc/lib/FS/FSlibInt.c
deleted file mode 100644
index ccd13fac5..000000000
--- a/xc/lib/FS/FSlibInt.c
+++ /dev/null
@@ -1,1347 +0,0 @@
-/* $TOG: FSlibInt.c /main/23 1998/05/01 11:42:57 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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/lib/FS/FSlibInt.c,v 3.6 1999/02/25 06:00:56 dawes Exp $ */
-
-/*
- * FSlibInt.c - Internal support routines for the C subroutine
- * interface library (FSlib).
- */
-#include <stdio.h>
-#include "FSlibint.h"
-#include <X11/Xos.h>
-
-static void _EatData32 ( FSServer *svr, unsigned long n );
-static char * _SysErrorMsg ( int n );
-
-/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
- * systems are broken and return EWOULDBLOCK when they should return EAGAIN
- */
-#ifdef WIN32
-#define ETEST() (WSAGetLastError() == WSAEWOULDBLOCK)
-#else
-#if defined(EAGAIN) && defined(EWOULDBLOCK)
-#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK)
-#else
-#ifdef EAGAIN
-#define ETEST() (errno == EAGAIN)
-#else
-#define ETEST() (errno == EWOULDBLOCK)
-#endif
-#endif
-#endif
-#ifdef WIN32
-#define ECHECK(err) (WSAGetLastError() == err)
-#define ESET(val) WSASetLastError(val)
-#else
-#ifdef ISC
-#define ECHECK(err) ((errno == err) || ETEST())
-#else
-#define ECHECK(err) (errno == err)
-#endif
-#define ESET(val) errno = val
-#endif
-
-/*
- * The following routines are internal routines used by FSlib for protocol
- * packet transmission and reception.
- *
- * FSIOError(FSServer *) will be called if any sort of system call error occurs.
- * This is assumed to be a fatal condition, i.e., FSIOError should not return.
- *
- * FSError(FSServer *, FSErrorEvent *) will be called whenever an FS_Error event is
- * received. This is not assumed to be a fatal condition, i.e., it is
- * acceptable for this procedure to return. However, FSError should NOT
- * perform any operations (directly or indirectly) on the DISPLAY.
- *
- * Routines declared with a return type of 'Status' return 0 on failure,
- * and non 0 on success. Routines with no declared return type don't
- * return anything. Whenever possible routines that create objects return
- * the object they have created.
- */
-
-_FSQEvent *_FSqfree = NULL; /* NULL _FSQEvent. */
-
-static int padlength[4] = {0, 3, 2, 1};
-
- /*
- * lookup table for adding padding bytes to data that is read from or written
- * to the FS socket.
- */
-
-static fsReq _dummy_request = {
- 0, 0, 0
-};
-
-/*
- * _FSFlush - Flush the FS request buffer. If the buffer is empty, no
- * action is taken. This routine correctly handles incremental writes.
- * This routine may have to be reworked if int < long.
- */
-void
-_FSFlush(svr)
- register FSServer *svr;
-{
- register long size,
- todo;
- register int write_stat;
- register char *bufindex;
-
- size = todo = svr->bufptr - svr->buffer;
- bufindex = svr->bufptr = svr->buffer;
- /*
- * While write has not written the entire buffer, keep looping until the
- * entire buffer is written. bufindex will be incremented and size
- * decremented as buffer is written out.
- */
- while (size) {
- ESET(0);
- write_stat = _FSTransWrite(svr->trans_conn, bufindex, (int) todo);
- if (write_stat >= 0) {
- size -= write_stat;
- todo = size;
- bufindex += write_stat;
- } else if (ETEST()) {
- _FSWaitForWritable(svr);
-#ifdef SUNSYSV
- } else if (ECHECK(0)) {
- _FSWaitForWritable(svr);
-#endif
-
-#ifdef EMSGSIZE
- } else if (ECHECK(EMSGSIZE)) {
- if (todo > 1)
- todo >>= 1;
- else
- _FSWaitForWritable(svr);
-#endif
- } else {
- /* Write failed! */
- /* errno set by write system call. */
- (*_FSIOErrorFunction) (svr);
- }
- }
- svr->last_req = (char *) &_dummy_request;
-}
-
-int
-_FSEventsQueued(svr, mode)
- register FSServer *svr;
- int mode;
-{
- register BytesReadable_t len;
- BytesReadable_t pend;
- char buf[BUFSIZE];
- register fsReply *rep;
-
- if (mode == QueuedAfterFlush) {
- _FSFlush(svr);
- if (svr->qlen)
- return (svr->qlen);
- }
- if (_FSTransBytesReadable(svr->trans_conn, &pend) < 0)
- (*_FSIOErrorFunction) (svr);
- if ((len = pend) < SIZEOF(fsReply))
- return (svr->qlen); /* _FSFlush can enqueue events */
- else if (len > BUFSIZE)
- len = BUFSIZE;
- len /= SIZEOF(fsReply);
- pend = len * SIZEOF(fsReply);
- _FSRead(svr, buf, (long) pend);
-
- /* no space between comma and type or else macro will die */
- STARTITERATE(rep, fsReply, buf, (len > 0), len--) {
- if (rep->generic.type == FS_Error)
- _FSError(svr, (fsError *) rep);
- else /* must be an event packet */
- _FSEnq(svr, (fsEvent *) rep);
- }
- ENDITERATE
- return (svr->qlen);
-}
-
-/* _FSReadEvents - Flush the output queue,
- * then read as many events as possible (but at least 1) and enqueue them
- */
-void
-_FSReadEvents(svr)
- register FSServer *svr;
-{
- char buf[BUFSIZE];
- BytesReadable_t pend_not_register; /* because can't "&" a register
- * variable */
- register BytesReadable_t pend;
- register fsEvent *ev;
- Bool not_yet_flushed = True;
-
- do {
- /* find out how much data can be read */
- if (_FSTransBytesReadable(svr->trans_conn, &pend_not_register) < 0)
- (*_FSIOErrorFunction) (svr);
- pend = pend_not_register;
-
- /*
- * must read at least one fsEvent; if none is pending, then we'll just
- * flush and block waiting for it
- */
- if (pend < SIZEOF(fsEvent)) {
- pend = SIZEOF(fsEvent);
- /* don't flush until we block the first time */
- if (not_yet_flushed) {
- int qlen = svr->qlen;
-
- _FSFlush(svr);
- if (qlen != svr->qlen)
- return;
- not_yet_flushed = False;
- }
- }
- /* but we won't read more than the max buffer size */
- if (pend > BUFSIZE)
- pend = BUFSIZE;
-
- /* round down to an integral number of XReps */
- pend = (pend / SIZEOF(fsEvent)) * SIZEOF(fsEvent);
-
- _FSRead(svr, buf, (long)pend);
-
- /* no space between comma and type or else macro will die */
- STARTITERATE(ev, fsEvent, buf, (pend > 0),
- pend -= SIZEOF(fsEvent)) {
- if (ev->type == FS_Error)
- _FSError(svr, (fsError *) ev);
- else /* it's an event packet; enqueue it */
- _FSEnq(svr, ev);
- }
- ENDITERATE
- } while (svr->head == NULL);
-}
-
-/*
- * _FSRead - Read bytes from the socket taking into account incomplete
- * reads. This routine may have to be reworked if int < long.
- */
-void
-_FSRead(svr, data, size)
- register FSServer *svr;
- register char *data;
- register long size;
-{
- register long bytes_read;
-#if defined(SVR4) && defined(i386)
- int num_failed_reads = 0;
-#endif
-
- if (size == 0)
- return;
- ESET(0);
- /*
- * For SVR4 with a unix-domain connection, ETEST() after selecting
- * readable means the server has died. To do this here, we look for
- * two consecutive reads returning ETEST().
- */
- while ((bytes_read = _FSTransRead(svr->trans_conn, data, (int) size))
- != size) {
-
- if (bytes_read > 0) {
- size -= bytes_read;
- data += bytes_read;
-#if defined(SVR4) && defined(i386)
- num_failed_reads = 0;
-#endif
- }
- else if (ETEST()) {
- _FSWaitForReadable(svr);
-#if defined(SVR4) && defined(i386)
- num_failed_reads++;
- if (num_failed_reads > 1) {
- ESET(EPIPE);
- (*_FSIOErrorFunction) (svr);
- }
-#endif
- ESET(0);
- }
-#ifdef SUNSYSV
- else if (ECHECK(0)) {
- _FSWaitForReadable(svr);
- }
-#endif
-
- else if (bytes_read == 0) {
- /* Read failed because of end of file! */
- ESET(EPIPE);
- (*_FSIOErrorFunction) (svr);
- } else { /* bytes_read is less than 0; presumably -1 */
- /* If it's a system call interrupt, it's not an error. */
- if (!ECHECK(EINTR))
- (*_FSIOErrorFunction) (svr);
-#if defined(SVR4) && defined(i386)
- else
- num_failed_reads = 0;
-#endif
- }
- }
-}
-
-#ifdef WORD64
-/*
- * XXX This is a *really* stupid way of doing this....
- */
-
-#define PACKBUFFERSIZE 4096
-
-
-/*
- * _FSRead32 - Read bytes from the socket unpacking each 32 bits
- * into a long (64 bits on a CRAY computer).
- *
- */
-static void
-_doFSRead32(svr, data, size, packbuffer)
- register FSServer *svr;
- register long *data;
- register long size;
- register char *packbuffer;
-{
- long *lpack,
- *lp;
- long mask32 = 0x00000000ffffffff;
- long maskw,
- nwords,
- i,
- bits;
-
- _FSReadPad(svr, packbuffer, size);
-
- lp = data;
- lpack = (long *) packbuffer;
- nwords = size >> 2;
- bits = 32;
-
- for (i = 0; i < nwords; i++) {
- maskw = mask32 << bits;
- *lp++ = (*lpack & maskw) >> bits;
- bits = bits ^ 32;
- if (bits) {
- lpack++;
- }
- }
-}
-
-void
-_FSRead32(svr, data, len)
- FSServer *svr;
- long *data;
- long len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nwords = (PACKBUFFERSIZE >> 2); /* bytes to CARD32 */
-
- for (; len > nwords; len -= nwords, data += nwords) {
- _doFSRead32(svr, data, nwords, packbuffer);
- }
- _doFSRead32(svr, data, len, packbuffer);
-}
-
-
-
-/*
- * _FSRead16 - Read bytes from the socket unpacking each 16 bits
- * into a long (64 bits on a CRAY computer).
- *
- */
-static void
-_doFSRead16(svr, data, size, packbuffer)
- register FSServer *svr;
- register short *data;
- register long size;
- char *packbuffer;
-{
- long *lpack,
- *lp;
- long mask16 = 0x000000000000ffff;
- long maskw,
- nwords,
- i,
- bits;
-
- _FSRead(svr, packbuffer, size); /* don't do a padded read... */
-
- lp = (long *) data;
- lpack = (long *) packbuffer;
- nwords = size >> 1; /* number of 16 bit words to be unpacked */
- bits = 48;
- for (i = 0; i < nwords; i++) {
- maskw = mask16 << bits;
- *lp++ = (*lpack & maskw) >> bits;
- bits -= 16;
- if (bits < 0) {
- lpack++;
- bits = 48;
- }
- }
-}
-
-void
-_FSRead16(svr, data, len)
- FSServer *svr;
- short *data;
- long len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nwords = (PACKBUFFERSIZE >> 1); /* bytes to CARD16 */
-
- for (; len > nwords; len -= nwords, data += nwords) {
- _doFSRead16(svr, data, nwords, packbuffer);
- }
- _doFSRead16(svr, data, len, packbuffer);
-}
-
-void
-_FSRead16Pad(svr, data, size)
- FSServer *svr;
- short *data;
- long size;
-{
- int slop = (size & 3);
- short slopbuf[3];
-
- _FSRead16(svr, data, size);
- if (slop > 0) {
- _FSRead16(svr, slopbuf, 4 - slop);
- }
-}
-
-#endif /* WORD64 */
-
-
-/*
- * _FSReadPad - Read bytes from the socket taking into account incomplete
- * reads. If the number of bytes is not 0 mod 32, read additional pad
- * bytes. This routine may have to be reworked if int < long.
- */
-void
-_FSReadPad(svr, data, size)
- register FSServer *svr;
- register char *data;
- register long size;
-{
- register long bytes_read;
- struct iovec iov[2];
- char pad[3];
-
- if (size == 0)
- return;
- iov[0].iov_len = (int) size;
- iov[0].iov_base = data;
- /*
- * The following hack is used to provide 32 bit long-word aligned padding.
- * The [1] vector is of length 0, 1, 2, or 3, whatever is needed.
- */
-
- iov[1].iov_len = padlength[size & 3];
- iov[1].iov_base = pad;
- size += iov[1].iov_len;
-
- ESET(0);
- while ((bytes_read = _FSTransReadv(svr->trans_conn, iov, 2)) != size) {
-
- if (bytes_read > 0) {
- size -= bytes_read;
- if ((iov[0].iov_len -= bytes_read) < 0) {
- iov[1].iov_len += iov[0].iov_len;
- iov[1].iov_base = (char *)iov[1].iov_base - iov[0].iov_len;
- iov[0].iov_len = 0;
- } else
- iov[0].iov_base = (char *)iov[0].iov_base + bytes_read;
- }
- else if (ETEST()) {
- _FSWaitForReadable(svr);
- ESET(0);
- }
-#ifdef SUNSYSV
- else if (ECHECK(0)) {
- _FSWaitForReadable(svr);
- }
-#endif
-
- else if (bytes_read == 0) {
- /* Read failed because of end of file! */
- ESET(EPIPE);
- (*_FSIOErrorFunction) (svr);
- } else { /* bytes_read is less than 0; presumably -1 */
- /* If it's a system call interrupt, it's not an error. */
- if (!ECHECK(EINTR))
- (*_FSIOErrorFunction) (svr);
- }
- }
-}
-
-/*
- * _FSSend - Flush the buffer and send the client data. 32 bit word aligned
- * transmission is used, if size is not 0 mod 4, extra bytes are transmitted.
- * This routine may have to be reworked if int < long;
- */
-void
-_FSSend(svr, data, size)
- register FSServer *svr;
- char *data;
- register long size;
-{
- struct iovec iov[3];
- static char pad[3] = {0, 0, 0};
-
- long skip = 0;
- long svrbufsize = (svr->bufptr - svr->buffer);
- long padsize = padlength[size & 3];
- long total = svrbufsize + size + padsize;
- long todo = total;
-
- /*
- * There are 3 pieces that may need to be written out:
- *
- * o whatever is in the display buffer o the data passed in by the user o
- * any padding needed to 32bit align the whole mess
- *
- * This loop looks at all 3 pieces each time through. It uses skip to figure
- * out whether or not a given piece is needed.
- */
- while (total) {
- long before = skip; /* amount of whole thing written */
- long remain = todo; /* amount to try this time, <= total */
- int i = 0;
- long len;
-
- /*
- * You could be very general here and have "in" and "out" iovecs and
- * write a loop without using a macro, but what the heck. This
- * translates to:
- *
- * how much of this piece is new? if more new then we are trying this
- * time, clamp if nothing new then bump down amount already written,
- * for next piece else put new stuff in iovec, will need all of next
- * piece
- *
- * Note that todo had better be at least 1 or else we'll end up writing 0
- * iovecs.
- */
-#define InsertIOV(pointer, length) \
- len = (length) - before; \
- if (len > remain) \
- len = remain; \
- if (len <= 0) { \
- before = (-len); \
- } else { \
- iov[i].iov_len = len; \
- iov[i].iov_base = (pointer) + before; \
- i++; \
- remain -= len; \
- before = 0; \
- }
-
- InsertIOV(svr->buffer, svrbufsize)
- InsertIOV(data, size)
- InsertIOV(pad, padsize)
-
- ESET(0);
- if ((len = _FSTransWritev(svr->trans_conn, iov, i)) >= 0) {
- skip += len;
- total -= len;
- todo = total;
- } else if (ETEST()) {
- _FSWaitForWritable(svr);
-#ifdef SUNSYSV
- } else if (ECHECK(0)) {
- _FSWaitForWritable(svr);
-#endif
-
-#ifdef EMSGSIZE
- } else if (ECHECK(EMSGSIZE)) {
- if (todo > 1)
- todo >>= 1;
- else
- _FSWaitForWritable(svr);
-#endif
- } else {
- (*_FSIOErrorFunction) (svr);
- }
- }
-
- svr->bufptr = svr->buffer;
- svr->last_req = (char *) &_dummy_request;
-}
-
-#ifdef undef
-/*
- * _FSAllocID - normal resource ID allocation routine. A client
- * can roll his own and instatantiate it if he wants, but must
- * follow the rules.
- */
-FSID
-_FSAllocID(svr)
- register FSServer *svr;
-{
- return (svr->resource_base + (svr->resource_id++ << svr->resource_shift));
-}
-
-#endif
-
-/*
- * The hard part about this is that we only get 16 bits from a reply. Well,
- * then, we have three values that will march along, with the following
- * invariant:
- * svr->last_request_read <= rep->sequenceNumber <= svr->request
- * The right choice for rep->sequenceNumber is the largest that
- * still meets these constraints.
- */
-
-unsigned long
-_FSSetLastRequestRead(svr, rep)
- register FSServer *svr;
- register fsGenericReply *rep;
-{
- register unsigned long newseq,
- lastseq;
-
- newseq = (svr->last_request_read & ~((unsigned long) 0xffff)) |
- rep->sequenceNumber;
- lastseq = svr->last_request_read;
- while (newseq < lastseq) {
- newseq += 0x10000;
- if (newseq > svr->request) {
- (void) fprintf(stderr,
- "FSlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n",
- newseq, svr->request,
- (unsigned int) rep->type);
- newseq -= 0x10000;
- break;
- }
- }
-
- svr->last_request_read = newseq;
- return (newseq);
-}
-
-/*
- * _FSReply - Wait for a reply packet and copy its contents into the
- * specified rep. Mean while we must handle error and event packets that
- * we may encounter.
- */
-Status
-_FSReply(svr, rep, extra, discard)
- register FSServer *svr;
- register fsReply *rep;
- int extra; /* number of 32-bit words expected after the
- * reply */
- Bool discard; /* should I discard data followind "extra"
- * words? */
-{
- /*
- * Pull out the serial number now, so that (currently illegal) requests
- * generated by an error handler don't confuse us.
- */
- unsigned long cur_request = svr->request;
- long rem_length;
-
- _FSFlush(svr);
- while (1) {
- _FSRead(svr, (char *) rep, (long) SIZEOF(fsReply));
- switch ((int) rep->generic.type) {
-
- case FS_Reply:
- /*
- * Reply received. Fast update for synchronous replies, but deal
- * with multiple outstanding replies.
- */
- if (rep->generic.sequenceNumber == (cur_request & 0xffff))
- svr->last_request_read = cur_request;
- else
- (void) _FSSetLastRequestRead(svr, &rep->generic);
- rem_length = rep->generic.length - (SIZEOF(fsReply) >> 2);
- if (rem_length < 0) rem_length = 0;
- if (extra == 0) {
- if (discard && rem_length)
- /* unexpectedly long reply! */
- _EatData32(svr, rem_length);
- return (1);
- }
- if (extra == rem_length) {
- /*
- * Read the extra data into storage immediately following the
- * GenericReply structure.
- */
- _FSRead(svr, (char *) NEXTPTR(rep, fsReply), ((long) extra) << 2);
- return (1);
- }
- if (extra < rem_length) {
- /* Actual reply is longer than "extra" */
- _FSRead(svr, (char *) NEXTPTR(rep, fsReply), ((long) extra) << 2);
- if (discard)
- _EatData32(svr, rem_length - extra);
- return (1);
- }
- /*
- * if we get here, then extra > rem_length -- meaning we
- * read a reply that's shorter than we expected. This is an
- * error, but we still need to figure out how to handle it...
- */
- _FSRead(svr, (char *) NEXTPTR(rep, fsReply), rem_length << 2);
- (*_FSIOErrorFunction) (svr);
- return (0);
-
- case FS_Error:
- {
- register _FSExtension *ext;
- register Bool ret = False;
- int ret_code;
- fsError err;
- unsigned long serial;
- long err_data;
-
- err = *(fsError *) rep;
- /* read the rest of the error */
- _FSRead(svr, (char *) &err + SIZEOF(fsReply),
- (long) (SIZEOF(fsError) - SIZEOF(fsReply)));
- serial = _FSSetLastRequestRead(svr, (fsGenericReply *) rep);
- if (serial == cur_request)
- /* do not die on certain failures */
- switch ((int) err.request) {
- /* suck in any extra error info */
- case FSBadResolution:
- case FSBadLength:
- case FSBadIDChoice:
- case FSBadRange:
- case FSBadFont:
- case FSBadFormat:
- _FSRead(svr, (char *) &err_data, 4);
- break;
- case FSBadAccessContext:
- _FSRead(svr, (char *) &err_data, 4);
- return 0;
- case FSBadAlloc:
- return (0);
- /*
- * we better see if there is an extension who may want
- * to suppress the error.
- */
- default:
- ext = svr->ext_procs;
- while (ext) {
- if (ext->error != NULL)
- ret = (*ext->error)
- (svr, &err, &ext->codes, &ret_code);
- ext = ext->next;
- }
- if (ret)
- return (ret_code);
- break;
- }
- _FSError(svr, &err);
- if (serial == cur_request)
- return (0);
- }
- break;
- default:
- _FSEnq(svr, (fsEvent *) rep);
- break;
- }
- }
-}
-
-
-/* Read and discard "n" 8-bit bytes of data */
-
-void
-_FSEatData(svr, n)
- FSServer *svr;
- register unsigned long n;
-{
-#define SCRATCHSIZE 2048
- char buf[SCRATCHSIZE];
-
- while (n > 0) {
- register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n;
-
- _FSRead(svr, buf, bytes_read);
- n -= bytes_read;
- }
-#undef SCRATCHSIZE
-}
-
-
-/* Read and discard "n" 32-bit words. */
-
-static void
-_EatData32(svr, n)
- FSServer *svr;
- unsigned long n;
-{
- _FSEatData(svr, n << 2);
-}
-
-
-/*
- * _FSEnq - Place event packets on the display's queue.
- * note that no squishing of move events in V11, since there
- * is pointer motion hints....
- */
-void
-_FSEnq(svr, event)
- register FSServer *svr;
- register fsEvent *event;
-{
- register _FSQEvent *qelt;
-
-/*NOSTRICT*/
- if ((qelt = _FSqfree) != NULL) {
- /* If _FSqfree is non-NULL do this, else malloc a new one. */
- _FSqfree = qelt->next;
- } else if ((qelt =
- (_FSQEvent *) FSmalloc((unsigned) sizeof(_FSQEvent))) == NULL) {
- /* Malloc call failed! */
- ESET(ENOMEM);
- (*_FSIOErrorFunction) (svr);
- }
- qelt->next = NULL;
- /* go call through display to find proper event reformatter */
- if ((*svr->event_vec[event->type & 0177]) (svr, &qelt->event, event)) {
- if (svr->tail)
- svr->tail->next = qelt;
- else
- svr->head = qelt;
-
- svr->tail = qelt;
- svr->qlen++;
- } else {
- /* ignored, or stashed away for many-to-one compression */
- qelt->next = _FSqfree;
- _FSqfree = qelt;
- }
-}
-
-/*
- * EventToWire in seperate file in that often not needed.
- */
-
-/*ARGSUSED*/
-Bool
-_FSUnknownWireEvent(svr, re, event)
- register FSServer *svr; /* pointer to display structure */
- register FSEvent *re; /* pointer to where event should be
- * reformatted */
- register fsEvent *event; /* wire protocol event */
-{
-
-#ifdef notdef
- (void) fprintf(stderr,
- "FSlib: unhandled wire event! event number = %d, display = %x\n.",
- event->type, svr);
-#endif
-
- return (False);
-}
-
-/*ARGSUSED*/
-Status
-_FSUnknownNativeEvent(svr, re, event)
- register FSServer *svr; /* pointer to display structure */
- register FSEvent *re; /* pointer to where event should be
- * reformatted */
- register fsEvent *event; /* wire protocol event */
-{
-
-#ifdef notdef
- (void) fprintf(stderr,
- "FSlib: unhandled native event! event number = %d, display = %x\n.",
- re->type, svr);
-#endif
-
- return (0);
-}
-
-/*
- * reformat a wire event into an FSEvent structure of the right type.
- */
-Bool
-_FSWireToEvent(svr, re, event)
- register FSServer *svr; /* pointer to display structure */
- register FSEvent *re; /* pointer to where event should be
- * reformatted */
- register fsEvent *event; /* wire protocol event */
-{
-
- re->type = event->type & 0x7f;
- ((FSAnyEvent *) re)->serial = _FSSetLastRequestRead(svr,
- (fsGenericReply *) event);
- ((FSAnyEvent *) re)->send_event = ((event->type & 0x80) != 0);
- ((FSAnyEvent *) re)->server = svr;
-
- /*
- * Ignore the leading bit of the event type since it is set when a client
- * sends an event rather than the server.
- */
-
- switch (event->type & 0177) {
- default:
- return (_FSUnknownWireEvent(svr, re, event));
- }
-}
-
-
-static char *
-_SysErrorMsg(n)
- int n;
-{
- char *s = strerror(n);
-
- return (s ? s : "no such error");
-}
-
-/*
- * _FSDefaultIOError - Default fatal system error reporting routine. Called
- * when an X internal system error is encountered.
- */
-int
-_FSDefaultIOError(svr)
- FSServer *svr;
-{
- (void) fprintf(stderr,
- "FSIO: fatal IO error %d (%s) on font server \"%s\"\r\n",
-#ifdef WIN32
- WSAGetLastError(), strerror(WSAGetLastError()),
-#else
-
- errno, _SysErrorMsg(errno),
-#endif
- FSServerString(svr));
- (void) fprintf(stderr,
- " after %lu requests (%lu known processed) with %d events remaining.\r\n",
- NextRequest(svr) - 1, LastKnownRequestProcessed(svr),
- QLength(svr));
-
- if (ECHECK(EPIPE)) {
- (void) fprintf(stderr,
- " The connection was probably broken by a server shutdown.\r\n");
- }
- exit(1);
- return 0;
-}
-
-/*
- * _FSError - Default non-fatal error reporting routine. Called when an
- * FS_Error packet is encountered in the input stream.
- */
-int
-_FSError(svr, rep)
- FSServer *svr;
- fsError *rep;
-{
- FSErrorEvent event;
-
- /*
- * FS_Error packet encountered! We need to unpack the error before giving
- * it to the user.
- */
-
- event.server = svr;
- event.type = FS_Error;
- event.serial = _FSSetLastRequestRead(svr, (fsGenericReply *) rep);
- event.error_code = rep->request;
- event.request_code = rep->major_opcode;
- event.minor_code = rep->minor_opcode;
- if (_FSErrorFunction != NULL) {
- return ((*_FSErrorFunction) (svr, &event));
- }
- exit(1);
- /* NOTREACHED */
-}
-
-int
-_FSPrintDefaultError(svr, event, fp)
- FSServer *svr;
- FSErrorEvent *event;
- FILE *fp;
-{
- char buffer[BUFSIZ];
- char mesg[BUFSIZ];
- char number[32];
- char *mtype = "FSlibMessage";
- register _FSExtension *ext = (_FSExtension *) NULL;
-
- (void) FSGetErrorText(svr, event->error_code, buffer, BUFSIZ);
- (void) FSGetErrorDatabaseText(svr, mtype, "FSError", "FS Error", mesg,
- BUFSIZ);
- (void) fprintf(fp, "%s: %s\n ", mesg, buffer);
- (void) FSGetErrorDatabaseText(svr, mtype, "MajorCode",
- "Request Major code %d", mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->request_code);
- if (event->request_code < 128) {
- sprintf(number, "%d", event->request_code);
- (void) FSGetErrorDatabaseText(svr, "FSRequest", number, "", buffer,
- BUFSIZ);
- } else {
- for (ext = svr->ext_procs;
- ext && (ext->codes.major_opcode != event->request_code);
- ext = ext->next);
- if (ext)
- strcpy(buffer, ext->name);
- else
- buffer[0] = '\0';
- }
- (void) fprintf(fp, " (%s)\n ", buffer);
- (void) FSGetErrorDatabaseText(svr, mtype, "MinorCode",
- "Request Minor code %d", mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->minor_code);
- if (ext) {
- sprintf(mesg, "%s.%d", ext->name, event->minor_code);
- (void) FSGetErrorDatabaseText(svr, "FSRequest", mesg, "", buffer,
- BUFSIZ);
- (void) fprintf(fp, " (%s)", buffer);
- }
- fputs("\n ", fp);
- (void) FSGetErrorDatabaseText(svr, mtype, "ResourceID", "ResourceID 0x%x",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->resourceid);
- fputs("\n ", fp);
- (void) FSGetErrorDatabaseText(svr, mtype, "ErrorSerial", "Error Serial #%d",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->serial);
- fputs("\n ", fp);
- (void) FSGetErrorDatabaseText(svr, mtype, "CurrentSerial",
- "Current Serial #%d", mesg, BUFSIZ);
- (void) fprintf(fp, mesg, svr->request);
- fputs("\n", fp);
- return 1;
-}
-
-int
-_FSDefaultError(svr, event)
- FSServer *svr;
- FSErrorEvent *event;
-{
- if (_FSPrintDefaultError(svr, event, stderr) == 0)
- return 0;
- exit(1);
- /* NOTREACHED */
-}
-
-
-FSIOErrorHandler _FSIOErrorFunction = _FSDefaultIOError;
-FSErrorHandler _FSErrorFunction = _FSDefaultError;
-
-/*
- * This routine can be used to (cheaply) get some memory within a single
- * Xlib routine for scratch space. It is reallocated from the same place
- * each time, unless the library needs a large scratch space.
- */
-char *
-_FSAllocScratch(svr, nbytes)
- register FSServer *svr;
- unsigned long nbytes;
-{
- if (nbytes > svr->scratch_length) {
- if (svr->scratch_buffer != NULL)
- FSfree(svr->scratch_buffer);
- return (svr->scratch_length = nbytes,
- svr->scratch_buffer = FSmalloc((unsigned) nbytes));
- }
- return (svr->scratch_buffer);
-}
-
-int
-FSFree(data)
- char *data;
-{
- FSfree(data);
- return 1;
-}
-
-unsigned char *
-FSMalloc(size)
- unsigned size;
-{
- return (unsigned char *) FSmalloc(size);
-}
-
-#ifdef DataRoutineIsProcedure
-void
-Data(svr, data, len)
- FSServer *svr;
- char *data;
- long len;
-{
- if (svr->bufptr + (len) <= svr->bufmax) {
- bcopy(data, svr->bufptr, (int) len);
- svr->bufptr += ((len) + 3) & ~3;
- } else {
- _FSSend(svr, data, len);
- }
-}
-
-#endif /* DataRoutineIsProcedure */
-
-
-#ifdef WORD64
-/*
- * XXX This is a *really* stupid way of doing this. It should just use
- * svr->bufptr directly, taking into account where in the word it is.
- */
-
-/*
- * Data16 - Place 16 bit data in the buffer.
- *
- * "svr" is a pointer to a FSServer.
- * "data" is a pointer to the data.
- * "len" is the length in bytes of the data.
- */
-
-static void
-doData16(svr, data, len, packbuffer)
- register FSServer *svr;
- short *data;
- unsigned len;
- char *packbuffer;
-{
- long *lp,
- *lpack;
- long i,
- nwords,
- bits;
- long mask16 = 0x000000000000ffff;
-
- lp = (long *) data;
- lpack = (long *) packbuffer;
- *lpack = 0;
-
-/* nwords is the number of 16 bit values to be packed,
- * the low order 16 bits of each word will be packed
- * into 64 bit words
- */
- nwords = len >> 1;
- bits = 48;
-
- for (i = 0; i < nwords; i++) {
- *lpack ^= (*lp & mask16) << bits;
- bits -= 16;
- lp++;
- if (bits < 0) {
- lpack++;
- *lpack = 0;
- bits = 48;
- }
- }
- Data(svr, packbuffer, len);
-}
-
-void
-Data16(svr, data, len)
- FSServer *svr;
- short *data;
- unsigned len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nwords = (PACKBUFFERSIZE >> 1); /* bytes to CARD16 */
-
- for (; len > nwords; len -= nwords, data += nwords) {
- doData16(svr, data, nwords, packbuffer);
- }
- doData16(svr, data, len, packbuffer);
-}
-
-/*
- * Data32 - Place 32 bit data in the buffer.
- *
- * "svr" is a pointer to a FSServer.
- * "data" is a pointer to the data.
- * "len" is the length in bytes of the data.
- */
-
-static
-doData32(svr, data, len, packbuffer)
- register FSServer *svr;
- long *data;
- unsigned len;
- char *packbuffer;
-{
- long *lp,
- *lpack;
- long i,
- bits,
- nwords;
- long mask32 = 0x00000000ffffffff;
-
- lpack = (long *) packbuffer;
- lp = data;
-
- *lpack = 0;
-
-/* nwords is the number of 32 bit values to be packed
- * the low order 32 bits of each word will be packed
- * into 64 bit words
- */
- nwords = len >> 2;
- bits = 32;
-
- for (i = 0; i < nwords; i++) {
- *lpack ^= (*lp & mask32) << bits;
- bits = bits ^ 32;
- lp++;
- if (bits) {
- lpack++;
- *lpack = 0;
- }
- }
- Data(svr, packbuffer, len);
-}
-
-void
-Data32(svr, data, len)
- FSServer *svr;
- short *data;
- unsigned len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nwords = (PACKBUFFERSIZE >> 2); /* bytes to CARD32 */
-
- for (; len > nwords; len -= nwords, data += nwords) {
- doData32(svr, data, nwords, packbuffer);
- }
- doData32(svr, data, len, packbuffer);
-}
-
-#endif /* WORD64 */
-
-
-
-/*
- * _FSFreeQ - free the queue of events, called by XCloseServer when there are
- * no more displays left on the display list
- */
-
-void
-_FSFreeQ()
-{
- register _FSQEvent *qelt = _FSqfree;
-
- while (qelt) {
- register _FSQEvent *qnext = qelt->next;
-
- FSfree(qelt);
- qelt = qnext;
- }
- _FSqfree = NULL;
- return;
-}
-
-#ifdef _POSIX_SOURCE /* stupid makedepend [need if] */
-#define NEED_UTSNAME
-#endif
-#ifdef hpux
-#define NEED_UTSNAME
-#endif
-#ifdef USG
-#define NEED_UTSNAME
-#endif
-#ifdef SVR4
-#ifndef _SEQUENT_
-#define NEED_UTSNAME
-#endif
-#endif
-
-#ifdef NEED_UTSNAME
-#include <sys/utsname.h>
-#endif
-
-
-/*
- * _FSGetHostname - similar to gethostname but allows special processing.
- */
-int
-_FSGetHostname(buf, maxlen)
- char *buf;
- int maxlen;
-{
- int len;
-
-#ifdef NEED_UTSNAME
- /*
- * same host name crock as in server and xinit.
- */
- struct utsname name;
-
- uname(&name);
- len = strlen(name.nodename);
- if (len >= maxlen)
- len = maxlen - 1;
- strncpy(buf, name.nodename, len);
- buf[len] = '\0';
-#else
- buf[0] = '\0';
- (void) gethostname(buf, maxlen);
- buf[maxlen - 1] = '\0';
- len = strlen(buf);
-#endif /* NEED_UTSNAME */
-
- return len;
-}
-
-#ifndef _FSANYSET
-/*
- * This is not always a macro.
- */
-_FSANYSET(src)
- long *src;
-{
- int i;
-
- for (i=0; i<MSKCNT; i++)
- if (src[ i ])
- return (1);
- return (0);
-}
-#endif
diff --git a/xc/lib/FS/FSlibint.h b/xc/lib/FS/FSlibint.h
deleted file mode 100644
index bb4fc9745..000000000
--- a/xc/lib/FS/FSlibint.h
+++ /dev/null
@@ -1,401 +0,0 @@
-/* $TOG: FSlibint.h /main/17 1998/05/01 12:50:43 kaleb $ */
-
-/*
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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/lib/FS/FSlibint.h,v 3.4 1999/02/19 21:26:52 hohndel Exp $ */
-
-/*
- * FSlib internal decls
- */
-#include <stdio.h>
-#ifdef USG
-#ifndef __TYPES__
-#include <sys/types.h> /* forgot to protect it... */
-#define __TYPES__
-#endif /* __TYPES__ */
-#else
-#if defined(_POSIX_SOURCE) && defined(MOTOROLA)
-#undef _POSIX_SOURCE
-#include <sys/types.h>
-#define _POSIX_SOURCE
-#else
-#include <sys/types.h>
-#endif
-#endif /* USG */
-
-#include "FSlib.h"
-#include "FSproto.h"
-#include "FSlibos.h"
-#include <errno.h>
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef X_NOT_STDC_ENV
-extern int errno; /* Internal system error number. */
-#endif
-
-typedef int (* FSIOErrorHandler)(FSServer *);
-typedef int (* FSErrorHandler)(FSServer *, FSErrorEvent *);
-
-extern FSIOErrorHandler _FSIOErrorFunction;
-extern FSErrorHandler _FSErrorFunction;
-
-extern void _FSEatData ( FSServer *svr, unsigned long n );
-extern void _FSWaitForWritable ( FSServer *svr );
-extern void _FSWaitForReadable ( FSServer *svr );
-extern void _FSFlush ( FSServer *svr );
-extern void _FSRead ( FSServer *svr, char *data, long size );
-extern void _FSReadEvents ( FSServer *svr );
-extern void _FSReadPad ( FSServer *svr, char *data, long size );
-extern void _FSSend ( FSServer *svr, char *data, long size );
-extern void _FSEnq ( FSServer *svr, fsEvent *event );
-extern void _FSFreeServerStructure ( FSServer *svr );
-extern int _FSError ( FSServer *svr, fsError *rep );
-extern int _FSReply ( FSServer *svr, fsReply *rep, int extra, int discard );
-extern XtransConnInfo _FSConnectServer ( char *server_name );
-extern void _FSDisconnectServer ( XtransConnInfo trans_conn );
-extern void _FSSendClientPrefix ( FSServer *svr, fsConnClientPrefix *client );
-extern int _FSEventsQueued ( FSServer *svr, int mode );
-extern unsigned long _FSSetLastRequestRead ( FSServer *svr,
- fsGenericReply *rep );
-extern int _FSUnknownWireEvent ( FSServer *svr, FSEvent *re, fsEvent *event );
-extern int _FSUnknownNativeEvent ( FSServer *svr, FSEvent *re,
- fsEvent *event );
-extern int _FSWireToEvent ( FSServer *svr, FSEvent *re, fsEvent *event );
-extern int _FSDefaultIOError ( FSServer *svr );
-extern int _FSPrintDefaultError ( FSServer *svr, FSErrorEvent *event,
- FILE *fp );
-extern int _FSDefaultError ( FSServer *svr, FSErrorEvent *event );
-extern char * _FSAllocScratch ( FSServer *svr, unsigned long nbytes );
-extern void _FSFreeQ ( void );
-extern int _FSGetHostname ( char *buf, int maxlen );
-
-extern FSErrorHandler FSSetErrorHandler ( FSErrorHandler handler );
-extern FSIOErrorHandler FSSetIOErrorHandler ( FSIOErrorHandler handler );
-
-#ifndef BUFSIZE
-#define BUFSIZE 2048 /* FS output buffer size. */
-#endif
-
-/*
- * server flags
- */
-#define FSlibServerIOError (1L << 0)
-#define FSlibServerClosing (1L << 1)
-
-/* Need to start requests on 64 bit word boundries
- * on a CRAY computer so add a NoOp (127) if needed.
- * A character pointer on a CRAY computer will be non-zero
- * after shifting right 61 bits of it is not pointing to
- * a word boundary.
- */
-
-#ifdef WORD64
-#define WORD64ALIGN if ((long)svr->bufptr >> 61) {\
- svr->last_req = svr->bufptr;\
- *(svr->bufptr) = FS_Noop;\
- *(svr->bufptr+1) = 0;\
- *(svr->bufptr+2) = 0;\
- *(svr->bufptr+3) = 1;\
- svr->request += 1;\
- svr->bufptr += 4;\
- }
-#else /* else does not require alignment on 64-bit
- * boundaries */
-#define WORD64ALIGN
-#endif /* WORD64 */
-
-/*
- * GetReq - Get the next avilable FS request packet in the buffer and
- * return it.
- *
- * "name" is the name of the request, e.g. InternAtom, OpenFont, etc.
- * "req" is the name of the request pointer.
- *
- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetReq(name, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fs##name##Req)) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fs##name##Req *)(svr->last_req = svr->bufptr);\
- req->reqType = FS_##name;\
- req->length = (SIZEOF(fs##name##Req))>>2;\
- svr->bufptr += SIZEOF(fs##name##Req);\
- svr->request++
-
-#else /* non-ANSI C uses empty comment instead of
- * "##" for token concatenation */
-#define GetReq(name, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fs/**/name/**/Req)) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fs/**/name/**/Req *)(svr->last_req = svr->bufptr);\
- req->reqType = FS_/**/name;\
- req->length = (SIZEOF(fs/**/name/**/Req))>>2;\
- svr->bufptr += SIZEOF(fs/**/name/**/Req);\
- svr->request++
-#endif
-
-/* GetReqExtra is the same as GetReq, but allocates "n" additional
- bytes after the request. "n" must be a multiple of 4! */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetReqExtra(name, n, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fs##name##Req) + n) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fs##name##Req *)(svr->last_req = svr->bufptr);\
- req->reqType = FS_##name;\
- req->length = (SIZEOF(fs##name##Req) + n)>>2;\
- svr->bufptr += SIZEOF(fs##name##Req) + n;\
- svr->request++
-#else
-#define GetReqExtra(name, n, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fs/**/name/**/Req) + n) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fs/**/name/**/Req *)(svr->last_req = svr->bufptr);\
- req->reqType = FS_/**/name;\
- req->length = (SIZEOF(fs/**/name/**/Req) + n)>>2;\
- svr->bufptr += SIZEOF(fs/**/name/**/Req) + n;\
- svr->request++
-#endif
-
-
-/*
- * GetResReq is for those requests that have a resource ID
- * (Window, Pixmap, GContext, etc.) as their single argument.
- * "rid" is the name of the resource.
- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetResReq(name, rid, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fsResourceReq)) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fsResourceReq *) (svr->last_req = svr->bufptr);\
- req->reqType = FS_##name;\
- req->length = 2;\
- req->id = (rid);\
- svr->bufptr += SIZEOF(fsResourceReq);\
- svr->request++
-#else
-#define GetResReq(name, rid, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fsResourceReq)) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fsResourceReq *) (svr->last_req = svr->bufptr);\
- req->reqType = FS_/**/name;\
- req->length = 2;\
- req->id = (rid);\
- svr->bufptr += SIZEOF(fsResourceReq);\
- svr->request++
-#endif
-
-/*
- * GetEmptyReq is for those requests that have no arguments
- * at all.
- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetEmptyReq(name, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fsReq)) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fsReq *) (svr->last_req = svr->bufptr);\
- req->reqType = FS_##name;\
- req->length = 1;\
- svr->bufptr += SIZEOF(fsReq);\
- svr->request++
-#else
-#define GetEmptyReq(name, req) \
- WORD64ALIGN\
- if ((svr->bufptr + SIZEOF(fsReq)) > svr->bufmax)\
- _FSFlush(svr);\
- req = (fsReq *) (svr->last_req = svr->bufptr);\
- req->reqType = FS_/**/name;\
- req->length = 1;\
- svr->bufptr += SIZEOF(fsReq);\
- svr->request++
-#endif
-
-#define SyncHandle() \
- if (svr->synchandler) (*svr->synchandler)(svr)
-
-/*
- * Data - Place data in the buffer and pad the end to provide
- * 32 bit word alignment. Transmit if the buffer fills.
- *
- * "svr" is a pointer to a Display.
- * "data" is a pinter to a data buffer.
- * "len" is the length of the data buffer.
- * we can presume buffer less than 2^16 bytes, so bcopy can be used safely.
- */
-
-#ifdef DataRoutineIsProcedure
-extern void Data();
-
-#else
-#define Data(svr, data, len) \
- if (svr->bufptr + (len) <= svr->bufmax) {\
- bcopy(data, svr->bufptr, (int)len);\
- svr->bufptr += ((len) + 3) & ~3;\
- } else\
- _FSSend(svr, data, len)
-#endif /* DataRoutineIsProcedure */
-
-
-/* Allocate bytes from the buffer. No padding is done, so if
- * the length is not a multiple of 4, the caller must be
- * careful to leave the buffer aligned after sending the
- * current request.
- *
- * "type" is the type of the pointer being assigned to.
- * "ptr" is the pointer being assigned to.
- * "n" is the number of bytes to allocate.
- *
- * Example:
- * xTextElt *elt;
- * BufAlloc (xTextElt *, elt, nbytes)
- */
-
-#define BufAlloc(type, ptr, n) \
- if (svr->bufptr + (n) > svr->bufmax) \
- _FSFlush (svr); \
- ptr = (type) svr->bufptr; \
- svr->bufptr += (n);
-
-/*
- * provide emulation routines for smaller architectures
- */
-#ifndef WORD64
-#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
-#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
-#define _FSRead16Pad(dpy, data, len) _FSReadPad((dpy), (char *)(data), (len))
-#define _FSRead16(dpy, data, len) _FSRead((dpy), (char *)(data), (len))
-#define _FSRead32(dpy, data, len) _FSRead((dpy), (char *)(data), (len))
-#endif /* not WORD64 */
-
-#define PackData16(dpy,data,len) Data16 (dpy, data, len)
-#define PackData32(dpy,data,len) Data32 (dpy, data, len)
-
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-
-#ifdef MUSTCOPY
-/* a little bit of magic */
-#define OneDataCard32(svr,dstaddr,srcvar) \
- { svr->bufptr -= 4; Data32 (svr, (char *) &(srcvar), 4); }
-
-#define STARTITERATE(tpvar,type,start,endcond,decr) \
- { register char *cpvar; \
- for (cpvar = (char *) start; endcond; cpvar = NEXTPTR(cpvar,type), decr) { \
- type dummy; bcopy (cpvar, (char *) &dummy, SIZEOF(type)); \
- tpvar = (type *) cpvar;
-#define ENDITERATE }}
-
-#else
-
-/* srcvar must be a variable for large architecture version */
-#define OneDataCard32(svr,dstaddr,srcvar) \
- { *(unsigned long *)(dstaddr) = (srcvar); }
-
-#define STARTITERATE(tpvar,type,start,endcond,decr) \
- for (tpvar = (type *) start; endcond; tpvar++, decr) {
-#define ENDITERATE }
-#endif /* MUSTCOPY - used machines whose C structs
- * don't line up with proto */
-
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define FSCat(x,y) x##_##y
-#else
-#define FSCat(x,y) x/**/_/**/y
-#endif
-
-/* copy XCharInfo parts of a protocol reply into a FSXCharInfo */
-
-#define FSUnpack_XCharInfo(packet, structure) \
- (structure)->left = FSCat(packet,left); \
- (structure)->right = FSCat(packet,right); \
- (structure)->width = FSCat(packet,width); \
- (structure)->ascent = FSCat(packet,ascent); \
- (structure)->descent = FSCat(packet,descent); \
- (structure)->attributes = FSCat(packet,attributes)
-
-
-/* copy XFontInfoHeader parts of a protocol reply into a FSXFontInfoHeader */
-
-#define FSUnpack_XFontInfoHeader(packet, structure, serverversion) \
- (structure)->flags = (packet)->font_header_flags; \
- (structure)->draw_direction = (packet)->font_header_draw_direction; \
- \
- if (serverversion > 1) { \
- (structure)->char_range.min_char.high = (packet)->font_hdr_char_range_min_char_high; \
- (structure)->char_range.min_char.low = (packet)->font_hdr_char_range_min_char_low; \
- (structure)->char_range.max_char.high = (packet)->font_hdr_char_range_max_char_high; \
- (structure)->char_range.max_char.low = (packet)->font_hdr_char_range_max_char_low; \
- (structure)->default_char.high = (packet)->font_header_default_char_high; \
- (structure)->default_char.low = (packet)->font_header_default_char_low; \
- } else { \
- (structure)->char_range.min_char.high = (packet)->font_hdr_char_range_min_char_low; \
- (structure)->char_range.min_char.low = (packet)->font_hdr_char_range_min_char_high; \
- (structure)->char_range.max_char.high = (packet)->font_hdr_char_range_max_char_low; \
- (structure)->char_range.max_char.low = (packet)->font_hdr_char_range_max_char_high; \
- (structure)->default_char.high = (packet)->font_header_default_char_low; \
- (structure)->default_char.low = (packet)->font_header_default_char_high; \
- } \
- \
- (structure)->font_ascent = (packet)->font_header_font_ascent; \
- (structure)->font_descent = (packet)->font_header_font_descent; \
- \
- FSUnpack_XCharInfo((packet)->font_header_min_bounds, &(structure)->min_bounds); \
- FSUnpack_XCharInfo((packet)->font_header_max_bounds, &(structure)->max_bounds)
diff --git a/xc/lib/FS/FSlibos.h b/xc/lib/FS/FSlibos.h
deleted file mode 100644
index bf781546c..000000000
--- a/xc/lib/FS/FSlibos.h
+++ /dev/null
@@ -1,326 +0,0 @@
-/* $TOG: FSlibos.h /main/24 1998/02/06 13:43:07 kaleb $ */
-
-/* @(#)FSlibos.h 4.1 91/05/02
- * Copyright 1990 Network Computing Devices;
- * Portions Copyright 1987 by Digital Equipment Corporation
- *
- * 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 Network Computing
- * Devices or Digital not be used in advertising or publicity pertaining
- * to distribution of the software without specific, written prior
- * permission. Network Computing Devices or Digital make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES
- * OR 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, 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/lib/FS/FSlibos.h,v 3.4 1998/10/03 08:41:08 dawes Exp $ */
-
-/*
- * FSlib networking & os include file
- */
-
-#include <X11/Xfuncs.h>
-#include <X11/Xosdefs.h>
-
-#ifndef WIN32
-
-/*
- * makedepend screws up on #undef OPEN_MAX, so we define a new symbol
- */
-
-#ifndef FS_OPEN_MAX
-
-#ifndef X_NOT_POSIX
-#ifdef _POSIX_SOURCE
-#include <limits.h>
-#else
-#define _POSIX_SOURCE
-#include <limits.h>
-#undef _POSIX_SOURCE
-#endif
-#endif
-#ifndef OPEN_MAX
-#ifdef SVR4
-#define OPEN_MAX 256
-#else
-#include <sys/param.h>
-#ifndef OPEN_MAX
-#ifdef __OSF1__
-#define OPEN_MAX 256
-#else
-#ifdef NOFILE
-#define OPEN_MAX NOFILE
-#else
-#ifndef __EMX__
-#ifdef __GNU__
-#define OPEN_MAX (sysconf(_SC_OPEN_MAX))
-#else /* !__GNU__ */
-#define OPEN_MAX NOFILES_MAX
-#endif /* __GNU__ */
-#else /* __EMX__ */
-#define OPEN_MAX 256
-#endif /* __EMX__ */
-#endif
-#endif
-#endif
-#endif
-#endif
-
-#ifdef __GNU__
-#define FS_OPEN_MAX 256
-#else /*!__GNU__*/
-#if OPEN_MAX > 256
-#define FS_OPEN_MAX 256
-#else
-#define FS_OPEN_MAX OPEN_MAX
-#endif
-#endif /*__GNU__*/
-
-#endif /* FS_OPEN_MAX */
-
-/* Utek leaves kernel macros around in include files (bleah) */
-
-#ifdef dirty
-#undef dirty
-#endif
-
-#ifdef WORD64
-#define NMSKBITS 64
-#else
-#define NMSKBITS 32
-#endif
-
-#define MSKCNT ((FS_OPEN_MAX + NMSKBITS - 1) / NMSKBITS)
-
-#ifdef LONG64
-typedef unsigned int FdSet[MSKCNT];
-#else
-typedef unsigned long FdSet[MSKCNT];
-#endif
-
-#if (MSKCNT==1)
-#define BITMASK(i) (1 << (i))
-#define MASKIDX(i) 0
-#endif
-
-#if (MSKCNT>1)
-#define BITMASK(i) (1 << ((i) & (NMSKBITS - 1)))
-#define MASKIDX(i) ((i) / NMSKBITS)
-#endif
-
-#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))
-
-#if (MSKCNT==1)
-#define COPYBITS(src, dst) dst[0] = src[0]
-#define CLEARBITS(buf) buf[0] = 0
-#define MASKANDSETBITS(dst, b1, b2) dst[0] = (b1[0] & b2[0])
-#define ORBITS(dst, b1, b2) dst[0] = (b1[0] | b2[0])
-#define UNSETBITS(dst, b1) (dst[0] &= ~b1[0])
-#define _FSANYSET(src) (src[0])
-#endif
-
-#if (MSKCNT==2)
-#define COPYBITS(src, dst) { dst[0] = src[0]; dst[1] = src[1]; }
-#define CLEARBITS(buf) { buf[0] = 0; buf[1] = 0; }
-#define MASKANDSETBITS(dst, b1, b2) {\
- dst[0] = (b1[0] & b2[0]);\
- dst[1] = (b1[1] & b2[1]); }
-#define ORBITS(dst, b1, b2) {\
- dst[0] = (b1[0] | b2[0]);\
- dst[1] = (b1[1] | b2[1]); }
-#define UNSETBITS(dst, b1) {\
- dst[0] &= ~b1[0]; \
- dst[1] &= ~b1[1]; }
-#define _FSANYSET(src) (src[0] || src[1])
-#endif
-
-#if (MSKCNT==3)
-#define COPYBITS(src, dst) { dst[0] = src[0]; dst[1] = src[1]; \
- dst[2] = src[2]; }
-#define CLEARBITS(buf) { buf[0] = 0; buf[1] = 0; buf[2] = 0; }
-#define MASKANDSETBITS(dst, b1, b2) {\
- dst[0] = (b1[0] & b2[0]);\
- dst[1] = (b1[1] & b2[1]);\
- dst[2] = (b1[2] & b2[2]); }
-#define ORBITS(dst, b1, b2) {\
- dst[0] = (b1[0] | b2[0]);\
- dst[1] = (b1[1] | b2[1]);\
- dst[2] = (b1[2] | b2[2]); }
-#define UNSETBITS(dst, b1) {\
- dst[0] &= ~b1[0]; \
- dst[1] &= ~b1[1]; \
- dst[2] &= ~b1[2]; }
-#define _FSANYSET(src) (src[0] || src[1] || src[2])
-#endif
-
-#if (MSKCNT==4)
-#define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; \
- dst[2] = src[2]; dst[3] = src[3]
-#define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0
-#define MASKANDSETBITS(dst, b1, b2) \
- dst[0] = (b1[0] & b2[0]);\
- dst[1] = (b1[1] & b2[1]);\
- dst[2] = (b1[2] & b2[2]);\
- dst[3] = (b1[3] & b2[3])
-#define ORBITS(dst, b1, b2) \
- dst[0] = (b1[0] | b2[0]);\
- dst[1] = (b1[1] | b2[1]);\
- dst[2] = (b1[2] | b2[2]);\
- dst[3] = (b1[3] | b2[3])
-#define UNSETBITS(dst, b1) \
- dst[0] &= ~b1[0]; \
- dst[1] &= ~b1[1]; \
- dst[2] &= ~b1[2]; \
- dst[3] &= ~b1[3]
-#define _FSANYSET(src) (src[0] || src[1] || src[2] || src[3])
-#endif
-
-#if (MSKCNT>4)
-#define COPYBITS(src, dst) bcopy((caddr_t) src, (caddr_t) dst, sizeof(FdSet))
-#define CLEARBITS(buf) bzero((caddr_t) buf, sizeof(FdSet))
-#define MASKANDSETBITS(dst, b1, b2) \
- { int cri; \
- for (cri=0; cri<MSKCNT; cri++) \
- dst[cri] = (b1[cri] & b2[cri]) }
-#define ORBITS(dst, b1, b2) \
- { int cri; \
- for (cri=0; cri<MSKCNT; cri++) \
- dst[cri] = (b1[cri] | b2[cri]) }
-#define UNSETBITS(dst, b1) \
- { int cri; \
- for (cri=0; cri<MSKCNT; cri++) \
- dst[cri] &= ~b1[cri]; }
-#if (MSKCNT==8)
-#define _FSANYSET(src) (src[0] || src[1] || src[2] || src[3] || \
- src[4] || src[5] || src[6] || src[7])
-#endif
-/*
- * If MSKCNT>4 and not 8, then _FSANYSET is a routine defined in FSlibInt.c.
- *
- * #define _FSANYSET(src) (src[0] || src[1] || src[2] || src[3] || src[4] ...)
- */
-#endif
-
-
-#else
-
-#include <X11/Xwinsock.h>
-#include <X11/Xw32defs.h>
-
-typedef fd_set FdSet;
-
-#define CLEARBITS(set) FD_ZERO(&set)
-#define BITSET(set,s) FD_SET(s,&set)
-#define _FSANYSET(set) set.fd_count
-
-#endif
-
-#include <X11/Xtrans.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#include <string.h>
-#else
-char *malloc(), *realloc(), *calloc();
-void exit();
-#ifdef SYSV
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#endif
-
-/*
- * The following definitions can be used for locking requests in multi-threaded
- * address spaces.
- */
-#define LockDisplay(dis)
-#define LockMutex(mutex)
-#define UnlockMutex(mutex)
-#define UnlockDisplay(dis)
-#define FSfree(ptr) free((ptr))
-
-
-/*
- * Note that some machines do not return a valid pointer for malloc(0), in
- * which case we provide an alternate under the control of the
- * define MALLOC_0_RETURNS_NULL. This is necessary because some
- * FSlib code expects malloc(0) to return a valid pointer to storage.
- */
-
-#ifdef MALLOC_0_RETURNS_NULL
-#define FSmalloc(size) malloc(((size) > 0 ? (size) : 1))
-#define FSrealloc(ptr, size) realloc((ptr), ((size) > 0 ? (size) : 1))
-#define FScalloc(nelem, elsize) calloc(((nelem) > 0 ? (nelem) : 1), (elsize))
-
-#else
-
-#define FSmalloc(size) malloc((size))
-#define FSrealloc(ptr, size) realloc((ptr), (size))
-#define FScalloc(nelem, elsize) calloc((nelem), (elsize))
-#endif
-
-/*
- * ReadvFromServer and WritevToSever use struct iovec, normally found
- * in Berkeley systems in <sys/uio.h>. See the readv(2) and writev(2)
- * manual pages for details.
- *
- * struct iovec {
- * caddr_t iov_base;
- * int iov_len;
- * };
- */
-
-#ifdef USG
-
-#if defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA)
-#ifndef __TIMEVAL__
-#define __TIMEVAL__
-struct timeval { /* BSD has in <sys/time.h> */
- long tv_sec;
- long tv_usec;
-};
-
-#endif /* __TIMEVAL__ */
-
-#endif /* not CRAY or umips */
-
-#endif /* USG */
-
-
-#define SearchString(string, char) index((string), (char))
diff --git a/xc/lib/FS/Imakefile b/xc/lib/FS/Imakefile
deleted file mode 100644
index a391d0d24..000000000
--- a/xc/lib/FS/Imakefile
+++ /dev/null
@@ -1,48 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/20 1996/09/28 16:32:46 rws $
-XCOMM $XFree86: xc/lib/FS/Imakefile,v 3.4 1999/02/19 21:26:52 hohndel Exp $
-#define DoNormalLib NormalLibFS
-#define DoSharedLib SharedLibFS
-#define DoExtraLib SharedLibFS
-#define DoDebugLib DebugLibFS
-#define DoProfileLib ProfileLibFS
-#define LibName FS
-#define SoRev SOFSREV
-#define IncSubdir X11
-#define IncSubSubdir fonts
-
-#if Malloc0ReturnsNull
- DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
-DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES)
-
-HEADERS = FSlib.h
-
-INCLUDES = -I$(FONTINCSRC)
-
-SRCS = FSClServ.c FSCloseFt.c FSConnServ.c FSErrDis.c FSErrHndlr.c \
- FSFlush.c FSFontInfo.c FSFtNames.c FSGetCats.c FSListCats.c \
- FSListExt.c FSMisc.c FSNextEv.c FSOpenFont.c FSOpenServ.c \
- FSQGlyphs.c FSQXExt.c FSQXInfo.c FSQuExt.c FSServName.c \
- FSSetCats.c FSSync.c FSSynchro.c FSlibInt.c transport.c
-
-OBJS = FSClServ.o FSCloseFt.o FSConnServ.o FSErrDis.o FSErrHndlr.o \
- FSFlush.o FSFontInfo.o FSFtNames.o FSGetCats.o FSListCats.o \
- FSListExt.o FSMisc.o FSNextEv.o FSOpenFont.o FSOpenServ.o \
- FSQGlyphs.o FSQXExt.o FSQXInfo.o FSQuExt.o FSServName.o \
- FSSetCats.o FSSync.o FSSynchro.o FSlibInt.o transport.o
-
-CONN_DEFINES = $(CONNECTION_FLAGS) -DFS_t -DTRANS_CLIENT
-#if HasBSD44Sockets
-SOCK_DEFINES = -DBSD44SOCKETS
-#endif
-
-#include <Library.tmpl>
-
-SpecialCLibObjectRule(FSlibInt,$(ICONFIGFILES),$(CONN_DEFINES))
-SpecialCLibObjectRule(FSOpenServ,$(ICONFIGFILES),$(CONN_DEFINES))
-SpecialCLibObjectRule(FSConnServ,$(ICONFIGFILES),$(CONN_DEFINES) $(SOCK_DEFINES))
-SpecialCLibObjectRule(transport,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES))
-LinkSourceFile(transport.c,$(TRANSCOMMSRC))
-
-DependTarget()
diff --git a/xc/lib/ICE/ICE-def.cpp b/xc/lib/ICE/ICE-def.cpp
deleted file mode 100644
index cf494cda3..000000000
--- a/xc/lib/ICE/ICE-def.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-LIBRARY ICE
-VERSION LIBRARY_VERSION
-EXPORTS
- IceAcceptConnection
- IceAddConnectionWatch
- IceAllocScratch
- IceAppLockConn
- IceAppUnlockConn
- IceAuthFileName
- IceCheckShutdownNegotiation
- IceCloseConnection
- IceComposeNetworkIdList
- IceConnectionNumber
- IceConnectionStatus
- IceConnectionString
- IceFlush
- IceFreeAuthFileEntry
- IceFreeListenObjs
- IceGenerateMagicCookie
- IceGetAuthFileEntry
- IceGetConnectionContext
- IceGetInBufSize
- IceGetListenConnectionNumber
- IceGetListenConnectionString
- IceGetOutBufSize
- IceInitThreads
- IceLastReceivedSequenceNumber
- IceLastSentSequenceNumber
- IceListenForConnections
- IceLockAuthFile
- IceOpenConnection
- IcePing
- IceProcessMessages
- IceProtocolRevision
- IceProtocolSetup
- IceProtocolShutdown
- IceProtocolVersion
- IceReadAuthFileEntry
- IceRegisterForProtocolReply
- IceRegisterForProtocolSetup
- IceRelease
- IceRemoveConnectionWatch
- IceSetErrorHandler
- IceSetHostBasedAuthProc
- IceSetIOErrorHandler
- IceSetPaAuthData
- IceSetShutdownNegotiation
- IceSwapping
- IceUnlockAuthFile
- IceVendor
- IceWriteAuthFileEntry
- _IceTransGetPeerAddr
- _IceTransGetPeerNetworkId
- _IceErrorBadMinor
- _IceErrorBadLength
- _IceErrorBadState
- _IceErrorBadValue
- _IcePaMagicCookie1Proc
- _IcePoMagicCookie1Proc
- _IceRead
- _IceReadSkip
- _IceWrite
- IceListenForWellKnownConnections
-/* $TOG: ICE-def.cpp /main/7 1998/01/04 12:31:53 kaleb $ */
diff --git a/xc/lib/ICE/ICE.h b/xc/lib/ICE/ICE.h
deleted file mode 100644
index 8d5422efa..000000000
--- a/xc/lib/ICE/ICE.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* $TOG: ICE.h /main/7 1998/02/06 13:56:58 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.
-
-Author: Ralph Mor, X Consortium
-
-******************************************************************************/
-
-#ifndef _ICE_H_
-#define _ICE_H_
-
-/*
- * Protocol Version
- */
-
-#define IceProtoMajor 1
-#define IceProtoMinor 0
-
-
-/*
- * Byte Order
- */
-
-#define IceLSBfirst 0
-#define IceMSBfirst 1
-
-
-/*
- * ICE minor opcodes
- */
-
-#define ICE_Error 0
-#define ICE_ByteOrder 1
-#define ICE_ConnectionSetup 2
-#define ICE_AuthRequired 3
-#define ICE_AuthReply 4
-#define ICE_AuthNextPhase 5
-#define ICE_ConnectionReply 6
-#define ICE_ProtocolSetup 7
-#define ICE_ProtocolReply 8
-#define ICE_Ping 9
-#define ICE_PingReply 10
-#define ICE_WantToClose 11
-#define ICE_NoClose 12
-
-
-/*
- * Error severity
- */
-
-#define IceCanContinue 0
-#define IceFatalToProtocol 1
-#define IceFatalToConnection 2
-
-
-/*
- * ICE error classes that are common to all protocols
- */
-
-#define IceBadMinor 0x8000
-#define IceBadState 0x8001
-#define IceBadLength 0x8002
-#define IceBadValue 0x8003
-
-
-/*
- * ICE error classes that are specific to the ICE protocol
- */
-
-#define IceBadMajor 0
-#define IceNoAuth 1
-#define IceNoVersion 2
-#define IceSetupFailed 3
-#define IceAuthRejected 4
-#define IceAuthFailed 5
-#define IceProtocolDuplicate 6
-#define IceMajorOpcodeDuplicate 7
-#define IceUnknownProtocol 8
-
-#endif /* _ICE_H_ */
diff --git a/xc/lib/ICE/ICEconn.h b/xc/lib/ICE/ICEconn.h
deleted file mode 100644
index a9c613ebe..000000000
--- a/xc/lib/ICE/ICEconn.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/* $TOG: ICEconn.h /main/5 1998/02/06 13:56:22 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#ifndef _ICECONN_H_
-#define _ICECONN_H_
-
-/*
- * Data structures for ICE connection object
- */
-
-typedef struct _IceSavedReplyWait {
- IceReplyWaitInfo *reply_wait;
- Bool reply_ready;
- struct _IceSavedReplyWait *next;
-} _IceSavedReplyWait;
-
-typedef struct _IcePingWait {
- IcePingReplyProc ping_reply_proc;
- IcePointer client_data;
- struct _IcePingWait *next;
-} _IcePingWait;
-
-typedef struct {
- char *vendor;
- char *release;
- int version_count;
- IcePoVersionRec *version_recs;
- int auth_count;
- char **auth_names;
- IcePoAuthProc *auth_procs;
- IceIOErrorProc io_error_proc;
-} _IcePoProtocol;
-
-typedef struct {
- char *vendor;
- char *release;
- int version_count;
- IcePaVersionRec *version_recs;
- IceProtocolSetupProc protocol_setup_proc;
- IceProtocolActivateProc protocol_activate_proc;
- int auth_count;
- char **auth_names;
- IcePaAuthProc *auth_procs;
- IceHostBasedAuthProc host_based_auth_proc;
- IceIOErrorProc io_error_proc;
-} _IcePaProtocol;
-
-typedef struct {
- char *protocol_name;
- _IcePoProtocol *orig_client;
- _IcePaProtocol *accept_client;
-} _IceProtocol;
-
-typedef struct {
- Bool in_use;
- int my_opcode;
- _IceProtocol *protocol;
- IcePointer client_data;
- Bool accept_flag;
- union {
- IcePaProcessMsgProc accept_client;
- IcePoProcessMsgProc orig_client;
- } process_msg_proc;
-} _IceProcessMsgInfo;
-
-typedef struct {
- int his_version_index;
- int my_version_index;
- char *his_vendor;
- char *his_release;
- char my_auth_index;
- IcePointer my_auth_state;
- Bool must_authenticate;
-} _IceConnectToMeInfo;
-
-typedef struct {
- int his_opcode;
- int my_opcode;
- int his_version_index;
- int my_version_index;
- char *his_vendor;
- char *his_release;
- char my_auth_index;
- IcePointer my_auth_state;
- Bool must_authenticate;
-} _IceProtoSetupToMeInfo;
-
-typedef struct {
- Bool auth_active;
- char my_auth_index;
- IcePointer my_auth_state;
-} _IceConnectToYouInfo;
-
-typedef struct {
- int my_opcode;
- int my_auth_count;
- int *my_auth_indices;
- Bool auth_active;
- char my_auth_index;
- IcePointer my_auth_state;
-} _IceProtoSetupToYouInfo;
-
-
-struct _IceConn {
-
- unsigned int io_ok : 1; /* did an IO error occur? */
- unsigned int swap : 1; /* do we need to swap on reads? */
- unsigned int waiting_for_byteorder : 1; /* waiting for a ByteOrder msg? */
- unsigned int skip_want_to_close : 1; /* avoid shutdown negotiation? */
- unsigned int want_to_close : 1; /* did we send a WantToClose? */
- unsigned int free_asap : 1; /* free as soon as possible */
- unsigned int unused1 : 2; /* future use */
- unsigned int unused2 : 8; /* future use */
-
- IceConnectStatus connection_status; /* pending, accepted, rejected */
-
- unsigned char my_ice_version_index; /* which version are we using? */
-
- struct _XtransConnInfo *trans_conn; /* transport connection object */
- unsigned long send_sequence; /* Sequence # of last msg sent */
- unsigned long receive_sequence; /* Sequence # of last msg received */
-
- char *connection_string; /* network connection string */
- char *vendor; /* other client's vendor */
- char *release; /* other client's release */
-
- char *inbuf; /* Input buffer starting address */
- char *inbufptr; /* Input buffer index pointer */
- char *inbufmax; /* Input buffer maximum+1 address */
-
- char *outbuf; /* Output buffer starting address */
- char *outbufptr; /* Output buffer index pointer */
- char *outbufmax; /* Output buffer maximum+1 address */
-
- char *scratch; /* scratch buffer */
- unsigned long scratch_size; /* scratch size */
-
- int dispatch_level; /* IceProcessMessages dispatch level */
-
- IcePointer context; /* context associated with caller
- of IceOpenConnection */
-
- /*
- * Before we read a message, the major opcode of the message must be
- * mapped to our corresponding major opcode (the two clients can use
- * different opcodes for the same protocol). In order to save space,
- * we keep track of the mininum and maximum major opcodes used by the
- * other client. To get the information on how to process this message,
- * we do the following...
- *
- * processMsgInfo = iceConn->process_msg_info[
- * message->majorOpcode - iceConn->his_min_opcode]
- *
- * Note that the number of elements in the iceConn->process_msg_info
- * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1).
- * We check process_msg_info->in_use to see if the opcode is being used.
- */
-
- _IceProcessMsgInfo *process_msg_info;
- char his_min_opcode; /* [1..255] */
- char his_max_opcode; /* [1..255] */
-
-
- /*
- * Number of times this iceConn was returned in IceOpenConnection
- * or IceAcceptConnection.
- */
-
- unsigned char open_ref_count;
-
-
- /*
- * Number of active protocols.
- */
-
- unsigned char proto_ref_count;
-
-
- /*
- * If this ICE connection was created with IceAcceptConnection,
- * the listen_obj field is set to the listen object. Otherwise,
- * the listen_obj field is NULL.
- */
-
- IceListenObj listen_obj;
-
-
-
-
- /*
- * We need to keep track of all the replies we're waiting for.
- * Check the comments in process.c for how this works.
- */
-
- _IceSavedReplyWait *saved_reply_waits;
-
-
- /*
- * We keep track of all Pings sent from the client. When the Ping reply
- * arrives, we remove it from the list.
- */
-
- _IcePingWait *ping_waits;
-
-
- /*
- * Some state for a client doing a Connection/Protocol Setup
- */
-
- _IceConnectToYouInfo *connect_to_you;
- _IceProtoSetupToYouInfo *protosetup_to_you;
-
-
- /*
- * Some state for a client receiving a Connection/Protocol Setup
- */
-
- _IceConnectToMeInfo *connect_to_me;
- _IceProtoSetupToMeInfo *protosetup_to_me;
-
-};
-
-#endif /* _ICECONN_H_ */
diff --git a/xc/lib/ICE/ICElib.h b/xc/lib/ICE/ICElib.h
deleted file mode 100644
index 8486d1293..000000000
--- a/xc/lib/ICE/ICElib.h
+++ /dev/null
@@ -1,534 +0,0 @@
-/* $TOG: ICElib.h /main/42 1998/02/06 13:56:32 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/ICElib.h,v 3.2 1998/10/03 08:41:09 dawes Exp $ */
-
-#ifndef _ICELIB_H_
-#define _ICELIB_H_
-
-#include <X11/ICE/ICE.h>
-#include <X11/Xfuncproto.h>
-
-#define Bool int
-#define Status int
-#define True 1
-#define False 0
-
-#if NeedFunctionPrototypes
-typedef void *IcePointer;
-#else
-typedef char *IcePointer;
-#endif
-
-typedef enum {
- IcePoAuthHaveReply,
- IcePoAuthRejected,
- IcePoAuthFailed,
- IcePoAuthDoneCleanup
-} IcePoAuthStatus;
-
-typedef enum {
- IcePaAuthContinue,
- IcePaAuthAccepted,
- IcePaAuthRejected,
- IcePaAuthFailed
-} IcePaAuthStatus;
-
-typedef enum {
- IceConnectPending,
- IceConnectAccepted,
- IceConnectRejected,
- IceConnectIOError
-} IceConnectStatus;
-
-typedef enum {
- IceProtocolSetupSuccess,
- IceProtocolSetupFailure,
- IceProtocolSetupIOError,
- IceProtocolAlreadyActive
-} IceProtocolSetupStatus;
-
-typedef enum {
- IceAcceptSuccess,
- IceAcceptFailure,
- IceAcceptBadMalloc
-} IceAcceptStatus;
-
-typedef enum {
- IceClosedNow,
- IceClosedASAP,
- IceConnectionInUse,
- IceStartedShutdownNegotiation
-} IceCloseStatus;
-
-typedef enum {
- IceProcessMessagesSuccess,
- IceProcessMessagesIOError,
- IceProcessMessagesConnectionClosed
-} IceProcessMessagesStatus;
-
-typedef struct {
- unsigned long sequence_of_request;
- int major_opcode_of_request;
- int minor_opcode_of_request;
- IcePointer reply;
-} IceReplyWaitInfo;
-
-typedef struct _IceConn *IceConn;
-typedef struct _IceListenObj *IceListenObj;
-
-typedef void (*IceWatchProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer /* clientData */,
- Bool /* opening */,
- IcePointer * /* watchData */
-#endif
-);
-
-typedef void (*IcePoProcessMsgProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer /* clientData */,
- int /* opcode */,
- unsigned long /* length */,
- Bool /* swap */,
- IceReplyWaitInfo * /* replyWait */,
- Bool * /* replyReadyRet */
-#endif
-);
-
-typedef void (*IcePaProcessMsgProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer /* clientData */,
- int /* opcode */,
- unsigned long /* length */,
- Bool /* swap */
-#endif
-);
-
-typedef struct {
- int major_version;
- int minor_version;
- IcePoProcessMsgProc process_msg_proc;
-} IcePoVersionRec;
-
-typedef struct {
- int major_version;
- int minor_version;
- IcePaProcessMsgProc process_msg_proc;
-} IcePaVersionRec;
-
-typedef IcePoAuthStatus (*IcePoAuthProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer * /* authStatePtr */,
- Bool /* cleanUp */,
- Bool /* swap */,
- int /* authDataLen */,
- IcePointer /* authData */,
- int * /* replyDataLenRet */,
- IcePointer * /* replyDataRet */,
- char ** /* errorStringRet */
-#endif
-);
-
-typedef IcePaAuthStatus (*IcePaAuthProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer * /* authStatePtr */,
- Bool /* swap */,
- int /* authDataLen */,
- IcePointer /* authData */,
- int * /* replyDataLenRet */,
- IcePointer * /* replyDataRet */,
- char ** /* errorStringRet */
-#endif
-);
-
-typedef Bool (*IceHostBasedAuthProc) (
-#if NeedFunctionPrototypes
- char * /* hostName */
-#endif
-);
-
-typedef Status (*IceProtocolSetupProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorVersion */,
- int /* minorVersion */,
- char * /* vendor */,
- char * /* release */,
- IcePointer * /* clientDataRet */,
- char ** /* failureReasonRet */
-#endif
-);
-
-typedef void (*IceProtocolActivateProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer /* clientData */
-#endif
-);
-
-typedef void (*IceIOErrorProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-typedef void (*IcePingReplyProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePointer /* clientData */
-#endif
-);
-
-typedef void (*IceErrorHandler) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- Bool /* swap */,
- int /* offendingMinorOpcode */,
- unsigned long /* offendingSequence */,
- int /* errorClass */,
- int /* severity */,
- IcePointer /* values */
-#endif
-);
-
-typedef void (*IceIOErrorHandler) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-
-/*
- * Function prototypes
- */
-
-_XFUNCPROTOBEGIN
-
-extern int IceRegisterForProtocolSetup (
-#if NeedFunctionPrototypes
- char * /* protocolName */,
- char * /* vendor */,
- char * /* release */,
- int /* versionCount */,
- IcePoVersionRec * /* versionRecs */,
- int /* authCount */,
- char ** /* authNames */,
- IcePoAuthProc * /* authProcs */,
- IceIOErrorProc /* IOErrorProc */
-#endif
-);
-
-extern int IceRegisterForProtocolReply (
-#if NeedFunctionPrototypes
- char * /* protocolName */,
- char * /* vendor */,
- char * /* release */,
- int /* versionCount */,
- IcePaVersionRec * /* versionRecs */,
- int /* authCount */,
- char ** /* authNames */,
- IcePaAuthProc * /* authProcs */,
- IceHostBasedAuthProc /* hostBasedAuthProc */,
- IceProtocolSetupProc /* protocolSetupProc */,
- IceProtocolActivateProc /* protocolActivateProc */,
- IceIOErrorProc /* IOErrorProc */
-#endif
-);
-
-extern IceConn IceOpenConnection (
-#if NeedFunctionPrototypes
- char * /* networkIdsList */,
- IcePointer /* context */,
- Bool /* mustAuthenticate */,
- int /* majorOpcodeCheck */,
- int /* errorLength */,
- char * /* errorStringRet */
-#endif
-);
-
-extern IcePointer IceGetConnectionContext (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern Status IceListenForConnections (
-#if NeedFunctionPrototypes
- int * /* countRet */,
- IceListenObj ** /* listenObjsRet */,
- int /* errorLength */,
- char * /* errorStringRet */
-#endif
-);
-
-extern Status IceListenForWellKnownConnections (
-#if NeedFunctionPrototypes
- char * /* port */,
- int * /* countRet */,
- IceListenObj ** /* listenObjsRet */,
- int /* errorLength */,
- char * /* errorStringRet */
-#endif
-);
-
-extern int IceGetListenConnectionNumber (
-#if NeedFunctionPrototypes
- IceListenObj /* listenObj */
-#endif
-);
-
-extern char *IceGetListenConnectionString (
-#if NeedFunctionPrototypes
- IceListenObj /* listenObj */
-#endif
-);
-
-extern char *IceComposeNetworkIdList (
-#if NeedFunctionPrototypes
- int /* count */,
- IceListenObj * /* listenObjs */
-#endif
-);
-
-extern void IceFreeListenObjs (
-#if NeedFunctionPrototypes
- int /* count */,
- IceListenObj * /* listenObjs */
-#endif
-);
-
-extern void IceSetHostBasedAuthProc (
-#if NeedFunctionPrototypes
- IceListenObj /* listenObj */,
- IceHostBasedAuthProc /* hostBasedAuthProc */
-#endif
-);
-
-extern IceConn IceAcceptConnection (
-#if NeedFunctionPrototypes
- IceListenObj /* listenObj */,
- IceAcceptStatus * /* statusRet */
-#endif
-);
-
-extern void IceSetShutdownNegotiation (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- Bool /* negotiate */
-#endif
-);
-
-extern Bool IceCheckShutdownNegotiation (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern IceCloseStatus IceCloseConnection (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern Status IceAddConnectionWatch (
-#if NeedFunctionPrototypes
- IceWatchProc /* watchProc */,
- IcePointer /* clientData */
-#endif
-);
-
-extern void IceRemoveConnectionWatch (
-#if NeedFunctionPrototypes
- IceWatchProc /* watchProc */,
- IcePointer /* clientData */
-#endif
-);
-
-extern IceProtocolSetupStatus IceProtocolSetup (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* myOpcode */,
- IcePointer /* clientData */,
- Bool /* mustAuthenticate */,
- int * /* majorVersionRet */,
- int * /* minorVersionRet */,
- char ** /* vendorRet */,
- char ** /* releaseRet */,
- int /* errorLength */,
- char * /* errorStringRet */
-#endif
-);
-
-extern Status IceProtocolShutdown (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */
-#endif
-);
-
-extern IceProcessMessagesStatus IceProcessMessages (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IceReplyWaitInfo * /* replyWait */,
- Bool * /* replyReadyRet */
-#endif
-);
-
-extern Status IcePing (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IcePingReplyProc /* pingReplyProc */,
- IcePointer /* clientData */
-#endif
-);
-
-extern char *IceAllocScratch (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- unsigned long /* size */
-#endif
-);
-
-extern int IceFlush (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern int IceGetOutBufSize (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern int IceGetInBufSize (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern IceConnectStatus IceConnectionStatus (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern char *IceVendor (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern char *IceRelease (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern int IceProtocolVersion (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern int IceProtocolRevision (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern int IceConnectionNumber (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern char *IceConnectionString (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern unsigned long IceLastSentSequenceNumber (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern unsigned long IceLastReceivedSequenceNumber (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern Bool IceSwapping (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern IceErrorHandler IceSetErrorHandler (
-#if NeedFunctionPrototypes
- IceErrorHandler /* handler */
-#endif
-);
-
-extern IceIOErrorHandler IceSetIOErrorHandler (
-#if NeedFunctionPrototypes
- IceIOErrorHandler /* handler */
-#endif
-);
-
-
-/*
- * Multithread Routines
- */
-
-extern Status IceInitThreads (
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void IceAppLockConn (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern void IceAppUnlockConn (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-_XFUNCPROTOEND
-
-#endif /* _ICELIB_H_ */
diff --git a/xc/lib/ICE/ICElibint.h b/xc/lib/ICE/ICElibint.h
deleted file mode 100644
index de929db93..000000000
--- a/xc/lib/ICE/ICElibint.h
+++ /dev/null
@@ -1,584 +0,0 @@
-/* $TOG: ICElibint.h /main/43 1998/02/06 13:56:27 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#ifndef _ICELIBINT_H_
-#define _ICELIBINT_H_
-
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xmd.h>
-#include <X11/ICE/ICEproto.h>
-#include <X11/ICE/ICEconn.h>
-#include <X11/ICE/ICEmsg.h>
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-char *malloc();
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/*
- * Vendor & Release
- */
-
-#define IceVendorString "MIT"
-#define IceReleaseString "1.0"
-
-
-/*
- * Pad to a 64 bit boundary
- */
-
-#define PAD64(_bytes) ((8 - ((unsigned int) (_bytes) % 8)) % 8)
-
-#define PADDED_BYTES64(_bytes) (_bytes + PAD64 (_bytes))
-
-
-/*
- * Pad to 32 bit boundary
- */
-
-#define PAD32(_bytes) ((4 - ((unsigned int) (_bytes) % 4)) % 4)
-
-#define PADDED_BYTES32(_bytes) (_bytes + PAD32 (_bytes))
-
-
-/*
- * Number of 8 byte units in _bytes.
- */
-
-#define WORD64COUNT(_bytes) (((unsigned int) ((_bytes) + 7)) >> 3)
-
-
-/*
- * Number of 4 byte units in _bytes.
- */
-
-#define WORD32COUNT(_bytes) (((unsigned int) ((_bytes) + 3)) >> 2)
-
-
-/*
- * Given a string, compute the number of bytes for the STRING representation
- */
-
-#define STRING_BYTES(_string) \
- (2 + strlen (_string) + PAD32 (2 + strlen (_string)))
-
-
-/*
- * Size of ICE input/output buffers
- */
-
-#define ICE_INBUFSIZE 1024
-
-#define ICE_OUTBUFSIZE 1024
-
-
-/*
- * Maxium number of ICE authentication methods allowed, and maxiumum
- * number of authentication data entries allowed to be set in the
- * IceSetPaAuthData function.
- *
- * We should use linked lists, but this is easier and should suffice.
- */
-
-#define MAX_ICE_AUTH_NAMES 32
-#define ICE_MAX_AUTH_DATA_ENTRIES 100
-
-
-/*
- * ICE listen object
- */
-
-struct _IceListenObj {
- struct _XtransConnInfo *trans_conn; /* transport connection object */
- char *network_id;
- IceHostBasedAuthProc host_based_auth_proc;
-};
-
-
-/*
- * Some internal data structures for processing ICE messages.
- */
-
-typedef void (*_IceProcessCoreMsgProc) (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* opcode */,
- unsigned long /* length */,
- Bool /* swap */,
- IceReplyWaitInfo * /* replyWait */,
- Bool * /* replyReadyRet */,
- Bool * /* connectionClosedRet */
-#endif
-);
-
-typedef struct {
- int major_version;
- int minor_version;
- _IceProcessCoreMsgProc process_core_msg_proc;
-} _IceVersion;
-
-
-/*
- * STORE FOO
- */
-
-#define STORE_CARD8(_pBuf, _val) \
-{ \
- *((CARD8 *) _pBuf) = _val; \
- _pBuf += 1; \
-}
-
-#ifndef WORD64
-
-#define STORE_CARD16(_pBuf, _val) \
-{ \
- *((CARD16 *) _pBuf) = _val; \
- _pBuf += 2; \
-}
-
-#define STORE_CARD32(_pBuf, _val) \
-{ \
- *((CARD32 *) _pBuf) = _val; \
- _pBuf += 4; \
-}
-
-#else /* WORD64 */
-
-#define STORE_CARD16(_pBuf, _val) \
-{ \
- struct { \
- int value :16; \
- int pad :16; \
- } _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, 2); \
- _pBuf += 2; \
-}
-
-#define STORE_CARD32(_pBuf, _val) \
-{ \
- struct { \
- int value :32; \
- } _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, 4); \
- _pBuf += 4; \
-}
-
-#endif /* WORD64 */
-
-#define STORE_STRING(_pBuf, _string) \
-{ \
- CARD16 _len = strlen (_string); \
- STORE_CARD16 (_pBuf, _len); \
- memcpy (_pBuf, _string, _len); \
- _pBuf += _len; \
- if (PAD32 (2 + _len)) \
- _pBuf += PAD32 (2 + _len); \
-}
-
-
-/*
- * EXTRACT FOO
- */
-
-#define EXTRACT_CARD8(_pBuf, _val) \
-{ \
- _val = *((CARD8 *) _pBuf); \
- _pBuf += 1; \
-}
-
-#ifndef WORD64
-
-#define EXTRACT_CARD16(_pBuf, _swap, _val) \
-{ \
- _val = *((CARD16 *) _pBuf); \
- _pBuf += 2; \
- if (_swap) \
- _val = lswaps (_val); \
-}
-
-#define EXTRACT_CARD32(_pBuf, _swap, _val) \
-{ \
- _val = *((CARD32 *) _pBuf); \
- _pBuf += 4; \
- if (_swap) \
- _val = lswapl (_val); \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_CARD16(_pBuf, _swap, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
- _pBuf += 2; \
- if (_swap) \
- _val = lswaps (_val); \
-}
-
-#define EXTRACT_CARD32(_pBuf, _swap, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 2) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 3) & 0xff;\
- _pBuf += 4; \
- if (_swap) \
- _val = lswapl (_val); \
-}
-
-#endif /* WORD64 */
-
-#define EXTRACT_STRING(_pBuf, _swap, _string) \
-{ \
- CARD16 _len; \
- EXTRACT_CARD16 (_pBuf, _swap, _len); \
- _string = (char *) malloc (_len + 1); \
- memcpy (_string, _pBuf, _len); \
- _pBuf += _len; \
- _string[_len] = '\0'; \
- if (PAD32 (2 + _len)) \
- _pBuf += PAD32 (2 + _len); \
-}
-
-#define EXTRACT_LISTOF_STRING(_pBuf, _swap, _count, _strings) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- EXTRACT_STRING (_pBuf, _swap, _strings[_i]); \
-}
-
-
-#define SKIP_STRING(_pBuf, _swap) \
-{ \
- CARD16 _len; \
- EXTRACT_CARD16 (_pBuf, _swap, _len); \
- _pBuf += _len; \
- if (PAD32 (2 + _len)) \
- _pBuf += PAD32 (2 + _len); \
-}
-
-#define SKIP_LISTOF_STRING(_pBuf, _swap, _count) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- SKIP_STRING (_pBuf, _swap); \
-}
-
-
-
-/*
- * Byte swapping
- */
-
-/* byte swap a long literal */
-#define lswapl(_val) ((((_val) & 0xff) << 24) |\
- (((_val) & 0xff00) << 8) |\
- (((_val) & 0xff0000) >> 8) |\
- (((_val) >> 24) & 0xff))
-
-/* byte swap a short literal */
-#define lswaps(_val) ((((_val) & 0xff) << 8) | (((_val) >> 8) & 0xff))
-
-
-
-/*
- * ICE replies (not processed via callbacks because we block)
- */
-
-#define ICE_CONNECTION_REPLY 1
-#define ICE_CONNECTION_ERROR 2
-#define ICE_PROTOCOL_REPLY 3
-#define ICE_PROTOCOL_ERROR 4
-
-typedef struct {
- int type;
- int version_index;
- char *vendor;
- char *release;
-} _IceConnectionReply;
-
-typedef struct {
- int type;
- char *error_message;
-} _IceConnectionError;
-
-typedef struct {
- int type;
- int major_opcode;
- int version_index;
- char *vendor;
- char *release;
-} _IceProtocolReply;
-
-typedef struct {
- int type;
- char *error_message;
-} _IceProtocolError;
-
-
-typedef union {
- int type;
- _IceConnectionReply connection_reply;
- _IceConnectionError connection_error;
- _IceProtocolReply protocol_reply;
- _IceProtocolError protocol_error;
-} _IceReply;
-
-
-/*
- * Watch for ICE connection create/destroy.
- */
-
-typedef struct _IceWatchedConnection {
- IceConn iceConn;
- IcePointer watch_data;
- struct _IceWatchedConnection *next;
-} _IceWatchedConnection;
-
-typedef struct _IceWatchProc {
- IceWatchProc watch_proc;
- IcePointer client_data;
- _IceWatchedConnection *watched_connections;
- struct _IceWatchProc *next;
-} _IceWatchProc;
-
-
-/*
- * Locking
- */
-
-#define IceLockConn(_iceConn)
-#define IceUnlockConn(_iceConn)
-
-
-/*
- * Extern declarations
- */
-
-extern IceConn _IceConnectionObjs[];
-extern char *_IceConnectionStrings[];
-extern int _IceConnectionCount;
-
-extern _IceProtocol _IceProtocols[];
-extern int _IceLastMajorOpcode;
-
-extern int _IceAuthCount;
-extern char *_IceAuthNames[];
-extern IcePoAuthProc _IcePoAuthProcs[];
-extern IcePaAuthProc _IcePaAuthProcs[];
-
-extern int _IceVersionCount;
-extern _IceVersion _IceVersions[];
-
-extern _IceWatchProc *_IceWatchProcs;
-
-extern IceErrorHandler _IceErrorHandler;
-extern IceIOErrorHandler _IceIOErrorHandler;
-
-
-extern void _IceErrorBadMajor (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* offendingMajor */,
- int /* offendingMinor */,
- int /* severity */
-#endif
-);
-
-extern void _IceErrorNoAuthentication (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* offendingMinor */
-#endif
-);
-
-extern void _IceErrorNoVersion (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* offendingMinor */
-#endif
-);
-
-extern void _IceErrorSetupFailed (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* offendingMinor */,
- char * /* reason */
-#endif
-);
-
-extern void _IceErrorAuthenticationRejected (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* offendingMinor */,
- char * /* reason */
-#endif
-);
-
-extern void _IceErrorAuthenticationFailed (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* offendingMinor */,
- char * /* reason */
-#endif
-);
-
-extern void _IceErrorProtocolDuplicate (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- char * /* protocolName */
-#endif
-);
-
-extern void _IceErrorMajorOpcodeDuplicate (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */
-#endif
-);
-
-extern void _IceErrorUnknownProtocol (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- char * /* protocolName */
-#endif
-);
-
-extern void _IceAddOpcodeMapping (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* hisOpcode */,
- int /* myOpcode */
-#endif
-);
-
-extern char *_IceGetPeerName (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern void _IceFreeConnection (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern void _IceAddReplyWait (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IceReplyWaitInfo * /* replyWait */
-#endif
-);
-
-extern IceReplyWaitInfo *_IceSearchReplyWaits (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */
-#endif
-);
-
-extern void _IceSetReplyReady (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IceReplyWaitInfo * /* replyWait */
-#endif
-);
-
-extern Bool _IceCheckReplyReady (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- IceReplyWaitInfo * /* replyWait */
-#endif
-);
-
-extern void _IceConnectionOpened (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern void _IceConnectionClosed (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */
-#endif
-);
-
-extern void _IceGetPoAuthData (
-#if NeedFunctionPrototypes
- char * /* protocol_name */,
- char * /* address */,
- char * /* auth_name */,
- unsigned short * /* auth_data_length_ret */,
- char ** /* auth_data_ret */
-#endif
-);
-
-extern void _IceGetPaAuthData (
-#if NeedFunctionPrototypes
- char * /* protocol_name */,
- char * /* address */,
- char * /* auth_name */,
- unsigned short * /* auth_data_length_ret */,
- char ** /* auth_data_ret */
-#endif
-);
-
-extern void _IceGetPoValidAuthIndices (
-#if NeedFunctionPrototypes
- char * /* protocol_name */,
- char * /* address */,
- int /* num_auth_names */,
- char ** /* auth_names */,
- int * /* num_indices_ret */,
- int * /* indices_ret */
-#endif
-);
-
-extern void _IceGetPaValidAuthIndices (
-#if NeedFunctionPrototypes
- char * /* protocol_name */,
- char * /* address */,
- int /* num_auth_names */,
- char ** /* auth_names */,
- int * /* num_indices_ret */,
- int * /* indices_ret */
-#endif
-);
-
-#endif /* _ICELIBINT_H_ */
diff --git a/xc/lib/ICE/ICEmsg.h b/xc/lib/ICE/ICEmsg.h
deleted file mode 100644
index 9f9452615..000000000
--- a/xc/lib/ICE/ICEmsg.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/* $TOG: ICEmsg.h /main/6 1998/02/06 13:56:38 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#ifndef _ICEMSG_H_
-#define _ICEMSG_H_
-
-#include <X11/ICE/ICEconn.h>
-
-/*
- * Function prototypes for internal ICElib functions
- */
-
-extern Status _IceRead (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- unsigned long /* nbytes */,
- char * /* ptr */
-#endif
-);
-
-extern void _IceReadSkip (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- unsigned long /* nbytes */
-#endif
-);
-
-extern void _IceWrite (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- unsigned long /* nbytes */,
- char * /* ptr */
-#endif
-);
-
-
-extern void _IceErrorBadMinor (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */,
- int /* offendingMinor */,
- int /* severity */
-#endif
-);
-
-extern void _IceErrorBadState (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */,
- int /* offendingMinor */,
- int /* severity */
-#endif
-);
-
-extern void _IceErrorBadLength (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */,
- int /* offendingMinor */,
- int /* severity */
-#endif
-);
-
-extern void _IceErrorBadValue (
-#if NeedFunctionPrototypes
- IceConn /* iceConn */,
- int /* majorOpcode */,
- int /* offendingMinor */,
- int /* offset */,
- int /* length */,
- IcePointer /* value */
-#endif
-);
-
-
-/*
- * Macro to check if IO operations are valid on an ICE connection.
- */
-
-#define IceValidIO(_iceConn) _iceConn->io_ok
-
-
-/*
- * Macros for writing messages.
- */
-
-#define IceGetHeader(_iceConn, _major, _minor, _headerSize, _msgType, _pMsg) \
- if ((_iceConn->outbufptr + _headerSize) > _iceConn->outbufmax) \
- IceFlush (_iceConn); \
- _pMsg = (_msgType *) _iceConn->outbufptr; \
- _pMsg->majorOpcode = _major; \
- _pMsg->minorOpcode = _minor; \
- _pMsg->length = (_headerSize - SIZEOF (iceMsg)) >> 3; \
- _iceConn->outbufptr += _headerSize; \
- _iceConn->send_sequence++
-
-#define IceGetHeaderExtra(_iceConn, _major, _minor, _headerSize, _extra, _msgType, _pMsg, _pData) \
- if ((_iceConn->outbufptr + \
- _headerSize + ((_extra) << 3)) > _iceConn->outbufmax) \
- IceFlush (_iceConn); \
- _pMsg = (_msgType *) _iceConn->outbufptr; \
- if ((_iceConn->outbufptr + \
- _headerSize + ((_extra) << 3)) <= _iceConn->outbufmax) \
- _pData = (char *) _pMsg + _headerSize; \
- else \
- _pData = NULL; \
- _pMsg->majorOpcode = _major; \
- _pMsg->minorOpcode = _minor; \
- _pMsg->length = ((_headerSize - SIZEOF (iceMsg)) >> 3) + (_extra); \
- _iceConn->outbufptr += (_headerSize + ((_extra) << 3)); \
- _iceConn->send_sequence++
-
-#define IceSimpleMessage(_iceConn, _major, _minor) \
-{ \
- iceMsg *_pMsg; \
- IceGetHeader (_iceConn, _major, _minor, SIZEOF (iceMsg), iceMsg, _pMsg); \
-}
-
-#define IceErrorHeader(_iceConn, _offendingMajorOpcode, _offendingMinorOpcode, _offendingSequenceNum, _severity, _errorClass, _dataLength) \
-{ \
- iceErrorMsg *_pMsg; \
-\
- IceGetHeader (_iceConn, _offendingMajorOpcode, ICE_Error, \
- SIZEOF (iceErrorMsg), iceErrorMsg, _pMsg); \
- _pMsg->length += (_dataLength); \
- _pMsg->offendingMinorOpcode = _offendingMinorOpcode; \
- _pMsg->severity = _severity; \
- _pMsg->offendingSequenceNum = _offendingSequenceNum; \
- _pMsg->errorClass = _errorClass; \
-}
-
-
-/*
- * Write data into the ICE output buffer.
- */
-
-#define IceWriteData(_iceConn, _bytes, _data) \
-{ \
- if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
- { \
- IceFlush (_iceConn); \
- _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
- } \
- else \
- { \
- memcpy (_iceConn->outbufptr, _data, _bytes); \
- _iceConn->outbufptr += (_bytes); \
- } \
-}
-
-#ifndef WORD64
-
-#define IceWriteData16(_iceConn, _bytes, _data) \
- IceWriteData (_iceConn, _bytes, (char *) _data)
-
-#define IceWriteData32(_iceConn, _bytes, _data) \
- IceWriteData (_iceConn, _bytes, (char *) _data)
-
-#else /* WORD64 */
-
-/* IceWriteData16 and IceWriteData32 defined in misc.c for WORD64 */
-
-#endif /* WORD64 */
-
-
-/*
- * The IceSendData macro bypasses copying the data to the
- * ICE connection buffer and sends the data directly. If necessary,
- * the ICE connection buffer is first flushed.
- */
-
-#define IceSendData(_iceConn, _bytes, _data) \
-{ \
- if (_iceConn->outbufptr > _iceConn->outbuf) \
- IceFlush (_iceConn); \
- _IceWrite (_iceConn, (unsigned long) (_bytes), _data); \
-}
-
-
-/*
- * Write pad bytes. Used to force 32 or 64 bit alignment.
- * A maxium of 7 pad bytes can be specified.
- */
-
-#define IceWritePad(_iceConn, _bytes) \
-{ \
- if ((_iceConn->outbufptr + (_bytes)) > _iceConn->outbufmax) \
- { \
- char _dummy[7]; \
- IceFlush (_iceConn); \
- _IceWrite (_iceConn, (unsigned long) (_bytes), _dummy); \
- } \
- else \
- { \
- _iceConn->outbufptr += (_bytes); \
- } \
-}
-
-
-/*
- * Macros for reading messages.
- */
-
-#define IceReadCompleteMessage(_iceConn, _headerSize, _msgType, _pMsg, _pData)\
-{ \
- unsigned long _bytes; \
- IceReadMessageHeader (_iceConn, _headerSize, _msgType, _pMsg); \
- _bytes = (_pMsg->length << 3) - (_headerSize - SIZEOF (iceMsg)); \
- if ((_iceConn->inbufmax - _iceConn->inbufptr) >= _bytes) \
- { \
- _IceRead (_iceConn, _bytes, _iceConn->inbufptr); \
- _pData = _iceConn->inbufptr; \
- _iceConn->inbufptr += _bytes; \
- } \
- else \
- { \
- _pData = (char *) malloc ((unsigned) _bytes); \
- if (_pData) \
- _IceRead (_iceConn, _bytes, _pData); \
- else \
- _IceReadSkip (_iceConn, _bytes); \
- } \
-}
-
-#define IceDisposeCompleteMessage(_iceConn, _pData) \
- if ((char *) _pData < _iceConn->inbuf || \
- (char *) _pData >= _iceConn->inbufmax) \
- free ((char *) _pData);
-
-
-#define IceReadSimpleMessage(_iceConn, _msgType, _pMsg) \
- _pMsg = (_msgType *) (_iceConn->inbuf);
-
-#define IceReadMessageHeader(_iceConn, _headerSize, _msgType, _pMsg) \
-{ \
- _IceRead (_iceConn, \
- (unsigned long) (_headerSize - SIZEOF (iceMsg)), \
- _iceConn->inbufptr); \
- _pMsg = (_msgType *) (_iceConn->inbuf); \
- _iceConn->inbufptr += (_headerSize - SIZEOF (iceMsg)); \
-}
-
-#define IceReadData(_iceConn, _bytes, _pData) \
- _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
-
-#ifndef WORD64
-
-#define IceReadData16(_iceConn, _swap, _bytes, _pData) \
-{ \
- _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
-}
-
-#define IceReadData32(_iceConn, _swap, _bytes, _pData) \
-{ \
- _IceRead (_iceConn, (unsigned long) (_bytes), (char *) _pData); \
-}
-
-#else /* WORD64 */
-
-/* IceReadData16 and IceReadData32 defined in misc.c for WORD64 */
-
-#endif /* WORD64 */
-
-
-/*
- * Read pad bytes (for 32 or 64 bit alignment).
- * A maxium of 7 pad bytes can be specified.
- */
-
-#define IceReadPad(_iceConn, _bytes) \
-{ \
- char _dummy[7]; \
- _IceRead (_iceConn, (unsigned long) (_bytes), _dummy); \
-}
-
-#endif /* _ICEMSG_H_ */
diff --git a/xc/lib/ICE/ICEos2.def b/xc/lib/ICE/ICEos2.def
deleted file mode 100644
index 987b19d34..000000000
--- a/xc/lib/ICE/ICEos2.def
+++ /dev/null
@@ -1,134 +0,0 @@
-LIBRARY ICE
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/ICE/ICEos2.def,v 3.7 1999/04/29 09:13:27 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- IceAcceptConnection @ 1
- IceAddConnectionWatch @ 2
- IceAllocScratch @ 3
- IceAppLockConn @ 4
- IceAppUnlockConn @ 5
- IceAuthFileName @ 6
- IceCheckShutdownNegotiation @ 7
- IceCloseConnection @ 8
- IceComposeNetworkIdList @ 9
- IceConnectionNumber @ 10
- IceConnectionStatus @ 11
- IceConnectionString @ 12
- IceFlush @ 13
- IceFreeAuthFileEntry @ 14
- IceFreeListenObjs @ 15
- IceGenerateMagicCookie @ 16
- IceGetAuthFileEntry @ 17
- IceGetConnectionContext @ 18
- IceGetInBufSize @ 19
- IceGetListenConnectionNumber @ 20
- IceGetListenConnectionString @ 21
- IceGetOutBufSize @ 22
- IceInitThreads @ 23
- IceLastReceivedSequenceNumber @ 24
- IceLastSentSequenceNumber @ 25
- IceListenForConnections @ 26
- IceLockAuthFile @ 27
- IceOpenConnection @ 28
- IcePing @ 29
- IceProcessMessages @ 30
- IceProtocolRevision @ 31
- IceProtocolSetup @ 32
- IceProtocolShutdown @ 33
- IceProtocolVersion @ 34
- IceReadAuthFileEntry @ 35
- IceRegisterForProtocolReply @ 36
- IceRegisterForProtocolSetup @ 37
- IceRelease @ 38
- IceRemoveConnectionWatch @ 39
- IceSetErrorHandler @ 40
- IceSetHostBasedAuthProc @ 41
- IceSetIOErrorHandler @ 42
- IceSetPaAuthData @ 43
- IceSetShutdownNegotiation @ 44
- IceSwapping @ 45
- IceUnlockAuthFile @ 46
- IceVendor @ 47
- IceWriteAuthFileEntry @ 48
- _IceTransGetPeerAddr @ 49
- _IceTransGetPeerNetworkId @ 50
- _IceErrorBadMinor @ 51
- _IceErrorBadLength @ 52
- _IceErrorBadState @ 53
- _IceErrorBadValue @ 54
- _IcePaMagicCookie1Proc @ 55
- _IcePoMagicCookie1Proc @ 56
- _IceRead @ 57
- _IceReadSkip @ 58
- _IceWrite @ 59
- _IceErrorNoAuthentication @ 60
- _IceErrorNoVersion @ 61
- _IceErrorAuthenticationRejected @ 62
- _IceErrorAuthenticationFailed @ 63
- _IceErrorProtocolDuplicate @ 64
- _IceErrorMajorOpcodeDuplicate @ 65
- _IceErrorUnknownProtocol @ 66
- _IceErrorBadMajor @ 67
- _IceDefaultErrorHandler @ 68
- _IceDefaultIOErrorHandler @ 69
- _IceGetPoValidAuthIndices @ 70
- _IceGetPaValidAuthIndices @ 71
- _IceAddOpcodeMapping @ 72
- _IceGetPeerName @ 73
- _IceProcessCoreMessage @ 74
- _IceAddReplyWait @ 75
- _IceSearchReplyWaits @ 76
- _IceCheckReplyReady @ 77
- _IceFreeConnection @ 78
- _IceConnectionOpened @ 79
- _IceConnectionClosed @ 80
- _IceErrorSetupFailed @ 81
- _IceGetPoAuthData @ 82
- _IceGetPaAuthData @ 83
- _IceTransOpenCOTSClient @ 84
- _IceTransOpenCOTSServer @ 85
- _IceTransOpenCLTSClient @ 86
- _IceTransOpenCLTSServer @ 87
- _IceTransSetOption @ 88
- _IceTransCreateListener @ 89
- _IceTransResetListener @ 90
- _IceTransAccept @ 91
- _IceTransConnect @ 92
- _IceTransBytesReadable @ 93
- _IceTransRead @ 94
- _IceTransWrite @ 95
- _IceTransReadv @ 96
- _IceTransWritev @ 97
- _IceTransDisconnect @ 98
- _IceTransClose @ 99
- _IceTransCloseForCloning @ 100
- _IceTransIsLocal @ 101
- _IceTransGetMyAddr @ 102
- _IceTransGetConnectionNumber @ 103
- _IceTransMakeAllCOTSServerListeners @ 104
- _IceTransMakeAllCLTSServerListeners @ 105
- _IceTransGetHostname @ 106
- _IceTransGetMyNetworkId @ 107
- _IceConnectionCount @ 108
- _IceLastMajorOpcode @ 109
- _IceAuthCount @ 110
- _IceAuthNames @ 111
- _IcePoAuthProcs @ 112
- _IcePaAuthProcs @ 113
- _IcePaAuthDataEntryCount @ 114
- _IceVersionCount @ 115
- _IceVersions @ 116
- _IceWatchProcs @ 117
- _IceErrorHandler @ 118
- _IceIOErrorHandler @ 119
- _IceConnectionObjs @ 120
- _IceConnectionStrings @ 121
- _IceProtocols @ 122
- _IcePaAuthDataEntries @ 123
- _IceTransSocketINETFuncs @ 124
- _IceTransSocketTCPFuncs @ 125
- IceListenForWellKnownConnections @ 126
diff --git a/xc/lib/ICE/ICEos2.rsp b/xc/lib/ICE/ICEos2.rsp
deleted file mode 100644
index 6aaf77c1e..000000000
--- a/xc/lib/ICE/ICEos2.rsp
+++ /dev/null
@@ -1,6 +0,0 @@
-accept.obj authutil.obj connect.obj error.obj getauth.obj iceauth.obj+
-listen.obj locking.obj misc.obj ping.obj process.obj protosetup.obj+
-register.obj replywait.obj setauth.obj shutdown.obj transport.obj+
-watch.obj listenwk.obj /NOI /NOL /NOD /BAT
-ICE.dll
-ICE.map
diff --git a/xc/lib/ICE/ICEproto.h b/xc/lib/ICE/ICEproto.h
deleted file mode 100644
index 629da6eba..000000000
--- a/xc/lib/ICE/ICEproto.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* $TOG: ICEproto.h /main/8 1998/02/06 13:56:44 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#ifndef _ICEPROTO_H_
-#define _ICEPROTO_H_
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 data[2];
- CARD32 length B32;
-} iceMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD16 errorClass B16;
- CARD32 length B32;
- CARD8 offendingMinorOpcode;
- CARD8 severity;
- CARD16 unused B16;
- CARD32 offendingSequenceNum B32;
- /* n varying values */
- /* p p = pad (n, 8) */
-} iceErrorMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 byteOrder;
- CARD8 unused;
- CARD32 length B32;
-} iceByteOrderMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 versionCount;
- CARD8 authCount;
- CARD32 length B32;
- CARD8 mustAuthenticate;
- CARD8 unused[7];
- /* i STRING vendor */
- /* j STRING release */
- /* k LIST of STRING authentication-protocol-names */
- /* m LIST of VERSION version-list */
- /* p p = pad (i+j+k+m, 8) */
-} iceConnectionSetupMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 authIndex;
- CARD8 unused1;
- CARD32 length B32;
- CARD16 authDataLength B16;
- CARD8 unused2[6];
- /* n varying data */
- /* p p = pad (n, 8) */
-} iceAuthRequiredMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused1[2];
- CARD32 length B32;
- CARD16 authDataLength B16;
- CARD8 unused2[6];
- /* n varying data */
- /* p p = pad (n, 8) */
-} iceAuthReplyMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused1[2];
- CARD32 length B32;
- CARD16 authDataLength B16;
- CARD8 unused2[6];
- /* n varying data */
- /* p p = pad (n, 8) */
-} iceAuthNextPhaseMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 versionIndex;
- CARD8 unused;
- CARD32 length B32;
- /* i STRING vendor */
- /* j STRING release */
- /* p p = pad (i+j, 8) */
-} iceConnectionReplyMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 protocolOpcode;
- CARD8 mustAuthenticate;
- CARD32 length B32;
- CARD8 versionCount;
- CARD8 authCount;
- CARD8 unused[6];
- /* i STRING protocol-name */
- /* j STRING vendor */
- /* k STRING release */
- /* m LIST of STRING authentication-protocol-names */
- /* n LIST of VERSION version-list */
- /* p p = pad (i+j+k+m+n, 8) */
-} iceProtocolSetupMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 versionIndex;
- CARD8 protocolOpcode;
- CARD32 length B32;
- /* i STRING vendor */
- /* j STRING release */
- /* p p = pad (i+j, 8) */
-} iceProtocolReplyMsg;
-
-typedef iceMsg icePingMsg;
-typedef iceMsg icePingReplyMsg;
-typedef iceMsg iceWantToCloseMsg;
-typedef iceMsg iceNoCloseMsg;
-
-
-/*
- * SIZEOF values. These better be multiples of 8.
- */
-
-#define sz_iceMsg 8
-#define sz_iceErrorMsg 16
-#define sz_iceByteOrderMsg 8
-#define sz_iceConnectionSetupMsg 16
-#define sz_iceAuthRequiredMsg 16
-#define sz_iceAuthReplyMsg 16
-#define sz_iceAuthNextPhaseMsg 16
-#define sz_iceConnectionReplyMsg 8
-#define sz_iceProtocolSetupMsg 16
-#define sz_iceProtocolReplyMsg 8
-#define sz_icePingMsg 8
-#define sz_icePingReplyMsg 8
-#define sz_iceWantToCloseMsg 8
-#define sz_iceNoCloseMsg 8
-
-#endif /* _ICEPROTO_H_ */
diff --git a/xc/lib/ICE/ICEutil.h b/xc/lib/ICE/ICEutil.h
deleted file mode 100644
index 46146dc2b..000000000
--- a/xc/lib/ICE/ICEutil.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $TOG: ICEutil.h /main/6 1998/02/06 13:56:49 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#ifndef _ICEUTIL_H_
-#define _ICEUTIL_H_
-
-#include <stdio.h>
-
-/*
- * Data structure for entry in ICE authority file
- */
-
-typedef struct {
- char *protocol_name;
- unsigned short protocol_data_length;
- char *protocol_data;
- char *network_id;
- char *auth_name;
- unsigned short auth_data_length;
- char *auth_data;
-} IceAuthFileEntry;
-
-
-/*
- * Authentication data maintained in memory.
- */
-
-typedef struct {
- char *protocol_name;
- char *network_id;
- char *auth_name;
- unsigned short auth_data_length;
- char *auth_data;
-} IceAuthDataEntry;
-
-
-/*
- * Return values from IceLockAuthFile
- */
-
-#define IceAuthLockSuccess 0 /* lock succeeded */
-#define IceAuthLockError 1 /* lock unexpectely failed, check errno */
-#define IceAuthLockTimeout 2 /* lock failed, timeouts expired */
-
-
-/*
- * Function Prototypes
- */
-
-extern char *IceAuthFileName (
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern int IceLockAuthFile (
-#if NeedFunctionPrototypes
- char * /* file_name */,
- int /* retries */,
- int /* timeout */,
- long /* dead */
-#endif
-);
-
-extern void IceUnlockAuthFile (
-#if NeedFunctionPrototypes
- char * /* file_name */
-#endif
-);
-
-extern IceAuthFileEntry *IceReadAuthFileEntry (
-#if NeedFunctionPrototypes
- FILE * /* auth_file */
-#endif
-);
-
-extern void IceFreeAuthFileEntry (
-#if NeedFunctionPrototypes
- IceAuthFileEntry * /* auth */
-#endif
-);
-
-extern Status IceWriteAuthFileEntry (
-#if NeedFunctionPrototypes
- FILE * /* auth_file */,
- IceAuthFileEntry * /* auth */
-#endif
-);
-
-extern IceAuthFileEntry *IceGetAuthFileEntry (
-#if NeedFunctionPrototypes
- char * /* protocol_name */,
- char * /* network_id */,
- char * /* auth_name */
-#endif
-);
-
-extern char *IceGenerateMagicCookie (
-#if NeedFunctionPrototypes
- int /* len */
-#endif
-);
-
-extern void IceSetPaAuthData (
-#if NeedFunctionPrototypes
- int /* numEntries */,
- IceAuthDataEntry * /* entries */
-#endif
-);
-
-#endif /* _ICEUTIL_H_ */
diff --git a/xc/lib/ICE/Imakefile b/xc/lib/ICE/Imakefile
deleted file mode 100644
index 340496319..000000000
--- a/xc/lib/ICE/Imakefile
+++ /dev/null
@@ -1,92 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/21 1996/11/29 13:30:33 swick $
-XCOMM $XFree86: xc/lib/ICE/Imakefile,v 3.3 1998/12/20 11:56:49 dawes Exp $
-
-#define DoNormalLib NormalLibICE
-#define DoSharedLib SharedLibICE
-#define DoExtraLib SharedLibICE
-#define DoDebugLib DebugLibICE
-#define DoProfileLib ProfileLibICE
-#define LibName ICE
-#define SoRev SOICEREV
-#define IncSubdir X11
-#define IncSubSubdir ICE
-
-#ifdef SharedICEReqs
-REQUIREDLIBS = SharedICEReqs
-#endif
-
-#if (SystemV || SystemV4) && !HasSockets
-CONN_DEFINES = -DTCPCONN -DICE_t -DTRANS_CLIENT -DTRANS_SERVER
-#else
-#ifdef USLArchitecture
-/* XXX temporary hack, PTS is failing on UnixWare */
-CONN_DEFINES = -DSTREAMSCONN -DUNIXCONN -DICE_t -DTRANS_CLIENT -DTRANS_SERVER
-#else
-CONN_DEFINES = $(CONNECTION_FLAGS) -DICE_t -DTRANS_CLIENT -DTRANS_SERVER
-#endif
-#endif
-
-#if HasBSD44Sockets
-SOCK_DEFINES = -DBSD44SOCKETS
-#endif
-
-DEPEND_DEFINES = $(TRANS_INCLUDES) $(CONN_DEFINES)
-
-HEADERS = ICE.h \
- ICEconn.h \
- ICEproto.h \
- ICElib.h \
- ICEmsg.h \
- ICEutil.h
-
-SRCS = accept.c \
- authutil.c \
- connect.c \
- error.c \
- getauth.c \
- iceauth.c \
- listen.c \
- listenwk.c \
- locking.c \
- misc.c \
- ping.c \
- process.c \
- protosetup.c \
- register.c \
- replywait.c \
- setauth.c \
- shutdown.c \
- transport.c \
- watch.c
-
-OBJS = accept.o \
- authutil.o \
- connect.o \
- error.o \
- getauth.o \
- iceauth.o \
- listen.o \
- listenwk.o \
- locking.o \
- misc.o \
- ping.o \
- process.o \
- protosetup.o \
- register.o \
- replywait.o \
- setauth.o \
- shutdown.o \
- transport.o \
- watch.o
-
-#include <Library.tmpl>
-
-SpecialCLibObjectRule(accept,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-SpecialCLibObjectRule(connect,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-SpecialCLibObjectRule(listen,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-SpecialCLibObjectRule(listenwk,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-SpecialCLibObjectRule(misc,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-SpecialCLibObjectRule(transport,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES))
-LinkSourceFile(transport.c,$(TRANSCOMMSRC))
-
-DependTarget()
diff --git a/xc/lib/ICE/accept.c b/xc/lib/ICE/accept.c
deleted file mode 100644
index 13549e9ca..000000000
--- a/xc/lib/ICE/accept.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $TOG: accept.c /main/25 1998/02/06 13:55:44 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/Xtrans.h>
-
-
-IceConn
-IceAcceptConnection (listenObj, statusRet)
-
-IceListenObj listenObj;
-IceAcceptStatus *statusRet;
-
-{
- IceConn iceConn;
- XtransConnInfo newconn;
- iceByteOrderMsg *pMsg;
- int endian, status;
-
- /*
- * Accept the connection.
- */
-
- if ((newconn = _IceTransAccept (listenObj->trans_conn, &status)) == 0)
- {
- if (status == TRANS_ACCEPT_BAD_MALLOC)
- *statusRet = IceAcceptBadMalloc;
- else
- *statusRet = IceAcceptFailure;
- return (NULL);
- }
-
-
- /*
- * Set close-on-exec so that programs that fork() don't get confused.
- */
-
- _IceTransSetOption (newconn, TRANS_CLOSEONEXEC, 1);
-
-
- /*
- * Create an ICE object for this connection.
- */
-
- if ((iceConn = (IceConn) malloc (sizeof (struct _IceConn))) == NULL)
- {
- _IceTransClose (newconn);
- *statusRet = IceAcceptBadMalloc;
- return (NULL);
- }
-
- iceConn->listen_obj = listenObj;
-
- iceConn->waiting_for_byteorder = True;
- iceConn->connection_status = IceConnectPending;
- iceConn->io_ok = True;
- iceConn->dispatch_level = 0;
- iceConn->context = NULL;
- iceConn->my_ice_version_index = 0;
-
- iceConn->trans_conn = newconn;
- iceConn->send_sequence = 0;
- iceConn->receive_sequence = 0;
-
- iceConn->connection_string = (char *) malloc (
- strlen (listenObj->network_id) + 1);
-
- if (iceConn->connection_string == NULL)
- {
- _IceTransClose (newconn);
- free ((char *) iceConn);
- *statusRet = IceAcceptBadMalloc;
- return (NULL);
- }
- else
- strcpy (iceConn->connection_string, listenObj->network_id);
-
- iceConn->vendor = NULL;
- iceConn->release = NULL;
-
- if ((iceConn->inbuf = iceConn->inbufptr =
- (char *) malloc (ICE_INBUFSIZE)) != NULL)
- {
- iceConn->inbufmax = iceConn->inbuf + ICE_INBUFSIZE;
- }
- else
- {
- _IceTransClose (newconn);
- free ((char *) iceConn);
- *statusRet = IceAcceptBadMalloc;
- return (NULL);
- }
-
- if ((iceConn->outbuf = iceConn->outbufptr =
- (char *) malloc (ICE_OUTBUFSIZE)) != NULL)
- {
- iceConn->outbufmax = iceConn->outbuf + ICE_OUTBUFSIZE;
- }
- else
- {
- _IceTransClose (newconn);
- free (iceConn->inbuf);
- free ((char *) iceConn);
- *statusRet = IceAcceptBadMalloc;
- return (NULL);
- }
-
- iceConn->scratch = NULL;
- iceConn->scratch_size = 0;
-
- iceConn->open_ref_count = 1;
- iceConn->proto_ref_count = 0;
-
- iceConn->skip_want_to_close = False;
- iceConn->want_to_close = False;
- iceConn->free_asap = False;
-
- iceConn->saved_reply_waits = NULL;
- iceConn->ping_waits = NULL;
-
- iceConn->process_msg_info = NULL;
-
- iceConn->connect_to_you = NULL;
- iceConn->protosetup_to_you = NULL;
-
- iceConn->connect_to_me = NULL;
- iceConn->protosetup_to_me = NULL;
-
-
- /*
- * Send our byte order.
- */
-
- IceGetHeader (iceConn, 0, ICE_ByteOrder,
- SIZEOF (iceByteOrderMsg), iceByteOrderMsg, pMsg);
-
- endian = 1;
- if (*(char *) &endian)
- pMsg->byteOrder = IceLSBfirst;
- else
- pMsg->byteOrder = IceMSBfirst;
-
- IceFlush (iceConn);
-
-
- if (_IceWatchProcs)
- {
- /*
- * Notify the watch procedures that an iceConn was opened.
- */
-
- _IceConnectionOpened (iceConn);
- }
-
- *statusRet = IceAcceptSuccess;
-
- return (iceConn);
-}
diff --git a/xc/lib/ICE/authutil.c b/xc/lib/ICE/authutil.c
deleted file mode 100644
index 453ad0457..000000000
--- a/xc/lib/ICE/authutil.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/* $TOG: authutil.c /main/18 1998/02/06 13:55:51 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/authutil.c,v 3.5 1999/05/23 06:33:23 dawes Exp $ */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/ICE/ICEutil.h>
-#include <X11/Xos.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#if defined(X_NOT_STDC_ENV) && !defined(__EMX__)
-extern int errno;
-extern long time ();
-extern char *getenv();
-#define Time_t long
-#else
-#include <time.h>
-#define Time_t time_t
-#ifdef __EMX__
-extern char* getenv(const char*);
-#define link rename
-#endif
-#endif
-#ifndef X_NOT_POSIX
-#include <unistd.h>
-#else
-#ifndef WIN32
-extern unsigned sleep ();
-#else
-#define link rename
-#endif
-#endif
-
-static Status read_short ();
-static Status read_string ();
-static Status read_counted_string ();
-static Status write_short ();
-static Status write_string ();
-static Status write_counted_string ();
-
-
-
-/*
- * The following routines are for manipulating the .ICEauthority file
- * These are utility functions - they are not part of the standard
- * ICE library specification.
- */
-
-char *
-IceAuthFileName ()
-
-{
- static char slashDotICEauthority[] = "/.ICEauthority";
- char *name;
- static char *buf;
- static int bsize;
- int size;
-#if defined(WIN32) || defined(__EMX__)
-#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif
- char dir[PATH_MAX];
-#endif
-
- if ((name = getenv ("ICEAUTHORITY")))
- return (name);
-
- name = getenv ("HOME");
-
- if (!name)
- {
-#ifdef WIN32
- register char *ptr1;
- register char *ptr2;
- int len1 = 0, len2 = 0;
-
- if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) {
- len1 = strlen (ptr1);
- len2 = strlen (ptr2);
- } else if (ptr2 = getenv("USERNAME")) {
- len1 = strlen (ptr1 = "/users/");
- len2 = strlen (ptr2);
- }
- if ((len1 + len2 + 1) < PATH_MAX) {
- sprintf (dir, "%s%s", ptr1, (ptr2) ? ptr2 : "");
- name = dir;
- }
- if (!name)
-#endif
-#ifdef __EMX__
- strcpy (dir,"c:");
- name = dir;
- if (!name)
-#endif
- return (NULL);
- }
-
- size = strlen (name) + strlen (&slashDotICEauthority[1]) + 2;
-
- if (size > bsize)
- {
- if (buf)
- free (buf);
- buf = malloc ((unsigned) size);
- if (!buf)
- return (NULL);
- bsize = size;
- }
-
- strcpy (buf, name);
- strcat (buf, slashDotICEauthority + (name[1] == '\0' ? 1 : 0));
-
- return (buf);
-}
-
-
-
-int
-IceLockAuthFile (file_name, retries, timeout, dead)
-
-char *file_name;
-int retries;
-int timeout;
-long dead;
-
-{
- char creat_name[1025], link_name[1025];
- struct stat statb;
- Time_t now;
- int creat_fd = -1;
-
- if ((int) strlen (file_name) > 1022)
- return (IceAuthLockError);
-
- strcpy (creat_name, file_name);
- strcat (creat_name, "-c");
- strcpy (link_name, file_name);
- strcat (link_name, "-l");
-
- if (stat (creat_name, &statb) != -1)
- {
- now = time ((Time_t *) 0);
-
- /*
- * NFS may cause ctime to be before now, special
- * case a 0 deadtime to force lock removal
- */
-
- if (dead == 0 || now - statb.st_ctime > dead)
- {
- unlink (creat_name);
- unlink (link_name);
- }
- }
-
- while (retries > 0)
- {
- if (creat_fd == -1)
- {
- creat_fd = creat (creat_name, 0666);
-
- if (creat_fd == -1)
- {
- if (errno != EACCES)
- return (IceAuthLockError);
- }
- else
- close (creat_fd);
- }
-
- if (creat_fd != -1)
- {
- if (link (creat_name, link_name) != -1)
- return (IceAuthLockSuccess);
-
- if (errno == ENOENT)
- {
- creat_fd = -1; /* force re-creat next time around */
- continue;
- }
-
- if (errno != EEXIST)
- return (IceAuthLockError);
- }
-
- sleep ((unsigned) timeout);
- --retries;
- }
-
- return (IceAuthLockTimeout);
-}
-
-
-
-void
-IceUnlockAuthFile (file_name)
-
-char *file_name;
-
-{
-#ifndef WIN32
- char creat_name[1025];
-#endif
- char link_name[1025];
-
- if ((int) strlen (file_name) > 1022)
- return;
-
-#ifndef WIN32
- strcpy (creat_name, file_name);
- strcat (creat_name, "-c");
-#endif
- strcpy (link_name, file_name);
- strcat (link_name, "-l");
-
-#ifndef WIN32
- unlink (creat_name);
-#endif
- unlink (link_name);
-}
-
-
-
-IceAuthFileEntry *
-IceReadAuthFileEntry (auth_file)
-
-FILE *auth_file;
-
-{
- IceAuthFileEntry local;
- IceAuthFileEntry *ret;
-
- local.protocol_name = NULL;
- local.protocol_data = NULL;
- local.network_id = NULL;
- local.auth_name = NULL;
- local.auth_data = NULL;
-
- if (!read_string (auth_file, &local.protocol_name))
- return (NULL);
-
- if (!read_counted_string (auth_file,
- &local.protocol_data_length, &local.protocol_data))
- goto bad;
-
- if (!read_string (auth_file, &local.network_id))
- goto bad;
-
- if (!read_string (auth_file, &local.auth_name))
- goto bad;
-
- if (!read_counted_string (auth_file,
- &local.auth_data_length, &local.auth_data))
- goto bad;
-
- if (!(ret = (IceAuthFileEntry *) malloc (sizeof (IceAuthFileEntry))))
- goto bad;
-
- *ret = local;
-
- return (ret);
-
- bad:
-
- if (local.protocol_name) free (local.protocol_name);
- if (local.protocol_data) free (local.protocol_data);
- if (local.network_id) free (local.network_id);
- if (local.auth_name) free (local.auth_name);
- if (local.auth_data) free (local.auth_data);
-
- return (NULL);
-}
-
-
-
-void
-IceFreeAuthFileEntry (auth)
-
-IceAuthFileEntry *auth;
-
-{
- if (auth)
- {
- if (auth->protocol_name) free (auth->protocol_name);
- if (auth->protocol_data) free (auth->protocol_data);
- if (auth->network_id) free (auth->network_id);
- if (auth->auth_name) free (auth->auth_name);
- if (auth->auth_data) free (auth->auth_data);
- free ((char *) auth);
- }
-}
-
-
-
-Status
-IceWriteAuthFileEntry (auth_file, auth)
-
-FILE *auth_file;
-IceAuthFileEntry *auth;
-
-{
- if (!write_string (auth_file, auth->protocol_name))
- return (0);
-
- if (!write_counted_string (auth_file,
- auth->protocol_data_length, auth->protocol_data))
- return (0);
-
- if (!write_string (auth_file, auth->network_id))
- return (0);
-
- if (!write_string (auth_file, auth->auth_name))
- return (0);
-
- if (!write_counted_string (auth_file,
- auth->auth_data_length, auth->auth_data))
- return (0);
-
- return (1);
-}
-
-
-
-IceAuthFileEntry *
-IceGetAuthFileEntry (protocol_name, network_id, auth_name)
-
-char *protocol_name;
-char *network_id;
-char *auth_name;
-
-{
- FILE *auth_file;
- char *filename;
- IceAuthFileEntry *entry;
-
- if (!(filename = IceAuthFileName ()))
- return (NULL);
-
- if (access (filename, R_OK) != 0) /* checks REAL id */
- return (NULL);
-
- if (!(auth_file = fopen (filename, "rb")))
- return (NULL);
-
- for (;;)
- {
- if (!(entry = IceReadAuthFileEntry (auth_file)))
- break;
-
- if (strcmp (protocol_name, entry->protocol_name) == 0 &&
- strcmp (network_id, entry->network_id) == 0 &&
- strcmp (auth_name, entry->auth_name) == 0)
- {
- break;
- }
-
- IceFreeAuthFileEntry (entry);
- }
-
- fclose (auth_file);
-
- return (entry);
-}
-
-
-
-/*
- * local routines
- */
-
-static Status
-read_short (file, shortp)
-
-FILE *file;
-unsigned short *shortp;
-
-{
- unsigned char file_short[2];
-
- if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
- return (0);
-
- *shortp = file_short[0] * 256 + file_short[1];
- return (1);
-}
-
-
-static Status
-read_string (file, stringp)
-
-FILE *file;
-char **stringp;
-
-{
- unsigned short len;
- char *data;
-
- if (!read_short (file, &len))
- return (0);
-
- if (len == 0)
- {
- data = 0;
- }
- else
- {
- data = malloc ((unsigned) len + 1);
-
- if (!data)
- return (0);
-
- if (fread (data, (int) sizeof (char), (int) len, file) != len)
- {
- free (data);
- return (0);
- }
-
- data[len] = '\0';
- }
-
- *stringp = data;
-
- return (1);
-}
-
-
-static Status
-read_counted_string (file, countp, stringp)
-
-FILE *file;
-unsigned short *countp;
-char **stringp;
-
-{
- unsigned short len;
- char *data;
-
- if (!read_short (file, &len))
- return (0);
-
- if (len == 0)
- {
- data = 0;
- }
- else
- {
- data = malloc ((unsigned) len);
-
- if (!data)
- return (0);
-
- if (fread (data, (int) sizeof (char), (int) len, file) != len)
- {
- free (data);
- return (0);
- }
- }
-
- *stringp = data;
- *countp = len;
-
- return (1);
-}
-
-
-static Status
-write_short (file, s)
-
-FILE *file;
-unsigned short s;
-
-{
- unsigned char file_short[2];
-
- file_short[0] = (s & (unsigned) 0xff00) >> 8;
- file_short[1] = s & 0xff;
-
- if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1)
- return (0);
-
- return (1);
-}
-
-
-static Status
-write_string (file, string)
-
-FILE *file;
-char *string;
-
-{
- unsigned short count = strlen (string);
-
- if (!write_short (file, count))
- return (0);
-
- if (fwrite (string, (int) sizeof (char), (int) count, file) != count)
- return (0);
-
- return (1);
-}
-
-
-static Status
-write_counted_string (file, count, string)
-
-FILE *file;
-unsigned short count;
-char *string;
-
-{
- if (!write_short (file, count))
- return (0);
-
- if (fwrite (string, (int) sizeof (char), (int) count, file) != count)
- return (0);
-
- return (1);
-}
diff --git a/xc/lib/ICE/connect.c b/xc/lib/ICE/connect.c
deleted file mode 100644
index 780e133cf..000000000
--- a/xc/lib/ICE/connect.c
+++ /dev/null
@@ -1,555 +0,0 @@
-/* $TOG: connect.c /main/34 1998/05/29 14:30:51 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/connect.c,v 3.5 1999/03/21 07:34:27 dawes Exp $ */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/Xtrans.h>
-#include "globals.h"
-
-static XtransConnInfo ConnectToPeer();
-
-#ifndef X_NOT_STDC_ENV
-#define Strstr strstr
-#else
-static char *Strstr(s1, s2)
- char *s1, *s2;
-{
- int n1, n2;
-
- n1 = strlen(s1);
- n2 = strlen(s2);
- for ( ; n1 >= n2; s1++, n1--) {
- if (!strncmp(s1, s2, n2))
- return s1;
- }
- return NULL;
-}
-#endif
-
-IceConn
-IceOpenConnection (networkIdsList, context, mustAuthenticate, majorOpcodeCheck,
- errorLength, errorStringRet)
-
-char *networkIdsList;
-IcePointer context;
-Bool mustAuthenticate;
-int majorOpcodeCheck;
-int errorLength;
-char *errorStringRet;
-
-{
- IceConn iceConn;
- int extra, i, j;
- int endian;
- Bool gotReply, ioErrorOccured;
- unsigned long setup_sequence;
- iceByteOrderMsg *pByteOrderMsg;
- iceConnectionSetupMsg *pSetupMsg;
- char *pData;
- IceReplyWaitInfo replyWait;
- _IceReply reply;
- int authUsableCount;
- int authUsableFlags[MAX_ICE_AUTH_NAMES];
- int authIndices[MAX_ICE_AUTH_NAMES];
-
- if (errorStringRet && errorLength > 0)
- *errorStringRet = '\0';
-
- if (networkIdsList == NULL || *networkIdsList == '\0')
- {
- strncpy (errorStringRet,
- "networkIdsList argument is NULL", errorLength);
- return (NULL);
- }
-
- /*
- * Check to see if we can use a previously created ICE connection.
- *
- * If iceConn->want_to_close is True, or iceConn->free_asap is True,
- * we can not use the iceConn.
- *
- * If 'context' is non-NULL, we will only use a previously opened ICE
- * connection if the specified 'context' is equal to the context
- * associated with the ICE connection, or if the context associated
- * with the ICE connection is NULL.
- *
- * If 'majorOpcodeCheck' is non-zero, it will contain a protocol major
- * opcode that we should make sure is not already active on the ICE
- * connection. Some clients will want two seperate connections for the
- * same protocol to the same destination client.
- */
-
- for (i = 0; i < _IceConnectionCount; i++)
- {
- char *strptr;
- if ((strptr = (char *) Strstr (
- networkIdsList, _IceConnectionStrings[i])) != NULL)
- {
- char ch = *(strptr + strlen (_IceConnectionStrings[i]));
- if (ch == ',' || ch == '\0')
- {
- /*
- * OK, we found a connection. Make sure we can reuse it.
- */
-
- IceConn iceConn = _IceConnectionObjs[i];
-
- if (iceConn->want_to_close || iceConn->free_asap ||
- (context && iceConn->context &&
- iceConn->context != context))
- {
- /* force a new connection to be created */
- break;
- }
-
- if (majorOpcodeCheck)
- {
- for (j = iceConn->his_min_opcode;
- j <= iceConn->his_max_opcode; j++)
- {
- if (iceConn->process_msg_info[
- j - iceConn->his_min_opcode].in_use &&
- iceConn->process_msg_info[
- j - iceConn->his_min_opcode].my_opcode ==
- majorOpcodeCheck)
- break;
- }
-
- if (j <= iceConn->his_max_opcode ||
- (iceConn->protosetup_to_you &&
- iceConn->protosetup_to_you->my_opcode ==
- majorOpcodeCheck))
- {
- /* force a new connection to be created */
- break;
- }
- }
-
- iceConn->open_ref_count++;
- if (context && !iceConn->context)
- iceConn->context = context;
- return (iceConn);
- }
- }
- }
-
- if ((iceConn = (IceConn) malloc (sizeof (struct _IceConn))) == NULL)
- {
- strncpy (errorStringRet, "Can't malloc", errorLength);
- return (NULL);
- }
-
-
- /*
- * Open a network connection with the peer client.
- */
-
- if ((iceConn->trans_conn = ConnectToPeer (networkIdsList,
- &iceConn->connection_string)) == NULL)
- {
- free ((char *) iceConn);
- strncpy (errorStringRet, "Could not open network socket", errorLength);
- return (NULL);
- }
-
- /*
- * Set close-on-exec so that programs that fork() don't get confused.
- */
-
- _IceTransSetOption (iceConn->trans_conn, TRANS_CLOSEONEXEC, 1);
-
- iceConn->listen_obj = NULL;
-
- iceConn->connection_status = IceConnectPending;
- iceConn->io_ok = True;
- iceConn->dispatch_level = 0;
- iceConn->context = context;
- iceConn->my_ice_version_index = 0;
- iceConn->send_sequence = 0;
- iceConn->receive_sequence = 0;
-
- iceConn->vendor = NULL;
- iceConn->release = NULL;
- iceConn->outbuf = NULL;
-
- iceConn->scratch = NULL;
- iceConn->scratch_size = 0;
-
- iceConn->process_msg_info = NULL;
-
- iceConn->connect_to_you = NULL;
- iceConn->protosetup_to_you = NULL;
-
- iceConn->connect_to_me = NULL;
- iceConn->protosetup_to_me = NULL;
-
- if ((iceConn->inbuf = iceConn->inbufptr =
- (char *) malloc (ICE_INBUFSIZE)) == NULL)
- {
- _IceFreeConnection (iceConn);
- strncpy (errorStringRet, "Can't malloc", errorLength);
- return (NULL);
- }
-
- iceConn->inbufmax = iceConn->inbuf + ICE_INBUFSIZE;
-
- if ((iceConn->outbuf = iceConn->outbufptr =
- (char *) malloc (ICE_OUTBUFSIZE)) == NULL)
- {
- _IceFreeConnection (iceConn);
- strncpy (errorStringRet, "Can't malloc", errorLength);
- return (NULL);
- }
-
- iceConn->outbufmax = iceConn->outbuf + ICE_OUTBUFSIZE;
-
- iceConn->open_ref_count = 1;
- iceConn->proto_ref_count = 0;
-
- iceConn->skip_want_to_close = False;
- iceConn->want_to_close = False;
- iceConn->free_asap = False;
-
- iceConn->saved_reply_waits = NULL;
- iceConn->ping_waits = NULL;
-
- iceConn->connect_to_you = (_IceConnectToYouInfo *) malloc (
- sizeof (_IceConnectToYouInfo));
- iceConn->connect_to_you->auth_active = 0;
-
- /*
- * Send our byte order.
- */
-
- IceGetHeader (iceConn, 0, ICE_ByteOrder,
- SIZEOF (iceByteOrderMsg), iceByteOrderMsg, pByteOrderMsg);
-
- endian = 1;
- if (*(char *) &endian)
- pByteOrderMsg->byteOrder = IceLSBfirst;
- else
- pByteOrderMsg->byteOrder = IceMSBfirst;
-
- IceFlush (iceConn);
-
-
- /*
- * Now read the ByteOrder message from the other client.
- * iceConn->swap should be set to the appropriate boolean
- * value after the call to IceProcessMessages.
- */
-
- iceConn->waiting_for_byteorder = True;
-
- ioErrorOccured = False;
- while (iceConn->waiting_for_byteorder == True && !ioErrorOccured)
- {
- ioErrorOccured = (IceProcessMessages (
- iceConn, NULL, NULL) == IceProcessMessagesIOError);
- }
-
- if (ioErrorOccured)
- {
- _IceFreeConnection (iceConn);
- strncpy (errorStringRet, "IO error occured opening connection",
- errorLength);
- return (NULL);
- }
-
- if (iceConn->connection_status == IceConnectRejected)
- {
- /*
- * We failed to get the required ByteOrder message.
- */
-
- _IceFreeConnection (iceConn);
- strncpy (errorStringRet,
- "Internal error - did not receive the expected ByteOrder message",
- errorLength);
- return (NULL);
- }
-
-
- /*
- * Determine which authentication methods are available for
- * the Connection Setup authentication.
- */
-
- _IceGetPoValidAuthIndices (
- "ICE", iceConn->connection_string,
- _IceAuthCount, _IceAuthNames, &authUsableCount, authIndices);
-
- for (i = 0; i < _IceAuthCount; i++)
- {
- authUsableFlags[i] = 0;
- for (j = 0; j < authUsableCount && !authUsableFlags[i]; j++)
- authUsableFlags[i] = (authIndices[j] == i);
- }
-
-
- /*
- * Now send a Connection Setup message.
- */
-
- extra = STRING_BYTES (IceVendorString) + STRING_BYTES (IceReleaseString);
-
- for (i = 0; i < _IceAuthCount; i++)
- if (authUsableFlags[i])
- {
- extra += STRING_BYTES (_IceAuthNames[i]);
- }
-
- extra += (_IceVersionCount * 4);
-
- IceGetHeaderExtra (iceConn, 0, ICE_ConnectionSetup,
- SIZEOF (iceConnectionSetupMsg), WORD64COUNT (extra),
- iceConnectionSetupMsg, pSetupMsg, pData);
-
- setup_sequence = iceConn->send_sequence;
-
- pSetupMsg->versionCount = _IceVersionCount;
- pSetupMsg->authCount = authUsableCount;
- pSetupMsg->mustAuthenticate = mustAuthenticate;
-
- STORE_STRING (pData, IceVendorString);
- STORE_STRING (pData, IceReleaseString);
-
- for (i = 0; i < _IceAuthCount; i++)
- if (authUsableFlags[i])
- {
- STORE_STRING (pData, _IceAuthNames[i]);
- }
-
- for (i = 0; i < _IceVersionCount; i++)
- {
- STORE_CARD16 (pData, _IceVersions[i].major_version);
- STORE_CARD16 (pData, _IceVersions[i].minor_version);
- }
-
- IceFlush (iceConn);
-
-
- /*
- * Process messages until we get a Connection Reply or an Error Message.
- * Authentication will take place behind the scenes.
- */
-
- replyWait.sequence_of_request = setup_sequence;
- replyWait.major_opcode_of_request = 0;
- replyWait.minor_opcode_of_request = ICE_ConnectionSetup;
- replyWait.reply = (IcePointer) &reply;
-
- gotReply = False;
- ioErrorOccured = False;
-
- while (!gotReply && !ioErrorOccured)
- {
- ioErrorOccured = (IceProcessMessages (
- iceConn, &replyWait, &gotReply) == IceProcessMessagesIOError);
-
- if (ioErrorOccured)
- {
- strncpy (errorStringRet, "IO error occured opening connection",
- errorLength);
- _IceFreeConnection (iceConn);
- iceConn = NULL;
- }
- else if (gotReply)
- {
- if (reply.type == ICE_CONNECTION_REPLY)
- {
- if (reply.connection_reply.version_index >= _IceVersionCount)
- {
- strncpy (errorStringRet,
- "Got a bad version index in the Connection Reply",
- errorLength);
-
- free (reply.connection_reply.vendor);
- free (reply.connection_reply.release);
- _IceFreeConnection (iceConn);
- iceConn = NULL;
- }
- else
- {
- iceConn->my_ice_version_index =
- reply.connection_reply.version_index;
- iceConn->vendor = reply.connection_reply.vendor;
- iceConn->release = reply.connection_reply.release;
-
- _IceConnectionObjs[_IceConnectionCount] = iceConn;
- _IceConnectionStrings[_IceConnectionCount] =
- iceConn->connection_string;
- _IceConnectionCount++;
-
- free ((char *) iceConn->connect_to_you);
- iceConn->connect_to_you = NULL;
-
- iceConn->connection_status = IceConnectAccepted;
- }
- }
- else /* reply.type == ICE_CONNECTION_ERROR */
- {
- /* Connection failed */
-
- strncpy (errorStringRet, reply.connection_error.error_message,
- errorLength);
-
- free (reply.connection_error.error_message);
-
- _IceFreeConnection (iceConn);
- iceConn = NULL;
- }
- }
- }
-
- if (iceConn && _IceWatchProcs)
- {
-#ifdef MINIX
- _IceTransSetOption(iceConn->trans_conn, TRANS_NONBLOCKING, 1);
-#endif
- /*
- * Notify the watch procedures that an iceConn was opened.
- */
-
- _IceConnectionOpened (iceConn);
- }
-
- return (iceConn);
-}
-
-
-
-IcePointer
-IceGetConnectionContext (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->context);
-}
-
-
-
-/* ------------------------------------------------------------------------- *
- * local routines *
- * ------------------------------------------------------------------------- */
-
-#define ICE_CONNECTION_RETRIES 5
-
-
-static XtransConnInfo
-ConnectToPeer (networkIdsList, actualConnectionRet)
-
-char *networkIdsList;
-char **actualConnectionRet;
-
-{
- char addrbuf[256];
- char* address;
- char *ptr, *endptr, *delim;
- int madeConnection = 0;
- int len, retry;
- int connect_stat;
- int address_size;
- XtransConnInfo trans_conn = NULL;
-
- *actualConnectionRet = NULL;
-
- ptr = networkIdsList;
- len = strlen (networkIdsList);
- endptr = networkIdsList + len;
-
- if (len < sizeof addrbuf)
- {
- address = addrbuf;
- address_size = 256;
- }
- else
- {
- address = malloc (len + 1);
- address_size = len;
- }
-
- while (ptr < endptr && !madeConnection)
- {
- if ((delim = (char *) strchr (ptr, ',')) == NULL)
- delim = endptr;
-
- len = delim - ptr;
- if (len > address_size - 1)
- len = address_size - 1;
- strncpy (address, ptr, len);
- address[len] = '\0';
-
- ptr = delim + 1;
-
- for (retry = ICE_CONNECTION_RETRIES; retry >= 0; retry--)
- {
- if ((trans_conn = _IceTransOpenCOTSClient (address)) == NULL)
- {
- break;
- }
-
- if ((connect_stat = _IceTransConnect (trans_conn, address)) < 0)
- {
- _IceTransClose (trans_conn);
-
- if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
- {
- sleep(1);
- continue;
- }
- else
- break;
- }
- else
- {
- madeConnection = 1;
- break;
- }
- }
- }
-
- if (madeConnection)
- {
- /*
- * We need to return the actual network connection string
- */
-
- *actualConnectionRet = (char *) malloc (strlen (address) + 1);
- strcpy (*actualConnectionRet, address);
-
-
- /*
- * Return the file descriptor
- */
- }
- else trans_conn = NULL;
-
- if (address != addrbuf) free (address);
-
- return trans_conn;
-}
diff --git a/xc/lib/ICE/error.c b/xc/lib/ICE/error.c
deleted file mode 100644
index b14c3b998..000000000
--- a/xc/lib/ICE/error.c
+++ /dev/null
@@ -1,638 +0,0 @@
-/* $TOG: error.c /main/17 1998/02/06 13:56:02 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/error.c,v 1.2 1999/05/23 06:33:23 dawes Exp $ */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <stdio.h>
-
-#include <errno.h>
-
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
-
-void
-_IceErrorBadMinor (iceConn, majorOpcode, offendingMinor, severity)
-
-IceConn iceConn;
-int majorOpcode;
-int offendingMinor;
-int severity;
-
-{
- IceErrorHeader (iceConn,
- majorOpcode, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceBadMinor,
- 0);
-
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorBadState (iceConn, majorOpcode, offendingMinor, severity)
-
-IceConn iceConn;
-int majorOpcode;
-int offendingMinor;
-int severity;
-
-{
- IceErrorHeader (iceConn,
- majorOpcode, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceBadState,
- 0);
-
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorBadLength (iceConn, majorOpcode, offendingMinor, severity)
-
-IceConn iceConn;
-int majorOpcode;
-int offendingMinor;
-int severity;
-
-{
- IceErrorHeader (iceConn,
- majorOpcode, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceBadLength,
- 0);
-
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorBadValue (iceConn, majorOpcode, offendingMinor, offset, length, value)
-
-IceConn iceConn;
-int majorOpcode;
-int offendingMinor;
-int offset;
-int length; /* in bytes */
-IcePointer value;
-
-{
- IceErrorHeader (iceConn,
- majorOpcode, offendingMinor,
- iceConn->receive_sequence,
- IceCanContinue,
- IceBadValue,
- WORD64COUNT (8 + length));
-
- IceWriteData32 (iceConn, 4, &offset);
- IceWriteData32 (iceConn, 4, &length);
- IceWriteData (iceConn, length, (char *) value);
-
- if (PAD64 (length))
- IceWritePad (iceConn, PAD64 (length));
-
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorNoAuthentication (iceConn, offendingMinor)
-
-IceConn iceConn;
-int offendingMinor;
-
-{
- int severity = (offendingMinor == ICE_ConnectionSetup) ?
- IceFatalToConnection : IceFatalToProtocol;
-
- IceErrorHeader (iceConn,
- 0, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceNoAuth,
- 0);
-
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorNoVersion (iceConn, offendingMinor)
-
-IceConn iceConn;
-int offendingMinor;
-
-{
- int severity = (offendingMinor == ICE_ConnectionSetup) ?
- IceFatalToConnection : IceFatalToProtocol;
-
- IceErrorHeader (iceConn,
- 0, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceNoVersion,
- 0);
-
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorSetupFailed (iceConn, offendingMinor, reason)
-
-IceConn iceConn;
-int offendingMinor;
-char *reason;
-
-{
- char *pBuf, *pStart;
- int bytes;
- int severity = (offendingMinor == ICE_ConnectionSetup) ?
- IceFatalToConnection : IceFatalToProtocol;
-
- if (!reason)
- reason = "";
- bytes = STRING_BYTES (reason);
-
- IceErrorHeader (iceConn,
- 0, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceSetupFailed,
- WORD64COUNT (bytes));
-
- pBuf = pStart = IceAllocScratch (iceConn, PADDED_BYTES64 (bytes));
- STORE_STRING (pBuf, reason);
-
- IceWriteData (iceConn, PADDED_BYTES64 (bytes), pStart);
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorAuthenticationRejected (iceConn, offendingMinor, reason)
-
-IceConn iceConn;
-int offendingMinor;
-char *reason;
-
-{
- char *pBuf, *pStart;
- int bytes;
-
- if (!reason)
- reason = "";
- bytes = STRING_BYTES (reason);
-
- IceErrorHeader (iceConn,
- 0, offendingMinor,
- iceConn->receive_sequence,
- IceFatalToProtocol,
- IceAuthRejected,
- WORD64COUNT (bytes));
-
- pBuf = pStart = IceAllocScratch (iceConn, PADDED_BYTES64 (bytes));
- STORE_STRING (pBuf, reason);
-
- IceWriteData (iceConn, PADDED_BYTES64 (bytes), pStart);
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorAuthenticationFailed (iceConn, offendingMinor, reason)
-
-IceConn iceConn;
-int offendingMinor;
-char *reason;
-
-{
- char *pBuf, *pStart;
- int bytes;
-
- if (!reason)
- reason = "";
- bytes = STRING_BYTES (reason);
-
- IceErrorHeader (iceConn,
- 0, offendingMinor,
- iceConn->receive_sequence,
- IceFatalToProtocol,
- IceAuthFailed,
- WORD64COUNT (bytes));
-
- pBuf = pStart = IceAllocScratch (iceConn, PADDED_BYTES64 (bytes));
- STORE_STRING (pBuf, reason);
-
- IceWriteData (iceConn, PADDED_BYTES64 (bytes), pStart);
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorProtocolDuplicate (iceConn, protocolName)
-
-IceConn iceConn;
-char *protocolName;
-
-{
- char *pBuf, *pStart;
- int bytes;
-
- if (!protocolName)
- protocolName = "";
- bytes = STRING_BYTES (protocolName);
-
- IceErrorHeader (iceConn,
- 0, ICE_ProtocolSetup,
- iceConn->receive_sequence,
- IceFatalToProtocol,
- IceProtocolDuplicate,
- WORD64COUNT (bytes));
-
- pBuf = pStart = IceAllocScratch (iceConn, PADDED_BYTES64 (bytes));
- STORE_STRING (pBuf, protocolName);
-
- IceWriteData (iceConn, PADDED_BYTES64 (bytes), pStart);
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorMajorOpcodeDuplicate (iceConn, majorOpcode)
-
-IceConn iceConn;
-int majorOpcode;
-
-{
- char mOp = (char) majorOpcode;
-
- IceErrorHeader (iceConn,
- 0, ICE_ProtocolSetup,
- iceConn->receive_sequence,
- IceFatalToProtocol,
- IceMajorOpcodeDuplicate,
- 1 /* length */);
-
- IceWriteData (iceConn, 8, &mOp);
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorUnknownProtocol (iceConn, protocolName)
-
-IceConn iceConn;
-char *protocolName;
-
-{
- char *pBuf, *pStart;
- int bytes;
-
- if (!protocolName)
- protocolName = "";
- bytes = STRING_BYTES (protocolName);
-
- IceErrorHeader (iceConn,
- 0, ICE_ProtocolSetup,
- iceConn->receive_sequence,
- IceFatalToProtocol,
- IceUnknownProtocol,
- WORD64COUNT (bytes));
-
- pBuf = pStart = IceAllocScratch (iceConn, PADDED_BYTES64 (bytes));
- STORE_STRING (pBuf, protocolName);
-
- IceWriteData (iceConn, PADDED_BYTES64 (bytes), pStart);
- IceFlush (iceConn);
-}
-
-
-void
-_IceErrorBadMajor (iceConn, offendingMajor, offendingMinor, severity)
-
-IceConn iceConn;
-int offendingMajor;
-int offendingMinor;
-int severity;
-
-{
- char maj = (char) offendingMajor;
-
- IceErrorHeader (iceConn,
- 0, offendingMinor,
- iceConn->receive_sequence,
- severity,
- IceBadMajor,
- 1 /* length */);
-
- IceWriteData (iceConn, 8, &maj);
- IceFlush (iceConn);
-}
-
-
-
-/*
- * Default error handler.
- */
-
-void
-_IceDefaultErrorHandler (iceConn, swap,
- offendingMinorOpcode, offendingSequence, errorClass, severity, values)
-
-IceConn iceConn;
-Bool swap;
-int offendingMinorOpcode;
-unsigned long offendingSequence;
-int errorClass;
-int severity;
-IcePointer values;
-
-{
- char *str;
- char *pData = (char *) values;
-
- switch (offendingMinorOpcode)
- {
- case ICE_ConnectionSetup:
- str = "ConnectionSetup";
- break;
- case ICE_AuthRequired:
- str = "AuthRequired";
- break;
- case ICE_AuthReply:
- str = "AuthReply";
- break;
- case ICE_AuthNextPhase:
- str = "AuthNextPhase";
- break;
- case ICE_ConnectionReply:
- str = "ConnectionReply";
- break;
- case ICE_ProtocolSetup:
- str = "ProtocolSetup";
- break;
- case ICE_ProtocolReply:
- str = "ProtocolReply";
- break;
- case ICE_Ping:
- str = "Ping";
- break;
- case ICE_PingReply:
- str = "PingReply";
- break;
- case ICE_WantToClose:
- str = "WantToClose";
- break;
- case ICE_NoClose:
- str = "NoClose";
- break;
- default:
- str = "";
- }
-
- fprintf (stderr, "\n");
-
- fprintf (stderr, "ICE error: Offending minor opcode = %d (%s)\n",
- offendingMinorOpcode, str);
-
- fprintf (stderr, " Offending sequence number = %lu\n",
- offendingSequence);
-
- switch (errorClass)
- {
- case IceBadMinor:
- str = "BadMinor";
- break;
- case IceBadState:
- str = "BadState";
- break;
- case IceBadLength:
- str = "BadLength";
- break;
- case IceBadValue:
- str = "BadValue";
- break;
- case IceBadMajor:
- str = "BadMajor";
- break;
- case IceNoAuth:
- str = "NoAuthentication";
- break;
- case IceNoVersion:
- str = "NoVersion";
- break;
- case IceSetupFailed:
- str = "SetupFailed";
- break;
- case IceAuthRejected:
- str = "AuthenticationRejected";
- break;
- case IceAuthFailed:
- str = "AuthenticationFailed";
- break;
- case IceProtocolDuplicate:
- str = "ProtocolDuplicate";
- break;
- case IceMajorOpcodeDuplicate:
- str = "MajorOpcodeDuplicate";
- break;
- case IceUnknownProtocol:
- str = "UnknownProtocol";
- break;
- default:
- str = "???";
- }
-
- fprintf (stderr, " Error class = %s\n", str);
-
- if (severity == IceCanContinue)
- str = "CanContinue";
- else if (severity == IceFatalToProtocol)
- str = "FatalToProtocol";
- else if (severity == IceFatalToConnection)
- str = "FatalToConnection";
- else
- str = "???";
-
- fprintf (stderr, " Severity = %s\n", str);
-
- switch (errorClass)
- {
- case IceBadValue:
- {
- int offset, length, val;
-
- EXTRACT_CARD32 (pData, swap, offset);
- EXTRACT_CARD32 (pData, swap, length);
-
- fprintf (stderr,
- " BadValue Offset = %d\n", offset);
- fprintf (stderr,
- " BadValue Length = %d\n", length);
-
- if (length <= 4)
- {
- if (length == 1)
- val = (int) *pData;
- else if (length == 2)
- {
- EXTRACT_CARD16 (pData, swap, val);
- }
- else
- {
- EXTRACT_CARD32 (pData, swap, val);
- }
-
- fprintf (stderr,
- " BadValue = %d\n", val);
- }
- break;
- }
-
- case IceBadMajor:
-
- fprintf (stderr, "Major opcode : %d\n", (int) *pData);
- break;
-
- case IceSetupFailed:
-
- EXTRACT_STRING (pData, swap, str);
- fprintf (stderr, "Reason : %s\n", str);
- break;
-
- case IceAuthRejected:
-
- EXTRACT_STRING (pData, swap, str);
- fprintf (stderr, "Reason : %s\n", str);
- break;
-
- case IceAuthFailed:
-
- EXTRACT_STRING (pData, swap, str);
- fprintf (stderr, "Reason : %s\n", str);
- break;
-
- case IceProtocolDuplicate:
-
- EXTRACT_STRING (pData, swap, str);
- fprintf (stderr, "Protocol name : %s\n", str);
- break;
-
- case IceMajorOpcodeDuplicate:
-
- fprintf (stderr, "Major opcode : %d\n", (int) *pData);
- break;
-
- case IceUnknownProtocol:
-
- EXTRACT_STRING (pData, swap, str);
- fprintf (stderr, "Protocol name : %s\n", str);
- break;
-
- default:
- break;
- }
-
- fprintf (stderr, "\n");
-
- if (severity != IceCanContinue)
- exit (1);
-}
-
-
-
-/*
- * This procedure sets the ICE error handler to be the specified
- * routine. If NULL is passed in the default error handler is restored.
- * The function's return value is the previous error handler.
- */
-
-IceErrorHandler
-IceSetErrorHandler (handler)
-
-IceErrorHandler handler;
-
-{
- IceErrorHandler oldHandler = _IceErrorHandler;
-
- if (handler != NULL)
- _IceErrorHandler = handler;
- else
- _IceErrorHandler = _IceDefaultErrorHandler;
-
- return (oldHandler);
-}
-
-
-
-/*
- * Default IO error handler.
- */
-
-void
-_IceDefaultIOErrorHandler (iceConn)
-
-IceConn iceConn;
-
-{
- fprintf (stderr,
- "ICE default IO error handler doing an exit(), pid = %d, errno = %d\n",
- getpid(), errno);
-
- exit (1);
-}
-
-
-
-/*
- * This procedure sets the ICE fatal I/O error handler to be the
- * specified routine. If NULL is passed in the default error
- * handler is restored. The function's return value is the
- * previous error handler.
- */
-
-IceIOErrorHandler
-IceSetIOErrorHandler (handler)
-
-IceIOErrorHandler handler;
-
-{
- IceIOErrorHandler oldHandler = _IceIOErrorHandler;
-
- if (handler != NULL)
- _IceIOErrorHandler = handler;
- else
- _IceIOErrorHandler = _IceDefaultIOErrorHandler;
-
- return (oldHandler);
-}
diff --git a/xc/lib/ICE/getauth.c b/xc/lib/ICE/getauth.c
deleted file mode 100644
index 7f84e7e3b..000000000
--- a/xc/lib/ICE/getauth.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* $TOG: getauth.c /main/9 1998/02/06 13:56:07 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/ICE/ICEutil.h>
-
-static Bool auth_valid ();
-
-extern int _IcePaAuthDataEntryCount;
-extern IceAuthDataEntry _IcePaAuthDataEntries[];
-
-
-/*
- * The functions in this file are not a standard part of ICElib.
- *
- * The sample implementation uses an .ICEauthority to manipulate
- * authentication data.
- *
- * For the client that initiates a Protocol Setup, we look in the
- * .ICEauthority file to get the data.
- *
- * For the client accepting the Protocol Setup, we get the data
- * from an in-memory database of authentication data (set by the
- * application calling IceSetPaAuthData). We have to get the data
- * from memory because getting it directly from the .ICEauthority
- * file is not secure - someone can just modify the contents of the
- * .ICEauthority file behind our back.
- */
-
-void
-_IceGetPoAuthData (protocolName, networkId, authName,
- authDataLenRet, authDataRet)
-
-char *protocolName;
-char *networkId;
-char *authName;
-unsigned short *authDataLenRet;
-char **authDataRet;
-
-{
- IceAuthFileEntry *entry;
-
- entry = IceGetAuthFileEntry (protocolName, networkId, authName);
-
- if (entry)
- {
- *authDataLenRet = entry->auth_data_length;
-
- if ((*authDataRet = (char *) malloc (entry->auth_data_length)) != NULL)
- memcpy (*authDataRet, entry->auth_data, entry->auth_data_length);
- }
- else
- {
- *authDataLenRet = 0;
- *authDataRet = NULL;
- }
-
- IceFreeAuthFileEntry (entry);
-}
-
-
-
-void
-_IceGetPaAuthData (protocolName, networkId, authName,
- authDataLenRet, authDataRet)
-
-char *protocolName;
-char *networkId;
-char *authName;
-unsigned short *authDataLenRet;
-char **authDataRet;
-
-{
- IceAuthDataEntry *entry;
- int found = 0;
- int i;
-
- for (i = 0; i < _IcePaAuthDataEntryCount && !found; i++)
- {
- entry = &_IcePaAuthDataEntries[i];
-
- found =
- strcmp (protocolName, entry->protocol_name) == 0 &&
- strcmp (networkId, entry->network_id) == 0 &&
- strcmp (authName, entry->auth_name) == 0;
- }
-
- if (found)
- {
- *authDataLenRet = entry->auth_data_length;
-
- if ((*authDataRet = (char *) malloc (entry->auth_data_length)) != NULL)
- memcpy (*authDataRet, entry->auth_data, entry->auth_data_length);
- }
- else
- {
- *authDataLenRet = 0;
- *authDataRet = NULL;
- }
-}
-
-
-
-void
-_IceGetPoValidAuthIndices (protocol_name, network_id,
- num_auth_names, auth_names, num_indices_ret, indices_ret)
-
-char *protocol_name;
-char *network_id;
-int num_auth_names;
-char **auth_names;
-int *num_indices_ret;
-int *indices_ret; /* in/out arg */
-
-{
- FILE *auth_file;
- char *filename;
- IceAuthFileEntry *entry;
- int index_ret, i;
-
- *num_indices_ret = 0;
-
- if (!(filename = IceAuthFileName ()))
- return;
-
- if (access (filename, R_OK) != 0) /* checks REAL id */
- return;
-
- if (!(auth_file = fopen (filename, "rb")))
- return;
-
- for (;;)
- {
- if (!(entry = IceReadAuthFileEntry (auth_file)))
- break;
-
- if (strcmp (protocol_name, entry->protocol_name) == 0 &&
- strcmp (network_id, entry->network_id) == 0 &&
- auth_valid (entry->auth_name, num_auth_names,
- auth_names, &index_ret))
- {
- /*
- * Make sure we didn't store this index already.
- */
-
- for (i = 0; i < *num_indices_ret; i++)
- if (index_ret == indices_ret[i])
- break;
-
- if (i >= *num_indices_ret)
- {
- indices_ret[*num_indices_ret] = index_ret;
- *num_indices_ret += 1;
- }
- }
-
- IceFreeAuthFileEntry (entry);
- }
-
- fclose (auth_file);
-}
-
-
-
-void
-_IceGetPaValidAuthIndices (protocol_name, network_id,
- num_auth_names, auth_names, num_indices_ret, indices_ret)
-
-char *protocol_name;
-char *network_id;
-int num_auth_names;
-char **auth_names;
-int *num_indices_ret;
-int *indices_ret; /* in/out arg */
-
-{
- int index_ret;
- int i, j;
- IceAuthDataEntry *entry;
-
- *num_indices_ret = 0;
-
- for (i = 0; i < _IcePaAuthDataEntryCount; i++)
- {
- entry = &_IcePaAuthDataEntries[i];
-
- if (strcmp (protocol_name, entry->protocol_name) == 0 &&
- strcmp (network_id, entry->network_id) == 0 &&
- auth_valid (entry->auth_name, num_auth_names,
- auth_names, &index_ret))
- {
- /*
- * Make sure we didn't store this index already.
- */
-
- for (j = 0; j < *num_indices_ret; j++)
- if (index_ret == indices_ret[j])
- break;
-
- if (j >= *num_indices_ret)
- {
- indices_ret[*num_indices_ret] = index_ret;
- *num_indices_ret += 1;
- }
- }
- }
-}
-
-
-
-/*
- * local routines
- */
-
-static Bool
-auth_valid (auth_name, num_auth_names, auth_names, index_ret)
-
-char *auth_name;
-int num_auth_names;
-char **auth_names;
-int *index_ret;
-
-{
- /*
- * Check if auth_name is in auth_names. Return index.
- */
-
- int i;
-
- for (i = 0; i < num_auth_names; i++)
- if (strcmp (auth_name, auth_names[i]) == 0)
- {
- break;
- }
-
- if (i < num_auth_names)
- {
- *index_ret = i;
- return (1);
- }
- else
- return (0);
-}
diff --git a/xc/lib/ICE/globals.h b/xc/lib/ICE/globals.h
deleted file mode 100644
index 2bcc8bb45..000000000
--- a/xc/lib/ICE/globals.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $TOG: globals.h /main/15 1998/02/06 13:56:12 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/globals.h,v 1.2 1998/12/20 11:56:49 dawes Exp $ */
-
-extern void _IceDefaultErrorHandler ();
-extern void _IceDefaultIOErrorHandler ();
-
-extern IcePoAuthStatus _IcePoMagicCookie1Proc ();
-extern IcePaAuthStatus _IcePaMagicCookie1Proc ();
-
-extern void _IceProcessCoreMessage ();
-
-#ifndef __EMX__
-IceConn _IceConnectionObjs[256];
-char *_IceConnectionStrings[256];
-#else
-IceConn _IceConnectionObjs[256] = {0};
-char *_IceConnectionStrings[256] = {0};
-#endif
-int _IceConnectionCount = 0;
-
-#ifndef __EMX__
-_IceProtocol _IceProtocols[255];
-#else
-_IceProtocol _IceProtocols[255] = {0};
-#endif
-int _IceLastMajorOpcode = 0;
-
-int _IceAuthCount = 1;
-char *_IceAuthNames[] = {"MIT-MAGIC-COOKIE-1"};
-IcePoAuthProc _IcePoAuthProcs[] = {_IcePoMagicCookie1Proc};
-IcePaAuthProc _IcePaAuthProcs[] = {_IcePaMagicCookie1Proc};
-
-int _IceVersionCount = 1;
-_IceVersion _IceVersions[] = {
- {IceProtoMajor, IceProtoMinor, _IceProcessCoreMessage}};
-
-_IceWatchProc *_IceWatchProcs = NULL;
-
-IceErrorHandler _IceErrorHandler = _IceDefaultErrorHandler;
-IceIOErrorHandler _IceIOErrorHandler = _IceDefaultIOErrorHandler;
diff --git a/xc/lib/ICE/iceauth.c b/xc/lib/ICE/iceauth.c
deleted file mode 100644
index 6ff0fa514..000000000
--- a/xc/lib/ICE/iceauth.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* $TOG: iceauth.c /main/22 1998/02/06 13:56:17 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/iceauth.c,v 3.2 1998/10/03 08:41:09 dawes Exp $ */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/ICE/ICEutil.h>
-
-#if defined(X_NOT_STDC_ENV) && !defined(__EMX__)
-#define Time_t long
-extern Time_t time ();
-#else
-#include <time.h>
-#define Time_t time_t
-#endif
-
-static int binaryEqual ();
-
-static int was_called_state;
-
-/*
- * MIT-MAGIC-COOKIE-1 is a sample authentication method implemented by
- * the SI. It is not part of standard ICElib.
- */
-
-
-char *
-IceGenerateMagicCookie (len)
-
-int len;
-
-{
- char *auth;
- long ldata[2];
- int seed;
- int value;
- int i;
-
- if ((auth = (char *) malloc (len + 1)) == NULL)
- return (NULL);
-
-#ifdef ITIMER_REAL
- {
- struct timeval now;
- X_GETTIMEOFDAY (&now);
- ldata[0] = now.tv_sec;
- ldata[1] = now.tv_usec;
- }
-#else
- {
-#ifndef __EMX__
- long time ();
-#endif
- ldata[0] = time ((long *) 0);
- ldata[1] = getpid ();
- }
-#endif
- seed = (ldata[0]) + (ldata[1] << 16);
- srand (seed);
- for (i = 0; i < len; i++)
- {
- value = rand ();
- auth[i] = value & 0xff;
- }
- auth[len] = '\0';
-
- return (auth);
-}
-
-
-
-IcePoAuthStatus
-_IcePoMagicCookie1Proc (iceConn, authStatePtr, cleanUp, swap,
- authDataLen, authData, replyDataLenRet, replyDataRet, errorStringRet)
-
-IceConn iceConn;
-IcePointer *authStatePtr;
-Bool cleanUp;
-Bool swap;
-int authDataLen;
-IcePointer authData;
-int *replyDataLenRet;
-IcePointer *replyDataRet;
-char **errorStringRet;
-
-{
- if (cleanUp)
- {
- /*
- * We didn't allocate any state. We're done.
- */
-
- return (IcePoAuthDoneCleanup);
- }
-
- *errorStringRet = NULL;
-
- if (*authStatePtr == NULL)
- {
- /*
- * This is the first time we're being called. Search the
- * authentication data for the first occurence of
- * MIT-MAGIC-COOKIE-1 that matches iceConn->connection_string.
- */
-
- unsigned short length;
- char *data;
-
- _IceGetPoAuthData ("ICE", iceConn->connection_string,
- "MIT-MAGIC-COOKIE-1", &length, &data);
-
- if (!data)
- {
- char *tempstr =
- "Could not find correct MIT-MAGIC-COOKIE-1 authentication";
-
- *errorStringRet = (char *) malloc (strlen (tempstr) + 1);
- if (*errorStringRet)
- strcpy (*errorStringRet, tempstr);
-
- return (IcePoAuthFailed);
- }
- else
- {
- *authStatePtr = (IcePointer) &was_called_state;
-
- *replyDataLenRet = length;
- *replyDataRet = data;
-
- return (IcePoAuthHaveReply);
- }
- }
- else
- {
- /*
- * We should never get here for MIT-MAGIC-COOKIE-1 since it is
- * a single pass authentication method.
- */
-
- char *tempstr = "MIT-MAGIC-COOKIE-1 authentication internal error";
-
- *errorStringRet = (char *) malloc (strlen (tempstr) + 1);
- if (*errorStringRet)
- strcpy (*errorStringRet, tempstr);
-
- return (IcePoAuthFailed);
- }
-}
-
-
-
-IcePaAuthStatus
-_IcePaMagicCookie1Proc (iceConn, authStatePtr, swap,
- authDataLen, authData, replyDataLenRet, replyDataRet, errorStringRet)
-
-IceConn iceConn;
-IcePointer *authStatePtr;
-Bool swap;
-int authDataLen;
-IcePointer authData;
-int *replyDataLenRet;
-IcePointer *replyDataRet;
-char **errorStringRet;
-
-{
- *errorStringRet = NULL;
- *replyDataLenRet = 0;
- *replyDataRet = NULL;
-
- if (*authStatePtr == NULL)
- {
- /*
- * This is the first time we're being called. We don't have
- * any data to pass to the other client.
- */
-
- *authStatePtr = (IcePointer) &was_called_state;
-
- return (IcePaAuthContinue);
- }
- else
- {
- /*
- * Search the authentication data for the first occurence of
- * MIT-MAGIC-COOKIE-1 that matches iceConn->connection_string.
- */
-
- unsigned short length;
- char *data;
-
- _IceGetPaAuthData ("ICE", iceConn->connection_string,
- "MIT-MAGIC-COOKIE-1", &length, &data);
-
- if (data)
- {
- IcePaAuthStatus stat;
-
- if (authDataLen == length &&
- binaryEqual ((char *) authData, data, authDataLen))
- {
- stat = IcePaAuthAccepted;
- }
- else
- {
- char *tempstr = "MIT-MAGIC-COOKIE-1 authentication rejected";
-
- *errorStringRet = (char *) malloc (strlen (tempstr) + 1);
- if (*errorStringRet)
- strcpy (*errorStringRet, tempstr);
-
- stat = IcePaAuthRejected;
- }
-
- free (data);
- return (stat);
- }
- else
- {
- /*
- * We should never get here because in the ConnectionReply
- * we should have passed all the valid methods. So we should
- * always find a valid entry.
- */
-
- char *tempstr =
- "MIT-MAGIC-COOKIE-1 authentication internal error";
-
- *errorStringRet = (char *) malloc (strlen (tempstr) + 1);
- if (*errorStringRet)
- strcpy (*errorStringRet, tempstr);
-
- return (IcePaAuthFailed);
- }
- }
-}
-
-
-
-/*
- * local routines
- */
-
-static int
-binaryEqual (a, b, len)
-
-register char *a, *b;
-register unsigned len;
-
-{
- while (len--)
- if (*a++ != *b++)
- return 0;
- return 1;
-}
diff --git a/xc/lib/ICE/listen.c b/xc/lib/ICE/listen.c
deleted file mode 100644
index 0026fc079..000000000
--- a/xc/lib/ICE/listen.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* $TOG: listen.c /main/16 1998/02/06 13:57:14 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/Xtrans.h>
-#include <stdio.h>
-
-
-Status
-IceListenForConnections (countRet, listenObjsRet, errorLength, errorStringRet)
-
-int *countRet;
-IceListenObj **listenObjsRet;
-int errorLength;
-char *errorStringRet;
-
-{
- struct _IceListenObj *listenObjs;
- char *networkId;
- int fd, transCount, partial, i, j;
- Status status = 1;
- XtransConnInfo *transConns = NULL;
-
-
- if ((_IceTransMakeAllCOTSServerListeners (NULL, &partial,
- &transCount, &transConns) < 0) || (transCount < 1))
- {
- *listenObjsRet = NULL;
- *countRet = 0;
-
- strncpy (errorStringRet,
- "Cannot establish any listening sockets", errorLength);
-
- return (0);
- }
-
- if ((listenObjs = (struct _IceListenObj *) malloc (
- transCount * sizeof (struct _IceListenObj))) == NULL)
- {
- for (i = 0; i < transCount; i++)
- _IceTransClose (transConns[i]);
- free ((char *) transConns);
- return (0);
- }
-
- *countRet = 0;
-
- for (i = 0; i < transCount; i++)
- {
- networkId = _IceTransGetMyNetworkId (transConns[i]);
-
- if (networkId)
- {
- listenObjs[*countRet].trans_conn = transConns[i];
- listenObjs[*countRet].network_id = networkId;
-
- (*countRet)++;
- }
- }
-
- if (*countRet == 0)
- {
- *listenObjsRet = NULL;
-
- strncpy (errorStringRet,
- "Cannot establish any listening sockets", errorLength);
-
- status = 0;
- }
- else
- {
- *listenObjsRet = (IceListenObj *) malloc (
- *countRet * sizeof (IceListenObj));
-
- if (*listenObjsRet == NULL)
- {
- strncpy (errorStringRet, "Malloc failed", errorLength);
-
- status = 0;
- }
- else
- {
- for (i = 0; i < *countRet; i++)
- {
- (*listenObjsRet)[i] = (IceListenObj) malloc (
- sizeof (struct _IceListenObj));
-
- if ((*listenObjsRet)[i] == NULL)
- {
- strncpy (errorStringRet, "Malloc failed", errorLength);
-
- for (j = 0; j < i; j++)
- free ((char *) (*listenObjsRet)[j]);
-
- free ((char *) *listenObjsRet);
-
- status = 0;
- }
- else
- {
- *((*listenObjsRet)[i]) = listenObjs[i];
- }
- }
- }
- }
-
- if (status == 1)
- {
- if (errorStringRet && errorLength > 0)
- *errorStringRet = '\0';
-
- for (i = 0; i < *countRet; i++)
- {
- (*listenObjsRet)[i]->host_based_auth_proc = NULL;
- }
- }
- else
- {
- for (i = 0; i < transCount; i++)
- _IceTransClose (transConns[i]);
- }
-
- free ((char *) listenObjs);
- free ((char *) transConns);
-
- return (status);
-}
-
-
-
-int
-IceGetListenConnectionNumber (listenObj)
-
-IceListenObj listenObj;
-
-{
- return (_IceTransGetConnectionNumber (listenObj->trans_conn));
-}
-
-
-
-char *
-IceGetListenConnectionString (listenObj)
-
-IceListenObj listenObj;
-
-{
- char *networkId;
-
- networkId = (char *) malloc (strlen (listenObj->network_id) + 1);
-
- if (networkId)
- strcpy (networkId, listenObj->network_id);
-
- return (networkId);
-}
-
-
-
-char *
-IceComposeNetworkIdList (count, listenObjs)
-
-int count;
-IceListenObj *listenObjs;
-
-{
- char *list;
- int len = 0;
- int i;
-
- if (count < 1 || listenObjs == NULL)
- return (NULL);
-
- for (i = 0; i < count; i++)
- len += (strlen (listenObjs[i]->network_id) + 1);
-
- list = (char *) malloc (len);
-
- if (list == NULL)
- return (NULL);
- else
- {
- int doneCount = 0;
-
- list[0] = '\0';
-
- for (i = 0; i < count; i++)
- {
- if (_IceTransIsLocal (listenObjs[i]->trans_conn))
- {
- strcat (list, listenObjs[i]->network_id);
- doneCount++;
- if (doneCount < count)
- strcat (list, ",");
- }
- }
-
- if (doneCount < count)
- {
- for (i = 0; i < count; i++)
- {
- if (!_IceTransIsLocal (listenObjs[i]->trans_conn))
- {
- strcat (list, listenObjs[i]->network_id);
- doneCount++;
- if (doneCount < count)
- strcat (list, ",");
- }
- }
- }
-
- return (list);
- }
-}
-
-
-
-void
-IceFreeListenObjs (count, listenObjs)
-
-int count;
-IceListenObj *listenObjs;
-
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- free (listenObjs[i]->network_id);
- _IceTransClose (listenObjs[i]->trans_conn);
- free ((char *) listenObjs[i]);
- }
-
- free ((char *) listenObjs);
-}
-
-
-
-/*
- * Allow host based authentication for the ICE Connection Setup.
- * Do not confuse with the host based authentication callbacks that
- * can be set up in IceRegisterForProtocolReply.
- */
-
-void
-IceSetHostBasedAuthProc (listenObj, hostBasedAuthProc)
-
-IceListenObj listenObj;
-IceHostBasedAuthProc hostBasedAuthProc;
-
-{
- listenObj->host_based_auth_proc = hostBasedAuthProc;
-}
diff --git a/xc/lib/ICE/listenwk.c b/xc/lib/ICE/listenwk.c
deleted file mode 100644
index 78b1b9368..000000000
--- a/xc/lib/ICE/listenwk.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $TOG: listenwk.c /main/5 1998/02/09 08:30:39 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.
-
-*/
-/* $XFree86: xc/lib/ICE/listenwk.c,v 1.2 1999/05/23 06:33:24 dawes Exp $ */
-
-
-/* Author: Ralph Mor, X Consortium */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/Xtrans.h>
-#include <stdio.h>
-
-
-Status
-IceListenForWellKnownConnections (port, countRet, listenObjsRet, errorLength, errorStringRet)
-
-char *port;
-int *countRet;
-IceListenObj **listenObjsRet;
-int errorLength;
-char *errorStringRet;
-
-{
- struct _IceListenObj *listenObjs;
- char *networkId;
- int transCount, partial, i, j;
- Status status = 1;
- XtransConnInfo *transConns = NULL;
-
-
- if ((_IceTransMakeAllCOTSServerListeners (port, &partial,
- &transCount, &transConns) < 0) || (transCount < 1))
- {
- *listenObjsRet = NULL;
- *countRet = 0;
-
- strncpy (errorStringRet,
- "Cannot establish any listening sockets", errorLength);
-
- return (0);
- }
-
- if ((listenObjs = (struct _IceListenObj *) malloc (
- transCount * sizeof (struct _IceListenObj))) == NULL)
- {
- for (i = 0; i < transCount; i++)
- _IceTransClose (transConns[i]);
- free ((char *) transConns);
- return (0);
- }
-
- *countRet = 0;
-
- for (i = 0; i < transCount; i++)
- {
- networkId = (char *)_IceTransGetMyNetworkId (transConns[i]);
-
- if (networkId)
- {
- listenObjs[*countRet].trans_conn = transConns[i];
- listenObjs[*countRet].network_id = networkId;
-
- (*countRet)++;
- }
- }
-
- if (*countRet == 0)
- {
- *listenObjsRet = NULL;
-
- strncpy (errorStringRet,
- "Cannot establish any listening sockets", errorLength);
-
- status = 0;
- }
- else
- {
- *listenObjsRet = (IceListenObj *) malloc (
- *countRet * sizeof (IceListenObj));
-
- if (*listenObjsRet == NULL)
- {
- strncpy (errorStringRet, "Malloc failed", errorLength);
-
- status = 0;
- }
- else
- {
- for (i = 0; i < *countRet; i++)
- {
- (*listenObjsRet)[i] = (IceListenObj) malloc (
- sizeof (struct _IceListenObj));
-
- if ((*listenObjsRet)[i] == NULL)
- {
- strncpy (errorStringRet, "Malloc failed", errorLength);
-
- for (j = 0; j < i; j++)
- free ((char *) (*listenObjsRet)[j]);
-
- free ((char *) *listenObjsRet);
-
- status = 0;
- }
- else
- {
- *((*listenObjsRet)[i]) = listenObjs[i];
- }
- }
- }
- }
-
- if (status == 1)
- {
- if (errorStringRet && errorLength > 0)
- *errorStringRet = '\0';
-
- for (i = 0; i < *countRet; i++)
- {
- (*listenObjsRet)[i]->host_based_auth_proc = NULL;
- }
- }
- else
- {
- for (i = 0; i < transCount; i++)
- _IceTransClose (transConns[i]);
- }
-
- free ((char *) listenObjs);
- free ((char *) transConns);
-
- return (status);
-}
diff --git a/xc/lib/ICE/locking.c b/xc/lib/ICE/locking.c
deleted file mode 100644
index 0119d14f0..000000000
--- a/xc/lib/ICE/locking.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $TOG: locking.c /main/5 1998/02/06 13:57:19 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-
-/*
- * NOT IMPLEMENTED YET
- */
-
-
-Status
-IceInitThreads ()
-
-{
- return (0);
-}
-
-
-void
-IceAppLockConn (iceConn)
-
-IceConn iceConn;
-
-{
- IceLockConn (iceConn);
-}
-
-
-void
-IceAppUnlockConn (iceConn)
-
-IceConn iceConn;
-
-{
- IceUnlockConn (iceConn);
-}
diff --git a/xc/lib/ICE/misc.c b/xc/lib/ICE/misc.c
deleted file mode 100644
index b533c7f9e..000000000
--- a/xc/lib/ICE/misc.c
+++ /dev/null
@@ -1,619 +0,0 @@
-/* $TOG: misc.c /main/30 1998/02/06 13:57:24 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/misc.c,v 1.2 1999/05/23 06:33:24 dawes Exp $ */
-
-#ifdef WIN32
-#define _WILLWINSOCK_
-#endif
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/Xtrans.h>
-#include <stdio.h>
-#ifdef WIN32
-#include <X11/Xwinsock.h>
-#include <X11/Xw32defs.h>
-#endif
-
-
-/*
- * scratch buffer
- */
-
-char *
-IceAllocScratch (iceConn, size)
-
-IceConn iceConn;
-unsigned long size;
-
-{
- if (!iceConn->scratch || size > iceConn->scratch_size)
- {
- if (iceConn->scratch)
- free (iceConn->scratch);
-
- iceConn->scratch = (char *) malloc ((unsigned) size);
- iceConn->scratch_size = size;
- }
-
- return (iceConn->scratch);
-}
-
-
-
-/*
- * Output/Input buffer functions
- */
-
-int
-IceFlush (iceConn)
-
-IceConn iceConn;
-
-{
- _IceWrite (iceConn,
- (unsigned long) (iceConn->outbufptr - iceConn->outbuf),
- iceConn->outbuf);
-
- iceConn->outbufptr = iceConn->outbuf;
- return 1;
-}
-
-
-int
-IceGetOutBufSize (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->outbufmax - iceConn->outbuf);
-}
-
-
-int
-IceGetInBufSize (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->inbufmax - iceConn->inbuf);
-}
-
-
-
-/*
- * informational functions
- */
-
-IceConnectStatus
-IceConnectionStatus (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->connection_status);
-}
-
-
-char *
-IceVendor (iceConn)
-
-IceConn iceConn;
-
-{
- char *string = (char *) malloc (strlen (iceConn->vendor) + 1);
-
- if (string)
- strcpy (string, iceConn->vendor);
-
- return (string);
-}
-
-
-char *
-IceRelease (iceConn)
-
-IceConn iceConn;
-
-{
- char *string = (char *) malloc (strlen (iceConn->release) + 1);
-
- if (string)
- strcpy (string, iceConn->release);
-
- return (string);
-}
-
-
-int
-IceProtocolVersion (iceConn)
-
-IceConn iceConn;
-
-{
- return (_IceVersions[iceConn->my_ice_version_index].major_version);
-}
-
-
-int
-IceProtocolRevision (iceConn)
-
-IceConn iceConn;
-
-{
- return (_IceVersions[iceConn->my_ice_version_index].minor_version);
-}
-
-
-int
-IceConnectionNumber (iceConn)
-
-IceConn iceConn;
-
-{
- return (_IceTransGetConnectionNumber (iceConn->trans_conn));
-}
-
-
-char *
-IceConnectionString (iceConn)
-
-IceConn iceConn;
-
-{
- if (iceConn->connection_string)
- {
- char *string = (char *) malloc (
- strlen (iceConn->connection_string) + 1);
-
- if (string)
- strcpy (string, iceConn->connection_string);
-
- return (string);
- }
- else
- return (NULL);
-}
-
-
-unsigned long
-IceLastSentSequenceNumber (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->send_sequence);
-}
-
-
-unsigned long
-IceLastReceivedSequenceNumber (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->receive_sequence);
-}
-
-
-Bool
-IceSwapping (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->swap);
-}
-
-
-
-/*
- * Read "n" bytes from a connection.
- *
- * Return Status 0 if we detected an EXPECTED closed connection.
- *
- */
-
-Status
-_IceRead (iceConn, nbytes, ptr)
-
-register IceConn iceConn;
-unsigned long nbytes;
-register char *ptr;
-
-{
- register unsigned long nleft;
-
- nleft = nbytes;
- while (nleft > 0)
- {
- int nread;
-
- if (iceConn->io_ok)
- nread = _IceTransRead (iceConn->trans_conn, ptr, (int) nleft);
- else
- return (1);
-
- if (nread <= 0)
- {
-#ifdef WIN32
- errno = WSAGetLastError();
-#endif
- if (iceConn->want_to_close)
- {
- /*
- * We sent a WantToClose message and now we detected that
- * the other side closed the connection.
- */
-
- _IceConnectionClosed (iceConn); /* invoke watch procs */
- _IceFreeConnection (iceConn);
-
- return (0);
- }
- else
- {
- /*
- * Fatal IO error. First notify each protocol's IceIOErrorProc
- * callback, then invoke the application IO error handler.
- */
-
- iceConn->io_ok = False;
-
- if (iceConn->connection_status == IceConnectPending)
- {
- /*
- * Don't invoke IO error handler if we are in the
- * middle of a connection setup.
- */
-
- return (1);
- }
-
- if (iceConn->process_msg_info)
- {
- int i;
-
- for (i = iceConn->his_min_opcode;
- i <= iceConn->his_max_opcode; i++)
- {
- _IceProcessMsgInfo *process;
-
- process = &iceConn->process_msg_info[
- i - iceConn->his_min_opcode];
-
- if (process->in_use)
- {
- IceIOErrorProc IOErrProc = process->accept_flag ?
- process->protocol->accept_client->io_error_proc :
- process->protocol->orig_client->io_error_proc;
-
- if (IOErrProc)
- (*IOErrProc) (iceConn);
- }
- }
- }
-
- (*_IceIOErrorHandler) (iceConn);
- return (1);
- }
- }
-
- nleft -= nread;
- ptr += nread;
- }
-
- return (1);
-}
-
-
-
-/*
- * If we read a message header with a bad major or minor opcode,
- * we need to advance to the end of the message. This way, the next
- * message can be processed correctly.
- */
-
-void
-_IceReadSkip (iceConn, nbytes)
-
-register IceConn iceConn;
-register unsigned long nbytes;
-
-{
- char temp[512];
-
- while (nbytes > 0)
- {
- unsigned long rbytes = nbytes > 512 ? 512 : nbytes;
-
- _IceRead (iceConn, rbytes, temp);
- nbytes -= rbytes;
- }
-}
-
-
-
-/*
- * Write "n" bytes to a connection.
- */
-
-void
-_IceWrite (iceConn, nbytes, ptr)
-
-register IceConn iceConn;
-unsigned long nbytes;
-register char *ptr;
-
-{
- register unsigned long nleft;
-
- nleft = nbytes;
- while (nleft > 0)
- {
- int nwritten;
-
- if (iceConn->io_ok)
- nwritten = _IceTransWrite (iceConn->trans_conn, ptr, (int) nleft);
- else
- return;
-
- if (nwritten <= 0)
- {
-#ifdef WIN32
- errno = WSAGetLastError();
-#endif
- /*
- * Fatal IO error. First notify each protocol's IceIOErrorProc
- * callback, then invoke the application IO error handler.
- */
-
- iceConn->io_ok = False;
-
- if (iceConn->connection_status == IceConnectPending)
- {
- /*
- * Don't invoke IO error handler if we are in the
- * middle of a connection setup.
- */
-
- return;
- }
-
- if (iceConn->process_msg_info)
- {
- int i;
-
- for (i = iceConn->his_min_opcode;
- i <= iceConn->his_max_opcode; i++)
- {
- _IceProcessMsgInfo *process;
-
- process = &iceConn->process_msg_info[
- i - iceConn->his_min_opcode];
-
- if (process->in_use)
- {
- IceIOErrorProc IOErrProc = process->accept_flag ?
- process->protocol->accept_client->io_error_proc :
- process->protocol->orig_client->io_error_proc;
-
- if (IOErrProc)
- (*IOErrProc) (iceConn);
- }
- }
- }
-
- (*_IceIOErrorHandler) (iceConn);
- return;
- }
-
- nleft -= nwritten;
- ptr += nwritten;
- }
-}
-
-#ifdef WORD64
-
-IceWriteData16 (iceConn, nbytes, data)
-
-IceConn iceConn;
-unsigned long nbytes;
-short *data;
-
-{
- int numShorts = nbytes / 2;
- int index = 0;
-
- while (index < numShorts)
- {
- int spaceLeft, count, i;
- int shortsLeft = numShorts - index;
-
- spaceLeft = iceConn->outbufmax - iceConn->outbufptr - 1;
-
- if (spaceLeft < 2)
- {
- IceFlush (iceConn);
- spaceLeft = iceConn->outbufmax - iceConn->outbufptr - 1;
- }
-
- count = (shortsLeft < spaceLeft / 2) ? shortsLeft : spaceLeft / 2;
-
- for (i = 0; i < count; i++)
- STORE_CARD16 (iceConn->outbufptr, data[index++]);
- }
-}
-
-
-IceWriteData32 (iceConn, nbytes, data)
-
-IceConn iceConn;
-unsigned long nbytes;
-int *data;
-
-{
- int numLongs = nbytes / 4;
- int index = 0;
-
- while (index < numLongs)
- {
- int spaceLeft, count, i;
- int longsLeft = numLongs - index;
-
- spaceLeft = iceConn->outbufmax - iceConn->outbufptr - 1;
-
- if (spaceLeft < 4)
- {
- IceFlush (iceConn);
- spaceLeft = iceConn->outbufmax - iceConn->outbufptr - 1;
- }
-
- count = (longsLeft < spaceLeft / 4) ? longsLeft : spaceLeft / 4;
-
- for (i = 0; i < count; i++)
- STORE_CARD32 (iceConn->outbufptr, data[index++]);
- }
-}
-
-
-IceReadData16 (iceConn, swap, nbytes, data)
-
-IceConn iceConn;
-Bool swap;
-unsigned long nbytes;
-short *data;
-
-{
- /* NOT IMPLEMENTED YET */
-}
-
-
-IceReadData32 (iceConn, swap, nbytes, data)
-
-IceConn iceConn;
-Bool swap;
-unsigned long nbytes;
-int *data;
-
-{
- /* NOT IMPLEMENTED YET */
-}
-
-#endif /* WORD64 */
-
-
-
-void
-_IceAddOpcodeMapping (iceConn, hisOpcode, myOpcode)
-
-IceConn iceConn;
-int hisOpcode;
-int myOpcode;
-
-{
- if (hisOpcode <= 0 || hisOpcode > 255)
- {
- return;
- }
- else if (iceConn->process_msg_info == NULL)
- {
- iceConn->process_msg_info = (_IceProcessMsgInfo *) malloc (
- sizeof (_IceProcessMsgInfo));
- iceConn->his_min_opcode = iceConn->his_max_opcode = hisOpcode;
- }
- else if (hisOpcode < iceConn->his_min_opcode)
- {
- _IceProcessMsgInfo *oldVec = iceConn->process_msg_info;
- int oldsize = iceConn->his_max_opcode - iceConn->his_min_opcode + 1;
- int newsize = iceConn->his_max_opcode - hisOpcode + 1;
- int i;
-
- iceConn->process_msg_info = (_IceProcessMsgInfo *) malloc (
- newsize * sizeof (_IceProcessMsgInfo));
-
- memcpy (&iceConn->process_msg_info[
- iceConn->his_min_opcode - hisOpcode], oldVec,
- oldsize * sizeof (_IceProcessMsgInfo));
-
- free ((char *) oldVec);
-
- for (i = hisOpcode + 1; i < iceConn->his_min_opcode; i++)
- {
- iceConn->process_msg_info[i -
- iceConn->his_min_opcode].in_use = False;
-
- iceConn->process_msg_info[i -
- iceConn->his_min_opcode].protocol = NULL;
- }
-
- iceConn->his_min_opcode = hisOpcode;
- }
- else if (hisOpcode > iceConn->his_max_opcode)
- {
- _IceProcessMsgInfo *oldVec = iceConn->process_msg_info;
- int oldsize = iceConn->his_max_opcode - iceConn->his_min_opcode + 1;
- int newsize = hisOpcode - iceConn->his_min_opcode + 1;
- int i;
-
- iceConn->process_msg_info = (_IceProcessMsgInfo *) malloc (
- newsize * sizeof (_IceProcessMsgInfo));
-
- memcpy (iceConn->process_msg_info, oldVec,
- oldsize * sizeof (_IceProcessMsgInfo));
-
- free ((char *) oldVec);
-
- for (i = iceConn->his_max_opcode + 1; i < hisOpcode; i++)
- {
- iceConn->process_msg_info[i -
- iceConn->his_min_opcode].in_use = False;
-
- iceConn->process_msg_info[i -
- iceConn->his_min_opcode].protocol = NULL;
- }
-
- iceConn->his_max_opcode = hisOpcode;
- }
-
- iceConn->process_msg_info[hisOpcode -
- iceConn->his_min_opcode].in_use = True;
-
- iceConn->process_msg_info[hisOpcode -
- iceConn->his_min_opcode].my_opcode = myOpcode;
-
- iceConn->process_msg_info[hisOpcode -
- iceConn->his_min_opcode].protocol = &_IceProtocols[myOpcode - 1];
-}
-
-
-
-char *
-_IceGetPeerName (iceConn)
-
-IceConn iceConn;
-
-{
- return (_IceTransGetPeerNetworkId (iceConn->trans_conn));
-}
diff --git a/xc/lib/ICE/ping.c b/xc/lib/ICE/ping.c
deleted file mode 100644
index 468f79f70..000000000
--- a/xc/lib/ICE/ping.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $TOG: ping.c /main/9 1998/02/06 13:57:29 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-Status
-IcePing (iceConn, pingReplyProc, clientData)
-
-IceConn iceConn;
-IcePingReplyProc pingReplyProc;
-IcePointer clientData;
-
-{
- _IcePingWait *newping = (_IcePingWait *) malloc (sizeof (_IcePingWait));
- _IcePingWait *ptr = iceConn->ping_waits;
-
- if (newping == NULL)
- return (0);
-
- newping->ping_reply_proc = pingReplyProc;
- newping->client_data = clientData;
- newping->next = NULL;
-
- while (ptr && ptr->next)
- ptr = ptr->next;
-
- if (ptr == NULL)
- iceConn->ping_waits = newping;
- else
- ptr->next = newping;
-
- IceSimpleMessage (iceConn, 0, ICE_Ping);
- IceFlush (iceConn);
-
- return (1);
-}
diff --git a/xc/lib/ICE/process.c b/xc/lib/ICE/process.c
deleted file mode 100644
index 0222ec386..000000000
--- a/xc/lib/ICE/process.c
+++ /dev/null
@@ -1,2509 +0,0 @@
-/* $TOG: process.c /main/44 1998/02/06 13:57:34 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/process.c,v 3.3 1999/05/23 06:33:24 dawes Exp $ */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-#include <stdio.h> /* sprintf */
-
-#ifdef MINIX
-#include <X11/Xtrans.h>
-#endif
-
-/*
- * Check for bad length
- */
-
-#define CHECK_SIZE_MATCH(_iceConn, _opcode, _expected_len, _actual_len, _severity) \
- if ((((_actual_len) - SIZEOF (iceMsg)) >> 3) != _expected_len) \
- { \
- _IceErrorBadLength (_iceConn, 0, _opcode, _severity); \
- return (0); \
- }
-
-#define CHECK_AT_LEAST_SIZE(_iceConn, _opcode, _expected_len, _actual_len, _severity) \
- if ((((_actual_len) - SIZEOF (iceMsg)) >> 3) > _expected_len) \
- { \
- _IceErrorBadLength (_iceConn, 0, _opcode, _severity); \
- return (0); \
- }
-
-#define CHECK_COMPLETE_SIZE(_iceConn, _opcode, _expected_len, _actual_len, _pStart, _severity) \
- if (((PADDED_BYTES64((_actual_len)) - SIZEOF (iceMsg)) >> 3) \
- != _expected_len) \
- { \
- _IceErrorBadLength (_iceConn, 0, _opcode, _severity); \
- IceDisposeCompleteMessage (iceConn, _pStart); \
- return (0); \
- }
-
-
-
-/*
- * IceProcessMessages:
- *
- * If replyWait == NULL, the client is not waiting for a reply.
- *
- * If replyWait != NULL, the client is waiting for a reply...
- *
- * - replyWait->sequence_of_request is the sequence number of the
- * message for which the client is waiting a reply. This is needed
- * to determine if an error matches a replyWait.
- *
- * - replyWait->major_opcode_of_request is the major opcode of the
- * message for which we are waiting a reply.
- *
- * - replyWait->minor_opcode_of_request is the minor opcode of the
- * message for which we are waiting a reply.
- *
- * - replyWait->reply is a pointer to the reply message which will be
- * filled in when the reply is ready (the protocol library should
- * cast this IcePointer to the appropriate reply type). In most cases,
- * the reply will have some fixed-size part, and the sender function
- * will have provided a pointer to a structure (e.g.) to hold this
- * fixed-size data. If there is variable-length data, it would be
- * expected that the reply function will have to allocate additional
- * memory and store pointer(s) to that memory in the fixed-size
- * structure. If the entire data is variable length (e.g., a single
- * variable-length string), then the sender function would probably
- * just pass a pointer to fixed-size space to hold a pointer, and the
- * reply function would allocate the storage and store the pointer.
- * It is the responsibility of the client receiving the reply to
- * free up any memory allocated on it's behalf.
- *
- * We might be waiting for several different replies (a function can wait
- * for a reply, and while calling IceProcessMessages, a callback can be
- * invoked which will wait for another reply). We take advantage of the
- * fact that for a given protocol, we are guaranteed that messages are
- * processed in the order we sent them. So, everytime we have a new
- * replyWait, we add it to the END of the 'saved_reply_waits' list. When
- * we read a message and want to see if it matches a replyWait, we use the
- * FIRST replyWait in the list with the major opcode of the message. If the
- * reply is ready, we remove that replyWait from the list.
- *
- * If the reply/error is ready for the replyWait passed in to
- * IceProcessMessages, *replyReadyRet is set to True.
- *
- * The return value of IceProcessMessages is one of the following:
- *
- * IceProcessMessagesSuccess - the message was processed successfully.
- * IceProcessMessagesIOError - an IO error occured. The caller should
- * invoked IceCloseConnection.
- * IceProcessMessagesConnectionClosed - the connection was closed as a
- * result of shutdown negotiation.
- */
-
-IceProcessMessagesStatus
-IceProcessMessages (iceConn, replyWait, replyReadyRet)
-
-IceConn iceConn;
-IceReplyWaitInfo *replyWait;
-Bool *replyReadyRet;
-
-{
- iceMsg *header;
- Bool replyReady = False;
- IceReplyWaitInfo *useThisReplyWait = NULL;
- IceProcessMessagesStatus retStatus = IceProcessMessagesSuccess;
-
- if (replyWait)
- *replyReadyRet = False;
-
- /*
- * Each time IceProcessMessages is entered, we increment the dispatch
- * level. Each time we leave it, we decrement the dispatch level.
- */
-
- iceConn->dispatch_level++;
-
-
- /*
- * Read the ICE message header.
- */
-
- if (!_IceRead (iceConn, (unsigned long) SIZEOF (iceMsg), iceConn->inbuf))
- {
- /*
- * If we previously sent a WantToClose and now we detected
- * that the connection was closed, _IceRead returns status 0.
- * Since the connection was closed, we just want to return here.
- */
-
- return (IceProcessMessagesConnectionClosed);
- }
-
- if (!iceConn->io_ok)
- {
- /*
- * An unexpected IO error occured. The caller of IceProcessMessages
- * should call IceCloseConnection which will cause the watch procedures
- * to be invoked and the ICE connection to be freed.
- */
-
- iceConn->dispatch_level--;
- iceConn->connection_status = IceConnectIOError;
- return (IceProcessMessagesIOError);
- }
-
- header = (iceMsg *) iceConn->inbuf;
- iceConn->inbufptr = iceConn->inbuf + SIZEOF (iceMsg);
-
- iceConn->receive_sequence++;
-
- if (iceConn->waiting_for_byteorder)
- {
- if (header->majorOpcode == 0 &&
- header->minorOpcode == ICE_ByteOrder)
- {
- char byteOrder = ((iceByteOrderMsg *) header)->byteOrder;
- int endian = 1;
-
- CHECK_SIZE_MATCH (iceConn, ICE_ByteOrder,
- header->length, SIZEOF (iceByteOrderMsg),
- IceFatalToConnection);
-
- if (byteOrder != IceMSBfirst && byteOrder != IceLSBfirst)
- {
- _IceErrorBadValue (iceConn, 0,
- ICE_ByteOrder, 2, 1, &byteOrder);
-
- iceConn->connection_status = IceConnectRejected;
- }
- else
- {
- iceConn->swap =
- (((*(char *) &endian) && byteOrder == IceMSBfirst) ||
- (!(*(char *) &endian) && byteOrder == IceLSBfirst));
-
- iceConn->waiting_for_byteorder = 0;
- }
- }
- else
- {
- if (header->majorOpcode != 0)
- {
- _IceErrorBadMajor (iceConn, header->majorOpcode,
- header->minorOpcode, IceFatalToConnection);
- }
- else
- {
- _IceErrorBadState (iceConn, 0,
- header->minorOpcode, IceFatalToConnection);
- }
-
- iceConn->connection_status = IceConnectRejected;
- }
-
- iceConn->dispatch_level--;
- if (!iceConn->io_ok)
- {
- iceConn->connection_status = IceConnectIOError;
- retStatus = IceProcessMessagesIOError;
- }
-
- return (retStatus);
- }
-
- if (iceConn->swap)
- {
- /* swap the length field */
-
- header->length = lswapl (header->length);
- }
-
- if (replyWait)
- {
- /*
- * Add to the list of replyWaits (only if it doesn't exist
- * in the list already.
- */
-
- _IceAddReplyWait (iceConn, replyWait);
-
-
- /*
- * Note that there are two different replyWaits. The first is
- * the one passed into IceProcessMessages, and is the replyWait
- * for the message the client is blocking on. The second is
- * the replyWait for the message currently being processed
- * by IceProcessMessages. We call it "useThisReplyWait".
- */
-
- useThisReplyWait = _IceSearchReplyWaits (iceConn, header->majorOpcode);
- }
-
- if (header->majorOpcode == 0)
- {
- /*
- * ICE protocol
- */
-
- Bool connectionClosed;
-
- _IceProcessCoreMsgProc processIce =
- _IceVersions[iceConn->my_ice_version_index].process_core_msg_proc;
-
- (*processIce) (iceConn, header->minorOpcode,
- header->length, iceConn->swap,
- useThisReplyWait, &replyReady, &connectionClosed);
-
- if (connectionClosed)
- {
- /*
- * As a result of shutdown negotiation, the connection was closed.
- */
-
- return (IceProcessMessagesConnectionClosed);
- }
- }
- else
- {
- /*
- * Sub protocol
- */
-
- if ((int) header->majorOpcode < iceConn->his_min_opcode ||
- (int) header->majorOpcode > iceConn->his_max_opcode ||
- !(iceConn->process_msg_info[header->majorOpcode -
- iceConn->his_min_opcode].in_use))
- {
- /*
- * The protocol of the message we just read is not supported.
- */
-
- _IceErrorBadMajor (iceConn, header->majorOpcode,
- header->minorOpcode, IceCanContinue);
-
- _IceReadSkip (iceConn, header->length << 3);
- }
- else
- {
- _IceProcessMsgInfo *processMsgInfo = &iceConn->process_msg_info[
- header->majorOpcode - iceConn->his_min_opcode];
-
- if (processMsgInfo->accept_flag)
- {
- IcePaProcessMsgProc processProc =
- processMsgInfo->process_msg_proc.accept_client;
-
- (*processProc) (iceConn, processMsgInfo->client_data,
- header->minorOpcode, header->length, iceConn->swap);
- }
- else
- {
- IcePoProcessMsgProc processProc =
- processMsgInfo->process_msg_proc.orig_client;
-
- (*processProc) (iceConn,
- processMsgInfo->client_data, header->minorOpcode,
- header->length, iceConn->swap,
- useThisReplyWait, &replyReady);
- }
- }
- }
-
- if (replyReady)
- {
- _IceSetReplyReady (iceConn, useThisReplyWait);
- }
-
-
- /*
- * Now we check if the reply is ready for the replyWait passed
- * into IceProcessMessages. The replyWait is removed from the
- * replyWait list if it is ready.
- */
-
- if (replyWait)
- *replyReadyRet = _IceCheckReplyReady (iceConn, replyWait);
-
-
- /*
- * Decrement the dispatch level. If we reach level 0, and the
- * free_asap bit is set, free the connection now. Also check for
- * possible bad IO status.
- */
-
- iceConn->dispatch_level--;
-
- if (iceConn->dispatch_level == 0 && iceConn->free_asap)
- {
- _IceFreeConnection (iceConn);
- retStatus = IceProcessMessagesConnectionClosed;
- }
- else if (!iceConn->io_ok)
- {
- iceConn->connection_status = IceConnectIOError;
- retStatus = IceProcessMessagesIOError;
- }
-
- return (retStatus);
-}
-
-
-
-static void
-AuthRequired (iceConn, authIndex, authDataLen, authData)
-
-IceConn iceConn;
-int authIndex;
-int authDataLen;
-IcePointer authData;
-
-{
- iceAuthRequiredMsg *pMsg;
-
- IceGetHeader (iceConn, 0, ICE_AuthRequired,
- SIZEOF (iceAuthRequiredMsg), iceAuthRequiredMsg, pMsg);
-
- pMsg->authIndex = authIndex;
- pMsg->authDataLength = authDataLen;
- pMsg->length += WORD64COUNT (authDataLen);
-
- IceWriteData (iceConn, authDataLen, (char *) authData);
-
- if (PAD64 (authDataLen))
- IceWritePad (iceConn, PAD64 (authDataLen));
-
- IceFlush (iceConn);
-}
-
-
-
-static void
-AuthReply (iceConn, authDataLen, authData)
-
-IceConn iceConn;
-int authDataLen;
-IcePointer authData;
-
-{
- iceAuthReplyMsg *pMsg;
-
- IceGetHeader (iceConn, 0, ICE_AuthReply,
- SIZEOF (iceAuthReplyMsg), iceAuthReplyMsg, pMsg);
-
- pMsg->authDataLength = authDataLen;
- pMsg->length += WORD64COUNT (authDataLen);
-
- IceWriteData (iceConn, authDataLen, (char *) authData);
-
- if (PAD64 (authDataLen))
- IceWritePad (iceConn, PAD64 (authDataLen));
-
- IceFlush (iceConn);
-}
-
-
-
-static void
-AuthNextPhase (iceConn, authDataLen, authData)
-
-IceConn iceConn;
-int authDataLen;
-IcePointer authData;
-
-{
- iceAuthNextPhaseMsg *pMsg;
-
- IceGetHeader (iceConn, 0, ICE_AuthNextPhase,
- SIZEOF (iceAuthNextPhaseMsg), iceAuthNextPhaseMsg, pMsg);
-
- pMsg->authDataLength = authDataLen;
- pMsg->length += WORD64COUNT (authDataLen);
-
- IceWriteData (iceConn, authDataLen, (char *) authData);
-
- if (PAD64 (authDataLen))
- IceWritePad (iceConn, PAD64 (authDataLen));
-
- IceFlush (iceConn);
-}
-
-
-
-static void
-AcceptConnection (iceConn, versionIndex)
-
-IceConn iceConn;
-int versionIndex;
-
-{
- iceConnectionReplyMsg *pMsg;
- char *pData;
- int extra;
-
- extra = STRING_BYTES (IceVendorString) + STRING_BYTES (IceReleaseString);
-
- IceGetHeaderExtra (iceConn, 0, ICE_ConnectionReply,
- SIZEOF (iceConnectionReplyMsg), WORD64COUNT (extra),
- iceConnectionReplyMsg, pMsg, pData);
-
- pMsg->versionIndex = versionIndex;
-
- STORE_STRING (pData, IceVendorString);
- STORE_STRING (pData, IceReleaseString);
-
- IceFlush (iceConn);
-
- iceConn->connection_status = IceConnectAccepted;
-}
-
-
-
-static void
-AcceptProtocol (iceConn, hisOpcode, myOpcode, versionIndex, vendor, release)
-
-IceConn iceConn;
-int hisOpcode;
-int myOpcode;
-int versionIndex;
-char *vendor;
-char *release;
-
-{
- iceProtocolReplyMsg *pMsg;
- char *pData;
- int extra;
-
- extra = STRING_BYTES (vendor) + STRING_BYTES (release);
-
- IceGetHeaderExtra (iceConn, 0, ICE_ProtocolReply,
- SIZEOF (iceProtocolReplyMsg), WORD64COUNT (extra),
- iceProtocolReplyMsg, pMsg, pData);
-
- pMsg->protocolOpcode = myOpcode;
- pMsg->versionIndex = versionIndex;
-
- STORE_STRING (pData, vendor);
- STORE_STRING (pData, release);
-
- IceFlush (iceConn);
-
-
- /*
- * We may be using a different major opcode for this protocol
- * than the other client. Whenever we get a message, we must
- * map to our own major opcode.
- */
-
- _IceAddOpcodeMapping (iceConn, hisOpcode, myOpcode);
-}
-
-
-
-static void
-PingReply (iceConn)
-
-IceConn iceConn;
-
-{
- IceSimpleMessage (iceConn, 0, ICE_PingReply);
- IceFlush (iceConn);
-}
-
-
-
-static Bool
-ProcessError (iceConn, length, swap, replyWait)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-
-{
- int invokeHandler;
- Bool errorReturned = False;
- iceErrorMsg *message;
- char *pData, *pStart;
- char severity;
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_Error,
- length, SIZEOF (iceErrorMsg),
- (iceConn->connect_to_you || iceConn->connect_to_me) ?
- IceFatalToConnection : IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceErrorMsg),
- iceErrorMsg, message, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- severity = message->severity;
-
- if (severity != IceCanContinue && severity != IceFatalToProtocol &&
- severity != IceFatalToConnection)
- {
- _IceErrorBadValue (iceConn, 0,
- ICE_Error, 9, 1, &severity);
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- if (swap)
- {
- message->errorClass = lswaps (message->errorClass);
- message->offendingSequenceNum = lswapl (message->offendingSequenceNum);
- }
-
- if (!replyWait ||
- message->offendingSequenceNum != replyWait->sequence_of_request)
- {
- invokeHandler = 1;
- }
- else
- {
- if (iceConn->connect_to_you &&
- ((!iceConn->connect_to_you->auth_active &&
- message->offendingMinorOpcode == ICE_ConnectionSetup) ||
- (iceConn->connect_to_you->auth_active &&
- message->offendingMinorOpcode == ICE_AuthReply)))
- {
- _IceConnectionError *errorReply =
- &(((_IceReply *) (replyWait->reply))->connection_error);
- char *errorStr = NULL;
- char *tempstr;
- char *prefix, *temp;
-
- invokeHandler = 0;
- errorReturned = True;
-
- switch (message->errorClass)
- {
- case IceNoVersion:
-
- tempstr =
- "None of the ICE versions specified are supported";
- errorStr = (char *) malloc (strlen (tempstr) + 1);
- strcpy (errorStr, tempstr);
- break;
-
- case IceNoAuth:
-
- tempstr =
- "None of the authentication protocols specified are supported";
- errorStr = (char *) malloc (strlen (tempstr) + 1);
- strcpy (errorStr, tempstr);
- break;
-
- case IceSetupFailed:
-
- prefix = "Connection Setup Failed, reason : ";
-
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- case IceAuthRejected:
-
- prefix = "Authentication Rejected, reason : ";
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- case IceAuthFailed:
-
- prefix = "Authentication Failed, reason : ";
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- default:
- invokeHandler = 1;
- }
-
- errorReply->type = ICE_CONNECTION_ERROR;
- errorReply->error_message = errorStr;
- }
- else if (iceConn->protosetup_to_you &&
- ((!iceConn->protosetup_to_you->auth_active &&
- message->offendingMinorOpcode == ICE_ProtocolSetup) ||
- (iceConn->protosetup_to_you->auth_active &&
- message->offendingMinorOpcode == ICE_AuthReply)))
- {
- _IceProtocolError *errorReply =
- &(((_IceReply *) (replyWait->reply))->protocol_error);
- char *errorStr = "";
- char *prefix, *temp;
-
- invokeHandler = 0;
- errorReturned = True;
-
- switch (message->errorClass)
- {
- case IceNoVersion:
-
- temp =
- "None of the protocol versions specified are supported";
- errorStr = (char *) malloc (strlen (temp) + 1);
- strcpy (errorStr, temp);
- break;
-
- case IceNoAuth:
-
- temp =
- "None of the authentication protocols specified are supported";
- errorStr = (char *) malloc (strlen (temp) + 1);
- strcpy (errorStr, temp);
- break;
-
- case IceSetupFailed:
-
- prefix = "Protocol Setup Failed, reason : ";
-
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- case IceAuthRejected:
-
- prefix = "Authentication Rejected, reason : ";
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- case IceAuthFailed:
-
- prefix = "Authentication Failed, reason : ";
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- case IceProtocolDuplicate:
-
- prefix = "Protocol was already registered : ";
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- case IceMajorOpcodeDuplicate:
-
- prefix = "The major opcode was already used : ";
- errorStr = (char *) malloc (strlen (prefix) + 2);
- sprintf (errorStr, "%s%d", prefix, (int) *pData);
- break;
-
- case IceUnknownProtocol:
-
- prefix = "Unknown Protocol : ";
- EXTRACT_STRING (pData, swap, temp);
- errorStr = (char *) malloc (
- strlen (prefix) + strlen (temp) + 1);
- sprintf (errorStr, "%s%s", prefix, temp);
- free (temp);
- break;
-
- default:
- invokeHandler = 1;
- }
-
- errorReply->type = ICE_PROTOCOL_ERROR;
- errorReply->error_message = errorStr;
- }
-
- if (errorReturned == True)
- {
- /*
- * If we tried to authenticate, tell the authentication
- * procedure to clean up.
- */
-
- IcePoAuthProc authProc;
-
- if (iceConn->connect_to_you &&
- iceConn->connect_to_you->auth_active)
- {
- authProc = _IcePoAuthProcs[(int)
- (iceConn->connect_to_you->my_auth_index)];
-
- (*authProc) (iceConn, &iceConn->connect_to_you->my_auth_state,
- True /* clean up */, False /* swap */,
- 0, NULL, NULL, NULL, NULL);
- }
- else if (iceConn->protosetup_to_you &&
- iceConn->protosetup_to_you->auth_active)
- {
- _IcePoProtocol *protocol = _IceProtocols[
- iceConn->protosetup_to_you->my_opcode - 1].orig_client;
-
- authProc = protocol->auth_procs[(int)(iceConn->
- protosetup_to_you->my_auth_index)];
-
- (*authProc) (iceConn,
- &iceConn->protosetup_to_you->my_auth_state,
- True /* clean up */, False /* swap */,
- 0, NULL, NULL, NULL, NULL);
- }
- }
- }
-
- if (invokeHandler)
- {
- (*_IceErrorHandler) (iceConn, swap, message->offendingMinorOpcode,
- message->offendingSequenceNum, message->errorClass,
- message->severity, (IcePointer) pData);
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
-
- return (errorReturned);
-}
-
-
-
-static int
-ProcessConnectionSetup (iceConn, length, swap)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-
-{
- iceConnectionSetupMsg *message;
- int myVersionCount, hisVersionCount;
- int myVersionIndex, hisVersionIndex;
- int hisMajorVersion, hisMinorVersion;
- int myAuthCount, hisAuthCount;
- int found, i, j;
- char *myAuthName, **hisAuthNames;
- char *pData, *pStart;
- char *vendor = NULL;
- char *release = NULL;
- int myAuthIndex = 0;
- int hisAuthIndex = 0;
- int accept_setup_now = 0;
- char mustAuthenticate;
- int authUsableCount;
- int authUsableFlags[MAX_ICE_AUTH_NAMES];
- int authIndices[MAX_ICE_AUTH_NAMES];
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_ConnectionSetup,
- length, SIZEOF (iceConnectionSetupMsg), IceFatalToConnection);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceConnectionSetupMsg),
- iceConnectionSetupMsg, message, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- SKIP_STRING (pData, swap); /* vendor */
- SKIP_STRING (pData, swap); /* release */
- SKIP_LISTOF_STRING (pData, swap, (int) message->authCount);/* auth names */
- pData += (message->versionCount * 4); /* versions */
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_ConnectionSetup,
- length, pData - pStart + SIZEOF (iceConnectionSetupMsg),
- pStart, IceFatalToConnection);
-
- mustAuthenticate = message->mustAuthenticate;
- if (mustAuthenticate != 0 && mustAuthenticate != 1)
- {
- _IceErrorBadValue (iceConn, 0,
- ICE_ConnectionSetup, 8, 1, &mustAuthenticate);
- iceConn->connection_status = IceConnectRejected;
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- EXTRACT_STRING (pData, swap, vendor);
- EXTRACT_STRING (pData, swap, release);
-
- if ((hisAuthCount = message->authCount) > 0)
- {
- hisAuthNames = (char **) malloc (hisAuthCount * sizeof (char *));
- EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
- }
-
- hisVersionCount = message->versionCount;
- myVersionCount = _IceVersionCount;
-
- hisVersionIndex = myVersionIndex = found = 0;
-
- for (i = 0; i < hisVersionCount && !found; i++)
- {
- EXTRACT_CARD16 (pData, swap, hisMajorVersion);
- EXTRACT_CARD16 (pData, swap, hisMinorVersion);
-
- for (j = 0; j < myVersionCount && !found; j++)
- {
- if (_IceVersions[j].major_version == hisMajorVersion &&
- _IceVersions[j].minor_version == hisMinorVersion)
- {
- hisVersionIndex = i;
- myVersionIndex = j;
- found = 1;
- }
- }
- }
-
- if (!found)
- {
- _IceErrorNoVersion (iceConn, ICE_ConnectionSetup);
- iceConn->connection_status = IceConnectRejected;
-
- free (vendor);
- free (release);
-
- if (hisAuthCount > 0)
- {
- for (i = 0; i < hisAuthCount; i++)
- free (hisAuthNames[i]);
-
- free ((char *) hisAuthNames);
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- _IceGetPaValidAuthIndices ("ICE", iceConn->connection_string,
- _IceAuthCount, _IceAuthNames, &authUsableCount, authIndices);
-
- for (i = 0; i < _IceAuthCount; i++)
- {
- authUsableFlags[i] = 0;
- for (j = 0; j < authUsableCount && !authUsableFlags[i]; j++)
- authUsableFlags[i] = (authIndices[j] == i);
- }
-
- myAuthCount = _IceAuthCount;
-
- for (i = found = 0; i < myAuthCount && !found; i++)
- {
- if (authUsableFlags[i])
- {
- myAuthName = _IceAuthNames[i];
-
- for (j = 0; j < hisAuthCount && !found; j++)
- if (strcmp (myAuthName, hisAuthNames[j]) == 0)
- {
- myAuthIndex = i;
- hisAuthIndex = j;
- found = 1;
- }
- }
- }
-
- if (!found)
- {
- /*
- * None of the authentication methods specified by the
- * other client is supported. If the other client requires
- * authentication, we must reject the connection now.
- * Otherwise, we can invoke the host-based authentication callback
- * to see if we can accept this connection.
- */
-
- if (mustAuthenticate || !iceConn->listen_obj->host_based_auth_proc)
- {
- _IceErrorNoAuthentication (iceConn, ICE_ConnectionSetup);
- iceConn->connection_status = IceConnectRejected;
- }
- else
- {
- char *hostname = _IceGetPeerName (iceConn);
-
- if ((*iceConn->listen_obj->host_based_auth_proc) (hostname))
- {
- accept_setup_now = 1;
- }
- else
- {
- _IceErrorAuthenticationRejected (iceConn,
- ICE_ConnectionSetup, "None of the authentication protocols specified are supported and host-based authentication failed");
-
- iceConn->connection_status = IceConnectRejected;
- }
-
- if (hostname)
- free (hostname);
- }
-
- if (iceConn->connection_status == IceConnectRejected)
- {
- free (vendor);
- free (release);
- }
- }
- else
- {
- IcePaAuthStatus status;
- int authDataLen;
- IcePointer authData = NULL;
- IcePointer authState;
- char *errorString = NULL;
- IcePaAuthProc authProc = _IcePaAuthProcs[myAuthIndex];
-
- authState = NULL;
-
- status = (*authProc) (iceConn, &authState,
- swap, 0, NULL, &authDataLen, &authData, &errorString);
-
- if (status == IcePaAuthContinue)
- {
- _IceConnectToMeInfo *setupInfo;
-
- AuthRequired (iceConn, hisAuthIndex, authDataLen, authData);
-
- iceConn->connect_to_me = setupInfo = (_IceConnectToMeInfo *)
- malloc (sizeof (_IceConnectToMeInfo));
-
- setupInfo->my_version_index = myVersionIndex;
- setupInfo->his_version_index = hisVersionIndex;
- setupInfo->his_vendor = vendor;
- setupInfo->his_release = release;
- setupInfo->my_auth_index = myAuthIndex;
- setupInfo->my_auth_state = authState;
- setupInfo->must_authenticate = mustAuthenticate;
- }
- else if (status == IcePaAuthAccepted)
- {
- accept_setup_now = 1;
- }
-
- if (authData && authDataLen > 0)
- free ((char *) authData);
-
- if (errorString)
- free (errorString);
- }
-
- if (accept_setup_now)
- {
- AcceptConnection (iceConn, hisVersionIndex);
-
- iceConn->vendor = vendor;
- iceConn->release = release;
- iceConn->my_ice_version_index = myVersionIndex;
- }
-
- if (hisAuthCount > 0)
- {
- for (i = 0; i < hisAuthCount; i++)
- free (hisAuthNames[i]);
-
- free ((char *) hisAuthNames);
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
-}
-
-
-
-static Bool
-ProcessAuthRequired (iceConn, length, swap, replyWait)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-
-{
- iceAuthRequiredMsg *message;
- int authDataLen;
- IcePointer authData;
- int replyDataLen;
- IcePointer replyData = NULL;
- char *errorString = NULL;
- IcePoAuthProc authProc;
- IcePoAuthStatus status;
- IcePointer authState;
- int realAuthIndex;
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_AuthRequired,
- length, SIZEOF (iceAuthRequiredMsg),
- iceConn->connect_to_you ? IceFatalToConnection : IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceAuthRequiredMsg),
- iceAuthRequiredMsg, message, authData);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, authData);
- return (0);
- }
-
- if (swap)
- {
- message->authDataLength = lswaps (message->authDataLength);
- }
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_AuthRequired, length,
- message->authDataLength + SIZEOF (iceAuthRequiredMsg), authData,
- iceConn->connect_to_you ? IceFatalToConnection : IceFatalToProtocol);
-
- if (iceConn->connect_to_you)
- {
- if ((int) message->authIndex >= _IceAuthCount)
- {
- _IceConnectionError *errorReply =
- &(((_IceReply *) (replyWait->reply))->connection_error);
-
- char *tempstr = "Received bad authIndex in the AuthRequired message";
- char errIndex = (int) message->authIndex;
-
- errorString = (char *) malloc (strlen (tempstr) + 1);
- strcpy (errorString, tempstr);
-
- errorReply->type = ICE_CONNECTION_ERROR;
- errorReply->error_message = errorString;
-
- _IceErrorBadValue (iceConn, 0,
- ICE_AuthRequired, 2, 1, &errIndex);
-
- IceDisposeCompleteMessage (iceConn, authData);
- return (1);
- }
- else
- {
- authProc = _IcePoAuthProcs[message->authIndex];
-
- iceConn->connect_to_you->auth_active = 1;
- }
- }
- else if (iceConn->protosetup_to_you)
- {
- if ((int) message->authIndex >=
- iceConn->protosetup_to_you->my_auth_count)
- {
- _IceProtocolError *errorReply =
- &(((_IceReply *) (replyWait->reply))->protocol_error);
-
- char *tempstr = "Received bad authIndex in the AuthRequired message";
- char errIndex = (int) message->authIndex;
-
- errorString = (char *) malloc (strlen (tempstr) + 1);
- strcpy (errorString, tempstr);
-
- errorReply->type = ICE_PROTOCOL_ERROR;
- errorReply->error_message = errorString;
-
- _IceErrorBadValue (iceConn, 0,
- ICE_AuthRequired, 2, 1, &errIndex);
-
- IceDisposeCompleteMessage (iceConn, authData);
- return (1);
- }
- else
- {
- _IcePoProtocol *myProtocol = _IceProtocols[
- iceConn->protosetup_to_you->my_opcode - 1].orig_client;
-
- realAuthIndex = iceConn->protosetup_to_you->
- my_auth_indices[message->authIndex];
-
- authProc = myProtocol->auth_procs[realAuthIndex];
-
- iceConn->protosetup_to_you->auth_active = 1;
- }
- }
- else
- {
- /*
- * Unexpected message
- */
-
- _IceErrorBadState (iceConn, 0, ICE_AuthRequired, IceCanContinue);
-
- IceDisposeCompleteMessage (iceConn, authData);
- return (0);
- }
-
- authState = NULL;
- authDataLen = message->authDataLength;
-
- status = (*authProc) (iceConn, &authState, False /* don't clean up */,
- swap, authDataLen, authData, &replyDataLen, &replyData, &errorString);
-
- if (status == IcePoAuthHaveReply)
- {
- AuthReply (iceConn, replyDataLen, replyData);
-
- replyWait->sequence_of_request = iceConn->send_sequence;
- replyWait->minor_opcode_of_request = ICE_AuthReply;
-
- if (iceConn->connect_to_you)
- {
- iceConn->connect_to_you->my_auth_state = authState;
- iceConn->connect_to_you->my_auth_index = message->authIndex;
- }
- else if (iceConn->protosetup_to_you)
- {
- iceConn->protosetup_to_you->my_auth_state = authState;
- iceConn->protosetup_to_you->my_auth_index = realAuthIndex;
- }
- }
- else if (status == IcePoAuthRejected || status == IcePoAuthFailed)
- {
- char *prefix, *returnErrorString;
-
- if (status == IcePoAuthRejected)
- {
- _IceErrorAuthenticationRejected (iceConn,
- ICE_AuthRequired, errorString);
-
- prefix = "Authentication Rejected, reason : ";
- }
- else
- {
- _IceErrorAuthenticationFailed (iceConn,
- ICE_AuthRequired, errorString);
-
- prefix = "Authentication Failed, reason : ";
- }
-
- returnErrorString = (char *) malloc (strlen (prefix) +
- strlen (errorString) + 1);
- sprintf (returnErrorString, "%s%s", prefix, errorString);
- free (errorString);
-
- if (iceConn->connect_to_you)
- {
- _IceConnectionError *errorReply =
- &(((_IceReply *) (replyWait->reply))->connection_error);
-
- errorReply->type = ICE_CONNECTION_ERROR;
- errorReply->error_message = returnErrorString;
- }
- else
- {
- _IceProtocolError *errorReply =
- &(((_IceReply *) (replyWait->reply))->protocol_error);
-
- errorReply->type = ICE_PROTOCOL_ERROR;
- errorReply->error_message = returnErrorString;
- }
- }
-
- if (replyData && replyDataLen > 0)
- free ((char *) replyData);
-
- IceDisposeCompleteMessage (iceConn, authData);
-
- return (status != IcePoAuthHaveReply);
-}
-
-
-
-static int
-ProcessAuthReply (iceConn, length, swap)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-
-{
- iceAuthReplyMsg *message;
- int replyDataLen;
- IcePointer replyData;
- int authDataLen;
- IcePointer authData = NULL;
- char *errorString = NULL;
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_AuthReply,
- length, SIZEOF (iceAuthReplyMsg),
- iceConn->connect_to_me ? IceFatalToConnection : IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceAuthReplyMsg),
- iceAuthReplyMsg, message, replyData);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, replyData);
- return (0);
- }
-
- if (swap)
- {
- message->authDataLength = lswaps (message->authDataLength);
- }
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_AuthReply, length,
- message->authDataLength + SIZEOF (iceAuthReplyMsg), replyData,
- iceConn->connect_to_me ? IceFatalToConnection : IceFatalToProtocol);
-
- replyDataLen = message->authDataLength;
-
- if (iceConn->connect_to_me)
- {
- IcePaAuthProc authProc = _IcePaAuthProcs[(int)
- (iceConn->connect_to_me->my_auth_index)];
- IcePaAuthStatus status =
- (*authProc) (iceConn, &iceConn->connect_to_me->my_auth_state, swap,
- replyDataLen, replyData, &authDataLen, &authData, &errorString);
-
- if (status == IcePaAuthContinue)
- {
- AuthNextPhase (iceConn, authDataLen, authData);
- }
- else if (status == IcePaAuthRejected || status == IcePaAuthFailed)
- {
- /*
- * Before we reject, invoke host-based authentication callback
- * and give it a chance to accept the connection (only if the
- * other client doesn't require authentication).
- */
-
- if (!iceConn->connect_to_me->must_authenticate &&
- iceConn->listen_obj->host_based_auth_proc)
- {
- char *hostname = _IceGetPeerName (iceConn);
-
- if ((*iceConn->listen_obj->host_based_auth_proc) (hostname))
- {
- status = IcePaAuthAccepted;
- }
-
- if (hostname)
- free (hostname);
- }
-
- if (status != IcePaAuthAccepted)
- {
- free (iceConn->connect_to_me->his_vendor);
- free (iceConn->connect_to_me->his_release);
- free ((char *) iceConn->connect_to_me);
- iceConn->connect_to_me = NULL;
-
- iceConn->connection_status = IceConnectRejected;
-
- if (status == IcePaAuthRejected)
- {
- _IceErrorAuthenticationRejected (iceConn,
- ICE_AuthReply, errorString);
- }
- else
- {
- _IceErrorAuthenticationFailed (iceConn,
- ICE_AuthReply, errorString);
- }
- }
- }
-
- if (status == IcePaAuthAccepted)
- {
- AcceptConnection (iceConn,
- iceConn->connect_to_me->his_version_index);
-
- iceConn->vendor = iceConn->connect_to_me->his_vendor;
- iceConn->release = iceConn->connect_to_me->his_release;
- iceConn->my_ice_version_index =
- iceConn->connect_to_me->my_version_index;
-
- free ((char *) iceConn->connect_to_me);
- iceConn->connect_to_me = NULL;
- }
- }
- else if (iceConn->protosetup_to_me)
- {
- _IcePaProtocol *myProtocol = _IceProtocols[iceConn->protosetup_to_me->
- my_opcode - 1].accept_client;
- IcePaAuthProc authProc = myProtocol->auth_procs[(int)
- (iceConn->protosetup_to_me->my_auth_index)];
- IcePaAuthStatus status =
- (*authProc) (iceConn, &iceConn->protosetup_to_me->my_auth_state,
- swap, replyDataLen, replyData,
- &authDataLen, &authData, &errorString);
- int free_setup_info = 1;
-
- if (status == IcePaAuthContinue)
- {
- AuthNextPhase (iceConn, authDataLen, authData);
- free_setup_info = 0;
- }
- else if (status == IcePaAuthRejected || status == IcePaAuthFailed)
- {
- /*
- * Before we reject, invoke host-based authentication callback
- * and give it a chance to accept the Protocol Setup (only if the
- * other client doesn't require authentication).
- */
-
- if (!iceConn->protosetup_to_me->must_authenticate &&
- myProtocol->host_based_auth_proc)
- {
- char *hostname = _IceGetPeerName (iceConn);
-
- if ((*myProtocol->host_based_auth_proc) (hostname))
- {
- status = IcePaAuthAccepted;
- }
-
- if (hostname)
- free (hostname);
- }
-
- if (status == IcePaAuthRejected)
- {
- _IceErrorAuthenticationRejected (iceConn,
- ICE_AuthReply, errorString);
- }
- else
- {
- _IceErrorAuthenticationFailed (iceConn,
- ICE_AuthReply, errorString);
- }
- }
-
- if (status == IcePaAuthAccepted)
- {
- IcePaProcessMsgProc processMsgProc;
- IceProtocolSetupProc protocolSetupProc;
- IceProtocolActivateProc protocolActivateProc;
- _IceProcessMsgInfo *process_msg_info;
- IcePointer clientData = NULL;
- char *failureReason = NULL;
- Status status = 1;
-
- protocolSetupProc = myProtocol->protocol_setup_proc;
- protocolActivateProc = myProtocol->protocol_activate_proc;
-
- if (protocolSetupProc)
- {
- /*
- * Notify the client of the Protocol Setup.
- */
-
- status = (*protocolSetupProc) (iceConn,
- myProtocol->version_recs[iceConn->protosetup_to_me->
- my_version_index].major_version,
- myProtocol->version_recs[iceConn->protosetup_to_me->
- my_version_index].minor_version,
- iceConn->protosetup_to_me->his_vendor,
- iceConn->protosetup_to_me->his_release,
- &clientData, &failureReason);
-
- /*
- * Set vendor and release pointers to NULL, so it won't
- * get freed below. The ProtocolSetupProc should
- * free it.
- */
-
- iceConn->protosetup_to_me->his_vendor = NULL;
- iceConn->protosetup_to_me->his_release = NULL;
- }
-
- if (status != 0)
- {
- /*
- * Send the Protocol Reply
- */
-
- AcceptProtocol (iceConn,
- iceConn->protosetup_to_me->his_opcode,
- iceConn->protosetup_to_me->my_opcode,
- iceConn->protosetup_to_me->his_version_index,
- myProtocol->vendor, myProtocol->release);
-
-
- /*
- * Set info for this protocol.
- */
-
- processMsgProc = myProtocol->version_recs[
- iceConn->protosetup_to_me->
- my_version_index].process_msg_proc;
-
- process_msg_info = &iceConn->process_msg_info[
- iceConn->protosetup_to_me->
- his_opcode -iceConn->his_min_opcode];
-
- process_msg_info->client_data = clientData;
- process_msg_info->accept_flag = 1;
- process_msg_info->process_msg_proc.
- accept_client = processMsgProc;
-
-
- /*
- * Increase the reference count for the number
- * of active protocols.
- */
-
- iceConn->proto_ref_count++;
-
-
- /*
- * Notify the client that the protocol is active. The reason
- * we have this 2nd callback invoked is because the client
- * may wish to immediately generate a message for this
- * protocol, but it must wait until we send the Protocol Reply.
- */
-
- if (protocolActivateProc)
- {
- (*protocolActivateProc) (iceConn,
- process_msg_info->client_data);
- }
- }
- else
- {
- /*
- * An error was encountered.
- */
-
- _IceErrorSetupFailed (iceConn, ICE_ProtocolSetup,
- failureReason);
-
- if (failureReason)
- free (failureReason);
- }
- }
-
-
- if (free_setup_info)
- {
- if (iceConn->protosetup_to_me->his_vendor)
- free (iceConn->protosetup_to_me->his_vendor);
- if (iceConn->protosetup_to_me->his_release)
- free (iceConn->protosetup_to_me->his_release);
- free ((char *) iceConn->protosetup_to_me);
- iceConn->protosetup_to_me = NULL;
- }
- }
- else
- {
- /*
- * Unexpected message
- */
-
- _IceErrorBadState (iceConn, 0, ICE_AuthReply, IceCanContinue);
- }
-
- if (authData && authDataLen > 0)
- free ((char *) authData);
-
- if (errorString)
- free (errorString);
-
- IceDisposeCompleteMessage (iceConn, replyData);
- return (0);
-}
-
-
-
-static Bool
-ProcessAuthNextPhase (iceConn, length, swap, replyWait)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-
-{
- iceAuthNextPhaseMsg *message;
- int authDataLen;
- IcePointer authData;
- int replyDataLen;
- IcePointer replyData = NULL;
- char *errorString = NULL;
- IcePoAuthProc authProc;
- IcePoAuthStatus status;
- IcePointer *authState;
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_AuthNextPhase,
- length, SIZEOF (iceAuthNextPhaseMsg),
- iceConn->connect_to_you ? IceFatalToConnection : IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceAuthNextPhaseMsg),
- iceAuthNextPhaseMsg, message, authData);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, authData);
- return (0);
- }
-
- if (swap)
- {
- message->authDataLength = lswaps (message->authDataLength);
- }
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_AuthNextPhase, length,
- message->authDataLength + SIZEOF (iceAuthNextPhaseMsg), authData,
- iceConn->connect_to_you ? IceFatalToConnection : IceFatalToProtocol);
-
- if (iceConn->connect_to_you)
- {
- authProc = _IcePoAuthProcs[(int)
- (iceConn->connect_to_you->my_auth_index)];
-
- authState = &iceConn->connect_to_you->my_auth_state;
- }
- else if (iceConn->protosetup_to_you)
- {
- _IcePoProtocol *myProtocol =
- _IceProtocols[iceConn->protosetup_to_you->my_opcode - 1].orig_client;
-
- authProc = myProtocol->auth_procs[(int)
- (iceConn->protosetup_to_you->my_auth_index)];
-
- authState = &iceConn->protosetup_to_you->my_auth_state;
- }
- else
- {
- /*
- * Unexpected message
- */
-
- _IceErrorBadState (iceConn, 0, ICE_AuthNextPhase, IceCanContinue);
-
- IceDisposeCompleteMessage (iceConn, authData);
- return (0);
- }
-
- authDataLen = message->authDataLength;
-
- status = (*authProc) (iceConn, authState, False /* don't clean up */,
- swap, authDataLen, authData, &replyDataLen, &replyData, &errorString);
-
- if (status == IcePoAuthHaveReply)
- {
- AuthReply (iceConn, replyDataLen, replyData);
-
- replyWait->sequence_of_request = iceConn->send_sequence;
- }
- else if (status == IcePoAuthRejected || status == IcePoAuthFailed)
- {
- char *prefix, *returnErrorString;
-
- if (status == IcePoAuthRejected)
- {
- _IceErrorAuthenticationRejected (iceConn,
- ICE_AuthNextPhase, errorString);
-
- prefix = "Authentication Rejected, reason : ";
- }
- else if (status == IcePoAuthFailed)
- {
- _IceErrorAuthenticationFailed (iceConn,
- ICE_AuthNextPhase, errorString);
-
- prefix = "Authentication Failed, reason : ";
- }
-
- returnErrorString = (char *) malloc (strlen (prefix) +
- strlen (errorString) + 1);
- sprintf (returnErrorString, "%s%s", prefix, errorString);
- free (errorString);
-
- if (iceConn->connect_to_you)
- {
- _IceConnectionError *errorReply =
- &(((_IceReply *) (replyWait->reply))->connection_error);
-
- errorReply->type = ICE_CONNECTION_ERROR;
- errorReply->error_message = returnErrorString;
- }
- else
- {
- _IceProtocolError *errorReply =
- &(((_IceReply *) (replyWait->reply))->protocol_error);
-
- errorReply->type = ICE_PROTOCOL_ERROR;
- errorReply->error_message = returnErrorString;
- }
- }
-
- if (replyData && replyDataLen > 0)
- free ((char *) replyData);
-
- IceDisposeCompleteMessage (iceConn, authData);
-
- return (status != IcePoAuthHaveReply);
-}
-
-
-
-static Bool
-ProcessConnectionReply (iceConn, length, swap, replyWait)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-
-{
- iceConnectionReplyMsg *message;
- char *pData, *pStart;
- Bool replyReady;
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_ConnectionReply,
- length, SIZEOF (iceConnectionReplyMsg), IceFatalToConnection);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceConnectionReplyMsg),
- iceConnectionReplyMsg, message, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- SKIP_STRING (pData, swap); /* vendor */
- SKIP_STRING (pData, swap); /* release */
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_ConnectionReply,
- length, pData - pStart + SIZEOF (iceConnectionReplyMsg),
- pStart, IceFatalToConnection);
-
- pData = pStart;
-
- if (iceConn->connect_to_you)
- {
- if (iceConn->connect_to_you->auth_active)
- {
- /*
- * Tell the authentication procedure to clean up.
- */
-
- IcePoAuthProc authProc = _IcePoAuthProcs[(int)
- (iceConn->connect_to_you->my_auth_index)];
-
- (*authProc) (iceConn, &iceConn->connect_to_you->my_auth_state,
- True /* clean up */, False /* swap */,
- 0, NULL, NULL, NULL, NULL);
- }
-
- if ((int) message->versionIndex >= _IceVersionCount)
- {
- _IceConnectionError *errorReply =
- &(((_IceReply *) (replyWait->reply))->connection_error);
- char errIndex = message->versionIndex;
-
- _IceErrorBadValue (iceConn, 0,
- ICE_ConnectionReply, 2, 1, &errIndex);
-
- errorReply->type = ICE_CONNECTION_ERROR;
- errorReply->error_message =
- "Received bad version index in Connection Reply";
- }
- else
- {
- _IceReply *reply = (_IceReply *) (replyWait->reply);
-
- reply->type = ICE_CONNECTION_REPLY;
- reply->connection_reply.version_index = message->versionIndex;
-
- EXTRACT_STRING (pData, swap, reply->connection_reply.vendor);
- EXTRACT_STRING (pData, swap, reply->connection_reply.release);
- }
-
- replyReady = True;
- }
- else
- {
- /*
- * Unexpected message
- */
-
- _IceErrorBadState (iceConn, 0, ICE_ConnectionReply, IceCanContinue);
-
- replyReady = False;
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
-
- return (replyReady);
-}
-
-
-
-static int
-ProcessProtocolSetup (iceConn, length, swap)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-
-{
- iceProtocolSetupMsg *message;
- _IcePaProtocol *myProtocol;
- int myVersionCount, hisVersionCount;
- int myVersionIndex, hisVersionIndex;
- int hisMajorVersion, hisMinorVersion;
- int myAuthCount, hisAuthCount;
- int myOpcode, hisOpcode;
- int found, i, j;
- char *myAuthName, **hisAuthNames;
- char *protocolName;
- char *pData, *pStart;
- char *vendor = NULL;
- char *release = NULL;
- int accept_setup_now = 0;
- int myAuthIndex = 0;
- int hisAuthIndex = 0;
- char mustAuthenticate;
- int authUsableCount;
- int authUsableFlags[MAX_ICE_AUTH_NAMES];
- int authIndices[MAX_ICE_AUTH_NAMES];
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_ProtocolSetup,
- length, SIZEOF (iceProtocolSetupMsg), IceFatalToProtocol);
-
- if (iceConn->want_to_close)
- {
- /*
- * If we sent a WantToClose message, but just got a ProtocolSetup,
- * we must cancel our WantToClose. It is the responsiblity of the
- * other client to send a WantToClose later on.
- */
-
- iceConn->want_to_close = 0;
- }
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceProtocolSetupMsg),
- iceProtocolSetupMsg, message, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- SKIP_STRING (pData, swap); /* proto name */
- SKIP_STRING (pData, swap); /* vendor */
- SKIP_STRING (pData, swap); /* release */
- SKIP_LISTOF_STRING (pData, swap, (int) message->authCount);/* auth names */
- pData += (message->versionCount * 4); /* versions */
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_ProtocolSetup,
- length, pData - pStart + SIZEOF (iceProtocolSetupMsg),
- pStart, IceFatalToProtocol);
-
- mustAuthenticate = message->mustAuthenticate;
-
- if (mustAuthenticate != 0 && mustAuthenticate != 1)
- {
- _IceErrorBadValue (iceConn, 0,
- ICE_ProtocolSetup, 4, 1, &mustAuthenticate);
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- if (iceConn->process_msg_info &&
- (int) message->protocolOpcode >= iceConn->his_min_opcode &&
- (int) message->protocolOpcode <= iceConn->his_max_opcode &&
- iceConn->process_msg_info[
- message->protocolOpcode - iceConn->his_min_opcode].in_use)
- {
- _IceErrorMajorOpcodeDuplicate (iceConn, message->protocolOpcode);
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- EXTRACT_STRING (pData, swap, protocolName);
-
- if (iceConn->process_msg_info)
- {
- for (i = 0;
- i <= (iceConn->his_max_opcode - iceConn->his_min_opcode); i++)
- {
- if (iceConn->process_msg_info[i].in_use && strcmp (protocolName,
- iceConn->process_msg_info[i].protocol->protocol_name) == 0)
- {
- _IceErrorProtocolDuplicate (iceConn, protocolName);
- free (protocolName);
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
- }
- }
-
- for (i = 0; i < _IceLastMajorOpcode; i++)
- if (strcmp (protocolName, _IceProtocols[i].protocol_name) == 0)
- break;
-
- if (i < _IceLastMajorOpcode &&
- (myProtocol = _IceProtocols[i].accept_client) != NULL)
- {
- hisOpcode = message->protocolOpcode;
- myOpcode = i + 1;
- free (protocolName);
- }
- else
- {
- _IceErrorUnknownProtocol (iceConn, protocolName);
- free (protocolName);
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- EXTRACT_STRING (pData, swap, vendor);
- EXTRACT_STRING (pData, swap, release);
-
- if ((hisAuthCount = message->authCount) > 0)
- {
- hisAuthNames = (char **) malloc (hisAuthCount * sizeof (char *));
- EXTRACT_LISTOF_STRING (pData, swap, hisAuthCount, hisAuthNames);
- }
-
- hisVersionCount = message->versionCount;
- myVersionCount = myProtocol->version_count;
-
- hisVersionIndex = myVersionIndex = found = 0;
-
- for (i = 0; i < hisVersionCount && !found; i++)
- {
- EXTRACT_CARD16 (pData, swap, hisMajorVersion);
- EXTRACT_CARD16 (pData, swap, hisMinorVersion);
-
- for (j = 0; j < myVersionCount && !found; j++)
- {
- if (myProtocol->version_recs[j].major_version == hisMajorVersion &&
- myProtocol->version_recs[j].minor_version == hisMinorVersion)
- {
- hisVersionIndex = i;
- myVersionIndex = j;
- found = 1;
- }
- }
- }
-
- if (!found)
- {
- _IceErrorNoVersion (iceConn, ICE_ProtocolSetup);
-
- free (vendor);
- free (release);
-
- if (hisAuthCount > 0)
- {
- for (i = 0; i < hisAuthCount; i++)
- free (hisAuthNames[i]);
-
- free ((char *) hisAuthNames);
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- myAuthCount = myProtocol->auth_count;
-
- _IceGetPaValidAuthIndices (
- _IceProtocols[myOpcode - 1].protocol_name,
- iceConn->connection_string, myAuthCount, myProtocol->auth_names,
- &authUsableCount, authIndices);
-
- for (i = 0; i < myAuthCount; i++)
- {
- authUsableFlags[i] = 0;
- for (j = 0; j < authUsableCount && !authUsableFlags[i]; j++)
- authUsableFlags[i] = (authIndices[j] == i);
- }
-
- for (i = found = 0; i < myAuthCount && !found; i++)
- {
- if (authUsableFlags[i])
- {
- myAuthName = myProtocol->auth_names[i];
-
- for (j = 0; j < hisAuthCount && !found; j++)
- if (strcmp (myAuthName, hisAuthNames[j]) == 0)
- {
- myAuthIndex = i;
- hisAuthIndex = j;
- found = 1;
- }
- }
- }
-
- if (!found)
- {
- /*
- * None of the authentication methods specified by the
- * other client is supported. If the other client requires
- * authentication, we must reject the Protocol Setup now.
- * Otherwise, we can invoke the host-based authentication callback
- * to see if we can accept this Protocol Setup.
- */
-
- if (mustAuthenticate || !myProtocol->host_based_auth_proc)
- {
- _IceErrorNoAuthentication (iceConn, ICE_ProtocolSetup);
- }
- else
- {
- char *hostname = _IceGetPeerName (iceConn);
-
- if ((*myProtocol->host_based_auth_proc) (hostname))
- {
- accept_setup_now = 1;
- }
- else
- {
- _IceErrorAuthenticationRejected (iceConn,
- ICE_ProtocolSetup, "None of the authentication protocols specified are supported and host-based authentication failed");
- }
-
- if (hostname)
- free (hostname);
- }
- }
- else
- {
- IcePaAuthStatus status;
- int authDataLen;
- IcePointer authData = NULL;
- IcePointer authState;
- char *errorString = NULL;
- IcePaAuthProc authProc =
- myProtocol->auth_procs[myAuthIndex];
-
- authState = NULL;
-
- status = (*authProc) (iceConn, &authState, swap, 0, NULL,
- &authDataLen, &authData, &errorString);
-
- if (status == IcePaAuthContinue)
- {
- _IceProtoSetupToMeInfo *setupInfo;
-
- AuthRequired (iceConn, hisAuthIndex, authDataLen, authData);
-
- iceConn->protosetup_to_me = setupInfo =
- (_IceProtoSetupToMeInfo *) malloc (
- sizeof (_IceProtoSetupToMeInfo));
-
- setupInfo->his_opcode = hisOpcode;
- setupInfo->my_opcode = myOpcode;
- setupInfo->my_version_index = myVersionIndex;
- setupInfo->his_version_index = hisVersionIndex;
- setupInfo->his_vendor = vendor;
- setupInfo->his_release = release;
- vendor = release = NULL; /* so we don't free it */
- setupInfo->my_auth_index = myAuthIndex;
- setupInfo->my_auth_state = authState;
- setupInfo->must_authenticate = mustAuthenticate;
- }
- else if (status == IcePaAuthAccepted)
- {
- accept_setup_now = 1;
- }
-
- if (authData && authDataLen > 0)
- free ((char *) authData);
-
- if (errorString)
- free (errorString);
- }
-
- if (accept_setup_now)
- {
- IcePaProcessMsgProc processMsgProc;
- IceProtocolSetupProc protocolSetupProc;
- IceProtocolActivateProc protocolActivateProc;
- _IceProcessMsgInfo *process_msg_info;
- IcePointer clientData = NULL;
- char *failureReason = NULL;
- Status status = 1;
-
- protocolSetupProc = myProtocol->protocol_setup_proc;
- protocolActivateProc = myProtocol->protocol_activate_proc;
-
- if (protocolSetupProc)
- {
- /*
- * Notify the client of the Protocol Setup.
- */
-
- status = (*protocolSetupProc) (iceConn,
- myProtocol->version_recs[myVersionIndex].major_version,
- myProtocol->version_recs[myVersionIndex].minor_version,
- vendor, release, &clientData, &failureReason);
-
- vendor = release = NULL; /* so we don't free it */
- }
-
- if (status != 0)
- {
- /*
- * Send the Protocol Reply
- */
-
- AcceptProtocol (iceConn, hisOpcode, myOpcode, hisVersionIndex,
- myProtocol->vendor, myProtocol->release);
-
-
- /*
- * Set info for this protocol.
- */
-
- processMsgProc = myProtocol->version_recs[
- myVersionIndex].process_msg_proc;
-
- process_msg_info = &iceConn->process_msg_info[hisOpcode -
- iceConn->his_min_opcode];
-
- process_msg_info->client_data = clientData;
- process_msg_info->accept_flag = 1;
- process_msg_info->process_msg_proc.accept_client = processMsgProc;
-
-
- /*
- * Increase the reference count for the number of active protocols.
- */
-
- iceConn->proto_ref_count++;
-
-
- /*
- * Notify the client that the protocol is active. The reason
- * we have this 2nd callback invoked is because the client
- * may wish to immediately generate a message for this
- * protocol, but it must wait until we send the Protocol Reply.
- */
-
- if (protocolActivateProc)
- {
- (*protocolActivateProc) (iceConn,
- process_msg_info->client_data);
- }
- }
- else
- {
- /*
- * An error was encountered.
- */
-
- _IceErrorSetupFailed (iceConn, ICE_ProtocolSetup, failureReason);
-
- if (failureReason)
- free (failureReason);
- }
- }
-
- if (vendor)
- free (vendor);
-
- if (release)
- free (release);
-
- if (hisAuthCount > 0)
- {
- for (i = 0; i < hisAuthCount; i++)
- free (hisAuthNames[i]);
-
- free ((char *) hisAuthNames);
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
-}
-
-
-
-static Bool
-ProcessProtocolReply (iceConn, length, swap, replyWait)
-
-IceConn iceConn;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-
-{
- iceProtocolReplyMsg *message;
- char *pData, *pStart;
- Bool replyReady;
-
- CHECK_AT_LEAST_SIZE (iceConn, ICE_ProtocolReply,
- length, SIZEOF (iceProtocolReplyMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceProtocolReplyMsg),
- iceProtocolReplyMsg, message, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return (0);
- }
-
- pData = pStart;
-
- SKIP_STRING (pData, swap); /* vendor */
- SKIP_STRING (pData, swap); /* release */
-
- CHECK_COMPLETE_SIZE (iceConn, ICE_ProtocolReply,
- length, pData - pStart + SIZEOF (iceProtocolReplyMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart;
-
- if (iceConn->protosetup_to_you)
- {
- if (iceConn->protosetup_to_you->auth_active)
- {
- /*
- * Tell the authentication procedure to clean up.
- */
-
- _IcePoProtocol *myProtocol = _IceProtocols[
- iceConn->protosetup_to_you->my_opcode - 1].orig_client;
-
- IcePoAuthProc authProc = myProtocol->auth_procs[(int)
- (iceConn->protosetup_to_you->my_auth_index)];
-
-#ifdef SVR4
-
-/*
- * authProc is never NULL, but the cc compiler on UNIX System V/386
- * Release 4.2 Version 1 screws up an optimization. Unless there is
- * some sort of reference to authProc before the function call, the
- * function call will seg fault.
- */
- if (authProc)
-#endif
- (*authProc) (iceConn,
- &iceConn->protosetup_to_you->my_auth_state,
- True /* clean up */, False /* swap */,
- 0, NULL, NULL, NULL, NULL);
- }
-
- if ((int) message->versionIndex >= _IceVersionCount)
- {
- _IceProtocolError *errorReply =
- &(((_IceReply *) (replyWait->reply))->protocol_error);
- char errIndex = message->versionIndex;
-
- _IceErrorBadValue (iceConn, 0,
- ICE_ProtocolReply, 2, 1, &errIndex);
-
- errorReply->type = ICE_PROTOCOL_ERROR;
- errorReply->error_message =
- "Received bad version index in Protocol Reply";
- }
- else
- {
- _IceProtocolReply *reply =
- &(((_IceReply *) (replyWait->reply))->protocol_reply);
-
- reply->type = ICE_PROTOCOL_REPLY;
- reply->major_opcode = message->protocolOpcode;
- reply->version_index = message->versionIndex;
-
- EXTRACT_STRING (pData, swap, reply->vendor);
- EXTRACT_STRING (pData, swap, reply->release);
- }
-
- replyReady = True;
- }
- else
- {
- _IceErrorBadState (iceConn, 0, ICE_ProtocolReply, IceCanContinue);
-
- replyReady = False;
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
-
- return (replyReady);
-}
-
-
-
-static int
-ProcessPing (iceConn, length)
-
-IceConn iceConn;
-unsigned long length;
-
-{
- CHECK_SIZE_MATCH (iceConn, ICE_Ping,
- length, SIZEOF (icePingMsg), IceFatalToConnection);
-
- PingReply (iceConn);
-
- return (0);
-}
-
-
-
-static int
-ProcessPingReply (iceConn, length)
-
-IceConn iceConn;
-unsigned long length;
-
-{
- CHECK_SIZE_MATCH (iceConn, ICE_PingReply,
- length, SIZEOF (icePingReplyMsg), IceFatalToConnection);
-
- if (iceConn->ping_waits)
- {
- _IcePingWait *next = iceConn->ping_waits->next;
-
- (*iceConn->ping_waits->ping_reply_proc) (iceConn,
- iceConn->ping_waits->client_data);
-
- free ((char *) iceConn->ping_waits);
- iceConn->ping_waits = next;
- }
- else
- {
- _IceErrorBadState (iceConn, 0, ICE_PingReply, IceCanContinue);
- }
-
- return (0);
-}
-
-
-
-static int
-ProcessWantToClose (iceConn, length, connectionClosedRet)
-
-IceConn iceConn;
-unsigned long length;
-Bool *connectionClosedRet;
-
-{
- *connectionClosedRet = False;
-
- CHECK_SIZE_MATCH (iceConn, ICE_WantToClose,
- length, SIZEOF (iceWantToCloseMsg), IceFatalToConnection);
-
- if (iceConn->want_to_close || iceConn->open_ref_count == 0)
- {
- /*
- * We just received a WantToClose. Either we also sent a
- * WantToClose, so we close the connection, or the iceConn
- * is not being used, so we close the connection. This
- * second case is possible if we sent a WantToClose because
- * the iceConn->open_ref_count reached zero, but then we
- * received a NoClose.
- */
-
- _IceConnectionClosed (iceConn); /* invoke watch procs */
- _IceFreeConnection (iceConn);
- *connectionClosedRet = True;
- }
- else if (iceConn->proto_ref_count > 0)
- {
- /*
- * We haven't shut down all of our protocols yet. We send a NoClose,
- * and it's up to us to generate a WantToClose later on.
- */
-
- IceSimpleMessage (iceConn, 0, ICE_NoClose);
- IceFlush (iceConn);
- }
- else
- {
- /*
- * The reference count on this iceConn is zero. This means that
- * there are no active protocols, but the client didn't explicitly
- * close the connection yet. If we didn't just send a Protocol Setup,
- * we send a NoClose, and it's up to us to generate a WantToClose
- * later on.
- */
-
- if (!iceConn->protosetup_to_you)
- {
- IceSimpleMessage (iceConn, 0, ICE_NoClose);
- IceFlush (iceConn);
- }
- }
-
- return (0);
-}
-
-
-
-static int
-ProcessNoClose (iceConn, length)
-
-IceConn iceConn;
-unsigned long length;
-
-{
- CHECK_SIZE_MATCH (iceConn, ICE_NoClose,
- length, SIZEOF (iceNoCloseMsg), IceFatalToConnection);
-
- if (iceConn->want_to_close)
- {
- /*
- * The other side can't close now. We cancel our WantToClose,
- * and we can expect a WantToClose from the other side.
- */
-
- iceConn->want_to_close = 0;
- }
- else
- {
- _IceErrorBadState (iceConn, 0, ICE_NoClose, IceCanContinue);
- }
-
- return (0);
-}
-
-
-
-void
-_IceProcessCoreMessage (iceConn, opcode, length, swap,
- replyWait, replyReadyRet, connectionClosedRet)
-
-IceConn iceConn;
-int opcode;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-Bool *replyReadyRet;
-Bool *connectionClosedRet;
-
-{
- Bool replyReady = False;
-
- *connectionClosedRet = False;
-
- switch (opcode)
- {
- case ICE_Error:
-
- replyReady = ProcessError (iceConn, length, swap, replyWait);
- break;
-
- case ICE_ConnectionSetup:
-
- ProcessConnectionSetup (iceConn, length, swap);
- break;
-
- case ICE_AuthRequired:
-
- replyReady = ProcessAuthRequired (iceConn, length, swap, replyWait);
- break;
-
- case ICE_AuthReply:
-
- ProcessAuthReply (iceConn, length, swap);
- break;
-
- case ICE_AuthNextPhase:
-
- replyReady = ProcessAuthNextPhase (iceConn, length, swap, replyWait);
- break;
-
- case ICE_ConnectionReply:
-
- replyReady = ProcessConnectionReply (iceConn, length, swap, replyWait);
- break;
-
- case ICE_ProtocolSetup:
-
- ProcessProtocolSetup (iceConn, length, swap);
- break;
-
- case ICE_ProtocolReply:
-
- replyReady = ProcessProtocolReply (iceConn, length, swap, replyWait);
- break;
-
- case ICE_Ping:
-
- ProcessPing (iceConn, length);
- break;
-
- case ICE_PingReply:
-
- ProcessPingReply (iceConn, length);
- break;
-
- case ICE_WantToClose:
-
- ProcessWantToClose (iceConn, length, connectionClosedRet);
- break;
-
- case ICE_NoClose:
-
- ProcessNoClose (iceConn, length);
- break;
-
- default:
-
- _IceErrorBadMinor (iceConn, 0, opcode, IceCanContinue);
- _IceReadSkip (iceConn, length << 3);
- break;
- }
-
- if (replyWait)
- *replyReadyRet = replyReady;
-}
-
-
-#ifdef MINIX
-int
-MNX_IceMessagesAvailable(iceConn)
-
-IceConn iceConn;
-{
- BytesReadable_t bytes;
-
- _IceTransSetOption(iceConn->trans_conn, TRANS_NONBLOCKING, 1);
- if (_IceTransBytesReadable(iceConn->trans_conn, &bytes) < 0)
- bytes= -1;
- _IceTransSetOption(iceConn->trans_conn, TRANS_NONBLOCKING, 0);
- return (bytes != 0);
-}
-#endif
diff --git a/xc/lib/ICE/protosetup.c b/xc/lib/ICE/protosetup.c
deleted file mode 100644
index 0b1d86e3f..000000000
--- a/xc/lib/ICE/protosetup.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* $TOG: protosetup.c /main/20 1998/02/06 13:57:43 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-
-IceProtocolSetupStatus
-IceProtocolSetup (iceConn, myOpcode, clientData, mustAuthenticate,
- majorVersionRet, minorVersionRet, vendorRet, releaseRet,
- errorLength, errorStringRet)
-
-IceConn iceConn;
-int myOpcode;
-IcePointer clientData;
-Bool mustAuthenticate;
-int *majorVersionRet;
-int *minorVersionRet;
-char **vendorRet;
-char **releaseRet;
-int errorLength;
-char *errorStringRet;
-
-{
- iceProtocolSetupMsg *pMsg;
- char *pData;
- _IceProtocol *myProtocol;
- int extra;
- Bool gotReply, ioErrorOccured;
- int accepted, i;
- int hisOpcode;
- unsigned long setup_sequence;
- IceReplyWaitInfo replyWait;
- _IceReply reply;
- IcePoVersionRec *versionRec;
- int authCount;
- int *authIndices;
-
- if (errorStringRet && errorLength > 0)
- *errorStringRet = '\0';
-
- *majorVersionRet = 0;
- *minorVersionRet = 0;
- *vendorRet = NULL;
- *releaseRet = NULL;
-
- if (myOpcode < 1 || myOpcode > _IceLastMajorOpcode)
- {
- strncpy (errorStringRet, "myOpcode out of range", errorLength);
- return (IceProtocolSetupFailure);
- }
-
- myProtocol = &_IceProtocols[myOpcode - 1];
-
- if (myProtocol->orig_client == NULL)
- {
- strncpy (errorStringRet,
- "IceRegisterForProtocolSetup was not called", errorLength);
- return (IceProtocolSetupFailure);
- }
-
-
- /*
- * Make sure this protocol hasn't been activated already.
- */
-
- if (iceConn->process_msg_info)
- {
- for (i = iceConn->his_min_opcode; i <= iceConn->his_max_opcode; i++)
- {
- if (iceConn->process_msg_info[
- i - iceConn->his_min_opcode].in_use &&
- iceConn->process_msg_info[
- i - iceConn->his_min_opcode ].my_opcode == myOpcode)
- break;
- }
-
- if (i <= iceConn->his_max_opcode)
- {
- return (IceProtocolAlreadyActive);
- }
- }
-
- /*
- * Generate the message.
- */
-
- if (myProtocol->orig_client->auth_count > 0)
- {
- authIndices = (int *) malloc (
- myProtocol->orig_client->auth_count * sizeof (int));
-
- _IceGetPoValidAuthIndices (myProtocol->protocol_name,
- iceConn->connection_string,
- myProtocol->orig_client->auth_count,
- myProtocol->orig_client->auth_names,
- &authCount, authIndices);
-
- }
- else
- {
- authCount = 0;
- authIndices = NULL;
- }
-
- extra = STRING_BYTES (myProtocol->protocol_name) +
- STRING_BYTES (myProtocol->orig_client->vendor) +
- STRING_BYTES (myProtocol->orig_client->release);
-
- for (i = 0; i < authCount; i++)
- {
- extra += STRING_BYTES (myProtocol->orig_client->auth_names[
- authIndices[i]]);
- }
-
- extra += (myProtocol->orig_client->version_count * 4);
-
- IceGetHeaderExtra (iceConn, 0, ICE_ProtocolSetup,
- SIZEOF (iceProtocolSetupMsg), WORD64COUNT (extra),
- iceProtocolSetupMsg, pMsg, pData);
-
- setup_sequence = iceConn->send_sequence;
-
- pMsg->protocolOpcode = myOpcode;
- pMsg->versionCount = myProtocol->orig_client->version_count;
- pMsg->authCount = authCount;
- pMsg->mustAuthenticate = mustAuthenticate;
-
- STORE_STRING (pData, myProtocol->protocol_name);
- STORE_STRING (pData, myProtocol->orig_client->vendor);
- STORE_STRING (pData, myProtocol->orig_client->release);
-
- for (i = 0; i < authCount; i++)
- {
- STORE_STRING (pData, myProtocol->orig_client->auth_names[
- authIndices[i]]);
- }
-
- for (i = 0; i < myProtocol->orig_client->version_count; i++)
- {
- STORE_CARD16 (pData,
- myProtocol->orig_client->version_recs[i].major_version);
- STORE_CARD16 (pData,
- myProtocol->orig_client->version_recs[i].minor_version);
- }
-
- IceFlush (iceConn);
-
-
- /*
- * Process messages until we get a Protocol Reply.
- */
-
- replyWait.sequence_of_request = setup_sequence;
- replyWait.major_opcode_of_request = 0;
- replyWait.minor_opcode_of_request = ICE_ProtocolSetup;
- replyWait.reply = (IcePointer) &reply;
-
- iceConn->protosetup_to_you = (_IceProtoSetupToYouInfo *) malloc (
- sizeof (_IceProtoSetupToYouInfo));
- iceConn->protosetup_to_you->my_opcode = myOpcode;
- iceConn->protosetup_to_you->my_auth_count = authCount;
- iceConn->protosetup_to_you->auth_active = 0;
- iceConn->protosetup_to_you->my_auth_indices = authIndices;
-
- gotReply = False;
- ioErrorOccured = False;
- accepted = 0;
-
- while (!gotReply && !ioErrorOccured)
- {
- ioErrorOccured = (IceProcessMessages (
- iceConn, &replyWait, &gotReply) == IceProcessMessagesIOError);
-
- if (ioErrorOccured)
- {
- strncpy (errorStringRet,
- "IO error occured doing Protocol Setup on connection",
- errorLength);
- return (IceProtocolSetupIOError);
- }
- else if (gotReply)
- {
- if (reply.type == ICE_PROTOCOL_REPLY)
- {
- if (reply.protocol_reply.version_index >=
- myProtocol->orig_client->version_count)
- {
- strncpy (errorStringRet,
- "Got a bad version index in the Protocol Reply",
- errorLength);
-
- free (reply.protocol_reply.vendor);
- free (reply.protocol_reply.release);
- }
- else
- {
- versionRec = &(myProtocol->orig_client->version_recs[
- reply.protocol_reply.version_index]);
-
- accepted = 1;
- }
- }
- else /* reply.type == ICE_PROTOCOL_ERROR */
- {
- /* Protocol Setup failed */
-
- strncpy (errorStringRet, reply.protocol_error.error_message,
- errorLength);
-
- free (reply.protocol_error.error_message);
- }
-
- if (iceConn->protosetup_to_you->my_auth_indices)
- free ((char *) iceConn->protosetup_to_you->my_auth_indices);
- free ((char *) iceConn->protosetup_to_you);
- iceConn->protosetup_to_you = NULL;
- }
- }
-
- if (accepted)
- {
- _IceProcessMsgInfo *process_msg_info;
-
- *majorVersionRet = versionRec->major_version;
- *minorVersionRet = versionRec->minor_version;
- *vendorRet = reply.protocol_reply.vendor;
- *releaseRet = reply.protocol_reply.release;
-
-
- /*
- * Increase the reference count for the number of active protocols.
- */
-
- iceConn->proto_ref_count++;
-
-
- /*
- * We may be using a different major opcode for this protocol
- * than the other client. Whenever we get a message, we must
- * map to our own major opcode.
- */
-
- hisOpcode = reply.protocol_reply.major_opcode;
-
- _IceAddOpcodeMapping (iceConn, hisOpcode, myOpcode);
-
- process_msg_info = &iceConn->process_msg_info[hisOpcode -
- iceConn->his_min_opcode];
-
- process_msg_info->client_data = clientData;
- process_msg_info->accept_flag = 0;
-
- process_msg_info->process_msg_proc.orig_client =
- versionRec->process_msg_proc;
-
- return (IceProtocolSetupSuccess);
- }
- else
- {
- return (IceProtocolSetupFailure);
- }
-}
diff --git a/xc/lib/ICE/register.c b/xc/lib/ICE/register.c
deleted file mode 100644
index cd392d1b1..000000000
--- a/xc/lib/ICE/register.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* $TOG: register.c /main/14 1998/02/06 13:57:48 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-int
-IceRegisterForProtocolSetup (protocolName, vendor, release,
- versionCount, versionRecs, authCount, authNames, authProcs, IOErrorProc)
-
-char *protocolName;
-char *vendor;
-char *release;
-int versionCount;
-IcePoVersionRec *versionRecs;
-int authCount;
-char **authNames;
-IcePoAuthProc *authProcs;
-IceIOErrorProc IOErrorProc;
-
-{
- _IcePoProtocol *p;
- int opcodeRet, i;
-
- for (i = 1; i <= _IceLastMajorOpcode; i++)
- if (strcmp (protocolName, _IceProtocols[i - 1].protocol_name) == 0)
- {
- if (_IceProtocols[i - 1].orig_client != NULL)
- {
- /*
- * We've already registered this protocol.
- */
-
- return (i);
- }
- else
- {
- break;
- }
- }
-
- if (i <= _IceLastMajorOpcode)
- {
- p = _IceProtocols[i - 1].orig_client =
- (_IcePoProtocol *) malloc (sizeof (_IcePoProtocol));
- opcodeRet = i;
- }
- else if (_IceLastMajorOpcode == 255 ||
- versionCount < 1 ||
- strlen (protocolName) == 0)
- {
- return (-1);
- }
- else
- {
- char *name;
-
- _IceProtocols[_IceLastMajorOpcode].protocol_name = name =
- (char *) malloc (strlen (protocolName) + 1);
- strcpy (name, protocolName);
-
- p = _IceProtocols[_IceLastMajorOpcode].orig_client =
- (_IcePoProtocol *) malloc (sizeof (_IcePoProtocol));
-
- _IceProtocols[_IceLastMajorOpcode].accept_client = NULL;
-
- opcodeRet = ++_IceLastMajorOpcode;
- }
-
- p->vendor = (char *) malloc (strlen (vendor) + 1);
- strcpy (p->vendor, vendor);
-
- p->release = (char *) malloc (strlen (release) + 1);
- strcpy (p->release, release);
-
- p->version_count = versionCount;
-
- p->version_recs = (IcePoVersionRec *) malloc (
- versionCount * sizeof (IcePoVersionRec));
- memcpy (p->version_recs, versionRecs,
- versionCount * sizeof (IcePoVersionRec));
-
- if ((p->auth_count = authCount) > 0)
- {
- p->auth_names = (char **) malloc (
- authCount * sizeof (char *));
-
- p->auth_procs = (IcePoAuthProc *) malloc (
- authCount * sizeof (IcePoAuthProc));
-
- for (i = 0; i < authCount; i++)
- {
- p->auth_names[i] =
- (char *) malloc (strlen (authNames[i]) + 1);
- strcpy (p->auth_names[i], authNames[i]);
-
- p->auth_procs[i] = authProcs[i];
- }
- }
- else
- {
- p->auth_names = NULL;
- p->auth_procs = NULL;
- }
-
- p->io_error_proc = IOErrorProc;
-
- return (opcodeRet);
-}
-
-
-
-int
-IceRegisterForProtocolReply (protocolName, vendor, release,
- versionCount, versionRecs, authCount, authNames, authProcs,
- hostBasedAuthProc, protocolSetupProc, protocolActivateProc,
- IOErrorProc)
-
-char *protocolName;
-char *vendor;
-char *release;
-int versionCount;
-IcePaVersionRec *versionRecs;
-int authCount;
-char **authNames;
-IcePaAuthProc *authProcs;
-IceHostBasedAuthProc hostBasedAuthProc;
-IceProtocolSetupProc protocolSetupProc;
-IceProtocolActivateProc protocolActivateProc;
-IceIOErrorProc IOErrorProc;
-
-{
- _IcePaProtocol *p;
- int opcodeRet, i;
-
- for (i = 1; i <= _IceLastMajorOpcode; i++)
- if (strcmp (protocolName, _IceProtocols[i - 1].protocol_name) == 0)
- {
- if (_IceProtocols[i - 1].accept_client != NULL)
- {
- /*
- * We've already registered this protocol.
- */
-
- return (i);
- }
- else
- {
- break;
- }
- }
-
-
- if (i <= _IceLastMajorOpcode)
- {
- p = _IceProtocols[i - 1].accept_client =
- (_IcePaProtocol *) malloc (sizeof (_IcePaProtocol));
- opcodeRet = i;
- }
- else if (_IceLastMajorOpcode == 255 ||
- versionCount < 1 ||
- strlen (protocolName) == 0)
- {
- return (-1);
- }
- else
- {
- char *name;
-
- _IceProtocols[_IceLastMajorOpcode].protocol_name = name =
- (char *) malloc (strlen (protocolName) + 1);
- strcpy (name, protocolName);
-
- _IceProtocols[_IceLastMajorOpcode].orig_client = NULL;
-
- p = _IceProtocols[_IceLastMajorOpcode].accept_client =
- (_IcePaProtocol *) malloc (sizeof (_IcePaProtocol));
-
- opcodeRet = ++_IceLastMajorOpcode;
- }
-
- p->vendor = (char *) malloc (strlen (vendor) + 1);
- strcpy (p->vendor, vendor);
-
- p->release = (char *) malloc (strlen (release) + 1);
- strcpy (p->release, release);
-
- p->version_count = versionCount;
-
- p->version_recs = (IcePaVersionRec *) malloc (
- versionCount * sizeof (IcePaVersionRec));
- memcpy (p->version_recs, versionRecs,
- versionCount * sizeof (IcePaVersionRec));
-
- p->protocol_setup_proc = protocolSetupProc;
- p->protocol_activate_proc = protocolActivateProc;
-
- if ((p->auth_count = authCount) > 0)
- {
- p->auth_names = (char **) malloc (
- authCount * sizeof (char *));
-
- p->auth_procs = (IcePaAuthProc *) malloc (
- authCount * sizeof (IcePaAuthProc));
-
- for (i = 0; i < authCount; i++)
- {
- p->auth_names[i] =
- (char *) malloc (strlen (authNames[i]) + 1);
- strcpy (p->auth_names[i], authNames[i]);
-
- p->auth_procs[i] = authProcs[i];
- }
- }
- else
- {
- p->auth_names = NULL;
- p->auth_procs = NULL;
- }
-
- p->host_based_auth_proc = hostBasedAuthProc;
-
- p->io_error_proc = IOErrorProc;
-
- return (opcodeRet);
-}
-
diff --git a/xc/lib/ICE/replywait.c b/xc/lib/ICE/replywait.c
deleted file mode 100644
index 305eb905d..000000000
--- a/xc/lib/ICE/replywait.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $TOG: replywait.c /main/5 1998/02/06 13:57:54 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-
-void
-_IceAddReplyWait (iceConn, replyWait)
-
-IceConn iceConn;
-IceReplyWaitInfo *replyWait;
-
-{
- /*
- * Add this replyWait to the end of the list (only if the
- * replyWait is not already in the list).
- */
-
- _IceSavedReplyWait *savedReplyWait;
- _IceSavedReplyWait *prev, *last;
-
- prev = NULL;
- last = iceConn->saved_reply_waits;
-
- while (last)
- {
- if (last->reply_wait == replyWait)
- return;
-
- prev = last;
- last = last->next;
- }
-
- savedReplyWait = (_IceSavedReplyWait *) malloc (
- sizeof (_IceSavedReplyWait));
-
- savedReplyWait->reply_wait = replyWait;
- savedReplyWait->reply_ready = False;
- savedReplyWait->next = NULL;
-
- if (prev == NULL)
- iceConn->saved_reply_waits = savedReplyWait;
- else
- prev->next = savedReplyWait;
-}
-
-
-
-IceReplyWaitInfo *
-_IceSearchReplyWaits (iceConn, majorOpcode)
-
-IceConn iceConn;
-int majorOpcode;
-
-{
- /*
- * Return the first replyWait in the list with the given majorOpcode
- */
-
- _IceSavedReplyWait *savedReplyWait = iceConn->saved_reply_waits;
-
- while (savedReplyWait && !savedReplyWait->reply_ready &&
- savedReplyWait->reply_wait->major_opcode_of_request != majorOpcode)
- {
- savedReplyWait = savedReplyWait->next;
- }
-
- return (savedReplyWait ? savedReplyWait->reply_wait : NULL);
-}
-
-
-
-void
-_IceSetReplyReady (iceConn, replyWait)
-
-IceConn iceConn;
-IceReplyWaitInfo *replyWait;
-
-{
- /*
- * The replyWait specified has a reply ready.
- */
-
- _IceSavedReplyWait *savedReplyWait = iceConn->saved_reply_waits;
-
- while (savedReplyWait && savedReplyWait->reply_wait != replyWait)
- savedReplyWait = savedReplyWait->next;
-
- if (savedReplyWait)
- savedReplyWait->reply_ready = True;
-}
-
-
-
-Bool
-_IceCheckReplyReady (iceConn, replyWait)
-
-IceConn iceConn;
-IceReplyWaitInfo *replyWait;
-
-{
- _IceSavedReplyWait *savedReplyWait = iceConn->saved_reply_waits;
- _IceSavedReplyWait *prev = NULL;
- Bool found = False;
- Bool ready;
-
- while (savedReplyWait && !found)
- {
- if (savedReplyWait->reply_wait == replyWait)
- found = True;
- else
- {
- prev = savedReplyWait;
- savedReplyWait = savedReplyWait->next;
- }
- }
-
- ready = found && savedReplyWait->reply_ready;
-
- if (ready)
- {
- if (prev == NULL)
- iceConn->saved_reply_waits = savedReplyWait->next;
- else
- prev->next = savedReplyWait->next;
-
- free ((char *) savedReplyWait);
- }
-
- return (ready);
-}
diff --git a/xc/lib/ICE/setauth.c b/xc/lib/ICE/setauth.c
deleted file mode 100644
index 5b9569f8b..000000000
--- a/xc/lib/ICE/setauth.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $TOG: setauth.c /main/9 1998/02/06 13:57:59 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-/* $XFree86: xc/lib/ICE/setauth.c,v 1.2 1998/12/20 11:56:50 dawes Exp $ */
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-#include <X11/ICE/ICEutil.h>
-
-
-/*
- * IceSetPaAuthData is not a standard part of ICElib, it is specific
- * to the sample implementation.
- *
- * For the client that initiates a Protocol Setup, we look in the
- * .ICEauthority file to get authentication data.
- *
- * For the client accepting the Protocol Setup, we get the data
- * from an in-memory database of authentication data (set by the
- * application calling IceSetPaAuthData). We have to get the data
- * from memory because getting it directly from the .ICEauthority
- * file is not secure - someone can just modify the contents of the
- * .ICEauthority file behind our back.
- */
-
-int _IcePaAuthDataEntryCount = 0;
-#ifndef __EMX__
-IceAuthDataEntry _IcePaAuthDataEntries[ICE_MAX_AUTH_DATA_ENTRIES];
-#else
-IceAuthDataEntry _IcePaAuthDataEntries[ICE_MAX_AUTH_DATA_ENTRIES] = {0};
-#endif
-
-
-void
-IceSetPaAuthData (numEntries, entries)
-
-int numEntries;
-IceAuthDataEntry *entries;
-
-{
- /*
- * _IcePaAuthDataEntries should really be a linked list.
- * On my list of TO DO stuff.
- */
-
- int i, j;
-
- for (i = 0; i < numEntries; i++)
- {
- for (j = 0; j < _IcePaAuthDataEntryCount; j++)
- if (strcmp (entries[i].protocol_name,
- _IcePaAuthDataEntries[j].protocol_name) == 0 &&
- strcmp (entries[i].network_id,
- _IcePaAuthDataEntries[j].network_id) == 0 &&
- strcmp (entries[i].auth_name,
- _IcePaAuthDataEntries[j].auth_name) == 0)
- break;
-
- if (j < _IcePaAuthDataEntryCount)
- {
- free (_IcePaAuthDataEntries[j].protocol_name);
- free (_IcePaAuthDataEntries[j].network_id);
- free (_IcePaAuthDataEntries[j].auth_name);
- free (_IcePaAuthDataEntries[j].auth_data);
- }
- else
- {
- _IcePaAuthDataEntryCount++;
- }
-
- _IcePaAuthDataEntries[j].protocol_name = (char *) malloc (
- strlen (entries[i].protocol_name) + 1);
- strcpy (_IcePaAuthDataEntries[j].protocol_name,
- entries[i].protocol_name);
-
- _IcePaAuthDataEntries[j].network_id = (char *) malloc (
- strlen (entries[i].network_id) + 1);
- strcpy (_IcePaAuthDataEntries[j].network_id,
- entries[i].network_id);
-
- _IcePaAuthDataEntries[j].auth_name = (char *) malloc (
- strlen (entries[i].auth_name) + 1);
- strcpy (_IcePaAuthDataEntries[j].auth_name,
- entries[i].auth_name);
-
- _IcePaAuthDataEntries[j].auth_data_length =
- entries[i].auth_data_length;
- _IcePaAuthDataEntries[j].auth_data = (char *) malloc (
- entries[i].auth_data_length);
- memcpy (_IcePaAuthDataEntries[j].auth_data,
- entries[i].auth_data, entries[i].auth_data_length);
- }
-}
diff --git a/xc/lib/ICE/shutdown.c b/xc/lib/ICE/shutdown.c
deleted file mode 100644
index 20768722a..000000000
--- a/xc/lib/ICE/shutdown.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* $TOG: shutdown.c /main/18 1998/02/06 13:58:05 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-
-Status
-IceProtocolShutdown (iceConn, majorOpcode)
-
-IceConn iceConn;
-int majorOpcode;
-
-{
- if (iceConn->proto_ref_count == 0 || iceConn->process_msg_info == NULL ||
- majorOpcode < 1 || majorOpcode > _IceLastMajorOpcode)
- {
- return (0);
- }
- else
- {
- /*
- * Make sure this majorOpcode is really being used.
- */
-
- int i;
-
- for (i = iceConn->his_min_opcode; i <= iceConn->his_max_opcode; i++)
- {
- if (iceConn->process_msg_info[
- i - iceConn->his_min_opcode].in_use &&
- iceConn->process_msg_info[
- i - iceConn->his_min_opcode].my_opcode == majorOpcode)
- break;
- }
-
- if (i > iceConn->his_max_opcode)
- {
- return (0);
- }
- else
- {
- /*
- * OK, we can shut down the protocol.
- */
-
- iceConn->process_msg_info[
- i - iceConn->his_min_opcode].in_use = False;
- iceConn->proto_ref_count--;
-
- return (1);
- }
- }
-}
-
-
-
-void
-IceSetShutdownNegotiation (iceConn, negotiate)
-
-IceConn iceConn;
-Bool negotiate;
-
-{
- iceConn->skip_want_to_close = negotiate ? False : True;
-}
-
-
-
-Bool
-IceCheckShutdownNegotiation (iceConn)
-
-IceConn iceConn;
-
-{
- return (iceConn->skip_want_to_close ? False : True);
-}
-
-
-
-IceCloseStatus
-IceCloseConnection (iceConn)
-
-IceConn iceConn;
-
-{
- int refCountReachedZero;
- IceCloseStatus status;
-
- /*
- * If this connection object was never valid, we can close
- * it right now. This happens if IceAcceptConnection was
- * called, but after calling IceProcessMessages several times
- * the connection was rejected (because of authentication or
- * some other reason).
- */
-
- if (iceConn->listen_obj &&
- iceConn->connection_status != IceConnectAccepted)
- {
- _IceConnectionClosed (iceConn); /* invoke watch procs */
- _IceFreeConnection (iceConn);
- return (IceClosedNow);
- }
-
-
- /*---------------------------------------------------------------
-
- ACTIONS:
-
- A = Invoke Watch Procedures
- B = Set free-asap bit
- C = Free connection
- D = Initialize shutdown negotiation
- N = do nothing
-
-
- ACTION TABLE:
-
- IO free- dispatch protocol shutdown
- error asap bit level refcount negotiation ACTION
- occured set reached 0 reached 0
-
- 0 0 0 0 0 N
- 0 0 0 0 1 N
- 0 0 0 1 0 AB
- 0 0 0 1 1 N
- 0 0 1 0 0 N
- 0 0 1 0 1 N
- 0 0 1 1 0 AC
- 0 0 1 1 1 D
- 0 1 0 0 0 N
- 0 1 0 0 1 N
- 0 1 0 1 0 N
- 0 1 0 1 1 N
- 0 1 1 0 0 C
- 0 1 1 0 1 D
- 0 1 1 1 0 C
- 0 1 1 1 1 D
- 1 0 0 0 0 AB
- 1 0 0 0 1 AB
- 1 0 0 1 0 AB
- 1 0 0 1 1 AB
- 1 0 1 0 0 AC
- 1 0 1 0 1 AC
- 1 0 1 1 0 AC
- 1 0 1 1 1 AC
- 1 1 0 0 0 N
- 1 1 0 0 1 N
- 1 1 0 1 0 N
- 1 1 0 1 1 N
- 1 1 1 0 0 C
- 1 1 1 0 1 C
- 1 1 1 1 0 C
- 1 1 1 1 1 C
-
- ---------------------------------------------------------------*/
-
- if (iceConn->open_ref_count > 0)
- iceConn->open_ref_count--;
-
- refCountReachedZero = iceConn->open_ref_count == 0 &&
- iceConn->proto_ref_count == 0;
-
- status = IceConnectionInUse;
-
- if (!iceConn->free_asap && (!iceConn->io_ok ||
- (iceConn->io_ok && refCountReachedZero &&
- iceConn->skip_want_to_close)))
- {
- /*
- * Invoke the watch procedures now.
- */
-
- _IceConnectionClosed (iceConn);
- status = IceClosedNow; /* may be overwritten by IceClosedASAP */
- }
-
- if (!iceConn->free_asap && iceConn->dispatch_level != 0 &&
- (!iceConn->io_ok ||
- (iceConn->io_ok && refCountReachedZero &&
- iceConn->skip_want_to_close)))
- {
- /*
- * Set flag so we free the connection as soon as possible.
- */
-
- iceConn->free_asap = True;
- status = IceClosedASAP;
- }
-
- if (iceConn->io_ok && iceConn->dispatch_level == 0 &&
- !iceConn->skip_want_to_close && refCountReachedZero)
- {
- /*
- * Initiate shutdown negotiation.
- */
-
- IceSimpleMessage (iceConn, 0, ICE_WantToClose);
- IceFlush (iceConn);
-
- iceConn->want_to_close = 1;
-
- status = IceStartedShutdownNegotiation;
- }
- else if (iceConn->dispatch_level == 0 &&
- (!iceConn->io_ok || (iceConn->io_ok && iceConn->skip_want_to_close &&
- (iceConn->free_asap || (!iceConn->free_asap && refCountReachedZero)))))
- {
- /*
- * Free the connection.
- */
-
- _IceFreeConnection (iceConn);
-
- status = IceClosedNow;
- }
-
- return (status);
-}
-
-
-
-void
-_IceFreeConnection (iceConn)
-
-IceConn iceConn;
-
-{
- if (iceConn->listen_obj == NULL)
- {
- /*
- * This iceConn was created with IceOpenConnection.
- * We keep track of all open IceConn's, so we need
- * to remove it from the list.
- */
-
- int i;
-
- for (i = 0; i < _IceConnectionCount; i++)
- if (_IceConnectionObjs[i] == iceConn)
- break;
-
- if (i < _IceConnectionCount)
- {
- if (i < _IceConnectionCount - 1)
- {
- _IceConnectionObjs[i] =
- _IceConnectionObjs[_IceConnectionCount - 1];
- _IceConnectionStrings[i] =
- _IceConnectionStrings[_IceConnectionCount - 1];
- }
-
- _IceConnectionCount--;
- }
- }
-
- if (iceConn->trans_conn)
- _IceTransClose (iceConn->trans_conn);
-
- if (iceConn->connection_string)
- free (iceConn->connection_string);
-
- if (iceConn->vendor)
- free (iceConn->vendor);
-
- if (iceConn->release)
- free (iceConn->release);
-
- if (iceConn->inbuf)
- free (iceConn->inbuf);
-
- if (iceConn->outbuf)
- free (iceConn->outbuf);
-
- if (iceConn->scratch)
- free (iceConn->scratch);
-
- if (iceConn->process_msg_info)
- free ((char *) iceConn->process_msg_info);
-
- if (iceConn->connect_to_you)
- free ((char *) iceConn->connect_to_you);
-
- if (iceConn->protosetup_to_you)
- free ((char *) iceConn->protosetup_to_you);
-
- if (iceConn->connect_to_me)
- free ((char *) iceConn->connect_to_me);
-
- if (iceConn->protosetup_to_me)
- free ((char *) iceConn->protosetup_to_me);
-
- free ((char *) iceConn);
-}
-
-
-
-
diff --git a/xc/lib/ICE/watch.c b/xc/lib/ICE/watch.c
deleted file mode 100644
index f5f3d52e7..000000000
--- a/xc/lib/ICE/watch.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $TOG: watch.c /main/7 1998/02/06 13:58:11 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.
-
-Author: Ralph Mor, X Consortium
-******************************************************************************/
-
-#include <X11/ICE/ICElib.h>
-#include "ICElibint.h"
-
-
-Status
-IceAddConnectionWatch (watchProc, clientData)
-
-IceWatchProc watchProc;
-IcePointer clientData;
-
-{
- /*
- * watchProc will be called each time an ICE connection is
- * created/destroyed by ICElib.
- */
-
- _IceWatchProc *ptr = _IceWatchProcs;
- _IceWatchProc *newWatchProc;
- int i;
-
- if ((newWatchProc = (_IceWatchProc *) malloc (
- sizeof (_IceWatchProc))) == NULL)
- {
- return (0);
- }
-
- newWatchProc->watch_proc = watchProc;
- newWatchProc->client_data = clientData;
- newWatchProc->watched_connections = NULL;
- newWatchProc->next = NULL;
-
- while (ptr && ptr->next)
- ptr = ptr->next;
-
- if (ptr == NULL)
- _IceWatchProcs = newWatchProc;
- else
- ptr->next = newWatchProc;
-
-
- /*
- * Invoke the watch proc with any previously opened ICE connections.
- */
-
- for (i = 0; i < _IceConnectionCount; i++)
- {
- _IceWatchedConnection *newWatchedConn = (_IceWatchedConnection *)
- malloc (sizeof (_IceWatchedConnection));
-
- newWatchedConn->iceConn = _IceConnectionObjs[i];
- newWatchedConn->next = NULL;
-
- newWatchProc->watched_connections = newWatchedConn;
-
- (*newWatchProc->watch_proc) (_IceConnectionObjs[i],
- newWatchProc->client_data, True, &newWatchedConn->watch_data);
- }
-
- return (1);
-}
-
-
-
-void
-IceRemoveConnectionWatch (watchProc, clientData)
-
-IceWatchProc watchProc;
-IcePointer clientData;
-
-{
- _IceWatchProc *currWatchProc = _IceWatchProcs;
- _IceWatchProc *prevWatchProc = NULL;
-
- while (currWatchProc && (currWatchProc->watch_proc != watchProc ||
- currWatchProc->client_data != clientData))
- {
- prevWatchProc = currWatchProc;
- currWatchProc = currWatchProc->next;
- }
-
- if (currWatchProc)
- {
- _IceWatchProc *nextWatchProc = currWatchProc->next;
- _IceWatchedConnection *watchedConn;
-
- watchedConn = currWatchProc->watched_connections;
- while (watchedConn)
- {
- _IceWatchedConnection *nextWatchedConn = watchedConn->next;
- free ((char *) watchedConn);
- watchedConn = nextWatchedConn;
- }
-
- if (prevWatchProc == NULL)
- _IceWatchProcs = nextWatchProc;
- else
- prevWatchProc->next = nextWatchProc;
-
- free ((char *) currWatchProc);
- }
-}
-
-
-
-void
-_IceConnectionOpened (iceConn)
-
-IceConn iceConn;
-
-{
- _IceWatchProc *watchProc = _IceWatchProcs;
-
- while (watchProc)
- {
- _IceWatchedConnection *newWatchedConn = (_IceWatchedConnection *)
- malloc (sizeof (_IceWatchedConnection));
- _IceWatchedConnection *watchedConn;
-
- watchedConn = watchProc->watched_connections;
- while (watchedConn && watchedConn->next)
- watchedConn = watchedConn->next;
-
- newWatchedConn->iceConn = iceConn;
- newWatchedConn->next = NULL;
-
- if (watchedConn == NULL)
- watchProc->watched_connections = newWatchedConn;
- else
- watchedConn->next = newWatchedConn;
-
- (*watchProc->watch_proc) (iceConn,
- watchProc->client_data, True, &newWatchedConn->watch_data);
-
- watchProc = watchProc->next;
- }
-}
-
-
-
-void
-_IceConnectionClosed (iceConn)
-
-IceConn iceConn;
-
-{
- _IceWatchProc *watchProc = _IceWatchProcs;
-
- while (watchProc)
- {
- _IceWatchedConnection *watchedConn = watchProc->watched_connections;
- _IceWatchedConnection *prev = NULL;
-
- while (watchedConn && watchedConn->iceConn != iceConn)
- {
- prev = watchedConn;
- watchedConn = watchedConn->next;
- }
-
- if (watchedConn)
- {
- (*watchProc->watch_proc) (iceConn,
- watchProc->client_data, False, &watchedConn->watch_data);
-
- if (prev == NULL)
- watchProc->watched_connections = watchedConn->next;
- else
- prev->next = watchedConn->next;
-
- free ((char *) watchedConn);
- }
-
- watchProc = watchProc->next;
- }
-}
diff --git a/xc/lib/Imakefile b/xc/lib/Imakefile
index 4d600393a..62abe10b9 100644
--- a/xc/lib/Imakefile
+++ b/xc/lib/Imakefile
@@ -20,7 +20,7 @@ XAW6LIBDIR = Xaw6
BERKDIR = Xbsd
#endif
-#if BuildXKBlib
+#if BuildXKBfilelib || BuildXKB
XKBLIBDIR = xkbfile
#endif
diff --git a/xc/lib/PEX5/Imakefile b/xc/lib/PEX5/Imakefile
deleted file mode 100644
index cf5f7967a..000000000
--- a/xc/lib/PEX5/Imakefile
+++ /dev/null
@@ -1,87 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/18 1996/09/28 16:33:26 rws $
-XCOMM $XFree86: xc/lib/PEX5/Imakefile,v 1.3 1998/12/20 11:56:51 dawes Exp $
-
-#define DoNormalLib NormalLibPex
-#define DoSharedLib SharedLibPex
-#define DoExtraLib SharedLibPex
-#define DoDebugLib DebugLibPex
-#define DoProfileLib ProfileLibPex
-#define LibName PEX5
-#define SoRev SOPEXREV
-#define IncSubdir X11
-#define IncSubSubdir PEX5
-
-#include <Threads.tmpl>
-
-#ifdef SharedPexReqs
-REQUIREDLIBS = SharedPexReqs
-#endif
-
-#ifdef PexNativeFPFormat
-NATIVE_FP_FORMAT = PexNativeFPFormat
-FP_DEFINES = -DNATIVE_FP_FORMAT=$(NATIVE_FP_FORMAT)
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
-DEFINES = $(FP_DEFINES) $(ALLOC_DEFINES)
-
-HEADERS = PEXlib.h \
- PEXlibint.h \
- PEX.h \
- PEXproto.h \
- PEXprotost.h
-
-SRCS = pl_convert.c \
- pl_escape.c \
- pl_font.c \
- pl_free.c \
- pl_lut.c \
- pl_nameset.c \
- pl_oc_attr.c \
- pl_oc_dec.c \
- pl_oc_enc.c \
- pl_oc_prim.c \
- pl_oc_str.c \
- pl_oc_util.c \
- pl_pc.c \
- pl_pick.c \
- pl_rdr.c \
- pl_sc.c \
- pl_startup.c \
- pl_struct.c \
- pl_util.c \
- pl_wks.c
-
-OBJS = pl_convert.o \
- pl_escape.o \
- pl_font.o \
- pl_free.o \
- pl_lut.o \
- pl_nameset.o \
- pl_oc_attr.o \
- pl_oc_dec.o \
- pl_oc_enc.o \
- pl_oc_prim.o \
- pl_oc_str.o \
- pl_oc_util.o \
- pl_pc.o \
- pl_pick.o \
- pl_rdr.o \
- pl_sc.o \
- pl_startup.o \
- pl_struct.o \
- pl_util.o \
- pl_wks.o
-
-
-#include <Library.tmpl>
-
-/* Work around a problem with SunPro C 4.2 (ix86) */
-#ifdef HasSunC
-SpecialCLibObjectRule(pl_util,,-g)
-#endif
-
-DependTarget()
diff --git a/xc/lib/PEX5/PEX.h b/xc/lib/PEX5/PEX.h
deleted file mode 100644
index 1f98e3c44..000000000
--- a/xc/lib/PEX5/PEX.h
+++ /dev/null
@@ -1,1222 +0,0 @@
-#ifndef _PEX_H_
-#define _PEX_H_
-
-/* $XConsortium: PEX.h,v 1.8 94/03/18 10:37:25 mor Exp $ */
-
-/******************************************************************************/
-/* Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Mass. */
-/* */
-/* (c) Copyright Hewlett-Packard Company, 1992, Fort Collins, Colorado */
-/* */
-/* All Rights Reserved */
-/* */
-/* Permission to use, copy, modify, and distribute 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 the copyright notices and this permission notice appear in */
-/* supporting documentation, and that the names of Digital or */
-/* Hewlett-Packard 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 */
-/* SOFTWARE, 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 software. */
-/* */
-/******************************************************************************/
-
-/*
- * PEX extension name
- */
-#define PEX_NAME_STRING "X3D-PEX"
-
-/*
- * PEX protocol major and minor numbers
- */
-#define PEX_PROTO_MAJOR 5 /* 5.1 protocol */
-#define PEX_PROTO_MINOR 1 /* 5.1 protocol */
-
-/*
- * PEX standard subsets
- */
-#define PEXCompleteImplementation 0
-#define PEXImmediateMode (1L<<0)
-#define PEXWorkstationOnly (1L<<1)
-#define PEXStructureMode (1L<<2)
-
-/*
- * enumerated type information
- */
-#define PEXETCounts 0
-#define PEXETIndex (1L<<0)
-#define PEXETMnemonic (1L<<1)
-#define PEXETAll (PEXETIndex | PEXETMnemonic)
-
-/* enumerated 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 PEXETColorType 15
-#define PEXETFloatFormat 16
-#define PEXETHLHSRMode 17
-#define PEXETPromptEchoType 18
-#define PEXETDisplayUpdateMode 19
-#define PEXETColorApproxType 20
-#define PEXETColorApproxModel 21
-#define PEXETGDP2D 22
-#define PEXETGDP 23
-#define PEXETGSE 24
-#define PEXETTrimCurveApproxMethod 25
-#define PEXETRenderingColorModel 26
-#define PEXETParaSurfCharacteristics 27
-#define PEXETEscape 28
-#define PEXETPickOneMethod 29
-#define PEXETPickAllMethod 30
-
-/* enumerated type values */
-
-/* marker types */
-#define PEXMarkerDot 1
-#define PEXMarkerCross 2
-#define PEXMarkerAsterisk 3
-#define PEXMarkerCircle 4
-#define PEXMarkerX 5
-
-/* marker type mnemonics */
-#define PEXETMMarkerDot "Dot"
-#define PEXETMMarkerCross "Cross"
-#define PEXETMMarkerAsterisk "Asterisk"
-#define PEXETMMarkerCircle "Circle"
-#define PEXETMMarkerX "X"
-
-/* annotation text styles */
-#define PEXATextNotConnected 1
-#define PEXATextConnected 2
-
-/* annotation text style mnemonics */
-#define PEXETMATextNotConnected "NotConnected"
-#define PEXETMATextConnected "Connected"
-
-/* interior styles */
-#define PEXInteriorStyleHollow 1
-#define PEXInteriorStyleSolid 2
-#define PEXInteriorStylePattern 3
-#define PEXInteriorStyleHatch 4
-#define PEXInteriorStyleEmpty 5
-
-/* interior style mnemonics */
-#define PEXETMInteriorStyleHollow "Hollow"
-#define PEXETMInteriorStyleSolid "Solid"
-#define PEXETMInteriorStylePattern "Pattern"
-#define PEXETMInteriorStyleHatch "Hatch"
-#define PEXETMInteriorStyleEmpty "Empty"
-
-/* hatch style */
-
-/* line types */
-#define PEXLineTypeSolid 1
-#define PEXLineTypeDashed 2
-#define PEXLineTypeDotted 3
-#define PEXLineTypeDashDot 4
-
-/* line type mnemonics */
-#define PEXETMLineTypeSolid "Solid"
-#define PEXETMLineTypeDashed "Dashed"
-#define PEXETMLineTypeDotted "Dotted"
-#define PEXETMLineTypeDashDot "DashDot"
-
-/* surface edge types */
-#define PEXSurfaceEdgeSolid 1
-#define PEXSurfaceEdgeDashed 2
-#define PEXSurfaceEdgeDotted 3
-#define PEXSurfaceEdgeDashDot 4
-
-/* surface edge type mnemonics */
-#define PEXETMSurfaceEdgeSolid "Solid"
-#define PEXETMSurfaceEdgeDashed "Dashed"
-#define PEXETMSurfaceEdgeDotted "Dotted"
-#define PEXETMSurfaceEdgeDashDot "DashDot"
-
-/* pick device types */
-#define PEXPickDeviceDCHitBox 1
-#define PEXPickDeviceNPCHitVolume 2
-
-/* pick device type mnemonics */
-#define PEXETMPickDeviceDCHitBox "DC_HitBox"
-#define PEXETMPickDeviceNPCHitVolume "NPC_HitVolume"
-
-/* polyline interpolation methods */
-#define PEXPolylineInterpNone 1
-#define PEXPolylineInterpColor 2
-
-/* polyline interpolation method mnemonics */
-#define PEXETMPolylineInterpNone "None"
-#define PEXETMPolylineInterpColor "Color"
-
-/* curve, surface and trim curve approximation methods */
-#define PEXApproxImpDep 1
-#define PEXApproxConstantBetweenKnots 2
-#define PEXApproxWCChordalSize 3
-#define PEXApproxNPCChordalSize 4
-#define PEXApproxDCChordalSize 5
-#define PEXCurveApproxWCChordalDev 6
-#define PEXCurveApproxNPCChordalDev 7
-#define PEXCurveApproxDCChordalDev 8
-#define PEXSurfaceApproxWCPlanarDev 6
-#define PEXSurfaceApproxNPCPlanarDev 7
-#define PEXSurfaceApproxDCPlanarDev 8
-#define PEXApproxWCRelative 9
-#define PEXApproxNPCRelative 10
-#define PEXApproxDCRelative 11
-
-/* curve, surface and trim curve approximation method mnemonics */
- /* PEXApproxImpDep is an implementation-dependent string */
-#define PEXETMApproxConstantBetweenKnots "ConstantBetweenKnots"
-#define PEXETMApproxWCChordalSize "WCS_ChordalSize"
-#define PEXETMApproxNPCChordalSize "NPC_ChordalSize"
-#define PEXETMApproxDCChordalSize "DC_ChordalSize"
-#define PEXETMCurveApproxWCChordalDev "WCS_ChordalDev"
-#define PEXETMCurveApproxNPCChordalDev "NPC_ChordalDev"
-#define PEXETMCurveApproxDCChordalDev "DC_ChordalDev"
-#define PEXETMSurfaceApproxWCPlanarDev "WCS_PlanarDev"
-#define PEXETMSurfaceApproxNPCPlanarDev "NPC_PlanarDev"
-#define PEXETMSurfaceApproxDCPlanarDev "DC_PlanarDev"
-#define PEXETMApproxWCRelative "WCS_Relative"
-#define PEXETMApproxNPCRelative "NPC_Relative"
-#define PEXETMApproxDCRelative "DC_Relative"
-
-/* reflection models */
-#define PEXReflectionNone 1
-#define PEXReflectionAmbient 2
-#define PEXReflectionDiffuse 3
-#define PEXReflectionSpecular 4
-
-/* reflection model mnemonics */
-#define PEXETMReflectionNone "NoShading"
-#define PEXETMReflectionAmbient "Ambient"
-#define PEXETMReflectionDiffuse "Diffuse"
-#define PEXETMReflectionSpecular "Specular"
-
-/* surface interpolation methods */
-#define PEXSurfaceInterpNone 1
-#define PEXSurfaceInterpColor 2
-#define PEXSurfaceInterpDotProduct 3
-#define PEXSurfaceInterpNormal 4
-
-/* surface interpolation method mnemonics */
-#define PEXETMSurfaceInterpNone "None"
-#define PEXETMSurfaceInterpColor "Color"
-#define PEXETMSurfaceInterpDotProduct "DotProduct"
-#define PEXETMSurfaceInterpNormal "Normal"
-
-/* model clip operators */
-#define PEXModelClipReplace 1
-#define PEXModelClipIntersection 2
-
-/* model clip operator mnemonics */
-#define PEXETMModelClipReplace "Replace"
-#define PEXETMModelClipIntersection "Intersection"
-
-/* light types */
-#define PEXLightAmbient 1
-#define PEXLightWCVector 2
-#define PEXLightWCPoint 3
-#define PEXLightWCSpot 4
-
-/* light type mnemonics */
-#define PEXETMLightAmbient "Ambient"
-#define PEXETMLightWCVector "WCS_Vector"
-#define PEXETMLightWCPoint "WCS_Point"
-#define PEXETMLightWCSpot "WCS_Spot"
-
-/* color types */
-#define PEXColorTypeIndexed 0
-#define PEXColorTypeRGB 1
-#define PEXColorTypeCIE 2
-#define PEXColorTypeHSV 3
-#define PEXColorTypeHLS 4
-#define PEXColorTypeRGB8 5
-#define PEXColorTypeRGB16 6
-
-/* color type mnemonics */
-#define PEXETMColorTypeIndexed "Indexed"
-#define PEXETMColorTypeRGB "RGBFloat"
-#define PEXETMColorTypeCIE "CIEFloat"
-#define PEXETMColorTypeHSV "HSVFloat"
-#define PEXETMColorTypeHLS "HLSFloat"
-#define PEXETMColorTypeRGB8 "RGBInt8"
-#define PEXETMColorTypeRGB16 "RGBInt16"
-
-/* float formats */
-#define PEXIEEE_754_32 1
-#define PEXDEC_F_Floating 2
-#define PEXIEEE_754_64 3
-#define PEXDEC_D_Floating 4
-
-/* float format mnemonics */
-#define PEXETMIEEE_754_32 "IEEE_754_32"
-#define PEXETMDEC_F_Floating "DEC_F_Floating"
-#define PEXETMIEEE_754_64 "IEEE_754_64"
-#define PEXETMDEC_D_Floating "DEC_D_Floating"
-
-/* HLHSR modes */
-#define PEXHLHSROff 1
-#define PEXHLHSRZBuffer 2
-#define PEXHLHSRPainters 3
-#define PEXHLHSRScanline 4
-#define PEXHLHSRHiddenLineOnly 5
-#define PEXHLHSRZBufferID 6
-
-/* HLHSR mode mnemonics */
-#define PEXETMHLHSROff "Off"
-#define PEXETMHLHSRZBuffer "ZBuffer"
-#define PEXETMHLHSRPainters "Painters"
-#define PEXETMHLHSRScanline "Scanline"
-#define PEXETMHLHSRHiddenLineOnly "HiddenLineOnly"
-#define PEXETMHLHSRZBufferID "ZBufferId"
-
-/* prompt echo types */
-#define PEXEchoPrimitive 1
-#define PEXEchoStructure 2
-#define PEXEchoNetwork 3
-
-/* prompt echo type mnemonics */
-#define PEXETMEchoPrimitive "EchoPrimitive"
-#define PEXETMEchoStructure "EchoStructure"
-#define PEXETMEchoNetwork "EchoNetwork"
-
-/* display update methods */
-#define PEXVisualizeEach 1
-#define PEXVisualizeEasy 2
-#define PEXVisualizeNone 3
-#define PEXSimulateSome 4
-#define PEXVisualizeWhenever 5
-
-/* display update method mnemonics */
-#define PEXETMVisualizeEach "VisualizeEach"
-#define PEXETMVisualizeEasy "VisualizeEasy"
-#define PEXETMVisualizeNone "VisualizeNone"
-#define PEXETMSimulateSome "SimulateSome"
-#define PEXETMVisualizeWhenever "VisualizeWhenever"
-
-/* color approximation types */
-#define PEXColorSpace 1
-#define PEXColorRange 2
-
-/* color approximation type mnemonics */
-#define PEXETMColorSpace "ColorSpace"
-#define PEXETMColorRange "ColorRange"
-
-/* color approximation models */
-#define PEXColorApproxRGB 1
-#define PEXColorApproxCIE 2
-#define PEXColorApproxHSV 3
-#define PEXColorApproxHLS 4
-#define PEXColorApproxYIQ 5
-
-/* color approximation model mnemonics */
-#define PEXETMColorApproxRGB "RGB"
-#define PEXETMColorApproxCIE "CIE"
-#define PEXETMColorApproxHSV "HSV"
-#define PEXETMColorApproxHLS "HLS"
-#define PEXETMColorApproxYIQ "YIQ"
-
-/* rendering color models */
-#define PEXRenderingColorModelImpDep 0
-#define PEXRenderingColorModelRGB 1
-#define PEXRenderingColorModelCIE 2
-#define PEXRenderingColorModelHSV 3
-#define PEXRenderingColorModelHLS 4
-
-/* rendering color model mnemonics */
- /* PEXETMRenderingColorModelImpDep is an implementation-dependent string */
-#define PEXETMRenderingColorModelRGB "RGB"
-#define PEXETMRenderingColorModelCIE "CIE"
-#define PEXETMRenderingColorModelHSV "HSV"
-#define PEXETMRenderingColorModelHLS "HLS"
-
-/* parametric surface characteristics */
-#define PEXPSCNone 1
-#define PEXPSCImpDep 2
-#define PEXPSCIsoCurves 3
-#define PEXPSCMCLevelCurves 4
-#define PEXPSCWCLevelCurves 5
-
-/* parametric surface characteristic mnemonics */
-#define PEXETMPSCNone "None"
- /* PEXETMPSCImpDep is an implementation-dependent string */
-#define PEXETMPSCIsoCurves "IsoparametricCurves"
-#define PEXETMPSCMCLevelCurves "MC_LevelCurves"
-#define PEXETMPSCWCLevelCurves "WC_LevelCurves"
-
-/* standard escape identifiers */
-#define PEXEscapeSetEchoColor 1
-
-/* standard escape identifier mnemonics */
-#define PEXETMEscapeSetEchoColor "SetEchoColor"
-
-/* pick one methods */
-#define PEXPickLast 1
-#define PEXPickClosestZ 2
-#define PEXPickVisibleAny 3
-#define PEXPickVisibleClosest 4
-
-/* pick one method mnemonics */
-#define PEXETMPickLast "Last"
-#define PEXETMPickClosestZ "ClosestZ"
-#define PEXETMPickVisibleAny "VisibleAny"
-#define PEXETMPickVisibleClosest "VisibleClosest"
-
-/* pick all methods */
-#define PEXPickAllAll 1
-#define PEXPickAllVisible 2
-
-/* pick all method mnemonics */
-#define PEXETMPickAllAll "All"
-#define PEXETMPickAllVisible "Visible"
-
-
-/*
- * implementation dependent constants
- */
-#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 PEXIDBestColorApprox 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
-#define PEXIDMaxHitsEventSupported 34
-
-/* values for PEXIDBestColorApprox */
-#define PEXColorApproxAnyValues 0
-#define PEXColorApproxPowersOf2 1
-
-/*
- * match rendering targets
- */
-#define PEXAnyDrawable 0
-#define PEXWindowDrawable 1
-#define PEXPixmapDrawable 2
-#define PEXBufferDrawable 3
-
-
-/*
- * output primitive and attribute values
- */
-
-/* shape hints */
-#define PEXShapeComplex 0
-#define PEXShapeNonConvex 1
-#define PEXShapeConvex 2
-#define PEXShapeUnknown 3
-
-/* contour hints */
-#define PEXContourDisjoint 0
-#define PEXContourNested 1
-#define PEXContourIntersecting 2
-#define PEXContourUnknown 3
-
-/* facet and vertex attributes bitmask */
-#define PEXGANone 0
-#define PEXGAColor (1L<<0)
-#define PEXGANormal (1L<<1)
-#define PEXGAEdges (1L<<2)
-
-/* flags (e.g., switches, visibility, and edges) */
-#define PEXOff 0
-#define PEXOn 1
-
-/* HLHSR identifier for PEXHLHSRZBufferID HLHSR mode */
-#define PEXHLHSRIDDisable 0
-#define PEXHLHSRIDEnable 1
-
-/* text path direction */
-#define PEXPathRight 0
-#define PEXPathLeft 1
-#define PEXPathUp 2
-#define PEXPathDown 3
-
-/* text vertical alignment */
-#define PEXVAlignNormal 0
-#define PEXVAlignTop 1
-#define PEXVAlignCap 2
-#define PEXVAlignHalf 3
-#define PEXVAlignBase 4
-#define PEXVAlignBottom 5
-
-/* text horizontal alignment */
-#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 width */
-#define PEXCSByte 0
-#define PEXCSShort 1
-#define PEXCSLong 2
-
-/* curve and surface types */
-#define PEXRational 0
-#define PEXNonRational 1
-
-/* clipping */
-#define PEXClipXY (1L<<0)
-#define PEXClipBack (1L<<1)
-#define PEXClipFront (1L<<2)
-#define PEXClippingAll (PEXClipXY | PEXClipBack | PEXClipFront)
-
-#define PEXClip 0
-#define PEXNoClip 1
-
-/* cull modes */
-#define PEXNone 0
-#define PEXBackFaces 1
-#define PEXFrontFaces 2
-
-/* local transform composition types */
-#define PEXPreConcatenate 0
-#define PEXPostConcatenate 1
-#define PEXReplace 2
-
-/* isoparametric curves placement types */
-#define PEXUniformPlacement 0
-#define PEXNonUniformPlacement 1
-
-/* aspect source flags (ASFs) */
-#define PEXBundled 0
-#define PEXIndividual 1
-
-/* mask values for setting ASFs */
-#define PEXASFMarkerType (1L<<0)
-#define PEXASFMarkerScale (1L<<1)
-#define PEXASFMarkerColor (1L<<2)
-#define PEXASFTextFontIndex (1L<<3)
-#define PEXASFTextPrec (1L<<4)
-#define PEXASFCharExpansion (1L<<5)
-#define PEXASFCharSpacing (1L<<6)
-#define PEXASFTextColor (1L<<7)
-#define PEXASFLineType (1L<<8)
-#define PEXASFLineWidth (1L<<9)
-#define PEXASFLineColor (1L<<10)
-#define PEXASFCurveApprox (1L<<11)
-#define PEXASFPolylineInterp (1L<<12)
-#define PEXASFInteriorStyle (1L<<13)
-#define PEXASFInteriorStyleIndex (1L<<14)
-#define PEXASFSurfaceColor (1L<<15)
-#define PEXASFSurfaceInterp (1L<<16)
-#define PEXASFReflectionModel (1L<<17)
-#define PEXASFReflectionAttr (1L<<18)
-#define PEXASFBFInteriorStyle (1L<<19)
-#define PEXASFBFInteriorStyleIndex (1L<<20)
-#define PEXASFBFSurfaceColor (1L<<21)
-#define PEXASFBFSurfaceInterp (1L<<22)
-#define PEXASFBFReflectionModel (1L<<23)
-#define PEXASFBFReflectionAttr (1L<<24)
-#define PEXASFSurfaceApprox (1L<<25)
-#define PEXASFSurfaceEdges (1L<<26)
-#define PEXASFSurfaceEdgeType (1L<<27)
-#define PEXASFSurfaceEdgeWidth (1L<<28)
-#define PEXASFSurfaceEdgeColor (1L<<29)
-
-
-/*
- * resource identifier value when resource is referenced, but freed
- */
-#define PEXAlreadyFreed 1
-
-
-/*
- * pipeline context
- */
-
-/* pipeline context attributes bitmask shift values */
-#define PEXPCMarkerType 0
-#define PEXPCMarkerScale 1
-#define PEXPCMarkerColor 2
-#define PEXPCMarkerBundleIndex 3
-#define PEXPCTextFont 4
-#define PEXPCTextPrecision 5
-#define PEXPCCharExpansion 6
-#define PEXPCCharSpacing 7
-#define PEXPCTextColor 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 PEXPCLineColor 21
-#define PEXPCCurveApprox 22
-#define PEXPCPolylineInterp 23
-#define PEXPCLineBundleIndex 24
-#define PEXPCInteriorStyle 25
-#define PEXPCInteriorStyleIndex 26
-#define PEXPCSurfaceColor 27
-#define PEXPCReflectionAttr 28
-#define PEXPCReflectionModel 29
-#define PEXPCSurfaceInterp 30
-#define PEXPCBFInteriorStyle 31
-
-#define PEXPCBFInteriorStyleIndex 32
-#define PEXPCBFSurfaceColor 33
-#define PEXPCBFReflectionAttr 34
-#define PEXPCBFReflectionModel 35
-#define PEXPCBFSurfaceInterp 36
-#define PEXPCSurfaceApprox 37
-#define PEXPCCullingMode 38
-#define PEXPCDistinguishFlag 39
-#define PEXPCPatternSize 40
-#define PEXPCPatternRefPoint 41
-#define PEXPCPatternRefVec1 42
-#define PEXPCPatternRefVec2 43
-#define PEXPCInteriorBundleIndex 44
-#define PEXPCSurfaceEdgeFlag 45
-#define PEXPCSurfaceEdgeType 46
-#define PEXPCSurfaceEdgeWidth 47
-#define PEXPCSurfaceEdgeColor 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 PEXPCASFValues 57
-#define PEXPCPickID 58
-#define PEXPCHLHSRIdentifier 59
-#define PEXPCNameSet 60
-#define PEXPCColorApproxIndex 61
-#define PEXPCRenderingColorModel 62
-#define PEXPCParaSurfCharacteristics 63
-#define PEXPCMaxShift 63
-
-
-/*
- * renderer and renderer picking
- */
-
-/* renderer state */
-#define PEXIdle 0
-#define PEXRendering 1
-#define PEXPicking 2
-
-/* renderer dynamics */
-#define PEXDynamic 0
-#define PEXNotDynamic 1
-
-/* renderer echo modes */
-#define PEXNoEcho 0
-#define PEXEcho 1
-#define PEXUnEcho 2
-
-/* renderer attributes bitmask */
-#define PEXRAPipelineContext (1L<<0)
-#define PEXRACurrentPath (1L<<1)
-#define PEXRAMarkerBundle (1L<<2)
-#define PEXRATextBundle (1L<<3)
-#define PEXRALineBundle (1L<<4)
-#define PEXRAInteriorBundle (1L<<5)
-#define PEXRAEdgeBundle (1L<<6)
-#define PEXRAViewTable (1L<<7)
-#define PEXRAColorTable (1L<<8)
-#define PEXRADepthCueTable (1L<<9)
-#define PEXRALightTable (1L<<10)
-#define PEXRAColorApproxTable (1L<<11)
-#define PEXRAPatternTable (1L<<12)
-#define PEXRATextFontTable (1L<<13)
-#define PEXRAHighlightIncl (1L<<14)
-#define PEXRAHighlightExcl (1L<<15)
-#define PEXRAInvisibilityIncl (1L<<16)
-#define PEXRAInvisibilityExcl (1L<<17)
-#define PEXRARendererState (1L<<18)
-#define PEXRAHLHSRMode (1L<<19)
-#define PEXRANPCSubVolume (1L<<20)
-#define PEXRAViewport (1L<<21)
-#define PEXRAClipList (1L<<22)
-#define PEXRAPickIncl (1L<<23)
-#define PEXRAPickExcl (1L<<24)
-#define PEXRAPickStartPath (1L<<25)
-#define PEXRABackgroundColor (1L<<26)
-#define PEXRAClearImage (1L<<27)
-#define PEXRAClearZ (1L<<28)
-#define PEXRAEchoMode (1L<<29)
-#define PEXRAMaxShift 29
-
-/* renderer dynamics bitmask */
-/* tables */
-#define PEXRDTMarkerBundle (1L<<0)
-#define PEXRDTTextBundle (1L<<1)
-#define PEXRDTLineBundle (1L<<2)
-#define PEXRDTInteriorBundle (1L<<3)
-#define PEXRDTEdgeBundle (1L<<4)
-#define PEXRDTViewTable (1L<<5)
-#define PEXRDTColorTable (1L<<6)
-#define PEXRDTDepthCueTable (1L<<7)
-#define PEXRDTLightTable (1L<<8)
-#define PEXRDTColorApproxTable (1L<<9)
-#define PEXRDTPatternTable (1L<<10)
-#define PEXRDTTextFontTable (1L<<11)
-#define PEXRDTMarkerBundleContents (1L<<16)
-#define PEXRDTTextBundleContents (1L<<17)
-#define PEXRDTLineBundleContents (1L<<18)
-#define PEXRDTInteriorBundleContents (1L<<19)
-#define PEXRDTEdgeBundleContents (1L<<20)
-#define PEXRDTViewTableContents (1L<<21)
-#define PEXRDTColorTableContents (1L<<22)
-#define PEXRDTDepthCueTableContents (1L<<23)
-#define PEXRDTLightTableContents (1L<<24)
-#define PEXRDTColorApproxContents (1L<<25)
-#define PEXRDTPatternTableContents (1L<<26)
-#define PEXRDTTextFontTableContents (1L<<27)
-/* name sets */
-#define PEXRDNHighlightNameSet (1L<<0)
-#define PEXRDNInvisibilityNameSet (1L<<1)
-#define PEXRDNPickNameSet (1L<<2)
-#define PEXRDNHighlightNameSetContents (1L<<16)
-#define PEXRDNInvisibilityNameSetContents (1L<<17)
-#define PEXRDNPickNameSetContents (1L<<18)
-/* attributes */
-#define PEXRDAHLHSRMode (1L<<0)
-#define PEXRDANPCSubVolume (1L<<1)
-#define PEXRDAViewport (1L<<2)
-#define PEXRDAClipList (1L<<3)
-#define PEXRDAEchoMode (1L<<4)
-
-/* renderer pick status */
-#define PEXNoPick 0
-#define PEXPick 1
-#define PEXAbortedPick 2
-
-
-/*
- * name set
- */
-
-/* name set changes */
-#define PEXNSAdd 0
-#define PEXNSRemove 1
-#define PEXNSReplace 2
-
-
-/*
- * look up table
- */
-
-/* table types */
-#define PEXLUTLineBundle 1
-#define PEXLUTMarkerBundle 2
-#define PEXLUTTextBundle 3
-#define PEXLUTInteriorBundle 4
-#define PEXLUTEdgeBundle 5
-#define PEXLUTPattern 6
-#define PEXLUTTextFont 7
-#define PEXLUTColor 8
-#define PEXLUTView 9
-#define PEXLUTLight 10
-#define PEXLUTDepthCue 11
-#define PEXLUTColorApprox 12
-
-/* status in PEXGetTableEntry */
-#define PEXDefaultEntry 0
-#define PEXDefinedEntry 1
-
-/* return type in PEXGetTableEntry and PEXGetTableEntries */
-#define PEXSetValue 0
-#define PEXRealizedValue 1
-
-
-/*
- * structure
- */
-
-/* structure editing mode */
-#define PEXStructureInsert 0
-#define PEXStructureReplace 1
-
-/* whence in structure element ranges */
-#define PEXBeginning 0
-#define PEXCurrent 1
-#define PEXEnd 2
-
-/* structure info */
-#define PEXElementPtr (1L<<0)
-#define PEXNumElements (1L<<1)
-#define PEXLengthStructure (1L<<2)
-#define PEXHasRefs (1L<<3)
-#define PEXEditMode (1L<<4)
-
-/* structures in network */
-#define PEXAll 0
-#define PEXOrphans 1
-
-/* ancestors and descendents*/
-#define PEXTopPart 0
-#define PEXBottomPart 1
-
-/* element search */
-#define PEXForward 0
-#define PEXBackward 1
-
-/* element info bitmask */
-#define PEXElementType (1L<<0)
-#define PEXElementSize (1L<<1)
-#define PEXElementData (1L<<2)
-
-
-/*
- * search context
- */
-
-/* element search status */
-#define PEXNotFound 1
-#define PEXFound 2
-
-/* search context attributes bitmask */
-#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)
-#define PEXSCMaxShift 6
-
-
-/*
- * PHIGS workstation
- */
-
-/* workstation update state */
-#define PEXNotPending 0
-#define PEXPending 1
-
-/* workstation visual state */
-#define PEXCorrect 0
-#define PEXDeferred 1
-#define PEXSimulated 2
-
-/* workstation display state */
-#define PEXEmpty 0
-#define PEXNotEmpty 1
-
-/* workstation buffer mode */
-#define PEXSingleBuffered 0
-#define PEXDoubleBuffered 1
-
-/* workstation dynamics */
-#define PEXIMM 0
-#define PEXIRG 1
-#define PEXCBS 2
-
-/* workstation structure posting priorities */
-#define PEXHigher 0
-#define PEXLower 1
-
-/* workstation attributes bitmask shift values */
-#define PEXPWDisplayUpdate 0
-#define PEXPWVisualState 1
-#define PEXPWDisplaySurface 2
-#define PEXPWViewUpdate 3
-#define PEXPWDefinedViews 4
-#define PEXPWWorkstationUpdate 5
-#define PEXPWReqNPCSubVolume 6
-#define PEXPWCurNPCSubVolume 7
-#define PEXPWReqViewport 8
-#define PEXPWCurViewport 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 PEXPWColorTable 19
-#define PEXPWDepthCueTable 20
-#define PEXPWLightTable 21
-#define PEXPWColorApproxTable 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 PEXPWMaxShift 33
-
-/* values for indices to returned workstation dynamics */
-#define PEXPWDViewRep 0
-#define PEXPWDMarkerBundle 1
-#define PEXPWDTextBundle 2
-#define PEXPWDLineBundle 3
-#define PEXPWDInteriorBundle 4
-#define PEXPWDEdgeBundle 5
-#define PEXPWDColorTable 6
-#define PEXPWDPatternTable 7
-#define PEXPWDWorkstationTransform 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 PEXPWDColorApproxTable 20
-
-
-/*
- * workstation picking
- */
-
-/* workstation pick status */
- /* PEXNoPick defined the same as for renderer pick */
- /* PEXPick defined the same as for renderer pick */
-
-/* pick echo modes */
- /* PEXNoEcho defined the same as for renderer echo */
- /* PEXEcho defined the same as for renderer echo */
-
-/* pick path order */
-#define PEXTopFirst 0
-#define PEXBottomFirst 1
-
-/* pick all, more hits flag */
-#define PEXMoreHits 0
-#define PEXNoMoreHits 1
-#define PEXMayBeMoreHits 2
-
-/* workstation pick device attributes bitmask */
-#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 PEXPDPromptEchoType (1L<<6)
-#define PEXPDEchoVolume (1L<<7)
-#define PEXPDEchoSwitch (1L<<8)
-#define PEXPDMaxShift 8
-
-/* workstation pick measure attributes bitmask */
-#define PEXPMStatus (1L<<0)
-#define PEXPMPath (1L<<1)
-#define PEXPMMaxShift 1
-
-/*
- * events
- */
-#define PEXMaxHitsReached 0
-#define PEXMaxEvent 0
-
-
-/*
- * errors
- */
-#define BadPEXColorType 0
-#define BadPEXRendererState 1
-#define BadPEXFloatingPointFormat 2
-#define BadPEXLabel 3
-#define BadPEXLookupTable 4
-#define BadPEXNameSet 5
-#define BadPEXPath 6
-#define BadPEXFont 7
-#define BadPEXWorkstation 8
-#define BadPEXPickMeasure 9
-#define BadPEXPipelineContext 10
-#define BadPEXRenderer 11
-#define BadPEXSearchContext 12
-#define BadPEXStructure 13
-#define BadPEXOutputCommand 14
-#define PEXMaxError 14
-
-
-/*
- * protocol output command codes
- */
-#define PEXOCAll 0
-#define PEXOCMarkerType 1
-#define PEXOCMarkerScale 2
-#define PEXOCMarkerColorIndex 3
-#define PEXOCMarkerColor 4
-#define PEXOCMarkerBundleIndex 5
-#define PEXOCTextFontIndex 6
-#define PEXOCTextPrecision 7
-#define PEXOCCharExpansion 8
-#define PEXOCCharSpacing 9
-#define PEXOCTextColorIndex 10
-#define PEXOCTextColor 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 PEXOCLineColorIndex 24
-#define PEXOCLineColor 25
-#define PEXOCCurveApprox 26
-#define PEXOCPolylineInterpMethod 27
-#define PEXOCLineBundleIndex 28
-#define PEXOCInteriorStyle 29
-#define PEXOCInteriorStyleIndex 30
-#define PEXOCSurfaceColorIndex 31
-#define PEXOCSurfaceColor 32
-#define PEXOCReflectionAttributes 33
-#define PEXOCReflectionModel 34
-#define PEXOCSurfaceInterpMethod 35
-#define PEXOCBFInteriorStyle 36
-#define PEXOCBFInteriorStyleIndex 37
-#define PEXOCBFSurfaceColorIndex 38
-#define PEXOCBFSurfaceColor 39
-#define PEXOCBFReflectionAttributes 40
-#define PEXOCBFReflectionModel 41
-#define PEXOCBFSurfaceInterpMethod 42
-#define PEXOCSurfaceApprox 43
-#define PEXOCFacetCullingMode 44
-#define PEXOCFacetDistinguishFlag 45
-#define PEXOCPatternSize 46
-#define PEXOCPatternAttributes2D 47
-#define PEXOCPatternAttributes 48
-#define PEXOCInteriorBundleIndex 49
-#define PEXOCSurfaceEdgeFlag 50
-#define PEXOCSurfaceEdgeType 51
-#define PEXOCSurfaceEdgeWidth 52
-#define PEXOCSurfaceEdgeColorIndex 53
-#define PEXOCSurfaceEdgeColor 54
-#define PEXOCEdgeBundleIndex 55
-#define PEXOCIndividualASF 56
-#define PEXOCLocalTransform 57
-#define PEXOCLocalTransform2D 58
-#define PEXOCGlobalTransform 59
-#define PEXOCGlobalTransform2D 60
-#define PEXOCModelClipFlag 61
-#define PEXOCModelClipVolume 62
-#define PEXOCModelClipVolume2D 63
-#define PEXOCRestoreModelClipVolume 64
-#define PEXOCViewIndex 65
-#define PEXOCLightSourceState 66
-#define PEXOCDepthCueIndex 67
-#define PEXOCPickID 68
-#define PEXOCHLHSRID 69
-#define PEXOCColorApproxIndex 70
-#define PEXOCRenderingColorModel 71
-#define PEXOCParaSurfCharacteristics 72
-#define PEXOCAddToNameSet 73
-#define PEXOCRemoveFromNameSet 74
-#define PEXOCExecuteStructure 75
-#define PEXOCLabel 76
-#define PEXOCApplicationData 77
-#define PEXOCGSE 78
-#define PEXOCMarkers 79
-#define PEXOCMarkers2D 80
-#define PEXOCText 81
-#define PEXOCText2D 82
-#define PEXOCAnnotationText 83
-#define PEXOCAnnotationText2D 84
-#define PEXOCPolyline 85
-#define PEXOCPolyline2D 86
-#define PEXOCPolylineSetWithData 87
-#define PEXOCNURBCurve 88
-#define PEXOCFillArea 89
-#define PEXOCFillArea2D 90
-#define PEXOCFillAreaWithData 91
-#define PEXOCFillAreaSet 92
-#define PEXOCFillAreaSet2D 93
-#define PEXOCFillAreaSetWithData 94
-#define PEXOCTriangleStrip 95
-#define PEXOCQuadrilateralMesh 96
-#define PEXOCSetOfFillAreaSets 97
-#define PEXOCNURBSurface 98
-#define PEXOCCellArray 99
-#define PEXOCCellArray2D 100
-#define PEXOCExtendedCellArray 101
-#define PEXOCGDP 102
-#define PEXOCGDP2D 103
-#define PEXOCNoop 104
-#define PEXOCNil 0xffff
-
-
-/*
- * protocol request codes
- */
-#define PEXRCGetExtensionInfo 1
-#define PEXRCGetEnumTypeInfo 2
-#define PEXRCGetImpDepConstants 3
-#define PEXRCCreateLookupTable 4
-#define PEXRCCopyLookupTable 5
-#define PEXRCFreeLookupTable 6
-#define PEXRCGetTableInfo 7
-#define PEXRCGetPredefinedEntries 8
-#define PEXRCGetDefinedIndices 9
-#define PEXRCGetTableEntry 10
-#define PEXRCGetTableEntries 11
-#define PEXRCSetTableEntries 12
-#define PEXRCDeleteTableEntries 13
-#define PEXRCCreatePipelineContext 14
-#define PEXRCCopyPipelineContext 15
-#define PEXRCFreePipelineContext 16
-#define PEXRCGetPipelineContext 17
-#define PEXRCChangePipelineContext 18
-#define PEXRCCreateRenderer 19
-#define PEXRCFreeRenderer 20
-#define PEXRCChangeRenderer 21
-#define PEXRCGetRendererAttributes 22
-#define PEXRCGetRendererDynamics 23
-#define PEXRCBeginRendering 24
-#define PEXRCEndRendering 25
-#define PEXRCBeginStructure 26
-#define PEXRCEndStructure 27
-#define PEXRCRenderOutputCommands 28
-#define PEXRCRenderNetwork 29
-#define PEXRCCreateStructure 30
-#define PEXRCCopyStructure 31
-#define PEXRCDestroyStructures 32
-#define PEXRCGetStructureInfo 33
-#define PEXRCGetElementInfo 34
-#define PEXRCGetStructuresInNetwork 35
-#define PEXRCGetAncestors 36
-#define PEXRCGetDescendants 37
-#define PEXRCFetchElements 38
-#define PEXRCSetEditingMode 39
-#define PEXRCSetElementPointer 40
-#define PEXRCSetElementPointerAtLabel 41
-#define PEXRCElementSearch 42
-#define PEXRCStoreElements 43
-#define PEXRCDeleteElements 44
-#define PEXRCDeleteElementsToLabel 45
-#define PEXRCDeleteBetweenLabels 46
-#define PEXRCCopyElements 47
-#define PEXRCChangeStructureRefs 48
-#define PEXRCCreateNameSet 49
-#define PEXRCCopyNameSet 50
-#define PEXRCFreeNameSet 51
-#define PEXRCGetNameSet 52
-#define PEXRCChangeNameSet 53
-#define PEXRCCreateSearchContext 54
-#define PEXRCCopySearchContext 55
-#define PEXRCFreeSearchContext 56
-#define PEXRCGetSearchContext 57
-#define PEXRCChangeSearchContext 58
-#define PEXRCSearchNetwork 59
-#define PEXRCCreateWorkstation 60
-#define PEXRCFreeWorkstation 61
-#define PEXRCGetWorkstationAttributes 62
-#define PEXRCGetWorkstationDynamics 63
-#define PEXRCGetWorkstationViewRep 64
-#define PEXRCRedrawAllStructures 65
-#define PEXRCUpdateWorkstation 66
-#define PEXRCRedrawClipRegion 67
-#define PEXRCExecuteDeferredActions 68
-#define PEXRCSetWorkstationViewPriority 69
-#define PEXRCSetWorkstationDisplayUpdateMode 70
-#define PEXRCMapDCtoWC 71
-#define PEXRCMapWCtoDC 72
-#define PEXRCSetWorkstationViewRep 73
-#define PEXRCSetWorkstationWindow 74
-#define PEXRCSetWorkstationViewport 75
-#define PEXRCSetWorkstationHLHSRMode 76
-#define PEXRCSetWorkstationBufferMode 77
-#define PEXRCPostStructure 78
-#define PEXRCUnpostStructure 79
-#define PEXRCUnpostAllStructures 80
-#define PEXRCGetWorkstationPostings 81
-#define PEXRCGetPickDevice 82
-#define PEXRCChangePickDevice 83
-#define PEXRCCreatePickMeasure 84
-#define PEXRCFreePickMeasure 85
-#define PEXRCGetPickMeasure 86
-#define PEXRCUpdatePickMeasure 87
-#define PEXRCLoadFont 88
-#define PEXRCUnloadFont 89
-#define PEXRCQueryFont 90
-#define PEXRCListFonts 91
-#define PEXRCListFontsWithInfo 92
-#define PEXRCQueryTextExtents 93
-#define PEXRCMatchRenderingTargets 94
-#define PEXRCEscape 95
-#define PEXRCEscapeWithReply 96
-#define PEXRCRenderElements 97
-#define PEXRCAccumulateState 98
-#define PEXRCBeginPickOne 99
-#define PEXRCEndPickOne 100
-#define PEXRCPickOne 101
-#define PEXRCBeginPickAll 102
-#define PEXRCEndPickAll 103
-#define PEXRCPickAll 104
-
-#endif /* _PEX_H_ */
diff --git a/xc/lib/PEX5/PEX5-def.cpp b/xc/lib/PEX5/PEX5-def.cpp
deleted file mode 100644
index af73ccd75..000000000
--- a/xc/lib/PEX5/PEX5-def.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-LIBRARY PEX5
-VERSION LIBRARY_VERSION
-EXPORTS
- PEXAccumulateState
- PEXAddToNameSet
- PEXAnnotationText
- PEXAnnotationText2D
- PEXApplicationData
- PEXBeginPickAll
- PEXBeginPickOne
- PEXBeginRendering
- PEXBeginStructure
- PEXBuildTransform
- PEXBuildTransform2D
- PEXCellArray
- PEXCellArray2D
- PEXChangeNameSet
- PEXChangePickDevice
- PEXChangePipelineContext
- PEXChangeRenderer
- PEXChangeSearchContext
- PEXChangeStructureRefs
- PEXCopyBytesToOC
- PEXCopyElements
- PEXCopyLookupTable
- PEXCopyNameSet
- PEXCopyPipelineContext
- PEXCopySearchContext
- PEXCopyStructure
- PEXCountOCs
- PEXCreateLookupTable
- PEXCreateNameSet
- PEXCreatePickMeasure
- PEXCreatePipelineContext
- PEXCreateRenderer
- PEXCreateSearchContext
- PEXCreateStructure
- PEXCreateWorkstation
- PEXDecodeOCs
- PEXDeleteBetweenLabels
- PEXDeleteElements
- PEXDeleteTableEntries
- PEXDeleteToLabel
- PEXDestroyStructures
- PEXElementSearch
- PEXEncodeOCs
- PEXEncodedAnnoText
- PEXEncodedAnnoText2D
- PEXEncodedText
- PEXEncodedText2D
- PEXEndPickAll
- PEXEndPickOne
- PEXEndRendering
- PEXEndStructure
- PEXEscape
- PEXEscapeWithReply
- PEXExecuteDeferredActions
- PEXExecuteStructure
- PEXExtendedCellArray
- PEXFetchElements
- PEXFetchElementsAndSend
- PEXFillArea
- PEXFillArea2D
- PEXFillAreaSet
- PEXFillAreaSet2D
- PEXFillAreaSetWithData
- PEXFillAreaWithData
- PEXFinishOCs
- PEXFreeEnumInfo
- PEXFreeFontInfo
- PEXFreeFontNames
- PEXFreeLookupTable
- PEXFreeNameSet
- PEXFreeOCData
- PEXFreePCAttributes
- PEXFreePDAttributes
- PEXFreePMAttributes
- PEXFreePickMeasure
- PEXFreePickPaths
- PEXFreePipelineContext
- PEXFreeRenderer
- PEXFreeRendererAttributes
- PEXFreeSCAttributes
- PEXFreeSearchContext
- PEXFreeStructurePaths
- PEXFreeTableEntries
- PEXFreeWorkstation
- PEXFreeWorkstationAttributes
- PEXGDP
- PEXGDP2D
- PEXGSE
- PEXGeoNormFillArea
- PEXGeoNormFillAreaSet
- PEXGeoNormQuadrilateralMesh
- PEXGeoNormSetOfFillAreaSets
- PEXGeoNormTriangleStrip
- PEXGetAncestors
- PEXGetDefinedIndices
- PEXGetDescendants
- PEXGetElementInfo
- PEXGetEnumTypeInfo
- PEXGetExtensionInfo
- PEXGetImpDepConstants
- PEXGetNameSet
- PEXGetOCAddr
- PEXGetPickDevice
- PEXGetPickMeasure
- PEXGetPipelineContext
- PEXGetPredefinedEntries
- PEXGetProtocolFloatFormat
- PEXGetRendererAttributes
- PEXGetRendererDynamics
- PEXGetSearchContext
- PEXGetSizeOCs
- PEXGetStructureInfo
- PEXGetStructuresInNetwork
- PEXGetTableEntries
- PEXGetTableEntry
- PEXGetTableInfo
- PEXGetWorkstationAttributes
- PEXGetWorkstationDynamics
- PEXGetWorkstationPostings
- PEXGetWorkstationViewRep
- PEXIdentityMatrix
- PEXIdentityMatrix2D
- PEXInitialize
- PEXInvertMatrix
- PEXInvertMatrix2D
- PEXLabel
- PEXListFonts
- PEXListFontsWithInfo
- PEXLoadFont
- PEXLookAtViewMatrix
- PEXMapDCToWC
- PEXMapWCToDC
- PEXMapXCToNPC
- PEXMapXCToNPC2D
- PEXMarkers
- PEXMarkers2D
- PEXMatchRenderingTargets
- PEXMatrixMult
- PEXMatrixMult2D
- PEXNPCToXCTransform
- PEXNPCToXCTransform2D
- PEXNURBCurve
- PEXNURBSurface
- PEXNoop
- PEXNormalizeVectors
- PEXNormalizeVectors2D
- PEXOrthoProjMatrix
- PEXPerspProjMatrix
- PEXPickAll
- PEXPickOne
- PEXPolarViewMatrix
- PEXPolyline
- PEXPolyline2D
- PEXPolylineSetWithData
- PEXPostStructure
- PEXQuadrilateralMesh
- PEXQueryEncodedTextExtents
- PEXQueryFont
- PEXQueryTextExtents
- PEXRedrawAllStructures
- PEXRedrawClipRegion
- PEXRemoveFromNameSet
- PEXRenderElements
- PEXRenderNetwork
- PEXRestoreModelClipVolume
- PEXRotate
- PEXRotate2D
- PEXRotateGeneral
- PEXScale
- PEXScale2D
- PEXSearchNetwork
- PEXSendOCs
- PEXSetATextAlignment
- PEXSetATextHeight
- PEXSetATextPath
- PEXSetATextStyle
- PEXSetATextUpVector
- PEXSetBFInteriorStyle
- PEXSetBFInteriorStyleIndex
- PEXSetBFReflectionAttributes
- PEXSetBFReflectionModel
- PEXSetBFSurfaceColor
- PEXSetBFSurfaceColorIndex
- PEXSetBFSurfaceInterpMethod
- PEXSetCharExpansion
- PEXSetCharHeight
- PEXSetCharSpacing
- PEXSetCharUpVector
- PEXSetColorApproxIndex
- PEXSetCurveApprox
- PEXSetDepthCueIndex
- PEXSetEchoColor
- PEXSetEdgeBundleIndex
- PEXSetEditingMode
- PEXSetElementPtr
- PEXSetElementPtrAtLabel
- PEXSetFacetCullingMode
- PEXSetFacetDistinguishFlag
- PEXSetGlobalTransform
- PEXSetGlobalTransform2D
- PEXSetHLHSRID
- PEXSetIndividualASF
- PEXSetInteriorBundleIndex
- PEXSetInteriorStyle
- PEXSetInteriorStyleIndex
- PEXSetLightSourceState
- PEXSetLineBundleIndex
- PEXSetLineColor
- PEXSetLineColorIndex
- PEXSetLineType
- PEXSetLineWidth
- PEXSetLocalTransform
- PEXSetLocalTransform2D
- PEXSetMarkerBundleIndex
- PEXSetMarkerColor
- PEXSetMarkerColorIndex
- PEXSetMarkerScale
- PEXSetMarkerType
- PEXSetModelClipFlag
- PEXSetModelClipVolume
- PEXSetModelClipVolume2D
- PEXSetOfFillAreaSets
- PEXSetParaSurfCharacteristics
- PEXSetPatternAttributes
- PEXSetPatternAttributes2D
- PEXSetPatternSize
- PEXSetPickID
- PEXSetPolylineInterpMethod
- PEXSetReflectionAttributes
- PEXSetReflectionModel
- PEXSetRenderingColorModel
- PEXSetSurfaceApprox
- PEXSetSurfaceColor
- PEXSetSurfaceColorIndex
- PEXSetSurfaceEdgeColor
- PEXSetSurfaceEdgeColorIndex
- PEXSetSurfaceEdgeFlag
- PEXSetSurfaceEdgeType
- PEXSetSurfaceEdgeWidth
- PEXSetSurfaceInterpMethod
- PEXSetTableEntries
- PEXSetTextAlignment
- PEXSetTextBundleIndex
- PEXSetTextColor
- PEXSetTextColorIndex
- PEXSetTextFontIndex
- PEXSetTextPath
- PEXSetTextPrecision
- PEXSetViewIndex
- PEXSetWorkstationBufferMode
- PEXSetWorkstationDisplayUpdateMode
- PEXSetWorkstationHLHSRMode
- PEXSetWorkstationViewPriority
- PEXSetWorkstationViewRep
- PEXSetWorkstationViewport
- PEXSetWorkstationWindow
- PEXStartOCs
- PEXText
- PEXText2D
- PEXTransformPoints
- PEXTransformPoints2D
- PEXTransformPoints2DH
- PEXTransformPoints4D
- PEXTransformVectors
- PEXTransformVectors2D
- PEXTranslate
- PEXTranslate2D
- PEXTriangleStrip
- PEXUnloadFont
- PEXUnpostAllStructures
- PEXUnpostStructure
- PEXUpdatePickMeasure
- PEXUpdateWorkstation
- PEXViewMappingMatrix
- PEXViewMappingMatrix2D
- PEXViewOrientationMatrix
- PEXViewOrientationMatrix2D
- PEXXCToNPCTransform
- PEXXCToNPCTransform2D
-/* $XConsortium: PEX5-def.cpp /main/2 1996/05/07 13:15:18 kaleb $ */
diff --git a/xc/lib/PEX5/PEX5os2.def b/xc/lib/PEX5/PEX5os2.def
deleted file mode 100644
index 6f2d74314..000000000
--- a/xc/lib/PEX5/PEX5os2.def
+++ /dev/null
@@ -1,429 +0,0 @@
-LIBRARY PEX5
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/PEX5/PEX5os2.def,v 3.6 1999/04/29 09:13:27 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 65536
-EXPORTS
- PEXAccumulateState @ 1
- PEXAddToNameSet @ 2
- PEXAnnotationText @ 3
- PEXAnnotationText2D @ 4
- PEXApplicationData @ 5
- PEXBeginPickAll @ 6
- PEXBeginPickOne @ 7
- PEXBeginRendering @ 8
- PEXBeginStructure @ 9
- PEXBuildTransform @ 10
- PEXBuildTransform2D @ 11
- PEXCellArray @ 12
- PEXCellArray2D @ 13
- PEXChangeNameSet @ 14
- PEXChangePickDevice @ 15
- PEXChangePipelineContext @ 16
- PEXChangeRenderer @ 17
- PEXChangeSearchContext @ 18
- PEXChangeStructureRefs @ 19
- PEXCopyBytesToOC @ 20
- PEXCopyElements @ 21
- PEXCopyLookupTable @ 22
- PEXCopyNameSet @ 23
- PEXCopyPipelineContext @ 24
- PEXCopySearchContext @ 25
- PEXCopyStructure @ 26
- PEXCountOCs @ 27
- PEXCreateLookupTable @ 28
- PEXCreateNameSet @ 29
- PEXCreatePickMeasure @ 30
- PEXCreatePipelineContext @ 31
- PEXCreateRenderer @ 32
- PEXCreateSearchContext @ 33
- PEXCreateStructure @ 34
- PEXCreateWorkstation @ 35
- PEXDecodeOCs @ 36
- PEXDeleteBetweenLabels @ 37
- PEXDeleteElements @ 38
- PEXDeleteTableEntries @ 39
- PEXDeleteToLabel @ 40
- PEXDestroyStructures @ 41
- PEXElementSearch @ 42
- PEXEncodeOCs @ 43
- PEXEncodedAnnoText @ 44
- PEXEncodedAnnoText2D @ 45
- PEXEncodedText @ 46
- PEXEncodedText2D @ 47
- PEXEndPickAll @ 48
- PEXEndPickOne @ 49
- PEXEndRendering @ 50
- PEXEndStructure @ 51
- PEXEscape @ 52
- PEXEscapeWithReply @ 53
- PEXExecuteDeferredActions @ 54
- PEXExecuteStructure @ 55
- PEXExtendedCellArray @ 56
- PEXFetchElements @ 57
- PEXFetchElementsAndSend @ 58
- PEXFillArea @ 59
- PEXFillArea2D @ 60
- PEXFillAreaSet @ 61
- PEXFillAreaSet2D @ 62
- PEXFillAreaSetWithData @ 63
- PEXFillAreaWithData @ 64
- PEXFinishOCs @ 65
- PEXFreeEnumInfo @ 66
- PEXFreeFontInfo @ 67
- PEXFreeFontNames @ 68
- PEXFreeLookupTable @ 69
- PEXFreeNameSet @ 70
- PEXFreeOCData @ 71
- PEXFreePCAttributes @ 72
- PEXFreePDAttributes @ 73
- PEXFreePMAttributes @ 74
- PEXFreePickMeasure @ 75
- PEXFreePickPaths @ 76
- PEXFreePipelineContext @ 77
- PEXFreeRenderer @ 78
- PEXFreeRendererAttributes @ 79
- PEXFreeSCAttributes @ 80
- PEXFreeSearchContext @ 81
- PEXFreeStructurePaths @ 82
- PEXFreeTableEntries @ 83
- PEXFreeWorkstation @ 84
- PEXFreeWorkstationAttributes @ 85
- PEXGDP @ 86
- PEXGDP2D @ 87
- PEXGSE @ 88
- PEXGeoNormFillArea @ 89
- PEXGeoNormFillAreaSet @ 90
- PEXGeoNormQuadrilateralMesh @ 91
- PEXGeoNormSetOfFillAreaSets @ 92
- PEXGeoNormTriangleStrip @ 93
- PEXGetAncestors @ 94
- PEXGetDefinedIndices @ 95
- PEXGetDescendants @ 96
- PEXGetElementInfo @ 97
- PEXGetEnumTypeInfo @ 98
- PEXGetExtensionInfo @ 99
- PEXGetImpDepConstants @ 100
- PEXGetNameSet @ 101
- PEXGetOCAddr @ 102
- PEXGetPickDevice @ 103
- PEXGetPickMeasure @ 104
- PEXGetPipelineContext @ 105
- PEXGetPredefinedEntries @ 106
- PEXGetProtocolFloatFormat @ 107
- PEXGetRendererAttributes @ 108
- PEXGetRendererDynamics @ 109
- PEXGetSearchContext @ 110
- PEXGetSizeOCs @ 111
- PEXGetStructureInfo @ 112
- PEXGetStructuresInNetwork @ 113
- PEXGetTableEntries @ 114
- PEXGetTableEntry @ 115
- PEXGetTableInfo @ 116
- PEXGetWorkstationAttributes @ 117
- PEXGetWorkstationDynamics @ 118
- PEXGetWorkstationPostings @ 119
- PEXGetWorkstationViewRep @ 120
- PEXIdentityMatrix @ 121
- PEXIdentityMatrix2D @ 122
- PEXInitialize @ 123
- PEXInvertMatrix @ 124
- PEXInvertMatrix2D @ 125
- PEXLabel @ 126
- PEXListFonts @ 127
- PEXListFontsWithInfo @ 128
- PEXLoadFont @ 129
- PEXLookAtViewMatrix @ 130
- PEXMapDCToWC @ 131
- PEXMapWCToDC @ 132
- PEXMapXCToNPC @ 133
- PEXMapXCToNPC2D @ 134
- PEXMarkers @ 135
- PEXMarkers2D @ 136
- PEXMatchRenderingTargets @ 137
- PEXMatrixMult @ 138
- PEXMatrixMult2D @ 139
- PEXNPCToXCTransform @ 140
- PEXNPCToXCTransform2D @ 141
- PEXNURBCurve @ 142
- PEXNURBSurface @ 143
- PEXNoop @ 144
- PEXNormalizeVectors @ 145
- PEXNormalizeVectors2D @ 146
- PEXOrthoProjMatrix @ 147
- PEXPerspProjMatrix @ 148
- PEXPickAll @ 149
- PEXPickOne @ 150
- PEXPolarViewMatrix @ 151
- PEXPolyline @ 152
- PEXPolyline2D @ 153
- PEXPolylineSetWithData @ 154
- PEXPostStructure @ 155
- PEXQuadrilateralMesh @ 156
- PEXQueryEncodedTextExtents @ 157
- PEXQueryFont @ 158
- PEXQueryTextExtents @ 159
- PEXRedrawAllStructures @ 160
- PEXRedrawClipRegion @ 161
- PEXRemoveFromNameSet @ 162
- PEXRenderElements @ 163
- PEXRenderNetwork @ 164
- PEXRestoreModelClipVolume @ 165
- PEXRotate @ 166
- PEXRotate2D @ 167
- PEXRotateGeneral @ 168
- PEXScale @ 169
- PEXScale2D @ 170
- PEXSearchNetwork @ 171
- PEXSendOCs @ 172
- PEXSetATextAlignment @ 173
- PEXSetATextHeight @ 174
- PEXSetATextPath @ 175
- PEXSetATextStyle @ 176
- PEXSetATextUpVector @ 177
- PEXSetBFInteriorStyle @ 178
- PEXSetBFInteriorStyleIndex @ 179
- PEXSetBFReflectionAttributes @ 180
- PEXSetBFReflectionModel @ 181
- PEXSetBFSurfaceColor @ 182
- PEXSetBFSurfaceColorIndex @ 183
- PEXSetBFSurfaceInterpMethod @ 184
- PEXSetCharExpansion @ 185
- PEXSetCharHeight @ 186
- PEXSetCharSpacing @ 187
- PEXSetCharUpVector @ 188
- PEXSetColorApproxIndex @ 189
- PEXSetCurveApprox @ 190
- PEXSetDepthCueIndex @ 191
- PEXSetEchoColor @ 192
- PEXSetEdgeBundleIndex @ 193
- PEXSetEditingMode @ 194
- PEXSetElementPtr @ 195
- PEXSetElementPtrAtLabel @ 196
- PEXSetFacetCullingMode @ 197
- PEXSetFacetDistinguishFlag @ 198
- PEXSetGlobalTransform @ 199
- PEXSetGlobalTransform2D @ 200
- PEXSetHLHSRID @ 201
- PEXSetIndividualASF @ 202
- PEXSetInteriorBundleIndex @ 203
- PEXSetInteriorStyle @ 204
- PEXSetInteriorStyleIndex @ 205
- PEXSetLightSourceState @ 206
- PEXSetLineBundleIndex @ 207
- PEXSetLineColor @ 208
- PEXSetLineColorIndex @ 209
- PEXSetLineType @ 210
- PEXSetLineWidth @ 211
- PEXSetLocalTransform @ 212
- PEXSetLocalTransform2D @ 213
- PEXSetMarkerBundleIndex @ 214
- PEXSetMarkerColor @ 215
- PEXSetMarkerColorIndex @ 216
- PEXSetMarkerScale @ 217
- PEXSetMarkerType @ 218
- PEXSetModelClipFlag @ 219
- PEXSetModelClipVolume @ 220
- PEXSetModelClipVolume2D @ 221
- PEXSetOfFillAreaSets @ 222
- PEXSetParaSurfCharacteristics @ 223
- PEXSetPatternAttributes @ 224
- PEXSetPatternAttributes2D @ 225
- PEXSetPatternSize @ 226
- PEXSetPickID @ 227
- PEXSetPolylineInterpMethod @ 228
- PEXSetReflectionAttributes @ 229
- PEXSetReflectionModel @ 230
- PEXSetRenderingColorModel @ 231
- PEXSetSurfaceApprox @ 232
- PEXSetSurfaceColor @ 233
- PEXSetSurfaceColorIndex @ 234
- PEXSetSurfaceEdgeColor @ 235
- PEXSetSurfaceEdgeColorIndex @ 236
- PEXSetSurfaceEdgeFlag @ 237
- PEXSetSurfaceEdgeType @ 238
- PEXSetSurfaceEdgeWidth @ 239
- PEXSetSurfaceInterpMethod @ 240
- PEXSetTableEntries @ 241
- PEXSetTextAlignment @ 242
- PEXSetTextBundleIndex @ 243
- PEXSetTextColor @ 244
- PEXSetTextColorIndex @ 245
- PEXSetTextFontIndex @ 246
- PEXSetTextPath @ 247
- PEXSetTextPrecision @ 248
- PEXSetViewIndex @ 249
- PEXSetWorkstationBufferMode @ 250
- PEXSetWorkstationDisplayUpdateMode @ 251
- PEXSetWorkstationHLHSRMode @ 252
- PEXSetWorkstationViewPriority @ 253
- PEXSetWorkstationViewRep @ 254
- PEXSetWorkstationViewport @ 255
- PEXSetWorkstationWindow @ 256
- PEXStartOCs @ 257
- PEXText @ 258
- PEXText2D @ 259
- PEXTransformPoints @ 260
- PEXTransformPoints2D @ 261
- PEXTransformPoints2DH @ 262
- PEXTransformPoints4D @ 263
- PEXTransformVectors @ 264
- PEXTransformVectors2D @ 265
- PEXTranslate @ 266
- PEXTranslate2D @ 267
- PEXTriangleStrip @ 268
- PEXUnloadFont @ 269
- PEXUnpostAllStructures @ 270
- PEXUnpostStructure @ 271
- PEXUpdatePickMeasure @ 272
- PEXUpdateWorkstation @ 273
- PEXViewMappingMatrix @ 274
- PEXViewMappingMatrix2D @ 275
- PEXViewOrientationMatrix @ 276
- PEXViewOrientationMatrix2D @ 277
- PEXXCToNPCTransform @ 278
- PEXXCToNPCTransform2D @ 279
- _PEXDecodeEnumType @ 280
- _PEXDecodeTableIndex @ 281
- _PEXDecodeColor @ 282
- _PEXDecodeFloat @ 283
- _PEXDecodeCARD16 @ 284
- _PEXDecodeVector2D @ 285
- _PEXDecodeTextAlignment @ 286
- _PEXDecodeCurveApprox @ 287
- _PEXDecodeReflectionAttr @ 288
- _PEXDecodeSurfaceApprox @ 289
- _PEXDecodeCullMode @ 290
- _PEXDecodeSwitch @ 291
- _PEXDecodePatternSize @ 292
- _PEXDecodePatternAttr2D @ 293
- _PEXDecodePatternAttr @ 294
- _PEXDecodeASF @ 295
- _PEXDecodeLocalTransform @ 296
- _PEXDecodeLocalTransform2D @ 297
- _PEXDecodeGlobalTransform @ 298
- _PEXDecodeGlobalTransform2D @ 299
- _PEXDecodeModelClipVolume @ 300
- _PEXDecodeModelClipVolume2D @ 301
- _PEXDecodeRestoreModelClip @ 302
- _PEXDecodeLightSourceState @ 303
- _PEXDecodeID @ 304
- _PEXDecodePSC @ 305
- _PEXDecodeNameSet @ 306
- _PEXDecodeExecuteStructure @ 307
- _PEXDecodeLabel @ 308
- _PEXDecodeApplicationData @ 309
- _PEXDecodeGSE @ 310
- _PEXDecodeMarkers @ 311
- _PEXDecodeMarkers2D @ 312
- _PEXDecodePolyline @ 313
- _PEXDecodePolyline2D @ 314
- _PEXDecodeText @ 315
- _PEXDecodeText2D @ 316
- _PEXDecodeAnnoText @ 317
- _PEXDecodeAnnoText2D @ 318
- _PEXDecodePolylineSet @ 319
- _PEXDecodeNURBCurve @ 320
- _PEXDecodeFillArea @ 321
- _PEXDecodeFillArea2D @ 322
- _PEXDecodeFillAreaWithData @ 323
- _PEXDecodeFillAreaSet @ 324
- _PEXDecodeFillAreaSet2D @ 325
- _PEXDecodeFillAreaSetWithData @ 326
- _PEXDecodeTriangleStrip @ 327
- _PEXDecodeQuadMesh @ 328
- _PEXDecodeSOFA @ 329
- _PEXDecodeNURBSurface @ 330
- _PEXDecodeCellArray @ 331
- _PEXDecodeCellArray2D @ 332
- _PEXDecodeExtendedCellArray @ 333
- _PEXDecodeGDP @ 334
- _PEXDecodeGDP2D @ 335
- _PEXDecodeNoop @ 336
- _PEXEncodeEnumType @ 337
- _PEXEncodeTableIndex @ 338
- _PEXEncodeColor @ 339
- _PEXEncodeFloat @ 340
- _PEXEncodeCARD16 @ 341
- _PEXEncodeVector2D @ 342
- _PEXEncodeTextAlignment @ 343
- _PEXEncodeCurveApprox @ 344
- _PEXEncodeReflectionAttr @ 345
- _PEXEncodeSurfaceApprox @ 346
- _PEXEncodeCullMode @ 347
- _PEXEncodeSwitch @ 348
- _PEXEncodePatternSize @ 349
- _PEXEncodePatternAttr2D @ 350
- _PEXEncodePatternAttr @ 351
- _PEXEncodeASF @ 352
- _PEXEncodeLocalTransform @ 353
- _PEXEncodeLocalTransform2D @ 354
- _PEXEncodeGlobalTransform @ 355
- _PEXEncodeGlobalTransform2D @ 356
- _PEXEncodeModelClipVolume @ 357
- _PEXEncodeModelClipVolume2D @ 358
- _PEXEncodeRestoreModelClip @ 359
- _PEXEncodeLightSourceState @ 360
- _PEXEncodeID @ 361
- _PEXEncodePSC @ 362
- _PEXEncodeNameSet @ 363
- _PEXEncodeExecuteStructure @ 364
- _PEXEncodeLabel @ 365
- _PEXEncodeApplicationData @ 366
- _PEXEncodeGSE @ 367
- _PEXEncodeMarkers @ 368
- _PEXEncodePolyline @ 369
- _PEXEncodeMarkers2D @ 370
- _PEXEncodePolyline2D @ 371
- _PEXEncodeText @ 372
- _PEXEncodeText2D @ 373
- _PEXEncodeAnnoText @ 374
- _PEXEncodeAnnoText2D @ 375
- _PEXEncodePolylineSet @ 376
- _PEXEncodeNURBCurve @ 377
- _PEXEncodeFillArea @ 378
- _PEXEncodeFillArea2D @ 379
- _PEXEncodeFillAreaWithData @ 380
- _PEXEncodeFillAreaSet @ 381
- _PEXEncodeFillAreaSet2D @ 382
- _PEXEncodeFillAreaSetWithData @ 383
- _PEXEncodeTriangleStrip @ 384
- _PEXEncodeQuadMesh @ 385
- _PEXEncodeSOFA @ 386
- _PEXEncodeNURBSurface @ 387
- _PEXEncodeCellArray @ 388
- _PEXEncodeCellArray2D @ 389
- _PEXEncodeExtendedCellArray @ 390
- _PEXEncodeGDP @ 391
- _PEXEncodeGDP2D @ 392
- _PEXEncodeNoop @ 393
- _PEXSendBytesToOC @ 394
- _PEXCopyPaddedBytesToOC @ 395
- _PEXGenOCBadLengthError @ 396
- _PEXConvertMaxHitsEvent @ 397
- _PEXConvertOCError @ 398
- _PEXPrintOCError @ 399
- _PEXCloseDisplay @ 400
- _PEXIEEE32toDECF @ 401
- _PEXDECFtoIEEE32 @ 402
- _PEXOCFacet @ 403
- _PEXOCListOfFacet @ 404
- _PEXOCListOfVertex @ 405
- _PEXOCListOfColor @ 406
- _PEXStoreFacet @ 407
- _PEXStoreListOfFacet @ 408
- _PEXStoreListOfVertex @ 409
- _PEXStoreListOfColor @ 410
- _PEXExtractFacet @ 411
- _PEXExtractListOfFacet @ 412
- _PEXExtractListOfVertex @ 413
- _PEXExtractListOfColor @ 414
- PEXDisplayInfoHeader @ 415
- PEXPickCache @ 416
- PEXPickCacheSize @ 417
- PEXPickCacheInUse @ 418
- PEX_encode_oc_funcs @ 419
- PEX_decode_oc_funcs @ 420
- PEX_fp_convert @ 421
diff --git a/xc/lib/PEX5/PEX5os2.rsp b/xc/lib/PEX5/PEX5os2.rsp
deleted file mode 100644
index ded21cd14..000000000
--- a/xc/lib/PEX5/PEX5os2.rsp
+++ /dev/null
@@ -1,6 +0,0 @@
-pl_convert.obj pl_escape.obj pl_font.obj pl_free.obj pl_lut.obj+
-pl_nameset.obj pl_oc_attr.obj pl_oc_dec.obj pl_oc_enc.obj pl_oc_prim.obj+
-pl_oc_str.obj pl_oc_util.obj pl_pc.obj pl_pick.obj pl_rdr.obj pl_sc.obj+
-pl_startup.obj pl_struct.obj pl_util.obj pl_wks.obj /NOI /NOL /NOD /BAT
-PEX5.dll
-PEX5.map
diff --git a/xc/lib/PEX5/PEXlib.h b/xc/lib/PEX5/PEXlib.h
deleted file mode 100644
index b3e110555..000000000
--- a/xc/lib/PEX5/PEXlib.h
+++ /dev/null
@@ -1,4426 +0,0 @@
-#ifndef _PEXLIB_H_
-#define _PEXLIB_H_
-
-/* $XConsortium: PEXlib.h,v 1.11 94/04/01 18:46:54 rws Exp $ */
-
-/******************************************************************************/
-/* Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Mass. */
-/* */
-/* (c) Copyright Hewlett-Packard Company, 1992, Fort Collins, Colorado */
-/* */
-/* All Rights Reserved */
-/* */
-/* Permission to use, copy, modify, and distribute 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 the copyright notices and this permission notice appear in */
-/* supporting documentation, and that the names of Digital or */
-/* Hewlett-Packard 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 */
-/* SOFTWARE, 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 software. */
-/* */
-/******************************************************************************/
-
-#include <X11/Xlib.h>
-#include <X11/PEX5/PEX.h>
-#include <X11/Xfuncproto.h>
-
-/*
- * floating point min and max values
- */
-#define PEXMinFloatIeee_754_32 1.40129846432481707e-45
-#define PEXMaxFloatIeee_754_32 3.40282346638528860e+38
-#define PEXMinFloatIeee_754_64 4.94065645841246544e-324
-#define PEXMaxFloatIeee_754_64 1.797693134862315708e+308
-
-/*
- * constants for PEXInitiliaze - failure return values and error string length
- */
-#define PEXBadExtension 1
-#define PEXBadProtocolVersion 2
-#define PEXBadFloatConversion 3
-#define PEXBadLocalAlloc 4
-
-#define PEXErrorStringLength 80
-
-
-/*
- * type definitions
- */
-typedef XID PEXFont;
-typedef XID PEXLookupTable;
-typedef XID PEXNameSet;
-typedef XID PEXPickMeasure;
-typedef XID PEXPipelineContext;
-typedef XID PEXRenderer;
-typedef XID PEXSearchContext;
-typedef XID PEXStructure;
-typedef XID PEXWorkstation;
-
-typedef unsigned long PEXBitmask;
-typedef unsigned short PEXBitmaskShort;
-typedef short PEXColorType;
-typedef unsigned char PEXContourHint;
-typedef unsigned short PEXCoordType;
-typedef short PEXComposition;
-typedef unsigned short PEXCullMode;
-typedef unsigned char PEXDynamicType;
-typedef short PEXEnumTypeIndex;
-typedef float PEXMatrix[4][4];
-typedef float PEXMatrix3x3[3][3];
-typedef unsigned long PEXName;
-typedef int PEXOCRequestType;
-typedef unsigned short PEXShapeHint;
-typedef unsigned char PEXSwitch;
-typedef unsigned short PEXTableIndex;
-typedef unsigned short PEXTypeOrTableIndex;
-
-#if NeedFunctionPrototypes
-typedef void *PEXPointer;
-#else
-typedef char *PEXPointer;
-#endif
-
-
-/*
- * PEX extension information
- */
-typedef struct {
- unsigned short major_version;
- unsigned short minor_version;
- unsigned long release;
- unsigned long subset_info;
- char *vendor_name;
- int major_opcode;
- int first_event;
- int first_error;
-} PEXExtensionInfo;
-
-/*
- * enumerated type information
- */
-typedef struct {
- PEXEnumTypeIndex index;
- char *descriptor; /* null terminated string */
-} PEXEnumTypeDesc;
-
-/*
- * implementation dependent constants
- */
-typedef union {
- unsigned long integer;
- float flt_point;
-} PEXImpDepConstant;
-
-/*
- * match rendering targets
- */
-typedef struct {
- int depth;
- int type;
- Visual *visual;
-} PEXRenderingTarget;
-
-
-/*
- * output primitive and attribute
- */
-
-/* output command request types */
-#define PEXOCRender 0
-#define PEXOCStore 1
-#define PEXOCRenderSingle 2
-#define PEXOCStoreSingle 3
-
-/* coordinates */
-typedef struct {
- float x;
- float y;
- float z;
-} PEXCoord;
-
-typedef struct {
- float x;
- float y;
-} PEXCoord2D;
-
-typedef struct {
- float x;
- float y;
- float z;
- float w;
-} PEXCoord4D;
-
-/* coordinate lists without data */
-typedef struct {
- unsigned long count; /* number of points */
- PEXCoord2D *points;
-} PEXListOfCoord2D; /* Pointer to an array of 2D points */
-
-typedef struct {
- unsigned long count; /* number of points */
- PEXCoord *points;
-} PEXListOfCoord; /* Pointer to an array of 3D points */
-
-typedef struct {
- unsigned long count; /* number of points */
- PEXCoord4D *points;
-} PEXListOfCoord4D; /* Pointer to an array of 4D points */
-
-typedef union {
- PEXCoord2D *point_2d;
- PEXCoord *point;
- PEXCoord4D *point_4d;
-} PEXArrayOfCoord; /* Pointer to array of points */
-
-/* colors */
-typedef struct {
- float red;
- float green;
- float blue;
-} PEXColorRGB;
-
-typedef struct {
- float hue;
- float saturation;
- float value;
-} PEXColorHSV;
-
-typedef struct {
- float hue;
- float lightness;
- float saturation;
-} PEXColorHLS;
-
-typedef struct {
- float x;
- float y;
- float z;
-} PEXColorCIE;
-
-typedef struct {
- unsigned char red;
- unsigned char green;
- unsigned char blue;
- unsigned char reserved;
-} PEXColorRGB8;
-
-typedef struct {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- unsigned short reserved;
-} PEXColorRGB16;
-
-typedef struct {
- PEXTableIndex index;
- unsigned short reserved;
-} PEXColorIndexed;
-
-typedef union {
- PEXColorIndexed indexed;
- PEXColorRGB rgb;
- PEXColorHSV hsv;
- PEXColorHLS hls;
- PEXColorCIE cie;
- PEXColorRGB8 rgb8;
- PEXColorRGB16 rgb16;
-} PEXColor;
-
-typedef union {
- PEXColorIndexed *indexed;
- PEXColorRGB *rgb;
- PEXColorHSV *hsv;
- PEXColorHLS *hls;
- PEXColorCIE *cie;
- PEXColorRGB8 *rgb8;
- PEXColorRGB16 *rgb16;
-} PEXArrayOfColor;
-
-/* vectors */
-typedef struct {
- float x;
- float y;
- float z;
-} PEXVector;
-
-typedef struct {
- float x;
- float y;
-} PEXVector2D;
-
-/* facet data */
-typedef struct {
- PEXColorIndexed index;
- PEXVector normal;
-} PEXColorIndexedNormal;
-
-typedef struct {
- PEXColorRGB rgb;
- PEXVector normal;
-} PEXColorRGBNormal;
-
-typedef struct {
- PEXColorCIE cie;
- PEXVector normal;
-} PEXColorCIENormal;
-
-typedef struct {
- PEXColorHSV hsv;
- PEXVector normal;
-} PEXColorHSVNormal;
-
-typedef struct {
- PEXColorHLS hls;
- PEXVector normal;
-} PEXColorHLSNormal;
-
-typedef struct {
- PEXColorRGB8 rgb8;
- PEXVector normal;
-} PEXColorRGB8Normal;
-
-typedef struct {
- PEXColorRGB16 rgb16;
- PEXVector normal;
-} PEXColorRGB16Normal;
-
-typedef union {
- PEXColorIndexed index;
- PEXColorRGB rgb;
- PEXColorHSV hsv;
- PEXColorHLS hls;
- PEXColorCIE cie;
- PEXColorRGB8 rgb8;
- PEXColorRGB16 rgb16;
- PEXVector normal;
- PEXColorIndexedNormal index_normal;
- PEXColorRGBNormal rgb_normal;
- PEXColorHSVNormal hsv_normal;
- PEXColorHLSNormal hls_normal;
- PEXColorCIENormal cie_normal;
- PEXColorRGB8Normal rgb8_normal;
- PEXColorRGB16Normal rgb16_normal;
-} PEXFacetData;
-
-typedef union {
- PEXColorIndexed *index;
- PEXColorRGB *rgb;
- PEXColorHSV *hsv;
- PEXColorHLS *hls;
- PEXColorCIE *cie;
- PEXColorRGB8 *rgb8;
- PEXColorRGB16 *rgb16;
- PEXVector *normal;
- PEXColorIndexedNormal *index_normal;
- PEXColorRGBNormal *rgb_normal;
- PEXColorCIENormal *cie_normal;
- PEXColorHSVNormal *hsv_normal;
- PEXColorHLSNormal *hls_normal;
- PEXColorRGB8Normal *rgb8_normal;
- PEXColorRGB16Normal *rgb16_normal;
-} PEXArrayOfFacetData;
-
-/* vertex data */
-typedef struct {
- PEXCoord point;
- PEXColorIndexed index;
-} PEXVertexIndexed;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB rgb;
-} PEXVertexRGB;
-
-typedef struct {
- PEXCoord point;
- PEXColorHSV hsv;
-} PEXVertexHSV;
-
-typedef struct {
- PEXCoord point;
- PEXColorHLS hls;
-} PEXVertexHLS;
-
-typedef struct {
- PEXCoord point;
- PEXColorCIE cie;
-} PEXVertexCIE;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB8 rgb8;
-} PEXVertexRGB8;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB16 rgb16;
-} PEXVertexRGB16;
-
-typedef struct {
- PEXCoord point;
- PEXVector normal;
-} PEXVertexNormal;
-
-typedef struct {
- PEXCoord point;
- unsigned int edge;
-} PEXVertexEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorIndexed index;
- PEXVector normal;
-} PEXVertexIndexedNormal;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB rgb;
- PEXVector normal;
-} PEXVertexRGBNormal;
-
-typedef struct {
- PEXCoord point;
- PEXColorHSV hsv;
- PEXVector normal;
-} PEXVertexHSVNormal;
-
-typedef struct {
- PEXCoord point;
- PEXColorHLS hls;
- PEXVector normal;
-} PEXVertexHLSNormal;
-
-typedef struct {
- PEXCoord point;
- PEXColorCIE cie;
- PEXVector normal;
-} PEXVertexCIENormal;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB8 rgb8;
- PEXVector normal;
-} PEXVertexRGB8Normal;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB16 rgb16;
- PEXVector normal;
-} PEXVertexRGB16Normal;
-
-typedef struct {
- PEXCoord point;
- PEXColorIndexed index;
- unsigned int edge;
-} PEXVertexIndexedEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB rgb;
- unsigned int edge;
-} PEXVertexRGBEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorHSV hsv;
- unsigned int edge;
-} PEXVertexHSVEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorHLS hls;
- unsigned int edge;
-} PEXVertexHLSEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorCIE cie;
- unsigned int edge;
-} PEXVertexCIEEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB8 rgb8;
- unsigned int edge;
-} PEXVertexRGB8Edge;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB16 rgb16;
- unsigned int edge;
-} PEXVertexRGB16Edge;
-
-typedef struct {
- PEXCoord point;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexNormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorIndexed index;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexIndexedNormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB rgb;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexRGBNormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorHSV hsv;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexHSVNormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorHLS hls;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexHLSNormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorCIE cie;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexCIENormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB8 rgb8;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexRGB8NormalEdge;
-
-typedef struct {
- PEXCoord point;
- PEXColorRGB16 rgb16;
- PEXVector normal;
- unsigned int edge;
-} PEXVertexRGB16NormalEdge;
-
-typedef union {
- PEXCoord *no_data;
- PEXVertexIndexed *index;
- PEXVertexRGB *rgb;
- PEXVertexHSV *hsv;
- PEXVertexHLS *hls;
- PEXVertexCIE *cie;
- PEXVertexRGB8 *rgb8;
- PEXVertexRGB16 *rgb16;
- PEXVertexNormal *normal;
- PEXVertexEdge *edge;
- PEXVertexIndexedNormal *index_normal;
- PEXVertexRGBNormal *rgb_normal;
- PEXVertexHSVNormal *hsv_normal;
- PEXVertexHLSNormal *hls_normal;
- PEXVertexCIENormal *cie_normal;
- PEXVertexRGB8Normal *rgb8_normal;
- PEXVertexRGB16Normal *rgb16_normal;
- PEXVertexIndexedEdge *index_edge;
- PEXVertexRGBEdge *rgb_edge;
- PEXVertexHSVEdge *hsv_edge;
- PEXVertexHLSEdge *hls_edge;
- PEXVertexCIEEdge *cie_edge;
- PEXVertexRGB8Edge *rgb8_edge;
- PEXVertexRGB16Edge *rgb16_edge;
- PEXVertexNormalEdge *normal_edge;
- PEXVertexIndexedNormalEdge *index_normal_edge;
- PEXVertexRGBNormalEdge *rgb_normal_edge;
- PEXVertexHSVNormalEdge *hsv_normal_edge;
- PEXVertexHLSNormalEdge *hls_normal_edge;
- PEXVertexCIENormalEdge *cie_normal_edge;
- PEXVertexRGB8NormalEdge *rgb8_normal_edge;
- PEXVertexRGB16NormalEdge *rgb16_normal_edge;
-} PEXArrayOfVertex;
-
-typedef struct {
- unsigned long count; /* number of vertices */
- PEXArrayOfVertex vertices; /* pointer to vertices */
-} PEXListOfVertex;
-
-/* connectivity list for set of fill area sets */
-typedef struct {
- unsigned short count; /* number of shorts */
- unsigned short *shorts;
-} PEXListOfUShort;
-
-typedef struct {
- unsigned short count; /* number of lists */
- PEXListOfUShort *lists;
-} PEXConnectivityData;
-
-/* encoded text */
-typedef struct {
- unsigned short character_set;
- unsigned char character_set_width;
- unsigned char encoding_state;
- unsigned short reserved;
- unsigned short length;
- char *ch;
-} PEXEncodedTextData;
-
-typedef struct {
- unsigned short count; /* number of encodings */
- PEXEncodedTextData *encoded_text;
-} PEXListOfEncodedText;
-
-/* trimming curves */
-typedef struct {
- unsigned short count; /* number of floats */
- float *floats;
-} PEXListOfFloat;
-
-typedef struct {
- PEXSwitch visibility;
- unsigned char reserved;
- unsigned short order;
- PEXCoordType rationality;
- PEXEnumTypeIndex approx_method;
- float tolerance;
- float tmin, tmax;
- PEXListOfFloat knots;
- unsigned short count; /* number of control points */
- PEXArrayOfCoord control_points;
-} PEXTrimCurve;
-
-typedef struct {
- unsigned short count; /* number of curves */
- PEXTrimCurve *curves;
-} PEXListOfTrimCurve;
-
-/* half spaces */
-typedef struct {
- PEXCoord point;
- PEXVector vector;
-} PEXHalfSpace;
-
-typedef struct {
- PEXCoord2D point;
- PEXVector2D vector;
-} PEXHalfSpace2D;
-
-/* parametric surface characteristics */
-typedef struct {
- unsigned short placement_type;
- unsigned short reserved;
- unsigned short u_count;
- unsigned short v_count;
-} PEXPSCIsoparametricCurves;
-
-typedef struct {
- PEXCoord origin;
- PEXVector direction;
- unsigned short count; /* number of parameters */
- unsigned short reserved;
- float *parameters;
-} PEXPSCLevelCurves;
-
-typedef struct {
- unsigned short length;
- char *data;
-} PEXPSCImpDepData;
-
-typedef union {
- PEXPSCIsoparametricCurves iso_curves;
- PEXPSCLevelCurves level_curves;
- PEXPSCImpDepData imp_dep;
-} PEXPSCData;
-
-
-/*
- * pipeline context
- */
-typedef struct {
- PEXColorType type;
- unsigned short reserved;
- PEXColor value;
-} PEXColorSpecifier;
-
-typedef struct {
- unsigned short vertical;
- unsigned short horizontal;
-} PEXTextAlignment;
-
-typedef struct {
- PEXEnumTypeIndex method;
- unsigned short reserved;
- float tolerance;
-} PEXCurveApprox;
-
-typedef struct {
- float ambient;
- float diffuse;
- float specular;
- float specular_conc;
- float transmission;
- PEXColorSpecifier specular_color;
-} PEXReflectionAttributes;
-
-typedef struct {
- PEXEnumTypeIndex method;
- unsigned short reserved;
- float u_tolerance;
- float v_tolerance;
-} PEXSurfaceApprox;
-
-typedef struct {
- unsigned short count; /* number of half spaces */
- PEXHalfSpace *half_spaces;
-} PEXModelClipVolume;
-
-typedef struct {
- unsigned short count; /* number of lights */
- PEXTableIndex *indices;
-} PEXListOfLight;
-
-typedef struct {
- short type;
- PEXPSCData psc;
-} PEXPSCSpecifier;
-
-typedef struct {
- PEXEnumTypeIndex marker_type;
- float marker_scale;
- PEXColorSpecifier marker_color;
- PEXTableIndex marker_bundle_index;
- PEXTableIndex text_font;
- unsigned short text_precision;
- float char_expansion;
- float char_spacing;
- PEXColorSpecifier text_color;
- float char_height;
- PEXVector2D char_up_vector;
- unsigned short text_path;
- PEXTextAlignment text_alignment;
- float atext_height;
- PEXVector2D atext_up_vector;
- unsigned short atext_path;
- PEXTextAlignment atext_alignment;
- PEXEnumTypeIndex atext_style;
- PEXTableIndex text_bundle_index;
- PEXEnumTypeIndex line_type;
- float line_width;
- PEXColorSpecifier line_color;
- PEXCurveApprox curve_approx;
- PEXEnumTypeIndex polyline_interp;
- PEXTableIndex line_bundle_index;
- PEXEnumTypeIndex interior_style;
- PEXTypeOrTableIndex interior_style_index;
- PEXColorSpecifier surface_color;
- PEXReflectionAttributes reflection_attr;
- PEXEnumTypeIndex reflection_model;
- PEXEnumTypeIndex surface_interp;
- PEXEnumTypeIndex bf_interior_style;
- PEXTypeOrTableIndex bf_interior_style_index;
- PEXColorSpecifier bf_surface_color;
- PEXReflectionAttributes bf_reflection_attr;
- PEXEnumTypeIndex bf_reflection_model;
- PEXEnumTypeIndex bf_surface_interp;
- PEXSurfaceApprox surface_approx;
- unsigned short culling_mode;
- Bool distinguish;
- PEXCoord2D pattern_size;
- PEXCoord pattern_ref_point;
- PEXVector pattern_ref_vec1;
- PEXVector pattern_ref_vec2;
- PEXTableIndex interior_bundle_index;
- PEXSwitch surface_edges;
- PEXEnumTypeIndex surface_edge_type;
- float surface_edge_width;
- PEXColorSpecifier surface_edge_color;
- PEXTableIndex edge_bundle_index;
- PEXMatrix local_transform;
- PEXMatrix global_transform;
- unsigned short model_clip;
- PEXModelClipVolume model_clip_volume;
- PEXTableIndex view_index;
- PEXListOfLight light_state;
- PEXTableIndex depth_cue_index;
- PEXBitmask asf_enables;
- PEXBitmask asf_values;
- long pick_id;
- unsigned long hlhsr_id;
- PEXNameSet name_set;
- PEXTableIndex color_approx_index;
- PEXEnumTypeIndex rendering_color_model;
- PEXPSCSpecifier para_surf_char;
-} PEXPCAttributes;
-
-/* macros for setting bits in a PC attribute bitmask */
-
-#define PEXSetPCAttributeMask(mask, attr) \
- mask[((attr)) >> 5] |= (unsigned long) 1 << ( ((attr)) & 0x1f)
-
-#define PEXSetPCAttributeMaskAll(mask) \
- mask[0] = 0xffffffff; \
- mask[1] = 0xffffffff; \
- mask[2] = 0x0
-
-
-/*
- * renderer
- */
-typedef struct {
- short xmin;
- short ymin;
- short xmax;
- short ymax;
-} PEXDeviceRect;
-
-typedef struct {
- unsigned short count; /* number of device rectangles */
- PEXDeviceRect *rectangles;
-} PEXListOfClipRect;
-
-typedef struct {
- PEXCoord min;
- PEXCoord max;
-} PEXNPCSubVolume;
-
-typedef struct {
- short x;
- short y;
- float z;
-} PEXDeviceCoord;
-
-typedef struct {
- short x;
- short y;
-} PEXDeviceCoord2D;
-
-typedef struct {
- PEXDeviceCoord min;
- PEXDeviceCoord max;
- PEXSwitch use_drawable;
- unsigned char reserved[3];
-} PEXViewport;
-
-typedef struct {
- PEXStructure structure;
- unsigned long offset;
-} PEXElementRef;
-
-typedef struct {
- unsigned long count; /* number of elements */
- PEXElementRef *elements;
-} PEXStructurePath;
-
-typedef struct {
- PEXStructure sid;
- unsigned long offset;
- unsigned long pick_id;
-} PEXPickElementRef;
-
-typedef struct {
- unsigned long count; /* number of elements */
- PEXPickElementRef *elements;
-} PEXPickPath;
-
-typedef struct {
- PEXPipelineContext pipeline_context;
- PEXStructurePath current_path;
- PEXLookupTable marker_bundle;
- PEXLookupTable text_bundle;
- PEXLookupTable line_bundle;
- PEXLookupTable interior_bundle;
- PEXLookupTable edge_bundle;
- PEXLookupTable view_table;
- PEXLookupTable color_table;
- PEXLookupTable depth_cue_table;
- PEXLookupTable light_table;
- PEXLookupTable color_approx_table;
- PEXLookupTable pattern_table;
- PEXLookupTable text_font_table;
- PEXNameSet highlight_incl;
- PEXNameSet highlight_excl;
- PEXNameSet invisibility_incl;
- PEXNameSet invisibility_excl;
- int renderer_state;
- PEXEnumTypeIndex hlhsr_mode;
- PEXNPCSubVolume npc_subvolume;
- PEXViewport viewport;
- PEXListOfClipRect clip_list;
- PEXNameSet pick_incl;
- PEXNameSet pick_excl;
- PEXStructurePath pick_start_path;
- PEXColorSpecifier background_color;
- Bool clear_image;
- Bool clear_z;
- int echo_mode;
-} PEXRendererAttributes;
-
-/* renderer picking */
-typedef PEXNPCSubVolume PEXPDNPCHitVolume;
-
-typedef struct {
- PEXDeviceCoord2D position;
- float distance;
-} PEXPDDCHitBox;
-
-typedef struct {
- unsigned short length; /* number of bytes in record */
- char *record;
-} PEXPickDataRecord;
-
-typedef union {
- PEXPDNPCHitVolume volume;
- PEXPDDCHitBox box;
- PEXPickDataRecord data;
-} PEXPickRecord;
-
-
-/*
- * name set
- */
-typedef struct {
- PEXNameSet inclusion;
- PEXNameSet exclusion;
-} PEXNameSetPair;
-
-typedef struct {
- unsigned short count; /* number of pairs */
- PEXNameSetPair *pairs;
-} PEXListOfNameSetPair;
-
-
-/*
- * font
- */
-typedef struct {
- Atom name;
- unsigned long value;
-} PEXFontProp;
-
-typedef struct {
- unsigned long first_glyph;
- unsigned long last_glyph;
- unsigned long default_glyph;
- Bool all_exist;
- Bool stroke;
- unsigned short count; /* number of properties */
- PEXFontProp *props;
-} PEXFontInfo;
-
-typedef struct {
- unsigned short length;
- char *ch;
-} PEXStringData;
-
-typedef struct {
- PEXCoord2D lower_left;
- PEXCoord2D upper_right;
- PEXCoord2D concat_point;
-} PEXTextExtent;
-
-
-/*
- * look up table
- */
-typedef struct {
- unsigned short definable_entries;
- unsigned short predefined_count;
- unsigned short predefined_min;
- unsigned short predefined_max;
-} PEXTableInfo;
-
-typedef struct {
- PEXEnumTypeIndex type;
- PEXEnumTypeIndex interp_method;
- PEXCurveApprox curve_approx;
- float width;
- PEXColorSpecifier color;
-} PEXLineBundleEntry;
-
-typedef struct {
- PEXEnumTypeIndex type;
- short reserved;
- float scale;
- PEXColorSpecifier color;
-} PEXMarkerBundleEntry;
-
-typedef struct {
- PEXTableIndex font_index;
- PEXEnumTypeIndex precision;
- float char_expansion;
- float char_spacing;
- PEXColorSpecifier color;
-} PEXTextBundleEntry;
-
-typedef struct {
- PEXEnumTypeIndex style;
- PEXTypeOrTableIndex style_index;
- PEXEnumTypeIndex reflection_model;
- PEXEnumTypeIndex interp_method;
- PEXEnumTypeIndex bf_style;
- PEXTypeOrTableIndex bf_style_index;
- PEXEnumTypeIndex bf_reflection_model;
- PEXEnumTypeIndex bf_interp_method;
- PEXSurfaceApprox surface_approx;
- PEXColorSpecifier color;
- PEXReflectionAttributes reflection_attr;
- PEXColorSpecifier bf_color;
- PEXReflectionAttributes bf_reflection_attr;
-} PEXInteriorBundleEntry;
-
-typedef struct {
- PEXSwitch edge_flag;
- unsigned char reserved;
- PEXEnumTypeIndex type;
- float width;
- PEXColorSpecifier color;
-} PEXEdgeBundleEntry;
-
-typedef struct {
- PEXColorType color_type;
- unsigned short row_count;
- unsigned short col_count;
- PEXArrayOfColor colors; /* pointer to 2D array of colors */
-} PEXPatternEntry;
-
-typedef PEXColorSpecifier PEXColorEntry;
-
-typedef struct {
- unsigned short count; /* number of fonts */
- PEXFont *fonts;
-} PEXTextFontEntry;
-
-typedef struct {
- PEXEnumTypeIndex type;
- unsigned short reserved;
- PEXVector direction;
- PEXCoord point;
- float concentration;
- float spread_angle;
- float attenuation1;
- float attenuation2;
- PEXColorSpecifier color;
-} PEXLightEntry;
-
-typedef struct {
- PEXSwitch mode;
- unsigned char reserved[3];
- float front_plane;
- float back_plane;
- float front_scaling;
- float back_scaling;
- PEXColorSpecifier color;
-} PEXDepthCueEntry;
-
-typedef struct {
- PEXEnumTypeIndex type;
- PEXEnumTypeIndex model;
- unsigned short max1;
- unsigned short max2;
- unsigned short max3;
- PEXSwitch dither;
- unsigned char reserved;
- unsigned long mult1;
- unsigned long mult2;
- unsigned long mult3;
- float weight1;
- float weight2;
- float weight3;
- unsigned long base_pixel;
-} PEXColorApproxEntry;
-
-typedef struct {
- unsigned short clip_flags;
- unsigned short reserved;
- PEXNPCSubVolume clip_limits;
- PEXMatrix orientation;
- PEXMatrix mapping;
-} PEXViewEntry;
-
-
-/*
- * structure
- */
-typedef struct {
- unsigned long element_count;
- unsigned long size;
- Bool has_refs;
- unsigned short edit_mode;
- unsigned long element_pointer;
-} PEXStructureInfo;
-
-typedef struct {
- unsigned short type;
- unsigned short length;
-} PEXElementInfo;
-
-
-/*
- * search context
- */
-typedef struct {
- PEXCoord position;
- float distance;
- unsigned short ceiling;
- Bool model_clip_flag;
- PEXStructurePath start_path;
- PEXListOfNameSetPair normal;
- PEXListOfNameSetPair inverted;
-} PEXSCAttributes;
-
-
-/*
- * PHIGS workstation
- */
-typedef struct {
- PEXTableIndex index;
- unsigned short reserved;
- PEXViewEntry view;
-} PEXViewRep;
-
-typedef struct {
- unsigned short count; /* number of views */
- PEXTableIndex *views;
-} PEXListOfView;
-
-typedef struct {
- PEXStructure sid;
- float priority;
-} PEXPostedStructure;
-
-typedef struct {
- unsigned long count; /* number of posted structures*/
- PEXPostedStructure *structures;
-} PEXListOfPostedStructure;
-
-typedef struct {
- short drawable_update;
- int visual_state;
- int drawable_surface;
- int view_update;
- PEXListOfView defined_views;
- int wks_update;
- PEXNPCSubVolume req_npc_subvolume;
- PEXNPCSubVolume cur_npc_subvolume;
- PEXViewport req_workstation_viewport;
- PEXViewport cur_workstation_viewport;
- int hlhsr_update;
- PEXEnumTypeIndex req_hlhsr_mode;
- PEXEnumTypeIndex cur_hlhsr_mode;
- Drawable drawable;
- PEXLookupTable marker_bundle;
- PEXLookupTable text_bundle;
- PEXLookupTable line_bundle;
- PEXLookupTable interior_bundle;
- PEXLookupTable edge_bundle;
- PEXLookupTable color_table;
- PEXLookupTable depth_cue_table;
- PEXLookupTable light_table;
- PEXLookupTable color_approx_table;
- PEXLookupTable pattern_table;
- PEXLookupTable text_font_table;
- PEXNameSet highlight_incl;
- PEXNameSet highlight_excl;
- PEXNameSet invisibility_incl;
- PEXNameSet invisibility_excl;
- PEXListOfPostedStructure posted_structures;
- unsigned long count_priorities;
- int buffer_update;
- int req_buffer_mode;
- int cur_buffer_mode;
-} PEXWorkstationAttributes;
-
-/* macros for setting bits in a workstation attribute bitmask */
-
-#define PEXSetPWAttributeMask(mask, attr) \
- mask[((attr)) >> 5] |= (unsigned long) 1 << ( ((attr)) & 0x1f)
-
-#define PEXSetPWAttributeMaskAll(mask) \
- mask[0] = 0xffffffff; \
- mask[1] = 0x00000003
-
-typedef struct {
- unsigned char view_rep;
- unsigned char marker_bundle;
- unsigned char text_bundle;
- unsigned char line_bundle;
- unsigned char interior_bundle;
- unsigned char edge_bundle;
- unsigned char color_table;
- unsigned char pattern_table;
- unsigned char wks_transform;
- unsigned char highlight_filter;
- unsigned char invisibility_filter;
- unsigned char hlhsr_mode;
- unsigned char structure_modify;
- unsigned char post_structure;
- unsigned char unpost_structure;
- unsigned char delete_structure;
- unsigned char reference_modify;
- unsigned char buffer_modify;
- unsigned char light_table;
- unsigned char depth_cue_table;
- unsigned char color_approx_table;
-} PEXWorkstationDynamics;
-
-
-/*
- * workstation picking
- */
-typedef struct {
- unsigned short status;
- PEXPickPath pick_path;
-} PEXPMAttributes;
-
-typedef struct {
- unsigned short status;
- PEXPickPath path;
- int path_order;
- PEXNameSet inclusion;
- PEXNameSet exclusion;
- PEXPickRecord pick_record;
- PEXEnumTypeIndex prompt_echo_type;
- PEXViewport echo_volume;
- int echo_switch;
-} PEXPDAttributes;
-
-
-/*
- * errors
- */
-/* similar to XErrorEvent - use to access additional info in OC error */
-typedef struct {
- int type;
- Display *display; /* Display the event was read from */
- XID resourceid; /* resource id of renderer or structure */
- unsigned long serial; /* serial number of failed request */
- unsigned char error_code; /* error code of failed request */
- unsigned char request_code; /* Major op-code of failed request */
- unsigned char minor_code; /* Minor op-code of failed request */
- unsigned short op_code; /* op-code of failed output command */
- unsigned short count; /* number of output commands successfully */
- /* executed before error */
-} PEXOCErrorEvent;
-
-
-/*
- * events
- */
-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 */
- PEXRenderer renderer;
-} PEXMaxHitsReachedEvent;
-
-
-/*
- * encode and decode
- */
-typedef struct {
- unsigned short oc_type;
- union {
- struct {
- unsigned long count;
- PEXName *names;
- } AddToNameSet;
- struct {
- int length;
- char *data;
- } ApplicationData;
- struct {
- PEXCoord point1;
- PEXCoord point2;
- PEXCoord point3;
- unsigned int col_count;
- unsigned int row_count;
- PEXTableIndex *color_indices;
- } CellArray;
- struct {
- PEXCoord2D point1;
- PEXCoord2D point2;
- unsigned int col_count;
- unsigned int row_count;
- PEXTableIndex *color_indices;
- } CellArray2D;
- struct {
- PEXCoord origin;
- PEXCoord offset;
- unsigned int count;
- PEXEncodedTextData *encoded_text;
- } EncodedAnnoText;
- struct {
- PEXCoord2D origin;
- PEXCoord2D offset;
- unsigned int count;
- PEXEncodedTextData *encoded_text;
- } EncodedAnnoText2D;
- struct {
- PEXCoord origin;
- PEXVector vector1;
- PEXVector vector2;
- unsigned int count;
- PEXEncodedTextData *encoded_text;
- } EncodedText;
- struct {
- PEXCoord2D origin;
- unsigned int count;
- PEXEncodedTextData *encoded_text;
- } EncodedText2D;
- struct {
- PEXStructure structure;
- } ExecuteStructure;
- struct {
- PEXCoord point1;
- PEXCoord point2;
- PEXCoord point3;
- unsigned int col_count;
- unsigned int row_count;
- int color_type;
- PEXArrayOfColor colors;
- } ExtendedCellArray;
- struct {
- int shape_hint;
- int ignore_edges;
- unsigned int count;
- PEXCoord *points;
- } FillArea;
- struct {
- int shape_hint;
- int ignore_edges;
- unsigned int count;
- PEXCoord2D *points;
- } FillArea2D;
- struct {
- int shape_hint;
- int ignore_edges;
- int contour_hint;
- unsigned int count;
- PEXListOfCoord *point_lists;
- } FillAreaSet;
- struct {
- int shape_hint;
- int ignore_edges;
- int contour_hint;
- unsigned int count;
- PEXListOfCoord2D *point_lists;
- } FillAreaSet2D;
- struct {
- int shape_hint;
- int ignore_edges;
- int contour_hint;
- unsigned int facet_attributes;
- unsigned int vertex_attributes;
- int color_type;
- unsigned int count;
- PEXFacetData facet_data;
- PEXListOfVertex *vertex_lists;
- } FillAreaSetWithData;
- struct {
- int shape_hint;
- int ignore_edges;
- unsigned int facet_attributes;
- unsigned int vertex_attributes;
- int color_type;
- PEXFacetData facet_data;
- unsigned int count;
- PEXArrayOfVertex vertices;
- } FillAreaWithData;
- struct {
- long gdp_id;
- unsigned int count;
- PEXCoord *points;
- unsigned long length;
- char *data;
- } GDP;
- struct {
- long gdp_id;
- unsigned int count;
- PEXCoord2D *points;
- unsigned long length;
- char *data;
- } GDP2D;
- struct {
- long id;
- int length;
- char *data;
- } GSE;
- struct {
- long label;
- } Label;
- struct {
- unsigned int count;
- PEXCoord *points;
- } Markers;
- struct {
- unsigned int count;
- PEXCoord2D *points;
- } Markers2D;
- struct {
- int rationality;
- int order;
- float *knots;
- unsigned int count;
- PEXArrayOfCoord points;
- double tmin;
- double tmax;
- } NURBCurve;
- struct {
- int rationality;
- int uorder;
- int vorder;
- float *uknots;
- float *vknots;
- unsigned int col_count;
- unsigned int row_count;
- PEXArrayOfCoord points;
- unsigned int curve_count;
- PEXListOfTrimCurve *trim_curves;
- } NURBSurface;
- struct {
- unsigned int count;
- PEXCoord *points;
- } Polyline;
- struct {
- unsigned int count;
- PEXCoord2D *points;
- } Polyline2D;
- struct {
- unsigned int vertex_attributes;
- int color_type;
- unsigned int count;
- PEXListOfVertex *vertex_lists;
- } PolylineSetWithData;
- struct {
- int shape_hint;
- unsigned int facet_attributes;
- unsigned int vertex_attributes;
- int color_type;
- PEXArrayOfFacetData facet_data;
- unsigned int col_count;
- unsigned int row_count;
- PEXArrayOfVertex vertices;
- } QuadrilateralMesh;
- struct {
- unsigned long count;
- PEXName *names;
- } RemoveFromNameSet;
- struct {
- int halignment;
- int valignment;
- } SetATextAlignment;
- struct {
- double height;
- } SetATextHeight;
- struct {
- int path;
- } SetATextPath;
- struct {
- int style;
- } SetATextStyle;
- struct {
- PEXVector2D vector;
- } SetATextUpVector;
- struct {
- int style;
- } SetBFInteriorStyle;
- struct {
- int index;
- } SetBFInteriorStyleIndex;
- struct {
- PEXReflectionAttributes attributes;
- } SetBFReflectionAttributes;
- struct {
- int model;
- } SetBFReflectionModel;
- struct {
- int color_type;
- PEXColor color;
- } SetBFSurfaceColor;
- struct {
- unsigned int index;
- } SetBFSurfaceColorIndex;
- struct {
- int method;
- } SetBFSurfaceInterpMethod;
- struct {
- double expansion;
- } SetCharExpansion;
- struct {
- double height;
- } SetCharHeight;
- struct {
- double spacing;
- } SetCharSpacing;
- struct {
- PEXVector2D vector;
- } SetCharUpVector;
- struct {
- unsigned int index;
- } SetColorApproxIndex;
- struct {
- int method;
- double tolerance;
- } SetCurveApprox;
- struct {
- unsigned int index;
- } SetDepthCueIndex;
- struct {
- unsigned int index;
- } SetEdgeBundleIndex;
- struct {
- int mode;
- } SetFacetCullingMode;
- struct {
- int flag;
- } SetFacetDistinguishFlag;
- struct {
- PEXMatrix transform;
- } SetGlobalTransform;
- struct {
- PEXMatrix3x3 transform;
- } SetGlobalTransform2D;
- struct {
- unsigned long hlhsr_id;
- } SetHLHSRID;
- struct {
- unsigned long attribute;
- int asf;
- } SetIndividualASF;
- struct {
- unsigned int index;
- } SetInteriorBundleIndex;
- struct {
- int style;
- } SetInteriorStyle;
- struct {
- int index;
- } SetInteriorStyleIndex;
- struct {
- unsigned int enable_count;
- PEXTableIndex *enable;
- unsigned int disable_count;
- PEXTableIndex *disable;
- } SetLightSourceState;
- struct {
- unsigned int index;
- } SetLineBundleIndex;
- struct {
- int color_type;
- PEXColor color;
- } SetLineColor;
- struct {
- unsigned int index;
- } SetLineColorIndex;
- struct {
- int line_type;
- } SetLineType;
- struct {
- double width;
- } SetLineWidth;
- struct {
- int composition;
- PEXMatrix transform;
- } SetLocalTransform;
- struct {
- int composition;
- PEXMatrix3x3 transform;
- } SetLocalTransform2D;
- struct {
- unsigned int index;
- } SetMarkerBundleIndex;
- struct {
- int color_type;
- PEXColor color;
- } SetMarkerColor;
- struct {
- unsigned int index;
- } SetMarkerColorIndex;
- struct {
- double scale;
- } SetMarkerScale;
- struct {
- int marker_type;
- } SetMarkerType;
- struct {
- int flag;
- } SetModelClipFlag;
- struct {
- int op;
- unsigned int count;
- PEXHalfSpace *half_spaces;
- } SetModelClipVolume;
- struct {
- int op;
- unsigned int count;
- PEXHalfSpace2D *half_spaces;
- } SetModelClipVolume2D;
- struct {
- int shape_hint;
- unsigned int facet_attributes;
- unsigned int vertex_attributes;
- unsigned int edge_attributes;
- int contour_hint;
- int contours_all_one;
- int color_type;
- unsigned int set_count;
- PEXArrayOfFacetData facet_data;
- unsigned int vertex_count;
- PEXArrayOfVertex vertices;
- unsigned int index_count;
- PEXSwitch *edge_flags;
- PEXConnectivityData *connectivity;
- } SetOfFillAreaSets;
- struct {
- int psc_type;
- PEXPSCData characteristics;
- } SetParaSurfCharacteristics;
- struct {
- PEXCoord ref_point;
- PEXVector vector1;
- PEXVector vector2;
- } SetPatternAttributes;
- struct {
- PEXCoord2D ref_point;
- } SetPatternAttributes2D;
- struct {
- double width;
- double height;
- } SetPatternSize;
- struct {
- unsigned long pick_id;
- } SetPickID;
- struct {
- int method;
- } SetPolylineInterpMethod;
- struct {
- PEXReflectionAttributes attributes;
- } SetReflectionAttributes;
- struct {
- int model;
- } SetReflectionModel;
- struct {
- int model;
- } SetRenderingColorModel;
- struct {
- int method;
- double utolerance;
- double vtolerance;
- } SetSurfaceApprox;
- struct {
- int color_type;
- PEXColor color;
- } SetSurfaceColor;
- struct {
- unsigned int index;
- } SetSurfaceColorIndex;
- struct {
- int color_type;
- PEXColor color;
- } SetSurfaceEdgeColor;
- struct {
- unsigned int index;
- } SetSurfaceEdgeColorIndex;
- struct {
- int flag;
- } SetSurfaceEdgeFlag;
- struct {
- int edge_type;
- } SetSurfaceEdgeType;
- struct {
- double width;
- } SetSurfaceEdgeWidth;
- struct {
- int method;
- } SetSurfaceInterpMethod;
- struct {
- int halignment;
- int valignment;
- } SetTextAlignment;
- struct {
- unsigned int index;
- } SetTextBundleIndex;
- struct {
- int color_type;
- PEXColor color;
- } SetTextColor;
- struct {
- unsigned int index;
- } SetTextColorIndex;
- struct {
- unsigned int index;
- } SetTextFontIndex;
- struct {
- int path;
- } SetTextPath;
- struct {
- int precision;
- } SetTextPrecision;
- struct {
- unsigned int index;
- } SetViewIndex;
- struct {
- unsigned int facet_attributes;
- unsigned int vertex_attributes;
- int color_type;
- PEXArrayOfFacetData facet_data;
- unsigned int count;
- PEXArrayOfVertex vertices;
- } TriangleStrip;
- } data;
-} PEXOCData;
-
-
-/*
- * encoded output commands
- */
-
-/* macro for inquiring max length for PEXGetOCAddr */
-
-#define PEXGetOCAddrMaxSize(_display) \
- ((_display)->bufmax - (_display)->buffer) /* this macro returns the */
- /* maximum allowable size (in */
- /* bytes) for PEXGetOCAddr */
- /* individual implementations */
- /* can modify the value, but */
- /* the minimum allowed is 1024*/
-
-
-/*
- * constants for utilities
- */
-
-/* constants for PEXRotate */
-#define PEXXAxis 1
-#define PEXYAxis 2
-#define PEXZAxis 3
-
-/* constants for utilities error return status */
-#define PEXBadVector 1
-#define PEXBadVectors 2
-#define PEXBadLimits 3
-#define PEXBadViewport 4
-#define PEXBadPlanes 5
-#define PEXBadPRP 6
-#define PEXBadMatrix 7
-#define PEXBadPrimitive 8
-#define PEXBadDistance 9
-#define PEXBadAxis 10
-#define PEXBadHomoCoord 11
-#define PEXBadSubVolume 12
-
-_XFUNCPROTOBEGIN
-
-/*
- * function declarations
- */
-
-extern void PEXAccumulateState(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- unsigned long /* count */,
- PEXElementRef * /* elements */
-#endif
-);
-
-extern void PEXAddToNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned long /* count */,
- PEXName * /* names */
-#endif
-);
-
-extern void PEXAnnotationText(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* origin */,
- PEXCoord * /* offset */,
- int /* length */,
- char * /* string */
-#endif
-);
-
-extern void PEXAnnotationText2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord2D * /* origin */,
- PEXCoord2D * /* offset */,
- int /* length */,
- char * /* string */
-#endif
-);
-
-extern void PEXApplicationData(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* length */,
- char * /* data */
-#endif
-);
-
-extern void PEXBeginPickAll(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXRenderer /* renderer */,
- long /* structure_id */,
- int /* method */,
- int /* send_event */,
- int /* max_hits */,
- int /* pick_device_type */,
- PEXPickRecord * /* pick_record */
-#endif
-);
-
-extern void PEXBeginPickOne(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXRenderer /* renderer */,
- long /* structure_id */,
- int /* method */,
- int /* pick_device_type */,
- PEXPickRecord * /* pick_record */
-#endif
-);
-
-extern void PEXBeginRendering(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXRenderer /* renderer */
-#endif
-);
-
-extern void PEXBeginStructure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- long /* structure_id */
-#endif
-);
-
-extern void PEXBuildTransform(
-#if NeedFunctionPrototypes
- PEXCoord * /* fixed_point */,
- PEXVector * /* trans_vector */,
- double /* angle_x */,
- double /* angle_y */,
- double /* angle_z */,
- PEXVector * /* scale_vector */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXBuildTransform2D(
-#if NeedFunctionPrototypes
- PEXCoord2D * /* fixed_point */,
- PEXVector2D * /* trans_vector */,
- double /* angle_z */,
- PEXVector2D * /* scale_vector */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern void PEXCellArray(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* point1 */,
- PEXCoord * /* point2 */,
- PEXCoord * /* point3 */,
- unsigned int /* col_count */,
- unsigned int /* row_count */,
- PEXTableIndex * /* color_indices */
-#endif
-);
-
-extern void PEXCellArray2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord2D * /* point1 */,
- PEXCoord2D * /* point2 */,
- unsigned int /* col_count */,
- unsigned int /* row_count */,
- PEXTableIndex * /* color_indices */
-#endif
-);
-
-extern void PEXChangeNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXNameSet /* nameset */,
- int /* action */,
- unsigned long /* count */,
- PEXName * /* names */
-#endif
-);
-
-extern void PEXChangePickDevice(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- int /* pick_device_type */,
- unsigned long /* value_mask */,
- PEXPDAttributes * /* values */
-#endif
-);
-
-extern void PEXChangePipelineContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXPipelineContext /* context */,
- unsigned long * /* value_mask */,
- PEXPCAttributes * /* values */
-#endif
-);
-
-extern void PEXChangeRenderer(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- unsigned long /* value_mask */,
- PEXRendererAttributes * /* values */
-#endif
-);
-
-extern void PEXChangeSearchContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXSearchContext /* context */,
- unsigned long /* value_mask */,
- PEXSCAttributes * /* values */
-#endif
-);
-
-extern void PEXChangeStructureRefs(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* old_structure */,
- PEXStructure /* new_structure */
-#endif
-);
-
-extern void PEXCopyBytesToOC(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* length */,
- char * /* data */
-#endif
-);
-
-extern void PEXCopyElements(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* src_structure */,
- int /* src_whence1 */,
- long /* src_offset1 */,
- int /* src_whence2 */,
- long /* src_offset2 */,
- PEXStructure /* dst_structure */,
- int /* dst_whence */,
- long /* dst_offset */
-#endif
-);
-
-extern void PEXCopyLookupTable(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* src_table */,
- PEXLookupTable /* dst_table */
-#endif
-);
-
-extern void PEXCopyNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXNameSet /* src_nameset */,
- PEXNameSet /* dst_nameset */
-#endif
-);
-
-extern void PEXCopyPipelineContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long * /* value_mask */,
- PEXPipelineContext /* src_context */,
- PEXPipelineContext /* dst_context */
-#endif
-);
-
-extern void PEXCopySearchContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* value_mask */,
- PEXSearchContext /* src_context */,
- PEXSearchContext /* dst_context */
-#endif
-);
-
-extern void PEXCopyStructure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* src_structure */,
- PEXStructure /* dst_structure */
-#endif
-);
-
-extern PEXLookupTable PEXCreateLookupTable(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- int /* table_type */
-#endif
-);
-
-extern PEXNameSet PEXCreateNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern PEXPickMeasure PEXCreatePickMeasure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- int /* pick_device_type */
-#endif
-);
-
-extern PEXPipelineContext PEXCreatePipelineContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long * /* value_mask */,
- PEXPCAttributes * /* values */
-#endif
-);
-
-extern PEXRenderer PEXCreateRenderer(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- unsigned long /* value_mask */,
- PEXRendererAttributes * /* values */
-#endif
-);
-
-extern PEXSearchContext PEXCreateSearchContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* value_mask */,
- PEXSCAttributes * /* values */
-#endif
-);
-
-extern PEXStructure PEXCreateStructure(
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern PEXWorkstation PEXCreateWorkstation(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXLookupTable /* line_bundle */,
- PEXLookupTable /* marker_bundle */,
- PEXLookupTable /* text_bundle */,
- PEXLookupTable /* interior_bundle */,
- PEXLookupTable /* edge_bundle */,
- PEXLookupTable /* color_table */,
- PEXLookupTable /* pattern_table */,
- PEXLookupTable /* font_table */,
- PEXLookupTable /* depth_cue_table */,
- PEXLookupTable /* light_table */,
- PEXLookupTable /* color_approx_table */,
- PEXNameSet /* highlight_incl */,
- PEXNameSet /* highlight_excl */,
- PEXNameSet /* invisibility_incl */,
- PEXNameSet /* invisibility_excl */,
- int /* buffer_mode */
-#endif
-);
-
-extern PEXOCData *PEXDecodeOCs(
-#if NeedFunctionPrototypes
- int /* float_format */,
- unsigned long /* oc_count */,
- unsigned long /* length */,
- char * /* encoded_ocs */
-#endif
-);
-
-extern void PEXDeleteBetweenLabels(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- long /* label1 */,
- long /* label2 */
-#endif
-);
-
-extern void PEXDeleteElements(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* whence1 */,
- long /* offset1 */,
- int /* whence2 */,
- long /* offset2 */
-#endif
-);
-
-extern void PEXDeleteTableEntries(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* table */,
- unsigned int /* start */,
- unsigned int /* count */
-#endif
-);
-
-extern void PEXDeleteToLabel(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* whence */,
- long /* offset */,
- long /* label */
-#endif
-);
-
-extern void PEXDestroyStructures(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* count */,
- PEXStructure * /* structures */
-#endif
-);
-
-extern Status PEXElementSearch(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* whence */,
- long /* offset */,
- int /* direction */,
- unsigned long /* incl_count */,
- unsigned short * /* incl_list */,
- unsigned long /* excl_count */,
- unsigned short * /* excl_list */,
- unsigned long * /* elem_offset_return */
-#endif
-);
-
-extern char *PEXEncodeOCs(
-#if NeedFunctionPrototypes
- int /* float_format */,
- unsigned long /* oc_count */,
- PEXOCData * /* oc_data */,
- unsigned long * /* length_return */
-#endif
-);
-
-extern void PEXEncodedAnnoText(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* origin */,
- PEXCoord * /* offset */,
- unsigned int /* count */,
- PEXEncodedTextData * /* encoded_text */
-#endif
-);
-
-extern void PEXEncodedAnnoText2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord2D * /* origin */,
- PEXCoord2D * /* offset */,
- unsigned int /* count */,
- PEXEncodedTextData * /* encoded_text */
-#endif
-);
-
-extern void PEXEncodedText(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* origin */,
- PEXVector * /* vector1 */,
- PEXVector * /* vector2 */,
- unsigned int /* count */,
- PEXEncodedTextData * /* encoded_text */
-#endif
-);
-
-extern void PEXEncodedText2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord2D * /* origin */,
- unsigned int /* count */,
- PEXEncodedTextData * /* encoded_text */
-#endif
-);
-
-extern PEXPickPath *PEXEndPickAll(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- int * /* status_return */,
- int * /* more_return */,
- unsigned long * /* count_return */
-#endif
-);
-
-extern PEXPickPath *PEXEndPickOne(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- int * /* status_return */,
- int * /* undetectable_return */
-#endif
-);
-
-extern void PEXEndRendering(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- int /* flush */
-#endif
-);
-
-extern void PEXEndStructure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */
-#endif
-);
-
-extern void PEXEscape(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* escape_id */,
- int /* length */,
- char * /* escape_data */
-#endif
-);
-
-extern char *PEXEscapeWithReply(
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* escape_id */,
- int /* length */,
- char * /* escape_data */,
- unsigned long * /* reply_length_return */
-#endif
-);
-
-extern void PEXExecuteDeferredActions(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */
-#endif
-);
-
-extern void PEXExecuteStructure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXStructure /* structure */
-#endif
-);
-
-extern void PEXExtendedCellArray(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* point1 */,
- PEXCoord * /* point2 */,
- PEXCoord * /* point3 */,
- unsigned int /* col_count */,
- unsigned int /* row_count */,
- int /* color_type */,
- PEXArrayOfColor /* colors */
-#endif
-);
-
-extern Status PEXFetchElements(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* whence1 */,
- long /* offset1 */,
- int /* whence2 */,
- long /* offset2 */,
- int /* float_format */,
- unsigned long * /* count_return */,
- unsigned long * /* length_return */,
- char ** /* ocs_return */
-#endif
-);
-
-extern Status PEXFetchElementsAndSend(
-#if NeedFunctionPrototypes
- Display * /* src_display */,
- PEXStructure /* structure */,
- int /* whence1 */,
- long /* offset1 */,
- int /* whence2 */,
- long /* offset2 */,
- Display * /* dst_display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */
-#endif
-);
-
-extern void PEXFillArea(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- int /* ignore_edges */,
- unsigned int /* count */,
- PEXCoord * /* points */
-#endif
-);
-
-extern void PEXFillArea2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- int /* ignore_edges */,
- unsigned int /* count */,
- PEXCoord2D * /* points */
-#endif
-);
-
-extern void PEXFillAreaSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- int /* ignore_edges */,
- int /* contour_hint */,
- unsigned int /* count */,
- PEXListOfCoord * /* point_lists */
-#endif
-);
-
-extern void PEXFillAreaSet2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- int /* ignore_edges */,
- int /* contour_hint */,
- unsigned int /* count */,
- PEXListOfCoord2D * /* point_lists */
-#endif
-);
-
-extern void PEXFillAreaSetWithData(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- int /* ignore_edges */,
- int /* contour_hint */,
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- unsigned int /* count */,
- PEXFacetData * /* facet_data */,
- PEXListOfVertex * /* vertex_lists */
-#endif
-);
-
-extern void PEXFillAreaWithData(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- int /* ignore_edges */,
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- PEXFacetData * /* facet_data */,
- unsigned int /* count */,
- PEXArrayOfVertex /* vertices */
-#endif
-);
-
-extern void PEXFinishOCs(
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern void PEXFreeEnumInfo(
-#if NeedFunctionPrototypes
- unsigned long /* count */,
- unsigned long * /* info_count */,
- PEXEnumTypeDesc * /* enum_info */
-#endif
-);
-
-extern void PEXFreeFontInfo(
-#if NeedFunctionPrototypes
- unsigned long /* count */,
- PEXFontInfo * /* font_info */
-#endif
-);
-
-extern void PEXFreeFontNames(
-#if NeedFunctionPrototypes
- unsigned long /* count */,
- char ** /* font_names */
-#endif
-);
-
-extern void PEXFreeLookupTable(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* table */
-#endif
-);
-
-extern void PEXFreeNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXNameSet /* nameset */
-#endif
-);
-
-extern void PEXFreeOCData(
-#if NeedFunctionPrototypes
- unsigned long /* count */,
- PEXOCData * /* oc_data */
-#endif
-);
-
-extern void PEXFreePCAttributes(
-#if NeedFunctionPrototypes
- PEXPCAttributes * /* values */
-#endif
-);
-
-extern void PEXFreePDAttributes(
-#if NeedFunctionPrototypes
- PEXPDAttributes * /* values */
-#endif
-);
-
-extern void PEXFreePMAttributes(
-#if NeedFunctionPrototypes
- PEXPMAttributes * /* values */
-#endif
-);
-
-extern void PEXFreePickMeasure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXPickMeasure /* pick_measure */
-#endif
-);
-
-extern void PEXFreePickPaths(
-#if NeedFunctionPrototypes
- unsigned long /* count */,
- PEXPickPath * /* pick_paths */
-#endif
-);
-
-extern void PEXFreePipelineContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXPipelineContext /* context */
-#endif
-);
-
-extern void PEXFreeRenderer(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */
-#endif
-);
-
-extern void PEXFreeRendererAttributes(
-#if NeedFunctionPrototypes
- PEXRendererAttributes * /* values */
-#endif
-);
-
-extern void PEXFreeSCAttributes(
-#if NeedFunctionPrototypes
- PEXSCAttributes * /* values */
-#endif
-);
-
-extern void PEXFreeSearchContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXSearchContext /* context */
-#endif
-);
-
-extern void PEXFreeStructurePaths(
-#if NeedFunctionPrototypes
- unsigned long /* count */,
- PEXStructurePath * /* paths */
-#endif
-);
-
-extern void PEXFreeTableEntries(
-#if NeedFunctionPrototypes
- int /* table_type */,
- unsigned int /* count */,
- PEXPointer /* entries */
-#endif
-);
-
-extern void PEXFreeWorkstation(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */
-#endif
-);
-
-extern void PEXFreeWorkstationAttributes(
-#if NeedFunctionPrototypes
- PEXWorkstationAttributes * /* values */
-#endif
-);
-
-extern void PEXGDP(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- long /* gdp_id */,
- unsigned int /* count */,
- PEXCoord * /* points */,
- unsigned long /* length */,
- char * /* data */
-#endif
-);
-
-extern void PEXGDP2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- long /* gdp_id */,
- unsigned int /* count */,
- PEXCoord2D * /* points */,
- unsigned long /* length */,
- char * /* data */
-#endif
-);
-
-extern void PEXGSE(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- long /* id */,
- int /* length */,
- char * /* data */
-#endif
-);
-
-extern int PEXGeoNormFillArea(
-#if NeedFunctionPrototypes
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- PEXFacetData * /* facet_data */,
- unsigned int /* count */,
- PEXArrayOfVertex /* vertices */
-#endif
-);
-
-extern int PEXGeoNormFillAreaSet(
-#if NeedFunctionPrototypes
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- unsigned int /* count */,
- PEXFacetData * /* facet_data */,
- PEXListOfVertex * /* vertex_lists */
-#endif
-);
-
-extern int PEXGeoNormQuadrilateralMesh(
-#if NeedFunctionPrototypes
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- PEXArrayOfFacetData /* facet_data */,
- unsigned int /* col_count */,
- unsigned int /* row_count */,
- PEXArrayOfVertex /* vertices */
-#endif
-);
-
-extern int PEXGeoNormSetOfFillAreaSets(
-#if NeedFunctionPrototypes
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- unsigned int /* set_count */,
- PEXArrayOfFacetData /* facet_data */,
- unsigned int /* vertex_count */,
- PEXArrayOfVertex /* vertices */,
- unsigned int /* index_count */,
- PEXConnectivityData * /* connectivity */
-#endif
-);
-
-extern int PEXGeoNormTriangleStrip(
-#if NeedFunctionPrototypes
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- PEXArrayOfFacetData /* facet_data */,
- unsigned int /* count */,
- PEXArrayOfVertex /* vertices */
-#endif
-);
-
-extern PEXStructurePath *PEXGetAncestors(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* path_part */,
- unsigned long /* path_depth */,
- unsigned long * /* count_return */
-#endif
-);
-
-extern Status PEXGetDefinedIndices(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* table */,
- unsigned long * /* count_return */,
- PEXTableIndex ** /* indices_return */
-#endif
-);
-
-extern PEXStructurePath *PEXGetDescendants(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* path_part */,
- unsigned long /* path_depth */,
- unsigned long * /* count_return */
-#endif
-);
-
-extern Status PEXGetElementInfo(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* whence1 */,
- long /* offset1 */,
- int /* whence2 */,
- long /* offset2 */,
- int /* float_format */,
- unsigned long * /* count_return */,
- PEXElementInfo ** /* info_return */
-#endif
-);
-
-extern Status PEXGetEnumTypeInfo(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- unsigned long /* count */,
- int * /* enum_types */,
- unsigned long /* item_mask */,
- unsigned long ** /* info_count_return */,
- PEXEnumTypeDesc ** /* enum_info_return */
-#endif
-);
-
-extern PEXExtensionInfo *PEXGetExtensionInfo(
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern Status PEXGetImpDepConstants(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- unsigned long /* count */,
- unsigned short * /* names */,
- PEXImpDepConstant ** /* constants_return */
-#endif
-);
-
-extern Status PEXGetNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXNameSet /* nameset */,
- unsigned long * /* count_return */,
- PEXName ** /* names_return */
-#endif
-);
-
-extern char *PEXGetOCAddr(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* length */
-#endif
-);
-
-extern PEXPDAttributes *PEXGetPickDevice(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- int /* pick_device_type */,
- unsigned long /* value_mask */
-#endif
-);
-
-extern PEXPMAttributes *PEXGetPickMeasure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXPickMeasure /* pick_measure */,
- unsigned long /* value_mask */
-#endif
-);
-
-extern PEXPCAttributes *PEXGetPipelineContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXPipelineContext /* context */,
- unsigned long * /* value_mask */
-#endif
-);
-
-extern Status PEXGetPredefinedEntries(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- int /* table_type */,
- unsigned int /* start */,
- unsigned int /* count */,
- PEXPointer * /* entries_return */
-#endif
-);
-
-extern int PEXGetProtocolFloatFormat(
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern PEXRendererAttributes *PEXGetRendererAttributes(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- unsigned long /* value_mask */
-#endif
-);
-
-extern Status PEXGetRendererDynamics(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- unsigned long * /* tables_return */,
- unsigned long * /* name_sets_return */,
- unsigned long * /* attributes_return */
-#endif
-);
-
-extern PEXSCAttributes *PEXGetSearchContext(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXSearchContext /* context */,
- unsigned long /* value_mask */
-#endif
-);
-
-extern int PEXGetSizeOCs(
-#if NeedFunctionPrototypes
- int /* float_format */,
- int /* oc_count */,
- PEXOCData * /* oc_data */
-#endif
-);
-
-extern Status PEXGetStructureInfo(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* float_format */,
- unsigned long /* value_mask */,
- PEXStructureInfo * /* info_return */
-#endif
-);
-
-extern PEXStructure *PEXGetStructuresInNetwork(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* which */,
- unsigned long * /* count_return */
-#endif
-);
-
-extern Status PEXGetTableEntries(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* table */,
- unsigned int /* start */,
- unsigned int /* count */,
- int /* value_type */,
- int * /* table_type_return */,
- PEXPointer * /* entries_return */
-#endif
-);
-
-extern PEXPointer PEXGetTableEntry(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* table */,
- unsigned int /* index */,
- int /* value_type */,
- int * /* status_return */,
- int * /* table_type_return */
-#endif
-);
-
-extern Status PEXGetTableInfo(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- int /* table_type */,
- PEXTableInfo * /* info_return */
-#endif
-);
-
-extern PEXWorkstationAttributes *PEXGetWorkstationAttributes(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned long * /* value_mask */
-#endif
-);
-
-extern Status PEXGetWorkstationDynamics(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXWorkstationDynamics * /* dynamics_return */
-#endif
-);
-
-extern Status PEXGetWorkstationPostings(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- unsigned long * /* count_return */,
- PEXWorkstation ** /* postings_return */
-#endif
-);
-
-extern Status PEXGetWorkstationViewRep(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned int /* index */,
- int * /* update_return */,
- PEXViewRep * /* req_view_return */,
- PEXViewRep * /* cur_view_return */
-#endif
-);
-
-extern void PEXIdentityMatrix(
-#if NeedFunctionPrototypes
- PEXMatrix /* transform_return */
-#endif
-);
-
-extern void PEXIdentityMatrix2D(
-#if NeedFunctionPrototypes
- PEXMatrix3x3 /* transform_return */
-#endif
-);
-
-extern int PEXInitialize(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXExtensionInfo ** /* info_return */,
- int /* length */,
- char * /* error_string */
-#endif
-);
-
-extern int PEXInvertMatrix(
-#if NeedFunctionPrototypes
- PEXMatrix /* transform */,
- PEXMatrix /* transform_return */
-#endif
-);
-
-extern int PEXInvertMatrix2D(
-#if NeedFunctionPrototypes
- PEXMatrix3x3 /* transform */,
- PEXMatrix3x3 /* transform_return */
-#endif
-);
-
-extern void PEXLabel(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- long /* label */
-#endif
-);
-
-extern char **PEXListFonts(
-#if NeedFunctionPrototypes
- Display * /* display */,
- char * /* pattern */,
- unsigned int /* max_names */,
- unsigned long * /* count_return */
-#endif
-);
-
-extern char **PEXListFontsWithInfo(
-#if NeedFunctionPrototypes
- Display * /* display */,
- char * /* pattern */,
- unsigned int /* max_names */,
- unsigned long * /* count_return */,
- PEXFontInfo ** /* info_return */
-#endif
-);
-
-extern PEXFont PEXLoadFont(
-#if NeedFunctionPrototypes
- Display * /* display */,
- char * /* font_name */
-#endif
-);
-
-extern int PEXLookAtViewMatrix(
-#if NeedFunctionPrototypes
- PEXCoord * /* from */,
- PEXCoord * /* to */,
- PEXVector * /* up */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern Status PEXMapDCToWC(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned long /* dc_count */,
- PEXDeviceCoord * /* dc_points */,
- unsigned int * /* view_index_return */,
- unsigned long * /* wc_count_return */,
- PEXCoord ** /* wc_points_return */
-#endif
-);
-
-extern Status PEXMapWCToDC(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned long /* wc_count */,
- PEXCoord * /* wc_points */,
- unsigned int /* view_index */,
- unsigned long * /* dc_count_return */,
- PEXDeviceCoord ** /* dc_points_return */
-#endif
-);
-
-extern int PEXMapXCToNPC(
-#if NeedFunctionPrototypes
- int /* point_count */,
- PEXDeviceCoord2D * /* points */,
- unsigned int /* window_height */,
- double /* z_dc */,
- PEXDeviceCoord * /* viewport */,
- PEXNPCSubVolume * /* npc_sub_volume */,
- int /* view_count */,
- PEXViewEntry * /* views */,
- int * /* view_return */,
- int * /* count_return */,
- PEXCoord * /* points_return */
-#endif
-);
-
-extern int PEXMapXCToNPC2D(
-#if NeedFunctionPrototypes
- int /* point_count */,
- PEXDeviceCoord2D * /* points */,
- unsigned int /* window_height */,
- PEXDeviceCoord2D * /* viewport */,
- PEXNPCSubVolume * /* npc_sub_volume */,
- int /* view_count */,
- PEXViewEntry * /* views */,
- int * /* view_return */,
- int * /* count_return */,
- PEXCoord2D * /* points_return */
-#endif
-);
-
-extern void PEXMarkers(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* count */,
- PEXCoord * /* points */
-#endif
-);
-
-extern void PEXMarkers2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* count */,
- PEXCoord2D * /* points */
-#endif
-);
-
-extern Status PEXMatchRenderingTargets(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- int /* depth */,
- int /* type */,
- Visual * /* visual */,
- unsigned long /* max_targets */,
- unsigned long * /* count_return */,
- PEXRenderingTarget ** /* targets_return */
-#endif
-);
-
-extern void PEXMatrixMult(
-#if NeedFunctionPrototypes
- PEXMatrix /* matrix1 */,
- PEXMatrix /* matrix2 */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXMatrixMult2D(
-#if NeedFunctionPrototypes
- PEXMatrix3x3 /* matrix1 */,
- PEXMatrix3x3 /* matrix2 */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern int PEXNPCToXCTransform(
-#if NeedFunctionPrototypes
- PEXNPCSubVolume * /* npc_sub_volume */,
- PEXDeviceCoord * /* viewport */,
- unsigned int /* window_height */,
- PEXMatrix /* transform_return */
-#endif
-);
-
-extern int PEXNPCToXCTransform2D(
-#if NeedFunctionPrototypes
- PEXNPCSubVolume * /* npc_sub_volume */,
- PEXDeviceCoord2D * /* viewport */,
- unsigned int /* window_height */,
- PEXMatrix3x3 /* transform_return */
-#endif
-);
-
-extern void PEXNURBCurve(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* rationality */,
- int /* order */,
- float * /* knots */,
- unsigned int /* count */,
- PEXArrayOfCoord /* points */,
- double /* tmin */,
- double /* tmax */
-#endif
-);
-
-extern void PEXNURBSurface(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* rationality */,
- int /* uorder */,
- int /* vorder */,
- float * /* uknots */,
- float * /* vknots */,
- unsigned int /* col_count */,
- unsigned int /* row_count */,
- PEXArrayOfCoord /* points */,
- unsigned int /* curve_count */,
- PEXListOfTrimCurve * /* trim_curves */
-#endif
-);
-
-extern void PEXNoop(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */
-#endif
-);
-
-extern int PEXNormalizeVectors(
-#if NeedFunctionPrototypes
- int /* count */,
- PEXVector * /* vectors */,
- PEXVector * /* vectors_return */
-#endif
-);
-
-extern int PEXNormalizeVectors2D(
-#if NeedFunctionPrototypes
- int /* count */,
- PEXVector2D * /* vectors */,
- PEXVector2D * /* vectors_return */
-#endif
-);
-
-extern int PEXOrthoProjMatrix(
-#if NeedFunctionPrototypes
- double /* height */,
- double /* aspect */,
- double /* near */,
- double /* far */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern int PEXPerspProjMatrix(
-#if NeedFunctionPrototypes
- double /* fovy */,
- double /* distance */,
- double /* aspect */,
- double /* near */,
- double /* far */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern PEXPickPath *PEXPickAll(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXRenderer /* renderer */,
- int /* method */,
- int /* max_hits */,
- int /* pick_device_type */,
- PEXPickRecord * /* pick_record */,
- int * /* status_return */,
- int * /* more_return */,
- unsigned long * /* count_return */
-#endif
-);
-
-extern PEXPickPath *PEXPickOne(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXRenderer /* renderer */,
- PEXStructure /* structure */,
- int /* method */,
- int /* pick_device_type */,
- PEXPickRecord * /* pick_record */,
- int * /* status_return */,
- int * /* undetectable_return */
-#endif
-);
-
-extern int PEXPolarViewMatrix(
-#if NeedFunctionPrototypes
- PEXCoord * /* from */,
- double /* distance */,
- double /* azimuth */,
- double /* altitude */,
- double /* twist */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXPolyline(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* count */,
- PEXCoord * /* points */
-#endif
-);
-
-extern void PEXPolyline2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* count */,
- PEXCoord2D * /* points */
-#endif
-);
-
-extern void PEXPolylineSetWithData(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- unsigned int /* count */,
- PEXListOfVertex * /* vertex_lists */
-#endif
-);
-
-extern void PEXPostStructure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- PEXStructure /* structure */,
- double /* priority */
-#endif
-);
-
-extern void PEXQuadrilateralMesh(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- PEXArrayOfFacetData /* facet_data */,
- unsigned int /* col_count */,
- unsigned int /* row_count */,
- PEXArrayOfVertex /* vertices */
-#endif
-);
-
-extern PEXTextExtent *PEXQueryEncodedTextExtents(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- unsigned int /* font_table_index */,
- int /* path */,
- double /* expansion */,
- double /* spacing */,
- double /* height */,
- int /* halign */,
- int /* valign */,
- unsigned long /* count */,
- PEXListOfEncodedText * /* encoded_text */
-#endif
-);
-
-extern PEXFontInfo *PEXQueryFont(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXFont /* font */
-#endif
-);
-
-extern PEXTextExtent *PEXQueryTextExtents(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- unsigned int /* font_table_index */,
- int /* path */,
- double /* expansion */,
- double /* spacing */,
- double /* height */,
- int /* halign */,
- int /* valign */,
- unsigned long /* count */,
- PEXStringData * /* text */
-#endif
-);
-
-extern void PEXRedrawAllStructures(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */
-#endif
-);
-
-extern void PEXRedrawClipRegion(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned long /* count */,
- PEXDeviceRect * /* clip_rectangles */
-#endif
-);
-
-extern void PEXRemoveFromNameSet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned long /* count */,
- PEXName * /* names */
-#endif
-);
-
-extern void PEXRenderElements(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- PEXStructure /* structure */,
- int /* whence1 */,
- long /* offset1 */,
- int /* whence2 */,
- long /* offset2 */
-#endif
-);
-
-extern void PEXRenderNetwork(
-#if NeedFunctionPrototypes
- Display * /* display */,
- Drawable /* drawable */,
- PEXRenderer /* renderer */,
- PEXStructure /* structure */
-#endif
-);
-
-extern void PEXRestoreModelClipVolume(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */
-#endif
-);
-
-extern int PEXRotate(
-#if NeedFunctionPrototypes
- int /* axis */,
- double /* angle */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXRotate2D(
-#if NeedFunctionPrototypes
- double /* angle */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern int PEXRotateGeneral(
-#if NeedFunctionPrototypes
- PEXCoord * /* point1 */,
- PEXCoord * /* point2 */,
- double /* angle */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXScale(
-#if NeedFunctionPrototypes
- PEXVector * /* scale_vector */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXScale2D(
-#if NeedFunctionPrototypes
- PEXVector2D * /* scale_vector */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern Status PEXSearchNetwork(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXSearchContext /* context */,
- PEXStructurePath ** /* path_return */
-#endif
-);
-
-extern void PEXSendOCs(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* float_format */,
- unsigned long /* oc_count */,
- unsigned int /* length */,
- char * /* encoded_ocs */
-#endif
-);
-
-extern void PEXSetATextAlignment(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* halignment */,
- int /* valignment */
-#endif
-);
-
-extern void PEXSetATextHeight(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* height */
-#endif
-);
-
-extern void PEXSetATextPath(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* path */
-#endif
-);
-
-extern void PEXSetATextStyle(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* style */
-#endif
-);
-
-extern void PEXSetATextUpVector(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXVector2D * /* vector */
-#endif
-);
-
-extern void PEXSetBFInteriorStyle(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* style */
-#endif
-);
-
-extern void PEXSetBFInteriorStyleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* index */
-#endif
-);
-
-extern void PEXSetBFReflectionAttributes(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXReflectionAttributes * /* attributes */
-#endif
-);
-
-extern void PEXSetBFReflectionModel(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* model */
-#endif
-);
-
-extern void PEXSetBFSurfaceColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetBFSurfaceColorIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetBFSurfaceInterpMethod(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* method */
-#endif
-);
-
-extern void PEXSetCharExpansion(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* expansion */
-#endif
-);
-
-extern void PEXSetCharHeight(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* height */
-#endif
-);
-
-extern void PEXSetCharSpacing(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* spacing */
-#endif
-);
-
-extern void PEXSetCharUpVector(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXVector2D * /* vector */
-#endif
-);
-
-extern void PEXSetColorApproxIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetCurveApprox(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* method */,
- double /* tolerance */
-#endif
-);
-
-extern void PEXSetDepthCueIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetEchoColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXRenderer /* renderer */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetEdgeBundleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetEditingMode(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* mode */
-#endif
-);
-
-extern void PEXSetElementPtr(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- int /* whence */,
- long /* offset */
-#endif
-);
-
-extern void PEXSetElementPtrAtLabel(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXStructure /* structure */,
- long /* label */,
- long /* offset */
-#endif
-);
-
-extern void PEXSetFacetCullingMode(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* mode */
-#endif
-);
-
-extern void PEXSetFacetDistinguishFlag(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* flag */
-#endif
-);
-
-extern void PEXSetGlobalTransform(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXMatrix /* transform */
-#endif
-);
-
-extern void PEXSetGlobalTransform2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXMatrix3x3 /* transform */
-#endif
-);
-
-extern void PEXSetHLHSRID(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned long /* hlhsr_id */
-#endif
-);
-
-extern void PEXSetIndividualASF(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned long /* attribute */,
- int /* asf */
-#endif
-);
-
-extern void PEXSetInteriorBundleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetInteriorStyle(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* style */
-#endif
-);
-
-extern void PEXSetInteriorStyleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* index */
-#endif
-);
-
-extern void PEXSetLightSourceState(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* enable_count */,
- PEXTableIndex * /* enable */,
- unsigned int /* disable_count */,
- PEXTableIndex * /* disable */
-#endif
-);
-
-extern void PEXSetLineBundleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetLineColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetLineColorIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetLineType(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* line_type */
-#endif
-);
-
-extern void PEXSetLineWidth(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* width */
-#endif
-);
-
-extern void PEXSetLocalTransform(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* composition */,
- PEXMatrix /* transform */
-#endif
-);
-
-extern void PEXSetLocalTransform2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* composition */,
- PEXMatrix3x3 /* transform */
-#endif
-);
-
-extern void PEXSetMarkerBundleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetMarkerColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetMarkerColorIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetMarkerScale(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* scale */
-#endif
-);
-
-extern void PEXSetMarkerType(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* marker_type */
-#endif
-);
-
-extern void PEXSetModelClipFlag(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* flag */
-#endif
-);
-
-extern void PEXSetModelClipVolume(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* op */,
- unsigned int /* count */,
- PEXHalfSpace * /* half_spaces */
-#endif
-);
-
-extern void PEXSetModelClipVolume2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* op */,
- unsigned int /* count */,
- PEXHalfSpace2D * /* half_spaces */
-#endif
-);
-
-extern void PEXSetOfFillAreaSets(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* shape_hint */,
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- unsigned int /* edge_attributes */,
- int /* contour_hint */,
- int /* contours_all_one */,
- int /* color_type */,
- unsigned int /* set_count */,
- PEXArrayOfFacetData /* facet_data */,
- unsigned int /* vertex_count */,
- PEXArrayOfVertex /* vertices */,
- unsigned int /* index_count */,
- PEXSwitch * /* edge_flags */,
- PEXConnectivityData * /* connectivity */
-#endif
-);
-
-extern void PEXSetParaSurfCharacteristics(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* psc_type */,
- PEXPSCData * /* characteristics */
-#endif
-);
-
-extern void PEXSetPatternAttributes(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* ref_point */,
- PEXVector * /* vector1 */,
- PEXVector * /* vector2 */
-#endif
-);
-
-extern void PEXSetPatternAttributes2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord2D * /* ref_point */
-#endif
-);
-
-extern void PEXSetPatternSize(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* width */,
- double /* height */
-#endif
-);
-
-extern void PEXSetPickID(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned long /* pick_id */
-#endif
-);
-
-extern void PEXSetPolylineInterpMethod(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* method */
-#endif
-);
-
-extern void PEXSetReflectionAttributes(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXReflectionAttributes * /* attributes */
-#endif
-);
-
-extern void PEXSetReflectionModel(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* model */
-#endif
-);
-
-extern void PEXSetRenderingColorModel(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* model */
-#endif
-);
-
-extern void PEXSetSurfaceApprox(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* method */,
- double /* utolerance */,
- double /* vtolerance */
-#endif
-);
-
-extern void PEXSetSurfaceColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetSurfaceColorIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetSurfaceEdgeColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetSurfaceEdgeColorIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetSurfaceEdgeFlag(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* flag */
-#endif
-);
-
-extern void PEXSetSurfaceEdgeType(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* edge_type */
-#endif
-);
-
-extern void PEXSetSurfaceEdgeWidth(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- double /* width */
-#endif
-);
-
-extern void PEXSetSurfaceInterpMethod(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* method */
-#endif
-);
-
-extern void PEXSetTableEntries(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXLookupTable /* table */,
- unsigned int /* start */,
- unsigned int /* count */,
- int /* table_type */,
- PEXPointer /* entries */
-#endif
-);
-
-extern void PEXSetTextAlignment(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* halignment */,
- int /* valignment */
-#endif
-);
-
-extern void PEXSetTextBundleIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetTextColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* color_type */,
- PEXColor * /* color */
-#endif
-);
-
-extern void PEXSetTextColorIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetTextFontIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetTextPath(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* path */
-#endif
-);
-
-extern void PEXSetTextPrecision(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* precision */
-#endif
-);
-
-extern void PEXSetViewIndex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* index */
-#endif
-);
-
-extern void PEXSetWorkstationBufferMode(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- int /* buffer_mode */
-#endif
-);
-
-extern void PEXSetWorkstationDisplayUpdateMode(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- int /* update_mode */
-#endif
-);
-
-extern void PEXSetWorkstationHLHSRMode(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- int /* hlhsr_mode */
-#endif
-);
-
-extern void PEXSetWorkstationViewPriority(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned int /* index1 */,
- unsigned int /* index2 */,
- int /* priority */
-#endif
-);
-
-extern void PEXSetWorkstationViewRep(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- unsigned int /* view_index */,
- PEXViewEntry * /* values */
-#endif
-);
-
-extern void PEXSetWorkstationViewport(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- PEXViewport * /* viewport */
-#endif
-);
-
-extern void PEXSetWorkstationWindow(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- PEXNPCSubVolume * /* workstation_window */
-#endif
-);
-
-extern Status PEXStartOCs(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- int /* float_format */,
- int /* oc_count */,
- int /* word_count */
-#endif
-);
-
-extern void PEXText(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord * /* origin */,
- PEXVector * /* vector1 */,
- PEXVector * /* vector2 */,
- int /* length */,
- char * /* string */
-#endif
-);
-
-extern void PEXText2D(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- PEXCoord2D * /* origin */,
- int /* length */,
- char * /* string */
-#endif
-);
-
-extern int PEXTransformPoints(
-#if NeedFunctionPrototypes
- PEXMatrix /* transform */,
- int /* count */,
- PEXCoord * /* points */,
- PEXCoord * /* points_return */
-#endif
-);
-
-extern int PEXTransformPoints2D(
-#if NeedFunctionPrototypes
- PEXMatrix3x3 /* transform */,
- int /* count */,
- PEXCoord2D * /* points */,
- PEXCoord2D * /* points_return */
-#endif
-);
-
-extern void PEXTransformPoints2DH(
-#if NeedFunctionPrototypes
- PEXMatrix3x3 /* transform */,
- int /* count */,
- PEXCoord * /* points */,
- PEXCoord * /* points_return */
-#endif
-);
-
-extern void PEXTransformPoints4D(
-#if NeedFunctionPrototypes
- PEXMatrix /* transform */,
- int /* count */,
- PEXCoord4D * /* points */,
- PEXCoord4D * /* points_return */
-#endif
-);
-
-extern void PEXTransformVectors(
-#if NeedFunctionPrototypes
- PEXMatrix /* transform */,
- int /* count */,
- PEXVector * /* vectors */,
- PEXVector * /* vectors_return */
-#endif
-);
-
-extern void PEXTransformVectors2D(
-#if NeedFunctionPrototypes
- PEXMatrix3x3 /* transform */,
- int /* count */,
- PEXVector2D * /* vectors */,
- PEXVector2D * /* vectors_return */
-#endif
-);
-
-extern void PEXTranslate(
-#if NeedFunctionPrototypes
- PEXVector * /* trans_vector */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern void PEXTranslate2D(
-#if NeedFunctionPrototypes
- PEXVector2D * /* trans_vector */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern void PEXTriangleStrip(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */,
- unsigned int /* facet_attributes */,
- unsigned int /* vertex_attributes */,
- int /* color_type */,
- PEXArrayOfFacetData /* facet_data */,
- unsigned int /* count */,
- PEXArrayOfVertex /* vertices */
-#endif
-);
-
-extern void PEXUnloadFont(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXFont /* font */
-#endif
-);
-
-extern void PEXUnpostAllStructures(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */
-#endif
-);
-
-extern void PEXUnpostStructure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */,
- PEXStructure /* structure */
-#endif
-);
-
-extern void PEXUpdatePickMeasure(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXPickMeasure /* pick_measure */,
- int /* pick_device_type */,
- PEXPickRecord * /* pick_record */
-#endif
-);
-
-extern void PEXUpdateWorkstation(
-#if NeedFunctionPrototypes
- Display * /* display */,
- PEXWorkstation /* workstation */
-#endif
-);
-
-extern int PEXViewMappingMatrix(
-#if NeedFunctionPrototypes
- PEXCoord2D * /* frame */,
- PEXNPCSubVolume * /* viewport */,
- int /* perspective */,
- PEXCoord * /* prp */,
- double /* view_plane */,
- double /* back_plane */,
- double /* front_plane */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern int PEXViewMappingMatrix2D(
-#if NeedFunctionPrototypes
- PEXCoord2D * /* frame */,
- PEXCoord2D * /* viewport */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern int PEXViewOrientationMatrix(
-#if NeedFunctionPrototypes
- PEXCoord * /* vrp */,
- PEXVector * /* vpn */,
- PEXVector * /* vup */,
- PEXMatrix /* matrix_return */
-#endif
-);
-
-extern int PEXViewOrientationMatrix2D(
-#if NeedFunctionPrototypes
- PEXCoord2D * /* vrp */,
- PEXVector2D * /* vup */,
- PEXMatrix3x3 /* matrix_return */
-#endif
-);
-
-extern int PEXXCToNPCTransform(
-#if NeedFunctionPrototypes
- PEXNPCSubVolume * /* npc_sub_volume */,
- PEXDeviceCoord * /* viewport */,
- unsigned int /* window_height */,
- PEXMatrix /* transform_return */
-#endif
-);
-
-extern int PEXXCToNPCTransform2D(
-#if NeedFunctionPrototypes
- PEXNPCSubVolume * /* npc_sub_volume */,
- PEXDeviceCoord2D * /* viewport */,
- unsigned int /* window_height */,
- PEXMatrix3x3 /* transform_return */
-#endif
-);
-
-extern unsigned long PEXCountOCs(
-#if NeedFunctionPrototypes
- int /* float_format */,
- unsigned long /* length */,
- char * /* encoded_ocs */
-#endif
-);
-
-_XFUNCPROTOEND
-
-#endif /* _PEXLIB_H_ */
diff --git a/xc/lib/PEX5/PEXlibint.h b/xc/lib/PEX5/PEXlibint.h
deleted file mode 100644
index 2d3f46391..000000000
--- a/xc/lib/PEX5/PEXlibint.h
+++ /dev/null
@@ -1,1052 +0,0 @@
-/* $TOG: PEXlibint.h /main/19 1998/02/06 16:09:05 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 _PEXLIBINT_H_
-#define _PEXLIBINT_H_
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/Xfuncs.h>
-#include "PEXproto.h"
-#include "pl_convert.h"
-#include "pl_store.h"
-#include "pl_extract.h"
-#include "pl_xdata.h"
-
-
-/* -------------------------------------------------------------------------
- * Display extension data structures and macros.
- * ------------------------------------------------------------------------- */
-
-/*
- * For each display initialized by PEXInitialize(), a record is allocated
- * which holds various information about that display. These records are
- * maintained in a linked list. The record for the most recently referenced
- * display is always kept at the beginning of the list (for quick access).
- */
-
-typedef struct PEXDisplayInfo
-{
- Display *display; /* pointer to X display structure */
- XExtCodes *extCodes; /* extension codes */
- PEXExtensionInfo *extInfo; /* extension info */
- unsigned char extOpcode; /* opcode for pex extension */
- unsigned short fpFormat; /* floating point format */
- char fpConvert; /* flag for floating point conversion */
- PEXEnumTypeDesc *fpSupport; /* float formats supported by server */
- int fpCount; /* number of float formats supported */
- XID lastResID; /* renderer/structure ID of last OC */
- int lastReqType; /* request type (store/rend) of last OC */
- int lastReqNum; /* request number of last OC */
- struct PEXDisplayInfo *next; /* next in list */
-} PEXDisplayInfo;
-
-
-/*
- * Insert a new record in the beginning of the linked list.
- */
-
-#define PEXAddDisplayInfo(_display, _info) \
-\
-{ \
- _info->display = _display; \
-\
- _info->next = PEXDisplayInfoHeader; \
- PEXDisplayInfoHeader = _info; \
-}
-
-
-/*
- * Remove the record assosicated with '_display' from the linked list
- * and return a pointer to it in '_info'.
- */
-
-#define PEXRemoveDisplayInfo(_display, _info) \
-\
-{ \
- PEXDisplayInfo *prev = NULL; \
-\
- _info = PEXDisplayInfoHeader; \
-\
- while (_info && _info->display != _display) \
- { \
- prev = _info; \
- _info = _info->next; \
- } \
-\
- if (_info) \
- if (!prev) \
- PEXDisplayInfoHeader = _info->next; \
- else \
- prev->next = _info->next; \
-}
-
-
-/*
- * Return the info assosicated with '_display' in '_info'.
- * If the info is not the first in the list, move it to the front.
- */
-
-#define PEXGetDisplayInfo(_display, _info) \
-\
-{ \
- if (_info = PEXDisplayInfoHeader) \
- { \
- if (PEXDisplayInfoHeader->display != _display) \
- { \
- PEXDisplayInfo *prev = PEXDisplayInfoHeader; \
-\
- _info = _info->next; \
- while (_info && _info->display != _display) \
- { \
- prev = _info; \
- _info = _info->next; \
- } \
-\
- if (_info) \
- { \
- prev->next = _info->next; \
- _info->next = PEXDisplayInfoHeader; \
- PEXDisplayInfoHeader = _info; \
- } \
- } \
- } \
-}
-
-
-
-/* -------------------------------------------------------------------------
- * Memory related macros.
- * ------------------------------------------------------------------------- */
-
-#define PAD(_size) (3 - (((_size) + 3) & 0x3))
-
-#define PADDED_BYTES(_bytes) (_bytes + PAD (_bytes))
-
-#define NUMWORDS(_size) (((unsigned int) ((_size) + 3)) >> 2)
-
-#define NUMBYTES(_len) (((unsigned int) (_len)) << 2)
-
-#define LENOF(_ctype) (SIZEOF (_ctype) >> 2)
-
-
-/*
- * Count the number of ones in a longword.
- */
-
-#define CountOnes(_mask, _countReturn) \
- _countReturn = ((_mask) - (((_mask)>>1)&0x77777777) \
- - (((_mask)>>2)&0x33333333) - (((_mask)>>3)&0x11111111)); \
- _countReturn = ((((_countReturn)+((_countReturn)>>4)) & 0x0F0F0F0F) % 255)
-
-
-
-/* -------------------------------------------------------------------------
- * Macros for dealing with the transport buffer.
- * ------------------------------------------------------------------------- */
-
-/*
- * The maximum protocol request size.
- */
-
-#define MAX_REQUEST_SIZE ((1<<16) - 1)
-
-
-/*
- * Has the X transport buffer been flushed?
- */
-
-#define XBufferFlushed(_display) \
- ((_display)->buffer == (_display)->bufptr)
-
-
-/*
- * The number of bytes left in the X transport buffer.
- */
-
-#define BytesLeftInXBuffer(_display) \
- ((_display)->bufmax - (_display)->bufptr)
-
-
-/*
- * The number of words left in the X transport buffer.
- */
-
-#define WordsLeftInXBuffer(_display) \
- (((_display)->bufmax - (_display)->bufptr) >> 2)
-
-
-/*
- * See if XSynchronize has been called. If so, send request right away.
- */
-
-#define PEXSyncHandle(_display)\
- if ((_display)->synchandler) (*(_display)->synchandler) (_display)
-
-
-/*
- * Read a reply into a scratch buffer.
- */
-
-#define XREAD_INTO_SCRATCH(_display, _pBuf, _numBytes) \
- _pBuf = (char *) _XAllocTemp (_display, (unsigned long) (_numBytes)); \
- _XRead (_display, _pBuf, (long) (_numBytes));
-
-#define FINISH_WITH_SCRATCH(_display, _pBuf, _numBytes) \
- _XFreeTemp (_display, _pBuf, (unsigned long) (_numBytes));
-
-
-/* -------------------------------------------------------------------------
- * Output Command request header. The pexOpCode field specifies the type
- * of request - Render Output Commands or Store Elements.
- * ------------------------------------------------------------------------- */
-
-typedef struct pexOCRequestHeader
-{
- CARD8 extOpcode;
- CARD8 pexOpcode;
- CARD16 reqLength B16;
- INT16 fpFormat B16;
- CARD16 pad B16;
- CARD32 target B32;
- CARD32 numCommands B32;
-} pexOCRequestHeader;
-
-
-
-/* -------------------------------------------------------------------------
- * Macros for setting up requests.
- * ------------------------------------------------------------------------- */
-
-/*
- * Request names and opcodes.
- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define REQNAME(_name_) pex##_name_##Req
-#define REQOPCODE(_name_) PEXRC##_name_
-#define REQSIZE(_name_) sz_pex##_name_##Req
-#else
-#define REQNAME(_name_) pex/**/_name_/**/Req
-#define REQOPCODE(_name_) PEXRC/**/_name_
-#define REQSIZE(_name_) sz_pex/**/_name_/**/Req
-#endif
-
-
-/*
- * PEXGetReq sets up a request to be sent to the X server. If there isn't
- * enough room left in the X buffer, it is flushed before the new request
- * is started.
- */
-
-#define PEXGetReq(_name, _req) \
- if ((display->bufptr + REQSIZE(_name)) > display->bufmax) \
- _XFlush (display); \
- _req = (char *) (display->last_req = display->bufptr); \
- display->bufptr += REQSIZE(_name); \
- display->request++
-
-
-/*
- * PEXGetReqExtra is the same as PEXGetReq and except that an additional
- * "n" bytes are allocated after the request. "n" will be padded to a word
- * boundary.
- */
-
-#define PEXGetReqExtra(_name, _n, _req) \
- if ((display->bufptr + REQSIZE(_name) + \
- PADDED_BYTES (_n)) > display->bufmax) _XFlush (display); \
- _req = (char *) (display->last_req = display->bufptr); \
- display->bufptr += (REQSIZE(_name) + PADDED_BYTES (_n)); \
- display->request++
-
-
-/*
- * BEGIN_REQUEST_HEADER and END_REQUEST_HEADER are used to hide
- * the extra work that has to be done on 64 bit clients. On such
- * machines, all structure pointers must point to an 8 byte boundary.
- * As a result, we must first store the request header info in
- * a static data stucture, then bcopy it into the transport buffer.
- */
-
-#ifndef WORD64
-
-#define BEGIN_REQUEST_HEADER(_name, _pBuf, _pReq) \
-{ \
- PEXDisplayInfo *pexDisplayInfo; \
- PEXGetDisplayInfo (display, pexDisplayInfo); \
- _pReq = (REQNAME(_name) *) _pBuf;
-
-#define END_REQUEST_HEADER(_name, _pBuf, _pReq) \
- _pBuf += REQSIZE(_name); \
-}
-
-#else /* WORD64 */
-
-#define BEGIN_REQUEST_HEADER(_name, _pBuf, _pReq) \
-{ \
- PEXDisplayInfo *pexDisplayInfo; \
- REQNAME(_name) tReq; \
- PEXGetDisplayInfo (display, pexDisplayInfo); \
- _pReq = &tReq;
-
-#define END_REQUEST_HEADER(_name, _pBuf, _pReq) \
- memcpy (_pBuf, _pReq, REQSIZE(_name)); \
- _pBuf += REQSIZE(_name); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Macros used to store the request header info.
- */
-
-#define PEXStoreReqHead(_name, _req) \
- _req->reqType = pexDisplayInfo->extOpcode; \
- _req->opcode = REQOPCODE(_name); \
- _req->length = (REQSIZE(_name)) >> 2;
-
-
-#define PEXStoreFPReqHead(_name, _fpFormat, _req) \
- _req->reqType = pexDisplayInfo->extOpcode; \
- _req->opcode = REQOPCODE(_name); \
- _req->length = (REQSIZE(_name)) >> 2; \
- _req->fpFormat = _fpFormat;
-
-#define PEXStoreReqExtraHead(_name, _extraBytes, _req) \
- _req->reqType = pexDisplayInfo->extOpcode; \
- _req->opcode = REQOPCODE(_name); \
- _req->length = (REQSIZE(_name) + PADDED_BYTES (_extraBytes)) >> 2;
-
-#define PEXStoreFPReqExtraHead(_name, _fpFormat, _extraBytes, _req) \
- _req->reqType = pexDisplayInfo->extOpcode; \
- _req->opcode = REQOPCODE(_name); \
- _req->length = (REQSIZE(_name) + PADDED_BYTES (_extraBytes)) >> 2; \
- _req->fpFormat = _fpFormat;
-
-
-
-/*
- * Return flag for floating point conversion, as well as the
- * float format to convert to. The call to this macro must come
- * after BEGIN_REQUEST_HEADER and before END_REQUEST_HEADER.
- */
-
-#define CHECK_FP(_fpConvert, _fpFormat) \
- _fpConvert = pexDisplayInfo->fpConvert; \
- _fpFormat = pexDisplayInfo->fpFormat;
-
-
-
-/* -------------------------------------------------------------------------
- * Get pointer to a structure in a buffer stream. On 64 bit clients,
- * all structure pointers must point to an 8 byte boundary. As a result,
- * we must first bcopy into a static data structure, then return a pointer
- * to this static data structure.
- *
- * Note: GET_STRUCT_PTR must be used in the declaration section of a block.
- * ------------------------------------------------------------------------- */
-
-#ifndef WORD64
-
-#define GET_STRUCT_PTR(_name, _pBuf, _pStruct) \
- _pStruct = (_name *) _pBuf;
-
-#else /* WORD64 */
-
-#define GET_STRUCT_PTR(_name, _pBuf, _pStruct) \
- _name tStruct; \
- memcpy (&tStruct, _pBuf, SIZEOF (_name)); \
- _pStruct = &tStruct;
-
-#endif /* WORD64 */
-
-
-
-/* -------------------------------------------------------------------------
- * Color related macros.
- * ------------------------------------------------------------------------- */
-
-/*
- * Protocol color size based on color type (in bytes).
- */
-
-#define GetColorSize(_type) \
- ((_type) == PEXColorTypeIndexed ? SIZEOF (pexIndexedColor) : \
- ((_type) == PEXColorTypeRGB8 ? SIZEOF (pexRgb8Color) : \
- ((_type) == PEXColorTypeRGB16 ? SIZEOF (pexRgb16Color) : \
- SIZEOF (pexRgbFloatColor))))
-
-/*
- * Protocol color size based on color type (in words).
- */
-
-#define GetColorLength(_type)\
- ((_type) == PEXColorTypeIndexed ? LENOF (pexIndexedColor) :\
- ((_type) == PEXColorTypeRGB8 ? LENOF (pexRgb8Color) :\
- ((_type) == PEXColorTypeRGB16 ? LENOF (pexRgb16Color) : \
- LENOF (pexRgbFloatColor))))
-
-/*
- * Client color size based on color type (in bytes).
- */
-
-#define GetClientColorSize(_type) \
- ((_type) == PEXColorTypeIndexed ? sizeof (PEXColorIndexed) : \
- ((_type) == PEXColorTypeRGB8 ? sizeof (PEXColorRGB8) : \
- ((_type) == PEXColorTypeRGB16 ? sizeof (PEXColorRGB16) : \
- sizeof (PEXColorRGB))))
-
-
-
-/* -------------------------------------------------------------------------
- * Constants
- * ------------------------------------------------------------------------- */
-
-/*
- * IEEE-754-32 is the most common floating point type. Vendors who have
- * a different native floating point format should define NATIVE_FP_FORMAT
- * at compile time via the -D switch (this is done by modifying the vendors
- * config file to include a "#define PexNativeFPFormat your_format".
- */
-
-#ifndef NATIVE_FP_FORMAT
-#define NATIVE_FP_FORMAT PEXIEEE_754_32
-#endif
-
-
-/*
- * The PEXlib SI supports Cray floating point format, but this constant
- * is not a registered float format, so it's not found in PEX.h. We define
- * it here.
- *
- * If a vendor wants to add support for his own float format in PEXlib, he
- * should add a consant here for the format, and bump up NUM_FP_FORMATS.
- * Then he must modify the fp conversion function table found in the file
- * pl_global_def.h to include his format.
- *
- * Note : Floating point formats 1-4 are registered with PEX at this time.
- */
-
-#define PEXCRAY_Floating 5
-
-#define NUM_FP_FORMATS 5
-
-
-/*
- * Maximum size of pick cache in bytes.
- */
-
-#define MAX_PICK_CACHE_SIZE 2048
-
-
-/*
- * Protocol data structure sizes. SIZEOF (rec) == sz_rec.
- */
-
-#define sz_pexAccumulateStateReq 12
-#define sz_pexAddToNameSet 4
-#define sz_pexRemoveFromNameSet 4
-#define sz_pexAnnotationText 32
-#define sz_pexAnnotationText2D 24
-#define sz_pexApplicationData 8
-#define sz_pexATextStyle 8
-#define sz_pexBeginPickAllReq 28
-#define sz_pexBeginPickOneReq 20
-#define sz_pexBeginRenderingReq 12
-#define sz_pexBeginStructureReq 12
-#define sz_pexCellArray 48
-#define sz_pexCellArray2D 28
-#define sz_pexChangeNameSetReq 12
-#define sz_pexChangePickDeviceReq 20
-#define sz_pexChangePipelineContextReq 24
-#define sz_pexChangeRendererReq 16
-#define sz_pexChangeSearchContextReq 16
-#define sz_pexChangeStructureRefsReq 12
-#define sz_pexCharExpansion 8
-#define sz_pexCharHeight 8
-#define sz_pexATextHeight 8
-#define sz_pexCharSpacing 8
-#define sz_pexCharUpVector 12
-#define sz_pexATextUpVector 12
-#define sz_pexCopyElementsReq 36
-#define sz_pexCopyLookupTableReq 12
-#define sz_pexCopyNameSetReq 12
-#define sz_pexCopyPipelineContextReq 24
-#define sz_pexCopySearchContextReq 16
-#define sz_pexCopyStructureReq 12
-#define sz_pexCreateLookupTableReq 16
-#define sz_pexCreatePickMeasureReq 16
-#define sz_pexCreatePipelineContextReq 24
-#define sz_pexCreateRendererReq 20
-#define sz_pexCreateSearchContextReq 16
-#define sz_pexCreateWorkstationReq 76
-#define sz_pexFacetCullingMode 8
-#define sz_pexCurveApprox 12
-#define sz_pexDeleteBetweenLabelsReq 16
-#define sz_pexDeleteElementsReq 24
-#define sz_pexDeleteElementsToLabelReq 20
-#define sz_pexDeleteTableEntriesReq 12
-#define sz_pexDestroyStructuresReq 8
-#define sz_pexFacetDistinguishFlag 8
-#define sz_pexElementSearchReply 32
-#define sz_pexElementSearchReq 28
-#define sz_pexEndPickAllReply 32
-#define sz_pexEndPickAllReq 8
-#define sz_pexEndPickOneReply 32
-#define sz_pexEndPickOneReq 8
-#define sz_pexEndRenderingReq 12
-#define sz_pexEscapeReq 8
-#define sz_pexEscapeWithReplyReq sz_pexEscapeReq
-#define sz_pexEscapeWithReplyReply 32
-#define sz_pexExecuteStructure 8
-#define sz_pexExtendedCellArray 52
-#define sz_pexFillAreaWithData 16
-#define sz_pexFillAreaSetWithData 20
-#define sz_pexFetchElementsReply 32
-#define sz_pexFetchElementsReq 28
-#define sz_pexFillArea 8
-#define sz_pexFillArea2D 8
-#define sz_pexFillAreaSet 12
-#define sz_pexFillAreaSet2D 12
-#define sz_pexGDP 16
-#define sz_pexGDP2D 16
-#define sz_pexGetAncestorsReply 32
-#define sz_pexGetAncestorsReq 16
-#define sz_pexGetDescendantsReq sz_pexGetAncestorsReq
-#define sz_pexGetDefinedIndicesReply 32
-#define sz_pexGetElementInfoReply 32
-#define sz_pexGetElementInfoReq 28
-#define sz_pexGetEnumTypeInfoReply 32
-#define sz_pexGetEnumTypeInfoReq 16
-#define sz_pexGetExtensionInfoReply 32
-#define sz_pexGetExtensionInfoReq 8
-#define sz_pexGetImpDepConstantsReply 32
-#define sz_pexGetImpDepConstantsReq 16
-#define sz_pexGetNameSetReply 32
-#define sz_pexGetPickDeviceReply 32
-#define sz_pexGetPickDeviceReq 16
-#define sz_pexGetPickMeasureReply 32
-#define sz_pexGetPickMeasureReq 12
-#define sz_pexGetPipelineContextReply 32
-#define sz_pexGetPipelineContextReq 24
-#define sz_pexGetPredefinedEntriesReply 32
-#define sz_pexGetPredefinedEntriesReq 20
-#define sz_pexGetRendererAttributesReply 32
-#define sz_pexGetRendererAttributesReq 16
-#define sz_pexGetRendererDynamicsReply 32
-#define sz_pexGetSearchContextReply 32
-#define sz_pexGetSearchContextReq 16
-#define sz_pexGetStructureInfoReply 32
-#define sz_pexGetStructureInfoReq 12
-#define sz_pexGetStructuresInNetworkRepl 32
-#define sz_pexGetStructuresInNetworkReq 12
-#define sz_pexGetTableEntriesReply 32
-#define sz_pexGetTableEntriesReq 16
-#define sz_pexGetTableEntryReply 32
-#define sz_pexGetTableEntryReq 16
-#define sz_pexGetTableInfoReply 32
-#define sz_pexGetTableInfoReq 12
-#define sz_pexGetWorkstationAttributesReply 32
-#define sz_pexGetWorkstationAttributesReq 20
-#define sz_pexGetWorkstationDynamicsReply 32
-#define sz_pexGetWorkstationDynamicsReq 8
-#define sz_pexGetWorkstationPostingsReply 32
-#define sz_pexGetWorkstationViewRepReply 32
-#define sz_pexGetWorkstationViewRepReq 12
-#define sz_pexGlobalTransform 68
-#define sz_pexGlobalTransform2D 40
-#define sz_pexGSE 12
-#define sz_pexHLHSRID 8
-#define sz_pexInteriorStyle 8
-#define sz_pexBFInteriorStyle 8
-#define sz_pexLabel 8
-#define sz_pexLightSourceState 8
-#define sz_pexLineType 8
-#define sz_pexLineWidth 8
-#define sz_pexSurfaceEdgeWidth 8
-#define sz_pexListFontsReply 32
-#define sz_pexListFontsReq 8
-#define sz_pexListFontsWithInfoReply 32
-#define sz_pexListFontsWithInfoReq 12
-#define sz_pexLoadFontReq 12
-#define sz_pexLocalTransform 72
-#define sz_pexLocalTransform2D 44
-#define sz_pexLookupTable 4
-#define sz_pexMapDCtoWCReply 32
-#define sz_pexMapDCtoWCReq 16
-#define sz_pexMapWCtoDCReply 32
-#define sz_pexMapWCtoDCReq 16
-#define sz_pexMarkers 4
-#define sz_pexMarkers2D 4
-
-#define sz_pexMarkerBundleIndex 8
-#define sz_pexTextBundleIndex 8
-#define sz_pexLineBundleIndex 8
-#define sz_pexInteriorBundleIndex 8
-#define sz_pexInteriorStyleIndex 8
-#define sz_pexBFInteriorStyleIndex 8
-#define sz_pexEdgeBundleIndex 8
-#define sz_pexViewIndex 8
-#define sz_pexDepthCueIndex 8
-#define sz_pexColorApproxIndex 8
-
-#define sz_pexMarkerColorIndex 8
-#define sz_pexTextColorIndex 8
-#define sz_pexLineColorIndex 8
-#define sz_pexSurfaceColorIndex 8
-#define sz_pexBFSurfaceColorIndex 8
-#define sz_pexSurfaceEdgeColorIndex 8
-
-#define sz_pexMarkerColor 8
-#define sz_pexTextColor 8
-#define sz_pexLineColor 8
-#define sz_pexSurfaceColor 8
-#define sz_pexBFSurfaceColor 8
-#define sz_pexSurfaceEdgeColor 8
-
-#define sz_pexTextFontIndex 8
-
-#define sz_pexMarkerScale 8
-#define sz_pexMarkerType 8
-#define sz_pexMatchRenderingTargetsReply 32
-#define sz_pexMatchRenderingTargetsReq 20
-#define sz_pexMaxHitsReachedEvent 32
-#define sz_pexModelClipFlag 8
-#define sz_pexModelClipVolume 8
-#define sz_pexModelClipVolume2D 8
-#define sz_pexNoop 4
-#define sz_pexNURBCurve 24
-#define sz_pexNURBSurface 28
-#define sz_pexParaSurfCharacteristics 8
-#define sz_pexPatternAttributes 40
-#define sz_pexPatternAttributes2D 12
-#define sz_pexPatternSize 12
-#define sz_pexPickAllReply 32
-#define sz_pexPickAllReq 20
-#define sz_pexPickID 8
-#define sz_pexPickOneReply 32
-#define sz_pexPickOneReq 20
-#define sz_pexPolyline 4
-#define sz_pexPolyline2D 4
-#define sz_pexPolylineInterpMethod 8
-#define sz_pexPolylineSetWithData 12
-#define sz_pexPostStructureReq 20
-#define sz_pexQuadrilateralMesh 16
-#define sz_pexQueryFontReply 32
-#define sz_pexQueryFontReq 8
-#define sz_pexQueryTextExtentsReply 32
-#define sz_pexQueryTextExtentsReq 36
-#define sz_pexRedrawClipRegionReq 12
-#define sz_pexRenderElementsReq 28
-#define sz_pexRenderNetworkReq 16
-#define sz_pexRenderOutputCommandsReq 16
-#define sz_pexRenderingColorModel 8
-#define sz_pexReq 4
-#define sz_pexResourceReq 8
-#define sz_pexFreeLookupTableReq sz_pexResourceReq
-#define sz_pexGetDefinedIndicesReq sz_pexResourceReq
-#define sz_pexFreePipelineContextReq sz_pexResourceReq
-#define sz_pexFreeRendererReq sz_pexResourceReq
-#define sz_pexGetRendererDynamicsReq sz_pexResourceReq
-#define sz_pexEndStructureReq sz_pexResourceReq
-#define sz_pexCreateStructureReq sz_pexResourceReq
-#define sz_pexCreateNameSetReq sz_pexResourceReq
-#define sz_pexFreeNameSetReq sz_pexResourceReq
-#define sz_pexGetNameSetReq sz_pexResourceReq
-#define sz_pexFreeSearchContextReq sz_pexResourceReq
-#define sz_pexFreeWorkstationReq sz_pexResourceReq
-#define sz_pexRedrawAllStructuresReq sz_pexResourceReq
-#define sz_pexUpdateWorkstationReq sz_pexResourceReq
-#define sz_pexExecuteDeferredActionsReq sz_pexResourceReq
-#define sz_pexUnpostAllStructuresReq sz_pexResourceReq
-#define sz_pexGetWorkstationPostingsReq sz_pexResourceReq
-#define sz_pexFreePickMeasureReq sz_pexResourceReq
-#define sz_pexUnloadFontReq sz_pexResourceReq
-#define sz_pexSearchNetworkReq sz_pexResourceReq
-#define sz_pexRestoreModelClipVolume 4
-#define sz_pexSetOfFillAreaSets 24
-#define sz_pexSearchNetworkReply 32
-#define sz_pexIndividualASF 12
-#define sz_pexSetEditingModeReq 12
-#define sz_pexSetElementPointerAtLabelReq 16
-#define sz_pexSetElementPointerReq 16
-#define sz_pexSetTableEntriesReq 16
-#define sz_pexSetWorkstationBufferModeReq 12
-#define sz_pexSetWorkstationDisplayUpdateModeReq 12
-#define sz_pexSetWorkstationHLHSRModeReq 12
-#define sz_pexSetWorkstationViewPriorityReq 16
-#define sz_pexSetWorkstationViewRepReq 172
-#define sz_pexSetWorkstationViewportReq 32
-#define sz_pexSetWorkstationWindowReq 36
-#define sz_pexStoreElementsReq 16
-#define sz_pexSurfaceApprox 16
-#define sz_pexSurfaceEdgeFlag 8
-#define sz_pexSurfaceEdgeType 8
-#define sz_pexSurfaceInterpMethod 8
-#define sz_pexBFSurfaceInterpMethod 8
-#define sz_pexReflectionAttributes 28
-#define sz_pexBFReflectionAttributes 28
-#define sz_pexReflectionModel 8
-#define sz_pexBFReflectionModel 8
-#define sz_pexText 44
-#define sz_pexText2D 16
-#define sz_pexTextAlignment 8
-#define sz_pexATextAlignment 8
-#define sz_pexTextPath 8
-#define sz_pexATextPath 8
-#define sz_pexTextPrecision 8
-#define sz_pexTriangleStrip 16
-#define sz_pexUnpostStructureReq 12
-#define sz_pexUpdatePickMeasureReq 12
-#define sz_pexCieColor 12
-#define sz_pexColor 12
-#define sz_pexColorApproxEntry 40
-#define sz_pexColorSpecifier 4
-#define sz_pexColorEntry sz_pexColorSpecifier
-#define sz_pexCoord2D 8
-#define sz_pexCoord3D 12
-#define sz_pexCoord4D 16
-#define sz_pexCullMode 2
-#define sz_pexCurveApproxData 8
-#define sz_pexDepthCueEntry 24
-#define sz_pexDeviceCoord 8
-#define sz_pexDeviceCoord2D 4
-#define sz_pexDeviceRect 8
-#define sz_pexEdgeBundleEntry 12
-#define sz_pexElementInfo 4
-#define sz_pexElementPos 8
-#define sz_pexElementRange 16
-#define sz_pexElementRef 8
-#define sz_pexEnumTypeDesc 4
-#define sz_pexEnumTypeIndex 4
-#define sz_pexEscapeSetEchoColorData 8
-#define sz_pexExtentInfo 24
-#define sz_pexFloatColor 12
-#define sz_pexFont 4
-#define sz_pexFontInfo 20
-#define sz_pexFontProp 8
-#define sz_pexHalfSpace 24
-#define sz_pexHalfSpace2D 16
-#define sz_pexHlsColor 12
-#define sz_pexHsvColor 12
-#define sz_pexIndexedColor 4
-#define sz_pexInteriorBundleEntry 28
-#define sz_pexLightEntry 48
-#define sz_pexLineBundleEntry 20
-#define sz_pexLocalTransform2DData 40
-#define sz_pexLocalTransform3DData 68
-#define sz_pexMarkerBundleEntry 12
-#define sz_pexMatrix 64
-#define sz_pexMatrix3X3 36
-#define sz_pexMonoEncoding 8
-#define sz_pexName 4
-#define sz_pexNameSet 4
-#define sz_pexNameSetPair 8
-#define sz_pexNpcSubvolume 24
-#define sz_pexPD_NPC_HitVolume sz_pexNpcSubvolume
-#define sz_pexOutputCommandError 32
-#define sz_pexPD_DC_HitBox 8
-#define sz_pexPSC_IsoparametricCurves 8
-#define sz_pexPSC_LevelCurves 28
-#define sz_pexPatternEntry 8
-#define sz_pexPickElementRef 12
-#define sz_pexPickRecord 4
-#define sz_pexReflectionAttr 24
-#define sz_pexRendererTarget 8
-#define sz_pexRgb16Color 8
-#define sz_pexRgb8Color 4
-#define sz_pexRgbFloatColor 12
-#define sz_pexString 2
-#define sz_pexStructure 4
-#define sz_pexStructureInfo 8
-#define sz_pexSurfaceApproxData 12
-#define sz_pexSwitch 1
-#define sz_pexTableInfo 8
-#define sz_pexTableIndex 2
-#define sz_pexTextAlignmentData 4
-#define sz_pexTextBundleEntry 16
-#define sz_pexTextFontEntry 4
-#define sz_pexTrimCurve 28
-#define sz_pexVector2D 8
-#define sz_pexVector3D 12
-#define sz_pexVertex 12
-#define sz_pexViewEntry 156
-#define sz_pexViewRep 160
-#define sz_pexViewport 20
-
-/* from PEXlibint.h */
-#define sz_pexOCRequestHeader 16
-
-/* for X-Window system protocol elements */
-#define sz_CARD32 4
-#define sz_CARD16 2
-#define sz_CARD8 1
-#define sz_INT32 4
-#define sz_INT16 2
-
-/* for other things */
-#define sz_char 1
-#define sz_short 2
-#define sz_long 4
-#define sz_float 4
-
-
-
-/* -------------------------------------------------------------------------
- * Externally defined globals.
- * ------------------------------------------------------------------------- */
-
-/*
- * Linked list of open displays.
- */
-
-extern PEXDisplayInfo *PEXDisplayInfoHeader;
-
-
-/*
- * Pick path cache.
- */
-
-extern PEXPickPath *PEXPickCache;
-extern unsigned int PEXPickCacheSize;
-extern int PEXPickCacheInUse;
-
-
-/*
- * Floating point conversion function table.
- */
-
-extern void (*(PEX_fp_convert[NUM_FP_FORMATS][NUM_FP_FORMATS]))();
-
-
-
-/* -------------------------------------------------------------------------
- * Function prototypes for PEXlib internal functions.
- * ------------------------------------------------------------------------- */
-
-extern void _PEXCopyPaddedBytesToOC(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* numBytes */,
- char * /* data */
-#endif
-);
-
-extern void _PEXSendBytesToOC(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* numBytes */,
- char * /* data */
-#endif
-);
-
-extern void _PEXOCFacet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* colorType */,
- unsigned int /* facetAttr */,
- PEXFacetData * /* facetData */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXOCListOfFacet(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* count */,
- int /* colorType */,
- unsigned int /* facetAttr */,
- PEXArrayOfFacetData /* facetData */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXOCListOfVertex(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* count */,
- int /* colorType */,
- unsigned int /* vertAttr */,
- PEXArrayOfVertex /* vertData */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXOCListOfColor(
-#if NeedFunctionPrototypes
- Display * /* display */,
- int /* count */,
- int /* colorType */,
- PEXArrayOfColor /* colors */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXStoreFacet(
-#if NeedFunctionPrototypes
- int /* colorType */,
- unsigned int /* facetAttr */,
- PEXFacetData * /* facetData */,
- char ** /* bufPtr */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXStoreListOfFacet(
-#if NeedFunctionPrototypes
- int /* count */,
- int /* colorType */,
- unsigned int /* facetAttr */,
- PEXArrayOfFacetData /* facetData */,
- char ** /* bufPtr */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXStoreListOfVertex(
-#if NeedFunctionPrototypes
- int /* count */,
- int /* colorType */,
- unsigned int /* vertAttr */,
- PEXArrayOfVertex /* vertData */,
- char ** /* bufPtr */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXStoreListOfColor(
-#if NeedFunctionPrototypes
- int /* count */,
- int /* colorType */,
- PEXArrayOfColor /* colors */,
- char ** /* bufPtr */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXExtractFacet(
-#if NeedFunctionPrototypes
- char ** /* bufPtr */,
- int /* colorType */,
- unsigned int /* facetAttr */,
- PEXFacetData * /* facetData */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXExtractListOfFacet(
-#if NeedFunctionPrototypes
- int /* count */,
- char ** /* bufPtr */,
- int /* colorType */,
- unsigned int /* facetAttr */,
- PEXArrayOfFacetData /* facetData */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXExtractListOfVertex(
-#if NeedFunctionPrototypes
- int /* count */,
- char ** /* bufPtr */,
- int /* colorType */,
- unsigned int /* vertAttr */,
- PEXArrayOfVertex /* vertData */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXExtractListOfColor(
-#if NeedFunctionPrototypes
- int /* count */,
- char ** /* bufPtr */,
- int /* colorType */,
- PEXArrayOfColor /* colors */,
- int /* fpFormat */
-#endif
-);
-
-extern void _PEXGenOCBadLengthError(
-#if NeedFunctionPrototypes
- Display * /* display */,
- XID /* resource_id */,
- PEXOCRequestType /* req_type */
-#endif
-);
-
-
-
-/* -------------------------------------------------------------------------
- * Miscellaneous.
- * ------------------------------------------------------------------------- */
-
-/*
- * Argument types in function definitions.
- */
-
-#define INPUT
-#define OUTPUT
-#define INOUT
-
-
-/*
- * Xlib defines min and max as macros; Must undef since min and max
- * are field names in PEXlib data structures.
- */
-
-#ifdef min
-#undef min
-#endif
-
-#ifdef max
-#undef max
-#endif
-
-#endif /* _PEXLIBINT_H_ */
-
-
diff --git a/xc/lib/PEX5/PEXproto.h b/xc/lib/PEX5/PEXproto.h
deleted file mode 100644
index c6ede2c70..000000000
--- a/xc/lib/PEX5/PEXproto.h
+++ /dev/null
@@ -1,2241 +0,0 @@
-/* $TOG: PEXproto.h /main/10 1998/02/06 16:09:31 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.
-
-*/
-
-/******************************************************************************
-Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
-
- All Rights Reserved
-
-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 Sun Microsystems not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Sun Microsystems makes no representations about the
-suitability of this software for any purpose. It is provided "as is" without
-express or implied warranty.
-
-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.)
- */
-
-#define XID CARD32
-#define Drawable CARD32
-
-#include <X11/PEX5/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 */
- } pexGetEnumTypeInfoReply;
-
-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( ) */
- } pexMatchRenderingTargetsReply;
-
-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 */
- 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; /* 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 ) */
- } pexGetWorkstationAttributesReply;
-
-
-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 colorTable;
- 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 colorApproxTable;
- CARD8 pad[3];
- } pexGetWorkstationDynamicsReply;
-
-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 */
- } pexGetWorkstationViewRepReply;
-
-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() */
- } pexGetWorkstationPostingsReply;
-
-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;
-
-/****************************************************************
- * 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 ) */
-} pexGetEnumTypeInfoReq;
-
-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;
-} pexMatchRenderingTargetsReq;
-
-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; /* 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 itemMask0 B32;
- pexBitmask itemMask1 B32;
- pexBitmask itemMask2 B32;
- /* SINGLE PipelineContextAttributes( itemMask ) */
-} pexCreatePipelineContextReq;
-
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 6 */
- pexPC src B32;
- pexPC dst B32;
- pexBitmask itemMask0 B32;
- pexBitmask itemMask1 B32;
- pexBitmask itemMask2 B32;
-} pexCopyPipelineContextReq;
-
-typedef pexResourceReq pexFreePipelineContextReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 6 */
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexPC pc B32;
- pexBitmask itemMask0 B32;
- pexBitmask itemMask1 B32;
- pexBitmask itemMask2 B32;
-} pexGetPipelineContextReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16;
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexPC pc B32;
- pexBitmask itemMask0 B32;
- pexBitmask itemMask1 B32;
- pexBitmask itemMask2 B32;
- /* 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;
- 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;
- CARD16 position1_whence B16;
- CARD16 unused1 B16;
- INT32 position1_offset B32;
- CARD16 position2_whence B16;
- CARD16 unused2 B16;
- INT32 position2_offset B32;
-} 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; /* 7 */
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexStructure sid B32;
- CARD16 position1_whence B16;
- CARD16 unused1 B16;
- INT32 position1_offset B32;
- CARD16 position2_whence B16;
- CARD16 unused2 B16;
- INT32 position2_offset B32;
-} 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;
- CARD16 position1_whence B16;
- CARD16 unused1 B16;
- INT32 position1_offset B32;
- CARD16 position2_whence B16;
- CARD16 unused2 B16;
- INT32 position2_offset B32;
-} 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;
- CARD16 position_whence B16;
- CARD16 unused B16;
- INT32 position_offset B32;
-} 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;
- pexStructure sid B32;
- CARD16 position_whence B16;
- CARD16 unused B16;
- INT32 position_offset B32;
- 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;
- CARD16 position1_whence B16;
- CARD16 unused1 B16;
- INT32 position1_offset B32;
- CARD16 position2_whence B16;
- CARD16 unused2 B16;
- INT32 position2_offset B32;
-} pexDeleteElementsReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 5 */
- pexStructure sid B32;
- CARD16 position_whence B16;
- CARD16 unused B16;
- INT32 position_offset B32;
- 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;
- CARD16 srcPosition1_whence B16;
- CARD16 unused1 B16;
- INT32 srcPosition1_offset B32;
- CARD16 srcPosition2_whence B16;
- CARD16 unused2 B16;
- INT32 srcPosition2_offset B32;
- pexStructure dst B32;
- CARD16 dstPosition_whence B16;
- CARD16 unused3 B16;
- INT32 dstPosition_offset B32;
-} 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 colorTable B32;
- pexLookupTable depthCueTable B32;
- pexLookupTable lightTable B32;
- pexLookupTable colorApproxTable 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;
-} pexCreateWorkstationReq;
-
-typedef pexResourceReq pexFreeWorkstationReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 5 */
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexPhigsWks wks B32;
- pexBitmask itemMask0 B32;
- pexBitmask itemMask1 B32;
-} pexGetWorkstationAttributesReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 2 */
- Drawable drawable B32;
-} pexGetWorkstationDynamicsReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 3 */
- pexEnumTypeIndex fpFormat B16;
- pexTableIndex index B16;
- pexPhigsWks wks B32;
-} pexGetWorkstationViewRepReq;
-
-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;
-} pexSetWorkstationViewPriorityReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 3 */
- pexPhigsWks wks B32;
- pexEnumTypeIndex displayUpdate B16;
- CARD16 pad B16;
-} pexSetWorkstationDisplayUpdateModeReq;
-
-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 unused1 B16;
- pexPhigsWks wks B32;
- pexTableIndex index B16;
- CARD16 unused2 B16;
- CARD16 clipFlags B16;
- CARD16 unused3 B16;
- PEXFLOAT clipLimits_xmin B32;
- PEXFLOAT clipLimits_ymin B32;
- PEXFLOAT clipLimits_zmin B32;
- PEXFLOAT clipLimits_xmax B32;
- PEXFLOAT clipLimits_ymax B32;
- PEXFLOAT clipLimits_zmax B32;
- pexMatrix view_orientation;
- pexMatrix view_mapping;
-} pexSetWorkstationViewRepReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 9 */
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexPhigsWks wks B32;
- PEXFLOAT npcSubvolume_xmin B32;
- PEXFLOAT npcSubvolume_ymin B32;
- PEXFLOAT npcSubvolume_zmin B32;
- PEXFLOAT npcSubvolume_xmax B32;
- PEXFLOAT npcSubvolume_ymax B32;
- PEXFLOAT npcSubvolume_zmax B32;
-} pexSetWorkstationWindowReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 8 */
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexPhigsWks wks B32;
- INT16 viewport_xmin B16;
- INT16 viewport_ymin B16;
- PEXFLOAT viewport_zmin B32;
- INT16 viewport_xmax B16;
- INT16 viewport_ymax B16;
- PEXFLOAT viewport_zmax B32;
- pexSwitch useDrawable;
- BYTE pad[3];
-} pexSetWorkstationViewportReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 3 */
- pexPhigsWks wks B32;
- pexEnumTypeIndex mode B16;
- CARD16 pad B16;
-} pexSetWorkstationHLHSRModeReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 3 */
- pexPhigsWks wks B32;
- CARD16 bufferMode B16;
- CARD16 pad B16;
-} pexSetWorkstationBufferModeReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 5 */
- pexEnumTypeIndex fpFormat B16;
- CARD16 unused B16;
- pexPhigsWks wks B32;
- pexStructure sid B32;
- PEXFLOAT priority B32;
-} pexPostStructureReq;
-
-typedef struct {
- CARD8 reqType;
- CARD8 opcode;
- CARD16 length B16; /* 3 */
- pexPhigsWks wks B32;
- pexStructure sid B32;
-} pexUnpostStructureReq;
-
-typedef pexResourceReq pexUnpostAllStructuresReq;
-
-typedef pexResourceReq pexGetWorkstationPostingsReq;
-
-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 B32;
- 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 ) */
-} pexLoadFontReq;
-
-typedef pexResourceReq pexUnloadFontReq;
-
-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 B32;
- PEXFLOAT charSpacing B32;
- PEXFLOAT charHeight B32;
- CARD16 alignment_vertical B16;
- CARD16 alignment_horizontal B16;
- CARD32 numStrings B32;
- /* LISTof LISTof MONO_ENCODINGS() */
- /* pad() */
-} pexQueryTextExtentsReq;
-
-/*****************************************************************
- * Output Commands
- *****************************************************************/
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex markerType B16;
- CARD16 pad B16;
-} pexMarkerType;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT scale B32;
-} pexMarkerScale;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexTableIndex index B16;
- CARD16 pad B16;
-} pexMarkerBundleIndex;
-
-typedef pexMarkerBundleIndex pexMarkerColorIndex;
-typedef pexMarkerBundleIndex pexTextColorIndex;
-typedef pexMarkerBundleIndex pexLineColorIndex;
-typedef pexMarkerBundleIndex pexSurfaceColorIndex;
-typedef pexMarkerBundleIndex pexBFSurfaceColorIndex;
-typedef pexMarkerBundleIndex pexSurfaceEdgeColorIndex;
-
-typedef pexMarkerBundleIndex pexTextFontIndex;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexColorType colorType B16;
- CARD16 unused B16;
- /* SINGLE COLOR(colorType) */
-} pexMarkerColor;
-
-typedef pexMarkerColor pexTextColor;
-typedef pexMarkerColor pexLineColor;
-typedef pexMarkerColor pexSurfaceColor;
-typedef pexMarkerColor pexBFSurfaceColor;
-typedef pexMarkerColor pexSurfaceEdgeColor;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- 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 pexColorApproxIndex;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 precision B16;
- CARD16 pad B16;
-} pexTextPrecision;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT expansion B32;
-} pexCharExpansion;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT spacing B32;
-} pexCharSpacing;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT height B32;
-} pexCharHeight;
-typedef pexCharHeight pexATextHeight;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT up_x B32;
- PEXFLOAT up_y B32;
-} pexCharUpVector;
-typedef pexCharUpVector pexATextUpVector;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 path B16;
- CARD16 pad B16;
-} pexTextPath;
-typedef pexTextPath pexATextPath;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 alignment_vertical B16;
- CARD16 alignment_horizontal B16;
-} pexTextAlignment;
-typedef pexTextAlignment pexATextAlignment;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex lineType B16;
- CARD16 pad B16;
-} pexLineType;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT width B32;
-} pexLineWidth;
-typedef pexLineWidth pexSurfaceEdgeWidth;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex approxMethod B16;
- CARD16 unused B16;
- PEXFLOAT tolerance B32;
-} pexCurveApprox;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex polylineInterp B16;
- CARD16 pad B16;
-} pexPolylineInterpMethod;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex interiorStyle B16;
- CARD16 pad B16;
-} pexInteriorStyle;
-typedef pexInteriorStyle pexBFInteriorStyle;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT ambient B32;
- PEXFLOAT diffuse B32;
- PEXFLOAT specular B32;
- PEXFLOAT specularConc B32;
- PEXFLOAT transmission B32;
- pexColorType specular_colorType B16;
- CARD16 unused B16;
- /* SINGLE COLOR(specular_colorType) */
-} pexReflectionAttributes;
-typedef pexReflectionAttributes pexBFReflectionAttributes;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex reflectionModel B16;
- CARD16 pad B16;
-} pexReflectionModel;
-typedef pexReflectionModel pexBFReflectionModel;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex surfaceInterp B16;
- CARD16 pad B16;
-} pexSurfaceInterpMethod;
-typedef pexSurfaceInterpMethod pexBFSurfaceInterpMethod;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex approxMethod B16;
- CARD16 unused B16;
- PEXFLOAT uTolerance B32;
- PEXFLOAT vTolerance B32;
-} pexSurfaceApprox;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexCullMode cullMode B16;
- CARD16 pad B16;
-} pexFacetCullingMode;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexSwitch distinguish;
- BYTE pad[3];
-} pexFacetDistinguishFlag;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT size_x B32;
- PEXFLOAT size_y B32;
-} pexPatternSize;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT point_x B32;
- PEXFLOAT point_y B32;
-} pexPatternAttributes2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT refPt_x B32;
- PEXFLOAT refPt_y B32;
- PEXFLOAT refPt_z B32;
- PEXFLOAT vector1_x B32;
- PEXFLOAT vector1_y B32;
- PEXFLOAT vector1_z B32;
- PEXFLOAT vector2_x B32;
- PEXFLOAT vector2_y B32;
- PEXFLOAT vector2_z B32;
-} pexPatternAttributes;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexSwitch onoff;
- BYTE pad[3];
-} pexSurfaceEdgeFlag;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex edgeType B16;
- CARD16 pad B16;
-} pexSurfaceEdgeType;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexAsfAttribute attribute B32;
- pexAsfValue source;
- BYTE pad[3];
-} pexIndividualASF;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexComposition compType B16;
- CARD16 unused B16;
- pexMatrix matrix;
-} pexLocalTransform;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexComposition compType B16;
- CARD16 unused B16;
- pexMatrix3X3 matrix3X3;
-} pexLocalTransform2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexMatrix matrix;
-} pexGlobalTransform;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexMatrix3X3 matrix3X3;
-} pexGlobalTransform2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexSwitch onoff;
- BYTE pad[3];
-} pexModelClipFlag;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex modelClipOperator B16;
- CARD16 numHalfSpaces B16;
- /* LISTof pexHalfSpace( numHalfSpaces ) */
-} pexModelClipVolume;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex modelClipOperator B16;
- CARD16 numHalfSpaces B16;
- /* LISTof pexHalfSpace2D( numHalfSpaces ) */
-} pexModelClipVolume2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
-} pexRestoreModelClipVolume;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 numEnable B16;
- CARD16 numDisable B16;
- /* LISTof pexTableIndex( numEnable ) */
- /* pad( ( numEnable )*2 ) */
- /* LISTof pexTableIndex( numDisable ) */
- /* pad( ( numDisable )*2 ) */
-} pexLightSourceState;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD32 pickId B32;
-} pexPickID;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD32 hlhsrID B32;
-} pexHLHSRID;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex model B16;
- CARD16 pad B16;
-} pexRenderingColorModel;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexEnumTypeIndex characteristics B16;
- CARD16 length B16;
- /* SINGLEof PARAMETRIC_SURFACE_CHARACTERISTICS */
-} pexParaSurfCharacteristics;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- /* LISTof pexName() */
-} pexAddToNameSet;
-typedef pexAddToNameSet pexRemoveFromNameSet;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexStructure id B32;
-} pexExecuteStructure;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- INT32 label B32;
-} pexLabel;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 numElements B16;
- CARD16 unused B16;
- /* LISTof CARD8( numElements ) -- don't swap */
- /* pad( numElements ) */
-} pexApplicationData;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD32 id B32;
- CARD16 numElements B16;
- CARD16 unused B16;
- /* LISTof CARD8( numElements ) -- don't swap */
- /* pad( numElements ) */
-} pexGSE;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- /* LISTof pexCoord3D() */
-} pexMarkers;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- /* LISTof pexCoord2D() */
-} pexMarkers2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT origin_x B32;
- PEXFLOAT origin_y B32;
- PEXFLOAT origin_z B32;
- PEXFLOAT vector1_x B32;
- PEXFLOAT vector1_y B32;
- PEXFLOAT vector1_z B32;
- PEXFLOAT vector2_x B32;
- PEXFLOAT vector2_y B32;
- PEXFLOAT vector2_z B32;
- CARD16 numEncodings B16;
- CARD16 unused B16;
- /* LISTof pexMonoEncoding( numEncodings ) */
-} pexText;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT origin_x B32;
- PEXFLOAT origin_y B32;
- CARD16 numEncodings B16;
- CARD16 unused B16;
- /* LISTof pexMonoEncoding( numEncodings ) */
-} pexText2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT origin_x B32;
- PEXFLOAT origin_y B32;
- PEXFLOAT origin_z B32;
- PEXFLOAT offset_x B32;
- PEXFLOAT offset_y B32;
- PEXFLOAT offset_z B32;
- CARD16 numEncodings B16;
- CARD16 unused B16;
- /* LISTof pexMonoEncoding( numEncodings ) */
-} pexAnnotationText;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT origin_x B32;
- PEXFLOAT origin_y B32;
- PEXFLOAT offset_x B32;
- PEXFLOAT offset_y B32;
- CARD16 numEncodings B16;
- CARD16 unused B16;
- /* LISTof pexMonoEncoding( numEncodings ) */
-} pexAnnotationText2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- /* LISTof pexCoord3D() */
-} pexPolyline;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- /* LISTof pexCoord2D() */
-} pexPolyline2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexColorType colorType B16;
- pexBitmaskShort vertexAttribs B16;
- CARD32 numLists B32;
- /* LISTof CLISTof pexVertex( numLists, vertexAttribs, colorType ) */
-} pexPolylineSetWithData;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 curveOrder B16;
- pexCoordType coordType B16;
- PEXFLOAT tmin B32;
- PEXFLOAT tmax B32;
- CARD32 numKnots B32;
- CARD32 numPoints B32;
- /* LISTof FLOAT( numKnots ) */
- /* LISTof {pexCoord3D|pexCoord4D}( numPoints, coordType ) */
-} pexNURBCurve;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexSwitch ignoreEdges;
- CARD8 pad;
- /* LISTof pexCoord3D() */
-} pexFillArea;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexSwitch ignoreEdges;
- CARD8 unused;
- /* LISTof pexCoord2D() */
-} pexFillArea2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexSwitch ignoreEdges;
- CARD8 unused;
- pexColorType colorType B16;
- pexBitmaskShort facetAttribs B16;
- pexBitmaskShort vertexAttribs B16;
- CARD16 unused2 B16;
- /* SINGLE Facet( facetAttribs, vertexAttribs, colorType ) */
-} pexFillAreaWithData;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexSwitch ignoreEdges;
- CARD8 contourHint;
- CARD32 numLists B32;
- /* LISTof CLISTof Coord3D( numLists ) */
-} pexFillAreaSet;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexSwitch ignoreEdges;
- CARD8 contourHint;
- CARD32 numLists B32;
- /* LISTof CLISTof Coord2D( numLists ) */
-} pexFillAreaSet2D;
-
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexSwitch ignoreEdges;
- CARD8 contourHint;
- pexColorType colorType B16;
- pexBitmaskShort facetAttribs B16;
- pexBitmaskShort vertexAttribs B16;
- CARD16 unused2 B16;
- CARD32 numLists B32;
- /* pexOptData( facetAttribs ) */
- /* LISTof CLISTof pexVertex( numLists, vertexAttribs, colorType ) */
-} pexFillAreaSetWithData;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexColorType colorType B16;
- pexBitmaskShort facetAttribs B16;
- pexBitmaskShort vertexAttribs B16;
- CARD16 unused B16;
- CARD32 numVertices B32;
- /* number of OptData is numVert - 2 */
- /* LISTof pexOptData( facetAttribs, colorType ) */
- /* LISTof pexVertex( numVertices, vertexAttribs, colorType ) */
-} pexTriangleStrip;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexColorType colorType 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, colorType ) */
- /* LISTof pexVertex( mPts, nPts, vertexAttribs, colorType ) */
-} pexQuadrilateralMesh;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- CARD16 shape B16;
- pexColorType colorType 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 */
-} pexSetOfFillAreaSets;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- 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 {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT point1_x B32;
- PEXFLOAT point1_y B32;
- PEXFLOAT point1_z B32;
- PEXFLOAT point2_x B32;
- PEXFLOAT point2_y B32;
- PEXFLOAT point2_z B32;
- PEXFLOAT point3_x B32;
- PEXFLOAT point3_y B32;
- PEXFLOAT point3_z B32;
- CARD32 dx B32;
- CARD32 dy B32;
- /* LISTof pexTableIndex( dx, dy ) */
- /* pad( 2*dx*dy ) */
-} pexCellArray;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- PEXFLOAT point1_x B32;
- PEXFLOAT point1_y B32;
- PEXFLOAT point2_x B32;
- PEXFLOAT point2_y B32;
- CARD32 dx B32;
- CARD32 dy B32;
- /* LISTof pexTableIndex( dx, dy ) */
- /* pad( 2*dx*dy ) */
-} pexCellArray2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- pexColorType colorType B16;
- CARD16 unused B16;
- PEXFLOAT point1_x B32;
- PEXFLOAT point1_y B32;
- PEXFLOAT point1_z B32;
- PEXFLOAT point2_x B32;
- PEXFLOAT point2_y B32;
- PEXFLOAT point2_z B32;
- PEXFLOAT point3_x B32;
- PEXFLOAT point3_y B32;
- PEXFLOAT point3_z B32;
- CARD32 dx B32;
- CARD32 dy B32;
- /* LISTof pexColorSpecifier( dx, dy ) */
-} pexExtendedCellArray;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- INT32 gdpId B32;
- CARD32 numPoints B32;
- CARD32 numBytes B32;
- /* LISTof pexCoord3D( numPoints ) */
- /* LISTof CARD8( numBytes ) -- don't swap */
- /* pad( numBytes ) */
-} pexGDP;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
- INT32 gdpId B32;
- CARD32 numPoints B32;
- CARD32 numBytes B32;
- /* LISTof pexCoord2D( numPoints ) */
- /* LISTof CARD8( numBytes ) -- don't swap */
- /* pad( numBytes ) */
-} pexGDP2D;
-
-typedef struct {
- CARD16 oc_opcode B16;
- CARD16 oc_length B16;
-} pexNoop;
-
-/****************************************************************
- * EVENTS *
- ****************************************************************/
-/* Event structure */
-
-typedef struct {
- BYTE type; /* X_Event */
- CARD8 what; /* unused */
- CARD16 sequenceNumber B16;
- CARD32 rdr B32;
- BYTE pad[24];
-} pexMaxHitsReachedEvent;
-
-#undef XID
-#undef Drawable
-
-#endif /* _PEXPROTO_H_ */
-
diff --git a/xc/lib/PEX5/PEXprotost.h b/xc/lib/PEX5/PEXprotost.h
deleted file mode 100644
index a7670f147..000000000
--- a/xc/lib/PEX5/PEXprotost.h
+++ /dev/null
@@ -1,678 +0,0 @@
-/* $TOG: PEXprotost.h /main/8 1998/02/06 16:09: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.
-
-*/
-
-
-/******************************************************************************
-Copyright 1989, 1990, 1991 by Sun Microsystems, Inc.
-
- All Rights Reserved
-
-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 Sun Microsystems not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Sun Microsystems makes no representations about the
-suitability of this software for any purpose. It is provided "as is" without
-express or implied warranty.
-
-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 _PEXPROTOST_H_
-#define _PEXPROTOST_H_
-
-/* Matches revision 5.1C */
-
-#include <X11/Xmd.h> /* defines things like CARD32 */
-
-
-/* This is FLOAT as defined and used by the Protocol Encoding */
-#ifndef WORD64
-typedef float PEXFLOAT;
-#else
-typedef CARD32 PEXFLOAT;
-#endif
-
-
-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;
-
-#ifndef WORD64
-typedef PEXFLOAT pexMatrix[4][4];
-typedef PEXFLOAT pexMatrix3X3[3][3];
-#else
-typedef CARD8 pexMatrix[64];
-typedef CARD8 pexMatrix3X3[36];
-#endif
-
-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 pexColorType; /* ColorType */
-
-/* included in others */
-typedef struct {
- CARD16 length B16;
- /* list of CARD8 -- don't swap */
-} pexString;
-
-typedef struct {
- pexStructure sid B32;
- PEXFLOAT priority B32;
-} pexStructureInfo;
-
-typedef struct {
- PEXFLOAT x B32;
- PEXFLOAT y B32;
-} pexVector2D;
-
-typedef struct {
- PEXFLOAT x B32;
- PEXFLOAT y B32;
- PEXFLOAT z B32;
-} pexVector3D;
-
-/* Coord structures */
-
-typedef struct {
- PEXFLOAT x B32;
- PEXFLOAT y B32;
-} pexCoord2D;
-
-typedef struct {
- PEXFLOAT x B32;
- PEXFLOAT y B32;
- PEXFLOAT z B32;
-} pexCoord3D;
-
-typedef struct {
- PEXFLOAT x B32;
- PEXFLOAT y B32;
- PEXFLOAT z B32;
- PEXFLOAT w B32;
-} pexCoord4D;
-
-
-/* Color structures */
-typedef struct {
- PEXFLOAT red B32;
- PEXFLOAT green B32;
- PEXFLOAT blue B32;
-} pexRgbFloatColor;
-
-typedef struct {
- PEXFLOAT hue B32;
- PEXFLOAT saturation B32;
- PEXFLOAT value B32;
-} pexHsvColor;
-
-typedef struct {
- PEXFLOAT hue B32;
- PEXFLOAT lightness B32;
- PEXFLOAT saturation B32;
-} pexHlsColor;
-
-typedef struct {
- PEXFLOAT x B32;
- PEXFLOAT y B32;
- PEXFLOAT z B32;
-} pexCieColor;
-
-typedef struct {
- CARD8 red;
- CARD8 green;
- CARD8 blue;
- CARD8 pad;
-} pexRgb8Color;
-
-typedef struct {
- CARD16 red B16;
- CARD16 green B16;
- CARD16 blue B16;
- CARD16 pad B16;
-} pexRgb16Color;
-
-typedef struct {
- pexTableIndex index B16;
- CARD16 pad B16;
-} pexIndexedColor;
-
-typedef struct {
- union {
- pexIndexedColor indexed;
- pexRgb8Color rgb8;
- pexRgb16Color rgb16;
- pexRgbFloatColor rgbFloat;
- pexHsvColor hsvFloat;
- pexHlsColor hlsFloat;
- pexCieColor cieFloat;
- } format;
-} pexColor;
-
-typedef struct {
- PEXFLOAT first B32;
- PEXFLOAT second B32;
- PEXFLOAT third B32;
-} pexFloatColor;
-
-typedef struct {
- pexColorType colorType B16; /* ColorType enumerated type */
- CARD16 unused B16;
- /* SINGLE COLOR(colorType) */
-} pexColorSpecifier;
-
-
-typedef struct {
- pexEnumTypeIndex approxMethod B16;
- CARD16 unused B16;
- PEXFLOAT tolerance B32;
-} pexCurveApproxData;
-
-typedef struct {
- INT16 x B16;
- INT16 y B16;
- PEXFLOAT z B32;
-} 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 is 8 bytes long */
- pexElementPos position2;
-} pexElementRange;
-
-typedef struct {
- pexStructure structure B32;
- CARD32 offset B32;
-} pexElementRef;
-
-typedef struct {
- PEXFLOAT lowerLeft_x B32;
- PEXFLOAT lowerLeft_y B32;
- PEXFLOAT upperRight_x B32;
- PEXFLOAT upperRight_y B32;
- PEXFLOAT concatpoint_x B32;
- PEXFLOAT concatpoint_y B32;
-} pexExtentInfo;
-
-typedef struct {
- pexEnumTypeIndex index B16;
- CARD16 descriptor_length B16;
-} pexEnumTypeDesc;
-
-typedef struct {
- PEXFLOAT point_x B32;
- PEXFLOAT point_y B32;
- PEXFLOAT point_z B32;
- PEXFLOAT vector_x B32;
- PEXFLOAT vector_y B32;
- PEXFLOAT vector_z B32;
-} pexHalfSpace;
-
-typedef struct {
- pexNameSet incl B32;
- pexNameSet excl B32;
-} pexNameSetPair;
-
-typedef struct {
- PEXFLOAT point_x B32;
- PEXFLOAT point_y B32;
- PEXFLOAT vector_x B32;
- PEXFLOAT vector_y B32;
-} 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 {
- PEXFLOAT xmin B32;
- PEXFLOAT ymin B32;
- PEXFLOAT zmin B32;
- PEXFLOAT xmax B32;
- PEXFLOAT ymax B32;
- PEXFLOAT zmax B32;
-} 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 B32;
- PEXFLOAT tMin B32;
- PEXFLOAT tMax B32;
- 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 B16;
- /* SINGLE HITBOX() */
-} pexPickRecord;
-
-typedef struct {
- PEXFLOAT ambient B32;
- PEXFLOAT diffuse B32;
- PEXFLOAT specular B32;
- PEXFLOAT specularConc B32;
- PEXFLOAT transmission B32; /* 0.0 = opaque, 1.0 = transparent */
- pexColorType specular_colorType B16;
- CARD16 unused B16;
- /* SINGLE COLOR() */
-} pexReflectionAttr;
-
-typedef struct {
- pexEnumTypeIndex approxMethod B16;
- CARD16 unused B16;
- PEXFLOAT uTolerance B32;
- PEXFLOAT vTolerance B32;
-} pexSurfaceApproxData;
-
-
-typedef struct {
- PEXFLOAT point_x B32;
- PEXFLOAT point_y B32;
- PEXFLOAT point_z B32;
- /* SINGLE OPT_DATA() */
-} pexVertex;
-
-
-typedef struct {
- INT16 xmin B16;
- INT16 ymin B16;
- PEXFLOAT zmin B32;
- INT16 xmax B16;
- INT16 ymax B16;
- PEXFLOAT zmax B32;
- pexSwitch useDrawable;
- BYTE pad[3];
-} pexViewport;
-
-typedef struct {
- CARD16 clipFlags B16;
- CARD16 unused B16;
- PEXFLOAT clipLimits_xmin B32;
- PEXFLOAT clipLimits_ymin B32;
- PEXFLOAT clipLimits_zmin B32;
- PEXFLOAT clipLimits_xmax B32;
- PEXFLOAT clipLimits_ymax B32;
- PEXFLOAT clipLimits_zmax B32;
- pexMatrix orientation;
- pexMatrix mapping;
-} pexViewEntry;
-
-typedef struct {
- pexTableIndex index B16;
- CARD16 unused1 B16;
- CARD16 clipFlags B16;
- CARD16 unused2 B16;
- PEXFLOAT clipLimits_xmin B32;
- PEXFLOAT clipLimits_ymin B32;
- PEXFLOAT clipLimits_zmin B32;
- PEXFLOAT clipLimits_xmax B32;
- PEXFLOAT clipLimits_ymax B32;
- PEXFLOAT clipLimits_zmax B32;
- pexMatrix orientation;
- pexMatrix mapping;
-} 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;
- pexEnumTypeIndex curveApprox_method B16;
- CARD16 unused1 B16;
- PEXFLOAT curveApprox_tolerance B32;
- PEXFLOAT lineWidth B32;
- pexColorType lineColorType B16;
- CARD16 unused2 B16;
- /* SINGLE COLOR(lineColorType) */
-} pexLineBundleEntry;
-
-typedef struct {
- pexEnumTypeIndex markerType B16;
- INT16 unused1 B16;
- PEXFLOAT markerScale B32;
- pexColorType markerColorType B16;
- CARD16 unused2 B16;
- /* SINGLE COLOR(markerColorType) */
-} pexMarkerBundleEntry;
-
-typedef struct {
- CARD16 textFontIndex B16;
- CARD16 textPrecision B16;
- PEXFLOAT charExpansion B32;
- PEXFLOAT charSpacing B32;
- pexColorType textColorType B16;
- CARD16 unused B16;
- /* SINGLE COLOR(textColorType) */
-} pexTextBundleEntry;
-
-
-/*
- Note that since an InteriorBundleEntry contains 4 embedded instances of
- pexColorSpecifier, 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;
- pexEnumTypeIndex surfaceApprox_method B16;
- CARD16 unused B16;
- PEXFLOAT surfaceApproxuTolerance B32;
- PEXFLOAT surfaceApproxvTolerance B32;
- /* SINGLE pexColorSpecifier surfaceColor */
- /* SINGLE pexReflectionAttr reflectionAttr */
- /* SINGLE pexColorSpecifier bfSurfaceColor */
- /* SINGLE pexReflectionAttr bfReflectionAttr */
-} pexInteriorBundleEntry;
-
-typedef struct {
- pexSwitch edges;
- CARD8 unused1;
- pexEnumTypeIndex edgeType B16;
- PEXFLOAT edgeWidth B32;
- pexColorType edgeColorType B16;
- CARD16 unused2 B16;
- /* SINGLE COLOR(edgeColorType) */
-} pexEdgeBundleEntry;
-
-typedef struct {
- pexColorType colorType B16;
- CARD16 numx B16;
- CARD16 numy B16;
- CARD16 unused B16;
- /* LISTof Color(numx, numy) 2D array of colors */
-} pexPatternEntry;
-
-/* a pexColorEntry is just a pexColorSpecifier
-*/
-
-typedef struct {
- CARD32 numFonts B32;
- /* LISTof pexFont( numFonts ) */
-} pexTextFontEntry;
-
-/* a pexViewEntry is defined above */
-
-typedef struct {
- pexEnumTypeIndex lightType B16;
- INT16 unused1 B16;
- PEXFLOAT direction_x B32;
- PEXFLOAT direction_y B32;
- PEXFLOAT direction_z B32;
- PEXFLOAT point_x B32;
- PEXFLOAT point_y B32;
- PEXFLOAT point_z B32;
- PEXFLOAT concentration B32;
- PEXFLOAT spreadAngle B32;
- PEXFLOAT attenuation1 B32;
- PEXFLOAT attenuation2 B32;
- pexColorType lightColorType B16;
- CARD16 unused2 B16;
- /* SINGLE COLOR(lightColorType) */
-} pexLightEntry;
-
-typedef struct {
- pexSwitch mode;
- CARD8 unused1;
- CARD16 unused2 B16;
- PEXFLOAT frontPlane B32;
- PEXFLOAT backPlane B32;
- PEXFLOAT frontScaling B32;
- PEXFLOAT backScaling B32;
- pexColorType depthCueColorType B16;
- CARD16 unused3 B16;
- /* SINGLE COLOR(depthCueColorType) */
-} pexDepthCueEntry;
-
-typedef struct {
- INT16 approxType B16;
- INT16 approxModel B16;
- CARD16 max1 B16;
- CARD16 max2 B16;
- CARD16 max3 B16;
- CARD8 dither;
- CARD8 unused;
- CARD32 mult1 B32;
- CARD32 mult2 B32;
- CARD32 mult3 B32;
- PEXFLOAT weight1 B32;
- PEXFLOAT weight2 B32;
- PEXFLOAT weight3 B32;
- CARD32 basePixel B32;
-} pexColorApproxEntry;
-
-
-/* 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 B16;
- /* 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 {
- PEXFLOAT origin_x B32;
- PEXFLOAT origin_y B32;
- PEXFLOAT origin_z B32;
- PEXFLOAT direction_x B32;
- PEXFLOAT direction_y B32;
- PEXFLOAT direction_z B32;
- CARD16 numberIntersections B16;
- CARD16 pad B16;
- /* LISTof pexCoord3D( numIntersections ) */
-} pexPSC_LevelCurves; /* type 4: MC
- type 5: WC */
-
-/* Pick Device data records */
-
-typedef struct {
- INT16 position_x B16;
- INT16 position_y B16;
- PEXFLOAT distance B32;
-} 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 ColorSpecifier() */
-} pexEscapeSetEchoColorData;
-
-#endif /* _PEXPROTOST_H_ */
diff --git a/xc/lib/PEX5/jump_funcs b/xc/lib/PEX5/jump_funcs
deleted file mode 100644
index 4afa711ac..000000000
--- a/xc/lib/PEX5/jump_funcs
+++ /dev/null
@@ -1,417 +0,0 @@
-# $XConsortium: jump_funcs,v 1.2 94/12/07 10:48:56 kaleb Exp $
-# $XFree86: xc/lib/PEX5/jump_funcs,v 3.1 1995/01/28 15:42:19 dawes Exp $
-#
-00000000 T _PEXEscape libPEX5 pl_escape
-00000000 T _PEXEscapeWithReply libPEX5 pl_escape
-00000000 T _PEXSetEchoColor libPEX5 pl_escape
-00000000 T _PEXLoadFont libPEX5 pl_font
-00000000 T _PEXUnloadFont libPEX5 pl_font
-00000000 T _PEXQueryFont libPEX5 pl_font
-00000000 T _PEXListFonts libPEX5 pl_font
-00000000 T _PEXListFontsWithInfo libPEX5 pl_font
-00000000 T _PEXQueryTextExtents libPEX5 pl_font
-00000000 T _PEXQueryEncodedTextExtents libPEX5 pl_font
-00000000 T _PEXFreeEnumInfo libPEX5 pl_free
-00000000 T _PEXFreeFontInfo libPEX5 pl_free
-00000000 T _PEXFreeFontNames libPEX5 pl_free
-00000000 T _PEXFreePCAttributes libPEX5 pl_free
-00000000 T _PEXFreePDAttributes libPEX5 pl_free
-00000000 T _PEXFreePMAttributes libPEX5 pl_free
-00000000 T _PEXFreePickPaths libPEX5 pl_free
-00000000 T _PEXFreeRendererAttributes libPEX5 pl_free
-00000000 T _PEXFreeSCAttributes libPEX5 pl_free
-00000000 T _PEXFreeStructurePaths libPEX5 pl_free
-00000000 T _PEXFreeTableEntries libPEX5 pl_free
-00000000 T _PEXFreeWorkstationAttributes libPEX5 pl_free
-00000000 T _PEXFreeOCData libPEX5 pl_free
-00000000 T _PEXCreateLookupTable libPEX5 pl_lut
-00000000 T _PEXFreeLookupTable libPEX5 pl_lut
-00000000 T _PEXCopyLookupTable libPEX5 pl_lut
-00000000 T _PEXGetTableInfo libPEX5 pl_lut
-00000000 T _PEXGetPredefinedEntries libPEX5 pl_lut
-00000000 T _PEXGetDefinedIndices libPEX5 pl_lut
-00000000 T _PEXGetTableEntry libPEX5 pl_lut
-00000000 T _PEXGetTableEntries libPEX5 pl_lut
-00000000 T _PEXSetTableEntries libPEX5 pl_lut
-00000000 T _PEXDeleteTableEntries libPEX5 pl_lut
-00000000 T _PEXCreateNameSet libPEX5 pl_nameset
-00000000 T _PEXFreeNameSet libPEX5 pl_nameset
-00000000 T _PEXCopyNameSet libPEX5 pl_nameset
-00000000 T _PEXGetNameSet libPEX5 pl_nameset
-00000000 T _PEXChangeNameSet libPEX5 pl_nameset
-00000000 T _PEXSetMarkerType libPEX5 pl_oc_attr
-00000000 T _PEXSetMarkerScale libPEX5 pl_oc_attr
-00000000 T _PEXSetMarkerColorIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetMarkerColor libPEX5 pl_oc_attr
-00000000 T _PEXSetMarkerBundleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetTextFontIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetTextPrecision libPEX5 pl_oc_attr
-00000000 T _PEXSetCharExpansion libPEX5 pl_oc_attr
-00000000 T _PEXSetCharSpacing libPEX5 pl_oc_attr
-00000000 T _PEXSetTextColorIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetTextColor libPEX5 pl_oc_attr
-00000000 T _PEXSetCharHeight libPEX5 pl_oc_attr
-00000000 T _PEXSetCharUpVector libPEX5 pl_oc_attr
-00000000 T _PEXSetTextPath libPEX5 pl_oc_attr
-00000000 T _PEXSetTextAlignment libPEX5 pl_oc_attr
-00000000 T _PEXSetATextHeight libPEX5 pl_oc_attr
-00000000 T _PEXSetATextUpVector libPEX5 pl_oc_attr
-00000000 T _PEXSetATextPath libPEX5 pl_oc_attr
-00000000 T _PEXSetATextAlignment libPEX5 pl_oc_attr
-00000000 T _PEXSetATextStyle libPEX5 pl_oc_attr
-00000000 T _PEXSetTextBundleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetLineType libPEX5 pl_oc_attr
-00000000 T _PEXSetLineWidth libPEX5 pl_oc_attr
-00000000 T _PEXSetLineColorIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetLineColor libPEX5 pl_oc_attr
-00000000 T _PEXSetCurveApprox libPEX5 pl_oc_attr
-00000000 T _PEXSetPolylineInterpMethod libPEX5 pl_oc_attr
-00000000 T _PEXSetLineBundleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetInteriorStyle libPEX5 pl_oc_attr
-00000000 T _PEXSetInteriorStyleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceColorIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceColor libPEX5 pl_oc_attr
-00000000 T _PEXSetReflectionAttributes libPEX5 pl_oc_attr
-00000000 T _PEXSetReflectionModel libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceInterpMethod libPEX5 pl_oc_attr
-00000000 T _PEXSetBFInteriorStyle libPEX5 pl_oc_attr
-00000000 T _PEXSetBFInteriorStyleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetBFSurfaceColorIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetBFSurfaceColor libPEX5 pl_oc_attr
-00000000 T _PEXSetBFReflectionAttributes libPEX5 pl_oc_attr
-00000000 T _PEXSetBFReflectionModel libPEX5 pl_oc_attr
-00000000 T _PEXSetBFSurfaceInterpMethod libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceApprox libPEX5 pl_oc_attr
-00000000 T _PEXSetFacetCullingMode libPEX5 pl_oc_attr
-00000000 T _PEXSetFacetDistinguishFlag libPEX5 pl_oc_attr
-00000000 T _PEXSetPatternSize libPEX5 pl_oc_attr
-00000000 T _PEXSetPatternAttributes2D libPEX5 pl_oc_attr
-00000000 T _PEXSetPatternAttributes libPEX5 pl_oc_attr
-00000000 T _PEXSetInteriorBundleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceEdgeFlag libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceEdgeType libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceEdgeWidth libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceEdgeColorIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetSurfaceEdgeColor libPEX5 pl_oc_attr
-00000000 T _PEXSetEdgeBundleIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetIndividualASF libPEX5 pl_oc_attr
-00000000 T _PEXSetLocalTransform libPEX5 pl_oc_attr
-00000000 T _PEXSetLocalTransform2D libPEX5 pl_oc_attr
-00000000 T _PEXSetGlobalTransform libPEX5 pl_oc_attr
-00000000 T _PEXSetGlobalTransform2D libPEX5 pl_oc_attr
-00000000 T _PEXSetModelClipFlag libPEX5 pl_oc_attr
-00000000 T _PEXSetModelClipVolume libPEX5 pl_oc_attr
-00000000 T _PEXSetModelClipVolume2D libPEX5 pl_oc_attr
-00000000 T _PEXRestoreModelClipVolume libPEX5 pl_oc_attr
-00000000 T _PEXSetViewIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetLightSourceState libPEX5 pl_oc_attr
-00000000 T _PEXSetDepthCueIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetPickID libPEX5 pl_oc_attr
-00000000 T _PEXSetHLHSRID libPEX5 pl_oc_attr
-00000000 T _PEXSetColorApproxIndex libPEX5 pl_oc_attr
-00000000 T _PEXSetParaSurfCharacteristics libPEX5 pl_oc_attr
-00000000 T _PEXSetRenderingColorModel libPEX5 pl_oc_attr
-00000000 T _PEXAddToNameSet libPEX5 pl_oc_attr
-00000000 T _PEXRemoveFromNameSet libPEX5 pl_oc_attr
-00000000 T _PEXDecodeOCs libPEX5 pl_oc_dec
-00000000 T __PEXDecodeEnumType libPEX5 pl_oc_dec
-00000000 T __PEXDecodeTableIndex libPEX5 pl_oc_dec
-00000000 T __PEXDecodeColor libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFloat libPEX5 pl_oc_dec
-00000000 T __PEXDecodeCARD16 libPEX5 pl_oc_dec
-00000000 T __PEXDecodeVector2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeTextAlignment libPEX5 pl_oc_dec
-00000000 T __PEXDecodeCurveApprox libPEX5 pl_oc_dec
-00000000 T __PEXDecodeReflectionAttr libPEX5 pl_oc_dec
-00000000 T __PEXDecodeSurfaceApprox libPEX5 pl_oc_dec
-00000000 T __PEXDecodeCullMode libPEX5 pl_oc_dec
-00000000 T __PEXDecodeSwitch libPEX5 pl_oc_dec
-00000000 T __PEXDecodePatternSize libPEX5 pl_oc_dec
-00000000 T __PEXDecodePatternAttr2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodePatternAttr libPEX5 pl_oc_dec
-00000000 T __PEXDecodeASF libPEX5 pl_oc_dec
-00000000 T __PEXDecodeLocalTransform libPEX5 pl_oc_dec
-00000000 T __PEXDecodeLocalTransform2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeGlobalTransform libPEX5 pl_oc_dec
-00000000 T __PEXDecodeGlobalTransform2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeModelClipVolume libPEX5 pl_oc_dec
-00000000 T __PEXDecodeModelClipVolume2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeRestoreModelClip libPEX5 pl_oc_dec
-00000000 T __PEXDecodeLightSourceState libPEX5 pl_oc_dec
-00000000 T __PEXDecodeID libPEX5 pl_oc_dec
-00000000 T __PEXDecodePSC libPEX5 pl_oc_dec
-00000000 T __PEXDecodeNameSet libPEX5 pl_oc_dec
-00000000 T __PEXDecodeExecuteStructure libPEX5 pl_oc_dec
-00000000 T __PEXDecodeLabel libPEX5 pl_oc_dec
-00000000 T __PEXDecodeApplicationData libPEX5 pl_oc_dec
-00000000 T __PEXDecodeGSE libPEX5 pl_oc_dec
-00000000 T __PEXDecodeMarkers libPEX5 pl_oc_dec
-00000000 T __PEXDecodeMarkers2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodePolyline libPEX5 pl_oc_dec
-00000000 T __PEXDecodePolyline2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeText libPEX5 pl_oc_dec
-00000000 T __PEXDecodeText2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeAnnoText libPEX5 pl_oc_dec
-00000000 T __PEXDecodeAnnoText2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodePolylineSet libPEX5 pl_oc_dec
-00000000 T __PEXDecodeNURBCurve libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFillArea libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFillArea2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFillAreaWithData libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFillAreaSet libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFillAreaSet2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeFillAreaSetWithData libPEX5 pl_oc_dec
-00000000 T __PEXDecodeTriangleStrip libPEX5 pl_oc_dec
-00000000 T __PEXDecodeQuadMesh libPEX5 pl_oc_dec
-00000000 T __PEXDecodeSOFA libPEX5 pl_oc_dec
-00000000 T __PEXDecodeNURBSurface libPEX5 pl_oc_dec
-00000000 T __PEXDecodeCellArray libPEX5 pl_oc_dec
-00000000 T __PEXDecodeCellArray2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeExtendedCellArray libPEX5 pl_oc_dec
-00000000 T __PEXDecodeGDP libPEX5 pl_oc_dec
-00000000 T __PEXDecodeGDP2D libPEX5 pl_oc_dec
-00000000 T __PEXDecodeNoop libPEX5 pl_oc_dec
-00000000 T _PEXEncodeOCs libPEX5 pl_oc_enc
-00000000 T __PEXEncodeEnumType libPEX5 pl_oc_enc
-00000000 T __PEXEncodeTableIndex libPEX5 pl_oc_enc
-00000000 T __PEXEncodeColor libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFloat libPEX5 pl_oc_enc
-00000000 T __PEXEncodeCARD16 libPEX5 pl_oc_enc
-00000000 T __PEXEncodeVector2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeTextAlignment libPEX5 pl_oc_enc
-00000000 T __PEXEncodeCurveApprox libPEX5 pl_oc_enc
-00000000 T __PEXEncodeReflectionAttr libPEX5 pl_oc_enc
-00000000 T __PEXEncodeSurfaceApprox libPEX5 pl_oc_enc
-00000000 T __PEXEncodeCullMode libPEX5 pl_oc_enc
-00000000 T __PEXEncodeSwitch libPEX5 pl_oc_enc
-00000000 T __PEXEncodePatternSize libPEX5 pl_oc_enc
-00000000 T __PEXEncodePatternAttr2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodePatternAttr libPEX5 pl_oc_enc
-00000000 T __PEXEncodeASF libPEX5 pl_oc_enc
-00000000 T __PEXEncodeLocalTransform libPEX5 pl_oc_enc
-00000000 T __PEXEncodeLocalTransform2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeGlobalTransform libPEX5 pl_oc_enc
-00000000 T __PEXEncodeGlobalTransform2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeModelClipVolume libPEX5 pl_oc_enc
-00000000 T __PEXEncodeModelClipVolume2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeRestoreModelClip libPEX5 pl_oc_enc
-00000000 T __PEXEncodeLightSourceState libPEX5 pl_oc_enc
-00000000 T __PEXEncodeID libPEX5 pl_oc_enc
-00000000 T __PEXEncodePSC libPEX5 pl_oc_enc
-00000000 T __PEXEncodeNameSet libPEX5 pl_oc_enc
-00000000 T __PEXEncodeExecuteStructure libPEX5 pl_oc_enc
-00000000 T __PEXEncodeLabel libPEX5 pl_oc_enc
-00000000 T __PEXEncodeApplicationData libPEX5 pl_oc_enc
-00000000 T __PEXEncodeGSE libPEX5 pl_oc_enc
-00000000 T __PEXEncodeMarkers libPEX5 pl_oc_enc
-00000000 T __PEXEncodePolyline libPEX5 pl_oc_enc
-00000000 T __PEXEncodeMarkers2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodePolyline2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeText libPEX5 pl_oc_enc
-00000000 T __PEXEncodeText2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeAnnoText libPEX5 pl_oc_enc
-00000000 T __PEXEncodeAnnoText2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodePolylineSet libPEX5 pl_oc_enc
-00000000 T __PEXEncodeNURBCurve libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFillArea libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFillArea2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFillAreaWithData libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFillAreaSet libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFillAreaSet2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeFillAreaSetWithData libPEX5 pl_oc_enc
-00000000 T __PEXEncodeTriangleStrip libPEX5 pl_oc_enc
-00000000 T __PEXEncodeQuadMesh libPEX5 pl_oc_enc
-00000000 T __PEXEncodeSOFA libPEX5 pl_oc_enc
-00000000 T __PEXEncodeNURBSurface libPEX5 pl_oc_enc
-00000000 T __PEXEncodeCellArray libPEX5 pl_oc_enc
-00000000 T __PEXEncodeCellArray2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeExtendedCellArray libPEX5 pl_oc_enc
-00000000 T __PEXEncodeGDP libPEX5 pl_oc_enc
-00000000 T __PEXEncodeGDP2D libPEX5 pl_oc_enc
-00000000 T __PEXEncodeNoop libPEX5 pl_oc_enc
-00000000 T _PEXMarkers libPEX5 pl_oc_prim
-00000000 T _PEXMarkers2D libPEX5 pl_oc_prim
-00000000 T _PEXText libPEX5 pl_oc_prim
-00000000 T _PEXText2D libPEX5 pl_oc_prim
-00000000 T _PEXAnnotationText libPEX5 pl_oc_prim
-00000000 T _PEXAnnotationText2D libPEX5 pl_oc_prim
-00000000 T _PEXEncodedText libPEX5 pl_oc_prim
-00000000 T _PEXEncodedText2D libPEX5 pl_oc_prim
-00000000 T _PEXEncodedAnnoText libPEX5 pl_oc_prim
-00000000 T _PEXEncodedAnnoText2D libPEX5 pl_oc_prim
-00000000 T _PEXPolyline libPEX5 pl_oc_prim
-00000000 T _PEXPolyline2D libPEX5 pl_oc_prim
-00000000 T _PEXPolylineSetWithData libPEX5 pl_oc_prim
-00000000 T _PEXNURBCurve libPEX5 pl_oc_prim
-00000000 T _PEXFillArea libPEX5 pl_oc_prim
-00000000 T _PEXFillArea2D libPEX5 pl_oc_prim
-00000000 T _PEXFillAreaWithData libPEX5 pl_oc_prim
-00000000 T _PEXFillAreaSet libPEX5 pl_oc_prim
-00000000 T _PEXFillAreaSet2D libPEX5 pl_oc_prim
-00000000 T _PEXFillAreaSetWithData libPEX5 pl_oc_prim
-00000000 T _PEXSetOfFillAreaSets libPEX5 pl_oc_prim
-00000000 T _PEXTriangleStrip libPEX5 pl_oc_prim
-00000000 T _PEXQuadrilateralMesh libPEX5 pl_oc_prim
-00000000 T _PEXNURBSurface libPEX5 pl_oc_prim
-00000000 T _PEXCellArray libPEX5 pl_oc_prim
-00000000 T _PEXCellArray2D libPEX5 pl_oc_prim
-00000000 T _PEXExtendedCellArray libPEX5 pl_oc_prim
-00000000 T _PEXGDP libPEX5 pl_oc_prim
-00000000 T _PEXGDP2D libPEX5 pl_oc_prim
-00000000 T _PEXExecuteStructure libPEX5 pl_oc_struct
-00000000 T _PEXLabel libPEX5 pl_oc_struct
-00000000 T _PEXNoop libPEX5 pl_oc_struct
-00000000 T _PEXApplicationData libPEX5 pl_oc_struct
-00000000 T _PEXGSE libPEX5 pl_oc_struct
-00000000 T _PEXStartOCs libPEX5 pl_oc_util
-00000000 T _PEXFinishOCs libPEX5 pl_oc_util
-00000000 T __PEXSendBytesToOC libPEX5 pl_oc_util
-00000000 T _PEXCopyBytesToOC libPEX5 pl_oc_util
-00000000 T __PEXCopyPaddedBytesToOC libPEX5 pl_oc_util
-00000000 T _PEXGetOCAddr libPEX5 pl_oc_util
-00000000 T _PEXSendOCs libPEX5 pl_oc_util
-00000000 T __PEXGenOCBadLengthError libPEX5 pl_oc_util
-00000000 T _PEXGetSizeOCs libPEX5 pl_oc_util
-00000000 T _PEXCountOCs libPEX5 pl_oc_util
-00000000 T _PEXCreatePipelineContext libPEX5 pl_pc
-00000000 T _PEXFreePipelineContext libPEX5 pl_pc
-00000000 T _PEXCopyPipelineContext libPEX5 pl_pc
-00000000 T _PEXGetPipelineContext libPEX5 pl_pc
-00000000 T _PEXChangePipelineContext libPEX5 pl_pc
-00000000 T _PEXCreatePickMeasure libPEX5 pl_pick
-00000000 T _PEXFreePickMeasure libPEX5 pl_pick
-00000000 T _PEXGetPickMeasure libPEX5 pl_pick
-00000000 T _PEXUpdatePickMeasure libPEX5 pl_pick
-00000000 T _PEXGetPickDevice libPEX5 pl_pick
-00000000 T _PEXChangePickDevice libPEX5 pl_pick
-00000000 T __PEXConvertMaxHitsEvent libPEX5 pl_pick
-00000000 T _PEXBeginPickOne libPEX5 pl_pick
-00000000 T _PEXEndPickOne libPEX5 pl_pick
-00000000 T _PEXPickOne libPEX5 pl_pick
-00000000 T _PEXBeginPickAll libPEX5 pl_pick
-00000000 T _PEXEndPickAll libPEX5 pl_pick
-00000000 T _PEXPickAll libPEX5 pl_pick
-00000000 T _PEXCreateRenderer libPEX5 pl_rdr
-00000000 T _PEXFreeRenderer libPEX5 pl_rdr
-00000000 T _PEXGetRendererAttributes libPEX5 pl_rdr
-00000000 T _PEXGetRendererDynamics libPEX5 pl_rdr
-00000000 T _PEXChangeRenderer libPEX5 pl_rdr
-00000000 T _PEXBeginRendering libPEX5 pl_rdr
-00000000 T _PEXEndRendering libPEX5 pl_rdr
-00000000 T _PEXBeginStructure libPEX5 pl_rdr
-00000000 T _PEXEndStructure libPEX5 pl_rdr
-00000000 T _PEXRenderNetwork libPEX5 pl_rdr
-00000000 T _PEXRenderElements libPEX5 pl_rdr
-00000000 T _PEXAccumulateState libPEX5 pl_rdr
-00000000 T _PEXCreateSearchContext libPEX5 pl_sc
-00000000 T _PEXFreeSearchContext libPEX5 pl_sc
-00000000 T _PEXCopySearchContext libPEX5 pl_sc
-00000000 T _PEXGetSearchContext libPEX5 pl_sc
-00000000 T _PEXChangeSearchContext libPEX5 pl_sc
-00000000 T _PEXSearchNetwork libPEX5 pl_sc
-00000000 T _PEXInitialize libPEX5 pl_startup
-00000000 T _PEXGetExtensionInfo libPEX5 pl_startup
-00000000 T _PEXGetProtocolFloatFormat libPEX5 pl_startup
-00000000 T _PEXGetEnumTypeInfo libPEX5 pl_startup
-00000000 T _PEXGetImpDepConstants libPEX5 pl_startup
-00000000 T _PEXMatchRenderingTargets libPEX5 pl_startup
-00000000 T __PEXConvertOCError libPEX5 pl_startup
-00000000 T __PEXPrintOCError libPEX5 pl_startup
-00000000 T __PEXCloseDisplay libPEX5 pl_startup
-00000000 T _PEXCreateStructure libPEX5 pl_struct
-00000000 T _PEXDestroyStructures libPEX5 pl_struct
-00000000 T _PEXCopyStructure libPEX5 pl_struct
-00000000 T _PEXGetStructureInfo libPEX5 pl_struct
-00000000 T _PEXGetElementInfo libPEX5 pl_struct
-00000000 T _PEXGetStructuresInNetwork libPEX5 pl_struct
-00000000 T _PEXGetAncestors libPEX5 pl_struct
-00000000 T _PEXGetDescendants libPEX5 pl_struct
-00000000 T _PEXFetchElements libPEX5 pl_struct
-00000000 T _PEXFetchElementsAndSend libPEX5 pl_struct
-00000000 T _PEXSetEditingMode libPEX5 pl_struct
-00000000 T _PEXSetElementPtr libPEX5 pl_struct
-00000000 T _PEXSetElementPtrAtLabel libPEX5 pl_struct
-00000000 T _PEXElementSearch libPEX5 pl_struct
-00000000 T _PEXDeleteElements libPEX5 pl_struct
-00000000 T _PEXDeleteToLabel libPEX5 pl_struct
-00000000 T _PEXDeleteBetweenLabels libPEX5 pl_struct
-00000000 T _PEXCopyElements libPEX5 pl_struct
-00000000 T _PEXChangeStructureRefs libPEX5 pl_struct
-00000000 T _PEXRotate libPEX5 pl_util
-00000000 T _PEXRotate2D libPEX5 pl_util
-00000000 T _PEXRotateGeneral libPEX5 pl_util
-00000000 T _PEXScale libPEX5 pl_util
-00000000 T _PEXScale2D libPEX5 pl_util
-00000000 T _PEXTranslate libPEX5 pl_util
-00000000 T _PEXTranslate2D libPEX5 pl_util
-00000000 T _PEXMatrixMult libPEX5 pl_util
-00000000 T _PEXMatrixMult2D libPEX5 pl_util
-00000000 T _PEXBuildTransform libPEX5 pl_util
-00000000 T _PEXBuildTransform2D libPEX5 pl_util
-00000000 T _PEXViewOrientationMatrix libPEX5 pl_util
-00000000 T _PEXViewOrientationMatrix2D libPEX5 pl_util
-00000000 T _PEXViewMappingMatrix libPEX5 pl_util
-00000000 T _PEXViewMappingMatrix2D libPEX5 pl_util
-00000000 T _PEXLookAtViewMatrix libPEX5 pl_util
-00000000 T _PEXPolarViewMatrix libPEX5 pl_util
-00000000 T _PEXOrthoProjMatrix libPEX5 pl_util
-00000000 T _PEXPerspProjMatrix libPEX5 pl_util
-00000000 T _PEXTransformPoints libPEX5 pl_util
-00000000 T _PEXTransformPoints2D libPEX5 pl_util
-00000000 T _PEXTransformPoints4D libPEX5 pl_util
-00000000 T _PEXTransformPoints2DH libPEX5 pl_util
-00000000 T _PEXTransformVectors libPEX5 pl_util
-00000000 T _PEXTransformVectors2D libPEX5 pl_util
-00000000 T _PEXNormalizeVectors libPEX5 pl_util
-00000000 T _PEXNormalizeVectors2D libPEX5 pl_util
-00000000 T _PEXNPCToXCTransform libPEX5 pl_util
-00000000 T _PEXNPCToXCTransform2D libPEX5 pl_util
-00000000 T _PEXXCToNPCTransform libPEX5 pl_util
-00000000 T _PEXXCToNPCTransform2D libPEX5 pl_util
-00000000 T _PEXMapXCToNPC libPEX5 pl_util
-00000000 T _PEXMapXCToNPC2D libPEX5 pl_util
-00000000 T _PEXInvertMatrix libPEX5 pl_util
-00000000 T _PEXInvertMatrix2D libPEX5 pl_util
-00000000 T _PEXIdentityMatrix libPEX5 pl_util
-00000000 T _PEXIdentityMatrix2D libPEX5 pl_util
-00000000 T _PEXGeoNormFillArea libPEX5 pl_util
-00000000 T _PEXGeoNormFillAreaSet libPEX5 pl_util
-00000000 T _PEXGeoNormTriangleStrip libPEX5 pl_util
-00000000 T _PEXGeoNormQuadrilateralMesh libPEX5 pl_util
-00000000 T _PEXGeoNormSetOfFillAreaSets libPEX5 pl_util
-00000000 T _PEXCreateWorkstation libPEX5 pl_wks
-00000000 T _PEXFreeWorkstation libPEX5 pl_wks
-00000000 T _PEXGetWorkstationAttributes libPEX5 pl_wks
-00000000 T _PEXGetWorkstationDynamics libPEX5 pl_wks
-00000000 T _PEXGetWorkstationViewRep libPEX5 pl_wks
-00000000 T _PEXGetWorkstationPostings libPEX5 pl_wks
-00000000 T _PEXSetWorkstationViewPriority libPEX5 pl_wks
-00000000 T _PEXSetWorkstationDisplayUpdateMode libPEX5 pl_wks
-00000000 T _PEXSetWorkstationBufferMode libPEX5 pl_wks
-00000000 T _PEXSetWorkstationViewRep libPEX5 pl_wks
-00000000 T _PEXSetWorkstationWindow libPEX5 pl_wks
-00000000 T _PEXSetWorkstationViewport libPEX5 pl_wks
-00000000 T _PEXSetWorkstationHLHSRMode libPEX5 pl_wks
-00000000 T _PEXRedrawAllStructures libPEX5 pl_wks
-00000000 T _PEXUpdateWorkstation libPEX5 pl_wks
-00000000 T _PEXExecuteDeferredActions libPEX5 pl_wks
-00000000 T _PEXMapDCToWC libPEX5 pl_wks
-00000000 T _PEXMapWCToDC libPEX5 pl_wks
-00000000 T _PEXPostStructure libPEX5 pl_wks
-00000000 T _PEXUnpostStructure libPEX5 pl_wks
-00000000 T _PEXUnpostAllStructures libPEX5 pl_wks
-00000000 T _PEXRedrawClipRegion libPEX5 pl_wks
-00000000 T __PEXIEEE32toDECF libPEX5 pl_convert
-00000000 T __PEXDECFtoIEEE32 libPEX5 pl_convert
-00000000 T __PEXOCFacet libPEX5 pl_oc_util
-00000000 T __PEXOCListOfFacet libPEX5 pl_oc_util
-00000000 T __PEXOCListOfVertex libPEX5 pl_oc_util
-00000000 T __PEXOCListOfColor libPEX5 pl_oc_util
-00000000 T __PEXStoreFacet libPEX5 pl_oc_util
-00000000 T __PEXStoreListOfFacet libPEX5 pl_oc_util
-00000000 T __PEXStoreListOfVertex libPEX5 pl_oc_util
-00000000 T __PEXStoreListOfColor libPEX5 pl_oc_util
-00000000 T __PEXExtractFacet libPEX5 pl_oc_util
-00000000 T __PEXExtractListOfFacet libPEX5 pl_oc_util
-00000000 T __PEXExtractListOfVertex libPEX5 pl_oc_util
-00000000 T __PEXExtractListOfColor libPEX5 pl_oc_util
diff --git a/xc/lib/PEX5/jump_ignore b/xc/lib/PEX5/jump_ignore
deleted file mode 100644
index e31c55f51..000000000
--- a/xc/lib/PEX5/jump_ignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# $XConsortium: jump_ignore,v 1.2 94/12/07 10:48:56 kaleb Exp $
-# $XFree86: xc/lib/PEX5/jump_ignore,v 3.1 1995/01/28 15:42:20 dawes Exp $
-# jump_ignore
diff --git a/xc/lib/PEX5/jump_vars b/xc/lib/PEX5/jump_vars
deleted file mode 100644
index 9a8e46e41..000000000
--- a/xc/lib/PEX5/jump_vars
+++ /dev/null
@@ -1,10 +0,0 @@
-# $XConsortium: jump_vars,v 1.2 94/12/07 10:48:56 kaleb Exp $
-# $XFree86: xc/lib/PEX5/jump_vars,v 3.1 1995/01/28 15:42:22 dawes Exp $
-#
-00000004 D _PEXDisplayInfoHeader libPEX5 pl_startup
-00000004 D _PEXPickCache libPEX5 pl_startup
-00000004 D _PEXPickCacheSize libPEX5 pl_startup
-00000004 D _PEXPickCacheInUse libPEX5 pl_startup
-00000260 D _PEX_encode_oc_funcs libPEX5 pl_startup
-00000260 D _PEX_decode_oc_funcs libPEX5 pl_startup
-00000100 D _PEX_fp_convert libPEX5 pl_startup
diff --git a/xc/lib/PEX5/pl_convert.c b/xc/lib/PEX5/pl_convert.c
deleted file mode 100644
index c3344b9d1..000000000
--- a/xc/lib/PEX5/pl_convert.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* $TOG: pl_convert.c /main/3 1998/02/06 16:09:48 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.
-
-*/
-
-/******************************************************************************
-FOR VAX/IEEE conversions:
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-
-
-void _PEXIEEE32toDECF (srcVal, dstVal)
-
-INPUT char *srcVal;
-OUTPUT char *dstVal;
-
-{
- register CARD32 IEEEnum = *(CARD32 *) srcVal;
- CARD32 *IEEEnumP = (CARD32 *) dstVal;
- CARD32 result;
-
- 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;
-}
-
-
-
-void _PEXDECFtoIEEE32 (srcVal, dstVal)
-
-INPUT char *srcVal;
-OUTPUT char *dstVal;
-
-{
- register CARD32 Vaxnum = *(CARD32 *) srcVal;
- CARD32 *VaxnumP = (CARD32 *) dstVal;
- 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;
-}
-
-
-
-#ifdef CRAY
-
-void _PEXIEEE32toCRAY (srcVal, dstVal)
-
-INPUT char *srcVal;
-OUTPUT char *dstVal;
-
-{
- unsigned char *PC = (unsigned char *) srcVal;
- float *result = (float *) dstVal;
-
- union {
- struct ieee_single is;
- long l;
- } c;
-
- union {
- struct cray_single vc;
- float iis;
- } ieee;
-
-
- c.l = PC[0] << 24 | PC[1] << 16 | PC[2] << 8 | PC[3];
- if (PC[0] & 0x80)
- c.l |= ~0xffffffff;
-
- if (c.is.exp == 0)
- {
- ieee.iis = 0.0;
- }
- else if (c.is.exp == 0xff)
- {
- /*
- * If the IEEE float we are decoding indicates
- * an IEEE overflow condition, we manufacture
- * a Cray overflow condition.
- */
-
- SET_MAX_SNG_CRAY (ieee.vc);
- }
- else
- {
- ieee.vc.sign = c.is.sign;
- ieee.vc.exp = c.is.exp - IEEE_SNG_BIAS + CRAY_BIAS;
- ieee.vc.mantissa = c.is.mantissa | (1 << 23);
- ieee.vc.mantissa2 = 0;
- }
-
- *result = ieee.iis;
-}
-
-
-
-void _PEXCRAYtoIEEE32 (srcVal, dstVal)
-
-INPUT char *srcVal;
-OUTPUT char *dstVal;
-
-{
- unsigned char *PC = (unsigned char *) dstVal;
- struct cray_single vc;
- float *fptr;
-
- struct ieee_single ais;
- union {
- struct ieee_single is;
- unsigned iis;
- } ieee;
-
- fptr = (float *) &vc;
- *fptr = *((float *) srcVal);
-
- if (vc.exp >= MAX_CRAY_SNG)
- {
- SET_MAX_SNG_IEEE (ieee.is);
- }
- else if (vc.exp < MIN_CRAY_SNG ||
- (vc.mantissa == 0 && vc.mantissa2 == 0))
- {
- /*
- * On the Cray, there is no hidden mantissa bit.
- * So, if the mantissa is zero, the number is zero.
- */
-
- SET_MIN_SNG_IEEE (ieee.is);
- }
- else
- {
- ieee.is.exp = vc.exp - CRAY_BIAS + IEEE_SNG_BIAS;
- ieee.is.mantissa = vc.mantissa;
- /* Hidden bit removed by truncation */
- }
-
- ieee.is.sign = vc.sign;
-
- PC[0] = ieee.iis >> 24;
- PC[1] = ieee.iis >> 16;
- PC[2] = ieee.iis >> 8;
- PC[3] = ieee.iis;
-}
-
-#endif /* CRAY */
diff --git a/xc/lib/PEX5/pl_convert.h b/xc/lib/PEX5/pl_convert.h
deleted file mode 100644
index 34ad4e4c5..000000000
--- a/xc/lib/PEX5/pl_convert.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/* $TOG: pl_convert.h /main/4 1998/02/06 16:09:53 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.
-
-*/
-
-/* -------------------------------------------------------------------------
- * Structures for fiddling with 16 and 32 bit data on 64 bit machines
- * ------------------------------------------------------------------------- */
-
-#ifdef WORD64
-
-typedef struct {
- int value :32;
-} Long;
-
-typedef struct {
- int value :16;
- int pad :16;
-} Short;
-
-typedef struct {
- int value :8;
- int pad :24;
-} Char;
-
-typedef struct {
- unsigned int value :32;
-} ULong;
-
-typedef struct {
- unsigned int value :16;
-} UShort;
-
-typedef struct {
- unsigned char value;
-} UChar;
-
-#endif /* WORD64 */
-
-
-
-/* -------------------------------------------------------------------------
- * Floating point conversion macros
- * ------------------------------------------------------------------------- */
-
-/*
- * Host->Network
- * _srcVal = host floating point value
- * _dstBuf = buffer to store network float
- */
-
-#define FP_CONVERT_HTON_BUFF(_srcVal, _dstBuf, _fpFormat) \
-{ \
- PEX_fp_convert[NATIVE_FP_FORMAT-1][_fpFormat-1](&(_srcVal), _dstBuf); \
-}
-
-
-/*
- * Host->Network
- * _srcVal = host floating point value
- * _dstVal = store network float in this value (on 64 bit machines,
- * _dstVal is most probably a bitfield, so we can't take &_dstVal.
- */
-
-#ifndef WORD64
-
-#define FP_CONVERT_HTON(_srcVal, _dstVal, _fpFormat) \
-{ \
- FP_CONVERT_HTON_BUFF (_srcVal, &(_dstVal), _fpFormat); \
-}
-
-#define FP_CONVERT_DHTON(_srcVal, _dstVal, _fpFormat) \
-{ \
- float single = _srcVal; \
- FP_CONVERT_HTON_BUFF (single, &(_dstVal), _fpFormat); \
-}
-
-#else /* WORD64 */
-
-#define FP_CONVERT_HTON(_srcVal, _dstVal, _fpFormat) \
-{ \
- Long temp; \
- FP_CONVERT_HTON_BUFF (_srcVal, &temp, _fpFormat); \
- _dstVal = temp.value; \
-}
-
-#define FP_CONVERT_DHTON(_srcVal, _dstVal, _fpFormat) \
-{ \
- float single = _srcVal; \
- Long temp; \
- FP_CONVERT_HTON_BUFF (single, &temp, _fpFormat); \
- _dstVal = temp.value; \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Network->Host
- * _srcBuf = buffer containing network floating point value
- * _dstVal = store host float in this value
- */
-
-#define FP_CONVERT_NTOH_BUFF(_srcBuf, _dstVal, _fpFormat) \
-{ \
- PEX_fp_convert[_fpFormat-1][NATIVE_FP_FORMAT-1](_srcBuf, &_dstVal); \
-}
-
-
-/*
- * Network->Host
- * _srcVal = network floating point value
- * _dstVal = store host float in this value
- */
-
-#ifndef WORD64
-
-#define FP_CONVERT_NTOH(_srcVal, _dstVal, _fpFormat) \
-{ \
- FP_CONVERT_NTOH_BUFF (&(_srcVal), _dstVal, _fpFormat); \
-}
-
-#else /* WORD64 */
-
-#define FP_CONVERT_NTOH(_srcVal, _dstVal, _fpFormat) \
-{ \
- Long temp; \
- temp.value = _srcVal; \
- FP_CONVERT_NTOH_BUFF (&temp, _dstVal, _fpFormat); \
-}
-
-#endif /* WORD64 */
-
-
-
-/* -------------------------------------------------------------------------
- * Macros for 64 bit conversion
- * ------------------------------------------------------------------------- */
-
-#ifdef WORD64
-
-#define CARD64_TO_32(_val, _pBuf) \
-{ \
- Long _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, SIZEOF (CARD32)); \
-}
-
-#define CARD64_TO_16(_val, _pBuf) \
-{ \
- Short _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, SIZEOF (CARD16)); \
-}
-
-#define INT64_TO_32(_val, _pBuf) \
-{ \
- Long _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, SIZEOF (INT32)); \
-}
-
-#define INT64_TO_16(_val, _pBuf) \
-{ \
- Short _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, SIZEOF (INT16)); \
-}
-
-
-#define CARD32_TO_64(_pBuf, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 2) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 3) & 0xff;\
-}
-
-#define CARD16_TO_64(_pBuf, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
-}
-
-#define INT32_TO_64(_pBuf, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 2) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 3) & 0xff;\
-}
-
-#define INT16_TO_64(_pBuf, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
-}
-
-#endif /* WORD64 */
-
-
-
-/* -------------------------------------------------------------------------
- * DEC/IEEE float conversions
- * ------------------------------------------------------------------------- */
-
-/*
- * 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.
- */
-
-#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
-
-
-
-/* -------------------------------------------------------------------------
- * Cray float conversions
- * ------------------------------------------------------------------------- */
-
-#ifdef CRAY
-
-struct ieee_single {
- unsigned int zero : 32; /* Upper 32 bits are junk */
- unsigned int sign : 1;
- unsigned int exp : 8;
- unsigned int mantissa: 23; /* 24-bit mantissa with 1 hidden bit */
-};
-
-/* Cray floating point, partitioned for easy conversion to IEEE single */
-
-struct cray_single {
- unsigned int sign : 1;
- unsigned int exp : 15;
- unsigned int mantissa : 24;
- unsigned int mantissa2: 24;
-};
-
-struct cray_double {
- unsigned int sign : 1;
- unsigned int exp : 15;
- unsigned int mantissa : 48;
-};
-
-#define SET_MIN_SNG_IEEE(_ieee) \
- _ieee.zero = 0; \
- _ieee.sign = 0; \
- _ieee.exp = 0x00; \
- _ieee.mantissa = 0;
-
-#define SET_MAX_SNG_IEEE(_ieee) \
- _ieee.zero = 0; \
- _ieee.sign = 0; \
- _ieee.exp = 0xff; \
- _ieee.mantissa = 0;
-
-#define SET_MAX_SNG_CRAY(_cray) \
- _cray.sign = 0; \
- _cray.exp = 0x6000; \
- _cray.mantissa = 0; \
- _cray.mantissa2 = 0;
-
-#define SET_MAX_DBL_CRAY(_cray) \
- _cray.sign = 0; \
- _cray.exp = 0x6000; \
- _cray.mantissa = 0;
-
-
-/* Cray exponent limits for conversion to IEEE single */
-
-#define MAX_CRAY_SNG (0x100 + CRAY_BIAS - IEEE_SNG_BIAS)
-#define MIN_CRAY_SNG (0x00 + CRAY_BIAS - IEEE_SNG_BIAS)
-
-#define CRAY_BIAS 040001
-#define IEEE_SNG_BIAS 0x7f
-
-#endif /* CRAY */
diff --git a/xc/lib/PEX5/pl_escape.c b/xc/lib/PEX5/pl_escape.c
deleted file mode 100644
index baed06693..000000000
--- a/xc/lib/PEX5/pl_escape.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* $TOG: pl_escape.c /main/11 1998/02/06 16:09:59 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 "PEXlib.h"
-#include "PEXlibint.h"
-
-
-void
-PEXEscape (display, escapeID, escapeDataSize, escapeData)
-
-INPUT Display *display;
-INPUT unsigned long escapeID;
-INPUT int escapeDataSize;
-INPUT char *escapeData;
-
-{
- register pexEscapeReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (Escape, pBuf);
-
- BEGIN_REQUEST_HEADER (Escape, pBuf, req);
-
- PEXStoreReqExtraHead (Escape, escapeDataSize, req);
- req->escapeID = escapeID;
-
- END_REQUEST_HEADER (Escape, pBuf, req);
-
- Data (display, escapeData, escapeDataSize);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-char *
-PEXEscapeWithReply (display, escapeID, escapeDataSize,
- escapeData, escapeOutDataSize)
-
-INPUT Display *display;
-INPUT unsigned long escapeID;
-INPUT int escapeDataSize;
-INPUT char *escapeData;
-OUTPUT unsigned long *escapeOutDataSize;
-
-{
- register pexEscapeWithReplyReq *req;
- char *pBuf;
- pexEscapeWithReplyReply rep;
- char *escRepData;
- char *escRepDataRet;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (EscapeWithReply, pBuf);
-
- BEGIN_REQUEST_HEADER (EscapeWithReply, pBuf, req);
-
- PEXStoreReqExtraHead (EscapeWithReply, escapeDataSize, req);
- req->escapeID = escapeID;
-
- END_REQUEST_HEADER (EscapeWithReply, pBuf, req);
-
- Data (display, escapeData, escapeDataSize);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *escapeOutDataSize = 0;
- return (NULL); /* return an error */
- }
-
- *escapeOutDataSize = 20 + (rep.length << 2);
-
-
- /*
- * Allocate a buffer for the reply escape data
- */
-
- escRepData = escRepDataRet = Xmalloc ((unsigned) *escapeOutDataSize);
-
- memcpy (escRepData, rep.escape_specific, 20);
- escRepData += 20;
-
- if (rep.length)
- _XRead (display, (char *) escRepData, (long) (rep.length << 2));
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (escRepDataRet);
-}
-
-
-void PEXSetEchoColor (display, renderer, color_type, color)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT int color_type;
-INPUT PEXColor *color;
-
-{
- char *escapeData;
- unsigned escapeSize;
- pexEscapeSetEchoColorData *header;
- char *ptr;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Fill in the escape record.
- */
-
- escapeSize = SIZEOF (pexEscapeSetEchoColorData) +
- SIZEOF (pexColorSpecifier) + GetColorSize (color_type);
-
- escapeData = Xmalloc (escapeSize);
-
- fpFormat = PEXGetProtocolFloatFormat (display);
- fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- header = (pexEscapeSetEchoColorData *) escapeData;
- header->fpFormat = fpFormat;
- header->rdr = renderer;
-
- ptr = escapeData + SIZEOF (pexEscapeSetEchoColorData);
- STORE_INT16 (color_type, ptr);
- ptr += 2;
- STORE_COLOR_VAL (color_type, (*color), ptr, fpConvert, fpFormat);
-
-
- /*
- * Generate the escape.
- */
-
- PEXEscape (display, PEXEscapeSetEchoColor, (int) escapeSize, escapeData);
-
- Xfree (escapeData);
-}
diff --git a/xc/lib/PEX5/pl_extract.h b/xc/lib/PEX5/pl_extract.h
deleted file mode 100644
index 174881309..000000000
--- a/xc/lib/PEX5/pl_extract.h
+++ /dev/null
@@ -1,1160 +0,0 @@
-/* $TOG: pl_extract.h /main/6 1998/02/06 16:10:05 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.
-
-*/
-
-#ifndef WORD64
-
-#define GET_CARD32(_pBuf, _val) \
- _val = *((CARD32 *) _pBuf)
-
-#define GET_CARD16(_pBuf, _val) \
- _val = *((CARD16 *) _pBuf)
-
-#define GET_INT32(_pBuf, _val) \
- _val = *((INT32 *) _pBuf)
-
-#define GET_INT16(_pBuf, _val) \
- _val = *((INT16 *) _pBuf)
-
-#else /* WORD64 */
-
-#define GET_CARD32(_pBuf, _val) \
- CARD32_TO_64 (_pBuf, _val)
-
-#define GET_CARD16(_pBuf, _val) \
- CARD16_TO_64 (_pBuf, _val)
-
-#define GET_INT32(_pBuf, _val) \
- INT32_TO_64 (_pBuf, _val)
-
-#define GET_INT16(_pBuf, _val) \
- INT16_TO_64 (_pBuf, _val)
-
-#endif /* WORD64 */
-
-
-#define EXTRACT_CARD32(_pBuf, _val) \
-{ \
- GET_CARD32 (_pBuf, _val); \
- _pBuf += SIZEOF (CARD32); \
-}
-
-#define EXTRACT_CARD16(_pBuf, _val) \
-{ \
- GET_CARD16 (_pBuf, _val); \
- _pBuf += SIZEOF (CARD16); \
-}
-
-#define EXTRACT_INT32(_pBuf, _val) \
-{ \
- GET_INT32 (_pBuf, _val); \
- _pBuf += SIZEOF (INT32); \
-}
-
-#define EXTRACT_INT16(_pBuf, _val) \
-{ \
- GET_INT16 (_pBuf, _val); \
- _pBuf += SIZEOF (INT16); \
-}
-
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define EXTRACT_LISTOF_CARD32(_count, _pBuf, _pList) \
-{ \
- memcpy (_pList, _pBuf, _count * SIZEOF (CARD32)); \
- _pBuf += (_count * SIZEOF (CARD32)); \
-}
-
-#define EXTRACT_LISTOF_CARD16(_count, _pBuf, _pList) \
-{ \
- memcpy (_pList, _pBuf, _count * SIZEOF (CARD16)); \
- _pBuf += (_count * SIZEOF (CARD16)); \
-}
-
-#define EXTRACT_LISTOF_INT32(_count, _pBuf, _pList) \
-{ \
- memcpy (_pList, _pBuf, _count * SIZEOF (INT32)); \
- _pBuf += (_count * SIZEOF (INT32)); \
-}
-
-#define EXTRACT_LISTOF_INT16(_count, _pBuf, _pList) \
-{ \
- memcpy (_pList, _pBuf, _count * SIZEOF (INT16)); \
- _pBuf += (_count * SIZEOF (INT16)); \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_LISTOF_CARD32(_count, _pBuf, _pList) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- EXTRACT_CARD32 (_pBuf, _pList[_i]); \
-}
-
-#define EXTRACT_LISTOF_CARD16(_count, _pBuf, _pList) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- EXTRACT_CARD16 (_pBuf, _pList[_i]); \
-}
-
-#define EXTRACT_LISTOF_INT32(_count, _pBuf, _pList) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- EXTRACT_INT32 (_pBuf, _pList[_i]); \
-}
-
-#define EXTRACT_LISTOF_INT16(_count, _pBuf, _pList) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- EXTRACT_INT16 (_pBuf, _pList[_i]); \
-}
-
-#endif /* WORD64 */
-
-/* ------------------------------------------------------------------------ */
-
-/* List of Values - all values extracted from 4 byte field */
-
-#ifndef WORD64
-
-#define EXTRACT_LOV_CARD16(_pBuf, _val) \
- EXTRACT_CARD32 (_pBuf, _val);
-
-#define EXTRACT_LOV_INT16(_pBuf, _val) \
- EXTRACT_CARD32 (_pBuf, _val);
-
-#else /* WORD64 */
-
-#define EXTRACT_LOV_CARD16(_pBuf, _val) \
-{ \
- _pBuf += 2; \
- EXTRACT_CARD16 (_pBuf, _val); \
-}
-
-#define EXTRACT_LOV_INT16(_pBuf, _val) \
-{ \
- _pBuf += 2; \
- EXTRACT_INT16 (_pBuf, _val); \
-}
-
-#endif /* WORD64 */
-
-
-#define EXTRACT_LOV_CARD8(_pBuf, _val) \
- EXTRACT_CARD32 (_pBuf, _val);
-
-
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define EXTRACT_FLOAT32(_pBuf, _val, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- _val = *((float *) _pBuf); \
- } \
- else \
- { \
- FP_CONVERT_NTOH_BUFF (_pBuf, _val, _fpFormat); \
- } \
- _pBuf += SIZEOF (float); \
-}
-
-#define EXTRACT_LISTOF_FLOAT32(_count, _pBuf, _pList, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- memcpy (_pList, _pBuf, _count * SIZEOF (float)); \
- _pBuf += (_count * SIZEOF (float)); \
- } \
- else \
- { \
- int _i; \
- float *fptr = (float *) _pList; \
-\
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- FP_CONVERT_NTOH_BUFF (_pBuf, *fptr, _fpFormat); \
- _pBuf += SIZEOF (float); \
- fptr++; \
- } \
- }\
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_FLOAT32(_pBuf, _val, _fpConvert, _fpFormat) \
-{ \
- FP_CONVERT_NTOH_BUFF (_pBuf, _val, _fpFormat); \
- _pBuf += SIZEOF (float); \
-}
-
-#define EXTRACT_LISTOF_FLOAT32(_count, _pBuf, _pList, _fpConvert, _fpFormat) \
-{ \
- int _i; \
- float *fptr = (float *) _pList; \
-\
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- FP_CONVERT_NTOH_BUFF (_pBuf, *fptr, _fpFormat); \
- _pBuf += SIZEOF (float); \
- fptr++; \
- } \
-}
-
-#endif /* WORD64 */
-
-
-
-/* ------------------------------------------------------------------------ */
-/* EXTRACT_FOO and EXTRACT_LISTOF_FOO */
-/* (where FOO has no floating point values in it) */
-/* ------------------------------------------------------------------------ */
-
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GET_TEMP(_pexType, _tFoo, _foo) GET_TEMP_##_pexType (_tFoo, _foo);
-#else
-#define GET_TEMP(_pexType, _tFoo, _foo) GET_TEMP_/**/_pexType (_tFoo, _foo);
-#endif
-
-
-#ifndef WORD64
-
-#define EXTRACT_FOO(_pexType, _pBuf, _foo) \
-{ \
- memcpy (&(_foo), _pBuf, SIZEOF (_pexType)); \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define EXTRACT_LISTOF_FOO(_pexType, _count, _pBuf, _fooList) \
-{ \
- memcpy (_fooList, _pBuf, _count * SIZEOF (_pexType)); \
- _pBuf += (_count * SIZEOF (_pexType)); \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_FOO(_pexType, _pBuf, _foo) \
-{ \
- _pexType tFoo; \
- memcpy (&tFoo, _pBuf, SIZEOF (_pexType)); \
- GET_TEMP(_pexType, tFoo, _foo); \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define EXTRACT_LISTOF_FOO(_pexType, _count, _pBuf, _fooList) \
-{ \
- _pexType tFoo; \
- int _i; \
-\
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- memcpy (&tFoo, _pBuf, SIZEOF (_pexType)); \
- GET_TEMP (_pexType, tFoo, _fooList[_i]); \
- _pBuf += SIZEOF (_pexType); \
- } \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * TEXT ALIGNMENT
- */
-
-#define EXTRACT_TEXTALIGN(_pBuf, _align) \
- EXTRACT_FOO (pexTextAlignmentData, _pBuf, _align)
-
-#define GET_TEMP_pexTextAlignmentData(_src, _dst) \
- _dst.vertical = _src.vertical; \
- _dst.horizontal = _src.horizontal;
-
-
-/*
- * PSC ISO CURVES
- */
-
-#define EXTRACT_PSC_ISOCURVES(_pBuf, _isoCurves) \
- EXTRACT_FOO (pexPSC_IsoparametricCurves, _pBuf, _isoCurves)
-
-#define GET_TEMP_pexPSC_IsoparametricCurves(_src, _dst) \
- _dst.placement_type = _src.placementType; \
- _dst.u_count = _src.numUcurves; \
- _dst.v_count = _src.numVcurves;
-
-
-/*
- * List of ELEMENT REF
- */
-
-#define EXTRACT_LISTOF_ELEMREF(_count, _pBuf, _pList) \
- EXTRACT_LISTOF_FOO (pexElementRef, _count, _pBuf, _pList)
-
-#define GET_TEMP_pexElementRef(_src, _dst) \
- _dst.structure = _src.structure; \
- _dst.offset = _src.offset;
-
-
-/*
- * List of ELEMENT INFO
- */
-
-#define EXTRACT_LISTOF_ELEMINFO(_count, _pBuf, _pList) \
- EXTRACT_LISTOF_FOO (pexElementInfo, _count, _pBuf, _pList)
-
-#define GET_TEMP_pexElementInfo(_src, _dst) \
- _dst.type = _src.elementType; \
- _dst.length = _src.length;
-
-
-/*
- * List of PICK ELEMENT REF
- */
-
-#define EXTRACT_LISTOF_PICKELEMREF(_count, _pBuf, _pList) \
- EXTRACT_LISTOF_FOO (pexPickElementRef, _count, _pBuf, _pList)
-
-#define GET_TEMP_pexPickElementRef(_src, _dst) \
- _dst.sid = _src.sid; \
- _dst.offset = _src.offset; \
- _dst.pick_id = _src.pickid;
-
-
-/*
- * List of DEVICE RECT
- */
-
-#define EXTRACT_LISTOF_DEVRECT(_count, _pBuf, _pList) \
- EXTRACT_LISTOF_FOO (pexDeviceRect, _count, _pBuf, _pList)
-
-#define GET_TEMP_pexDeviceRect(_src, _dst) \
- _dst.xmin = _src.xmin; \
- _dst.ymin = _src.ymin; \
- _dst.xmax = _src.xmax; \
- _dst.ymax = _src.ymax;
-
-
-/*
- * List of NAME SET PAIR
- */
-
-#define EXTRACT_LISTOF_NAMESET_PAIR(_count, _pBuf, _pList) \
- EXTRACT_LISTOF_FOO (pexNameSetPair, _count, _pBuf, _pList)
-
-#define GET_TEMP_pexNameSetPair(_src, _dst) \
- _dst.inclusion = _src.incl; \
- _dst.exclusion = _src.excl;
-
-
-/*
- * List of FONT PROP
- */
-
-#define EXTRACT_LISTOF_FONTPROP(_count, _pBuf, _pList) \
- EXTRACT_LISTOF_FOO (pexFontProp, _count, _pBuf, _pList)
-
-#define GET_TEMP_pexFontProp(_src, _dst) \
- _dst.name = _src.name; \
- _dst.value = _src.value;
-
-
-
-/* ------------------------------------------------------------------------ */
-/* EXTRACT_FOOFP and EXTRACT_LISTOF_FOOFP */
-/* ------------------------------------------------------------------------ */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define DOEXTRACT(_pexType, _src, _dst, _fpConvert, _fpFormat) \
- DOEXTRACT_##_pexType (_src, _dst, _fpConvert, _fpFormat)
-#else
-#define DOEXTRACT(_pexType, _src, _dst, _fpConvert, _fpFormat) \
- DOEXTRACT_/**/_pexType (_src, _dst, _fpConvert, _fpFormat)
-#endif
-
-
-#ifndef WORD64
-
-#define EXTRACT_FOOFP(_pexType, _pBuf, _foo, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- memcpy (&(_foo), _pBuf, SIZEOF (_pexType)); \
- } \
- else \
- { \
- _pexType *pFoo = (_pexType *) _pBuf; \
- DOEXTRACT (_pexType, pFoo, _foo, _fpConvert, _fpFormat); \
- } \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define EXTRACT_LISTOF_FOOFP(_pexType, _count, _pBuf, _fooList, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- memcpy (_fooList, _pBuf, _count * SIZEOF (_pexType)); \
- _pBuf += (_count * SIZEOF (_pexType)); \
- } \
- else \
- { \
- int _i; \
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- _pexType *pFoo = (_pexType *) _pBuf; \
- DOEXTRACT (_pexType, pFoo, _fooList[_i], _fpConvert, _fpFormat); \
- _pBuf += SIZEOF (_pexType); \
- } \
- } \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_FOOFP(_pexType, _pBuf, _foo, _fpConvert, _fpFormat) \
-{ \
- _pexType tFoo; \
- _pexType *pFoo = &tFoo; \
- memcpy (pFoo, _pBuf, SIZEOF (_pexType)); \
- DOEXTRACT (_pexType, pFoo, _foo, _fpConvert, _fpFormat); \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define EXTRACT_LISTOF_FOOFP(_pexType, _count, _pBuf, _fooList, _fpConvert, _fpFormat) \
-{ \
- int _i; \
- _pexType tFoo; \
- _pexType *pFoo = &tFoo; \
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- memcpy (pFoo, _pBuf, SIZEOF (_pexType)); \
- DOEXTRACT (_pexType, pFoo, _fooList[_i], _fpConvert, _fpFormat); \
- _pBuf += SIZEOF (_pexType); \
- } \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * NPC SUBVOLUME
- */
-
-#define EXTRACT_NPC_SUBVOLUME(_pBuf, _volume, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexNpcSubvolume, _pBuf, _volume, _fpConvert, _fpFormat)
-
-#define DOEXTRACT_pexNpcSubvolume(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->xmin, _dst.min.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->ymin, _dst.min.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->zmin, _dst.min.z, _fpFormat); \
- FP_CONVERT_NTOH (_src->xmax, _dst.max.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->ymax, _dst.max.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->zmax, _dst.max.z, _fpFormat); \
- } \
- else \
- { \
- _dst.min.x = _src->xmin; \
- _dst.min.y = _src->ymin; \
- _dst.min.z = _src->zmin; \
- _dst.max.x = _src->xmax; \
- _dst.max.y = _src->ymax; \
- _dst.max.z = _src->zmax; \
- }
-
-
-/*
- * VIEWPORT
- */
-
-#define EXTRACT_VIEWPORT(_pBuf, _viewport, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexViewport, _pBuf, _viewport, _fpConvert, _fpFormat)
-
-#define DOEXTRACT_pexViewport(_src, _dst, _fpConvert, _fpFormat) \
- _dst.min.x = _src->xmin; \
- _dst.min.y = _src->ymin; \
- _dst.max.x = _src->xmax; \
- _dst.max.y = _src->ymax; \
- _dst.use_drawable = _src->useDrawable; \
-\
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->zmin, _dst.min.z, _fpFormat); \
- FP_CONVERT_NTOH (_src->zmax, _dst.max.z, _fpFormat); \
- } \
- else \
- { \
- _dst.min.z = _src->zmin; \
- _dst.max.z = _src->zmax; \
- }
-
-
-/*
- * COORD 4D
- */
-
-#define EXTRACT_COORD4D(_pBuf, _coord4D, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexCoord4D, _pBuf, _coord4D, _fpConvert, _fpFormat)
-
-
-#define EXTRACT_LISTOF_COORD4D(_count, _pBuf, _pList, _fpConvert, _fpFormat)\
- EXTRACT_LISTOF_FOOFP (pexCoord4D, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat);
-
-
-#define DOEXTRACT_pexCoord4D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->x, _dst.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->y, _dst.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->z, _dst.z, _fpFormat); \
- FP_CONVERT_NTOH (_src->w, _dst.w, _fpFormat); \
- } \
- else \
- { \
- _dst.x = _src->x; \
- _dst.y = _src->y; \
- _dst.z = _src->z; \
- _dst.w = _src->w; \
- }
-
-
-/*
- * COORD 3D
- */
-
-#define EXTRACT_COORD3D(_pBuf, _coord3D, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexCoord3D, _pBuf, _coord3D, _fpConvert, _fpFormat)
-
-
-#define EXTRACT_LISTOF_COORD3D(_count, _pBuf, _pList, _fpConvert, _fpFormat)\
- EXTRACT_LISTOF_FOOFP (pexCoord3D, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat);
-
-
-#define DOEXTRACT_pexCoord3D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->x, _dst.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->y, _dst.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->z, _dst.z, _fpFormat); \
- } \
- else \
- { \
- _dst.x = _src->x; \
- _dst.y = _src->y; \
- _dst.z = _src->z; \
- }
-
-
-/*
- * COORD 2D
- */
-
-#define EXTRACT_COORD2D(_pBuf, _coord2D, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexCoord2D, _pBuf, _coord2D, _fpConvert, _fpFormat)
-
-
-#define EXTRACT_LISTOF_COORD2D(_count, _pBuf, _pList, _fpConvert, _fpFormat)\
- EXTRACT_LISTOF_FOOFP (pexCoord2D, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat);
-
-
-#define DOEXTRACT_pexCoord2D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->x, _dst.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->y, _dst.y, _fpFormat); \
- } \
- else \
- { \
- _dst.x = _src->x; \
- _dst.y = _src->y; \
- }
-
-
-/*
- * VECTOR 3D
- */
-
-#define EXTRACT_VECTOR3D(_pBuf, _vector3D, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexVector3D, _pBuf, _vector3D, _fpConvert, _fpFormat)
-
-
-#define DOEXTRACT_pexVector3D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->x, _dst.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->y, _dst.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->z, _dst.z, _fpFormat); \
- } \
- else \
- { \
- _dst.x = _src->x; \
- _dst.y = _src->y; \
- _dst.z = _src->z; \
- }
-
-
-/*
- * VECTOR 2D
- */
-
-#define EXTRACT_VECTOR2D(_pBuf, _vector2D, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexVector2D, _pBuf, _vector2D, _fpConvert, _fpFormat)
-
-
-#define DOEXTRACT_pexVector2D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->x, _dst.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->y, _dst.y, _fpFormat); \
- } \
- else \
- { \
- _dst.x = _src->x; \
- _dst.y = _src->y; \
- }
-
-
-/*
- * PSC LEVEL CURVES
- */
-
-#define EXTRACT_PSC_LEVELCURVES(_pBuf, _levCurv, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexPSC_LevelCurves, _pBuf, _levCurv, _fpConvert, _fpFormat)
-
-
-#define DOEXTRACT_pexPSC_LevelCurves(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->origin_x, _dst.origin.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->origin_y, _dst.origin.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->origin_z, _dst.origin.z, _fpFormat); \
- FP_CONVERT_NTOH (_src->direction_x, _dst.direction.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->direction_y, _dst.direction.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->direction_z, _dst.direction.z, _fpFormat); \
- } \
- else \
- { \
- _dst.origin.x = _src->origin_x; \
- _dst.origin.y = _src->origin_y; \
- _dst.origin.z = _src->origin_z; \
- _dst.direction.x = _src->direction_x; \
- _dst.direction.y = _src->direction_y; \
- _dst.direction.z = _src->direction_z; \
- } \
- _dst.count = _src->numberIntersections;
-
-
-/*
- * REFLECTION ATTRIBUTES
- */
-
-#define EXTRACT_REFLECTION_ATTR(_pBuf, _reflAttr, _fpConvert, _fpFormat) \
- EXTRACT_FOOFP (pexReflectionAttr, _pBuf, _reflAttr, _fpConvert, _fpFormat)\
- EXTRACT_COLOR_VAL (_pBuf, _reflAttr.specular_color.type, \
- _reflAttr.specular_color.value, _fpConvert, _fpFormat)
-
-
-#define DOEXTRACT_pexReflectionAttr(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->ambient, _dst.ambient, _fpFormat); \
- FP_CONVERT_NTOH (_src->diffuse, _dst.diffuse, _fpFormat); \
- FP_CONVERT_NTOH (_src->specular, _dst.specular, _fpFormat); \
- FP_CONVERT_NTOH (_src->specularConc, _dst.specular_conc, _fpFormat); \
- FP_CONVERT_NTOH (_src->transmission, _dst.transmission, _fpFormat); \
- } \
- else \
- { \
- _dst.ambient = _src->ambient; \
- _dst.diffuse = _src->diffuse; \
- _dst.specular = _src->specular; \
- _dst.specular_conc = _src->specularConc; \
- _dst.transmission = _src->transmission; \
- } \
- _dst.specular_color.type = _src->specular_colorType;
-
-
-/*
- * List of HALF SPACE
- */
-
-#define EXTRACT_LISTOF_HALFSPACE3D(_count, _pBuf, _pList, _fpConvert, _fpFormat)\
- EXTRACT_LISTOF_FOOFP (pexHalfSpace, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat);
-
-#define DOEXTRACT_pexHalfSpace(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->point_x, _dst.point.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->point_y, _dst.point.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->point_z, _dst.point.z, _fpFormat); \
- FP_CONVERT_NTOH (_src->vector_x, _dst.vector.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->vector_y, _dst.vector.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->vector_z, _dst.vector.z, _fpFormat); \
- } \
- else \
- { \
- _dst.point.x = _src->point_x; \
- _dst.point.y = _src->point_y; \
- _dst.point.z = _src->point_z; \
- _dst.vector.x = _src->vector_x; \
- _dst.vector.y = _src->vector_y; \
- _dst.vector.z = _src->vector_z; \
- }
-
-#define EXTRACT_LISTOF_HALFSPACE2D(_count, _pBuf, _pList, _fpConvert, _fpFormat)\
- EXTRACT_LISTOF_FOOFP (pexHalfSpace2D, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat);
-
-#define DOEXTRACT_pexHalfSpace2D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->point_x, _dst.point.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->point_y, _dst.point.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->vector_x, _dst.vector.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->vector_y, _dst.vector.y, _fpFormat); \
- } \
- else \
- { \
- _dst.point.x = _src->point_x; \
- _dst.point.y = _src->point_y; \
- _dst.vector.x = _src->vector_x; \
- _dst.vector.y = _src->vector_y; \
- }
-
-
-/*
- * List of DEVICE COORD
- */
-
-#define EXTRACT_LISTOF_DEVCOORD(_count, _pBuf, _pList, _fpConvert, _fpFormat) \
- EXTRACT_LISTOF_FOOFP (pexDeviceCoord, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat)
-
-#define DOEXTRACT_pexDeviceCoord(_src, _dst, _fpConvert, _fpFormat) \
- _dst.x = _src->x; \
- _dst.y = _src->y; \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->z, _dst.z, _fpFormat); \
- } \
- else \
- _dst.z = _src->z;
-
-
-/*
- * List of EXTENT INFO
- */
-
-#define EXTRACT_LISTOF_EXTENT_INFO(_count, _pBuf, _pList, _fpConvert, _fpFormat) \
- EXTRACT_LISTOF_FOOFP (pexExtentInfo, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat)
-
-
-#define DOEXTRACT_pexExtentInfo(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->lowerLeft_x, _dst.lower_left.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->lowerLeft_y, _dst.lower_left.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->upperRight_x, _dst.upper_right.x, _fpFormat); \
- FP_CONVERT_NTOH (_src->upperRight_y, _dst.upper_right.y, _fpFormat); \
- FP_CONVERT_NTOH (_src->concatpoint_x, _dst.concat_point.x, _fpFormat);\
- FP_CONVERT_NTOH (_src->concatpoint_y, _dst.concat_point.y, _fpFormat);\
- } \
- else \
- { \
- _dst.lower_left.x = _src->lowerLeft_x; \
- _dst.lower_left.y = _src->lowerLeft_y; \
- _dst.upper_right.x = _src->upperRight_x; \
- _dst.upper_right.y = _src->upperRight_y; \
- _dst.concat_point.x = _src->concatpoint_x; \
- _dst.concat_point.y = _src->concatpoint_y; \
- }
-
-
-/*
- * List of POSTED STRUCS
- */
-
-#define EXTRACT_LISTOF_POSTED_STRUCS(_count, _pBuf, _pList, _fpConvert, _fpFormat) \
- EXTRACT_LISTOF_FOOFP (pexStructureInfo, _count, _pBuf, _pList, \
- _fpConvert, _fpFormat)
-
-#define DOEXTRACT_pexStructureInfo(_src, _dst, _fpConvert, _fpFormat) \
- _dst.sid = _src->sid; \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (_src->priority, _dst.priority, _fpFormat); \
- } \
- else \
- _dst.priority = _src->priority;
-
-
-/* ------------------------------------------------------------------------ */
-/* COLOR VALUE and COLOR SPECIFIER */
-/* ------------------------------------------------------------------------ */
-
-#define EXTRACT_COLOR_VAL(_pBuf, _colType, _colVal, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- int sizeColor = GetColorSize (_colType); \
- memcpy (&(_colVal), _pBuf, sizeColor); \
- _pBuf += sizeColor; \
- } \
- else \
- { \
- switch (_colType) \
- { \
- case PEXColorTypeIndexed: \
-\
- EXTRACT_CARD16 (_pBuf, _colVal.indexed.index); \
- _pBuf += 2; \
- break; \
-\
- case PEXColorTypeRGB: \
- case PEXColorTypeCIE: \
- case PEXColorTypeHSV: \
- case PEXColorTypeHLS: \
-\
- FP_CONVERT_NTOH_BUFF (_pBuf, _colVal.rgb.red, _fpFormat); \
- _pBuf += SIZEOF (float); \
- FP_CONVERT_NTOH_BUFF (_pBuf, _colVal.rgb.green, _fpFormat); \
- _pBuf += SIZEOF (float); \
- FP_CONVERT_NTOH_BUFF (_pBuf, _colVal.rgb.blue, _fpFormat); \
- _pBuf += SIZEOF (float); \
- break; \
-\
- case PEXColorTypeRGB8: \
-\
- memcpy (&(_colVal.rgb8), _pBuf, 4); \
- _pBuf += 4; \
- break; \
-\
- case PEXColorTypeRGB16: \
-\
- EXTRACT_CARD16 (_pBuf, _colVal.rgb16.red); \
- EXTRACT_CARD16 (_pBuf, _colVal.rgb16.green); \
- EXTRACT_CARD16 (_pBuf, _colVal.rgb16.blue); \
- _pBuf += 2; \
- break; \
- } \
- } \
-}
-
-
-#define EXTRACT_LISTOF_COLOR_VAL(_count, _pBuf, _colType, _pList, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- int sizeColor = GetColorSize (_colType); \
- memcpy (_pList.indexed, _pBuf, _count * sizeColor); \
- _pBuf += (_count * sizeColor); \
- } \
- else \
- { \
- _PEXExtractListOfColor (_count, &(_pBuf), _colType, \
- _pList, _fpFormat); \
- } \
-}
-
-
-#define EXTRACT_COLOR_SPEC(_pBuf, _colSpec, _fpConvert, _fpFormat) \
-{ \
- EXTRACT_INT16 (_pBuf, _colSpec.type); \
- _pBuf += 2; \
- EXTRACT_COLOR_VAL (_pBuf, _colSpec.type, _colSpec.value, \
- _fpConvert, _fpFormat); \
-}
-
-
-#define EXTRACT_LISTOF_COLOR_SPEC(_count, _pBuf, _pList, _fpConvert, _fpFormat) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- { \
- EXTRACT_COLOR_SPEC (_pBuf, _pList[_i], _fpConvert, _fpFormat); \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* FONT Info */
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define EXTRACT_FONTINFO(_pBuf, _fontInfo) \
-{ \
- pexFontInfo *pInfo = (pexFontInfo *) _pBuf; \
- _fontInfo.first_glyph = pInfo->firstGlyph; \
- _fontInfo.last_glyph = pInfo->lastGlyph; \
- _fontInfo.default_glyph = pInfo->defaultGlyph; \
- _fontInfo.all_exist = pInfo->allExist; \
- _fontInfo.stroke = pInfo->strokeFont; \
- _fontInfo.count = pInfo->numProps; \
- _pBuf += SIZEOF (pexFontInfo); \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_FONTINFO(_pBuf, _fontInfo) \
-{ \
- pexFontInfo tInfo; \
- memcpy (&tInfo, _pBuf, SIZEOF (pexFontInfo)); \
- _fontInfo.first_glyph = tInfo.firstGlyph; \
- _fontInfo.last_glyph = tInfo.lastGlyph; \
- _fontInfo.default_glyph = tInfo.defaultGlyph; \
- _fontInfo.all_exist = tInfo.allExist; \
- _fontInfo.stroke = tInfo.strokeFont; \
- _fontInfo.count = tInfo.numProps; \
- _pBuf += SIZEOF (pexFontInfo); \
-}
-
-#endif /* WORD64 */
-
-
-/* ------------------------------------------------------------------------ */
-/* List of STRING */
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define EXTRACT_LISTOF_STRING(_count, _pBuf, _pList) \
-{ \
- unsigned int length; \
- int _i; \
-\
- for (_i = 0; _i < _count; _i++) \
- { \
- pexString *repStrings = (pexString *) _pBuf; \
- length = repStrings->length; \
- _pList[_i] = (char *) Xmalloc (length + 1); \
- memcpy (_pList[_i], _pBuf + SIZEOF (pexString), length); \
- _pList[_i][length] = '\0'; \
- _pBuf += PADDED_BYTES (SIZEOF (pexString) + length); \
- } \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_LISTOF_STRING(_count, _pBuf, _pList) \
-{ \
- pexString tString; \
- unsigned int length; \
- int _i; \
-\
- for (_i = 0; _i < _count; _i++) \
- { \
- memcpy (&tString, _pBuf, SIZEOF (pexString)); \
- length = tString.length; \
- _pList[_i] = (char *) Xmalloc (length + 1); \
- memcpy (_pList[_i], _pBuf + SIZEOF (pexString), length); \
- _pList[_i][length] = '\0'; \
- _pBuf += PADDED_BYTES (SIZEOF (pexString) + length); \
- } \
-}
-
-#endif
-
-
-/* ------------------------------------------------------------------------ */
-/* FACET data */
-/* ------------------------------------------------------------------------ */
-
-#define EXTRACT_FACET(_pBuf, _colorType, _facetAttr, _facetData, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXExtractFacet (&(_pBuf), _colorType, _facetAttr, \
- &_facetData, _fpFormat); \
- } \
- else \
- { \
- int bytes = GetClientFacetSize (_colorType, _facetAttr); \
- memcpy (&_facetData, _pBuf, bytes); \
- _pBuf += bytes; \
- } \
-}
-
-
-#define EXTRACT_LISTOF_FACET(_count, _pBuf, _facetSize, _colorType, _facetAttr, _facetData, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXExtractListOfFacet (_count, &(_pBuf), _colorType, \
- _facetAttr, _facetData, _fpFormat); \
- } \
- else \
- { \
- int bytes = _count * _facetSize; \
- memcpy (_facetData.index, _pBuf, bytes); \
- _pBuf += bytes; \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* VERTEX data */
-/* ------------------------------------------------------------------------ */
-
-#define EXTRACT_LISTOF_VERTEX(_count, _pBuf, _vertexSize, _colorType, _vertexAttr, _vertexData, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXExtractListOfVertex (_count, &(_pBuf), _colorType, \
- _vertexAttr, _vertexData, _fpFormat); \
- } \
- else \
- { \
- int bytes = _count * _vertexSize; \
- memcpy (_vertexData.no_data, _pBuf, bytes); \
- _pBuf += bytes; \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* PICK RECORD */
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define EXTRACT_PICK_RECORD(_pBuf, _type, _numBytes, _pickRec, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- DOEXTRACT_PICK_RECORD (_pBuf, _type, _numBytes, _pickRec, \
- _fpConvert, _fpFormat); \
- } \
- else \
- { \
- memcpy (&(_pickRec), _pBuf, _numBytes); \
- } \
- _pBuf += _numBytes; \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_PICK_RECORD(_pBuf, _type, _numBytes, _pickRec, _fpConvert, _fpFormat) \
-{ \
- DOEXTRACT_PICK_RECORD (_pBuf, _type, _numBytes, _pickRec, _fpConvert, _fpFormat);\
- _pBuf += _numBytes; \
-}
-
-#endif /* WORD64 */
-
-
-#define DOEXTRACT_PICK_RECORD(_pBuf, _type, _numBytes, _pickRec, _fpConvert, _fpFormat) \
-{ \
- pexPD_DC_HitBox dc_box; \
- pexPD_NPC_HitVolume npc_vol; \
-\
- if (_type == PEXPickDeviceDCHitBox) \
- { \
- memcpy (&dc_box, _pBuf, _numBytes); \
- _pickRec.box.position.x = dc_box.position_x; \
- _pickRec.box.position.y = dc_box.position_y; \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (dc_box.distance, \
- _pickRec.box.distance, fpFormat); \
- } \
- else \
- _pickRec.box.distance = dc_box.distance; \
- } \
- else if (_type == PEXPickDeviceNPCHitVolume) \
- { \
- memcpy (&npc_vol, _pBuf, _numBytes); \
- if (_fpConvert) \
- { \
- FP_CONVERT_NTOH (npc_vol.xmin, _pickRec.volume.min.x, _fpFormat);\
- FP_CONVERT_NTOH (npc_vol.ymin, _pickRec.volume.min.y, _fpFormat);\
- FP_CONVERT_NTOH (npc_vol.zmin, _pickRec.volume.min.z, _fpFormat);\
- FP_CONVERT_NTOH (npc_vol.xmax, _pickRec.volume.max.x, _fpFormat);\
- FP_CONVERT_NTOH (npc_vol.ymax, _pickRec.volume.max.y, _fpFormat);\
- FP_CONVERT_NTOH (npc_vol.zmax, _pickRec.volume.max.z, _fpFormat);\
- } \
- else \
- { \
- _pickRec.volume.min.x = npc_vol.xmin; \
- _pickRec.volume.min.y = npc_vol.ymin; \
- _pickRec.volume.min.z = npc_vol.zmin; \
- _pickRec.volume.max.x = npc_vol.xmax; \
- _pickRec.volume.max.y = npc_vol.ymax; \
- _pickRec.volume.max.z = npc_vol.zmax; \
- } \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* Mono Encoded Strings */
-/* ------------------------------------------------------------------------ */
-
-#define EXTRACT_MONOENCODING(_pBuf, _enc) \
- EXTRACT_FOO (pexMonoEncoding, _pBuf, _enc)
-
-#define GET_TEMP_pexMonoEncoding(_src, _dst) \
- _dst.character_set = _src.characterSet; \
- _dst.character_set_width = _src.characterSetWidth; \
- _dst.encoding_state = _src.encodingState; \
- _dst.length = _src.numChars;
-
-#define EXTRACT_LISTOF_MONOENCODING(_count, _pBuf, _pList) \
-{ \
- PEXEncodedTextData *nextString; \
- unsigned size; \
- int _i; \
-\
- nextString = _pList; \
- for (_i = 0; _i < (int) _count; _i++, nextString++) \
- { \
- EXTRACT_MONOENCODING (_pBuf, (*nextString)); \
-\
- if (nextString->character_set_width == PEXCSLong) \
- size = nextString->length * SIZEOF (long); \
- else if (nextString->character_set_width == PEXCSShort) \
- size = nextString->length * SIZEOF (short); \
- else /* nextString->character_set_width == PEXCSByte) */ \
- size = nextString->length; \
-\
- nextString->ch = (char *) Xmalloc (size); \
-\
- memcpy (nextString->ch, _pBuf, size); \
- _pBuf += PADDED_BYTES (size); \
- } \
-}
-
-
diff --git a/xc/lib/PEX5/pl_font.c b/xc/lib/PEX5/pl_font.c
deleted file mode 100644
index d97fd9554..000000000
--- a/xc/lib/PEX5/pl_font.c
+++ /dev/null
@@ -1,671 +0,0 @@
-/* $TOG: pl_font.c /main/13 1998/02/06 16:10:11 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-
-
-PEXFont
-PEXLoadFont (display, fontname)
-
-INPUT Display *display;
-INPUT char *fontname;
-
-{
- register pexLoadFontReq *req;
- char *pBuf;
- PEXFont id;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (LoadFont, pBuf);
-
- BEGIN_REQUEST_HEADER (LoadFont, pBuf, req);
-
- PEXStoreReqHead (LoadFont, req);
- req->numBytes = strlen (fontname);
- req->font = id = XAllocID (display);
- req->length += (req->numBytes + 3) >> 2;
-
- END_REQUEST_HEADER (LoadFont, pBuf, req);
-
- Data (display, fontname, req->numBytes);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (id);
-}
-
-
-void
-PEXUnloadFont (display, font)
-
-INPUT Display *display;
-INPUT PEXFont font;
-
-{
- register pexResourceReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (UnloadFont, pBuf);
-
- BEGIN_REQUEST_HEADER (Resource, pBuf, req);
-
- PEXStoreReqHead (UnloadFont, req);
- req->id = font;
-
- END_REQUEST_HEADER (Resource, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXFontInfo *
-PEXQueryFont (display, font)
-
-INPUT Display *display;
-INPUT PEXFont font;
-
-{
- register pexQueryFontReq *req;
- char *pBuf, *pBufSave;
- pexQueryFontReply rep;
- PEXFontInfo *fontInfo;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (QueryFont, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryFont, pBuf, req);
-
- PEXStoreReqHead (QueryFont, req);
- req->font = font;
-
- END_REQUEST_HEADER (QueryFont, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- fontInfo = (PEXFontInfo *) Xmalloc (sizeof (PEXFontInfo));
-
- EXTRACT_FONTINFO (pBuf, (*fontInfo));
-
- fontInfo->props = (PEXFontProp *) Xmalloc (
- (unsigned) (fontInfo->count * sizeof (PEXFontProp)));
-
- EXTRACT_LISTOF_FONTPROP (fontInfo->count, pBuf, fontInfo->props);
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (fontInfo);
-}
-
-
-char **
-PEXListFonts (display, pattern, maxNames, countReturn)
-
-INPUT Display *display;
-INPUT char *pattern;
-INPUT unsigned int maxNames;
-OUTPUT unsigned long *countReturn;
-
-{
- register pexListFontsReq *req;
- char *pBuf, *pBufSave;
- pexListFontsReply rep;
- char **names;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (ListFonts, pBuf);
-
- BEGIN_REQUEST_HEADER (ListFonts, pBuf, req);
-
- PEXStoreReqHead (ListFonts, req);
- req->maxNames = maxNames;
- req->numChars = strlen (pattern);
- req->length += ((int) req->numChars + 3) >> 2;
-
- END_REQUEST_HEADER (ListFonts, pBuf, req);
-
- Data (display, pattern, req->numChars);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *countReturn = 0;
- return (NULL); /* return an error */
- }
-
- *countReturn = rep.numStrings;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- names = (char **) Xmalloc ((unsigned) (rep.numStrings * sizeof (char *)));
-
- EXTRACT_LISTOF_STRING (rep.numStrings, pBuf, names);
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (names);
-}
-
-
-char **
-PEXListFontsWithInfo (display, pattern, maxNames, countReturn, fontInfoReturn)
-
-INPUT Display *display;
-INPUT char *pattern;
-INPUT unsigned int maxNames;
-OUTPUT unsigned long *countReturn;
-OUTPUT PEXFontInfo **fontInfoReturn;
-
-{
- register pexListFontsWithInfoReq *req;
- char *pBuf, *pBufSave;
- pexListFontsWithInfoReply rep;
- PEXFontInfo *pInfoRet;
- char **names;
- CARD32 count;
- int i;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (ListFontsWithInfo, pBuf);
-
- BEGIN_REQUEST_HEADER (ListFontsWithInfo, pBuf, req);
-
- PEXStoreReqHead (ListFontsWithInfo, req);
- req->maxNames = maxNames;
- req->numChars = strlen (pattern);
- req->length += ((int) req->numChars + 3) >> 2;
-
- END_REQUEST_HEADER (ListFontsWithInfo, pBuf, req);
-
- Data (display, (char *) pattern, req->numChars);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *countReturn = 0;
- return (NULL); /* return an error */
- }
-
- *countReturn = rep.numStrings;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the font names to pass back to the client.
- */
-
- names = (char **) Xmalloc ((unsigned) (rep.numStrings * sizeof (char *)));
-
- EXTRACT_LISTOF_STRING (rep.numStrings, pBuf, names);
-
-
- /*
- * Allocate a buffer for the font info to pass back to the client.
- */
-
- EXTRACT_CARD32 (pBuf, count);
-
- *fontInfoReturn = pInfoRet = (PEXFontInfo *)
- Xmalloc ((unsigned) (count * sizeof (PEXFontInfo)));
-
- for (i = 0; i < count; i++, pInfoRet++)
- {
- EXTRACT_FONTINFO (pBuf, (*pInfoRet));
-
- pInfoRet->props = (PEXFontProp *)
- Xmalloc ((unsigned) (pInfoRet->count * sizeof (PEXFontProp)));
-
- EXTRACT_LISTOF_FONTPROP (pInfoRet->count, pBuf, pInfoRet->props);
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (names);
-}
-
-
-PEXTextExtent *
-PEXQueryTextExtents (display, id, fontGroup, path, expansion, spacing, height,
- halign, valign, count, text)
-
-INPUT Display *display;
-INPUT XID id;
-INPUT unsigned int fontGroup;
-INPUT int path;
-INPUT double expansion;
-INPUT double spacing;
-INPUT double height;
-INPUT int halign;
-INPUT int valign;
-INPUT unsigned long count;
-INPUT PEXStringData *text;
-{
- register pexQueryTextExtentsReq *req;
- char *pBuf, *pBufSave;
- pexQueryTextExtentsReply rep;
- pexMonoEncoding monoEncoding;
- int numEncodings, i;
- PEXTextExtent *textExtents;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (QueryTextExtents, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryTextExtents, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (QueryTextExtents, fpFormat, req);
- req->textPath = path;
- req->id = id;
- req->fontGroupIndex = (pexTableIndex) fontGroup;
- req->alignment_vertical = valign;
- req->alignment_horizontal = halign;
- req->numStrings = count;
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (expansion, req->charExpansion, fpFormat);
- FP_CONVERT_DHTON (spacing, req->charSpacing, fpFormat);
- FP_CONVERT_DHTON (height, req->charHeight, fpFormat);
- }
- else
- {
- req->charExpansion = expansion;
- req->charSpacing = spacing;
- req->charHeight = height;
- }
-
- req->length += (count * (LENOF (CARD32) + LENOF (pexMonoEncoding)));
- for (i = 0; i < count; i++)
- req->length += (((int) text[i].length + 3) >> 2);
-
- END_REQUEST_HEADER (QueryTextExtents, pBuf, req);
-
-
- /*
- * Put the text in the request.
- */
-
- monoEncoding.characterSet = (INT16) 1;
- monoEncoding.characterSetWidth = (CARD8) PEXCSByte;
- monoEncoding.encodingState = 0;
-
- numEncodings = 1;
-
- for (i = 0; i < count; i++)
- {
- XDATA_CARD32 (display, numEncodings);
- monoEncoding.numChars = (CARD16) (text[i].length);
- Data (display, (char *) &monoEncoding, SIZEOF (pexMonoEncoding));
- Data (display, text[i].ch, text[i].length);
- }
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- textExtents = (PEXTextExtent *) Xmalloc (
- (unsigned) (count * sizeof (PEXTextExtent)));
-
- EXTRACT_LISTOF_EXTENT_INFO (count, pBuf, textExtents, fpConvert, fpFormat)
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (textExtents);
-}
-
-
-PEXTextExtent *
-PEXQueryEncodedTextExtents (display, id, fontGroup, path, expansion,
- spacing, height, halign, valign, count, encoded_text)
-
-INPUT Display *display;
-INPUT XID id;
-INPUT unsigned int fontGroup;
-INPUT int path;
-INPUT double expansion;
-INPUT double spacing;
-INPUT double height;
-INPUT int halign;
-INPUT int valign;
-INPUT unsigned long count;
-INPUT PEXListOfEncodedText *encoded_text;
-
-{
- register pexQueryTextExtentsReq *req;
- char *pBuf, *pBufSave;
- pexQueryTextExtentsReply rep;
- PEXEncodedTextData *string;
- PEXTextExtent *textExtents;
- int i, j;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (QueryTextExtents, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryTextExtents, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (QueryTextExtents, fpFormat, req);
- req->textPath = path;
- req->id = id;
- req->fontGroupIndex = (pexTableIndex) fontGroup;
- req->alignment_vertical = valign;
- req->alignment_horizontal = halign;
- req->numStrings = count;
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (expansion, req->charExpansion, fpFormat);
- FP_CONVERT_DHTON (spacing, req->charSpacing, fpFormat);
- FP_CONVERT_DHTON (height, req->charHeight, fpFormat);
- }
- else
- {
- req->charExpansion = expansion;
- req->charSpacing = spacing;
- req->charHeight = height;
- }
-
- req->length += (count * LENOF (CARD32));
- for (i = 0; i < count; i++)
- {
- string = encoded_text[i].encoded_text;
- for (j = 0; j < (int) encoded_text[i].count; j++, string++)
- {
- req->length += LENOF (pexMonoEncoding);
- if (string->character_set_width == PEXCSLong)
- req->length += string->length;
- else if (string->character_set_width == PEXCSShort)
- req->length += ((int) string->length + 1) >> 1;
- else /* string->character_set_width == PEXCSByte) */
- req->length += ((int) string->length + 3) >> 2;
- }
- }
-
- END_REQUEST_HEADER (QueryTextExtents, pBuf, req);
-
-
- /*
- * Put the encoded text in the request.
- */
-
- for (i = 0; i < count; i++)
- {
- unsigned long numEncodings = encoded_text[i].count;
- string = encoded_text[i].encoded_text;
-
- XDATA_CARD32 (display, numEncodings);
-
- for (j = 0; j < (int) numEncodings; j++, string++)
- {
- XDATA_MONOENCODING (display, string);
-
- if (string->character_set_width == PEXCSLong)
- {
- Data (display, string->ch, string->length * SIZEOF (long));
- }
- else if (string->character_set_width == PEXCSShort)
- {
- Data (display, string->ch, string->length * SIZEOF (short));
- }
- else /* string->character_set_width == PEXCSByte) */
- {
- Data (display, string->ch, string->length);
- }
- }
- }
-
-
- /*
- * Get a reply.
- */
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- textExtents = (PEXTextExtent *) Xmalloc (
- (unsigned) (count * sizeof (PEXTextExtent)));
-
- EXTRACT_LISTOF_EXTENT_INFO (count, pBuf, textExtents, fpConvert, fpFormat)
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (textExtents);
-}
diff --git a/xc/lib/PEX5/pl_free.c b/xc/lib/PEX5/pl_free.c
deleted file mode 100644
index 2118b7423..000000000
--- a/xc/lib/PEX5/pl_free.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/* $TOG: pl_free.c /main/11 1998/02/06 16:10:16 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 "PEXlib.h"
-#include "PEXlibint.h"
-
-#define CHECK_AND_FREE(_ptr) if (_ptr) Xfree (_ptr)
-
-
-void PEXFreeEnumInfo (numCounts, infoCount, enumInfo)
-
-INPUT unsigned long numCounts;
-INPUT unsigned long *infoCount;
-INPUT PEXEnumTypeDesc *enumInfo;
-
-{
- PEXEnumTypeDesc *desc = enumInfo;
- int i, j;
-
-
- if (enumInfo)
- for (i = 0; i < numCounts; i++)
- for (j = 0; j < infoCount[i]; j++)
- {
- CHECK_AND_FREE ((char *) desc->descriptor);
- desc++;
- }
-
- CHECK_AND_FREE ((char *) infoCount);
- CHECK_AND_FREE ((char *) enumInfo);
-}
-
-
-void PEXFreeFontInfo (numFontInfo, fontInfo)
-
-INPUT unsigned long numFontInfo;
-INPUT PEXFontInfo *fontInfo;
-
-{
- PEXFontInfo *info = fontInfo;
- int i;
-
-
- for (i = 0; i < numFontInfo; i++)
- {
- CHECK_AND_FREE ((char *) info->props);
- info++;
- }
-
- CHECK_AND_FREE ((char *) fontInfo);
-}
-
-
-void PEXFreeFontNames (numFontNames, fontNames)
-
-INPUT unsigned long numFontNames;
-INPUT char **fontNames;
-
-{
- int i;
-
-
- for (i = 0; i < numFontNames; i++)
- CHECK_AND_FREE (fontNames[i]);
-
- CHECK_AND_FREE ((char *) fontNames);
-}
-
-
-void PEXFreePCAttributes (pcAttr)
-
-INPUT PEXPCAttributes *pcAttr;
-
-{
- CHECK_AND_FREE ((char *) pcAttr->model_clip_volume.half_spaces);
- CHECK_AND_FREE ((char *) pcAttr->light_state.indices);
-
- if (pcAttr->para_surf_char.type == PEXPSCMCLevelCurves ||
- pcAttr->para_surf_char.type == PEXPSCWCLevelCurves)
- {
- CHECK_AND_FREE ((char *)
- pcAttr->para_surf_char.psc.level_curves.parameters);
- }
- else if (pcAttr->para_surf_char.type == PEXPSCImpDep)
- {
- CHECK_AND_FREE ((char *) pcAttr->para_surf_char.psc.imp_dep.data);
- }
-
- CHECK_AND_FREE ((char *) pcAttr);
-}
-
-
-void PEXFreePDAttributes (pdAttr)
-
-PEXPDAttributes *pdAttr;
-
-{
- CHECK_AND_FREE ((char *) pdAttr->path.elements);
-
- CHECK_AND_FREE ((char *) pdAttr);
-}
-
-
-void PEXFreePMAttributes (pmAttr)
-
-PEXPMAttributes *pmAttr;
-
-{
- CHECK_AND_FREE ((char *) pmAttr->pick_path.elements);
-
- CHECK_AND_FREE ((char *) pmAttr);
-}
-
-
-void PEXFreePickPaths (numPickPaths, pickPaths)
-
-INPUT unsigned long numPickPaths;
-INPUT PEXPickPath *pickPaths;
-
-{
- int total_size, i;
-
-
- /*
- * Note that memory allocation of pick paths is optimized by
- * allocating one chunk for all the pick paths in the list, instead
- * of allocating a seperate buffer for each pick path.
- */
-
- if (pickPaths == PEXPickCache)
- {
- /*
- * Make the pick cache available again.
- */
-
- PEXPickCacheInUse = 0;
- }
- else if (PEXPickCacheInUse)
- {
- /*
- * The pick cache is in use, so we must free this pick path.
- */
-
- Xfree ((char *) pickPaths);
- }
- else
- {
- /*
- * Calculate the size of the pick path being freed.
- */
-
- total_size = numPickPaths * sizeof (PEXPickPath);
- for (i = 0; i < numPickPaths; i++)
- total_size += (pickPaths[i].count * sizeof (PEXPickElementRef));
-
-
- /*
- * If the size is smaller than the pick cache size or bigger than
- * the max size, free the pick path. Otherwise, make this path the
- * new pick cache buffer.
- */
-
- if (total_size <= PEXPickCacheSize || total_size > MAX_PICK_CACHE_SIZE)
- Xfree ((char *) pickPaths);
- else
- {
- if (PEXPickCache)
- Xfree ((char *) PEXPickCache);
- PEXPickCache = pickPaths;
- PEXPickCacheSize = total_size;
- }
- }
-}
-
-
-void PEXFreeRendererAttributes (rdrAttr)
-
-INPUT PEXRendererAttributes *rdrAttr;
-
-{
- CHECK_AND_FREE ((char *) rdrAttr->current_path.elements);
- CHECK_AND_FREE ((char *) rdrAttr->clip_list.rectangles);
- CHECK_AND_FREE ((char *) rdrAttr->pick_start_path.elements);
-
- CHECK_AND_FREE ((char *) rdrAttr);
-}
-
-
-void PEXFreeSCAttributes (scAttr)
-
-PEXSCAttributes *scAttr;
-
-{
- CHECK_AND_FREE ((char *) scAttr->start_path.elements);
- CHECK_AND_FREE ((char *) scAttr->normal.pairs);
- CHECK_AND_FREE ((char *) scAttr->inverted.pairs);
-
- CHECK_AND_FREE ((char *) scAttr);
-}
-
-
-void PEXFreeStructurePaths (numPaths, paths)
-
-INPUT unsigned long numPaths;
-INPUT PEXStructurePath *paths;
-
-{
- int i;
-
-
- for (i = 0; i < numPaths; i++)
- CHECK_AND_FREE ((char *) paths[i].elements);
-
- CHECK_AND_FREE ((char *) paths);
-}
-
-
-void PEXFreeTableEntries (tableType, numTableEntries, tableEntries)
-
-INPUT int tableType;
-INPUT unsigned int numTableEntries;
-INPUT PEXPointer tableEntries;
-
-{
- int i;
-
-
- switch (tableType)
- {
- case PEXLUTPattern:
- {
- PEXPatternEntry *entries = (PEXPatternEntry *) tableEntries;
-
- for (i = 0; i < numTableEntries; i++)
- CHECK_AND_FREE ((char *) entries[i].colors.indexed);
- break;
- }
-
- case PEXLUTTextFont:
- {
- PEXTextFontEntry *entries = (PEXTextFontEntry *) tableEntries;
-
- for (i = 0; i < numTableEntries; i++)
- CHECK_AND_FREE ((char *) entries[i].fonts);
- break;
- }
-
- case PEXLUTLineBundle:
- case PEXLUTMarkerBundle:
- case PEXLUTTextBundle:
- case PEXLUTInteriorBundle:
- case PEXLUTEdgeBundle:
- case PEXLUTColor:
- case PEXLUTView:
- case PEXLUTLight:
- case PEXLUTDepthCue:
- case PEXLUTColorApprox:
- break;
- }
-}
-
-
-void PEXFreeWorkstationAttributes (wksAttr)
-
-INPUT PEXWorkstationAttributes *wksAttr;
-
-{
- CHECK_AND_FREE ((char *) wksAttr->defined_views.views);
- CHECK_AND_FREE ((char *) wksAttr->posted_structures.structures);
-
- CHECK_AND_FREE ((char *) wksAttr);
-}
-
-
-void PEXFreeOCData (count, oc_data)
-
-INPUT unsigned long count;
-INPUT PEXOCData *oc_data;
-
-{
- PEXOCData *oc = oc_data;
- PEXEncodedTextData *encText;
- PEXListOfVertex *plset;
- PEXListOfCoord *fillset;
- PEXListOfCoord2D *fillset2D;
- PEXListOfVertex *fillsetdata;
- PEXConnectivityData *pCon;
- PEXListOfTrimCurve *pTrim;
- int i, j, k;
-
-
- for (i = 0; i < count; i++, oc++)
- {
- switch (oc->oc_type)
- {
- case PEXOCModelClipVolume:
-
- CHECK_AND_FREE ((char *) oc->data.SetModelClipVolume.half_spaces);
- break;
-
- case PEXOCModelClipVolume2D:
-
- CHECK_AND_FREE ((char *) oc->data.SetModelClipVolume2D.half_spaces);
- break;
-
- case PEXOCLightSourceState:
-
- CHECK_AND_FREE ((char *) oc->data.SetLightSourceState.enable);
- CHECK_AND_FREE ((char *) oc->data.SetLightSourceState.disable);
- break;
-
- case PEXOCParaSurfCharacteristics:
-
- if (oc->data.SetParaSurfCharacteristics.psc_type ==
- PEXPSCMCLevelCurves ||
- oc->data.SetParaSurfCharacteristics.psc_type ==
- PEXPSCWCLevelCurves)
- CHECK_AND_FREE ((char *) oc->data.SetParaSurfCharacteristics.characteristics.level_curves.parameters);
- break;
-
- case PEXOCAddToNameSet:
-
- CHECK_AND_FREE ((char *) oc->data.AddToNameSet.names);
- break;
-
- case PEXOCRemoveFromNameSet:
-
- CHECK_AND_FREE ((char *) oc->data.RemoveFromNameSet.names);
- break;
-
- case PEXOCApplicationData:
-
- CHECK_AND_FREE ((char *) oc->data.ApplicationData.data);
- break;
-
- case PEXOCGSE:
-
- CHECK_AND_FREE ((char *) oc->data.GSE.data);
- break;
-
- case PEXOCMarkers:
-
- CHECK_AND_FREE ((char *) oc->data.Markers.points);
- break;
-
- case PEXOCMarkers2D:
-
- CHECK_AND_FREE ((char *) oc->data.Markers2D.points);
- break;
-
- case PEXOCPolyline:
-
- CHECK_AND_FREE ((char *) oc->data.Polyline.points);
- break;
-
- case PEXOCPolyline2D:
-
- CHECK_AND_FREE ((char *) oc->data.Polyline2D.points);
- break;
-
- case PEXOCText:
-
- encText = oc->data.EncodedText.encoded_text;
- for (j = 0; j < oc->data.EncodedText.count; j++, encText++)
- CHECK_AND_FREE ((char *) encText->ch);
- CHECK_AND_FREE ((char *) oc->data.EncodedText.encoded_text);
- break;
-
- case PEXOCText2D:
-
- encText = oc->data.EncodedText2D.encoded_text;
- for (j = 0; j < oc->data.EncodedText2D.count; j++, encText++)
- CHECK_AND_FREE ((char *) encText->ch);
- CHECK_AND_FREE ((char *) oc->data.EncodedText2D.encoded_text);
- break;
-
- case PEXOCAnnotationText:
-
- encText = oc->data.EncodedAnnoText.encoded_text;
- for (j = 0; j < oc->data.EncodedAnnoText.count; j++, encText++)
- CHECK_AND_FREE ((char *) encText->ch);
- CHECK_AND_FREE ((char *) oc->data.EncodedAnnoText.encoded_text);
- break;
-
- case PEXOCAnnotationText2D:
-
- encText = oc->data.EncodedAnnoText2D.encoded_text;
- for (j = 0; j < oc->data.EncodedAnnoText2D.count; j++, encText++)
- CHECK_AND_FREE ((char *) encText->ch);
- CHECK_AND_FREE ((char *) oc->data.EncodedAnnoText2D.encoded_text);
- break;
-
- case PEXOCPolylineSetWithData:
-
- plset = oc->data.PolylineSetWithData.vertex_lists;
- for (j = 0; j < oc->data.PolylineSetWithData.count; j++, plset++)
- {
- CHECK_AND_FREE ((char *) plset->vertices.no_data);
- }
- CHECK_AND_FREE ((char *) oc->data.PolylineSetWithData.vertex_lists);
- break;
-
- case PEXOCNURBCurve:
-
- CHECK_AND_FREE ((char *) oc->data.NURBCurve.knots);
- CHECK_AND_FREE ((char *) oc->data.NURBCurve.points.point);
- break;
-
- case PEXOCFillArea:
-
- CHECK_AND_FREE ((char *) oc->data.FillArea.points);
- break;
-
- case PEXOCFillArea2D:
-
- CHECK_AND_FREE ((char *) oc->data.FillArea2D.points);
- break;
-
- case PEXOCFillAreaWithData:
-
- CHECK_AND_FREE ((char *)
- oc->data.FillAreaWithData.vertices.no_data);
- break;
-
- case PEXOCFillAreaSet:
-
- fillset = oc->data.FillAreaSet.point_lists;
- for (j = 0; j < oc->data.FillAreaSet.count; j++, fillset++)
- {
- CHECK_AND_FREE ((char *) fillset->points);
- }
- CHECK_AND_FREE ((char *) oc->data.FillAreaSet.point_lists);
- break;
-
- case PEXOCFillAreaSet2D:
-
- fillset2D = oc->data.FillAreaSet2D.point_lists;
- for (j = 0; j < oc->data.FillAreaSet2D.count; j++, fillset2D++)
- {
- CHECK_AND_FREE ((char *) fillset2D->points);
- }
- CHECK_AND_FREE ((char *) oc->data.FillAreaSet2D.point_lists);
- break;
-
- case PEXOCFillAreaSetWithData:
-
- fillsetdata = oc->data.FillAreaSetWithData.vertex_lists;
- for (j = 0; j < oc->data.FillAreaSetWithData.count;
- j++, fillsetdata++)
- {
- CHECK_AND_FREE ((char *) fillsetdata->vertices.no_data);
- }
- CHECK_AND_FREE ((char *) oc->data.FillAreaSetWithData.vertex_lists);
- break;
-
- case PEXOCTriangleStrip:
-
- CHECK_AND_FREE ((char *) oc->data.TriangleStrip.facet_data.index);
- CHECK_AND_FREE ((char *) oc-> data.TriangleStrip.vertices.no_data);
- break;
-
- case PEXOCQuadrilateralMesh:
-
- CHECK_AND_FREE ((char *)
- oc->data.QuadrilateralMesh.facet_data.index);
- CHECK_AND_FREE ((char *)
- oc->data.QuadrilateralMesh.vertices.no_data);
- break;
-
- case PEXOCSetOfFillAreaSets:
-
- CHECK_AND_FREE ((char *)
- oc->data.SetOfFillAreaSets.facet_data.index);
- CHECK_AND_FREE ((char *)
- oc->data.SetOfFillAreaSets.vertices.no_data);
- CHECK_AND_FREE ((char *) oc->data.SetOfFillAreaSets.edge_flags);
-
- pCon = oc->data.SetOfFillAreaSets.connectivity;
- for (j = 0; j < oc->data.SetOfFillAreaSets.set_count; j++, pCon++)
- {
- for (k = 0; k < (int) pCon->count; k++)
- CHECK_AND_FREE ((char *) pCon->lists[k].shorts);
- CHECK_AND_FREE ((char *) pCon->lists);
- }
- CHECK_AND_FREE ((char *) oc->data.SetOfFillAreaSets.connectivity);
- break;
-
- case PEXOCNURBSurface:
-
- CHECK_AND_FREE ((char *) oc->data.NURBSurface.uknots);
- CHECK_AND_FREE ((char *) oc->data.NURBSurface.vknots);
- CHECK_AND_FREE ((char *) oc->data.NURBSurface.points.point);
-
- pTrim = oc->data.NURBSurface.trim_curves;
- for (j = 0; j < oc->data.NURBSurface.curve_count; j++, pTrim++)
- {
- for (k = 0; k < (int) pTrim->count; k++)
- {
- CHECK_AND_FREE ((char *) pTrim->curves[k].knots.floats);
- CHECK_AND_FREE ((char *)
- pTrim->curves[k].control_points.point);
- }
- CHECK_AND_FREE ((char *) pTrim->curves);
- }
- CHECK_AND_FREE ((char *) oc->data.NURBSurface.trim_curves);
- break;
-
- case PEXOCCellArray:
-
- CHECK_AND_FREE ((char *) oc->data.CellArray.color_indices);
- break;
-
- case PEXOCCellArray2D:
-
- CHECK_AND_FREE ((char *) oc->data.CellArray2D.color_indices);
- break;
-
- case PEXOCExtendedCellArray:
-
- CHECK_AND_FREE ((char *) oc->data.ExtendedCellArray.colors.indexed);
- break;
-
- default:
- break;
- }
- }
-
- CHECK_AND_FREE ((char *) oc_data);
-}
diff --git a/xc/lib/PEX5/pl_global.h b/xc/lib/PEX5/pl_global.h
deleted file mode 100644
index 2ea470433..000000000
--- a/xc/lib/PEX5/pl_global.h
+++ /dev/null
@@ -1,422 +0,0 @@
-/* $TOG: pl_global.h /main/9 1998/02/06 16:10:22 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.
-
-*/
-
-/*
- * Header to linked list of open displays.
- */
-
-PEXDisplayInfo *PEXDisplayInfoHeader = NULL;
-
-
-/*
- * Pick path cache.
- */
-
-PEXPickPath *PEXPickCache = NULL;
-unsigned int PEXPickCacheSize = 0;
-int PEXPickCacheInUse = 0;
-
-
-/*
- * Floating point conversion function table.
- */
-
-extern void _PEXIEEE32toDECF();
-extern void _PEXDECFtoIEEE32();
-
-#ifdef CRAY
-extern void _PEXIEEE32toCRAY();
-extern void _PEXCRAYtoIEEE32();
-#else
-#define _PEXIEEE32toCRAY 0
-#define _PEXCRAYtoIEEE32 0
-#endif
-
-void (*(PEX_fp_convert[NUM_FP_FORMATS][NUM_FP_FORMATS]))() = {
-
-/* IEEE 32 -> OTHER */
-
- {0, _PEXIEEE32toDECF, 0, 0, _PEXIEEE32toCRAY},
-
-/* DEC F -> OTHER */
-
- {_PEXDECFtoIEEE32, 0, 0, 0, 0},
-
-/* IEEE 64 -> OTHER ------- NOT SUPPORTED !!! */
-
- {0, 0, 0, 0, 0},
-
-/* DEC D -> OTHER ------- NOT SUPPORTED !!! */
-
- {0, 0, 0, 0, 0},
-
-/* CRAY -> OTHER */
-
- {_PEXCRAYtoIEEE32, 0, 0, 0, 0}
-
-};
-
-
-/*
- * Encode OC function table.
- */
-
-extern void _PEXEncodeEnumType();
-extern void _PEXEncodeTableIndex();
-extern void _PEXEncodeColor();
-extern void _PEXEncodeFloat();
-extern void _PEXEncodeCARD16();
-extern void _PEXEncodeVector2D();
-extern void _PEXEncodeTextAlignment();
-extern void _PEXEncodeCurveApprox();
-extern void _PEXEncodeReflectionAttr();
-extern void _PEXEncodeSurfaceApprox();
-extern void _PEXEncodeCullMode();
-extern void _PEXEncodeSwitch();
-extern void _PEXEncodePatternSize();
-extern void _PEXEncodePatternAttr2D();
-extern void _PEXEncodePatternAttr();
-extern void _PEXEncodeASF();
-extern void _PEXEncodeLocalTransform();
-extern void _PEXEncodeLocalTransform2D();
-extern void _PEXEncodeGlobalTransform();
-extern void _PEXEncodeGlobalTransform2D();
-extern void _PEXEncodeModelClipVolume();
-extern void _PEXEncodeModelClipVolume2D();
-extern void _PEXEncodeRestoreModelClip();
-extern void _PEXEncodeLightSourceState();
-extern void _PEXEncodeID();
-extern void _PEXEncodePSC();
-extern void _PEXEncodeNameSet();
-extern void _PEXEncodeExecuteStructure();
-extern void _PEXEncodeLabel();
-extern void _PEXEncodeApplicationData();
-extern void _PEXEncodeGSE();
-extern void _PEXEncodeMarkers();
-extern void _PEXEncodePolyline();
-extern void _PEXEncodeMarkers2D();
-extern void _PEXEncodePolyline2D();
-extern void _PEXEncodeText();
-extern void _PEXEncodeText2D();
-extern void _PEXEncodeAnnoText();
-extern void _PEXEncodeAnnoText2D();
-extern void _PEXEncodePolylineSet();
-extern void _PEXEncodeNURBCurve();
-extern void _PEXEncodeFillArea();
-extern void _PEXEncodeFillArea2D();
-extern void _PEXEncodeFillAreaWithData();
-extern void _PEXEncodeFillAreaSet();
-extern void _PEXEncodeFillAreaSet2D();
-extern void _PEXEncodeFillAreaSetWithData();
-extern void _PEXEncodeTriangleStrip();
-extern void _PEXEncodeQuadMesh();
-extern void _PEXEncodeSOFA();
-extern void _PEXEncodeNURBSurface();
-extern void _PEXEncodeCellArray();
-extern void _PEXEncodeCellArray2D();
-extern void _PEXEncodeExtendedCellArray();
-extern void _PEXEncodeGDP();
-extern void _PEXEncodeGDP2D();
-extern void _PEXEncodeNoop();
-
-void (*(PEX_encode_oc_funcs[]))() = {
-NULL, /* DUMMY 0 */
-_PEXEncodeEnumType, /* PEXOCMarkerType 1 */
-_PEXEncodeFloat, /* PEXOCMarkerScale 2 */
-_PEXEncodeTableIndex, /* PEXOCMarkerColorIndex 3 */
-_PEXEncodeColor, /* PEXOCMarkerColor 4 */
-_PEXEncodeTableIndex, /* PEXOCMarkerBundleIndex 5 */
-_PEXEncodeTableIndex, /* PEXOCTextFontIndex 6 */
-_PEXEncodeCARD16, /* PEXOCTextPrecision 7 */
-_PEXEncodeFloat, /* PEXOCCharExpansion 8 */
-_PEXEncodeFloat, /* PEXOCCharSpacing 9 */
-_PEXEncodeTableIndex, /* PEXOCTextColorIndex 10 */
-_PEXEncodeColor, /* PEXOCTextColor 11 */
-_PEXEncodeFloat, /* PEXOCCharHeight 12 */
-_PEXEncodeVector2D, /* PEXOCCharUpVector 13 */
-_PEXEncodeCARD16, /* PEXOCTextPath 14 */
-_PEXEncodeTextAlignment, /* PEXOCTextAlignment 15 */
-_PEXEncodeFloat, /* PEXOCATextHeight 16 */
-_PEXEncodeVector2D, /* PEXOCATextUpVector 17 */
-_PEXEncodeCARD16, /* PEXOCATextPath 18 */
-_PEXEncodeTextAlignment, /* PEXOCATextAlignment 19 */
-_PEXEncodeEnumType, /* PEXOCATextStyle 20 */
-_PEXEncodeTableIndex, /* PEXOCTextBundleIndex 21 */
-_PEXEncodeEnumType, /* PEXOCLineType 22 */
-_PEXEncodeFloat, /* PEXOCLineWidth 23 */
-_PEXEncodeTableIndex, /* PEXOCLineColorIndex 24 */
-_PEXEncodeColor, /* PEXOCLineColor 25 */
-_PEXEncodeCurveApprox, /* PEXOCCurveApprox 26 */
-_PEXEncodeEnumType, /* PEXOCPolylineInterpMethod 27 */
-_PEXEncodeTableIndex, /* PEXOCLineBundleIndex 28 */
-_PEXEncodeEnumType, /* PEXOCInteriorStyle 29 */
-_PEXEncodeTableIndex, /* PEXOCInteriorStyleIndex 30 */
-_PEXEncodeTableIndex, /* PEXOCSurfaceColorIndex 31 */
-_PEXEncodeColor, /* PEXOCSurfaceColor 32 */
-_PEXEncodeReflectionAttr, /* PEXOCReflectionAttributes 33 */
-_PEXEncodeEnumType, /* PEXOCReflectionModel 34 */
-_PEXEncodeEnumType, /* PEXOCSurfaceInterpMethod 35 */
-_PEXEncodeEnumType, /* PEXOCBFInteriorStyle 36 */
-_PEXEncodeTableIndex, /* PEXOCBFInteriorStyleIndex 37 */
-_PEXEncodeTableIndex, /* PEXOCBFSurfaceColorIndex 38 */
-_PEXEncodeColor, /* PEXOCBFSurfaceColor 39 */
-_PEXEncodeReflectionAttr, /* PEXOCBFReflectionAttributes 40 */
-_PEXEncodeEnumType, /* PEXOCBFReflectionModel 41 */
-_PEXEncodeEnumType, /* PEXOCBFSurfaceInterpMethod 42 */
-_PEXEncodeSurfaceApprox, /* PEXOCSurfaceApprox 43 */
-_PEXEncodeCullMode, /* PEXOCFacetCullingMode 44 */
-_PEXEncodeSwitch, /* PEXOCFacetDistinguishFlag 45 */
-_PEXEncodePatternSize, /* PEXOCPatternSize 46 */
-_PEXEncodePatternAttr2D, /* PEXOCPatternAttributes2D 47 */
-_PEXEncodePatternAttr, /* PEXOCPatternAttributes 48 */
-_PEXEncodeTableIndex, /* PEXOCInteriorBundleIndex 49 */
-_PEXEncodeSwitch, /* PEXOCSurfaceEdgeFlag 50 */
-_PEXEncodeEnumType, /* PEXOCSurfaceEdgeType 51 */
-_PEXEncodeFloat, /* PEXOCSurfaceEdgeWidth 52 */
-_PEXEncodeTableIndex, /* PEXOCSurfaceEdgeColorIndex 53 */
-_PEXEncodeColor, /* PEXOCSurfaceEdgeColor 54 */
-_PEXEncodeTableIndex, /* PEXOCEdgeBundleIndex 55 */
-_PEXEncodeASF, /* PEXOCIndividualASF 56 */
-_PEXEncodeLocalTransform, /* PEXOCLocalTransform 57 */
-_PEXEncodeLocalTransform2D, /* PEXOCLocalTransform2D 58 */
-_PEXEncodeGlobalTransform, /* PEXOCGlobalTransform 59 */
-_PEXEncodeGlobalTransform2D, /* PEXOCGlobalTransform2D 60 */
-_PEXEncodeSwitch, /* PEXOCModelClipFlag 61 */
-_PEXEncodeModelClipVolume, /* PEXOCModelClipVolume 62 */
-_PEXEncodeModelClipVolume2D, /* PEXOCModelClipVolume2D 63 */
-_PEXEncodeRestoreModelClip, /* PEXOCRestoreModelClipVolume 64 */
-_PEXEncodeTableIndex, /* PEXOCViewIndex 65 */
-_PEXEncodeLightSourceState, /* PEXOCLightSourceState 66 */
-_PEXEncodeTableIndex, /* PEXOCDepthCueIndex 67 */
-_PEXEncodeID, /* PEXOCPickID 68 */
-_PEXEncodeID, /* PEXOCHLHSRID 69 */
-_PEXEncodeTableIndex, /* PEXOCColorApproxIndex 70 */
-_PEXEncodeEnumType, /* PEXOCRenderingColorModel 71 */
-_PEXEncodePSC, /* PEXOCParaSurfCharacteristics 72 */
-_PEXEncodeNameSet, /* PEXOCAddToNameSet 73 */
-_PEXEncodeNameSet, /* PEXOCRemoveFromNameSet 74 */
-_PEXEncodeExecuteStructure, /* PEXOCExecuteStructure 75 */
-_PEXEncodeLabel, /* PEXOCLabel 76 */
-_PEXEncodeApplicationData, /* PEXOCApplicationData 77 */
-_PEXEncodeGSE, /* PEXOCGSE 78 */
-_PEXEncodeMarkers, /* PEXOCMarkers 79 */
-_PEXEncodeMarkers2D, /* PEXOCMarkers2D 80 */
-_PEXEncodeText, /* PEXOCText 81 */
-_PEXEncodeText2D, /* PEXOCText2D 82 */
-_PEXEncodeAnnoText, /* PEXOCAnnotationText 83 */
-_PEXEncodeAnnoText2D, /* PEXOCAnnotationText2D 84 */
-_PEXEncodePolyline, /* PEXOCPolyline 85 */
-_PEXEncodePolyline2D, /* PEXOCPolyline2D 86 */
-_PEXEncodePolylineSet, /* PEXOCPolylineSetWithData 87 */
-_PEXEncodeNURBCurve, /* PEXOCNURBCurve 88 */
-_PEXEncodeFillArea, /* PEXOCFillArea 89 */
-_PEXEncodeFillArea2D, /* PEXOCFillArea2D 90 */
-_PEXEncodeFillAreaWithData, /* PEXOCFillAreaWithData 91 */
-_PEXEncodeFillAreaSet, /* PEXOCFillAreaSet 92 */
-_PEXEncodeFillAreaSet2D, /* PEXOCFillAreaSet2D 93 */
-_PEXEncodeFillAreaSetWithData, /* PEXOCFillAreaSetWithData 94 */
-_PEXEncodeTriangleStrip, /* PEXOCTriangleStrip 95 */
-_PEXEncodeQuadMesh, /* PEXOCQuadrilateralMesh 96 */
-_PEXEncodeSOFA, /* PEXOCSetOfFillAreaSets 97 */
-_PEXEncodeNURBSurface, /* PEXOCNURBSurface 98 */
-_PEXEncodeCellArray, /* PEXOCCellArray 99 */
-_PEXEncodeCellArray2D, /* PEXOCCellArray2D 100 */
-_PEXEncodeExtendedCellArray, /* PEXOCExtendedCellArray 101 */
-_PEXEncodeGDP, /* PEXOCGDP 102 */
-_PEXEncodeGDP2D, /* PEXOCGDP2D 103 */
-_PEXEncodeNoop /* PEXOCNoop 104 */
-};
-
-
-/*
- * Decode OC function table.
- */
-
-extern void _PEXDecodeEnumType();
-extern void _PEXDecodeTableIndex();
-extern void _PEXDecodeColor();
-extern void _PEXDecodeFloat();
-extern void _PEXDecodeCARD16();
-extern void _PEXDecodeVector2D();
-extern void _PEXDecodeTextAlignment();
-extern void _PEXDecodeCurveApprox();
-extern void _PEXDecodeReflectionAttr();
-extern void _PEXDecodeSurfaceApprox();
-extern void _PEXDecodeCullMode();
-extern void _PEXDecodeSwitch();
-extern void _PEXDecodePatternSize();
-extern void _PEXDecodePatternAttr2D();
-extern void _PEXDecodePatternAttr();
-extern void _PEXDecodeASF();
-extern void _PEXDecodeLocalTransform();
-extern void _PEXDecodeLocalTransform2D();
-extern void _PEXDecodeGlobalTransform();
-extern void _PEXDecodeGlobalTransform2D();
-extern void _PEXDecodeModelClipVolume();
-extern void _PEXDecodeModelClipVolume2D();
-extern void _PEXDecodeRestoreModelClip();
-extern void _PEXDecodeLightSourceState();
-extern void _PEXDecodeID();
-extern void _PEXDecodePSC();
-extern void _PEXDecodeNameSet();
-extern void _PEXDecodeExecuteStructure();
-extern void _PEXDecodeLabel();
-extern void _PEXDecodeApplicationData();
-extern void _PEXDecodeGSE();
-extern void _PEXDecodeMarkers();
-extern void _PEXDecodePolyline();
-extern void _PEXDecodeMarkers2D();
-extern void _PEXDecodePolyline2D();
-extern void _PEXDecodeText();
-extern void _PEXDecodeText2D();
-extern void _PEXDecodeAnnoText();
-extern void _PEXDecodeAnnoText2D();
-extern void _PEXDecodePolylineSet();
-extern void _PEXDecodeNURBCurve();
-extern void _PEXDecodeFillArea();
-extern void _PEXDecodeFillArea2D();
-extern void _PEXDecodeFillAreaWithData();
-extern void _PEXDecodeFillAreaSet();
-extern void _PEXDecodeFillAreaSet2D();
-extern void _PEXDecodeFillAreaSetWithData();
-extern void _PEXDecodeTriangleStrip();
-extern void _PEXDecodeQuadMesh();
-extern void _PEXDecodeSOFA();
-extern void _PEXDecodeNURBSurface();
-extern void _PEXDecodeCellArray();
-extern void _PEXDecodeCellArray2D();
-extern void _PEXDecodeExtendedCellArray();
-extern void _PEXDecodeGDP();
-extern void _PEXDecodeGDP2D();
-extern void _PEXDecodeNoop();
-
-void (*(PEX_decode_oc_funcs[]))() = {
-NULL, /* DUMMY 0 */
-_PEXDecodeEnumType, /* PEXOCMarkerType 1 */
-_PEXDecodeFloat, /* PEXOCMarkerScale 2 */
-_PEXDecodeTableIndex, /* PEXOCMarkerColorIndex 3 */
-_PEXDecodeColor, /* PEXOCMarkerColor 4 */
-_PEXDecodeTableIndex, /* PEXOCMarkerBundleIndex 5 */
-_PEXDecodeTableIndex, /* PEXOCTextFontIndex 6 */
-_PEXDecodeCARD16, /* PEXOCTextPrecision 7 */
-_PEXDecodeFloat, /* PEXOCCharExpansion 8 */
-_PEXDecodeFloat, /* PEXOCCharSpacing 9 */
-_PEXDecodeTableIndex, /* PEXOCTextColorIndex 10 */
-_PEXDecodeColor, /* PEXOCTextColor 11 */
-_PEXDecodeFloat, /* PEXOCCharHeight 12 */
-_PEXDecodeVector2D, /* PEXOCCharUpVector 13 */
-_PEXDecodeCARD16, /* PEXOCTextPath 14 */
-_PEXDecodeTextAlignment, /* PEXOCTextAlignment 15 */
-_PEXDecodeFloat, /* PEXOCATextHeight 16 */
-_PEXDecodeVector2D, /* PEXOCATextUpVector 17 */
-_PEXDecodeCARD16, /* PEXOCATextPath 18 */
-_PEXDecodeTextAlignment, /* PEXOCATextAlignment 19 */
-_PEXDecodeEnumType, /* PEXOCATextStyle 20 */
-_PEXDecodeTableIndex, /* PEXOCTextBundleIndex 21 */
-_PEXDecodeEnumType, /* PEXOCLineType 22 */
-_PEXDecodeFloat, /* PEXOCLineWidth 23 */
-_PEXDecodeTableIndex, /* PEXOCLineColorIndex 24 */
-_PEXDecodeColor, /* PEXOCLineColor 25 */
-_PEXDecodeCurveApprox, /* PEXOCCurveApprox 26 */
-_PEXDecodeEnumType, /* PEXOCPolylineInterpMethod 27 */
-_PEXDecodeTableIndex, /* PEXOCLineBundleIndex 28 */
-_PEXDecodeEnumType, /* PEXOCInteriorStyle 29 */
-_PEXDecodeTableIndex, /* PEXOCInteriorStyleIndex 30 */
-_PEXDecodeTableIndex, /* PEXOCSurfaceColorIndex 31 */
-_PEXDecodeColor, /* PEXOCSurfaceColor 32 */
-_PEXDecodeReflectionAttr, /* PEXOCReflectionAttributes 33 */
-_PEXDecodeEnumType, /* PEXOCReflectionModel 34 */
-_PEXDecodeEnumType, /* PEXOCSurfaceInterpMethod 35 */
-_PEXDecodeEnumType, /* PEXOCBFInteriorStyle 36 */
-_PEXDecodeTableIndex, /* PEXOCBFInteriorStyleIndex 37 */
-_PEXDecodeTableIndex, /* PEXOCBFSurfaceColorIndex 38 */
-_PEXDecodeColor, /* PEXOCBFSurfaceColor 39 */
-_PEXDecodeReflectionAttr, /* PEXOCBFReflectionAttributes 40 */
-_PEXDecodeEnumType, /* PEXOCBFReflectionModel 41 */
-_PEXDecodeEnumType, /* PEXOCBFSurfaceInterpMethod 42 */
-_PEXDecodeSurfaceApprox, /* PEXOCSurfaceApprox 43 */
-_PEXDecodeCullMode, /* PEXOCFacetCullingMode 44 */
-_PEXDecodeSwitch, /* PEXOCFacetDistinguishFlag 45 */
-_PEXDecodePatternSize, /* PEXOCPatternSize 46 */
-_PEXDecodePatternAttr2D, /* PEXOCPatternAttributes2D 47 */
-_PEXDecodePatternAttr, /* PEXOCPatternAttributes 48 */
-_PEXDecodeTableIndex, /* PEXOCInteriorBundleIndex 49 */
-_PEXDecodeSwitch, /* PEXOCSurfaceEdgeFlag 50 */
-_PEXDecodeEnumType, /* PEXOCSurfaceEdgeType 51 */
-_PEXDecodeFloat, /* PEXOCSurfaceEdgeWidth 52 */
-_PEXDecodeTableIndex, /* PEXOCSurfaceEdgeColorIndex 53 */
-_PEXDecodeColor, /* PEXOCSurfaceEdgeColor 54 */
-_PEXDecodeTableIndex, /* PEXOCEdgeBundleIndex 55 */
-_PEXDecodeASF, /* PEXOCIndividualASF 56 */
-_PEXDecodeLocalTransform, /* PEXOCLocalTransform 57 */
-_PEXDecodeLocalTransform2D, /* PEXOCLocalTransform2D 58 */
-_PEXDecodeGlobalTransform, /* PEXOCGlobalTransform 59 */
-_PEXDecodeGlobalTransform2D, /* PEXOCGlobalTransform2D 60 */
-_PEXDecodeSwitch, /* PEXOCModelClipFlag 61 */
-_PEXDecodeModelClipVolume, /* PEXOCModelClipVolume 62 */
-_PEXDecodeModelClipVolume2D, /* PEXOCModelClipVolume2D 63 */
-_PEXDecodeRestoreModelClip, /* PEXOCRestoreModelClipVolume 64 */
-_PEXDecodeTableIndex, /* PEXOCViewIndex 65 */
-_PEXDecodeLightSourceState, /* PEXOCLightSourceState 66 */
-_PEXDecodeTableIndex, /* PEXOCDepthCueIndex 67 */
-_PEXDecodeID, /* PEXOCPickID 68 */
-_PEXDecodeID, /* PEXOCHLHSRID 69 */
-_PEXDecodeTableIndex, /* PEXOCColorApproxIndex 70 */
-_PEXDecodeEnumType, /* PEXOCRenderingColorModel 71 */
-_PEXDecodePSC, /* PEXOCParaSurfCharacteristics 72 */
-_PEXDecodeNameSet, /* PEXOCAddToNameSet 73 */
-_PEXDecodeNameSet, /* PEXOCRemoveFromNameSet 74 */
-_PEXDecodeExecuteStructure, /* PEXOCExecuteStructure 75 */
-_PEXDecodeLabel, /* PEXOCLabel 76 */
-_PEXDecodeApplicationData, /* PEXOCApplicationData 77 */
-_PEXDecodeGSE, /* PEXOCGSE 78 */
-_PEXDecodeMarkers, /* PEXOCMarkers 79 */
-_PEXDecodeMarkers2D, /* PEXOCMarkers2D 80 */
-_PEXDecodeText, /* PEXOCText 81 */
-_PEXDecodeText2D, /* PEXOCText2D 82 */
-_PEXDecodeAnnoText, /* PEXOCAnnotationText 83 */
-_PEXDecodeAnnoText2D, /* PEXOCAnnotationText2D 84 */
-_PEXDecodePolyline, /* PEXOCPolyline 85 */
-_PEXDecodePolyline2D, /* PEXOCPolyline2D 86 */
-_PEXDecodePolylineSet, /* PEXOCPolylineSetWithData 87 */
-_PEXDecodeNURBCurve, /* PEXOCNURBCurve 88 */
-_PEXDecodeFillArea, /* PEXOCFillArea 89 */
-_PEXDecodeFillArea2D, /* PEXOCFillArea2D 90 */
-_PEXDecodeFillAreaWithData, /* PEXOCFillAreaWithData 91 */
-_PEXDecodeFillAreaSet, /* PEXOCFillAreaSet 92 */
-_PEXDecodeFillAreaSet2D, /* PEXOCFillAreaSet2D 93 */
-_PEXDecodeFillAreaSetWithData, /* PEXOCFillAreaSetWithData 94 */
-_PEXDecodeTriangleStrip, /* PEXOCTriangleStrip 95 */
-_PEXDecodeQuadMesh, /* PEXOCQuadrilateralMesh 96 */
-_PEXDecodeSOFA, /* PEXOCSetOfFillAreaSets 97 */
-_PEXDecodeNURBSurface, /* PEXOCNURBSurface 98 */
-_PEXDecodeCellArray, /* PEXOCCellArray 99 */
-_PEXDecodeCellArray2D, /* PEXOCCellArray2D 100 */
-_PEXDecodeExtendedCellArray, /* PEXOCExtendedCellArray 101 */
-_PEXDecodeGDP, /* PEXOCGDP 102 */
-_PEXDecodeGDP2D, /* PEXOCGDP2D 103 */
-_PEXDecodeNoop /* PEXOCNoop 104 */
-};
-
diff --git a/xc/lib/PEX5/pl_lut.c b/xc/lib/PEX5/pl_lut.c
deleted file mode 100644
index fe278c7ed..000000000
--- a/xc/lib/PEX5/pl_lut.c
+++ /dev/null
@@ -1,1588 +0,0 @@
-/* $TOG: pl_lut.c /main/13 1998/02/06 16:10:27 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_lut.h"
-
-
-PEXLookupTable
-PEXCreateLookupTable (display, drawable, type)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT int type;
-
-{
- register pexCreateLookupTableReq *req;
- char *pBuf;
- PEXLookupTable id;
-
-
- /*
- * Get a lookup table resource id from X.
- */
-
- id = XAllocID (display);
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreateLookupTable, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateLookupTable, pBuf, req);
-
- PEXStoreReqHead (CreateLookupTable, req);
- req->drawableExample = drawable;
- req->lut = id;
- req->tableType = type;
-
- END_REQUEST_HEADER (CreateLookupTable, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (id);
-}
-
-
-void
-PEXFreeLookupTable (display, lut)
-
-INPUT Display *display;
-INPUT PEXLookupTable lut;
-
-{
- register pexFreeLookupTableReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreeLookupTable, pBuf);
-
- BEGIN_REQUEST_HEADER (FreeLookupTable, pBuf, req);
-
- PEXStoreReqHead (FreeLookupTable, req);
- req->id = lut;
-
- END_REQUEST_HEADER (FreeLookupTable, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCopyLookupTable (display, srcLut, destLut)
-
-INPUT Display *display;
-INPUT PEXLookupTable srcLut;
-INPUT PEXLookupTable destLut;
-
-{
- register pexCopyLookupTableReq *req;
- char *pBuf;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CopyLookupTable, pBuf);
-
- BEGIN_REQUEST_HEADER (CopyLookupTable, pBuf, req);
-
- PEXStoreReqHead (CopyLookupTable, req);
- req->src = srcLut;
- req->dst = destLut;
-
- END_REQUEST_HEADER (CopyLookupTable, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-Status
-PEXGetTableInfo (display, drawable, type, info)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT int type;
-INPUT PEXTableInfo *info;
-
-{
- register pexGetTableInfoReq *req;
- char *pBuf;
- pexGetTableInfoReply rep;
-
-
- /*
- * Lock around critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetTableInfo, pBuf);
-
- BEGIN_REQUEST_HEADER (GetTableInfo, pBuf, req);
-
- PEXStoreReqHead (GetTableInfo, req);
- req->drawableExample = drawable;
- req->tableType = type;
-
- END_REQUEST_HEADER (GetTableInfo, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xTrue) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (0); /* return an error */
- }
-
- info->definable_entries = rep.definableEntries;
- info->predefined_count = rep.numPredefined;
- info->predefined_min = rep.predefinedMin;
- info->predefined_max = rep.predefinedMax;
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXGetPredefinedEntries (display, drawable, type, start, count, entriesReturn)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT int type;
-INPUT unsigned int start;
-INPUT unsigned int count;
-OUTPUT PEXPointer *entriesReturn;
-
-{
- register pexGetPredefinedEntriesReq *req;
- char *pBuf;
- pexGetPredefinedEntriesReply rep;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetPredefinedEntries, pBuf);
-
- BEGIN_REQUEST_HEADER (GetPredefinedEntries, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetPredefinedEntries, fpFormat, req);
- req->drawableExample = drawable;
- req->tableType = type;
- req->start = start;
- req->count = count;
-
- END_REQUEST_HEADER (GetPredefinedEntries, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *entriesReturn = NULL;
- return (0); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
-
-
- /*
- * Repack the entries into a buffer allocated for the application.
- */
-
- *entriesReturn = _PEXRepackLUTEntries (pBuf, (int) rep.numEntries,
- type, fpConvert, fpFormat);
-
- FINISH_WITH_SCRATCH (display, pBuf, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXGetDefinedIndices (display, lut, numIndicesReturn, indicesReturn)
-
-INPUT Display *display;
-INPUT PEXLookupTable lut;
-OUTPUT unsigned long *numIndicesReturn;
-OUTPUT PEXTableIndex **indicesReturn;
-
-{
- register pexGetDefinedIndicesReq *req;
- char *pBuf;
- pexGetDefinedIndicesReply rep;
- unsigned count;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetDefinedIndices, pBuf);
-
- BEGIN_REQUEST_HEADER (GetDefinedIndices, pBuf, req);
-
- PEXStoreReqHead (GetDefinedIndices, req);
- req->id = lut;
-
- END_REQUEST_HEADER (GetDefinedIndices, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numIndicesReturn = 0;
- *indicesReturn = NULL;
- return (0); /* return an error */
- }
-
- *numIndicesReturn = rep.numIndices;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the user.
- */
-
- count = (rep.numIndices & 1) ? (rep.numIndices + 1) : rep.numIndices;
- *indicesReturn = (PEXTableIndex *) Xmalloc (
- count * sizeof (PEXTableIndex));
-
- XREAD_LISTOF_CARD16 (display, count, *indicesReturn);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-PEXPointer
-PEXGetTableEntry (display, lut, index, valueType,
- statusReturn, table_type_return)
-
-INPUT Display *display;
-INPUT PEXLookupTable lut;
-INPUT unsigned int index;
-INPUT int valueType;
-OUTPUT int *statusReturn;
-OUTPUT int *table_type_return;
-
-{
- register pexGetTableEntryReq *req;
- char *pBuf;
- pexGetTableEntryReply rep;
- int fpConvert;
- int fpFormat;
- PEXPointer entryReturn;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetTableEntry, pBuf);
-
- BEGIN_REQUEST_HEADER (GetTableEntry, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetTableEntry, fpFormat, req);
- req->valueType = valueType;
- req->lut = lut;
- req->index = index;
-
- END_REQUEST_HEADER (GetTableEntry, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
- *statusReturn = rep.status;
- *table_type_return = rep.tableType;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
-
-
- /*
- * Repack the entries into a buffer allocated for the application.
- */
-
- entryReturn = _PEXRepackLUTEntries (pBuf, 1,
- (int) rep.tableType, fpConvert, fpFormat);
-
- FINISH_WITH_SCRATCH (display, pBuf, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (entryReturn);
-}
-
-
-Status
-PEXGetTableEntries (display, lut, start, count, valueType,
- table_type_return, entriesReturn)
-
-INPUT Display *display;
-INPUT PEXLookupTable lut;
-INPUT unsigned int start;
-INPUT unsigned int count;
-INPUT int valueType;
-OUTPUT int *table_type_return;
-OUTPUT PEXPointer *entriesReturn;
-
-{
- register pexGetTableEntriesReq *req;
- char *pBuf;
- pexGetTableEntriesReply rep;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetTableEntries, pBuf);
-
- BEGIN_REQUEST_HEADER (GetTableEntries, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetTableEntries, fpFormat, req);
- req->valueType = valueType;
- req->lut = lut;
- req->start = start;
- req->count = count;
-
- END_REQUEST_HEADER (GetTableEntries, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *entriesReturn = NULL;
- return (0); /* return an error */
- }
-
- *table_type_return = rep.tableType;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
-
-
- /*
- * Repack the entries into a buffer allocated for the application.
- */
-
- *entriesReturn = _PEXRepackLUTEntries (pBuf, (int) rep.numEntries,
- (int) rep.tableType, fpConvert, fpFormat);
-
- FINISH_WITH_SCRATCH (display, pBuf, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-void
-PEXSetTableEntries (display, lut, start, count, type, entries)
-
-INPUT Display *display;
-INPUT PEXLookupTable lut;
-INPUT unsigned int start;
-INPUT unsigned int count;
-INPUT int type;
-INPUT PEXPointer entries;
-
-{
- register pexSetTableEntriesReq *req;
- char *pBuf;
- char *scratch;
- char *firstEntry;
- int fpConvert;
- int fpFormat;
- int size, i;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetTableEntries, pBuf);
-
- BEGIN_REQUEST_HEADER (SetTableEntries, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (SetTableEntries, fpFormat, req);
- req->lut = lut;
- req->start = start;
- req->count = count;
-
- switch (type)
- {
- case PEXLUTLineBundle:
- {
- PEXLineBundleEntry *src = (PEXLineBundleEntry *) entries;
- pexLineBundleEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXLineBundleEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexLineBundleEntry, scratch, dst);
-
- dst->lineType = src->type;
- dst->polylineInterp = src->interp_method;
- dst->curveApprox_method = src->curve_approx.method;
- dst->lineColorType = src->color.type;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->curve_approx.tolerance,
- dst->curveApprox_tolerance, fpFormat);
- FP_CONVERT_HTON (src->width, dst->lineWidth, fpFormat);
- }
- else
- {
- dst->curveApprox_tolerance = src->curve_approx.tolerance;
- dst->lineWidth = src->width;
- }
-
- END_LUTENTRY_HEADER (pexLineBundleEntry, scratch, dst);
-
- STORE_COLOR_VAL (src->color.type, src->color.value, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTMarkerBundle:
- {
- PEXMarkerBundleEntry *src = (PEXMarkerBundleEntry *) entries;
- pexMarkerBundleEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXMarkerBundleEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexMarkerBundleEntry, scratch, dst);
-
- dst->markerType = src->type;
- dst->markerColorType = src->color.type;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->scale, dst->markerScale, fpFormat);
- }
- else
- dst->markerScale = src->scale;
-
- END_LUTENTRY_HEADER (pexMarkerBundleEntry, scratch, dst);
-
- STORE_COLOR_VAL (src->color.type, src->color.value, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTTextBundle:
- {
- PEXTextBundleEntry *src = (PEXTextBundleEntry *) entries;
- pexTextBundleEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXTextBundleEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexTextBundleEntry, scratch, dst);
-
- dst->textFontIndex = src->font_index;
- dst->textPrecision = src->precision;
- dst->textColorType = src->color.type;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->char_expansion,
- dst->charExpansion, fpFormat);
- FP_CONVERT_HTON (src->char_spacing,
- dst->charSpacing, fpFormat);
- }
- else
- {
- dst->charExpansion = src->char_expansion;
- dst->charSpacing = src->char_spacing;
- }
-
- END_LUTENTRY_HEADER (pexTextBundleEntry, scratch, dst);
-
- STORE_COLOR_VAL (src->color.type, src->color.value, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTInteriorBundle:
- {
- PEXInteriorBundleEntry *src = (PEXInteriorBundleEntry *) entries;
- pexInteriorBundleEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXInteriorBundleEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexInteriorBundleEntry, scratch, dst);
-
- dst->interiorStyle = src->style;
- dst->interiorStyleIndex = src->style_index;
- dst->reflectionModel = src->reflection_model;
- dst->surfaceInterp = src->interp_method;
- dst->bfInteriorStyle = src->bf_style;
- dst->bfInteriorStyleIndex = src->bf_style_index;
- dst->bfReflectionModel = src->bf_reflection_model;
- dst->bfSurfaceInterp = src->bf_interp_method;
- dst->surfaceApprox_method = src->surface_approx.method;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->surface_approx.u_tolerance,
- dst->surfaceApproxuTolerance, fpFormat);
- FP_CONVERT_HTON (src->surface_approx.v_tolerance,
- dst->surfaceApproxvTolerance, fpFormat);
- }
- else
- {
- dst->surfaceApproxuTolerance = src->surface_approx.u_tolerance;
- dst->surfaceApproxvTolerance = src->surface_approx.v_tolerance;
- }
-
- END_LUTENTRY_HEADER (pexInteriorBundleEntry, scratch, dst);
-
- /* copy surfaceColor */
-
- STORE_COLOR_SPEC (src->color, scratch, fpConvert, fpFormat);
-
- /* copy reflectionAttr */
-
- STORE_REFLECTION_ATTR (src->reflection_attr, scratch,
- fpConvert, fpFormat);
-
- /* copy bfSurfaceColor */
-
- STORE_COLOR_SPEC (src->bf_color, scratch, fpConvert, fpFormat);
-
- /* copy bfReflectionAttr */
-
- STORE_REFLECTION_ATTR (src->bf_reflection_attr, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTEdgeBundle:
- {
- PEXEdgeBundleEntry *src = (PEXEdgeBundleEntry *) entries;
- pexEdgeBundleEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXEdgeBundleEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexEdgeBundleEntry, scratch, dst);
-
- dst->edges = src->edge_flag;
- dst->edgeType = src->type;
- dst->edgeColorType = src->color.type;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->width, dst->edgeWidth, fpFormat);
- }
- else
- dst->edgeWidth = src->width;
-
- END_LUTENTRY_HEADER (pexEdgeBundleEntry, scratch, dst);
-
- STORE_COLOR_VAL (src->color.type, src->color.value, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTPattern:
- {
- PEXPatternEntry *src = (PEXPatternEntry *) entries;
- pexPatternEntry *dst;
-
- size = count * sizeof (PEXPatternEntry);
- for (i = 0; i < count; i++)
- size += (src[i].col_count * src[i].row_count * sizeof (PEXColor));
-
- scratch = firstEntry = (char *) _XAllocScratch (display, size);
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexPatternEntry, scratch, dst);
-
- dst->colorType = src->color_type;
- dst->numx = src->col_count;
- dst->numy = src->row_count;
-
- END_LUTENTRY_HEADER (pexPatternEntry, scratch, dst);
-
- STORE_LISTOF_COLOR_VAL (src->col_count * src->row_count,
- src->color_type, src->colors, scratch, fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTTextFont:
- {
- PEXTextFontEntry *src = (PEXTextFontEntry *) entries;
- pexTextFontEntry *dst;
-
- size = count * sizeof (PEXTextFontEntry);
- for (i = 0; i < count; i++)
- size += src[i].count * sizeof (PEXFont);
-
- scratch = firstEntry = (char *) _XAllocScratch (display, size);
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexTextFontEntry, scratch, dst);
-
- dst->numFonts = src->count;
-
- END_LUTENTRY_HEADER (pexTextFontEntry, scratch, dst);
-
- STORE_LISTOF_CARD32 (src->count, src->fonts, scratch);
- }
- break;
- }
-
- case PEXLUTColor:
- {
- PEXColorEntry *src = (PEXColorEntry *) entries;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXColorEntry));
-
- STORE_LISTOF_COLOR_SPEC (count, src, scratch, fpConvert, fpFormat);
- break;
- }
-
- case PEXLUTView:
- {
- PEXViewEntry *src = (PEXViewEntry *) entries;
- pexViewEntry *dst;
- char *tPtr;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXViewEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexViewEntry, scratch, dst);
-
- dst->clipFlags = src->clip_flags;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->clip_limits.min.x,
- dst->clipLimits_xmin, fpFormat);
- FP_CONVERT_HTON (src->clip_limits.min.y,
- dst->clipLimits_ymin, fpFormat);
- FP_CONVERT_HTON (src->clip_limits.min.z,
- dst->clipLimits_zmin, fpFormat);
- FP_CONVERT_HTON (src->clip_limits.max.x,
- dst->clipLimits_xmax, fpFormat);
- FP_CONVERT_HTON (src->clip_limits.max.y,
- dst->clipLimits_ymax, fpFormat);
- FP_CONVERT_HTON (src->clip_limits.max.z,
- dst->clipLimits_zmax, fpFormat);
- }
- else
- {
- dst->clipLimits_xmin = src->clip_limits.min.x;
- dst->clipLimits_ymin = src->clip_limits.min.y;
- dst->clipLimits_zmin = src->clip_limits.min.z;
- dst->clipLimits_xmax = src->clip_limits.max.x;
- dst->clipLimits_ymax = src->clip_limits.max.y;
- dst->clipLimits_zmax = src->clip_limits.max.z;
- }
-
- tPtr = (char *) dst->orientation;
- STORE_LISTOF_FLOAT32 (16, src->orientation, tPtr,
- fpConvert, fpFormat);
-
- tPtr = (char *) dst->mapping;
- STORE_LISTOF_FLOAT32 (16, src->mapping, tPtr,
- fpConvert, fpFormat);
-
- END_LUTENTRY_HEADER (pexViewEntry, scratch, dst);
- }
- break;
- }
-
- case PEXLUTLight:
- {
- PEXLightEntry *src = (PEXLightEntry *) entries;
- pexLightEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXLightEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexLightEntry, scratch, dst);
-
- dst->lightType = src->type;
- dst->lightColorType = src->color.type;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->direction.x, dst->direction_x, fpFormat);
- FP_CONVERT_HTON (src->direction.y, dst->direction_y, fpFormat);
- FP_CONVERT_HTON (src->direction.z, dst->direction_z, fpFormat);
-
- FP_CONVERT_HTON (src->point.x, dst->point_x, fpFormat);
- FP_CONVERT_HTON (src->point.y, dst->point_y, fpFormat);
- FP_CONVERT_HTON (src->point.z, dst->point_z, fpFormat);
-
- FP_CONVERT_HTON (src->concentration,
- dst->concentration, fpFormat);
- FP_CONVERT_HTON (src->spread_angle,
- dst->spreadAngle, fpFormat);
- FP_CONVERT_HTON (src->attenuation1,
- dst->attenuation1, fpFormat);
- FP_CONVERT_HTON (src->attenuation2,
- dst->attenuation2, fpFormat);
- }
- else
- {
- dst->direction_x = src->direction.x;
- dst->direction_y = src->direction.y;
- dst->direction_z = src->direction.z;
-
- dst->point_x = src->point.x;
- dst->point_y = src->point.y;
- dst->point_z = src->point.z;
-
- dst->concentration = src->concentration;
- dst->spreadAngle = src->spread_angle;
- dst->attenuation1 = src->attenuation1;
- dst->attenuation2 = src->attenuation2;
- }
-
- END_LUTENTRY_HEADER (pexLightEntry, scratch, dst);
-
- STORE_COLOR_VAL (src->color.type, src->color.value, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTDepthCue:
- {
- PEXDepthCueEntry *src = (PEXDepthCueEntry *) entries;
- pexDepthCueEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXDepthCueEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexDepthCueEntry, scratch, dst);
-
- dst->mode = src->mode;
- dst->depthCueColorType = src->color.type;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->front_plane, dst->frontPlane, fpFormat);
- FP_CONVERT_HTON (src->back_plane, dst->backPlane, fpFormat);
-
- FP_CONVERT_HTON (src->front_scaling,
- dst->frontScaling, fpFormat);
- FP_CONVERT_HTON (src->back_scaling,
- dst->backScaling, fpFormat);
- }
- else
- {
- dst->frontPlane = src->front_plane;
- dst->backPlane = src->back_plane;
-
- dst->frontScaling = src->front_scaling;
- dst->backScaling = src->back_scaling;
- }
-
- END_LUTENTRY_HEADER (pexDepthCueEntry, scratch, dst);
-
- STORE_COLOR_VAL (src->color.type, src->color.value, scratch,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTColorApprox:
- {
- PEXColorApproxEntry *src = (PEXColorApproxEntry *) entries;
- pexColorApproxEntry *dst;
-
- scratch = firstEntry = (char *) _XAllocScratch (display,
- count * sizeof (PEXColorApproxEntry));
-
- for (i = 0; i < count; i++, src++)
- {
- BEGIN_LUTENTRY_HEADER (pexColorApproxEntry, scratch, dst);
-
- dst->approxType = src->type;
- dst->approxModel = src->model;
- dst->max1 = src->max1;
- dst->max2 = src->max2;
- dst->max3 = src->max3;
- dst->dither = src->dither;
- dst->mult1 = src->mult1;
- dst->mult2 = src->mult2;
- dst->mult3 = src->mult3;
- dst->basePixel = src->base_pixel;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (src->weight1, dst->weight1, fpFormat);
- FP_CONVERT_HTON (src->weight2, dst->weight2, fpFormat);
- FP_CONVERT_HTON (src->weight3, dst->weight3, fpFormat);
- }
- else
- {
- dst->weight1 = src->weight1;
- dst->weight2 = src->weight2;
- dst->weight3 = src->weight3;
- }
-
- END_LUTENTRY_HEADER (pexColorApproxEntry, scratch, dst);
- }
- break;
- }
- }
-
-
- /*
- * Update the request length.
- */
-
- size = scratch - firstEntry;
- req->length += NUMWORDS (size);
-
- END_REQUEST_HEADER (SetTableEntries, pBuf, req);
-
-
- /*
- * Add the table entry data to the end of the X request.
- */
-
- Data (display, firstEntry, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXDeleteTableEntries (display, lut, start, count)
-
-INPUT Display *display;
-INPUT PEXLookupTable lut;
-INPUT unsigned int start;
-INPUT unsigned int count;
-
-{
- register pexDeleteTableEntriesReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (DeleteTableEntries, pBuf);
-
- BEGIN_REQUEST_HEADER (DeleteTableEntries, pBuf, req);
-
- PEXStoreReqHead (DeleteTableEntries, req);
- req->lut = lut;
- req->start = start;
- req->count = count;
-
- END_REQUEST_HEADER (DeleteTableEntries, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-
-/*
- * This routine repacks the lut entries returned by PEXGetTableEntry,
- * PEXGetTableEntries, and PEXGetPredefinedEntries. This is mostly to
- * change the colors from fixed size to the PEXColor union format,
- * as well as to do floating point conversion.
-*/
-
-static PEXPointer
-_PEXRepackLUTEntries (pBuf, numEntries, tableType, fpConvert, fpFormat)
-
-INPUT char *pBuf;
-INPUT int numEntries;
-INPUT int tableType;
-INPUT int fpConvert;
-INPUT int fpFormat;
-
-{
- PEXPointer lutBuf;
- int i;
-
- switch (tableType)
- {
- case PEXLUTLineBundle:
- {
- pexLineBundleEntry *src;
- PEXLineBundleEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXLineBundleEntry, lutBuf);
- dst = (PEXLineBundleEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexLineBundleEntry, pBuf, src);
- pBuf += SIZEOF (pexLineBundleEntry);
-
- dst->type = src->lineType;
- dst->interp_method = src->polylineInterp;
- dst->curve_approx.method = src->curveApprox_method;
- dst->color.type = src->lineColorType;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->curveApprox_tolerance,
- dst->curve_approx.tolerance, fpFormat);
- FP_CONVERT_NTOH (src->lineWidth, dst->width, fpFormat);
- }
- else
- {
- dst->curve_approx.tolerance = src->curveApprox_tolerance;
- dst->width = src->lineWidth;
- }
-
- EXTRACT_COLOR_VAL (pBuf, dst->color.type, dst->color.value,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTMarkerBundle:
- {
- pexMarkerBundleEntry *src;
- PEXMarkerBundleEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXMarkerBundleEntry, lutBuf);
- dst = (PEXMarkerBundleEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexMarkerBundleEntry, pBuf, src);
- pBuf += SIZEOF (pexMarkerBundleEntry);
-
- dst->type = src->markerType;
- dst->color.type = src->markerColorType;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->markerScale, dst->scale, fpFormat);
- }
- else
- dst->scale = src->markerScale;
-
- EXTRACT_COLOR_VAL (pBuf, dst->color.type, dst->color.value,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTTextBundle:
- {
- pexTextBundleEntry *src;
- PEXTextBundleEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXTextBundleEntry, lutBuf);
- dst = (PEXTextBundleEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexTextBundleEntry, pBuf, src);
- pBuf += SIZEOF (pexTextBundleEntry);
-
- dst->font_index = src->textFontIndex;
- dst->precision = src->textPrecision;
- dst->color.type = src->textColorType;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->charExpansion,
- dst->char_expansion, fpFormat);
- FP_CONVERT_NTOH (src->charSpacing,
- dst->char_spacing, fpFormat);
- }
- else
- {
- dst->char_expansion = src->charExpansion;
- dst->char_spacing = src->charSpacing;
- }
-
- EXTRACT_COLOR_VAL (pBuf, dst->color.type, dst->color.value,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTInteriorBundle:
- {
- pexInteriorBundleEntry *src;
- PEXInteriorBundleEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXInteriorBundleEntry, lutBuf);
- dst = (PEXInteriorBundleEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexInteriorBundleEntry, pBuf, src);
- pBuf += SIZEOF (pexInteriorBundleEntry);
-
- dst->style = src->interiorStyle;
- dst->style_index = src->interiorStyleIndex;
- dst->reflection_model = src->reflectionModel;
- dst->interp_method = src->surfaceInterp;
- dst->bf_style = src->bfInteriorStyle;
- dst->bf_style_index = src->bfInteriorStyleIndex;
- dst->bf_reflection_model = src->bfReflectionModel;
- dst->bf_interp_method = src->bfSurfaceInterp;
- dst->surface_approx.method = src->surfaceApprox_method;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->surfaceApproxuTolerance,
- dst->surface_approx.u_tolerance, fpFormat);
- FP_CONVERT_NTOH (src->surfaceApproxvTolerance,
- dst->surface_approx.v_tolerance, fpFormat);
- }
- else
- {
- dst->surface_approx.u_tolerance = src->surfaceApproxuTolerance;
- dst->surface_approx.v_tolerance = src->surfaceApproxvTolerance;
- }
-
- /* copy surfaceColor */
-
- EXTRACT_COLOR_SPEC (pBuf, dst->color, fpConvert, fpFormat);
-
- /* copy reflectionAttr */
-
- EXTRACT_REFLECTION_ATTR (pBuf, dst->reflection_attr,
- fpConvert, fpFormat);
-
- /* copy bfSurfaceColor */
-
- EXTRACT_COLOR_SPEC (pBuf, dst->bf_color, fpConvert, fpFormat);
-
- /* copy bfReflectionAttr */
-
- EXTRACT_REFLECTION_ATTR (pBuf, dst->bf_reflection_attr,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTEdgeBundle:
- {
- pexEdgeBundleEntry *src;
- PEXEdgeBundleEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXEdgeBundleEntry, lutBuf);
- dst = (PEXEdgeBundleEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexEdgeBundleEntry, pBuf, src);
- pBuf += SIZEOF (pexEdgeBundleEntry);
-
- dst->edge_flag = src->edges;
- dst->type = src->edgeType;
- dst->color.type = src->edgeColorType;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->edgeWidth, dst->width, fpFormat);
- }
- else
- dst->width = src->edgeWidth;
-
- EXTRACT_COLOR_VAL (pBuf, dst->color.type, dst->color.value,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTPattern:
- {
- pexPatternEntry *src;
- PEXPatternEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXPatternEntry, lutBuf);
- dst = (PEXPatternEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexPatternEntry, pBuf, src);
- pBuf += SIZEOF (pexPatternEntry);
-
- dst->color_type = src->colorType;
- dst->col_count = src->numx;
- dst->row_count = src->numy;
-
- dst->colors.indexed = (PEXColorIndexed *) Xmalloc (
- (unsigned) (GetClientColorSize (dst->color_type) *
- dst->row_count * dst->col_count));
-
- EXTRACT_LISTOF_COLOR_VAL (dst->row_count * dst->col_count,
- pBuf, dst->color_type, dst->colors, fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTTextFont:
- {
- pexTextFontEntry *src;
- PEXTextFontEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXTextFontEntry, lutBuf);
- dst = (PEXTextFontEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexTextFontEntry, pBuf, src);
- pBuf += SIZEOF (pexTextFontEntry);
-
- dst->count = src->numFonts;
-
- dst->fonts = (PEXFont *)
- Xmalloc ((unsigned) (dst->count * sizeof (PEXFont)));
-
- EXTRACT_LISTOF_CARD32 (dst->count, pBuf, dst->fonts);
- }
- break;
- }
-
- case PEXLUTColor:
- {
- PEXColorEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXColorEntry, lutBuf);
- dst = (PEXColorEntry *) lutBuf;
-
- EXTRACT_LISTOF_COLOR_SPEC (numEntries, pBuf, dst, fpConvert, fpFormat);
- break;
- }
-
- case PEXLUTView:
- {
- pexViewEntry *src;
- PEXViewEntry *dst;
- char *tPtr;
-
- GetLUTEntryBuffer (numEntries, PEXViewEntry, lutBuf);
- dst = (PEXViewEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexViewEntry, pBuf, src);
- pBuf += SIZEOF (pexViewEntry);
-
- dst->clip_flags = src->clipFlags;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->clipLimits_xmin,
- dst->clip_limits.min.x, fpFormat);
- FP_CONVERT_NTOH (src->clipLimits_ymin,
- dst->clip_limits.min.y, fpFormat);
- FP_CONVERT_NTOH (src->clipLimits_zmin,
- dst->clip_limits.min.z, fpFormat);
- FP_CONVERT_NTOH (src->clipLimits_xmax,
- dst->clip_limits.max.x, fpFormat);
- FP_CONVERT_NTOH (src->clipLimits_ymax,
- dst->clip_limits.max.y, fpFormat);
- FP_CONVERT_NTOH (src->clipLimits_zmax,
- dst->clip_limits.max.z, fpFormat);
- }
- else
- {
- dst->clip_limits.min.x = src->clipLimits_xmin;
- dst->clip_limits.min.y = src->clipLimits_ymin;
- dst->clip_limits.min.z = src->clipLimits_zmin;
- dst->clip_limits.max.x = src->clipLimits_xmax;
- dst->clip_limits.max.y = src->clipLimits_ymax;
- dst->clip_limits.max.z = src->clipLimits_zmax;
- }
-
- tPtr = (char *) src->orientation;
- EXTRACT_LISTOF_FLOAT32 (16, tPtr, dst->orientation,
- fpConvert, fpFormat);
-
- tPtr = (char *) src->mapping;
- EXTRACT_LISTOF_FLOAT32 (16, tPtr, dst->mapping,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTLight:
- {
- pexLightEntry *src;
- PEXLightEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXLightEntry, lutBuf);
- dst = (PEXLightEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexLightEntry, pBuf, src);
- pBuf += SIZEOF (pexLightEntry);
-
- dst->type = src->lightType;
- dst->color.type = src->lightColorType;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->direction_x, dst->direction.x, fpFormat);
- FP_CONVERT_NTOH (src->direction_y, dst->direction.y, fpFormat);
- FP_CONVERT_NTOH (src->direction_z, dst->direction.z, fpFormat);
-
- FP_CONVERT_NTOH (src->point_x, dst->point.x, fpFormat);
- FP_CONVERT_NTOH (src->point_y, dst->point.y, fpFormat);
- FP_CONVERT_NTOH (src->point_z, dst->point.z, fpFormat);
-
- FP_CONVERT_NTOH (src->concentration,
- dst->concentration, fpFormat);
- FP_CONVERT_NTOH (src->spreadAngle,
- dst->spread_angle, fpFormat);
- FP_CONVERT_NTOH (src->attenuation1,
- dst->attenuation1, fpFormat);
- FP_CONVERT_NTOH (src->attenuation2,
- dst->attenuation2, fpFormat);
- }
- else
- {
- dst->direction.x = src->direction_x;
- dst->direction.y = src->direction_y;
- dst->direction.z = src->direction_z;
-
- dst->point.x = src->point_x;
- dst->point.y = src->point_y;
- dst->point.z = src->point_z;
-
- dst->concentration = src->concentration;
- dst->spread_angle = src->spreadAngle;
- dst->attenuation1 = src->attenuation1;
- dst->attenuation2 = src->attenuation2;
- }
-
- EXTRACT_COLOR_VAL (pBuf, dst->color.type, dst->color.value,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTDepthCue:
- {
- pexDepthCueEntry *src;
- PEXDepthCueEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXDepthCueEntry, lutBuf);
- dst = (PEXDepthCueEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexDepthCueEntry, pBuf, src);
- pBuf += SIZEOF (pexDepthCueEntry);
-
- dst->mode = src->mode;
- dst->color.type = src->depthCueColorType;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->frontPlane, dst->front_plane, fpFormat);
- FP_CONVERT_NTOH (src->backPlane, dst->back_plane, fpFormat);
-
- FP_CONVERT_NTOH (src->frontScaling,
- dst->front_scaling, fpFormat);
- FP_CONVERT_NTOH (src->backScaling,
- dst->back_scaling, fpFormat);
- }
- else
- {
- dst->front_plane = src->frontPlane;
- dst->back_plane = src->backPlane;
-
- dst->front_scaling = src->frontScaling;
- dst->back_scaling = src->backScaling;
- }
-
- EXTRACT_COLOR_VAL (pBuf, dst->color.type, dst->color.value,
- fpConvert, fpFormat);
- }
- break;
- }
-
- case PEXLUTColorApprox:
- {
- pexColorApproxEntry *src;
- PEXColorApproxEntry *dst;
-
- GetLUTEntryBuffer (numEntries, PEXColorApproxEntry, lutBuf);
- dst = (PEXColorApproxEntry *) lutBuf;
-
- for (i = 0; i < numEntries; i++, dst++)
- {
- GET_STRUCT_PTR (pexColorApproxEntry, pBuf, src);
- pBuf += SIZEOF (pexColorApproxEntry);
-
- dst->type = src->approxType;
- dst->model = src->approxModel;
- dst->max1 = src->max1;
- dst->max2 = src->max2;
- dst->max3 = src->max3;
- dst->dither = src->dither;
- dst->mult1 = src->mult1;
- dst->mult2 = src->mult2;
- dst->mult3 = src->mult3;
- dst->base_pixel = src->basePixel;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (src->weight1, dst->weight1, fpFormat);
- FP_CONVERT_NTOH (src->weight2, dst->weight2, fpFormat);
- FP_CONVERT_NTOH (src->weight3, dst->weight3, fpFormat);
- }
- else
- {
- dst->weight1 = src->weight1;
- dst->weight2 = src->weight2;
- dst->weight3 = src->weight3;
- }
- }
- break;
- }
- }
-
- return (lutBuf);
-}
diff --git a/xc/lib/PEX5/pl_lut.h b/xc/lib/PEX5/pl_lut.h
deleted file mode 100644
index fa8336e5e..000000000
--- a/xc/lib/PEX5/pl_lut.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $TOG: pl_lut.h /main/5 1998/02/06 16:10:34 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.
-
-*/
-
-#ifndef WORD64
-
-#define BEGIN_LUTENTRY_HEADER(_name, _pBuf, _pEntry) \
- _pEntry = (_name *) _pBuf;
-
-#define END_LUTENTRY_HEADER(_name, _pBuf, _pEntry) \
- _pBuf += SIZEOF (_name);
-
-#else /* WORD64 */
-
-#define BEGIN_LUTENTRY_HEADER(_name, _pBuf, _pEntry) \
-{ \
- _name tEntry; \
- _pEntry = &tEntry;
-
-#define END_LUTENTRY_HEADER(_name, _pBuf, _pEntry) \
- memcpy (_pBuf, _pEntry, SIZEOF (_name)); \
- _pBuf += SIZEOF (_name); \
-}
-
-#endif /* WORD64 */
-
-
-static PEXPointer _PEXRepackLUTEntries();
-
-#define GetLUTEntryBuffer(_numEntries, _entryType, _buf) \
- (_buf) = (PEXPointer) Xmalloc ( \
- (unsigned) ((_numEntries) * (sizeof (_entryType))));
-
-
-
diff --git a/xc/lib/PEX5/pl_nameset.c b/xc/lib/PEX5/pl_nameset.c
deleted file mode 100644
index 16b329387..000000000
--- a/xc/lib/PEX5/pl_nameset.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* $TOG: pl_nameset.c /main/9 1998/02/06 16:10:40 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-
-
-PEXNameSet
-PEXCreateNameSet (display)
-
-INPUT Display *display;
-
-{
- register pexCreateNameSetReq *req;
- char *pBuf;
- PEXNameSet ns;
-
-
- /*
- * Get a nameset resource id from X.
- */
-
- ns = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreateNameSet, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateNameSet, pBuf, req);
-
- PEXStoreReqHead (CreateNameSet, req);
- req->id = ns;
-
- END_REQUEST_HEADER (CreateNameSet, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (ns);
-}
-
-
-void
-PEXFreeNameSet (display, ns)
-
-INPUT Display *display;
-INPUT PEXNameSet ns;
-
-{
- register pexFreeNameSetReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreeNameSet, pBuf);
-
- BEGIN_REQUEST_HEADER (FreeNameSet, pBuf, req);
-
- PEXStoreReqHead (FreeNameSet, req);
- req->id = ns;
-
- END_REQUEST_HEADER (FreeNameSet, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCopyNameSet (display, srcNs, destNs)
-
-INPUT Display *display;
-INPUT PEXNameSet srcNs;
-INPUT PEXNameSet destNs;
-
-{
- register pexCopyNameSetReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CopyNameSet, pBuf);
-
- BEGIN_REQUEST_HEADER (CopyNameSet, pBuf, req);
-
- PEXStoreReqHead (CopyNameSet, req);
- req->src = srcNs;
- req->dst = destNs;
-
- END_REQUEST_HEADER (CopyNameSet, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-Status
-PEXGetNameSet (display, ns, numNamesReturn, namesReturn)
-
-INPUT Display *display;
-INPUT PEXNameSet ns;
-OUTPUT unsigned long *numNamesReturn;
-OUTPUT PEXName **namesReturn;
-
-{
- register pexGetNameSetReq *req;
- char *pBuf;
- pexGetNameSetReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetNameSet, pBuf);
-
- BEGIN_REQUEST_HEADER (GetNameSet, pBuf, req);
-
- PEXStoreReqHead (GetNameSet, req);
- req->id = ns;
-
- END_REQUEST_HEADER (GetNameSet, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numNamesReturn = 0;
- *namesReturn = NULL;
- return (0); /* return an error */
- }
-
- *numNamesReturn = rep.numNames;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the user.
- */
-
- *namesReturn = (PEXName *) Xmalloc (
- (unsigned) (sizeof (PEXName) * rep.numNames));
-
- XREAD_LISTOF_CARD32 (display, rep.numNames, *namesReturn);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-void
-PEXChangeNameSet (display, ns, action, numValues, values)
-
-INPUT Display *display;
-INPUT PEXNameSet ns;
-INPUT int action;
-INPUT unsigned long numValues;
-INPUT PEXName *values;
-
-{
- register pexChangeNameSetReq *req;
- char *pBuf;
- int size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- size = numValues * SIZEOF (pexName);
- PEXGetReqExtra (ChangeNameSet, size, pBuf);
-
- BEGIN_REQUEST_HEADER (ChangeNameSet, pBuf, req);
-
- PEXStoreReqExtraHead (ChangeNameSet, size, req);
- req->ns = ns;
- req->action = action;
-
- END_REQUEST_HEADER (ChangeNameSet, pBuf, req);
-
- STORE_LISTOF_CARD32 (numValues, values, pBuf);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
diff --git a/xc/lib/PEX5/pl_oc_attr.c b/xc/lib/PEX5/pl_oc_attr.c
deleted file mode 100644
index a719bafa1..000000000
--- a/xc/lib/PEX5/pl_oc_attr.c
+++ /dev/null
@@ -1,1979 +0,0 @@
-/* $TOG: pl_oc_attr.c /main/10 1998/02/06 16:10:45 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-void
-PEXSetMarkerType (display, resource_id, req_type, type)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int type;
-
-{
- register pexMarkerType *req;
-
- BEGIN_SIMPLE_OC (MarkerType, resource_id, req_type, req);
- req->markerType = type;
- END_SIMPLE_OC (MarkerType, resource_id, req_type, req);
-}
-
-
-void
-PEXSetMarkerScale (display, resource_id, req_type, scale)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double scale;
-
-{
- register pexMarkerScale *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (MarkerScale, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (scale, req->scale, fpFormat);
- }
- else
- req->scale = scale;
-
- END_SIMPLE_OC (MarkerScale, resource_id, req_type, req);
-}
-
-
-void
-PEXSetMarkerColorIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexMarkerColorIndex *req;
-
- BEGIN_SIMPLE_OC (MarkerColorIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (MarkerColorIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetMarkerColor (display, resource_id, req_type, colorType, color)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int colorType;
-INPUT PEXColor *color;
-
-{
- register pexMarkerColor *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (colorType);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexMarkerColor), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (MarkerColor, lenofColor, pBuf, req);
-
- req->colorType = colorType;
-
- END_OC_HEADER (MarkerColor, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (colorType, (*color), pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetMarkerBundleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexMarkerBundleIndex *req;
-
- BEGIN_SIMPLE_OC (MarkerBundleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (MarkerBundleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextFontIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexTextFontIndex *req;
-
- BEGIN_SIMPLE_OC (TextFontIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (TextFontIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextPrecision (display, resource_id, req_type, precision)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int precision;
-
-{
- register pexTextPrecision *req;
-
- BEGIN_SIMPLE_OC (TextPrecision, resource_id, req_type, req);
- req->precision = precision;
- END_SIMPLE_OC (TextPrecision, resource_id, req_type, req);
-}
-
-
-void
-PEXSetCharExpansion (display, resource_id, req_type, expansion)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double expansion;
-
-{
- register pexCharExpansion *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (CharExpansion, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (expansion, req->expansion, fpFormat);
- }
- else
- req->expansion = expansion;
-
- END_SIMPLE_OC (CharExpansion, resource_id, req_type, req);
-}
-
-
-void
-PEXSetCharSpacing (display, resource_id, req_type, spacing)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double spacing;
-
-{
- register pexCharSpacing *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (CharSpacing, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (spacing, req->spacing, fpFormat);
- }
- else
- req->spacing = spacing;
-
- END_SIMPLE_OC (CharSpacing, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextColorIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexTextColorIndex *req;
-
- BEGIN_SIMPLE_OC (TextColorIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (TextColorIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextColor (display, resource_id, req_type, colorType, color)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int colorType;
-INPUT PEXColor *color;
-
-{
- register pexTextColor *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (colorType);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexTextColor), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (TextColor, lenofColor, pBuf, req);
-
- req->colorType = colorType;
-
- END_OC_HEADER (TextColor, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (colorType, (*color), pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetCharHeight (display, resource_id, req_type, height)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double height;
-
-{
- register pexCharHeight *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (CharHeight, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (height, req->height, fpFormat);
- }
- else
- req->height = height;
-
- END_SIMPLE_OC (CharHeight, resource_id, req_type, req);
-}
-
-
-void
-PEXSetCharUpVector (display, resource_id, req_type, vector)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXVector2D *vector;
-
-{
- register pexCharUpVector *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (CharUpVector, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (vector->x, req->up_x, fpFormat);
- FP_CONVERT_HTON (vector->y, req->up_y, fpFormat);
- }
- else
- {
- req->up_x = vector->x;
- req->up_y = vector->y;
- }
-
- END_SIMPLE_OC (CharUpVector, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextPath (display, resource_id, req_type, path)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int path;
-
-{
- register pexTextPath *req;
-
- BEGIN_SIMPLE_OC (TextPath, resource_id, req_type, req);
- req->path = path;
- END_SIMPLE_OC (TextPath, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextAlignment (display, resource_id, req_type, halignment, valignment)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int halignment;
-INPUT int valignment;
-
-{
- register pexTextAlignment *req;
-
- BEGIN_SIMPLE_OC (TextAlignment, resource_id, req_type, req);
- req->alignment_vertical = valignment;
- req->alignment_horizontal = halignment;
- END_SIMPLE_OC (TextAlignment, resource_id, req_type, req);
-}
-
-
-void
-PEXSetATextHeight (display, resource_id, req_type, height)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double height;
-
-{
- register pexATextHeight *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (ATextHeight, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (height, req->height, fpFormat);
- }
- else
- req->height = height;
-
- END_SIMPLE_OC (ATextHeight, resource_id, req_type, req);
-}
-
-
-void
-PEXSetATextUpVector (display, resource_id, req_type, vector)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXVector2D *vector;
-
-{
- register pexATextUpVector *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (ATextUpVector, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (vector->x, req->up_x, fpFormat);
- FP_CONVERT_HTON (vector->y, req->up_y, fpFormat);
- }
- else
- {
- req->up_x = vector->x;
- req->up_y = vector->y;
- }
-
- END_SIMPLE_OC (ATextUpVector, resource_id, req_type, req);
-}
-
-
-void
-PEXSetATextPath (display, resource_id, req_type, path)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int path;
-
-{
- register pexATextPath *req;
-
- BEGIN_SIMPLE_OC (ATextPath, resource_id, req_type, req);
- req->path = path;
- END_SIMPLE_OC (ATextPath, resource_id, req_type, req);
-}
-
-
-void
-PEXSetATextAlignment (display, resource_id, req_type, halignment, valignment)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int halignment;
-INPUT int valignment;
-
-{
- register pexATextAlignment *req;
-
- BEGIN_SIMPLE_OC (ATextAlignment, resource_id, req_type, req);
- req->alignment_vertical = valignment;
- req->alignment_horizontal = halignment;
- END_SIMPLE_OC (ATextAlignment, resource_id, req_type, req);
-}
-
-
-void
-PEXSetATextStyle (display, resource_id, req_type, style)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int style;
-
-{
- register pexATextStyle *req;
-
- BEGIN_SIMPLE_OC (ATextStyle, resource_id, req_type, req);
- req->style = style;
- END_SIMPLE_OC (ATextStyle, resource_id, req_type, req);
-}
-
-
-void
-PEXSetTextBundleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexTextBundleIndex *req;
-
- BEGIN_SIMPLE_OC (TextBundleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (TextBundleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLineType (display, resource_id, req_type, type)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int type;
-
-{
- register pexLineType *req;
-
- BEGIN_SIMPLE_OC (LineType, resource_id, req_type, req);
- req->lineType = type;
- END_SIMPLE_OC (LineType, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLineWidth (display, resource_id, req_type, width)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double width;
-
-{
- register pexLineWidth *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (LineWidth, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (width, req->width, fpFormat);
- }
- else
- req->width = width;
-
- END_SIMPLE_OC (LineWidth, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLineColorIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexLineColorIndex *req;
-
- BEGIN_SIMPLE_OC (LineColorIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (LineColorIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLineColor (display, resource_id, req_type, colorType, color)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int colorType;
-INPUT PEXColor *color;
-
-{
- register pexLineColor *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (colorType);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexLineColor), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (LineColor, lenofColor, pBuf, req);
-
- req->colorType = colorType;
-
- END_OC_HEADER (LineColor, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (colorType, (*color), pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetCurveApprox (display, resource_id, req_type, approxMethod, tolerance)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int approxMethod;
-INPUT double tolerance;
-
-{
- register pexCurveApprox *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (CurveApprox, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- req->approxMethod = approxMethod;
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (tolerance, req->tolerance, fpFormat);
- }
- else
- req->tolerance = tolerance;
-
- END_SIMPLE_OC (CurveApprox, resource_id, req_type, req);
-}
-
-
-void
-PEXSetPolylineInterpMethod (display, resource_id, req_type, method)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int method;
-
-{
- register pexPolylineInterpMethod *req;
-
- BEGIN_SIMPLE_OC (PolylineInterpMethod, resource_id, req_type, req);
- req->polylineInterp = method;
- END_SIMPLE_OC (PolylineInterpMethod, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLineBundleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexLineBundleIndex *req;
-
- BEGIN_SIMPLE_OC (LineBundleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (LineBundleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetInteriorStyle (display, resource_id, req_type, style)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int style;
-
-{
- register pexInteriorStyle *req;
-
- BEGIN_SIMPLE_OC (InteriorStyle, resource_id, req_type, req);
- req->interiorStyle = style;
- END_SIMPLE_OC (InteriorStyle, resource_id, req_type, req);
-}
-
-
-void
-PEXSetInteriorStyleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int index;
-
-{
- register pexInteriorStyleIndex *req;
-
- BEGIN_SIMPLE_OC (InteriorStyleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (InteriorStyleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceColorIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexSurfaceColorIndex *req;
-
- BEGIN_SIMPLE_OC (SurfaceColorIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (SurfaceColorIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceColor (display, resource_id, req_type, colorType, color)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int colorType;
-INPUT PEXColor *color;
-
-{
- register pexSurfaceColor *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (colorType);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexSurfaceColor), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (SurfaceColor, lenofColor, pBuf, req);
-
- req->colorType = colorType;
-
- END_OC_HEADER (SurfaceColor, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (colorType, (*color), pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetReflectionAttributes (display, resource_id, req_type, reflectionAttr)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXReflectionAttributes *reflectionAttr;
-
-{
- register pexReflectionAttributes *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (reflectionAttr->specular_color.type);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexReflectionAttributes), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (ReflectionAttributes, lenofColor, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (reflectionAttr->ambient, req->ambient, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->diffuse, req->diffuse, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->specular, req->specular, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->specular_conc,
- req->specularConc, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->transmission,
- req->transmission, fpFormat);
- }
- else
- {
- req->ambient = reflectionAttr->ambient;
- req->diffuse = reflectionAttr->diffuse;
- req->specular = reflectionAttr->specular;
- req->specularConc = reflectionAttr->specular_conc;
- req->transmission = reflectionAttr->transmission;
- }
-
- req->specular_colorType = reflectionAttr->specular_color.type;
-
- END_OC_HEADER (ReflectionAttributes, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (reflectionAttr->specular_color.type,
- reflectionAttr->specular_color.value, pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetReflectionModel (display, resource_id, req_type, model)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int model;
-
-{
- register pexReflectionModel *req;
-
- BEGIN_SIMPLE_OC (ReflectionModel, resource_id, req_type, req);
- req->reflectionModel = model;
- END_SIMPLE_OC (ReflectionModel, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceInterpMethod (display, resource_id, req_type, method)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int method;
-
-{
- register pexSurfaceInterpMethod *req;
-
- BEGIN_SIMPLE_OC (SurfaceInterpMethod, resource_id, req_type, req);
- req->surfaceInterp = method;
- END_SIMPLE_OC (SurfaceInterpMethod, resource_id, req_type, req);
-}
-
-
-void
-PEXSetBFInteriorStyle (display, resource_id, req_type, style)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int style;
-
-{
- register pexBFInteriorStyle *req;
-
- BEGIN_SIMPLE_OC (BFInteriorStyle, resource_id, req_type, req);
- req->interiorStyle = style;
- END_SIMPLE_OC (BFInteriorStyle, resource_id, req_type, req);
-}
-
-
-void
-PEXSetBFInteriorStyleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int index;
-
-{
- register pexBFInteriorStyleIndex *req;
-
- BEGIN_SIMPLE_OC (BFInteriorStyleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (BFInteriorStyleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetBFSurfaceColorIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexBFSurfaceColorIndex *req;
-
- BEGIN_SIMPLE_OC (BFSurfaceColorIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (BFSurfaceColorIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetBFSurfaceColor (display, resource_id, req_type, colorType, color)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int colorType;
-INPUT PEXColor *color;
-
-{
- register pexBFSurfaceColor *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (colorType);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexBFSurfaceColor), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (BFSurfaceColor, lenofColor, pBuf, req);
-
- req->colorType = colorType;
-
- END_OC_HEADER (BFSurfaceColor, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (colorType, (*color), pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetBFReflectionAttributes (display, resource_id, req_type, reflectionAttr)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXReflectionAttributes *reflectionAttr;
-
-{
- register pexBFReflectionAttributes *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (reflectionAttr->specular_color.type);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexBFReflectionAttributes), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (BFReflectionAttributes, lenofColor, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (reflectionAttr->ambient, req->ambient, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->diffuse, req->diffuse, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->specular, req->specular, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->specular_conc,
- req->specularConc, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->transmission,
- req->transmission, fpFormat);
- }
- else
- {
- req->ambient = reflectionAttr->ambient;
- req->diffuse = reflectionAttr->diffuse;
- req->specular = reflectionAttr->specular;
- req->specularConc = reflectionAttr->specular_conc;
- req->transmission = reflectionAttr->transmission;
- }
-
- req->specular_colorType = reflectionAttr->specular_color.type;
-
- END_OC_HEADER (BFReflectionAttributes, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (reflectionAttr->specular_color.type,
- reflectionAttr->specular_color.value, pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetBFReflectionModel (display, resource_id, req_type, model)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int model;
-
-{
- register pexBFReflectionModel *req;
-
- BEGIN_SIMPLE_OC (BFReflectionModel, resource_id, req_type, req);
- req->reflectionModel = model;
- END_SIMPLE_OC (BFReflectionModel, resource_id, req_type, req);
-}
-
-
-void
-PEXSetBFSurfaceInterpMethod (display, resource_id, req_type, method)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int method;
-
-{
- register pexBFSurfaceInterpMethod *req;
-
- BEGIN_SIMPLE_OC (BFSurfaceInterpMethod, resource_id, req_type, req);
- req->surfaceInterp = method;
- END_SIMPLE_OC (BFSurfaceInterpMethod, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceApprox (display, resource_id, req_type,
- approxMethod, uTolerance, vTolerance)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int approxMethod;
-INPUT double uTolerance;
-INPUT double vTolerance;
-
-{
- register pexSurfaceApprox *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (SurfaceApprox, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- req->approxMethod = approxMethod;
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (uTolerance, req->uTolerance, fpFormat);
- FP_CONVERT_DHTON (vTolerance, req->vTolerance, fpFormat);
- }
- else
- {
- req->uTolerance = uTolerance;
- req->vTolerance = vTolerance;
- }
-
- END_SIMPLE_OC (SurfaceApprox, resource_id, req_type, req);
-}
-
-
-void
-PEXSetFacetCullingMode (display, resource_id, req_type, mode)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int mode;
-
-{
- register pexFacetCullingMode *req;
-
- BEGIN_SIMPLE_OC (FacetCullingMode, resource_id, req_type, req);
- req->cullMode = mode;
- END_SIMPLE_OC (FacetCullingMode, resource_id, req_type, req);
-}
-
-
-void
-PEXSetFacetDistinguishFlag (display, resource_id, req_type, flag)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int flag;
-
-{
- register pexFacetDistinguishFlag *req;
-
- BEGIN_SIMPLE_OC (FacetDistinguishFlag, resource_id, req_type, req);
- req->distinguish = flag;
- END_SIMPLE_OC (FacetDistinguishFlag, resource_id, req_type, req);
-}
-
-
-void
-PEXSetPatternSize (display, resource_id, req_type, width, height)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double width;
-INPUT double height;
-
-{
- register pexPatternSize *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (PatternSize, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (width, req->size_x, fpFormat);
- FP_CONVERT_DHTON (height, req->size_y, fpFormat);
- }
- else
- {
- req->size_x = width;
- req->size_y = height;
- }
-
- END_SIMPLE_OC (PatternSize, resource_id, req_type, req);
-}
-
-
-void
-PEXSetPatternAttributes2D (display, resource_id, req_type, ref_point)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord2D *ref_point;
-
-{
- register pexPatternAttributes2D *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (PatternAttributes2D, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ref_point->x, req->point_x, fpFormat);
- FP_CONVERT_HTON (ref_point->y, req->point_y, fpFormat);
- }
- else
- {
- req->point_x = ref_point->x;
- req->point_y = ref_point->y;
- }
-
- END_SIMPLE_OC (PatternAttributes2D, resource_id, req_type, req);
-}
-
-
-void
-PEXSetPatternAttributes (display, resource_id, req_type, refPt, vec1, vec2)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *refPt;
-INPUT PEXVector *vec1;
-INPUT PEXVector *vec2;
-
-{
- register pexPatternAttributes *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (PatternAttributes, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (refPt->x, req->refPt_x, fpFormat);
- FP_CONVERT_HTON (refPt->y, req->refPt_y, fpFormat);
- FP_CONVERT_HTON (refPt->z, req->refPt_z, fpFormat);
- FP_CONVERT_HTON (vec1->x, req->vector1_x, fpFormat);
- FP_CONVERT_HTON (vec1->y, req->vector1_y, fpFormat);
- FP_CONVERT_HTON (vec1->z, req->vector1_z, fpFormat);
- FP_CONVERT_HTON (vec2->x, req->vector2_x, fpFormat);
- FP_CONVERT_HTON (vec2->y, req->vector2_y, fpFormat);
- FP_CONVERT_HTON (vec2->z, req->vector2_z, fpFormat);
- }
- else
- {
- req->refPt_x = refPt->x;
- req->refPt_y = refPt->y;
- req->refPt_z = refPt->z;
- req->vector1_x = vec1->x;
- req->vector1_y = vec1->y;
- req->vector1_z = vec1->z;
- req->vector2_x = vec2->x;
- req->vector2_y = vec2->y;
- req->vector2_z = vec2->z;
- }
-
- END_SIMPLE_OC (PatternAttributes, resource_id, req_type, req);
-}
-
-
-void
-PEXSetInteriorBundleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexInteriorBundleIndex *req;
-
- BEGIN_SIMPLE_OC (InteriorBundleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (InteriorBundleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceEdgeFlag (display, resource_id, req_type, flag)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int flag;
-
-{
- register pexSurfaceEdgeFlag *req;
-
- BEGIN_SIMPLE_OC (SurfaceEdgeFlag, resource_id, req_type, req);
- req->onoff = flag;
- END_SIMPLE_OC (SurfaceEdgeFlag, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceEdgeType (display, resource_id, req_type, type)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int type;
-
-{
- register pexSurfaceEdgeType *req;
-
- BEGIN_SIMPLE_OC (SurfaceEdgeType, resource_id, req_type, req);
- req->edgeType = type;
- END_SIMPLE_OC (SurfaceEdgeType, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceEdgeWidth (display, resource_id, req_type, width)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT double width;
-
-{
- register pexSurfaceEdgeWidth *req;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (SurfaceEdgeWidth, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (width, req->width, fpFormat);
- }
- else
- req->width = width;
-
- END_SIMPLE_OC (SurfaceEdgeWidth, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceEdgeColorIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexSurfaceEdgeColorIndex *req;
-
- BEGIN_SIMPLE_OC (SurfaceEdgeColorIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (SurfaceEdgeColorIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetSurfaceEdgeColor (display, resource_id, req_type, colorType, color)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int colorType;
-INPUT PEXColor *color;
-
-{
- register pexSurfaceEdgeColor *req;
- char *pBuf;
- int lenofColor;
- int fpConvert;
- int fpFormat;
-
- lenofColor = GetColorLength (colorType);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexSurfaceEdgeColor), lenofColor, pBuf);
-
- if (pBuf == NULL) return;
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (SurfaceEdgeColor, lenofColor, pBuf, req);
-
- req->colorType = colorType;
-
- END_OC_HEADER (SurfaceEdgeColor, pBuf, req);
-
- pBuf = PEXGetOCAddr (display, NUMBYTES (lenofColor));
- STORE_COLOR_VAL (colorType, (*color), pBuf, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetEdgeBundleIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexEdgeBundleIndex *req;
-
- BEGIN_SIMPLE_OC (EdgeBundleIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (EdgeBundleIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetIndividualASF (display, resource_id, req_type, attribute, value)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned long attribute;
-INPUT int value;
-
-{
- register pexIndividualASF *req;
-
- BEGIN_SIMPLE_OC (IndividualASF, resource_id, req_type, req);
- req->attribute = attribute;
- req->source = value;
- END_SIMPLE_OC (IndividualASF, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLocalTransform (display, resource_id, req_type, compType, transform)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int compType;
-INPUT PEXMatrix transform;
-
-{
- register pexLocalTransform *req;
- char *ptr;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (LocalTransform, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- req->compType = compType;
-
- ptr = (char *) req->matrix;
- STORE_LISTOF_FLOAT32 (16, transform, ptr, fpConvert, fpFormat);
-
- END_SIMPLE_OC (LocalTransform, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLocalTransform2D (display, resource_id, req_type, compType, transform)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int compType;
-INPUT PEXMatrix3x3 transform;
-
-{
- register pexLocalTransform2D *req;
- char *ptr;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (LocalTransform2D, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- req->compType = compType;
-
- ptr = (char *) req->matrix3X3;
- STORE_LISTOF_FLOAT32 (9, transform, ptr, fpConvert, fpFormat);
-
- END_SIMPLE_OC (LocalTransform2D, resource_id, req_type, req);
-}
-
-
-void
-PEXSetGlobalTransform (display, resource_id, req_type, transform)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXMatrix transform;
-
-{
- register pexGlobalTransform *req;
- char *ptr;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (GlobalTransform, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- ptr = (char *) req->matrix;
- STORE_LISTOF_FLOAT32 (16, transform, ptr, fpConvert, fpFormat);
-
- END_SIMPLE_OC (GlobalTransform, resource_id, req_type, req);
-}
-
-
-void
-PEXSetGlobalTransform2D (display, resource_id, req_type, transform)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXMatrix3x3 transform;
-
-{
- register pexGlobalTransform2D *req;
- char *ptr;
- int fpConvert;
- int fpFormat;
-
- BEGIN_SIMPLE_OC (GlobalTransform2D, resource_id, req_type, req);
- CHECK_FP (fpConvert, fpFormat);
-
- ptr = (char *) req->matrix3X3;
- STORE_LISTOF_FLOAT32 (9, transform, ptr, fpConvert, fpFormat);
-
- END_SIMPLE_OC (GlobalTransform2D, resource_id, req_type, req);
-}
-
-
-void
-PEXSetModelClipFlag (display, resource_id, req_type, flag)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int flag;
-
-{
- register pexModelClipFlag *req;
-
- BEGIN_SIMPLE_OC (ModelClipFlag, resource_id, req_type, req);
- req->onoff = flag;
- END_SIMPLE_OC (ModelClipFlag, resource_id, req_type, req);
-}
-
-
-void
-PEXSetModelClipVolume (display, resource_id, req_type, op,
- numHalfSpaces, halfSpaces)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int op;
-INPUT unsigned int numHalfSpaces;
-INPUT PEXHalfSpace *halfSpaces;
-
-{
- register pexModelClipVolume *req;
- char *pBuf;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numHalfSpaces * SIZEOF (pexHalfSpace));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexModelClipVolume), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (ModelClipVolume, dataLength, pBuf, req);
-
- req->modelClipOperator = op;
- req->numHalfSpaces = numHalfSpaces;
-
- END_OC_HEADER (ModelClipVolume, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_HALFSPACE3D (numHalfSpaces, halfSpaces, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetModelClipVolume2D (display, resource_id, req_type, op,
- numHalfSpaces, halfSpaces)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int op;
-INPUT unsigned int numHalfSpaces;
-INPUT PEXHalfSpace2D *halfSpaces;
-
-{
- register pexModelClipVolume2D *req;
- char *pBuf;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numHalfSpaces * SIZEOF (pexHalfSpace2D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexModelClipVolume2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (ModelClipVolume2D, dataLength, pBuf, req);
-
- req->modelClipOperator = op;
- req->numHalfSpaces = numHalfSpaces;
-
- END_OC_HEADER (ModelClipVolume2D, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_HALFSPACE2D (numHalfSpaces, halfSpaces, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXRestoreModelClipVolume (display, resource_id, req_type)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-
-{
- register pexRestoreModelClipVolume *req;
-
- BEGIN_SIMPLE_OC (RestoreModelClipVolume, resource_id, req_type, req);
- /* no data */
- END_SIMPLE_OC (RestoreModelClipVolume, resource_id, req_type, req);
-}
-
-
-void
-PEXSetViewIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexViewIndex *req;
-
- BEGIN_SIMPLE_OC (ViewIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (ViewIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetLightSourceState (display, resource_id, req_type,
- numEnable, enable, numDisable, disable)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int numEnable;
-INPUT PEXTableIndex *enable;
-INPUT unsigned int numDisable;
-INPUT PEXTableIndex *disable;
-
-{
- register pexLightSourceState *req;
- char *pBuf;
- int dataLength;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numEnable * SIZEOF (CARD16)) +
- NUMWORDS (numDisable * SIZEOF (CARD16));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexLightSourceState), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- BEGIN_OC_HEADER (LightSourceState, dataLength, pBuf, req);
-
- req->numEnable = numEnable;
- req->numDisable = numDisable;
-
- END_OC_HEADER (LightSourceState, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_CARD16_PAD (numEnable, enable);
- OC_LISTOF_CARD16_PAD (numDisable, disable);
-
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetDepthCueIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexDepthCueIndex *req;
-
- BEGIN_SIMPLE_OC (DepthCueIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (DepthCueIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetPickID (display, resource_id, req_type, id)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned long id;
-
-{
- register pexPickID *req;
-
- BEGIN_SIMPLE_OC (PickID, resource_id, req_type, req);
- req->pickId = id;
- END_SIMPLE_OC (PickID, resource_id, req_type, req);
-}
-
-
-void
-PEXSetHLHSRID (display, resource_id, req_type, id)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned long id;
-
-{
- register pexHLHSRID *req;
-
- BEGIN_SIMPLE_OC (HLHSRID, resource_id, req_type, req);
- req->hlhsrID = id;
- END_SIMPLE_OC (HLHSRID, resource_id, req_type, req);
-}
-
-
-void
-PEXSetColorApproxIndex (display, resource_id, req_type, index)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int index;
-
-{
- register pexColorApproxIndex *req;
-
- BEGIN_SIMPLE_OC (ColorApproxIndex, resource_id, req_type, req);
- req->index = index;
- END_SIMPLE_OC (ColorApproxIndex, resource_id, req_type, req);
-}
-
-
-void
-PEXSetParaSurfCharacteristics (display, resource_id, req_type,
- pscType, pscData)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int pscType;
-INPUT PEXPSCData *pscData;
-
-{
- register pexParaSurfCharacteristics *req;
- char *pBuf;
- int dataLength = 0;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- if (pscType == PEXPSCIsoCurves)
- {
- dataLength = LENOF (pexPSC_IsoparametricCurves);
- }
- else if (pscType == PEXPSCMCLevelCurves || pscType == PEXPSCWCLevelCurves)
- {
- dataLength = NUMWORDS (SIZEOF (pexPSC_LevelCurves) +
- (pscData->level_curves.count * SIZEOF (float)));
- }
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexParaSurfCharacteristics), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (ParaSurfCharacteristics, dataLength, pBuf, req);
-
- req->characteristics = pscType;
- req->length = NUMBYTES (dataLength);
-
- END_OC_HEADER (ParaSurfCharacteristics, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- if (pBuf = PEXGetOCAddr (display, req->length))
- {
- if (pscType == PEXPSCIsoCurves)
- {
- STORE_PSC_ISOCURVES (pscData->iso_curves, pBuf);
- }
- else if (pscType == PEXPSCMCLevelCurves ||
- pscType == PEXPSCWCLevelCurves)
- {
- STORE_PSC_LEVELCURVES (pscData->level_curves, pBuf,
- fpConvert, fpFormat);
-
- STORE_LISTOF_FLOAT32 (pscData->level_curves.count,
- pscData->level_curves.parameters, pBuf, fpConvert, fpFormat);
- }
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetRenderingColorModel (display, resource_id, req_type, model)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int model;
-
-{
- register pexRenderingColorModel *req;
-
- BEGIN_SIMPLE_OC (RenderingColorModel, resource_id, req_type, req);
- req->model = model;
- END_SIMPLE_OC (RenderingColorModel, resource_id, req_type, req);
-}
-
-
-void
-PEXAddToNameSet (display, resource_id, req_type, numNames, names)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned long numNames;
-INPUT PEXName *names;
-
-{
- register pexAddToNameSet *req;
- char *pBuf;
- int dataLength;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numNames * SIZEOF (pexName));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexAddToNameSet), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- BEGIN_OC_HEADER (AddToNameSet, dataLength, pBuf, req);
- END_OC_HEADER (AddToNameSet, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_CARD32 (numNames, names);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXRemoveFromNameSet (display, resource_id, req_type, numNames, names)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned long numNames;
-INPUT PEXName *names;
-
-{
- register pexRemoveFromNameSet *req;
- char *pBuf;
- int dataLength;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numNames * SIZEOF (pexName));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexRemoveFromNameSet), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- BEGIN_OC_HEADER (RemoveFromNameSet, dataLength, pBuf, req);
- END_OC_HEADER (RemoveFromNameSet, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_CARD32 (numNames, names);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
diff --git a/xc/lib/PEX5/pl_oc_dec.c b/xc/lib/PEX5/pl_oc_dec.c
deleted file mode 100644
index e5bd7d02f..000000000
--- a/xc/lib/PEX5/pl_oc_dec.c
+++ /dev/null
@@ -1,1925 +0,0 @@
-/* $TOG: pl_oc_dec.c /main/15 1998/02/06 16:10:54 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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-PEXOCData *
-PEXDecodeOCs (float_format, oc_count, length, encoded_ocs)
-
-INPUT int float_format;
-INPUT unsigned long oc_count;
-INPUT unsigned long length;
-INPUT char *encoded_ocs;
-
-{
- extern void (*(PEX_decode_oc_funcs[]))();
- PEXOCData *ocDest, *ocRet;
- pexElementInfo *elemInfo;
- char *ocSrc;
- int i;
-
-
- /*
- * Allocate a buffer to hold the decoded OC data.
- */
-
- ocRet = (PEXOCData *) Xmalloc ((unsigned) (oc_count * sizeof (PEXOCData)));
-
-
- /*
- * Now, decode the OCs.
- */
-
- ocSrc = encoded_ocs;
- ocDest = ocRet;
-
- for (i = 0; i < oc_count; i++, ocDest++)
- {
- GET_STRUCT_PTR (pexElementInfo, ocSrc, elemInfo);
- ocDest->oc_type = elemInfo->elementType;
- (*PEX_decode_oc_funcs[elemInfo->elementType]) (float_format,
- &ocSrc, ocDest);
- }
-
-#ifdef DEBUG
- if (ocSrc - encoded_ocs != length)
- {
- printf ("PEXlib WARNING : Internal error in PEXDecodeOCs :\n");
- printf ("Number of bytes parsed not equal to size of input buffer.\n");
- }
-#endif
-
- return (ocRet);
-}
-
-
-void _PEXDecodeEnumType (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexMarkerType *oc;
-
- GET_STRUCT_PTR (pexMarkerType, *ocSrc, oc);
- *ocSrc += SIZEOF (pexMarkerType);
-
- ocDest->data.SetMarkerType.marker_type = oc->markerType;
-}
-
-
-void _PEXDecodeTableIndex (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexMarkerColorIndex *oc;
-
- GET_STRUCT_PTR (pexMarkerColorIndex, *ocSrc, oc);
- *ocSrc += SIZEOF (pexMarkerColorIndex);
-
- ocDest->data.SetMarkerColorIndex.index = oc->index;
-}
-
-
-void _PEXDecodeColor (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexMarkerColor *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexMarkerColor, *ocSrc, oc);
- *ocSrc += SIZEOF (pexMarkerColor);
-
- ocDest->data.SetMarkerColor.color_type = oc->colorType;
-
- EXTRACT_COLOR_VAL (*ocSrc, oc->colorType,
- ocDest->data.SetMarkerColor.color, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeFloat (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexMarkerScale *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexMarkerScale, *ocSrc, oc);
- *ocSrc += SIZEOF (pexMarkerScale);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->scale,
- ocDest->data.SetMarkerScale.scale, fpFormat);
- }
- else
- ocDest->data.SetMarkerScale.scale = oc->scale;
-}
-
-
-void _PEXDecodeCARD16 (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexTextPrecision *oc;
-
- GET_STRUCT_PTR (pexTextPrecision, *ocSrc, oc);
- *ocSrc += SIZEOF (pexTextPrecision);
-
- ocDest->data.SetTextPrecision.precision = oc->precision;
-}
-
-
-void _PEXDecodeVector2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexCharUpVector *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexCharUpVector, *ocSrc, oc);
- *ocSrc += SIZEOF (pexCharUpVector);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->up_x,
- ocDest->data.SetCharUpVector.vector.x, fpFormat);
- FP_CONVERT_NTOH (oc->up_y,
- ocDest->data.SetCharUpVector.vector.y, fpFormat);
- }
- else
- {
- ocDest->data.SetCharUpVector.vector.x = oc->up_x;
- ocDest->data.SetCharUpVector.vector.y = oc->up_y;
- }
-}
-
-
-void _PEXDecodeTextAlignment (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexTextAlignment *oc;
-
- GET_STRUCT_PTR (pexTextAlignment, *ocSrc, oc);
- *ocSrc += SIZEOF (pexTextAlignment);
-
- ocDest->data.SetTextAlignment.halignment = oc->alignment_horizontal;
- ocDest->data.SetTextAlignment.valignment = oc->alignment_vertical;
-}
-
-
-void _PEXDecodeCurveApprox (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexCurveApprox *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexCurveApprox, *ocSrc, oc);
- *ocSrc += SIZEOF (pexCurveApprox);
-
- ocDest->data.SetCurveApprox.method = oc->approxMethod;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->tolerance,
- ocDest->data.SetCurveApprox.tolerance, fpFormat);
- }
- else
- ocDest->data.SetCurveApprox.tolerance = oc->tolerance;
-}
-
-
-void _PEXDecodeReflectionAttr (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- *ocSrc += SIZEOF (pexElementInfo);
-
- EXTRACT_REFLECTION_ATTR (*ocSrc,
- ocDest->data.SetReflectionAttributes.attributes,
- fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeSurfaceApprox (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexSurfaceApprox *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexSurfaceApprox, *ocSrc, oc);
- *ocSrc += SIZEOF (pexSurfaceApprox);
-
- ocDest->data.SetSurfaceApprox.method = oc->approxMethod;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->uTolerance,
- ocDest->data.SetSurfaceApprox.utolerance, fpFormat);
- FP_CONVERT_NTOH (oc->vTolerance,
- ocDest->data.SetSurfaceApprox.vtolerance, fpFormat);
- }
- else
- {
- ocDest->data.SetSurfaceApprox.utolerance = oc->uTolerance;
- ocDest->data.SetSurfaceApprox.vtolerance = oc->vTolerance;
- }
-}
-
-
-void _PEXDecodeCullMode (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFacetCullingMode *oc;
-
- GET_STRUCT_PTR (pexFacetCullingMode, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFacetCullingMode);
-
- ocDest->data.SetFacetCullingMode.mode = oc->cullMode;
-}
-
-
-void _PEXDecodeSwitch (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFacetDistinguishFlag *oc;
-
- GET_STRUCT_PTR (pexFacetDistinguishFlag, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFacetDistinguishFlag);
-
- ocDest->data.SetFacetDistinguishFlag.flag = oc->distinguish;
-}
-
-
-void _PEXDecodePatternSize (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPatternSize *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexPatternSize, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPatternSize);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->size_x,
- ocDest->data.SetPatternSize.width, fpFormat);
- FP_CONVERT_NTOH (oc->size_y,
- ocDest->data.SetPatternSize.height, fpFormat);
- }
- else
- {
- ocDest->data.SetPatternSize.width = oc->size_x;
- ocDest->data.SetPatternSize.height = oc->size_y;
- }
-}
-
-
-
-void _PEXDecodePatternAttr2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPatternAttributes2D *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexPatternAttributes2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPatternAttributes2D);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->point_x,
- ocDest->data.SetPatternAttributes2D.ref_point.x, fpFormat);
- FP_CONVERT_NTOH (oc->point_y,
- ocDest->data.SetPatternAttributes2D.ref_point.y, fpFormat);
- }
- else
- {
- ocDest->data.SetPatternAttributes2D.ref_point.x = oc->point_x;
- ocDest->data.SetPatternAttributes2D.ref_point.y = oc->point_y;
- }
-}
-
-
-void _PEXDecodePatternAttr (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPatternAttributes *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexPatternAttributes, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPatternAttributes);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->refPt_x,
- ocDest->data.SetPatternAttributes.ref_point.x, fpFormat);
- FP_CONVERT_NTOH (oc->refPt_y,
- ocDest->data.SetPatternAttributes.ref_point.y, fpFormat);
- FP_CONVERT_NTOH (oc->refPt_z,
- ocDest->data.SetPatternAttributes.ref_point.z, fpFormat);
- FP_CONVERT_NTOH (oc->vector1_x,
- ocDest->data.SetPatternAttributes.vector1.x, fpFormat);
- FP_CONVERT_NTOH (oc->vector1_y,
- ocDest->data.SetPatternAttributes.vector1.y, fpFormat);
- FP_CONVERT_NTOH (oc->vector1_z,
- ocDest->data.SetPatternAttributes.vector1.z, fpFormat);
- FP_CONVERT_NTOH (oc->vector2_x,
- ocDest->data.SetPatternAttributes.vector2.x, fpFormat);
- FP_CONVERT_NTOH (oc->vector2_y,
- ocDest->data.SetPatternAttributes.vector2.y, fpFormat);
- FP_CONVERT_NTOH (oc->vector2_z,
- ocDest->data.SetPatternAttributes.vector2.z, fpFormat);
- }
- else
- {
- ocDest->data.SetPatternAttributes.ref_point.x = oc->refPt_x;
- ocDest->data.SetPatternAttributes.ref_point.y = oc->refPt_y;
- ocDest->data.SetPatternAttributes.ref_point.z = oc->refPt_z;
- ocDest->data.SetPatternAttributes.vector1.x = oc->vector1_x;
- ocDest->data.SetPatternAttributes.vector1.y = oc->vector1_y;
- ocDest->data.SetPatternAttributes.vector1.z = oc->vector1_z;
- ocDest->data.SetPatternAttributes.vector2.x = oc->vector2_x;
- ocDest->data.SetPatternAttributes.vector2.y = oc->vector2_y;
- ocDest->data.SetPatternAttributes.vector2.z = oc->vector2_z;
- }
-}
-
-
-void _PEXDecodeASF (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexIndividualASF *oc;
-
- GET_STRUCT_PTR (pexIndividualASF, *ocSrc, oc);
- *ocSrc += SIZEOF (pexIndividualASF);
-
- ocDest->data.SetIndividualASF.attribute = oc->attribute;
- ocDest->data.SetIndividualASF.asf = oc->source;
-}
-
-
-void _PEXDecodeLocalTransform (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- *ocSrc += SIZEOF (pexElementInfo);
-
- EXTRACT_CARD16 (*ocSrc, ocDest->data.SetLocalTransform.composition);
- *ocSrc += 2;
-
- EXTRACT_LISTOF_FLOAT32 (16, *ocSrc,
- ocDest->data.SetLocalTransform.transform, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeLocalTransform2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- *ocSrc += SIZEOF (pexElementInfo);
-
- EXTRACT_CARD16 (*ocSrc, ocDest->data.SetLocalTransform2D.composition);
- *ocSrc += 2;
-
- EXTRACT_LISTOF_FLOAT32 (9, *ocSrc,
- ocDest->data.SetLocalTransform2D.transform, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeGlobalTransform (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- *ocSrc += SIZEOF (pexElementInfo);
-
- EXTRACT_LISTOF_FLOAT32 (16, *ocSrc,
- ocDest->data.SetGlobalTransform.transform, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeGlobalTransform2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- *ocSrc += SIZEOF (pexElementInfo);
-
- EXTRACT_LISTOF_FLOAT32 (9, *ocSrc,
- ocDest->data.SetGlobalTransform2D.transform, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeModelClipVolume (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexModelClipVolume *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexModelClipVolume, *ocSrc, oc);
- *ocSrc += SIZEOF (pexModelClipVolume);
-
- ocDest->data.SetModelClipVolume.op = oc->modelClipOperator;
- ocDest->data.SetModelClipVolume.count = oc->numHalfSpaces;
-
- ocDest->data.SetModelClipVolume.half_spaces = (PEXHalfSpace *)
- Xmalloc ((unsigned) (oc->numHalfSpaces * sizeof (PEXHalfSpace)));
-
- EXTRACT_LISTOF_HALFSPACE3D (oc->numHalfSpaces, *ocSrc,
- ocDest->data.SetModelClipVolume.half_spaces, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeModelClipVolume2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexModelClipVolume2D *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexModelClipVolume2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexModelClipVolume2D);
-
- ocDest->data.SetModelClipVolume2D.op = oc->modelClipOperator;
- ocDest->data.SetModelClipVolume2D.count = oc->numHalfSpaces;
-
- ocDest->data.SetModelClipVolume2D.half_spaces = (PEXHalfSpace2D *)
- Xmalloc ((unsigned) (oc->numHalfSpaces * sizeof (PEXHalfSpace2D)));
-
- EXTRACT_LISTOF_HALFSPACE2D (oc->numHalfSpaces, *ocSrc,
- ocDest->data.SetModelClipVolume2D.half_spaces, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeRestoreModelClip (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- /* no data to decode */
-
- *ocSrc += SIZEOF (pexRestoreModelClipVolume);
-}
-
-
-void _PEXDecodeLightSourceState (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexLightSourceState *oc;
-
- GET_STRUCT_PTR (pexLightSourceState, *ocSrc, oc);
- *ocSrc += SIZEOF (pexLightSourceState);
-
- ocDest->data.SetLightSourceState.enable_count = oc->numEnable;
- ocDest->data.SetLightSourceState.disable_count = oc->numDisable;
-
- ocDest->data.SetLightSourceState.enable = (PEXTableIndex *)
- Xmalloc ((unsigned) (oc->numEnable * sizeof (PEXTableIndex)));
-
- ocDest->data.SetLightSourceState.disable = (PEXTableIndex *)
- Xmalloc ((unsigned) (oc->numDisable * sizeof (PEXTableIndex)));
-
- EXTRACT_LISTOF_CARD16 (oc->numEnable, *ocSrc,
- ocDest->data.SetLightSourceState.enable);
-
- if (oc->numEnable & 1)
- *ocSrc += 2;
-
- EXTRACT_LISTOF_CARD16 (oc->numDisable, *ocSrc,
- ocDest->data.SetLightSourceState.disable);
-
- if (oc->numDisable & 1)
- *ocSrc += 2;
-}
-
-
-void _PEXDecodeID (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPickID *oc;
-
- GET_STRUCT_PTR (pexPickID, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPickID);
-
- ocDest->data.SetPickID.pick_id = oc->pickId;
-}
-
-
-void _PEXDecodePSC (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexParaSurfCharacteristics *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexParaSurfCharacteristics, *ocSrc, oc);
- *ocSrc += SIZEOF (pexParaSurfCharacteristics);
-
- ocDest->data.SetParaSurfCharacteristics.psc_type = oc->characteristics;
-
- switch (oc->characteristics)
- {
- case PEXPSCIsoCurves:
- {
- EXTRACT_PSC_ISOCURVES (*ocSrc,
- ocDest->data.SetParaSurfCharacteristics.characteristics.iso_curves);
- break;
- }
-
- case PEXPSCMCLevelCurves:
- case PEXPSCWCLevelCurves:
- {
- PEXPSCLevelCurves *levelDest = (PEXPSCLevelCurves *)
- &ocDest->data.SetParaSurfCharacteristics.characteristics.level_curves;
-
- EXTRACT_PSC_LEVELCURVES (*ocSrc, (*levelDest), fpConvert, fpFormat);
-
- levelDest->parameters = (float *) Xmalloc (
- (unsigned) (sizeof (float) * levelDest->count));
-
- EXTRACT_LISTOF_FLOAT32 (levelDest->count, *ocSrc,
- levelDest->parameters, fpConvert, fpFormat);
- break;
- }
-
- default:
- *ocSrc += PADDED_BYTES (oc->length);
- break;
- }
-}
-
-
-void _PEXDecodeNameSet (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexElementInfo *elemInfo;
- unsigned count;
-
- GET_STRUCT_PTR (pexElementInfo, *ocSrc, elemInfo);
- *ocSrc += SIZEOF (pexElementInfo);
-
- ocDest->data.AddToNameSet.count = count = elemInfo->length - 1;
-
- ocDest->data.AddToNameSet.names =
- (PEXName *) Xmalloc (count * sizeof (PEXName));
-
- EXTRACT_LISTOF_CARD32 (count, *ocSrc, ocDest->data.AddToNameSet.names);
-}
-
-
-void _PEXDecodeExecuteStructure (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexExecuteStructure *oc;
-
- GET_STRUCT_PTR (pexExecuteStructure, *ocSrc, oc);
- *ocSrc += SIZEOF (pexExecuteStructure);
-
- ocDest->data.ExecuteStructure.structure = oc->id;
-}
-
-
-void _PEXDecodeLabel (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexLabel *oc;
-
- GET_STRUCT_PTR (pexLabel, *ocSrc, oc);
- *ocSrc += SIZEOF (pexLabel);
-
- ocDest->data.Label.label = oc->label;
-}
-
-
-void _PEXDecodeApplicationData (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexApplicationData *oc;
-
- GET_STRUCT_PTR (pexApplicationData, *ocSrc, oc);
- *ocSrc += SIZEOF (pexApplicationData);
-
- ocDest->data.ApplicationData.length = oc->numElements;
- ocDest->data.ApplicationData.data =
- (PEXPointer) Xmalloc ((unsigned) oc->numElements);
-
- memcpy (ocDest->data.ApplicationData.data, *ocSrc, oc->numElements);
- *ocSrc += PADDED_BYTES (oc->numElements);
-}
-
-
-void _PEXDecodeGSE (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexGSE *oc;
-
- GET_STRUCT_PTR (pexGSE, *ocSrc, oc);
- *ocSrc += SIZEOF (pexGSE);
-
- ocDest->data.GSE.id = oc->id;
- ocDest->data.GSE.length = oc->numElements;
- ocDest->data.GSE.data = (char *) Xmalloc ((unsigned) oc->numElements);
-
- memcpy (ocDest->data.GSE.data, *ocSrc, oc->numElements);
- *ocSrc += PADDED_BYTES (oc->numElements);
-}
-
-
-void _PEXDecodeMarkers (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexMarkers *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexMarkers, *ocSrc, oc);
- *ocSrc += SIZEOF (pexMarkers);
-
- ocDest->data.Markers.count = count =
- (SIZEOF (CARD32) * ((int) oc->oc_length - 1)) / SIZEOF (pexCoord3D);
-
- ocDest->data.Markers.points =
- (PEXCoord *) Xmalloc (count * sizeof (PEXCoord));
-
- EXTRACT_LISTOF_COORD3D (count, *ocSrc,
- ocDest->data.Markers.points, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeMarkers2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexMarkers2D *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexMarkers2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexMarkers2D);
-
- ocDest->data.Markers2D.count = count =
- (SIZEOF (CARD32) * ((int) oc->oc_length - 1)) / SIZEOF (pexCoord2D);
-
- ocDest->data.Markers2D.points =
- (PEXCoord2D *) Xmalloc (count * sizeof (PEXCoord2D));
-
- EXTRACT_LISTOF_COORD2D (count, *ocSrc,
- ocDest->data.Markers2D.points, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodePolyline (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPolyline *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexPolyline, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPolyline);
-
- ocDest->data.Polyline.count = count =
- (SIZEOF (CARD32) * ((int) oc->oc_length - 1)) / SIZEOF (pexCoord3D);
-
- ocDest->data.Polyline.points =
- (PEXCoord *) Xmalloc (count * sizeof (PEXCoord));
-
- EXTRACT_LISTOF_COORD3D (count, *ocSrc,
- ocDest->data.Polyline.points, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodePolyline2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPolyline2D *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexPolyline2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPolyline2D);
-
- ocDest->data.Polyline2D.count = count =
- (SIZEOF (CARD32) * ((int) oc->oc_length - 1)) / SIZEOF (pexCoord2D);
-
- ocDest->data.Polyline2D.points =
- (PEXCoord2D *) Xmalloc (count * sizeof (PEXCoord2D));
-
- EXTRACT_LISTOF_COORD2D (count, *ocSrc,
- ocDest->data.Polyline2D.points, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeText (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- /* Text is always mono encoded */
-
- pexText *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexText, *ocSrc, oc);
- *ocSrc += SIZEOF (pexText);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->origin_x,
- ocDest->data.EncodedText.origin.x, fpFormat);
- FP_CONVERT_NTOH (oc->origin_y,
- ocDest->data.EncodedText.origin.y, fpFormat);
- FP_CONVERT_NTOH (oc->origin_z,
- ocDest->data.EncodedText.origin.z, fpFormat);
- FP_CONVERT_NTOH (oc->vector1_x,
- ocDest->data.EncodedText.vector1.x, fpFormat);
- FP_CONVERT_NTOH (oc->vector1_y,
- ocDest->data.EncodedText.vector1.y, fpFormat);
- FP_CONVERT_NTOH (oc->vector1_z,
- ocDest->data.EncodedText.vector1.z, fpFormat);
- FP_CONVERT_NTOH (oc->vector2_x,
- ocDest->data.EncodedText.vector2.x, fpFormat);
- FP_CONVERT_NTOH (oc->vector2_y,
- ocDest->data.EncodedText.vector2.y, fpFormat);
- FP_CONVERT_NTOH (oc->vector2_z,
- ocDest->data.EncodedText.vector2.z, fpFormat);
- }
- else
- {
- ocDest->data.EncodedText.origin.x = oc->origin_x;
- ocDest->data.EncodedText.origin.y = oc->origin_y;
- ocDest->data.EncodedText.origin.z = oc->origin_z;
- ocDest->data.EncodedText.vector1.x = oc->vector1_x;
- ocDest->data.EncodedText.vector1.y = oc->vector1_y;
- ocDest->data.EncodedText.vector1.z = oc->vector1_z;
- ocDest->data.EncodedText.vector2.x = oc->vector2_x;
- ocDest->data.EncodedText.vector2.y = oc->vector2_y;
- ocDest->data.EncodedText.vector2.z = oc->vector2_z;
- }
-
- ocDest->data.EncodedText.count = oc->numEncodings;
-
- ocDest->data.EncodedText.encoded_text = (PEXEncodedTextData *)
- Xmalloc ((unsigned) (oc->numEncodings * sizeof (PEXEncodedTextData)));
-
- EXTRACT_LISTOF_MONOENCODING (oc->numEncodings,
- *ocSrc, ocDest->data.EncodedText.encoded_text);
-}
-
-
-void _PEXDecodeText2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- /* Text is always mono encoded */
-
- pexText2D *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexText2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexText2D);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->origin_x,
- ocDest->data.EncodedText2D.origin.x, fpFormat);
- FP_CONVERT_NTOH (oc->origin_y,
- ocDest->data.EncodedText2D.origin.y, fpFormat);
- }
- else
- {
- ocDest->data.EncodedText2D.origin.x = oc->origin_x;
- ocDest->data.EncodedText2D.origin.y = oc->origin_y;
- }
-
- ocDest->data.EncodedText2D.count = oc->numEncodings;
-
- ocDest->data.EncodedText2D.encoded_text = (PEXEncodedTextData *)
- Xmalloc ((unsigned) (oc->numEncodings * sizeof (PEXEncodedTextData)));
-
- EXTRACT_LISTOF_MONOENCODING (oc->numEncodings,
- *ocSrc, ocDest->data.EncodedText2D.encoded_text);
-}
-
-
-void _PEXDecodeAnnoText (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- /* Anno Text is always mono encoded */
-
- pexAnnotationText *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexAnnotationText, *ocSrc, oc);
- *ocSrc += SIZEOF (pexAnnotationText);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->origin_x,
- ocDest->data.EncodedAnnoText.origin.x, fpFormat);
- FP_CONVERT_NTOH (oc->origin_y,
- ocDest->data.EncodedAnnoText.origin.y, fpFormat);
- FP_CONVERT_NTOH (oc->origin_z,
- ocDest->data.EncodedAnnoText.origin.z, fpFormat);
- FP_CONVERT_NTOH (oc->offset_x,
- ocDest->data.EncodedAnnoText.offset.x, fpFormat);
- FP_CONVERT_NTOH (oc->offset_y,
- ocDest->data.EncodedAnnoText.offset.y, fpFormat);
- FP_CONVERT_NTOH (oc->offset_z,
- ocDest->data.EncodedAnnoText.offset.z, fpFormat);
- }
- else
- {
- ocDest->data.EncodedAnnoText.origin.x = oc->origin_x;
- ocDest->data.EncodedAnnoText.origin.y = oc->origin_y;
- ocDest->data.EncodedAnnoText.origin.z = oc->origin_z;
- ocDest->data.EncodedAnnoText.offset.x = oc->offset_x;
- ocDest->data.EncodedAnnoText.offset.y = oc->offset_y;
- ocDest->data.EncodedAnnoText.offset.z = oc->offset_z;
- }
-
- ocDest->data.EncodedAnnoText.count = oc->numEncodings;
-
- ocDest->data.EncodedAnnoText.encoded_text = (PEXEncodedTextData *)
- Xmalloc ((unsigned) (oc->numEncodings * sizeof (PEXEncodedTextData)));
-
- EXTRACT_LISTOF_MONOENCODING (oc->numEncodings,
- *ocSrc, ocDest->data.EncodedAnnoText.encoded_text);
-}
-
-
-void _PEXDecodeAnnoText2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- /* Anno Text is always mono encoded */
-
- pexAnnotationText2D *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexAnnotationText2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexAnnotationText2D);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->origin_x,
- ocDest->data.EncodedAnnoText2D.origin.x, fpFormat);
- FP_CONVERT_NTOH (oc->origin_y,
- ocDest->data.EncodedAnnoText2D.origin.y, fpFormat);
- FP_CONVERT_NTOH (oc->offset_x,
- ocDest->data.EncodedAnnoText2D.offset.x, fpFormat);
- FP_CONVERT_NTOH (oc->offset_y,
- ocDest->data.EncodedAnnoText2D.offset.y, fpFormat);
- }
- else
- {
- ocDest->data.EncodedAnnoText2D.origin.x = oc->origin_x;
- ocDest->data.EncodedAnnoText2D.origin.y = oc->origin_y;
- ocDest->data.EncodedAnnoText2D.offset.x = oc->offset_x;
- ocDest->data.EncodedAnnoText2D.offset.y = oc->offset_y;
- }
-
- ocDest->data.EncodedAnnoText2D.count = oc->numEncodings;
-
- ocDest->data.EncodedAnnoText2D.encoded_text = (PEXEncodedTextData *)
- Xmalloc ((unsigned) (oc->numEncodings * sizeof (PEXEncodedTextData)));
-
- EXTRACT_LISTOF_MONOENCODING (oc->numEncodings,
- *ocSrc, ocDest->data.EncodedAnnoText2D.encoded_text);
-}
-
-
-void _PEXDecodePolylineSet (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexPolylineSetWithData *oc;
- PEXListOfVertex *plset;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
- int vertexSize;
- int i;
-
- GET_STRUCT_PTR (pexPolylineSetWithData, *ocSrc, oc);
- *ocSrc += SIZEOF (pexPolylineSetWithData);
-
- ocDest->data.PolylineSetWithData.vertex_attributes = oc->vertexAttribs;
- ocDest->data.PolylineSetWithData.color_type = oc->colorType;
- ocDest->data.PolylineSetWithData.count = oc->numLists;
-
- ocDest->data.PolylineSetWithData.vertex_lists = plset = (PEXListOfVertex *)
- Xmalloc ((unsigned) (oc->numLists * sizeof (PEXListOfVertex)));
-
- vertexSize = GetClientVertexSize (oc->colorType, oc->vertexAttribs);
-
- for (i = 0; i < oc->numLists; i++, plset++)
- {
- EXTRACT_CARD32 (*ocSrc, plset->count);
-
- plset->vertices.no_data = (PEXCoord *) Xmalloc (
- (unsigned) (plset->count * vertexSize));
-
- EXTRACT_LISTOF_VERTEX (plset->count, *ocSrc, vertexSize,
- oc->colorType, oc->vertexAttribs,
- plset->vertices, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXDecodeNURBCurve (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexNURBCurve *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexNURBCurve, *ocSrc, oc);
- *ocSrc += SIZEOF (pexNURBCurve);
-
- ocDest->data.NURBCurve.rationality = oc->coordType;
- ocDest->data.NURBCurve.order = oc->curveOrder;
- ocDest->data.NURBCurve.count = oc->numPoints;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->tmin, ocDest->data.NURBCurve.tmin, fpFormat);
- FP_CONVERT_NTOH (oc->tmax, ocDest->data.NURBCurve.tmax, fpFormat);
- }
- else
- {
- ocDest->data.NURBCurve.tmin = oc->tmin;
- ocDest->data.NURBCurve.tmax = oc->tmax;
- }
-
- ocDest->data.NURBCurve.knots =
- (float *) Xmalloc ((unsigned) (oc->numKnots * sizeof (float)));
-
- EXTRACT_LISTOF_FLOAT32 (oc->numKnots, *ocSrc,
- ocDest->data.NURBCurve.knots, fpConvert, fpFormat);
-
- if (oc->coordType == PEXRational)
- {
- ocDest->data.NURBCurve.points.point_4d = (PEXCoord4D *) Xmalloc (
- (unsigned) (oc->numPoints * sizeof (PEXCoord4D)));
-
- EXTRACT_LISTOF_COORD4D (oc->numPoints, *ocSrc,
- ocDest->data.NURBCurve.points.point_4d, fpConvert, fpFormat);
- }
- else
- {
- ocDest->data.NURBCurve.points.point = (PEXCoord *) Xmalloc (
- (unsigned) (oc->numPoints * sizeof (PEXCoord)));
-
- EXTRACT_LISTOF_COORD3D (oc->numPoints, *ocSrc,
- ocDest->data.NURBCurve.points.point, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXDecodeFillArea (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFillArea *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexFillArea, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFillArea);
-
- ocDest->data.FillArea.shape_hint = oc->shape;
- ocDest->data.FillArea.ignore_edges = oc->ignoreEdges;
-
- ocDest->data.FillArea.count = count =
- (SIZEOF (CARD32) * ((int) oc->oc_length - 2)) / SIZEOF (pexCoord3D);
-
- ocDest->data.FillArea.points =
- (PEXCoord *) Xmalloc (count * sizeof (PEXCoord));
-
- EXTRACT_LISTOF_COORD3D (count, *ocSrc,
- ocDest->data.FillArea.points, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeFillArea2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFillArea2D *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexFillArea2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFillArea2D);
-
- ocDest->data.FillArea2D.shape_hint = oc->shape;
- ocDest->data.FillArea2D.ignore_edges = oc->ignoreEdges;
-
- ocDest->data.FillArea2D.count = count =
- (SIZEOF (CARD32) * ((int) oc->oc_length - 2)) / SIZEOF (pexCoord2D);
-
- ocDest->data.FillArea2D.points =
- (PEXCoord2D *) Xmalloc (count * sizeof (PEXCoord2D));
-
- EXTRACT_LISTOF_COORD2D (count, *ocSrc,
- ocDest->data.FillArea2D.points, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeFillAreaWithData (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFillAreaWithData *oc;
- CARD32 count;
- int vertexSize;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexFillAreaWithData, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFillAreaWithData);
-
- ocDest->data.FillAreaWithData.shape_hint = oc->shape;
- ocDest->data.FillAreaWithData.ignore_edges = oc->ignoreEdges;
- ocDest->data.FillAreaWithData.facet_attributes = oc->facetAttribs;
- ocDest->data.FillAreaWithData.vertex_attributes = oc->vertexAttribs;
- ocDest->data.FillAreaWithData.color_type = oc->colorType;
-
- if (oc->facetAttribs)
- {
- EXTRACT_FACET (*ocSrc, oc->colorType, oc->facetAttribs,
- ocDest->data.FillAreaWithData.facet_data, fpConvert, fpFormat);
- }
-
- EXTRACT_CARD32 (*ocSrc, count);
- ocDest->data.FillAreaWithData.count = count;
-
- vertexSize = GetClientVertexSize (oc->colorType, oc->vertexAttribs);
-
- ocDest->data.FillAreaWithData.vertices.no_data =
- (PEXCoord *) Xmalloc ((unsigned) (count * vertexSize));
-
- EXTRACT_LISTOF_VERTEX (count, *ocSrc, vertexSize,
- oc->colorType, oc->vertexAttribs,
- ocDest->data.FillAreaWithData.vertices, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeFillAreaSet (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFillAreaSet *oc;
- PEXListOfCoord *pList;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
- int i;
-
- GET_STRUCT_PTR (pexFillAreaSet, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFillAreaSet);
-
- ocDest->data.FillAreaSet.shape_hint = oc->shape;
- ocDest->data.FillAreaSet.ignore_edges = oc->ignoreEdges;
- ocDest->data.FillAreaSet.contour_hint = oc->contourHint;
- ocDest->data.FillAreaSet.count = oc->numLists;
-
- ocDest->data.FillAreaSet.point_lists = pList = (PEXListOfCoord *)
- Xmalloc ((unsigned) (oc->numLists * sizeof (PEXListOfCoord)));
-
- for (i = 0; i < oc->numLists; i++, pList++)
- {
- EXTRACT_CARD32 (*ocSrc, pList->count);
-
- pList->points = (PEXCoord *)
- Xmalloc ((unsigned) (pList->count * sizeof (PEXCoord)));
-
- EXTRACT_LISTOF_COORD3D (pList->count, *ocSrc,
- pList->points, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXDecodeFillAreaSet2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFillAreaSet2D *oc;
- PEXListOfCoord2D *pList;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
- int i;
-
- GET_STRUCT_PTR (pexFillAreaSet2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFillAreaSet2D);
-
- ocDest->data.FillAreaSet2D.shape_hint = oc->shape;
- ocDest->data.FillAreaSet2D.ignore_edges = oc->ignoreEdges;
- ocDest->data.FillAreaSet2D.contour_hint = oc->contourHint;
- ocDest->data.FillAreaSet2D.count = oc->numLists;
-
- ocDest->data.FillAreaSet2D.point_lists = pList = (PEXListOfCoord2D *)
- Xmalloc ((unsigned) (oc->numLists * sizeof (PEXListOfCoord2D)));
-
- for (i = 0; i < oc->numLists; i++, pList++)
- {
- EXTRACT_CARD32 (*ocSrc, pList->count);
-
- pList->points = (PEXCoord2D *)
- Xmalloc ((unsigned) (pList->count * sizeof (PEXCoord2D)));
-
- EXTRACT_LISTOF_COORD2D (pList->count, *ocSrc,
- pList->points, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXDecodeFillAreaSetWithData (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexFillAreaSetWithData *oc;
- PEXListOfVertex *pList;
- int vertexSize, i;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexFillAreaSetWithData, *ocSrc, oc);
- *ocSrc += SIZEOF (pexFillAreaSetWithData);
-
- ocDest->data.FillAreaSetWithData.shape_hint = oc->shape;
- ocDest->data.FillAreaSetWithData.ignore_edges = oc->ignoreEdges;
- ocDest->data.FillAreaSetWithData.contour_hint = oc->contourHint;
- ocDest->data.FillAreaSetWithData.facet_attributes = oc->facetAttribs;
- ocDest->data.FillAreaSetWithData.vertex_attributes = oc->vertexAttribs;
- ocDest->data.FillAreaSetWithData.color_type = oc->colorType;
-
- if (oc->facetAttribs)
- {
- EXTRACT_FACET (*ocSrc, oc->colorType, oc->facetAttribs,
- ocDest->data.FillAreaSetWithData.facet_data, fpConvert, fpFormat);
- }
-
- ocDest->data.FillAreaSetWithData.count = oc->numLists;
- ocDest->data.FillAreaSetWithData.vertex_lists = pList = (PEXListOfVertex *)
- Xmalloc ((unsigned) (oc->numLists * sizeof (PEXListOfVertex)));
-
- vertexSize = GetClientVertexSize (oc->colorType, oc->vertexAttribs);
- if (oc->vertexAttribs & PEXGAEdges)
- vertexSize += sizeof (unsigned int);
-
- for (i = 0; i < oc->numLists; i++, pList++)
- {
- EXTRACT_CARD32 (*ocSrc, pList->count);
-
- pList->vertices.no_data = (PEXCoord *) Xmalloc (
- (unsigned) (pList->count * vertexSize));
-
- EXTRACT_LISTOF_VERTEX (pList->count, *ocSrc, vertexSize,
- oc->colorType, oc->vertexAttribs,
- pList->vertices, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXDecodeTriangleStrip (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexTriangleStrip *oc;
- int facetSize;
- int vertexSize;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexTriangleStrip, *ocSrc, oc);
- *ocSrc += SIZEOF (pexTriangleStrip);
-
- ocDest->data.TriangleStrip.facet_attributes = oc->facetAttribs;
- ocDest->data.TriangleStrip.vertex_attributes = oc->vertexAttribs;
- ocDest->data.TriangleStrip.color_type = oc->colorType;
- ocDest->data.TriangleStrip.count = oc->numVertices;
-
- if (oc->facetAttribs)
- {
- facetSize = GetClientFacetSize (oc->colorType, oc->facetAttribs);
-
- ocDest->data.TriangleStrip.facet_data.index = (PEXColorIndexed *)
- Xmalloc ((unsigned) ((oc->numVertices - 2) * facetSize));
-
- EXTRACT_LISTOF_FACET ((oc->numVertices - 2), *ocSrc, facetSize,
- oc->colorType, oc->facetAttribs,
- ocDest->data.TriangleStrip.facet_data, fpConvert, fpFormat);
- }
- else
- ocDest->data.TriangleStrip.facet_data.index = NULL;
-
- vertexSize = GetClientVertexSize (oc->colorType, oc->vertexAttribs);
-
- ocDest->data.TriangleStrip.vertices.no_data =
- (PEXCoord *) Xmalloc ((unsigned) (oc->numVertices * vertexSize));
-
- EXTRACT_LISTOF_VERTEX (oc->numVertices, *ocSrc, vertexSize,
- oc->colorType, oc->vertexAttribs,
- ocDest->data.TriangleStrip.vertices, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeQuadMesh (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexQuadrilateralMesh *oc;
- int count;
- int facetSize;
- int vertexSize;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexQuadrilateralMesh, *ocSrc, oc);
- *ocSrc += SIZEOF (pexQuadrilateralMesh);
-
- ocDest->data.QuadrilateralMesh.shape_hint = oc->shape;
- ocDest->data.QuadrilateralMesh.facet_attributes = oc->facetAttribs;
- ocDest->data.QuadrilateralMesh.vertex_attributes = oc->vertexAttribs;
- ocDest->data.QuadrilateralMesh.color_type = oc->colorType;
- ocDest->data.QuadrilateralMesh.col_count = oc->mPts;
- ocDest->data.QuadrilateralMesh.row_count = oc->nPts;
-
- if (oc->facetAttribs)
- {
- facetSize = GetClientFacetSize (oc->colorType, oc->facetAttribs);
-
- count = (oc->mPts - 1) * (oc->nPts - 1);
- ocDest->data.QuadrilateralMesh.facet_data.index =
- (PEXColorIndexed *) Xmalloc ((unsigned) (count * facetSize));
-
- EXTRACT_LISTOF_FACET (count, *ocSrc, facetSize,
- oc->colorType, oc->facetAttribs,
- ocDest->data.QuadrilateralMesh.facet_data, fpConvert, fpFormat);
- }
- else
- ocDest->data.QuadrilateralMesh.facet_data.index = NULL;
-
- vertexSize = GetClientVertexSize (oc->colorType, oc->vertexAttribs);
-
- count = oc->mPts * oc->nPts;
- ocDest->data.QuadrilateralMesh.vertices.no_data =
- (PEXCoord *) Xmalloc ((unsigned) (count * vertexSize));
-
- EXTRACT_LISTOF_VERTEX (count, *ocSrc, vertexSize,
- oc->colorType, oc->vertexAttribs,
- ocDest->data.QuadrilateralMesh.vertices, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeSOFA (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexSetOfFillAreaSets *oc;
- PEXConnectivityData *pCon;
- PEXListOfUShort *pList;
- int cbytes;
- int facetSize;
- int vertexSize;
- int i, j;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexSetOfFillAreaSets, *ocSrc, oc);
- *ocSrc += SIZEOF (pexSetOfFillAreaSets);
-
- ocDest->data.SetOfFillAreaSets.shape_hint = oc->shape;
- ocDest->data.SetOfFillAreaSets.facet_attributes = oc->FAS_Attributes;
- ocDest->data.SetOfFillAreaSets.vertex_attributes = oc->vertexAttributes;
- ocDest->data.SetOfFillAreaSets.edge_attributes =
- (oc->edgeAttributes == PEXOn) ? PEXGAEdges : 0;
- ocDest->data.SetOfFillAreaSets.contour_hint = oc->contourHint;
- ocDest->data.SetOfFillAreaSets.contours_all_one = oc->contourCountsFlag;
- ocDest->data.SetOfFillAreaSets.color_type = oc->colorType;
- ocDest->data.SetOfFillAreaSets.set_count = oc->numFAS;
- ocDest->data.SetOfFillAreaSets.vertex_count = oc->numVertices;
- ocDest->data.SetOfFillAreaSets.index_count = oc->numEdges;
-
- if (oc->FAS_Attributes)
- {
- facetSize = GetClientFacetSize (oc->colorType, oc->FAS_Attributes);
-
- ocDest->data.SetOfFillAreaSets.facet_data.index =
- (PEXColorIndexed *) Xmalloc ((unsigned) (oc->numFAS * facetSize));
-
- EXTRACT_LISTOF_FACET (oc->numFAS, *ocSrc, facetSize,
- oc->colorType, oc->FAS_Attributes,
- ocDest->data.SetOfFillAreaSets.facet_data, fpConvert, fpFormat);
- }
- else
- ocDest->data.SetOfFillAreaSets.facet_data.index = NULL;
-
- vertexSize = GetClientVertexSize (oc->colorType, oc->vertexAttributes);
-
- ocDest->data.SetOfFillAreaSets.vertices.no_data =
- (PEXCoord *) Xmalloc ((unsigned) (oc->numVertices * vertexSize));
-
- EXTRACT_LISTOF_VERTEX (oc->numVertices, *ocSrc, vertexSize,
- oc->colorType, oc->vertexAttributes,
- ocDest->data.SetOfFillAreaSets.vertices, fpConvert, fpFormat);
-
- if (oc->edgeAttributes)
- {
- unsigned int size = oc->numEdges * sizeof (CARD8);
- ocDest->data.SetOfFillAreaSets.edge_flags =
- (PEXSwitch *) Xmalloc (size);
- memcpy (ocDest->data.SetOfFillAreaSets.edge_flags, *ocSrc, size);
- *ocSrc += PADDED_BYTES (size);
- }
- else
- ocDest->data.SetOfFillAreaSets.edge_flags = NULL;
-
- ocDest->data.SetOfFillAreaSets.connectivity = pCon =
- (PEXConnectivityData *) Xmalloc ((unsigned) (oc->numFAS *
- sizeof (PEXConnectivityData)));
-
- for (i = 0; i < (int) oc->numFAS; i++, pCon++)
- {
- EXTRACT_CARD16 (*ocSrc, pCon->count);
-
- pCon->lists = pList = (PEXListOfUShort *)
- Xmalloc ((unsigned) (pCon->count * sizeof (PEXListOfUShort)));
-
- for (j = 0; j < (int) pCon->count; j++, pList++)
- {
- EXTRACT_CARD16 (*ocSrc, pList->count);
-
- pList->shorts = (unsigned short *) Xmalloc (
- (unsigned) (pList->count * sizeof (unsigned short)));
-
- EXTRACT_LISTOF_CARD16 (pList->count, *ocSrc, pList->shorts);
- }
- }
-
- cbytes = SIZEOF (CARD16) * (oc->numFAS + oc->numContours + oc->numEdges);
- *ocSrc += PAD (cbytes);
-}
-
-
-void _PEXDecodeNURBSurface (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexNURBSurface *oc;
- PEXListOfTrimCurve *pList;
- pexTrimCurve *trimSrc;
- PEXTrimCurve *trimDest;
- unsigned count;
- int i, j;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexNURBSurface, *ocSrc, oc);
- *ocSrc += SIZEOF (pexNURBSurface);
-
- ocDest->data.NURBSurface.rationality = oc->type;
- ocDest->data.NURBSurface.uorder = oc->uOrder;
- ocDest->data.NURBSurface.vorder = oc->vOrder;
- ocDest->data.NURBSurface.col_count = oc->mPts;
- ocDest->data.NURBSurface.row_count = oc->nPts;
-
- count = oc->uOrder + oc->mPts;
- ocDest->data.NURBSurface.uknots =
- (float *) Xmalloc (count * sizeof (float));
-
- EXTRACT_LISTOF_FLOAT32 (count, *ocSrc,
- ocDest->data.NURBSurface.uknots, fpConvert, fpFormat);
-
- count = oc->vOrder + oc->nPts;
- ocDest->data.NURBSurface.vknots =
- (float *) Xmalloc (count * sizeof (float));
-
- EXTRACT_LISTOF_FLOAT32 (count, *ocSrc,
- ocDest->data.NURBSurface.vknots, fpConvert, fpFormat);
-
- count = oc->mPts * oc->nPts;
-
- if (oc->type == PEXRational)
- {
- ocDest->data.NURBSurface.points.point_4d =
- (PEXCoord4D *) Xmalloc (count * sizeof (PEXCoord4D));
-
- EXTRACT_LISTOF_COORD4D (count, *ocSrc,
- ocDest->data.NURBSurface.points.point_4d, fpConvert, fpFormat);
- }
- else
- {
- ocDest->data.NURBSurface.points.point =
- (PEXCoord *) Xmalloc (count * sizeof (PEXCoord));
-
- EXTRACT_LISTOF_COORD3D (count, *ocSrc,
- ocDest->data.NURBSurface.points.point, fpConvert, fpFormat);
- }
-
- ocDest->data.NURBSurface.curve_count = oc->numLists;
- ocDest->data.NURBSurface.trim_curves = pList = (PEXListOfTrimCurve *)
- Xmalloc ((unsigned) (oc->numLists * sizeof (PEXListOfTrimCurve)));
-
- for (i = 0; i < oc->numLists; i++, pList++)
- {
- EXTRACT_CARD32 (*ocSrc, pList->count);
-
- pList->curves = trimDest = (PEXTrimCurve *)
- Xmalloc ((unsigned) (pList->count * sizeof (PEXTrimCurve)));
-
- for (j = 0; j < (int) pList->count; j++, trimDest++)
- {
- GET_STRUCT_PTR (pexTrimCurve, *ocSrc, trimSrc);
- *ocSrc += SIZEOF (pexTrimCurve);
-
- trimDest->visibility = trimSrc->visibility;
- trimDest->order = trimSrc->order;
- trimDest->rationality = trimSrc->type;
- trimDest->approx_method = trimSrc->approxMethod;
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (trimSrc->tolerance,
- trimDest->tolerance, fpFormat);
- FP_CONVERT_NTOH (trimSrc->tMin, trimDest->tmin, fpFormat);
- FP_CONVERT_NTOH (trimSrc->tMax, trimDest->tmax, fpFormat);
- }
- else
- {
- trimDest->tolerance = trimSrc->tolerance;
- trimDest->tmin = trimSrc->tMin;
- trimDest->tmax = trimSrc->tMax;
- }
-
- count = trimSrc->order + trimSrc->numCoord;
- trimDest->knots.count = count;
- trimDest->knots.floats =
- (float *) Xmalloc (count * sizeof (float));
-
- EXTRACT_LISTOF_FLOAT32 (count, *ocSrc,
- trimDest->knots.floats, fpConvert, fpFormat);
-
- trimDest->count = trimSrc->numCoord;
-
- if (trimSrc->type == PEXRational)
- {
- trimDest->control_points.point = (PEXCoord *) Xmalloc (
- (unsigned) (trimSrc->numCoord * sizeof (PEXCoord)));
-
- EXTRACT_LISTOF_COORD3D (trimSrc->numCoord, *ocSrc,
- trimDest->control_points.point, fpConvert, fpFormat);
- }
- else
- {
- trimDest->control_points.point_2d = (PEXCoord2D *) Xmalloc (
- (unsigned) (trimSrc->numCoord * sizeof (PEXCoord2D)));
-
- EXTRACT_LISTOF_COORD2D (trimSrc->numCoord, *ocSrc,
- trimDest->control_points.point_2d, fpConvert, fpFormat);
- }
- }
- }
-}
-
-
-void _PEXDecodeCellArray (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexCellArray *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
-
- GET_STRUCT_PTR (pexCellArray, *ocSrc, oc);
- *ocSrc += SIZEOF (pexCellArray);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->point1_x,
- ocDest->data.CellArray.point1.x, fpFormat);
- FP_CONVERT_NTOH (oc->point1_y,
- ocDest->data.CellArray.point1.y, fpFormat);
- FP_CONVERT_NTOH (oc->point1_z,
- ocDest->data.CellArray.point1.z, fpFormat);
- FP_CONVERT_NTOH (oc->point2_x,
- ocDest->data.CellArray.point2.x, fpFormat);
- FP_CONVERT_NTOH (oc->point2_y,
- ocDest->data.CellArray.point2.y, fpFormat);
- FP_CONVERT_NTOH (oc->point2_z,
- ocDest->data.CellArray.point2.z, fpFormat);
- FP_CONVERT_NTOH (oc->point3_x,
- ocDest->data.CellArray.point3.x, fpFormat);
- FP_CONVERT_NTOH (oc->point3_y,
- ocDest->data.CellArray.point3.y, fpFormat);
- FP_CONVERT_NTOH (oc->point3_z,
- ocDest->data.CellArray.point3.z, fpFormat);
- }
- else
- {
- ocDest->data.CellArray.point1.x = oc->point1_x;
- ocDest->data.CellArray.point1.y = oc->point1_y;
- ocDest->data.CellArray.point1.z = oc->point1_z;
- ocDest->data.CellArray.point2.x = oc->point2_x;
- ocDest->data.CellArray.point2.y = oc->point2_y;
- ocDest->data.CellArray.point2.z = oc->point2_z;
- ocDest->data.CellArray.point3.x = oc->point3_x;
- ocDest->data.CellArray.point3.y = oc->point3_y;
- ocDest->data.CellArray.point3.z = oc->point3_z;
- }
-
- ocDest->data.CellArray.col_count = oc->dx;
- ocDest->data.CellArray.row_count = oc->dy;
-
- count = oc->dx * oc->dy;
- ocDest->data.CellArray.color_indices =
- (PEXTableIndex *) Xmalloc (count * sizeof (PEXTableIndex));
-
- EXTRACT_LISTOF_CARD16 (count, *ocSrc,
- ocDest->data.CellArray.color_indices);
-
- if (count & 1)
- *ocSrc += 2;
-}
-
-
-void _PEXDecodeCellArray2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexCellArray2D *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
-
- GET_STRUCT_PTR (pexCellArray2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexCellArray2D);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->point1_x,
- ocDest->data.CellArray2D.point1.x, fpFormat);
- FP_CONVERT_NTOH (oc->point1_y,
- ocDest->data.CellArray2D.point1.y, fpFormat);
- FP_CONVERT_NTOH (oc->point2_x,
- ocDest->data.CellArray2D.point2.x, fpFormat);
- FP_CONVERT_NTOH (oc->point2_y,
- ocDest->data.CellArray2D.point2.y, fpFormat);
- }
- else
- {
- ocDest->data.CellArray2D.point1.x = oc->point1_x;
- ocDest->data.CellArray2D.point1.y = oc->point1_y;
- ocDest->data.CellArray2D.point2.x = oc->point2_x;
- ocDest->data.CellArray2D.point2.y = oc->point2_y;
- }
-
- ocDest->data.CellArray2D.col_count = oc->dx;
- ocDest->data.CellArray2D.row_count = oc->dy;
-
- count = oc->dx * oc->dy;
- ocDest->data.CellArray2D.color_indices =
- (PEXTableIndex *) Xmalloc (count * sizeof (PEXTableIndex));
-
- EXTRACT_LISTOF_CARD16 (count, *ocSrc,
- ocDest->data.CellArray2D.color_indices);
-
- if (count & 1)
- *ocSrc += 2;
-}
-
-
-void _PEXDecodeExtendedCellArray (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexExtendedCellArray *oc;
- unsigned count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexExtendedCellArray, *ocSrc, oc);
- *ocSrc += SIZEOF (pexExtendedCellArray);
-
- if (fpConvert)
- {
- FP_CONVERT_NTOH (oc->point1_x,
- ocDest->data.ExtendedCellArray.point1.x, fpFormat);
- FP_CONVERT_NTOH (oc->point1_y,
- ocDest->data.ExtendedCellArray.point1.y, fpFormat);
- FP_CONVERT_NTOH (oc->point1_z,
- ocDest->data.ExtendedCellArray.point1.z, fpFormat);
- FP_CONVERT_NTOH (oc->point2_x,
- ocDest->data.ExtendedCellArray.point2.x, fpFormat);
- FP_CONVERT_NTOH (oc->point2_y,
- ocDest->data.ExtendedCellArray.point2.y, fpFormat);
- FP_CONVERT_NTOH (oc->point2_z,
- ocDest->data.ExtendedCellArray.point2.z, fpFormat);
- FP_CONVERT_NTOH (oc->point3_x,
- ocDest->data.ExtendedCellArray.point3.x, fpFormat);
- FP_CONVERT_NTOH (oc->point3_y,
- ocDest->data.ExtendedCellArray.point3.y, fpFormat);
- FP_CONVERT_NTOH (oc->point3_z,
- ocDest->data.ExtendedCellArray.point3.z, fpFormat);
- }
- else
- {
- ocDest->data.ExtendedCellArray.point1.x = oc->point1_x;
- ocDest->data.ExtendedCellArray.point1.y = oc->point1_y;
- ocDest->data.ExtendedCellArray.point1.z = oc->point1_z;
- ocDest->data.ExtendedCellArray.point2.x = oc->point2_x;
- ocDest->data.ExtendedCellArray.point2.y = oc->point2_y;
- ocDest->data.ExtendedCellArray.point2.z = oc->point2_z;
- ocDest->data.ExtendedCellArray.point3.x = oc->point3_x;
- ocDest->data.ExtendedCellArray.point3.y = oc->point3_y;
- ocDest->data.ExtendedCellArray.point3.z = oc->point3_z;
- }
-
- ocDest->data.ExtendedCellArray.col_count = oc->dx;
- ocDest->data.ExtendedCellArray.row_count = oc->dy;
- ocDest->data.ExtendedCellArray.color_type = oc->colorType;
-
- count = oc->dx * oc->dy;
- ocDest->data.ExtendedCellArray.colors.indexed = (PEXColorIndexed *)
- Xmalloc (count * GetClientColorSize (oc->colorType));
-
- EXTRACT_LISTOF_COLOR_VAL (count, *ocSrc, oc->colorType,
- ocDest->data.ExtendedCellArray.colors, fpConvert, fpFormat);
-}
-
-
-void _PEXDecodeGDP (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexGDP *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexGDP, *ocSrc, oc);
- *ocSrc += SIZEOF (pexGDP);
-
- ocDest->data.GDP.gdp_id = oc->gdpId;
- ocDest->data.GDP.count = oc->numPoints;
- ocDest->data.GDP.length = oc->numBytes;
-
- ocDest->data.GDP.points =
- (PEXCoord *) Xmalloc ((unsigned) (oc->numPoints * sizeof (PEXCoord)));
-
- EXTRACT_LISTOF_COORD3D (oc->numPoints, *ocSrc,
- ocDest->data.GDP.points, fpConvert, fpFormat);
-
- ocDest->data.GDP.data = (char *) Xmalloc ((unsigned) (oc->numBytes));
-
- memcpy (ocDest->data.GDP.data, *ocSrc, oc->numBytes);
- *ocSrc += PADDED_BYTES (oc->numBytes);
-}
-
-
-void _PEXDecodeGDP2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- pexGDP2D *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GET_STRUCT_PTR (pexGDP2D, *ocSrc, oc);
- *ocSrc += SIZEOF (pexGDP2D);
-
- ocDest->data.GDP2D.gdp_id = oc->gdpId;
- ocDest->data.GDP2D.count = oc->numPoints;
- ocDest->data.GDP2D.length = oc->numBytes;
-
- ocDest->data.GDP2D.points = (PEXCoord2D *) Xmalloc (
- (unsigned) (oc->numPoints * sizeof (PEXCoord2D)));
-
- EXTRACT_LISTOF_COORD2D (oc->numPoints, *ocSrc,
- ocDest->data.GDP2D.points, fpConvert, fpFormat);
-
- ocDest->data.GDP2D.data = (char *) Xmalloc ((unsigned) oc->numBytes);
-
- memcpy (ocDest->data.GDP2D.data, *ocSrc, oc->numBytes);
- *ocSrc += PADDED_BYTES (oc->numBytes);
-}
-
-
-void _PEXDecodeNoop (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-char **ocSrc;
-PEXOCData *ocDest;
-
-{
- /* no data to decode */
-
- *ocSrc += SIZEOF (pexNoop);
-}
diff --git a/xc/lib/PEX5/pl_oc_enc.c b/xc/lib/PEX5/pl_oc_enc.c
deleted file mode 100644
index cb5163e1b..000000000
--- a/xc/lib/PEX5/pl_oc_enc.c
+++ /dev/null
@@ -1,2138 +0,0 @@
-/* $TOG: pl_oc_enc.c /main/12 1998/02/06 16:11:03 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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-char *
-PEXEncodeOCs (float_format, oc_count, oc_data, length_return)
-
-INPUT int float_format;
-INPUT unsigned long oc_count;
-INPUT PEXOCData *oc_data;
-OUTPUT unsigned long *length_return;
-
-{
- extern void (*(PEX_encode_oc_funcs[]))();
- PEXOCData *ocSrc;
- char *ocDest, *ocRet;
- int i;
-
-
- /*
- * Allocate a buffer to hold the encodings.
- */
-
- *length_return = PEXGetSizeOCs (float_format, oc_count, oc_data);
- ocRet = ocDest = (char *) Xmalloc ((unsigned) *length_return);
-
-
- /*
- * Now, encode the OCs in the buffer.
- */
-
- for (i = 0, ocSrc = oc_data; i < oc_count; i++, ocSrc++)
- (*PEX_encode_oc_funcs[ocSrc->oc_type]) (float_format, ocSrc, &ocDest);
-
-
-#ifdef DEBUG
- if (ocDest - ocRet != *length_return)
- {
- printf ("PEXlib WARNING : Internal error in PEXEncodeOCs :\n");
- printf ("Data size encoded != Data size allocated.\n");
- }
-#endif
-
- return (ocRet);
-}
-
-
-void _PEXEncodeEnumType (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexMarkerType *oc;
-
- BEGIN_SIMPLE_ENCODE (MarkerType, ocSrc->oc_type, *ocDest, oc);
-
- oc->markerType = ocSrc->data.SetMarkerType.marker_type;
-
- END_SIMPLE_ENCODE (MarkerType, *ocDest, oc);
-}
-
-
-void _PEXEncodeTableIndex (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexMarkerColorIndex *oc;
-
- BEGIN_SIMPLE_ENCODE (MarkerColorIndex, ocSrc->oc_type, *ocDest, oc);
-
- oc->index = ocSrc->data.SetMarkerColorIndex.index;
-
- END_SIMPLE_ENCODE (MarkerColorIndex, *ocDest, oc);
-}
-
-
-void _PEXEncodeColor (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexMarkerColor *oc;
- int lenofColor;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- lenofColor = GetColorLength (ocSrc->data.SetMarkerColor.color_type);
-
- BEGIN_ENCODE_OCHEADER (MarkerColor, ocSrc->oc_type,
- lenofColor, *ocDest, oc);
-
- oc->colorType = ocSrc->data.SetMarkerColor.color_type;
-
- END_ENCODE_OCHEADER (MarkerColor, *ocDest, oc);
-
- STORE_COLOR_VAL (ocSrc->data.SetMarkerColor.color_type,
- ocSrc->data.SetMarkerColor.color,
- *ocDest, fpConvert, fpFormat)
-}
-
-
-void _PEXEncodeFloat (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexMarkerScale *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (MarkerScale, ocSrc->oc_type, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetMarkerScale.scale,
- oc->scale, fpFormat);
- }
- else
- oc->scale = ocSrc->data.SetMarkerScale.scale;
-
- END_SIMPLE_ENCODE (MarkerScale, *ocDest, oc);
-}
-
-
-void _PEXEncodeCARD16 (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexTextPrecision *oc;
-
- BEGIN_SIMPLE_ENCODE (TextPrecision, ocSrc->oc_type, *ocDest, oc);
-
- oc->precision = ocSrc->data.SetTextPrecision.precision;
-
- END_SIMPLE_ENCODE (TextPrecision, *ocDest, oc);
-}
-
-
-void _PEXEncodeVector2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexCharUpVector *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (CharUpVector, ocSrc->oc_type, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetCharUpVector.vector.x,
- oc->up_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetCharUpVector.vector.y,
- oc->up_y, fpFormat);
- }
- else
- {
- oc->up_x = ocSrc->data.SetCharUpVector.vector.x;
- oc->up_y = ocSrc->data.SetCharUpVector.vector.y;
- }
-
- END_SIMPLE_ENCODE (CharUpVector, *ocDest, oc);
-}
-
-
-void _PEXEncodeTextAlignment (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexTextAlignment *oc;
-
- BEGIN_SIMPLE_ENCODE (TextAlignment, ocSrc->oc_type, *ocDest, oc);
-
- oc->alignment_horizontal = ocSrc->data.SetTextAlignment.halignment;
- oc->alignment_vertical = ocSrc->data.SetTextAlignment.valignment;
-
- END_SIMPLE_ENCODE (TextAlignment, *ocDest, oc);
-}
-
-
-void _PEXEncodeCurveApprox (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexCurveApprox *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (CurveApprox, ocSrc->oc_type, *ocDest, oc);
-
- oc->approxMethod = ocSrc->data.SetCurveApprox.method;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetCurveApprox.tolerance,
- oc->tolerance, fpFormat);
- }
- else
- oc->tolerance = ocSrc->data.SetCurveApprox.tolerance;
-
- END_SIMPLE_ENCODE (CurveApprox, *ocDest, oc);
-}
-
-
-void _PEXEncodeReflectionAttr (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexReflectionAttributes *oc;
- PEXReflectionAttributes *reflectionAttr;
- int lenofColor;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- reflectionAttr = &(ocSrc->data.SetReflectionAttributes.attributes);
- lenofColor = GetColorLength (reflectionAttr->specular_color.type);
-
- BEGIN_ENCODE_OCHEADER (ReflectionAttributes, ocSrc->oc_type,
- lenofColor, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (reflectionAttr->ambient, oc->ambient, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->diffuse, oc->diffuse, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->specular, oc->specular, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->specular_conc,
- oc->specularConc, fpFormat);
- FP_CONVERT_HTON (reflectionAttr->transmission,
- oc->transmission, fpFormat);
- }
- else
- {
- oc->ambient = reflectionAttr->ambient;
- oc->diffuse = reflectionAttr->diffuse;
- oc->specular = reflectionAttr->specular;
- oc->specularConc = reflectionAttr->specular_conc;
- oc->transmission = reflectionAttr->transmission;
- }
-
- oc->specular_colorType = reflectionAttr->specular_color.type;
-
- END_ENCODE_OCHEADER (ReflectionAttributes, *ocDest, oc);
-
- STORE_COLOR_VAL (reflectionAttr->specular_color.type,
- reflectionAttr->specular_color.value, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeSurfaceApprox (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexSurfaceApprox *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (SurfaceApprox, ocSrc->oc_type, *ocDest, oc);
-
- oc->approxMethod = ocSrc->data.SetSurfaceApprox.method;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetSurfaceApprox.utolerance,
- oc->uTolerance, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetSurfaceApprox.vtolerance,
- oc->vTolerance, fpFormat);
- }
- else
- {
- oc->uTolerance = ocSrc->data.SetSurfaceApprox.utolerance;
- oc->vTolerance = ocSrc->data.SetSurfaceApprox.vtolerance;
- }
-
- END_SIMPLE_ENCODE (SurfaceApprox, *ocDest, oc);
-}
-
-
-void _PEXEncodeCullMode (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFacetCullingMode *oc;
-
- BEGIN_SIMPLE_ENCODE (FacetCullingMode, ocSrc->oc_type, *ocDest, oc);
-
- oc->cullMode = ocSrc->data.SetFacetCullingMode.mode;
-
- END_SIMPLE_ENCODE (FacetCullingMode, *ocDest, oc);
-}
-
-
-void _PEXEncodeSwitch (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFacetDistinguishFlag *oc;
-
- BEGIN_SIMPLE_ENCODE (FacetDistinguishFlag, ocSrc->oc_type, *ocDest, oc);
-
- oc->distinguish = ocSrc->data.SetFacetDistinguishFlag.flag;
-
- END_SIMPLE_ENCODE (FacetDistinguishFlag, *ocDest, oc);
-}
-
-
-void _PEXEncodePatternSize (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPatternSize *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (PatternSize, ocSrc->oc_type, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetPatternSize.width,
- oc->size_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternSize.height,
- oc->size_y, fpFormat);
- }
- else
- {
- oc->size_x = ocSrc->data.SetPatternSize.width;
- oc->size_y = ocSrc->data.SetPatternSize.height;
- }
-
- END_SIMPLE_ENCODE (PatternSize, *ocDest, oc);
-}
-
-
-void _PEXEncodePatternAttr2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPatternAttributes2D *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (PatternAttributes2D, ocSrc->oc_type, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes2D.ref_point.x,
- oc->point_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes2D.ref_point.y,
- oc->point_y, fpFormat);
- }
- else
- {
- oc->point_x = ocSrc->data.SetPatternAttributes2D.ref_point.x;
- oc->point_y = ocSrc->data.SetPatternAttributes2D.ref_point.y;
- }
-
- END_SIMPLE_ENCODE (PatternAttributes2D, *ocDest, oc);
-}
-
-
-void _PEXEncodePatternAttr (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPatternAttributes *oc;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (PatternAttributes, ocSrc->oc_type, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.ref_point.x,
- oc->refPt_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.ref_point.y,
- oc->refPt_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.ref_point.z,
- oc->refPt_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.vector1.x,
- oc->vector1_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.vector1.y,
- oc->vector1_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.vector1.z,
- oc->vector1_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.vector2.x,
- oc->vector2_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.vector2.y,
- oc->vector2_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.SetPatternAttributes.vector2.z,
- oc->vector2_z, fpFormat);
- }
- else
- {
- oc->refPt_x = ocSrc->data.SetPatternAttributes.ref_point.x;
- oc->refPt_y = ocSrc->data.SetPatternAttributes.ref_point.y;
- oc->refPt_z = ocSrc->data.SetPatternAttributes.ref_point.z;
- oc->vector1_x = ocSrc->data.SetPatternAttributes.vector1.x;
- oc->vector1_y = ocSrc->data.SetPatternAttributes.vector1.y;
- oc->vector1_z = ocSrc->data.SetPatternAttributes.vector1.z;
- oc->vector2_x = ocSrc->data.SetPatternAttributes.vector2.x;
- oc->vector2_y = ocSrc->data.SetPatternAttributes.vector2.y;
- oc->vector2_z = ocSrc->data.SetPatternAttributes.vector2.z;
- }
-
- END_SIMPLE_ENCODE (PatternAttributes, *ocDest, oc);
-}
-
-
-void _PEXEncodeASF (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexIndividualASF *oc;
-
- BEGIN_SIMPLE_ENCODE (IndividualASF, ocSrc->oc_type, *ocDest, oc);
-
- oc->attribute = ocSrc->data.SetIndividualASF.attribute;
- oc->source = ocSrc->data.SetIndividualASF.asf;
-
- END_SIMPLE_ENCODE (IndividualASF, *ocDest, oc);
-}
-
-
-void _PEXEncodeLocalTransform (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexLocalTransform *oc;
- char *ptr;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (LocalTransform, ocSrc->oc_type, *ocDest, oc);
-
- oc->compType = ocSrc->data.SetLocalTransform.composition;
-
- ptr = (char *) oc->matrix;
- STORE_LISTOF_FLOAT32 (16, ocSrc->data.SetLocalTransform.transform, ptr,
- fpConvert, fpFormat);
-
- END_SIMPLE_ENCODE (LocalTransform, *ocDest, oc);
-}
-
-
-void _PEXEncodeLocalTransform2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexLocalTransform2D *oc;
- char *ptr;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (LocalTransform2D, ocSrc->oc_type, *ocDest, oc);
-
- oc->compType = ocSrc->data.SetLocalTransform2D.composition;
-
- ptr = (char *) oc->matrix3X3;
- STORE_LISTOF_FLOAT32 (9, ocSrc->data.SetLocalTransform2D.transform, ptr,
- fpConvert, fpFormat);
-
- END_SIMPLE_ENCODE (LocalTransform2D, *ocDest, oc);
-}
-
-
-void _PEXEncodeGlobalTransform (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexGlobalTransform *oc;
- char *ptr;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (GlobalTransform, ocSrc->oc_type, *ocDest, oc);
-
- ptr = (char *) oc->matrix;
- STORE_LISTOF_FLOAT32 (16, ocSrc->data.SetGlobalTransform.transform, ptr,
- fpConvert, fpFormat);
-
- END_SIMPLE_ENCODE (GlobalTransform, *ocDest, oc);
-}
-
-
-void _PEXEncodeGlobalTransform2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexGlobalTransform2D *oc;
- char *ptr;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- BEGIN_SIMPLE_ENCODE (GlobalTransform2D, ocSrc->oc_type, *ocDest, oc);
-
- ptr = (char *) oc->matrix3X3;
- STORE_LISTOF_FLOAT32 (9, ocSrc->data.SetGlobalTransform2D.transform, ptr,
- fpConvert, fpFormat);
-
- END_SIMPLE_ENCODE (GlobalTransform2D, *ocDest, oc);
-}
-
-
-void _PEXEncodeModelClipVolume (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexModelClipVolume *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = NUMWORDS (SIZEOF (pexHalfSpace) *
- ocSrc->data.SetModelClipVolume.count);
-
- BEGIN_ENCODE_OCHEADER (ModelClipVolume, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->modelClipOperator = ocSrc->data.SetModelClipVolume.op;
- oc->numHalfSpaces = ocSrc->data.SetModelClipVolume.count;
-
- END_ENCODE_OCHEADER (ModelClipVolume, *ocDest, oc);
-
- STORE_LISTOF_HALFSPACE3D (ocSrc->data.SetModelClipVolume.count,
- ocSrc->data.SetModelClipVolume.half_spaces, *ocDest,
- fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeModelClipVolume2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexModelClipVolume2D *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = NUMWORDS (SIZEOF (pexHalfSpace2D) *
- ocSrc->data.SetModelClipVolume2D.count);
-
- BEGIN_ENCODE_OCHEADER (ModelClipVolume2D, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->modelClipOperator = ocSrc->data.SetModelClipVolume2D.op;
- oc->numHalfSpaces = ocSrc->data.SetModelClipVolume2D.count;
-
- END_ENCODE_OCHEADER (ModelClipVolume2D, *ocDest, oc);
-
- STORE_LISTOF_HALFSPACE2D (ocSrc->data.SetModelClipVolume2D.count,
- ocSrc->data.SetModelClipVolume2D.half_spaces, *ocDest,
- fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeRestoreModelClip (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexRestoreModelClipVolume *oc;
-
- BEGIN_SIMPLE_ENCODE (RestoreModelClipVolume, ocSrc->oc_type, *ocDest, oc);
- /* no data */
- END_SIMPLE_ENCODE (RestoreModelClipVolume, *ocDest, oc);
-}
-
-
-void _PEXEncodeLightSourceState (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexLightSourceState *oc;
- int dataLength;
-
- dataLength =
- NUMWORDS (SIZEOF (CARD16) *
- ocSrc->data.SetLightSourceState.enable_count) +
- NUMWORDS (SIZEOF (CARD16) *
- ocSrc->data.SetLightSourceState.disable_count);
-
- BEGIN_ENCODE_OCHEADER (LightSourceState, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->numEnable = ocSrc->data.SetLightSourceState.enable_count;
- oc->numDisable = ocSrc->data.SetLightSourceState.disable_count;
-
- END_ENCODE_OCHEADER (LightSourceState, *ocDest, oc);
-
- STORE_LISTOF_CARD16 (ocSrc->data.SetLightSourceState.enable_count,
- ocSrc->data.SetLightSourceState.enable, *ocDest);
-
- if (ocSrc->data.SetLightSourceState.enable_count & 1)
- *ocDest += 2;
-
- STORE_LISTOF_CARD16 (ocSrc->data.SetLightSourceState.disable_count,
- ocSrc->data.SetLightSourceState.disable, *ocDest);
-
- if (ocSrc->data.SetLightSourceState.disable_count & 1)
- *ocDest += 2;
-}
-
-
-void _PEXEncodeID (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPickID *oc;
-
- BEGIN_SIMPLE_ENCODE (PickID, ocSrc->oc_type, *ocDest, oc);
-
- oc->pickId = ocSrc->data.SetPickID.pick_id;
-
- END_SIMPLE_ENCODE (PickID, *ocDest, oc);
-}
-
-
-void _PEXEncodePSC (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexParaSurfCharacteristics *oc;
- PEXPSCData *pscData;
- int pscType;
- int dataLength = 0;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- pscType = ocSrc->data.SetParaSurfCharacteristics.psc_type;
- pscData = &(ocSrc->data.SetParaSurfCharacteristics.characteristics);
-
- if (pscType == PEXPSCIsoCurves)
- {
- dataLength = LENOF (pexPSC_IsoparametricCurves);
- }
- else if (pscType == PEXPSCMCLevelCurves || pscType == PEXPSCWCLevelCurves)
- {
- dataLength = NUMWORDS (SIZEOF (pexPSC_LevelCurves) +
- (pscData->level_curves.count * SIZEOF (float)));
- }
-
- BEGIN_ENCODE_OCHEADER (ParaSurfCharacteristics, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->characteristics = pscType;
- oc->length = NUMBYTES (dataLength);
-
- END_ENCODE_OCHEADER (ParaSurfCharacteristics, *ocDest, oc);
-
- if (dataLength > 0)
- {
- if (pscType == PEXPSCIsoCurves)
- {
- STORE_PSC_ISOCURVES (pscData->iso_curves, *ocDest);
- }
- else if (pscType == PEXPSCMCLevelCurves ||
- pscType == PEXPSCWCLevelCurves)
- {
- STORE_PSC_LEVELCURVES (pscData->level_curves, *ocDest,
- fpConvert, fpFormat);
-
- STORE_LISTOF_FLOAT32 (pscData->level_curves.count,
- pscData->level_curves.parameters, *ocDest,
- fpConvert, fpFormat);
- }
- }
-}
-
-
-void _PEXEncodeNameSet (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexAddToNameSet *oc;
- int dataLength;
-
- dataLength = NUMWORDS (ocSrc->data.AddToNameSet.count * SIZEOF (pexName));
-
- BEGIN_ENCODE_OCHEADER (AddToNameSet, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- END_ENCODE_OCHEADER (AddToNameSet, *ocDest, oc);
-
- STORE_LISTOF_CARD32 (ocSrc->data.AddToNameSet.count,
- ocSrc->data.AddToNameSet.names, *ocDest);
-}
-
-
-void _PEXEncodeExecuteStructure (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexExecuteStructure *oc;
-
- BEGIN_SIMPLE_ENCODE (ExecuteStructure, ocSrc->oc_type, *ocDest, oc);
-
- oc->id = ocSrc->data.ExecuteStructure.structure;
-
- END_SIMPLE_ENCODE (ExecuteStructure, *ocDest, oc);
-}
-
-
-void _PEXEncodeLabel (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexLabel *oc;
-
- BEGIN_SIMPLE_ENCODE (Label, ocSrc->oc_type, *ocDest, oc);
-
- oc->label = ocSrc->data.Label.label;
-
- END_SIMPLE_ENCODE (Label, *ocDest, oc);
-}
-
-
-void _PEXEncodeApplicationData (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexApplicationData *oc;
- int dataLength;
-
- dataLength = NUMWORDS (ocSrc->data.ApplicationData.length);
-
- BEGIN_ENCODE_OCHEADER (ApplicationData, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->numElements = ocSrc->data.ApplicationData.length;
-
- END_ENCODE_OCHEADER (ApplicationData, *ocDest, oc);
-
- memcpy (*ocDest, ocSrc->data.ApplicationData.data,
- ocSrc->data.ApplicationData.length);
-
- *ocDest += PADDED_BYTES (ocSrc->data.ApplicationData.length);
-}
-
-
-void _PEXEncodeGSE (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexGSE *oc;
- int dataLength;
-
- dataLength = NUMWORDS (ocSrc->data.GSE.length);
-
- BEGIN_ENCODE_OCHEADER (GSE, ocSrc->oc_type, dataLength, *ocDest, oc);
-
- oc->id = ocSrc->data.GSE.id;
- oc->numElements = ocSrc->data.GSE.length;
-
- END_ENCODE_OCHEADER (GSE, *ocDest, oc);
-
- memcpy (*ocDest, ocSrc->data.GSE.data, ocSrc->data.GSE.length);
- *ocDest += PADDED_BYTES (ocSrc->data.GSE.length);
-}
-
-
-void _PEXEncodeMarkers (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexMarkers *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = NUMWORDS (ocSrc->data.Markers.count * SIZEOF (pexCoord3D));
-
- BEGIN_ENCODE_OCHEADER (Markers, ocSrc->oc_type, dataLength, *ocDest, oc);
- END_ENCODE_OCHEADER (Markers, *ocDest, oc);
-
- STORE_LISTOF_COORD3D (ocSrc->data.Markers.count,
- ocSrc->data.Markers.points, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodePolyline (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPolyline *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = NUMWORDS (ocSrc->data.Polyline.count * SIZEOF (pexCoord3D));
-
- BEGIN_ENCODE_OCHEADER (Polyline, ocSrc->oc_type, dataLength, *ocDest, oc);
- END_ENCODE_OCHEADER (Polyline, *ocDest, oc);
-
- STORE_LISTOF_COORD3D (ocSrc->data.Polyline.count,
- ocSrc->data.Polyline.points, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeMarkers2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexMarkers2D *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = NUMWORDS (ocSrc->data.Markers2D.count * SIZEOF (pexCoord2D));
-
- BEGIN_ENCODE_OCHEADER (Markers2D, ocSrc->oc_type,
- dataLength, *ocDest, oc);
- END_ENCODE_OCHEADER (Markers2D, *ocDest, oc);
-
- STORE_LISTOF_COORD2D (ocSrc->data.Markers2D.count,
- ocSrc->data.Markers2D.points, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodePolyline2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPolyline2D *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = NUMWORDS (ocSrc->data.Polyline2D.count * SIZEOF (pexCoord2D));
-
- BEGIN_ENCODE_OCHEADER (Polyline2D, ocSrc->oc_type,
- dataLength, *ocDest, oc);
- END_ENCODE_OCHEADER (Polyline2D, *ocDest, oc);
-
- STORE_LISTOF_COORD2D (ocSrc->data.Polyline2D.count,
- ocSrc->data.Polyline2D.points, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeText (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- /* Text is always mono encoded */
-
- pexText *oc;
- int lenofStrings;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GetStringsLength (ocSrc->data.EncodedText.count,
- ocSrc->data.EncodedText.encoded_text, lenofStrings);
-
- BEGIN_ENCODE_OCHEADER (Text, ocSrc->oc_type, lenofStrings, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.EncodedText.origin.x,
- oc->origin_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.origin.y,
- oc->origin_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.origin.z,
- oc->origin_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.vector1.x,
- oc->vector1_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.vector1.y,
- oc->vector1_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.vector1.z,
- oc->vector1_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.vector2.x,
- oc->vector2_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.vector2.y,
- oc->vector2_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText.vector2.z,
- oc->vector2_z, fpFormat);
- }
- else
- {
- oc->origin_x = ocSrc->data.EncodedText.origin.x;
- oc->origin_y = ocSrc->data.EncodedText.origin.y;
- oc->origin_z = ocSrc->data.EncodedText.origin.z;
- oc->vector1_x = ocSrc->data.EncodedText.vector1.x;
- oc->vector1_y = ocSrc->data.EncodedText.vector1.y;
- oc->vector1_z = ocSrc->data.EncodedText.vector1.z;
- oc->vector2_x = ocSrc->data.EncodedText.vector2.x;
- oc->vector2_y = ocSrc->data.EncodedText.vector2.y;
- oc->vector2_z = ocSrc->data.EncodedText.vector2.z;
- }
-
- oc->numEncodings = ocSrc->data.EncodedText.count;
-
- END_ENCODE_OCHEADER (Text, *ocDest, oc);
-
- STORE_LISTOF_MONOENCODING (ocSrc->data.EncodedText.count,
- ocSrc->data.EncodedText.encoded_text, *ocDest);
-}
-
-
-void _PEXEncodeText2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- /* Text is always mono encoded */
-
- pexText2D *oc;
- int lenofStrings;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GetStringsLength (ocSrc->data.EncodedText2D.count,
- ocSrc->data.EncodedText2D.encoded_text, lenofStrings);
-
- BEGIN_ENCODE_OCHEADER (Text2D, ocSrc->oc_type, lenofStrings, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.EncodedText2D.origin.x,
- oc->origin_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedText2D.origin.y,
- oc->origin_y, fpFormat);
- }
- else
- {
- oc->origin_x = ocSrc->data.EncodedText2D.origin.x;
- oc->origin_y = ocSrc->data.EncodedText2D.origin.y;
- }
-
- oc->numEncodings = ocSrc->data.EncodedText2D.count;
-
- END_ENCODE_OCHEADER (Text2D, *ocDest, oc);
-
- STORE_LISTOF_MONOENCODING (ocSrc->data.EncodedText2D.count,
- ocSrc->data.EncodedText2D.encoded_text, *ocDest);
-}
-
-
-void _PEXEncodeAnnoText (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- /* Anno Text is always mono encoded */
-
- pexAnnotationText *oc;
- int lenofStrings;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GetStringsLength (ocSrc->data.EncodedAnnoText.count,
- ocSrc->data.EncodedAnnoText.encoded_text, lenofStrings);
-
- BEGIN_ENCODE_OCHEADER (AnnotationText, ocSrc->oc_type,
- lenofStrings, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText.origin.x,
- oc->origin_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText.origin.y,
- oc->origin_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText.origin.z,
- oc->origin_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText.offset.x,
- oc->offset_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText.offset.y,
- oc->offset_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText.offset.z,
- oc->offset_z, fpFormat);
- }
- else
- {
- oc->origin_x = ocSrc->data.EncodedAnnoText.origin.x;
- oc->origin_y = ocSrc->data.EncodedAnnoText.origin.y;
- oc->origin_z = ocSrc->data.EncodedAnnoText.origin.z;
- oc->offset_x = ocSrc->data.EncodedAnnoText.offset.x;
- oc->offset_y = ocSrc->data.EncodedAnnoText.offset.y;
- oc->offset_z = ocSrc->data.EncodedAnnoText.offset.z;
- }
-
- oc->numEncodings = ocSrc->data.EncodedAnnoText.count;
-
- END_ENCODE_OCHEADER (AnnotationText, *ocDest, oc);
-
- STORE_LISTOF_MONOENCODING (ocSrc->data.EncodedAnnoText.count,
- ocSrc->data.EncodedAnnoText.encoded_text, *ocDest);
-}
-
-
-void _PEXEncodeAnnoText2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- /* Anno Text is always mono encoded */
-
- pexAnnotationText2D *oc;
- int lenofStrings;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- GetStringsLength (ocSrc->data.EncodedAnnoText2D.count,
- ocSrc->data.EncodedAnnoText2D.encoded_text, lenofStrings);
-
- BEGIN_ENCODE_OCHEADER (AnnotationText2D, ocSrc->oc_type,
- lenofStrings, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText2D.origin.x,
- oc->origin_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText2D.origin.y,
- oc->origin_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText2D.offset.x,
- oc->offset_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.EncodedAnnoText2D.offset.y,
- oc->offset_y, fpFormat);
- }
- else
- {
- oc->origin_x = ocSrc->data.EncodedAnnoText2D.origin.x;
- oc->origin_y = ocSrc->data.EncodedAnnoText2D.origin.y;
- oc->offset_x = ocSrc->data.EncodedAnnoText2D.offset.x;
- oc->offset_y = ocSrc->data.EncodedAnnoText2D.offset.y;
- }
-
- oc->numEncodings = ocSrc->data.EncodedAnnoText2D.count;
-
- END_ENCODE_OCHEADER (AnnotationText2D, *ocDest, oc);
-
- STORE_LISTOF_MONOENCODING (ocSrc->data.EncodedAnnoText2D.count,
- ocSrc->data.EncodedAnnoText2D.encoded_text, *ocDest);
-}
-
-
-void _PEXEncodePolylineSet (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexPolylineSetWithData *oc;
- int numPoints, i;
- int dataLength;
- int lenofVertex;
- unsigned int vertexAttributes;
- unsigned int numPolylines;
- int colorType;
- PEXListOfVertex *polylines;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- numPolylines = ocSrc->data.PolylineSetWithData.count;
- polylines = ocSrc->data.PolylineSetWithData.vertex_lists;
- colorType = ocSrc->data.PolylineSetWithData.color_type;
- vertexAttributes = ocSrc->data.PolylineSetWithData.vertex_attributes;
-
- for (i = 0, numPoints = 0; i < numPolylines; i++)
- numPoints += polylines[i].count;
-
- lenofVertex = LENOF (pexCoord3D) + ((vertexAttributes & PEXGAColor) ?
- GetColorLength (colorType) : 0);
-
- dataLength = numPolylines + (numPoints * lenofVertex);
-
- BEGIN_ENCODE_OCHEADER (PolylineSetWithData, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->colorType = colorType;
- oc->vertexAttribs = vertexAttributes;
- oc->numLists = numPolylines;
-
- END_ENCODE_OCHEADER (PolylineSetWithData, *ocDest, oc);
-
- for (i = 0; i < numPolylines; i++)
- {
- STORE_CARD32 (polylines[i].count, *ocDest);
-
- STORE_LISTOF_VERTEX (polylines[i].count, NUMBYTES (lenofVertex),
- colorType, vertexAttributes, polylines[i].vertices,
- *ocDest, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXEncodeNURBCurve (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexNURBCurve *oc;
- int lenofVertexList;
- int lenofKnotList;
- unsigned int numPoints;
- int rationality, order;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- numPoints = ocSrc->data.NURBCurve.count;
- rationality = ocSrc->data.NURBCurve.rationality;
- order = ocSrc->data.NURBCurve.order;
-
- lenofVertexList = numPoints * ((rationality == PEXRational) ?
- LENOF (pexCoord4D) : LENOF (pexCoord3D));
- lenofKnotList = order + numPoints;
-
- BEGIN_ENCODE_OCHEADER (NURBCurve, ocSrc->oc_type,
- lenofKnotList + lenofVertexList, *ocDest, oc);
-
- oc->curveOrder = order;
- oc->coordType = rationality;
- oc->numKnots = order + numPoints;
- oc->numPoints = numPoints;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.NURBCurve.tmin, oc->tmin, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.NURBCurve.tmax, oc->tmax, fpFormat);
- }
- else
- {
- oc->tmin = ocSrc->data.NURBCurve.tmin;
- oc->tmax = ocSrc->data.NURBCurve.tmax;
- }
-
- END_ENCODE_OCHEADER (NURBCurve, *ocDest, oc);
-
- STORE_LISTOF_FLOAT32 (lenofKnotList, ocSrc->data.NURBCurve.knots, *ocDest,
- fpConvert, fpFormat);
-
- if (rationality == PEXRational)
- {
- STORE_LISTOF_COORD4D (numPoints, ocSrc->data.NURBCurve.points.point_4d,
- *ocDest, fpConvert, fpFormat);
- }
- else
- {
- STORE_LISTOF_COORD3D (numPoints, ocSrc->data.NURBCurve.points.point,
- *ocDest, fpConvert, fpFormat);
- }
-}
-
-
-void _PEXEncodeFillArea (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFillArea *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = ocSrc->data.FillArea.count * LENOF (pexCoord3D);
-
- BEGIN_ENCODE_OCHEADER (FillArea, ocSrc->oc_type, dataLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.FillArea.shape_hint;
- oc->ignoreEdges = ocSrc->data.FillArea.ignore_edges;
-
- END_ENCODE_OCHEADER (FillArea, *ocDest, oc);
-
- STORE_LISTOF_COORD3D (ocSrc->data.FillArea.count,
- ocSrc->data.FillArea.points, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeFillArea2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFillArea2D *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = ocSrc->data.FillArea2D.count * LENOF (pexCoord2D);
-
- BEGIN_ENCODE_OCHEADER (FillArea2D, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.FillArea2D.shape_hint;
- oc->ignoreEdges = ocSrc->data.FillArea2D.ignore_edges;
-
- END_ENCODE_OCHEADER (FillArea2D, *ocDest, oc);
-
- STORE_LISTOF_COORD2D (ocSrc->data.FillArea2D.count,
- ocSrc->data.FillArea2D.points, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeFillAreaWithData (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFillAreaWithData *oc;
- int dataLength;
- int lenofFacet;
- int lenofVertex;
- int lenofColor;
- unsigned int facetAttributes;
- unsigned int vertexAttributes;
- int colorType;
- unsigned int numVertices;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- colorType = ocSrc->data.FillAreaWithData.color_type;
- facetAttributes = ocSrc->data.FillAreaWithData.facet_attributes;
- vertexAttributes = ocSrc->data.FillAreaWithData.vertex_attributes;
- numVertices = ocSrc->data.FillAreaWithData.count;
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
- dataLength = lenofFacet + 1 /* count */ + numVertices * lenofVertex;
-
- BEGIN_ENCODE_OCHEADER (FillAreaWithData, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.FillAreaWithData.shape_hint;
- oc->ignoreEdges = ocSrc->data.FillAreaWithData.ignore_edges;
- oc->colorType = colorType;
- oc->facetAttribs = facetAttributes;
- oc->vertexAttribs = vertexAttributes;
-
- END_ENCODE_OCHEADER (FillAreaWithData, *ocDest, oc);
-
- if (facetAttributes)
- {
- STORE_FACET (colorType, facetAttributes,
- ocSrc->data.FillAreaWithData.facet_data, *ocDest,
- fpConvert, fpFormat);
- }
-
- STORE_CARD32 (numVertices, *ocDest);
-
- STORE_LISTOF_VERTEX (numVertices, NUMBYTES (lenofVertex), colorType,
- vertexAttributes, ocSrc->data.FillAreaWithData.vertices, *ocDest,
- fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeFillAreaSet (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFillAreaSet *oc;
- int dataLength;
- int numPoints, i;
- unsigned int numFillAreas;
- PEXListOfCoord *vertices;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- numFillAreas = ocSrc->data.FillAreaSet.count;
- vertices = ocSrc->data.FillAreaSet.point_lists;
-
- for (i = 0, numPoints = 0; i < numFillAreas; i++)
- numPoints += vertices[i].count;
-
- dataLength = numFillAreas + (numPoints * LENOF (pexCoord3D));
-
- BEGIN_ENCODE_OCHEADER (FillAreaSet, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.FillAreaSet.shape_hint;
- oc->ignoreEdges = ocSrc->data.FillAreaSet.ignore_edges;
- oc->contourHint = ocSrc->data.FillAreaSet.contour_hint;
- oc->numLists = numFillAreas;
-
- END_ENCODE_OCHEADER (FillAreaSet, *ocDest, oc);
-
- for (i = 0; i < numFillAreas; i++)
- {
- STORE_CARD32 (vertices[i].count, *ocDest);
-
- STORE_LISTOF_COORD3D (vertices[i].count, vertices[i].points, *ocDest,
- fpConvert, fpFormat);
- }
-}
-
-
-void _PEXEncodeFillAreaSet2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFillAreaSet2D *oc;
- int dataLength;
- int numPoints, i;
- unsigned int numFillAreas;
- PEXListOfCoord2D *vertices;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- numFillAreas = ocSrc->data.FillAreaSet2D.count;
- vertices = ocSrc->data.FillAreaSet2D.point_lists;
-
- for (i = 0, numPoints = 0; i < numFillAreas; i++)
- numPoints += vertices[i].count;
-
- dataLength = numFillAreas /* counts */ + (numPoints * LENOF (pexCoord2D));
-
- BEGIN_ENCODE_OCHEADER (FillAreaSet2D, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.FillAreaSet2D.shape_hint;
- oc->ignoreEdges = ocSrc->data.FillAreaSet2D.ignore_edges;
- oc->contourHint = ocSrc->data.FillAreaSet2D.contour_hint;
- oc->numLists = numFillAreas;
-
- END_ENCODE_OCHEADER (FillAreaSet2D, *ocDest, oc);
-
- for (i = 0; i < numFillAreas; i++)
- {
- STORE_CARD32 (vertices[i].count, *ocDest);
-
- STORE_LISTOF_COORD2D (vertices[i].count, vertices[i].points, *ocDest,
- fpConvert, fpFormat);
- }
-}
-
-
-void _PEXEncodeFillAreaSetWithData (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexFillAreaSetWithData *oc;
- int dataLength;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int numVertices, i;
- int colorType;
- unsigned int numFillAreas;
- unsigned int facetAttributes;
- unsigned int vertexAttributes;
- PEXListOfVertex *vertices;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- colorType = ocSrc->data.FillAreaSetWithData.color_type;
- numFillAreas = ocSrc->data.FillAreaSetWithData.count;
- facetAttributes = ocSrc->data.FillAreaSetWithData.facet_attributes;
- vertexAttributes = ocSrc->data.FillAreaSetWithData.vertex_attributes;
- vertices = ocSrc->data.FillAreaSetWithData.vertex_lists;
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
- if (vertexAttributes & PEXGAEdges)
- lenofVertex++; /* edge switch is CARD32 */
-
- for (i = 0, numVertices = 0; i < numFillAreas; i++)
- numVertices += vertices[i].count;
-
- dataLength = lenofFacet + numFillAreas + numVertices * lenofVertex;
-
- BEGIN_ENCODE_OCHEADER (FillAreaSetWithData, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.FillAreaSetWithData.shape_hint;
- oc->ignoreEdges = ocSrc->data.FillAreaSetWithData.ignore_edges;
- oc->contourHint = ocSrc->data.FillAreaSetWithData.contour_hint;
- oc->colorType = colorType;
- oc->facetAttribs = facetAttributes;
- oc->vertexAttribs = vertexAttributes;
- oc->numLists = numFillAreas;
-
- END_ENCODE_OCHEADER (FillAreaSetWithData, *ocDest, oc);
-
- if (facetAttributes)
- {
- STORE_FACET (colorType, facetAttributes,
- ocSrc->data.FillAreaSetWithData.facet_data, *ocDest,
- fpConvert, fpFormat);
- }
-
- for (i = 0; i < numFillAreas; i++)
- {
- STORE_CARD32 (vertices[i].count, *ocDest);
-
- STORE_LISTOF_VERTEX (vertices[i].count, NUMBYTES (lenofVertex),
- colorType, vertexAttributes, vertices[i].vertices, *ocDest,
- fpConvert, fpFormat);
- }
-}
-
-
-void _PEXEncodeTriangleStrip (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexTriangleStrip *oc;
- int dataLength;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int colorType;
- unsigned long numVertices;
- unsigned int facetAttributes;
- unsigned int vertexAttributes;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- colorType = ocSrc->data.TriangleStrip.color_type;
- numVertices = ocSrc->data.TriangleStrip.count;
- facetAttributes = ocSrc->data.TriangleStrip.facet_attributes;
- vertexAttributes = ocSrc->data.TriangleStrip.vertex_attributes;
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
- dataLength = (numVertices - 2) * lenofFacet + numVertices * lenofVertex;
-
- BEGIN_ENCODE_OCHEADER (TriangleStrip, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->colorType = colorType;
- oc->facetAttribs = facetAttributes;
- oc->vertexAttribs = vertexAttributes;
- oc->numVertices = numVertices;
-
- END_ENCODE_OCHEADER (TriangleStrip, *ocDest, oc);
-
- if (facetAttributes)
- {
- STORE_LISTOF_FACET ((numVertices - 2),
- NUMBYTES (lenofFacet), colorType,
- facetAttributes, ocSrc->data.TriangleStrip.facet_data,
- *ocDest, fpConvert, fpFormat);
- }
-
- STORE_LISTOF_VERTEX (numVertices, NUMBYTES (lenofVertex), colorType,
- vertexAttributes, ocSrc->data.TriangleStrip.vertices, *ocDest,
- fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeQuadMesh (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexQuadrilateralMesh *oc;
- int dataLength;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int colorType;
- unsigned int rowCount;
- unsigned int colCount;
- unsigned int facetAttributes;
- unsigned int vertexAttributes;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- colorType = ocSrc->data.QuadrilateralMesh.color_type;
- rowCount = ocSrc->data.QuadrilateralMesh.row_count;
- colCount = ocSrc->data.QuadrilateralMesh.col_count;
- facetAttributes = ocSrc->data.QuadrilateralMesh.facet_attributes;
- vertexAttributes = ocSrc->data.QuadrilateralMesh.vertex_attributes;
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
- dataLength = (((rowCount - 1) * (colCount - 1)) * lenofFacet) +
- (rowCount * colCount * lenofVertex);
-
- BEGIN_ENCODE_OCHEADER (QuadrilateralMesh, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->colorType = colorType;
- oc->mPts = colCount;
- oc->nPts = rowCount;
- oc->facetAttribs = facetAttributes;
- oc->vertexAttribs = vertexAttributes;
- oc->shape = ocSrc->data.QuadrilateralMesh.shape_hint;
-
- END_ENCODE_OCHEADER (QuadrilateralMesh, *ocDest, oc);
-
- if (facetAttributes)
- {
- STORE_LISTOF_FACET ((rowCount - 1) * (colCount - 1),
- NUMBYTES (lenofFacet), colorType, facetAttributes,
- ocSrc->data.QuadrilateralMesh.facet_data,
- *ocDest, fpConvert, fpFormat);
- }
-
- STORE_LISTOF_VERTEX (rowCount * colCount, NUMBYTES (lenofVertex),
- colorType, vertexAttributes, ocSrc->data.QuadrilateralMesh.vertices,
- *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeSOFA (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexSetOfFillAreaSets *oc;
- PEXConnectivityData *pConnectivity;
- PEXListOfUShort *pList;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int sizeofEdge;
- int totLength;
- int numContours;
- int count;
- int i, j;
- unsigned int facetAttributes;
- unsigned int vertexAttributes;
- unsigned int edgeAttributes;
- int colorType, cbytes;
- unsigned int numFillAreaSets;
- unsigned int numVertices;
- unsigned int numIndices;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- colorType = ocSrc->data.SetOfFillAreaSets.color_type;
- facetAttributes = ocSrc->data.SetOfFillAreaSets.facet_attributes;
- vertexAttributes = ocSrc->data.SetOfFillAreaSets.vertex_attributes;
- edgeAttributes = ocSrc->data.SetOfFillAreaSets.edge_attributes;
- numFillAreaSets = ocSrc->data.SetOfFillAreaSets.set_count;
- numVertices = ocSrc->data.SetOfFillAreaSets.vertex_count;
- numIndices = ocSrc->data.SetOfFillAreaSets.index_count;
-
- numContours = 0;
- pConnectivity = ocSrc->data.SetOfFillAreaSets.connectivity;
- for (i = 0; i < numFillAreaSets; i++, pConnectivity++)
- numContours += pConnectivity->count;
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
- sizeofEdge = edgeAttributes ? SIZEOF (CARD8) : 0;
-
- cbytes = SIZEOF (CARD16) * (numFillAreaSets + numContours + numIndices);
-
- totLength = (lenofFacet * numFillAreaSets) + (lenofVertex * numVertices) +
- NUMWORDS (sizeofEdge * numIndices) + NUMWORDS (cbytes);
-
- BEGIN_ENCODE_OCHEADER (SetOfFillAreaSets, ocSrc->oc_type,
- totLength, *ocDest, oc);
-
- oc->shape = ocSrc->data.SetOfFillAreaSets.shape_hint;
- oc->colorType = colorType;
- oc->FAS_Attributes = facetAttributes;
- oc->vertexAttributes = vertexAttributes;
- oc->edgeAttributes = edgeAttributes ? PEXOn : PEXOff;
- oc->contourHint = ocSrc->data.SetOfFillAreaSets.contour_hint;
- oc->contourCountsFlag = ocSrc->data.SetOfFillAreaSets.contours_all_one;
- oc->numFAS = numFillAreaSets;
- oc->numVertices = numVertices;
- oc->numEdges = numIndices;
- oc->numContours = numContours;
-
- END_ENCODE_OCHEADER (SetOfFillAreaSets, *ocDest, oc);
-
- if (facetAttributes)
- {
- STORE_LISTOF_FACET (numFillAreaSets, NUMBYTES (lenofFacet), colorType,
- facetAttributes, ocSrc->data.SetOfFillAreaSets.facet_data,
- *ocDest, fpConvert, fpFormat);
- }
-
- STORE_LISTOF_VERTEX (numVertices, NUMBYTES (lenofVertex), colorType,
- vertexAttributes, ocSrc->data.SetOfFillAreaSets.vertices,
- *ocDest, fpConvert, fpFormat);
-
- if (edgeAttributes)
- {
- memcpy (*ocDest, ocSrc->data.SetOfFillAreaSets.edge_flags, numIndices);
-
- *ocDest += PADDED_BYTES (numIndices);
- }
-
- pConnectivity = ocSrc->data.SetOfFillAreaSets.connectivity;
-
- for (i = 0 ; i < numFillAreaSets; i++)
- {
- count = pConnectivity->count;
- STORE_CARD16 (count, *ocDest);
-
- for (j = 0, pList = pConnectivity->lists; j < count; j++, pList++)
- {
- STORE_CARD16 (pList->count, *ocDest);
-
- STORE_LISTOF_CARD16 (pList->count, pList->shorts, *ocDest);
- }
-
- pConnectivity++;
- }
-
- *ocDest += PAD (cbytes);
-}
-
-
-void _PEXEncodeNURBSurface (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexNURBSurface *oc;
- pexTrimCurve *pTCHead;
- PEXTrimCurve *ptrimCurve;
- PEXListOfTrimCurve *ptrimLoop;
- int dataLength;
- int lenofVertexList;
- int lenofUKnotList;
- int lenofVKnotList;
- int lenofTrimData;
- int thisLength, i;
- int count;
- unsigned int numMPoints, numNPoints;
- int rationality, uorder, vorder;
- unsigned long numTrimLoops;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- numMPoints = ocSrc->data.NURBSurface.col_count;
- numNPoints = ocSrc->data.NURBSurface.row_count;
- rationality = ocSrc->data.NURBSurface.rationality;
- uorder = ocSrc->data.NURBSurface.uorder;
- vorder = ocSrc->data.NURBSurface.vorder;
- numTrimLoops = ocSrc->data.NURBSurface.curve_count;
-
- lenofVertexList = numMPoints * numNPoints *
- ((rationality == PEXRational) ?
- LENOF (pexCoord4D) : LENOF (pexCoord3D));
- lenofUKnotList = uorder + numMPoints;
- lenofVKnotList = vorder + numNPoints;
-
- lenofTrimData = numTrimLoops * LENOF (CARD32);
-
- ptrimLoop = ocSrc->data.NURBSurface.trim_curves;
- for (i = 0; i < numTrimLoops; i++, ptrimLoop++)
- {
- ptrimCurve = ptrimLoop->curves;
- count = ptrimLoop->count;
-
- while (count--)
- {
- lenofTrimData += (LENOF (pexTrimCurve) +
- ptrimCurve->count +
- ptrimCurve->order + /* knot list */
- ptrimCurve->count *
- (ptrimCurve->rationality == PEXRational ?
- LENOF (pexCoord3D) : LENOF (pexCoord2D)));
- ptrimCurve++;
- }
- }
-
- dataLength = lenofUKnotList + lenofVKnotList +
- lenofVertexList + lenofTrimData;
-
- BEGIN_ENCODE_OCHEADER (NURBSurface, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- oc->type = rationality;
- oc->uOrder = uorder;
- oc->vOrder = vorder;
- oc->numUknots = uorder + numMPoints;
- oc->numVknots = vorder + numNPoints;
- oc->mPts = numMPoints;
- oc->nPts = numNPoints;
- oc->numLists = numTrimLoops;
-
- END_ENCODE_OCHEADER (NURBSurface, *ocDest, oc);
-
- STORE_LISTOF_FLOAT32 (lenofUKnotList, ocSrc->data.NURBSurface.uknots,
- *ocDest, fpConvert, fpFormat);
-
- STORE_LISTOF_FLOAT32 (lenofVKnotList, ocSrc->data.NURBSurface.vknots,
- *ocDest, fpConvert, fpFormat);
-
- if (rationality == PEXRational)
- {
- STORE_LISTOF_COORD4D (numMPoints * numNPoints,
- ocSrc->data.NURBSurface.points.point_4d, *ocDest,
- fpConvert, fpFormat);
- }
- else
- {
- STORE_LISTOF_COORD3D (numMPoints * numNPoints,
- ocSrc->data.NURBSurface.points.point, *ocDest,
- fpConvert, fpFormat);
- }
-
- ptrimLoop = ocSrc->data.NURBSurface.trim_curves;
- for (i = 0; i < numTrimLoops; i++, ptrimLoop++)
- {
- count = ptrimLoop->count;
- STORE_CARD32 (count, *ocDest);
-
- ptrimCurve = ptrimLoop->curves;
-
- while (count--)
- {
- thisLength = ptrimCurve->order + ptrimCurve->count;
-
- BEGIN_TRIMCURVE_HEAD (*ocDest, pTCHead);
-
- pTCHead->visibility = (pexSwitch) ptrimCurve->visibility;
- pTCHead->order = (CARD16) ptrimCurve->order;
- pTCHead->type = (pexCoordType) ptrimCurve->rationality;
- pTCHead->approxMethod = (INT16) ptrimCurve->approx_method;
- pTCHead->numKnots = thisLength;
- pTCHead->numCoord = ptrimCurve->count;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ptrimCurve->tolerance,
- pTCHead->tolerance, fpFormat);
- FP_CONVERT_HTON (ptrimCurve->tmin,
- pTCHead->tMin, fpFormat);
- FP_CONVERT_HTON (ptrimCurve->tmax,
- pTCHead->tMax, fpFormat);
- }
- else
- {
- pTCHead->tolerance = (float) ptrimCurve->tolerance;
- pTCHead->tMin = (float) ptrimCurve->tmin;
- pTCHead->tMax = (float) ptrimCurve->tmax;
- }
-
- END_TRIMCURVE_HEAD (*ocDest, pTCHead);
- *ocDest += SIZEOF (pexTrimCurve);
-
- STORE_LISTOF_FLOAT32 (thisLength,
- ptrimCurve->knots.floats, *ocDest, fpConvert, fpFormat);
-
- if (ptrimCurve->rationality == PEXRational)
- {
- STORE_LISTOF_COORD3D (ptrimCurve->count,
- ptrimCurve->control_points.point, *ocDest,
- fpConvert, fpFormat);
- }
- else
- {
- STORE_LISTOF_COORD2D (ptrimCurve->count,
- ptrimCurve->control_points.point_2d, *ocDest,
- fpConvert, fpFormat);
- }
-
- ptrimCurve++;
- }
- }
-}
-
-
-void _PEXEncodeCellArray (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexCellArray *oc;
- int dataLength;
- int count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- count = ocSrc->data.CellArray.col_count * ocSrc->data.CellArray.row_count;
- dataLength = NUMWORDS (count * SIZEOF (pexTableIndex));
-
- BEGIN_ENCODE_OCHEADER (CellArray, ocSrc->oc_type, dataLength, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.CellArray.point1.x,
- oc->point1_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point1.y,
- oc->point1_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point1.z,
- oc->point1_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point2.x,
- oc->point2_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point2.y,
- oc->point2_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point2.z,
- oc->point2_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point3.x,
- oc->point3_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point3.y,
- oc->point3_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray.point3.z,
- oc->point3_z, fpFormat);
- }
- else
- {
- oc->point1_x = ocSrc->data.CellArray.point1.x;
- oc->point1_y = ocSrc->data.CellArray.point1.y;
- oc->point1_z = ocSrc->data.CellArray.point1.z;
- oc->point2_x = ocSrc->data.CellArray.point2.x;
- oc->point2_y = ocSrc->data.CellArray.point2.y;
- oc->point2_z = ocSrc->data.CellArray.point2.z;
- oc->point3_x = ocSrc->data.CellArray.point3.x;
- oc->point3_y = ocSrc->data.CellArray.point3.y;
- oc->point3_z = ocSrc->data.CellArray.point3.z;
- }
-
- oc->dx = ocSrc->data.CellArray.col_count;
- oc->dy = ocSrc->data.CellArray.row_count;
-
- END_ENCODE_OCHEADER (CellArray, *ocDest, oc);
-
- STORE_LISTOF_CARD16 (count, ocSrc->data.CellArray.color_indices, *ocDest);
-
- if (count & 1)
- *ocDest += 2;
-}
-
-
-void _PEXEncodeCellArray2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexCellArray2D *oc;
- int dataLength;
- int count;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- count = ocSrc->data.CellArray2D.col_count *
- ocSrc->data.CellArray2D.row_count;
-
- dataLength = NUMWORDS (count * SIZEOF (pexTableIndex));
-
- BEGIN_ENCODE_OCHEADER (CellArray2D, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.CellArray2D.point1.x,
- oc->point1_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray2D.point1.y,
- oc->point1_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray2D.point2.x,
- oc->point2_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.CellArray2D.point2.y,
- oc->point2_y, fpFormat);
- }
- else
- {
- oc->point1_x = ocSrc->data.CellArray2D.point1.x;
- oc->point1_y = ocSrc->data.CellArray2D.point1.y;
- oc->point2_x = ocSrc->data.CellArray2D.point2.x;
- oc->point2_y = ocSrc->data.CellArray2D.point2.y;
- }
-
- oc->dx = ocSrc->data.CellArray2D.col_count;
- oc->dy = ocSrc->data.CellArray2D.row_count;
-
- END_ENCODE_OCHEADER (CellArray2D, *ocDest, oc);
-
- STORE_LISTOF_CARD16 (count,
- ocSrc->data.CellArray2D.color_indices, *ocDest);
-
- if (count & 1)
- *ocDest += 2;
-}
-
-
-void _PEXEncodeExtendedCellArray (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexExtendedCellArray *oc;
- int count;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- count = ocSrc->data.ExtendedCellArray.col_count *
- ocSrc->data.ExtendedCellArray.row_count;
-
- dataLength = count *
- GetColorLength (ocSrc->data.ExtendedCellArray.color_type);
-
- BEGIN_ENCODE_OCHEADER (ExtendedCellArray, ocSrc->oc_type,
- dataLength, *ocDest, oc);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point1.x,
- oc->point1_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point1.y,
- oc->point1_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point1.z,
- oc->point1_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point2.x,
- oc->point2_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point2.y,
- oc->point2_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point2.z,
- oc->point2_z, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point3.x,
- oc->point3_x, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point3.y,
- oc->point3_y, fpFormat);
- FP_CONVERT_HTON (ocSrc->data.ExtendedCellArray.point3.z,
- oc->point3_z, fpFormat);
- }
- else
- {
- oc->point1_x = ocSrc->data.ExtendedCellArray.point1.x;
- oc->point1_y = ocSrc->data.ExtendedCellArray.point1.y;
- oc->point1_z = ocSrc->data.ExtendedCellArray.point1.z;
- oc->point2_x = ocSrc->data.ExtendedCellArray.point2.x;
- oc->point2_y = ocSrc->data.ExtendedCellArray.point2.y;
- oc->point2_z = ocSrc->data.ExtendedCellArray.point2.z;
- oc->point3_x = ocSrc->data.ExtendedCellArray.point3.x;
- oc->point3_y = ocSrc->data.ExtendedCellArray.point3.y;
- oc->point3_z = ocSrc->data.ExtendedCellArray.point3.z;
- }
-
- oc->colorType = ocSrc->data.ExtendedCellArray.color_type;
- oc->dx = ocSrc->data.ExtendedCellArray.col_count;
- oc->dy = ocSrc->data.ExtendedCellArray.row_count;
-
- END_ENCODE_OCHEADER (ExtendedCellArray, *ocDest, oc);
-
- STORE_LISTOF_COLOR_VAL (count, ocSrc->data.ExtendedCellArray.color_type,
- ocSrc->data.ExtendedCellArray.colors, *ocDest, fpConvert, fpFormat);
-}
-
-
-void _PEXEncodeGDP (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexGDP *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = ocSrc->data.GDP.count * LENOF (pexCoord3D) +
- NUMWORDS (ocSrc->data.GDP.length);
-
- BEGIN_ENCODE_OCHEADER (GDP, ocSrc->oc_type, dataLength, *ocDest, oc);
-
- oc->gdpId = ocSrc->data.GDP.gdp_id;
- oc->numPoints = ocSrc->data.GDP.count;
- oc->numBytes = ocSrc->data.GDP.length;
-
- END_ENCODE_OCHEADER (GDP, *ocDest, oc);
-
- STORE_LISTOF_COORD3D (ocSrc->data.GDP.count, ocSrc->data.GDP.points,
- *ocDest, fpConvert, fpFormat);
-
- memcpy (*ocDest, ocSrc->data.GDP.data, ocSrc->data.GDP.length);
- *ocDest += PADDED_BYTES (ocSrc->data.GDP.length);
-}
-
-
-void _PEXEncodeGDP2D (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexGDP2D *oc;
- int dataLength;
- int fpConvert = (fpFormat != NATIVE_FP_FORMAT);
-
- dataLength = ocSrc->data.GDP2D.count * LENOF (pexCoord2D) +
- NUMWORDS (ocSrc->data.GDP2D.length);
-
- BEGIN_ENCODE_OCHEADER (GDP2D, ocSrc->oc_type, dataLength, *ocDest, oc);
-
- oc->gdpId = ocSrc->data.GDP2D.gdp_id;
- oc->numPoints = ocSrc->data.GDP2D.count;
- oc->numBytes = ocSrc->data.GDP2D.length;
-
- END_ENCODE_OCHEADER (GDP2D, *ocDest, oc);
-
- STORE_LISTOF_COORD2D (ocSrc->data.GDP2D.count, ocSrc->data.GDP2D.points,
- *ocDest, fpConvert, fpFormat);
-
- memcpy (*ocDest, ocSrc->data.GDP2D.data, ocSrc->data.GDP2D.length);
- *ocDest += PADDED_BYTES (ocSrc->data.GDP2D.length);
-}
-
-
-void _PEXEncodeNoop (fpFormat, ocSrc, ocDest)
-
-int fpFormat;
-PEXOCData *ocSrc;
-char **ocDest;
-
-{
- pexNoop *oc;
-
- BEGIN_SIMPLE_ENCODE (Noop, ocSrc->oc_type, *ocDest, oc);
- /* no data */
- END_SIMPLE_ENCODE (Noop, *ocDest, oc);
-}
diff --git a/xc/lib/PEX5/pl_oc_prim.c b/xc/lib/PEX5/pl_oc_prim.c
deleted file mode 100644
index 8fbb08110..000000000
--- a/xc/lib/PEX5/pl_oc_prim.c
+++ /dev/null
@@ -1,2448 +0,0 @@
-/* $TOG: pl_oc_prim.c /main/16 1998/02/06 16:11:11 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-void
-PEXMarkers (display, resource_id, req_type, numPoints, points)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int numPoints;
-INPUT PEXCoord *points;
-
-{
- register pexMarkers *req;
- char *pBuf;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numPoints * SIZEOF (pexCoord3D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexMarkers), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Markers, dataLength, pBuf, req);
- END_OC_HEADER (Markers, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_COORD3D (numPoints, points, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXMarkers2D (display, resource_id, req_type, numPoints, points)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int numPoints;
-INPUT PEXCoord2D *points;
-
-{
- register pexMarkers2D *req;
- char *pBuf;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numPoints * SIZEOF (pexCoord2D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexMarkers2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Markers2D, dataLength, pBuf, req);
- END_OC_HEADER (Markers2D, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_COORD2D (numPoints, points, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXText (display, resource_id, req_type, origin, vec1, vec2, count, string)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *origin;
-INPUT PEXVector *vec1;
-INPUT PEXVector *vec2;
-INPUT int count;
-INPUT char *string;
-
-{
- register pexText *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = LENOF (pexMonoEncoding) + NUMWORDS (count);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexText), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the text request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Text, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- FP_CONVERT_HTON (origin->z, req->origin_z, fpFormat);
- FP_CONVERT_HTON (vec1->x, req->vector1_x, fpFormat);
- FP_CONVERT_HTON (vec1->y, req->vector1_y, fpFormat);
- FP_CONVERT_HTON (vec1->z, req->vector1_z, fpFormat);
- FP_CONVERT_HTON (vec2->x, req->vector2_x, fpFormat);
- FP_CONVERT_HTON (vec2->y, req->vector2_y, fpFormat);
- FP_CONVERT_HTON (vec2->z, req->vector2_z, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- req->origin_z = origin->z;
- req->vector1_x = vec1->x;
- req->vector1_y = vec1->y;
- req->vector1_z = vec1->z;
- req->vector2_x = vec2->x;
- req->vector2_y = vec2->y;
- req->vector2_z = vec2->z;
- }
-
- req->numEncodings = (CARD16) 1;
-
- END_OC_HEADER (Text, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_DEFAULT_MONO_STRING (count, string);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXText2D (display, resource_id, req_type, origin, count, string)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord2D *origin;
-INPUT int count;
-INPUT char *string;
-
-{
- register pexText2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = LENOF (pexMonoEncoding) + NUMWORDS (count);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexText2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the text header request data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Text2D, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- }
-
- req->numEncodings = (CARD16) 1;
-
- END_OC_HEADER (Text2D, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_DEFAULT_MONO_STRING (count, string);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXAnnotationText (display, resource_id, req_type,
- origin, offset, count, string)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *origin;
-INPUT PEXCoord *offset;
-INPUT int count;
-INPUT char *string;
-
-{
- register pexAnnotationText *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = LENOF (pexMonoEncoding) + NUMWORDS (count);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexAnnotationText), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the atext request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (AnnotationText, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- FP_CONVERT_HTON (origin->z, req->origin_z, fpFormat);
- FP_CONVERT_HTON (offset->x, req->offset_x, fpFormat);
- FP_CONVERT_HTON (offset->y, req->offset_y, fpFormat);
- FP_CONVERT_HTON (offset->z, req->offset_z, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- req->origin_z = origin->z;
- req->offset_x = offset->x;
- req->offset_y = offset->y;
- req->offset_z = offset->z;
- }
-
- req->numEncodings = (CARD16) 1;
-
- END_OC_HEADER (AnnotationText, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_DEFAULT_MONO_STRING (count, string);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXAnnotationText2D (display, resource_id, req_type,
- origin, offset, count, string)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord2D *origin;
-INPUT PEXCoord2D *offset;
-INPUT int count;
-INPUT char *string;
-
-{
- register pexAnnotationText2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = LENOF (pexMonoEncoding) + NUMWORDS (count);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexAnnotationText2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the atext request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (AnnotationText2D, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- FP_CONVERT_HTON (offset->x, req->offset_x, fpFormat);
- FP_CONVERT_HTON (offset->y, req->offset_y, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- req->offset_x = offset->x;
- req->offset_y = offset->y;
- }
-
- req->numEncodings = (CARD16) 1;
-
- END_OC_HEADER (AnnotationText2D, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_DEFAULT_MONO_STRING (count, string);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXEncodedText (display, resource_id, req_type,
- origin, vec1, vec2, numEncodings, encodedTextList)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *origin;
-INPUT PEXVector *vec1;
-INPUT PEXVector *vec2;
-INPUT unsigned int numEncodings;
-INPUT PEXEncodedTextData *encodedTextList;
-
-{
- register pexText *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int lenofStrings;
-
-
- /*
- * Get length of mono-encoded strings.
- */
-
- GetStringsLength (numEncodings, encodedTextList, lenofStrings);
-
-
- /*
- * Initialize the OC request.
- */
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexText), lenofStrings, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the text request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Text, lenofStrings, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- FP_CONVERT_HTON (origin->z, req->origin_z, fpFormat);
- FP_CONVERT_HTON (vec1->x, req->vector1_x, fpFormat);
- FP_CONVERT_HTON (vec1->y, req->vector1_y, fpFormat);
- FP_CONVERT_HTON (vec1->z, req->vector1_z, fpFormat);
- FP_CONVERT_HTON (vec2->x, req->vector2_x, fpFormat);
- FP_CONVERT_HTON (vec2->y, req->vector2_y, fpFormat);
- FP_CONVERT_HTON (vec2->z, req->vector2_z, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- req->origin_z = origin->z;
- req->vector1_x = vec1->x;
- req->vector1_y = vec1->y;
- req->vector1_z = vec1->z;
- req->vector2_x = vec2->x;
- req->vector2_y = vec2->y;
- req->vector2_z = vec2->z;
- }
-
- req->numEncodings = (CARD16) numEncodings;
-
- END_OC_HEADER (Text, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_LISTOF_MONO_STRING (numEncodings, encodedTextList);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXEncodedText2D (display, resource_id, req_type,
- origin, numEncodings, encodedTextList)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord2D *origin;
-INPUT unsigned int numEncodings;
-INPUT PEXEncodedTextData *encodedTextList;
-
-{
- register pexText2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int lenofStrings;
-
-
- /*
- * Get length of mono-encoded strings.
- */
-
- GetStringsLength (numEncodings, encodedTextList, lenofStrings);
-
-
- /*
- * Initialize the OC request.
- */
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexText2D), lenofStrings, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the text header request data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Text2D, lenofStrings, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- }
-
- req->numEncodings = (CARD16) numEncodings;
-
- END_OC_HEADER (Text2D, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_LISTOF_MONO_STRING (numEncodings, encodedTextList);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXEncodedAnnoText (display, resource_id, req_type,
- origin, offset, numEncodings, encodedTextList)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *origin;
-INPUT PEXCoord *offset;
-INPUT unsigned int numEncodings;
-INPUT PEXEncodedTextData *encodedTextList;
-
-{
- register pexAnnotationText *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int lenofStrings;
-
-
- /*
- * Get length of mono-encoded strings.
- */
-
- GetStringsLength (numEncodings, encodedTextList, lenofStrings);
-
-
- /*
- * Initialize the OC request.
- */
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexAnnotationText), lenofStrings, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the atext request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (AnnotationText, lenofStrings, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- FP_CONVERT_HTON (origin->z, req->origin_z, fpFormat);
- FP_CONVERT_HTON (offset->x, req->offset_x, fpFormat);
- FP_CONVERT_HTON (offset->y, req->offset_y, fpFormat);
- FP_CONVERT_HTON (offset->z, req->offset_z, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- req->origin_z = origin->z;
- req->offset_x = offset->x;
- req->offset_y = offset->y;
- req->offset_z = offset->z;
- }
-
- req->numEncodings = (CARD16) numEncodings;
-
- END_OC_HEADER (AnnotationText, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_LISTOF_MONO_STRING (numEncodings, encodedTextList);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXEncodedAnnoText2D (display, resource_id, req_type,
- origin, offset, numEncodings, encodedTextList)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord2D *origin;
-INPUT PEXCoord2D *offset;
-INPUT unsigned int numEncodings;
-INPUT PEXEncodedTextData *encodedTextList;
-
-{
- register pexAnnotationText2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int lenofStrings;
-
-
- /*
- * Get length of mono-encoded strings.
- */
-
- GetStringsLength (numEncodings, encodedTextList, lenofStrings);
-
-
- /*
- * Initialize the OC request.
- */
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexAnnotationText2D), lenofStrings, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the atext request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (AnnotationText2D, lenofStrings, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (origin->x, req->origin_x, fpFormat);
- FP_CONVERT_HTON (origin->y, req->origin_y, fpFormat);
- FP_CONVERT_HTON (offset->x, req->offset_x, fpFormat);
- FP_CONVERT_HTON (offset->y, req->offset_y, fpFormat);
- }
- else
- {
- req->origin_x = origin->x;
- req->origin_y = origin->y;
- req->offset_x = offset->x;
- req->offset_y = offset->y;
- }
-
- req->numEncodings = (CARD16) numEncodings;
-
- END_OC_HEADER (AnnotationText2D, pBuf, req);
-
-
- /*
- * Store the mono-encoded string.
- */
-
- OC_LISTOF_MONO_STRING (numEncodings, encodedTextList);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXPolyline (display, resource_id, req_type, numVertices, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int numVertices;
-INPUT PEXCoord *vertices;
-
-{
- register pexPolyline *req;
- char *pBuf;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numVertices * SIZEOF (pexCoord3D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexPolyline), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Polyline, dataLength, pBuf, req);
- END_OC_HEADER (Polyline, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_COORD3D (numVertices, vertices, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXPolyline2D (display, resource_id, req_type, numVertices, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int numVertices;
-INPUT PEXCoord2D *vertices;
-
-{
- register pexPolyline2D *req;
- char *pBuf;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (numVertices * SIZEOF (pexCoord2D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexPolyline2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (Polyline2D, dataLength, pBuf, req);
- END_OC_HEADER (Polyline2D, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_COORD2D (numVertices, vertices, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXPolylineSetWithData (display, resource_id, req_type,
- vertexAttributes, colorType, numPolylines, polylines)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int vertexAttributes;
-INPUT int colorType;
-INPUT unsigned int numPolylines;
-INPUT PEXListOfVertex *polylines;
-
-{
- register pexPolylineSetWithData *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int lenofVertex;
- int numPoints, i;
- int dataLength;
- char *pData;
-
-
- /*
- * Calculate the total number of vertices.
- */
-
- for (i = 0, numPoints = 0; i < numPolylines; i++)
- numPoints += polylines[i].count;
-
-
- /*
- * Calculate how big each vertex is.
- */
-
- lenofVertex = LENOF (pexCoord3D) +
- ((vertexAttributes & PEXGAColor) ? GetColorLength (colorType) : 0);
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numPolylines + (numPoints * lenofVertex);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexPolylineSetWithData), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the polyline request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (PolylineSetWithData, dataLength, pBuf, req);
-
- req->colorType = colorType;
- req->vertexAttribs = vertexAttributes;
- req->numLists = numPolylines;
-
- END_OC_HEADER (PolylineSetWithData, pBuf, req);
-
-
- /*
- * For each polyline store a count and then the list of vertices.
- * Note that the vertices are padded to end on a word boundary
- */
-
- vertexAttributes &= PEXGAColor; /* only color allowed at vertices */
-
- for (i = 0; i < numPolylines; i++)
- {
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD32));
- PUT_CARD32 (polylines[i].count, pData);
-
- OC_LISTOF_VERTEX (polylines[i].count, lenofVertex, colorType,
- vertexAttributes, polylines[i].vertices, fpConvert, fpFormat);
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXNURBCurve (display, resource_id, req_type,
- rationality, order, knots, numPoints, points, tmin, tmax)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int rationality;
-INPUT int order;
-INPUT float *knots;
-INPUT unsigned int numPoints;
-INPUT PEXArrayOfCoord points;
-INPUT double tmin;
-INPUT double tmax;
-
-{
- register pexNURBCurve *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int lenofVertexList;
- int lenofKnotList;
-
-
- /*
- * Calculate the number of words in the vertex list and knot list. The
- * number of knots = order + number of points.
- */
-
- lenofVertexList = numPoints * ((rationality == PEXRational) ?
- LENOF (pexCoord4D) : LENOF (pexCoord3D));
- lenofKnotList = order + numPoints;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = lenofKnotList + lenofVertexList;
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexNURBCurve), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the nurb request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (NURBCurve, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (tmin, req->tmin, fpFormat);
- FP_CONVERT_DHTON (tmax, req->tmax, fpFormat);
- }
- else
- {
- req->tmin = tmin;
- req->tmax = tmax;
- }
-
- req->curveOrder = order;
- req->coordType = rationality;
- req->numKnots = order + numPoints;
- req->numPoints = numPoints;
-
- END_OC_HEADER (NURBCurve, pBuf, req);
-
-
- /*
- * Store the knot list and the vertex list.
- */
-
- OC_LISTOF_FLOAT32 (lenofKnotList, knots, fpConvert, fpFormat);
-
- if (rationality == PEXRational)
- {
- OC_LISTOF_COORD4D (numPoints, points.point_4d,
- fpConvert, fpFormat);
- }
- else
- {
- OC_LISTOF_COORD3D (numPoints, points.point,
- fpConvert, fpFormat);
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXFillArea (display, resource_id, req_type,
- shape, ignoreEdges, numPoints, points)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT int ignoreEdges;
-INPUT unsigned int numPoints;
-INPUT PEXCoord *points;
-
-{
- register pexFillArea *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numPoints * LENOF (pexCoord3D);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexFillArea), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the fill area request data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (FillArea, dataLength, pBuf, req);
-
- req->shape = shape;
- req->ignoreEdges = ignoreEdges;
-
- END_OC_HEADER (FillArea, pBuf, req);
-
-
- /*
- * Copy the vertex data to the oc.
- */
-
- OC_LISTOF_COORD3D (numPoints, points, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXFillArea2D (display, resource_id, req_type,
- shape, ignoreEdges, numPoints, points)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT int ignoreEdges;
-INPUT unsigned int numPoints;
-INPUT PEXCoord2D *points;
-
-{
- register pexFillArea2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numPoints * LENOF (pexCoord2D);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexFillArea2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the fill area request data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (FillArea2D, dataLength, pBuf, req);
-
- req->shape = shape;
- req->ignoreEdges = ignoreEdges;
-
- END_OC_HEADER (FillArea2D, pBuf, req);
-
-
- /*
- * Copy the vertex data to the oc.
- */
-
- OC_LISTOF_COORD2D (numPoints, points, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXFillAreaWithData (display, resource_id, req_type,
- shape, ignoreEdges, facetAttributes, vertexAttributes, colorType,
- facetData, numVertices, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT int ignoreEdges;
-INPUT unsigned int facetAttributes;
-INPUT unsigned int vertexAttributes;
-INPUT int colorType;
-INPUT PEXFacetData *facetData;
-INPUT unsigned int numVertices;
-INPUT PEXArrayOfVertex vertices;
-
-{
- register pexFillAreaWithData *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int lenofFacet;
- int lenofVertex;
- int lenofColor;
- char *pData;
-
-
- /*
- * Calculate the number of words in the optional facet data and the
- * number of words per vertex.
- */
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = lenofFacet + 1 /* count */ + numVertices * lenofVertex;
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexFillAreaWithData), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the fill area request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (FillAreaWithData, dataLength, pBuf, req);
-
- req->shape = shape;
- req->ignoreEdges = ignoreEdges;
- req->colorType = colorType;
- req->facetAttribs = facetAttributes;
- req->vertexAttribs = vertexAttributes;
-
- END_OC_HEADER (FillAreaWithData, pBuf, req);
-
-
- /*
- * Copy the facet data.
- */
-
- if (facetAttributes)
- {
- OC_FACET (colorType, facetAttributes, facetData, fpConvert, fpFormat);
- }
-
-
- /*
- * Copy the vertex data.
- */
-
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD32));
- PUT_CARD32 (numVertices, pData);
-
- OC_LISTOF_VERTEX (numVertices, lenofVertex, colorType,
- vertexAttributes, vertices, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXFillAreaSet (display, resource_id, req_type,
- shape, ignoreEdges, contourHint, numFillAreas, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT int ignoreEdges;
-INPUT int contourHint;
-INPUT unsigned int numFillAreas;
-INPUT PEXListOfCoord *vertices;
-
-{
- register pexFillAreaSet *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int numPoints, i;
- char *pData;
-
-
- /*
- * Calculate the total number of vertices
- */
-
- for (i = 0, numPoints = 0; i < numFillAreas; i++)
- numPoints += vertices[i].count;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numFillAreas /* counts */ + (numPoints * LENOF (pexCoord3D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexFillAreaSet), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the fill area set request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (FillAreaSet, dataLength, pBuf, req);
-
- req->shape = shape;
- req->ignoreEdges = ignoreEdges;
- req->contourHint = contourHint;
- req->numLists = numFillAreas;
-
- END_OC_HEADER (FillAreaSet, pBuf, req);
-
-
- /*
- * Now store the fill area set. Each fill area in the set consists of
- * a vertex count followed by a polygon.
- */
-
- for (i = 0; i < numFillAreas; i++)
- {
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD32));
- PUT_CARD32 (vertices[i].count, pData);
-
- OC_LISTOF_COORD3D (vertices[i].count, vertices[i].points,
- fpConvert, fpFormat);
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXFillAreaSet2D (display, resource_id, req_type,
- shape, ignoreEdges, contourHint, numFillAreas, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT int ignoreEdges;
-INPUT int contourHint;
-INPUT unsigned int numFillAreas;
-INPUT PEXListOfCoord2D *vertices;
-
-{
- register pexFillAreaSet2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int numPoints, i;
- char *pData;
-
-
- /*
- * Calculate the total number of vertices
- */
-
- for (i = 0, numPoints = 0; i < numFillAreas; i++)
- numPoints += vertices[i].count;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numFillAreas /* counts */ + (numPoints * LENOF (pexCoord2D));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexFillAreaSet2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the fill area set request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (FillAreaSet2D, dataLength, pBuf, req);
-
- req->shape = shape;
- req->ignoreEdges = ignoreEdges;
- req->contourHint = contourHint;
- req->numLists = numFillAreas;
-
- END_OC_HEADER (FillAreaSet2D, pBuf, req);
-
-
- /*
- * Now store the fill area set. Each fill area in the set consists of
- * a vertex count followed by a polygon.
- */
-
- for (i = 0; i < numFillAreas; i++)
- {
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD32));
- PUT_CARD32 (vertices[i].count, pData);
-
- OC_LISTOF_COORD2D (vertices[i].count, vertices[i].points,
- fpConvert, fpFormat);
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXFillAreaSetWithData (display, resource_id, req_type,
- shape, ignoreEdges, contourHint, facetAttributes, vertexAttributes,
- colorType, numFillAreas, facetData, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT int ignoreEdges;
-INPUT int contourHint;
-INPUT unsigned int facetAttributes;
-INPUT unsigned int vertexAttributes;
-INPUT int colorType;
-INPUT unsigned int numFillAreas;
-INPUT PEXFacetData *facetData;
-INPUT PEXListOfVertex *vertices;
-
-{
- register pexFillAreaSetWithData *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int numVertices, i;
- char *pData;
-
-
- /*
- * Calculate the size of the facet data and vertex data.
- */
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
- if (vertexAttributes & PEXGAEdges)
- lenofVertex++; /* edge switch is CARD32 */
-
- for (i = 0, numVertices = 0; i < numFillAreas; i++)
- numVertices += vertices[i].count;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = lenofFacet + numFillAreas + numVertices * lenofVertex;
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexFillAreaSetWithData), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the fill area set request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (FillAreaSetWithData, dataLength, pBuf, req);
-
- req->shape = shape;
- req->ignoreEdges = ignoreEdges;
- req->contourHint = contourHint;
- req->colorType = colorType;
- req->facetAttribs = facetAttributes;
- req->vertexAttribs = vertexAttributes;
- req->numLists = numFillAreas;
-
- END_OC_HEADER (FillAreaSetWithData, pBuf, req);
-
-
- /*
- * Copy the facet data
- */
-
- if (facetAttributes)
- {
- OC_FACET (colorType, facetAttributes, facetData, fpConvert, fpFormat);
- }
-
-
- /*
- * Copy the polygon vertices, preceded by a count.
- * Note that the vertices are padded to end on a word boundary.
- */
-
- for (i = 0; i < numFillAreas; i++)
- {
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD32));
- PUT_CARD32 (vertices[i].count, pData);
-
- OC_LISTOF_VERTEX (vertices[i].count, lenofVertex, colorType,
- vertexAttributes, vertices[i].vertices, fpConvert, fpFormat);
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetOfFillAreaSets (display, resource_id, req_type, shape,
- facetAttributes, vertexAttributes, edgeAttributes, contourHint,
- contoursAllOne, colorType, numFillAreaSets, facetData,
- numVertices, vertices, numIndices, edgeFlags, connectivity)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT unsigned int facetAttributes;
-INPUT unsigned int vertexAttributes;
-INPUT unsigned int edgeAttributes;
-INPUT int contourHint;
-INPUT int contoursAllOne;
-INPUT int colorType;
-INPUT unsigned int numFillAreaSets;
-INPUT PEXArrayOfFacetData facetData;
-INPUT unsigned int numVertices;
-INPUT PEXArrayOfVertex vertices;
-INPUT unsigned int numIndices;
-INPUT PEXSwitch *edgeFlags;
-INPUT PEXConnectivityData *connectivity;
-
-{
- register pexSetOfFillAreaSets *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- PEXConnectivityData *pConnectivity;
- PEXListOfUShort *pList;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int sizeofEdge;
- int numContours;
- int count, scount;
- int cbytes;
- int i, j;
- char *pData;
-
-
- /*
- * Calculate the total number of contours.
- */
-
- numContours = 0;
- pConnectivity = connectivity;
- for (i = 0; i < numFillAreaSets; i++, pConnectivity++)
- numContours += pConnectivity->count;
-
-
- /*
- * Calculate the size of the facet data and vertex data
- */
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
- sizeofEdge = edgeAttributes ? SIZEOF (CARD8) : 0;
-
- cbytes = SIZEOF (CARD16) * (numFillAreaSets + numContours + numIndices);
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = (lenofFacet * numFillAreaSets) +
- (lenofVertex * numVertices) +
- NUMWORDS (sizeofEdge * numIndices) + NUMWORDS (cbytes);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexSetOfFillAreaSets), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the SOFA request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (SetOfFillAreaSets, dataLength, pBuf, req);
-
- req->shape = shape;
- req->colorType = colorType;
- req->FAS_Attributes = facetAttributes;
- req->vertexAttributes = vertexAttributes;
- req->edgeAttributes = edgeAttributes ? PEXOn : PEXOff;
- req->contourHint = contourHint;
- req->contourCountsFlag = contoursAllOne;
- req->numFAS = numFillAreaSets;
- req->numVertices = numVertices;
- req->numEdges = numIndices;
- req->numContours = numContours;
-
- END_OC_HEADER (SetOfFillAreaSets, pBuf, req);
-
-
- /*
- * Copy the facet data.
- */
-
- if (facetAttributes)
- {
- OC_LISTOF_FACET (numFillAreaSets, lenofFacet, colorType,
- facetAttributes, facetData, fpConvert, fpFormat);
- }
-
-
- /*
- * Copy the vertex data.
- */
-
- OC_LISTOF_VERTEX (numVertices, lenofVertex, colorType,
- vertexAttributes, vertices, fpConvert, fpFormat);
-
-
- /*
- * Copy the edge data.
- */
-
- if (edgeAttributes)
- {
- OC_LISTOF_CARD8_PAD (numIndices, edgeFlags);
- }
-
-
- /*
- * Now add the connectivity data.
- *
- * Unfortunately, the encoding for LISTofLISTofLISTofCARD16
- * is broken - there is no padding within this entity, just
- * at the end. As a result, display->bufptr can be on a
- * non word aligned boundary when _XSend or _XFlush is called!!!
- *
- * If the connectivity data fits in the X transport buffer,
- * _XSend and _XFlush is not used, so we're safe.
- *
- * If the connectivity data doesn't fit in the X transport buffer,
- * we fix the problem by putting the connectivity data in a scratch
- * buffer, then using _XSend.
- */
-
- pConnectivity = connectivity;
-
- if ((cbytes + PAD (cbytes)) <= BytesLeftInXBuffer (display))
- {
- for (i = 0; i < numFillAreaSets; i++)
- {
- count = pConnectivity->count;
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD16));
- PUT_CARD16 (count, pData);
-
- for (j = 0, pList = pConnectivity->lists; j < count; j++, pList++)
- {
- scount = pList->count;
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD16));
- PUT_CARD16 (scount, pData);
-
- OC_LISTOF_CARD16 (scount, pList->shorts);
- }
-
- pConnectivity++;
- }
-
- if (PAD (cbytes))
- PEXGetOCAddr (display, PAD (cbytes));
- }
- else
- {
- char *pStart = _XAllocScratch (display, cbytes + PAD (cbytes));
- pData = pStart;
-
- for (i = 0; i < numFillAreaSets; i++)
- {
- count = pConnectivity->count;
- STORE_CARD16 (count, pData);
-
- for (j = 0, pList = pConnectivity->lists; j < count; j++, pList++)
- {
- scount = pList->count;
- STORE_CARD16 (scount, pData);
-
- STORE_LISTOF_CARD16 (scount, pList->shorts, pData);
- }
-
- pConnectivity++;
- }
-
- _XSend (display, pStart, cbytes + PAD (cbytes));
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXTriangleStrip (display, resource_id, req_type,
- facetAttributes, vertexAttributes, colorType,
- facetData, numVertices, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT unsigned int facetAttributes;
-INPUT unsigned int vertexAttributes;
-INPUT int colorType;
-INPUT PEXArrayOfFacetData facetData;
-INPUT unsigned int numVertices;
-INPUT PEXArrayOfVertex vertices;
-
-{
- register pexTriangleStrip *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
-
-
- /*
- * Calculate number of words in the list of facet data and the vertex list.
- */
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = (numVertices - 2) * lenofFacet + numVertices * lenofVertex;
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexTriangleStrip), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the triangle strip request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (TriangleStrip, dataLength, pBuf, req);
-
- req->colorType = colorType;
- req->facetAttribs = facetAttributes;
- req->vertexAttribs = vertexAttributes;
- req->numVertices = numVertices;
-
- END_OC_HEADER (TriangleStrip, pBuf, req);
-
-
- /*
- * Copy the facet data.
- */
-
- if (facetAttributes)
- {
- OC_LISTOF_FACET ((numVertices - 2), lenofFacet, colorType,
- facetAttributes, facetData, fpConvert, fpFormat);
- }
-
-
- /*
- * Copy the vertex data.
- */
-
- OC_LISTOF_VERTEX (numVertices, lenofVertex, colorType,
- vertexAttributes, vertices, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXQuadrilateralMesh (display, resource_id, req_type,
- shape, facetAttributes, vertexAttributes, colorType,
- facetData, colCount, rowCount, vertices)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int shape;
-INPUT unsigned int facetAttributes;
-INPUT unsigned int vertexAttributes;
-INPUT int colorType;
-INPUT PEXArrayOfFacetData facetData;
-INPUT unsigned int colCount;
-INPUT unsigned int rowCount;
-INPUT PEXArrayOfVertex vertices;
-
-{
- register pexQuadrilateralMesh *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
-
-
- /*
- * Calculate the number of words in the facet data list and vertex list.
- */
-
- lenofColor = GetColorLength (colorType);
- lenofFacet = GetFacetDataLength (facetAttributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (vertexAttributes, lenofColor);
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = (((rowCount - 1) * (colCount - 1)) * lenofFacet) +
- (rowCount * colCount * lenofVertex);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexQuadrilateralMesh), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the quad mesh request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (QuadrilateralMesh, dataLength, pBuf, req);
-
- req->colorType = colorType;
- req->mPts = colCount;
- req->nPts = rowCount;
- req->facetAttribs = facetAttributes;
- req->vertexAttribs = vertexAttributes;
- req->shape = shape;
-
- END_OC_HEADER (QuadrilateralMesh, pBuf, req);
-
-
- /*
- * Copy the facet data.
- */
-
- if (facetAttributes)
- {
- OC_LISTOF_FACET ((rowCount - 1) * (colCount - 1), lenofFacet,
- colorType, facetAttributes, facetData, fpConvert, fpFormat);
- }
-
-
- /*
- * Copy the vertex data.
- */
-
- OC_LISTOF_VERTEX (rowCount * colCount, lenofVertex, colorType,
- vertexAttributes, vertices, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXNURBSurface (display, resource_id, req_type, rationality, uorder, vorder,
- uknots, vknots, numMPoints, numNPoints, points, numTrimLoops, trimLoops)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int rationality;
-INPUT int uorder;
-INPUT int vorder;
-INPUT float *uknots;
-INPUT float *vknots;
-INPUT unsigned int numMPoints;
-INPUT unsigned int numNPoints;
-INPUT PEXArrayOfCoord points;
-INPUT unsigned int numTrimLoops;
-INPUT PEXListOfTrimCurve *trimLoops;
-
-{
- register pexNURBSurface *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
- int lenofVertexList;
- int lenofUKnotList;
- int lenofVKnotList;
- int lenofTrimData;
- int thisLength, i;
- int count;
- pexTrimCurve *pTCHead;
- PEXTrimCurve *ptrimCurve;
- PEXListOfTrimCurve *ptrimLoop;
- char *pData;
- char *ocAddr;
-
-
- /*
- * Calculate the number of words in the vertex list and the knot lists.
- */
-
- lenofVertexList = numMPoints * numNPoints *
- ((rationality == PEXRational) ?
- LENOF (pexCoord4D) : LENOF (pexCoord3D));
- lenofUKnotList = uorder + numMPoints;
- lenofVKnotList = vorder + numNPoints;
-
-
- /*
- * Calculate the number of words in the trim curve data. Note that the
- * vertices for the trim curve are in parametric space so they are either
- * 3D or 2D.
- */
-
- lenofTrimData = numTrimLoops * LENOF (CARD32); /* count per loop */
-
- for (i = 0, ptrimLoop = trimLoops; i < numTrimLoops; i++, ptrimLoop++)
- {
- ptrimCurve = ptrimLoop->curves;
- count = ptrimLoop->count;
-
- while (count--)
- {
- lenofTrimData += (LENOF (pexTrimCurve) +
- ptrimCurve->count + ptrimCurve->order + /* knot list */
- ptrimCurve->count *
- (ptrimCurve->rationality == PEXRational ?
- LENOF (pexCoord3D) : LENOF (pexCoord2D)));
- ptrimCurve++;
- }
- }
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = lenofUKnotList + lenofVKnotList +
- lenofVertexList + lenofTrimData;
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexNURBSurface), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the nurb surface request header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (NURBSurface, dataLength, pBuf, req);
-
- req->type = rationality;
- req->uOrder = uorder;
- req->vOrder = vorder;
- req->numUknots = uorder + numMPoints;
- req->numVknots = vorder + numNPoints;
- req->mPts = numMPoints;
- req->nPts = numNPoints;
- req->numLists = numTrimLoops;
-
- END_OC_HEADER (NURBSurface, pBuf, req);
-
-
- /*
- * Now copy the knot lists and the vertex list.
- */
-
- OC_LISTOF_FLOAT32 (lenofUKnotList, uknots, fpConvert, fpFormat);
- OC_LISTOF_FLOAT32 (lenofVKnotList, vknots, fpConvert, fpFormat);
-
- if (rationality == PEXRational)
- {
- OC_LISTOF_COORD4D (numMPoints * numNPoints,
- points.point_4d, fpConvert, fpFormat);
- }
- else
- {
- OC_LISTOF_COORD3D (numMPoints * numNPoints,
- points.point, fpConvert, fpFormat);
- }
-
-
- /*
- * Now add the list of trim curve (LISTofTrimCurve). A trim curve list
- * consists of a count followed by a list of trim curves.
- */
-
- for (i = 0, ptrimLoop = trimLoops; i < numTrimLoops; i++, ptrimLoop++)
- {
- count = ptrimLoop->count;
- pData = (char *) PEXGetOCAddr (display, SIZEOF (CARD32));
- PUT_CARD32 (count, pData);
-
- ptrimCurve = ptrimLoop->curves;
-
- while (count--)
- {
- /*
- * Add the trim curve header data.
- */
-
- thisLength = ptrimCurve->order + ptrimCurve->count;
- ocAddr = (char *) PEXGetOCAddr (display, SIZEOF (pexTrimCurve));
-
- BEGIN_TRIMCURVE_HEAD (ocAddr, pTCHead);
-
- pTCHead->visibility = (pexSwitch) ptrimCurve->visibility;
- pTCHead->order = (CARD16) ptrimCurve->order;
- pTCHead->type = (pexCoordType) ptrimCurve->rationality;
- pTCHead->approxMethod = (INT16) ptrimCurve->approx_method;
- pTCHead->numKnots = thisLength;
- pTCHead->numCoord = ptrimCurve->count;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (ptrimCurve->tolerance,
- pTCHead->tolerance, fpFormat);
- FP_CONVERT_HTON (ptrimCurve->tmin,
- pTCHead->tMin, fpFormat);
- FP_CONVERT_HTON (ptrimCurve->tmax,
- pTCHead->tMax, fpFormat);
- }
- else
- {
- pTCHead->tolerance = (float) ptrimCurve->tolerance;
- pTCHead->tMin = (float) ptrimCurve->tmin;
- pTCHead->tMax = (float) ptrimCurve->tmax;
- }
-
- END_TRIMCURVE_HEAD (ocAddr, pTCHead);
-
-
- /*
- * Add the trim curve knot list and vertex list.
- */
-
- OC_LISTOF_FLOAT32 (thisLength,
- ptrimCurve->knots.floats, fpConvert, fpFormat);
-
- if (ptrimCurve->rationality == PEXRational)
- {
- OC_LISTOF_COORD3D (ptrimCurve->count,
- ptrimCurve->control_points.point, fpConvert, fpFormat);
- }
- else
- {
- OC_LISTOF_COORD2D (ptrimCurve->count,
- ptrimCurve->control_points.point_2d, fpConvert, fpFormat);
- }
-
- ptrimCurve++;
- }
- }
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCellArray (display, resource_id, req_type, pt1, pt2, pt3, dx, dy, icolors)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *pt1;
-INPUT PEXCoord *pt2;
-INPUT PEXCoord *pt3;
-INPUT unsigned int dx;
-INPUT unsigned int dy;
-INPUT PEXTableIndex *icolors;
-
-{
- register pexCellArray *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (dx * dy * SIZEOF (pexTableIndex));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexCellArray), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the cell array header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (CellArray, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (pt1->x, req->point1_x, fpFormat);
- FP_CONVERT_HTON (pt1->y, req->point1_y, fpFormat);
- FP_CONVERT_HTON (pt1->z, req->point1_z, fpFormat);
- FP_CONVERT_HTON (pt2->x, req->point2_x, fpFormat);
- FP_CONVERT_HTON (pt2->y, req->point2_y, fpFormat);
- FP_CONVERT_HTON (pt2->z, req->point2_z, fpFormat);
- FP_CONVERT_HTON (pt3->x, req->point3_x, fpFormat);
- FP_CONVERT_HTON (pt3->y, req->point3_y, fpFormat);
- FP_CONVERT_HTON (pt3->z, req->point3_z, fpFormat);
- }
- else
- {
- req->point1_x = pt1->x;
- req->point1_y = pt1->y;
- req->point1_z = pt1->z;
- req->point2_x = pt2->x;
- req->point2_y = pt2->y;
- req->point2_z = pt2->z;
- req->point3_x = pt3->x;
- req->point3_y = pt3->y;
- req->point3_z = pt3->z;
- }
-
- req->dx = dx;
- req->dy = dy;
-
- END_OC_HEADER (CellArray, pBuf, req);
-
-
- /*
- * Copy the color data to the oc.
- */
-
- OC_LISTOF_CARD16_PAD (dx * dy, icolors);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCellArray2D (display, resource_id, req_type, pt1, pt2, dx, dy, icolors)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord2D *pt1;
-INPUT PEXCoord2D *pt2;
-INPUT unsigned int dx;
-INPUT unsigned int dy;
-INPUT PEXTableIndex *icolors;
-
-{
- register pexCellArray2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (dx * dy * SIZEOF (pexTableIndex));
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexCellArray2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the cell array header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (CellArray2D, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (pt1->x, req->point1_x, fpFormat);
- FP_CONVERT_HTON (pt1->y, req->point1_y, fpFormat);
- FP_CONVERT_HTON (pt2->x, req->point2_x, fpFormat);
- FP_CONVERT_HTON (pt2->y, req->point2_y, fpFormat);
- }
- else
- {
- req->point1_x = pt1->x;
- req->point1_y = pt1->y;
- req->point2_x = pt2->x;
- req->point2_y = pt2->y;
- }
-
- req->dx = dx;
- req->dy = dy;
-
- END_OC_HEADER (CellArray2D, pBuf, req);
-
-
- /*
- * Copy the color data to the oc.
- */
-
- OC_LISTOF_CARD16_PAD (dx * dy, icolors);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXExtendedCellArray (display, resource_id, req_type,
- pt1, pt2, pt3, dx, dy, colorType, colors)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXCoord *pt1;
-INPUT PEXCoord *pt2;
-INPUT PEXCoord *pt3;
-INPUT unsigned int dx;
-INPUT unsigned int dy;
-INPUT int colorType;
-INPUT PEXArrayOfColor colors;
-
-{
- register pexExtendedCellArray *req;
- char *pBuf;
- int lenofColor;
- int dataLength;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Initialize the OC request.
- */
-
- lenofColor = GetColorLength (colorType);
- dataLength = dx * dy * lenofColor;
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexExtendedCellArray), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the cell array header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (ExtendedCellArray, dataLength, pBuf, req);
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (pt1->x, req->point1_x, fpFormat);
- FP_CONVERT_HTON (pt1->y, req->point1_y, fpFormat);
- FP_CONVERT_HTON (pt1->z, req->point1_z, fpFormat);
- FP_CONVERT_HTON (pt2->x, req->point2_x, fpFormat);
- FP_CONVERT_HTON (pt2->y, req->point2_y, fpFormat);
- FP_CONVERT_HTON (pt2->z, req->point2_z, fpFormat);
- FP_CONVERT_HTON (pt3->x, req->point3_x, fpFormat);
- FP_CONVERT_HTON (pt3->y, req->point3_y, fpFormat);
- FP_CONVERT_HTON (pt3->z, req->point3_z, fpFormat);
- }
- else
- {
- req->point1_x = pt1->x;
- req->point1_y = pt1->y;
- req->point1_z = pt1->z;
- req->point2_x = pt2->x;
- req->point2_y = pt2->y;
- req->point2_z = pt2->z;
- req->point3_x = pt3->x;
- req->point3_y = pt3->y;
- req->point3_z = pt3->z;
- }
-
- req->colorType = colorType;
- req->dx = dx;
- req->dy = dy;
-
- END_OC_HEADER (ExtendedCellArray, pBuf, req);
-
-
- /*
- * Copy the color data to the oc.
- */
-
- OC_LISTOF_COLOR (dx * dy, lenofColor, colorType,
- colors, fpConvert, fpFormat);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXGDP (display, resource_id, req_type, id, numPoints, points, numBytes, data)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT long id;
-INPUT unsigned int numPoints;
-INPUT PEXCoord *points;
-INPUT unsigned long numBytes;
-INPUT char *data;
-
-{
- register pexGDP *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numPoints * LENOF (pexCoord3D) + NUMWORDS (numBytes);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexGDP), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the gdp header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (GDP, dataLength, pBuf, req);
-
- req->gdpId = id;
- req->numPoints = numPoints;
- req->numBytes = numBytes;
-
- END_OC_HEADER (GDP, pBuf, req);
-
-
- /*
- * Copy the vertices and GDP data to the oc.
- */
-
- OC_LISTOF_COORD3D (numPoints, points, fpConvert, fpFormat);
-
- OC_LISTOF_CARD8_PAD (numBytes, data);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXGDP2D (display, resource_id, req_type,
- id, numPoints, points, numBytes, data)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT long id;
-INPUT unsigned int numPoints;
-INPUT PEXCoord2D *points;
-INPUT unsigned long numBytes;
-INPUT char *data;
-
-{
- register pexGDP2D *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = numPoints * LENOF (pexCoord2D) + NUMWORDS (numBytes);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexGDP2D), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the gdp header data.
- */
-
- CHECK_FP (fpConvert, fpFormat);
-
- BEGIN_OC_HEADER (GDP2D, dataLength, pBuf, req);
-
- req->gdpId = id;
- req->numPoints = numPoints;
- req->numBytes = numBytes;
-
- END_OC_HEADER (GDP2D, pBuf, req);
-
-
- /*
- * Copy the vertices and GDP data to the oc.
- */
-
- OC_LISTOF_COORD2D (numPoints, points, fpConvert, fpFormat);
-
- OC_LISTOF_CARD8_PAD (numBytes, data);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
diff --git a/xc/lib/PEX5/pl_oc_str.c b/xc/lib/PEX5/pl_oc_str.c
deleted file mode 100644
index bbf554ba3..000000000
--- a/xc/lib/PEX5/pl_oc_str.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* $TOG: pl_oc_str.c /main/8 1998/02/06 16:11: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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-void
-PEXExecuteStructure (display, resource_id, req_type, structure)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT PEXStructure structure;
-
-{
- register pexExecuteStructure *req;
-
- BEGIN_SIMPLE_OC (ExecuteStructure, resource_id, req_type, req);
- req->id = structure;
- END_SIMPLE_OC (ExecuteStructure, resource_id, req_type, req);
-}
-
-
-void
-PEXLabel (display, resource_id, req_type, label)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT long label;
-
-{
- register pexLabel *req;
-
- BEGIN_SIMPLE_OC (Label, resource_id, req_type, req);
- req->label = label;
- END_SIMPLE_OC (Label, resource_id, req_type, req);
-}
-
-
-void
-PEXNoop (display, resource_id, req_type)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-
-{
- register pexNoop *req;
-
- BEGIN_SIMPLE_OC (Noop, resource_id, req_type, req);
- /* no data */
- END_SIMPLE_OC (Noop, resource_id, req_type, req);
-}
-
-
-void
-PEXApplicationData (display, resource_id, req_type, length, data)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int length;
-INPUT char *data;
-
-{
- register pexApplicationData *req;
- char *pBuf;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (length);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexApplicationData), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the request header data.
- */
-
- BEGIN_OC_HEADER (ApplicationData, dataLength, pBuf, req);
-
- req->numElements = length;
-
- END_OC_HEADER (ApplicationData, pBuf, req);
-
-
- /*
- * Copy the oc data.
- */
-
- OC_LISTOF_CARD8_PAD (length, data);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXGSE (display, resource_id, req_type, id, length, data)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT long id;
-INPUT int length;
-INPUT char *data;
-
-{
- register pexGSE *req;
- char *pBuf;
- int dataLength;
-
-
- /*
- * Initialize the OC request.
- */
-
- dataLength = NUMWORDS (length);
-
- PEXInitOC (display, resource_id, req_type,
- LENOF (pexGSE), dataLength, pBuf);
-
- if (pBuf == NULL) return;
-
-
- /*
- * Store the GSE request header data.
- */
-
- BEGIN_OC_HEADER (GSE, dataLength, pBuf, req);
-
- req->id = id;
- req->numElements = length;
-
- END_OC_HEADER (GSE, pBuf, req);
-
-
- /*
- * Copy the GSE data to the oc.
- */
-
- OC_LISTOF_CARD8_PAD (length, data);
-
- PEXFinishOC (display);
- PEXSyncHandle (display);
-}
diff --git a/xc/lib/PEX5/pl_oc_util.c b/xc/lib/PEX5/pl_oc_util.c
deleted file mode 100644
index cdd4fe14e..000000000
--- a/xc/lib/PEX5/pl_oc_util.c
+++ /dev/null
@@ -1,2961 +0,0 @@
-/* $TOG: pl_oc_util.c /main/17 1998/02/06 16:11:25 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-Status
-PEXStartOCs (display, resource_id, req_type, float_format, numOCs, numWords)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int float_format;
-INPUT int numOCs;
-INPUT int numWords;
-
-{
- register PEXDisplayInfo *pexDisplayInfo;
- register pexOCRequestHeader *pReq;
- char *currentReq;
-
-
- /*
- * Is the oc larger than the protocol max request size?
- * If so, return an error.
- */
-
- if (numWords + LENOF (pexOCRequestHeader) > MAX_REQUEST_SIZE)
- return (0);
-
-
- /*
- * If possible add the OC to a ROC or StoreElements request,
- * otherwise start a new request.
- */
-
- LockDisplay (display);
- PEXGetDisplayInfo (display, pexDisplayInfo);
-
- currentReq = (XBufferFlushed (display)) ? (NULL) : (display->last_req);
-
- if (currentReq == NULL ||
- pexDisplayInfo->lastReqNum != display->request ||
- pexDisplayInfo->lastResID != resource_id ||
- pexDisplayInfo->lastReqType != req_type ||
- req_type == PEXOCRenderSingle || req_type == PEXOCStoreSingle ||
- display->synchandler ||
- (LENOF (pexOCRequestHeader) + numWords > WordsLeftInXBuffer (display)))
- {
- PEXGetOCReq (SIZEOF (pexOCRequestHeader) + NUMBYTES (numWords));
-
- pexDisplayInfo->lastResID = resource_id;
- pexDisplayInfo->lastReqType = req_type;
- pexDisplayInfo->lastReqNum = display->request;
-
- BEGIN_NEW_OCREQ_HEADER (display->bufptr, pReq);
-
- pReq->extOpcode = pexDisplayInfo->extOpcode;
- pReq->pexOpcode =
- (req_type == PEXOCStore || req_type == PEXOCStoreSingle) ?
- PEXRCStoreElements : PEXRCRenderOutputCommands;
- pReq->reqLength = LENOF (pexOCRequestHeader) + numWords;
- pReq->fpFormat = float_format;
- pReq->target = resource_id;
- pReq->numCommands = numOCs;
-
- END_NEW_OCREQ_HEADER (display->bufptr, pReq);
-
- display->bufptr += SIZEOF (pexOCRequestHeader);
- }
- else
- {
- BEGIN_UPDATE_OCREQ_HEADER (currentReq, pReq);
-
- pReq->reqLength += numWords;
- pReq->numCommands += numOCs;
-
- END_UPDATE_OCREQ_HEADER (currentReq, pReq);
- }
-
- return (1);
-}
-
-
-void
-PEXFinishOCs (display)
-
-INPUT Display *display;
-
-{
- UnlockDisplay (display);
-}
-
-
- /*
- * PEXlib uses an internal macro called PEXCopyBytesToOC, so undef here.
- * The macro does the same work as this function, but avoids a function call.
- */
-
-#ifdef PEXCopyBytesToOC
-#undef PEXCopyBytesToOC
-#endif
-
-void
-PEXCopyBytesToOC (display, numBytes, data)
-
-INPUT Display *display;
-INPUT int numBytes;
-INPUT char *data;
-
-{
- if (numBytes <= BytesLeftInXBuffer (display))
- {
- /*
- * There is room in the X buffer to do the copy.
- */
-
- memcpy (display->bufptr, data, numBytes);
- display->bufptr += numBytes;
- }
- else
- {
- /*
- * Copying this OC will overflow the transport buffer. We
- * can't do a simple bcopy.
- */
-
- _PEXSendBytesToOC (display, numBytes, data);
- }
-}
-
-
-char *
-PEXGetOCAddr (display, numBytes)
-
-INPUT Display *display;
-INPUT int numBytes;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
- char *retPtr;
-
-
- /*
- * If numBytes is larger than the max allowed size, return error.
- */
-
- if (numBytes > PEXGetOCAddrMaxSize (display))
- return (NULL);
-
-
- /*
- * If there isn't enough space in the X buffer, flush it
- * and make sure that the next OC starts a new request.
- */
-
- if (numBytes > BytesLeftInXBuffer (display))
- {
- _XFlush (display);
- PEXGetDisplayInfo (display, pexDisplayInfo);
- pexDisplayInfo->lastReqNum = -1;
- }
-
-
- /*
- * Return a pointer to the bytes, and update the display's bufptr.
- */
-
- retPtr = display->bufptr;
- display->bufptr += numBytes;
-
- return (retPtr);
-}
-
-
-void
-PEXSendOCs (display, resource_id, req_type, float_format,
- oc_count, numBytes, encoded_ocs)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-INPUT int float_format;
-INPUT unsigned long oc_count;
-INPUT unsigned int numBytes;
-INPUT char *encoded_ocs;
-
-{
- PEXStartOCs (display, resource_id, req_type, float_format,
- oc_count, NUMWORDS (numBytes));
-
- _PEXCopyPaddedBytesToOC (display, numBytes, encoded_ocs);
-
- PEXFinishOCs (display);
-}
-
-
-int
-PEXGetSizeOCs (float_format, oc_count, oc_data)
-
-INPUT int float_format;
-INPUT int oc_count;
-INPUT PEXOCData *oc_data;
-
-{
- int totalSize, i;
-
-
- for (i = totalSize = 0; i < oc_count; i++, oc_data++)
- {
- switch (oc_data->oc_type)
- {
- case PEXOCMarkerType:
- case PEXOCLineType:
- case PEXOCATextStyle:
- case PEXOCBFInteriorStyle:
- case PEXOCBFReflectionModel:
- case PEXOCBFSurfaceInterpMethod:
- case PEXOCInteriorStyle:
- case PEXOCPolylineInterpMethod:
- case PEXOCReflectionModel:
- case PEXOCRenderingColorModel:
- case PEXOCSurfaceEdgeType:
- case PEXOCSurfaceInterpMethod:
-
- totalSize += SIZEOF (pexMarkerType);
- break;
-
- case PEXOCMarkerColorIndex:
- case PEXOCMarkerBundleIndex:
- case PEXOCTextFontIndex:
- case PEXOCTextColorIndex:
- case PEXOCTextBundleIndex:
- case PEXOCLineColorIndex:
- case PEXOCLineBundleIndex:
- case PEXOCSurfaceColorIndex:
- case PEXOCBFInteriorStyleIndex:
- case PEXOCBFSurfaceColorIndex:
- case PEXOCInteriorBundleIndex:
- case PEXOCInteriorStyleIndex:
- case PEXOCSurfaceEdgeColorIndex:
- case PEXOCEdgeBundleIndex:
- case PEXOCViewIndex:
- case PEXOCDepthCueIndex:
- case PEXOCColorApproxIndex:
-
- totalSize += SIZEOF (pexMarkerColorIndex);
- break;
-
- case PEXOCMarkerColor:
- case PEXOCTextColor:
- case PEXOCLineColor:
- case PEXOCSurfaceColor:
- case PEXOCBFSurfaceColor:
- case PEXOCSurfaceEdgeColor:
-
- totalSize += (SIZEOF (pexMarkerColor) +
- GetColorSize (oc_data->data.SetMarkerColor.color_type));
- break;
-
- case PEXOCMarkerScale:
- case PEXOCCharExpansion:
- case PEXOCCharSpacing:
- case PEXOCCharHeight:
- case PEXOCATextHeight:
- case PEXOCLineWidth:
- case PEXOCSurfaceEdgeWidth:
-
- totalSize += SIZEOF (pexMarkerScale);
- break;
-
- case PEXOCTextPrecision:
- case PEXOCTextPath:
- case PEXOCATextPath:
-
- totalSize += SIZEOF (pexTextPrecision);
- break;
-
- case PEXOCCharUpVector:
- case PEXOCATextUpVector:
-
- totalSize += SIZEOF (pexCharUpVector);
- break;
-
- case PEXOCTextAlignment:
- case PEXOCATextAlignment:
-
- totalSize += SIZEOF (pexTextAlignment);
- break;
-
- case PEXOCCurveApprox:
-
- totalSize += SIZEOF (pexCurveApprox);
- break;
-
- case PEXOCReflectionAttributes:
- case PEXOCBFReflectionAttributes:
-
- totalSize += (SIZEOF (pexReflectionAttributes) + GetColorSize (
- oc_data->data.SetReflectionAttributes.attributes.specular_color.type));
- break;
-
- case PEXOCSurfaceApprox:
-
- totalSize += SIZEOF (pexSurfaceApprox);
- break;
-
- case PEXOCFacetCullingMode:
-
- totalSize += SIZEOF (pexFacetCullingMode);
- break;
-
- case PEXOCFacetDistinguishFlag:
- case PEXOCSurfaceEdgeFlag:
- case PEXOCModelClipFlag:
-
- totalSize += SIZEOF (pexFacetDistinguishFlag);
- break;
-
- case PEXOCPatternSize:
-
- totalSize += SIZEOF (pexPatternSize);
- break;
-
- case PEXOCPatternAttributes2D:
-
- totalSize += SIZEOF (pexPatternAttributes2D);
- break;
-
- case PEXOCPatternAttributes:
-
- totalSize += SIZEOF (pexPatternAttributes);
- break;
-
- case PEXOCIndividualASF:
-
- totalSize += SIZEOF (pexIndividualASF);
- break;
-
- case PEXOCLocalTransform:
-
- totalSize += SIZEOF (pexLocalTransform);
- break;
-
- case PEXOCLocalTransform2D:
-
- totalSize += SIZEOF (pexLocalTransform2D);
- break;
-
- case PEXOCGlobalTransform:
-
- totalSize += SIZEOF (pexGlobalTransform);
- break;
-
- case PEXOCGlobalTransform2D:
-
- totalSize += SIZEOF (pexGlobalTransform2D);
- break;
-
- case PEXOCModelClipVolume:
-
- totalSize += (SIZEOF (pexModelClipVolume) +
- SIZEOF (pexHalfSpace) *
- oc_data->data.SetModelClipVolume.count);
- break;
-
- case PEXOCModelClipVolume2D:
-
- totalSize += (SIZEOF (pexModelClipVolume2D) +
- SIZEOF (pexHalfSpace2D) *
- oc_data->data.SetModelClipVolume2D.count);
- break;
-
- case PEXOCRestoreModelClipVolume:
-
- totalSize += SIZEOF (pexRestoreModelClipVolume);
- break;
-
- case PEXOCLightSourceState:
-
- {
- int sizeofEnableList, sizeofDisableList;
-
- sizeofEnableList = SIZEOF (CARD16) *
- oc_data->data.SetLightSourceState.enable_count;
-
- sizeofDisableList = SIZEOF (CARD16) *
- oc_data->data.SetLightSourceState.disable_count;
-
- totalSize += (SIZEOF (pexLightSourceState) +
- PADDED_BYTES (sizeofEnableList) +
- PADDED_BYTES (sizeofDisableList));
- break;
- }
-
- case PEXOCPickID:
- case PEXOCHLHSRID:
-
- totalSize += SIZEOF (pexPickID);
- break;
-
- case PEXOCParaSurfCharacteristics:
-
- {
- int pscDataSize = 0;
-
- switch (oc_data->data.SetParaSurfCharacteristics.psc_type)
- {
- case PEXPSCIsoCurves:
- pscDataSize = SIZEOF (pexPSC_IsoparametricCurves);
- break;
-
- case PEXPSCMCLevelCurves:
- case PEXPSCWCLevelCurves:
- pscDataSize = SIZEOF (pexPSC_LevelCurves) + SIZEOF (float) *
- oc_data->data.SetParaSurfCharacteristics.characteristics.level_curves.count;
- break;
-
- default:
- break;
- }
-
- totalSize += (SIZEOF (pexParaSurfCharacteristics) + pscDataSize);
- break;
- }
-
- case PEXOCAddToNameSet:
- case PEXOCRemoveFromNameSet:
-
- totalSize += (SIZEOF (pexAddToNameSet) +
- oc_data->data.AddToNameSet.count * SIZEOF (pexName));
- break;
-
- case PEXOCExecuteStructure:
-
- totalSize += SIZEOF (pexExecuteStructure);
- break;
-
- case PEXOCLabel:
-
- totalSize += SIZEOF (pexLabel);
- break;
-
- case PEXOCApplicationData:
-
- totalSize += (SIZEOF (pexApplicationData) +
- PADDED_BYTES (oc_data->data.ApplicationData.length));
- break;
-
- case PEXOCGSE:
-
- totalSize += (SIZEOF (pexGSE) +
- PADDED_BYTES (oc_data->data.GSE.length));
- break;
-
- case PEXOCMarkers:
- case PEXOCPolyline:
-
- totalSize += (SIZEOF (pexMarkers) +
- oc_data->data.Markers.count * SIZEOF (pexCoord3D));
- break;
-
- case PEXOCMarkers2D:
- case PEXOCPolyline2D:
-
- totalSize += (SIZEOF (pexMarkers2D) +
- oc_data->data.Markers2D.count * SIZEOF (pexCoord2D));
- break;
-
- case PEXOCText:
-
- {
- /* Text is always mono encoded */
-
- int lenofStrings;
-
- GetStringsLength (oc_data->data.EncodedText.count,
- oc_data->data.EncodedText.encoded_text, lenofStrings)
-
- totalSize += (SIZEOF (pexText) + NUMBYTES (lenofStrings));
- break;
- }
-
- case PEXOCText2D:
-
- {
- /* Text is always mono encoded */
-
- int lenofStrings;
-
- GetStringsLength (oc_data->data.EncodedText2D.count,
- oc_data->data.EncodedText2D.encoded_text, lenofStrings)
-
- totalSize += (SIZEOF (pexText2D) + NUMBYTES (lenofStrings));
- break;
- }
-
- case PEXOCAnnotationText:
-
- {
- /* Anno Text is always mono encoded */
-
- int lenofStrings;
-
- GetStringsLength (oc_data->data.EncodedAnnoText.count,
- oc_data->data.EncodedAnnoText.encoded_text, lenofStrings)
-
- totalSize += (SIZEOF (pexAnnotationText) +
- NUMBYTES (lenofStrings));
- break;
- }
-
- case PEXOCAnnotationText2D:
-
- {
- /* Anno Text is always mono encoded */
-
- int lenofStrings;
-
- GetStringsLength (oc_data->data.EncodedAnnoText2D.count,
- oc_data->data.EncodedAnnoText2D.encoded_text, lenofStrings)
-
- totalSize += (SIZEOF (pexAnnotationText2D) +
- NUMBYTES (lenofStrings));
- break;
- }
-
- case PEXOCPolylineSetWithData:
-
- {
- int numPoints, lenofVertex, i;
-
- for (i = 0, numPoints = 0;
- i < oc_data->data.PolylineSetWithData.count; i++)
- numPoints +=
- oc_data->data.PolylineSetWithData.vertex_lists[i].count;
-
- lenofVertex = LENOF (pexCoord3D) +
- ((oc_data->data.PolylineSetWithData.vertex_attributes &
- PEXGAColor) ? GetColorLength (
- oc_data->data.PolylineSetWithData.color_type) : 0);
-
- totalSize += (SIZEOF (pexPolylineSetWithData) + NUMBYTES (
- oc_data->data.PolylineSetWithData.count +
- numPoints * lenofVertex));
- break;
- }
-
- case PEXOCNURBCurve:
-
- {
- int sizeofVertexList, sizeofKnotList;
-
- sizeofVertexList =
- oc_data->data.NURBCurve.count *
- ((oc_data->data.NURBCurve.rationality == PEXRational) ?
- SIZEOF (pexCoord4D) : SIZEOF (pexCoord3D));
-
- sizeofKnotList = NUMBYTES (
- oc_data->data.NURBCurve.order +
- oc_data->data.NURBCurve.count);
-
- totalSize += (SIZEOF (pexNURBCurve) +
- sizeofVertexList + sizeofKnotList);
- break;
- }
-
- case PEXOCFillArea:
-
- totalSize += (SIZEOF (pexFillArea) +
- oc_data->data.FillArea.count * SIZEOF (pexCoord3D));
- break;
-
- case PEXOCFillArea2D:
-
- totalSize += (SIZEOF (pexFillArea2D) +
- oc_data->data.FillArea2D.count * SIZEOF (pexCoord2D));
- break;
-
- case PEXOCFillAreaWithData:
-
- {
- int lenofColor, lenofFacet, lenofVertex;
-
- lenofColor =
- GetColorLength (oc_data->data.FillAreaWithData.color_type);
-
- lenofFacet =
- GetFacetDataLength (
- oc_data->data.FillAreaWithData.facet_attributes, lenofColor);
-
- lenofVertex =
- GetVertexWithDataLength (
- oc_data->data.FillAreaWithData.vertex_attributes, lenofColor);
-
- totalSize += (SIZEOF (pexFillAreaWithData) +
- NUMBYTES (lenofFacet + 1 +
- oc_data->data.FillAreaWithData.count * lenofVertex));
- break;
- }
-
- case PEXOCFillAreaSet:
-
- {
- int numPoints, i;
-
- for (i = 0, numPoints = 0;
- i < oc_data->data.FillAreaSet.count; i++)
- numPoints +=
- oc_data->data.FillAreaSet.point_lists[i].count;
-
- totalSize += (SIZEOF (pexFillAreaSet) +
- NUMBYTES (oc_data->data.FillAreaSet.count) +
- numPoints * SIZEOF (pexCoord3D));
- break;
- }
-
- case PEXOCFillAreaSet2D:
-
- {
- int numPoints, i;
-
- for (i = 0, numPoints = 0;
- i < oc_data->data.FillAreaSet2D.count; i++)
- numPoints +=
- oc_data->data.FillAreaSet2D.point_lists[i].count;
-
- totalSize += (SIZEOF (pexFillAreaSet2D) +
- NUMBYTES (oc_data->data.FillAreaSet2D.count) +
- numPoints * SIZEOF (pexCoord2D));
- break;
- }
-
- case PEXOCFillAreaSetWithData:
-
- {
- int lenofColor, lenofFacet, lenofVertex;
- int numVertices, i;
-
- lenofColor = GetColorLength (
- oc_data->data.FillAreaSetWithData.color_type);
-
- lenofFacet =
- GetFacetDataLength (
- oc_data->data.FillAreaSetWithData.facet_attributes,
- lenofColor);
-
- lenofVertex =
- GetVertexWithDataLength (
- oc_data->data.FillAreaSetWithData.vertex_attributes,
- lenofColor);
-
- if (oc_data->data.FillAreaSetWithData.vertex_attributes &
- PEXGAEdges)
- lenofVertex++; /* edge switch is CARD32 */
-
- for (i = 0, numVertices = 0;
- i < oc_data->data.FillAreaSetWithData.count; i++)
- numVertices +=
- oc_data->data.FillAreaSetWithData.vertex_lists[i].count;
-
- totalSize += (SIZEOF (pexFillAreaSetWithData) +
- NUMBYTES (lenofFacet +
- oc_data->data.FillAreaSetWithData.count +
- numVertices * lenofVertex));
- break;
- }
-
- case PEXOCTriangleStrip:
-
- {
- int lenofColor, lenofFacetList, lenofVertexList;
-
- lenofColor =
- GetColorLength (oc_data->data.TriangleStrip.color_type);
-
- lenofFacetList = (oc_data->data.TriangleStrip.count - 2) *
- GetFacetDataLength (
- oc_data->data.TriangleStrip.facet_attributes, lenofColor);
-
- lenofVertexList = oc_data->data.TriangleStrip.count *
- GetVertexWithDataLength (
- oc_data->data.TriangleStrip.vertex_attributes, lenofColor);
-
- totalSize += (SIZEOF (pexTriangleStrip) +
- NUMBYTES (lenofFacetList + lenofVertexList));
- break;
- }
-
- case PEXOCQuadrilateralMesh:
-
- {
- int lenofColor, lenofFacetList, lenofVertexList;
-
- lenofColor =
- GetColorLength (oc_data->data.QuadrilateralMesh.color_type);
-
- lenofFacetList =
- (oc_data->data.QuadrilateralMesh.row_count - 1) *
- (oc_data->data.QuadrilateralMesh.col_count - 1) *
- GetFacetDataLength (
- oc_data->data.QuadrilateralMesh.facet_attributes,
- lenofColor);
-
- lenofVertexList =
- oc_data->data.QuadrilateralMesh.row_count *
- oc_data->data.QuadrilateralMesh.col_count *
- GetVertexWithDataLength (
- oc_data->data.QuadrilateralMesh.vertex_attributes,
- lenofColor);
-
- totalSize += (SIZEOF (pexQuadrilateralMesh) +
- NUMBYTES (lenofFacetList + lenofVertexList));
- break;
- }
-
- case PEXOCSetOfFillAreaSets:
-
- {
- PEXConnectivityData *pConnectivity;
- int lenofColor, lenofFacet, lenofVertex;
- int sizeofEdge, sofaLength;
- int numContours, numFillAreaSets;
- int numIndices, numVertices, i;
-
- numFillAreaSets = oc_data->data.SetOfFillAreaSets.set_count;
- numIndices = oc_data->data.SetOfFillAreaSets.index_count;
- numVertices = oc_data->data.SetOfFillAreaSets.vertex_count;
-
- pConnectivity = oc_data->data.SetOfFillAreaSets.connectivity;
- numContours = 0;
- for (i = 0; i < numFillAreaSets; i++, pConnectivity++)
- numContours += pConnectivity->count;
-
- lenofColor = GetColorLength (
- oc_data->data.SetOfFillAreaSets.color_type);
- lenofFacet = GetFacetDataLength (
- oc_data->data.SetOfFillAreaSets.facet_attributes,
- lenofColor);
- lenofVertex = GetVertexWithDataLength (
- oc_data->data.SetOfFillAreaSets.vertex_attributes,
- lenofColor);
-
- sizeofEdge = oc_data->data.SetOfFillAreaSets.edge_attributes ?
- SIZEOF (CARD8) : 0;
-
- sofaLength = (lenofFacet * numFillAreaSets) +
- (lenofVertex * numVertices) +
- NUMWORDS (sizeofEdge * numIndices) +
- NUMWORDS (SIZEOF (CARD16) *
- (numFillAreaSets + numContours + numIndices));
-
- totalSize += (SIZEOF (pexSetOfFillAreaSets) +
- NUMBYTES (sofaLength));
- break;
- }
-
- case PEXOCNURBSurface:
- {
- PEXListOfTrimCurve *ptrimLoop;
- PEXTrimCurve *ptrimCurve;
- int numMPoints, numNPoints, numTrimLoops;
- int uorder, vorder;
- int lenofVertexList, lenofUKnotList, lenofVKnotList;
- int lenofTrimData, count, i;
-
- numMPoints = oc_data->data.NURBSurface.col_count;
- numNPoints = oc_data->data.NURBSurface.row_count;
- numTrimLoops = oc_data->data.NURBSurface.curve_count;
- uorder = oc_data->data.NURBSurface.uorder;
- vorder = oc_data->data.NURBSurface.vorder;
-
- lenofVertexList = numMPoints * numNPoints *
- ((oc_data->data.NURBSurface.rationality == PEXRational)
- ? LENOF (pexCoord4D) : LENOF (pexCoord3D));
- lenofUKnotList = uorder + numMPoints;
- lenofVKnotList = vorder + numNPoints;
-
- lenofTrimData = numTrimLoops * LENOF (CARD32);
-
- ptrimLoop = oc_data->data.NURBSurface.trim_curves;
- for (i = 0; i < numTrimLoops; i++, ptrimLoop++)
- {
- ptrimCurve = ptrimLoop->curves;
- count = ptrimLoop->count;
-
- while (count--)
- {
- lenofTrimData += (LENOF (pexTrimCurve) +
- ptrimCurve->count + ptrimCurve->order +
- ptrimCurve->count *
- (ptrimCurve->rationality == PEXRational ?
- LENOF (pexCoord3D) : LENOF (pexCoord2D)));
- ptrimCurve++;
- }
- }
-
- totalSize += (SIZEOF (pexNURBSurface) +
- NUMBYTES (lenofUKnotList + lenofVKnotList +
- lenofVertexList + lenofTrimData));
- break;
- }
-
- case PEXOCCellArray:
-
- {
- int bytes;
-
- bytes = oc_data->data.CellArray.col_count *
- oc_data->data.CellArray.row_count * SIZEOF (pexTableIndex);
- totalSize += (SIZEOF (pexCellArray) + PADDED_BYTES (bytes));
- break;
- }
-
- case PEXOCCellArray2D:
-
- {
- int bytes;
-
- bytes = oc_data->data.CellArray2D.col_count *
- oc_data->data.CellArray2D.row_count * SIZEOF (pexTableIndex);
- totalSize += (SIZEOF (pexCellArray2D) + PADDED_BYTES (bytes));
- break;
- }
-
- case PEXOCExtendedCellArray:
-
- {
- int lenofColorList;
-
- lenofColorList = oc_data->data.ExtendedCellArray.col_count *
- oc_data->data.ExtendedCellArray.row_count * GetColorLength (
- oc_data->data.ExtendedCellArray.color_type);
-
- totalSize += (SIZEOF (pexExtendedCellArray) +
- NUMBYTES (lenofColorList));
- break;
- }
-
- case PEXOCGDP:
-
- totalSize += (SIZEOF (pexGDP) +
- oc_data->data.GDP.count * SIZEOF (pexCoord3D) +
- PADDED_BYTES (oc_data->data.GDP.length));
- break;
-
- case PEXOCGDP2D:
-
- totalSize += (SIZEOF (pexGDP2D) +
- oc_data->data.GDP2D.count * SIZEOF (pexCoord2D) +
- PADDED_BYTES (oc_data->data.GDP2D.length));
- break;
-
- case PEXOCNoop:
-
- totalSize += SIZEOF (pexNoop);
- break;
-
- default:
- break;
- }
- }
-
-#ifdef DEBUG
- if (totalSize % 4)
- {
- printf ("PEXlib WARNING : Internal error in PEXGetSizeOCs :\n");
- printf ("Memory allocated is not word aligned.\n");
- }
-#endif
-
- return (totalSize);
-}
-
-
-unsigned long
-PEXCountOCs (float_format, length, encoded_ocs)
-
-INPUT int float_format;
-INPUT unsigned long length;
-INPUT char *encoded_ocs;
-
-{
- char *pBuf = encoded_ocs;
- char *pBufStart;
- unsigned long oc_count = 0;
- int totalSize = 0;
- pexElementInfo *elemInfo;
-
-
- /*
- * Keep parsing the data until the end of the buffer is reached.
- * Increment the oc count as we go along.
- */
-
- while (totalSize < length)
- {
- GET_STRUCT_PTR (pexElementInfo, pBuf, elemInfo);
-
- pBufStart = pBuf;
-
- switch (elemInfo->elementType)
- {
- case PEXOCMarkerType:
- case PEXOCLineType:
- case PEXOCATextStyle:
- case PEXOCBFInteriorStyle:
- case PEXOCBFReflectionModel:
- case PEXOCBFSurfaceInterpMethod:
- case PEXOCInteriorStyle:
- case PEXOCPolylineInterpMethod:
- case PEXOCReflectionModel:
- case PEXOCRenderingColorModel:
- case PEXOCSurfaceEdgeType:
- case PEXOCSurfaceInterpMethod:
-
- pBuf += SIZEOF (pexMarkerType);
- break;
-
- case PEXOCMarkerColorIndex:
- case PEXOCMarkerBundleIndex:
- case PEXOCTextFontIndex:
- case PEXOCTextColorIndex:
- case PEXOCTextBundleIndex:
- case PEXOCLineColorIndex:
- case PEXOCLineBundleIndex:
- case PEXOCSurfaceColorIndex:
- case PEXOCBFInteriorStyleIndex:
- case PEXOCBFSurfaceColorIndex:
- case PEXOCInteriorBundleIndex:
- case PEXOCInteriorStyleIndex:
- case PEXOCSurfaceEdgeColorIndex:
- case PEXOCEdgeBundleIndex:
- case PEXOCViewIndex:
- case PEXOCDepthCueIndex:
- case PEXOCColorApproxIndex:
-
- pBuf += SIZEOF (pexMarkerColorIndex);
- break;
-
- case PEXOCMarkerColor:
- case PEXOCTextColor:
- case PEXOCLineColor:
- case PEXOCSurfaceColor:
- case PEXOCBFSurfaceColor:
- case PEXOCSurfaceEdgeColor:
-
- {
- pexMarkerColor *oc;
-
- GET_STRUCT_PTR (pexMarkerColor, pBuf, oc);
-
- pBuf += (SIZEOF (pexMarkerColor) + GetColorSize (oc->colorType));
- break;
- }
-
- case PEXOCMarkerScale:
- case PEXOCCharExpansion:
- case PEXOCCharSpacing:
- case PEXOCCharHeight:
- case PEXOCATextHeight:
- case PEXOCLineWidth:
- case PEXOCSurfaceEdgeWidth:
-
- pBuf += SIZEOF (pexMarkerScale);
- break;
-
- case PEXOCTextPrecision:
- case PEXOCTextPath:
- case PEXOCATextPath:
-
- pBuf += SIZEOF (pexTextPrecision);
- break;
-
- case PEXOCCharUpVector:
- case PEXOCATextUpVector:
-
- pBuf += SIZEOF (pexCharUpVector);
- break;
-
- case PEXOCTextAlignment:
- case PEXOCATextAlignment:
-
- pBuf += SIZEOF (pexTextAlignment);
- break;
-
- case PEXOCCurveApprox:
-
- pBuf += SIZEOF (pexCurveApprox);
- break;
-
- case PEXOCReflectionAttributes:
- case PEXOCBFReflectionAttributes:
-
- {
- pexReflectionAttributes *oc;
-
- GET_STRUCT_PTR (pexReflectionAttributes, pBuf, oc);
-
- pBuf += (SIZEOF (pexReflectionAttributes) +
- GetColorSize (oc->specular_colorType));
- break;
- }
-
- case PEXOCSurfaceApprox:
-
- pBuf += SIZEOF (pexSurfaceApprox);
- break;
-
- case PEXOCFacetCullingMode:
-
- pBuf += SIZEOF (pexFacetCullingMode);
- break;
-
- case PEXOCFacetDistinguishFlag:
- case PEXOCSurfaceEdgeFlag:
- case PEXOCModelClipFlag:
-
- pBuf += SIZEOF (pexFacetDistinguishFlag);
- break;
-
- case PEXOCPatternSize:
-
- pBuf += SIZEOF (pexPatternSize);
- break;
-
- case PEXOCPatternAttributes2D:
-
- pBuf += SIZEOF (pexPatternAttributes2D);
- break;
-
- case PEXOCPatternAttributes:
-
- pBuf += SIZEOF (pexPatternAttributes);
- break;
-
- case PEXOCIndividualASF:
-
- pBuf += SIZEOF (pexIndividualASF);
- break;
-
- case PEXOCLocalTransform:
-
- pBuf += SIZEOF (pexLocalTransform);
- break;
-
- case PEXOCLocalTransform2D:
-
- pBuf += SIZEOF (pexLocalTransform2D);
- break;
-
- case PEXOCGlobalTransform:
-
- pBuf += SIZEOF (pexGlobalTransform);
- break;
-
- case PEXOCGlobalTransform2D:
-
- pBuf += SIZEOF (pexGlobalTransform2D);
- break;
-
- case PEXOCModelClipVolume:
-
- {
- pexModelClipVolume *oc;
-
- GET_STRUCT_PTR (pexModelClipVolume, pBuf, oc);
-
- pBuf += (SIZEOF (pexModelClipVolume) +
- oc->numHalfSpaces * SIZEOF (pexHalfSpace));
- break;
- }
-
- case PEXOCModelClipVolume2D:
-
- {
- pexModelClipVolume2D *oc;
-
- GET_STRUCT_PTR (pexModelClipVolume2D, pBuf, oc);
-
- pBuf += (SIZEOF (pexModelClipVolume2D) +
- oc->numHalfSpaces * SIZEOF (pexHalfSpace2D));
- break;
- }
-
- case PEXOCRestoreModelClipVolume:
-
- pBuf += SIZEOF (pexRestoreModelClipVolume);
- break;
-
- case PEXOCLightSourceState:
-
- {
- pexLightSourceState *oc;
- int size;
-
- GET_STRUCT_PTR (pexLightSourceState, pBuf, oc);
-
- size = oc->numEnable * SIZEOF (pexTableIndex);
- pBuf += (SIZEOF (pexLightSourceState) + PADDED_BYTES (size));
-
- size = oc->numDisable * SIZEOF (pexTableIndex);
- pBuf += PADDED_BYTES (size);
- break;
- }
-
- case PEXOCPickID:
- case PEXOCHLHSRID:
-
- pBuf += SIZEOF (pexPickID);
- break;
-
- case PEXOCParaSurfCharacteristics:
-
- {
- pexParaSurfCharacteristics *oc;
-
- GET_STRUCT_PTR (pexParaSurfCharacteristics, pBuf, oc);
- pBuf += SIZEOF (pexParaSurfCharacteristics);
-
- switch (oc->characteristics)
- {
- case PEXPSCIsoCurves:
- pBuf += SIZEOF (pexPSC_IsoparametricCurves);
- break;
-
- case PEXPSCMCLevelCurves:
- case PEXPSCWCLevelCurves:
- {
- pexPSC_LevelCurves *level;
-
- GET_STRUCT_PTR (pexPSC_LevelCurves, pBuf, level);
-
- pBuf += (SIZEOF (pexPSC_LevelCurves) +
- SIZEOF (float) * level->numberIntersections);
- break;
- }
-
- default:
- pBuf += PADDED_BYTES (oc->length);
- break;
- }
-
- break;
- }
-
- case PEXOCAddToNameSet:
- case PEXOCRemoveFromNameSet:
-
- pBuf += (SIZEOF (pexAddToNameSet) +
- (elemInfo->length - 1) * SIZEOF (pexName));
- break;
-
- case PEXOCExecuteStructure:
-
- pBuf += SIZEOF (pexExecuteStructure);
- break;
-
- case PEXOCLabel:
-
- pBuf += SIZEOF (pexLabel);
- break;
-
- case PEXOCApplicationData:
-
- {
- pexApplicationData *oc;
-
- GET_STRUCT_PTR (pexApplicationData, pBuf, oc);
-
- pBuf += (SIZEOF (pexApplicationData) +
- PADDED_BYTES (oc->numElements));
- break;
- }
-
- case PEXOCGSE:
-
- {
- pexGSE *oc;
-
- GET_STRUCT_PTR (pexGSE, pBuf, oc);
-
- pBuf += (SIZEOF (pexGSE) + PADDED_BYTES (oc->numElements));
- break;
- }
-
- case PEXOCMarkers:
- case PEXOCPolyline:
-
- pBuf += (SIZEOF (pexMarkers) + SIZEOF (pexCoord3D) *
- (SIZEOF (CARD32) * ((int) elemInfo->length - 1)) /
- SIZEOF (pexCoord3D));
- break;
-
- case PEXOCMarkers2D:
- case PEXOCPolyline2D:
-
- pBuf += (SIZEOF (pexMarkers2D) + SIZEOF (pexCoord2D) *
- (SIZEOF (CARD32) * ((int) elemInfo->length - 1)) /
- SIZEOF (pexCoord2D));
- break;
-
- case PEXOCText:
-
- {
- /* Text is always mono encoded */
-
- pexText *oc;
- pexMonoEncoding *enc;
- int size, i;
-
- GET_STRUCT_PTR (pexText, pBuf, oc);
- pBuf += SIZEOF (pexText);
-
- for (i = 0; i < (int) oc->numEncodings; i++)
- {
- GET_STRUCT_PTR (pexMonoEncoding, pBuf, enc);
-
- if (enc->characterSetWidth == PEXCSLong)
- size = enc->numChars * sizeof (long);
- else if (enc->characterSetWidth == PEXCSShort)
- size = enc->numChars * sizeof (short);
- else /* enc->characterSetWidth == PEXCSByte) */
- size = enc->numChars;
-
- pBuf += (SIZEOF (pexMonoEncoding) + PADDED_BYTES (size));
- }
- break;
- }
-
- case PEXOCText2D:
-
- {
- /* Text is always mono encoded */
-
- pexText2D *oc;
- pexMonoEncoding *enc;
- int size, i;
-
- GET_STRUCT_PTR (pexText2D, pBuf, oc);
- pBuf += SIZEOF (pexText2D);
-
- for (i = 0; i < (int) oc->numEncodings; i++)
- {
- GET_STRUCT_PTR (pexMonoEncoding, pBuf, enc);
-
- if (enc->characterSetWidth == PEXCSLong)
- size = enc->numChars * sizeof (long);
- else if (enc->characterSetWidth == PEXCSShort)
- size = enc->numChars * sizeof (short);
- else /* enc->characterSetWidth == PEXCSByte) */
- size = enc->numChars;
-
- pBuf += (SIZEOF (pexMonoEncoding) + PADDED_BYTES (size));
- }
- break;
- }
-
- case PEXOCAnnotationText:
-
- {
- /* Anno Text is always mono encoded */
-
- pexAnnotationText *oc;
- pexMonoEncoding *enc;
- int size, i;
-
- GET_STRUCT_PTR (pexAnnotationText, pBuf, oc);
- pBuf += SIZEOF (pexAnnotationText);
-
- for (i = 0; i < (int) oc->numEncodings; i++)
- {
- GET_STRUCT_PTR (pexMonoEncoding, pBuf, enc);
-
- if (enc->characterSetWidth == PEXCSLong)
- size = enc->numChars * sizeof (long);
- else if (enc->characterSetWidth == PEXCSShort)
- size = enc->numChars * sizeof (short);
- else /* enc->characterSetWidth == PEXCSByte) */
- size = enc->numChars;
-
- pBuf += (SIZEOF (pexMonoEncoding) + PADDED_BYTES (size));
- }
- break;
- }
-
- case PEXOCAnnotationText2D:
-
- {
- /* Anno Text is always mono encoded */
-
- pexAnnotationText2D *oc;
- pexMonoEncoding *enc;
- int size, i;
-
- GET_STRUCT_PTR (pexAnnotationText2D, pBuf, oc);
- pBuf += SIZEOF (pexAnnotationText2D);
-
- for (i = 0; i < (int) oc->numEncodings; i++)
- {
- GET_STRUCT_PTR (pexMonoEncoding, pBuf, enc);
-
- if (enc->characterSetWidth == PEXCSLong)
- size = enc->numChars * sizeof (long);
- else if (enc->characterSetWidth == PEXCSShort)
- size = enc->numChars * sizeof (short);
- else /* enc->characterSetWidth == PEXCSByte) */
- size = enc->numChars;
-
- pBuf += (SIZEOF (pexMonoEncoding) + PADDED_BYTES (size));
- }
- break;
- }
-
- case PEXOCPolylineSetWithData:
-
- {
- pexPolylineSetWithData *oc;
- int lenofVertex, i;
- CARD32 count;
-
- GET_STRUCT_PTR (pexPolylineSetWithData, pBuf, oc);
-
- lenofVertex = LENOF (pexCoord3D) +
- ((oc->vertexAttribs & PEXGAColor) ?
- GetColorLength (oc->colorType) : 0);
-
- pBuf += SIZEOF (pexPolylineSetWithData);
-
- for (i = 0; i < oc->numLists; i++)
- {
- EXTRACT_CARD32 (pBuf, count);
- pBuf += NUMBYTES (count * lenofVertex);
- }
- break;
- }
-
- case PEXOCNURBCurve:
-
- {
- pexNURBCurve *oc;
-
- GET_STRUCT_PTR (pexNURBCurve, pBuf, oc);
-
- pBuf += (SIZEOF (pexNURBCurve) + oc->numKnots * SIZEOF (float) +
- (oc->numPoints * ((oc->coordType == PEXRational) ?
- SIZEOF (pexCoord4D) : SIZEOF (pexCoord3D))));
- break;
- }
-
- case PEXOCFillArea:
-
- {
- int count;
-
- count = (SIZEOF (CARD32) * ((int) elemInfo->length - 2)) /
- SIZEOF (pexCoord3D);
-
- pBuf += (SIZEOF (pexFillArea) + count * SIZEOF (pexCoord3D));
- break;
- }
-
- case PEXOCFillArea2D:
-
- {
- int count;
-
- count = (SIZEOF (CARD32) * ((int) elemInfo->length - 2)) /
- SIZEOF (pexCoord2D);
-
- pBuf += (SIZEOF (pexFillArea2D) + count * SIZEOF (pexCoord2D));
- break;
- }
-
- case PEXOCFillAreaWithData:
-
- {
- pexFillAreaWithData *oc;
- int lenofFacetData;
- int lenofVertex;
- int lenofColor;
- CARD32 count;
-
- GET_STRUCT_PTR (pexFillAreaWithData, pBuf, oc);
-
- lenofColor = GetColorLength (oc->colorType);
- lenofFacetData = GetFacetDataLength (oc->facetAttribs, lenofColor);
- lenofVertex = GetVertexWithDataLength (
- oc->vertexAttribs, lenofColor);
-
- pBuf += SIZEOF (pexFillAreaWithData);
-
- if (oc->facetAttribs)
- pBuf += NUMBYTES (lenofFacetData);
-
- EXTRACT_CARD32 (pBuf, count);
- pBuf += (count * NUMBYTES (lenofVertex));
- break;
- }
-
- case PEXOCFillAreaSet:
-
- {
- pexFillAreaSet *oc;
- int i;
- CARD32 count;
-
- GET_STRUCT_PTR (pexFillAreaSet, pBuf, oc);
-
- pBuf += SIZEOF (pexFillAreaSet);
-
- for (i = 0; i < oc->numLists; i++)
- {
- EXTRACT_CARD32 (pBuf, count);
- pBuf += (count * SIZEOF (pexCoord3D));
- }
- break;
- }
-
- case PEXOCFillAreaSet2D:
-
- {
- pexFillAreaSet2D *oc;
- int i;
- CARD32 count;
-
- GET_STRUCT_PTR (pexFillAreaSet2D, pBuf, oc);
-
- pBuf += SIZEOF (pexFillAreaSet2D);
-
- for (i = 0; i < oc->numLists; i++)
- {
- EXTRACT_CARD32 (pBuf, count);
- pBuf += (count * SIZEOF (pexCoord2D));
- }
- break;
- }
-
- case PEXOCFillAreaSetWithData:
-
- {
- pexFillAreaSetWithData *oc;
- int lenofFacetData;
- int lenofVertex;
- int lenofColor, i;
- CARD32 count;
-
- GET_STRUCT_PTR (pexFillAreaSetWithData, pBuf, oc);
-
- lenofColor = GetColorLength (oc->colorType);
- lenofFacetData = GetFacetDataLength (oc->facetAttribs, lenofColor);
- lenofVertex = GetVertexWithDataLength (
- oc->vertexAttribs, lenofColor);
-
- if (oc->vertexAttribs & PEXGAEdges)
- lenofVertex++; /* edge switch is CARD32 */
-
- pBuf += SIZEOF (pexFillAreaSetWithData);
-
- if (oc->facetAttribs)
- pBuf += NUMBYTES (lenofFacetData);
-
- for (i = 0; i < oc->numLists; i++)
- {
- EXTRACT_CARD32 (pBuf, count);
- pBuf += (count * NUMBYTES (lenofVertex));
- }
- break;
- }
-
- case PEXOCTriangleStrip:
-
- {
- pexTriangleStrip *oc;
- int lenofColor;
- int lenofFacetDataList;
- int lenofVertexList;
-
- GET_STRUCT_PTR (pexTriangleStrip, pBuf, oc);
-
- lenofColor = GetColorLength (oc->colorType);
- lenofFacetDataList = (oc->numVertices - 2) *
- GetFacetDataLength (oc->facetAttribs, lenofColor);
- lenofVertexList = oc->numVertices *
- GetVertexWithDataLength (oc->vertexAttribs, lenofColor);
-
- pBuf += SIZEOF (pexTriangleStrip);
-
- if (oc->facetAttribs)
- pBuf += NUMBYTES (lenofFacetDataList);
-
- pBuf += NUMBYTES (lenofVertexList);
- break;
- }
-
- case PEXOCQuadrilateralMesh:
-
- {
- pexQuadrilateralMesh *oc;
- int lenofColor;
- int lenofFacetDataList;
- int lenofVertexList;
-
- GET_STRUCT_PTR (pexQuadrilateralMesh, pBuf, oc);
-
- lenofColor = GetColorLength (oc->colorType);
- lenofFacetDataList = ((oc->mPts - 1) * (oc->nPts - 1)) *
- GetFacetDataLength (oc->facetAttribs, lenofColor);
- lenofVertexList = oc->mPts * oc->nPts *
- GetVertexWithDataLength (oc->vertexAttribs, lenofColor);
-
- pBuf += SIZEOF (pexQuadrilateralMesh);
-
- if (oc->facetAttribs)
- pBuf += NUMBYTES (lenofFacetDataList);
-
- pBuf += NUMBYTES (lenofVertexList);
- break;
- }
-
- case PEXOCSetOfFillAreaSets:
-
- {
- pexSetOfFillAreaSets *oc;
- int lenofColor;
- int lenofFacet;
- int lenofVertex;
- int cbytes, i, j;
- CARD16 count, scount;
-
- GET_STRUCT_PTR (pexSetOfFillAreaSets, pBuf, oc);
-
- lenofColor = GetColorLength (oc->colorType);
- lenofFacet = GetFacetDataLength (oc->FAS_Attributes, lenofColor);
- lenofVertex = GetVertexWithDataLength (
- oc->vertexAttributes, lenofColor);
-
- pBuf += SIZEOF (pexSetOfFillAreaSets);
-
- if (oc->FAS_Attributes)
- pBuf += (NUMBYTES (lenofFacet) * oc->numFAS);
-
- pBuf += (NUMBYTES (lenofVertex) * oc->numVertices);
-
- if (oc->edgeAttributes)
- pBuf += PADDED_BYTES (oc->numEdges * SIZEOF (CARD8));
-
- for (i = 0; i < (int) oc->numFAS; i++)
- {
- EXTRACT_CARD16 (pBuf, count);
-
- for (j = 0; j < (int) count; j++)
- {
- EXTRACT_CARD16 (pBuf, scount);
- pBuf += (scount * SIZEOF (CARD16));
- }
- }
-
- cbytes = SIZEOF (CARD16) *
- (oc->numFAS + oc->numContours + oc->numEdges);
-
- pBuf += PAD (cbytes);
- break;
- }
-
- case PEXOCNURBSurface:
-
- {
- pexNURBSurface *oc;
- int sizeofVertexList;
- int sizeofUKnotList;
- int sizeofVKnotList;
- pexTrimCurve *trim;
- int i, j;
- CARD32 count;
-
- GET_STRUCT_PTR (pexNURBSurface, pBuf, oc);
-
- sizeofVertexList = oc->mPts * oc->nPts *
- ((oc->type == PEXRational) ?
- SIZEOF (pexCoord4D) : SIZEOF (pexCoord3D));
- sizeofUKnotList = NUMBYTES (oc->uOrder + oc->mPts);
- sizeofVKnotList = NUMBYTES (oc->vOrder + oc->nPts);
-
- pBuf += (SIZEOF (pexNURBSurface) +
- sizeofUKnotList + sizeofVKnotList + sizeofVertexList);
-
- for (i = 0; i < oc->numLists; i++)
- {
- EXTRACT_CARD32 (pBuf, count);
-
- for (j = 0; j < count; j++)
- {
- GET_STRUCT_PTR (pexTrimCurve, pBuf, trim);
-
- pBuf += (SIZEOF (pexTrimCurve) +
- NUMBYTES (trim->order + trim->numCoord) +
- trim->numCoord * ((trim->type == PEXRational) ?
- SIZEOF (pexCoord3D) : SIZEOF (pexCoord2D)));
- }
- }
- break;
- }
-
- case PEXOCCellArray:
-
- {
- pexCellArray *oc;
- int size;
-
- GET_STRUCT_PTR (pexCellArray, pBuf, oc);
-
- size = oc->dx * oc->dy * SIZEOF (pexTableIndex);
- pBuf += (SIZEOF (pexCellArray) + PADDED_BYTES (size));
- break;
- }
-
- case PEXOCCellArray2D:
-
- {
- pexCellArray2D *oc;
- int size;
-
- GET_STRUCT_PTR (pexCellArray2D, pBuf, oc);
-
- size = oc->dx * oc->dy * SIZEOF (pexTableIndex);
- pBuf += (SIZEOF (pexCellArray2D) + PADDED_BYTES (size));
- break;
- }
-
- case PEXOCExtendedCellArray:
-
- {
- pexExtendedCellArray *oc;
-
- GET_STRUCT_PTR (pexExtendedCellArray, pBuf, oc);
-
- pBuf += (SIZEOF (pexExtendedCellArray) +
- oc->dx * oc->dy * NUMBYTES (GetColorLength (oc->colorType)));
- break;
- }
-
- case PEXOCGDP:
-
- {
- pexGDP *oc;
-
- GET_STRUCT_PTR (pexGDP, pBuf, oc);
-
- pBuf += (SIZEOF (pexGDP) + oc->numPoints * SIZEOF (pexCoord3D) +
- PADDED_BYTES (oc->numBytes));
- break;
- }
-
- case PEXOCGDP2D:
-
- {
- pexGDP2D *oc;
-
- GET_STRUCT_PTR (pexGDP2D, pBuf, oc);
-
- pBuf += (SIZEOF (pexGDP2D) + oc->numPoints * SIZEOF (pexCoord2D) +
- PADDED_BYTES (oc->numBytes));
- break;
- }
-
- case PEXOCNoop:
-
- pBuf += SIZEOF (pexNoop);
- break;
-
- default:
- break;
- }
-
- totalSize += (pBuf - pBufStart);
- oc_count++;
- }
-
-#ifdef DEBUG
- if (totalSize > length)
- {
- printf ("PEXlib WARNING : Internal error in PEXCountOCs :\n");
- printf ("OC parsing continued past the end of the input buffer.\n");
- }
-#endif
-
- return (oc_count);
-}
-
-
-/*
- * INTERNAL FUNCTIONS
- */
-
-void
-_PEXCopyPaddedBytesToOC (display, numBytes, data)
-
-INPUT Display *display;
-INPUT int numBytes;
-INPUT char *data;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
- int paddedBytes = PADDED_BYTES (numBytes);
-
-
- if (paddedBytes <= BytesLeftInXBuffer (display))
- {
- /*
- * There is room in the X buffer to do the copy.
- */
-
- memcpy (display->bufptr, data, numBytes);
- display->bufptr += paddedBytes;
- }
- else
- {
- /*
- * Copying this OC will overflow the transport buffer. Using
- * _XSend will take care of splitting the buffer into chunks
- * small enough to fit in the transport buffer.
- */
-
- _XSend (display, data, numBytes);
-
-
- /*
- * Make sure that the next oc starts a new request.
- */
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
- pexDisplayInfo->lastReqNum = -1;
- }
-}
-
-
-void
-_PEXSendBytesToOC (display, numBytes, data)
-
-INPUT Display *display;
-INPUT int numBytes;
-INPUT char *data;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
- int mod4bytes;
-
-
- /*
- * _XSend will take care of splitting the buffer into chunks
- * small enough to fit in the transport buffer. _XSend will
- * only copy a multiple of 4 bytes, so we must do some extra
- * work if numBytes % 4 != 0.
- */
-
- if (mod4bytes = numBytes % 4)
- {
- if (mod4bytes > BytesLeftInXBuffer (display))
- _XFlush (display);
-
- memcpy (display->bufptr, data, mod4bytes);
- display->bufptr += mod4bytes;
-
- data += mod4bytes;
- numBytes -= mod4bytes;
- }
-
- _XSend (display, data, numBytes);
-
-
- /*
- * Make sure that the next oc starts a new request.
- */
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
- pexDisplayInfo->lastReqNum = -1;
-}
-
-
-void _PEXOCFacet (display, colorType, facetAttr, facetData, fpFormat)
-
-INPUT Display *display;
-INPUT int colorType;
-INPUT unsigned int facetAttr;
-INPUT PEXFacetData *facetData;
-INPUT int fpFormat;
-
-{
- int lenofFacet;
- char *ocAddr;
- PEXVector *normal;
-
- if (!facetData)
- return;
-
- lenofFacet = GetFacetDataLength (facetAttr, GetColorLength (colorType));
- ocAddr = PEXGetOCAddr (display, NUMBYTES (lenofFacet));
-
- if (!(facetAttr & PEXGAColor))
- {
- normal = &(facetData->normal);
- }
- else
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
-
- STORE_CARD16 (facetData->index.index, ocAddr);
- ocAddr += 2;
- normal = &(facetData->index_normal.normal);
- break;
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
-
- FP_CONVERT_HTON_BUFF (facetData->rgb.red, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (facetData->rgb.green, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (facetData->rgb.blue, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- normal = &(facetData->rgb_normal.normal);
- break;
-
- case PEXColorTypeRGB8:
-
- memcpy (ocAddr, &(facetData->rgb8), 4);
- ocAddr += 4;
- normal = &(facetData->rgb8_normal.normal);
- break;
-
- case PEXColorTypeRGB16:
-
- STORE_CARD16 (facetData->rgb16.red, ocAddr);
- STORE_CARD16 (facetData->rgb16.green, ocAddr);
- STORE_CARD16 (facetData->rgb16.blue, ocAddr);
- ocAddr += 2;
- normal = &(facetData->rgb16_normal.normal);
- break;
- }
- }
-
- if (facetAttr & PEXGANormal)
- {
- FP_CONVERT_HTON_BUFF (normal->x, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->y, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->z, ocAddr, fpFormat);
- }
-}
-
-
-void _PEXOCListOfFacet (display, count, colorType,
- facetAttr, facetData, fpFormat)
-
-INPUT Display *display;
-INPUT int count;
-INPUT int colorType;
-INPUT unsigned int facetAttr;
-INPUT PEXArrayOfFacetData facetData;
-INPUT int fpFormat;
-
-{
- int lenofFacet;
- int maxWords;
- int wordsLeft;
- int copyWords, i;
- char *ocAddr;
- char *data;
- PEXVector *normal;
-
- if (!(data = (char *) facetData.index))
- return;
-
- lenofFacet = GetFacetDataLength (facetAttr, GetColorLength (colorType));
-
- maxWords = NUMWORDS (PEXGetOCAddrMaxSize (display));
- wordsLeft = count * lenofFacet;
- copyWords = (wordsLeft < maxWords) ?
- wordsLeft : (maxWords - maxWords % lenofFacet);
-
- while (copyWords > 0)
- {
- ocAddr = PEXGetOCAddr (display, NUMBYTES (copyWords));
- for (i = 0; i < (copyWords / lenofFacet); i++)
- {
- if (facetAttr & PEXGAColor)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- STORE_CARD16 (col->index, ocAddr);
- ocAddr += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_HTON_BUFF (col->red, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->green, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->blue, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (ocAddr, data, 4);
- ocAddr += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- STORE_CARD16 (col->red, ocAddr);
- STORE_CARD16 (col->green, ocAddr);
- STORE_CARD16 (col->blue, ocAddr);
- ocAddr += 2;
- break;
- }
- }
- }
-
- if (facetAttr & PEXGANormal)
- {
- normal = (PEXVector *) data;
- data += sizeof (PEXVector);
-
- FP_CONVERT_HTON_BUFF (normal->x, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->y, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->z, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- }
- }
-
- wordsLeft -= copyWords;
- copyWords = (wordsLeft < maxWords) ?
- wordsLeft : (maxWords - maxWords % lenofFacet);
- }
-}
-
-
-void _PEXOCListOfVertex (display, count, colorType,
- vertAttr, vertData, fpFormat)
-
-INPUT Display *display;
-INPUT int count;
-INPUT int colorType;
-INPUT unsigned int vertAttr;
-INPUT PEXArrayOfVertex vertData;
-INPUT int fpFormat;
-
-{
- int lenofVert;
- int maxWords;
- int wordsLeft;
- int copyWords, i;
- char *ocAddr;
- char *data;
- PEXVector *normal;
- unsigned int *edge;
-
- if (!(data = (char *) vertData.index))
- return;
-
- lenofVert = GetVertexWithDataLength (vertAttr, GetColorLength (colorType));
-
- maxWords = NUMWORDS (PEXGetOCAddrMaxSize (display));
- wordsLeft = count * lenofVert;
- copyWords = (wordsLeft < maxWords) ?
- wordsLeft : (maxWords - maxWords % lenofVert);
-
- while (copyWords > 0)
- {
- ocAddr = PEXGetOCAddr (display, NUMBYTES (copyWords));
- for (i = 0; i < (copyWords / lenofVert); i++)
- {
- PEXCoord *coord = (PEXCoord *) data;
- data += sizeof (PEXCoord);
-
- FP_CONVERT_HTON_BUFF (coord->x, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (coord->y, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (coord->z, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
-
- if (vertAttr & PEXGAColor)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- STORE_CARD16 (col->index, ocAddr);
- ocAddr += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_HTON_BUFF (col->red, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->green, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->blue, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (ocAddr, data, 4);
- ocAddr += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- STORE_CARD16 (col->red, ocAddr);
- STORE_CARD16 (col->green, ocAddr);
- STORE_CARD16 (col->blue, ocAddr);
- ocAddr += 2;
- break;
- }
- }
- }
-
- if (vertAttr & PEXGANormal)
- {
- normal = (PEXVector *) data;
- data += sizeof (PEXVector);
-
- FP_CONVERT_HTON_BUFF (normal->x, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->y, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->z, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- }
-
- if (vertAttr & PEXGAEdges)
- {
- edge = (unsigned int *) data;
- data += sizeof (unsigned int);
- STORE_CARD32 (*edge, ocAddr);
- }
- }
-
- wordsLeft -= copyWords;
- copyWords = (wordsLeft < maxWords) ?
- wordsLeft : (maxWords - maxWords % lenofVert);
- }
-}
-
-
-void _PEXOCListOfColor (display, count, colorType, colors, fpFormat)
-
-INPUT Display *display;
-INPUT int count;
-INPUT int colorType;
-INPUT PEXArrayOfColor colors;
-INPUT int fpFormat;
-
-{
- int lenofColor;
- int maxWords;
- int wordsLeft;
- int copyWords, i;
- char *ocAddr;
- char *data;
-
- if (!(data = (char *) colors.indexed))
- return;
-
- lenofColor = GetColorLength (colorType);
-
- maxWords = NUMWORDS (PEXGetOCAddrMaxSize (display));
- wordsLeft = count * lenofColor;
- copyWords = (wordsLeft < maxWords) ?
- wordsLeft : (maxWords - maxWords % lenofColor);
-
- while (copyWords > 0)
- {
- ocAddr = PEXGetOCAddr (display, NUMBYTES (copyWords));
- for (i = 0; i < (copyWords / lenofColor); i++)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- STORE_CARD16 (col->index, ocAddr);
- ocAddr += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_HTON_BUFF (col->red, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->green, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->blue, ocAddr, fpFormat);
- ocAddr += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (ocAddr, data, 4);
- ocAddr += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- STORE_CARD16 (col->red, ocAddr);
- STORE_CARD16 (col->green, ocAddr);
- STORE_CARD16 (col->blue, ocAddr);
- ocAddr += 2;
- break;
- }
- }
- }
-
- wordsLeft -= copyWords;
- copyWords = (wordsLeft < maxWords) ?
- wordsLeft : (maxWords - maxWords % lenofColor);
- }
-}
-
-
-void _PEXStoreFacet (colorType, facetAttr, facetData, bufPtr, fpFormat)
-
-INPUT int colorType;
-INPUT unsigned int facetAttr;
-INPUT PEXFacetData *facetData;
-INPUT char **bufPtr;
-INPUT int fpFormat;
-
-{
- PEXVector *normal;
- char *pBuf = *bufPtr;
-
- if (!facetData)
- return;
-
- if (!(facetAttr & PEXGAColor))
- {
- normal = &(facetData->normal);
- }
- else
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
-
- STORE_CARD16 (facetData->index.index, pBuf);
- pBuf += 2;
- normal = &(facetData->index_normal.normal);
- break;
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
-
- FP_CONVERT_HTON_BUFF (facetData->rgb.red, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (facetData->rgb.green, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (facetData->rgb.blue, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- normal = &(facetData->rgb_normal.normal);
- break;
-
- case PEXColorTypeRGB8:
-
- memcpy (pBuf, &(facetData->rgb8), 4);
- pBuf += 4;
- normal = &(facetData->rgb8_normal.normal);
- break;
-
- case PEXColorTypeRGB16:
-
- STORE_CARD16 (facetData->rgb16.red, pBuf);
- STORE_CARD16 (facetData->rgb16.green, pBuf);
- STORE_CARD16 (facetData->rgb16.blue, pBuf);
- pBuf += 2;
- normal = &(facetData->rgb16_normal.normal);
- break;
- }
- }
-
- if (facetAttr & PEXGANormal)
- {
- FP_CONVERT_HTON_BUFF (normal->x, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->y, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->z, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXStoreListOfFacet (count, colorType,
- facetAttr, facetData, bufPtr, fpFormat)
-
-INPUT int count;
-INPUT int colorType;
-INPUT unsigned int facetAttr;
-INPUT PEXArrayOfFacetData facetData;
-INPUT char **bufPtr;
-INPUT int fpFormat;
-
-{
- int i;
- char *data;
- PEXVector *normal;
- char *pBuf = *bufPtr;
-
- if (!(data = (char *) facetData.index))
- return;
-
- for (i = 0; i < count; i++)
- {
- if (facetAttr & PEXGAColor)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- STORE_CARD16 (col->index, pBuf);
- pBuf += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_HTON_BUFF (col->red, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->green, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->blue, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (pBuf, data, 4);
- pBuf += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- STORE_CARD16 (col->red, pBuf);
- STORE_CARD16 (col->green, pBuf);
- STORE_CARD16 (col->blue, pBuf);
- pBuf += 2;
- break;
- }
- }
- }
-
- if (facetAttr & PEXGANormal)
- {
- normal = (PEXVector *) data;
- data += sizeof (PEXVector);
-
- FP_CONVERT_HTON_BUFF (normal->x, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->y, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->z, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- }
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXStoreListOfVertex (count, colorType,
- vertAttr, vertData, bufPtr, fpFormat)
-
-INPUT int count;
-INPUT int colorType;
-INPUT unsigned int vertAttr;
-INPUT PEXArrayOfVertex vertData;
-INPUT char **bufPtr;
-INPUT int fpFormat;
-
-{
- int i;
- char *data;
- PEXVector *normal;
- unsigned int *edge;
- char *pBuf = *bufPtr;
-
- if (!(data = (char *) vertData.index))
- return;
-
- for (i = 0; i < count; i++)
- {
- PEXCoord *coord = (PEXCoord *) data;
- data += sizeof (PEXCoord);
-
- FP_CONVERT_HTON_BUFF (coord->x, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (coord->y, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (coord->z, pBuf, fpFormat);
- pBuf += SIZEOF (float);
-
- if (vertAttr & PEXGAColor)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- STORE_CARD16 (col->index, pBuf);
- pBuf += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_HTON_BUFF (col->red, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->green, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->blue, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (pBuf, data, 4);
- pBuf += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- STORE_CARD16 (col->red, pBuf);
- STORE_CARD16 (col->green, pBuf);
- STORE_CARD16 (col->blue, pBuf);
- pBuf += 2;
- break;
- }
- }
- }
-
- if (vertAttr & PEXGANormal)
- {
- normal = (PEXVector *) data;
- data += sizeof (PEXVector);
-
- FP_CONVERT_HTON_BUFF (normal->x, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->y, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (normal->z, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- }
-
- if (vertAttr & PEXGAEdges)
- {
- edge = (unsigned int *) data;
- data += sizeof (unsigned int);
- STORE_CARD32 (*edge, pBuf);
- }
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXStoreListOfColor (count, colorType, colors, bufPtr, fpFormat)
-
-INPUT int count;
-INPUT int colorType;
-INPUT PEXArrayOfColor colors;
-INPUT char **bufPtr;
-INPUT int fpFormat;
-
-{
- int i;
- char *data;
- char *pBuf = *bufPtr;
-
- if (!(data = (char *) colors.indexed))
- return;
-
- for (i = 0; i < count; i++)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- STORE_CARD16 (col->index, pBuf);
- pBuf += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_HTON_BUFF (col->red, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->green, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_HTON_BUFF (col->blue, pBuf, fpFormat);
- pBuf += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (pBuf, data, 4);
- pBuf += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- STORE_CARD16 (col->red, pBuf);
- STORE_CARD16 (col->green, pBuf);
- STORE_CARD16 (col->blue, pBuf);
- pBuf += 2;
- break;
- }
- }
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXExtractFacet (bufPtr, colorType, facetAttr, facetData, fpFormat)
-
-INPUT char **bufPtr;
-INPUT int colorType;
-INPUT unsigned int facetAttr;
-INPUT PEXFacetData *facetData;
-INPUT int fpFormat;
-
-{
- PEXVector *normal;
- char *pBuf = *bufPtr;
-
- if (!facetData)
- return;
-
- if (!(facetAttr & PEXGAColor))
- {
- normal = &(facetData->normal);
- }
- else
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
-
- EXTRACT_CARD16 (pBuf, facetData->index.index);
- pBuf += 2;
- normal = &(facetData->index_normal.normal);
- break;
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
-
- FP_CONVERT_NTOH_BUFF (pBuf, facetData->rgb.red, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, facetData->rgb.green, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, facetData->rgb.blue, fpFormat);
- pBuf += SIZEOF (float);
- normal = &(facetData->rgb_normal.normal);
- break;
-
- case PEXColorTypeRGB8:
-
- memcpy (&(facetData->rgb8), pBuf, 4);
- pBuf += 4;
- normal = &(facetData->rgb8_normal.normal);
- break;
-
- case PEXColorTypeRGB16:
-
- EXTRACT_CARD16 (pBuf, facetData->rgb16.red);
- EXTRACT_CARD16 (pBuf, facetData->rgb16.green);
- EXTRACT_CARD16 (pBuf, facetData->rgb16.blue);
- pBuf += 2;
- normal = &(facetData->rgb16_normal.normal);
- break;
- }
- }
-
- if (facetAttr & PEXGANormal)
- {
- FP_CONVERT_NTOH_BUFF (pBuf, normal->x, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, normal->y, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, normal->z, fpFormat);
- pBuf += SIZEOF (float);
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXExtractListOfFacet (count, bufPtr, colorType,
- facetAttr, facetData, fpFormat)
-
-INPUT int count;
-INPUT char **bufPtr;
-INPUT int colorType;
-INPUT unsigned int facetAttr;
-INPUT PEXArrayOfFacetData facetData;
-INPUT int fpFormat;
-
-{
- int i;
- char *data;
- PEXVector *normal;
- char *pBuf = *bufPtr;
-
- if (!(data = (char *) facetData.index))
- return;
-
- for (i = 0; i < count; i++)
- {
- if (facetAttr & PEXGAColor)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- EXTRACT_CARD16 (pBuf, col->index);
- pBuf += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_NTOH_BUFF (pBuf, col->red, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, col->green, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, col->blue, fpFormat);
- pBuf += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (data, pBuf, 4);
- pBuf += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- EXTRACT_CARD16 (pBuf, col->red);
- EXTRACT_CARD16 (pBuf, col->green);
- EXTRACT_CARD16 (pBuf, col->blue);
- pBuf += 2;
- break;
- }
- }
- }
-
- if (facetAttr & PEXGANormal)
- {
- normal = (PEXVector *) data;
- data += sizeof (PEXVector);
-
- FP_CONVERT_NTOH_BUFF (pBuf, normal->x, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, normal->y, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, normal->z, fpFormat);
- pBuf += SIZEOF (float);
- }
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXExtractListOfVertex (count, bufPtr, colorType,
- vertAttr, vertData, fpFormat)
-
-INPUT int count;
-INPUT char **bufPtr;
-INPUT int colorType;
-INPUT unsigned int vertAttr;
-INPUT PEXArrayOfVertex vertData;
-INPUT int fpFormat;
-
-{
- int i;
- char *data;
- PEXVector *normal;
- unsigned int *edge;
- char *pBuf = *bufPtr;
-
- if (!(data = (char *) vertData.index))
- return;
-
- for (i = 0; i < count; i++)
- {
- PEXCoord *coord = (PEXCoord *) data;
- data += sizeof (PEXCoord);
-
- FP_CONVERT_NTOH_BUFF (pBuf, coord->x, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, coord->y, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, coord->z, fpFormat);
- pBuf += SIZEOF (float);
-
- if (vertAttr & PEXGAColor)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- EXTRACT_CARD16 (pBuf, col->index);
- pBuf += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_NTOH_BUFF (pBuf, col->red, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, col->green, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, col->blue, fpFormat);
- pBuf += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (data, pBuf, 4);
- pBuf += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- EXTRACT_CARD16 (pBuf, col->red);
- EXTRACT_CARD16 (pBuf, col->green);
- EXTRACT_CARD16 (pBuf, col->blue);
- pBuf += 2;
- break;
- }
- }
- }
-
- if (vertAttr & PEXGANormal)
- {
- normal = (PEXVector *) data;
- data += sizeof (PEXVector);
-
- FP_CONVERT_NTOH_BUFF (pBuf, normal->x, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, normal->y, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, normal->z, fpFormat);
- pBuf += SIZEOF (float);
- }
-
- if (vertAttr & PEXGAEdges)
- {
- edge = (unsigned int *) data;
- data += sizeof (unsigned int);
- EXTRACT_CARD32 (pBuf, *edge);
- }
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXExtractListOfColor (count, bufPtr, colorType, colors, fpFormat)
-
-INPUT int count;
-INPUT char **bufPtr;
-INPUT int colorType;
-INPUT PEXArrayOfColor colors;
-INPUT int fpFormat;
-
-{
- int i;
- char *data;
- char *pBuf = *bufPtr;
-
- if (!(data = (char *) colors.indexed))
- return;
-
- for (i = 0; i < count; i++)
- {
- switch (colorType)
- {
- case PEXColorTypeIndexed:
- {
- PEXColorIndexed *col = (PEXColorIndexed *) data;
- data += sizeof (PEXColorIndexed);
-
- EXTRACT_CARD16 (pBuf, col->index);
- pBuf += 2;
- break;
- }
-
- case PEXColorTypeRGB:
- case PEXColorTypeCIE:
- case PEXColorTypeHSV:
- case PEXColorTypeHLS:
- {
- PEXColorRGB *col = (PEXColorRGB *) data;
- data += sizeof (PEXColorRGB);
-
- FP_CONVERT_NTOH_BUFF (pBuf, col->red, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, col->green, fpFormat);
- pBuf += SIZEOF (float);
- FP_CONVERT_NTOH_BUFF (pBuf, col->blue, fpFormat);
- pBuf += SIZEOF (float);
- break;
- }
-
- case PEXColorTypeRGB8:
-
- memcpy (data, pBuf, 4);
- pBuf += 4;
- data += sizeof (PEXColorRGB8);
- break;
-
- case PEXColorTypeRGB16:
- {
- PEXColorRGB16 *col = (PEXColorRGB16 *) data;
- data += sizeof (PEXColorRGB16);
-
- EXTRACT_CARD16 (pBuf, col->red);
- EXTRACT_CARD16 (pBuf, col->green);
- EXTRACT_CARD16 (pBuf, col->blue);
- pBuf += 2;
- break;
- }
- }
- }
-
- *bufPtr = pBuf;
-}
-
-
-void _PEXGenOCBadLengthError (display, resource_id, req_type)
-
-INPUT Display *display;
-INPUT XID resource_id;
-INPUT PEXOCRequestType req_type;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
- pexOCRequestHeader *req;
-
-
- /*
- * Generate an OC request with a zero request length.
- */
-
- LockDisplay (display);
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
- PEXGetOCReq (0);
-
- BEGIN_NEW_OCREQ_HEADER (display->bufptr, req);
-
- req->extOpcode = pexDisplayInfo->extOpcode;
- req->pexOpcode =
- (req_type == PEXOCStore || req_type == PEXOCStoreSingle) ?
- PEXRCStoreElements : PEXRCRenderOutputCommands;
- req->reqLength = 0;
- req->fpFormat = pexDisplayInfo->fpFormat;
- req->target = resource_id;
- req->numCommands = 1;
-
- END_NEW_OCREQ_HEADER (display->bufptr, req);
-
- /*
- * Make sure that the next oc starts a new request.
- */
-
- pexDisplayInfo->lastReqNum = -1;
- pexDisplayInfo->lastResID = resource_id;
- pexDisplayInfo->lastReqType = req_type;
-
- UnlockDisplay (display);
-}
diff --git a/xc/lib/PEX5/pl_oc_util.h b/xc/lib/PEX5/pl_oc_util.h
deleted file mode 100644
index 60f11c4f9..000000000
--- a/xc/lib/PEX5/pl_oc_util.h
+++ /dev/null
@@ -1,838 +0,0 @@
-/* $TOG: pl_oc_util.h /main/13 1998/02/06 16:11:35 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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.
-******************************************************************************/
-
-
-/*
- * NAME:
- * PEXCopyBytesToOC
- *
- * ARGUMENTS:
- * _display The display pointer.
- *
- * _numBytes The number of bytes to copy.
- *
- * _data The data to copy.
- *
- * DESCRIPTION:
- * This macro serves the same purpose as the PEXlib function
- * PEXCopyBytesToOC, but is used internally by PEXlib in order to
- * avoid a function call (in the simple case when there is enough
- * space in the X transport buffer to do the copy).
- */
-
-#ifndef DEBUG /* use the function version when debugging */
-
-#define PEXCopyBytesToOC(_display, _numBytes, _data) \
-{ \
- if ((int) (_numBytes) <= (int) BytesLeftInXBuffer (_display)) \
- { \
- memcpy (_display->bufptr, _data, _numBytes); \
- _display->bufptr += _numBytes; \
- } \
- else \
- { \
- _PEXSendBytesToOC (_display, _numBytes, _data); \
- } \
-}
-
-#endif
-
-
-
-/*
- * NAME:
- * PEXCopyWordsToOC
- *
- * ARGUMENTS:
- * _display The display pointer.
- *
- * _numWords The number of words to copy.
- *
- * _data The data to copy.
- *
- * DESCRIPTION:
- * This is a convenience macro which converts _numWords to a byte count
- * and calls PEXCopyBytesToOC.
- */
-
-#define PEXCopyWordsToOC(_display, _numWords, _data) \
- PEXCopyBytesToOC (_display, NUMBYTES (_numWords), _data)
-
-
-
-/*
- * NAME:
- * PEXInitOC
- *
- * ARGUMENTS:
- * _display The display pointer.
- *
- * _resID The resource ID of a renderer or structure.
- *
- * _reqType The OC request type
- *
- * _ocHeaderLength The number of words for the OC header.
- *
- * _ocDataLength The number of words for the OC data.
- *
- * _pBuf Return a pointer to the transport buffer
- * which points to the start of the OC.
- *
- * DESCRIPTION:
- * This macro will initialize an OC encoding in the X transport buffer.
- * It will return a pointer in _pBuf which points to the start of the OC.
- * Note that the macro does not have a "}" at the end - this is so the
- * hidden variable 'pexDisplayInfo' can be used by other macros. The
- * macro 'PEXFinishOC' will have the "}".
- */
-
-#define PEXInitOC(_display, _resID, _reqType, _ocHeaderLength, _ocDataLength, _pBuf) \
-{ \
- PEXDisplayInfo *pexDisplayInfo; \
- int ocLength = _ocHeaderLength + _ocDataLength; \
-\
- _pBuf = NULL; \
- PEXGetDisplayInfo (display, pexDisplayInfo); \
- if (ocLength > MAX_REQUEST_SIZE) \
- { \
- _PEXGenOCBadLengthError (_display, _resID, _reqType); \
- } \
- else if (PEXStartOCs (_display, _resID, _reqType, \
- pexDisplayInfo->fpFormat, 1, ocLength)) \
- { \
- _pBuf = display->bufptr; \
- display->bufptr += NUMBYTES (_ocHeaderLength); \
- }
-
-
-
-/*
- * NAME:
- * PEXFinishOC
- *
- * ARGUMENTS:
- * _display The display pointer.
- *
- * DESCRIPTION:
- * This macro is the same as the PEXFinishOCs function, but is used
- * internally by PEXlib to avoid a function call.
- */
-
-#define PEXFinishOC(_display) \
- UnlockDisplay (_display); \
-}
-
-
-
-/*
- * NAME:
- * GetStringsLength
- *
- * ARGUMENTS:
- * _numStrings The number of strings in the mono encoded text.
- *
- * _stringList The list of strings in the mono encoded text.
- *
- * _lenofStrings Return the length of the strings.
- *
- * DESCRIPTION:
- * Compute length of mono-encoded strings.
- */
-
-#define GetStringsLength(_numStrings, _stringList, _lenofStrings) \
-{ \
- PEXEncodedTextData *nextString; \
- int i; \
-\
- (_lenofStrings) = 0; \
- nextString = (_stringList); \
- for (i = 0; i < (_numStrings); i++, nextString++) \
- { \
- lenofStrings += LENOF (pexMonoEncoding); \
- if (nextString->character_set_width == PEXCSLong) \
- (_lenofStrings) += NUMWORDS (nextString->length * SIZEOF (long));\
- else if (nextString->character_set_width == PEXCSShort) \
- (_lenofStrings) += NUMWORDS (nextString->length * SIZEOF (short));\
- else /* ( nextString->character_set_width == PEXCSByte) */ \
- (_lenofStrings) += NUMWORDS (nextString->length); \
- } \
-}
-
-
-
-
-/* -------------------------------------------------------------------------
- * Macros for setting up Output Commands.
- * ------------------------------------------------------------------------- */
-
-/*
- * Output Command names and opcodes.
- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define OCNAME(_name_) pex##_name_
-#define OCOPCODE(_name_) PEXOC##_name_
-#define OCSIZE(_name_) sz_pex##_name_
-#define OCLEN(_name_) ((sz_pex##_name_) >> 2)
-
-#else
-#define OCNAME(_name_) pex/**/_name_
-#define OCOPCODE(_name_) PEXOC/**/_name_
-#define OCSIZE(_name_) sz_pex/**/_name_
-#define OCLEN(_name_) ((sz_pex/**/_name_) >> 2)
-#endif
-
-
-/*
- * PEXGetOCReq sets up an OC request to be sent to the X server. If there
- * isn't enough room left in the X buffer, it is flushed before the new
- * request is started. Unlike PEXGetReq, display->bufptr is not updated
- * by the size of the request header at this point. The calling routine
- * should initialize the header and bump up display->bufptr.
- */
-
-#define PEXGetOCReq(_nBytes) \
-{ \
- if ((display)->bufptr + (_nBytes) > (display)->bufmax) \
- _XFlush (display); \
- (display)->last_req = (display)->bufptr; \
- (display)->request++; \
-}
-
-
-/*
- * Start a new OC request header.
- */
-
-#ifndef WORD64
-
-#define BEGIN_NEW_OCREQ_HEADER(_pBuf, _pReq) \
- _pReq = (pexOCRequestHeader *) _pBuf;
-
-#define END_NEW_OCREQ_HEADER(_pBuf, _pReq)
-
-#else /* WORD64 */
-
-#define BEGIN_NEW_OCREQ_HEADER(_pBuf, _pReq) \
-{ \
- pexOCRequestHeader tReq; \
- _pReq = &tReq;
-
-#define END_NEW_OCREQ_HEADER(_pBuf, _pReq) \
- memcpy (_pBuf, _pReq, SIZEOF (pexOCRequestHeader)); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Update an existing OC request header.
- */
-
-#ifndef WORD64
-
-#define BEGIN_UPDATE_OCREQ_HEADER(_pBuf, _pReq) \
- _pReq = (pexOCRequestHeader *) _pBuf;
-
-#define END_UPDATE_OCREQ_HEADER(_pBuf, _pReq)
-
-#else /* WORD64 */
-
-#define BEGIN_UPDATE_OCREQ_HEADER(_pBuf, _pReq) \
-{ \
- pexOCRequestHeader tReq; \
- _pReq = &tReq; \
- memcpy (_pReq, _pBuf, SIZEOF (pexOCRequestHeader));
-
-#define END_UPDATE_OCREQ_HEADER(_pBuf, _pReq) \
- memcpy (_pBuf, _pReq, SIZEOF (pexOCRequestHeader)); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Begin a new OC for a Store Elements or Render Output Commands Request.
- */
-
-#ifndef WORD64
-
-#define BEGIN_OC_HEADER(_name, _dataLength, _pBuf, _pOC) \
- _pOC = (OCNAME(_name) *) _pBuf; \
- _pOC->oc_opcode = OCOPCODE(_name); \
- _pOC->oc_length = OCLEN(_name) + _dataLength;
-
-#define END_OC_HEADER(_name, _pBuf, _pOC)
-
-#else /* WORD64 */
-
-#define BEGIN_OC_HEADER(_name, _dataLength, _pBuf, _pOC) \
-{ \
- OCNAME(_name) tReq; \
- _pOC = &tReq; \
- _pOC->oc_opcode = OCOPCODE(_name); \
- _pOC->oc_length = OCLEN(_name) + _dataLength;
-
-#define END_OC_HEADER(_name, _pBuf, _pOC) \
- memcpy (_pBuf, _pOC, OCSIZE(_name)); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Add a simple OC to the transport buffer.
- */
-
-#define BEGIN_SIMPLE_OC(_ocName, _resId, _reqType, _pReq) \
-{ \
- char *pBuf; \
- PEXInitOC (display, _resId, _reqType, OCLEN(_ocName), 0, pBuf); \
- if (pBuf == NULL) return; \
- BEGIN_OC_HEADER (_ocName, 0, pBuf, req);
-
-#define END_SIMPLE_OC(_ocName, _resId, _reqType, _pReq) \
- END_OC_HEADER (_ocName, pBuf, _pReq); \
- PEXFinishOC (display); \
-}
-
-
-/*
- * Begin a new OC for a Store Elements or Render Output Commands Request
- * which will go in an application OC encoded buffer.
- */
-
-#ifndef WORD64
-
-#define BEGIN_ENCODE_OCHEADER(_name, _opCode, _dataLength, _pBuf, _pOC) \
- _pOC = (OCNAME(_name) *) _pBuf; \
- _pOC->oc_opcode = _opCode; \
- _pOC->oc_length = OCLEN(_name) + _dataLength;
-
-#define END_ENCODE_OCHEADER(_name, _pBuf, _pOC) \
- _pBuf += OCSIZE(_name);
-
-#else /* WORD64 */
-
-#define BEGIN_ENCODE_OCHEADER(_name, _opCode, _dataLength, _pBuf, _pOC) \
-{ \
- OCNAME(_name) tReq; \
- _pOC = &tReq; \
- _pOC->oc_opcode = _opCode; \
- _pOC->oc_length = OCLEN(_name) + _dataLength;
-
-#define END_ENCODE_OCHEADER(_name, _pBuf, _pOC) \
- memcpy (_pBuf, _pOC, OCSIZE(_name)); \
- _pBuf += OCSIZE(_name); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Encode a simple OC in an application buffer.
- */
-
-#define BEGIN_SIMPLE_ENCODE(_name, _opCode, _pBuf, _pOC) \
- BEGIN_ENCODE_OCHEADER (_name, _opCode, 0, _pBuf, _pOC)
-
-#define END_SIMPLE_ENCODE(_name, _pBuf, _pOC) \
- END_ENCODE_OCHEADER (_name, _pBuf, _pOC)
-
-
-
-/*
- * Trim curve header.
- */
-
-#ifndef WORD64
-
-#define BEGIN_TRIMCURVE_HEAD(_pBuf, _pTrim) \
- _pTrim = (pexTrimCurve *) _pBuf;
-
-#define END_TRIMCURVE_HEAD(_pBuf, _pTrim)
-
-#else /* WORD64 */
-
-#define BEGIN_TRIMCURVE_HEAD(_pBuf, _pTrim) \
-{ \
- pexTrimCurve tTrim; \
- _pTrim = &tTrim;
-
-#define END_TRIMCURVE_HEAD(_pBuf, _pTrim) \
- memcpy (_pBuf, _pTrim, SIZEOF (pexTrimCurve)); \
-}
-
-#endif /* WORD64 */
-
-
-
-/* -------------------------------------------------------------------------
- * Macros to compute the number of words in a facet/vertex with data.
- * ------------------------------------------------------------------------- */
-
-/*
- * Compute the number of protocol words in the facet data
- */
-
-#define GetFacetDataLength(_fattribs, _lenofColor) \
- (((_fattribs & PEXGAColor) ? _lenofColor : 0) + \
- ((_fattribs & PEXGANormal) ? LENOF(pexVector3D) : 0))
-
-
-/*
- * Compute the number of protocol words in a vertex with
- * optional colors and normals
- */
-
-#define GetVertexWithDataLength(_vattribs, _lenofColor) \
- (LENOF (pexCoord3D) + \
- ((_vattribs & PEXGAColor) ? _lenofColor : 0) + \
- ((_vattribs & PEXGANormal) ? LENOF (pexVector3D) : 0))
-
-
-/*
- * Compute the number of bytes in the client's facet data structure
- */
-
-#define GetClientVertexSize(_colorType, _vertexAttribs) \
- (sizeof (PEXCoord) + \
- ((_vertexAttribs & PEXGAColor) ? GetClientColorSize (_colorType) : 0) + \
- ((_vertexAttribs & PEXGANormal) ? sizeof (PEXVector) : 0))
-
-
-/*
- * Compute the number of bytes in the client's vertex data structure
- * with optional colors and normals
- */
-
-#define GetClientFacetSize(_colorType, _facetAttribs) \
- (((_facetAttribs & PEXGAColor) ? GetClientColorSize (_colorType) : 0) + \
- ((_facetAttribs & PEXGANormal) ? sizeof (PEXVector) : 0))
-
-
-
-/* -------------------------------------------------------------------------
- * Generic macros to store OC data.
- * ------------------------------------------------------------------------- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-
-#define STORE_LIST(_name, _count, _pList, _pBuf) \
- STORE_LISTOF_##_name (_count, _pList, _pBuf)
-
-#define STORE_LISTFP(_name, _count, _pList, _pBuf, _fpConvert, _fpFormat) \
- STORE_LISTOF_##_name (_count, _pList, _pBuf, _fpConvert, _fpFormat)
-
-#else
-
-#define STORE_LIST(_name, _count, _pList, _pBuf) \
- STORE_LISTOF_/**/_name (_count, _pList, _pBuf)
-
-#define STORE_LISTFP(_name, _count, _pList, _pBuf, _fpConvert, _fpFormat) \
- STORE_LISTOF_/**/_name (_count, _pList, _pBuf, _fpConvert, _fpFormat)
-
-#endif
-
-
-/*
- * OC data without floating point values.
- */
-
-#define OC_LISTOF_FOO(_pexType, _storeMacro, _count, _fooList) \
-{ \
- _pexType *fooPtr = (_pexType *) _fooList; \
- int bytesLeft = _count * SIZEOF (_pexType); \
- int maxSize, copyBytes, fooCount; \
- char *bufPtr; \
-\
- maxSize = PEXGetOCAddrMaxSize (display); \
- copyBytes = (bytesLeft < maxSize) ? \
- bytesLeft : (maxSize - maxSize % SIZEOF (_pexType)); \
- while (copyBytes > 0) \
- { \
- bufPtr = PEXGetOCAddr (display, copyBytes); \
- fooCount = copyBytes / SIZEOF (_pexType); \
- _storeMacro (fooCount, fooPtr, bufPtr); \
- fooPtr += fooCount; \
- bytesLeft -= copyBytes; \
- copyBytes = (bytesLeft < maxSize) ? \
- bytesLeft : (maxSize - maxSize % SIZEOF (_pexType)); \
- } \
-}
-
-
-/*
- * OC data with floating point values.
- */
-
-#define OC_LISTOF_FOOFP(_pexType, _libType, _storeMacro, _count, _fooList, _fpConvert, _fpFormat) \
-{ \
- _libType *fooPtr = _fooList; \
- int bytesLeft = _count * SIZEOF (_pexType); \
- int maxSize, copyBytes, fooCount; \
- char *bufPtr; \
-\
- maxSize = PEXGetOCAddrMaxSize (display); \
- copyBytes = (bytesLeft < maxSize) ? \
- bytesLeft : (maxSize - maxSize % SIZEOF (_pexType)); \
- while (copyBytes > 0) \
- { \
- bufPtr = PEXGetOCAddr (display, copyBytes); \
- fooCount = copyBytes / SIZEOF (_pexType); \
- _storeMacro (fooCount, fooPtr, bufPtr, _fpConvert, _fpFormat); \
- fooPtr += fooCount; \
- bytesLeft -= copyBytes; \
- copyBytes = (bytesLeft < maxSize) ? \
- bytesLeft : (maxSize - maxSize % SIZEOF (_pexType)); \
- } \
-}
-
-
-
-/* -------------------------------------------------------------------------
- * OC_LISTOF_... macros
- * ------------------------------------------------------------------------- */
-
-#define OC_LISTOF_CARD8(_count, _pList) \
- PEXCopyBytesToOC (display, _count, (char *) _pList);
-
-
-#define OC_LISTOF_CARD8_PAD(_count, _pList) \
- _PEXCopyPaddedBytesToOC (display, _count, (char *) _pList);
-
-
-#ifndef WORD64
-
-#define OC_LISTOF_CARD32(_count, _pList) \
- PEXCopyWordsToOC (display, _count, (char *) _pList);
-
-
-#define OC_LISTOF_CARD16(_count, _pList) \
- PEXCopyBytesToOC (display, _count * SIZEOF (CARD16), (char *) _pList);
-
-
-#define OC_LISTOF_CARD16_PAD(_count, _pList) \
- _PEXCopyPaddedBytesToOC (display, _count * SIZEOF (CARD16), \
- (char *) _pList);
-
-
-#define OC_LISTOF_FLOAT32(_count, _pList, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- OC_LISTOF_FOOFP (float, float, STORE_LISTOF_FLOAT32, \
- _count, _pList, _fpConvert, _fpFormat); \
- } \
- else \
- { \
- PEXCopyBytesToOC (display, \
- _count * SIZEOF (float), (char *) _pList);\
- }
-
-
-#define OC_LISTOF_COORD4D(_count, _pList, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- OC_LISTOF_FOOFP (pexCoord4D, PEXCoord4D, STORE_LISTOF_COORD4D, \
- _count, _pList, _fpConvert, _fpFormat); \
- } \
- else \
- { \
- PEXCopyBytesToOC (display, \
- _count * SIZEOF (pexCoord4D), (char *) _pList);\
- }
-
-
-#define OC_LISTOF_COORD3D(_count, _pList, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- OC_LISTOF_FOOFP (pexCoord3D, PEXCoord, STORE_LISTOF_COORD3D, \
- _count, _pList, _fpConvert, _fpFormat); \
- } \
- else \
- { \
- PEXCopyBytesToOC (display, \
- _count * SIZEOF (pexCoord3D), (char *) _pList);\
- }
-
-
-#define OC_LISTOF_COORD2D(_count, _pList, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- OC_LISTOF_FOOFP (pexCoord2D, PEXCoord2D, STORE_LISTOF_COORD2D, \
- _count, _pList, _fpConvert, _fpFormat); \
- } \
- else \
- { \
- PEXCopyBytesToOC (display, \
- _count * SIZEOF (pexCoord2D), (char *) _pList);\
- }
-
-
-#define OC_LISTOF_HALFSPACE3D(_count, _pList, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- OC_LISTOF_FOOFP (pexHalfSpace, PEXHalfSpace, \
- STORE_LISTOF_HALFSPACE3D, _count, _pList, _fpConvert, _fpFormat); \
- } \
- else \
- { \
- PEXCopyBytesToOC (display, \
- _count * SIZEOF (pexHalfSpace), (char *) _pList);\
- }
-
-
-#define OC_LISTOF_HALFSPACE2D(_count, _pList, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- OC_LISTOF_FOOFP (pexHalfSpace2D, PEXHalfSpace2D, \
- STORE_LISTOF_HALFSPACE2D, _count, _pList, _fpConvert, _fpFormat); \
- } \
- else \
- { \
- PEXCopyBytesToOC (display, \
- _count * SIZEOF (pexHalfSpace2D), (char *) _pList);\
- }
-
-
-#else /* WORD64 */
-
-
-#define OC_LISTOF_CARD32(_count, _pList) \
- OC_LISTOF_FOO (CARD32, STORE_LISTOF_CARD32, _count, _pList);
-
-
-#define OC_LISTOF_CARD16(_count, _pList) \
- OC_LISTOF_FOO (CARD16, STORE_LISTOF_CARD16, _count, _pList);
-
-
-#define OC_LISTOF_CARD16_PAD(_count, _pList) \
-{ \
- OC_LISTOF_FOO (CARD16, STORE_LISTOF_CARD16, _count, _pList); \
- if (_count & 1) PEXGetOCAddr (display, SIZEOF (CARD16)); \
-}
-
-
-#define OC_LISTOF_FLOAT32(_count, _pList, _fpConvert, _fpFormat) \
- OC_LISTOF_FOOFP (float, float, STORE_LISTOF_FLOAT32, \
- _count, _pList, _fpConvert, _fpFormat);
-
-
-#define OC_LISTOF_COORD4D(_count, _pList, _fpConvert, _fpFormat) \
- OC_LISTOF_FOOFP (pexCoord4D, PEXCoord4D, STORE_LISTOF_COORD4D, \
- _count, _pList, _fpConvert, _fpFormat);
-
-
-#define OC_LISTOF_COORD3D(_count, _pList, _fpConvert, _fpFormat) \
- OC_LISTOF_FOOFP (pexCoord3D, PEXCoord, STORE_LISTOF_COORD3D, \
- _count, _pList, _fpConvert, _fpFormat);
-
-
-#define OC_LISTOF_COORD2D(_count, _pList, _fpConvert, _fpFormat) \
- OC_LISTOF_FOOFP (pexCoord2D, PEXCoord2D, STORE_LISTOF_COORD2D, \
- _count, _pList, _fpConvert, _fpFormat);
-
-
-#define OC_LISTOF_HALFSPACE3D(_count, _pList, _fpConvert, _fpFormat)\
- OC_LISTOF_FOOFP (pexHalfSpace, PEXHalfSpace, STORE_LISTOF_HALFSPACE3D, \
- _count, _pList, _fpConvert, _fpFormat);
-
-
-#define OC_LISTOF_HALFSPACE2D(_count, _pList, _fpConvert, _fpFormat)\
- OC_LISTOF_FOOFP (pexHalfSpace2D, PEXHalfSpace2D, STORE_LISTOF_HALFSPACE2D,\
- _count, _pList, _fpConvert, _fpFormat);
-
-
-#endif /* WORD64 */
-
-
-
-/*
- * FACET and VERTEX data
- */
-
-
-#define OC_FACET(_colorType, _facetAttr, _facetData, _fpConvert, _fpFormat)\
-{ \
- if (_fpConvert) \
- { \
- _PEXOCFacet (display, _colorType, _facetAttr, _facetData, _fpFormat); \
- } \
- else \
- { \
- int numWords = GetFacetDataLength ( \
- _facetAttr, GetColorLength (_colorType)); \
-\
- PEXCopyWordsToOC (display, numWords, (char *) _facetData); \
- } \
-}
-
-
-#define OC_LISTOF_FACET(_count, _facetLen, _colorType, _facetAttr, _facetData, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXOCListOfFacet (display, _count, _colorType, \
- _facetAttr, _facetData, _fpFormat); \
- } \
- else \
- { \
- PEXCopyWordsToOC (display, _count * _facetLen, \
- (char *) _facetData.index); \
- } \
-}
-
-
-#define OC_LISTOF_VERTEX(_count, _vertexLen, _colorType, _vertAttr, _vertData, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXOCListOfVertex (display, _count, _colorType, \
- _vertAttr, _vertData, _fpFormat); \
- } \
- else \
- { \
- PEXCopyWordsToOC (display, _count * _vertexLen, \
- (char *) _vertData.no_data); \
- } \
-}
-
-
-/*
- * Color data.
- */
-
-#define OC_LISTOF_COLOR(_count, _colorLen, _colorType, _colors, _fpConvert, _fpformat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXOCListOfColor (display, _count, _colorType, _colors, _fpformat); \
- } \
- else \
- { \
- PEXCopyWordsToOC (display, _count * _colorLen, \
- (char *) _colors.indexed); \
- } \
-}
-
-
-
-/*
- * Mono encoded text string
- */
-
-#ifndef WORD64
-
-#define OC_MONOENCODING(_encoding) \
- PEXCopyWordsToOC (display, LENOF (pexMonoEncoding), (char *) _encoding);
-
-#define OC_DEFAULT_MONO_STRING(_count, _string) \
-{ \
- pexMonoEncoding *pMonoEncoding; \
- char *pBuf; \
-\
- pBuf = PEXGetOCAddr (display, SIZEOF (pexMonoEncoding)); \
- pMonoEncoding = (pexMonoEncoding *) pBuf; \
- pMonoEncoding->characterSet = (INT16) 1; \
- pMonoEncoding->characterSetWidth = (CARD8) PEXCSByte; \
- pMonoEncoding->encodingState = 0; \
- pMonoEncoding->numChars = (CARD16) (_count); \
-\
- _PEXCopyPaddedBytesToOC (display, _count, _string); \
-}
-
-#else /* WORD64 */
-
-#define OC_MONOENCODING(_encoding) \
-{ \
- pexMonoEncoding tEncoding; \
- tEncoding.characterSet = (INT16) _encoding->character_set; \
- tEncoding.characterSetWidth = (CARD8) _encoding->character_set_width; \
- tEncoding.encodingState = _encoding->encoding_state; \
- tEncoding.numChars = (CARD16) _encoding->length; \
- PEXCopyWordsToOC (display, LENOF (pexMonoEncoding), (char *) &tEncoding); \
-}
-
-#define OC_DEFAULT_MONO_STRING(_count, _string) \
-{ \
- pexMonoEncoding tMonoEncoding; \
- char *pBuf; \
-\
- pBuf = PEXGetOCAddr (display, SIZEOF (pexMonoEncoding)); \
- tMonoEncoding.characterSet = (INT16) 1; \
- tMonoEncoding.characterSetWidth = (CARD8) PEXCSByte; \
- tMonoEncoding.encodingState = 0; \
- tMonoEncoding.numChars = (CARD16) (_count); \
- memcpy (pBuf, &tMonoEncoding, SIZEOF (pexMonoEncoding)); \
-\
- _PEXCopyPaddedBytesToOC (display, _count, _string); \
-}
-
-#endif /* WORD64 */
-
-
-#define OC_LISTOF_MONO_STRING(_numStrings, _stringList) \
-{ \
- PEXEncodedTextData *nextString; \
- int i; \
-\
- nextString = (_stringList); \
- for (i = 0; i < (_numStrings); i++, nextString++) \
- { \
- OC_MONOENCODING (nextString); \
- if (nextString->character_set_width == PEXCSLong) \
- _PEXCopyPaddedBytesToOC (display, \
- nextString->length * SIZEOF (long), \
- (char *) nextString->ch); \
- else if (nextString->character_set_width == PEXCSShort) \
- _PEXCopyPaddedBytesToOC (display, \
- nextString->length * SIZEOF (short), \
- (char *) nextString->ch); \
- else /* nextString->character_set_width == PEXCSByte) */ \
- _PEXCopyPaddedBytesToOC (display, \
- nextString->length, (char *) nextString->ch); \
- } \
-}
diff --git a/xc/lib/PEX5/pl_pc.c b/xc/lib/PEX5/pl_pc.c
deleted file mode 100644
index af39fa399..000000000
--- a/xc/lib/PEX5/pl_pc.c
+++ /dev/null
@@ -1,1218 +0,0 @@
-/* $TOG: pl_pc.c /main/14 1998/02/06 16:11:41 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-
-static void _PEXGeneratePCList();
-
-
-PEXPipelineContext
-PEXCreatePipelineContext (display, valueMask, values)
-
-INPUT Display *display;
-INPUT unsigned long *valueMask;
-INPUT PEXPCAttributes *values;
-
-{
- register pexCreatePipelineContextReq *req;
- char *pBuf;
- PEXPipelineContext pc;
- int size = 0;
- char *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Get a pipeline context resource id from X.
- */
-
- pc = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreatePipelineContext, pBuf);
-
- BEGIN_REQUEST_HEADER (CreatePipelineContext, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (CreatePipelineContext, fpFormat, req);
- req->pc = pc;
- req->itemMask0 = valueMask[0];
- req->itemMask1 = valueMask[1];
- req->itemMask2 = valueMask[2];
-
- if (valueMask[0] != 0 || valueMask[1] != 0 || valueMask[2] != 0)
- {
- _PEXGeneratePCList (display, fpConvert, fpFormat,
- valueMask, values, &size, &pList);
-
- req->length += NUMWORDS (size);
- }
-
- END_REQUEST_HEADER (CreatePipelineContext, pBuf, req);
-
-
- /*
- * Send the list of values.
- */
-
- if (size > 0)
- Data (display, pList, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pc);
-}
-
-
-void
-PEXFreePipelineContext (display, pc)
-
-INPUT Display *display;
-INPUT PEXPipelineContext pc;
-
-{
- register pexFreePipelineContextReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreePipelineContext, pBuf);
-
- BEGIN_REQUEST_HEADER (FreePipelineContext, pBuf, req);
-
- PEXStoreReqHead (FreePipelineContext, req);
- req->id = pc;
-
- END_REQUEST_HEADER (FreePipelineContext, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCopyPipelineContext (display, valueMask, srcPc, destPc)
-
-INPUT Display *display;
-INPUT unsigned long *valueMask;
-INPUT PEXPipelineContext srcPc;
-INPUT PEXPipelineContext destPc;
-
-{
- register pexCopyPipelineContextReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CopyPipelineContext, pBuf);
-
- BEGIN_REQUEST_HEADER (CopyPipelineContext, pBuf, req);
-
- PEXStoreReqHead (CopyPipelineContext, req);
- req->src = srcPc;
- req->dst = destPc;
- req->itemMask0 = valueMask[0];
- req->itemMask1 = valueMask[1];
- req->itemMask2 = valueMask[2];
-
- END_REQUEST_HEADER (CopyPipelineContext, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXPCAttributes *
-PEXGetPipelineContext (display, pc, valueMask)
-
-INPUT Display *display;
-INPUT PEXPipelineContext pc;
-INPUT unsigned long *valueMask;
-
-{
- register pexGetPipelineContextReq *req;
- char *pBuf, *pBufSave;
- pexGetPipelineContextReply rep;
- PEXPCAttributes *pAttr;
- Bool bitSet;
- unsigned int size;
- CARD32 count;
- int n;
- INT16 pscType;
- INT16 paramSize;
- int fpConvert;
- int fpFormat;
-
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetPipelineContext, pBuf);
-
- BEGIN_REQUEST_HEADER (GetPipelineContext, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetPipelineContext, fpFormat, req);
- req->pc = pc;
- req->itemMask0 = valueMask[0];
- req->itemMask1 = valueMask[1];
- req->itemMask2 = valueMask[2];
-
- END_REQUEST_HEADER (GetPipelineContext, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- pAttr = (PEXPCAttributes *) Xmalloc (sizeof (PEXPCAttributes));
-
- pAttr->model_clip_volume.count = 0;
- pAttr->model_clip_volume.half_spaces = NULL;
- pAttr->light_state.count = 0;
- pAttr->light_state.indices = NULL;
- pAttr->para_surf_char.type = 0;
-
-
- /*
- * Fill in the PC attributes.
- */
-
- for (n = 0; n < (PEXPCMaxShift + 1); n++)
- {
- bitSet = valueMask[n >> 5] & (1L << (n & 0x1f));
-
- if (bitSet != 0)
- {
- switch (n)
- {
- case PEXPCMarkerType:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->marker_type);
- break;
-
- case PEXPCMarkerScale:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->marker_scale,
- fpConvert, fpFormat);
- break;
-
- case PEXPCMarkerColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->marker_color,
- fpConvert, fpFormat);
- break;
-
- case PEXPCMarkerBundleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->marker_bundle_index);
- break;
-
- case PEXPCTextFont:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->text_font);
- break;
-
- case PEXPCTextPrecision:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->text_precision);
- break;
-
- case PEXPCCharExpansion:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->char_expansion,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCharSpacing:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->char_spacing,
- fpConvert, fpFormat);
- break;
-
- case PEXPCTextColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->text_color,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCharHeight:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->char_height,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCharUpVector:
-
- EXTRACT_VECTOR2D (pBuf, pAttr->char_up_vector,
- fpConvert, fpFormat);
- break;
-
- case PEXPCTextPath:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->text_path);
- break;
-
- case PEXPCTextAlignment:
-
- EXTRACT_TEXTALIGN (pBuf, pAttr->text_alignment);
- break;
-
- case PEXPCATextHeight:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->atext_height,
- fpConvert, fpFormat);
- break;
-
- case PEXPCATextUpVector:
-
- EXTRACT_VECTOR2D (pBuf, pAttr->atext_up_vector,
- fpConvert, fpFormat);
- break;
-
- case PEXPCATextPath:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->atext_path);
- break;
-
- case PEXPCATextAlignment:
-
- EXTRACT_TEXTALIGN (pBuf, pAttr->atext_alignment);
- break;
-
- case PEXPCATextStyle:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->atext_style);
- break;
-
- case PEXPCTextBundleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->text_bundle_index);
- break;
-
- case PEXPCLineType:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->line_type);
- break;
-
- case PEXPCLineWidth:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->line_width,
- fpConvert, fpFormat);
- break;
-
- case PEXPCLineColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->line_color,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCurveApprox:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->curve_approx.method);
- EXTRACT_FLOAT32 (pBuf, pAttr->curve_approx.tolerance,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPolylineInterp:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->polyline_interp);
- break;
-
- case PEXPCLineBundleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->line_bundle_index);
- break;
-
- case PEXPCInteriorStyle:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->interior_style);
- break;
-
- case PEXPCInteriorStyleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->interior_style_index);
- break;
-
- case PEXPCSurfaceColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->surface_color,
- fpConvert, fpFormat);
- break;
-
- case PEXPCReflectionAttr:
-
- EXTRACT_REFLECTION_ATTR (pBuf, pAttr->reflection_attr,
- fpConvert, fpFormat);
- break;
-
- case PEXPCReflectionModel:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->reflection_model);
- break;
-
- case PEXPCSurfaceInterp:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->surface_interp);
- break;
-
- case PEXPCBFInteriorStyle:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->bf_interior_style);
- break;
-
- case PEXPCBFInteriorStyleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->bf_interior_style_index);
- break;
-
- case PEXPCBFSurfaceColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->bf_surface_color,
- fpConvert, fpFormat);
- break;
-
- case PEXPCBFReflectionAttr:
-
- EXTRACT_REFLECTION_ATTR (pBuf, pAttr->bf_reflection_attr,
- fpConvert, fpFormat);
- break;
-
- case PEXPCBFReflectionModel:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->bf_reflection_model);
- break;
-
- case PEXPCBFSurfaceInterp:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->bf_surface_interp);
- break;
-
- case PEXPCSurfaceApprox:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->surface_approx.method);
- EXTRACT_FLOAT32 (pBuf, pAttr->surface_approx.u_tolerance,
- fpConvert, fpFormat);
- EXTRACT_FLOAT32 (pBuf, pAttr->surface_approx.v_tolerance,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCullingMode:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->culling_mode);
- break;
-
- case PEXPCDistinguishFlag:
-
- EXTRACT_LOV_CARD8 (pBuf, pAttr->distinguish);
- break;
-
- case PEXPCPatternSize:
-
- EXTRACT_COORD2D (pBuf, pAttr->pattern_size,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPatternRefPoint:
-
- EXTRACT_COORD3D (pBuf, pAttr->pattern_ref_point,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPatternRefVec1:
-
- EXTRACT_VECTOR3D (pBuf, pAttr->pattern_ref_vec1,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPatternRefVec2:
-
- EXTRACT_VECTOR3D (pBuf, pAttr->pattern_ref_vec2,
- fpConvert, fpFormat);
- break;
-
- case PEXPCInteriorBundleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->interior_bundle_index);
- break;
-
- case PEXPCSurfaceEdgeFlag:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->surface_edges);
- break;
-
- case PEXPCSurfaceEdgeType:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->surface_edge_type);
- break;
-
- case PEXPCSurfaceEdgeWidth:
-
- EXTRACT_FLOAT32 (pBuf, pAttr->surface_edge_width,
- fpConvert, fpFormat);
- break;
-
- case PEXPCSurfaceEdgeColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->surface_edge_color,
- fpConvert, fpFormat);
- break;
-
- case PEXPCEdgeBundleIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->edge_bundle_index);
- break;
-
- case PEXPCLocalTransform:
-
- EXTRACT_LISTOF_FLOAT32 (16, pBuf, pAttr->local_transform,
- fpConvert, fpFormat);
- break;
-
- case PEXPCGlobalTransform:
-
- EXTRACT_LISTOF_FLOAT32 (16, pBuf, pAttr->global_transform,
- fpConvert, fpFormat);
- break;
-
- case PEXPCModelClip:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->model_clip);
- break;
-
- case PEXPCModelClipVolume:
-
- EXTRACT_CARD32 (pBuf, count);
- pAttr->model_clip_volume.count = count;
-
- size = count * sizeof (PEXHalfSpace);
- pAttr->model_clip_volume.half_spaces =
- (PEXHalfSpace *) Xmalloc (size);
-
- EXTRACT_LISTOF_HALFSPACE3D (count, pBuf,
- pAttr->model_clip_volume.half_spaces,
- fpConvert, fpFormat);
- break;
-
- case PEXPCViewIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->view_index);
- break;
-
- case PEXPCLightState:
-
- EXTRACT_CARD32 (pBuf, count);
- pAttr->light_state.count = count;
-
- size = count * sizeof (PEXTableIndex);
- pAttr->light_state.indices =
- (PEXTableIndex *) Xmalloc (size);
-
- EXTRACT_LISTOF_CARD16 (count, pBuf,
- pAttr->light_state.indices);
- if (count & 1)
- pBuf += SIZEOF (CARD16);
- break;
-
- case PEXPCDepthCueIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->depth_cue_index);
- break;
-
- case PEXPCPickID:
-
- EXTRACT_CARD32 (pBuf, pAttr->pick_id);
- break;
-
- case PEXPCHLHSRIdentifier:
-
- EXTRACT_CARD32 (pBuf, pAttr->hlhsr_id);
- break;
-
- case PEXPCNameSet:
-
- EXTRACT_CARD32 (pBuf, pAttr->name_set);
- break;
-
- case PEXPCASFValues:
-
- EXTRACT_CARD32 (pBuf, pAttr->asf_enables);
- EXTRACT_CARD32 (pBuf, pAttr->asf_values);
- break;
-
- case PEXPCColorApproxIndex:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->color_approx_index);
- break;
-
- case PEXPCRenderingColorModel:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->rendering_color_model);
- break;
-
- case PEXPCParaSurfCharacteristics:
-
- EXTRACT_INT16 (pBuf, pscType);
- EXTRACT_INT16 (pBuf, paramSize);
-
- pAttr->para_surf_char.type = pscType;
-
- if (pscType == PEXPSCIsoCurves)
- {
- EXTRACT_PSC_ISOCURVES (pBuf,
- pAttr->para_surf_char.psc.iso_curves);
- }
- else if (pscType == PEXPSCMCLevelCurves ||
- pscType == PEXPSCWCLevelCurves)
- {
- count = (paramSize - SIZEOF (pexPSC_LevelCurves)) /
- SIZEOF (float);
-
- EXTRACT_PSC_LEVELCURVES (pBuf,
- pAttr->para_surf_char.psc.level_curves,
- fpConvert, fpFormat);
-
- pAttr->para_surf_char.psc.level_curves.parameters =
- (float *) Xmalloc ((unsigned) (count * sizeof (float)));
-
- EXTRACT_LISTOF_FLOAT32 (count, pBuf,
- pAttr->para_surf_char.psc.level_curves.parameters,
- fpConvert, fpFormat);
- }
- break;
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pAttr);
-}
-
-
-void
-PEXChangePipelineContext (display, pc, valueMask, pcAttributes)
-
-INPUT Display *display;
-INPUT PEXPipelineContext pc;
-INPUT unsigned long *valueMask;
-INPUT PEXPCAttributes *pcAttributes;
-
-{
- register pexChangePipelineContextReq *req;
- char *pBuf;
- int size = 0;
- char *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (ChangePipelineContext, pBuf);
-
- BEGIN_REQUEST_HEADER (ChangePipelineContext, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (ChangePipelineContext, fpFormat, req);
- req->pc = pc;
- req->itemMask0 = valueMask[0];
- req->itemMask1 = valueMask[1];
- req->itemMask2 = valueMask[2];
-
- if (valueMask[0] != 0 || valueMask[1] != 0 || valueMask[2] != 0)
- {
- _PEXGeneratePCList (display, fpConvert, fpFormat,
- valueMask, pcAttributes, &size, &pList);
-
- req->length += NUMWORDS (size);
- }
-
- END_REQUEST_HEADER (ChangePipelineContext, pBuf, req);
-
-
- /*
- * Send the list of values.
- */
-
- if (size > 0)
- Data (display, pList, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-
-/*
- * Routine to write a packed list of pc attributes into the transport buf.
- */
-
-static void
-_PEXGeneratePCList (display, fpConvert, fpFormat,
- valueMask, values, sizeRet, listRet)
-
-INPUT Display *display;
-INPUT int fpConvert;
-INPUT int fpFormat;
-INPUT unsigned long *valueMask;
-INPUT PEXPCAttributes *values;
-OUTPUT int *sizeRet;
-OUTPUT char **listRet;
-
-{
- register char *pBuf;
- unsigned long size;
- CARD32 count;
- Bool bitSet;
- int pscType, n;
-
-
- /*
- * size is the maximum size we might need to store the PC list. Just
- * use 2*sizeof(PEXPCAttributes) to account for padding between shorts.
- */
-
- size = 2 * sizeof (PEXPCAttributes);
-
- if (valueMask[1] &
- 1L << (PEXPCModelClipVolume - PEXPCBFInteriorStyleIndex))
- size += values->model_clip_volume.count * SIZEOF (pexHalfSpace);
-
- if (valueMask[1] & 1L << (PEXPCLightState - PEXPCBFInteriorStyleIndex))
- size += PADDED_BYTES (values->light_state.count *
- SIZEOF (pexTableIndex));
-
- *listRet = pBuf = (char *) _XAllocScratch (display, size);
-
- for (n = 0; n < (PEXPCMaxShift + 1); n++)
- {
- bitSet = valueMask[n >> 5] & (1L << (n & 0x1f));
- if (bitSet != 0)
- {
- switch (n)
- {
- case PEXPCMarkerType:
-
- STORE_CARD32 (values->marker_type, pBuf);
- break;
-
- case PEXPCMarkerScale:
-
- STORE_FLOAT32 (values->marker_scale, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCMarkerColor:
-
- STORE_COLOR_SPEC (values->marker_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCMarkerBundleIndex:
-
- STORE_CARD32 (values->marker_bundle_index, pBuf);
- break;
-
- case PEXPCTextFont:
-
- STORE_CARD32 (values->text_font, pBuf);
- break;
-
- case PEXPCTextPrecision:
-
- STORE_CARD32 (values->text_precision, pBuf);
- break;
-
- case PEXPCCharExpansion:
-
- STORE_FLOAT32 (values->char_expansion, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCharSpacing:
-
- STORE_FLOAT32 (values->char_spacing, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCTextColor:
-
- STORE_COLOR_SPEC (values->text_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCharHeight:
-
- STORE_FLOAT32 (values->char_height, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCharUpVector:
-
- STORE_VECTOR2D (values->char_up_vector, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCTextPath:
-
- STORE_CARD32 (values->text_path, pBuf);
- break;
-
- case PEXPCTextAlignment:
-
- STORE_TEXTALIGN (values->text_alignment, pBuf);
- break;
-
- case PEXPCATextHeight:
-
- STORE_FLOAT32 (values->atext_height, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCATextUpVector:
-
- STORE_VECTOR2D (values->atext_up_vector, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCATextPath:
-
- STORE_CARD32 (values->atext_path, pBuf);
- break;
-
- case PEXPCATextAlignment:
-
- STORE_TEXTALIGN (values->atext_alignment, pBuf);
- break;
-
- case PEXPCATextStyle:
-
- STORE_CARD32 (values->atext_style, pBuf);
- break;
-
- case PEXPCTextBundleIndex:
-
- STORE_CARD32 (values->text_bundle_index, pBuf);
- break;
-
- case PEXPCLineType:
-
- STORE_CARD32 (values->line_type, pBuf);
- break;
-
- case PEXPCLineWidth:
-
- STORE_FLOAT32 (values->line_width, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCLineColor:
-
- STORE_COLOR_SPEC (values->line_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCurveApprox:
-
- STORE_CARD32 (values->curve_approx.method, pBuf);
- STORE_FLOAT32 (values->curve_approx.tolerance, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPolylineInterp:
-
- STORE_CARD32 (values->polyline_interp, pBuf);
- break;
-
- case PEXPCLineBundleIndex:
-
- STORE_CARD32 (values->line_bundle_index, pBuf);
- break;
-
- case PEXPCInteriorStyle:
-
- STORE_CARD32 (values->interior_style, pBuf);
- break;
-
- case PEXPCInteriorStyleIndex:
-
- STORE_CARD32 (values->interior_style_index, pBuf);
- break;
-
- case PEXPCSurfaceColor:
-
- STORE_COLOR_SPEC (values->surface_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCReflectionAttr:
-
- STORE_REFLECTION_ATTR (values->reflection_attr, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCReflectionModel:
-
- STORE_CARD32 (values->reflection_model, pBuf);
- break;
-
- case PEXPCSurfaceInterp:
-
- STORE_CARD32 (values->surface_interp, pBuf);
- break;
-
- case PEXPCBFInteriorStyle:
-
- STORE_CARD32 (values->bf_interior_style, pBuf);
- break;
-
- case PEXPCBFInteriorStyleIndex:
-
- STORE_CARD32 (values->bf_interior_style_index, pBuf);
- break;
-
- case PEXPCBFSurfaceColor:
-
- STORE_COLOR_SPEC (values->bf_surface_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCBFReflectionAttr:
-
- STORE_REFLECTION_ATTR (values->bf_reflection_attr, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCBFReflectionModel:
-
- STORE_CARD32 (values->bf_reflection_model, pBuf);
- break;
-
- case PEXPCBFSurfaceInterp:
-
- STORE_CARD32 (values->bf_surface_interp, pBuf);
- break;
-
- case PEXPCSurfaceApprox:
-
- STORE_CARD32 (values->surface_approx.method, pBuf);
- STORE_FLOAT32 (values->surface_approx.u_tolerance, pBuf,
- fpConvert, fpFormat);
- STORE_FLOAT32 (values->surface_approx.v_tolerance, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCCullingMode:
-
- STORE_CARD32 (values->culling_mode, pBuf);
- break;
-
- case PEXPCDistinguishFlag:
-
- STORE_CARD32 (values->distinguish, pBuf);
- break;
-
- case PEXPCPatternSize:
-
- STORE_COORD2D (values->pattern_size, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPatternRefPoint:
-
- STORE_COORD3D (values->pattern_ref_point, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPatternRefVec1:
-
- STORE_VECTOR3D (values->pattern_ref_vec1, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCPatternRefVec2:
-
- STORE_VECTOR3D (values->pattern_ref_vec2, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCInteriorBundleIndex:
-
- STORE_CARD32 (values->interior_bundle_index, pBuf);
- break;
-
- case PEXPCSurfaceEdgeFlag:
-
- STORE_CARD32 (values->surface_edges, pBuf);
- break;
-
- case PEXPCSurfaceEdgeType:
-
- STORE_CARD32 (values->surface_edge_type, pBuf);
- break;
-
- case PEXPCSurfaceEdgeWidth:
-
- STORE_FLOAT32 (values->surface_edge_width, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCSurfaceEdgeColor:
-
- STORE_COLOR_SPEC (values->surface_edge_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCEdgeBundleIndex:
-
- STORE_CARD32 (values->edge_bundle_index, pBuf);
- break;
-
- case PEXPCLocalTransform:
-
- STORE_LISTOF_FLOAT32 (16, values->local_transform, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCGlobalTransform:
-
- STORE_LISTOF_FLOAT32 (16, values->global_transform, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCModelClip:
-
- STORE_CARD32 (values->model_clip, pBuf);
- break;
-
- case PEXPCModelClipVolume:
-
- count = values->model_clip_volume.count;
- STORE_CARD32 (count, pBuf);
- STORE_LISTOF_HALFSPACE3D (count,
- values->model_clip_volume.half_spaces, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPCViewIndex:
-
- STORE_CARD32 (values->view_index, pBuf);
- break;
-
- case PEXPCLightState:
-
- count = values->light_state.count;
- STORE_CARD32 (count, pBuf);
- STORE_LISTOF_CARD16 (count, values->light_state.indices, pBuf);
- if (count & 1)
- pBuf += SIZEOF (CARD16);
- break;
-
- case PEXPCDepthCueIndex:
-
- STORE_CARD32 (values->depth_cue_index, pBuf);
- break;
-
- case PEXPCPickID:
-
- STORE_CARD32 (values->pick_id, pBuf);
- break;
-
- case PEXPCHLHSRIdentifier:
-
- STORE_CARD32 (values->hlhsr_id, pBuf);
- break;
-
- case PEXPCNameSet:
-
- STORE_CARD32 (values->name_set, pBuf);
- break;
-
- case PEXPCASFValues:
-
- STORE_CARD32 (values->asf_enables, pBuf);
- STORE_CARD32 (values->asf_values, pBuf);
- break;
-
- case PEXPCColorApproxIndex:
-
- STORE_CARD32 (values->color_approx_index, pBuf);
- break;
-
- case PEXPCRenderingColorModel:
-
- STORE_CARD32 (values->rendering_color_model, pBuf);
- break;
-
- case PEXPCParaSurfCharacteristics:
-
- pscType = values->para_surf_char.type;
- if (pscType == PEXPSCIsoCurves)
- {
- size = SIZEOF (pexPSC_IsoparametricCurves);
-
- STORE_INT16 (PEXPSCIsoCurves, pBuf);
- STORE_INT16 (size, pBuf);
- STORE_PSC_ISOCURVES (
- values->para_surf_char.psc.iso_curves, pBuf);
- }
- else if (pscType == PEXPSCMCLevelCurves ||
- pscType == PEXPSCWCLevelCurves)
- {
- size = SIZEOF (pexPSC_LevelCurves) + (SIZEOF (float) *
- values->para_surf_char.psc.level_curves.count);
-
- STORE_INT16 (pscType, pBuf);
- STORE_INT16 (size, pBuf);
- STORE_PSC_LEVELCURVES (
- values->para_surf_char.psc.level_curves, pBuf,
- fpConvert, fpFormat);
- STORE_LISTOF_FLOAT32 (
- values->para_surf_char.psc.level_curves.count,
- values->para_surf_char.psc.level_curves.parameters,
- pBuf, fpConvert, fpFormat);
- }
- break;
- }
- }
- }
-
- *sizeRet = pBuf - *listRet;
-}
diff --git a/xc/lib/PEX5/pl_pick.c b/xc/lib/PEX5/pl_pick.c
deleted file mode 100644
index b827a49d5..000000000
--- a/xc/lib/PEX5/pl_pick.c
+++ /dev/null
@@ -1,1213 +0,0 @@
-/* $TOG: pl_pick.c /main/14 1998/02/06 16:11:48 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.
-
-*/
-
-/******************************************************************************
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1992 by ShoGraphics, Inc., Mountain View, California
-
- All Rights Reserved
-
-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 Digital or ShowGraphics not be used in advertising or
-publicity pertaining to distribution of the software without specific, written
-prior permission. Digital and ShowGraphics make no representations
-about the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-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.
-
-SHOGRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SHOGRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-*************************************************************************/
-
-/*
- * NEED EVENTS needs to be defined when including Xproto.h so xEvent
- * can be sucked in.
- */
-
-#define NEED_EVENTS
-
-#include "PEXlib.h"
-#include "PEXlibint.h"
-
-#define GetPickRecordSize(_pickType) \
- (_pickType == PEXPickDeviceNPCHitVolume ? SIZEOF (pexPD_NPC_HitVolume) : \
- (_pickType == PEXPickDeviceDCHitBox ? SIZEOF (pexPD_DC_HitBox) : 0))
-
-
-
-PEXPickMeasure
-PEXCreatePickMeasure (display, wks, devType)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT int devType;
-
-{
- register pexCreatePickMeasureReq *req;
- char *pBuf;
- PEXPickMeasure pm;
-
-
- /*
- * Get a Pick Measure resource id from X.
- */
-
- pm = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreatePickMeasure, pBuf);
-
- BEGIN_REQUEST_HEADER (CreatePickMeasure, pBuf, req);
-
- PEXStoreReqHead (CreatePickMeasure, req);
- req->wks = wks;
- req->pm = pm;
- req->devType = devType;
-
- END_REQUEST_HEADER (CreatePickMeasure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pm);
-}
-
-
-void
-PEXFreePickMeasure (display, pm)
-
-INPUT Display *display;
-INPUT PEXPickMeasure pm;
-
-{
- register pexFreePickMeasureReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreePickMeasure, pBuf);
-
- BEGIN_REQUEST_HEADER (FreePickMeasure, pBuf, req);
-
- PEXStoreReqHead (FreePickMeasure, req);
- req->id = pm;
-
- END_REQUEST_HEADER (FreePickMeasure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXPMAttributes *
-PEXGetPickMeasure (display, pm, valueMask)
-
-INPUT Display *display;
-INPUT PEXPickMeasure pm;
-INPUT unsigned long valueMask;
-
-{
- register pexGetPickMeasureReq *req;
- char *pBuf, *pBufSave;
- pexGetPickMeasureReply rep;
- PEXPMAttributes *ppmi;
- unsigned long f;
- int i;
- unsigned count;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetPickMeasure, pBuf);
-
- BEGIN_REQUEST_HEADER (GetPickMeasure, pBuf, req);
-
- PEXStoreReqHead (GetPickMeasure, req);
- req->pm = pm;
- req->itemMask = valueMask;
-
- END_REQUEST_HEADER (GetPickMeasure, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- ppmi = (PEXPMAttributes *) Xmalloc (sizeof (PEXPMAttributes));
-
- ppmi->pick_path.count = 0;
- ppmi->pick_path.elements = NULL;
-
- for (i = 0; i < (PEXPMMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXPMStatus:
-
- EXTRACT_LOV_CARD16 (pBuf, ppmi->status);
- break;
-
- case PEXPMPath:
-
- EXTRACT_CARD32 (pBuf, count);
- ppmi->pick_path.count = count;
-
- ppmi->pick_path.elements = (PEXPickElementRef *)
- Xmalloc (count * sizeof (PEXPickElementRef));
-
- EXTRACT_LISTOF_PICKELEMREF (count,
- pBuf, ppmi->pick_path.elements);
- break;
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (ppmi);
-}
-
-
-void
-PEXUpdatePickMeasure (display, pick_measure, pick_device_type, pick_record)
-
-INPUT Display *display;
-INPUT PEXPickMeasure pick_measure;
-INPUT int pick_device_type;
-INPUT PEXPickRecord *pick_record;
-
-{
- register pexUpdatePickMeasureReq *req;
- char *pBuf;
- int numBytes;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- numBytes = GetPickRecordSize (pick_device_type);
-
- PEXGetReqExtra (UpdatePickMeasure, numBytes, pBuf);
-
- BEGIN_REQUEST_HEADER (UpdatePickMeasure, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreReqHead (UpdatePickMeasure, req);
- req->pm = pick_measure;
- req->numBytes = numBytes;
-
- END_REQUEST_HEADER (UpdatePickMeasure, pBuf, req);
-
- STORE_PICK_RECORD (pick_device_type, numBytes, pick_record, pBuf,
- fpConvert, fpFormat);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXPDAttributes *
-PEXGetPickDevice (display, wks, devType, valueMask)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT int devType;
-INPUT unsigned long valueMask;
-
-{
- register pexGetPickDeviceReq *req;
- char *pBuf, *pBufSave;
- pexGetPickDeviceReply rep;
- PEXPDAttributes *ppdi;
- unsigned long f;
- int i;
- unsigned count;
- int size;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetPickDevice, pBuf);
-
- BEGIN_REQUEST_HEADER (GetPickDevice, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetPickDevice, fpFormat, req);
- req->wks = wks;
- req->itemMask = valueMask;
- req->devType = devType;
-
- END_REQUEST_HEADER (GetPickDevice, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- ppdi = (PEXPDAttributes *) Xmalloc (sizeof (PEXPDAttributes));
-
- ppdi->path.count = 0;
- ppdi->path.elements = NULL;
-
- for (i = 0; i < (PEXPDMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXPDPickStatus:
-
- EXTRACT_LOV_CARD16 (pBuf, ppdi->status);
- break;
-
- case PEXPDPickPath:
-
- EXTRACT_CARD32 (pBuf, count);
- ppdi->path.count = count;
-
- ppdi->path.elements = (PEXPickElementRef *)
- Xmalloc (count * sizeof (PEXPickElementRef));
-
- EXTRACT_LISTOF_PICKELEMREF (count, pBuf, ppdi->path.elements);
- break;
-
- case PEXPDPickPathOrder:
-
- EXTRACT_LOV_CARD16 (pBuf, ppdi->path_order);
- break;
-
- case PEXPDPickIncl:
-
- EXTRACT_CARD32 (pBuf, ppdi->inclusion);
- break;
-
- case PEXPDPickExcl:
-
- EXTRACT_CARD32 (pBuf, ppdi->exclusion);
- break;
-
- case PEXPDPickDataRec:
-
- EXTRACT_CARD32 (pBuf, size);
- EXTRACT_PICK_RECORD (pBuf, devType, size, ppdi->pick_record,
- fpConvert, fpFormat);
- break;
-
- case PEXPDPromptEchoType:
-
- EXTRACT_LOV_INT16 (pBuf, ppdi->prompt_echo_type);
- break;
-
- case PEXPDEchoVolume:
-
- EXTRACT_VIEWPORT (pBuf, ppdi->echo_volume,
- fpConvert, fpFormat);
- break;
-
- case PEXPDEchoSwitch:
-
- EXTRACT_LOV_CARD16 (pBuf, ppdi->echo_switch);
- break;
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (ppdi);
-}
-
-
-void
-PEXChangePickDevice (display, wks, devType, valueMask, values)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT int devType;
-INPUT unsigned long valueMask;
-INPUT PEXPDAttributes *values;
-
-{
- register pexChangePickDeviceReq *req;
- char *pBuf;
- char *pSend;
- unsigned long f;
- unsigned long size;
- PEXPickRecord *pick_record;
- int i;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (ChangePickDevice, pBuf);
-
- BEGIN_REQUEST_HEADER (ChangePickDevice, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (ChangePickDevice, fpFormat, req);
- req->wks = wks;
- req->itemMask = valueMask;
- req->devType = devType;
-
-
- /*
- * Allocate a scratch buffer used to pack the attributes. It's not
- * worth computing the exact amount of memory needed, so assume the
- * worse case.
- */
-
- size = 8 * SIZEOF (CARD32) +
- (SIZEOF (pexPickElementRef) * ((valueMask & PEXPDPickPath) ?
- values->path.count : 0)) +
- sizeof (PEXPickRecord) +
- SIZEOF (pexViewport);
-
- pBuf = pSend = (char *) _XAllocScratch (display, size);
-
- for (i = 0; i < (PEXPDMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXPDPickStatus:
-
- STORE_CARD32 (values->status, pBuf);
- break;
-
- case PEXPDPickPath:
-
- STORE_CARD32 (values->path.count, pBuf);
- STORE_LISTOF_PICKELEMREF (values->path.count,
- values->path.elements, pBuf);
- break;
-
- case PEXPDPickPathOrder:
-
- STORE_CARD32 (values->path_order, pBuf);
- break;
-
- case PEXPDPickIncl:
-
- STORE_CARD32 (values->inclusion, pBuf);
- break;
-
- case PEXPDPickExcl:
-
- STORE_CARD32 (values->exclusion, pBuf);
- break;
-
- case PEXPDPickDataRec:
-
- size = GetPickRecordSize (devType);
- STORE_CARD32 (size, pBuf);
-
- pick_record = (PEXPickRecord *) &(values->pick_record);
- STORE_PICK_RECORD (devType, size, pick_record, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPDPromptEchoType:
-
- STORE_CARD32 (values->prompt_echo_type, pBuf);
- break;
-
- case PEXPDEchoVolume:
-
- STORE_VIEWPORT (values->echo_volume, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXPDEchoSwitch:
-
- STORE_CARD32 (values->echo_switch, pBuf);
- break;
- }
- }
- }
-
- size = pBuf - pSend;
- req->length += NUMWORDS (size);
-
- END_REQUEST_HEADER (ChangePickDevice, pBuf, req);
-
- if (size > 0)
- Data (display, pSend, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-
-
-/*
- * Routine to convert a protocol-format event (wire) to a client event
- * structure (client) for a PEXMaxHitsReachedEvent. XESetWireToEvent is
- * called in PEXInitialize to set this up with Xlib.
- */
-
-Status
-_PEXConvertMaxHitsEvent (display, client, wire)
-
-INPUT Display *display;
-INPUT XEvent *client;
-INPUT xEvent *wire;
-
-{
- pexMaxHitsReachedEvent *wireevent;
- PEXMaxHitsReachedEvent *clientevent;
-
-
- /*
- * Set up the pointers.
- */
-
- wireevent = (pexMaxHitsReachedEvent *) wire;
- clientevent = (PEXMaxHitsReachedEvent *) client;
-
-
- /*
- * Now fill in the client structure.
- */
-
- clientevent->type = wireevent->type & 0x7f;
- clientevent->serial = wireevent->sequenceNumber;
- clientevent->send_event = (wireevent->type & 0x80) != 0;
-
-
- /*
- * MSB set if event came from SendEvent request.
- */
-
- clientevent->display = display;
- clientevent->renderer = wireevent->rdr;
-
-
- /*
- * Tell Xlib to add this to the event queue.
- */
-
- return (True);
-}
-
-
-void
-PEXBeginPickOne (display, drawable, renderer, structure_id,
- method, pick_device_type, pick_record)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXRenderer renderer;
-INPUT long structure_id;
-INPUT int method;
-INPUT int pick_device_type;
-INPUT PEXPickRecord *pick_record;
-{
- register pexBeginPickOneReq *req;
- char *pBuf;
- unsigned int rec_size;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- rec_size = GetPickRecordSize (pick_device_type);
-
- PEXGetReqExtra (BeginPickOne, (4 + rec_size), pBuf);
-
- BEGIN_REQUEST_HEADER (BeginPickOne, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (BeginPickOne, fpFormat, (4 + rec_size), req);
-
- req->method = method;
- req->rdr = renderer;
- req->drawable = drawable;
- req->sid = structure_id;
-
- END_REQUEST_HEADER (BeginPickOne, pBuf, req);
-
- STORE_INT16 (pick_device_type, pBuf);
- pBuf += 2; /* pad */
-
- STORE_PICK_RECORD (pick_device_type, rec_size,
- pick_record, pBuf, fpConvert, fpFormat);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXPickPath *
-PEXEndPickOne (display, renderer, status_return, undetectable_return)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-OUTPUT int *status_return;
-OUTPUT int *undetectable_return;
-
-{
- register pexEndPickOneReq *req;
- char *pBuf;
- pexEndPickOneReply rep;
- PEXPickPath *pathRet;
- unsigned int size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (EndPickOne, pBuf);
-
- BEGIN_REQUEST_HEADER (EndPickOne, pBuf, req);
-
- PEXStoreReqHead (EndPickOne, req);
- req->rdr = renderer;
-
- END_REQUEST_HEADER (EndPickOne, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
- *status_return = rep.pickStatus;
- *undetectable_return = rep.betterPick;
-
-
- /*
- * Allocate a buffer for the path to pass back to the client.
- * If possible, use the pick path cache.
- */
-
- size = sizeof (PEXPickPath) +
- rep.numPickElRefs * sizeof (PEXPickElementRef);
-
- if (!PEXPickCacheInUse && size <= PEXPickCacheSize)
- {
- pathRet = PEXPickCache;
- PEXPickCacheInUse = 1;
- }
- else
- pathRet = (PEXPickPath *) Xmalloc (size);
-
- pathRet->elements = (PEXPickElementRef *) (pathRet + 1);
- pathRet->count = rep.numPickElRefs;
-
- XREAD_LISTOF_PICKELEMREF (display, rep.numPickElRefs, pathRet->elements);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pathRet);
-}
-
-
-PEXPickPath *
-PEXPickOne (display, drawable, renderer, structure, method,
- pick_device_type, pick_record, status_return, undetectable_return)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXRenderer renderer;
-INPUT PEXStructure structure;
-INPUT int method;
-INPUT int pick_device_type;
-INPUT PEXPickRecord *pick_record;
-OUTPUT int *status_return;
-OUTPUT int *undetectable_return;
-
-{
- register pexPickOneReq *req;
- char *pBuf;
- pexPickOneReply rep;
- unsigned int rec_size;
- unsigned int size;
- int fpConvert;
- int fpFormat;
- PEXPickPath *pathRet;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- rec_size = GetPickRecordSize (pick_device_type);
-
- PEXGetReqExtra (PickOne, (4 + rec_size), pBuf);
-
- BEGIN_REQUEST_HEADER (PickOne, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (PickOne, fpFormat, (4 + rec_size), req);
-
- req->method = method;
- req->rdr = renderer;
- req->drawable = drawable;
- req->sid = structure;
-
- END_REQUEST_HEADER (PickOne, pBuf, req);
-
- STORE_INT16 (pick_device_type, pBuf);
- pBuf += 2; /* pad */
-
- STORE_PICK_RECORD (pick_device_type, rec_size,
- pick_record, pBuf, fpConvert, fpFormat);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
- *status_return = rep.pickStatus;
- *undetectable_return = rep.betterPick;
-
-
- /*
- * Allocate a buffer for the path to pass back to the client.
- * If possible, use the pick path cache.
- */
-
- size = sizeof (PEXPickPath) +
- rep.numPickElRefs * sizeof (PEXPickElementRef);
-
- if (!PEXPickCacheInUse && size <= PEXPickCacheSize)
- {
- pathRet = PEXPickCache;
- PEXPickCacheInUse = 1;
- }
- else
- pathRet = (PEXPickPath *) Xmalloc (size);
-
- pathRet->elements = (PEXPickElementRef *) (pathRet + 1);
- pathRet->count = rep.numPickElRefs;
-
- XREAD_LISTOF_PICKELEMREF (display, rep.numPickElRefs, pathRet->elements);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pathRet);
-}
-
-
-void
-PEXBeginPickAll (display, drawable, renderer, structure_id, method,
- send_event, max_hits, pick_device_type, pick_record)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXRenderer renderer;
-INPUT long structure_id;
-INPUT int method;
-INPUT int send_event;
-INPUT int max_hits;
-INPUT int pick_device_type;
-INPUT PEXPickRecord *pick_record;
-{
- register pexBeginPickAllReq *req;
- char *pBuf;
- unsigned int rec_size;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- rec_size = GetPickRecordSize (pick_device_type);
-
- PEXGetReqExtra (BeginPickAll, (4 + rec_size), pBuf);
-
- BEGIN_REQUEST_HEADER (BeginPickAll, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (BeginPickAll, fpFormat, (4 + rec_size), req);
-
- req->method = method;
- req->rdr = renderer;
- req->drawable = drawable;
- req->sid = structure_id;
- req->sendEvent = send_event;
- req->pickMaxHits = max_hits;
-
- END_REQUEST_HEADER (BeginPickAll, pBuf, req);
-
- STORE_INT16 (pick_device_type, pBuf);
- pBuf += 2; /* pad */
-
- STORE_PICK_RECORD (pick_device_type, rec_size,
- pick_record, pBuf, fpConvert, fpFormat);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXPickPath *
-PEXEndPickAll (display, renderer, status_return, more_return, count_return)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-OUTPUT int *status_return;
-OUTPUT int *more_return;
-OUTPUT unsigned long *count_return;
-
-{
- register pexEndPickAllReq *req;
- char *pBuf, *pBufSave;
- pexEndPickAllReply rep;
- PEXPickPath *pPath;
- PEXPickPath *pPathRet;
- PEXPickElementRef *pElemRef;
- int numElements, i;
- unsigned int total_size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (EndPickAll, pBuf);
-
- BEGIN_REQUEST_HEADER (EndPickAll, pBuf, req);
-
- PEXStoreReqHead (EndPickAll, req);
- req->rdr = renderer;
-
- END_REQUEST_HEADER (EndPickAll, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *count_return = 0;
- return (NULL); /* return an error */
- }
-
- *status_return = rep.pickStatus;
- *more_return = rep.morePicks;
- *count_return = rep.numPicked;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- * If possible, use the pick path cache.
- */
-
- total_size = rep.numPicked * sizeof (PEXPickPath);
-
- for (i = 0; i < rep.numPicked; i++)
- {
- EXTRACT_CARD32 (pBuf, numElements);
- total_size += (numElements * sizeof (PEXPickElementRef));
- pBuf += (numElements * SIZEOF (pexPickElementRef));
- }
-
- if (!PEXPickCacheInUse && total_size <= PEXPickCacheSize)
- {
- pPathRet = PEXPickCache;
- PEXPickCacheInUse = 1;
- }
- else
- pPathRet = (PEXPickPath *) Xmalloc (total_size);
-
- pPath = pPathRet;
- pBuf = pBufSave;
- pElemRef = (PEXPickElementRef *) ((char *) pPath +
- rep.numPicked * sizeof (PEXPickPath));
-
- for (i = 0; i < rep.numPicked; i++)
- {
- EXTRACT_CARD32 (pBuf, numElements);
- EXTRACT_LISTOF_PICKELEMREF (numElements, pBuf, pElemRef);
-
- pPath->count = numElements;
- pPath->elements = pElemRef;
- pPath++;
- pElemRef += numElements;
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pPathRet);
-}
-
-
-PEXPickPath *
-PEXPickAll (display, drawable, renderer, method, max_hits, pick_device_type,
- pick_record, status_return, more_return, count_return)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXRenderer renderer;
-INPUT int method;
-INPUT int max_hits;
-INPUT int pick_device_type;
-INPUT PEXPickRecord *pick_record;
-OUTPUT int *status_return;
-OUTPUT int *more_return;
-OUTPUT unsigned long *count_return;
-
-
-{
- register pexPickAllReq *req;
- char *pBuf, *pBufSave;
- pexPickAllReply rep;
- PEXPickPath *pPath;
- PEXPickPath *pPathRet;
- PEXPickElementRef *pElemRef;
- int numElements, i;
- unsigned int rec_size;
- unsigned int total_size;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- rec_size = GetPickRecordSize (pick_device_type);
-
- PEXGetReqExtra (PickAll, (4 + rec_size), pBuf);
-
- BEGIN_REQUEST_HEADER (PickAll, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (PickAll, fpFormat, (4 + rec_size), req);
-
- req->method = method;
- req->rdr = renderer;
- req->drawable = drawable;
- req->pickMaxHits = max_hits;
-
- END_REQUEST_HEADER (PickAll, pBuf, req);
-
- STORE_INT16 (pick_device_type, pBuf);
- pBuf += 2; /* pad */
-
- STORE_PICK_RECORD (pick_device_type, rec_size,
- pick_record, pBuf, fpConvert, fpFormat);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *count_return = 0;
- return (NULL); /* return an error */
- }
-
- *status_return = rep.pickStatus;
- *more_return = rep.morePicks;
- *count_return = rep.numPicked;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- * If possible, use the pick path cache.
- */
-
- total_size = rep.numPicked * sizeof (PEXPickPath);
-
- for (i = 0; i < rep.numPicked; i++)
- {
- EXTRACT_CARD32 (pBuf, numElements);
- total_size += (numElements * sizeof (PEXPickElementRef));
- pBuf += (numElements * SIZEOF (pexPickElementRef));
- }
-
- if (!PEXPickCacheInUse && total_size <= PEXPickCacheSize)
- {
- pPathRet = PEXPickCache;
- PEXPickCacheInUse = 1;
- }
- else
- pPathRet = (PEXPickPath *) Xmalloc (total_size);
-
- pPath = pPathRet;
- pBuf = pBufSave;
- pElemRef = (PEXPickElementRef *) ((char *) pPath +
- rep.numPicked * sizeof (PEXPickPath));
-
- for (i = 0; i < rep.numPicked; i++)
- {
- EXTRACT_CARD32 (pBuf, numElements);
- EXTRACT_LISTOF_PICKELEMREF (numElements, pBuf, pElemRef);
-
- pPath->count = numElements;
- pPath->elements = pElemRef;
- pPath++;
- pElemRef += numElements;
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pPathRet);
-}
diff --git a/xc/lib/PEX5/pl_rdr.c b/xc/lib/PEX5/pl_rdr.c
deleted file mode 100644
index 765f10c35..000000000
--- a/xc/lib/PEX5/pl_rdr.c
+++ /dev/null
@@ -1,1114 +0,0 @@
-/* $TOG: pl_rdr.c /main/12 1998/02/06 16:11:55 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-
-static void _PEXGenerateRendererList();
-
-
-PEXRenderer
-PEXCreateRenderer (display, drawable, valueMask, values)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT unsigned long valueMask;
-INPUT PEXRendererAttributes *values;
-
-{
- register pexCreateRendererReq *req;
- char *pBuf;
- PEXRenderer rdr;
- int size = 0;
- char *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Get a renderer resource id from X.
- */
-
- rdr = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer. For the value mask,
- * turn off the Current Path and Renderer State bits, since these
- * attributes are not modifiable.
- */
-
- valueMask &= ~(PEXRACurrentPath | PEXRARendererState);
-
- PEXGetReq (CreateRenderer, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateRenderer, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (CreateRenderer, fpFormat, req);
- req->drawable = drawable;
- req->rdr = rdr;
- req->itemMask = valueMask;
-
- if (valueMask != 0)
- {
- _PEXGenerateRendererList (display, fpConvert, fpFormat,
- valueMask, values, &size, &pList);
-
- req->length += NUMWORDS (size);
- }
-
- END_REQUEST_HEADER (CreateRenderer, pBuf, req);
-
-
- /*
- * Send the list of values.
- */
-
- if (size > 0)
- Data (display, pList, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (rdr);
-}
-
-
-void
-PEXFreeRenderer (display, renderer)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-
-{
- register pexFreeRendererReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreeRenderer, pBuf);
-
- BEGIN_REQUEST_HEADER (FreeRenderer, pBuf, req);
-
- PEXStoreReqHead (FreeRenderer, req);
- req->id = renderer;
-
- END_REQUEST_HEADER (FreeRenderer, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXRendererAttributes *
-PEXGetRendererAttributes (display, renderer, valueMask)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT unsigned long valueMask;
-
-{
- register pexGetRendererAttributesReq *req;
- register PEXRendererAttributes *pAttr;
- register char *pBuf, *pBufSave;
- pexGetRendererAttributesReply rep;
- unsigned long f;
- int i;
- unsigned count;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetRendererAttributes, pBuf);
-
- BEGIN_REQUEST_HEADER (GetRendererAttributes, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetRendererAttributes, fpFormat, req);
- req->rdr = renderer;
- req->itemMask = valueMask;
-
- END_REQUEST_HEADER (GetRendererAttributes, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- pAttr = (PEXRendererAttributes *)
- Xmalloc (sizeof (PEXRendererAttributes));
-
- pAttr->current_path.count = 0;
- pAttr->current_path.elements = NULL;
- pAttr->clip_list.count = 0;
- pAttr->clip_list.rectangles = NULL;
- pAttr->pick_start_path.count = 0;
- pAttr->pick_start_path.elements = NULL;
-
- for (i = 0; i < (PEXRAMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXRACurrentPath:
-
- EXTRACT_CARD32 (pBuf, count);
- pAttr->current_path.count = count;
-
- pAttr->current_path.elements = (PEXElementRef *)
- Xmalloc (count * sizeof (PEXElementRef));
-
- EXTRACT_LISTOF_ELEMREF (count,
- pBuf, pAttr->current_path.elements);
- break;
-
- case PEXRAPipelineContext:
-
- EXTRACT_CARD32 (pBuf, pAttr->pipeline_context);
- break;
-
- case PEXRAMarkerBundle:
-
- EXTRACT_CARD32 (pBuf, pAttr->marker_bundle);
- break;
-
- case PEXRATextBundle:
-
- EXTRACT_CARD32 (pBuf, pAttr->text_bundle);
- break;
-
- case PEXRALineBundle:
-
- EXTRACT_CARD32 (pBuf, pAttr->line_bundle);
- break;
-
- case PEXRAInteriorBundle:
-
- EXTRACT_CARD32 (pBuf, pAttr->interior_bundle);
- break;
-
- case PEXRAEdgeBundle:
-
- EXTRACT_CARD32 (pBuf, pAttr->edge_bundle);
- break;
-
- case PEXRAViewTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->view_table);
- break;
-
- case PEXRAColorTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->color_table);
- break;
-
- case PEXRADepthCueTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->depth_cue_table);
- break;
-
- case PEXRALightTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->light_table);
- break;
-
- case PEXRAColorApproxTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->color_approx_table);
- break;
-
- case PEXRAPatternTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->pattern_table);
- break;
-
- case PEXRATextFontTable:
-
- EXTRACT_CARD32 (pBuf, pAttr->text_font_table);
- break;
-
- case PEXRAHighlightIncl:
-
- EXTRACT_CARD32 (pBuf, pAttr->highlight_incl);
- break;
-
- case PEXRAHighlightExcl:
-
- EXTRACT_CARD32 (pBuf, pAttr->highlight_excl);
- break;
-
- case PEXRAInvisibilityIncl:
-
- EXTRACT_CARD32 (pBuf, pAttr->invisibility_incl);
- break;
-
- case PEXRAInvisibilityExcl:
-
- EXTRACT_CARD32 (pBuf, pAttr->invisibility_excl);
- break;
-
- case PEXRARendererState:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->renderer_state);
- break;
-
- case PEXRAHLHSRMode:
-
- EXTRACT_LOV_INT16 (pBuf, pAttr->hlhsr_mode);
- break;
-
- case PEXRANPCSubVolume:
-
- EXTRACT_NPC_SUBVOLUME (pBuf, pAttr->npc_subvolume,
- fpConvert, fpFormat);
- break;
-
- case PEXRAViewport:
-
- EXTRACT_VIEWPORT (pBuf, pAttr->viewport, fpConvert, fpFormat);
- break;
-
- case PEXRAClipList:
-
- EXTRACT_CARD32 (pBuf, count);
- pAttr->clip_list.count = count;
-
- pAttr->clip_list.rectangles = (PEXDeviceRect *)
- Xmalloc (count * sizeof (PEXDeviceRect));
-
- EXTRACT_LISTOF_DEVRECT (count,
- pBuf, pAttr->clip_list.rectangles);
- break;
-
- case PEXRAPickIncl:
-
- EXTRACT_CARD32 (pBuf, pAttr->pick_incl);
- break;
-
- case PEXRAPickExcl:
-
- EXTRACT_CARD32 (pBuf, pAttr->pick_excl);
- break;
-
- case PEXRAPickStartPath:
-
- EXTRACT_CARD32 (pBuf, count);
- pAttr->pick_start_path.count = count;
-
- pAttr->pick_start_path.elements = (PEXElementRef *)
- Xmalloc (count * sizeof (PEXElementRef));
-
- EXTRACT_LISTOF_ELEMREF (count,
- pBuf, pAttr->pick_start_path.elements);
- break;
-
- case PEXRABackgroundColor:
-
- EXTRACT_COLOR_SPEC (pBuf, pAttr->background_color,
- fpConvert, fpFormat);
- break;
-
- case PEXRAClearImage:
-
- EXTRACT_LOV_CARD8 (pBuf, pAttr->clear_image);
- break;
-
- case PEXRAClearZ:
-
- EXTRACT_LOV_CARD8 (pBuf, pAttr->clear_z);
- break;
-
- case PEXRAEchoMode:
-
- EXTRACT_LOV_CARD16 (pBuf, pAttr->echo_mode);
- break;
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pAttr);
-}
-
-
-Status
-PEXGetRendererDynamics (display, renderer, tablesReturn,
- namesetsReturn, attributesReturn)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-OUTPUT unsigned long *tablesReturn;
-OUTPUT unsigned long *namesetsReturn;
-OUTPUT unsigned long *attributesReturn;
-
-{
- register pexGetRendererDynamicsReq *req;
- char *pBuf;
- pexGetRendererDynamicsReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetRendererDynamics, pBuf);
-
- BEGIN_REQUEST_HEADER (GetRendererDynamics, pBuf, req);
-
- PEXStoreReqHead (GetRendererDynamics, req);
- req->id = renderer;
-
- END_REQUEST_HEADER (GetRendererDynamics, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *tablesReturn = *namesetsReturn = *attributesReturn = 0;
- return (0); /* return an error */
- }
-
- *tablesReturn = rep.tables;
- *namesetsReturn = rep.namesets;
- *attributesReturn = rep.attributes;
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-void
-PEXChangeRenderer (display, renderer, valueMask, values)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT unsigned long valueMask;
-INPUT PEXRendererAttributes *values;
-
-{
- register pexChangeRendererReq *req;
- char *pBuf;
- int size = 0;
- char *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer. For the item mask,
- * turn off the Current Path and Renderer State attributes, since
- * these are not modifiable.
- */
-
- valueMask &= ~(PEXRACurrentPath | PEXRARendererState);
-
- PEXGetReq (ChangeRenderer, pBuf);
-
- BEGIN_REQUEST_HEADER (ChangeRenderer, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (ChangeRenderer, fpFormat, req);
- req->rdr = renderer;
- req->itemMask = valueMask;
-
- if (valueMask != 0)
- {
- _PEXGenerateRendererList (display, fpConvert, fpFormat,
- valueMask, values, &size, &pList);
-
- req->length += NUMWORDS (size);
- }
-
- END_REQUEST_HEADER (ChangeRenderer, pBuf, req);
-
-
- /*
- * Send the list of values.
- */
-
- if (size > 0)
- Data (display, pList, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXBeginRendering (display, drawable, renderer)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXRenderer renderer;
-
-{
- register pexBeginRenderingReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (BeginRendering, pBuf);
-
- BEGIN_REQUEST_HEADER (BeginRendering, pBuf, req);
-
- PEXStoreReqHead (BeginRendering, req);
- req->rdr = renderer;
- req->drawable = drawable;
-
- END_REQUEST_HEADER (BeginRendering, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXEndRendering (display, renderer, flush)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT int flush;
-
-{
- register pexEndRenderingReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (EndRendering, pBuf);
-
- BEGIN_REQUEST_HEADER (EndRendering, pBuf, req);
-
- PEXStoreReqHead (EndRendering, req);
- req->rdr = renderer;
- req->flushFlag = flush;
-
- END_REQUEST_HEADER (EndRendering, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXBeginStructure (display, renderer, id)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT long id;
-
-{
- register pexBeginStructureReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (BeginStructure, pBuf);
-
- BEGIN_REQUEST_HEADER (BeginStructure, pBuf, req);
-
- PEXStoreReqHead (BeginStructure, req);
- req->rdr = renderer;
- req->sid = id;
-
- END_REQUEST_HEADER (BeginStructure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXEndStructure (display, renderer)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-
-{
- register pexEndStructureReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (EndStructure, pBuf);
-
- BEGIN_REQUEST_HEADER (EndStructure, pBuf, req);
-
- PEXStoreReqHead (EndStructure, req);
- req->id = renderer;
-
- END_REQUEST_HEADER (EndStructure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXRenderNetwork (display, drawable, renderer, structure)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXRenderer renderer;
-INPUT PEXStructure structure;
-
-{
- register pexRenderNetworkReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (RenderNetwork, pBuf);
-
- BEGIN_REQUEST_HEADER (RenderNetwork, pBuf, req);
-
- PEXStoreReqHead (RenderNetwork, req);
- req->rdr = renderer;
- req->drawable = drawable;
- req->sid = structure;
-
- END_REQUEST_HEADER (RenderNetwork, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXRenderElements (display, renderer, sid, whence1, offset1, whence2, offset2)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT PEXStructure sid;
-INPUT int whence1;
-INPUT long offset1;
-INPUT int whence2;
-INPUT long offset2;
-
-{
- register pexRenderElementsReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (RenderElements, pBuf);
-
- BEGIN_REQUEST_HEADER (RenderElements, pBuf, req);
-
- PEXStoreReqHead (RenderElements, req);
- req->rdr = renderer;
- req->sid = sid;
- req->position1_whence = whence1;
- req->position1_offset = offset1;
- req->position2_whence = whence2;
- req->position2_offset = offset2;
-
- END_REQUEST_HEADER (RenderElements, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXAccumulateState (display, renderer, numElements, elements)
-
-INPUT Display *display;
-INPUT PEXRenderer renderer;
-INPUT unsigned long numElements;
-INPUT PEXElementRef *elements;
-
-{
- register pexAccumulateStateReq *req;
- char *pBuf;
- unsigned int size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- size = numElements * SIZEOF (pexElementRef);
- PEXGetReqExtra (AccumulateState, size, pBuf);
-
- BEGIN_REQUEST_HEADER (AccumulateState, pBuf, req);
-
- PEXStoreReqExtraHead (AccumulateState, size, req);
- req->rdr = renderer;
- req->numElRefs = numElements;
-
- END_REQUEST_HEADER (AccumulateState, pBuf, req);
-
- STORE_LISTOF_ELEMREF (numElements, elements, pBuf);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-
-/*
- * Routine to write a packed list of renderer attributes to the
- * transport buffer.
- */
-
-
-static void
-_PEXGenerateRendererList (display, fpConvert, fpFormat,
- valueMask, values, sizeRet, listRet)
-
-INPUT Display *display;
-INPUT int fpConvert;
-INPUT int fpFormat;
-INPUT unsigned long valueMask;
-INPUT PEXRendererAttributes *values;
-OUTPUT int *sizeRet;
-OUTPUT char **listRet;
-
-{
- register char *pBuf;
- int size;
- int i, n;
- unsigned long f;
-
-
- /*
- * Count the number of attributes being set, then allocate a
- * scratch buffer used to pack the attributes. It's not worth
- * computing the exact amount of memory needed, so assume
- * worse case.
- */
-
- CountOnes (valueMask, n);
- size = n * SIZEOF (CARD32) +
- SIZEOF (pexNpcSubvolume) +
- SIZEOF (pexViewport) +
- SIZEOF (pexColorSpecifier);
-
- if (valueMask & PEXRAClipList)
- {
- size += (values->clip_list.count * SIZEOF (pexDeviceRect));
- }
-
- if (valueMask & PEXRAPickStartPath)
- {
- size += (values->pick_start_path.count * SIZEOF (pexElementRef));
- }
-
- pBuf = *listRet = (char *) _XAllocScratch (display, size);
-
-
- /*
- * Pack the attributes.
- */
-
- for (i = 0; i < (PEXRAMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXRACurrentPath:
-
- /*
- * Current path doesn't make sense in a new or changed
- * renderer, so ignore it.
- */
- break;
-
- case PEXRAPipelineContext:
-
- STORE_CARD32 (values->pipeline_context, pBuf);
- break;
-
- case PEXRAMarkerBundle:
-
- STORE_CARD32 (values->marker_bundle, pBuf);
- break;
-
- case PEXRATextBundle:
-
- STORE_CARD32 (values->text_bundle, pBuf);
- break;
-
- case PEXRALineBundle:
-
- STORE_CARD32 (values->line_bundle, pBuf);
- break;
-
- case PEXRAInteriorBundle:
-
- STORE_CARD32 (values->interior_bundle, pBuf);
- break;
-
- case PEXRAEdgeBundle:
-
- STORE_CARD32 (values->edge_bundle, pBuf);
- break;
-
- case PEXRAViewTable:
-
- STORE_CARD32 (values->view_table, pBuf);
- break;
-
- case PEXRAColorTable:
-
- STORE_CARD32 (values->color_table, pBuf);
- break;
-
- case PEXRADepthCueTable:
-
- STORE_CARD32 (values->depth_cue_table, pBuf);
- break;
-
- case PEXRALightTable:
-
- STORE_CARD32 (values->light_table, pBuf);
- break;
-
- case PEXRAColorApproxTable:
-
- STORE_CARD32 (values->color_approx_table, pBuf);
- break;
-
- case PEXRAPatternTable:
-
- STORE_CARD32 (values->pattern_table, pBuf);
- break;
-
- case PEXRATextFontTable:
-
- STORE_CARD32 (values->text_font_table, pBuf);
- break;
-
- case PEXRAHighlightIncl:
-
- STORE_CARD32 (values->highlight_incl, pBuf);
- break;
-
- case PEXRAHighlightExcl:
-
- STORE_CARD32 (values->highlight_excl, pBuf);
- break;
-
- case PEXRAInvisibilityIncl:
-
- STORE_CARD32 (values->invisibility_incl, pBuf);
- break;
-
- case PEXRAInvisibilityExcl:
-
- STORE_CARD32 (values->invisibility_excl, pBuf);
- break;
-
- case PEXRARendererState:
-
- /*
- * Renderer state doesn't make sense in a new or changed
- * renderer, so ignore it.
- */
- break;
-
- case PEXRAHLHSRMode:
-
- STORE_CARD32 (values->hlhsr_mode, pBuf);
- break;
-
- case PEXRANPCSubVolume:
-
- STORE_NPC_SUBVOLUME (values->npc_subvolume, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXRAViewport:
-
- STORE_VIEWPORT (values->viewport, pBuf, fpConvert, fpFormat);
- break;
-
- case PEXRAClipList:
-
- STORE_CARD32 (values->clip_list.count, pBuf);
-
- STORE_LISTOF_DEVRECT (values->clip_list.count,
- values->clip_list.rectangles, pBuf);
- break;
-
- case PEXRAPickIncl:
-
- STORE_CARD32 (values->pick_incl, pBuf);
- break;
-
- case PEXRAPickExcl:
-
- STORE_CARD32 (values->pick_excl, pBuf);
- break;
-
- case PEXRAPickStartPath:
-
- STORE_CARD32 (values->pick_start_path.count, pBuf);
-
- STORE_LISTOF_ELEMREF (values->pick_start_path.count,
- values->pick_start_path.elements, pBuf);
- break;
-
- case PEXRABackgroundColor:
-
- STORE_COLOR_SPEC (values->background_color, pBuf,
- fpConvert, fpFormat);
- break;
-
- case PEXRAClearImage:
-
- STORE_CARD32 (values->clear_image, pBuf);
- break;
-
- case PEXRAClearZ:
-
- STORE_CARD32 (values->clear_z, pBuf);
- break;
-
- case PEXRAEchoMode:
-
- STORE_CARD32 (values->echo_mode, pBuf);
- break;
- }
- }
- }
-
- *sizeRet = pBuf - *listRet;
-}
diff --git a/xc/lib/PEX5/pl_sc.c b/xc/lib/PEX5/pl_sc.c
deleted file mode 100644
index f7924bd34..000000000
--- a/xc/lib/PEX5/pl_sc.c
+++ /dev/null
@@ -1,596 +0,0 @@
-/* $TOG: pl_sc.c /main/13 1998/02/06 16:12:02 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.
-
-*/
-
-/******************************************************************************
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1992 by ShoGraphics, Inc., Mountain View, California
-
- All Rights Reserved
-
-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 Digital or ShowGraphics not be used in advertising or
-publicity pertaining to distribution of the software without specific, written
-prior permission. Digital and ShowGraphics make no representations
-about the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-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.
-
-SHOGRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SHOGRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER 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 "PEXlib.h"
-#include "PEXlibint.h"
-
-static void _PEXGenerateSCList();
-
-
-PEXSearchContext
-PEXCreateSearchContext (display, valueMask, values)
-
-INPUT Display *display;
-INPUT unsigned long valueMask;
-INPUT PEXSCAttributes *values;
-
-{
- register pexCreateSearchContextReq *req;
- char *pBuf;
- PEXSearchContext id;
- int size = 0;
- char *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Get a search context resource id from X.
- */
-
- id = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreateSearchContext, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateSearchContext, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (CreateSearchContext, fpFormat, req);
- req->sc = id;
- req->itemMask = valueMask;
-
- if (valueMask != 0)
- {
- _PEXGenerateSCList (display, fpConvert, fpFormat,
- valueMask, values, &size, &pList);
-
- req->length += NUMWORDS (size);
- }
-
- END_REQUEST_HEADER (CreateSearchContext, pBuf, req);
-
-
- /*
- * Send the list of values.
- */
-
- if (size > 0)
- Data (display, pList, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (id);
-}
-
-
-void
-PEXFreeSearchContext (display, sc)
-
-INPUT Display *display;
-INPUT PEXSearchContext sc;
-
-{
- register pexFreeSearchContextReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreeSearchContext, pBuf);
-
- BEGIN_REQUEST_HEADER (FreeSearchContext, pBuf, req);
-
- PEXStoreReqHead (FreeSearchContext, req);
- req->id = sc;
-
- END_REQUEST_HEADER (FreeSearchContext, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCopySearchContext (display, valueMask, srcSc, destSc)
-
-INPUT Display *display;
-INPUT unsigned long valueMask;
-INPUT PEXSearchContext srcSc;
-INPUT PEXSearchContext destSc;
-
-{
- register pexCopySearchContextReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CopySearchContext, pBuf);
-
- BEGIN_REQUEST_HEADER (CopySearchContext, pBuf, req);
-
- PEXStoreReqHead (CopySearchContext, req);
- req->src = srcSc;
- req->dst = destSc;
- req->itemMask = valueMask;
-
- END_REQUEST_HEADER (CopySearchContext, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXSCAttributes *
-PEXGetSearchContext (display, sc, valueMask)
-
-INPUT Display *display;
-INPUT PEXSearchContext sc;
-INPUT unsigned long valueMask;
-
-{
- register pexGetSearchContextReq *req;
- register char *pBuf, *pBufSave;
- pexGetSearchContextReply rep;
- PEXSCAttributes *scattr;
- unsigned long f;
- unsigned count;
- int i;
- PEXListOfNameSetPair *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetSearchContext, pBuf);
-
- BEGIN_REQUEST_HEADER (GetSearchContext, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetSearchContext, fpFormat, req);
- req->sc = sc;
- req->itemMask = valueMask;
-
- END_REQUEST_HEADER (GetSearchContext, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- scattr = (PEXSCAttributes *) Xmalloc (sizeof (PEXSCAttributes));
-
- scattr->start_path.count = 0;
- scattr->start_path.elements = NULL;
- scattr->normal.count = 0;
- scattr->normal.pairs = NULL;
- scattr->inverted.count = 0;
- scattr->inverted.pairs = NULL;
-
- for (i = 0; i < (PEXSCMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXSCPosition:
-
- EXTRACT_COORD3D (pBuf, scattr->position, fpConvert, fpFormat);
- break;
-
- case PEXSCDistance:
-
- EXTRACT_FLOAT32 (pBuf, scattr->distance, fpConvert, fpFormat);
- break;
-
- case PEXSCCeiling:
-
- EXTRACT_LOV_CARD16 (pBuf, scattr->ceiling);
- break;
-
- case PEXSCModelClipFlag:
-
- EXTRACT_LOV_CARD8 (pBuf, scattr->model_clip_flag);
- break;
-
- case PEXSCStartPath:
-
- EXTRACT_CARD32 (pBuf, count);
- scattr->start_path.count = count;
-
- scattr->start_path.elements = (PEXElementRef *) Xmalloc (
- count * sizeof (PEXElementRef));
-
- EXTRACT_LISTOF_ELEMREF (count, pBuf,
- scattr->start_path.elements);
- break;
-
- case PEXSCNormalList:
- case PEXSCInvertedList:
-
- if (f == PEXSCNormalList)
- pList = &scattr->normal;
- else
- pList = &scattr->inverted;
-
- EXTRACT_CARD32 (pBuf, count);
- pList->count = count;
-
- pList->pairs = (PEXNameSetPair *) Xmalloc (
- count * sizeof (PEXNameSetPair));
-
- EXTRACT_LISTOF_NAMESET_PAIR (count, pBuf, pList->pairs);
- break;
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (scattr);
-}
-
-
-void
-PEXChangeSearchContext (display, sc, valueMask, values)
-
-INPUT Display *display;
-INPUT PEXSearchContext sc;
-INPUT unsigned long valueMask;
-OUTPUT PEXSCAttributes *values;
-
-{
- register pexChangeSearchContextReq *req;
- char *pBuf;
- int size = 0;
- char *pList;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (ChangeSearchContext, pBuf);
-
- BEGIN_REQUEST_HEADER (ChangeSearchContext, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (ChangeSearchContext, fpFormat, req);
- req->sc = sc;
- req->itemMask = valueMask;
-
- if (valueMask != 0)
- {
- _PEXGenerateSCList (display, fpConvert, fpFormat,
- valueMask, values, &size, &pList);
-
- req->length += NUMWORDS (size);
- }
-
- END_REQUEST_HEADER (ChangeSearchContext, pBuf, req);
-
-
- /*
- * Send the list of values.
- */
-
- if (size > 0)
- Data (display, pList, size);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-Status
-PEXSearchNetwork (display, sc, path_return)
-
-INPUT Display *display;
-INPUT PEXSearchContext sc;
-OUTPUT PEXStructurePath **path_return;
-
-{
- register pexSearchNetworkReq *req;
- char *pBuf;
- pexSearchNetworkReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (SearchNetwork, pBuf);
-
- BEGIN_REQUEST_HEADER (SearchNetwork, pBuf, req);
-
- PEXStoreReqHead (SearchNetwork, req);
- req->id = sc;
-
- END_REQUEST_HEADER (SearchNetwork, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *path_return = NULL;
- return (0); /* return an error */
- }
-
-
- /*
- * Allocate a buffer for the path to pass back to the client.
- */
-
- *path_return = (PEXStructurePath *)
- Xmalloc (sizeof (PEXStructurePath));
-
- (*path_return)->count = rep.numItems;
- (*path_return)->elements = (PEXElementRef *)
- Xmalloc ((unsigned) (rep.numItems * sizeof (PEXElementRef)));
-
- XREAD_LISTOF_ELEMREF (display, rep.numItems, (*path_return)->elements);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-/*
- * Routine to write a packed list of SC attributes into the transport buf.
- */
-
-static void
-_PEXGenerateSCList (display, fpConvert, fpFormat,
- valueMask, values, sizeRet, listRet)
-
-INPUT Display *display;
-INPUT int fpConvert;
-INPUT int fpFormat;
-INPUT unsigned long valueMask;
-INPUT PEXSCAttributes *values;
-OUTPUT int *sizeRet;
-OUTPUT char **listRet;
-
-{
- register char *pBuf;
- int size;
- int count;
- int i;
- unsigned long f;
- PEXListOfNameSetPair *pList;
-
-
- /*
- * It's not worth the time of determining exactly how much
- * scratch space to allocate, so assume worse case.
- */
-
- size =
- SIZEOF (pexCoord3D) +
- SIZEOF (float) +
- (5 * SIZEOF (CARD32)) +
- (SIZEOF (pexElementRef) * ((valueMask & PEXSCStartPath) ?
- values->start_path.count : 0)) +
- (SIZEOF (pexNameSetPair) * ((valueMask & PEXSCNormalList) ?
- values->normal.count : 0)) +
- (SIZEOF (pexNameSetPair) * ((valueMask & PEXSCInvertedList) ?
- values->inverted.count : 0));
-
- pBuf = *listRet = (char *) _XAllocScratch (display, size);
-
- for (i = 0; i < (PEXSCMaxShift + 1); i++)
- {
- f = (1L << i);
- if (valueMask & f)
- {
- switch (f)
- {
- case PEXSCPosition:
-
- STORE_COORD3D (values->position, pBuf, fpConvert, fpFormat);
- break;
-
- case PEXSCDistance:
-
- STORE_FLOAT32 (values->distance, pBuf, fpConvert, fpFormat);
- break;
-
- case PEXSCCeiling:
-
- STORE_CARD32 (values->ceiling, pBuf);
- break;
-
- case PEXSCModelClipFlag:
-
- STORE_CARD32 (values->model_clip_flag, pBuf);
- break;
-
- case PEXSCStartPath:
-
- count = values->start_path.count;
- STORE_CARD32 (count, pBuf);
-
- STORE_LISTOF_ELEMREF (count,
- values->start_path.elements, pBuf);
- break;
-
- case PEXSCNormalList:
- case PEXSCInvertedList:
-
- if (f == PEXSCNormalList)
- pList = &values->normal;
- else
- pList = &values->inverted;
-
- count = pList->count;
- STORE_CARD32 (count, pBuf);
-
- STORE_LISTOF_NAMESET_PAIR (count, pList->pairs, pBuf);
- break;
- }
- }
- }
-
- *sizeRet = pBuf - *listRet;
-}
diff --git a/xc/lib/PEX5/pl_startup.c b/xc/lib/PEX5/pl_startup.c
deleted file mode 100644
index 641e97940..000000000
--- a/xc/lib/PEX5/pl_startup.c
+++ /dev/null
@@ -1,961 +0,0 @@
-/* $TOG: pl_startup.c /main/18 1998/02/06 16:12:09 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_global.h"
-#include <stdio.h>
-
-
-int
-PEXInitialize (display, info_return, length, error_string)
-
-INPUT Display *display;
-OUTPUT PEXExtensionInfo **info_return;
-INPUT int length;
-OUTPUT char *error_string;
-
-{
- pexGetExtensionInfoReq *req;
- char *pBuf;
- pexGetExtensionInfoReply rep;
- PEXExtensionInfo *extInfo;
- XExtCodes *pExtCodes;
- PEXDisplayInfo *pexDisplayInfo;
- int enumType, match, i;
- PEXEnumTypeDesc *enumReturn;
- unsigned long *numReturn;
- char *string;
-
- extern Status _PEXConvertMaxHitsEvent();
- Bool _PEXConvertOCError();
- void _PEXPrintOCError();
- int _PEXCloseDisplay();
-
-
- /*
- * Lock the display.
- */
-
- LockDisplay (display);
-
-
- /*
- * If PEXInitialize() has already been successfully called on this
- * display, just return the extension information.
- */
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
-
- if (pexDisplayInfo)
- {
- *info_return = pexDisplayInfo->extInfo;
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (0);
- }
-
-
- /*
- * Initialize the PEX extension on this display.
- */
-
- *info_return = NULL;
-
- if ((pExtCodes = XInitExtension (display, "X3D-PEX")) == NULL)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "BadExtension",
- "Could not initialize the PEX extension on the specified display",
- error_string, length);
-
- return (PEXBadExtension);
- }
-
-
- /*
- * For each display initialized by PEXlib, some additional data must
- * be maintained (such as extension codes and float format). A linked
- * list of records is maintained, one for each open display, with the
- * most recently referenced display always at the beginning.
- */
-
- pexDisplayInfo = (PEXDisplayInfo *) Xmalloc (sizeof (PEXDisplayInfo));
-
- if (!pexDisplayInfo)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "BadLocalAlloc",
- "Could not allocate memory for PEXlib internal usage",
- error_string, length);
-
- return (PEXBadLocalAlloc);
- }
-
- PEXAddDisplayInfo (display, pexDisplayInfo);
-
- pexDisplayInfo->extCodes = pExtCodes;
- pexDisplayInfo->extOpcode = pExtCodes->major_opcode;
- pexDisplayInfo->lastResID = 0;
- pexDisplayInfo->lastReqType = -1;
- pexDisplayInfo->lastReqNum = -1;
-
-
- /*
- * Check if the PEX server on this display supports the client's native
- * floating point format. If not, choose a server supported format
- * (hopefully, the server's native floating point format is in the
- * first entry returned by PEXGetEnumTypeInfo). In places specified by
- * the PEXlib spec, PEXlib will convert between the client's native
- * floating point format and the server supported format.
- */
-
- enumType = PEXETFloatFormat;
-
- if (PEXGetEnumTypeInfo (display, DefaultRootWindow (display), 1,
- &enumType, PEXETIndex, &numReturn, &enumReturn) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "GetEnumFailure",
- "Implicit call to PEXGetEnumTypeInfo by PEXInitialize failed",
- error_string, length);
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- return (PEXBadFloatConversion);
- }
-
- pexDisplayInfo->fpSupport = enumReturn;
- pexDisplayInfo->fpCount = *numReturn;
-
- for (i = match = 0; i < *numReturn; i++)
- if (enumReturn[i].index == NATIVE_FP_FORMAT)
- {
- match = 1;
- break;
- }
-
- if (enumReturn == NULL || *numReturn == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "NoFloats",
- "No floating point formats supported by server",
- error_string, length);
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- return (PEXBadFloatConversion);
- }
- else if (match)
- {
- pexDisplayInfo->fpFormat = NATIVE_FP_FORMAT;
- pexDisplayInfo->fpConvert = 0;
- }
- else
- {
- pexDisplayInfo->fpFormat = enumReturn[0].index;
- pexDisplayInfo->fpConvert = 1;
- }
-
- Xfree ((char *) numReturn);
-
-
- /*
- * Tell Xlib how to convert an Output Command error from
- * wire to client format.
- */
-
- XESetWireToError (display, pExtCodes->first_error + BadPEXOutputCommand,
- _PEXConvertOCError);
-
-
- /*
- * Tell Xlib how to print the OC error.
- */
-
- XESetPrintErrorValues (display, pExtCodes->extension, _PEXPrintOCError);
-
-
- /*
- * Tell Xlib how to convert a MaxHitReachedEvent from
- * wire to client format.
- */
-
- XESetWireToEvent (display, pExtCodes->first_event + PEXMaxHitsReached,
- _PEXConvertMaxHitsEvent);
-
-
- /*
- * Tell Xlib which PEXlib function to call when the display is closed.
- */
-
- XESetCloseDisplay (display, pExtCodes->extension, _PEXCloseDisplay);
-
-
- /*
- * Get information about the PEX server extension.
- */
-
- PEXGetReq (GetExtensionInfo, pBuf);
-
- BEGIN_REQUEST_HEADER (GetExtensionInfo, pBuf, req);
-
- PEXStoreReqHead (GetExtensionInfo, req);
- req->clientProtocolMajor = PEX_PROTO_MAJOR;
- req->clientProtocolMinor = PEX_PROTO_MINOR;
-
- END_REQUEST_HEADER (GetExtensionInfo, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "GetInfoFailure",
- "Could not get PEX extension information",
- error_string, length);
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- return (PEXBadExtension);
- }
-
-
- /*
- * Get the vendor name string and null terminate it.
- */
-
- if (!(string = (char *) Xmalloc ((unsigned) (rep.lengthName + 1))))
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "BadLocalAlloc",
- "Could not allocate memory for PEXlib internal usage",
- error_string, length);
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- return (PEXBadLocalAlloc);
- }
-
- _XReadPad (display, string, (long) (rep.lengthName));
- string[rep.lengthName] = '\0';
-
-
- /*
- * We can unlock the display now.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
-
- /*
- * Store the extension info.
- */
-
- extInfo = *info_return = pexDisplayInfo->extInfo = (PEXExtensionInfo *)
- Xmalloc (sizeof (PEXExtensionInfo));
-
- if (!extInfo)
- {
- XGetErrorDatabaseText (display, "PEXlibMessage", "BadLocalAlloc",
- "Could not allocate memory for PEXlib internal usage",
- error_string, length);
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- return (PEXBadLocalAlloc);
- }
-
- extInfo->major_version = rep.majorVersion;
- extInfo->minor_version = rep.minorVersion;
- extInfo->release = rep.release;
- extInfo->subset_info = rep.subsetInfo;
- extInfo->vendor_name = string;
- extInfo->major_opcode = pExtCodes->major_opcode;
- extInfo->first_event = pExtCodes->first_event;
- extInfo->first_error = pExtCodes->first_error;
-
- if (rep.majorVersion == PEX_PROTO_MAJOR)
- return (0);
- else
- {
- char str[PEXErrorStringLength];
-
- XGetErrorDatabaseText (display, "PEXlibMessage", "BadProtoVersion",
- "Client speaks PEX %d.%d; Server speaks PEX %d.%d",
- str, PEXErrorStringLength);
-
- sprintf (error_string, str,
- PEX_PROTO_MAJOR, PEX_PROTO_MINOR,
- rep.majorVersion, rep.minorVersion);
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- return (PEXBadProtocolVersion);
- }
-}
-
-
-PEXExtensionInfo *
-PEXGetExtensionInfo (display)
-
-INPUT Display *display;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
-
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
- return (pexDisplayInfo ? pexDisplayInfo->extInfo : NULL);
-}
-
-
-int
-PEXGetProtocolFloatFormat (display)
-
-INPUT Display *display;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
-
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
- return (pexDisplayInfo ? pexDisplayInfo->fpFormat : 0);
-}
-
-
-/*
- * PEXGetEnumTypeInfo is broken in the PEX spec. For 5.1, PEXlib will
- * be compatible with the PEX SI. In 6.0, the encoding should be fixed.
- */
-
-Status
-PEXGetEnumTypeInfo (display, drawable, numEnumTypes, enumTypes,
- itemMask, numReturn, enumInfoReturn)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT unsigned long numEnumTypes;
-INPUT int *enumTypes;
-INPUT unsigned long itemMask;
-OUTPUT unsigned long **numReturn;
-OUTPUT PEXEnumTypeDesc **enumInfoReturn;
-
-{
- register pexGetEnumTypeInfoReq *req;
- char *pBuf;
- pexGetEnumTypeInfoReply rep;
- char *pstartrep;
- PEXEnumTypeDesc *penum;
- unsigned long *pcounts;
- char *pstring;
- int numDescs;
- int totDescs;
- int *srcEnumType;
- unsigned int length;
- int size;
- int i, j;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- size = numEnumTypes * SIZEOF (CARD16);
- PEXGetReqExtra (GetEnumTypeInfo, size, pBuf);
-
- BEGIN_REQUEST_HEADER (GetEnumTypeInfo, pBuf, req);
-
- PEXStoreReqExtraHead (GetEnumTypeInfo, size, req);
- req->drawable = drawable;
- req->itemMask = itemMask;
- req->numEnums = numEnumTypes;
-
- END_REQUEST_HEADER (GetEnumTypeInfo, pBuf, req);
-
- for (i = 0, srcEnumType = enumTypes; i < numEnumTypes; i++)
- {
- STORE_CARD16 (*srcEnumType, pBuf);
- srcEnumType++;
- }
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numReturn = NULL;
- *enumInfoReturn = NULL;
- return (0); /* return an error */
- }
-
-
- /*
- * Error if fewer than numEnumTypes lists returned.
- */
-
- if (rep.numLists < numEnumTypes)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numReturn = NULL;
- *enumInfoReturn = NULL;
- return (0); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pstartrep, rep.length << 2);
-
-
- /*
- * Count total number of enums returned.
- */
-
- for (i = 0, totDescs = 0, pBuf = pstartrep; i < rep.numLists; i++)
- {
- EXTRACT_CARD32 (pBuf, numDescs);
- totDescs += numDescs;
-
- if (i == rep.numLists - 1)
- break;
-
- if (itemMask == PEXETIndex)
- {
- pBuf += PADDED_BYTES (numDescs * SIZEOF (INT16));
- }
- else if (itemMask == PEXETMnemonic)
- {
- for (j = 0; j < numDescs; j++)
- {
- GET_CARD16 (pBuf, length);
- pBuf += PADDED_BYTES (SIZEOF (CARD16) + length);
- }
- }
- else if (itemMask == PEXETAll)
- {
- for (j = 0; j < numDescs; j++)
- {
- pBuf += SIZEOF (INT16);
- EXTRACT_CARD16 (pBuf, length);
- pBuf += PADDED_BYTES (length);
- }
- }
- }
-
-
- /*
- * Allocate storage for enum data to be returned to the client.
- */
-
- if (itemMask == PEXETCounts)
- *enumInfoReturn = NULL;
- else
- {
- *enumInfoReturn = penum = (PEXEnumTypeDesc *)
- Xmalloc ((unsigned) (totDescs * sizeof (PEXEnumTypeDesc)));
- }
-
-
- /*
- * Allocate storage to return the counts to the client.
- */
-
- *numReturn = pcounts = (unsigned long *)
- Xmalloc ((unsigned) (numEnumTypes * sizeof (unsigned long)));
-
-
- /*
- * Retrieve the lists of enum info.
- */
-
- for (i = 0, pBuf = pstartrep; i < rep.numLists; i++, pcounts++)
- {
- EXTRACT_CARD32 (pBuf, numDescs);
- *pcounts = numDescs;
-
- if (itemMask == PEXETIndex)
- {
- for (j = 0; j < numDescs; j++, penum++)
- {
- penum->descriptor = NULL;
- EXTRACT_INT16 (pBuf, penum->index);
- }
-
- if (numDescs & 1)
- pBuf += SIZEOF (INT16);
- }
- else if (itemMask == PEXETMnemonic)
- {
- for (j = 0; j < numDescs; j++, penum++)
- {
- penum->index = 0;
- EXTRACT_CARD16 (pBuf, length);
-
- penum->descriptor = pstring =
- (char *) Xmalloc ((unsigned) (length + 1));
- memcpy (pstring, pBuf, length);
- pstring[length] = '\0'; /* null terminate */
-
- pBuf += (PADDED_BYTES (SIZEOF (CARD16) + length) -
- SIZEOF (CARD16));
- }
- }
- else if (itemMask == PEXETAll)
- {
- for (j = 0; j < numDescs; j++, penum++)
- {
- EXTRACT_INT16 (pBuf, penum->index);
- EXTRACT_CARD16 (pBuf, length);
-
- penum->descriptor = pstring =
- (char *) Xmalloc ((unsigned) (length + 1));
- memcpy (pstring, pBuf, length);
- pstring[length] = '\0'; /* null terminate */
-
- pBuf += PADDED_BYTES (length);
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pstartrep, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXGetImpDepConstants (display, drawable, numNames, names, constantsReturn)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT unsigned long numNames;
-INPUT unsigned short *names;
-OUTPUT PEXImpDepConstant **constantsReturn;
-
-{
- register pexGetImpDepConstantsReq *req;
- char *pBuf;
- pexGetImpDepConstantsReply rep;
- long size;
- CARD32 *c32list;
- float *flist;
- int i;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- size = numNames * SIZEOF (CARD16);
- PEXGetReqExtra (GetImpDepConstants, size, pBuf);
-
- BEGIN_REQUEST_HEADER (GetImpDepConstants, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (GetImpDepConstants, fpFormat, size, req);
- req->drawable = drawable;
- req->numNames = numNames;
-
- END_REQUEST_HEADER (GetImpDepConstants, pBuf, req);
-
- STORE_LISTOF_CARD16 (numNames, names, pBuf);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *constantsReturn = NULL;
- return (0); /* return an error */
- }
-
-
- /*
- * Allocate a buffer for the client.
- */
-
- *constantsReturn = (PEXImpDepConstant *) Xmalloc (
- (unsigned) (numNames * sizeof (PEXImpDepConstant)));
-
-
- /*
- * Read the values into the buffer.
- */
-
- c32list = (CARD32 *) (*constantsReturn);
- flist = (float *) (*constantsReturn);
-
- if (!fpConvert)
- {
- XREAD_LISTOF_CARD32 (display, numNames, c32list);
- }
- else
- {
- for (i = 0; i < numNames; i++)
- {
- switch (names[i])
- {
- 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 PEXIDBestColorApprox:
- case PEXIDTransparencySupported:
- case PEXIDDoubleBufferingSupported:
- case PEXIDMaxHitsEventSupported:
-
- _XRead (display, (char *) &c32list[i], SIZEOF (CARD32));
- 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:
-
- {
- char temp[4];
- _XRead (display, temp, SIZEOF (float));
- FP_CONVERT_NTOH_BUFF (temp, flist[i], fpFormat);
- }
- }
- }
- }
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXMatchRenderingTargets (display, drawable, depth, type, visual,
- maxTargets, numTargets, targets)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT int depth;
-INPUT int type;
-INPUT Visual *visual;
-INPUT unsigned long maxTargets;
-OUTPUT unsigned long *numTargets;
-OUTPUT PEXRenderingTarget **targets;
-
-{
- register pexMatchRenderingTargetsReq *req;
- char *pBuf;
- pexMatchRenderingTargetsReply rep;
- PEXRenderingTarget *info;
- pexRendererTarget *matchRec;
- int i;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (MatchRenderingTargets, pBuf);
-
- BEGIN_REQUEST_HEADER (MatchRenderingTargets, pBuf, req);
-
- PEXStoreReqHead (MatchRenderingTargets, req);
- req->drawable = drawable;
- req->depth = depth;
- req->type = type;
- req->visualID = visual ? visual->visualid : 0;
- req->maxTriplets = maxTargets;
-
- END_REQUEST_HEADER (MatchRenderingTargets, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numTargets = 0;
- *targets = NULL;
- return (0); /* return an error */
- }
-
- *numTargets = rep.length / 2;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
-
-
- /*
- * The total size of pexRendererTarget is 8 bytes, so it's safe
- * to have matchRec point to pBuf on 64 bit machines.
- */
-
- matchRec = (pexRendererTarget *) pBuf;
-
-
- /*
- * Allocate a buffer for the target list to pass back to the client.
- */
-
- *targets = info = (PEXRenderingTarget *) Xmalloc (
- (unsigned) (*numTargets * sizeof (PEXRenderingTarget)));
-
- for (i = 0; i < *numTargets; i++)
- {
- info->depth = matchRec->depth;
- info->type = matchRec->type;
- info->visual = _XVIDtoVisual (display, matchRec->visualID);
- info++;
- matchRec++;
- }
-
- FINISH_WITH_SCRATCH (display, pBuf, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-/*
- * Routine called to convert an Output Command error from wire format
- * to client format. The callback is set up in PEXInitialize.
- */
-
-Bool
-_PEXConvertOCError (display, client_error, wire_error)
-
-INPUT Display *display;
-OUTPUT XErrorEvent *client_error;
-INPUT xError *wire_error;
-
-{
- PEXOCErrorEvent *client = (PEXOCErrorEvent *) client_error;
- pexOutputCommandError *wire = (pexOutputCommandError *) wire_error;
-
-
- /*
- * PEXOCErrorEvent = XErrorEvent + oc_op_code + ocs_processed_count
- * Xlib will convert all of the XErrorEvent fields. We must
- * convert the op code and count.
- */
-
- client->op_code = wire->opcode;
- client->count = wire->numCommands;
-
- return (True);
-}
-
-
-/*
- * Routine called when an Output Command error is printed.
- * The callback is set up in PEXInitialize.
- */
-
-void
-_PEXPrintOCError (display, error, fp)
-
-INPUT Display *display;
-INPUT XErrorEvent *error;
-#if NeedFunctionPrototypes
-INPUT void *fp;
-#else
-INPUT FILE *fp;
-#endif
-{
- /*
- * Xlib bug - extension codes should be passed to this function,
- * but they're not. We must get them ourselves.
- */
-
- PEXDisplayInfo *pexDisplayInfo;
- char opcode_message[PEXErrorStringLength];
- char oc_count_message[PEXErrorStringLength];
-
-
- PEXGetDisplayInfo (display, pexDisplayInfo);
-
- if (error->error_code ==
- pexDisplayInfo->extCodes->first_error + BadPEXOutputCommand)
- {
- PEXOCErrorEvent *oc_error = (PEXOCErrorEvent *) error;
-
- XGetErrorDatabaseText (display,
- "PEXlibMessage", "OCErrorOpCode",
- "Opcode of failed output command : %d\n",
- opcode_message, PEXErrorStringLength);
-
- XGetErrorDatabaseText (display,
- "PEXlibMessage", "OCErrorCount",
- "Number of output commands processed before error : %d\n",
- oc_count_message, PEXErrorStringLength);
-
- fprintf (fp, " ");
- fprintf (fp, opcode_message, oc_error->op_code);
-
- fprintf (fp, " ");
- fprintf (fp, oc_count_message, oc_error->count);
- }
-}
-
-
-/*
- * Routine called when a display is closed via XCloseDisplay.
- * The callback is set up in PEXInitialize.
- */
-
-int
-_PEXCloseDisplay (display, codes)
-
-INPUT Display *display;
-INPUT XExtCodes *codes;
-
-{
- PEXDisplayInfo *pexDisplayInfo;
-
-
- /*
- * Free the extension codes and other info attached to this display.
- */
-
- PEXRemoveDisplayInfo (display, pexDisplayInfo);
-
- if (pexDisplayInfo == NULL)
- return (0);
-
- Xfree ((char *) (pexDisplayInfo->extInfo->vendor_name));
- Xfree ((char *) (pexDisplayInfo->extInfo));
- Xfree ((char *) (pexDisplayInfo->fpSupport));
- Xfree ((char *) pexDisplayInfo);
-
-
- /*
- * Free the pick path cache (if it's not in use)
- */
-
- if (PEXPickCache && !PEXPickCacheInUse)
- Xfree ((char *) PEXPickCache);
-
- return (1);
-}
diff --git a/xc/lib/PEX5/pl_store.h b/xc/lib/PEX5/pl_store.h
deleted file mode 100644
index 33309e5cf..000000000
--- a/xc/lib/PEX5/pl_store.h
+++ /dev/null
@@ -1,975 +0,0 @@
-/* $TOG: pl_store.h /main/5 1998/02/06 16:12:15 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.
-
-*/
-
-#ifndef WORD64
-
-#define PUT_CARD32(_val, _pBuf) \
- *((CARD32 *) _pBuf) = _val
-
-#define PUT_CARD16(_val, _pBuf) \
- *((CARD16 *) _pBuf) = _val
-
-#define PUT_INT32(_val, _pBuf) \
- *((INT32 *) _pBuf) = _val
-
-#define PUT_INT16(_val, _pBuf) \
- *((INT16 *) _pBuf) = _val
-
-#else /* WORD64 */
-
-#define PUT_CARD32(_val, _pBuf) \
- CARD64_TO_32 (_val, _pBuf)
-
-#define PUT_CARD16(_val, _pBuf) \
- CARD64_TO_16 (_val, _pBuf)
-
-#define PUT_INT32(_val, _pBuf) \
- INT64_TO_32 (_val, _pBuf)
-
-#define PUT_INT16(_val, _pBuf) \
- INT64_TO_16 (_val, _pBuf)
-
-#endif /* WORD64 */
-
-
-#define STORE_CARD32(_val, _pBuf) \
-{ \
- PUT_CARD32 (_val, _pBuf); \
- _pBuf += SIZEOF (CARD32); \
-}
-
-#define STORE_CARD16(_val, _pBuf) \
-{ \
- PUT_CARD16 (_val, _pBuf); \
- _pBuf += SIZEOF (CARD16); \
-}
-
-#define STORE_INT32(_val, _pBuf) \
-{ \
- PUT_INT32 (_val, _pBuf); \
- _pBuf += SIZEOF (INT32); \
-}
-
-#define STORE_INT16(_val, _pBuf) \
-{ \
- PUT_INT16 (_val, _pBuf); \
- _pBuf += SIZEOF (INT16); \
-}
-
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define STORE_LISTOF_CARD32(_count, _pList, _pBuf) \
-{ \
- memcpy (_pBuf, _pList, _count * SIZEOF (CARD32)); \
- _pBuf += (_count * SIZEOF (CARD32)); \
-}
-
-#define STORE_LISTOF_CARD16(_count, _pList, _pBuf) \
-{ \
- memcpy (_pBuf, _pList, _count * SIZEOF (CARD16)); \
- _pBuf += (_count * SIZEOF (CARD16)); \
-}
-
-#define STORE_LISTOF_INT32(_count, _pList, _pBuf) \
-{ \
- memcpy (_pBuf, _pList, _count * SIZEOF (INT32)); \
- _pBuf += (_count * SIZEOF (INT32)); \
-}
-
-#define STORE_LISTOF_INT16(_count, _pList, _pBuf) \
-{ \
- memcpy (_pBuf, _pList, _count * SIZEOF (INT16)); \
- _pBuf += (_count * SIZEOF (INT16)); \
-}
-
-#else /* WORD64 */
-
-#define STORE_LISTOF_CARD32(_count, _pList, _pBuf) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- STORE_CARD32 (_pList[_i], _pBuf); \
-}
-
-#define STORE_LISTOF_CARD16(_count, _pList, _pBuf) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- STORE_CARD16 (_pList[_i], _pBuf); \
-}
-
-#define STORE_LISTOF_INT32(_count, _pList, _pBuf) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- STORE_INT32 (_pList[_i], _pBuf); \
-}
-
-#define STORE_LISTOF_INT16(_count, _pList, _pBuf) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- STORE_INT16 (_pList[_i], _pBuf); \
-}
-
-#endif /* WORD64 */
-
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define STORE_FLOAT32(_val, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- *((float *) _pBuf) = _val; \
- } \
- else \
- { \
- FP_CONVERT_HTON_BUFF (_val, _pBuf, _fpFormat); \
- } \
- _pBuf += SIZEOF (float); \
-}
-
-#define STORE_LISTOF_FLOAT32(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- memcpy (_pBuf, _pList, _count * SIZEOF (float)); \
- _pBuf += (_count * SIZEOF (float)); \
- } \
- else \
- { \
- int _i; \
- float *fptr = (float *) _pList; \
-\
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- FP_CONVERT_HTON_BUFF (*fptr, _pBuf, _fpFormat); \
- _pBuf += SIZEOF (float); \
- fptr++; \
- } \
- }\
-}
-
-#else /* WORD64 */
-
-#define STORE_FLOAT32(_val, _pBuf, _fpConvert, _fpFormat) \
-{ \
- FP_CONVERT_HTON_BUFF (_val, _pBuf, _fpFormat); \
- _pBuf += SIZEOF (float); \
-}
-
-#define STORE_LISTOF_FLOAT32(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
-{ \
- int _i; \
- float *fptr = (float *) _pList; \
-\
- for (_i = 0; _i < _count; _i++) \
- { \
- FP_CONVERT_HTON_BUFF (*fptr, _pBuf, _fpFormat); \
- _pBuf += SIZEOF (float); \
- fptr++; \
- } \
-}
-
-#endif /* WORD64 */
-
-
-
-/* ------------------------------------------------------------------------ */
-/* STORE_FOO and STORE_LISTOF_FOO */
-/* (where FOO has no floating point values in it) */
-/* ------------------------------------------------------------------------ */
-
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define PUT_TEMP(_pexType, _foo, _tFoo) PUT_TEMP_##_pexType (_foo, _tFoo);
-#else
-#define PUT_TEMP(_pexType, _foo, _tFoo) PUT_TEMP_/**/_pexType (_foo, _tFoo);
-#endif
-
-
-#ifndef WORD64
-
-#define STORE_FOO(_pexType, _foo, _pBuf) \
-{ \
- memcpy (_pBuf, &(_foo), SIZEOF (_pexType)); \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define STORE_LISTOF_FOO(_pexType, _count, _fooList, _pBuf) \
-{ \
- memcpy (_pBuf, _fooList, _count * SIZEOF (_pexType)); \
- _pBuf += (_count * SIZEOF (_pexType)); \
-}
-
-#else /* WORD64 */
-
-#define STORE_FOO(_pexType, _foo, _pBuf) \
-{ \
- _pexType tFoo; \
- PUT_TEMP(_pexType, _foo, tFoo); \
- memcpy (_pBuf, &tFoo, SIZEOF (_pexType)); \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define STORE_LISTOF_FOO(_pexType, _count, _fooList, _pBuf) \
-{ \
- _pexType tFoo; \
- int _i; \
-\
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- PUT_TEMP(_pexType, _fooList[_i], tFoo); \
- memcpy (_pBuf, &tFoo, SIZEOF (_pexType)); \
- _pBuf += SIZEOF (_pexType); \
- } \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * TEXT ALIGNMENT
- */
-
-#define STORE_TEXTALIGN(_align, _pBuf) \
- STORE_FOO (pexTextAlignmentData, _align, _pBuf)
-
-#define PUT_TEMP_pexTextAlignmentData(_src, _dst) \
- _dst.vertical = _src.vertical; \
- _dst.horizontal = _src.horizontal;
-
-
-/*
- * PSC ISO CURVES
- */
-
-#define STORE_PSC_ISOCURVES(_isoCurves, _pBuf) \
- STORE_FOO (pexPSC_IsoparametricCurves, _isoCurves, _pBuf)
-
-#define PUT_TEMP_pexPSC_IsoparametricCurves(_src, _dst) \
- _dst.placementType = _src.placement_type; \
- _dst.numUcurves = _src.u_count; \
- _dst.numVcurves = _src.v_count;
-
-
-/*
- * List of ELEMENT REF
- */
-
-#define STORE_LISTOF_ELEMREF(_count, _pList, _pBuf) \
- STORE_LISTOF_FOO (pexElementRef, _count, _pList, _pBuf)
-
-#define PUT_TEMP_pexElementRef(_src, _dst) \
- _dst.structure = _src.structure; \
- _dst.offset = _src.offset;
-
-
-/*
- * List of PICK ELEMENT REF
- */
-
-#define STORE_LISTOF_PICKELEMREF(_count, _pList, _pBuf) \
- STORE_LISTOF_FOO (pexPickElementRef, _count, _pList, _pBuf)
-
-#define PUT_TEMP_pexPickElementRef(_src, _dst) \
- _dst.sid = _src.sid; \
- _dst.offset = _src.offset; \
- _dst.pickid = _src.pick_id;
-
-
-/*
- * List of DEVICE RECT
- */
-
-#define STORE_LISTOF_DEVRECT(_count, _pList, _pBuf) \
- STORE_LISTOF_FOO (pexDeviceRect, _count, _pList, _pBuf)
-
-#define PUT_TEMP_pexDeviceRect(_src, _dst) \
- _dst.xmin = _src.xmin; \
- _dst.ymin = _src.ymin; \
- _dst.xmax = _src.xmax; \
- _dst.ymax = _src.ymax;
-
-
-/*
- * List of NAME SET PAIR
- */
-
-#define STORE_LISTOF_NAMESET_PAIR(_count, _pList, _pBuf) \
- STORE_LISTOF_FOO (pexNameSetPair, _count, _pList, _pBuf)
-
-#define PUT_TEMP_pexNameSetPair(_src, _dst) \
- _dst.incl = _src.inclusion; \
- _dst.excl = _src.exclusion;
-
-
-
-/* ------------------------------------------------------------------------ */
-/* STORE_FOOFP and STORE_LISTOF_FOOFP */
-/* ------------------------------------------------------------------------ */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define DOSTORE(_pexType, _src, _dst, _fpConvert, _fpFormat) \
- DOSTORE_##_pexType (_src, _dst, _fpConvert, _fpFormat)
-#else
-#define DOSTORE(_pexType, _src, _dst, _fpConvert, _fpFormat) \
- DOSTORE_/**/_pexType (_src, _dst, _fpConvert, _fpFormat)
-#endif
-
-
-#ifndef WORD64
-
-#define STORE_FOOFP(_pexType, _foo, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- memcpy (_pBuf, &(_foo), SIZEOF (_pexType)); \
- } \
- else \
- { \
- _pexType *pFoo = (_pexType *) _pBuf; \
- DOSTORE (_pexType, _foo, pFoo, _fpConvert, _fpFormat); \
- } \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define STORE_LISTOF_FOOFP(_pexType, _count, _fooList, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- memcpy (_pBuf, _fooList, _count * SIZEOF (_pexType)); \
- _pBuf += (_count * SIZEOF (_pexType)); \
- } \
- else \
- { \
- int _i; \
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- _pexType *pFoo = (_pexType *) _pBuf; \
- DOSTORE (_pexType, _fooList[_i], pFoo, _fpConvert, _fpFormat); \
- _pBuf += SIZEOF (_pexType); \
- } \
- } \
-}
-
-#else /* WORD64 */
-
-#define STORE_FOOFP(_pexType, _foo, _pBuf, _fpConvert, _fpFormat) \
-{ \
- _pexType tFoo; \
- _pexType *pFoo = &tFoo; \
- DOSTORE (_pexType, _foo, pFoo, _fpConvert, _fpFormat); \
- memcpy (_pBuf, pFoo, SIZEOF (_pexType)); \
- _pBuf += SIZEOF (_pexType); \
-}
-
-#define STORE_LISTOF_FOOFP(_pexType, _count, _fooList, _pBuf, _fpConvert, _fpFormat) \
-{ \
- int _i; \
- _pexType tFoo; \
- _pexType *pFoo = &tFoo; \
- for (_i = 0; _i < (int) _count; _i++) \
- { \
- DOSTORE (_pexType, _fooList[_i], pFoo, _fpConvert, _fpFormat); \
- memcpy (_pBuf, pFoo, SIZEOF (_pexType)); \
- _pBuf += SIZEOF (_pexType); \
- } \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * NPC SUBVOLUME
- */
-
-#define STORE_NPC_SUBVOLUME(_volume, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexNpcSubvolume, _volume, _pBuf, _fpConvert, _fpFormat)
-
-#define DOSTORE_pexNpcSubvolume(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.min.x, _dst->xmin, _fpFormat); \
- FP_CONVERT_HTON (_src.min.y, _dst->ymin, _fpFormat); \
- FP_CONVERT_HTON (_src.min.z, _dst->zmin, _fpFormat); \
- FP_CONVERT_HTON (_src.max.x, _dst->xmax, _fpFormat); \
- FP_CONVERT_HTON (_src.max.y, _dst->ymax, _fpFormat); \
- FP_CONVERT_HTON (_src.max.z, _dst->zmax, _fpFormat); \
- } \
- else \
- { \
- _dst->xmin = _src.min.x; \
- _dst->ymin = _src.min.y; \
- _dst->zmin = _src.min.z; \
- _dst->xmax = _src.max.x; \
- _dst->ymax = _src.max.y; \
- _dst->zmax = _src.max.z; \
- }
-
-
-/*
- * VIEWPORT
- */
-
-#define STORE_VIEWPORT(_viewport, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexViewport, _viewport, _pBuf, _fpConvert, _fpFormat)
-
-#define DOSTORE_pexViewport(_src, _dst, _fpConvert, _fpFormat) \
- _dst->xmin = _src.min.x; \
- _dst->ymin = _src.min.y; \
- _dst->xmax = _src.max.x; \
- _dst->ymax = _src.max.y; \
- _dst->useDrawable = _src.use_drawable; \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.min.z, _dst->zmin, _fpFormat); \
- FP_CONVERT_HTON (_src.max.z, _dst->zmax, _fpFormat); \
- } \
- else \
- { \
- _dst->zmin = _src.min.z; \
- _dst->zmax = _src.max.z; \
- }
-
-
-/*
- * COORD 4D
- */
-
-#define STORE_COORD4D(_coord4D, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexCoord4D, _coord4D, _pBuf, _fpConvert, _fpFormat)
-
-
-#define STORE_LISTOF_COORD4D(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
- STORE_LISTOF_FOOFP (pexCoord4D, _count, _pList, _pBuf, \
- _fpConvert, _fpFormat);
-
-
-#define DOSTORE_pexCoord4D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.x, _dst->x, _fpFormat); \
- FP_CONVERT_HTON (_src.y, _dst->y, _fpFormat); \
- FP_CONVERT_HTON (_src.z, _dst->z, _fpFormat); \
- FP_CONVERT_HTON (_src.w, _dst->w, _fpFormat); \
- } \
- else \
- { \
- _dst->x = _src.x; \
- _dst->y = _src.y; \
- _dst->z = _src.z; \
- _dst->w = _src.w; \
- }
-
-
-/*
- * COORD 3D
- */
-
-#define STORE_COORD3D(_coord3D, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexCoord3D, _coord3D, _pBuf, _fpConvert, _fpFormat)
-
-
-#define STORE_LISTOF_COORD3D(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
- STORE_LISTOF_FOOFP (pexCoord3D, _count, _pList, _pBuf, \
- _fpConvert, _fpFormat);
-
-
-#define DOSTORE_pexCoord3D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.x, _dst->x, _fpFormat); \
- FP_CONVERT_HTON (_src.y, _dst->y, _fpFormat); \
- FP_CONVERT_HTON (_src.z, _dst->z, _fpFormat); \
- } \
- else \
- { \
- _dst->x = _src.x; \
- _dst->y = _src.y; \
- _dst->z = _src.z; \
- }
-
-
-/*
- * COORD 2D
- */
-
-#define STORE_COORD2D(_coord2D, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexCoord2D, _coord2D, _pBuf, _fpConvert, _fpFormat)
-
-
-#define STORE_LISTOF_COORD2D(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
- STORE_LISTOF_FOOFP (pexCoord2D, _count, _pList, _pBuf, \
- _fpConvert, _fpFormat);
-
-
-#define DOSTORE_pexCoord2D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.x, _dst->x, _fpFormat); \
- FP_CONVERT_HTON (_src.y, _dst->y, _fpFormat); \
- } \
- else \
- { \
- _dst->x = _src.x; \
- _dst->y = _src.y; \
- }
-
-
-/*
- * VECTOR 3D
- */
-
-#define STORE_VECTOR3D(_vector3D, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexVector3D, _vector3D, _pBuf, _fpConvert, _fpFormat)
-
-
-#define DOSTORE_pexVector3D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.x, _dst->x, _fpFormat); \
- FP_CONVERT_HTON (_src.y, _dst->y, _fpFormat); \
- FP_CONVERT_HTON (_src.z, _dst->z, _fpFormat); \
- } \
- else \
- { \
- _dst->x = _src.x; \
- _dst->y = _src.y; \
- _dst->z = _src.z; \
- }
-
-
-/*
- * VECTOR 2D
- */
-
-#define STORE_VECTOR2D(_vector2D, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexVector2D, _vector2D, _pBuf, _fpConvert, _fpFormat)
-
-
-#define DOSTORE_pexVector2D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.x, _dst->x, _fpFormat); \
- FP_CONVERT_HTON (_src.y, _dst->y, _fpFormat); \
- } \
- else \
- { \
- _dst->x = _src.x; \
- _dst->y = _src.y; \
- }
-
-
-/*
- * PSC LEVEL CURVES
- */
-
-#define STORE_PSC_LEVELCURVES(_levCurv, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexPSC_LevelCurves, _levCurv, _pBuf, _fpConvert, _fpFormat)
-
-
-#define DOSTORE_pexPSC_LevelCurves(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.origin.x, _dst->origin_x, _fpFormat); \
- FP_CONVERT_HTON (_src.origin.y, _dst->origin_y, _fpFormat); \
- FP_CONVERT_HTON (_src.origin.z, _dst->origin_z, _fpFormat); \
- FP_CONVERT_HTON (_src.direction.x, _dst->direction_x, _fpFormat); \
- FP_CONVERT_HTON (_src.direction.y, _dst->direction_y, _fpFormat); \
- FP_CONVERT_HTON (_src.direction.z, _dst->direction_z, _fpFormat); \
- } \
- else \
- { \
- _dst->origin_x = _src.origin.x; \
- _dst->origin_y = _src.origin.y; \
- _dst->origin_z = _src.origin.z; \
- _dst->direction_x = _src.direction.x; \
- _dst->direction_y = _src.direction.y; \
- _dst->direction_z = _src.direction.z; \
- } \
- _dst->numberIntersections = _src.count;
-
-
-/*
- * REFLECTION ATTRIBUTES
- */
-
-#define STORE_REFLECTION_ATTR(_reflAttr, _pBuf, _fpConvert, _fpFormat) \
- STORE_FOOFP (pexReflectionAttr, _reflAttr, _pBuf, _fpConvert, _fpFormat) \
- STORE_COLOR_VAL (_reflAttr.specular_color.type, \
- _reflAttr.specular_color.value, _pBuf, _fpConvert, _fpFormat)
-
-
-#define DOSTORE_pexReflectionAttr(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.ambient, _dst->ambient, _fpFormat); \
- FP_CONVERT_HTON (_src.diffuse, _dst->diffuse, _fpFormat); \
- FP_CONVERT_HTON (_src.specular, _dst->specular, _fpFormat); \
- FP_CONVERT_HTON (_src.specular_conc, _dst->specularConc, _fpFormat); \
- FP_CONVERT_HTON (_src.transmission, _dst->transmission, _fpFormat); \
- } \
- else \
- { \
- _dst->ambient = _src.ambient; \
- _dst->diffuse = _src.diffuse; \
- _dst->specular = _src.specular; \
- _dst->specularConc = _src.specular_conc; \
- _dst->transmission = _src.transmission; \
- } \
- _dst->specular_colorType = _src.specular_color.type;
-
-
-/*
- * List of DEVICE COORD
- */
-
-#define STORE_LISTOF_DEVCOORD(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
- STORE_LISTOF_FOOFP (pexDeviceCoord, _count, _pList, _pBuf, \
- _fpConvert, _fpFormat);
-
-#define DOSTORE_pexDeviceCoord(_src, _dst, _fpConvert, _fpFormat) \
- _dst->x = _src.x; \
- _dst->y = _src.y; \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.z, _dst->z, _fpFormat); \
- } \
- else \
- _dst->z = _src.z;
-
-
-/*
- * List of HALF SPACE
- */
-
-#define STORE_LISTOF_HALFSPACE3D(_count, _pList, _pBuf, _fpConvert, _fpFormat)\
- STORE_LISTOF_FOOFP (pexHalfSpace, _count, _pList, _pBuf, \
- _fpConvert, _fpFormat);
-
-#define DOSTORE_pexHalfSpace(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.point.x, _dst->point_x, _fpFormat); \
- FP_CONVERT_HTON (_src.point.y, _dst->point_y, _fpFormat); \
- FP_CONVERT_HTON (_src.point.z, _dst->point_z, _fpFormat); \
- FP_CONVERT_HTON (_src.vector.x, _dst->vector_x, _fpFormat); \
- FP_CONVERT_HTON (_src.vector.y, _dst->vector_y, _fpFormat); \
- FP_CONVERT_HTON (_src.vector.z, _dst->vector_z, _fpFormat); \
- } \
- else \
- { \
- _dst->point_x = _src.point.x; \
- _dst->point_y = _src.point.y; \
- _dst->point_z = _src.point.z; \
- _dst->vector_x = _src.vector.x; \
- _dst->vector_y = _src.vector.y; \
- _dst->vector_z = _src.vector.z; \
- }
-
-
-#define STORE_LISTOF_HALFSPACE2D(_count, _pList, _pBuf, _fpConvert, _fpFormat)\
- STORE_LISTOF_FOOFP (pexHalfSpace2D, _count, _pList, _pBuf, \
- _fpConvert, _fpFormat);
-
-#define DOSTORE_pexHalfSpace2D(_src, _dst, _fpConvert, _fpFormat) \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_src.point.x, _dst->point_x, _fpFormat); \
- FP_CONVERT_HTON (_src.point.y, _dst->point_y, _fpFormat); \
- FP_CONVERT_HTON (_src.vector.x, _dst->vector_x, _fpFormat); \
- FP_CONVERT_HTON (_src.vector.y, _dst->vector_y, _fpFormat); \
- } \
- else \
- { \
- _dst->point_x = _src.point.x; \
- _dst->point_y = _src.point.y; \
- _dst->vector_x = _src.vector.x; \
- _dst->vector_y = _src.vector.y; \
- }
-
-
-/* ------------------------------------------------------------------------ */
-/* COLOR VALUE and COLOR SPECIFIER */
-/* ------------------------------------------------------------------------ */
-
-#define STORE_COLOR_VAL(_colType, _colVal, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- int sizeColor = GetColorSize (_colType); \
- memcpy (_pBuf, &(_colVal), sizeColor); \
- _pBuf += sizeColor; \
- } \
- else \
- { \
- switch (_colType) \
- { \
- case PEXColorTypeIndexed: \
-\
- STORE_CARD16 (_colVal.indexed.index, _pBuf); \
- _pBuf += 2; \
- break; \
-\
- case PEXColorTypeRGB: \
- case PEXColorTypeCIE: \
- case PEXColorTypeHSV: \
- case PEXColorTypeHLS: \
-\
- FP_CONVERT_HTON_BUFF (_colVal.rgb.red, _pBuf, _fpFormat); \
- _pBuf += SIZEOF (float); \
- FP_CONVERT_HTON_BUFF (_colVal.rgb.green, _pBuf, _fpFormat); \
- _pBuf += SIZEOF (float); \
- FP_CONVERT_HTON_BUFF (_colVal.rgb.blue, _pBuf, _fpFormat); \
- _pBuf += SIZEOF (float); \
- break; \
-\
- case PEXColorTypeRGB8: \
-\
- memcpy (_pBuf, &(_colVal.rgb8), 4); \
- _pBuf += 4; \
- break; \
-\
- case PEXColorTypeRGB16: \
-\
- STORE_CARD16 (_colVal.rgb16.red, _pBuf); \
- STORE_CARD16 (_colVal.rgb16.green, _pBuf); \
- STORE_CARD16 (_colVal.rgb16.blue, _pBuf); \
- _pBuf += 2; \
- break; \
- } \
- } \
-}
-
-
-#define STORE_LISTOF_COLOR_VAL(_count, _colType, _pList, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (!_fpConvert) \
- { \
- int bytes = _count * GetColorSize (_colType); \
- memcpy (_pBuf, _pList.indexed, bytes); \
- _pBuf += bytes; \
- } \
- else \
- { \
- _PEXStoreListOfColor (_count, _colType, _pList, &(_pBuf), _fpFormat); \
- } \
-}
-
-
-#define STORE_COLOR_SPEC(_colSpec, _pBuf, _fpConvert, _fpFormat) \
-{ \
- STORE_INT16 (_colSpec.type, _pBuf); \
- _pBuf += 2; \
- STORE_COLOR_VAL (_colSpec.type, _colSpec.value, _pBuf, \
- _fpConvert, _fpFormat); \
-}
-
-
-#define STORE_LISTOF_COLOR_SPEC(_count, _pList, _pBuf, _fpConvert, _fpFormat) \
-{ \
- int _i; \
- for (_i = 0; _i < _count; _i++) \
- { \
- STORE_COLOR_SPEC (_pList[_i], _pBuf, _fpConvert, _fpFormat); \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* FACET data */
-/* ------------------------------------------------------------------------ */
-
-#define STORE_FACET(_colorType, _facetAttr, _facetData, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXStoreFacet (_colorType, _facetAttr, &_facetData, \
- &(_pBuf), _fpFormat);\
- } \
- else \
- { \
- int lenofFacet = GetFacetDataLength (_facetAttr, \
- GetColorLength (_colorType)); \
- memcpy (_pBuf, &_facetData, NUMBYTES (lenofFacet)); \
- _pBuf += NUMBYTES (lenofFacet); \
- } \
-}
-
-
-#define STORE_LISTOF_FACET(_count, _facetSize, _colorType, _facetAttr, _facetData, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXStoreListOfFacet (_count, _colorType, \
- _facetAttr, _facetData, &(_pBuf), _fpFormat); \
- } \
- else \
- { \
- int bytes = _count * _facetSize; \
- memcpy (_pBuf, _facetData.index, bytes); \
- _pBuf += bytes; \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* VERTEX data */
-/* ------------------------------------------------------------------------ */
-
-#define STORE_LISTOF_VERTEX(_count, _vertexSize, _colorType, _vertexAttr, _vertexData, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- _PEXStoreListOfVertex (_count, _colorType, \
- _vertexAttr, _vertexData, &(_pBuf), _fpFormat); \
- } \
- else \
- { \
- int bytes = _count * _vertexSize; \
- memcpy (_pBuf, _vertexData.no_data, bytes); \
- _pBuf += bytes; \
- } \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* PICK RECORD */
-/* ------------------------------------------------------------------------ */
-
-#ifndef WORD64
-
-#define STORE_PICK_RECORD(_type, _numBytes, _pickRec, _pBuf, _fpConvert, _fpFormat) \
-{ \
- if (_fpConvert) \
- { \
- DOSTORE_PICK_RECORD (_type, _numBytes, _pickRec, _pBuf, \
- _fpConvert, _fpFormat); \
- } \
- else \
- { \
- memcpy (_pBuf, _pickRec, _numBytes); \
- } \
- _pBuf += _numBytes; \
-}
-
-#else /* WORD64 */
-
-#define STORE_PICK_RECORD(_type, _numBytes, _pickRec, _pBuf, _fpConvert, _fpFormat) \
-{ \
- DOSTORE_PICK_RECORD (_type, _numBytes, _pickRec, _pBuf, \
- _fpConvert, _fpFormat); \
- _pBuf += _numBytes; \
-}
-
-#endif /* WORD64 */
-
-
-#define DOSTORE_PICK_RECORD(_type, _numBytes, _pickRec, _pBuf, _fpConvert, _fpFormat) \
-{ \
- pexPD_DC_HitBox dc_box; \
- pexPD_NPC_HitVolume npc_vol; \
- char *recPtr; \
-\
- if (_type == PEXPickDeviceDCHitBox) \
- { \
- recPtr = (char *) &dc_box; \
- dc_box.position_x = _pickRec->box.position.x; \
- dc_box.position_y = _pickRec->box.position.y; \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_pickRec->box.distance, \
- dc_box.distance, fpFormat); \
- } \
- else \
- dc_box.distance = _pickRec->box.distance; \
- } \
- else if (_type == PEXPickDeviceNPCHitVolume) \
- { \
- recPtr = (char *) &npc_vol; \
- if (_fpConvert) \
- { \
- FP_CONVERT_HTON (_pickRec->volume.min.x, npc_vol.xmin, _fpFormat);\
- FP_CONVERT_HTON (_pickRec->volume.min.y, npc_vol.ymin, _fpFormat);\
- FP_CONVERT_HTON (_pickRec->volume.min.z, npc_vol.zmin, _fpFormat);\
- FP_CONVERT_HTON (_pickRec->volume.max.x, npc_vol.xmax, _fpFormat);\
- FP_CONVERT_HTON (_pickRec->volume.max.y, npc_vol.ymax, _fpFormat);\
- FP_CONVERT_HTON (_pickRec->volume.max.z, npc_vol.zmax, _fpFormat);\
- } \
- else \
- { \
- npc_vol.xmin = _pickRec->volume.min.x; \
- npc_vol.ymin = _pickRec->volume.min.y; \
- npc_vol.zmin = _pickRec->volume.min.z; \
- npc_vol.xmax = _pickRec->volume.max.x; \
- npc_vol.ymax = _pickRec->volume.max.y; \
- npc_vol.zmax = _pickRec->volume.max.z; \
- } \
- } \
- memcpy (_pBuf, recPtr, _numBytes); \
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* Mono Encoded Strings */
-/* ------------------------------------------------------------------------ */
-
-#define STORE_MONOENCODING(_enc, _pBuf) \
- STORE_FOO (pexMonoEncoding, _enc, _pBuf)
-
-#define PUT_TEMP_pexMonoEncoding(_src, _dst) \
- _dst.characterSet = _src.character_set; \
- _dst.characterSetWidth = _src.character_set_width; \
- _dst.encodingState = _src.encoding_state; \
- _dst.numChars = _src.length;
-
-#define STORE_LISTOF_MONOENCODING(_count, _pList, _pBuf) \
-{ \
- PEXEncodedTextData *nextString; \
- int size, _i; \
-\
- nextString = _pList; \
- for (_i = 0; _i < _count; _i++, nextString++) \
- { \
- STORE_MONOENCODING ((*nextString), _pBuf); \
-\
- if (nextString->character_set_width == PEXCSLong) \
- size = nextString->length * SIZEOF (long); \
- else if (nextString->character_set_width == PEXCSShort) \
- size = nextString->length * SIZEOF (short); \
- else /* nextString->character_set_width == PEXCSByte) */ \
- size = nextString->length; \
-\
- memcpy (_pBuf, nextString->ch, size); \
- _pBuf += PADDED_BYTES (size); \
- } \
-}
-
-
diff --git a/xc/lib/PEX5/pl_struct.c b/xc/lib/PEX5/pl_struct.c
deleted file mode 100644
index 7b3be724d..000000000
--- a/xc/lib/PEX5/pl_struct.c
+++ /dev/null
@@ -1,1312 +0,0 @@
-/* $TOG: pl_struct.c /main/13 1998/02/06 16:12:21 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_oc_util.h"
-
-
-PEXStructure
-PEXCreateStructure (display)
-
-INPUT Display *display;
-
-{
- register pexCreateStructureReq *req;
- char *pBuf;
- PEXStructure sid;
-
-
- /*
- * Get a structure resource id from X.
- */
-
- sid = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreateStructure, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateStructure, pBuf, req);
-
- PEXStoreReqHead (CreateStructure, req);
- req->id = sid;
-
- END_REQUEST_HEADER (CreateStructure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (sid);
-}
-
-
-void
-PEXDestroyStructures (display, numStructures, structures)
-
-INPUT Display *display;
-INPUT unsigned long numStructures;
-INPUT PEXStructure *structures;
-
-{
- register pexDestroyStructuresReq *req;
- char *pBuf;
- int size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- size = numStructures * SIZEOF (pexStructure);
- PEXGetReqExtra (DestroyStructures, size, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyStructures, pBuf, req);
-
- PEXStoreReqExtraHead (DestroyStructures, size, req);
- req->numStructures = numStructures;
-
- END_REQUEST_HEADER (DestroyStructures, pBuf, req);
-
- STORE_LISTOF_CARD32 (numStructures, structures, pBuf);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCopyStructure (display, srcStructure, destStructure)
-
-INPUT Display *display;
-INPUT PEXStructure srcStructure;
-INPUT PEXStructure destStructure;
-
-{
- register pexCopyStructureReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CopyStructure, pBuf);
-
- BEGIN_REQUEST_HEADER (CopyStructure, pBuf, req);
-
- PEXStoreReqHead (CopyStructure, req);
- req->src = srcStructure;
- req->dst = destStructure;
-
- END_REQUEST_HEADER (CopyStructure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-Status
-PEXGetStructureInfo (display, structure, float_format,
- value_mask, info_return)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int float_format;
-INPUT unsigned long value_mask;
-OUTPUT PEXStructureInfo *info_return;
-
-{
- register pexGetStructureInfoReq *req;
- char *pBuf;
- pexGetStructureInfoReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetStructureInfo, pBuf);
-
- BEGIN_REQUEST_HEADER (GetStructureInfo, pBuf, req);
-
- PEXStoreReqHead (GetStructureInfo, req);
- req->fpFormat = float_format;
- req->sid = structure;
- req->itemMask = value_mask;
-
- END_REQUEST_HEADER (GetStructureInfo, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xTrue) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (0); /* return an error */
- }
-
-
- if (value_mask & PEXEditMode)
- info_return->edit_mode = rep.editMode;
- if (value_mask & PEXElementPtr)
- info_return->element_pointer = rep.elementPtr;
- if (value_mask & PEXNumElements)
- info_return->element_count = rep.numElements;
- if (value_mask & PEXLengthStructure)
- info_return->size = rep.lengthStructure;
- if (value_mask & PEXHasRefs)
- info_return->has_refs = rep.hasRefs;
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXGetElementInfo (display, structure, whence1, offset1, whence2, offset2,
- float_format, numElementInfoReturn, infoReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence1;
-INPUT long offset1;
-INPUT int whence2;
-INPUT long offset2;
-INPUT int float_format;
-OUTPUT unsigned long *numElementInfoReturn;
-OUTPUT PEXElementInfo **infoReturn;
-
-{
- register pexGetElementInfoReq *req;
- char *pBuf;
- pexGetElementInfoReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetElementInfo, pBuf);
-
- BEGIN_REQUEST_HEADER (GetElementInfo, pBuf, req);
-
- PEXStoreReqHead (GetElementInfo, req);
- req->fpFormat = float_format;
- req->sid = structure;
- req->position1_whence = whence1;
- req->position1_offset = offset1;
- req->position2_whence = whence2;
- req->position2_offset = offset2;
-
- END_REQUEST_HEADER (GetElementInfo, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numElementInfoReturn = 0;
- *infoReturn = NULL;
- return (0); /* return an error */
- }
-
- *numElementInfoReturn = rep.numInfo;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- *infoReturn = (PEXElementInfo *) Xmalloc (
- (unsigned) (sizeof (PEXElementInfo) * rep.numInfo));
-
- XREAD_LISTOF_ELEMINFO (display, rep.numInfo, (*infoReturn));
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-PEXStructure *
-PEXGetStructuresInNetwork (display, structure, which, numStructuresReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int which;
-OUTPUT unsigned long *numStructuresReturn;
-
-{
- register pexGetStructuresInNetworkReq *req;
- char *pBuf;
- pexGetStructuresInNetworkReply rep;
- PEXStructure *structsRet;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetStructuresInNetwork, pBuf);
-
- BEGIN_REQUEST_HEADER (GetStructuresInNetwork, pBuf, req);
-
- PEXStoreReqHead (GetStructuresInNetwork, req);
- req->sid = structure;
- req->which = which;
-
- END_REQUEST_HEADER (GetStructuresInNetwork, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numStructuresReturn = 0;
- return (NULL); /* return an error */
- }
-
- *numStructuresReturn = rep.numStructures;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- structsRet = (PEXStructure *) Xmalloc (
- (unsigned) (sizeof (PEXStructure) * rep.numStructures));
-
- XREAD_LISTOF_CARD32 (display, rep.numStructures, structsRet);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (structsRet);
-}
-
-
-PEXStructurePath *
-PEXGetAncestors (display, structure, pathPart, pathDepth, numPathsReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int pathPart;
-INPUT unsigned long pathDepth;
-OUTPUT unsigned long *numPathsReturn;
-
-{
- register pexGetAncestorsReq *req;
- char *pBuf, *pBufSave;
- pexGetAncestorsReply rep;
- PEXStructurePath *pStrucPath;
- PEXElementRef *pElemRef;
- int numElements;
- int i;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetAncestors, pBuf);
-
- BEGIN_REQUEST_HEADER (GetAncestors, pBuf, req);
-
- PEXStoreReqHead (GetAncestors, req);
- req->sid = structure;
- req->pathOrder = pathPart;
- req->pathDepth = pathDepth;
-
- END_REQUEST_HEADER (GetAncestors, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numPathsReturn = 0;
- return (NULL); /* return an error */
- }
-
- *numPathsReturn = rep.numPaths;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- pStrucPath = (PEXStructurePath *) Xmalloc (
- (unsigned) (rep.numPaths * sizeof (PEXStructurePath)));
-
- for (i = 0; i < rep.numPaths; i++)
- {
- EXTRACT_CARD32 (pBuf, numElements);
-
- pElemRef = (PEXElementRef *) Xmalloc (
- (unsigned) (numElements * sizeof (PEXElementRef)));
-
- EXTRACT_LISTOF_ELEMREF (numElements, pBuf, pElemRef);
-
- pStrucPath[i].count = numElements;
- pStrucPath[i].elements = pElemRef;
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pStrucPath);
-}
-
-
-
-PEXStructurePath *
-PEXGetDescendants (display, structure, pathPart, pathDepth, numPathsReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int pathPart;
-INPUT unsigned long pathDepth;
-OUTPUT unsigned long *numPathsReturn;
-
-{
- register pexGetDescendantsReq *req;
- char *pBuf, *pBufSave;
- pexGetDescendantsReply rep;
- PEXStructurePath *pStrucPath;
- PEXElementRef *pElemRef;
- int numElements;
- int i;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetDescendants, pBuf);
-
- BEGIN_REQUEST_HEADER (GetDescendants, pBuf, req);
-
- PEXStoreReqHead (GetDescendants, req);
- req->sid = structure;
- req->pathOrder = pathPart;
- req->pathDepth = pathDepth;
-
- END_REQUEST_HEADER (GetDescendants, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *numPathsReturn = 0;
- return (NULL); /* return an error */
- }
-
- *numPathsReturn = rep.numPaths;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer to pass the replies back to the client.
- */
-
- pStrucPath = (PEXStructurePath *) Xmalloc (
- (unsigned) (rep.numPaths * sizeof (PEXStructurePath)));
-
- for (i = 0; i < rep.numPaths; i++)
- {
- EXTRACT_CARD32 (pBuf, numElements);
-
- pElemRef = (PEXElementRef *) Xmalloc (
- (unsigned) (numElements * sizeof (PEXElementRef)));
-
- EXTRACT_LISTOF_ELEMREF (numElements, pBuf, pElemRef);
-
- pStrucPath[i].count = numElements;
- pStrucPath[i].elements = pElemRef;
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (pStrucPath);
-}
-
-
-Status
-PEXFetchElements (display, structure, whence1, offset1, whence2, offset2,
- float_format, numElementsReturn, sizeReturn, ocsReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence1;
-INPUT long offset1;
-INPUT int whence2;
-INPUT long offset2;
-INPUT int float_format;
-OUTPUT unsigned long *numElementsReturn;
-OUTPUT unsigned long *sizeReturn;
-OUTPUT char **ocsReturn;
-
-{
- register pexFetchElementsReq *req;
- char *pBuf;
- pexFetchElementsReply rep;
- long repSize;
- PEXOCData *oc_data;
- int server_float_format;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- server_float_format = PEXGetProtocolFloatFormat (display);
-
- PEXGetReq (FetchElements, pBuf);
-
- BEGIN_REQUEST_HEADER (FetchElements, pBuf, req);
-
- PEXStoreReqHead (FetchElements, req);
- req->fpFormat = server_float_format;
- req->sid = structure;
- req->position1_whence = whence1;
- req->position1_offset = offset1;
- req->position2_whence = whence2;
- req->position2_offset = offset2;
-
- END_REQUEST_HEADER (FetchElements, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *sizeReturn = *numElementsReturn = 0;
- *ocsReturn = NULL;
- return (0); /* return an error */
- }
-
- *numElementsReturn = rep.numElements;
-
- if (server_float_format != float_format)
- {
- /*
- * Convert from server's float format to the float format
- * specified by the application.
- */
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
-
- oc_data = PEXDecodeOCs (server_float_format, rep.numElements,
- rep.length << 2, pBuf);
-
- FINISH_WITH_SCRATCH (display, pBuf, rep.length << 2);
-
- *ocsReturn = PEXEncodeOCs (float_format, rep.numElements,
- oc_data, sizeReturn);
-
- PEXFreeOCData (rep.numElements, oc_data);
- }
- else
- {
- /*
- * No float conversion necessary.
- */
-
- *sizeReturn = repSize = rep.length << 2;
- if (*ocsReturn = (char *) Xmalloc ((unsigned) repSize))
- _XRead (display, *ocsReturn, (long) repSize);
- }
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXFetchElementsAndSend (display, structure,
- whence1, offset1, whence2, offset2, dstDisplay, resID, reqType)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence1;
-INPUT long offset1;
-INPUT int whence2;
-INPUT long offset2;
-INPUT Display *dstDisplay;
-INPUT XID resID;
-INPUT PEXOCRequestType reqType;
-
-{
- register pexFetchElementsReq *req;
- char *pBuf;
- pexFetchElementsReply rep;
- PEXDisplayInfo *srcDisplayInfo;
- PEXDisplayInfo *dstDisplayInfo;
- char *ocAddr;
- PEXOCData *oc_data;
- PEXEnumTypeDesc *srcFloats;
- PEXEnumTypeDesc *dstFloats;
- long bytesLeft;
- int getSize;
- int size;
- unsigned long oc_size;
- int i, j;
- int fp_match;
- int float_format;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Determine which floating point format to use.
- */
-
- PEXGetDisplayInfo (display, srcDisplayInfo);
- PEXGetDisplayInfo (dstDisplay, dstDisplayInfo);
-
- if (srcDisplayInfo->fpFormat == dstDisplayInfo->fpFormat)
- {
- float_format = dstDisplayInfo->fpFormat;
- fp_match = 1;
- }
- else
- {
- srcFloats = srcDisplayInfo->fpSupport;
- dstFloats = dstDisplayInfo->fpSupport;
-
- fp_match = 0;
- for (i = 0; i < dstDisplayInfo->fpCount && !fp_match; i++)
- for (j = 0; j < srcDisplayInfo->fpCount; j++)
- {
- if (dstFloats[i].index == srcFloats[j].index)
- {
- float_format = dstFloats[i].index;
- fp_match = 1;
- break;
- }
- }
-
- if (!fp_match)
- {
- /*
- * Will have to convert from source display float format to
- * destination display float format.
- */
-
- float_format = srcDisplayInfo->fpFormat;
- }
- }
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (FetchElements, pBuf);
-
- BEGIN_REQUEST_HEADER (FetchElements, pBuf, req);
-
- PEXStoreReqHead (FetchElements, req);
- req->fpFormat = float_format;
- req->sid = structure;
- req->position1_whence = whence1;
- req->position1_offset = offset1;
- req->position2_whence = whence2;
- req->position2_offset = offset2;
-
- END_REQUEST_HEADER (FetchElements, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (0); /* return an error */
- }
-
-
- /*
- * If no floating point conversion has to take place, fetch the element
- * info directly into the destination display connection.
- */
-
- if (fp_match)
- {
- if (display == dstDisplay)
- UnlockDisplay (display);
-
- if (PEXStartOCs (dstDisplay, resID, reqType, float_format,
- rep.numElements, rep.length))
- {
- bytesLeft = rep.length << 2;
- getSize = PEXGetOCAddrMaxSize (dstDisplay);
-
- while (bytesLeft > 0)
- {
- size = bytesLeft < getSize ? bytesLeft : getSize;
- ocAddr = PEXGetOCAddr (dstDisplay, size);
- _XRead (display, ocAddr, (long) size);
- bytesLeft -= size;
- }
-
- PEXFinishOCs (dstDisplay);
- }
-
- if (display != dstDisplay)
- UnlockDisplay (display);
- }
- else
- {
- /*
- * Floating point conversion necessary.
- */
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
-
- oc_data = PEXDecodeOCs (float_format, rep.numElements,
- rep.length << 2, pBuf);
-
- FINISH_WITH_SCRATCH (display, pBuf, rep.length << 2);
-
- pBuf = PEXEncodeOCs (dstDisplayInfo->fpFormat, rep.numElements,
- oc_data, &oc_size);
-
- PEXFreeOCData (rep.numElements, oc_data);
-
- if (display == dstDisplay)
- UnlockDisplay (display);
-
- PEXSendOCs (dstDisplay, resID, reqType, dstDisplayInfo->fpFormat,
- rep.numElements, oc_size, pBuf);
-
- if (display != dstDisplay)
- UnlockDisplay (display);
- }
-
- PEXSyncHandle (dstDisplay);
-
- return (1);
-}
-
-
-void
-PEXSetEditingMode (display, structure, mode)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int mode;
-
-{
- register pexSetEditingModeReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetEditingMode, pBuf);
-
- BEGIN_REQUEST_HEADER (SetEditingMode, pBuf, req);
-
- PEXStoreReqHead (SetEditingMode, req);
- req->sid = structure;
- req->mode = mode;
-
- END_REQUEST_HEADER (SetEditingMode, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetElementPtr (display, structure, whence, offset)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence;
-INPUT long offset;
-
-{
- register pexSetElementPointerReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetElementPointer, pBuf);
-
- BEGIN_REQUEST_HEADER (SetElementPointer, pBuf, req);
-
- PEXStoreReqHead (SetElementPointer, req);
- req->sid = structure;
- req->position_whence = whence;
- req->position_offset = offset;
-
- END_REQUEST_HEADER (SetElementPointer, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetElementPtrAtLabel (display, structure, label, offset)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT long label;
-INPUT long offset;
-
-{
- register pexSetElementPointerAtLabelReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetElementPointerAtLabel, pBuf);
-
- BEGIN_REQUEST_HEADER (SetElementPointerAtLabel, pBuf, req);
-
- PEXStoreReqHead (SetElementPointerAtLabel, req);
- req->sid = structure;
- req->label = label;
- req->offset = offset;
-
- END_REQUEST_HEADER (SetElementPointerAtLabel, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-Status
-PEXElementSearch (display, structure, whence, offset, direction,
- numIncl, inclList, numExcl, exclList, offsetReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence;
-INPUT long offset;
-INPUT int direction;
-INPUT unsigned long numIncl;
-INPUT unsigned short *inclList;
-INPUT unsigned long numExcl;
-INPUT unsigned short *exclList;
-OUTPUT unsigned long *offsetReturn;
-
-{
- register pexElementSearchReq *req;
- char *pBuf;
- pexElementSearchReply rep;
- int size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- size = SIZEOF (CARD16) *
- (numIncl + (numIncl & 1) + numExcl + (numExcl & 1));
-
- PEXGetReqExtra (ElementSearch, size, pBuf);
-
- BEGIN_REQUEST_HEADER (ElementSearch, pBuf, req);
-
- PEXStoreReqExtraHead (ElementSearch, size, req);
- req->sid = structure;
- req->position_whence = whence;
- req->position_offset = offset;
- req->direction = direction;
- req->numIncls = numIncl;
- req->numExcls = numExcl;
-
- END_REQUEST_HEADER (ElementSearch, pBuf, req);
-
- STORE_LISTOF_CARD16 (numIncl, inclList, pBuf);
- pBuf += ((numIncl & 1) * SIZEOF (CARD16));
- STORE_LISTOF_CARD16 (numExcl, exclList, pBuf);
-
- if (_XReply (display, (xReply *)&rep, 0, xTrue) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *offsetReturn = 0;
- return (0); /* return an error */
- }
-
- *offsetReturn = rep.foundOffset;
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (rep.status);
-}
-
-
-void
-PEXDeleteElements (display, structure, whence1, offset1, whence2, offset2)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence1;
-INPUT long offset1;
-INPUT int whence2;
-INPUT long offset2;
-
-{
- register pexDeleteElementsReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (DeleteElements, pBuf);
-
- BEGIN_REQUEST_HEADER (DeleteElements, pBuf, req);
-
- PEXStoreReqHead (DeleteElements, req);
- req->sid = structure;
- req->position1_whence = whence1;
- req->position1_offset = offset1;
- req->position2_whence = whence2;
- req->position2_offset = offset2;
-
- END_REQUEST_HEADER (DeleteElements, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXDeleteToLabel (display, structure, whence, offset, label)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT int whence;
-INPUT long offset;
-INPUT long label;
-
-{
- register pexDeleteElementsToLabelReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (DeleteElementsToLabel, pBuf);
-
- BEGIN_REQUEST_HEADER (DeleteElementsToLabel, pBuf, req);
-
- PEXStoreReqHead (DeleteElementsToLabel, req);
- req->sid = structure;
- req->position_whence = whence;
- req->position_offset = offset;
- req->label = label;
-
- END_REQUEST_HEADER (DeleteElementsToLabel, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXDeleteBetweenLabels (display, structure, label1, label2)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-INPUT long label1;
-INPUT long label2;
-
-{
- register pexDeleteBetweenLabelsReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (DeleteBetweenLabels, pBuf);
-
- BEGIN_REQUEST_HEADER (DeleteBetweenLabels, pBuf, req);
-
- PEXStoreReqHead (DeleteBetweenLabels, req);
- req->sid = structure;
- req->label1 = label1;
- req->label2 = label2;
-
- END_REQUEST_HEADER (DeleteBetweenLabels, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXCopyElements (display, srcStructure, srcWhence1, srcOffset1, srcWhence2,
- srcOffset2, destStructure, destWhence, destOffset)
-
-INPUT Display *display;
-INPUT PEXStructure srcStructure;
-INPUT int srcWhence1;
-INPUT long srcOffset1;
-INPUT int srcWhence2;
-INPUT long srcOffset2;
-INPUT PEXStructure destStructure;
-INPUT int destWhence;
-INPUT long destOffset;
-
-{
- register pexCopyElementsReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CopyElements, pBuf);
-
- BEGIN_REQUEST_HEADER (CopyElements, pBuf, req);
-
- PEXStoreReqHead (CopyElements, req);
- req->src = srcStructure;
- req->srcPosition1_whence = srcWhence1;
- req->srcPosition1_offset = srcOffset1;
- req->srcPosition2_whence = srcWhence2;
- req->srcPosition2_offset = srcOffset2;
- req->dst = destStructure;
- req->dstPosition_whence = destWhence;
- req->dstPosition_offset = destOffset;
-
- END_REQUEST_HEADER (CopyElements, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXChangeStructureRefs (display, oldStructure, newStructure)
-
-INPUT Display *display;
-INPUT PEXStructure oldStructure;
-INPUT PEXStructure newStructure;
-
-{
- register pexChangeStructureRefsReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (ChangeStructureRefs, pBuf);
-
- BEGIN_REQUEST_HEADER (ChangeStructureRefs, pBuf, req);
-
- PEXStoreReqHead (ChangeStructureRefs, req);
- req->old_id = oldStructure;
- req->new_id = newStructure;
-
- END_REQUEST_HEADER (ChangeStructureRefs, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
diff --git a/xc/lib/PEX5/pl_util.c b/xc/lib/PEX5/pl_util.c
deleted file mode 100644
index 11b8678dc..000000000
--- a/xc/lib/PEX5/pl_util.c
+++ /dev/null
@@ -1,3279 +0,0 @@
-/* $TOG: pl_util.c /main/12 1998/02/06 16:12:27 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.
-
-
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-
- All Rights Reserved
-
-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 Digital not be used in advertising or publicity
-pertaining to distribution of the software without specific, written prior
-permission. Digital make no representations about the suitability
-of this software for any purpose. It is provided "as is" without express or
-implied warranty.
-
-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 <math.h>
-#include "PEXlib.h"
-#include "PEXlibint.h"
-#include "pl_util.h"
-#include "pl_oc_util.h"
-
-
-int
-PEXRotate (axis, angle, matrix_return)
-
-INPUT int axis;
-INPUT double angle;
-OUTPUT PEXMatrix matrix_return;
-
-{
- double sine;
- double cosine;
-
- sine = sin (angle);
- cosine = cos (angle);
-
- switch (axis)
- {
- case PEXXAxis:
- matrix_return[0][0] = 1.0;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
- matrix_return[0][3] = 0.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = cosine;
- matrix_return[1][2] = -sine;
- matrix_return[1][3] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = sine;
- matrix_return[2][2] = cosine;
- matrix_return[2][3] = 0.0;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
- break;
-
- case PEXYAxis:
- matrix_return[0][0] = cosine;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = sine;
- matrix_return[0][3] = 0.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0;
- matrix_return[1][2] = 0.0;
- matrix_return[1][3] = 0.0;
-
- matrix_return[2][0] = -sine;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = cosine;
- matrix_return[2][3] = 0.0;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
- break;
-
- case PEXZAxis:
- matrix_return[0][0] = cosine;
- matrix_return[0][1] = -sine;
- matrix_return[0][2] = 0.0;
- matrix_return[0][3] = 0.0;
-
- matrix_return[1][0] = sine;
- matrix_return[1][1] = cosine;
- matrix_return[1][2] = 0.0;
- matrix_return[1][3] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
- matrix_return[2][3] = 0.0;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
- break;
-
- default:
- return (PEXBadAxis); /* error - invalid axis specifier */
- }
-
- return (0);
-}
-
-
-void
-PEXRotate2D (angle, matrix_return)
-
-INPUT double angle;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- double sine;
- double cosine;
-
- sine = sin (angle);
- cosine = cos (angle);
-
- matrix_return[0][0] = cosine;
- matrix_return[0][1] = -sine;
- matrix_return[0][2] = 0.0;
-
- matrix_return[1][0] = sine;
- matrix_return[1][1] = cosine;
- matrix_return[1][2] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
-}
-
-
-int
-PEXRotateGeneral (point1, point2, angle, matrix_return)
-
-INPUT PEXCoord *point1;
-INPUT PEXCoord *point2;
-INPUT double angle;
-OUTPUT PEXMatrix matrix_return;
-
-{
- PEXMatrix preMatrix, calcMatrix, postMatrix, tempMatrix;
- PEXCoord diff, rot;
- float dist, temp, s;
- double sine, cosine;
- int i, j;
-
- /*
- * The matrix is calculated as preMatrix * calcMatrix * postMatrix
- * where postMatrix translates by point1 and preMatrix translates back
- * by point1 and calcMatrix does the real work.
- */
-
- preMatrix[0][0] = 1.0;
- preMatrix[0][1] = 0.0;
- preMatrix[0][2] = 0.0;
- preMatrix[0][3] = point1->x;
-
- preMatrix[1][0] = 0.0;
- preMatrix[1][1] = 1.0;
- preMatrix[1][2] = 0.0;
- preMatrix[1][3] = point1->y;
-
- preMatrix[2][0] = 0.0;
- preMatrix[2][1] = 0.0;
- preMatrix[2][2] = 1.0;
- preMatrix[2][3] = point1->z;
-
- preMatrix[3][0] = 0.0;
- preMatrix[3][1] = 0.0;
- preMatrix[3][2] = 0.0;
- preMatrix[3][3] = 1.0;
-
-
- postMatrix[0][0] = 1.0;
- postMatrix[0][1] = 0.0;
- postMatrix[0][2] = 0.0;
- postMatrix[0][3] = -(point1->x);
-
- postMatrix[1][0] = 0.0;
- postMatrix[1][1] = 1.0;
- postMatrix[1][2] = 0.0;
- postMatrix[1][3] = -(point1->y);
-
- postMatrix[2][0] = 0.0;
- postMatrix[2][1] = 0.0;
- postMatrix[2][2] = 1.0;
- postMatrix[2][3] = -(point1->z);
-
- postMatrix[3][0] = 0.0;
- postMatrix[3][1] = 0.0;
- postMatrix[3][2] = 0.0;
- postMatrix[3][3] = 1.0;
-
-
- /*
- * Compute calcMatrix
- */
-
- diff.x = point2->x - point1->x;
- diff.y = point2->y - point1->y;
- diff.z = point2->z - point1->z;
-
- dist = sqrt (diff.x * diff.x + diff.y * diff.y + diff.z * diff.z);
-
- if (NEAR_ZERO (dist))
- return (PEXBadAxis);
-
- rot.x = diff.x = diff.x / dist; /* normalize rotation vector */
- rot.y = diff.y = diff.y / dist;
- rot.z = diff.z = diff.z / dist;
-
- rot.x = rot.x * rot.x; /* square it */
- rot.y = rot.y * rot.y;
- rot.z = rot.z * rot.z;
-
- cosine = cos (angle);
- sine = sin (angle);
-
- calcMatrix[0][0] = rot.x + cosine * (1.0 - rot.x);
- calcMatrix[1][1] = rot.y + cosine * (1.0 - rot.y);
- calcMatrix[2][2] = rot.z + cosine * (1.0 - rot.z);
-
- temp = diff.x * diff.y * (1.0 - cosine);
- s = sine * diff.z;
-
- calcMatrix[1][0] = temp - s;
- calcMatrix[0][1] = temp + s;
-
- temp = diff.x * diff.z * (1.0 - cosine);
- s = sine * diff.y;
-
- calcMatrix[2][0] = temp + s;
- calcMatrix[0][2] = temp - s;
-
- temp = diff.y * diff.z * (1.0 - cosine);
- s = sine * diff.x;
-
- calcMatrix[2][1] = temp - s;
- calcMatrix[1][2] = temp + s;
-
- calcMatrix[0][3] = 0.0;
- calcMatrix[1][3] = 0.0;
- calcMatrix[2][3] = 0.0;
- calcMatrix[3][0] = 0.0;
- calcMatrix[3][1] = 0.0;
- calcMatrix[3][2] = 0.0;
- calcMatrix[3][3] = 1.0;
-
-
- /* Multiply preMatrix by calcMatrix */
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- tempMatrix[i][j] = preMatrix[i][0] * calcMatrix[0][j] +
- preMatrix[i][1] * calcMatrix[1][j] +
- preMatrix[i][2] * calcMatrix[2][j] +
- preMatrix[i][3] * calcMatrix[3][j];
- }
- }
-
-
- /* Multiply by postMatrix and return the new matrix */
-
- for (i = 0; i < 4; i++)
- {
- for (j = 0; j < 4; j++)
- {
- matrix_return[i][j] = tempMatrix[i][0] * postMatrix[0][j] +
- tempMatrix[i][1] * postMatrix[1][j] +
- tempMatrix[i][2] * postMatrix[2][j] +
- tempMatrix[i][3] * postMatrix[3][j];
- }
- }
-
- return (0);
-}
-
-
-void
-PEXScale (scale_vector, matrix_return)
-
-INPUT PEXVector *scale_vector;
-OUTPUT PEXMatrix matrix_return;
-
-{
- matrix_return[0][0] = scale_vector->x;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
- matrix_return[0][3] = 0.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = scale_vector->y;
- matrix_return[1][2] = 0.0;
- matrix_return[1][3] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = scale_vector->z;
- matrix_return[2][3] = 0.0;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-}
-
-
-void
-PEXScale2D (scale_vector, matrix_return)
-
-INPUT PEXVector2D *scale_vector;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- matrix_return[0][0] = scale_vector->x;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = scale_vector->y;
- matrix_return[1][2] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
-}
-
-
-void
-PEXTranslate (trans_vector, matrix_return)
-
-INPUT PEXVector *trans_vector;
-OUTPUT PEXMatrix matrix_return;
-
-{
- matrix_return[0][0] = 1.0;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
- matrix_return[0][3] = trans_vector->x;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0;
- matrix_return[1][2] = 0.0;
- matrix_return[1][3] = trans_vector->y;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
- matrix_return[2][3] = trans_vector->z;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-}
-
-
-void
-PEXTranslate2D (trans_vector, matrix_return)
-
-INPUT PEXVector2D *trans_vector;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- matrix_return[0][0] = 1.0;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = trans_vector->x;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0;
- matrix_return[1][2] = trans_vector->y;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
-}
-
-
-void
-PEXMatrixMult (matrix1, matrix2, matrix_return)
-
-INPUT PEXMatrix matrix1;
-INPUT PEXMatrix matrix2;
-OUTPUT PEXMatrix matrix_return;
-
-{
- register float *r;
- register int i;
-
- if ((matrix_return != matrix1) && (matrix_return != matrix2))
- {
- for (i = 0; i < 4; i++)
- {
- r = matrix1[i];
- matrix_return[i][0] = r[0] * matrix2[0][0] + r[1] * matrix2[1][0] +
- r[2] * matrix2[2][0] + r[3] * matrix2[3][0];
- matrix_return[i][1] = r[0] * matrix2[0][1] + r[1] * matrix2[1][1] +
- r[2] * matrix2[2][1] + r[3] * matrix2[3][1];
- matrix_return[i][2] = r[0] * matrix2[0][2] + r[1] * matrix2[1][2] +
- r[2] * matrix2[2][2] + r[3] * matrix2[3][2];
- matrix_return[i][3] = r[0] * matrix2[0][3] + r[1] * matrix2[1][3] +
- r[2] * matrix2[2][3] + r[3] * matrix2[3][3];
- }
- }
- else
- {
- register float *src, *dst;
- PEXMatrix temp;
-
- for (i = 0; i < 4; i++)
- {
- r = matrix1[i];
- temp[i][0] = r[0] * matrix2[0][0] + r[1] * matrix2[1][0] +
- r[2] * matrix2[2][0] + r[3] * matrix2[3][0];
- temp[i][1] = r[0] * matrix2[0][1] + r[1] * matrix2[1][1] +
- r[2] * matrix2[2][1] + r[3] * matrix2[3][1];
- temp[i][2] = r[0] * matrix2[0][2] + r[1] * matrix2[1][2] +
- r[2] * matrix2[2][2] + r[3] * matrix2[3][2];
- temp[i][3] = r[0] * matrix2[0][3] + r[1] * matrix2[1][3] +
- r[2] * matrix2[2][3] + r[3] * matrix2[3][3];
- }
-
- src = (float *) temp;
- dst = (float *) matrix_return;
- for (i = 0; i < 16; i++)
- *dst++ = *src++;
- }
-}
-
-
-void
-PEXMatrixMult2D (matrix1, matrix2, matrix_return)
-
-INPUT PEXMatrix3x3 matrix1;
-INPUT PEXMatrix3x3 matrix2;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- register float *r;
- register int i;
-
- if ((matrix_return != matrix1) && (matrix_return != matrix2))
- {
- for (i = 0; i < 3; i++)
- {
- r = matrix1[i];
- matrix_return[i][0] = r[0] * matrix2[0][0] + r[1] * matrix2[1][0] +
- r[2] * matrix2[2][0];
- matrix_return[i][1] = r[0] * matrix2[0][1] + r[1] * matrix2[1][1] +
- r[2] * matrix2[2][1];
- matrix_return[i][2] = r[0] * matrix2[0][2] + r[1] * matrix2[1][2] +
- r[2] * matrix2[2][2];
- }
- }
- else
- {
- register float *src, *dst;
- PEXMatrix3x3 temp;
-
- for (i = 0; i < 3; i++)
- {
- r = matrix1[i];
- temp[i][0] = r[0] * matrix2[0][0] + r[1] * matrix2[1][0] +
- r[2] * matrix2[2][0];
- temp[i][1] = r[0] * matrix2[0][1] + r[1] * matrix2[1][1] +
- r[2] * matrix2[2][1];
- temp[i][2] = r[0] * matrix2[0][2] + r[1] * matrix2[1][2] +
- r[2] * matrix2[2][2];
- }
-
- src = (float *) temp;
- dst = (float *) matrix_return;
- for (i = 0; i < 9; i++)
- *dst++ = *src++;
- }
-}
-
-
-void
-PEXBuildTransform (fixed_point, trans_vector, angle_x, angle_y, angle_z,
- scale_vector, matrix_return)
-
-INPUT PEXCoord *fixed_point;
-INPUT PEXVector *trans_vector;
-INPUT double angle_x;
-INPUT double angle_y;
-INPUT double angle_z;
-INPUT PEXVector *scale_vector;
-OUTPUT PEXMatrix matrix_return;
-
-{
- /*
- * Translate fixed_point to the origin, scale, rotate, translate back
- * to fixed_point, then apply trans_vector:
- *
- * T * Tf~ * Rz * Ry * Rx * S * Tf.
- *
- * where: T is the "trans_vector" transform,
- * Tf ia the translation of fixed_point to the origin and
- * Tf~ is it's inverse,
- * Ri is the rotation transform about the i'th axis,
- * S is the scaling transform.
- */
-
- register float cz, sz, cx, sx, cy, sy;
- register float *r;
-
- cx = cos (angle_x); sx = sin (angle_x);
- cy = cos (angle_y); sy = sin (angle_y);
- cz = cos (angle_z); sz = sin (angle_z);
-
- r = matrix_return[0];
- r[0] = cz * cy * scale_vector->x;
- r[1] = (cz * sx * sy - sz * cx) * scale_vector->y;
- r[2] = (cz * sy * cx + sz * sx) * scale_vector->z;
- r[3] = trans_vector->x + fixed_point->x -
- (r[0] * fixed_point->x + r[1] * fixed_point->y +
- r[2] * fixed_point->z);
-
- r = matrix_return[1];
- r[0] = sz * cy * scale_vector->x;
- r[1] = (sz * sx * sy + cz * cx) * scale_vector->y;
- r[2] = (sz * sy * cx - cz * sx) * scale_vector->z;
- r[3] = trans_vector->y + fixed_point->y -
- (r[0] * fixed_point->x + r[1] * fixed_point->y +
- r[2] * fixed_point->z);
-
- r = matrix_return[2];
- r[0] = -sy * scale_vector->x;
- r[1] = cy * sx * scale_vector->y;
- r[2] = cy * cx * scale_vector->z;
- r[3] = trans_vector->z + fixed_point->z -
- (r[0] * fixed_point->x + r[1] * fixed_point->y +
- r[2] * fixed_point->z);
-
- r = matrix_return[3];
- r[0] = r[1] = r[2] = 0.0;
- r[3] = 1.0;
-}
-
-
-void
-PEXBuildTransform2D (fixed_point, trans_vector, angle_z,
- scale_vector, matrix_return)
-
-INPUT PEXCoord2D *fixed_point;
-INPUT PEXVector2D *trans_vector;
-INPUT double angle_z;
-INPUT PEXVector2D *scale_vector;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- /*
- * Translate fixed_point to the origin, scale, rotate, translate back
- * to fixed_point, then apply trans_vector:
- *
- * T * Tf~ * R * S * Tf.
- *
- * where: T is the "trans_vector" transform,
- * Tf ia the translation of fixed_point to the origin and
- * Tf~ is it's inverse,
- * R is the rotation transform,
- * S is the scaling transform.
- */
-
- register float *r;
- register float c, s;
-
- c = cos (angle_z);
- s = sin (angle_z);
-
- r = matrix_return[0];
- r[0] = c * scale_vector->x;
- r[1] = -s * scale_vector->y;
- r[2] = trans_vector->x + fixed_point->x -
- c * scale_vector->x * fixed_point->x +
- s * scale_vector->y * fixed_point->y;
-
- r = matrix_return[1];
- r[0] = s * scale_vector->x;
- r[1] = c * scale_vector->y;
- r[2] = trans_vector->y + fixed_point->y -
- (s * scale_vector->x * fixed_point->x +
- c * scale_vector->y * fixed_point->y);
-
- r = matrix_return[2];
- r[0] = r[1] = 0.0;
- r[2] = 1.0;
-}
-
-
-int
-PEXViewOrientationMatrix (vrp, vpn, vup, matrix_return)
-
-INPUT PEXCoord *vrp;
-INPUT PEXVector *vpn;
-INPUT PEXVector *vup;
-OUTPUT PEXMatrix matrix_return;
-
-{
- /*
- * Translate to VRP then change the basis.
- * The old basis is: e1 = < 1, 0, 0>, e2 = < 0, 1, 0>, e3 = < 0, 0, 1>.
- * The new basis is: ("x" means cross product)
- * e3' = VPN / |VPN|
- * e1' = VUP x VPN / |VUP x VPN|
- * e2' = e3' x e1'
- * Therefore the transform from old to new is x' = ATx, where:
- *
- * | e1' 0 | | 1 0 0 -vrp.x |
- * A = | |, T = | 0 1 0 -vrp.y |
- * | e2' 0 | | 0 0 1 -vrp.z |
- * | | | 0 0 0 1 |
- * | e3' 0 |
- * | |
- * | -0- 1|
- */
-
- /* These ei's are really ei primes. */
- float *e1 = matrix_return[0],
- *e2 = matrix_return[1],
- *e3 = matrix_return[2];
- double s, mag_vpn;
-
- if (ZERO_MAG (mag_vpn = MAG_V3 (vpn)))
- {
- return (PEXBadVector);
- }
- else if (ZERO_MAG (MAG_V3 (vup)))
- {
- return (PEXBadVector);
- }
- else
- {
- /*
- * e1' = VUP x VPN / |VUP x VPN|, but do the division later.
- */
-
- e1[0] = vup->y * vpn->z - vup->z * vpn->y;
- e1[1] = vup->z * vpn->x - vup->x * vpn->z;
- e1[2] = vup->x * vpn->y - vup->y * vpn->x;
-
- s = sqrt (e1[0] * e1[0] + e1[1] * e1[1] + e1[2] * e1[2]);
-
-
- /*
- * Check for vup and vpn colinear (zero dot product).
- */
-
- if (ZERO_MAG (s))
- return (PEXBadVectors);
- }
-
-
- /*
- * Normalize e1
- */
-
- s = 1.0 / s;
- e1[0] *= s; e1[1] *= s; e1[2] *= s;
-
-
- /*
- * e3 = VPN / |VPN|
- */
-
- s = 1.0 / mag_vpn;
- e3[0] = s * vpn->x; e3[1] = s * vpn->y; e3[2] = s * vpn->z;
-
-
- /*
- * e2 = e3 x e1
- */
-
- e2[0] = e3[1] * e1[2] - e3[2] * e1[1];
- e2[1] = e3[2] * e1[0] - e3[0] * e1[2];
- e2[2] = e3[0] * e1[1] - e3[1] * e1[0];
-
-
- /*
- * Add the translation
- */
-
- e1[3] = -(e1[0] * vrp->x + e1[1] * vrp->y + e1[2] * vrp->z);
- e2[3] = -(e2[0] * vrp->x + e2[1] * vrp->y + e2[2] * vrp->z);
- e3[3] = -(e3[0] * vrp->x + e3[1] * vrp->y + e3[2] * vrp->z);
-
-
- /*
- * Homogeneous entries
- */
-
- matrix_return[3][0] = matrix_return[3][1] = matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXViewOrientationMatrix2D (vrp, vup, matrix_return)
-
-INPUT PEXCoord2D *vrp;
-INPUT PEXVector2D *vup;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- /*
- * The old basis is: e1 = < 1, 0>, e2 = < 0, 1>
- * The new basis is: e1' = < vup.y, -vup.x> / |vup|, e2' = vup / |vup|.
- * Therefore the transform for old to new is x' = ATx, where:
- *
- * | e1' 0 | | 1 0 -vrp.x |
- * A = | |, T = | 0 1 -vrp.y |
- * | e2' 0 | | 0 0 1 |
- * | |
- * | -0- 1|
- */
-
- register double s;
-
- if (ZERO_MAG (s = MAG_V2 (vup)))
- {
- return (PEXBadVector);
- }
- else
- {
- /*
- * Compute the new basis, note that matrix_return[0] is e1'
- * and matrix_return[1] is e2'.
- */
-
- s = 1.0 / s;
- matrix_return[0][0] = s * vup->y;
- matrix_return[0][1] = s * -vup->x;
- matrix_return[1][0] = s * vup->x;
- matrix_return[1][1] = s * vup->y;
-
-
- /*
- * Add the translation
- */
-
- matrix_return[0][2] = -(matrix_return[0][0] * vrp->x +
- matrix_return[0][1] * vrp->y);
- matrix_return[1][2] = -(matrix_return[1][0] * vrp->x +
- matrix_return[1][1] * vrp->y);
-
-
- /*
- * Homogeneous entries
- */
-
- matrix_return[2][0] = matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
-
- return (0);
- }
-}
-
-
-int
-PEXViewMappingMatrix (frame, viewport, perspective, prp, view_plane,
- back_plane, front_plane, matrix_return)
-
-INPUT PEXCoord2D *frame;
-INPUT PEXNPCSubVolume *viewport;
-INPUT int perspective;
-INPUT PEXCoord *prp;
-INPUT double view_plane;
-INPUT double back_plane;
-INPUT double front_plane;
-OUTPUT PEXMatrix matrix_return;
-
-{
- /*
- * Procedure:
- *
- * (Perspective):
- * - Translate to PRP, Tc
- * - Convert to left handed coords, Tlr
- * - Shear, H
- * - Scale to canonical view volume, S
- * - Normalize perspective view volume, Ntp
- * - Scale to viewport, Svp
- * - Convert to right handed coords, Tlr
- * - Translate to viewport, Tvp
- *
- * (Parallel):
- * - Translate to view plane, Tc
- * - Shear about the view plane, H
- * - Translate back, Tc inverse
- * - Translate frame to origin, Tl
- * - Scale to canonical view volume, S
- * - Scale to viewport, Svp
- * - Translate to viewport, Tvp
- */
-
- double dx = viewport->max.x - viewport->min.x;
- double dy = viewport->max.y - viewport->min.y;
- double dz = viewport->max.z - viewport->min.z;
- double vvz = front_plane - back_plane;
- double sz, sx, sy;
- double hx, hy;
- double d;
- double zf;
- float *r;
-
- if (!(frame[0].x < frame[1].x) || !(frame[0].y < frame[1].y))
- {
- return (PEXBadLimits);
- }
- else if (!(viewport->min.x < viewport->max.x) ||
- !(viewport->min.y < viewport->max.y) ||
- !(viewport->min.z <= viewport->max.z))
- {
- return (PEXBadViewport);
- }
- else if (NEAR_ZERO (vvz) && viewport->min.z != viewport->max.z)
- {
- return (PEXBadPlanes);
- }
- else if (perspective && prp->z < front_plane && prp->z > back_plane)
- {
- return (PEXBadPlanes);
- }
- else if (prp->z == view_plane)
- {
- return (PEXBadPRP);
- }
- else if (front_plane < back_plane)
- {
- return (PEXBadPlanes);
- }
- else if (!IN_RANGE (0.0, 1.0, viewport->min.x) ||
- !IN_RANGE (0.0, 1.0, viewport->max.x) ||
- !IN_RANGE (0.0, 1.0, viewport->min.y) ||
- !IN_RANGE (0.0, 1.0, viewport->max.y) ||
- !IN_RANGE (0.0, 1.0, viewport->min.z) ||
- !IN_RANGE (0.0, 1.0, viewport->max.z))
- {
- return (PEXBadViewport);
- }
-
- if (perspective)
- {
- d = prp->z - view_plane;
- sz = 1.0 / (prp->z - back_plane);
- sx = sz * d * 2.0 / (frame[1].x - frame[0].x);
- sy = sz * d * 2.0 / (frame[1].y - frame[0].y);
- hx = (prp->x - 0.5 * (frame[0].x + frame[1].x)) / d;
- hy = (prp->y - 0.5 * (frame[0].y + frame[1].y)) / d;
-
- r = matrix_return[0];
- r[0] = 0.5 * dx * sx;
- r[1] = 0.0;
- r[2] = -(0.5 * dx * (sx * hx + sz) + sz * viewport->min.x);
- r[3] = -(0.5 * dx * sx * (prp->x - hx * prp->z) -
- sz * prp->z * (0.5 * dx + viewport->min.x));
-
- r = matrix_return[1];
- r[0] = 0.0;
- r[1] = 0.5 * dy * sy;
- r[2] = -(0.5 * dy * (sy * hy + sz) + sz * viewport->min.y);
- r[3] = -(0.5 * dy * sy * (prp->y - hy * prp->z) -
- sz * prp->z * (0.5 * dy + viewport->min.y));
-
- r = matrix_return[2];
- r[0] = r[1] = 0.0;
- zf = (prp->z - front_plane) / (prp->z - back_plane);
- if (NEAR_ZERO (1.0 - zf))
- {
- r[2] = 0.0;
- r[3] = sz * prp->z * viewport->max.z;
- }
- else
- {
- r[2] = sz * ((dz / (1.0 - zf)) - viewport->max.z);
- r[3] = sz * prp->z * viewport->max.z -
- (dz / (1.0 - zf)) * (sz * prp->z - zf);
- }
-
- r = matrix_return[3];
- r[0] = r[1] = 0.0;
- r[2] = -sz;
- r[3] = sz * prp->z;
- }
- else
- { /* parallel */
- sx = dx / (frame[1].x - frame[0].x);
- sy = dy / (frame[1].y - frame[0].y);
- hx = (prp->x - 0.5 * (frame[0].x + frame[1].x)) /
- (view_plane - prp->z);
- hy = (prp->y - 0.5 * (frame[0].y + frame[1].y)) /
- (view_plane - prp->z);
-
- r = matrix_return[0];
- r[0] = sx;
- r[1] = 0.0;
- r[2] = sx * hx;
- r[3] = viewport->min.x - sx * (hx * view_plane + frame[0].x);
-
- r = matrix_return[1];
- r[0] = 0.0;
- r[1] = sy;
- r[2] = sy * hy;
- r[3] = viewport->min.y - sy * (hy * view_plane + frame[0].y);
-
- r = matrix_return[2];
- r[0] = r[1] = 0.0;
- if (NEAR_ZERO (vvz))
- r[2] = 0.0;
- else
- r[2] = dz / vvz;
- r[3] = viewport->min.z - r[2] * back_plane;
-
- r = matrix_return[3];
- r[0] = r[1] = r[2] = 0.0;
- r[3] = 1.0;
- }
-
- return (0);
-}
-
-
-int
-PEXViewMappingMatrix2D (frame, viewport, matrix_return)
-
-INPUT PEXCoord2D *frame;
-INPUT PEXCoord2D *viewport;
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- /*
- * 1. Translate frame's lower-left-corner to 0,0.
- * 2. Scale size of frame to size of viewport.
- * 3. Translate 0,0 to viewport's lower-left-corner.
- *
- * Matrices are:
- *
- * 1: 1 0 -frame[0].x 2: scale.x 0 0 3: 1 0 viewport[0].x
- * 0 1 -frame[0].y 0 scale.y 0 0 1 viewport[0].y
- * 0 0 1 0 0 1 0 0 1
- */
-
- /* scale factors: len (viewport) / len (frame) */
- register float sx, sy;
-
-
- if (!(frame[0].x < frame[1].x) || !(frame[0].y < frame[1].y))
- {
- return (PEXBadLimits);
- }
- else if (!(viewport[0].x < viewport[1].x) ||
- !(viewport[0].y < viewport[1].y))
- {
- return (PEXBadViewport);
- }
- else if (!IN_RANGE (0.0, 1.0, viewport[0].x) ||
- !IN_RANGE (0.0, 1.0, viewport[1].x) ||
- !IN_RANGE (0.0, 1.0, viewport[0].y) ||
- !IN_RANGE (0.0, 1.0, viewport[1].y))
- {
- return (PEXBadViewport);
- }
-
- sx = (viewport[1].x - viewport[0].x) / (frame[1].x - frame[0].x);
- sy = (viewport[1].y - viewport[0].y) / (frame[1].y - frame[0].y);
-
- matrix_return[0][0] = sx;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = sx * (-frame[0].x + viewport[0].x);
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = sy;
- matrix_return[1][2] = sy * (-frame[0].y + viewport[0].y);
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXLookAtViewMatrix (from, to, up, matrix_return)
-
-INPUT PEXCoord *from;
-INPUT PEXCoord *to;
-INPUT PEXVector *up;
-OUTPUT PEXMatrix matrix_return;
-
-{
- PEXCoord a, b, c, d, e, f, t;
- float magnitude;
- float dot_product;
-
- /*
- * This matrix can be thought of as having 2 parts. The first part (next
- * to the coordinate point when it is being transformed) moves the to
- * point to the origin. The second part performs the rotation of the data.
- *
- * The three basis vectors of the rotation are obtained as follows.
- * The Z basis vector is determined by subtracting from from to and
- * dividing by its length (b). The Y basis vector is determined by
- * calculating the vector perpendicular to b and in the plane defined by
- * the to and from points and the up vector and then normalizing it (e).
- * The X basis vector (f) is calculated by e CROSS b.
- *
- * The resulting matrix looks like this:
- *
- * | fx fy fz 0 | | 1 0 0 -tox | | fx fy fz tz |
- * | ex ey ez 0 |*| 0 1 0 -toy |=| ex ey ez ty |
- * | bx by bz 0 | | 0 0 1 -toz | | bx by bz tz |
- * | 0 0 0 1 | | 0 0 0 1 | | 0 0 0 1 |
- *
- * where tx = -to DOT f, ty = -to DOT e, and tz = -to DOT b.
- */
-
- /*
- * Calculate the rotations
- */
-
- a.x = from->x - to->x; /* difference between to and from */
- a.y = from->y - to->y;
- a.z = from->z - to->z;
-
- magnitude = sqrt (a.x * a.x + a.y * a.y + a.z * a.z);
-
- if (ZERO_MAG (magnitude))
- {
- return (PEXBadVectors); /* from and to are the same */
- }
-
-
- /*
- * normalize the from-to vector
- */
-
- b.x = a.x / magnitude;
- b.y = a.y / magnitude;
- b.z = a.z / magnitude;
-
-
- /*
- * up is second basis vector
- */
-
- c.x = up->x;
- c.y = up->y;
- c.z = up->z;
-
-
- /*
- * compute the dot product of the previous two vectors
- */
-
- dot_product = (c.x * b.x) + (c.y * b.y) + (c.z * b.z);
-
-
- /*
- * calculate the vector perpendicular to the up vector and in the
- * plane defined by the to and from points and the up vector.
- */
-
- d.x = c.x - (dot_product * b.x);
- d.y = c.y - (dot_product * b.y);
- d.z = c.z - (dot_product * b.z);
-
- magnitude = sqrt (d.x * d.x + d.y * d.y + d.z * d.z);
-
- if (ZERO_MAG (magnitude)) /* use the defaults */
- {
- c.x = 0.0;
- c.y = 1.0;
- c.z = 0.0;
-
- dot_product = b.y;
-
- d.x = -(dot_product * b.x);
- d.y = 1.0 - (dot_product * b.y);
- d.z = -(dot_product * b.z);
-
- magnitude = sqrt (d.x * d.x + d.y * d.y + d.z * d.z);
-
- if (ZERO_MAG (magnitude))
- {
- c.x = 0.0;
- c.y = 0.0;
- c.z = 1.0;
-
- dot_product = b.z;
-
- d.x = -(dot_product * b.x);
- d.y = -(dot_product * b.y);
- d.z = 1.0 -(dot_product * b.z);
-
- magnitude = sqrt (d.x * d.x + d.y * d.y + d.z * d.z);
- }
- }
-
- /*
- * calculate the unit vector in the from, to, and at plane and
- * perpendicular to the up vector
- */
-
- e.x = d.x / magnitude;
- e.y = d.y / magnitude;
- e.z = d.z / magnitude;
-
-
- /*
- * calculate the unit vector perpendicular to the other two
- * by crossing them
- */
-
- f.x = (e.y * b.z) - (b.y * e.z);
- f.y = (e.z * b.x) - (b.z * e.x);
- f.z = (e.x * b.y) - (b.x * e.y);
-
-
- /*
- * fill in the rotation values
- */
-
- matrix_return[0][0] = f.x;
- matrix_return[0][1] = f.y;
- matrix_return[0][2] = f.z;
-
- matrix_return[1][0] = e.x;
- matrix_return[1][1] = e.y;
- matrix_return[1][2] = e.z;
-
- matrix_return[2][0] = b.x;
- matrix_return[2][1] = b.y;
- matrix_return[2][2] = b.z;
-
-
- /*
- * calculate the translation part of the matrix
- */
-
- t.x = (-to->x * f.x) + (-to->y * f.y) + (-to->z * f.z);
- t.y = (-to->x * e.x) + (-to->y * e.y) + (-to->z * e.z);
- t.z = (-to->x * b.x) + (-to->y * b.y) + (-to->z * b.z);
-
- matrix_return[0][3] = t.x;
- matrix_return[1][3] = t.y;
- matrix_return[2][3] = t.z;
-
-
- /*
- * and fill in the rest of the matrix
- */
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXPolarViewMatrix (from, distance, azimuth, altitude, twist, matrix_return)
-
-INPUT PEXCoord *from;
-INPUT double distance;
-INPUT double azimuth;
-INPUT double altitude;
-INPUT double twist;
-OUTPUT PEXMatrix matrix_return;
-
-{
- PEXCoord trans;
- float cost;
- float sint;
- float cosaz;
- float sinaz;
- float cosalt;
- float sinalt;
-
- if (distance <= ZERO_TOLERANCE)
- {
- return (PEXBadDistance);
- }
-
- cost = cos (twist);
- sint = sin (twist);
- cosaz = cos (-azimuth);
- sinaz = sin (-azimuth);
- cosalt = cos (-altitude);
- sinalt = sin (-altitude);
-
-
- /*
- * This matrix can be thought of as having five parts. The first part
- * (the part nearest the point to be transformed) translates the from point
- * to the origin. The last part translates the rotated data back by
- * distance so that the to point is at the origin. (Since the data is
- * lined up along the Z axis, there are no X and Y parts to this
- * translation.)
- *
- * The three parts in the middle rotate around the Y axis by azimuth,
- * rotate around the X axis by altitude, and rotate around the Z axis by
- * twist.
- *
- * The matrix calculated in this routine is the result of:
- *
- * (trans, -distance)*(twist, Z)*(altitude, X)*(azimuth, Y)*(trans, -from)
- *
- * | cost -sint 0 0 | | 1 0 0 0 | | cosaz 0 sinaz 0 |
- * Td*| sint cost 0 0 |*| 0 cosalt -sinalt 0 |*| 0 1 0 0 |*Tfrom
- * | 0 0 1 0 | | 0 sinalt cosalt 0 | |-sinaz 0 cosaz 0 |
- * | 0 0 0 1 | | 0 0 0 1 | | 0 0 0 1 |
- */
-
- matrix_return[0][0] = cost * cosaz + (-sint) * (-sinalt) * (-sinaz);
- matrix_return[0][1] = (-sint) * cosalt;
- matrix_return[0][2] = cost * sinaz + (-sint) * (-sinalt) * cosaz;
-
- matrix_return[1][0] = sint * cosaz + cost * (-sinalt) * (-sinaz);
- matrix_return[1][1] = cost * cosalt;
- matrix_return[1][2] = sint * sinaz + cost * (-sinalt) * cosaz;
-
- matrix_return[2][0] = cosalt * (-sinaz);
- matrix_return[2][1] = sinalt;
- matrix_return[2][2] = cosalt * cosaz;
-
-
- /*
- * calculate the translation part of the matrix
- */
-
- trans.x = -from->x * matrix_return[0][0] + -from->y * matrix_return[0][1] +
- -from->z * matrix_return[0][2];
- trans.y = -from->x * matrix_return[1][0] + -from->y * matrix_return[1][1] +
- -from->z * matrix_return[1][2];
- trans.z = -from->x * matrix_return[2][0] + -from->y * matrix_return[2][1] +
- -from->z * matrix_return[2][2];
-
- matrix_return[0][3] = trans.x;
- matrix_return[1][3] = trans.y;
- matrix_return[2][3] = trans.z + distance;
-
-
- /*
- * finish filling in the matrix
- */
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXOrthoProjMatrix (height, aspect, near_plane, far_plane, matrix_return)
-
-INPUT double height;
-INPUT double aspect;
-INPUT double near_plane;
-INPUT double far_plane;
-OUTPUT PEXMatrix matrix_return;
-
-{
- float width;
- float depth;
-
- width = height * aspect;
- depth = near_plane - far_plane;
-
- if (NEAR_ZERO (depth) || NEAR_ZERO (width) || NEAR_ZERO (height))
- {
- return (PEXBadLimits);
- }
-
-
- /*
- * This matrix maps the width, height, and depth to the range of zero to
- * one in all three directions. It also maps the z values to be
- * in front of the origin. The near plane is mapped to z = 1 and the
- * far plane is mapped to z = 0. It also translates the x, y coordinates
- * over by .5 so that x=0 and y=0 is in the middle of the NPC space.
- */
-
- matrix_return[0][0] = 1.0 / width;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
- matrix_return[0][3] = 0.5;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0 / height;
- matrix_return[1][2] = 0.0;
- matrix_return[1][3] = 0.5;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0 / depth;
- matrix_return[2][3] = 1.0 - (near_plane / depth);
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXPerspProjMatrix (fovy, distance, aspect, near_plane, far_plane, matrix_return)
-
-INPUT double fovy;
-INPUT double distance;
-INPUT double aspect;
-INPUT double near_plane;
-INPUT double far_plane;
-OUTPUT PEXMatrix matrix_return;
-
-{
- double fovy2;
- double c_hy;
- double s_hy;
- float height;
- float depth;
- float width;
- float eye_distance;
-
- if (near_plane <= far_plane || NEAR_ZERO (fovy) ||
- NEAR_ZERO (aspect) || distance <= near_plane)
- {
- return (PEXBadLimits);
- }
-
-
- /*
- * limit the field of view to be less than pi (minus a little) and ensure
- * that it's positive and then halve it
- */
-
- if ((fovy > 3.140) || (fovy < -3.140))
- {
- fovy2 = 3.140 / 2.0;
- }
- else if (fovy < 0.0)
- {
- fovy2 = -fovy / 2.0;
- }
- else
- {
- fovy2 = fovy / 2.0;
- }
-
-
- /*
- * calculate some dimensions we need
- */
-
- c_hy = cos (fovy2);
- s_hy = sin (fovy2);
-
- eye_distance = distance - near_plane;
- height = 2.0 * eye_distance * (s_hy / c_hy);
- depth = near_plane - far_plane;
- width = height * aspect;
-
- /*
- This matrix is made up of three parts. The first part is a perspective
- transformation matrix. The second part is a matrix to scale and
- translate the coordinates so that z is between 0 and 1, x is
- between height/2 and -height/2 and y is between width/2 and
- -width/2. The third part is a matrix to translate the eyepoint to
- .5 in x and y.
-
- The viewing frustum looks like this. We want to project the point
- (x, y, z) onto the near plane to get (x', y', z').
-
- +Z | o (x, y, z)
- <== | / :
- | / :
- (x',y',z') |/ :
- /| :
- / | :
- <----|----------------
- | z
- |
- eye near
-
- By similar triangles, x'/eye_dist = x/(eye_dist+near-z)
- y'/eye_dist = y/(eye_dist+near-z)
- z' = near
-
- So the projection matrix, Mproj =
-
- | 1 0 0 0 |
- | 0 1 0 0 |
- | 0 0 0 near |
- | 0 0 -1/eye_dist 1+(near/eye_dist) |
-
- (Row vectors are shown below for simplicity. They're really column
- vectors.)
-
- It can be shown that:
- Mproj * (0, 0, near, 1) = (0, 0, near, 1)
- Mproj * (0, 0, far, 1) = (0, 0, near, 1+near/eye_dist-far/eye_dist)
-
- Next, we want to find a matrix, Mst, such that the near plane is
- transformed to z=1 and the far plane is transformed to z=0.
- Mst * Mproj * (0, 0, near, 1) = (0, 0, 1, 1)
- Mst * Mproj * (0, 0, far, 1) = (0, 0, 0, t)
- where t = (eye_dist-far+near)/eye_dist
-
- Using the equations just above, this means that
- Mst * (0, 0, near, 1) = (0, 0, 1, 1)
- Mst * (0, 0, near, t) = (0, 0, 0, t)
-
- Concentrating on the lower right-hand corner of Mst, this means
- Mst * | near near | = | 1 0 |
- | 1 t | | 1 t |
-
- Solving for Mst, we get
- Mst = | t/(far(t-1)) -1/(t-1) |
- | 0 1 |
-
- Multiplying and simplifying, we get
- Mst * Mproj = | 1 0 0 0 |
- | 0 1 0 0 |
- | 0 0 1/depth -far/depth |
- | 0 0 -1/eye_dist 1 + near/eye_dist |
- where depth=near-far
-
- Now scale X and Y so that they have a range of "width"
- in X and "height" in Y. The resulting matrix is
- M2 = | 1/width 0 0 0 |
- | 0 1/height 0 0 |
- | 0 0 1/depth -far/depth |
- | 0 0 -1/eye_dist 1 + near/eye_dist |
-
- Last, we need to translate the results by .5 in X and Y so that the eye
- point is in the middle of NPC space.
- matrix_return = | 1 0 0 .5 | * M2
- | 0 1 0 .5 |
- | 0 0 1 0 |
- | 0 0 0 1 |
-
- = | 1/width 0 -1/(2*eye_dist) (1+near/eye_dist)/2 |
- | 0 1/height -1/(2*eye_dist) (1+near/eye_dist)/2 |
- | 0 0 1/depth -far/depth |
- | 0 0 -1/eye_dist 1+near/eye_dist |
- */
-
- matrix_return[0][0] = 1.0 / width;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = -1.0 / (2.0 * eye_distance);
- matrix_return[0][3] = (1.0 + (near_plane / eye_distance)) / 2.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0 / height;
- matrix_return[1][2] = -1.0 / (2.0 * eye_distance);
- matrix_return[1][3] = (1.0 + (near_plane / eye_distance)) / 2.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0 / depth;
- matrix_return[2][3] = -far_plane / depth;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = -1.0 / eye_distance;
- matrix_return[3][3] = 1.0 + (near_plane / eye_distance);
-
- return (0);
-}
-
-
-int
-PEXTransformPoints (mat, count, points, points_return)
-
-INPUT PEXMatrix mat;
-INPUT int count;
-INPUT PEXCoord *points;
-OUTPUT PEXCoord *points_return;
-
-{
- register PEXCoord *point_in = points;
- register PEXCoord *point_out = points_return;
- register int i;
- PEXCoord temp;
- int status = 0;
-
-
- if (NEAR_ZERO (mat[3][0]) && NEAR_ZERO (mat[3][1]) &&
- NEAR_ZERO (mat[3][2]) && NEAR_ZERO (mat[3][3] - 1.0))
- {
- for (i = 0; i < count; i++, point_in++, point_out++)
- {
- temp.x = mat[0][0] * point_in->x +
- mat[0][1] * point_in->y +
- mat[0][2] * point_in->z + mat[0][3];
-
- temp.y = mat[1][0] * point_in->x +
- mat[1][1] * point_in->y +
- mat[1][2] * point_in->z + mat[1][3];
-
- temp.z = mat[2][0] * point_in->x +
- mat[2][1] * point_in->y +
- mat[2][2] * point_in->z + mat[2][3];
-
- point_out->x = temp.x;
- point_out->y = temp.y;
- point_out->z = temp.z;
- }
- }
- else
- {
- register float w;
-
- for (i = 0; i < count; i++, point_in++, point_out++)
- {
- w = mat[3][0] * point_in->x + mat[3][1] * point_in->y +
- mat[3][2] * point_in->z + mat[3][3];
-
- if (NEAR_ZERO (w))
- {
- point_out->x = 0.0;
- point_out->y = 0.0;
- point_out->z = 0.0;
-
- status = PEXBadHomoCoord; /* return an error */
- }
- else
- {
- temp.x = (mat[0][0] * point_in->x +
- mat[0][1] * point_in->y +
- mat[0][2] * point_in->z + mat[0][3]) / w;
-
- temp.y = (mat[1][0] * point_in->x +
- mat[1][1] * point_in->y +
- mat[1][2] * point_in->z + mat[1][3]) / w;
-
- temp.z = (mat[2][0] * point_in->x +
- mat[2][1] * point_in->y +
- mat[2][2] * point_in->z + mat[2][3]) / w;
-
- point_out->x = temp.x;
- point_out->y = temp.y;
- point_out->z = temp.z;
- }
- }
- }
-
- return (status);
-}
-
-
-int
-PEXTransformPoints2D (mat, count, points, points_return)
-
-INPUT PEXMatrix3x3 mat;
-INPUT int count;
-INPUT PEXCoord2D *points;
-OUTPUT PEXCoord2D *points_return;
-
-{
- register PEXCoord2D *point_in = points;
- register PEXCoord2D *point_out = points_return;
- register int i;
- PEXCoord2D temp;
- int status = 0;
-
-
- if (NEAR_ZERO (mat[2][0]) && NEAR_ZERO (mat[2][1]) &&
- NEAR_ZERO (mat[2][2] - 1.0))
- {
- for (i = 0; i < count; i++, point_in++, point_out++)
- {
- temp.x = mat[0][0] * point_in->x +
- mat[0][1] * point_in->y + mat[0][2];
-
- temp.y = mat[1][0] * point_in->x +
- mat[1][1] * point_in->y + mat[1][2];
-
- point_out->x = temp.x;
- point_out->y = temp.y;
- }
- }
- else
- {
- register float w;
-
- for (i = 0; i < count; i++, point_in++, point_out++)
- {
- w = mat[2][0] * point_in->x + mat[2][1] * point_in->y + mat[2][2];
-
- if (NEAR_ZERO (w))
- {
- point_out->x = 0.0;
- point_out->y = 0.0;
-
- status = PEXBadHomoCoord; /* return an error */
- }
- else
- {
- temp.x = (mat[0][0] * point_in->x +
- mat[0][1] * point_in->y + mat[0][2]) / w;
-
- temp.y = (mat[1][0] * point_in->x +
- mat[1][1] * point_in->y + mat[1][2]) / w;
-
- point_out->x = temp.x;
- point_out->y = temp.y;
- }
- }
- }
-
- return (status);
-}
-
-
-void
-PEXTransformPoints4D (mat, count, points, points_return)
-
-INPUT PEXMatrix mat;
-INPUT int count;
-INPUT PEXCoord4D *points;
-OUTPUT PEXCoord4D *points_return;
-
-{
- register PEXCoord4D *point_in = points;
- register PEXCoord4D *point_out = points_return;
- register int i;
- PEXCoord4D temp;
-
-
- for (i = 0; i < count; i++, point_in++, point_out++)
- {
- temp.x = mat[0][0] * point_in->x + mat[0][1] * point_in->y +
- mat[0][2] * point_in->z + mat[0][3] * point_in->w;
-
- temp.y = mat[1][0] * point_in->x + mat[1][1] * point_in->y +
- mat[1][2] * point_in->z + mat[1][3] * point_in->w;
-
- temp.z = mat[2][0] * point_in->x + mat[2][1] * point_in->y +
- mat[2][2] * point_in->z + mat[2][3] * point_in->w;
-
- temp.w = mat[3][0] * point_in->x + mat[3][1] * point_in->y +
- mat[3][2] * point_in->z + mat[3][3] * point_in->w;
-
- point_out->x = temp.x;
- point_out->y = temp.y;
- point_out->z = temp.z;
- point_out->w = temp.w;
- }
-}
-
-
-void
-PEXTransformPoints2DH (mat, count, points, points_return)
-
-INPUT PEXMatrix3x3 mat;
-INPUT int count;
-INPUT PEXCoord *points;
-OUTPUT PEXCoord *points_return;
-
-{
- register PEXCoord *point_in = points;
- register PEXCoord *point_out = points_return;
- register int i;
- PEXCoord temp;
-
-
- for (i = 0; i < count; i++, point_in++, point_out++)
- {
- temp.x = mat[0][0] * point_in->x + mat[0][1] * point_in->y +
- mat[0][2] * point_in->z;
-
- temp.y = mat[1][0] * point_in->x + mat[1][1] * point_in->y +
- mat[1][2] * point_in->z;
-
- temp.z = mat[2][0] * point_in->x + mat[2][1] * point_in->y +
- mat[2][2] * point_in->z;
-
- point_out->x = temp.x;
- point_out->y = temp.y;
- point_out->z = temp.z;
- }
-}
-
-
-void
-PEXTransformVectors (mat, count, vectors, vectors_return)
-
-INPUT PEXMatrix mat;
-INPUT int count;
-INPUT PEXVector *vectors;
-OUTPUT PEXVector *vectors_return;
-
-{
- register PEXVector *vec_in = vectors;
- register PEXVector *vec_out = vectors_return;
- register int i;
- PEXVector temp;
-
-
- for (i = 0; i < count; i++, vec_in++, vec_out++)
- {
- temp.x = mat[0][0] * vec_in->x + mat[0][1] * vec_in->y +
- mat[0][2] * vec_in->z;
-
- temp.y = mat[1][0] * vec_in->x + mat[1][1] * vec_in->y +
- mat[1][2] * vec_in->z;
-
- temp.z = mat[2][0] * vec_in->x + mat[2][1] * vec_in->y +
- mat[2][2] * vec_in->z;
-
- vec_out->x = temp.x;
- vec_out->y = temp.y;
- vec_out->z = temp.z;
- }
-}
-
-
-void
-PEXTransformVectors2D (mat, count, vectors, vectors_return)
-
-INPUT PEXMatrix3x3 mat;
-INPUT int count;
-INPUT PEXVector2D *vectors;
-OUTPUT PEXVector2D *vectors_return;
-
-{
- register PEXVector2D *vec_in = vectors;
- register PEXVector2D *vec_out = vectors_return;
- register int i;
- PEXVector2D temp;
-
-
- for (i = 0; i < count; i++, vec_in++, vec_out++)
- {
- temp.x = mat[0][0] * vec_in->x + mat[0][1] * vec_in->y;
- temp.y = mat[1][0] * vec_in->x + mat[1][1] * vec_in->y;
-
- vec_out->x = temp.x;
- vec_out->y = temp.y;
-
- }
-}
-
-
-int
-PEXNormalizeVectors (count, vectors, vectors_return)
-
-INPUT int count;
-INPUT PEXVector *vectors;
-OUTPUT PEXVector *vectors_return;
-
-{
- register int i;
- register PEXVector *vec_in = vectors;
- register PEXVector *vec_out = vectors_return;
- float sum, length;
- int status = 0;
-
-
- for (i = 0; i < count; i++, vec_in++, vec_out++)
- {
- sum = vec_in->x * vec_in->x +
- vec_in->y * vec_in->y +
- vec_in->z * vec_in->z;
-
- if (NEAR_ZERO (sum))
- {
- vec_out->x = 0.0;
- vec_out->y = 0.0;
- vec_out->z = 0.0;
- status = PEXBadVector;
- }
- else
- {
- length = sqrt (sum);
-
- vec_out->x = vec_in->x / length;
- vec_out->y = vec_in->y / length;
- vec_out->z = vec_in->z / length;
- }
- }
-
- return (status);
-}
-
-
-int
-PEXNormalizeVectors2D (count, vectors, vectors_return)
-
-INPUT int count;
-INPUT PEXVector2D *vectors;
-OUTPUT PEXVector2D *vectors_return;
-
-{
- register int i;
- register PEXVector2D *vec_in = vectors;
- register PEXVector2D *vec_out = vectors_return;
- float sum, length;
- int status = 0;
-
-
- for (i = 0; i < count; i++, vec_in++, vec_out++)
- {
- sum = vec_in->x * vec_in->x +
- vec_in->y * vec_in->y;
-
- if (NEAR_ZERO (sum))
- {
- vec_out->x = 0.0;
- vec_out->y = 0.0;
- status = PEXBadVector;
- }
- else
- {
- length = sqrt (sum);
-
- vec_out->x = vec_in->x / length;
- vec_out->y = vec_in->y / length;
- }
- }
-
- return (status);
-}
-
-
-int
-PEXNPCToXCTransform (npc_sub_volume, viewport,
- window_height, transform_return)
-
-INPUT PEXNPCSubVolume *npc_sub_volume;
-INPUT PEXDeviceCoord *viewport;
-INPUT unsigned int window_height;
-OUTPUT PEXMatrix transform_return;
-
-{
- /*
- * M4 M3 M2 M1
- *
- * 1 0 0 0 1 0 0 Vx Sx 0 0 0 1 0 0 -Nx
- * 0 -1 0 H 0 1 0 Vy 0 Sy 0 0 0 1 0 -Ny
- * 0 0 1 0 0 0 1 Vz 0 0 Sz 0 0 0 1 -Nz
- * 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
- *
- * M1 : translates NPC subvolume to origin
- * (Nx, Ny, Nz) is the lower left corner of the NPC volume.
- *
- * M2 : scales NPC subvolme at origin to DC viewport at origin.
- * Sx, Sy, Sz are the scale factors that maintain the aspect ratio.
- *
- * M3 : translates DC viewport at origin to the correct position.
- * (Vx, Vy, Vz) is the lower left corner of the DC viewport.
- *
- * M4 : maps DC to X drawable coordinates (flips Y).
- * H is the window height.
- */
-
- float scale_x, scale_y, scale_z;
- int dvx, dvy;
- float dnx, dny;
- float dvz, dnz;
- PEXDeviceCoord new_viewport[2];
-
-
- dvx = viewport[1].x - viewport[0].x;
- dvy = viewport[1].y - viewport[0].y;
- dvz = viewport[1].z - viewport[0].z;
-
- if (dvx <= 0 || dvy <= 0 || !(viewport[0].z <= viewport[1].z))
- return (PEXBadViewport);
-
- if (BAD_SUBVOLUME (npc_sub_volume))
- return (PEXBadSubVolume);
-
- dnx = npc_sub_volume->max.x - npc_sub_volume->min.x;
- dny = npc_sub_volume->max.y - npc_sub_volume->min.y;
- dnz = npc_sub_volume->max.z - npc_sub_volume->min.z;
-
- scale_x = (float) dvx / dnx;
- scale_y = (float) dvy / dny;
- scale_z = NEAR_ZERO (dnz) ? 1.0 : (dvz / dnz);
-
- if (!NEAR_ZERO (scale_x - scale_y))
- {
- new_viewport[0].x = viewport[0].x;
- new_viewport[0].y = viewport[0].y;
- new_viewport[0].z = viewport[0].z;
-
- if (scale_y < scale_x)
- {
- new_viewport[1].x = viewport[0].x + (float) dvy * dnx / dny;
- new_viewport[1].y = viewport[1].y;
- new_viewport[1].z = viewport[1].z;
- }
- else
- {
- new_viewport[1].x = viewport[1].x;
- new_viewport[1].y = viewport[0].y + (float) dvx * dny / dnx;
- new_viewport[1].z = viewport[1].z;
- }
-
- viewport = new_viewport;
- }
-
- transform_return[0][0] = scale_x;
- transform_return[0][1] = 0.0;
- transform_return[0][2] = 0.0;
- transform_return[0][3] =
- viewport[0].x - (scale_x * npc_sub_volume->min.x);
-
- transform_return[1][0] = 0.0;
- transform_return[1][1] = -scale_y;
- transform_return[1][2] = 0.0;
- transform_return[1][3] =
- window_height - viewport[0].y + (scale_y * npc_sub_volume->min.y);
-
- transform_return[2][0] = 0.0;
- transform_return[2][1] = 0.0;
- transform_return[2][2] = scale_z;
- transform_return[2][3] =
- viewport[0].z - (scale_z * npc_sub_volume->min.z);
-
- transform_return[3][0] = 0.0;
- transform_return[3][1] = 0.0;
- transform_return[3][2] = 0.0;
- transform_return[3][3] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXNPCToXCTransform2D (npc_sub_volume, viewport,
- window_height, transform_return)
-
-INPUT PEXNPCSubVolume *npc_sub_volume;
-INPUT PEXDeviceCoord2D *viewport;
-INPUT unsigned int window_height;
-OUTPUT PEXMatrix3x3 transform_return;
-
-{
- /*
- * M4 M3 M2 M1
- *
- * 1 0 0 1 0 Vx Sx 0 0 1 0 -Nx
- * 0 -1 H 0 1 Vy 0 Sy 0 0 1 -Ny
- * 0 0 1 0 0 1 0 0 1 0 0 1
- *
- * M1 : translates NPC subvolume to origin
- * (Nx, Ny) is the lower left corner of the NPC volume.
- *
- * M2 : scales NPC subvolme at origin to DC viewport at origin.
- * Sx, Sy are the scale factors that maintain the aspect ratio.
- *
- * M3 : translates DC viewport at origin to the correct position.
- * (Vx, Vy) is the lower left corner of the DC viewport.
- *
- * M4 : maps DC to X drawable coordinates (flips Y).
- * H is the window height.
- */
-
- float scale_x, scale_y;
- int dvx, dvy;
- float dnx, dny;
- PEXDeviceCoord2D new_viewport[2];
-
-
- dvx = viewport[1].x - viewport[0].x;
- dvy = viewport[1].y - viewport[0].y;
-
- if (dvx <= 0 || dvy <= 0)
- return (PEXBadViewport);
-
- if (BAD_SUBVOLUME (npc_sub_volume))
- return (PEXBadSubVolume);
-
- dnx = npc_sub_volume->max.x - npc_sub_volume->min.x;
- dny = npc_sub_volume->max.y - npc_sub_volume->min.y;
-
- scale_x = (float) dvx / dnx;
- scale_y = (float) dvy / dny;
-
- if (!NEAR_ZERO (scale_x - scale_y))
- {
- new_viewport[0].x = viewport[0].x;
- new_viewport[0].y = viewport[0].y;
-
- if (scale_y < scale_x)
- {
- new_viewport[1].x = viewport[0].x + (float) dvy * dnx / dny;
- new_viewport[1].y = viewport[1].y;
- }
- else
- {
- new_viewport[1].x = viewport[1].x;
- new_viewport[1].y = viewport[0].y + (float) dvx * dny / dnx;
- }
-
- viewport = new_viewport;
- }
-
- transform_return[0][0] = scale_x;
- transform_return[0][1] = 0.0;
- transform_return[0][2] =
- viewport[0].x - (scale_x * npc_sub_volume->min.x);
-
- transform_return[1][0] = 0.0;
- transform_return[1][1] = -scale_y;
- transform_return[1][2] =
- window_height - viewport[0].y + (scale_y * npc_sub_volume->min.y);
-
- transform_return[2][0] = 0.0;
- transform_return[2][1] = 0.0;
- transform_return[2][2] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXXCToNPCTransform (npc_sub_volume, viewport,
- window_height, transform_return)
-
-INPUT PEXNPCSubVolume *npc_sub_volume;
-INPUT PEXDeviceCoord *viewport;
-INPUT unsigned int window_height;
-OUTPUT PEXMatrix transform_return;
-
-{
- /*
- * M4 M3 M2 M1
- *
- * 1 0 0 Nx Sx 0 0 0 1 0 0 -Vx 1 0 0 0
- * 0 1 0 Ny 0 Sy 0 0 0 1 0 -Vy 0 -1 0 H
- * 0 0 1 Nz 0 0 Sz 0 0 0 1 -Vz 0 0 1 0
- * 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1
- *
- * M1 : maps X drawable coordinates to DC (flips Y).
- * H is the window height.
- *
- * M2 : translates DC viewport to origin
- * (Vx, Vy, Vz) is the lower left corner of the DC viewport.
- *
- * M3 : scales DC viewport at origin to NPC subvolme at origin.
- * Sx, Sy, Sz are the scale factors that maintain the aspect ratio.
- *
- * M4 : translates NPC subvolume at origin to the correct position.
- * (Nx, Ny, Nz) is the lower left corner of the NPC volume.
- */
-
- float scale_x, scale_y, scale_z;
- int dvx, dvy;
- float dnx, dny;
- float dvz, dnz;
- PEXDeviceCoord new_viewport[2];
-
-
- dvx = viewport[1].x - viewport[0].x;
- dvy = viewport[1].y - viewport[0].y;
- dvz = viewport[1].z - viewport[0].z;
-
- if (dvx <= 0 || dvy <= 0 || !(viewport[0].z <= viewport[1].z))
- return (PEXBadViewport);
-
- if (BAD_SUBVOLUME (npc_sub_volume))
- return (PEXBadSubVolume);
-
- dnx = npc_sub_volume->max.x - npc_sub_volume->min.x;
- dny = npc_sub_volume->max.y - npc_sub_volume->min.y;
- dnz = npc_sub_volume->max.z - npc_sub_volume->min.z;
-
- scale_x = dnx / (float) dvx;
- scale_y = dny / (float) dvy;
- scale_z = NEAR_ZERO (dvz) ? 1.0 : (dnz / dvz);
-
- if (!NEAR_ZERO (scale_x - scale_y))
- {
- new_viewport[0].x = viewport[0].x;
- new_viewport[0].y = viewport[0].y;
- new_viewport[0].z = viewport[0].z;
-
- if (scale_x < scale_y)
- {
- new_viewport[1].x = viewport[0].x + (float) dvy * dnx / dny;
- new_viewport[1].y = viewport[1].y;
- new_viewport[1].z = viewport[1].z;
- }
- else
- {
- new_viewport[1].x = viewport[1].x;
- new_viewport[1].y = viewport[0].y + (float) dvx * dny / dnx;
- new_viewport[1].z = viewport[1].z;
- }
-
- viewport = new_viewport;
- }
-
- transform_return[0][0] = scale_x;
- transform_return[0][1] = 0.0;
- transform_return[0][2] = 0.0;
- transform_return[0][3] =
- npc_sub_volume->min.x - (scale_x * viewport[0].x);
-
- transform_return[1][0] = 0.0;
- transform_return[1][1] = -scale_y;
- transform_return[1][2] = 0.0;
- transform_return[1][3] =
- npc_sub_volume->min.y + scale_y * (window_height - viewport[0].y);
-
- transform_return[2][0] = 0.0;
- transform_return[2][1] = 0.0;
- transform_return[2][2] = 1.0;
- transform_return[2][3] =
- npc_sub_volume->min.z - (scale_z * viewport[0].z);
-
- transform_return[3][0] = 0.0;
- transform_return[3][1] = 0.0;
- transform_return[3][2] = 0.0;
- transform_return[3][3] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXXCToNPCTransform2D (npc_sub_volume, viewport,
- window_height, transform_return)
-
-INPUT PEXNPCSubVolume *npc_sub_volume;
-INPUT PEXDeviceCoord2D *viewport;
-INPUT unsigned int window_height;
-INPUT PEXMatrix3x3 transform_return;
-
-{
- /*
- * M4 M3 M2 M1
- *
- * 1 0 Nx Sx 0 0 1 0 -Vx 1 0 0
- * 0 1 Ny 0 Sy 0 0 1 -Vy 0 -1 H
- * 0 0 1 0 0 1 0 0 1 0 0 1
- *
- * M1 : maps X drawable coordinates to DC (flips Y).
- * H is the window height.
- *
- * M2 : translates DC viewport to origin
- * (Vx, Vy) is the lower left corner of the DC viewport.
- *
- * M3 : scales DC viewport at origin to NPC subvolme at origin.
- * Sx, Sy are the scale factors that maintain the aspect ratio.
- *
- * M4 : translates NPC subvolume at origin to the correct position.
- * (Nx, Ny) is the lower left corner of the NPC volume.
- */
-
- float scale_x, scale_y;
- int dvx, dvy;
- float dnx, dny;
- PEXDeviceCoord2D new_viewport[2];
-
-
- dvx = viewport[1].x - viewport[0].x;
- dvy = viewport[1].y - viewport[0].y;
-
- if (dvx <= 0 || dvy <= 0)
- return (PEXBadViewport);
-
- if (BAD_SUBVOLUME (npc_sub_volume))
- return (PEXBadSubVolume);
-
- dnx = npc_sub_volume->max.x - npc_sub_volume->min.x;
- dny = npc_sub_volume->max.y - npc_sub_volume->min.y;
-
- scale_x = dnx / (float) dvx;
- scale_y = dny / (float) dvy;
-
- if (!NEAR_ZERO (scale_x - scale_y))
- {
- new_viewport[0].x = viewport[0].x;
- new_viewport[0].y = viewport[0].y;
-
- if (scale_x < scale_y)
- {
- new_viewport[1].x = viewport[0].x + (float) dvy * dnx / dny;
- new_viewport[1].y = viewport[1].y;
- }
- else
- {
- new_viewport[1].x = viewport[1].x;
- new_viewport[1].y = viewport[0].y + (float) dvx * dny / dnx;
- }
-
- viewport = new_viewport;
- }
-
- transform_return[0][0] = scale_x;
- transform_return[0][1] = 0.0;
- transform_return[0][2] =
- npc_sub_volume->min.x - (scale_x * viewport[0].x);
-
- transform_return[1][0] = 0.0;
- transform_return[1][1] = -scale_y;
- transform_return[1][2] =
- npc_sub_volume->min.y + scale_y * (window_height - viewport[0].y);
-
- transform_return[2][0] = 0.0;
- transform_return[2][1] = 0.0;
- transform_return[2][2] = 1.0;
-
- return (0);
-}
-
-
-int
-PEXMapXCToNPC (point_count, points, window_height,
- z_dc, viewport, npc_sub_volume, view_count, views,
- view_return, count_return, points_return)
-
-INPUT int point_count;
-INPUT PEXDeviceCoord2D *points;
-INPUT unsigned int window_height;
-INPUT double z_dc;
-INPUT PEXDeviceCoord *viewport;
-INPUT PEXNPCSubVolume *npc_sub_volume;
-INPUT int view_count;
-INPUT PEXViewEntry *views;
-OUTPUT int *view_return;
-OUTPUT int *count_return;
-OUTPUT PEXCoord *points_return;
-
-{
- PEXCoord *xc_wz_points;
- PEXMatrix xform;
- int pts_in_view;
- int max_pts_in_view;
- int max_pts_view;
- int status, i, j;
-
- /*
- * Fill in the Z value for each XC point.
- */
-
- xc_wz_points = (PEXCoord *) Xmalloc (
- (unsigned) (point_count * sizeof (PEXCoord)));
-
- for (i = 0; i < point_count; i++)
- {
- xc_wz_points[i].x = points[i].x;
- xc_wz_points[i].y = points[i].y;
- xc_wz_points[i].z = z_dc;
- }
-
-
- /*
- * Determine the transformation matrix that takes us from XC to NPC.
- */
-
- status = PEXXCToNPCTransform (npc_sub_volume, viewport,
- window_height, xform);
-
- if (status != 0)
- return (status);
-
-
- /*
- * Now transform the XC points to NPC.
- */
-
- status = PEXTransformPoints (xform, point_count,
- xc_wz_points, points_return);
-
- Xfree ((char *) xc_wz_points);
-
- if (status != 0)
- return (status);
-
-
- /*
- * Search for the view containing all (or most) of the NPC points.
- */
-
- max_pts_view = -1;
- max_pts_in_view = 0;
-
- for (i = 0; i < view_count; i++)
- {
- for (j = pts_in_view = 0; j < point_count; j++)
- {
- if (POINT3D_IN_VIEW (points_return[j], views[i]))
- pts_in_view++;
- }
-
- if (pts_in_view == point_count)
- {
- max_pts_in_view = point_count;
- max_pts_view = i;
- break;
- }
- else if (pts_in_view > max_pts_in_view)
- {
- max_pts_in_view = pts_in_view;
- max_pts_view = i;
- }
- }
-
-
- /*
- * Make sure we only return points that are in the view we found.
- */
-
- if (max_pts_in_view > 0 && max_pts_in_view != point_count)
- {
- int count = 0;
-
- for (i = 0; i < point_count && count < max_pts_in_view; i++)
- {
- if (POINT3D_IN_VIEW (points_return[i], views[max_pts_view]))
- {
- points_return[count].x = points_return[i].x;
- points_return[count].y = points_return[i].y;
- points_return[count].z = points_return[i].z;
- count++;
- }
- }
- }
-
- *view_return = max_pts_view;
- *count_return = max_pts_in_view;
-
- return (0);
-}
-
-
-int
-PEXMapXCToNPC2D (point_count, points, window_height,
- viewport, npc_sub_volume, view_count, views,
- view_return, count_return, points_return)
-
-INPUT int point_count;
-INPUT PEXDeviceCoord2D *points;
-INPUT unsigned int window_height;
-INPUT PEXDeviceCoord2D *viewport;
-INPUT PEXNPCSubVolume *npc_sub_volume;
-INPUT int view_count;
-INPUT PEXViewEntry *views;
-OUTPUT int *view_return;
-OUTPUT int *count_return;
-OUTPUT PEXCoord2D *points_return;
-
-{
- PEXMatrix3x3 xform;
- PEXCoord2D *xc_points;
- int pts_in_view;
- int max_pts_in_view;
- int max_pts_view;
- int status, i, j;
-
- /*
- * Fill in the XC point.
- */
-
- xc_points = (PEXCoord2D *) Xmalloc (
- (unsigned) (point_count * sizeof (PEXCoord2D)));
-
- for (i = 0; i < point_count; i++)
- {
- xc_points[i].x = points[i].x;
- xc_points[i].y = points[i].y;
- }
-
-
- /*
- * Determine the transformation matrix that takes us from XC to NPC.
- */
-
- status = PEXXCToNPCTransform2D (npc_sub_volume, viewport,
- window_height, xform);
-
- if (status != 0)
- return (status);
-
-
- /*
- * Now transform the XC points to NPC.
- */
-
- status = PEXTransformPoints2D (xform, point_count,
- xc_points, points_return);
-
- Xfree ((char *) xc_points);
-
- if (status != 0)
- return (status);
-
-
- /*
- * Search for the view containing all (or most) of the NPC points.
- */
-
- max_pts_view = -1;
- max_pts_in_view = 0;
-
- for (i = 0; i < view_count; i++)
- {
- for (j = pts_in_view = 0; j < point_count; j++)
- {
- if (POINT2D_IN_VIEW (points_return[j], views[i]))
- pts_in_view++;
- }
-
- if (pts_in_view == point_count)
- {
- max_pts_in_view = point_count;
- max_pts_view = i;
- break;
- }
- else if (pts_in_view > max_pts_in_view)
- {
- max_pts_in_view = pts_in_view;
- max_pts_view = i;
- }
- }
-
-
- /*
- * Make sure we only return points that are in the view we found.
- */
-
- if (max_pts_in_view > 0 && max_pts_in_view != point_count)
- {
- int count = 0;
-
- for (i = 0; i < point_count && count < max_pts_in_view; i++)
- {
- if (POINT2D_IN_VIEW (points_return[i], views[max_pts_view]))
- {
- points_return[count].x = points_return[i].x;
- points_return[count].y = points_return[i].y;
- count++;
- }
- }
- }
-
- *view_return = max_pts_view;
- *count_return = max_pts_in_view;
-
- return (0);
-}
-
-
-int
-PEXInvertMatrix (matrix, inverseReturn)
-
-INPUT PEXMatrix matrix;
-OUTPUT PEXMatrix inverseReturn;
-
-{
- /*
- * This routine calculates a 4x4 inverse matrix. It uses Gaussian
- * elimination on the system [matrix][inverse] = [identity]. The values
- * of the matrix then become the coefficients of the system of equations
- * that evolves from this equation. The system is then solved for the
- * values of [inverse]. The algorithm solves for each column of [inverse]
- * in turn. Partial pivoting is also done to reduce the numerical error
- * involved in the computations. If singularity is detected, the routine
- * ends and returns an error.
- *
- * (See Numerical Analysis, L.W. Johnson and R.D.Riess, 1982).
- */
-
- int ipivot, h, i, j, k;
- float aug[4][5];
- float pivot, temp, q;
-
- for (h = 0; h < 4; h++) /* solve column by column */
- {
- /*
- * Set up the augmented matrix for [matrix][inverse] = [identity]
- */
-
- for (i = 0; i < 4; i++)
- {
- aug[i][0] = matrix[i][0];
- aug[i][1] = matrix[i][1];
- aug[i][2] = matrix[i][2];
- aug[i][3] = matrix[i][3];
- aug[i][4] = (h == i) ? 1.0 : 0.0;
- }
-
- /*
- * Search for the largest entry in column i, rows i through 3.
- * ipivot is the row index of the largest entry.
- */
-
- for (i = 0; i < 3; i++)
- {
- pivot = 0.0;
-
- for (j = i; j < 4; j++)
- {
- temp = ABS (aug[j][i]);
- if (pivot < temp)
- {
- pivot = temp;
- ipivot = j;
- }
- }
- if (NEAR_ZERO (pivot)) /* singularity check */
- return (PEXBadMatrix);
-
- /* interchange rows i and ipivot */
-
- if (ipivot != i)
- {
- for (k = i; k < 5; k++)
- {
- temp = aug[i][k];
- aug[i][k] = aug[ipivot][k];
- aug[ipivot][k] = temp;
- }
- }
-
- /* put augmented matrix in echelon form */
-
- for (k = i + 1; k < 4; k++)
- {
- q = -aug[k][i] / aug[i][i];
- aug[k][i] = 0.0;
- for (j = i + 1; j < 5; j++)
- {
- aug[k][j] = q * aug[i][j] + aug[k][j];
- }
- }
- }
-
- if (NEAR_ZERO (aug[3][3])) /* singularity check */
- return (PEXBadMatrix);
-
- /* backsolve to obtain values for inverse matrix */
-
- inverseReturn[3][h] = aug[3][4] / aug[3][3];
-
- for (k = 1; k < 4; k++)
- {
- q = 0.0;
- for (j = 1; j <= k; j++)
- {
- q = q + aug[3 - k][4 - j] * inverseReturn[4 - j][h];
- }
- inverseReturn[3 - k][h] = (aug[3 - k][4] - q) / aug[3 - k][3 - k];
- }
- }
-
- return (0);
-}
-
-
-int
-PEXInvertMatrix2D (matrix, inverseReturn)
-
-PEXMatrix3x3 matrix;
-PEXMatrix3x3 inverseReturn;
-
-{
- /*
- * This routine calculates a 4x4 inverse matrix. It uses Gaussian
- * elimination on the system [matrix][inverse] = [identity]. The values
- * of the matrix then become the coefficients of the system of equations
- * that evolves from this equation. The system is then solved for the
- * values of [inverse]. The algorithm solves for each column of [inverse]
- * in turn. Partial pivoting is also done to reduce the numerical error
- * involved in the computations. If singularity is detected, the routine
- * ends and returns an error.
- *
- * (See Numerical Analysis, L.W. Johnson and R.D.Riess, 1982).
- */
-
- int ipivot, h, i, j, k;
- float aug[3][4];
- float pivot, temp, q;
-
-
- for (h = 0; h < 3; h++) /* solve column by column */
- {
- /*
- * Set up the augmented matrix for [matrix][inverse] = [identity]
- */
-
- for (i = 0; i < 3; i++)
- {
- aug[i][0] = matrix[i][0];
- aug[i][1] = matrix[i][1];
- aug[i][2] = matrix[i][2];
- aug[i][3] = (h == i) ? 1.0 : 0.0;
- }
-
- /*
- * Search for the largest entry in column i, rows i through 3.
- * ipivot is the row index of the largest entry.
- */
-
- for (i = 0; i < 2; i++)
- {
- pivot = 0.0;
-
- for (j = i; j < 3; j++)
- {
- temp = ABS (aug[j][i]);
- if (pivot < temp)
- {
- pivot = temp;
- ipivot = j;
- }
- }
- if (NEAR_ZERO (pivot)) /* singularity check */
- return (PEXBadMatrix);
-
- /* interchange rows i and ipivot */
-
- if (ipivot != i)
- {
- for (k = i; k < 4; k++)
- {
- temp = aug[i][k];
- aug[i][k] = aug[ipivot][k];
- aug[ipivot][k] = temp;
- }
- }
-
- /* put augmented matrix in echelon form */
-
- for (k = i + 1; k < 3; k++)
- {
- q = -aug[k][i] / aug[i][i];
- aug[k][i] = 0.;
- for (j = i + 1; j < 4; j++)
- {
- aug[k][j] = q * aug[i][j] + aug[k][j];
- }
- }
- }
-
- if (NEAR_ZERO (aug[2][2])) /* singularity check */
- return (PEXBadMatrix);
-
- /* backsolve to obtain values for inverse matrix */
-
- inverseReturn[2][h] = aug[2][3] / aug[2][2];
-
- for (k = 1; k < 3; k++)
- {
- q = 0.0;
- for (j = 1; j <= k; j++)
- {
- q = q + aug[2 - k][3 - j] * inverseReturn[3 - j][h];
- }
- inverseReturn[2 - k][h] = (aug[2 - k][3] - q) / aug[2 - k][2 - k];
- }
- }
-
- return (0);
-}
-
-
-void
-PEXIdentityMatrix (matrix_return)
-
-OUTPUT PEXMatrix matrix_return;
-
-{
- matrix_return[0][0] = 1.0;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
- matrix_return[0][3] = 0.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0;
- matrix_return[1][2] = 0.0;
- matrix_return[1][3] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
- matrix_return[2][3] = 0.0;
-
- matrix_return[3][0] = 0.0;
- matrix_return[3][1] = 0.0;
- matrix_return[3][2] = 0.0;
- matrix_return[3][3] = 1.0;
-}
-
-
-void
-PEXIdentityMatrix2D (matrix_return)
-
-OUTPUT PEXMatrix3x3 matrix_return;
-
-{
- matrix_return[0][0] = 1.0;
- matrix_return[0][1] = 0.0;
- matrix_return[0][2] = 0.0;
-
- matrix_return[1][0] = 0.0;
- matrix_return[1][1] = 1.0;
- matrix_return[1][2] = 0.0;
-
- matrix_return[2][0] = 0.0;
- matrix_return[2][1] = 0.0;
- matrix_return[2][2] = 1.0;
-}
-
-
-int
-PEXGeoNormFillArea (facet_attributes, vertex_attributes,
- color_type, facet_data, count, vertices)
-
-INPUT unsigned int facet_attributes;
-INPUT unsigned int vertex_attributes;
-INPUT int color_type;
-INOUT PEXFacetData *facet_data;
-INPUT unsigned int count;
-INPUT PEXArrayOfVertex vertices;
-
-{
- PEXCoord *v1, *v2, *v3;
- int found_v2, found_v3;
- float dx, dy, dz, length;
- int vert_size;
- PEXVector *normal;
- char *ptr;
-
-
- /*
- * Check to see if we should compute the normal.
- */
-
- if (!(facet_attributes & PEXGANormal))
- return (0);
-
-
- /*
- * Make sure there are enough vertices to compute the normal.
- */
-
- if (count < 3)
- return (PEXBadPrimitive);
-
-
- /*
- * Get a pointer to the normal data structure.
- */
-
- if (facet_attributes & PEXGAColor)
- {
- normal = (PEXVector *) ((char *) facet_data +
- GetClientColorSize (color_type));
- }
- else
- normal = (PEXVector *) facet_data;
-
-
- /*
- * Now find the first 3 non-colinear points and take their
- * cross product to get the normal.
- */
-
- vert_size = GetClientVertexSize (color_type, vertex_attributes);
-
- ptr = (char *) vertices.no_data;
- v1 = (PEXCoord *) ptr;
- count--;
-
- found_v2 = 0;
-
- while (!found_v2 && count > 0)
- {
- /* find v2, such that v2 is not coincident with v1 */
-
- ptr += vert_size;
- v2 = (PEXCoord *) ptr;
- count--;
-
- dx = v2->x - v1->x;
- dy = v2->y - v1->y;
- dz = v2->z - v1->z;
-
- if (!NEAR_ZERO (dx) || !NEAR_ZERO (dy) || !NEAR_ZERO (dz))
- found_v2 = 1;
- }
-
- found_v3 = 0;
-
- while (!found_v3 && count > 0)
- {
- /* find v3, such that v3 is non-colinear with v1 and v2 */
-
- ptr += vert_size;
- v3 = (PEXCoord *) ptr;
- count--;
-
- CROSS_PRODUCT (v1, v2, v1, v3, normal);
- NORMALIZE_VECTOR (normal, length);
-
- if (!NEAR_ZERO (length))
- found_v3 = 1;
- }
-
- if (found_v3)
- return (0);
- else
- return (PEXBadPrimitive);
-}
-
-
-int
-PEXGeoNormFillAreaSet (facet_attributes, vertex_attributes,
- color_type, count, facet_data, vertex_lists)
-
-INPUT unsigned int facet_attributes;
-INPUT unsigned int vertex_attributes;
-INPUT int color_type;
-INPUT unsigned int count;
-INOUT PEXFacetData *facet_data;
-INPUT PEXListOfVertex *vertex_lists;
-
-{
- PEXCoord *v1, *v2, *v3;
- int vert_size, vcount;
- int found_v2, done, i;
- float dx, dy, dz, length;
- PEXVector *normal;
- char *ptr;
-
-
- /*
- * Check to see if we should compute the normal.
- */
-
- if (!(facet_attributes & PEXGANormal))
- return (0);
-
-
- /*
- * Get a pointer to the normal data structure.
- */
-
- if (facet_attributes & PEXGAColor)
- {
- normal = (PEXVector *) ((char *) facet_data +
- GetClientColorSize (color_type));
- }
- else
- normal = (PEXVector *) facet_data;
-
-
- /*
- * Now find the first 3 non-colinear points in one of the fill areas
- * of the set, and take their cross product to get the normal.
- */
-
- vert_size = GetClientVertexSize (color_type, vertex_attributes);
-
- for (i = done = 0; i < count && !done; i++)
- {
- if ((vcount = vertex_lists[i].count) > 2)
- {
- ptr = (char *) vertex_lists[i].vertices.no_data;
-
- v1 = (PEXCoord *) ptr;
- vcount--;
-
- found_v2 = 0;
-
- while (!found_v2 && vcount > 0)
- {
- /* find v2, such that v2 is not coincident with v1 */
-
- ptr += vert_size;
- v2 = (PEXCoord *) ptr;
- vcount--;
-
- dx = v2->x - v1->x;
- dy = v2->y - v1->y;
- dz = v2->z - v1->z;
-
- if (!NEAR_ZERO (dx) || !NEAR_ZERO (dy) || !NEAR_ZERO (dz))
- found_v2 = 1;
- }
-
- while (!done && vcount > 0)
- {
- /* find v3, such that v3 is non-colinear with v1 and v2 */
-
- ptr += vert_size;
- v3 = (PEXCoord *) ptr;
- vcount--;
-
- CROSS_PRODUCT (v1, v2, v1, v3, normal);
- NORMALIZE_VECTOR (normal, length);
-
- if (!NEAR_ZERO (length))
- done = 1;
- }
- }
- }
-
- if (done)
- return (0);
- else
- return (PEXBadPrimitive);
-}
-
-
-int
-PEXGeoNormTriangleStrip (facet_attributes, vertex_attributes,
- color_type, facet_data, count, vertices)
-
-INPUT unsigned int facet_attributes;
-INPUT unsigned int vertex_attributes;
-INPUT int color_type;
-INOUT PEXArrayOfFacetData facet_data;
-INPUT unsigned int count;
-INPUT PEXArrayOfVertex vertices;
-
-{
- PEXCoord *v1, *v2, *v3;
- int vert_size;
- int facet_size, i;
- PEXVector *normal;
- float length;
- char *ptr;
- int status = 0;
-
-
- /*
- * Check to see if we should compute the normals.
- */
-
- if (!(facet_attributes & PEXGANormal))
- return (0);
-
-
- /*
- * Make sure there are enough vertices to compute the normals.
- */
-
- if (count < 3)
- return (PEXBadPrimitive);
-
-
- /*
- * Get a pointer to the first normal.
- */
-
- if (facet_attributes & PEXGAColor)
- {
- normal = (PEXVector *) ((char *) facet_data.index +
- GetClientColorSize (color_type));
- }
- else
- normal = (PEXVector *) facet_data.normal;
-
-
- /*
- * Now compute all of the normals in the strip.
- */
-
- vert_size = GetClientVertexSize (color_type, vertex_attributes);
- facet_size = GetClientFacetSize (color_type, facet_attributes);
-
- ptr = (char *) vertices.no_data;
-
- for (i = 0; i < count - 2; i++)
- {
- v1 = (PEXCoord *) ptr;
- ptr += vert_size;
- v2 = (PEXCoord *) ptr;
- ptr += vert_size;
- v3 = (PEXCoord *) ptr;
- ptr -= vert_size;
-
- if (i % 2)
- {
- /* cross product of v1v3 x v1v2 */
-
- CROSS_PRODUCT (v1, v3, v1, v2, normal);
- }
- else
- {
- /* cross product of v1v2 x v1v3 */
-
- CROSS_PRODUCT (v1, v2, v1, v3, normal);
- }
-
- NORMALIZE_VECTOR (normal, length);
-
- if (NEAR_ZERO (length))
- {
- normal->x = normal->y = normal->z = 0.0;
- status = PEXBadPrimitive;
- }
-
- normal = (PEXVector *) ((char *) normal + facet_size);
- }
-
- return (status);
-}
-
-
-int
-PEXGeoNormQuadrilateralMesh (facet_attributes, vertex_attributes,
- color_type, facet_data, col_count, row_count, vertices)
-
-INPUT unsigned int facet_attributes;
-INPUT unsigned int vertex_attributes;
-INPUT int color_type;
-INOUT PEXArrayOfFacetData facet_data;
-INPUT unsigned int col_count;
-INPUT unsigned int row_count;
-INPUT PEXArrayOfVertex vertices;
-
-{
- PEXCoord *v1, *v2, *v3, *v4;
- int vert_size, facet_size;
- int row, col;
- PEXVector *normal;
- float length;
- int status = 0;
-
-
- /*
- * Check to see if we should compute the normals.
- */
-
- if (!(facet_attributes & PEXGANormal))
- return (0);
-
-
- /*
- * Make sure there are enough vertices to compute the normals.
- */
-
- if (row_count < 2 || col_count < 2)
- return (PEXBadPrimitive);
-
-
- /*
- * Get a pointer to the first normal.
- */
-
- if (facet_attributes & PEXGAColor)
- {
- normal = (PEXVector *) ((char *) facet_data.index +
- GetClientColorSize (color_type));
- }
- else
- normal = (PEXVector *) facet_data.normal;
-
-
- /*
- * Now compute all of the normals in the quad mesh.
- */
-
- vert_size = GetClientVertexSize (color_type, vertex_attributes);
- facet_size = GetClientFacetSize (color_type, facet_attributes);
-
- for (row = 0; row < row_count - 1; row++)
- for (col = 0; col < col_count - 1; col++)
- {
- /*
- * v1 = vert[row , col ]
- * v2 = vert[row + 1, col + 1]
- * v3 = vert[row + 1, col ]
- * v4 = vert[row , col + 1]
- *
- * Take cross product of v1v2 x v3v4, then normalize.
- */
-
- v1 = (PEXCoord *) ((char *) vertices.no_data +
- (row * col_count + col) * vert_size);
-
- v4 = (PEXCoord *) ((char *) v1 + vert_size);
-
- v3 = (PEXCoord *) ((char *) v1 + col_count * vert_size);
-
- v2 = (PEXCoord *) ((char *) v3 + vert_size);
-
- CROSS_PRODUCT (v1, v2, v3, v4, normal);
- NORMALIZE_VECTOR (normal, length);
-
- if (NEAR_ZERO (length))
- {
- normal->x = normal->y = normal->z = 0.0;
- status = PEXBadPrimitive;
- }
-
- normal = (PEXVector *) ((char *) normal + facet_size);
- }
-
- return (status);
-}
-
-
-int
-PEXGeoNormSetOfFillAreaSets (facet_attributes, vertex_attributes,
- color_type, set_count, facet_data, vertex_count, vertices,
- index_count, connectivity)
-
-INPUT unsigned int facet_attributes;
-INPUT unsigned int vertex_attributes;
-INPUT int color_type;
-INPUT unsigned int set_count;
-INOUT PEXArrayOfFacetData facet_data;
-INPUT unsigned int vertex_count;
-INPUT PEXArrayOfVertex vertices;
-INPUT unsigned int index_count;
-INPUT PEXConnectivityData *connectivity;
-{
- PEXConnectivityData *pConnectivity;
- PEXListOfUShort *pList;
- PEXCoord *v1, *v2, *v3;
- int vert_size, facet_size;
- float dx, dy, dz, length;
- int index, done;
- int found_v2, i, j;
- PEXVector *normal;
- int status = 0;
-
-
- /*
- * Check to see if we should compute the normals.
- */
-
- if (!(facet_attributes & PEXGANormal))
- return (0);
-
-
- /*
- * Make sure there are enough vertices/indices to compute the normals.
- */
-
- if (index_count < 3 || vertex_count < 3)
- return (PEXBadPrimitive);
-
-
- /*
- * Get a pointer to the first normal.
- */
-
- if (facet_attributes & PEXGAColor)
- {
- normal = (PEXVector *) ((char *) facet_data.index +
- GetClientColorSize (color_type));
- }
- else
- normal = (PEXVector *) facet_data.normal;
-
-
- /*
- * Now compute a normal for each fill area set.
- */
-
- vert_size = GetClientVertexSize (color_type, vertex_attributes);
- facet_size = GetClientFacetSize (color_type, facet_attributes);
-
- pConnectivity = connectivity;
-
- for (i = 0; i < set_count; i++)
- {
- pList = pConnectivity->lists;
- done = 0;
-
- for (j = 0; j < (int) pConnectivity->count && !done; j++, pList++)
- {
- if (pList->count > 2)
- {
- v1 = (PEXCoord *) ((char *) vertices.no_data +
- vert_size * pList->shorts[0]);
-
- index = 1;
- found_v2 = 0;
-
- while (!found_v2 && index < (int) pList->count)
- {
- /* find v2, such that v2 is not coincident with v1 */
-
- v2 = (PEXCoord *) ((char *) vertices.no_data +
- vert_size * pList->shorts[index]);
-
- index++;
-
- dx = v2->x - v1->x;
- dy = v2->y - v1->y;
- dz = v2->z - v1->z;
-
- if (!NEAR_ZERO (dx) || !NEAR_ZERO (dy) || !NEAR_ZERO (dz))
- found_v2 = 1;
- }
-
- while (!done && index < (int) pList->count)
- {
- /* find v3, such that v3 is non-colinear with v1 and v2 */
-
- v3 = (PEXCoord *) ((char *) vertices.no_data +
- vert_size * pList->shorts[index]);
-
- index++;
-
- CROSS_PRODUCT (v1, v2, v1, v3, normal);
- NORMALIZE_VECTOR (normal, length);
-
- if (!NEAR_ZERO (length))
- done = 1;
- }
- }
- }
-
- if (!done)
- {
- normal->x = normal->y = normal->z = 0.0;
- status = PEXBadPrimitive;
- }
-
- normal = (PEXVector *) ((char *) normal + facet_size);
- pConnectivity++;
- }
-
- return (status);
-}
diff --git a/xc/lib/PEX5/pl_util.h b/xc/lib/PEX5/pl_util.h
deleted file mode 100644
index 986483ff0..000000000
--- a/xc/lib/PEX5/pl_util.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $TOG: pl_util.h /main/7 1998/02/06 16:12:37 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.
-
-*/
-
-#define ZERO_TOLERANCE 1.0e-30
-
-#define ABS(_x) ((_x) < 0.0 ? -(_x) : (_x))
-
-#define NEAR_ZERO(_s) (ABS (_s) < ZERO_TOLERANCE)
-
-#define ZERO_MAG(_s) ((_s) < ZERO_TOLERANCE)
-
-#define IN_RANGE(_low, _high, _val) ((_val) >= (_low) && (_val) <= (_high))
-
-#define MAG_V3(_v) \
- (sqrt ((_v)->x * (_v)->x + (_v)->y * (_v)->y + (_v)->z * (_v)->z))
-
-#define MAG_V2(_v) \
- (sqrt ((_v)->x * (_v)->x + (_v)->y * (_v)->y))
-
-#define BAD_SUBVOLUME(_volume) \
- (!IN_RANGE (0.0, 1.0, _volume->min.x) || \
- !IN_RANGE (0.0, 1.0, _volume->max.x) || \
- !IN_RANGE (0.0, 1.0, _volume->min.y) || \
- !IN_RANGE (0.0, 1.0, _volume->max.y) || \
- !IN_RANGE (0.0, 1.0, _volume->min.z) || \
- !IN_RANGE (0.0, 1.0, _volume->max.z) || \
- !(_volume->min.x < _volume->max.x) || \
- !(_volume->min.y < _volume->max.y) || \
- !(_volume->min.z <= _volume->max.z))
-
-
-/*
- * Dot product of v1 * v2
- */
-
-#define DOT_PRODUCT(_v1, _v2) \
- ((_v1)->x * (_v2)->x + (_v1)->y * (_v2)->y + (_v1)->z * (_v2)->z)
-
-
-/*
- * Cross product of p1p2 x p3p4
- */
-
-#define CROSS_PRODUCT(_p1, _p2, _p3, _p4, _v) \
-{ \
- (_v)->x = (((_p2)->y - (_p1)->y) * ((_p4)->z - (_p3)->z)) - \
- (((_p2)->z - (_p1)->z) * ((_p4)->y - (_p3)->y)); \
- (_v)->y = (((_p2)->z - (_p1)->z) * ((_p4)->x - (_p3)->x)) - \
- (((_p2)->x - (_p1)->x) * ((_p4)->z - (_p3)->z)); \
- (_v)->z = (((_p2)->x - (_p1)->x) * ((_p4)->y - (_p3)->y)) - \
- (((_p2)->y - (_p1)->y) * ((_p4)->x - (_p3)->x)); \
-}
-
-
-/*
- * Normalize vector and return length
- */
-
-#define NORMALIZE_VECTOR(_v, _len) \
-{ \
- _len = DOT_PRODUCT (_v, _v); \
- _len = sqrt (_len); \
- if (!NEAR_ZERO (_len)) \
- { \
- (_v)->x /= _len; \
- (_v)->y /= _len; \
- (_v)->z /= _len; \
- } \
-}
-
-
-/*
- * Determine if a point is inside of a view
- */
-
-#define POINT3D_IN_VIEW(_point, _view) \
- (_point.x >= _view.clip_limits.min.x && \
- _point.x <= _view.clip_limits.max.x && \
- _point.y >= _view.clip_limits.min.y && \
- _point.y <= _view.clip_limits.max.y && \
- _point.z >= _view.clip_limits.min.z && \
- _point.z <= _view.clip_limits.max.z)
-
-#define POINT2D_IN_VIEW(_point, _view) \
- (_point.x >= _view.clip_limits.min.x && \
- _point.x <= _view.clip_limits.max.x && \
- _point.y >= _view.clip_limits.min.y && \
- _point.y <= _view.clip_limits.max.y)
diff --git a/xc/lib/PEX5/pl_wks.c b/xc/lib/PEX5/pl_wks.c
deleted file mode 100644
index 3be6faae5..000000000
--- a/xc/lib/PEX5/pl_wks.c
+++ /dev/null
@@ -1,1574 +0,0 @@
-/* $TOG: pl_wks.c /main/14 1998/02/06 16:12: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.
-
-*/
-
-/******************************************************************************
-Copyright 1987,1991 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1992 by ShoGraphics, Inc., Mountain View, California
-
- All Rights Reserved
-
-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 Digital or ShowGraphics not be used in advertising or
-publicity pertaining to distribution of the software without specific, written
-prior permission. Digital and ShowGraphics make no representations
-about the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-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.
-
-SHOGRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SHOGRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER 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 "PEXlib.h"
-#include "PEXlibint.h"
-
-
-PEXWorkstation
-PEXCreateWorkstation (display, drawable, lineBundle, markerBundle, textBundle,
- interiorBundle, edgeBundle, colorTable, patternTable, textFontTable,
- depthCueTable, lightTable, colorApproxTable, highlightIncl,
- highlightExcl, invisibilityIncl, invisibilityExcl, bufferMode)
-
-INPUT Display *display;
-INPUT Drawable drawable;
-INPUT PEXLookupTable lineBundle;
-INPUT PEXLookupTable markerBundle;
-INPUT PEXLookupTable textBundle;
-INPUT PEXLookupTable interiorBundle;
-INPUT PEXLookupTable edgeBundle;
-INPUT PEXLookupTable colorTable;
-INPUT PEXLookupTable patternTable;
-INPUT PEXLookupTable textFontTable;
-INPUT PEXLookupTable depthCueTable;
-INPUT PEXLookupTable lightTable;
-INPUT PEXLookupTable colorApproxTable;
-INPUT PEXNameSet highlightIncl;
-INPUT PEXNameSet highlightExcl;
-INPUT PEXNameSet invisibilityIncl;
-INPUT PEXNameSet invisibilityExcl;
-INPUT int bufferMode;
-
-{
- register pexCreateWorkstationReq *req;
- char *pBuf;
- PEXWorkstation wks;
-
-
- /*
- * Get a Phigs Workstation resource id from X.
- */
-
- wks = XAllocID (display);
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (CreateWorkstation, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateWorkstation, pBuf, req);
-
- PEXStoreReqHead (CreateWorkstation, req);
- req->drawable = drawable;
- req->wks = wks;
- req->lineBundle = lineBundle;
- req->markerBundle = markerBundle;
- req->textBundle = textBundle;
- req->interiorBundle = interiorBundle;
- req->edgeBundle = edgeBundle;
- req->colorTable = colorTable;
- req->patternTable = patternTable;
- req->textFontTable = textFontTable;
- req->depthCueTable = depthCueTable;
- req->lightTable = lightTable;
- req->colorApproxTable = colorApproxTable;
- req->highlightIncl = highlightIncl;
- req->highlightExcl = highlightExcl;
- req->invisIncl = invisibilityIncl;
- req->invisExcl = invisibilityExcl;
- req->bufferMode = bufferMode;
-
- END_REQUEST_HEADER (CreateWorkstation, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (wks);
-}
-
-
-void
-PEXFreeWorkstation (display, wks)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-
-{
- register pexFreeWorkstationReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (FreeWorkstation, pBuf);
-
- BEGIN_REQUEST_HEADER (FreeWorkstation, pBuf, req);
-
- PEXStoreReqHead (FreeWorkstation, req);
- req->id = wks;
-
- END_REQUEST_HEADER (FreeWorkstation, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-PEXWorkstationAttributes *
-PEXGetWorkstationAttributes (display, wks, valueMask)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned long *valueMask;
-
-{
- register pexGetWorkstationAttributesReq *req;
- register char *pBuf, *pBufSave;
- pexGetWorkstationAttributesReply rep;
- PEXWorkstationAttributes *ppwi;
- Bool bitSet;
- unsigned long count;
- int i;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetWorkstationAttributes, pBuf);
-
- BEGIN_REQUEST_HEADER (GetWorkstationAttributes, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetWorkstationAttributes, fpFormat, req);
- req->wks = wks;
- req->itemMask0 = valueMask[0];
- req->itemMask1 = valueMask[1];
-
- END_REQUEST_HEADER (GetWorkstationAttributes, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (NULL); /* return an error */
- }
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- ppwi = (PEXWorkstationAttributes *)
- Xmalloc (sizeof (PEXWorkstationAttributes));
-
- ppwi->defined_views.count = 0;
- ppwi->defined_views.views = NULL;
- ppwi->posted_structures.count = 0;
- ppwi->posted_structures.structures = NULL;
-
- for (i = 0; i < (PEXPWMaxShift + 1); i++)
- {
- bitSet = valueMask[i >> 5] & (1L << (i & 0x1f));
- if (bitSet != 0)
- {
- switch (i)
- {
- case PEXPWDisplayUpdate:
-
- EXTRACT_LOV_INT16 (pBuf, ppwi->drawable_update);
- break;
-
- case PEXPWVisualState:
-
- EXTRACT_LOV_CARD8 (pBuf, ppwi->visual_state);
- break;
-
- case PEXPWDisplaySurface:
-
- EXTRACT_LOV_CARD8 (pBuf, ppwi->drawable_surface);
- break;
-
- case PEXPWViewUpdate:
-
- EXTRACT_LOV_CARD8 (pBuf, ppwi->view_update);
- break;
-
- case PEXPWDefinedViews:
-
- EXTRACT_CARD32 (pBuf, count);
- ppwi->defined_views.count = count;
-
- ppwi->defined_views.views = (PEXTableIndex *) Xmalloc (
- (unsigned) (count * sizeof (PEXTableIndex)));
-
- EXTRACT_LISTOF_CARD16 (count, pBuf, ppwi->defined_views.views);
- pBuf += ((count & 1) * SIZEOF (CARD16));
- break;
-
- case PEXPWWorkstationUpdate:
-
- EXTRACT_LOV_CARD8 (pBuf, ppwi->wks_update);
- break;
-
- case PEXPWReqNPCSubVolume:
-
- EXTRACT_NPC_SUBVOLUME (pBuf, ppwi->req_npc_subvolume,
- fpConvert, fpFormat);
- break;
-
- case PEXPWCurNPCSubVolume:
-
- EXTRACT_NPC_SUBVOLUME (pBuf, ppwi->cur_npc_subvolume,
- fpConvert, fpFormat);
- break;
-
- case PEXPWReqViewport:
-
- EXTRACT_VIEWPORT (pBuf, ppwi->req_workstation_viewport,
- fpConvert, fpFormat);
- break;
-
- case PEXPWCurViewport:
-
- EXTRACT_VIEWPORT (pBuf, ppwi->cur_workstation_viewport,
- fpConvert, fpFormat);
- break;
-
- case PEXPWHLHSRUpdate:
-
- EXTRACT_LOV_CARD8 (pBuf, ppwi->hlhsr_update);
- break;
-
- case PEXPWReqHLHSRMode:
-
- EXTRACT_LOV_INT16 (pBuf, ppwi->req_hlhsr_mode);
- break;
-
- case PEXPWCurHLHSRMode:
-
- EXTRACT_LOV_INT16 (pBuf, ppwi->cur_hlhsr_mode);
- break;
-
- case PEXPWDrawable:
-
- EXTRACT_CARD32 (pBuf, ppwi->drawable);
- break;
-
- case PEXPWMarkerBundle:
-
- EXTRACT_CARD32 (pBuf, ppwi->marker_bundle);
- break;
-
- case PEXPWTextBundle:
-
- EXTRACT_CARD32 (pBuf, ppwi->text_bundle);
- break;
-
- case PEXPWLineBundle:
-
- EXTRACT_CARD32 (pBuf, ppwi->line_bundle);
- break;
-
- case PEXPWInteriorBundle:
-
- EXTRACT_CARD32 (pBuf, ppwi->interior_bundle);
- break;
-
- case PEXPWEdgeBundle:
-
- EXTRACT_CARD32 (pBuf, ppwi->edge_bundle);
- break;
-
- case PEXPWColorTable:
-
- EXTRACT_CARD32 (pBuf, ppwi->color_table);
- break;
-
- case PEXPWDepthCueTable:
-
- EXTRACT_CARD32 (pBuf, ppwi->depth_cue_table);
- break;
-
- case PEXPWLightTable:
-
- EXTRACT_CARD32 (pBuf, ppwi->light_table);
- break;
-
- case PEXPWColorApproxTable:
-
- EXTRACT_CARD32 (pBuf, ppwi->color_approx_table);
- break;
-
- case PEXPWPatternTable:
-
- EXTRACT_CARD32 (pBuf, ppwi->pattern_table);
- break;
-
- case PEXPWTextFontTable:
-
- EXTRACT_CARD32 (pBuf, ppwi->text_font_table);
- break;
-
- case PEXPWHighlightIncl:
-
- EXTRACT_CARD32 (pBuf, ppwi->highlight_incl);
- break;
-
- case PEXPWHighlightExcl:
-
- EXTRACT_CARD32 (pBuf, ppwi->highlight_excl);
- break;
-
- case PEXPWInvisibilityIncl:
-
- EXTRACT_CARD32 (pBuf, ppwi->invisibility_incl);
- break;
-
- case PEXPWInvisibilityExcl:
-
- EXTRACT_CARD32 (pBuf, ppwi->invisibility_excl);
- break;
-
- case PEXPWPostedStructures:
-
- EXTRACT_CARD32 (pBuf, count);
- ppwi->posted_structures.count = count;
-
- ppwi->posted_structures.structures = (PEXPostedStructure *)
- Xmalloc ((unsigned) (count * sizeof (PEXPostedStructure)));
-
- EXTRACT_LISTOF_POSTED_STRUCS (count, pBuf,
- ppwi->posted_structures.structures, fpConvert, fpFormat);
- break;
-
- case PEXPWNumPriorities:
-
- EXTRACT_CARD32 (pBuf, ppwi->count_priorities);
- break;
-
- case PEXPWBufferUpdate:
-
- EXTRACT_LOV_CARD8 (pBuf, ppwi->buffer_update);
- break;
-
- case PEXPWReqBufferMode:
-
- EXTRACT_LOV_CARD16 (pBuf, ppwi->req_buffer_mode);
- break;
-
- case PEXPWCurBufferMode:
-
- EXTRACT_LOV_CARD16 (pBuf, ppwi->cur_buffer_mode);
- break;
- }
- }
- }
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (ppwi);
-}
-
-
-Status
-PEXGetWorkstationDynamics (display, d, dynamics)
-
-INPUT Display *display;
-INPUT Drawable d;
-INPUT PEXWorkstationDynamics *dynamics;
-
-{
- register pexGetWorkstationDynamicsReq *req;
- char *pBuf;
- pexGetWorkstationDynamicsReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetWorkstationDynamics, pBuf);
-
- BEGIN_REQUEST_HEADER (GetWorkstationDynamics, pBuf, req);
-
- PEXStoreReqHead (GetWorkstationDynamics, req);
- req->drawable = d;
-
- END_REQUEST_HEADER (GetWorkstationDynamics, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (0); /* return an error */
- }
-
-
- /*
- * Fill in the dynamics.
- */
-
- dynamics->view_rep = rep.viewRep;
- dynamics->marker_bundle = rep.markerBundle;
- dynamics->text_bundle = rep.textBundle;
- dynamics->line_bundle = rep.lineBundle;
- dynamics->interior_bundle = rep.interiorBundle;
- dynamics->edge_bundle = rep.edgeBundle;
- dynamics->color_table = rep.colorTable;
- dynamics->pattern_table = rep.patternTable;
- dynamics->wks_transform = rep.wksTransform;
- dynamics->highlight_filter = rep.highlightFilter;
- dynamics->invisibility_filter = rep.invisibilityFilter;
- dynamics->hlhsr_mode = rep.HlhsrMode;
- dynamics->structure_modify = rep.structureModify;
- dynamics->post_structure = rep.postStructure;
- dynamics->unpost_structure = rep.unpostStructure;
- dynamics->delete_structure = rep.deleteStructure;
- dynamics->reference_modify = rep.referenceModify;
- dynamics->buffer_modify = rep.bufferModify;
- dynamics->light_table = rep.lightTable;
- dynamics->depth_cue_table = rep.depthCueTable;
- dynamics->color_approx_table = rep.colorApproxTable;
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXGetWorkstationViewRep (display, wks, index,
- viewUpdateReturn, reqViewReturn, curViewReturn)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned int index;
-OUTPUT int *viewUpdateReturn;
-OUTPUT PEXViewRep *reqViewReturn;
-OUTPUT PEXViewRep *curViewReturn;
-
-{
- register pexGetWorkstationViewRepReq *req;
- register char *pBuf, *pBufSave;
- pexGetWorkstationViewRepReply rep;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetWorkstationViewRep, pBuf);
-
- BEGIN_REQUEST_HEADER (GetWorkstationViewRep, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (GetWorkstationViewRep, fpFormat, req);
- req->wks = wks;
- req->index = index;
-
- END_REQUEST_HEADER (GetWorkstationViewRep, pBuf, req);
-
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- return (0); /* return an error */
- }
-
- *viewUpdateReturn = rep.viewUpdate;
-
-
- /*
- * Read the reply data into a scratch buffer.
- */
-
- XREAD_INTO_SCRATCH (display, pBufSave, rep.length << 2);
- pBuf = pBufSave;
-
- /*
- * Get the requested view rep.
- */
-
- EXTRACT_CARD32 (pBuf, reqViewReturn->index);
- EXTRACT_CARD32 (pBuf, reqViewReturn->view.clip_flags);
-
- EXTRACT_NPC_SUBVOLUME (pBuf, reqViewReturn->view.clip_limits,
- fpConvert, fpFormat);
-
- EXTRACT_LISTOF_FLOAT32 (16, pBuf, reqViewReturn->view.orientation,
- fpConvert, fpFormat);
- EXTRACT_LISTOF_FLOAT32 (16, pBuf, reqViewReturn->view.mapping,
- fpConvert, fpFormat);
-
-
- /*
- * Get the current view rep.
- */
-
- EXTRACT_CARD32 (pBuf, curViewReturn->index);
- EXTRACT_CARD32 (pBuf, curViewReturn->view.clip_flags);
-
- EXTRACT_NPC_SUBVOLUME (pBuf, curViewReturn->view.clip_limits,
- fpConvert, fpFormat);
-
- EXTRACT_LISTOF_FLOAT32 (16, pBuf, curViewReturn->view.orientation,
- fpConvert, fpFormat);
- EXTRACT_LISTOF_FLOAT32 (16, pBuf, curViewReturn->view.mapping,
- fpConvert, fpFormat);
-
- FINISH_WITH_SCRATCH (display, pBufSave, rep.length << 2);
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXGetWorkstationPostings (display, structure, numWksReturn, wksReturn)
-
-INPUT Display *display;
-INPUT PEXStructure structure;
-OUTPUT unsigned long *numWksReturn;
-OUTPUT PEXWorkstation **wksReturn;
-
-{
- register pexGetWorkstationPostingsReq *req;
- char *pBuf;
- pexGetWorkstationPostingsReply rep;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- PEXGetReq (GetWorkstationPostings, pBuf);
-
- BEGIN_REQUEST_HEADER (GetWorkstationPostings, pBuf, req);
-
- PEXStoreReqHead (GetWorkstationPostings, req);
- req->id = structure;
-
- END_REQUEST_HEADER (GetWorkstationPostings, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *wksReturn = NULL;
- return (0); /* return an error */
- }
-
- *numWksReturn = rep.length;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- *wksReturn = (PEXWorkstation *) Xmalloc (
- (unsigned) (*numWksReturn * sizeof (PEXWorkstation)));
-
- XREAD_LISTOF_CARD32 (display, *numWksReturn, *wksReturn);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-void
-PEXSetWorkstationViewPriority (display, wks, index1, index2, priority)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned int index1;
-INPUT unsigned int index2;
-INPUT int priority;
-
-{
- register pexSetWorkstationViewPriorityReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationViewPriority, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationViewPriority, pBuf, req);
-
- PEXStoreReqHead (SetWorkstationViewPriority, req);
- req->wks = wks;
- req->index1 = index1;
- req->index2 = index2;
- req->priority = priority;
-
- END_REQUEST_HEADER (SetWorkstationViewPriority, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetWorkstationDisplayUpdateMode (display, wks, displayUpdate)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT int displayUpdate;
-
-{
- register pexSetWorkstationDisplayUpdateModeReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationDisplayUpdateMode, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationDisplayUpdateMode, pBuf, req);
-
- PEXStoreReqHead (SetWorkstationDisplayUpdateMode, req);
- req->wks = wks;
- req->displayUpdate = displayUpdate;
-
- END_REQUEST_HEADER (SetWorkstationDisplayUpdateMode, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetWorkstationBufferMode (display, wks, bufferMode)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT int bufferMode;
-
-{
- register pexSetWorkstationBufferModeReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationBufferMode, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationBufferMode, pBuf, req);
-
- PEXStoreReqHead (SetWorkstationBufferMode, req);
- req->wks = wks;
- req->bufferMode = bufferMode;
-
- END_REQUEST_HEADER (SetWorkstationBufferMode, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetWorkstationViewRep (display, wks, viewIndex, values)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned int viewIndex;
-INPUT PEXViewEntry *values;
-
-{
- register pexSetWorkstationViewRepReq *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
- char *ptr;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationViewRep, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationViewRep, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (SetWorkstationViewRep, fpFormat, req);
- req->wks = wks;
- req->index = viewIndex;
- req->clipFlags = values->clip_flags;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (values->clip_limits.min.x,
- req->clipLimits_xmin, fpFormat);
- FP_CONVERT_HTON (values->clip_limits.min.y,
- req->clipLimits_ymin, fpFormat);
- FP_CONVERT_HTON (values->clip_limits.min.z,
- req->clipLimits_zmin, fpFormat);
- FP_CONVERT_HTON (values->clip_limits.max.x,
- req->clipLimits_xmax, fpFormat);
- FP_CONVERT_HTON (values->clip_limits.max.y,
- req->clipLimits_ymax, fpFormat);
- FP_CONVERT_HTON (values->clip_limits.max.z,
- req->clipLimits_zmax, fpFormat);
- }
- else
- {
- req->clipLimits_xmin = values->clip_limits.min.x;
- req->clipLimits_ymin = values->clip_limits.min.y;
- req->clipLimits_zmin = values->clip_limits.min.z;
- req->clipLimits_xmax = values->clip_limits.max.x;
- req->clipLimits_ymax = values->clip_limits.max.y;
- req->clipLimits_zmax = values->clip_limits.max.z;
- }
-
- ptr = (char *) req->view_orientation;
- STORE_LISTOF_FLOAT32 (16, values->orientation, ptr, fpConvert, fpFormat);
-
- ptr = (char *) req->view_mapping;
- STORE_LISTOF_FLOAT32 (16, values->mapping, ptr, fpConvert, fpFormat);
-
- END_REQUEST_HEADER (SetWorkstationViewRep, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetWorkstationWindow (display, wks, npcSubvolume)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT PEXNPCSubVolume *npcSubvolume;
-
-{
- register pexSetWorkstationWindowReq *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationWindow, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationWindow, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (SetWorkstationWindow, fpFormat, req);
- req->wks = wks;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (npcSubvolume->min.x,
- req->npcSubvolume_xmin, fpFormat);
- FP_CONVERT_HTON (npcSubvolume->min.y,
- req->npcSubvolume_ymin, fpFormat);
- FP_CONVERT_HTON (npcSubvolume->min.z,
- req->npcSubvolume_zmin, fpFormat);
- FP_CONVERT_HTON (npcSubvolume->max.x,
- req->npcSubvolume_xmax, fpFormat);
- FP_CONVERT_HTON (npcSubvolume->max.y,
- req->npcSubvolume_ymax, fpFormat);
- FP_CONVERT_HTON (npcSubvolume->max.z,
- req->npcSubvolume_zmax, fpFormat);
- }
- else
- {
- req->npcSubvolume_xmin = npcSubvolume->min.x;
- req->npcSubvolume_ymin = npcSubvolume->min.y;
- req->npcSubvolume_zmin = npcSubvolume->min.z;
- req->npcSubvolume_xmax = npcSubvolume->max.x;
- req->npcSubvolume_ymax = npcSubvolume->max.y;
- req->npcSubvolume_zmax = npcSubvolume->max.z;
- }
-
- END_REQUEST_HEADER (SetWorkstationWindow, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetWorkstationViewport (display, wks, viewport)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT PEXViewport *viewport;
-
-{
- register pexSetWorkstationViewportReq *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationViewport, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationViewport, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (SetWorkstationViewport, fpFormat, req);
- req->wks = wks;
- req->viewport_xmin = viewport->min.x;
- req->viewport_ymin = viewport->min.y;
- req->viewport_xmax = viewport->max.x;
- req->viewport_ymax = viewport->max.y;
- req->useDrawable = viewport->use_drawable;
-
- if (fpConvert)
- {
- FP_CONVERT_HTON (viewport->min.z, req->viewport_zmin, fpFormat);
- FP_CONVERT_HTON (viewport->max.z, req->viewport_zmax, fpFormat);
- }
- else
- {
- req->viewport_zmin = viewport->min.z;
- req->viewport_zmax = viewport->max.z;
- }
-
- END_REQUEST_HEADER (SetWorkstationViewport, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXSetWorkstationHLHSRMode (display, wks, hlhsrMode)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT int hlhsrMode;
-
-{
- register pexSetWorkstationHLHSRModeReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (SetWorkstationHLHSRMode, pBuf);
-
- BEGIN_REQUEST_HEADER (SetWorkstationHLHSRMode, pBuf, req);
-
- PEXStoreReqHead (SetWorkstationHLHSRMode, req);
- req->wks = wks;
- req->mode = (pexEnumTypeIndex) hlhsrMode;
-
- END_REQUEST_HEADER (SetWorkstationHLHSRMode, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXRedrawAllStructures (display, wks)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-
-{
- register pexRedrawAllStructuresReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (RedrawAllStructures, pBuf);
-
- BEGIN_REQUEST_HEADER (RedrawAllStructures, pBuf, req);
-
- PEXStoreReqHead (RedrawAllStructures, req);
- req->id = wks;
-
- END_REQUEST_HEADER (RedrawAllStructures, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXUpdateWorkstation (display, wks)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-
-{
- register pexUpdateWorkstationReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (UpdateWorkstation, pBuf);
-
- BEGIN_REQUEST_HEADER (UpdateWorkstation, pBuf, req);
-
- PEXStoreReqHead (UpdateWorkstation, req);
- req->id = wks;
-
- END_REQUEST_HEADER (UpdateWorkstation, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXExecuteDeferredActions (display, wks)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-
-{
- register pexExecuteDeferredActionsReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (ExecuteDeferredActions, pBuf);
-
- BEGIN_REQUEST_HEADER (ExecuteDeferredActions, pBuf, req);
-
- PEXStoreReqHead (ExecuteDeferredActions, req);
- req->id = wks;
-
- END_REQUEST_HEADER (ExecuteDeferredActions, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-Status
-PEXMapDCToWC (display, wks, dc_count, dc_points,
- view_index_return, wc_count_return, wc_points_return)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned long dc_count;
-INPUT PEXDeviceCoord *dc_points;
-OUTPUT unsigned int *view_index_return;
-OUTPUT unsigned long *wc_count_return;
-OUTPUT PEXCoord **wc_points_return;
-
-{
- register pexMapDCtoWCReq *req;
- char *pBuf;
- pexMapDCtoWCReply rep;
- int size;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- size = dc_count * SIZEOF (pexDeviceCoord);
- PEXGetReqExtra (MapDCtoWC, size, pBuf);
-
- BEGIN_REQUEST_HEADER (MapDCtoWC, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (MapDCtoWC, fpFormat, size, req);
- req->wks = wks;
- req->numCoords = dc_count;
-
- END_REQUEST_HEADER (MapDCtoWC, pBuf, req);
-
- STORE_LISTOF_DEVCOORD (dc_count, dc_points, pBuf, fpConvert, fpFormat);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *wc_count_return = 0;
- *wc_points_return = NULL;
- return (0); /* return an error */
- }
-
- *view_index_return = rep.viewIndex;
- *wc_count_return = rep.numCoords;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- *wc_points_return = (PEXCoord *) Xmalloc (
- (unsigned) (rep.numCoords * sizeof (PEXCoord)));
-
- XREAD_LISTOF_COORD3D (display, rep.numCoords, (*wc_points_return),
- fpConvert, fpFormat);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-Status
-PEXMapWCToDC (display, wks, wc_count, wc_points,
- view_index, dc_count_return, dc_points_return)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned long wc_count;
-INPUT PEXCoord *wc_points;
-INPUT unsigned int view_index;
-OUTPUT unsigned long *dc_count_return;
-OUTPUT PEXDeviceCoord **dc_points_return;
-
-{
- register pexMapWCtoDCReq *req;
- char *pBuf;
- pexMapWCtoDCReply rep;
- int size;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer and get a reply.
- */
-
- size = wc_count * SIZEOF (pexCoord3D);
- PEXGetReqExtra (MapWCtoDC, size, pBuf);
-
- BEGIN_REQUEST_HEADER (MapWCtoDC, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqExtraHead (MapWCtoDC, fpFormat, size, req);
- req->wks = wks;
- req->index = view_index;
- req->numCoords = wc_count;
-
- END_REQUEST_HEADER (MapWCtoDC, pBuf, req);
-
- STORE_LISTOF_COORD3D (wc_count, wc_points, pBuf, fpConvert, fpFormat);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- PEXSyncHandle (display);
- *dc_count_return = 0;
- *dc_points_return = NULL;
- return (0); /* return an error */
- }
-
- *dc_count_return = rep.numCoords;
-
-
- /*
- * Allocate a buffer for the replies to pass back to the client.
- */
-
- *dc_points_return = (PEXDeviceCoord *) Xmalloc (
- (unsigned) (rep.numCoords * sizeof (PEXDeviceCoord)));
-
- XREAD_LISTOF_DEVCOORD (display, rep.numCoords, (*dc_points_return),
- fpConvert, fpFormat);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-
- return (1);
-}
-
-
-void
-PEXPostStructure (display, wks, structure, priority)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT PEXStructure structure;
-INPUT double priority;
-
-{
- register pexPostStructureReq *req;
- char *pBuf;
- int fpConvert;
- int fpFormat;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (PostStructure, pBuf);
-
- BEGIN_REQUEST_HEADER (PostStructure, pBuf, req);
- CHECK_FP (fpConvert, fpFormat);
-
- PEXStoreFPReqHead (PostStructure, fpFormat, req);
- req->wks = wks;
- req->sid = structure;
-
- if (fpConvert)
- {
- FP_CONVERT_DHTON (priority, req->priority, fpFormat);
- }
- else
- req->priority = priority;
-
- END_REQUEST_HEADER (PostStructure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXUnpostStructure (display, wks, structure)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT PEXStructure structure;
-
-{
- register pexUnpostStructureReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (UnpostStructure, pBuf);
-
- BEGIN_REQUEST_HEADER (UnpostStructure, pBuf, req);
-
- PEXStoreReqHead (UnpostStructure, req);
- req->wks = wks;
- req->sid = structure;
-
- END_REQUEST_HEADER (UnpostStructure, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXUnpostAllStructures (display, wks)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-
-{
- register pexUnpostAllStructuresReq *req;
- char *pBuf;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- PEXGetReq (UnpostAllStructures, pBuf);
-
- BEGIN_REQUEST_HEADER (UnpostAllStructures, pBuf, req);
-
- PEXStoreReqHead (UnpostAllStructures, req);
- req->id = wks;
-
- END_REQUEST_HEADER (UnpostAllStructures, pBuf, req);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
-
-
-void
-PEXRedrawClipRegion (display, wks, numRectangles, deviceRectangles)
-
-INPUT Display *display;
-INPUT PEXWorkstation wks;
-INPUT unsigned long numRectangles;
-INPUT PEXDeviceRect *deviceRectangles;
-
-{
- register pexRedrawClipRegionReq *req;
- char *pBuf;
- int size;
-
-
- /*
- * Lock around the critical section, for multithreading.
- */
-
- LockDisplay (display);
-
-
- /*
- * Put the request in the X request buffer.
- */
-
- size = numRectangles * SIZEOF (pexDeviceRect);
- PEXGetReqExtra (RedrawClipRegion, size, pBuf);
-
- BEGIN_REQUEST_HEADER (RedrawClipRegion, pBuf, req);
-
- PEXStoreReqExtraHead (RedrawClipRegion, size, req);
- req->wks = wks;
- req->numRects = numRectangles;
-
- END_REQUEST_HEADER (RedrawClipRegion, pBuf, req);
-
- STORE_LISTOF_DEVRECT (numRectangles, deviceRectangles, pBuf);
-
-
- /*
- * Done, so unlock and check for synchronous-ness.
- */
-
- UnlockDisplay (display);
- PEXSyncHandle (display);
-}
diff --git a/xc/lib/PEX5/pl_xdata.h b/xc/lib/PEX5/pl_xdata.h
deleted file mode 100644
index 7d1ab2f8c..000000000
--- a/xc/lib/PEX5/pl_xdata.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/* $TOG: pl_xdata.h /main/6 1998/02/06 16:12:50 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.
-
-*/
-
-/*
- * Read data from the X buffer
- */
-
-#ifndef WORD64
-
-#define XREAD_LISTOF_CARD32(_display, _count, _pList) \
- _XRead (_display, (char *) _pList, (long) (SIZEOF (CARD32) * _count));
-
-
-#define XREAD_LISTOF_CARD16(_display, _count, _pList) \
- _XRead (_display, (char *) _pList, (long) (SIZEOF (CARD16) * _count));
-
-
-#define XREAD_LISTOF_FLOAT32(_display, _count, _pList, _fpConvert, _fpFormat) \
-{ \
- if (!fpConvert) \
- { \
- _XRead (_display, (char *) _pList, (long) (_count * SIZEOF (float))); \
- } \
- else \
- { \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_FLOAT32 (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
- } \
-}
-
-
-#define XREAD_LISTOF_COORD3D(_display, _count, _pList, _fpConvert, _fpFormat) \
-{ \
- if (!fpConvert) \
- { \
- _XRead (_display, (char *) _pList, \
- (long) (_count * SIZEOF (pexCoord3D))); \
- } \
- else \
- { \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_COORD3D (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
- } \
-}
-
-
-#define XREAD_LISTOF_DEVCOORD(_display, _count, _pList, _fpConvert, _fpFormat)\
-{ \
- if (!fpConvert) \
- { \
- _XRead (_display, (char *) _pList, \
- (long) (_count * SIZEOF (pexDeviceCoord))); \
- } \
- else \
- { \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, \
- _count * SIZEOF (pexDeviceCoord)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_DEVCOORD (_count, _pBuf, _pList, \
- _fpConvert, _fpFormat); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, \
- _count * SIZEOF (pexDeviceCoord)); \
- } \
-}
-
-
-#define XREAD_LISTOF_DEVRECT(_display, _count, _pList) \
- _XRead (_display, (char *) _pList, \
- (long) (_count * SIZEOF (pexDeviceRect)));
-
-
-#define XREAD_LISTOF_ELEMINFO(_display, _count, _pList) \
- _XRead (_display, (char *) _pList, \
- (long) (SIZEOF (pexElementInfo) * _count));
-
-
-#define XREAD_LISTOF_ELEMREF(_display, _count, _pList) \
- _XRead (_display, (char *) _pList, \
- (long) (_count * SIZEOF (pexElementRef)));
-
-
-#define XREAD_LISTOF_PICKELEMREF(_display, _count, _pList) \
- _XRead (_display, (char *) _pList, \
- (long) (_count * SIZEOF (pexPickElementRef)));
-
-
-#else /* WORD64 */
-
-
-#define XREAD_LISTOF_CARD32(_display, _count, _pList) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD32)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_CARD32 (_count, _pBuf, _pList); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD32)); \
-}
-
-
-#define XREAD_LISTOF_CARD16(_display, _count, _pList) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD16)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_CARD16 (_count, _pBuf, _pList); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (CARD16)); \
-}
-
-
-#define XREAD_LISTOF_FLOAT32(_display, _count, _pList, _fpConvert, _fpFormat) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_FLOAT32 (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (float)); \
-}
-
-
-#define XREAD_LISTOF_COORD3D(_display, _count, _pList, _fpConvert, _fpFormat) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_COORD3D (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexCoord3D)); \
-}
-
-
-#define XREAD_LISTOF_DEVCOORD(_display, _count, _pList, _fpConvert, _fpFormat)\
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceCoord)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_DEVCOORD (_count, _pBuf, _pList, _fpConvert, _fpFormat); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceCoord)); \
-}
-
-
-#define XREAD_LISTOF_DEVRECT(_display, _count, _pList) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceRect)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_DEVRECT (_count, _pBuf, _pList); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexDeviceRect)); \
-}
-
-
-#define XREAD_LISTOF_ELEMINFO(_display, _count, _pList) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementInfo)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_ELEMINFO (_count, _pBuf, _pList); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementInfo)); \
-}
-
-
-#define XREAD_LISTOF_ELEMREF(_display, _count, _pList) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementRef)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_ELEMREF (_count, _pBuf, _pList); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, _count * SIZEOF (pexElementRef)); \
-}
-
-
-#define XREAD_LISTOF_PICKELEMREF(_display, _count, _pList) \
-{ \
- char *_pBuf, *_pBufSave; \
- XREAD_INTO_SCRATCH (_display, _pBufSave, \
- _count * SIZEOF (pexPickElementRef)); \
- _pBuf = _pBufSave; \
- EXTRACT_LISTOF_PICKELEMREF (_count, _pBuf, _pList); \
- FINISH_WITH_SCRATCH (_display, _pBufSave, \
- _count * SIZEOF (pexPickElementRef)); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Send data to the X buffer
- */
-
-#ifndef WORD64
-
-#define XDATA_CARD32(_display, _val) \
- Data (_display, (char *) &_val, SIZEOF (CARD32));
-
-#define XDATA_MONOENCODING(_display, _encoding) \
- Data (_display, (char *) _encoding, SIZEOF (pexMonoEncoding));
-
-#else /* WORD64 */
-
-#define XDATA_CARD32(_display, _val) \
-{ \
- char tVal[4]; \
- CARD64_TO_32 (_val, tVal); \
- Data (_display, tVal, SIZEOF (CARD32)); \
-}
-
-#define XDATA_MONOENCODING(_display, _encoding) \
-{ \
- pexMonoEncoding tEncoding; \
- tEncoding.characterSet = _encoding->character_set; \
- tEncoding.characterSetWidth = _encoding->character_set_width; \
- tEncoding.encodingState = _encoding->encoding_state; \
- tEncoding.numChars = _encoding->length; \
- Data (_display, (char *) &tEncoding, SIZEOF (pexMonoEncoding)); \
-}
-
-#endif /* WORD64 */
diff --git a/xc/lib/SM/Imakefile b/xc/lib/SM/Imakefile
deleted file mode 100644
index 64cf1fc66..000000000
--- a/xc/lib/SM/Imakefile
+++ /dev/null
@@ -1,52 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/12 1996/12/04 10:22:18 lehors $
-XCOMM $XFree86: xc/lib/SM/Imakefile,v 1.2 1998/12/20 11:56:52 dawes Exp $
-
-#define DoNormalLib NormalLibSM
-#define DoSharedLib SharedLibSM
-#define DoExtraLib SharedLibSM
-#define DoDebugLib DebugLibSM
-#define DoProfileLib ProfileLibSM
-#define LibName SM
-#define SoRev SOSMREV
-#define IncSubdir X11
-#define IncSubSubdir SM
-
-#include <Threads.tmpl>
-
-#ifdef SharedSMReqs
-REQUIREDLIBS = SharedSMReqs
-#endif
-
-#if (SystemV || SystemV4) && !HasSockets
-CONN_DEFINES = -DTCPCONN -DICE_t
-#else
-CONN_DEFINES = $(CONNECTION_FLAGS) -DICE_t
-#endif
-DEPEND_DEFINES = $(CONN_DEFINES)
-
-HEADERS = SM.h \
- SMproto.h \
- SMlib.h
-
-SRCS = sm_client.c \
- sm_genid.c \
- sm_manager.c \
- sm_process.c \
- sm_error.c \
- sm_misc.c \
- sm_auth.c
-
-OBJS = sm_client.o \
- sm_genid.o \
- sm_manager.o \
- sm_process.o \
- sm_error.o \
- sm_misc.o \
- sm_auth.o
-
-#include <Library.tmpl>
-
-SpecialCLibObjectRule(sm_manager,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-SpecialCLibObjectRule(sm_genid,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES))
-
-DependTarget()
diff --git a/xc/lib/SM/SM-def.cpp b/xc/lib/SM/SM-def.cpp
deleted file mode 100644
index c53977945..000000000
--- a/xc/lib/SM/SM-def.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-LIBRARY SM
-VERSION LIBRARY_VERSION
-EXPORTS
- SmFreeProperty
- SmFreeReasons
- SmcClientID
- SmcCloseConnection
- SmcDeleteProperties
- SmcGetIceConnection
- SmcGetProperties
- SmcInteractDone
- SmcInteractRequest
- SmcModifyCallbacks
- SmcOpenConnection
- SmcProtocolRevision
- SmcProtocolVersion
- SmcRelease
- SmcRequestSaveYourself
- SmcRequestSaveYourselfPhase2
- SmcSaveYourselfDone
- SmcSetErrorHandler
- SmcSetProperties
- SmcVendor
- SmsCleanUp
- SmsClientHostName
- SmsClientID
- SmsDie
- SmsGenerateClientID
- SmsGetIceConnection
- SmsInitialize
- SmsInteract
- SmsProtocolRevision
- SmsProtocolVersion
- SmsRegisterClientReply
- SmsReturnProperties
- SmsSaveComplete
- SmsSaveYourself
- SmsSaveYourselfPhase2
- SmsSetErrorHandler
- SmsShutdownCancelled
-/* $XConsortium: SM-def.cpp /main/3 1996/05/07 13:15:21 kaleb $ */
diff --git a/xc/lib/SM/SM.h b/xc/lib/SM/SM.h
deleted file mode 100644
index 8cbb62e0d..000000000
--- a/xc/lib/SM/SM.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $TOG: SM.h /main/10 1998/02/06 14:09:46 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#ifndef _SM_H_
-#define _SM_H_
-
-/*
- * Protocol Version
- */
-
-#define SmProtoMajor 1
-#define SmProtoMinor 0
-
-
-/*
- * Interact Style
- */
-
-#define SmInteractStyleNone 0
-#define SmInteractStyleErrors 1
-#define SmInteractStyleAny 2
-
-
-/*
- * Dialog Type
- */
-
-#define SmDialogError 0
-#define SmDialogNormal 1
-
-
-/*
- * Save Type
- */
-
-#define SmSaveGlobal 0
-#define SmSaveLocal 1
-#define SmSaveBoth 2
-
-
-/*
- * Restart Style Hints
- */
-
-#define SmRestartIfRunning 0
-#define SmRestartAnyway 1
-#define SmRestartImmediately 2
-#define SmRestartNever 3
-
-
-/*
- * Property names
- */
-
-#define SmCloneCommand "CloneCommand"
-#define SmCurrentDirectory "CurrentDirectory"
-#define SmDiscardCommand "DiscardCommand"
-#define SmEnvironment "Environment"
-#define SmProcessID "ProcessID"
-#define SmProgram "Program"
-#define SmRestartCommand "RestartCommand"
-#define SmResignCommand "ResignCommand"
-#define SmRestartStyleHint "RestartStyleHint"
-#define SmShutdownCommand "ShutdownCommand"
-#define SmUserID "UserID"
-
-
-/*
- * Property types
- */
-
-#define SmCARD8 "CARD8"
-#define SmARRAY8 "ARRAY8"
-#define SmLISTofARRAY8 "LISTofARRAY8"
-
-
-/*
- * SM minor opcodes
- */
-
-#define SM_Error 0
-#define SM_RegisterClient 1
-#define SM_RegisterClientReply 2
-#define SM_SaveYourself 3
-#define SM_SaveYourselfRequest 4
-#define SM_InteractRequest 5
-#define SM_Interact 6
-#define SM_InteractDone 7
-#define SM_SaveYourselfDone 8
-#define SM_Die 9
-#define SM_ShutdownCancelled 10
-#define SM_CloseConnection 11
-#define SM_SetProperties 12
-#define SM_DeleteProperties 13
-#define SM_GetProperties 14
-#define SM_PropertiesReply 15
-#define SM_SaveYourselfPhase2Request 16
-#define SM_SaveYourselfPhase2 17
-#define SM_SaveComplete 18
-
-#endif /* _SM_H_ */
diff --git a/xc/lib/SM/SMlib.h b/xc/lib/SM/SMlib.h
deleted file mode 100644
index a7d129f94..000000000
--- a/xc/lib/SM/SMlib.h
+++ /dev/null
@@ -1,655 +0,0 @@
-/* $TOG: SMlib.h /main/24 1998/02/06 14:09:29 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#ifndef _SMLIB_H_
-#define _SMLIB_H_
-
-#include <X11/SM/SM.h>
-#include <X11/ICE/ICElib.h>
-
-
-/*
- * Generic SM pointer
- */
-
-typedef IcePointer SmPointer;
-
-
-/*
- * Connection objects. Defined in SMlibint.h
- */
-
-typedef struct _SmcConn *SmcConn;
-typedef struct _SmsConn *SmsConn;
-
-
-/*
- * Session Management property
- */
-
-typedef struct {
- int length; /* length (in bytes) of the value */
- SmPointer value; /* the value */
-} SmPropValue;
-
-typedef struct {
- char *name; /* name of property */
- char *type; /* type of property */
- int num_vals; /* number of values in property */
- SmPropValue *vals; /* the values */
-} SmProp;
-
-
-
-/*
- * SmcCloseConnection status return
- */
-
-typedef enum {
- SmcClosedNow,
- SmcClosedASAP,
- SmcConnectionInUse
-} SmcCloseStatus;
-
-
-
-/*
- * Client callbacks
- */
-
-typedef void (*SmcSaveYourselfProc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */,
- int /* saveType */,
- Bool /* shutdown */,
- int /* interactStyle */,
- Bool /* fast */
-#endif
-);
-
-typedef void (*SmcSaveYourselfPhase2Proc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */
-#endif
-);
-
-typedef void (*SmcInteractProc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */
-#endif
-);
-
-typedef void (*SmcDieProc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */
-#endif
-);
-
-typedef void (*SmcShutdownCancelledProc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */
-#endif
-);
-
-typedef void (*SmcSaveCompleteProc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */
-#endif
-);
-
-typedef void (*SmcPropReplyProc) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmPointer /* clientData */,
- int /* numProps */,
- SmProp ** /* props */
-#endif
-);
-
-
-/*
- * Callbacks set up at SmcOpenConnection time
- */
-
-typedef struct {
-
- struct {
- SmcSaveYourselfProc callback;
- SmPointer client_data;
- } save_yourself;
-
- struct {
- SmcDieProc callback;
- SmPointer client_data;
- } die;
-
- struct {
- SmcSaveCompleteProc callback;
- SmPointer client_data;
- } save_complete;
-
- struct {
- SmcShutdownCancelledProc callback;
- SmPointer client_data;
- } shutdown_cancelled;
-
-} SmcCallbacks;
-
-#define SmcSaveYourselfProcMask (1L << 0)
-#define SmcDieProcMask (1L << 1)
-#define SmcSaveCompleteProcMask (1L << 2)
-#define SmcShutdownCancelledProcMask (1L << 3)
-
-
-
-/*
- * Session manager callbacks
- */
-
-typedef Status (*SmsRegisterClientProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- char * /* previousId */
-#endif
-);
-
-typedef void (*SmsInteractRequestProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- int /* dialogType */
-#endif
-);
-
-typedef void (*SmsInteractDoneProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- Bool /* cancelShutdown */
-#endif
-);
-
-typedef void (*SmsSaveYourselfRequestProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- int /* saveType */,
- Bool /* shutdown */,
- int /* interactStyle */,
- Bool /* fast */,
- Bool /* global */
-#endif
-);
-
-typedef void (*SmsSaveYourselfPhase2RequestProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */
-#endif
-);
-
-typedef void (*SmsSaveYourselfDoneProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- Bool /* success */
-#endif
-);
-
-typedef void (*SmsCloseConnectionProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- int /* count */,
- char ** /* reasonMsgs */
-#endif
-);
-
-typedef void (*SmsSetPropertiesProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- int /* numProps */,
- SmProp ** /* props */
-#endif
-);
-
-typedef void (*SmsDeletePropertiesProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- int /* numProps */,
- char ** /* propNames */
-#endif
-);
-
-typedef void (*SmsGetPropertiesProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */
-#endif
-);
-
-
-/*
- * Callbacks set up by a session manager when a new client connects.
- */
-
-typedef struct {
-
- struct {
- SmsRegisterClientProc callback;
- SmPointer manager_data;
- } register_client;
-
- struct {
- SmsInteractRequestProc callback;
- SmPointer manager_data;
- } interact_request;
-
- struct {
- SmsInteractDoneProc callback;
- SmPointer manager_data;
- } interact_done;
-
- struct {
- SmsSaveYourselfRequestProc callback;
- SmPointer manager_data;
- } save_yourself_request;
-
- struct {
- SmsSaveYourselfPhase2RequestProc callback;
- SmPointer manager_data;
- } save_yourself_phase2_request;
-
- struct {
- SmsSaveYourselfDoneProc callback;
- SmPointer manager_data;
- } save_yourself_done;
-
- struct {
- SmsCloseConnectionProc callback;
- SmPointer manager_data;
- } close_connection;
-
- struct {
- SmsSetPropertiesProc callback;
- SmPointer manager_data;
- } set_properties;
-
- struct {
- SmsDeletePropertiesProc callback;
- SmPointer manager_data;
- } delete_properties;
-
- struct {
- SmsGetPropertiesProc callback;
- SmPointer manager_data;
- } get_properties;
-
-} SmsCallbacks;
-
-
-#define SmsRegisterClientProcMask (1L << 0)
-#define SmsInteractRequestProcMask (1L << 1)
-#define SmsInteractDoneProcMask (1L << 2)
-#define SmsSaveYourselfRequestProcMask (1L << 3)
-#define SmsSaveYourselfP2RequestProcMask (1L << 4)
-#define SmsSaveYourselfDoneProcMask (1L << 5)
-#define SmsCloseConnectionProcMask (1L << 6)
-#define SmsSetPropertiesProcMask (1L << 7)
-#define SmsDeletePropertiesProcMask (1L << 8)
-#define SmsGetPropertiesProcMask (1L << 9)
-
-
-
-typedef Status (*SmsNewClientProc) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- SmPointer /* managerData */,
- unsigned long * /* maskRet */,
- SmsCallbacks * /* callbacksRet */,
- char ** /* failureReasonRet */
-#endif
-);
-
-
-
-/*
- * Error handlers
- */
-
-typedef void (*SmcErrorHandler) (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- Bool /* swap */,
- int /* offendingMinorOpcode */,
- unsigned long /* offendingSequence */,
- int /* errorClass */,
- int /* severity */,
- SmPointer /* values */
-#endif
-);
-
-typedef void (*SmsErrorHandler) (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- Bool /* swap */,
- int /* offendingMinorOpcode */,
- unsigned long /* offendingSequence */,
- int /* errorClass */,
- int /* severity */,
- SmPointer /* values */
-#endif
-);
-
-
-
-/*
- * Function Prototypes
- */
-
-_XFUNCPROTOBEGIN
-
-extern SmcConn SmcOpenConnection (
-#if NeedFunctionPrototypes
- char * /* networkIdsList */,
- SmPointer /* context */,
- int /* xsmpMajorRev */,
- int /* xsmpMinorRev */,
- unsigned long /* mask */,
- SmcCallbacks * /* callbacks */,
- char * /* previousId */,
- char ** /* clientIdRet */,
- int /* errorLength */,
- char * /* errorStringRet */
-#endif
-);
-
-extern SmcCloseStatus SmcCloseConnection (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- int /* count */,
- char ** /* reasonMsgs */
-#endif
-);
-
-extern void SmcModifyCallbacks (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- unsigned long /* mask */,
- SmcCallbacks * /* callbacks */
-#endif
-);
-
-extern void SmcSetProperties (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- int /* numProps */,
- SmProp ** /* props */
-#endif
-);
-
-extern void SmcDeleteProperties (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- int /* numProps */,
- char ** /* propNames */
-#endif
-);
-
-extern Status SmcGetProperties (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmcPropReplyProc /* propReplyProc */,
- SmPointer /* clientData */
-#endif
-);
-
-extern Status SmcInteractRequest (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- int /* dialogType */,
- SmcInteractProc /* interactProc */,
- SmPointer /* clientData */
-#endif
-);
-
-extern void SmcInteractDone (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- Bool /* cancelShutdown */
-#endif
-);
-
-extern void SmcRequestSaveYourself (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- int /* saveType */,
- Bool /* shutdown */,
- int /* interactStyle */,
- Bool /* fast */,
- Bool /* global */
-#endif
-);
-
-extern Status SmcRequestSaveYourselfPhase2 (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- SmcSaveYourselfPhase2Proc /* saveYourselfPhase2Proc */,
- SmPointer /* clientData */
-#endif
-);
-
-extern void SmcSaveYourselfDone (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */,
- Bool /* success */
-#endif
-);
-
-extern int SmcProtocolVersion (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */
-#endif
-);
-
-extern int SmcProtocolRevision (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */
-#endif
-);
-
-extern char *SmcVendor (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */
-#endif
-);
-
-extern char *SmcRelease (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */
-#endif
-);
-
-extern char *SmcClientID (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */
-#endif
-);
-
-extern IceConn SmcGetIceConnection (
-#if NeedFunctionPrototypes
- SmcConn /* smcConn */
-#endif
-);
-
-extern Status SmsInitialize (
-#if NeedFunctionPrototypes
- char * /* vendor */,
- char * /* release */,
- SmsNewClientProc /* newClientProc */,
- SmPointer /* managerData */,
- IceHostBasedAuthProc /* hostBasedAuthProc */,
- int /* errorLength */,
- char * /* errorStringRet */
-#endif
-);
-
-extern char *SmsClientHostName (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern char *SmsGenerateClientID (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern Status SmsRegisterClientReply (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- char * /* clientId */
-#endif
-);
-
-extern void SmsSaveYourself (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- int /* saveType */,
- Bool /* shutdown */,
- int /* interactStyle */,
- Bool /* fast */
-#endif
-);
-
-extern void SmsSaveYourselfPhase2 (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern void SmsInteract (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern void SmsDie (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern void SmsSaveComplete (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern void SmsShutdownCancelled (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern void SmsReturnProperties (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */,
- int /* numProps */,
- SmProp ** /* props */
-#endif
-);
-
-extern void SmsCleanUp (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern int SmsProtocolVersion (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern int SmsProtocolRevision (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern char *SmsClientID (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern IceConn SmsGetIceConnection (
-#if NeedFunctionPrototypes
- SmsConn /* smsConn */
-#endif
-);
-
-extern SmcErrorHandler SmcSetErrorHandler (
-#if NeedFunctionPrototypes
- SmcErrorHandler /* handler */
-#endif
-);
-
-extern SmsErrorHandler SmsSetErrorHandler (
-#if NeedFunctionPrototypes
- SmsErrorHandler /* handler */
-#endif
-);
-
-extern void SmFreeProperty (
-#if NeedFunctionPrototypes
- SmProp * /* prop */
-#endif
-);
-
-extern void SmFreeReasons (
-#if NeedFunctionPrototypes
- int /* count */,
- char ** /* reasonMsgs */
-#endif
-);
-
-_XFUNCPROTOEND
-
-#endif /* _SMLIB_H_ */
diff --git a/xc/lib/SM/SMlibint.h b/xc/lib/SM/SMlibint.h
deleted file mode 100644
index b3984f0c4..000000000
--- a/xc/lib/SM/SMlibint.h
+++ /dev/null
@@ -1,516 +0,0 @@
-/* $TOG: SMlibint.h /main/21 1998/02/06 14:09:24 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#ifndef _SMLIBINT_H_
-#define _SMLIBINT_H_
-
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xmd.h>
-#include <X11/ICE/ICEmsg.h>
-#include <X11/ICE/ICEproto.h>
-#include <X11/SM/SMproto.h>
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-char *malloc();
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-
-/*
- * Vendor & Release
- */
-
-#define SmVendorString "MIT"
-#define SmReleaseString "1.0"
-
-
-/*
- * Pad to a 64 bit boundary
- */
-
-#define PAD64(_bytes) ((8 - ((unsigned int) (_bytes) % 8)) % 8)
-
-#define PADDED_BYTES64(_bytes) (_bytes + PAD64 (_bytes))
-
-
-/*
- * Pad to 32 bit boundary
- */
-
-#define PAD32(_bytes) ((4 - ((unsigned int) (_bytes) % 4)) % 4)
-
-#define PADDED_BYTES32(_bytes) (_bytes + PAD32 (_bytes))
-
-
-/*
- * Number of 8 byte units in _bytes.
- */
-
-#define WORD64COUNT(_bytes) (((unsigned int) ((_bytes) + 7)) >> 3)
-
-
-/*
- * Compute the number of bytes for an ARRAY8 representation
- */
-
-#define ARRAY8_BYTES(_len) (4 + _len + PAD64 (4 + _len))
-
-
-
-/*
- * Byte swapping
- */
-
-/* byte swap a long literal */
-#define lswapl(_val) ((((_val) & 0xff) << 24) |\
- (((_val) & 0xff00) << 8) |\
- (((_val) & 0xff0000) >> 8) |\
- (((_val) >> 24) & 0xff))
-
-/* byte swap a short literal */
-#define lswaps(_val) ((((_val) & 0xff) << 8) | (((_val) >> 8) & 0xff))
-
-
-/*
- * STORE macros
- */
-
-#ifndef WORD64
-
-#define STORE_CARD32(_pBuf, _val) \
-{ \
- *((CARD32 *) _pBuf) = _val; \
- _pBuf += 4; \
-}
-
-#else /* WORD64 */
-
-#define STORE_CARD32(_pBuf, _val) \
-{ \
- struct { \
- int value :32; \
- } _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, 4); \
- _pBuf += 4; \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * EXTRACT macros
- */
-
-#ifndef WORD64
-
-#define EXTRACT_CARD16(_pBuf, _swap, _val) \
-{ \
- _val = *((CARD16 *) _pBuf); \
- _pBuf += 2; \
- if (_swap) \
- _val = lswaps (_val); \
-}
-
-#define EXTRACT_CARD32(_pBuf, _swap, _val) \
-{ \
- _val = *((CARD32 *) _pBuf); \
- _pBuf += 4; \
- if (_swap) \
- _val = lswapl (_val); \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_CARD16(_pBuf, _swap, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
- _pBuf += 2; \
- if (_swap) \
- _val = lswaps (_val); \
-}
-
-#define EXTRACT_CARD32(_pBuf, _swap, _val) \
-{ \
- _val = *(_pBuf + 0) & 0xff; /* 0xff incase _pBuf is signed */ \
- _val <<= 8; \
- _val |= *(_pBuf + 1) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 2) & 0xff;\
- _val <<= 8; \
- _val |= *(_pBuf + 3) & 0xff;\
- _pBuf += 4; \
- if (_swap) \
- _val = lswapl (_val); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Compute the number of bytes for a LISTofPROPERTY representation
- */
-
-#define LISTOF_PROP_BYTES(_numProps, _props, _bytes) \
-{ \
- int _i, _j; \
- _bytes = 8; \
- for (_i = 0; _i < _numProps; _i++) \
- { \
- _bytes += (8 + ARRAY8_BYTES (strlen (_props[_i]->name)) + \
- ARRAY8_BYTES (strlen (_props[_i]->type))); \
-\
- for (_j = 0; _j < _props[_i]->num_vals; _j++) \
- _bytes += ARRAY8_BYTES (_props[_i]->vals[_j].length); \
- } \
-}
-
-
-/*
- * STORE FOO
- */
-
-#define STORE_ARRAY8(_pBuf, _len, _array8) \
-{ \
- STORE_CARD32 (_pBuf, _len); \
- memcpy (_pBuf, _array8, _len); \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
-}
-
-#define STORE_LISTOF_PROPERTY(_pBuf, _count, _props) \
-{ \
- int _i, _j; \
- STORE_CARD32 (_pBuf, _count); \
- _pBuf += 4; \
- for (_i = 0; _i < _count; _i++) \
- { \
- STORE_ARRAY8 (_pBuf, strlen (_props[_i]->name), _props[_i]->name); \
- STORE_ARRAY8 (_pBuf, strlen (_props[_i]->type), _props[_i]->type); \
- STORE_CARD32 (_pBuf, _props[_i]->num_vals); \
- _pBuf += 4; \
- for (_j = 0; _j < _props[_i]->num_vals; _j++) \
- { \
- STORE_ARRAY8 (_pBuf, _props[_i]->vals[_j].length, \
- (char *) _props[_i]->vals[_j].value); \
- } \
- } \
-}
-
-
-/*
- * EXTRACT FOO
- */
-
-#define EXTRACT_ARRAY8(_pBuf, _swap, _len, _array8) \
-{ \
- EXTRACT_CARD32 (_pBuf, _swap, _len); \
- _array8 = (char *) malloc (_len + 1); \
- memcpy (_array8, _pBuf, _len); \
- _array8[_len] = '\0'; \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
-}
-
-#define EXTRACT_ARRAY8_AS_STRING(_pBuf, _swap, _string) \
-{ \
- CARD32 _len; \
- EXTRACT_CARD32 (_pBuf, _swap, _len); \
- _string = (char *) malloc (_len + 1); \
- memcpy (_string, _pBuf, _len); \
- _string[_len] = '\0'; \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
-}
-
-#define EXTRACT_LISTOF_PROPERTY(_pBuf, _swap, _count, _props) \
-{ \
- int _i, _j; \
- EXTRACT_CARD32 (_pBuf, _swap, _count); \
- _pBuf += 4; \
- _props = (SmProp **) malloc (_count * sizeof (SmProp *)); \
- for (_i = 0; _i < _count; _i++) \
- { \
- _props[_i] = (SmProp *) malloc (sizeof (SmProp)); \
- EXTRACT_ARRAY8_AS_STRING (_pBuf, _swap, _props[_i]->name); \
- EXTRACT_ARRAY8_AS_STRING (_pBuf, _swap, _props[_i]->type); \
- EXTRACT_CARD32 (_pBuf, _swap, _props[_i]->num_vals); \
- _pBuf += 4; \
- _props[_i]->vals = (SmPropValue *) malloc ( \
- _props[_i]->num_vals * sizeof (SmPropValue)); \
- for (_j = 0; _j < _props[_i]->num_vals; _j++) \
- { \
- char *_temp; \
- EXTRACT_ARRAY8 (_pBuf, _swap, _props[_i]->vals[_j].length, _temp);\
- _props[_i]->vals[_j].value = (SmPointer) _temp; \
- } \
- } \
-}
-
-
-#define SKIP_ARRAY8(_pBuf, _swap) \
-{ \
- CARD32 _len; \
- EXTRACT_CARD32 (_pBuf, _swap, _len); \
- _pBuf += _len; \
- if (PAD64 (4 + _len)) \
- _pBuf += PAD64 (4 + _len); \
-}
-
-#define SKIP_LISTOF_PROPERTY(_pBuf, _swap) \
-{ \
- int _i, _j; \
- CARD32 _count; \
- EXTRACT_CARD32 (_pBuf, _swap, _count); \
- _pBuf += 4; \
- for (_i = 0; _i < _count; _i++) \
- { \
- CARD32 _numvals; \
- SKIP_ARRAY8 (_pBuf, _swap); \
- SKIP_ARRAY8 (_pBuf, _swap); \
- EXTRACT_CARD32 (_pBuf, _swap, _numvals); \
- _pBuf += 4; \
- for (_j = 0; _j < _numvals; _j++) \
- SKIP_ARRAY8 (_pBuf, _swap);\
- } \
-}
-
-
-/*
- * Client replies not processed by callbacks (we block for them).
- */
-
-typedef struct {
- Status status; /* if 1, client successfully registered */
- char *client_id;
-} _SmcRegisterClientReply;
-
-
-/*
- * Waiting for Interact
- */
-
-typedef struct _SmcInteractWait {
- SmcInteractProc interact_proc;
- SmPointer client_data;
- struct _SmcInteractWait *next;
-} _SmcInteractWait;
-
-
-/*
- * Waiting for SaveYourselfPhase2
- */
-
-typedef struct _SmcPhase2Wait {
- SmcSaveYourselfPhase2Proc phase2_proc;
- SmPointer client_data;
-} _SmcPhase2Wait;
-
-
-/*
- * Waiting for Properties Reply
- */
-
-typedef struct _SmcPropReplyWait {
- SmcPropReplyProc prop_reply_proc;
- SmPointer client_data;
- struct _SmcPropReplyWait *next;
-} _SmcPropReplyWait;
-
-
-
-/*
- * Client connection object
- */
-
-struct _SmcConn {
-
- /*
- * Some state.
- */
-
- unsigned int save_yourself_in_progress : 1;
- unsigned int shutdown_in_progress : 1;
- unsigned int unused1 : 6; /* future use */
- unsigned int unused2 : 8; /* future use */
-
-
- /*
- * We use ICE to esablish a connection with the SM.
- */
-
- IceConn iceConn;
-
-
- /*
- * Major and minor versions of the XSMP.
- */
-
- int proto_major_version;
- int proto_minor_version;
-
-
- /*
- * The session manager vendor and release number.
- */
-
- char *vendor;
- char *release;
-
-
- /*
- * The Client Id uniquely identifies this client to the session manager.
- */
-
- char *client_id;
-
-
- /*
- * Callbacks to be invoked when messages arrive from the session manager.
- * These callbacks are specified at SmcOpenConnection time.
- */
-
- SmcCallbacks callbacks;
-
-
- /*
- * We keep track of all Interact Requests sent by the client. When the
- * Interact message arrives, we remove it from the list (a FIFO list
- * is maintained).
- */
-
- _SmcInteractWait *interact_waits;
-
-
- /*
- * If we send a SaveYourselfPhase2Request, we wait for SaveYourselfPhase2.
- */
-
- _SmcPhase2Wait *phase2_wait;
-
-
- /*
- * We keep track of all Get Properties sent by the client. When the
- * Properties Reply arrives, we remove it from the list (a FIFO list
- * is maintained).
- */
-
- _SmcPropReplyWait *prop_reply_waits;
-};
-
-
-
-/*
- * Session manager connection object
- */
-
-struct _SmsConn {
-
- /*
- * Some state.
- */
-
- unsigned int save_yourself_in_progress : 1;
- unsigned int can_cancel_shutdown : 1;
- unsigned int interact_in_progress : 1;
- unsigned int unused1 : 5; /* future use */
- unsigned int unused2 : 8; /* future use */
-
-
- /*
- * We use ICE to esablish a connection with the client.
- */
-
- IceConn iceConn;
-
-
- /*
- * Major and minor versions of the XSMP.
- */
-
- int proto_major_version;
- int proto_minor_version;
-
-
- /*
- * The Client Id uniquely identifies this client to the session manager.
- */
-
- char *client_id;
-
-
- /*
- * Callbacks to be invoked when messages arrive from the client.
- */
-
- SmsCallbacks callbacks;
-
-
- /*
- * What type of interaction is allowed - SmInteractStyle{None,Errors,Any}
- */
-
- char interaction_allowed;
-};
-
-
-
-/*
- * Extern declarations
- */
-
-extern int _SmcOpcode;
-extern int _SmsOpcode;
-
-extern int _SmVersionCount;
-extern IcePoVersionRec _SmcVersions[];
-extern IcePaVersionRec _SmsVersions[];
-
-extern int _SmAuthCount;
-extern char *_SmAuthNames[];
-extern IcePoAuthProc _SmcAuthProcs[];
-extern IcePaAuthProc _SmsAuthProcs[];
-
-extern SmsNewClientProc _SmsNewClientProc;
-extern SmPointer _SmsNewClientData;
-
-extern SmcErrorHandler _SmcErrorHandler;
-extern SmsErrorHandler _SmsErrorHandler;
-
-#endif /* _SMLIBINT_H_ */
diff --git a/xc/lib/SM/SMos2.def b/xc/lib/SM/SMos2.def
deleted file mode 100644
index 460ec3eda..000000000
--- a/xc/lib/SM/SMos2.def
+++ /dev/null
@@ -1,63 +0,0 @@
-LIBRARY SM
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/SM/SMos2.def,v 3.5 1999/04/29 09:13:28 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- SmFreeProperty @ 1
- SmFreeReasons @ 2
- SmcClientID @ 3
- SmcCloseConnection @ 4
- SmcDeleteProperties @ 5
- SmcGetIceConnection @ 6
- SmcGetProperties @ 7
- SmcInteractDone @ 8
- SmcInteractRequest @ 9
- SmcModifyCallbacks @ 10
- SmcOpenConnection @ 11
- SmcProtocolRevision @ 12
- SmcProtocolVersion @ 13
- SmcRelease @ 14
- SmcRequestSaveYourself @ 15
- SmcRequestSaveYourselfPhase2 @ 16
- SmcSaveYourselfDone @ 17
- SmcSetErrorHandler @ 18
- SmcSetProperties @ 19
- SmcVendor @ 20
- SmsCleanUp @ 21
- SmsClientHostName @ 22
- SmsClientID @ 23
- SmsDie @ 24
- SmsGenerateClientID @ 25
- SmsGetIceConnection @ 26
- SmsInitialize @ 27
- SmsInteract @ 28
- SmsProtocolRevision @ 29
- SmsProtocolVersion @ 30
- SmsRegisterClientReply @ 31
- SmsReturnProperties @ 32
- SmsSaveComplete @ 33
- SmsSaveYourself @ 34
- SmsSaveYourselfPhase2 @ 35
- SmsSetErrorHandler @ 36
- SmsShutdownCancelled @ 37
- _SmcProcessMessage @ 38
- _SmsProcessMessage @ 39
- _SmcDefaultErrorHandler @ 40
- _SmsDefaultErrorHandler @ 41
- _SmsProtocolSetupProc @ 42
- _SmcOpcode @ 43
- _SmsOpcode @ 44
- _SmVersionCount @ 45
- _SmcVersions @ 46
- _SmsVersions @ 47
- _SmAuthCount @ 48
- _SmAuthNames @ 49
- _SmcAuthProcs @ 50
- _SmsAuthProcs @ 51
- _SmcErrorHandler @ 52
- _SmsErrorHandler @ 53
- _SmsNewClientProc @ 54
- _SmsNewClientData @ 55
diff --git a/xc/lib/SM/SMos2.rsp b/xc/lib/SM/SMos2.rsp
deleted file mode 100644
index 19dffbe68..000000000
--- a/xc/lib/SM/SMos2.rsp
+++ /dev/null
@@ -1,4 +0,0 @@
-sm_auth.obj sm_client.obj sm_error.obj sm_genid.obj sm_manager.obj+
-sm_misc.obj sm_process.obj /NOI /NOL /NOD /BAT
-SM.dll
-SM.map
diff --git a/xc/lib/SM/SMproto.h b/xc/lib/SM/SMproto.h
deleted file mode 100644
index 2669c4ad9..000000000
--- a/xc/lib/SM/SMproto.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* $TOG: SMproto.h /main/10 1998/02/06 14:09:35 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#ifndef _SMPROTO_H_
-#define _SMPROTO_H_
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
- /* n ARRAY8 previousId */
-} smRegisterClientMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
- /* n ARRAY8 clientId */
-} smRegisterClientReplyMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused1[2];
- CARD32 length B32;
- CARD8 saveType;
- CARD8 shutdown;
- CARD8 interactStyle;
- CARD8 fast;
- CARD8 unused2[4];
-} smSaveYourselfMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused1[2];
- CARD32 length B32;
- CARD8 saveType;
- CARD8 shutdown;
- CARD8 interactStyle;
- CARD8 fast;
- CARD8 global;
- CARD8 unused2[3];
-} smSaveYourselfRequestMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 dialogType;
- CARD8 unused;
- CARD32 length B32;
-} smInteractRequestMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smInteractMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 cancelShutdown;
- CARD8 unused;
- CARD32 length B32;
-} smInteractDoneMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 success;
- CARD8 unused;
- CARD32 length B32;
-} smSaveYourselfDoneMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smDieMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smShutdownCancelledMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
- /* b LISTofARRAY8 reasons */
-} smCloseConnectionMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
- /* a LISTofPROPERTY properties */
-} smSetPropertiesMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
- /* a LISTofARRAY8 property names */
-} smDeletePropertiesMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smGetPropertiesMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
- /* a LISTofPROPERTY properties */
-} smPropertiesReplyMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smSaveYourselfPhase2RequestMsg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smSaveYourselfPhase2Msg;
-
-typedef struct {
- CARD8 majorOpcode;
- CARD8 minorOpcode;
- CARD8 unused[2];
- CARD32 length B32;
-} smSaveCompleteMsg;
-
-
-/*
- * SIZEOF values. These better be multiples of 8.
- */
-
-#define sz_smRegisterClientMsg 8
-#define sz_smRegisterClientReplyMsg 8
-#define sz_smSaveYourselfMsg 16
-#define sz_smSaveYourselfRequestMsg 16
-#define sz_smInteractRequestMsg 8
-#define sz_smInteractMsg 8
-#define sz_smInteractDoneMsg 8
-#define sz_smSaveYourselfDoneMsg 8
-#define sz_smDieMsg 8
-#define sz_smShutdownCancelledMsg 8
-#define sz_smCloseConnectionMsg 8
-#define sz_smSetPropertiesMsg 8
-#define sz_smDeletePropertiesMsg 8
-#define sz_smGetPropertiesMsg 8
-#define sz_smPropertiesReplyMsg 8
-#define sz_smSaveYourselfPhase2RequestMsg 8
-#define sz_smSaveYourselfPhase2Msg 8
-#define sz_smSaveCompleteMsg 8
-
-#endif /* _SMPROTO_H_ */
diff --git a/xc/lib/SM/globals.h b/xc/lib/SM/globals.h
deleted file mode 100644
index 350d4144a..000000000
--- a/xc/lib/SM/globals.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $TOG: globals.h /main/13 1998/02/06 14:09:11 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/lib/SM/globals.h,v 1.2 1998/12/20 11:56:53 dawes Exp $ */
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-extern void _SmcDefaultErrorHandler ();
-extern void _SmsDefaultErrorHandler ();
-
-extern IcePoAuthStatus _IcePoMagicCookie1Proc ();
-extern IcePaAuthStatus _IcePaMagicCookie1Proc ();
-
-extern void _SmcProcessMessage ();
-extern void _SmsProcessMessage ();
-
-int _SmcOpcode = 0;
-int _SmsOpcode = 0;
-
-int _SmVersionCount = 1;
-
-IcePoVersionRec _SmcVersions[] = {
- {SmProtoMajor, SmProtoMinor, _SmcProcessMessage}};
-
-IcePaVersionRec _SmsVersions[] = {
- {SmProtoMajor, SmProtoMinor, _SmsProcessMessage}};
-
-int _SmAuthCount = 1;
-char *_SmAuthNames[] = {"MIT-MAGIC-COOKIE-1"};
-IcePoAuthProc _SmcAuthProcs[] = {_IcePoMagicCookie1Proc};
-IcePaAuthProc _SmsAuthProcs[] = {_IcePaMagicCookie1Proc};
-
-#ifndef __EMX__
-SmsNewClientProc _SmsNewClientProc;
-SmPointer _SmsNewClientData;
-#else
-SmsNewClientProc _SmsNewClientProc = 0;
-SmPointer _SmsNewClientData = 0;
-#endif
-
-SmcErrorHandler _SmcErrorHandler = _SmcDefaultErrorHandler;
-SmsErrorHandler _SmsErrorHandler = _SmsDefaultErrorHandler;
diff --git a/xc/lib/SM/sm_auth.c b/xc/lib/SM/sm_auth.c
deleted file mode 100644
index 7a65fe6a9..000000000
--- a/xc/lib/SM/sm_auth.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $TOG: sm_auth.c /main/12 1998/02/06 14:09:51 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-
-/*
- * For now, SMlib just supports MIT-MAGIC-COOKIE-1 (defined in ICElib).
- */
-
-
diff --git a/xc/lib/SM/sm_client.c b/xc/lib/SM/sm_client.c
deleted file mode 100644
index 1e349c0c9..000000000
--- a/xc/lib/SM/sm_client.c
+++ /dev/null
@@ -1,624 +0,0 @@
-/* $TOG: sm_client.c /main/31 1998/02/06 14:09:55 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-#include "globals.h"
-
-static void set_callbacks();
-
-
-SmcConn
-SmcOpenConnection (networkIdsList, context,
- xsmpMajorRev, xsmpMinorRev, mask, callbacks,
- previousId, clientIdRet, errorLength, errorStringRet)
-
-char *networkIdsList;
-SmPointer context;
-int xsmpMajorRev;
-int xsmpMinorRev;
-unsigned long mask;
-SmcCallbacks *callbacks;
-char *previousId;
-char **clientIdRet;
-int errorLength;
-char *errorStringRet;
-
-{
- SmcConn smcConn;
- IceConn iceConn;
- char *ids;
- IceProtocolSetupStatus setupstat;
- int majorVersion;
- int minorVersion;
- char *vendor = NULL;
- char *release = NULL;
- smRegisterClientMsg *pMsg;
- char *pData;
- int extra, len;
- IceReplyWaitInfo replyWait;
- _SmcRegisterClientReply reply;
- Bool gotReply, ioErrorOccured;
-
- *clientIdRet = NULL;
-
- if (errorStringRet && errorLength > 0)
- *errorStringRet = '\0';
-
- if (!_SmcOpcode)
- {
- /*
- * For now, there is only one version of XSMP, so we don't
- * have to check {xsmpMajorRev, xsmpMinorRev}. In the future,
- * we will check against _SmcVersions and generate the list
- * of versions the application actually supports.
- */
-
- if ((_SmcOpcode = IceRegisterForProtocolSetup ("XSMP",
- SmVendorString, SmReleaseString, _SmVersionCount, _SmcVersions,
- _SmAuthCount, _SmAuthNames, _SmcAuthProcs, NULL)) < 0)
- {
- strncpy (errorStringRet,
- "Could not register XSMP protocol with ICE", errorLength);
-
- return (NULL);
- }
- }
-
- if (networkIdsList == NULL || *networkIdsList == '\0')
- {
- if ((ids = (char *) getenv ("SESSION_MANAGER")) == NULL)
- {
- strncpy (errorStringRet,
- "SESSION_MANAGER environment variable not defined",
- errorLength);
-
- return (NULL);
- }
- }
- else
- {
- ids = networkIdsList;
- }
-
- if ((iceConn = IceOpenConnection (
- ids, context, 0, _SmcOpcode, errorLength, errorStringRet)) == NULL)
- {
- return (NULL);
- }
-
- if ((smcConn = (SmcConn) malloc (sizeof (struct _SmcConn))) == NULL)
- {
- strncpy (errorStringRet, "Can't malloc", errorLength);
- IceCloseConnection (iceConn);
- return (NULL);
- }
-
- setupstat = IceProtocolSetup (iceConn, _SmcOpcode,
- (IcePointer) smcConn,
- False /* mustAuthenticate */,
- &majorVersion, &minorVersion,
- &vendor, &release, errorLength, errorStringRet);
-
- if (setupstat == IceProtocolSetupFailure ||
- setupstat == IceProtocolSetupIOError)
- {
- IceCloseConnection (iceConn);
- free ((char *) smcConn);
- return (NULL);
- }
- else if (setupstat == IceProtocolAlreadyActive)
- {
- /*
- * This case should never happen, because when we called
- * IceOpenConnection, we required that the ICE connection
- * may not already have XSMP active on it.
- */
-
- free ((char *) smcConn);
- strncpy (errorStringRet, "Internal error in IceOpenConnection",
- errorLength);
- return (NULL);
- }
-
- smcConn->iceConn = iceConn;
- smcConn->proto_major_version = majorVersion;
- smcConn->proto_minor_version = minorVersion;
- smcConn->vendor = vendor;
- smcConn->release = release;
- smcConn->client_id = NULL;
-
- bzero ((char *) &smcConn->callbacks, sizeof (SmcCallbacks));
- set_callbacks (smcConn, mask, callbacks);
-
- smcConn->interact_waits = NULL;
- smcConn->phase2_wait = NULL;
- smcConn->prop_reply_waits = NULL;
-
- smcConn->save_yourself_in_progress = False;
- smcConn->shutdown_in_progress = False;
-
-
- /*
- * Now register the client
- */
-
- len = previousId ? strlen (previousId) : 0;
- extra = ARRAY8_BYTES (len);
-
- IceGetHeaderExtra (iceConn, _SmcOpcode, SM_RegisterClient,
- SIZEOF (smRegisterClientMsg), WORD64COUNT (extra),
- smRegisterClientMsg, pMsg, pData);
-
- STORE_ARRAY8 (pData, len, previousId);
-
- IceFlush (iceConn);
-
- replyWait.sequence_of_request = IceLastSentSequenceNumber (iceConn);
- replyWait.major_opcode_of_request = _SmcOpcode;
- replyWait.minor_opcode_of_request = SM_RegisterClient;
- replyWait.reply = (IcePointer) &reply;
-
- gotReply = False;
- ioErrorOccured = False;
-
- while (!gotReply && !ioErrorOccured)
- {
- ioErrorOccured = (IceProcessMessages (
- iceConn, &replyWait, &gotReply) == IceProcessMessagesIOError);
-
- if (ioErrorOccured)
- {
- strncpy (errorStringRet, "IO error occured opening connection",
- errorLength);
-
- free (smcConn->vendor);
- free (smcConn->release);
- free ((char *) smcConn);
-
- return (NULL);
- }
- else if (gotReply)
- {
- if (reply.status == 1)
- {
- /*
- * The client successfully registered.
- */
-
- *clientIdRet = reply.client_id;
-
- smcConn->client_id = (char *) malloc (
- strlen (*clientIdRet) + 1);
-
- strcpy (smcConn->client_id, *clientIdRet);
- }
- else
- {
- /*
- * Could not register the client because the previous ID
- * was bad. So now we register the client with the
- * previous ID set to NULL.
- */
-
- extra = ARRAY8_BYTES (0);
-
- IceGetHeaderExtra (iceConn, _SmcOpcode, SM_RegisterClient,
- SIZEOF (smRegisterClientMsg), WORD64COUNT (extra),
- smRegisterClientMsg, pMsg, pData);
-
- STORE_ARRAY8 (pData, 0, NULL);
-
- IceFlush (iceConn);
-
- replyWait.sequence_of_request =
- IceLastSentSequenceNumber (iceConn);
-
- gotReply = False;
- }
- }
- }
-
- return (smcConn);
-}
-
-
-
-SmcCloseStatus
-SmcCloseConnection (smcConn, count, reasonMsgs)
-
-SmcConn smcConn;
-int count;
-char **reasonMsgs;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smCloseConnectionMsg *pMsg;
- char *pData;
- int extra, i;
- IceCloseStatus closeStatus;
- SmcCloseStatus statusRet;
-
- extra = 8;
-
- for (i = 0; i < count; i++)
- extra += ARRAY8_BYTES (strlen (reasonMsgs[i]));
-
- IceGetHeaderExtra (iceConn, _SmcOpcode, SM_CloseConnection,
- SIZEOF (smCloseConnectionMsg), WORD64COUNT (extra),
- smCloseConnectionMsg, pMsg, pData);
-
- STORE_CARD32 (pData, count);
- pData += 4;
-
- for (i = 0; i < count; i++)
- STORE_ARRAY8 (pData, strlen (reasonMsgs[i]), reasonMsgs[i]);
-
- IceFlush (iceConn);
-
- IceProtocolShutdown (iceConn, _SmcOpcode);
- IceSetShutdownNegotiation (iceConn, False);
- closeStatus = IceCloseConnection (iceConn);
-
- if (smcConn->vendor)
- free (smcConn->vendor);
-
- if (smcConn->release)
- free (smcConn->release);
-
- if (smcConn->client_id)
- free (smcConn->client_id);
-
- if (smcConn->prop_reply_waits)
- {
- _SmcPropReplyWait *ptr = smcConn->prop_reply_waits;
- _SmcPropReplyWait *next;
-
- while (ptr)
- {
- next = ptr->next;
- free ((char *) ptr);
- ptr = next;
- }
-
- }
-
- free ((char *) smcConn);
-
- if (closeStatus == IceClosedNow)
- statusRet = SmcClosedNow;
- else if (closeStatus == IceClosedASAP)
- statusRet = SmcClosedASAP;
- else
- statusRet = SmcConnectionInUse;
-
- return (statusRet);
-}
-
-
-
-void
-SmcModifyCallbacks (smcConn, mask, callbacks)
-
-SmcConn smcConn;
-unsigned long mask;
-SmcCallbacks *callbacks;
-
-{
- set_callbacks (smcConn, mask, callbacks);
-}
-
-
-
-void
-SmcSetProperties (smcConn, numProps, props)
-
-SmcConn smcConn;
-int numProps;
-SmProp **props;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smSetPropertiesMsg *pMsg;
- char *pBuf;
- char *pStart;
- int bytes;
-
- IceGetHeader (iceConn, _SmcOpcode, SM_SetProperties,
- SIZEOF (smSetPropertiesMsg), smSetPropertiesMsg, pMsg);
-
- LISTOF_PROP_BYTES (numProps, props, bytes);
- pMsg->length += WORD64COUNT (bytes);
-
- pBuf = pStart = IceAllocScratch (iceConn, bytes);
-
- STORE_LISTOF_PROPERTY (pBuf, numProps, props);
-
- IceWriteData (iceConn, bytes, pStart);
- IceFlush (iceConn);
-}
-
-
-
-void
-SmcDeleteProperties (smcConn, numProps, propNames)
-
-SmcConn smcConn;
-int numProps;
-char **propNames;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smDeletePropertiesMsg *pMsg;
- char *pData;
- int extra, i;
-
- extra = 8;
-
- for (i = 0; i < numProps; i++)
- extra += ARRAY8_BYTES (strlen (propNames[i]));
-
- IceGetHeaderExtra (iceConn, _SmcOpcode, SM_DeleteProperties,
- SIZEOF (smDeletePropertiesMsg), WORD64COUNT (extra),
- smDeletePropertiesMsg, pMsg, pData);
-
- STORE_CARD32 (pData, numProps);
- pData += 4;
-
- for (i = 0; i < numProps; i++)
- STORE_ARRAY8 (pData, strlen (propNames[i]), propNames[i]);
-
- IceFlush (iceConn);
-}
-
-
-
-Status
-SmcGetProperties (smcConn, propReplyProc, clientData)
-
-SmcConn smcConn;
-SmcPropReplyProc propReplyProc;
-SmPointer clientData;
-
-{
- IceConn iceConn = smcConn->iceConn;
- _SmcPropReplyWait *wait, *ptr;
-
- if ((wait = (_SmcPropReplyWait *) malloc (
- sizeof (_SmcPropReplyWait))) == NULL)
- {
- return (0);
- }
-
- wait->prop_reply_proc = propReplyProc;
- wait->client_data = clientData;
- wait->next = NULL;
-
- ptr = smcConn->prop_reply_waits;
- while (ptr && ptr->next)
- ptr = ptr->next;
-
- if (ptr == NULL)
- smcConn->prop_reply_waits = wait;
- else
- ptr->next = wait;
-
- IceSimpleMessage (iceConn, _SmcOpcode, SM_GetProperties);
- IceFlush (iceConn);
-
- return (1);
-}
-
-
-
-Status
-SmcInteractRequest (smcConn, dialogType, interactProc, clientData)
-
-SmcConn smcConn;
-int dialogType;
-SmcInteractProc interactProc;
-SmPointer clientData;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smInteractRequestMsg *pMsg;
- _SmcInteractWait *wait, *ptr;
-
- if ((wait = (_SmcInteractWait *) malloc (
- sizeof (_SmcInteractWait))) == NULL)
- {
- return (0);
- }
-
- wait->interact_proc = interactProc;
- wait->client_data = clientData;
- wait->next = NULL;
-
- ptr = smcConn->interact_waits;
- while (ptr && ptr->next)
- ptr = ptr->next;
-
- if (ptr == NULL)
- smcConn->interact_waits = wait;
- else
- ptr->next = wait;
-
- IceGetHeader (iceConn, _SmcOpcode, SM_InteractRequest,
- SIZEOF (smInteractRequestMsg), smInteractRequestMsg, pMsg);
-
- pMsg->dialogType = dialogType;
-
- IceFlush (iceConn);
-
- return (1);
-}
-
-
-
-void
-SmcInteractDone (smcConn, cancelShutdown)
-
-SmcConn smcConn;
-Bool cancelShutdown;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smInteractDoneMsg *pMsg;
-
- IceGetHeader (iceConn, _SmcOpcode, SM_InteractDone,
- SIZEOF (smInteractDoneMsg), smInteractDoneMsg, pMsg);
-
- pMsg->cancelShutdown = cancelShutdown;
-
- IceFlush (iceConn);
-}
-
-
-
-void
-SmcRequestSaveYourself (smcConn, saveType, shutdown, interactStyle,
- fast, global)
-
-SmcConn smcConn;
-int saveType;
-Bool shutdown;
-int interactStyle;
-Bool fast;
-Bool global;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smSaveYourselfRequestMsg *pMsg;
-
- IceGetHeader (iceConn, _SmcOpcode, SM_SaveYourselfRequest,
- SIZEOF (smSaveYourselfRequestMsg), smSaveYourselfRequestMsg, pMsg);
-
- pMsg->saveType = saveType;
- pMsg->shutdown = shutdown;
- pMsg->interactStyle = interactStyle;
- pMsg->fast = fast;
- pMsg->global = global;
-
- IceFlush (iceConn);
-}
-
-
-
-Status
-SmcRequestSaveYourselfPhase2 (smcConn, saveYourselfPhase2Proc, clientData)
-
-SmcConn smcConn;
-SmcSaveYourselfPhase2Proc saveYourselfPhase2Proc;
-SmPointer clientData;
-
-{
- IceConn iceConn = smcConn->iceConn;
- _SmcPhase2Wait *wait;
-
- if (smcConn->phase2_wait)
- wait = smcConn->phase2_wait;
- else
- {
- if ((wait = (_SmcPhase2Wait *) malloc (
- sizeof (_SmcPhase2Wait))) == NULL)
- {
- return (0);
- }
- }
-
- wait->phase2_proc = saveYourselfPhase2Proc;
- wait->client_data = clientData;
-
- smcConn->phase2_wait = wait;
-
- IceSimpleMessage (iceConn, _SmcOpcode, SM_SaveYourselfPhase2Request);
- IceFlush (iceConn);
-
- return (1);
-}
-
-
-
-void
-SmcSaveYourselfDone (smcConn, success)
-
-SmcConn smcConn;
-Bool success;
-
-{
- IceConn iceConn = smcConn->iceConn;
- smSaveYourselfDoneMsg *pMsg;
-
- IceGetHeader (iceConn, _SmcOpcode, SM_SaveYourselfDone,
- SIZEOF (smSaveYourselfDoneMsg), smSaveYourselfDoneMsg, pMsg);
-
- pMsg->success = success;
-
- IceFlush (iceConn);
-}
-
-
-
-static void
-set_callbacks (smcConn, mask, callbacks)
-
-SmcConn smcConn;
-unsigned long mask;
-SmcCallbacks *callbacks;
-
-{
- if (mask & SmcSaveYourselfProcMask)
- {
- smcConn->callbacks.save_yourself.callback =
- callbacks->save_yourself.callback;
- smcConn->callbacks.save_yourself.client_data =
- callbacks->save_yourself.client_data;
- }
-
- if (mask & SmcDieProcMask)
- {
- smcConn->callbacks.die.callback = callbacks->die.callback;
- smcConn->callbacks.die.client_data = callbacks->die.client_data;
- }
-
- if (mask & SmcSaveCompleteProcMask)
- {
- smcConn->callbacks.save_complete.callback =
- callbacks->save_complete.callback;
- smcConn->callbacks.save_complete.client_data =
- callbacks->save_complete.client_data;
- }
-
- if (mask & SmcShutdownCancelledProcMask)
- {
- smcConn->callbacks.shutdown_cancelled.callback =
- callbacks->shutdown_cancelled.callback;
- smcConn->callbacks.shutdown_cancelled.client_data =
- callbacks->shutdown_cancelled.client_data;
- }
-}
diff --git a/xc/lib/SM/sm_error.c b/xc/lib/SM/sm_error.c
deleted file mode 100644
index b01d6be60..000000000
--- a/xc/lib/SM/sm_error.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/* $TOG: sm_error.c /main/12 1998/02/06 14:10:01 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-#include <stdio.h>
-
-
-
-/*
- * Default Smc error handler.
- */
-
-void
-_SmcDefaultErrorHandler (smcConn, swap,
- offendingMinorOpcode, offendingSequence,
- errorClass, severity, values)
-
-SmcConn smcConn;
-Bool swap;
-int offendingMinorOpcode;
-unsigned long offendingSequence;
-int errorClass;
-int severity;
-SmPointer values;
-
-{
- char *pData = (char *) values;
- char *str;
-
- switch (offendingMinorOpcode)
- {
- case SM_RegisterClient:
- str = "RegisterClient";
- break;
- case SM_InteractRequest:
- str = "InteractRequest";
- break;
- case SM_InteractDone:
- str = "InteractDone";
- break;
- case SM_SaveYourselfDone:
- str = "SaveYourselfDone";
- break;
- case SM_CloseConnection:
- str = "CloseConnection";
- break;
- case SM_SetProperties:
- str = "SetProperties";
- break;
- case SM_GetProperties:
- str = "GetProperties";
- break;
- default:
- str = "";
- }
-
- fprintf (stderr, "\n");
-
- fprintf (stderr, "XSMP error: Offending minor opcode = %d (%s)\n",
- offendingMinorOpcode, str);
-
- fprintf (stderr, " Offending sequence number = %d\n",
- offendingSequence);
-
- switch (errorClass)
- {
- case IceBadMinor:
- str = "BadMinor";
- break;
- case IceBadState:
- str = "BadState";
- break;
- case IceBadLength:
- str = "BadLength";
- break;
- case IceBadValue:
- str = "BadValue";
- break;
- default:
- str = "???";
- }
-
- fprintf (stderr, " Error class = %s\n", str);
-
- if (severity == IceCanContinue)
- str = "CanContinue";
- else if (severity == IceFatalToProtocol)
- str = "FatalToProtocol";
- else if (severity == IceFatalToConnection)
- str = "FatalToConnection";
- else
- str = "???";
-
- fprintf (stderr, " Severity = %s\n", str);
-
- switch (errorClass)
- {
- case IceBadValue:
- {
- int offset, length, val;
-
- EXTRACT_CARD32 (pData, swap, offset);
- EXTRACT_CARD32 (pData, swap, length);
-
- fprintf (stderr,
- " BadValue Offset = %d\n", offset);
- fprintf (stderr,
- " BadValue Length = %d\n", length);
-
- if (length <= 4)
- {
- if (length == 1)
- val = (int) *pData;
- else if (length == 2)
- {
- EXTRACT_CARD16 (pData, swap, val);
- }
- else
- {
- EXTRACT_CARD32 (pData, swap, val);
- }
-
- fprintf (stderr,
- " BadValue = %d\n", val);
- }
- break;
- }
-
- default:
- break;
- }
-
- fprintf (stderr, "\n");
-
- if (severity != IceCanContinue)
- exit (1);
-}
-
-
-
-/*
- * Default Sms error handler.
- */
-
-void
-_SmsDefaultErrorHandler (smsConn, swap,
- offendingMinorOpcode, offendingSequence,
- errorClass, severity, values)
-
-SmsConn smsConn;
-Bool swap;
-int offendingMinorOpcode;
-unsigned long offendingSequence;
-int errorClass;
-int severity;
-SmPointer values;
-
-{
- char *pData = (char *) values;
- char *str;
-
- switch (offendingMinorOpcode)
- {
- case SM_SaveYourself:
- str = "SaveYourself";
- break;
- case SM_Interact:
- str = "Interact";
- break;
- case SM_Die:
- str = "Die";
- break;
- case SM_ShutdownCancelled:
- str = "ShutdownCancelled";
- break;
- default:
- str = "";
- }
-
- fprintf (stderr, "\n");
-
- fprintf (stderr, "XSMP error: Offending minor opcode = %d (%s)\n",
- offendingMinorOpcode, str);
-
- fprintf (stderr, " Offending sequence number = %d\n",
- offendingSequence);
-
- switch (errorClass)
- {
- case IceBadMinor:
- str = "BadMinor";
- break;
- case IceBadState:
- str = "BadState";
- break;
- case IceBadLength:
- str = "BadLength";
- break;
- case IceBadValue:
- str = "BadValue";
- break;
- default:
- str = "???";
- }
-
- fprintf (stderr, " Error class = %s\n", str);
-
- if (severity == IceCanContinue)
- str = "CanContinue";
- else if (severity == IceFatalToProtocol)
- str = "FatalToProtocol";
- else if (severity == IceFatalToConnection)
- str = "FatalToConnection";
- else
- str = "???";
-
- fprintf (stderr, " Severity = %s\n", str);
-
- switch (errorClass)
- {
- case IceBadValue:
- {
- int offset, length, val;
-
- EXTRACT_CARD32 (pData, swap, offset);
- EXTRACT_CARD32 (pData, swap, length);
-
- fprintf (stderr,
- " BadValue Offset = %d\n", offset);
- fprintf (stderr,
- " BadValue Length = %d\n", length);
-
- if (length <= 4)
- {
- if (length == 1)
- val = (int) *pData;
- else if (length == 2)
- {
- EXTRACT_CARD16 (pData, swap, val);
- }
- else
- {
- EXTRACT_CARD32 (pData, swap, val);
- }
-
- fprintf (stderr,
- " BadValue = %d\n", val);
- }
- break;
- }
-
- default:
- break;
- }
-
- fprintf (stderr, "\n\n");
-
- /* don't exit() - that would kill the SM - pretty devastating */
-}
-
-
-
-/*
- * This procedure sets the Smc error handler to be the specified
- * routine. If NULL is passed in the default error handler is restored.
- * The function's return value is the previous error handler.
- */
-
-SmcErrorHandler
-SmcSetErrorHandler (handler)
-
-SmcErrorHandler handler;
-
-{
- SmcErrorHandler oldHandler = _SmcErrorHandler;
-
- if (handler != NULL)
- _SmcErrorHandler = handler;
- else
- _SmcErrorHandler = _SmcDefaultErrorHandler;
-
- return (oldHandler);
-}
-
-
-
-/*
- * This procedure sets the Sms error handler to be the specified
- * routine. If NULL is passed in the default error handler is restored.
- * The function's return value is the previous error handler.
- */
-
-SmsErrorHandler
-SmsSetErrorHandler (handler)
-
-SmsErrorHandler handler;
-
-{
- SmsErrorHandler oldHandler = _SmsErrorHandler;
-
- if (handler != NULL)
- _SmsErrorHandler = handler;
- else
- _SmsErrorHandler = _SmsDefaultErrorHandler;
-
- return (oldHandler);
-}
diff --git a/xc/lib/SM/sm_genid.c b/xc/lib/SM/sm_genid.c
deleted file mode 100644
index 0d964adbb..000000000
--- a/xc/lib/SM/sm_genid.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* $TOG: sm_genid.c /main/23 1998/02/06 14:10:08 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/lib/SM/sm_genid.c,v 3.10 1998/12/20 11:56:54 dawes Exp $ */
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#ifdef WIN32
-#define _WILLWINSOCK_
-#endif
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-#include <X11/Xtrans.h>
-#ifdef XTHREADS
-#include <X11/Xthreads.h>
-#endif
-#include <stdio.h>
-
-#if defined(X_NOT_STDC_ENV) && !defined(__EMX__)
-#define Time_t long
-extern Time_t time ();
-#else
-#include <time.h>
-#define Time_t time_t
-#endif
-
-#ifndef WIN32
-
-#if defined(TCPCONN) || defined(STREAMSCONN)
-#ifndef Lynx
-#include <sys/socket.h>
-#else
-#include <socket.h>
-#endif
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#define XOS_USE_NO_LOCKING
-#define X_INCLUDE_NETDB_H
-#include <X11/Xos_r.h>
-#endif
-
-#else /* WIN32 */
-
-#include <X11/Xwinsock.h>
-#include <X11/Xw32defs.h>
-#define X_INCLUDE_NETDB_H
-#define XOS_USE_MTSAFE_NETDBAPI
-#include <X11/Xos_r.h>
-
-#endif /* WIN32 */
-
-#ifdef MNX_TCPCONN
-#include <net/gen/netdb.h>
-
-#define TCPCONN
-#endif
-
-
-static char *hex_table[] = { /* for generating client IDs */
- "00", "01", "02", "03", "04", "05", "06", "07",
- "08", "09", "0a", "0b", "0c", "0d", "0e", "0f",
- "10", "11", "12", "13", "14", "15", "16", "17",
- "18", "19", "1a", "1b", "1c", "1d", "1e", "1f",
- "20", "21", "22", "23", "24", "25", "26", "27",
- "28", "29", "2a", "2b", "2c", "2d", "2e", "2f",
- "30", "31", "32", "33", "34", "35", "36", "37",
- "38", "39", "3a", "3b", "3c", "3d", "3e", "3f",
- "40", "41", "42", "43", "44", "45", "46", "47",
- "48", "49", "4a", "4b", "4c", "4d", "4e", "4f",
- "50", "51", "52", "53", "54", "55", "56", "57",
- "58", "59", "5a", "5b", "5c", "5d", "5e", "5f",
- "60", "61", "62", "63", "64", "65", "66", "67",
- "68", "69", "6a", "6b", "6c", "6d", "6e", "6f",
- "70", "71", "72", "73", "74", "75", "76", "77",
- "78", "79", "7a", "7b", "7c", "7d", "7e", "7f",
- "80", "81", "82", "83", "84", "85", "86", "87",
- "88", "89", "8a", "8b", "8c", "8d", "8e", "8f",
- "90", "91", "92", "93", "94", "95", "96", "97",
- "98", "99", "9a", "9b", "9c", "9d", "9e", "9f",
- "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
- "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af",
- "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7",
- "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf",
- "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7",
- "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf",
- "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
- "d8", "d9", "da", "db", "dc", "dd", "de", "df",
- "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7",
- "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef",
- "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
- "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff",
-};
-
-
-
-char *
-SmsGenerateClientID (smsConn)
-
-SmsConn smsConn;
-
-{
- char hostname[256];
- char address[14];
- char temp[256];
- char *id;
- static int sequence = 0;
-
- if (gethostname (hostname, sizeof (hostname)))
- return (NULL);
-
-#if defined(TCPCONN) || defined(STREAMSCONN)
- {
- char* inet_addr;
- char temp[4], *ptr1, *ptr2;
- unsigned char decimal[4];
- int i, len;
- _Xgethostbynameparams hparams;
- struct hostent *hostp;
-
- if ((hostp = _XGethostbyname (hostname,hparams)) != NULL)
- inet_addr = inet_ntoa (*(struct in_addr *)(hostp->h_addr));
- else
- return NULL;
- for (i = 0, ptr1 = inet_addr; i < 3; i++)
- {
- ptr2 = strchr (ptr1, '.');
- len = ptr2 - ptr1;
- if (!ptr2 || len > 3)
- return (NULL);
- strncpy (temp, ptr1, len);
- temp[len] = '\0';
- decimal[i] = atoi (temp);
- ptr1 = ptr2 + 1;
- }
-
- decimal[3] = atoi (ptr1);
-
- address[0] = '1';
- address[1] = '\0';
- for (i = 0; i < 4; i++)
- strcat (address, hex_table[decimal[i]]);
- }
-#else
- return (NULL);
-#endif
-
- sprintf (temp, "1%s%.13ld%.10d%.4d", address, time((Time_t*)0),
- getpid (), sequence);
-
- if (++sequence > 9999)
- sequence = 0;
-
- if ((id = malloc (strlen (temp) + 1)) != NULL)
- strcpy (id, temp);
-
- return (id);
-}
diff --git a/xc/lib/SM/sm_manager.c b/xc/lib/SM/sm_manager.c
deleted file mode 100644
index 2e4bdb489..000000000
--- a/xc/lib/SM/sm_manager.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* $TOG: sm_manager.c /main/25 1998/02/06 14:10:13 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-#include <X11/Xtrans.h>
-
-
-
-Status
-SmsInitialize (vendor, release, newClientProc, managerData,
- hostBasedAuthProc, errorLength, errorStringRet)
-
-char *vendor;
-char *release;
-SmsNewClientProc newClientProc;
-SmPointer managerData;
-IceHostBasedAuthProc hostBasedAuthProc;
-int errorLength;
-char *errorStringRet;
-
-{
- if (errorStringRet && errorLength > 0)
- *errorStringRet = '\0';
-
- if (!newClientProc)
- {
- strncpy (errorStringRet,
- "The SmsNewClientProc callback can't be NULL", errorLength);
-
- return (0);
- }
-
- if (!_SmsOpcode)
- {
- Status _SmsProtocolSetupProc ();
-
- if ((_SmsOpcode = IceRegisterForProtocolReply ("XSMP",
- vendor, release, _SmVersionCount, _SmsVersions,
- _SmAuthCount, _SmAuthNames, _SmsAuthProcs, hostBasedAuthProc,
- _SmsProtocolSetupProc,
- NULL, /* IceProtocolActivateProc - we don't care about
- when the Protocol Reply is sent, because the
- session manager can not immediately send a
- message - it must wait for RegisterClient. */
- NULL /* IceIOErrorProc */
- )) < 0)
- {
- strncpy (errorStringRet,
- "Could not register XSMP protocol with ICE", errorLength);
-
- return (0);
- }
- }
-
- _SmsNewClientProc = newClientProc;
- _SmsNewClientData = managerData;
-
- return (1);
-}
-
-
-
-Status
-_SmsProtocolSetupProc (iceConn,
- majorVersion, minorVersion, vendor, release,
- clientDataRet, failureReasonRet)
-
-IceConn iceConn;
-int majorVersion;
-int minorVersion;
-char *vendor;
-char *release;
-IcePointer *clientDataRet;
-char **failureReasonRet;
-
-{
- SmsConn smsConn;
- unsigned long mask;
- Status status;
-
- /*
- * vendor/release are undefined for ProtocolSetup in XSMP.
- */
-
- if (vendor)
- free (vendor);
- if (release)
- free (release);
-
-
- /*
- * Allocate new SmsConn.
- */
-
- if ((smsConn = (SmsConn) malloc (sizeof (struct _SmsConn))) == NULL)
- {
- char *str = "Memory allocation failed";
-
- if ((*failureReasonRet = (char *) malloc (strlen (str) + 1)) != NULL)
- strcpy (*failureReasonRet, str);
-
- return (0);
- }
-
- smsConn->iceConn = iceConn;
- smsConn->proto_major_version = majorVersion;
- smsConn->proto_minor_version = minorVersion;
- smsConn->client_id = NULL;
-
- smsConn->save_yourself_in_progress = False;
- smsConn->interaction_allowed = SmInteractStyleNone;
- smsConn->can_cancel_shutdown = False;
- smsConn->interact_in_progress = False;
-
- *clientDataRet = (IcePointer) smsConn;
-
-
- /*
- * Now give the session manager the new smsConn and get back the
- * callbacks to invoke when messages arrive from the client.
- *
- * In the future, we can use the mask return value to check
- * if the SM is expecting an older rev of SMlib.
- */
-
- bzero ((char *) &smsConn->callbacks, sizeof (SmsCallbacks));
-
- status = (*_SmsNewClientProc) (smsConn, _SmsNewClientData,
- &mask, &smsConn->callbacks, failureReasonRet);
-
- return (status);
-}
-
-
-
-char *
-SmsClientHostName (smsConn)
-
-SmsConn smsConn;
-
-{
- return (_IceTransGetPeerNetworkId (smsConn->iceConn->trans_conn));
-}
-
-
-
-Status
-SmsRegisterClientReply (smsConn, clientId)
-
-SmsConn smsConn;
-char *clientId;
-
-{
- IceConn iceConn = smsConn->iceConn;
- int extra;
- smRegisterClientReplyMsg *pMsg;
- char *pData;
-
- if ((smsConn->client_id = (char *) malloc (strlen (clientId) + 1)) == NULL)
- {
- return (0);
- }
-
- strcpy (smsConn->client_id, clientId);
-
- extra = ARRAY8_BYTES (strlen (clientId));
-
- IceGetHeaderExtra (iceConn, _SmsOpcode, SM_RegisterClientReply,
- SIZEOF (smRegisterClientReplyMsg), WORD64COUNT (extra),
- smRegisterClientReplyMsg, pMsg, pData);
-
- STORE_ARRAY8 (pData, strlen (clientId), clientId);
-
- IceFlush (iceConn);
-
- return (1);
-}
-
-
-
-void
-SmsSaveYourself (smsConn, saveType, shutdown, interactStyle, fast)
-
-SmsConn smsConn;
-int saveType;
-Bool shutdown;
-int interactStyle;
-Bool fast;
-
-{
- IceConn iceConn = smsConn->iceConn;
- smSaveYourselfMsg *pMsg;
-
- IceGetHeader (iceConn, _SmsOpcode, SM_SaveYourself,
- SIZEOF (smSaveYourselfMsg), smSaveYourselfMsg, pMsg);
-
- pMsg->saveType = saveType;
- pMsg->shutdown = shutdown;
- pMsg->interactStyle = interactStyle;
- pMsg->fast = fast;
-
- IceFlush (iceConn);
-
- smsConn->save_yourself_in_progress = True;
-
- if (interactStyle == SmInteractStyleNone ||
- interactStyle == SmInteractStyleErrors ||
- interactStyle == SmInteractStyleAny)
- {
- smsConn->interaction_allowed = interactStyle;
- }
- else
- {
- smsConn->interaction_allowed = SmInteractStyleNone;
- }
-
- smsConn->can_cancel_shutdown = shutdown &&
- (interactStyle == SmInteractStyleAny ||
- interactStyle == SmInteractStyleErrors);
-}
-
-
-
-void
-SmsSaveYourselfPhase2 (smsConn)
-
-SmsConn smsConn;
-
-{
- IceConn iceConn = smsConn->iceConn;
-
- IceSimpleMessage (iceConn, _SmsOpcode, SM_SaveYourselfPhase2);
- IceFlush (iceConn);
-}
-
-
-
-void
-SmsInteract (smsConn)
-
-SmsConn smsConn;
-
-{
- IceConn iceConn = smsConn->iceConn;
-
- IceSimpleMessage (iceConn, _SmsOpcode, SM_Interact);
- IceFlush (iceConn);
-
- smsConn->interact_in_progress = True;
-}
-
-
-
-void
-SmsDie (smsConn)
-
-SmsConn smsConn;
-
-{
- IceConn iceConn = smsConn->iceConn;
-
- IceSimpleMessage (iceConn, _SmsOpcode, SM_Die);
- IceFlush (iceConn);
-}
-
-
-
-void
-SmsSaveComplete (smsConn)
-
-SmsConn smsConn;
-
-{
- IceConn iceConn = smsConn->iceConn;
-
- IceSimpleMessage (iceConn, _SmsOpcode, SM_SaveComplete);
- IceFlush (iceConn);
-}
-
-
-
-void
-SmsShutdownCancelled (smsConn)
-
-SmsConn smsConn;
-
-{
- IceConn iceConn = smsConn->iceConn;
-
- IceSimpleMessage (iceConn, _SmsOpcode, SM_ShutdownCancelled);
- IceFlush (iceConn);
-
- smsConn->can_cancel_shutdown = False;
-}
-
-
-
-void
-SmsReturnProperties (smsConn, numProps, props)
-
-SmsConn smsConn;
-int numProps;
-SmProp **props;
-
-{
- IceConn iceConn = smsConn->iceConn;
- int bytes;
- smPropertiesReplyMsg *pMsg;
- char *pBuf;
- char *pStart;
-
- IceGetHeader (iceConn, _SmsOpcode, SM_PropertiesReply,
- SIZEOF (smPropertiesReplyMsg), smPropertiesReplyMsg, pMsg);
-
- LISTOF_PROP_BYTES (numProps, props, bytes);
- pMsg->length += WORD64COUNT (bytes);
-
- pBuf = pStart = IceAllocScratch (iceConn, bytes);
-
- STORE_LISTOF_PROPERTY (pBuf, numProps, props);
-
- IceWriteData (iceConn, bytes, pStart);
- IceFlush (iceConn);
-}
-
-
-
-void
-SmsCleanUp (smsConn)
-
-SmsConn smsConn;
-
-{
- IceProtocolShutdown (smsConn->iceConn, _SmsOpcode);
-
- if (smsConn->client_id)
- free (smsConn->client_id);
-
- free ((char *) smsConn);
-}
diff --git a/xc/lib/SM/sm_misc.c b/xc/lib/SM/sm_misc.c
deleted file mode 100644
index 9dba6f3b3..000000000
--- a/xc/lib/SM/sm_misc.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* $TOG: sm_misc.c /main/8 1998/02/06 14:10:19 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-#include <stdio.h>
-
-/*
- * Free property
- */
-
-void
-SmFreeProperty (prop)
-
-SmProp *prop;
-
-{
- if (prop)
- {
- int i;
-
- if (prop->name)
- free (prop->name);
- if (prop->type)
- free (prop->type);
- if (prop->vals)
- {
- for (i = 0; i < prop->num_vals; i++)
- if (prop->vals[i].value)
- free ((char *) prop->vals[i].value);
- free ((char *) prop->vals);
- }
-
- free ((char *) prop);
- }
-}
-
-
-/*
- * Free reason messages
- */
-
-void
-SmFreeReasons (count, reasonMsgs)
-
-int count;
-char **reasonMsgs;
-
-{
- if (reasonMsgs)
- {
- int i;
-
- for (i = 0; i < count; i++)
- free (reasonMsgs[i]);
-
- free ((char *) reasonMsgs);
- }
-}
-
-
-
-/*
- * Smc informational functions
- */
-
-int
-SmcProtocolVersion (smcConn)
-
-SmcConn smcConn;
-
-{
- return (smcConn->proto_major_version);
-}
-
-
-int
-SmcProtocolRevision (smcConn)
-
-SmcConn smcConn;
-
-{
- return (smcConn->proto_minor_version);
-}
-
-
-char *
-SmcVendor (smcConn)
-
-SmcConn smcConn;
-
-{
- char *string = (char *) malloc (strlen (smcConn->vendor) + 1);
-
- strcpy (string, smcConn->vendor);
-
- return (string);
-}
-
-
-char *
-SmcRelease (smcConn)
-
-SmcConn smcConn;
-
-{
- char *string = (char *) malloc (strlen (smcConn->release) + 1);
-
- strcpy (string, smcConn->release);
-
- return (string);
-}
-
-
-char *
-SmcClientID (smcConn)
-
-SmcConn smcConn;
-
-{
- char *clientId = (char *) malloc (strlen (smcConn->client_id) + 1);
-
- strcpy (clientId, smcConn->client_id);
-
- return (clientId);
-}
-
-
-IceConn
-SmcGetIceConnection (smcConn)
-
-SmcConn smcConn;
-
-{
- return (smcConn->iceConn);
-}
-
-
-
-/*
- * Sms informational functions
- */
-
-int
-SmsProtocolVersion (smsConn)
-
-SmsConn smsConn;
-
-{
- return (smsConn->proto_major_version);
-}
-
-
-int
-SmsProtocolRevision (smsConn)
-
-SmsConn smsConn;
-
-{
- return (smsConn->proto_minor_version);
-}
-
-
-char *
-SmsClientID (smsConn)
-
-SmsConn smsConn;
-
-{
- char *clientId = (char *) malloc (strlen (smsConn->client_id) + 1);
-
- strcpy (clientId, smsConn->client_id);
-
- return (clientId);
-}
-
-
-IceConn
-SmsGetIceConnection (smsConn)
-
-SmsConn smsConn;
-
-{
- return (smsConn->iceConn);
-}
diff --git a/xc/lib/SM/sm_process.c b/xc/lib/SM/sm_process.c
deleted file mode 100644
index 78b6dd891..000000000
--- a/xc/lib/SM/sm_process.c
+++ /dev/null
@@ -1,871 +0,0 @@
-/* $TOG: sm_process.c /main/30 1998/02/06 14:10:24 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.
-
-*/
-
-/*
- * Author: Ralph Mor, X Consortium
- */
-
-#include <X11/SM/SMlib.h>
-#include "SMlibint.h"
-
-
-/*
- * Check for bad length
- */
-
-#define CHECK_SIZE_MATCH(_iceConn, _majorOp, _minorOp, _expected_len, _actual_len, _severity) \
- if ((((_actual_len) - SIZEOF (iceMsg)) >> 3) != _expected_len) \
- { \
- _IceErrorBadLength (_iceConn, _majorOp, _minorOp, _severity); \
- return; \
- }
-
-#define CHECK_AT_LEAST_SIZE(_iceConn, _majorOp, _minorOp, _expected_len, _actual_len, _severity) \
- if ((((_actual_len) - SIZEOF (iceMsg)) >> 3) > _expected_len) \
- { \
- _IceErrorBadLength (_iceConn, _majorOp, _minorOp, _severity); \
- return; \
- }
-
-#define CHECK_COMPLETE_SIZE(_iceConn, _majorOp, _minorOp, _expected_len, _actual_len, _pStart, _severity) \
- if (((PADDED_BYTES64((_actual_len)) - SIZEOF (iceMsg)) >> 3) \
- != _expected_len) \
- { \
- _IceErrorBadLength (_iceConn, _majorOp, _minorOp, _severity); \
- IceDisposeCompleteMessage (iceConn, _pStart); \
- return; \
- }
-
-
-
-void
-_SmcProcessMessage (iceConn, clientData, opcode,
- length, swap, replyWait, replyReadyRet)
-
-IceConn iceConn;
-IcePointer clientData;
-int opcode;
-unsigned long length;
-Bool swap;
-IceReplyWaitInfo *replyWait;
-Bool *replyReadyRet;
-
-{
- SmcConn smcConn = (SmcConn) clientData;
-
- if (replyWait)
- *replyReadyRet = False;
-
- if (!smcConn->client_id &&
- opcode != SM_RegisterClientReply && opcode != SM_Error)
- {
- _IceReadSkip (iceConn, length << 3);
-
- _IceErrorBadState (iceConn, _SmcOpcode, opcode, IceFatalToProtocol);
- return;
- }
-
- switch (opcode)
- {
- case SM_Error:
- {
- iceErrorMsg *pMsg;
- char *pData;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (iceErrorMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceErrorMsg),
- iceErrorMsg, pMsg, pData);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pData);
- return;
- }
-
- if (swap)
- {
- pMsg->errorClass = lswaps (pMsg->errorClass);
- pMsg->offendingSequenceNum = lswapl (pMsg->offendingSequenceNum);
- }
-
- if (replyWait &&
- replyWait->minor_opcode_of_request == SM_RegisterClient &&
- pMsg->errorClass == IceBadValue &&
- pMsg->offendingMinorOpcode == SM_RegisterClient &&
- pMsg->offendingSequenceNum == replyWait->sequence_of_request)
- {
- /*
- * For Register Client, the previous ID was bad.
- */
-
- _SmcRegisterClientReply *reply =
- (_SmcRegisterClientReply *) (replyWait->reply);
-
- reply->status = 0;
-
- *replyReadyRet = True;
- }
- else
- {
- (*_SmcErrorHandler) (smcConn, swap,
- pMsg->offendingMinorOpcode,
- pMsg->offendingSequenceNum,
- pMsg->errorClass, pMsg->severity,
- (SmPointer) pData);
- }
-
- IceDisposeCompleteMessage (iceConn, pData);
- break;
- }
-
- case SM_RegisterClientReply:
-
- if (!replyWait ||
- replyWait->minor_opcode_of_request != SM_RegisterClient)
- {
- _IceReadSkip (iceConn, length << 3);
-
- _IceErrorBadState (iceConn, _SmcOpcode,
- SM_RegisterClientReply, IceFatalToProtocol);
- }
- else
- {
- smRegisterClientReplyMsg *pMsg;
- char *pData, *pStart;
- _SmcRegisterClientReply *reply =
- (_SmcRegisterClientReply *) (replyWait->reply);
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smRegisterClientReplyMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (smRegisterClientReplyMsg),
- smRegisterClientReplyMsg, pMsg, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return;
- }
-
- pData = pStart;
-
- SKIP_ARRAY8 (pData, swap); /* client id */
-
- CHECK_COMPLETE_SIZE (iceConn, _SmcOpcode, opcode,
- length, pData - pStart + SIZEOF (smRegisterClientReplyMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart;
-
- EXTRACT_ARRAY8_AS_STRING (pData, swap, reply->client_id);
-
- reply->status = 1;
- *replyReadyRet = True;
-
- IceDisposeCompleteMessage (iceConn, pStart);
- }
- break;
-
- case SM_SaveYourself:
- {
- smSaveYourselfMsg *pMsg;
- unsigned char errVal;
- int errOffset = -1;
-
- CHECK_SIZE_MATCH (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smSaveYourselfMsg),
- IceFatalToProtocol);
-
- IceReadMessageHeader (iceConn, SIZEOF (smSaveYourselfMsg),
- smSaveYourselfMsg, pMsg);
-
- if (!IceValidIO (iceConn))
- {
- return;
- }
-
- if (pMsg->saveType != SmSaveGlobal &&
- pMsg->saveType != SmSaveLocal &&
- pMsg->saveType != SmSaveBoth)
- {
- errVal = pMsg->saveType;
- errOffset = 8;
- }
- else if (pMsg->shutdown != 1 && pMsg->shutdown != 0)
- {
- errVal = pMsg->shutdown;
- errOffset = 9;
- }
- else if (pMsg->interactStyle != SmInteractStyleNone &&
- pMsg->interactStyle != SmInteractStyleErrors &&
- pMsg->interactStyle != SmInteractStyleAny)
- {
- errVal = pMsg->interactStyle;
- errOffset = 10;
- }
- else if (pMsg->fast != 1 && pMsg->fast != 0)
- {
- errVal = pMsg->fast;
- errOffset = 11;
- }
-
- if (errOffset >= 0)
- {
- _IceErrorBadValue (iceConn, _SmcOpcode,
- SM_SaveYourself, errOffset, 1, (IcePointer) &errVal);
- }
- else
- {
- (*smcConn->callbacks.save_yourself.callback) (smcConn,
- smcConn->callbacks.save_yourself.client_data,
- pMsg->saveType, pMsg->shutdown,
- pMsg->interactStyle, pMsg->fast);
-
- smcConn->save_yourself_in_progress = True;
-
- if (pMsg->shutdown)
- smcConn->shutdown_in_progress = True;
- }
- break;
- }
-
- case SM_SaveYourselfPhase2:
-
- if (!smcConn->phase2_wait)
- {
- _IceErrorBadState (iceConn, _SmcOpcode,
- SM_SaveYourselfPhase2, IceCanContinue);
- }
- else
- {
- CHECK_SIZE_MATCH (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smSaveYourselfPhase2Msg),
- IceFatalToProtocol);
-
- (*smcConn->phase2_wait->phase2_proc) (smcConn,
- smcConn->phase2_wait->client_data);
-
- free ((char *) smcConn->phase2_wait);
- smcConn->phase2_wait = NULL;
- }
- break;
-
- case SM_Interact:
-
- if (!smcConn->interact_waits)
- {
- _IceErrorBadState (iceConn, _SmcOpcode,
- SM_Interact, IceCanContinue);
- }
- else
- {
- _SmcInteractWait *next = smcConn->interact_waits->next;
-
- CHECK_SIZE_MATCH (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smInteractMsg),
- IceFatalToProtocol);
-
- (*smcConn->interact_waits->interact_proc) (smcConn,
- smcConn->interact_waits->client_data);
-
- free ((char *) smcConn->interact_waits);
- smcConn->interact_waits = next;
- }
- break;
-
- case SM_SaveComplete:
-
- if (!smcConn->save_yourself_in_progress)
- {
- _IceErrorBadState (iceConn, _SmcOpcode,
- SM_SaveComplete, IceCanContinue);
- }
- else
- {
- CHECK_SIZE_MATCH (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smSaveCompleteMsg),
- IceFatalToProtocol);
-
- smcConn->save_yourself_in_progress = False;
-
- (*smcConn->callbacks.save_complete.callback) (smcConn,
- smcConn->callbacks.save_complete.client_data);
- }
- break;
-
- case SM_Die:
-
- CHECK_SIZE_MATCH (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smDieMsg),
- IceFatalToProtocol);
-
- (*smcConn->callbacks.die.callback) (smcConn,
- smcConn->callbacks.die.client_data);
- break;
-
- case SM_ShutdownCancelled:
-
- if (!smcConn->shutdown_in_progress)
- {
- _IceErrorBadState (iceConn, _SmcOpcode,
- SM_ShutdownCancelled, IceCanContinue);
- }
- else
- {
- CHECK_SIZE_MATCH (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smShutdownCancelledMsg),
- IceFatalToProtocol);
-
- smcConn->shutdown_in_progress = False;
-
- (*smcConn->callbacks.shutdown_cancelled.callback) (smcConn,
- smcConn->callbacks.shutdown_cancelled.client_data);
- }
- break;
-
- case SM_PropertiesReply:
-
- if (!smcConn->prop_reply_waits)
- {
- _IceReadSkip (iceConn, length << 3);
-
- _IceErrorBadState (iceConn, _SmcOpcode,
- SM_PropertiesReply, IceCanContinue);
- }
- else
- {
- smPropertiesReplyMsg *pMsg;
- char *pData, *pStart;
- int numProps;
- SmProp **props = NULL;
- _SmcPropReplyWait *next;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmcOpcode, opcode,
- length, SIZEOF (smPropertiesReplyMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (smPropertiesReplyMsg),
- smPropertiesReplyMsg, pMsg, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return;
- }
-
- pData = pStart;
-
- SKIP_LISTOF_PROPERTY (pData, swap);
-
- CHECK_COMPLETE_SIZE (iceConn, _SmcOpcode, opcode,
- length, pData - pStart + SIZEOF (smPropertiesReplyMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart;
-
- EXTRACT_LISTOF_PROPERTY (pData, swap, numProps, props);
-
- next = smcConn->prop_reply_waits->next;
-
- (*smcConn->prop_reply_waits->prop_reply_proc) (smcConn,
- smcConn->prop_reply_waits->client_data, numProps, props);
-
- free ((char *) smcConn->prop_reply_waits);
- smcConn->prop_reply_waits = next;
-
- IceDisposeCompleteMessage (iceConn, pStart);
- }
- break;
-
- default:
- {
- _IceErrorBadMinor (iceConn, _SmcOpcode, opcode, IceCanContinue);
- _IceReadSkip (iceConn, length << 3);
- break;
- }
- }
-}
-
-
-
-void
-_SmsProcessMessage (iceConn, clientData, opcode, length, swap)
-
-IceConn iceConn;
-IcePointer clientData;
-int opcode;
-unsigned long length;
-Bool swap;
-
-{
- SmsConn smsConn = (SmsConn) clientData;
-
- if (!smsConn->client_id &&
- opcode != SM_RegisterClient && opcode != SM_Error)
- {
- _IceReadSkip (iceConn, length << 3);
-
- _IceErrorBadState (iceConn, _SmsOpcode, opcode, IceFatalToProtocol);
-
- return;
- }
-
- switch (opcode)
- {
- case SM_Error:
- {
- iceErrorMsg *pMsg;
- char *pData;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (iceErrorMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (iceErrorMsg),
- iceErrorMsg, pMsg, pData);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pData);
- return;
- }
-
- if (swap)
- {
- pMsg->errorClass = lswaps (pMsg->errorClass);
- pMsg->offendingSequenceNum = lswapl (pMsg->offendingSequenceNum);
- }
-
- (*_SmsErrorHandler) (smsConn, swap,
- pMsg->offendingMinorOpcode,
- pMsg->offendingSequenceNum,
- pMsg->errorClass, pMsg->severity,
- (SmPointer) pData);
-
- IceDisposeCompleteMessage (iceConn, pData);
- break;
- }
-
- case SM_RegisterClient:
- {
- smRegisterClientMsg *pMsg;
- char *pData, *pStart;
- char *previousId;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smRegisterClientMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (smRegisterClientMsg),
- smRegisterClientMsg, pMsg, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return;
- }
-
- pData = pStart;
-
- SKIP_ARRAY8 (pData, swap); /* previous id */
-
- CHECK_COMPLETE_SIZE (iceConn, _SmsOpcode, opcode,
- length, pData - pStart + SIZEOF (smRegisterClientMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart;
-
- EXTRACT_ARRAY8_AS_STRING (pData, swap, previousId);
-
- if (*previousId == '\0')
- {
- free (previousId);
- previousId = NULL;
- }
-
- if (!(*smsConn->callbacks.register_client.callback) (smsConn,
- smsConn->callbacks.register_client.manager_data, previousId))
- {
- /*
- * The previoudId was bad. Generate BadValue error.
- */
-
- int length = previousId ? strlen (previousId) : 0;
- int bytes = ARRAY8_BYTES (length);
-
- _IceErrorBadValue (smsConn->iceConn, _SmsOpcode, SM_RegisterClient,
- 8, bytes, (IcePointer) pStart);
- }
-
- IceDisposeCompleteMessage (iceConn, pStart);
- break;
- }
-
- case SM_InteractRequest:
-
- if (!smsConn->save_yourself_in_progress ||
- smsConn->interaction_allowed == SmInteractStyleNone)
- {
- _IceErrorBadState (iceConn, _SmsOpcode,
- SM_InteractRequest, IceCanContinue);
- }
- else
- {
- smInteractRequestMsg *pMsg;
-
- CHECK_SIZE_MATCH (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smInteractRequestMsg),
- IceFatalToProtocol);
-
- IceReadSimpleMessage (iceConn, smInteractRequestMsg, pMsg);
-
- if (pMsg->dialogType != SmDialogNormal &&
- pMsg->dialogType != SmDialogError)
- {
- unsigned char errVal = pMsg->dialogType;
-
- _IceErrorBadValue (iceConn, _SmsOpcode,
- SM_InteractRequest, 2, 1, (IcePointer) &errVal);
- }
- else if (pMsg->dialogType == SmDialogNormal &&
- smsConn->interaction_allowed != SmInteractStyleAny)
- {
- _IceErrorBadState (iceConn, _SmsOpcode,
- SM_InteractRequest, IceCanContinue);
- }
- else
- {
- (*smsConn->callbacks.interact_request.callback) (smsConn,
- smsConn->callbacks.interact_request.manager_data,
- pMsg->dialogType);
- }
- }
- break;
-
- case SM_InteractDone:
-
- if (!smsConn->interact_in_progress)
- {
- _IceErrorBadState (iceConn, _SmsOpcode,
- SM_InteractDone, IceCanContinue);
- }
- else
- {
- smInteractDoneMsg *pMsg;
-
- CHECK_SIZE_MATCH (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smInteractDoneMsg),
- IceFatalToProtocol);
-
- IceReadSimpleMessage (iceConn, smInteractDoneMsg, pMsg);
-
- if (pMsg->cancelShutdown != 1 &&
- pMsg->cancelShutdown != 0)
- {
- unsigned char errVal = pMsg->cancelShutdown;
-
- _IceErrorBadValue (iceConn, _SmsOpcode,
- SM_InteractDone, 2, 1, (IcePointer) &errVal);
- }
- else if (pMsg->cancelShutdown && !smsConn->can_cancel_shutdown)
- {
- _IceErrorBadState (iceConn, _SmsOpcode,
- SM_InteractDone, IceCanContinue);
- }
- else
- {
- smsConn->interact_in_progress = False;
-
- (*smsConn->callbacks.interact_done.callback) (smsConn,
- smsConn->callbacks.interact_done.manager_data,
- pMsg->cancelShutdown);
- }
- }
- break;
-
- case SM_SaveYourselfRequest:
- {
- smSaveYourselfRequestMsg *pMsg;
- unsigned char errVal;
- int errOffset = -1;
-
- CHECK_SIZE_MATCH (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smSaveYourselfRequestMsg),
- IceFatalToProtocol);
-
- IceReadMessageHeader (iceConn, SIZEOF (smSaveYourselfRequestMsg),
- smSaveYourselfRequestMsg, pMsg);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pMsg);
- return;
- }
-
- if (pMsg->saveType != SmSaveGlobal &&
- pMsg->saveType != SmSaveLocal &&
- pMsg->saveType != SmSaveBoth)
- {
- errVal = pMsg->saveType;
- errOffset = 8;
- }
- else if (pMsg->shutdown != 1 && pMsg->shutdown != 0)
- {
- errVal = pMsg->shutdown;
- errOffset = 9;
- }
- else if (pMsg->interactStyle != SmInteractStyleNone &&
- pMsg->interactStyle != SmInteractStyleErrors &&
- pMsg->interactStyle != SmInteractStyleAny)
- {
- errVal = pMsg->interactStyle;
- errOffset = 10;
- }
- else if (pMsg->fast != 1 && pMsg->fast != 0)
- {
- errVal = pMsg->fast;
- errOffset = 11;
- }
- else if (pMsg->global != 1 && pMsg->global != 0)
- {
- errVal = pMsg->fast;
- errOffset = 11;
- }
-
- if (errOffset >= 0)
- {
- _IceErrorBadValue (iceConn, _SmsOpcode,
- SM_SaveYourselfRequest, errOffset, 1, (IcePointer) &errVal);
- }
- else
- {
- (*smsConn->callbacks.save_yourself_request.callback) (smsConn,
- smsConn->callbacks.save_yourself_request.manager_data,
- pMsg->saveType, pMsg->shutdown, pMsg->interactStyle,
- pMsg->fast, pMsg->global);
- }
- break;
- }
-
- case SM_SaveYourselfPhase2Request:
-
- if (!smsConn->save_yourself_in_progress)
- {
- _IceErrorBadState (iceConn, _SmsOpcode,
- SM_SaveYourselfPhase2Request, IceCanContinue);
- }
- else
- {
- CHECK_SIZE_MATCH (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smSaveYourselfPhase2RequestMsg),
- IceFatalToProtocol);
-
- (*smsConn->callbacks.save_yourself_phase2_request.callback) (
- smsConn, smsConn->callbacks.
- save_yourself_phase2_request.manager_data);
- }
- break;
-
- case SM_SaveYourselfDone:
-
- if (!smsConn->save_yourself_in_progress)
- {
- _IceErrorBadState (iceConn, _SmsOpcode,
- SM_SaveYourselfDone, IceCanContinue);
- }
- else
- {
- smSaveYourselfDoneMsg *pMsg;
-
- CHECK_SIZE_MATCH (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smSaveYourselfDoneMsg),
- IceFatalToProtocol);
-
- IceReadSimpleMessage (iceConn, smSaveYourselfDoneMsg, pMsg);
-
- if (pMsg->success != 1 && pMsg->success != 0)
- {
- unsigned char errVal = pMsg->success;
-
- _IceErrorBadValue (iceConn, _SmsOpcode,
- SM_SaveYourselfDone, 2, 1, (IcePointer) &errVal);
- }
- else
- {
- smsConn->save_yourself_in_progress = False;
- smsConn->interaction_allowed = SmInteractStyleNone;
-
- (*smsConn->callbacks.save_yourself_done.callback) (smsConn,
- smsConn->callbacks.save_yourself_done.manager_data,
- pMsg->success);
- }
- }
- break;
-
- case SM_CloseConnection:
- {
- smCloseConnectionMsg *pMsg;
- char *pData, *pStart;
- int count, i;
- char **reasonMsgs = NULL;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smCloseConnectionMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (smCloseConnectionMsg),
- smCloseConnectionMsg, pMsg, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return;
- }
-
- pData = pStart;
-
- EXTRACT_CARD32 (pData, swap, count);
- pData += 4;
-
- for (i = 0; i < count; i++)
- SKIP_ARRAY8 (pData, swap);
-
- CHECK_COMPLETE_SIZE (iceConn, _SmsOpcode, opcode,
- length, pData - pStart + SIZEOF (smCloseConnectionMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart + 8;
-
- reasonMsgs = (char **) malloc (count * sizeof (char *));
- for (i = 0; i < count; i++)
- EXTRACT_ARRAY8_AS_STRING (pData, swap, reasonMsgs[i]);
-
- IceDisposeCompleteMessage (iceConn, pStart);
-
- (*smsConn->callbacks.close_connection.callback) (smsConn,
- smsConn->callbacks.close_connection.manager_data,
- count, reasonMsgs);
- break;
- }
-
- case SM_SetProperties:
- {
- smSetPropertiesMsg *pMsg;
- char *pData, *pStart;
- SmProp **props = NULL;
- int numProps;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smSetPropertiesMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (smSetPropertiesMsg),
- smSetPropertiesMsg, pMsg, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return;
- }
-
- pData = pStart;
-
- SKIP_LISTOF_PROPERTY (pData, swap);
-
- CHECK_COMPLETE_SIZE (iceConn, _SmsOpcode, opcode,
- length, pData - pStart + SIZEOF (smSetPropertiesMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart;
-
- EXTRACT_LISTOF_PROPERTY (pData, swap, numProps, props);
-
- (*smsConn->callbacks.set_properties.callback) (smsConn,
- smsConn->callbacks.set_properties.manager_data, numProps, props);
-
- IceDisposeCompleteMessage (iceConn, pStart);
- break;
- }
-
- case SM_DeleteProperties:
- {
- smDeletePropertiesMsg *pMsg;
- char *pData, *pStart;
- int count, i;
- char **propNames = NULL;
-
- CHECK_AT_LEAST_SIZE (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smDeletePropertiesMsg), IceFatalToProtocol);
-
- IceReadCompleteMessage (iceConn, SIZEOF (smDeletePropertiesMsg),
- smDeletePropertiesMsg, pMsg, pStart);
-
- if (!IceValidIO (iceConn))
- {
- IceDisposeCompleteMessage (iceConn, pStart);
- return;
- }
-
- pData = pStart;
-
- EXTRACT_CARD32 (pData, swap, count);
- pData += 4;
-
- for (i = 0; i < count; i++)
- SKIP_ARRAY8 (pData, swap); /* prop names */
-
- CHECK_COMPLETE_SIZE (iceConn, _SmsOpcode, opcode,
- length, pData - pStart + SIZEOF (smDeletePropertiesMsg),
- pStart, IceFatalToProtocol);
-
- pData = pStart + 8;
-
- propNames = (char **) malloc (count * sizeof (char *));
- for (i = 0; i < count; i++)
- EXTRACT_ARRAY8_AS_STRING (pData, swap, propNames[i]);
-
- IceDisposeCompleteMessage (iceConn, pStart);
-
- (*smsConn->callbacks.delete_properties.callback) (smsConn,
- smsConn->callbacks.delete_properties.manager_data,
- count, propNames);
-
- break;
- }
-
- case SM_GetProperties:
-
- CHECK_SIZE_MATCH (iceConn, _SmsOpcode, opcode,
- length, SIZEOF (smGetPropertiesMsg),
- IceFatalToProtocol);
-
- (*smsConn->callbacks.get_properties.callback) (smsConn,
- smsConn->callbacks.get_properties.manager_data);
- break;
-
- default:
- {
- _IceErrorBadMinor (iceConn, _SmsOpcode, opcode, IceCanContinue);
- _IceReadSkip (iceConn, length << 3);
- break;
- }
- }
-}
diff --git a/xc/lib/XIE/Imakefile b/xc/lib/XIE/Imakefile
deleted file mode 100644
index 09c9e9edc..000000000
--- a/xc/lib/XIE/Imakefile
+++ /dev/null
@@ -1,74 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/7 1996/09/28 16:43:07 rws $
-XCOMM $XFree86: xc/lib/XIE/Imakefile,v 1.2 1998/12/20 11:56:58 dawes Exp $
-
-#define DoNormalLib NormalLibXie
-#define DoSharedLib SharedLibXie
-#define DoExtraLib SharedLibXie
-#define DoDebugLib DebugLibXie
-#define DoProfileLib ProfileLibXie
-#define LibName XIE
-#define SoRev SOXIEREV
-#define IncSubdir X11
-#define IncSubSubdir extensions
-
-#include <Threads.tmpl>
-
-#ifdef SharedXieReqs
-REQUIREDLIBS = SharedXieReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
-DEFINES = $(ALLOC_DEFINES)
-
-HEADERS = XIElib.h
-
-SRCS = abort.c \
- await.c \
- clientdata.c \
- colorlist.c \
- conven.c \
- elements.c \
- free.c \
- errors.c \
- events.c \
- ieee.c \
- init.c \
- lut.c \
- photoflo.c \
- photomap.c \
- photospace.c \
- roi.c \
- technique.c \
- utils.c
-
-OBJS = abort.o \
- await.o \
- clientdata.o \
- colorlist.o \
- conven.o \
- elements.o \
- errors.o \
- events.o \
- free.o \
- ieee.o \
- init.o \
- lut.o \
- photoflo.o \
- photomap.o \
- photospace.o \
- roi.o \
- technique.o \
- utils.o
-
-#include <Library.tmpl>
-
-#ifdef NativeFPFormat
-NATIVE_FP_FORMAT = NativeFPFormat
-FP_DEFINES = -DNATIVE_FP_FORMAT=$(NATIVE_FP_FORMAT)
-SpecialCLibObjectRule(ieee,$(ICONFIGFILES),$(FP_DEFINES))
-#endif
-
-DependTarget()
diff --git a/xc/lib/XIE/XIE-def.cpp b/xc/lib/XIE/XIE-def.cpp
deleted file mode 100644
index cbaa648db..000000000
--- a/xc/lib/XIE/XIE-def.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-LIBRARY XIE
-VERSION LIBRARY_VERSION
-EXPORTS
- XieAbort
- XieAllocatePhotofloGraph
- XieAwait
- XieCreateColorList
- XieCreateLUT
- XieCreatePhotoflo
- XieCreatePhotomap
- XieCreatePhotospace
- XieCreateROI
- XieDestroyColorList
- XieDestroyLUT
- XieDestroyPhotoflo
- XieDestroyPhotomap
- XieDestroyPhotospace
- XieDestroyROI
- XieExecuteImmediate
- XieExecutePhotoflo
- XieFloArithmetic
- XieFloBandCombine
- XieFloBandExtract
- XieFloBandSelect
- XieFloBlend
- XieFloCompare
- XieFloConstrain
- XieFloConvertFromIndex
- XieFloConvertFromRGB
- XieFloConvertToIndex
- XieFloConvertToRGB
- XieFloConvolve
- XieFloDither
- XieFloExportClientHistogram
- XieFloExportClientLUT
- XieFloExportClientPhoto
- XieFloExportClientROI
- XieFloExportDrawable
- XieFloExportDrawablePlane
- XieFloExportLUT
- XieFloExportPhotomap
- XieFloExportROI
- XieFloGeometry
- XieFloImportClientLUT
- XieFloImportClientPhoto
- XieFloImportClientROI
- XieFloImportDrawable
- XieFloImportDrawablePlane
- XieFloImportLUT
- XieFloImportPhotomap
- XieFloImportROI
- XieFloLogical
- XieFloMatchHistogram
- XieFloMath
- XieFloPasteUp
- XieFloPoint
- XieFloUnconstrain
- XieFreeEncodeJPEGBaseline
- XieFreeEncodeJPEGLossless
- XieFreePasteUpTiles
- XieFreePhotofloGraph
- XieFreeTechniques
- XieGetClientData
- XieInitialize
- XieModifyPhotoflo
- XiePurgeColorList
- XiePutClientData
- XieQueryColorList
- XieQueryPhotoflo
- XieQueryPhotomap
- XieQueryTechniques
- XieRedefinePhotoflo
- XieTecCIELabToRGB
- XieTecCIEXYZToRGB
- XieTecClipScale
- XieTecColorAllocAll
- XieTecColorAllocMatch
- XieTecColorAllocRequantize
- XieTecConvolveConstant
- XieTecDecodeG31D
- XieTecDecodeG32D
- XieTecDecodeG42D
- XieTecDecodeJPEGBaseline
- XieTecDecodeJPEGLossless
- XieTecDecodeTIFF2
- XieTecDecodeTIFFPackBits
- XieTecDecodeUncompressedSingle
- XieTecDecodeUncompressedTriple
- XieTecDitherOrderedParam
- XieTecEncodeG31D
- XieTecEncodeG32D
- XieTecEncodeG42D
- XieTecEncodeJPEGBaseline
- XieTecEncodeJPEGLossless
- XieTecEncodeServerChoice
- XieTecEncodeTIFF2
- XieTecEncodeTIFFPackBits
- XieTecEncodeUncompressedSingle
- XieTecEncodeUncompressedTriple
- XieTecGeomAntialiasByArea
- XieTecGeomAntialiasByLowpass
- XieTecGeomGaussian
- XieTecGeomNearestNeighbor
- XieTecHistogramGaussian
- XieTecHistogramHyperbolic
- XieTecRGBToCIELab
- XieTecRGBToCIEXYZ
- XieTecRGBToYCC
- XieTecRGBToYCbCr
- XieTecWhiteAdjustCIELabShift
- XieTecYCCToRGB
- XieTecYCbCrToRGB
-/* $XConsortium: XIE-def.cpp /main/3 1996/05/07 13:15:28 kaleb $ */
diff --git a/xc/lib/XIE/XIElib.h b/xc/lib/XIE/XIElib.h
deleted file mode 100644
index fcbe74c64..000000000
--- a/xc/lib/XIE/XIElib.h
+++ /dev/null
@@ -1,1910 +0,0 @@
-/* $TOG: XIElib.h /main/13 1998/02/06 15:13:26 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.
-
-*/
-
-#ifndef _XIELIB_H_
-#define _XIELIB_H_
-
-#include <X11/Xlib.h>
-#include <X11/extensions/XIE.h>
-
-/*--------------------------------------------------------------------------*
- * XIE types *
- *--------------------------------------------------------------------------*/
-
-typedef float XieFloat;
-
-typedef float XieConstant[3];
-
-typedef float XieMatrix[9];
-
-typedef unsigned XieAlignment;
-
-typedef unsigned XieArithmeticOp;
-
-typedef unsigned XieColorAllocTechnique;
-
-typedef XID XieColorList;
-
-typedef unsigned XieColorspace;
-
-typedef unsigned XieCompareOp;
-
-typedef unsigned XieConstrainTechnique;
-
-typedef unsigned XieConvolveTechnique;
-
-typedef unsigned XieDataClass;
-
-typedef unsigned XieDataType;
-
-typedef unsigned XieDecodeTechnique;
-
-typedef unsigned XieDitherTechnique;
-
-typedef unsigned XieEncodeTechnique;
-
-typedef XID XiePhotospace;
-
-typedef XID XiePhotoflo;
-
-typedef unsigned XieExportNotify;
-
-typedef unsigned XieExportState;
-
-typedef unsigned XieGamutTechnique;
-
-typedef unsigned XieGeometryTechnique;
-
-typedef struct {
- unsigned long value;
- unsigned long count;
-} XieHistogramData;
-
-typedef unsigned XieHistogramShape;
-
-typedef unsigned XieInterleave;
-
-typedef unsigned long XieLevels[3];
-
-typedef XID XieLut;
-
-typedef unsigned XieMathOp;
-
-typedef unsigned XieOrientation;
-
-typedef unsigned XiePhotofloOutcome;
-
-typedef unsigned XiePhotofloState;
-
-typedef XID XiePhotomap;
-
-typedef unsigned XiePhototag;
-
-typedef struct {
- int offset_x;
- int offset_y;
- XiePhototag phototag;
-} XieProcessDomain;
-
-typedef struct { /* this is bcopyable on 32 bit machines */
- long x; /* when using PutClientData */
- long y;
- unsigned long width;
- unsigned long height;
-} XieRectangle;
-
-typedef XID XieRoi;
-
-typedef unsigned XieServiceClass;
-
-typedef unsigned XieTechniqueGroup;
-
-typedef struct {
- Bool needs_param;
- XieTechniqueGroup group;
- unsigned int number;
- unsigned int speed;
- char *name;
-} XieTechnique;
-
-typedef struct {
- XiePhototag src;
- int dst_x;
- int dst_y;
-} XieTile;
-
-typedef unsigned long XieLTriplet[3];
-
-typedef unsigned XieWhiteAdjustTechnique;
-
-#if NeedFunctionPrototypes
-typedef void *XiePointer;
-#else
-typedef char *XiePointer;
-#endif
-
-
-/*--------------------------------------------------------------------------*
- * Extension information *
- *--------------------------------------------------------------------------*/
-
-typedef struct {
- unsigned server_major_rev;
- unsigned server_minor_rev;
- XieServiceClass service_class;
- XieAlignment alignment;
- int uncnst_mantissa;
- int uncnst_min_exp;
- int uncnst_max_exp;
- int n_cnst_levels; /* number of constrained levels */
- unsigned long *cnst_levels; /* recommended constrained levels */
- int major_opcode;
- int first_event;
- int first_error;
-} XieExtensionInfo;
-
-
-/*--------------------------------------------------------------------------*
- * Photoflo element union *
- *--------------------------------------------------------------------------*/
-
-typedef struct {
-
- int elemType;
-
- union {
-
- /*
- * Import Elements
- */
-
- struct {
- XieDataClass data_class;
- XieOrientation band_order;
- XieLTriplet length;
- XieLevels levels;
- } ImportClientLUT;
-
- struct {
- XieDataClass data_class;
- XieLTriplet width;
- XieLTriplet height;
- XieLevels levels;
- Bool notify;
- XieDecodeTechnique decode_tech;
- XiePointer decode_param;
- } ImportClientPhoto;
-
- struct {
- unsigned int rectangles;
- } ImportClientROI;
-
- struct {
- Drawable drawable;
- int src_x;
- int src_y;
- unsigned int width;
- unsigned int height;
- unsigned long fill;
- Bool notify;
- } ImportDrawable;
-
- struct {
- Drawable drawable;
- int src_x;
- int src_y;
- unsigned int width;
- unsigned int height;
- unsigned long fill;
- unsigned long bit_plane;
- Bool notify;
- } ImportDrawablePlane;
-
- struct {
- XieLut lut;
- } ImportLUT;
-
- struct {
- XiePhotomap photomap;
- Bool notify;
- } ImportPhotomap;
-
- struct {
- XieRoi roi;
- } ImportROI;
-
-
- /*
- * Process Elements
- */
-
- struct {
- XiePhototag src1;
- XiePhototag src2;
- XieProcessDomain domain;
- XieConstant constant;
- XieArithmeticOp operator;
- unsigned int band_mask;
- } Arithmetic;
-
- struct {
- XiePhototag src1;
- XiePhototag src2;
- XiePhototag src3;
- } BandCombine;
-
- struct {
- XiePhototag src;
- unsigned int levels;
- float bias;
- XieConstant coefficients;
- } BandExtract;
-
- struct {
- XiePhototag src;
- unsigned int band_number;
- } BandSelect;
-
- struct {
- XiePhototag src1;
- XiePhototag src2;
- XieConstant src_constant;
- XiePhototag alpha;
- float alpha_constant;
- XieProcessDomain domain;
- unsigned int band_mask;
- } Blend;
-
- struct {
- XiePhototag src1;
- XiePhototag src2;
- XieProcessDomain domain;
- XieConstant constant;
- XieCompareOp operator;
- Bool combine;
- unsigned int band_mask;
- } Compare;
-
- struct {
- XiePhototag src;
- XieLevels levels;
- XieConstrainTechnique constrain_tech;
- XiePointer constrain_param;
- } Constrain;
-
- struct {
- XiePhototag src;
- Colormap colormap;
- XieDataClass data_class;
- unsigned int precision;
- } ConvertFromIndex;
-
- struct {
- XiePhototag src;
- XieColorspace color_space;
- XiePointer color_param;
- } ConvertFromRGB;
-
- struct {
- XiePhototag src;
- Colormap colormap;
- XieColorList color_list;
- Bool notify;
- XieColorAllocTechnique color_alloc_tech;
- XiePointer color_alloc_param;
- } ConvertToIndex;
-
- struct {
- XiePhototag src;
- XieColorspace color_space;
- XiePointer color_param;
- } ConvertToRGB;
-
- struct {
- XiePhototag src;
- XieProcessDomain domain;
- float *kernel;
- int kernel_size;
- unsigned int band_mask;
- XieConvolveTechnique convolve_tech;
- XiePointer convolve_param;
- } Convolve;
-
- struct {
- XiePhototag src;
- XieLevels levels;
- unsigned int band_mask;
- XieDitherTechnique dither_tech;
- XiePointer dither_param;
- } Dither;
-
- struct {
- XiePhototag src;
- unsigned int width;
- unsigned int height;
- float coefficients[6];
- XieConstant constant;
- unsigned int band_mask;
- XieGeometryTechnique sample_tech;
- XiePointer sample_param;
- } Geometry;
-
- struct {
- XiePhototag src1;
- XiePhototag src2;
- XieProcessDomain domain;
- XieConstant constant;
- int operator;
- unsigned int band_mask;
- } Logical;
-
- struct {
- XiePhototag src;
- XieProcessDomain domain;
- XieHistogramShape shape;
- XiePointer shape_param;
- } MatchHistogram;
-
- struct {
- XiePhototag src;
- XieProcessDomain domain;
- XieMathOp operator;
- unsigned int band_mask;
- } Math;
-
- struct {
- unsigned int width;
- unsigned int height;
- XieConstant constant;
- XieTile *tiles;
- unsigned int tile_count;
- } PasteUp;
-
- struct {
- XiePhototag src;
- XieProcessDomain domain;
- XiePhototag lut;
- unsigned int band_mask;
- } Point;
-
- struct {
- XiePhototag src;
- } Unconstrain;
-
- /*
- * Export Elements
- */
-
- struct {
- XiePhototag src;
- XieProcessDomain domain;
- XieExportNotify notify;
- } ExportClientHistogram;
-
- struct {
- XiePhototag src;
- XieOrientation band_order;
- XieExportNotify notify;
- XieLTriplet start;
- XieLTriplet length;
- } ExportClientLUT;
-
- struct {
- XiePhototag src;
- XieExportNotify notify;
- XieEncodeTechnique encode_tech;
- XiePointer encode_param;
- } ExportClientPhoto;
-
- struct {
- XiePhototag src;
- XieExportNotify notify;
- } ExportClientROI;
-
- struct {
- XiePhototag src;
- Drawable drawable;
- GC gc;
- int dst_x;
- int dst_y;
- } ExportDrawable;
-
- struct {
- XiePhototag src;
- Drawable drawable;
- GC gc;
- int dst_x;
- int dst_y;
- } ExportDrawablePlane;
-
- struct {
- XiePhototag src;
- XieLut lut;
- Bool merge;
- XieLTriplet start;
- } ExportLUT;
-
- struct {
- XiePhototag src;
- XiePhotomap photomap;
- XieEncodeTechnique encode_tech;
- XiePointer encode_param;
- } ExportPhotomap;
-
- struct {
- XiePhototag src;
- XieRoi roi;
- } ExportROI;
-
- } data;
-} XiePhotoElement;
-
-typedef XiePhotoElement *XiePhotofloGraph;
-
-
-/*--------------------------------------------------------------------------*
- * Technique Parameters *
- *--------------------------------------------------------------------------*/
-
-/* Color Alloc */
-
-typedef struct {
- unsigned long fill;
-} XieColorAllocAllParam;
-
-typedef struct {
- float match_limit;
- float gray_limit;
-} XieColorAllocMatchParam;
-
-typedef struct {
- unsigned long max_cells;
-} XieColorAllocRequantizeParam;
-
-
-/* Colorspace - conversion from RGB */
-
-typedef struct {
- XieMatrix matrix;
- XieWhiteAdjustTechnique white_adjust_tech;
- XiePointer white_adjust_param;
-} XieRGBToCIELabParam, XieRGBToCIEXYZParam;
-
-typedef struct {
- XieLevels levels;
- float luma_red;
- float luma_green;
- float luma_blue;
- XieConstant bias;
-} XieRGBToYCbCrParam;
-
-typedef struct {
- XieLevels levels;
- float luma_red;
- float luma_green;
- float luma_blue;
- float scale;
-} XieRGBToYCCParam;
-
-
-/* Colorspace - conversion to RGB */
-
-typedef struct {
- XieMatrix matrix;
- XieWhiteAdjustTechnique white_adjust_tech;
- XiePointer white_adjust_param;
- XieGamutTechnique gamut_tech;
- XiePointer gamut_param;
-} XieCIELabToRGBParam, XieCIEXYZToRGBParam;
-
-typedef struct {
- XieLevels levels;
- float luma_red;
- float luma_green;
- float luma_blue;
- XieConstant bias;
- XieGamutTechnique gamut_tech;
- XiePointer gamut_param;
-} XieYCbCrToRGBParam;
-
-typedef struct {
- XieLevels levels;
- float luma_red;
- float luma_green;
- float luma_blue;
- float scale;
- XieGamutTechnique gamut_tech;
- XiePointer gamut_param;
-} XieYCCToRGBParam;
-
-/* Constrain */
-
-typedef struct {
- XieConstant input_low,input_high;
- XieLTriplet output_low,output_high;
-} XieClipScaleParam;
-
-
-/* Convolve */
-
-typedef struct {
- XieConstant constant;
-} XieConvolveConstantParam;
-
-
-/* Decode */
-
-typedef struct {
- XieOrientation fill_order;
- XieOrientation pixel_order;
- unsigned int pixel_stride;
- unsigned int left_pad;
- unsigned int scanline_pad;
-} XieDecodeUncompressedSingleParam;
-
-typedef struct {
- unsigned char left_pad[3];
- XieOrientation fill_order;
- unsigned char pixel_stride[3];
- XieOrientation pixel_order;
- unsigned char scanline_pad[3];
- XieOrientation band_order;
- XieInterleave interleave;
-} XieDecodeUncompressedTripleParam;
-
-typedef struct {
- XieOrientation encoded_order;
- Bool normal;
- Bool radiometric;
-} XieDecodeG31DParam, XieDecodeG32DParam, XieDecodeG42DParam,
- XieDecodeTIFF2Param;
-
-typedef struct {
- XieOrientation encoded_order;
- Bool normal;
-} XieDecodeTIFFPackBitsParam;
-
-typedef struct {
- XieInterleave interleave;
- XieOrientation band_order;
- Bool up_sample;
-} XieDecodeJPEGBaselineParam;
-
-typedef struct {
- XieInterleave interleave;
- XieOrientation band_order;
-} XieDecodeJPEGLosslessParam;
-
-
-/* Dither */
-
-typedef struct {
- unsigned int threshold_order;
-} XieDitherOrderedParam;
-
-
-/* Encode */
-
-typedef struct {
- XieOrientation fill_order;
- XieOrientation pixel_order;
- unsigned int pixel_stride;
- unsigned int scanline_pad;
-} XieEncodeUncompressedSingleParam;
-
-typedef struct {
- unsigned char pixel_stride[3];
- XieOrientation pixel_order;
- unsigned char scanline_pad[3];
- XieOrientation fill_order;
- XieOrientation band_order;
- XieInterleave interleave;
-} XieEncodeUncompressedTripleParam;
-
-typedef struct {
- Bool align_eol;
- Bool radiometric;
- XieOrientation encoded_order;
-} XieEncodeG31DParam;
-
-typedef struct {
- Bool uncompressed;
- Bool align_eol;
- Bool radiometric;
- XieOrientation encoded_order;
- unsigned long k_factor;
-} XieEncodeG32DParam;
-
-typedef struct {
- Bool uncompressed;
- Bool radiometric;
- XieOrientation encoded_order;
-} XieEncodeG42DParam;
-
-typedef struct {
- unsigned int preference;
-} XieEncodeServerChoiceParam;
-
-typedef struct {
- XieInterleave interleave;
- XieOrientation band_order;
- unsigned char horizontal_samples[3];
- unsigned char vertical_samples[3];
- char *q_table;
- unsigned int q_size;
- char *ac_table;
- unsigned int ac_size;
- char *dc_table;
- unsigned int dc_size;
-} XieEncodeJPEGBaselineParam;
-
-typedef struct {
- XieInterleave interleave;
- XieOrientation band_order;
- unsigned char predictor[3];
- char *table;
- unsigned int table_size;
-} XieEncodeJPEGLosslessParam;
-
-typedef struct {
- XieOrientation encoded_order;
- Bool radiometric;
-} XieEncodeTIFF2Param;
-
-typedef struct {
- XieOrientation encoded_order;
-} XieEncodeTIFFPackBitsParam;
-
-
-/* Geometry */
-
-typedef struct {
- int simple;
-} XieGeomAntialiasByAreaParam;
-
-typedef struct {
- int kernel_size;
-} XieGeomAntialiasByLowpassParam;
-
-typedef struct {
- float sigma;
- float normalize;
- unsigned int radius;
- Bool simple;
-} XieGeomGaussianParam;
-
-typedef struct {
- unsigned int modify;
-} XieGeomNearestNeighborParam;
-
-
-/* Histogram */
-
-typedef struct {
- float mean;
- float sigma;
-} XieHistogramGaussianParam;
-
-typedef struct {
- float constant;
- Bool shape_factor;
-} XieHistogramHyperbolicParam;
-
-
-/* White Adjust */
-
-typedef struct {
- XieConstant white_point;
-} XieWhiteAdjustCIELabShiftParam;
-
-
-/*--------------------------------------------------------------------------*
- * Events *
- *--------------------------------------------------------------------------*/
-
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- unsigned long name_space;
- Time time;
- unsigned long flo_id;
- XiePhototag src;
- unsigned int elem_type;
- XieColorList color_list;
- XieColorAllocTechnique color_alloc_technique;
- unsigned long color_alloc_data;
-} XieColorAllocEvent;
-
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- unsigned long name_space;
- Time time;
- unsigned long flo_id;
- XiePhototag src;
- unsigned int elem_type;
- XieDecodeTechnique decode_technique;
- Bool aborted;
- unsigned int band_number;
- unsigned long width;
- unsigned long height;
-} XieDecodeNotifyEvent;
-
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- unsigned long name_space;
- Time time;
- unsigned long flo_id;
- XiePhototag src;
- unsigned int elem_type;
- unsigned int band_number;
- unsigned long data[3];
-} XieExportAvailableEvent;
-
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- unsigned long name_space;
- Time time;
- unsigned long flo_id;
- XiePhototag src;
- unsigned int elem_type;
- Window window;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
-} XieImportObscuredEvent;
-
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- unsigned long name_space;
- Time time;
- unsigned long flo_id;
- XiePhotofloOutcome outcome;
-} XiePhotofloDoneEvent;
-
-
-/*--------------------------------------------------------------------------*
- * Photoflo Errors *
- *--------------------------------------------------------------------------*/
-
-typedef struct {
- int type;
- Display *display;
- unsigned long flo_id;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
- unsigned int flo_error_code;
- unsigned long name_space;
- XiePhototag phototag;
- unsigned int elem_type;
-} XieFloAccessError, XieFloAllocError, XieFloElementError, XieFloIDError,
- XieFloLengthError, XieFloMatchError, XieFloSourceError;
-
-typedef struct {
- int type;
- Display *display;
- unsigned long flo_id;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
- unsigned int flo_error_code;
- unsigned long name_space;
- XiePhototag phototag;
- unsigned int elem_type;
- XID resource_id;
-} XieFloResourceError;
-
-typedef struct {
- int type;
- Display *display;
- unsigned long flo_id;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
- unsigned int flo_error_code;
- unsigned long name_space;
- XiePhototag phototag;
- unsigned int elem_type;
- XiePhototag domain_src;
-} XieFloDomainError;
-
-typedef struct {
- int type;
- Display *display;
- unsigned long flo_id;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
- unsigned int flo_error_code;
- unsigned long name_space;
- XiePhototag phototag;
- unsigned int elem_type;
- unsigned int operator;
-} XieFloOperatorError;
-
-typedef struct {
- int type;
- Display *display;
- unsigned long flo_id;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
- unsigned int flo_error_code;
- unsigned long name_space;
- XiePhototag phototag;
- unsigned int elem_type;
- unsigned int technique_number;
- unsigned int num_tech_params;
- XieTechniqueGroup tech_group;
-} XieFloTechniqueError;
-
-typedef struct {
- int type;
- Display *display;
- unsigned long flo_id;
- unsigned long serial;
- unsigned char error_code;
- unsigned char request_code;
- unsigned char minor_code;
- unsigned int flo_error_code;
- unsigned long name_space;
- XiePhototag phototag;
- unsigned int elem_type;
- unsigned long bad_value;
-} XieFloValueError;
-
-
-/*--------------------------------------------------------------------------*
- * Function prototypes *
- *--------------------------------------------------------------------------*/
-
-/* Startup functions -------------------------------------------------------*/
-
-extern Status XieInitialize (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieExtensionInfo ** /* extinfo_ret */
-#endif
-);
-
-extern Status XieQueryTechniques (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieTechniqueGroup /* technique_group */,
- int * /* ntechniques_ret */,
- XieTechnique ** /* techniques_ret */
-#endif
-);
-
-extern void XieFreeTechniques (
-#if NeedFunctionPrototypes
- XieTechnique * /* techs */,
- unsigned int /* count */
-#endif
-);
-
-
-/* Color List functions ---------------------------------------------------*/
-
-extern XieColorList XieCreateColorList (
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern void XieDestroyColorList (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieColorList /* color_list */
-#endif
-);
-
-extern void XiePurgeColorList (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieColorList /* color_list */
-#endif
-);
-
-extern Status XieQueryColorList (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieColorList /* color_list */,
- Colormap * /* colormap_ret */,
- unsigned * /* ncolors_ret */,
- unsigned long ** /* colors_ret */
-#endif
-);
-
-
-/* LUT functions -----------------------------------------------------------*/
-
-extern XieLut XieCreateLUT (
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern void XieDestroyLUT (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieLut /* lut */
-#endif
-);
-
-
-/* Photomap functions ------------------------------------------------------*/
-
-extern XiePhotomap XieCreatePhotomap (
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern void XieDestroyPhotomap (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotomap /* photomap */
-#endif
-);
-
-extern Status XieQueryPhotomap (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotomap /* photomap */,
- Bool * /* populated_ret */,
- XieDataType * /* datatype_ret */,
- XieDataClass * /* class_ret */,
- XieDecodeTechnique * /* decode_technique_ret */,
- XieLTriplet /* width_ret */,
- XieLTriplet /* height_ret */,
- XieLTriplet /* levels_ret */
-#endif
-);
-
-
-/* ROI functions -----------------------------------------------------------*/
-
-extern XieRoi XieCreateROI (
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern void XieDestroyROI (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XieRoi /* roi */
-#endif
-);
-
-
-/* Photospace functions ----------------------------------------------------*/
-
-extern XiePhotospace XieCreatePhotospace (
-#if NeedFunctionPrototypes
- Display * /* display */
-#endif
-);
-
-extern void XieDestroyPhotospace (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotospace /* photospace */
-#endif
-);
-
-extern void XieExecuteImmediate (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotospace /* photospace */,
- unsigned long /* flo_id */,
- Bool /* notify */,
- XiePhotoElement * /* elem_list */,
- int /* elem_count */
-#endif
-);
-
-
-/* Photoflo functions ------------------------------------------------------*/
-
-extern XiePhotoElement *XieAllocatePhotofloGraph (
-#if NeedFunctionPrototypes
- unsigned int /* count */
-#endif
-);
-
-extern void XieFreePhotofloGraph (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* elements */,
- unsigned int /* count */
-#endif
-);
-
-extern XiePhotoflo XieCreatePhotoflo (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotoElement * /* elem_list */,
- int /* elem_count */
-#endif
-);
-
-extern void XieDestroyPhotoflo (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotoflo /* photoflo */
-#endif
-);
-
-extern void XieExecutePhotoflo (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotoflo /* photoflo */,
- Bool /* notify */
-#endif
-);
-
-extern void XieModifyPhotoflo (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotoflo /* photoflo */,
- int /* start */,
- XiePhotoElement * /* elem_list */,
- int /* elem_count */
-#endif
-);
-
-extern void XieRedefinePhotoflo (
-#if NeedFunctionPrototypes
- Display * /* display */,
- XiePhotoflo /* photoflo */,
- XiePhotoElement * /* elem_list */,
- int /* elem_count */
-#endif
-);
-
-extern Status XieQueryPhotoflo (
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* name_space */,
- unsigned long /* flo_id */,
- XiePhotofloState * /* state_ret */,
- XiePhototag ** /* data_expected_ret */,
- unsigned int * /* nexpected_ret */,
- XiePhototag ** /* data_available_ret */,
- unsigned int * /* navailable_ret */
-#endif
-);
-
-
-/* Client Data functions ---------------------------------------------------*/
-
-extern void XiePutClientData (
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* name_space */,
- unsigned long /* flo_id */,
- XiePhototag /* element */,
- Bool /* final */,
- unsigned /* band_number */,
- unsigned char * /* data */,
- unsigned /* nbytes */
-#endif
-);
-
-extern Status XieGetClientData (
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* name_space */,
- unsigned long /* flo_id */,
- XiePhototag /* element */,
- unsigned /* max_bytes */,
- Bool /* terminate */,
- unsigned /* band_number */,
- XieExportState * /* new_state_ret */,
- unsigned char ** /* data_ret */,
- unsigned * /* nbytes_ret */
-#endif
-);
-
-
-/* Abort and Await functions -----------------------------------------------*/
-
-extern void XieAbort (
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* name_space */,
- unsigned long /* flo_id */
-#endif
-);
-
-extern void XieAwait (
-#if NeedFunctionPrototypes
- Display * /* display */,
- unsigned long /* name_space */,
- unsigned long /* flo_id */
-#endif
-);
-
-
-/* Photoflo element functions ----------------------------------------------*/
-
-extern void XieFloImportClientLUT (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XieDataClass /* data_class */,
- XieOrientation /* band_order */,
- XieLTriplet /* length */,
- XieLevels /* levels */
-#endif
-);
-
-extern void XieFloImportClientPhoto (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XieDataClass /* data_class */,
- XieLTriplet /* width */,
- XieLTriplet /* height */,
- XieLevels /* levels */,
- Bool /* notify */,
- XieDecodeTechnique /* decode_tech */,
- XiePointer /* decode_param */
-#endif
-);
-
-extern void XieFloImportClientROI (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- unsigned int /* rectangles */
-#endif
-);
-
-extern void XieFloImportDrawable (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- Drawable /* drawable */,
- int /* src_x */,
- int /* src_y */,
- unsigned int /* width */,
- unsigned int /* height */,
- unsigned long /* fill */,
- Bool /* notify */
-#endif
-);
-
-extern void XieFloImportDrawablePlane (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- Drawable /* drawable */,
- int /* src_x */,
- int /* src_y */,
- unsigned int /* width */,
- unsigned int /* height */,
- unsigned long /* fill */,
- unsigned long /* bit_plane */,
- Bool /* notify */
-#endif
-);
-
-extern void XieFloImportLUT (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XieLut /* lut */
-#endif
-);
-
-extern void XieFloImportPhotomap (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhotomap /* photomap */,
- Bool /* notify */
-#endif
-);
-
-extern void XieFloImportROI (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XieRoi /* roi */
-#endif
-);
-
-extern void XieFloArithmetic (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src1 */,
- XiePhototag /* src2 */,
- XieProcessDomain * /* domain */,
- XieConstant /* constant */,
- XieArithmeticOp /* operator */,
- unsigned int /* band_mask */
-#endif
-);
-
-extern void XieFloBandCombine (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src1 */,
- XiePhototag /* src2 */,
- XiePhototag /* src3 */
-#endif
-);
-
-extern void XieFloBandExtract (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- unsigned int /* levels */,
- double /* bias */,
- XieConstant /* coefficients */
-#endif
-);
-
-extern void XieFloBandSelect (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- unsigned int /* band_number */
-#endif
-);
-
-extern void XieFloBlend (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src1 */,
- XiePhototag /* src2 */,
- XieConstant /* src_constant */,
- XiePhototag /* alpha */,
- double /* alpha_const */,
- XieProcessDomain * /* domain */,
- unsigned int /* band_mask */
-#endif
-);
-
-extern void XieFloCompare (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src1 */,
- XiePhototag /* src2 */,
- XieProcessDomain * /* domain */,
- XieConstant /* constant */,
- XieCompareOp /* operator */,
- Bool /* combine */,
- unsigned int /* band_mask */
-#endif
-);
-
-extern void XieFloConstrain (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieLevels /* levels */,
- XieConstrainTechnique /* constrain_tech */,
- XiePointer /* constrain_param */
-#endif
-);
-
-extern void XieFloConvertFromIndex (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- Colormap /* colormap */,
- XieDataClass /* data_class */,
- unsigned int /* precision */
-#endif
-);
-
-extern void XieFloConvertFromRGB (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieColorspace /* color_space */,
- XiePointer /* color_param */
-#endif
-);
-
-extern void XieFloConvertToIndex (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- Colormap /* colormap */,
- XieColorList /* color_list */,
- Bool /* notify */,
- XieColorAllocTechnique /* color_alloc_tech */,
- XiePointer /* color_alloc_param */
-#endif
-);
-
-extern void XieFloConvertToRGB (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieColorspace /* color_space */,
- XiePointer /* color_param */
-#endif
-);
-
-extern void XieFloConvolve (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieProcessDomain * /* domain */,
- float * /* kernel */,
- int /* kernel_size */,
- unsigned int /* band_mask */,
- XieConvolveTechnique /* convolve_tech */,
- XiePointer /* convolve_param */
-#endif
-);
-
-extern void XieFloDither (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- unsigned int /* band_mask */,
- XieLevels /* levels */,
- XieDitherTechnique /* dither_tech */,
- XiePointer /* dither_param */
-#endif
-);
-
-extern void XieFloGeometry (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- unsigned int /* width */,
- unsigned int /* height */,
- float[6] /* coefficients[6] */,
- XieConstant /* constant */,
- unsigned int /* band_mask */,
- XieGeometryTechnique /* sample_tech */,
- XiePointer /* sample_param */
-#endif
-);
-
-extern void XieFloLogical (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src1 */,
- XiePhototag /* src2 */,
- XieProcessDomain * /* domain */,
- XieConstant /* constant */,
- unsigned long /* operator */,
- unsigned int /* band_mask */
-#endif
-);
-
-extern void XieFloMatchHistogram (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieProcessDomain * /* domain */,
- XieHistogramShape /* shape */,
- XiePointer /* shape_param */
-#endif
-);
-
-extern void XieFloMath (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieProcessDomain * /* domain */,
- XieMathOp /* operator */,
- unsigned int /* band_mask */
-#endif
-);
-
-extern void XieFloPasteUp (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- unsigned int /* width */,
- unsigned int /* height */,
- XieConstant /* constant */,
- XieTile * /* tiles */,
- unsigned int /* tile_count */
-#endif
-);
-
-extern void XieFloPoint (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieProcessDomain * /* domain */,
- XiePhototag /* lut */,
- unsigned int /* band_mask */
-#endif
-);
-
-extern void XieFloUnconstrain (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */
-#endif
-);
-
-extern void XieFloExportClientHistogram (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieProcessDomain * /* domain */,
- XieExportNotify /* notify */
-#endif
-);
-
-extern void XieFloExportClientLUT (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieOrientation /* band_order */,
- XieExportNotify /* notify */,
- XieLTriplet /* start */,
- XieLTriplet /* length */
-#endif
-);
-
-extern void XieFloExportClientPhoto (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieExportNotify /* notify */,
- XieEncodeTechnique /* encode_tech */,
- XiePointer /* encode_param */
-#endif
-);
-
-extern void XieFloExportClientROI (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieExportNotify /* notify */
-#endif
-);
-
-extern void XieFloExportDrawable (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- Drawable /* drawable */,
- GC /* gc */,
- int /* dst_x */,
- int /* dst_y */
-#endif
-);
-
-extern void XieFloExportDrawablePlane (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- Drawable /* drawable */,
- GC /* gc */,
- int /* dst_x */,
- int /* dst_y */
-#endif
-);
-
-extern void XieFloExportLUT (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieLut /* lut */,
- Bool /* merge */,
- XieLTriplet /* start */
-#endif
-);
-
-extern void XieFloExportPhotomap (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XiePhotomap /* photomap */,
- XieEncodeTechnique /* encode_tech */,
- XiePointer /* encode_param */
-#endif
-);
-
-extern void XieFloExportROI (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */,
- XiePhototag /* src */,
- XieRoi /* roi */
-#endif
-);
-
-
-/* Technique functions -----------------------------------------------------*/
-
-extern XieColorAllocAllParam *XieTecColorAllocAll (
-#if NeedFunctionPrototypes
- unsigned long /* fill */
-#endif
-);
-
-extern XieColorAllocMatchParam *XieTecColorAllocMatch (
-#if NeedFunctionPrototypes
- double /* match_limit */,
- double /* gray_limit */
-#endif
-);
-
-extern XieColorAllocRequantizeParam *XieTecColorAllocRequantize (
-#if NeedFunctionPrototypes
- unsigned long /* max_cells */
-#endif
-);
-
-extern XieRGBToCIELabParam *XieTecRGBToCIELab (
-#if NeedFunctionPrototypes
- XieMatrix /* matrix */,
- XieWhiteAdjustTechnique /* white_adjust_tech */,
- XiePointer /* white_adjust_param */
-#endif
-);
-
-extern XieRGBToCIEXYZParam *XieTecRGBToCIEXYZ (
-#if NeedFunctionPrototypes
- XieMatrix /* matrix */,
- XieWhiteAdjustTechnique /* white_adjust_tech */,
- XiePointer /* white_adjust_param */
-#endif
-);
-
-extern XieRGBToYCbCrParam *XieTecRGBToYCbCr (
-#if NeedFunctionPrototypes
- XieLevels /* levels */,
- double /* luma_red */,
- double /* luma_green */,
- double /* luma_blue */,
- XieConstant /* bias */
-#endif
-);
-
-extern XieRGBToYCCParam *XieTecRGBToYCC (
-#if NeedFunctionPrototypes
- XieLevels /* levels */,
- double /* luma_red */,
- double /* luma_green */,
- double /* luma_blue */,
- double /* scale */
-#endif
-);
-
-extern XieCIELabToRGBParam *XieTecCIELabToRGB (
-#if NeedFunctionPrototypes
- XieMatrix /* matrix */,
- XieWhiteAdjustTechnique /* white_adjust_tech */,
- XiePointer /* white_adjust_param */,
- XieGamutTechnique /* gamut_tech */,
- XiePointer /* gamut_param */
-#endif
-);
-
-extern XieCIEXYZToRGBParam *XieTecCIEXYZToRGB (
-#if NeedFunctionPrototypes
- XieMatrix /* matrix */,
- XieWhiteAdjustTechnique /* white_adjust_tech */,
- XiePointer /* white_adjust_param */,
- XieGamutTechnique /* gamut_tech */,
- XiePointer /* gamut_param */
-#endif
-);
-
-extern XieYCbCrToRGBParam *XieTecYCbCrToRGB (
-#if NeedFunctionPrototypes
- XieLevels /* levels */,
- double /* luma_red */,
- double /* luma_green */,
- double /* luma_blue */,
- XieConstant /* bias */,
- XieGamutTechnique /* gamut_tech */,
- XiePointer /* gamut_param */
-#endif
-);
-
-extern XieYCCToRGBParam *XieTecYCCToRGB (
-#if NeedFunctionPrototypes
- XieLevels /* levels */,
- double /* luma_red */,
- double /* luma_green */,
- double /* luma_blue */,
- double /* scale */,
- XieGamutTechnique /* gamut_tech */,
- XiePointer /* gamut_param */
-#endif
-);
-
-extern XieClipScaleParam *XieTecClipScale (
-#if NeedFunctionPrototypes
- XieConstant /* in_low */,
- XieConstant /* in_high */,
- XieLTriplet /* out_low */,
- XieLTriplet /* out_high */
-#endif
-);
-
-extern XieConvolveConstantParam *XieTecConvolveConstant (
-#if NeedFunctionPrototypes
- XieConstant /* constant */
-#endif
-);
-
-extern XieDecodeUncompressedSingleParam *XieTecDecodeUncompressedSingle (
-#if NeedFunctionPrototypes
- XieOrientation /* fill_order */,
- XieOrientation /* pixel_order */,
- unsigned int /* pixel_stride */,
- unsigned int /* left_pad */,
- unsigned int /* scanline_pad */
-#endif
-);
-
-extern XieDecodeUncompressedTripleParam *XieTecDecodeUncompressedTriple (
-#if NeedFunctionPrototypes
- XieOrientation /* fill_order */,
- XieOrientation /* pixel_order */,
- XieOrientation /* band_order */,
- XieInterleave /* interleave */,
- unsigned char[3] /* pixel_stride[3] */,
- unsigned char[3] /* left_pad[3] */,
- unsigned char[3] /* scanline_pad[3] */
-#endif
-);
-
-extern XieDecodeG31DParam *XieTecDecodeG31D (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */,
- Bool /* normal */,
- Bool /* radiometric */
-#endif
-);
-
-extern XieDecodeG32DParam *XieTecDecodeG32D (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */,
- Bool /* normal */,
- Bool /* radiometric */
-#endif
-);
-
-extern XieDecodeG42DParam *XieTecDecodeG42D (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */,
- Bool /* normal */,
- Bool /* radiometric */
-#endif
-);
-
-extern XieDecodeTIFF2Param *XieTecDecodeTIFF2 (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */,
- Bool /* normal */,
- Bool /* radiometric */
-#endif
-);
-
-extern XieDecodeTIFFPackBitsParam *XieTecDecodeTIFFPackBits (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */,
- Bool /* normal */
-#endif
-);
-
-extern XieDecodeJPEGBaselineParam *XieTecDecodeJPEGBaseline (
-#if NeedFunctionPrototypes
- XieInterleave /* interleave */,
- XieOrientation /* band_order */,
- Bool /* up_sample */
-#endif
-);
-
-extern XieDecodeJPEGLosslessParam *XieTecDecodeJPEGLossless (
-#if NeedFunctionPrototypes
- XieInterleave /* interleave */,
- XieOrientation /* band_order */
-#endif
-);
-
-extern XieDitherOrderedParam *XieTecDitherOrderedParam (
-#if NeedFunctionPrototypes
- unsigned int /* threshold_order */
-#endif
-);
-
-extern XieEncodeUncompressedSingleParam *XieTecEncodeUncompressedSingle (
-#if NeedFunctionPrototypes
- XieOrientation /* fill_order */,
- XieOrientation /* pixel_order */,
- unsigned int /* pixel_stride */,
- unsigned int /* scanline_pad */
-#endif
-);
-
-extern XieEncodeUncompressedTripleParam *XieTecEncodeUncompressedTriple (
-#if NeedFunctionPrototypes
- XieOrientation /* fill_order */,
- XieOrientation /* pixel_order */,
- XieOrientation /* band_order */,
- XieInterleave /* interleave */,
- unsigned char[3] /* pixel_stride[3] */,
- unsigned char[3] /* scanline_pad[3] */
-#endif
-);
-
-extern XieEncodeG31DParam *XieTecEncodeG31D (
-#if NeedFunctionPrototypes
- Bool /* align_eol */,
- Bool /* radiometric */,
- XieOrientation /* encoded_order */
-#endif
-);
-
-extern XieEncodeG32DParam *XieTecEncodeG32D (
-#if NeedFunctionPrototypes
- Bool /* uncompressed */,
- Bool /* align_eol */,
- Bool /* radiometric */,
- XieOrientation /* encoded_order */,
- unsigned long /* k_factor */
-#endif
-);
-
-extern XieEncodeG42DParam *XieTecEncodeG42D (
-#if NeedFunctionPrototypes
- Bool /* uncompressed */,
- Bool /* radiometric */,
- XieOrientation /* encoded_order */
-#endif
-);
-
-extern XieEncodeServerChoiceParam *XieTecEncodeServerChoice (
-#if NeedFunctionPrototypes
- unsigned int /* preference */
-#endif
-);
-
-extern XieEncodeJPEGBaselineParam *XieTecEncodeJPEGBaseline (
-#if NeedFunctionPrototypes
- XieInterleave /* interleave */,
- XieOrientation /* band_order */,
- unsigned char[3] /* horizontal_samples[3] */,
- unsigned char[3] /* vertical_samples[3] */,
- char * /* q_table */,
- unsigned int /* q_size */,
- char * /* ac_table */,
- unsigned int /* ac_size */,
- char * /* dc_table */,
- unsigned int /* dc_size */
-#endif
-);
-
-extern void XieFreeEncodeJPEGBaseline (
-#if NeedFunctionPrototypes
- XieEncodeJPEGBaselineParam * /* param */
-#endif
-);
-
-extern XieEncodeJPEGLosslessParam *XieTecEncodeJPEGLossless (
-#if NeedFunctionPrototypes
- XieInterleave /* interleave */,
- XieOrientation /* band_order */,
- unsigned char[3] /* predictor[3] */,
- char * /* table */,
- unsigned int /* table_size */
-#endif
-);
-
-extern void XieFreeEncodeJPEGLossless (
-#if NeedFunctionPrototypes
- XieEncodeJPEGLosslessParam * /* param */
-#endif
-);
-
-extern void XieFreePasteUpTiles (
-#if NeedFunctionPrototypes
- XiePhotoElement * /* element */
-#endif
-);
-
-extern XieEncodeTIFF2Param *XieTecEncodeTIFF2 (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */,
- Bool /* radiometric */
-#endif
-);
-
-extern XieEncodeTIFFPackBitsParam *XieTecEncodeTIFFPackBits (
-#if NeedFunctionPrototypes
- XieOrientation /* encoded_order */
-#endif
-);
-
-extern XieGeomAntialiasByAreaParam *XieTecGeomAntialiasByArea (
-#if NeedFunctionPrototypes
- int /* simple */
-#endif
-);
-
-extern XieGeomAntialiasByLowpassParam *XieTecGeomAntialiasByLowpass (
-#if NeedFunctionPrototypes
- int /* kernel_size */
-#endif
-);
-
-extern XieGeomGaussianParam *XieTecGeomGaussian (
-#if NeedFunctionPrototypes
- double /* sigma */,
- double /* normalize */,
- unsigned int /* radius */,
- Bool /* simple */
-#endif
-);
-
-extern XieGeomNearestNeighborParam *XieTecGeomNearestNeighbor (
-#if NeedFunctionPrototypes
- unsigned int /* modify */
-#endif
-);
-
-extern XieHistogramGaussianParam *XieTecHistogramGaussian (
-#if NeedFunctionPrototypes
- double /* mean */,
- double /* sigma */
-#endif
-);
-
-extern XieHistogramHyperbolicParam *XieTecHistogramHyperbolic (
-#if NeedFunctionPrototypes
- double /* constant */,
- Bool /* shape_factor */
-#endif
-);
-
-extern XieWhiteAdjustCIELabShiftParam *XieTecWhiteAdjustCIELabShift (
-#if NeedFunctionPrototypes
- XieConstant /* white_point */
-#endif
-);
-
-
-#endif /* _XIELIB_H_ */
diff --git a/xc/lib/XIE/XIElibint.h b/xc/lib/XIE/XIElibint.h
deleted file mode 100644
index 0e23c69f6..000000000
--- a/xc/lib/XIE/XIElibint.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/* $TOG: XIElibint.h /main/9 1998/02/06 15:13:20 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.
-
-*/
-/* $XFree86: xc/lib/XIE/XIElibint.h,v 3.3 1999/06/13 16:18:06 dawes Exp $ */
-
-#ifndef _XIELIBINT_H_
-#define _XIELIBINT_H_
-
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/Xfuncs.h>
-#include <X11/extensions/XIElib.h>
-#include <X11/extensions/XIEproto.h>
-
-
-
-/* -------------------------------------------------------------------------
- * Display extension data structures and macros.
- * ------------------------------------------------------------------------- */
-
-/*
- * For each display initialized by XieInitialize(), a record is allocated
- * which holds various information about that display. These records are
- * maintained in a linked list. The record for the most recently referenced
- * display is always kept at the beginning of the list (for quick access).
- */
-
-typedef struct _XieExtInfo
-{
- Display *display; /* pointer to X display structure */
- XExtCodes *extCodes; /* extension codes */
- XieExtensionInfo *extInfo; /* extension information */
- struct _XieExtInfo *next; /* next in list */
-} XieExtInfo;
-
-
-/*
- * Insert a new record in the beginning of the linked list.
- */
-
-#define ADD_EXTENSION_INFO(_display, _info) \
-\
-{ \
- _info->display = _display; \
-\
- _info->next = _XieExtInfoHeader; \
- _XieExtInfoHeader = _info; \
-}
-
-
-/*
- * Remove the record assosicated with '_display' from the linked list
- * and return a pointer to it in '_info'.
- */
-
-#define REMOVE_EXTENSION_INFO(_display, _info) \
-\
-{ \
- XieExtInfo *prev = NULL; \
-\
- _info = _XieExtInfoHeader; \
-\
- while (_info && _info->display != _display) \
- { \
- prev = _info; \
- _info = _info->next; \
- } \
-\
- if (_info) \
- if (!prev) \
- _XieExtInfoHeader = _info->next; \
- else \
- prev->next = _info->next; \
-}
-
-
-/*
- * Return the info assosicated with '_display' in '_info'.
- * If the info is not the first in the list, move it to the front.
- */
-
-#define GET_EXTENSION_INFO(_display, _info) \
-\
-{ \
- if ((_info = _XieExtInfoHeader) != 0) \
- { \
- if (_XieExtInfoHeader->display != _display) \
- { \
- XieExtInfo *prev = _XieExtInfoHeader; \
-\
- _info = _info->next; \
- while (_info && _info->display != _display) \
- { \
- prev = _info; \
- _info = _info->next; \
- } \
-\
- if (_info) \
- { \
- prev->next = _info->next; \
- _info->next = _XieExtInfoHeader; \
- _XieExtInfoHeader = _info; \
- } \
- } \
- } \
-}
-
-
-
-
-
-
-#define PAD(_size) (3 - (((_size) + 3) & 0x3))
-
-#define PADDED_BYTES(_bytes) (_bytes + PAD (_bytes))
-
-#define NUMWORDS(_size) (((unsigned int) ((_size) + 3)) >> 2)
-
-#define NUMBYTES(_len) (((unsigned int) (_len)) << 2)
-
-#define LENOF(_ctype) (SIZEOF (_ctype) >> 2)
-
-
-
-
-
-/* -------------------------------------------------------------------------
- * Macros for setting up requests.
- * ------------------------------------------------------------------------- */
-
-/*
- * Request names and opcodes.
- */
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define REQNAME(_name_) xie##_name_##Req
-#define REQOPCODE(_name_) X_ie##_name_
-#define REQSIZE(_name_) sz_xie##_name_##Req
-#else
-#define REQNAME(_name_) xie/**/_name_/**/Req
-#define REQOPCODE(_name_) X_ie/**/_name_
-#define REQSIZE(_name_) sz_xie/**/_name_/**/Req
-#endif
-
-
-/*
- * GET_REQUEST sets up a request to be sent to the X server. If there isn't
- * enough room left in the X buffer, it is flushed before the new request
- * is started.
- */
-
-#define GET_REQUEST(_name, _req) \
- if ((display->bufptr + REQSIZE(_name)) > display->bufmax) \
- _XFlush (display); \
- _req = (char *) (display->last_req = display->bufptr); \
- display->bufptr += REQSIZE(_name); \
- display->request++
-
-
-/*
- * GET_REQUEST_EXTRA is the same as GET_REQUEST and except that an additional
- * "extraBytes" are allocated after the request. "extraBytes" will be
- * padded to a word boundary.
- */
-
-#define GET_REQUEST_EXTRA(_name, _extraBytes, _req) \
- if ((display->bufptr + REQSIZE(_name) + \
- PADDED_BYTES (_extraBytes)) > display->bufmax) _XFlush (display); \
- _req = (char *) (display->last_req = display->bufptr); \
- display->bufptr += (REQSIZE(_name) + PADDED_BYTES (_extraBytes)); \
- display->request++
-
-
-/*
- * BEGIN_REQUEST_HEADER and END_REQUEST_HEADER are used to hide
- * the extra work that has to be done on 64 bit clients. On such
- * machines, all structure pointers must point to an 8 byte boundary.
- * As a result, we must first store the request header info in
- * a static data stucture, then bcopy it into the transport buffer.
- */
-
-#ifndef WORD64
-
-#define BEGIN_REQUEST_HEADER(_name, _pBuf, _pReq) \
-{ \
- XieExtInfo *_xieExtInfo; \
- GET_EXTENSION_INFO (display, _xieExtInfo); \
- _pReq = (REQNAME(_name) *) _pBuf;
-
-#define END_REQUEST_HEADER(_name, _pBuf, _pReq) \
- _pBuf += REQSIZE(_name); \
-}
-
-#else /* WORD64 */
-
-#define BEGIN_REQUEST_HEADER(_name, _pBuf, _pReq) \
-{ \
- XieExtInfo *_xieExtInfo; \
- REQNAME(_name) tReq; \
- GET_EXTENSION_INFO (display, _xieExtInfo); \
- _pReq = &tReq;
-
-#define END_REQUEST_HEADER(_name, _pBuf, _pReq) \
- memcpy (_pBuf, _pReq, REQSIZE(_name)); \
- _pBuf += REQSIZE(_name); \
-}
-
-#endif /* WORD64 */
-
-
-/*
- * Macros used to store the request header info.
- */
-
-#define STORE_REQUEST_HEADER(_name, _req) \
- _req->reqType = _xieExtInfo->extCodes->major_opcode; \
- _req->opcode = REQOPCODE(_name); \
- _req->length = (REQSIZE(_name)) >> 2;
-
-
-#define STORE_REQUEST_EXTRA_HEADER(_name, _extraBytes, _req) \
- _req->reqType = _xieExtInfo->extCodes->major_opcode; \
- _req->opcode = REQOPCODE(_name); \
- _req->length = (REQSIZE(_name) + PADDED_BYTES (_extraBytes)) >> 2;
-
-
-
-
-typedef int (*XieTechFuncPtr) (char **, XiePointer, int);
-
-typedef struct _XieTechFuncRec {
- int technique;
- XieTechFuncPtr techfunc;
- struct _XieTechFuncRec *next;
-} XieTechFuncRec;
-
-
-
-
-/*
- * See if XSynchronize has been called. If so, send request right away.
- */
-
-#define SYNC_HANDLE(_display)\
- if ((_display)->synchandler) (*(_display)->synchandler) (_display)
-
-
-/*
- * Read a reply into a scratch buffer.
- */
-
-#define XREAD_INTO_SCRATCH(_display, _pBuf, _numBytes) \
- _pBuf = (char *) _XAllocTemp (_display, _numBytes); \
- _XRead (_display, _pBuf, _numBytes);
-
-#define FINISH_WITH_SCRATCH(_display, _pBuf, _numBytes) \
- _XFreeTemp (_display, _pBuf, _numBytes);
-
-
-/*
- * Externally defined globals
- */
-
-extern XieExtInfo *_XieExtInfoHeader;
-extern void (*(_XieElemFuncs[]))(char **, XiePhotoElement *);
-extern XieTechFuncRec *_XieTechFuncs[];
-extern Bool _XieTechFuncsInitialized;
-
-extern Bool _XieFloError (Display *, XErrorEvent *, xError *);
-extern Status _XieColorAllocEvent (Display *, XEvent *, xEvent *);
-extern Status _XieDecodeNotifyEvent (Display *, XEvent *, xEvent *);
-extern Status _XieExportAvailableEvent (Display *, XEvent *, xEvent *);
-extern Status _XieImportObscuredEvent (Display *, XEvent *, xEvent *);
-extern Status _XiePhotofloDoneEvent (Display *, XEvent *, xEvent *);
-extern Status _XieRegisterTechFunc (int, int, XieTechFuncPtr);
-extern XieTechFuncPtr _XieLookupTechFunc (int, int);
-extern int _XieCloseDisplay (Display *, XExtCodes *);
-extern int _XiePhotofloSize (XiePhotoElement *, int);
-extern int _XieTechniqueLength (int, int, XiePointer);
-extern void _XieEncodeTechnique (char **, int, int, XiePointer);
-extern void _XieInitTechFuncTable (void);
-extern void _XiePrintError (Display *display, XErrorEvent *error, void *fp);
-extern xieTypFloat _XieConvertToIEEE(double);
-
-/* for X-Window system protocol elements */
-#define sz_CARD32 4
-#define sz_CARD16 2
-#define sz_CARD8 1
-#define sz_INT32 4
-#define sz_INT16 2
-
-#endif /* _XIELIBINT_H_ */
diff --git a/xc/lib/XIE/XIEos2.def b/xc/lib/XIE/XIEos2.def
deleted file mode 100644
index 8d09e930e..000000000
--- a/xc/lib/XIE/XIEos2.def
+++ /dev/null
@@ -1,207 +0,0 @@
-LIBRARY XIE
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/XIE/XIEos2.def,v 3.6 1999/04/29 09:13:29 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- XieAbort @ 1
- XieAllocatePhotofloGraph @ 2
- XieAwait @ 3
- XieCreateColorList @ 4
- XieCreateLUT @ 5
- XieCreatePhotoflo @ 6
- XieCreatePhotomap @ 7
- XieCreatePhotospace @ 8
- XieCreateROI @ 9
- XieDestroyColorList @ 10
- XieDestroyLUT @ 11
- XieDestroyPhotoflo @ 12
- XieDestroyPhotomap @ 13
- XieDestroyPhotospace @ 14
- XieDestroyROI @ 15
- XieExecuteImmediate @ 16
- XieExecutePhotoflo @ 17
- XieFloArithmetic @ 18
- XieFloBandCombine @ 19
- XieFloBandExtract @ 20
- XieFloBandSelect @ 21
- XieFloBlend @ 22
- XieFloCompare @ 23
- XieFloConstrain @ 24
- XieFloConvertFromIndex @ 25
- XieFloConvertFromRGB @ 26
- XieFloConvertToIndex @ 27
- XieFloConvertToRGB @ 28
- XieFloConvolve @ 29
- XieFloDither @ 30
- XieFloExportClientHistogram @ 31
- XieFloExportClientLUT @ 32
- XieFloExportClientPhoto @ 33
- XieFloExportClientROI @ 34
- XieFloExportDrawable @ 35
- XieFloExportDrawablePlane @ 36
- XieFloExportLUT @ 37
- XieFloExportPhotomap @ 38
- XieFloExportROI @ 39
- XieFloGeometry @ 40
- XieFloImportClientLUT @ 41
- XieFloImportClientPhoto @ 42
- XieFloImportClientROI @ 43
- XieFloImportDrawable @ 44
- XieFloImportDrawablePlane @ 45
- XieFloImportLUT @ 46
- XieFloImportPhotomap @ 47
- XieFloImportROI @ 48
- XieFloLogical @ 49
- XieFloMatchHistogram @ 50
- XieFloMath @ 51
- XieFloPasteUp @ 52
- XieFloPoint @ 53
- XieFloUnconstrain @ 54
- XieFreeEncodeJPEGBaseline @ 55
- XieFreeEncodeJPEGLossless @ 56
- XieFreePasteUpTiles @ 57
- XieFreePhotofloGraph @ 58
- XieFreeTechniques @ 59
- XieGetClientData @ 60
- XieInitialize @ 61
- XieModifyPhotoflo @ 62
- XiePurgeColorList @ 63
- XiePutClientData @ 64
- XieQueryColorList @ 65
- XieQueryPhotoflo @ 66
- XieQueryPhotomap @ 67
- XieQueryTechniques @ 68
- XieRedefinePhotoflo @ 69
- XieTecCIELabToRGB @ 70
- XieTecCIEXYZToRGB @ 71
- XieTecClipScale @ 72
- XieTecColorAllocAll @ 73
- XieTecColorAllocMatch @ 74
- XieTecColorAllocRequantize @ 75
- XieTecConvolveConstant @ 76
- XieTecDecodeG31D @ 77
- XieTecDecodeG32D @ 78
- XieTecDecodeG42D @ 79
- XieTecDecodeJPEGBaseline @ 80
- XieTecDecodeJPEGLossless @ 81
- XieTecDecodeTIFF2 @ 82
- XieTecDecodeTIFFPackBits @ 83
- XieTecDecodeUncompressedSingle @ 84
- XieTecDecodeUncompressedTriple @ 85
- XieTecDitherOrderedParam @ 86
- XieTecEncodeG31D @ 87
- XieTecEncodeG32D @ 88
- XieTecEncodeG42D @ 89
- XieTecEncodeJPEGBaseline @ 90
- XieTecEncodeJPEGLossless @ 91
- XieTecEncodeServerChoice @ 92
- XieTecEncodeTIFF2 @ 93
- XieTecEncodeTIFFPackBits @ 94
- XieTecEncodeUncompressedSingle @ 95
- XieTecEncodeUncompressedTriple @ 96
- XieTecGeomAntialiasByArea @ 97
- XieTecGeomAntialiasByLowpass @ 98
- XieTecGeomGaussian @ 99
- XieTecGeomNearestNeighbor @ 100
- XieTecHistogramGaussian @ 101
- XieTecHistogramHyperbolic @ 102
- XieTecRGBToCIELab @ 103
- XieTecRGBToCIEXYZ @ 104
- XieTecRGBToYCC @ 105
- XieTecRGBToYCbCr @ 106
- XieTecWhiteAdjustCIELabShift @ 107
- XieTecYCCToRGB @ 108
- XieTecYCbCrToRGB @ 109
- _XiePhotofloSize @ 110
- _XieElemImportClientLUT @ 111
- _XieElemImportClientPhoto @ 112
- _XieElemImportClientROI @ 113
- _XieElemImportDrawable @ 114
- _XieElemImportDrawablePlane @ 115
- _XieElemImportLUT @ 116
- _XieElemImportPhotomap @ 117
- _XieElemImportROI @ 118
- _XieElemArithmetic @ 119
- _XieElemBandCombine @ 120
- _XieElemBandExtract @ 121
- _XieElemBandSelect @ 122
- _XieElemBlend @ 123
- _XieElemCompare @ 124
- _XieElemConstrain @ 125
- _XieElemConvertFromIndex @ 126
- _XieElemConvertFromRGB @ 127
- _XieElemConvertToIndex @ 128
- _XieElemConvertToRGB @ 129
- _XieElemConvolve @ 130
- _XieElemDither @ 131
- _XieElemGeometry @ 132
- _XieElemLogical @ 133
- _XieElemMatchHistogram @ 134
- _XieElemMath @ 135
- _XieElemPasteUp @ 136
- _XieElemPoint @ 137
- _XieElemUnconstrain @ 138
- _XieElemExportClientHistogram @ 139
- _XieElemExportClientLUT @ 140
- _XieElemExportClientPhoto @ 141
- _XieElemExportClientROI @ 142
- _XieElemExportDrawable @ 143
- _XieElemExportDrawablePlane @ 144
- _XieElemExportLUT @ 145
- _XieElemExportPhotomap @ 146
- _XieElemExportROI @ 147
- _XieFloError @ 148
- _XieColorAllocEvent @ 149
- _XieDecodeNotifyEvent @ 150
- _XieExportAvailableEvent @ 151
- _XieImportObscuredEvent @ 152
- _XiePhotofloDoneEvent @ 153
- _XieConvertToIEEE @ 154
- _XieCloseDisplay @ 155
- _XiePrintError @ 156
- _XieTechniqueLength @ 157
- _XieEncodeTechnique @ 158
- _XieColorAllocAllParam @ 159
- _XieColorAllocMatchParam @ 160
- _XieColorAllocRequantizeParam @ 161
- _XieRGBToCIELabParam @ 162
- _XieRGBToYCbCrParam @ 163
- _XieRGBToYCCParam @ 164
- _XieYCbCrToRGBParam @ 165
- _XieYCCToRGBParam @ 166
- _XieCIELabToRGBParam @ 167
- _XieConvolveConstantParam @ 168
- _XieClipScaleParam @ 169
- _XieDecodeUncompressedSingleParam @ 170
- _XieDecodeUncompressedTripleParam @ 171
- _XieDecodeG31DParam @ 172
- _XieDecodeTIFFPackBitsParam @ 173
- _XieDecodeJPEGBaselineParam @ 174
- _XieDitherOrderedParam @ 175
- _XieEncodeUncompressedSingleParam @ 176
- _XieEncodeUncompressedTripleParam @ 177
- _XieEncodeG31DParam @ 178
- _XieEncodeTIFFPackBitsParam @ 179
- _XieEncodeServerChoiceParam @ 180
- _XieEncodeG32DParam @ 181
- _XieEncodeG42DParam @ 182
- _XieEncodeJPEGBaselineParam @ 183
- _XieEncodeJPEGLosslessParam @ 184
- _XieEncodeTIFF2Param @ 185
- _XieGeomAntialiasByAreaParam @ 186
- _XieGeomAntialiasByLowpassParam @ 187
- _XieGeomGaussianParam @ 188
- _XieGeomNearestNeighborParam @ 189
- _XieHistogramGaussianParam @ 190
- _XieHistogramHyperbolicParam @ 191
- _XieWhiteAdjustCIELabShiftParam @ 192
- _XieInitTechFuncTable @ 193
- _XieRegisterTechFunc @ 194
- _XieLookupTechFunc @ 195
- _XieExtInfoHeader @ 196
- _XieElemFuncs @ 197
- _XieTechFuncsInitialized @ 198
- _XieTechFuncs @ 199
diff --git a/xc/lib/XIE/XIEos2.rsp b/xc/lib/XIE/XIEos2.rsp
deleted file mode 100644
index bb86a8bb5..000000000
--- a/xc/lib/XIE/XIEos2.rsp
+++ /dev/null
@@ -1,5 +0,0 @@
-abort.obj await.obj clientdata.obj colorlist.obj conven.obj elements.obj+
-errors.obj events.obj free.obj ieee.obj init.obj lut.obj photoflo.obj+
-photomap.obj photospace.obj roi.obj technique.obj utils.obj /NOI /NOL /NOD /BAT
-XIE.dll
-XIE.map
diff --git a/xc/lib/XIE/abort.c b/xc/lib/XIE/abort.c
deleted file mode 100644
index e1e30d0a4..000000000
--- a/xc/lib/XIE/abort.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $TOG: abort.c /main/3 1998/02/06 15:11:19 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/lib/XIE/abort.c,v 1.3 1999/06/13 16:18:07 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-void
-XieAbort (
- Display *display,
- unsigned long name_space,
- unsigned long flo_id)
-{
- xieAbortReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (Abort, pBuf);
-
- BEGIN_REQUEST_HEADER (Abort, pBuf, req);
-
- STORE_REQUEST_HEADER (Abort, req);
- req->nameSpace = name_space;
- req->floID = flo_id;
-
- END_REQUEST_HEADER (Abort, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
diff --git a/xc/lib/XIE/await.c b/xc/lib/XIE/await.c
deleted file mode 100644
index c451fe475..000000000
--- a/xc/lib/XIE/await.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* $TOG: await.c /main/3 1998/02/06 15:11:25 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/lib/XIE/await.c,v 1.3 1999/06/13 16:18:07 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-void
-XieAwait (
- Display *display,
- unsigned long name_space,
- unsigned long flo_id)
-{
- xieAwaitReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (Await, pBuf);
-
- BEGIN_REQUEST_HEADER (Await, pBuf, req);
-
- STORE_REQUEST_HEADER (Await, req);
- req->nameSpace = name_space;
- req->floID = flo_id;
-
- END_REQUEST_HEADER (Await, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
diff --git a/xc/lib/XIE/clientdata.c b/xc/lib/XIE/clientdata.c
deleted file mode 100644
index 2505c45f5..000000000
--- a/xc/lib/XIE/clientdata.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $TOG: clientdata.c /main/5 1998/02/06 15:11:30 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.
-
-*/
-/* $XFree86: xc/lib/XIE/clientdata.c,v 1.3 1999/06/13 16:18:07 dawes Exp $ */
-
-#include "XIElibint.h"
-
-#include <stdio.h>
-
-
-void
-XiePutClientData (
- Display *display,
- unsigned long name_space,
- unsigned long flo_id,
- XiePhototag element,
- Bool final,
- unsigned band_number,
- unsigned char *data,
- unsigned nbytes)
-{
- xiePutClientDataReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (PutClientData, pBuf);
-
- BEGIN_REQUEST_HEADER (PutClientData, pBuf, req);
-
- STORE_REQUEST_EXTRA_HEADER (PutClientData, nbytes, req);
- req->nameSpace = name_space;
- req->floID = flo_id;
- req->element = element;
- req->final = final;
- req->bandNumber = band_number;
- req->byteCount = nbytes;
-
- END_REQUEST_HEADER (PutClientData, pBuf, req);
-
- Data (display, (char *) data, nbytes);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-Status
-XieGetClientData (
- Display *display,
- unsigned long name_space,
- unsigned long flo_id,
- XiePhototag element,
- unsigned max_bytes,
- Bool terminate,
- unsigned band_number,
- XieExportState *new_state_ret,
- unsigned char **data_ret,
- unsigned *nbytes_ret)
-{
- xieGetClientDataReq *req;
- xieGetClientDataReply rep;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (GetClientData, pBuf);
-
- BEGIN_REQUEST_HEADER (GetClientData, pBuf, req);
-
- STORE_REQUEST_HEADER (GetClientData, req);
- req->nameSpace = name_space;
- req->floID = flo_id;
- req->maxBytes = max_bytes;
- req->element = element;
- req->terminate = terminate;
- req->bandNumber = band_number;
-
- END_REQUEST_HEADER (GetClientData, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- /* V4.13 moved the data length word into the reply */
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- *nbytes_ret = 0;
- *data_ret = NULL;
-
- return (0);
- }
-
-
- *new_state_ret = rep.newState;
- *nbytes_ret = rep.byteCount;
-
- *data_ret = (unsigned char *) Xmalloc (PADDED_BYTES (rep.byteCount));
-
- _XReadPad (display, (char *) *data_ret, rep.byteCount);
-
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (1);
-}
diff --git a/xc/lib/XIE/colorlist.c b/xc/lib/XIE/colorlist.c
deleted file mode 100644
index 4381f6869..000000000
--- a/xc/lib/XIE/colorlist.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* $TOG: colorlist.c /main/7 1998/02/06 15:11:36 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.
-
-*/
-/* $XFree86: xc/lib/XIE/colorlist.c,v 1.3 1999/06/13 16:18:08 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-XieColorList
-XieCreateColorList (Display *display)
-{
- xieCreateColorListReq *req;
- char *pBuf;
- XieColorList id;
-
- LockDisplay (display);
-
- id = XAllocID (display);
-
- GET_REQUEST (CreateColorList, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateColorList, pBuf, req);
-
- STORE_REQUEST_HEADER (CreateColorList, req);
- req->colorList = id;
-
- END_REQUEST_HEADER (CreateColorList, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (id);
-}
-
-
-void
-XieDestroyColorList (Display *display, XieColorList color_list)
-{
- xieDestroyColorListReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (DestroyColorList, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyColorList, pBuf, req);
-
- STORE_REQUEST_HEADER (DestroyColorList, req);
- req->colorList = color_list;
-
- END_REQUEST_HEADER (DestroyColorList, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-void
-XiePurgeColorList (Display *display, XieColorList color_list)
-{
- xiePurgeColorListReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (PurgeColorList, pBuf);
-
- BEGIN_REQUEST_HEADER (PurgeColorList, pBuf, req);
-
- STORE_REQUEST_HEADER (PurgeColorList, req);
- req->colorList = color_list;
-
- END_REQUEST_HEADER (PurgeColorList, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-Status
-XieQueryColorList (
- Display *display,
- XieColorList color_list,
- Colormap *colormap_ret,
- unsigned *ncolors_ret,
- unsigned long **colors_ret)
-{
- xieQueryColorListReq *req;
- xieQueryColorListReply rep;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (QueryColorList, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryColorList, pBuf, req);
-
- STORE_REQUEST_HEADER (QueryColorList, req);
- req->colorList = color_list;
-
- END_REQUEST_HEADER (QueryColorList, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- *colormap_ret = 0;
- *ncolors_ret = 0;
- *colors_ret = NULL;
-
- return (0);
- }
-
- *colormap_ret = rep.colormap;
- *ncolors_ret = rep.length;
-
- if (*ncolors_ret)
- {
- *colors_ret = (unsigned long *) Xmalloc (
- rep.length * sizeof (unsigned long));
-
- _XRead32 (display, *colors_ret, rep.length << 2);
- }
- else
- *colors_ret = NULL;
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (1);
-}
diff --git a/xc/lib/XIE/conven.c b/xc/lib/XIE/conven.c
deleted file mode 100644
index 4f1886aa9..000000000
--- a/xc/lib/XIE/conven.c
+++ /dev/null
@@ -1,1447 +0,0 @@
-/* $TOG: conven.c /main/10 1998/02/06 15:11: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.
-
-*/
-/* $XFree86: xc/lib/XIE/conven.c,v 1.3 1999/06/13 16:18:08 dawes Exp $ */
-
-#include "XIElibint.h"
-
-/*
- * Element Convenience Functions
- */
-
-void
-XieFloImportClientLUT (
- XiePhotoElement *element,
- XieDataClass data_class,
- XieOrientation band_order,
- XieLTriplet length,
- XieLevels levels)
-{
- element->elemType = xieElemImportClientLUT;
- element->data.ImportClientLUT.data_class = data_class;
- element->data.ImportClientLUT.band_order = band_order;
- element->data.ImportClientLUT.length[0] = length[0];
- element->data.ImportClientLUT.length[1] = length[1];
- element->data.ImportClientLUT.length[2] = length[2];
- element->data.ImportClientLUT.levels[0] = levels[0];
- element->data.ImportClientLUT.levels[1] = levels[1];
- element->data.ImportClientLUT.levels[2] = levels[2];
-}
-
-
-void
-XieFloImportClientPhoto (
- XiePhotoElement *element,
- XieDataClass data_class,
- XieLTriplet width,
- XieLTriplet height,
- XieLevels levels,
- Bool notify,
- XieDecodeTechnique decode_tech,
- XiePointer decode_param)
-{
- element->elemType = xieElemImportClientPhoto;
- element->data.ImportClientPhoto.data_class = data_class;
- element->data.ImportClientPhoto.width[0] = width[0];
- element->data.ImportClientPhoto.width[1] = width[1];
- element->data.ImportClientPhoto.width[2] = width[2];
- element->data.ImportClientPhoto.height[0] = height[0];
- element->data.ImportClientPhoto.height[1] = height[1];
- element->data.ImportClientPhoto.height[2] = height[2];
- element->data.ImportClientPhoto.levels[0] = levels[0];
- element->data.ImportClientPhoto.levels[1] = levels[1];
- element->data.ImportClientPhoto.levels[2] = levels[2];
- element->data.ImportClientPhoto.notify = notify;
- element->data.ImportClientPhoto.decode_tech = decode_tech;
- element->data.ImportClientPhoto.decode_param = decode_param;
-}
-
-
-void
-XieFloImportClientROI (XiePhotoElement *element, unsigned int rectangles)
-{
- element->elemType = xieElemImportClientROI;
- element->data.ImportClientROI.rectangles = rectangles;
-}
-
-
-void
-XieFloImportDrawable (
- XiePhotoElement *element,
- Drawable drawable,
- int src_x,
- int src_y,
- unsigned int width,
- unsigned int height,
- unsigned long fill,
- Bool notify)
-{
- element->elemType = xieElemImportDrawable;
- element->data.ImportDrawable.drawable = drawable;
- element->data.ImportDrawable.src_x = src_x;
- element->data.ImportDrawable.src_y = src_y;
- element->data.ImportDrawable.width = width;
- element->data.ImportDrawable.height = height;
- element->data.ImportDrawable.fill = fill;
- element->data.ImportDrawable.notify = notify;
-}
-
-
-void
-XieFloImportDrawablePlane (
- XiePhotoElement *element,
- Drawable drawable,
- int src_x,
- int src_y,
- unsigned int width,
- unsigned int height,
- unsigned long fill,
- unsigned long bit_plane,
- Bool notify)
-{
- element->elemType = xieElemImportDrawablePlane;
- element->data.ImportDrawablePlane.drawable = drawable;
- element->data.ImportDrawablePlane.src_x = src_x;
- element->data.ImportDrawablePlane.src_y = src_y;
- element->data.ImportDrawablePlane.width = width;
- element->data.ImportDrawablePlane.height = height;
- element->data.ImportDrawablePlane.fill = fill;
- element->data.ImportDrawablePlane.bit_plane = bit_plane;
- element->data.ImportDrawablePlane.notify = notify;
-}
-
-
-void
-XieFloImportLUT (XiePhotoElement *element, XieLut lut)
-{
- element->elemType = xieElemImportLUT;
- element->data.ImportLUT.lut = lut;
-}
-
-
-void
-XieFloImportPhotomap (
- XiePhotoElement *element,
- XiePhotomap photomap,
- Bool notify)
-{
- element->elemType = xieElemImportPhotomap;
- element->data.ImportPhotomap.photomap = photomap;
- element->data.ImportPhotomap.notify = notify;
-}
-
-
-void
-XieFloImportROI ( XiePhotoElement *element, XieRoi roi)
-{
- element->elemType = xieElemImportROI;
- element->data.ImportROI.roi = roi;
-}
-
-
-void
-XieFloArithmetic (
- XiePhotoElement *element,
- XiePhototag src1,
- XiePhototag src2,
- XieProcessDomain *domain,
- XieConstant constant,
- XieArithmeticOp operator,
- unsigned int band_mask)
-{
- element->elemType = xieElemArithmetic;
- element->data.Arithmetic.src1 = src1;
- element->data.Arithmetic.src2 = src2;
- element->data.Arithmetic.domain.offset_x = domain->offset_x;
- element->data.Arithmetic.domain.offset_y = domain->offset_y;
- element->data.Arithmetic.domain.phototag = domain->phototag;
- element->data.Arithmetic.constant[0] = constant[0];
- element->data.Arithmetic.constant[1] = constant[1];
- element->data.Arithmetic.constant[2] = constant[2];
- element->data.Arithmetic.operator = operator;
- element->data.Arithmetic.band_mask = band_mask;
-}
-
-
-void
-XieFloBandCombine (
- XiePhotoElement *element,
- XiePhototag src1,
- XiePhototag src2,
- XiePhototag src3)
-{
- element->elemType = xieElemBandCombine;
- element->data.BandCombine.src1 = src1;
- element->data.BandCombine.src2 = src2;
- element->data.BandCombine.src3 = src3;
-}
-
-
-void
-XieFloBandExtract (
- XiePhotoElement *element,
- XiePhototag src,
- unsigned int levels,
- double bias,
- XieConstant coefficients)
-{
- element->elemType = xieElemBandExtract;
- element->data.BandExtract.src = src;
- element->data.BandExtract.levels = levels;
- element->data.BandExtract.bias = bias;
- element->data.BandExtract.coefficients[0] = coefficients[0];
- element->data.BandExtract.coefficients[1] = coefficients[1];
- element->data.BandExtract.coefficients[2] = coefficients[2];
-}
-
-
-void
-XieFloBandSelect (
- XiePhotoElement *element,
- XiePhototag src,
- unsigned int band_number)
-{
- element->elemType = xieElemBandSelect;
- element->data.BandSelect.src = src;
- element->data.BandSelect.band_number = band_number;
-}
-
-
-void
-XieFloBlend (
- XiePhotoElement *element,
- XiePhototag src1,
- XiePhototag src2,
- XieConstant src_constant,
- XiePhototag alpha,
- double alpha_constant,
- XieProcessDomain *domain,
- unsigned int band_mask)
-{
- element->elemType = xieElemBlend;
- element->data.Blend.src1 = src1;
- element->data.Blend.src2 = src2;
- element->data.Blend.src_constant[0] = src_constant[0];
- element->data.Blend.src_constant[1] = src_constant[1];
- element->data.Blend.src_constant[2] = src_constant[2];
- element->data.Blend.alpha = alpha;
- element->data.Blend.alpha_constant = alpha_constant;
- element->data.Blend.domain.offset_x = domain->offset_x;
- element->data.Blend.domain.offset_y = domain->offset_y;
- element->data.Blend.domain.phototag = domain->phototag;
- element->data.Blend.band_mask = band_mask;
-}
-
-
-void
-XieFloCompare (
- XiePhotoElement *element,
- XiePhototag src1,
- XiePhototag src2,
- XieProcessDomain *domain,
- XieConstant constant,
- XieCompareOp operator,
- Bool combine,
- unsigned int band_mask)
-{
- element->elemType = xieElemCompare;
- element->data.Compare.src1 = src1;
- element->data.Compare.src2 = src2;
- element->data.Compare.domain.offset_x = domain->offset_x;
- element->data.Compare.domain.offset_y = domain->offset_y;
- element->data.Compare.domain.phototag = domain->phototag;
- element->data.Compare.constant[0] = constant[0];
- element->data.Compare.constant[1] = constant[1];
- element->data.Compare.constant[2] = constant[2];
- element->data.Compare.operator = operator;
- element->data.Compare.combine = combine;
- element->data.Compare.band_mask = band_mask;
-}
-
-
-void
-XieFloConstrain (
- XiePhotoElement *element,
- XiePhototag src,
- XieLevels levels,
- XieConstrainTechnique constrain_tech,
- XiePointer constrain_param)
-{
- element->elemType = xieElemConstrain;
- element->data.Constrain.src = src;
- element->data.Constrain.levels[0] = levels[0];
- element->data.Constrain.levels[1] = levels[1];
- element->data.Constrain.levels[2] = levels[2];
- element->data.Constrain.constrain_tech = constrain_tech;
- element->data.Constrain.constrain_param = constrain_param;
-}
-
-
-void
-XieFloConvertFromIndex (
- XiePhotoElement *element,
- XiePhototag src,
- Colormap colormap,
- XieDataClass data_class,
- unsigned int precision)
-{
- element->elemType = xieElemConvertFromIndex;
- element->data.ConvertFromIndex.src = src;
- element->data.ConvertFromIndex.colormap = colormap;
- element->data.ConvertFromIndex.data_class = data_class;
- element->data.ConvertFromIndex.precision = precision;
-}
-
-
-void
-XieFloConvertFromRGB (
- XiePhotoElement *element,
- XiePhototag src,
- XieColorspace color_space,
- XiePointer color_param)
-{
- element->elemType = xieElemConvertFromRGB;
- element->data.ConvertFromRGB.src = src;
- element->data.ConvertFromRGB.color_space = color_space;
- element->data.ConvertFromRGB.color_param = color_param;
-}
-
-
-void
-XieFloConvertToIndex (
- XiePhotoElement *element,
- XiePhototag src,
- Colormap colormap,
- XieColorList color_list,
- Bool notify,
- XieColorAllocTechnique color_alloc_tech,
- XiePointer color_alloc_param)
-{
- element->elemType = xieElemConvertToIndex;
- element->data.ConvertToIndex.src = src;
- element->data.ConvertToIndex.colormap = colormap;
- element->data.ConvertToIndex.color_list = color_list;
- element->data.ConvertToIndex.notify = notify;
- element->data.ConvertToIndex.color_alloc_tech = color_alloc_tech;
- element->data.ConvertToIndex.color_alloc_param = color_alloc_param;
-}
-
-
-void
-XieFloConvertToRGB (
- XiePhotoElement *element,
- XiePhototag src,
- XieColorspace color_space,
- XiePointer color_param)
-{
- element->elemType = xieElemConvertToRGB;
- element->data.ConvertToRGB.src = src;
- element->data.ConvertToRGB.color_space = color_space;
- element->data.ConvertToRGB.color_param = color_param;
-}
-
-
-void
-XieFloConvolve (
- XiePhotoElement *element,
- XiePhototag src,
- XieProcessDomain *domain,
- float *kernel,
- int kernel_size,
- unsigned int band_mask,
- XieConvolveTechnique convolve_tech,
- XiePointer convolve_param)
-{
- unsigned size;
-
- element->elemType = xieElemConvolve;
- element->data.Convolve.src = src;
- element->data.Convolve.domain.offset_x = domain->offset_x;
- element->data.Convolve.domain.offset_y = domain->offset_y;
- element->data.Convolve.domain.phototag = domain->phototag;
- element->data.Convolve.kernel_size = kernel_size;
- element->data.Convolve.band_mask = band_mask;
- element->data.Convolve.convolve_tech = convolve_tech;
- element->data.Convolve.convolve_param = convolve_param;
-
- size = kernel_size * kernel_size * 4;
- element->data.Convolve.kernel = (float *) Xmalloc (size);
- memcpy (element->data.Convolve.kernel, kernel, size);
-}
-
-
-void
-XieFloDither (
- XiePhotoElement *element,
- XiePhototag src,
- unsigned int band_mask,
- XieLevels levels,
- XieDitherTechnique dither_tech,
- XiePointer dither_param)
-{
- element->elemType = xieElemDither;
- element->data.Dither.src = src;
- element->data.Dither.band_mask = band_mask;
- element->data.Dither.levels[0] = levels[0];
- element->data.Dither.levels[1] = levels[1];
- element->data.Dither.levels[2] = levels[2];
- element->data.Dither.dither_tech = dither_tech;
- element->data.Dither.dither_param = dither_param;
-}
-
-
-void
-XieFloGeometry (
- XiePhotoElement *element,
- XiePhototag src,
- unsigned int width,
- unsigned int height,
- float coefficients[6],
- XieConstant constant,
- unsigned int band_mask,
- XieGeometryTechnique sample_tech,
- XiePointer sample_param)
-{
- element->elemType = xieElemGeometry;
- element->data.Geometry.src = src;
- element->data.Geometry.width = width;
- element->data.Geometry.height = height;
- element->data.Geometry.coefficients[0] = coefficients[0];
- element->data.Geometry.coefficients[1] = coefficients[1];
- element->data.Geometry.coefficients[2] = coefficients[2];
- element->data.Geometry.coefficients[3] = coefficients[3];
- element->data.Geometry.coefficients[4] = coefficients[4];
- element->data.Geometry.coefficients[5] = coefficients[5];
- element->data.Geometry.constant[0] = constant[0];
- element->data.Geometry.constant[1] = constant[1];
- element->data.Geometry.constant[2] = constant[2];
- element->data.Geometry.band_mask = band_mask;
- element->data.Geometry.sample_tech = sample_tech;
- element->data.Geometry.sample_param = sample_param;
-}
-
-
-void
-XieFloLogical (
- XiePhotoElement *element,
- XiePhototag src1,
- XiePhototag src2,
- XieProcessDomain *domain,
- XieConstant constant,
- unsigned long operator,
- unsigned int band_mask)
-{
- element->elemType = xieElemLogical;
- element->data.Logical.src1 = src1;
- element->data.Logical.src2 = src2;
- element->data.Logical.domain.offset_x = domain->offset_x;
- element->data.Logical.domain.offset_y = domain->offset_y;
- element->data.Logical.domain.phototag = domain->phototag;
- element->data.Logical.constant[0] = constant[0];
- element->data.Logical.constant[1] = constant[1];
- element->data.Logical.constant[2] = constant[2];
- element->data.Logical.operator = operator;
- element->data.Logical.band_mask = band_mask;
-}
-
-
-void
-XieFloMatchHistogram (
- XiePhotoElement *element,
- XiePhototag src,
- XieProcessDomain *domain,
- XieHistogramShape shape,
- XiePointer shape_param)
-{
- element->elemType = xieElemMatchHistogram;
- element->data.MatchHistogram.src = src;
- element->data.MatchHistogram.domain.offset_x = domain->offset_x;
- element->data.MatchHistogram.domain.offset_y = domain->offset_y;
- element->data.MatchHistogram.domain.phototag = domain->phototag;
- element->data.MatchHistogram.shape = shape;
- element->data.MatchHistogram.shape_param = shape_param;
-}
-
-
-void
-XieFloMath (
- XiePhotoElement *element,
- XiePhototag src,
- XieProcessDomain *domain,
- XieMathOp operator,
- unsigned int band_mask)
-{
- element->elemType = xieElemMath;
- element->data.Math.src = src;
- element->data.Math.domain.offset_x = domain->offset_x;
- element->data.Math.domain.offset_y = domain->offset_y;
- element->data.Math.domain.phototag = domain->phototag;
- element->data.Math.operator = operator;
- element->data.Math.band_mask = band_mask;
-}
-
-
-void
-XieFloPasteUp (
- XiePhotoElement *element,
- unsigned int width,
- unsigned int height,
- XieConstant constant,
- XieTile *tiles,
- unsigned int tile_count)
-{
- unsigned size;
-
- element->elemType = xieElemPasteUp;
- element->data.PasteUp.width = width;
- element->data.PasteUp.height = height;
- element->data.PasteUp.constant[0] = constant[0];
- element->data.PasteUp.constant[1] = constant[1];
- element->data.PasteUp.constant[2] = constant[2];
- element->data.PasteUp.tile_count = tile_count;
-
- size = tile_count * sizeof (XieTile);
- element->data.PasteUp.tiles = (XieTile *) Xmalloc (size);
- memcpy (element->data.PasteUp.tiles, tiles, size);
-}
-
-
-void
-XieFloPoint (
- XiePhotoElement *element,
- XiePhototag src,
- XieProcessDomain *domain,
- XiePhototag lut,
- unsigned int band_mask)
-{
- element->elemType = xieElemPoint;
- element->data.Point.src = src;
- element->data.Point.domain.offset_x = domain->offset_x;
- element->data.Point.domain.offset_y = domain->offset_y;
- element->data.Point.domain.phototag = domain->phototag;
- element->data.Point.lut = lut;
- element->data.Point.band_mask = band_mask;
-}
-
-void
-XieFloUnconstrain (
- XiePhotoElement *element,
- XiePhototag src)
-{
- element->elemType = xieElemUnconstrain;
- element->data.Constrain.src = src;
-}
-
-void
-XieFloExportClientHistogram (
- XiePhotoElement *element,
- XiePhototag src,
- XieProcessDomain *domain,
- XieExportNotify notify)
-{
- element->elemType = xieElemExportClientHistogram;
- element->data.ExportClientHistogram.src = src;
- element->data.ExportClientHistogram.domain.offset_x = domain->offset_x;
- element->data.ExportClientHistogram.domain.offset_y = domain->offset_y;
- element->data.ExportClientHistogram.domain.phototag = domain->phototag;
- element->data.ExportClientHistogram.notify = notify;
-}
-
-
-void
-XieFloExportClientLUT (
- XiePhotoElement *element,
- XiePhototag src,
- XieOrientation band_order,
- XieExportNotify notify,
- XieLTriplet start,
- XieLTriplet length)
-{
- int i;
-
- element->elemType = xieElemExportClientLUT;
- element->data.ExportClientLUT.src = src;
- element->data.ExportClientLUT.band_order = band_order;
- element->data.ExportClientLUT.notify = notify;
-
- for (i = 0; i < 3; i++)
- {
- element->data.ExportClientLUT.start[i] = start[i];
- element->data.ExportClientLUT.length[i] = length[i];
- }
-
-}
-
-
-void
-XieFloExportClientPhoto (
- XiePhotoElement *element,
- XiePhototag src,
- XieExportNotify notify,
- XieEncodeTechnique encode_tech,
- XiePointer encode_param)
-{
- element->elemType = xieElemExportClientPhoto;
- element->data.ExportClientPhoto.src = src;
- element->data.ExportClientPhoto.notify = notify;
- element->data.ExportClientPhoto.encode_tech = encode_tech;
- element->data.ExportClientPhoto.encode_param = encode_param;
-}
-
-
-void
-XieFloExportClientROI (
- XiePhotoElement *element,
- XiePhototag src,
- XieExportNotify notify)
-{
- element->elemType = xieElemExportClientROI;
- element->data.ExportClientROI.src = src;
- element->data.ExportClientROI.notify = notify;
-}
-
-
-void
-XieFloExportDrawable (
- XiePhotoElement *element,
- XiePhototag src,
- Drawable drawable,
- GC gc,
- int dst_x,
- int dst_y)
-{
- element->elemType = xieElemExportDrawable;
- element->data.ExportDrawable.src = src;
- element->data.ExportDrawable.drawable = drawable;
- element->data.ExportDrawable.gc = gc;
- element->data.ExportDrawable.dst_x = dst_x;
- element->data.ExportDrawable.dst_y = dst_y;
-}
-
-
-void
-XieFloExportDrawablePlane (
- XiePhotoElement *element,
- XiePhototag src,
- Drawable drawable,
- GC gc,
- int dst_x,
- int dst_y)
-{
- element->elemType = xieElemExportDrawablePlane;
- element->data.ExportDrawablePlane.src = src;
- element->data.ExportDrawablePlane.drawable = drawable;
- element->data.ExportDrawablePlane.gc = gc;
- element->data.ExportDrawablePlane.dst_x = dst_x;
- element->data.ExportDrawablePlane.dst_y = dst_y;
-}
-
-
-void
-XieFloExportLUT (
- XiePhotoElement *element,
- XiePhototag src,
- XieLut lut,
- Bool merge,
- XieLTriplet start)
-{
- int i;
-
- for (i = 0; i < 3; i++)
- element->data.ExportLUT.start[i] = start[i];
-
- element->elemType = xieElemExportLUT;
- element->data.ExportLUT.merge = merge;
- element->data.ExportLUT.src = src;
- element->data.ExportLUT.lut = lut;
-}
-
-
-void
-XieFloExportPhotomap (
- XiePhotoElement *element,
- XiePhototag src,
- XiePhotomap photomap,
- XieEncodeTechnique encode_tech,
- XiePointer encode_param)
-{
- element->elemType = xieElemExportPhotomap;
- element->data.ExportPhotomap.src = src;
- element->data.ExportPhotomap.photomap = photomap;
- element->data.ExportPhotomap.encode_tech = encode_tech;
- element->data.ExportPhotomap.encode_param = encode_param;
-}
-
-
-void
-XieFloExportROI (
- XiePhotoElement *element,
- XiePhototag src,
- XieRoi roi)
-{
- element->elemType = xieElemExportROI;
- element->data.ExportROI.src = src;
- element->data.ExportROI.roi = roi;
-}
-
-
-
-/*
- * Technique Convenience Functions
- */
-
-XieColorAllocAllParam *
-XieTecColorAllocAll (unsigned long fill)
-{
- XieColorAllocAllParam *param = (XieColorAllocAllParam *)
- Xmalloc (sizeof (XieColorAllocAllParam));
-
- param->fill = fill;
-
- return (param);
-}
-
-
-XieColorAllocMatchParam *
-XieTecColorAllocMatch ( double match_limit, double gray_limit)
-{
- XieColorAllocMatchParam *param = (XieColorAllocMatchParam *)
- Xmalloc (sizeof (XieColorAllocMatchParam));
-
- param->match_limit = match_limit;
- param->gray_limit = gray_limit;
-
- return (param);
-}
-
-
-XieColorAllocRequantizeParam *
-XieTecColorAllocRequantize (unsigned long max_cells)
-{
- XieColorAllocRequantizeParam *param = (XieColorAllocRequantizeParam *)
- Xmalloc (sizeof (XieColorAllocRequantizeParam));
-
- param->max_cells = max_cells;
-
- return (param);
-}
-
-
-XieRGBToCIELabParam *
-XieTecRGBToCIELab (
- XieMatrix matrix,
- XieWhiteAdjustTechnique white_adjust_tech,
- XiePointer white_adjust_param)
-{
- XieRGBToCIELabParam *param = (XieRGBToCIELabParam *)
- Xmalloc (sizeof (XieRGBToCIELabParam));
-
- memcpy (param->matrix, matrix, sizeof (XieMatrix));
- param->white_adjust_tech = white_adjust_tech;
- param->white_adjust_param = white_adjust_param;
-
- return (param);
-}
-
-
-XieRGBToCIEXYZParam *
-XieTecRGBToCIEXYZ (
- XieMatrix matrix,
- XieWhiteAdjustTechnique white_adjust_tech,
- XiePointer white_adjust_param)
-{
- XieRGBToCIEXYZParam *param = (XieRGBToCIEXYZParam *)
- Xmalloc (sizeof (XieRGBToCIEXYZParam));
-
- memcpy (param->matrix, matrix, sizeof (XieMatrix));
- param->white_adjust_tech = white_adjust_tech;
- param->white_adjust_param = white_adjust_param;
-
- return (param);
-}
-
-
-XieRGBToYCbCrParam *
-XieTecRGBToYCbCr (
- XieLevels levels,
- double luma_red,
- double luma_green,
- double luma_blue,
- XieConstant bias)
-{
- XieRGBToYCbCrParam *param = (XieRGBToYCbCrParam *)
- Xmalloc (sizeof (XieRGBToYCbCrParam));
-
- param->levels[0] = levels[0];
- param->levels[1] = levels[1];
- param->levels[2] = levels[2];
- param->luma_red = luma_red;
- param->luma_green = luma_green;
- param->luma_blue = luma_blue;
- param->bias[0] = bias[0];
- param->bias[1] = bias[1];
- param->bias[2] = bias[2];
-
- return (param);
-}
-
-
-XieRGBToYCCParam *
-XieTecRGBToYCC (
- XieLevels levels,
- double luma_red,
- double luma_green,
- double luma_blue,
- double scale)
-{
- XieRGBToYCCParam *param = (XieRGBToYCCParam *)
- Xmalloc (sizeof (XieRGBToYCCParam));
-
- param->levels[0] = levels[0];
- param->levels[1] = levels[1];
- param->levels[2] = levels[2];
- param->luma_red = luma_red;
- param->luma_green = luma_green;
- param->luma_blue = luma_blue;
- param->scale = scale;
-
- return (param);
-}
-
-
-XieCIELabToRGBParam *
-XieTecCIELabToRGB (
- XieMatrix matrix,
- XieWhiteAdjustTechnique white_adjust_tech,
- XiePointer white_adjust_param,
- XieGamutTechnique gamut_tech,
- XiePointer gamut_param)
-{
- XieCIELabToRGBParam *param = (XieCIELabToRGBParam *)
- Xmalloc (sizeof (XieCIELabToRGBParam));
-
- memcpy (param->matrix, matrix, sizeof (XieMatrix));
- param->white_adjust_tech = white_adjust_tech;
- param->white_adjust_param = white_adjust_param;
- param->gamut_tech = gamut_tech;
- param->gamut_param = gamut_param;
-
- return (param);
-}
-
-
-XieCIEXYZToRGBParam *
-XieTecCIEXYZToRGB (
- XieMatrix matrix,
- XieWhiteAdjustTechnique white_adjust_tech,
- XiePointer white_adjust_param,
- XieGamutTechnique gamut_tech,
- XiePointer gamut_param)
-{
- XieCIEXYZToRGBParam *param = (XieCIEXYZToRGBParam *)
- Xmalloc (sizeof (XieCIEXYZToRGBParam));
-
- memcpy (param->matrix, matrix, sizeof (XieMatrix));
- param->white_adjust_tech = white_adjust_tech;
- param->white_adjust_param = white_adjust_param;
- param->gamut_tech = gamut_tech;
- param->gamut_param = gamut_param;
-
- return (param);
-}
-
-
-XieYCbCrToRGBParam *
-XieTecYCbCrToRGB (
- XieLevels levels,
- double luma_red,
- double luma_green,
- double luma_blue,
- XieConstant bias,
- XieGamutTechnique gamut_tech,
- XiePointer gamut_param)
-{
- XieYCbCrToRGBParam *param = (XieYCbCrToRGBParam *)
- Xmalloc (sizeof (XieYCbCrToRGBParam));
-
- param->levels[0] = levels[0];
- param->levels[1] = levels[1];
- param->levels[2] = levels[2];
- param->luma_red = luma_red;
- param->luma_green = luma_green;
- param->luma_blue = luma_blue;
- param->bias[0] = bias[0];
- param->bias[1] = bias[1];
- param->bias[2] = bias[2];
- param->gamut_tech = gamut_tech;
- param->gamut_param = gamut_param;
-
- return (param);
-}
-
-
-XieYCCToRGBParam *
-XieTecYCCToRGB (
- XieLevels levels,
- double luma_red,
- double luma_green,
- double luma_blue,
- double scale,
- XieGamutTechnique gamut_tech,
- XiePointer gamut_param)
-{
- XieYCCToRGBParam *param = (XieYCCToRGBParam *)
- Xmalloc (sizeof (XieYCCToRGBParam));
-
- param->levels[0] = levels[0];
- param->levels[1] = levels[1];
- param->levels[2] = levels[2];
- param->luma_red = luma_red;
- param->luma_green = luma_green;
- param->luma_blue = luma_blue;
- param->scale = scale;
- param->gamut_tech = gamut_tech;
- param->gamut_param = gamut_param;
-
- return (param);
-}
-
-
-XieClipScaleParam *
-XieTecClipScale (
- XieConstant in_low,
- XieConstant in_high,
- XieLTriplet out_low,
- XieLTriplet out_high)
-{
- int i;
-
- XieClipScaleParam *param = (XieClipScaleParam *)
- Xmalloc (sizeof (XieClipScaleParam));
-
- for (i = 0; i < 3; i++)
- {
- param->input_low[i] = in_low[i];
- param->input_high[i] = in_high[i];
- param->output_low[i] = out_low[i];
- param->output_high[i] = out_high[i];
- }
-
- return (param);
-}
-
-
-XieConvolveConstantParam *
-XieTecConvolveConstant (XieConstant constant)
-{
- XieConvolveConstantParam *param = (XieConvolveConstantParam *)
- Xmalloc (sizeof (XieConvolveConstantParam));
-
- param->constant[0] = constant[0];
- param->constant[1] = constant[1];
- param->constant[2] = constant[2];
-
- return (param);
-}
-
-
-XieDecodeUncompressedSingleParam *
-XieTecDecodeUncompressedSingle (
- XieOrientation fill_order,
- XieOrientation pixel_order,
- unsigned int pixel_stride,
- unsigned int left_pad,
- unsigned int scanline_pad)
-{
- XieDecodeUncompressedSingleParam *param =
- (XieDecodeUncompressedSingleParam *) Xmalloc (
- sizeof (XieDecodeUncompressedSingleParam));
-
- param->fill_order = fill_order;
- param->pixel_order = pixel_order;
- param->pixel_stride = pixel_stride;
- param->left_pad = left_pad;
- param->scanline_pad = scanline_pad;
-
- return (param);
-}
-
-
-XieDecodeUncompressedTripleParam *
-XieTecDecodeUncompressedTriple (
- XieOrientation fill_order,
- XieOrientation pixel_order,
- XieOrientation band_order,
- XieInterleave interleave,
- unsigned char pixel_stride[3],
- unsigned char left_pad[3],
- unsigned char scanline_pad[3])
-{
- XieDecodeUncompressedTripleParam *param =
- (XieDecodeUncompressedTripleParam *) Xmalloc (
- sizeof (XieDecodeUncompressedTripleParam));
-
- param->left_pad[0] = left_pad[0];
- param->left_pad[1] = left_pad[1];
- param->left_pad[2] = left_pad[2];
- param->fill_order = fill_order;
- param->pixel_stride[0] = pixel_stride[0];
- param->pixel_stride[1] = pixel_stride[1];
- param->pixel_stride[2] = pixel_stride[2];
- param->pixel_order = pixel_order;
- param->scanline_pad[0] = scanline_pad[0];
- param->scanline_pad[1] = scanline_pad[1];
- param->scanline_pad[2] = scanline_pad[2];
- param->band_order = band_order;
- param->interleave = interleave;
-
- return (param);
-}
-
-
-XieDecodeG31DParam *
-XieTecDecodeG31D (
- XieOrientation encoded_order,
- Bool normal,
- Bool radiometric)
-{
- XieDecodeG31DParam *param = (XieDecodeG31DParam *)
- Xmalloc (sizeof (XieDecodeG31DParam));
-
- param->encoded_order = encoded_order;
- param->normal = normal;
- param->radiometric = radiometric;
-
- return (param);
-}
-
-
-XieDecodeG32DParam *
-XieTecDecodeG32D (
- XieOrientation encoded_order,
- Bool normal,
- Bool radiometric)
-{
- XieDecodeG32DParam *param = (XieDecodeG32DParam *)
- Xmalloc (sizeof (XieDecodeG32DParam));
-
- param->encoded_order = encoded_order;
- param->normal = normal;
- param->radiometric = radiometric;
-
- return (param);
-}
-
-
-XieDecodeG42DParam *
-XieTecDecodeG42D (
- XieOrientation encoded_order,
- Bool normal,
- Bool radiometric)
-{
- XieDecodeG42DParam *param = (XieDecodeG42DParam *)
- Xmalloc (sizeof (XieDecodeG42DParam));
-
- param->encoded_order = encoded_order;
- param->normal = normal;
- param->radiometric = radiometric;
-
- return (param);
-}
-
-
-XieDecodeTIFF2Param *
-XieTecDecodeTIFF2 (
- XieOrientation encoded_order,
- Bool normal,
- Bool radiometric)
-{
- XieDecodeTIFF2Param *param = (XieDecodeTIFF2Param *)
- Xmalloc (sizeof (XieDecodeTIFF2Param));
-
- param->encoded_order = encoded_order;
- param->normal = normal;
- param->radiometric = radiometric;
-
- return (param);
-}
-
-
-XieDecodeTIFFPackBitsParam *
-XieTecDecodeTIFFPackBits (
- XieOrientation encoded_order,
- Bool normal)
-{
- XieDecodeTIFFPackBitsParam *param = (XieDecodeTIFFPackBitsParam *)
- Xmalloc (sizeof (XieDecodeTIFFPackBitsParam));
-
- param->encoded_order = encoded_order;
- param->normal = normal;
-
- return (param);
-}
-
-
-XieDecodeJPEGBaselineParam *
-XieTecDecodeJPEGBaseline (
- XieInterleave interleave,
- XieOrientation band_order,
- Bool up_sample)
-{
- XieDecodeJPEGBaselineParam *param = (XieDecodeJPEGBaselineParam *)
- Xmalloc (sizeof (XieDecodeJPEGBaselineParam));
-
- param->interleave = interleave;
- param->band_order = band_order;
- param->up_sample = up_sample;
-
- return (param);
-}
-
-
-XieDecodeJPEGLosslessParam *
-XieTecDecodeJPEGLossless (XieInterleave interleave, XieOrientation band_order)
-{
- XieDecodeJPEGLosslessParam *param = (XieDecodeJPEGLosslessParam *)
- Xmalloc (sizeof (XieDecodeJPEGLosslessParam));
-
- param->interleave = interleave;
- param->band_order = band_order;
-
- return (param);
-}
-
-
-XieDitherOrderedParam *
-XieTecDitherOrderedParam (unsigned int threshold_order)
-{
- XieDitherOrderedParam *param = (XieDitherOrderedParam *)
- Xmalloc (sizeof (XieDitherOrderedParam));
-
- param->threshold_order = threshold_order;
-
- return (param);
-}
-
-
-XieEncodeUncompressedSingleParam *
-XieTecEncodeUncompressedSingle (
- XieOrientation fill_order,
- XieOrientation pixel_order,
- unsigned int pixel_stride,
- unsigned int scanline_pad)
-{
- XieEncodeUncompressedSingleParam *param =
- (XieEncodeUncompressedSingleParam *) Xmalloc (
- sizeof (XieEncodeUncompressedSingleParam));
-
- param->fill_order = fill_order;
- param->pixel_order = pixel_order;
- param->pixel_stride = pixel_stride;
- param->scanline_pad = scanline_pad;
-
- return (param);
-}
-
-
-XieEncodeUncompressedTripleParam *
-XieTecEncodeUncompressedTriple (
- XieOrientation fill_order,
- XieOrientation pixel_order,
- XieOrientation band_order,
- XieInterleave interleave,
- unsigned char pixel_stride[3],
- unsigned char scanline_pad[3])
-{
- XieEncodeUncompressedTripleParam *param =
- (XieEncodeUncompressedTripleParam *) Xmalloc (
- sizeof (XieEncodeUncompressedTripleParam));
-
- param->pixel_stride[0] = pixel_stride[0];
- param->pixel_stride[1] = pixel_stride[1];
- param->pixel_stride[2] = pixel_stride[2];
- param->pixel_order = pixel_order;
- param->scanline_pad[0] = scanline_pad[0];
- param->scanline_pad[1] = scanline_pad[1];
- param->scanline_pad[2] = scanline_pad[2];
- param->fill_order = fill_order;
- param->band_order = band_order;
- param->interleave = interleave;
-
- return (param);
-}
-
-
-XieEncodeG31DParam *
-XieTecEncodeG31D (
- Bool align_eol,
- Bool radiometric,
- XieOrientation encoded_order)
-{
- XieEncodeG31DParam *param = (XieEncodeG31DParam *)
- Xmalloc (sizeof (XieEncodeG31DParam));
-
- param->align_eol = align_eol;
- param->radiometric = radiometric;
- param->encoded_order = encoded_order;
-
- return (param);
-}
-
-
-XieEncodeG32DParam *
-XieTecEncodeG32D (
- Bool uncompressed,
- Bool align_eol,
- Bool radiometric,
- XieOrientation encoded_order,
- unsigned long k_factor)
-{
- XieEncodeG32DParam *param = (XieEncodeG32DParam *)
- Xmalloc (sizeof (XieEncodeG32DParam));
-
- param->uncompressed = uncompressed;
- param->align_eol = align_eol;
- param->radiometric = radiometric;
- param->encoded_order = encoded_order;
- param->k_factor = k_factor;
-
- return (param);
-}
-
-
-XieEncodeG42DParam *
-XieTecEncodeG42D (
- Bool uncompressed,
- Bool radiometric,
- XieOrientation encoded_order)
-{
- XieEncodeG42DParam *param = (XieEncodeG42DParam *)
- Xmalloc (sizeof (XieEncodeG42DParam));
-
- param->uncompressed = uncompressed;
- param->radiometric = radiometric;
- param->encoded_order = encoded_order;
-
- return (param);
-}
-
-
-XieEncodeJPEGBaselineParam *
-XieTecEncodeJPEGBaseline (
- XieInterleave interleave,
- XieOrientation band_order,
- unsigned char horizontal_samples[3],
- unsigned char vertical_samples[3],
- char *q_table,
- unsigned int q_size,
- char *ac_table,
- unsigned int ac_size,
- char *dc_table,
- unsigned int dc_size)
-{
- XieEncodeJPEGBaselineParam *param = (XieEncodeJPEGBaselineParam *)
- Xmalloc (sizeof (XieEncodeJPEGBaselineParam));
-
- param->interleave = interleave;
- param->band_order = band_order;
-
- param->horizontal_samples[0] = horizontal_samples[0];
- param->horizontal_samples[1] = horizontal_samples[1];
- param->horizontal_samples[2] = horizontal_samples[2];
-
- param->vertical_samples[0] = vertical_samples[0];
- param->vertical_samples[1] = vertical_samples[1];
- param->vertical_samples[2] = vertical_samples[2];
-
- param->q_size = q_size;
- param->ac_size = ac_size;
- param->dc_size = dc_size;
-
- param->q_table = (char *) Xmalloc (q_size);
- param->ac_table = (char *) Xmalloc (ac_size);
- param->dc_table = (char *) Xmalloc (dc_size);
-
- memcpy (param->q_table, q_table, q_size);
- memcpy (param->ac_table, ac_table, ac_size);
- memcpy (param->dc_table, dc_table, dc_size);
-
- return (param);
-}
-
-
-XieEncodeJPEGLosslessParam *
-XieTecEncodeJPEGLossless (
- XieInterleave interleave,
- XieOrientation band_order,
- unsigned char predictor[3],
- char *table,
- unsigned int table_size)
-{
- XieEncodeJPEGLosslessParam *param = (XieEncodeJPEGLosslessParam *)
- Xmalloc (sizeof (XieEncodeJPEGLosslessParam));
-
- param->interleave = interleave;
- param->band_order = band_order;
- param->predictor[0] = predictor[0];
- param->predictor[1] = predictor[1];
- param->predictor[2] = predictor[2];
- param->table_size = table_size;
-
- param->table = (char *) Xmalloc (table_size);
- memcpy (param->table, table, table_size);
-
- return (param);
-}
-
-
-XieEncodeTIFF2Param *
-XieTecEncodeTIFF2 (XieOrientation encoded_order, Bool radiometric)
-{
- XieEncodeTIFF2Param *param = (XieEncodeTIFF2Param *)
- Xmalloc (sizeof (XieEncodeTIFF2Param));
-
- param->encoded_order = encoded_order;
- param->radiometric = radiometric;
-
- return (param);
-}
-
-
-XieEncodeTIFFPackBitsParam *
-XieTecEncodeTIFFPackBits (XieOrientation encoded_order)
-{
- XieEncodeTIFFPackBitsParam *param = (XieEncodeTIFFPackBitsParam *)
- Xmalloc (sizeof (XieEncodeTIFFPackBitsParam));
-
- param->encoded_order = encoded_order;
-
- return (param);
-}
-
-XieEncodeServerChoiceParam *
-XieTecEncodeServerChoice (unsigned int preference)
-{
- XieEncodeServerChoiceParam *param = (XieEncodeServerChoiceParam *)
- Xmalloc (sizeof (XieEncodeServerChoiceParam));
-
- param->preference = preference;
-
- return (param);
-}
-
-
-XieGeomAntialiasByAreaParam *
-XieTecGeomAntialiasByArea (int simple)
-{
- XieGeomAntialiasByAreaParam *param = (XieGeomAntialiasByAreaParam *)
- Xmalloc (sizeof (XieGeomAntialiasByAreaParam));
-
- param->simple = simple;
-
- return (param);
-}
-
-
-XieGeomAntialiasByLowpassParam *
-XieTecGeomAntialiasByLowpass ( int kernel_size)
-{
- XieGeomAntialiasByLowpassParam *param = (XieGeomAntialiasByLowpassParam *)
- Xmalloc (sizeof (XieGeomAntialiasByLowpassParam));
-
- param->kernel_size = kernel_size;
-
- return (param);
-}
-
-
-XieGeomGaussianParam *
-XieTecGeomGaussian (
- double sigma,
- double normalize,
- unsigned int radius,
- Bool simple)
-{
- XieGeomGaussianParam *param = (XieGeomGaussianParam *)
- Xmalloc (sizeof (XieGeomGaussianParam));
-
- param->sigma = sigma;
- param->normalize = normalize;
- param->radius = radius;
- param->simple = simple;
-
- return (param);
-}
-
-
-XieGeomNearestNeighborParam *
-XieTecGeomNearestNeighbor (unsigned int modify)
-{
- XieGeomNearestNeighborParam *param = (XieGeomNearestNeighborParam *)
- Xmalloc (sizeof (XieGeomNearestNeighborParam));
-
- param->modify = modify;
-
- return (param);
-}
-
-XieHistogramGaussianParam *
-XieTecHistogramGaussian (double mean, double sigma)
-{
- XieHistogramGaussianParam *param = (XieHistogramGaussianParam *)
- Xmalloc (sizeof (XieHistogramGaussianParam));
-
- param->mean = mean;
- param->sigma = sigma;
-
- return (param);
-}
-
-
-XieHistogramHyperbolicParam *
-XieTecHistogramHyperbolic (double constant, Bool shape_factor)
-{
- XieHistogramHyperbolicParam *param = (XieHistogramHyperbolicParam *)
- Xmalloc (sizeof (XieHistogramHyperbolicParam));
-
- param->constant = constant;
- param->shape_factor = shape_factor;
-
- return (param);
-}
-
-
-XieWhiteAdjustCIELabShiftParam *
-XieTecWhiteAdjustCIELabShift (XieConstant white_point)
-{
- XieWhiteAdjustCIELabShiftParam *param = (XieWhiteAdjustCIELabShiftParam *)
- Xmalloc (sizeof (XieWhiteAdjustCIELabShiftParam));
-
- param->white_point[0] = white_point[0];
- param->white_point[1] = white_point[1];
- param->white_point[2] = white_point[2];
-
- return (param);
-}
diff --git a/xc/lib/XIE/elements.c b/xc/lib/XIE/elements.c
deleted file mode 100644
index c1f144f85..000000000
--- a/xc/lib/XIE/elements.c
+++ /dev/null
@@ -1,1191 +0,0 @@
-/* $TOG: elements.c /main/6 1998/02/06 15:11:48 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.
-
-*/
-/* $XFree86: xc/lib/XIE/elements.c,v 1.3 1999/06/13 16:18:08 dawes Exp $ */
-
-#include "XIElibint.h"
-#include "elements.h"
-#include "globals.h"
-
-#include <stdio.h>
-
-
-int
-_XiePhotofloSize (
- XiePhotoElement *elem_list,
- int elem_count)
-{
- XiePhotoElement *elemSrc;
- int size = 0;
- int i;
-
- for (i = 0; i < elem_count; i++)
- {
- elemSrc = &elem_list[i];
-
- switch (elemSrc->elemType)
- {
- case xieElemImportClientLUT:
- size += SIZEOF (xieFloImportClientLUT);
- break;
-
- case xieElemImportClientPhoto:
- size += SIZEOF (xieFloImportClientPhoto) +
- (_XieTechniqueLength (xieValDecode,
- elemSrc->data.ImportClientPhoto.decode_tech,
- elemSrc->data.ImportClientPhoto.decode_param) << 2);
- break;
-
- case xieElemImportClientROI:
- size += SIZEOF (xieFloImportClientROI);
- break;
-
- case xieElemImportDrawable:
- size += SIZEOF (xieFloImportDrawable);
- break;
-
- case xieElemImportDrawablePlane:
- size += SIZEOF (xieFloImportDrawablePlane);
- break;
-
- case xieElemImportLUT:
- size += SIZEOF (xieFloImportLUT);
- break;
-
- case xieElemImportPhotomap:
- size += SIZEOF (xieFloImportPhotomap);
- break;
-
- case xieElemImportROI:
- size += SIZEOF (xieFloImportROI);
- break;
-
- case xieElemArithmetic:
- size += SIZEOF (xieFloArithmetic);
- break;
-
- case xieElemBandCombine:
- size += SIZEOF (xieFloBandCombine);
- break;
-
- case xieElemBandExtract:
- size += SIZEOF (xieFloBandExtract);
- break;
-
- case xieElemBandSelect:
- size += SIZEOF (xieFloBandSelect);
- break;
-
- case xieElemBlend:
- size += SIZEOF (xieFloBlend);
- break;
-
- case xieElemCompare:
- size += SIZEOF (xieFloCompare);
- break;
-
- case xieElemConstrain:
- size += SIZEOF (xieFloConstrain) +
- (_XieTechniqueLength (xieValConstrain,
- elemSrc->data.Constrain.constrain_tech,
- elemSrc->data.Constrain.constrain_param) << 2);
- break;
-
- case xieElemConvertFromIndex:
- size += SIZEOF (xieFloConvertFromIndex);
- break;
-
- case xieElemConvertFromRGB:
- size += SIZEOF (xieFloConvertFromRGB) +
- (_XieTechniqueLength (xieValConvertFromRGB,
- elemSrc->data.ConvertFromRGB.color_space,
- elemSrc->data.ConvertFromRGB.color_param) << 2);
- break;
-
- case xieElemConvertToIndex:
- size += SIZEOF (xieFloConvertToIndex) +
- (_XieTechniqueLength (xieValColorAlloc,
- elemSrc->data.ConvertToIndex.color_alloc_tech,
- elemSrc->data.ConvertToIndex.color_alloc_param) << 2);
- break;
-
- case xieElemConvertToRGB:
- size += SIZEOF (xieFloConvertToRGB) +
- (_XieTechniqueLength (xieValConvertToRGB,
- elemSrc->data.ConvertToRGB.color_space,
- elemSrc->data.ConvertToRGB.color_param) << 2);
- break;
-
- case xieElemConvolve:
- size += SIZEOF (xieFloConvolve) +
- (4 * elemSrc->data.Convolve.kernel_size *
- elemSrc->data.Convolve.kernel_size) +
- (_XieTechniqueLength (xieValConvolve,
- elemSrc->data.Convolve.convolve_tech,
- elemSrc->data.Convolve.convolve_param) << 2);
- break;
-
- case xieElemDither:
- size += SIZEOF (xieFloDither) +
- (_XieTechniqueLength (xieValDither,
- elemSrc->data.Dither.dither_tech,
- elemSrc->data.Dither.dither_param) << 2);
- break;
-
- case xieElemGeometry:
- size += SIZEOF (xieFloGeometry) +
- (_XieTechniqueLength (xieValGeometry,
- elemSrc->data.Geometry.sample_tech,
- elemSrc->data.Geometry.sample_param) << 2);
- break;
-
- case xieElemLogical:
- size += SIZEOF (xieFloLogical);
- break;
-
- case xieElemMatchHistogram:
- size += SIZEOF (xieFloMatchHistogram) +
- (_XieTechniqueLength (xieValHistogram,
- elemSrc->data.MatchHistogram.shape,
- elemSrc->data.MatchHistogram.shape_param) << 2);
- break;
-
- case xieElemMath:
- size += SIZEOF (xieFloMath);
- break;
-
- case xieElemPasteUp:
- size += SIZEOF (xieFloPasteUp) +
- elemSrc->data.PasteUp.tile_count * SIZEOF (xieTypTile);
- break;
-
- case xieElemPoint:
- size += SIZEOF (xieFloPoint);
- break;
-
- case xieElemUnconstrain:
- size += SIZEOF (xieFloUnconstrain);
- break;
-
- case xieElemExportClientHistogram:
- size += SIZEOF (xieFloExportClientHistogram);
- break;
-
- case xieElemExportClientLUT:
- size += SIZEOF (xieFloExportClientLUT);
- break;
-
- case xieElemExportClientPhoto:
- size += SIZEOF (xieFloExportClientPhoto) +
- (_XieTechniqueLength (xieValEncode,
- elemSrc->data.ExportClientPhoto.encode_tech,
- elemSrc->data.ExportClientPhoto.encode_param) << 2);
- break;
-
- case xieElemExportClientROI:
- size += SIZEOF (xieFloExportClientROI);
- break;
-
- case xieElemExportDrawable:
- size += SIZEOF (xieFloExportDrawable);
- break;
-
- case xieElemExportDrawablePlane:
- size += SIZEOF (xieFloExportDrawablePlane);
- break;
-
- case xieElemExportLUT:
- size += SIZEOF (xieFloExportLUT);
- break;
-
- case xieElemExportPhotomap:
- size += SIZEOF (xieFloExportPhotomap) +
- (_XieTechniqueLength (xieValEncode,
- elemSrc->data.ExportPhotomap.encode_tech,
- elemSrc->data.ExportPhotomap.encode_param) << 2);
- break;
-
- case xieElemExportROI:
- size += SIZEOF (xieFloExportROI);
- break;
-
- default:
- break;
- }
- }
-
- return (size);
-}
-
-
-void
-_XieElemImportClientLUT (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportClientLUT *elemDest;
-
- BEGIN_ELEM_HEAD (ImportClientLUT, elemSrc,
- LENOF (xieFloImportClientLUT), *bufDest, elemDest);
-
- elemDest->class = elemSrc->data.ImportClientLUT.data_class;
- elemDest->bandOrder = elemSrc->data.ImportClientLUT.band_order;
- elemDest->length0 = elemSrc->data.ImportClientLUT.length[0];
- elemDest->length1 = elemSrc->data.ImportClientLUT.length[1];
- elemDest->length2 = elemSrc->data.ImportClientLUT.length[2];
- elemDest->levels0 = elemSrc->data.ImportClientLUT.levels[0];
- elemDest->levels1 = elemSrc->data.ImportClientLUT.levels[1];
- elemDest->levels2 = elemSrc->data.ImportClientLUT.levels[2];
-
- END_ELEM_HEAD (ImportClientLUT, *bufDest, elemDest);
-}
-
-
-void
-_XieElemImportClientPhoto (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportClientPhoto *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValDecode,
- elemSrc->data.ImportClientPhoto.decode_tech,
- elemSrc->data.ImportClientPhoto.decode_param);
-
- BEGIN_ELEM_HEAD (ImportClientPhoto, elemSrc,
- LENOF (xieFloImportClientPhoto) + techLen, *bufDest, elemDest);
-
- elemDest->notify = elemSrc->data.ImportClientPhoto.notify;
- elemDest->class = elemSrc->data.ImportClientPhoto.data_class;
- elemDest->width0 = elemSrc->data.ImportClientPhoto.width[0];
- elemDest->width1 = elemSrc->data.ImportClientPhoto.width[1];
- elemDest->width2 = elemSrc->data.ImportClientPhoto.width[2];
- elemDest->height0 = elemSrc->data.ImportClientPhoto.height[0];
- elemDest->height1 = elemSrc->data.ImportClientPhoto.height[1];
- elemDest->height2 = elemSrc->data.ImportClientPhoto.height[2];
- elemDest->levels0 = elemSrc->data.ImportClientPhoto.levels[0];
- elemDest->levels1 = elemSrc->data.ImportClientPhoto.levels[1];
- elemDest->levels2 = elemSrc->data.ImportClientPhoto.levels[2];
- elemDest->decodeTechnique = elemSrc->data.ImportClientPhoto.decode_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (ImportClientPhoto, *bufDest, elemDest);
-
- /* Technique dependent decode params */
-
- _XieEncodeTechnique (bufDest, xieValDecode,
- elemSrc->data.ImportClientPhoto.decode_tech,
- elemSrc->data.ImportClientPhoto.decode_param);
-}
-
-
-void
-_XieElemImportClientROI (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportClientROI *elemDest;
-
- BEGIN_ELEM_HEAD (ImportClientROI, elemSrc,
- LENOF (xieFloImportClientROI), *bufDest, elemDest);
-
- elemDest->rectangles = elemSrc->data.ImportClientROI.rectangles;
-
- END_ELEM_HEAD (ImportClientROI, *bufDest, elemDest);
-}
-
-
-void
-_XieElemImportDrawable (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportDrawable *elemDest;
-
- BEGIN_ELEM_HEAD (ImportDrawable, elemSrc,
- LENOF (xieFloImportDrawable), *bufDest, elemDest);
-
- elemDest->drawable = elemSrc->data.ImportDrawable.drawable;
- elemDest->srcX = elemSrc->data.ImportDrawable.src_x;
- elemDest->srcY = elemSrc->data.ImportDrawable.src_y;
- elemDest->width = elemSrc->data.ImportDrawable.width;
- elemDest->height = elemSrc->data.ImportDrawable.height;
- elemDest->fill = elemSrc->data.ImportDrawable.fill;
- elemDest->notify = elemSrc->data.ImportDrawable.notify;
-
- END_ELEM_HEAD (ImportDrawable, *bufDest, elemDest);
-}
-
-
-void
-_XieElemImportDrawablePlane (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportDrawablePlane *elemDest;
-
- BEGIN_ELEM_HEAD (ImportDrawablePlane, elemSrc,
- LENOF (xieFloImportDrawablePlane), *bufDest, elemDest);
-
- elemDest->drawable = elemSrc->data.ImportDrawablePlane.drawable;
- elemDest->srcX = elemSrc->data.ImportDrawablePlane.src_x;
- elemDest->srcY = elemSrc->data.ImportDrawablePlane.src_y;
- elemDest->width = elemSrc->data.ImportDrawablePlane.width;
- elemDest->height = elemSrc->data.ImportDrawablePlane.height;
- elemDest->fill = elemSrc->data.ImportDrawablePlane.fill;
- elemDest->bitPlane = elemSrc->data.ImportDrawablePlane.bit_plane;
- elemDest->notify = elemSrc->data.ImportDrawablePlane.notify;
-
- END_ELEM_HEAD (ImportDrawablePlane, *bufDest, elemDest);
-}
-
-
-void
-_XieElemImportLUT (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportLUT *elemDest;
-
- BEGIN_ELEM_HEAD (ImportLUT, elemSrc,
- LENOF (xieFloImportLUT), *bufDest, elemDest);
-
- elemDest->lut = elemSrc->data.ImportLUT.lut;
-
- END_ELEM_HEAD (ImportLUT, *bufDest, elemDest);
-}
-
-
-void
-_XieElemImportPhotomap (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportPhotomap *elemDest;
-
- BEGIN_ELEM_HEAD (ImportPhotomap, elemSrc,
- LENOF (xieFloImportPhotomap), *bufDest, elemDest);
-
- elemDest->photomap = elemSrc->data.ImportPhotomap.photomap;
- elemDest->notify = elemSrc->data.ImportPhotomap.notify;
-
- END_ELEM_HEAD (ImportPhotomap, *bufDest, elemDest);
-}
-
-
-void
-_XieElemImportROI (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloImportROI *elemDest;
-
- BEGIN_ELEM_HEAD (ImportROI, elemSrc,
- LENOF (xieFloImportROI), *bufDest, elemDest);
-
- elemDest->roi = elemSrc->data.ImportROI.roi;
-
- END_ELEM_HEAD (ImportROI, *bufDest, elemDest);
-}
-
-
-void
-_XieElemArithmetic (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloArithmetic *elemDest;
-
- BEGIN_ELEM_HEAD (Arithmetic, elemSrc,
- LENOF (xieFloArithmetic), *bufDest, elemDest);
-
- elemDest->src1 = elemSrc->data.Arithmetic.src1;
- elemDest->src2 = elemSrc->data.Arithmetic.src2;
- elemDest->domainOffsetX = elemSrc->data.Arithmetic.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Arithmetic.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Arithmetic.domain.phototag;
- elemDest->operator = elemSrc->data.Arithmetic.operator;
- elemDest->bandMask = elemSrc->data.Arithmetic.band_mask;
- elemDest->constant0 =
- _XieConvertToIEEE (elemSrc->data.Arithmetic.constant[0]);
- elemDest->constant1 =
- _XieConvertToIEEE (elemSrc->data.Arithmetic.constant[1]);
- elemDest->constant2 =
- _XieConvertToIEEE (elemSrc->data.Arithmetic.constant[2]);
-
- END_ELEM_HEAD (Arithmetic, *bufDest, elemDest);
-}
-
-
-void
-_XieElemBandCombine (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloBandCombine *elemDest;
-
- BEGIN_ELEM_HEAD (BandCombine, elemSrc,
- LENOF (xieFloBandCombine), *bufDest, elemDest);
-
- elemDest->src1 = elemSrc->data.BandCombine.src1;
- elemDest->src2 = elemSrc->data.BandCombine.src2;
- elemDest->src3 = elemSrc->data.BandCombine.src3;
-
- END_ELEM_HEAD (BandCombine, *bufDest, elemDest);
-}
-
-
-void
-_XieElemBandExtract (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloBandExtract *elemDest;
-
- BEGIN_ELEM_HEAD (BandExtract, elemSrc,
- LENOF (xieFloBandExtract), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.BandExtract.src;
- elemDest->levels = elemSrc->data.BandExtract.levels;
- elemDest->bias =
- _XieConvertToIEEE (elemSrc->data.BandExtract.bias);
- elemDest->constant0 =
- _XieConvertToIEEE (elemSrc->data.BandExtract.coefficients[0]);
- elemDest->constant1 =
- _XieConvertToIEEE (elemSrc->data.BandExtract.coefficients[1]);
- elemDest->constant2 =
- _XieConvertToIEEE (elemSrc->data.BandExtract.coefficients[2]);
- END_ELEM_HEAD (BandExtract, *bufDest, elemDest);
-}
-
-void
-_XieElemBandSelect (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloBandSelect *elemDest;
-
- BEGIN_ELEM_HEAD (BandSelect, elemSrc,
- LENOF (xieFloBandSelect), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.BandSelect.src;
- elemDest->bandNumber= elemSrc->data.BandSelect.band_number;
-
- END_ELEM_HEAD (BandSelect, *bufDest, elemDest);
-}
-
-
-void
-_XieElemBlend (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloBlend *elemDest;
-
- BEGIN_ELEM_HEAD (Blend, elemSrc,
- LENOF (xieFloBlend), *bufDest, elemDest);
-
- elemDest->src1 = elemSrc->data.Blend.src1;
- elemDest->src2 = elemSrc->data.Blend.src2;
- elemDest->alpha = elemSrc->data.Blend.alpha;
- elemDest->constant0 =
- _XieConvertToIEEE (elemSrc->data.Blend.src_constant[0]);
- elemDest->constant1 =
- _XieConvertToIEEE (elemSrc->data.Blend.src_constant[1]);
- elemDest->constant2 =
- _XieConvertToIEEE (elemSrc->data.Blend.src_constant[2]);
- elemDest->alphaConst =
- _XieConvertToIEEE (elemSrc->data.Blend.alpha_constant);
- elemDest->domainOffsetX = elemSrc->data.Blend.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Blend.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Blend.domain.phototag;
- elemDest->bandMask = elemSrc->data.Blend.band_mask;
-
- END_ELEM_HEAD (Blend, *bufDest, elemDest);
-}
-
-
-void
-_XieElemCompare (bufDest, elemSrc)
-
-char **bufDest;
-XiePhotoElement *elemSrc;
-
-{
- xieFloCompare *elemDest;
-
- BEGIN_ELEM_HEAD (Compare, elemSrc,
- LENOF (xieFloCompare), *bufDest, elemDest);
-
- elemDest->src1 = elemSrc->data.Compare.src1;
- elemDest->src2 = elemSrc->data.Compare.src2;
- elemDest->domainOffsetX = elemSrc->data.Compare.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Compare.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Compare.domain.phototag;
- elemDest->operator = elemSrc->data.Compare.operator;
- elemDest->combine = elemSrc->data.Compare.combine;
- elemDest->constant0 =
- _XieConvertToIEEE (elemSrc->data.Compare.constant[0]);
- elemDest->constant1 =
- _XieConvertToIEEE (elemSrc->data.Compare.constant[1]);
- elemDest->constant2 =
- _XieConvertToIEEE (elemSrc->data.Compare.constant[2]);
- elemDest->bandMask = elemSrc->data.Compare.band_mask;
-
- END_ELEM_HEAD (Compare, *bufDest, elemDest);
-}
-
-
-void
-_XieElemConstrain (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloConstrain *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValConstrain,
- elemSrc->data.Constrain.constrain_tech,
- elemSrc->data.Constrain.constrain_param);
-
- BEGIN_ELEM_HEAD (Constrain, elemSrc,
- LENOF (xieFloConstrain) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Constrain.src;
- elemDest->levels0 = elemSrc->data.Constrain.levels[0];
- elemDest->levels1 = elemSrc->data.Constrain.levels[1];
- elemDest->levels2 = elemSrc->data.Constrain.levels[2];
- elemDest->constrain = elemSrc->data.Constrain.constrain_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (Constrain, *bufDest, elemDest);
-
- /* Technique dependent constrain params */
-
- _XieEncodeTechnique (bufDest, xieValConstrain,
- elemSrc->data.Constrain.constrain_tech,
- elemSrc->data.Constrain.constrain_param);
-}
-
-
-void
-_XieElemConvertFromIndex (bufDest, elemSrc)
-
-char **bufDest;
-XiePhotoElement *elemSrc;
-
-{
- xieFloConvertFromIndex *elemDest;
-
- BEGIN_ELEM_HEAD (ConvertFromIndex, elemSrc,
- LENOF (xieFloConvertFromIndex), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ConvertFromIndex.src;
- elemDest->class = elemSrc->data.ConvertFromIndex.data_class;
- elemDest->precision = elemSrc->data.ConvertFromIndex.precision;
- elemDest->colormap = elemSrc->data.ConvertFromIndex.colormap;
-
- END_ELEM_HEAD (ConvertFromIndex, *bufDest, elemDest);
-}
-
-
-void
-_XieElemConvertFromRGB (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloConvertFromRGB *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValConvertFromRGB,
- elemSrc->data.ConvertFromRGB.color_space,
- elemSrc->data.ConvertFromRGB.color_param);
-
- BEGIN_ELEM_HEAD (ConvertFromRGB, elemSrc,
- LENOF (xieFloConvertFromRGB) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ConvertFromRGB.src;
- elemDest->convert = elemSrc->data.ConvertFromRGB.color_space;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (ConvertFromRGB, *bufDest, elemDest);
-
- /* Technique dependent color params */
-
- _XieEncodeTechnique (bufDest, xieValConvertFromRGB,
- elemSrc->data.ConvertFromRGB.color_space,
- elemSrc->data.ConvertFromRGB.color_param);
-}
-
-
-void
-_XieElemConvertToIndex (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloConvertToIndex *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValColorAlloc,
- elemSrc->data.ConvertToIndex.color_alloc_tech,
- elemSrc->data.ConvertToIndex.color_alloc_param);
-
- BEGIN_ELEM_HEAD (ConvertToIndex, elemSrc,
- LENOF (xieFloConvertToIndex) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ConvertToIndex.src;
- elemDest->notify = elemSrc->data.ConvertToIndex.notify;
- elemDest->colormap = elemSrc->data.ConvertToIndex.colormap;
- elemDest->colorList = elemSrc->data.ConvertToIndex.color_list;
- elemDest->colorAlloc = elemSrc->data.ConvertToIndex.color_alloc_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (ConvertToIndex, *bufDest, elemDest);
-
- /* Technique dependent color alloc params */
-
- _XieEncodeTechnique (bufDest, xieValColorAlloc,
- elemSrc->data.ConvertToIndex.color_alloc_tech,
- elemSrc->data.ConvertToIndex.color_alloc_param);
-}
-
-
-void
-_XieElemConvertToRGB (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloConvertToRGB *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValConvertToRGB,
- elemSrc->data.ConvertToRGB.color_space,
- elemSrc->data.ConvertToRGB.color_param);
-
- BEGIN_ELEM_HEAD (ConvertToRGB, elemSrc,
- LENOF (xieFloConvertToRGB) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ConvertToRGB.src;
- elemDest->convert = elemSrc->data.ConvertToRGB.color_space;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (ConvertToRGB, *bufDest, elemDest);
-
- /* Technique dependent color params */
-
- _XieEncodeTechnique (bufDest, xieValConvertToRGB,
- elemSrc->data.ConvertToRGB.color_space,
- elemSrc->data.ConvertToRGB.color_param);
-}
-
-
-void
-_XieElemConvolve (bufDest, elemSrc)
-
-char **bufDest;
-XiePhotoElement *elemSrc;
-
-{
- int ksize = elemSrc->data.Convolve.kernel_size;
- int i, j;
- xieTypFloat *fptr;
- xieFloConvolve *elemDest;
- unsigned techLen, kernelLen;
-
- techLen = _XieTechniqueLength (xieValConvolve,
- elemSrc->data.Convolve.convolve_tech,
- elemSrc->data.Convolve.convolve_param);
-
- kernelLen = elemSrc->data.Convolve.kernel_size *
- elemSrc->data.Convolve.kernel_size;
-
- BEGIN_ELEM_HEAD (Convolve, elemSrc,
- LENOF (xieFloConvolve) + kernelLen + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Convolve.src;
- elemDest->domainOffsetX = elemSrc->data.Convolve.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Convolve.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Convolve.domain.phototag;
- elemDest->bandMask = elemSrc->data.Convolve.band_mask;
- elemDest->kernelSize = elemSrc->data.Convolve.kernel_size;
- elemDest->convolve = elemSrc->data.Convolve.convolve_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (Convolve, *bufDest, elemDest);
-
-
- /* LISTofFloat (kernelSize^2) */
-
- fptr = (xieTypFloat *) *bufDest;
- for (i = 0; i < ksize; i++)
- for (j = 0; j < ksize; j++)
- *fptr++ = _XieConvertToIEEE (
- elemSrc->data.Convolve.kernel[i * ksize + j]);
-
- *bufDest += NUMBYTES (kernelLen);
-
-
- /* Technique dependent convolve params */
-
- _XieEncodeTechnique (bufDest, xieValConvolve,
- elemSrc->data.Convolve.convolve_tech,
- elemSrc->data.Convolve.convolve_param);
-
-}
-
-
-void
-_XieElemDither (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloDither *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValDither,
- elemSrc->data.Dither.dither_tech,
- elemSrc->data.Dither.dither_param);
-
- BEGIN_ELEM_HEAD (Dither, elemSrc,
- LENOF (xieFloDither) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Dither.src;
- elemDest->bandMask = elemSrc->data.Dither.band_mask;
- elemDest->levels0 = elemSrc->data.Dither.levels[0];
- elemDest->levels1 = elemSrc->data.Dither.levels[1];
- elemDest->levels2 = elemSrc->data.Dither.levels[2];
- elemDest->dither = elemSrc->data.Dither.dither_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (Dither, *bufDest, elemDest);
-
- /* Technique dependent dither params */
-
- _XieEncodeTechnique (bufDest, xieValDither,
- elemSrc->data.Dither.dither_tech,
- elemSrc->data.Dither.dither_param);
-}
-
-
-void
-_XieElemGeometry (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloGeometry *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValGeometry,
- elemSrc->data.Geometry.sample_tech,
- elemSrc->data.Geometry.sample_param);
-
- BEGIN_ELEM_HEAD (Geometry, elemSrc,
- LENOF (xieFloGeometry) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Geometry.src;
- elemDest->bandMask = elemSrc->data.Geometry.band_mask;
- elemDest->width = elemSrc->data.Geometry.width;
- elemDest->height = elemSrc->data.Geometry.height;
- elemDest->a = _XieConvertToIEEE (
- elemSrc->data.Geometry.coefficients[0]);
- elemDest->b = _XieConvertToIEEE (
- elemSrc->data.Geometry.coefficients[1]);
- elemDest->c = _XieConvertToIEEE (
- elemSrc->data.Geometry.coefficients[2]);
- elemDest->d = _XieConvertToIEEE (
- elemSrc->data.Geometry.coefficients[3]);
- elemDest->tx = _XieConvertToIEEE (
- elemSrc->data.Geometry.coefficients[4]);
- elemDest->ty = _XieConvertToIEEE (
- elemSrc->data.Geometry.coefficients[5]);
- elemDest->constant0 = _XieConvertToIEEE (
- elemSrc->data.Geometry.constant[0] );
- elemDest->constant1 = _XieConvertToIEEE (
- elemSrc->data.Geometry.constant[1] );
- elemDest->constant2 = _XieConvertToIEEE (
- elemSrc->data.Geometry.constant[2] );
- elemDest->sample = elemSrc->data.Geometry.sample_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (Geometry, *bufDest, elemDest);
-
- /* Technique dependent sample params */
-
- _XieEncodeTechnique (bufDest, xieValGeometry,
- elemSrc->data.Geometry.sample_tech,
- elemSrc->data.Geometry.sample_param);
-}
-
-
-void
-_XieElemLogical (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloLogical *elemDest;
-
- BEGIN_ELEM_HEAD (Logical, elemSrc,
- LENOF (xieFloLogical), *bufDest, elemDest);
-
- elemDest->src1 = elemSrc->data.Logical.src1;
- elemDest->src2 = elemSrc->data.Logical.src2;
- elemDest->domainOffsetX = elemSrc->data.Logical.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Logical.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Logical.domain.phototag;
- elemDest->operator = elemSrc->data.Logical.operator;
- elemDest->bandMask = elemSrc->data.Logical.band_mask;
- elemDest->constant0 =
- _XieConvertToIEEE (elemSrc->data.Logical.constant[0]);
- elemDest->constant1 =
- _XieConvertToIEEE (elemSrc->data.Logical.constant[1]);
- elemDest->constant2 =
- _XieConvertToIEEE (elemSrc->data.Logical.constant[2]);
-
- END_ELEM_HEAD (Logical, *bufDest, elemDest);
-}
-
-
-void
-_XieElemMatchHistogram (bufDest, elemSrc)
-
-char **bufDest;
-XiePhotoElement *elemSrc;
-
-{
- xieFloMatchHistogram *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValHistogram,
- elemSrc->data.MatchHistogram.shape,
- elemSrc->data.MatchHistogram.shape_param);
-
- BEGIN_ELEM_HEAD (MatchHistogram, elemSrc,
- LENOF (xieFloMatchHistogram) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.MatchHistogram.src;
- elemDest->domainOffsetX = elemSrc->data.MatchHistogram.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.MatchHistogram.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.MatchHistogram.domain.phototag;
- elemDest->shape = elemSrc->data.MatchHistogram.shape;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (MatchHistogram, *bufDest, elemDest);
-
- /* Technique dependent shape params */
-
- _XieEncodeTechnique (bufDest, xieValHistogram,
- elemSrc->data.MatchHistogram.shape,
- elemSrc->data.MatchHistogram.shape_param);
-}
-
-
-void
-_XieElemMath (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloMath *elemDest;
-
- BEGIN_ELEM_HEAD (Math, elemSrc,
- LENOF (xieFloMath), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Math.src;
- elemDest->domainOffsetX = elemSrc->data.Math.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Math.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Math.domain.phototag;
- elemDest->operator = elemSrc->data.Math.operator;
- elemDest->bandMask = elemSrc->data.Math.band_mask;
-
- END_ELEM_HEAD (Math, *bufDest, elemDest);
-}
-
-
-void
-_XieElemPasteUp (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloPasteUp *elemDest;
-
- BEGIN_ELEM_HEAD (PasteUp, elemSrc,
- LENOF (xieFloPasteUp) +
- elemSrc->data.PasteUp.tile_count * LENOF (xieTypTile),
- *bufDest, elemDest);
-
- elemDest->numTiles = elemSrc->data.PasteUp.tile_count;
- elemDest->width = elemSrc->data.PasteUp.width;
- elemDest->height = elemSrc->data.PasteUp.height;
- elemDest->constant0 =
- _XieConvertToIEEE (elemSrc->data.PasteUp.constant[0]);
- elemDest->constant1 =
- _XieConvertToIEEE (elemSrc->data.PasteUp.constant[1]);
- elemDest->constant2 =
- _XieConvertToIEEE (elemSrc->data.PasteUp.constant[2]);
-
- END_ELEM_HEAD (PasteUp, *bufDest, elemDest);
-
- /* LISTofTile (numTiles) */
-
- STORE_LISTOF_TILES (elemSrc->data.PasteUp.tiles,
- elemSrc->data.PasteUp.tile_count, *bufDest);
-}
-
-
-void
-_XieElemPoint (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloPoint *elemDest;
-
- BEGIN_ELEM_HEAD (Point, elemSrc,
- LENOF (xieFloPoint), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Point.src;
- elemDest->lut = elemSrc->data.Point.lut;
- elemDest->domainOffsetX = elemSrc->data.Point.domain.offset_x;
- elemDest->domainOffsetY = elemSrc->data.Point.domain.offset_y;
- elemDest->domainPhototag = elemSrc->data.Point.domain.phototag;
- elemDest->bandMask = elemSrc->data.Point.band_mask;
-
- END_ELEM_HEAD (Point, *bufDest, elemDest);
-}
-
-void
-_XieElemUnconstrain (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloUnconstrain *elemDest;
-
- BEGIN_ELEM_HEAD (Unconstrain, elemSrc,
- LENOF (xieFloUnconstrain), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.Unconstrain.src;
-
- END_ELEM_HEAD (Unconstrain, *bufDest, elemDest);
-}
-
-void
-_XieElemExportClientHistogram (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportClientHistogram *elemDest;
-
- BEGIN_ELEM_HEAD (ExportClientHistogram, elemSrc,
- LENOF (xieFloExportClientHistogram), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportClientHistogram.src;
- elemDest->notify = elemSrc->data.ExportClientHistogram.notify;
- elemDest->domainOffsetX =
- elemSrc->data.ExportClientHistogram.domain.offset_x;
- elemDest->domainOffsetY =
- elemSrc->data.ExportClientHistogram.domain.offset_y;
- elemDest->domainPhototag =
- elemSrc->data.ExportClientHistogram.domain.phototag;
-
- END_ELEM_HEAD (ExportClientHistogram, *bufDest, elemDest);
-}
-
-
-void
-_XieElemExportClientLUT (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportClientLUT *elemDest;
-
- BEGIN_ELEM_HEAD (ExportClientLUT, elemSrc,
- LENOF (xieFloExportClientLUT), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportClientLUT.src;
- elemDest->notify = elemSrc->data.ExportClientLUT.notify;
- elemDest->bandOrder = elemSrc->data.ExportClientLUT.band_order;
- elemDest->start0 = elemSrc->data.ExportClientLUT.start[0];
- elemDest->start1 = elemSrc->data.ExportClientLUT.start[1];
- elemDest->start2 = elemSrc->data.ExportClientLUT.start[2];
- elemDest->length0 = elemSrc->data.ExportClientLUT.length[0];
- elemDest->length1 = elemSrc->data.ExportClientLUT.length[1];
- elemDest->length2 = elemSrc->data.ExportClientLUT.length[2];
-
- END_ELEM_HEAD (ExportClientLUT, *bufDest, elemDest);
-}
-
-
-void
-_XieElemExportClientPhoto (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportClientPhoto *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValEncode,
- elemSrc->data.ExportClientPhoto.encode_tech,
- elemSrc->data.ExportClientPhoto.encode_param);
-
- BEGIN_ELEM_HEAD (ExportClientPhoto, elemSrc,
- LENOF (xieFloExportClientPhoto) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportClientPhoto.src;
- elemDest->notify = elemSrc->data.ExportClientPhoto.notify;
- elemDest->encodeTechnique = elemSrc->data.ExportClientPhoto.encode_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (ExportClientPhoto, *bufDest, elemDest);
-
- /* Technique dependent encode params */
-
- _XieEncodeTechnique (bufDest, xieValEncode,
- elemSrc->data.ExportClientPhoto.encode_tech,
- elemSrc->data.ExportClientPhoto.encode_param);
-}
-
-
-void
-_XieElemExportClientROI (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportClientROI *elemDest;
-
- BEGIN_ELEM_HEAD (ExportClientROI, elemSrc,
- LENOF (xieFloExportClientROI), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportClientROI.src;
- elemDest->notify = elemSrc->data.ExportClientROI.notify;
-
- END_ELEM_HEAD (ExportClientROI, *bufDest, elemDest);
-}
-
-
-void
-_XieElemExportDrawable (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportDrawable *elemDest;
-
- BEGIN_ELEM_HEAD (ExportDrawable, elemSrc,
- LENOF (xieFloExportDrawable), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportDrawable.src;
- elemDest->dstX = elemSrc->data.ExportDrawable.dst_x;
- elemDest->dstY = elemSrc->data.ExportDrawable.dst_y;
- elemDest->drawable = elemSrc->data.ExportDrawable.drawable;
- elemDest->gc = (elemSrc->data.ExportDrawable.gc)->gid;
-
- END_ELEM_HEAD (ExportDrawable, *bufDest, elemDest);
-}
-
-
-void
-_XieElemExportDrawablePlane (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportDrawablePlane *elemDest;
-
- BEGIN_ELEM_HEAD (ExportDrawablePlane, elemSrc,
- LENOF (xieFloExportDrawablePlane), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportDrawablePlane.src;
- elemDest->dstX = elemSrc->data.ExportDrawablePlane.dst_x;
- elemDest->dstY = elemSrc->data.ExportDrawablePlane.dst_y;
- elemDest->drawable = elemSrc->data.ExportDrawablePlane.drawable;
- elemDest->gc = (elemSrc->data.ExportDrawablePlane.gc)->gid;
-
- END_ELEM_HEAD (ExportDrawablePlane, *bufDest, elemDest);
-}
-
-
-void
-_XieElemExportLUT (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportLUT *elemDest;
-
- BEGIN_ELEM_HEAD (ExportLUT, elemSrc,
- LENOF (xieFloExportLUT), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportLUT.src;
- elemDest->lut = elemSrc->data.ExportLUT.lut;
- elemDest->merge = elemSrc->data.ExportLUT.merge;
- elemDest->start0 = elemSrc->data.ExportLUT.start[0];
- elemDest->start1 = elemSrc->data.ExportLUT.start[1];
- elemDest->start2 = elemSrc->data.ExportLUT.start[2];
-
- END_ELEM_HEAD (ExportLUT, *bufDest, elemDest);
-}
-
-
-void
-_XieElemExportPhotomap (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportPhotomap *elemDest;
- unsigned techLen;
-
- techLen = _XieTechniqueLength (xieValEncode,
- elemSrc->data.ExportPhotomap.encode_tech,
- elemSrc->data.ExportPhotomap.encode_param);
-
- BEGIN_ELEM_HEAD (ExportPhotomap, elemSrc,
- LENOF (xieFloExportPhotomap) + techLen, *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportPhotomap.src;
- elemDest->photomap = elemSrc->data.ExportPhotomap.photomap;
- elemDest->encodeTechnique = elemSrc->data.ExportPhotomap.encode_tech;
- elemDest->lenParams = techLen;
-
- END_ELEM_HEAD (ExportPhotomap, *bufDest, elemDest);
-
- /* Technique dependent encode params */
-
- _XieEncodeTechnique (bufDest, xieValEncode,
- elemSrc->data.ExportPhotomap.encode_tech,
- elemSrc->data.ExportPhotomap.encode_param);
-}
-
-
-void
-_XieElemExportROI (
- char **bufDest,
- XiePhotoElement *elemSrc)
-{
- xieFloExportROI *elemDest;
-
- BEGIN_ELEM_HEAD (ExportROI, elemSrc,
- LENOF (xieFloExportROI), *bufDest, elemDest);
-
- elemDest->src = elemSrc->data.ExportROI.src;
- elemDest->roi = elemSrc->data.ExportROI.roi;
-
- END_ELEM_HEAD (ExportROI, *bufDest, elemDest);
-}
diff --git a/xc/lib/XIE/elements.h b/xc/lib/XIE/elements.h
deleted file mode 100644
index 718534525..000000000
--- a/xc/lib/XIE/elements.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* $TOG: elements.h /main/6 1998/02/06 15:11:55 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.
-
-*/
-
-#ifndef _ELEMENTS_H_
-#define _ELEMENTS_H_
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define ELEM_NAME(_name_) xieFlo##_name_
-#define ELEM_SIZE(_name_) sz_xieFlo##_name_
-#else
-#define ELEM_NAME(_name_) xieFlo/**/_name_
-#define ELEM_SIZE(_name_) sz_xieFlo/**/_name_
-#endif
-
-
-#ifndef WORD64
-
-#define BEGIN_ELEM_HEAD(_name, _elemSrc, _elemLength, _bufDest, _elemDest) \
- _elemDest = (ELEM_NAME(_name) *) _bufDest; \
- _elemDest->elemType = elemSrc->elemType; \
- _elemDest->elemLength = _elemLength;
-
-#define END_ELEM_HEAD(_name, _bufDest, _elemDest) \
- _bufDest += ELEM_SIZE(_name);
-
-#else /* WORD64 */
-
-#define BEGIN_ELEM_HEAD(_name, _elemSrc, _elemLength, _bufDest, _elemDest) \
-{ \
- ELEM_NAME(_name) tElem; \
- _elemDest = &tElem; \
- _elemDest->elemType = elemSrc->elemType; \
- _elemDest->elemLength = _elemLength;
-
-#define END_ELEM_HEAD(_name, _bufDest, _elemDest) \
- memcpy (_bufDest, _elemDest, ELEM_SIZE(_name)); \
- _bufDest += ELEM_SIZE(_name); \
-}
-
-#endif /* WORD64 */
-
-
-#ifndef WORD64
-
-#define STORE_LISTOF_TILES(_tiles, _count, _pBuf) \
-{ \
- xieTypTile *tileDest = (xieTypTile *) _pBuf; \
- int i; \
-\
- for (i = 0; i < _count; i++) \
- { \
- tileDest->src = _tiles[i].src; \
- tileDest->dstX = _tiles[i].dst_x; \
- tileDest->dstY = _tiles[i].dst_y; \
- tileDest++; \
- } \
- _pBuf += (SIZEOF (xieTypTile) * _count); \
-}
-
-#else /* WORD64 */
-
-#define STORE_LISTOF_TILES(_tiles, _count, _pBuf) \
-{ \
- xieTypTile temp; \
- int i; \
-\
- for (i = 0; i < _count; i++) \
- { \
- temp.src = _tiles[i].src; \
- temp.dstX = _tiles[i].dst_x; \
- temp.dstY = _tiles[i].dst_y; \
- memcpy (_pBuf, &temp, SIZEOF (xieTypTile)); \
- _pBuf += SIZEOF (xieTypTile); \
- } \
-}
-
-#endif
-
-#endif /* _ELEMENTS_H_ */
diff --git a/xc/lib/XIE/errors.c b/xc/lib/XIE/errors.c
deleted file mode 100644
index fdd92837b..000000000
--- a/xc/lib/XIE/errors.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $TOG: errors.c /main/6 1998/02/06 15:12:00 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/lib/XIE/errors.c,v 3.3 1999/06/13 16:18:09 dawes Exp $ */
-
-#define NEED_EVENTS /* so XErrorEvent will get pulled in */
-
-#include "XIElibint.h"
-
-
-Bool
-_XieFloError (
- Display *display,
- XErrorEvent *host,
- xError *wire)
-{
- XieFloAccessError *flo_host_error = (XieFloAccessError *) host;
- xieFloAccessErr *flo_wire_error = (xieFloAccessErr *) wire;
-
- /*
- * All flo errors have this basic info.
- */
-
-/* these are assigned by Xlib already
- flo_host_error->error_code = flo_wire_error->code;
- flo_host_error->flo_id = flo_wire_error->floID;
- flo_host_error->minor_code = flo_wire_error->minorOpcode;
- flo_host_error->request_code = flo_wire_error->majorOpcode;
-*/
- flo_host_error->flo_error_code = flo_wire_error->floErrorCode;
- flo_host_error->name_space = flo_wire_error->nameSpace;
- flo_host_error->phototag = flo_wire_error->phototag;
- flo_host_error->elem_type = flo_wire_error->type;
-
-
- /*
- * Now handle the particularites of each flo error.
- */
-
- switch (((xieFloAccessErr *) wire)->floErrorCode)
- {
- case xieErrNoFloAccess:
- case xieErrNoFloAlloc:
- case xieErrNoFloElement:
- case xieErrNoFloID:
- case xieErrNoFloMatch:
- case xieErrNoFloSource:
- case xieErrNoFloImplementation:
-
- break;
-
- case xieErrNoFloColormap:
- case xieErrNoFloColorList:
- case xieErrNoFloDrawable:
- case xieErrNoFloGC:
- case xieErrNoFloLUT:
- case xieErrNoFloPhotomap:
- case xieErrNoFloROI:
-
- {
- XieFloResourceError *host_error = (XieFloResourceError *) host;
- xieFloResourceErr *wire_error = (xieFloResourceErr *) wire;
-
- host_error->resource_id = wire_error->resourceID;
- break;
- }
-
- case xieErrNoFloDomain:
- {
- XieFloDomainError *host_error = (XieFloDomainError *) host;
- xieFloDomainErr *wire_error = (xieFloDomainErr *) wire;
-
- host_error->domain_src = wire_error->domainSrc;
- break;
- }
-
- case xieErrNoFloOperator:
- {
- XieFloOperatorError *host_error = (XieFloOperatorError *) host;
- xieFloOperatorErr *wire_error = (xieFloOperatorErr *) wire;
-
- host_error->operator = wire_error->operator;
- break;
- }
-
- case xieErrNoFloTechnique:
- {
- XieFloTechniqueError *host_error = (XieFloTechniqueError *) host;
- xieFloTechniqueErr *wire_error = (xieFloTechniqueErr *) wire;
-
- host_error->technique_number = wire_error->techniqueNumber;
- host_error->num_tech_params = wire_error->lenTechParams;
- host_error->tech_group = wire_error->techniqueGroup;
- break;
- }
-
- case xieErrNoFloValue:
- {
- XieFloValueError *host_error = (XieFloValueError *) host;
- xieFloValueErr *wire_error = (xieFloValueErr *) wire;
-
- host_error->bad_value = wire_error->badValue;
- break;
- }
-
- default:
- return (False);
- }
-
- return (True);
-}
diff --git a/xc/lib/XIE/events.c b/xc/lib/XIE/events.c
deleted file mode 100644
index 0c27b1113..000000000
--- a/xc/lib/XIE/events.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* $TOG: events.c /main/7 1998/02/06 15:12:05 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.
-
-*/
-/* $XFree86: xc/lib/XIE/events.c,v 1.3 1999/06/13 16:18:09 dawes Exp $ */
-
-#define NEED_EVENTS /* so xEvent will get pulled in */
-#include "XIElibint.h"
-
-
-Status
-_XieColorAllocEvent (
- Display *display,
- XEvent *host,
- xEvent *wire)
-{
- XieColorAllocEvent *host_event = (XieColorAllocEvent *) host;
- xieColorAllocEvn *wire_event = (xieColorAllocEvn *) wire;
-
- host_event->type = wire_event->event & 0x7f;
- host_event->serial = wire_event->sequenceNum;
- host_event->send_event = (wire_event->event & 0x80) != 0;
- host_event->display = display;
- host_event->name_space = wire_event->instanceNameSpace;
- host_event->time = wire_event->time;
- host_event->flo_id = wire_event->instanceFloID;
- host_event->src = wire_event->src;
- host_event->elem_type = wire_event->type;
- host_event->color_list = wire_event->colorList;
- host_event->color_alloc_technique = wire_event->colorAllocTechnique;
- host_event->color_alloc_data = wire_event->data;
-
- return (True);
-}
-
-
-Status
-_XieDecodeNotifyEvent (
- Display *display,
- XEvent *host,
- xEvent *wire)
-{
- XieDecodeNotifyEvent *host_event = (XieDecodeNotifyEvent *) host;
- xieDecodeNotifyEvn *wire_event = (xieDecodeNotifyEvn *) wire;
-
- host_event->type = wire_event->event & 0x7f;
- host_event->serial = wire_event->sequenceNum;
- host_event->send_event = (wire_event->event & 0x80) != 0;
- host_event->display = display;
- host_event->name_space = wire_event->instanceNameSpace;
- host_event->time = wire_event->time;
- host_event->flo_id = wire_event->instanceFloID;
- host_event->src = wire_event->src;
- host_event->elem_type = wire_event->type;
- host_event->decode_technique = wire_event->decodeTechnique;
- host_event->aborted = wire_event->aborted;
- host_event->band_number = wire_event->bandNumber;
- host_event->width = wire_event->width;
- host_event->height = wire_event->height;
-
- return (True);
-}
-
-
-Status
-_XieExportAvailableEvent (
- Display *display,
- XEvent *host,
- xEvent *wire)
-{
- XieExportAvailableEvent *host_event = (XieExportAvailableEvent *) host;
- xieExportAvailableEvn *wire_event = (xieExportAvailableEvn *) wire;
-
- host_event->type = wire_event->event & 0x7f;
- host_event->serial = wire_event->sequenceNum;
- host_event->send_event = (wire_event->event & 0x80) != 0;
- host_event->display = display;
- host_event->name_space = wire_event->instanceNameSpace;
- host_event->time = wire_event->time;
- host_event->flo_id = wire_event->instanceFloID;
- host_event->src = wire_event->src;
- host_event->elem_type = wire_event->type;
- host_event->band_number = wire_event->bandNumber;
- host_event->data[0] = wire_event->data0;
- host_event->data[1] = wire_event->data1;
- host_event->data[2] = wire_event->data2;
-
- return (True);
-}
-
-
-Status
-_XieImportObscuredEvent (
- Display *display,
- XEvent *host,
- xEvent *wire)
-{
- XieImportObscuredEvent *host_event = (XieImportObscuredEvent *) host;
- xieImportObscuredEvn *wire_event = (xieImportObscuredEvn *) wire;
-
- host_event->type = wire_event->event & 0x7f;
- host_event->serial = wire_event->sequenceNum;
- host_event->send_event = (wire_event->event & 0x80) != 0;
- host_event->display = display;
- host_event->name_space = wire_event->instanceNameSpace;
- host_event->time = wire_event->time;
- host_event->flo_id = wire_event->instanceFloID;
- host_event->src = wire_event->src;
- host_event->elem_type = wire_event->type;
- host_event->window = wire_event->window;
- host_event->x = wire_event->x;
- host_event->y = wire_event->y;
- host_event->width = wire_event->width;
- host_event->height = wire_event->height;
-
- return (True);
-}
-
-
-Status
-_XiePhotofloDoneEvent (
- Display *display,
- XEvent *host,
- xEvent *wire)
-{
- XiePhotofloDoneEvent *host_event = (XiePhotofloDoneEvent *) host;
- xiePhotofloDoneEvn *wire_event = (xiePhotofloDoneEvn *) wire;
-
- host_event->type = wire_event->event & 0x7f;
- host_event->serial = wire_event->sequenceNum;
- host_event->send_event = (wire_event->event & 0x80) != 0;
- host_event->display = display;
- host_event->name_space = wire_event->instanceNameSpace;
- host_event->time = wire_event->time;
- host_event->flo_id = wire_event->instanceFloID;
- host_event->outcome = wire_event->outcome;
-
- return (True);
-}
diff --git a/xc/lib/XIE/free.c b/xc/lib/XIE/free.c
deleted file mode 100644
index 4734f7d9d..000000000
--- a/xc/lib/XIE/free.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $TOG: free.c /main/4 1998/02/06 15:12: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/lib/XIE/free.c,v 1.3 1999/06/13 16:18:10 dawes Exp $ */
-
-#include "XIElibint.h"
-
-#define CHECK_AND_FREE(_ptr) if (_ptr) Xfree (_ptr)
-
-
-void
-XieFreeTechniques (XieTechnique *techs, unsigned int count)
-{
- unsigned i;
-
- if (techs)
- {
- for (i = 0; i < count; i++)
- CHECK_AND_FREE (techs[i].name);
-
- Xfree ((char *) techs);
- }
-}
-
-
-void
-XieFreePhotofloGraph (XiePhotoElement *elements, unsigned int count)
-{
- /*
- * NOTE: We do not free the technique parameters here.
- * Most of the technique parameters should be freed by the
- * client using Xfree (exception: EncodeJPEGBaseline and
- * EncodeJPEGLossless, see functions below). This is so
- * the client can reuse technique parameters between photoflos.
- */
-
- unsigned i;
-
- if (!elements)
- return;
-
- for (i = 0; i < count; i++)
- {
- switch (elements[i].elemType)
- {
- case xieElemConvolve:
- CHECK_AND_FREE ((char *) elements[i].data.Convolve.kernel);
- break;
- case xieElemPasteUp:
- CHECK_AND_FREE ((char *) elements[i].data.PasteUp.tiles);
- break;
- default:
- break;
- }
- }
-
- Xfree ((char *) elements);
-}
-
-
-void
-XieFreeEncodeJPEGBaseline (XieEncodeJPEGBaselineParam *param)
-{
- if (param)
- {
- CHECK_AND_FREE ((char *) param->q_table);
- CHECK_AND_FREE ((char *) param->ac_table);
- CHECK_AND_FREE ((char *) param->dc_table);
- Xfree ((char *) param);
- }
-}
-
-
-void
-XieFreeEncodeJPEGLossless (XieEncodeJPEGLosslessParam *param)
-{
- if (param)
- {
- CHECK_AND_FREE ((char *) param->table);
- Xfree ((char *) param);
- }
-}
-
-
-void
-XieFreePasteUpTiles (XiePhotoElement *element)
-{
- XieTile *tiles= element->data.PasteUp.tiles;
-
- if (tiles)
- {
- Xfree (tiles);
- element->data.PasteUp.tiles=NULL;
- }
-}
diff --git a/xc/lib/XIE/globals.h b/xc/lib/XIE/globals.h
deleted file mode 100644
index 58c399ad2..000000000
--- a/xc/lib/XIE/globals.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $TOG: globals.h /main/4 1998/02/06 15:12:14 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/lib/XIE/globals.h,v 1.3 1999/06/13 13:47:01 dawes Exp $ */
-
-extern void _XieElemImportClientLUT (char **, XiePhotoElement *);
-extern void _XieElemImportClientPhoto (char **, XiePhotoElement *);
-extern void _XieElemImportClientROI (char **, XiePhotoElement *);
-extern void _XieElemImportDrawable (char **, XiePhotoElement *);
-extern void _XieElemImportDrawablePlane (char **, XiePhotoElement *);
-extern void _XieElemImportLUT (char **, XiePhotoElement *);
-extern void _XieElemImportPhotomap (char **, XiePhotoElement *);
-extern void _XieElemImportROI (char **, XiePhotoElement *);
-extern void _XieElemArithmetic (char **, XiePhotoElement *);
-extern void _XieElemBandCombine (char **, XiePhotoElement *);
-extern void _XieElemBandExtract (char **, XiePhotoElement *);
-extern void _XieElemBandSelect (char **, XiePhotoElement *);
-extern void _XieElemBlend (char **, XiePhotoElement *);
-extern void _XieElemCompare (char **, XiePhotoElement *);
-extern void _XieElemConstrain (char **, XiePhotoElement *);
-extern void _XieElemConvertFromIndex (char **, XiePhotoElement *);
-extern void _XieElemConvertFromRGB (char **, XiePhotoElement *);
-extern void _XieElemConvertToIndex (char **, XiePhotoElement *);
-extern void _XieElemConvertToRGB (char **, XiePhotoElement *);
-extern void _XieElemConvolve (char **, XiePhotoElement *);
-extern void _XieElemDither (char **, XiePhotoElement *);
-extern void _XieElemGeometry (char **, XiePhotoElement *);
-extern void _XieElemLogical (char **, XiePhotoElement *);
-extern void _XieElemMatchHistogram (char **, XiePhotoElement *);
-extern void _XieElemMath (char **, XiePhotoElement *);
-extern void _XieElemPasteUp (char **, XiePhotoElement *);
-extern void _XieElemPoint (char **, XiePhotoElement *);
-extern void _XieElemUnconstrain (char **, XiePhotoElement *);
-extern void _XieElemExportClientHistogram (char **, XiePhotoElement *);
-extern void _XieElemExportClientLUT (char **, XiePhotoElement *);
-extern void _XieElemExportClientPhoto (char **, XiePhotoElement *);
-extern void _XieElemExportClientROI (char **, XiePhotoElement *);
-extern void _XieElemExportDrawable (char **, XiePhotoElement *);
-extern void _XieElemExportDrawablePlane (char **, XiePhotoElement *);
-extern void _XieElemExportLUT (char **, XiePhotoElement *);
-extern void _XieElemExportPhotomap (char **, XiePhotoElement *);
-extern void _XieElemExportROI (char **, XiePhotoElement *);
-
-#ifdef NEED_XIE_GLOBALS
-
-XieExtInfo *_XieExtInfoHeader = NULL;
-
-void (*(_XieElemFuncs[]))(char **, XiePhotoElement *) =
-{
- _XieElemImportClientLUT,
- _XieElemImportClientPhoto,
- _XieElemImportClientROI,
- _XieElemImportDrawable,
- _XieElemImportDrawablePlane,
- _XieElemImportLUT,
- _XieElemImportPhotomap,
- _XieElemImportROI,
- _XieElemArithmetic,
- _XieElemBandCombine,
- _XieElemBandExtract,
- _XieElemBandSelect,
- _XieElemBlend,
- _XieElemCompare,
- _XieElemConstrain,
- _XieElemConvertFromIndex,
- _XieElemConvertFromRGB,
- _XieElemConvertToIndex,
- _XieElemConvertToRGB,
- _XieElemConvolve,
- _XieElemDither,
- _XieElemGeometry,
- _XieElemLogical,
- _XieElemMatchHistogram,
- _XieElemMath,
- _XieElemPasteUp,
- _XieElemPoint,
- _XieElemUnconstrain,
- _XieElemExportClientHistogram,
- _XieElemExportClientLUT,
- _XieElemExportClientPhoto,
- _XieElemExportClientROI,
- _XieElemExportDrawable,
- _XieElemExportDrawablePlane,
- _XieElemExportLUT,
- _XieElemExportPhotomap,
- _XieElemExportROI
-};
-
-
-#ifndef __EMX__
-XieTechFuncRec *_XieTechFuncs[xieValMaxTechGroup];
-#else
-XieTechFuncRec *_XieTechFuncs[xieValMaxTechGroup] = {0};
-#endif
-
-Bool _XieTechFuncsInitialized = 0;
-
-#endif /* NEED_XIE_GLOBALS */
diff --git a/xc/lib/XIE/ieee.c b/xc/lib/XIE/ieee.c
deleted file mode 100644
index 1533e9365..000000000
--- a/xc/lib/XIE/ieee.c
+++ /dev/null
@@ -1,192 +0,0 @@
-/* $TOG: ieee.c /main/6 1998/02/06 15:12:20 kaleb $ */
-
-/******************************************************************************
- 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 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 MAKES 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 OR MIT OR LICENSEES
-HEREUNDER HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-The name 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.
-****************************************************************************/
-
-/*
-
-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/lib/XIE/ieee.c,v 1.3 1999/06/13 16:18:10 dawes Exp $ */
-
-#include "XIElibint.h"
-#include <math.h>
-
-#define ieeeFloatSignMask 0x80000000
-#define ieeeFloatExpMask 0x7F800000
-#define ieeeFloatExpShift 23
-#define ieeeFloatMantissaMask 0x007FFFFF
-#define ieeeMantissaSize 23
-
-/*
- From page 2-8 of spec, IEEE format. This is laid out as:
-
- bit 31 = 1 bit for sign (if bit on, negative)
- bits 23-39 = 8 bit "biased" exponent (see below)
- bits 0-22 = 23 bit mantissa
-
- A "normal" number is formed as
-
- (-1)^sign_bit * 2^(exp-127) * (1.0 + .mantissa)
-
- That is, the mantissa is interpreted as a fractional binary
- number between 0 and 2^-1 + 2^-2 + ... + 2^-23.
-
- If the exponent is 255, the value is taken as infinity.
-
- I stole definition out of TMS Family Code tools, pages 5-22, 5-23
-*/
-
-/**********************************************************************/
-xieTypFloat _XieConvertToIEEE(double native)
-{
-#ifndef NATIVE_FP_FORMAT
- XieFloat really_float = native; /* stupid language */
- return *((xieTypFloat *)&really_float);
-#else
-xieTypFloat value;
-int sign;
-int exponent;
-int ieee_exp;
-long ieee_mantissa;
-double frac_part;
-
-
- if (native == 0.0)
- return(0); /* frexp() can't handle 0.0 reliably */
-
-
-/*** frexp() breaks a double into the form
-
- "frac_part * 2^exponent"
-
- where 1/2 <= |frac_part| < 1.
-
-***/
- sign = (native < 0);
- frac_part = frexp(native,&exponent) * (sign? -1: 1);
-
-/***
- In IEEE, a normal number is formed as:
-
- (-1)^sign_bit * 2^(exp-127) * (1.0 + .mantissa)
-
- It is easy for us to figure out the sign bit. To convert to
- IEEE form, we work with the absolute value of the fractional
- part, which is between 1/2 and 1.
-
- To normalize for IEEE format, the mantissa must be converted
- to be between 1 and 2 instead of 1/2 and 1. In other words,
- we re-express
-
- frac_part * 2^exponent
- as
- 2*frac_part * 2^(exponent-1)
-
- Then the IEEE mantissa is 2*frac_part - 1, and the IEEE exponent
- is given by exponent-1 = exp-127, or exp = 126+exponent.
-
- example:
- The number 0.75 is expressed as f * 2^0, f=0.75.
- We convert mantissa to 2*0.75 = 1.5 and subtract
- one to get IEEE mantissa coding of 0.5. The exponent
- is downgraded to -1 so (1 + 0.5) * 2^-1 is 0.75,
- which is coded with IEEE bias as -1 = exp-127,
- yielding exp=126. 0.75 = (1+0.5) * 2^(126-127),
- and we code 0 for sign bit, 0.5 for mantissa, 126
- for the exponent.
-
- note: if the exponent becomes larger than 128, then
- exp+127>255, and we can't code it any more in
- 8 bits. Therefore if the exponent is >= 128,
- we set exp=255, which means infinity.
-***/
- frac_part = 2*frac_part;
- --exponent;
-
- frac_part -= 1;
-
- if (exponent >= 128)
- ieee_exp = 255;
- else
- ieee_exp = 127+exponent;
- /* notice we already decremented exponent by one, above */
-
-
-/*** Now assemble the number ***/
- value = 0;
- if (sign)
- value |= ieeeFloatSignMask;
-
- value |= (ieee_exp << ieeeFloatExpShift);
-
-/*** For the mantissa, we know we have a fractional part between 0 and 1.
- We want the most significant 23 bits. Just shift 23 places to the
- left and truncate.
-***/
- ieee_mantissa = (pow(2.0,23.0) * frac_part);
- value |= ieee_mantissa;
-
- return(value);
-#endif
-}
-/**********************************************************************/
-
-
diff --git a/xc/lib/XIE/init.c b/xc/lib/XIE/init.c
deleted file mode 100644
index 1760e82c2..000000000
--- a/xc/lib/XIE/init.c
+++ /dev/null
@@ -1,452 +0,0 @@
-/* $TOG: init.c /main/12 1998/02/06 15:12:25 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.
-
-*/
-/* $XFree86: xc/lib/XIE/init.c,v 3.3 1999/06/13 16:18:10 dawes Exp $ */
-
-#define NEED_EVENTS /* so XErrorEvent will get pulled in */
-
-#define NEED_XIE_GLOBALS
-#include "XIElibint.h"
-#include "globals.h"
-#include "init.h"
-#include <stdio.h>
-
-
-
-Status
-XieInitialize (display, extinfo_ret)
-
-Display *display;
-XieExtensionInfo **extinfo_ret;
-
-{
- XieExtInfo *xieExtInfo;
- XExtCodes *extCodes;
- xieQueryImageExtensionReq *req;
- xieQueryImageExtensionReply rep;
- char *pBuf;
-
- LockDisplay (display);
- GET_EXTENSION_INFO (display, xieExtInfo);
-
- if (xieExtInfo)
- {
- *extinfo_ret = xieExtInfo->extInfo;
-
- return (1);
- }
-
- *extinfo_ret = NULL;
-
- if ((extCodes = XInitExtension (display, xieExtName)) == NULL)
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (0);
- }
-
- xieExtInfo = (XieExtInfo *) Xmalloc (sizeof (XieExtInfo));
- xieExtInfo->extCodes = extCodes;
- xieExtInfo->extInfo = *extinfo_ret =
- (XieExtensionInfo *) Xmalloc (sizeof (XieExtensionInfo));
-
- ADD_EXTENSION_INFO (display, xieExtInfo);
-
- GET_REQUEST (QueryImageExtension, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryImageExtension, pBuf, req);
-
- STORE_REQUEST_HEADER (QueryImageExtension, req);
- req->majorVersion = xieMajorVersion;
- req->minorVersion = xieMinorVersion;
-
- END_REQUEST_HEADER (QueryImageExtension, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (0);
- }
-
- (*extinfo_ret)->server_major_rev = rep.majorVersion;
- (*extinfo_ret)->server_minor_rev = rep.minorVersion;
- (*extinfo_ret)->service_class = rep.serviceClass;
- (*extinfo_ret)->alignment = rep.alignment;
- (*extinfo_ret)->uncnst_mantissa = rep.unconstrainedMantissa;
- (*extinfo_ret)->uncnst_min_exp = rep.unconstrainedMinExp;
- (*extinfo_ret)->uncnst_max_exp = rep.unconstrainedMaxExp;
- (*extinfo_ret)->n_cnst_levels = rep.length;
- (*extinfo_ret)->major_opcode = extCodes->major_opcode;
- (*extinfo_ret)->first_event = extCodes->first_event;
- (*extinfo_ret)->first_error = extCodes->first_error;
-
-
- (*extinfo_ret)->cnst_levels = (unsigned long *)
- Xmalloc (rep.length * sizeof (unsigned long));
-
- _XRead32 (display, (*extinfo_ret)->cnst_levels, rep.length << 2);
-
-
- /*
- * Tell Xlib which function to call when the display is closed.
- */
-
- XESetCloseDisplay (display, extCodes->extension, _XieCloseDisplay);
-
-
- /*
- * Tell Xlib how to convert wire events to host format.
- */
-
- XESetWireToEvent (display, extCodes->first_event + xieEvnNoColorAlloc,
- _XieColorAllocEvent);
-
- XESetWireToEvent (display, extCodes->first_event + xieEvnNoDecodeNotify,
- _XieDecodeNotifyEvent);
-
- XESetWireToEvent (display, extCodes->first_event + xieEvnNoExportAvailable,
- _XieExportAvailableEvent);
-
- XESetWireToEvent (display, extCodes->first_event + xieEvnNoImportObscured,
- _XieImportObscuredEvent);
-
- XESetWireToEvent (display, extCodes->first_event + xieEvnNoPhotofloDone,
- _XiePhotofloDoneEvent);
-
-
- /*
- * Tell Xlib how to convert Flo errors from wire to host format.
- * Xlib can convert the other errors for us.
- */
-
- XESetWireToError (display, extCodes->first_error + xieErrNoFlo,
- _XieFloError);
-
-
- /*
- * Tell Xlib how to print XIE errors.
- */
-
- XESetPrintErrorValues (display, extCodes->extension, _XiePrintError);
-
-
- /*
- * If this is the first time XieInitialize has been called,
- * we must register the standard technique functions.
- */
-
- if (!_XieTechFuncsInitialized)
- {
- _XieInitTechFuncTable ();
- _XieTechFuncsInitialized = 1;
- }
-
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (1);
-}
-
-
-
-Status
-XieQueryTechniques (display, technique_group, ntechniques_ret, techniques_ret)
-
-Display *display;
-XieTechniqueGroup technique_group;
-int *ntechniques_ret;
-XieTechnique **techniques_ret;
-
-{
- xieQueryTechniquesReq *req;
- xieQueryTechniquesReply rep;
- char *pBuf, *pBufStart;
- XieTechnique *techRet;
- xieTypTechniqueRec *techRec;
- int i;
-
- LockDisplay (display);
-
- GET_REQUEST (QueryTechniques, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryTechniques, pBuf, req);
-
- STORE_REQUEST_HEADER (QueryTechniques, req);
- req->techniqueGroup = technique_group;
-
- END_REQUEST_HEADER (QueryTechniques, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- *ntechniques_ret = 0;
- *techniques_ret = NULL;
-
- return (0);
- }
-
- XREAD_INTO_SCRATCH (display, pBuf, rep.length << 2);
- pBufStart = pBuf;
-
- *ntechniques_ret = rep.numTechniques;
-
- *techniques_ret = techRet = (XieTechnique *) Xmalloc (
- sizeof (XieTechnique) * rep.numTechniques);
-
- for (i = 0; i < (int) rep.numTechniques; i++)
- {
- GET_TECHNIQUE_REC (pBuf, techRec);
- pBuf += SIZEOF (xieTypTechniqueRec);
-
- techRet[i].needs_param = techRec->needsParam;
- techRet[i].group = techRec->group;
- techRet[i].number = techRec->number;
- techRet[i].speed = techRec->speed;
-
- techRet[i].name = (char *) Xmalloc (
- (unsigned) techRec->nameLength + 1);
- memcpy (techRet[i].name, pBuf, (unsigned) techRec->nameLength);
- techRet[i].name[techRec->nameLength] = '\0';
- pBuf += PADDED_BYTES (techRec->nameLength);
- }
-
- FINISH_WITH_SCRATCH (display, pBufStart, rep.length << 2);
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (1);
-}
-
-
-
-/*
- * Routine called when a display is closed via XCloseDisplay.
- * The extension information attached to this display is freed.
- * The callback is set up in XieInitialize.
- */
-
-int
-_XieCloseDisplay (
- Display *display,
- XExtCodes *codes)
-{
- XieExtInfo *xieExtInfo;
-
- REMOVE_EXTENSION_INFO (display, xieExtInfo);
-
- if (xieExtInfo == NULL)
- return (0);
- else
- {
- Xfree ((char *) xieExtInfo->extInfo->cnst_levels);
- Xfree ((char *) xieExtInfo->extInfo);
- Xfree ((char *) xieExtInfo);
- return (1);
- }
-}
-
-
-
-/*
- * Routine called when Xlib wants to print an error. This callback
- * is setup in XieInitialize.
- */
-
-void
-_XiePrintError (
- Display *display,
- XErrorEvent *error,
- void *fp)
-{
- XieExtInfo *xieExtInfo;
- XieFloAccessError *flo_error = (XieFloAccessError *) error;
- XieFloResourceError *res_error = (XieFloResourceError *) error;
- XieFloDomainError *domain_error = (XieFloDomainError *) error;
- XieFloOperatorError *operator_error = (XieFloOperatorError *) error;
- XieFloTechniqueError *tech_error = (XieFloTechniqueError *) error;
- XieFloValueError *value_error = (XieFloValueError *) error;
-
- /*
- * Xlib bug - extension codes should be passed to this function,
- * but they're not. We must get them ourselves.
- */
-
- GET_EXTENSION_INFO (display, xieExtInfo);
-
- if (error->error_code ==
- xieExtInfo->extCodes->first_error + xieErrNoFlo)
- {
- /*
- * Print the flo error type.
- */
-
- fprintf (fp, " Flo error: ");
-
- switch (flo_error->flo_error_code)
- {
- case xieErrNoFloAccess:
- fprintf (fp, "FloAccess\n");
- break;
- case xieErrNoFloAlloc:
- fprintf (fp, "FloAlloc\n");
- break;
- case xieErrNoFloElement:
- fprintf (fp, "FloElement\n");
- break;
- case xieErrNoFloID:
- fprintf (fp, "FloID\n");
- break;
- case xieErrNoFloMatch:
- fprintf (fp, "FloMatch\n");
- break;
- case xieErrNoFloSource:
- fprintf (fp, "FloSource\n");
- break;
- case xieErrNoFloColormap:
- fprintf (fp, "FloColormap\n");
- break;
- case xieErrNoFloColorList:
- fprintf (fp, "FloColorList\n");
- break;
- case xieErrNoFloDrawable:
- fprintf (fp, "FloDrawable\n");
- break;
- case xieErrNoFloGC:
- fprintf (fp, "FloGC\n");
- break;
- case xieErrNoFloLUT:
- fprintf (fp, "FloLUT\n");
- break;
- case xieErrNoFloPhotomap:
- fprintf (fp, "FloPhotomap\n");
- break;
- case xieErrNoFloROI:
- fprintf (fp, "FloROI\n");
- break;
- case xieErrNoFloDomain:
- fprintf (fp, "FloDomain\n");
- break;
- case xieErrNoFloOperator:
- fprintf (fp, "FloOperator\n");
- break;
- case xieErrNoFloTechnique:
- fprintf (fp, "FloTechnique\n");
- break;
- case xieErrNoFloValue:
- fprintf (fp, "FloValue\n");
- break;
- case xieErrNoFloImplementation:
- fprintf (fp, "FloImplementation\n");
- break;
- default:
- break;
- }
-
-
- /*
- * All flo errors have this basic info to print.
- */
-
- fprintf (fp, " Name-space: 0x%lx\n", flo_error->name_space);
- fprintf (fp, " Phototag: %d\n", flo_error->phototag);
- fprintf (fp, " Element type: %d\n", flo_error->elem_type);
-
-
- /*
- * Now handle the particularites of each flo error.
- */
-
- switch (flo_error->flo_error_code)
- {
- case xieErrNoFloAccess:
- case xieErrNoFloAlloc:
- case xieErrNoFloElement:
- case xieErrNoFloID:
- case xieErrNoFloMatch:
- case xieErrNoFloSource:
- case xieErrNoFloImplementation:
- break;
-
- case xieErrNoFloColormap:
- fprintf (fp, " Colormap: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloColorList:
- fprintf (fp, " ColorList: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloDrawable:
- fprintf (fp, " Drawable: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloGC:
- fprintf (fp, " GC: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloLUT:
- fprintf (fp, " LUT: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloPhotomap:
- fprintf (fp, " Photomap: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloROI:
- fprintf (fp, " ROI: 0x%lx\n", res_error->resource_id);
- break;
-
- case xieErrNoFloDomain:
- fprintf (fp, " Phototag of domain src: %d\n",
- domain_error->domain_src);
- break;
-
- case xieErrNoFloOperator:
- fprintf (fp, " Operator: 0x%lx\n", (long) operator_error->operator);
- break;
-
- case xieErrNoFloTechnique:
- fprintf (fp, " Technique number: 0x%lx\n",
- (long) tech_error->technique_number);
- fprintf (fp, " Number of technique params: %d\n",
- tech_error->num_tech_params);
- fprintf (fp, " Technique group: %d\n",
- tech_error->tech_group);
- break;
-
- case xieErrNoFloValue:
- fprintf (fp, " Bad value: 0x%lx\n", value_error->bad_value);
- break;
-
- default:
- break;
- }
- }
-}
diff --git a/xc/lib/XIE/init.h b/xc/lib/XIE/init.h
deleted file mode 100644
index b2cbfaaf1..000000000
--- a/xc/lib/XIE/init.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $TOG: init.h /main/4 1998/02/06 15:12:30 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.
-
-*/
-
-#ifndef WORD64
-
-#define GET_TECHNIQUE_REC(_pBuf, _techRec) \
- _techRec = (xieTypTechniqueRec *) _pBuf;
-
-#else /* WORD64 */
-
-#define GET_TECHNIQUE_REC(_pBuf, _techRec) \
- xieTypTechniqueRec temp; \
- memcpy (&temp, _pBuf, SIZEOF (xieTypTechniqueRec)); \
- _techRec = &temp;
-
-#endif /* WORD64 */
diff --git a/xc/lib/XIE/jump_funcs b/xc/lib/XIE/jump_funcs
deleted file mode 100644
index e590f57c2..000000000
--- a/xc/lib/XIE/jump_funcs
+++ /dev/null
@@ -1,197 +0,0 @@
-# $XConsortium: jump_funcs,v 1.2 94/12/07 10:44:37 kaleb Exp $
-# $XFree86: xc/lib/XIE/jump_funcs,v 3.1 1995/01/28 15:43:09 dawes Exp $
-00000000 T _XieAbort libXIE abort
-00000000 T _XieAwait libXIE await
-00000000 T _XiePutClientData libXIE clientdata
-00000000 T _XieGetClientData libXIE clientdata
-00000000 T _XieCreateColorList libXIE colorlist
-00000000 T _XieDestroyColorList libXIE colorlist
-00000000 T _XiePurgeColorList libXIE colorlist
-00000000 T _XieQueryColorList libXIE colorlist
-00000000 T _XieFloImportClientLUT libXIE conven
-00000000 T _XieFloImportClientPhoto libXIE conven
-00000000 T _XieFloImportClientROI libXIE conven
-00000000 T _XieFloImportDrawable libXIE conven
-00000000 T _XieFloImportDrawablePlane libXIE conven
-00000000 T _XieFloImportLUT libXIE conven
-00000000 T _XieFloImportPhotomap libXIE conven
-00000000 T _XieFloImportROI libXIE conven
-00000000 T _XieFloArithmetic libXIE conven
-00000000 T _XieFloBandCombine libXIE conven
-00000000 T _XieFloBandExtract libXIE conven
-00000000 T _XieFloBandSelect libXIE conven
-00000000 T _XieFloBlend libXIE conven
-00000000 T _XieFloCompare libXIE conven
-00000000 T _XieFloConstrain libXIE conven
-00000000 T _XieFloConvertFromIndex libXIE conven
-00000000 T _XieFloConvertFromRGB libXIE conven
-00000000 T _XieFloConvertToIndex libXIE conven
-00000000 T _XieFloConvertToRGB libXIE conven
-00000000 T _XieFloConvolve libXIE conven
-00000000 T _XieFloDither libXIE conven
-00000000 T _XieFloGeometry libXIE conven
-00000000 T _XieFloLogical libXIE conven
-00000000 T _XieFloMatchHistogram libXIE conven
-00000000 T _XieFloMath libXIE conven
-00000000 T _XieFloPasteUp libXIE conven
-00000000 T _XieFloPoint libXIE conven
-00000000 T _XieFloUnconstrain libXIE conven
-00000000 T _XieFloExportClientHistogram libXIE conven
-00000000 T _XieFloExportClientLUT libXIE conven
-00000000 T _XieFloExportClientPhoto libXIE conven
-00000000 T _XieFloExportClientROI libXIE conven
-00000000 T _XieFloExportDrawable libXIE conven
-00000000 T _XieFloExportDrawablePlane libXIE conven
-00000000 T _XieFloExportLUT libXIE conven
-00000000 T _XieFloExportPhotomap libXIE conven
-00000000 T _XieFloExportROI libXIE conven
-00000000 T _XieTecColorAllocAll libXIE conven
-00000000 T _XieTecColorAllocMatch libXIE conven
-00000000 T _XieTecColorAllocRequantize libXIE conven
-00000000 T _XieTecRGBToCIELab libXIE conven
-00000000 T _XieTecRGBToCIEXYZ libXIE conven
-00000000 T _XieTecRGBToYCbCr libXIE conven
-00000000 T _XieTecRGBToYCC libXIE conven
-00000000 T _XieTecCIELabToRGB libXIE conven
-00000000 T _XieTecCIEXYZToRGB libXIE conven
-00000000 T _XieTecYCbCrToRGB libXIE conven
-00000000 T _XieTecYCCToRGB libXIE conven
-00000000 T _XieTecClipScale libXIE conven
-00000000 T _XieTecConvolveConstant libXIE conven
-00000000 T _XieTecDecodeUncompressedSingle libXIE conven
-00000000 T _XieTecDecodeUncompressedTriple libXIE conven
-00000000 T _XieTecDecodeG31D libXIE conven
-00000000 T _XieTecDecodeG32D libXIE conven
-00000000 T _XieTecDecodeG42D libXIE conven
-00000000 T _XieTecDecodeTIFF2 libXIE conven
-00000000 T _XieTecDecodeTIFFPackBits libXIE conven
-00000000 T _XieTecDecodeJPEGBaseline libXIE conven
-00000000 T _XieTecDecodeJPEGLossless libXIE conven
-00000000 T _XieTecDitherOrderedParam libXIE conven
-00000000 T _XieTecEncodeUncompressedSingle libXIE conven
-00000000 T _XieTecEncodeUncompressedTriple libXIE conven
-00000000 T _XieTecEncodeG31D libXIE conven
-00000000 T _XieTecEncodeG32D libXIE conven
-00000000 T _XieTecEncodeG42D libXIE conven
-00000000 T _XieTecEncodeJPEGBaseline libXIE conven
-00000000 T _XieTecEncodeJPEGLossless libXIE conven
-00000000 T _XieTecEncodeTIFF2 libXIE conven
-00000000 T _XieTecEncodeTIFFPackBits libXIE conven
-00000000 T _XieTecEncodeServerChoice libXIE conven
-00000000 T _XieTecGeomAntialiasByArea libXIE conven
-00000000 T _XieTecGeomAntialiasByLowpass libXIE conven
-00000000 T _XieTecGeomGaussian libXIE conven
-00000000 T _XieTecGeomNearestNeighbor libXIE conven
-00000000 T _XieTecHistogramGaussian libXIE conven
-00000000 T _XieTecHistogramHyperbolic libXIE conven
-00000000 T _XieTecWhiteAdjustCIELabShift libXIE conven
-00000000 T __XiePhotofloSize libXIE elements
-00000000 T __XieElemImportClientLUT libXIE elements
-00000000 T __XieElemImportClientPhoto libXIE elements
-00000000 T __XieElemImportClientROI libXIE elements
-00000000 T __XieElemImportDrawable libXIE elements
-00000000 T __XieElemImportDrawablePlane libXIE elements
-00000000 T __XieElemImportLUT libXIE elements
-00000000 T __XieElemImportPhotomap libXIE elements
-00000000 T __XieElemImportROI libXIE elements
-00000000 T __XieElemArithmetic libXIE elements
-00000000 T __XieElemBandCombine libXIE elements
-00000000 T __XieElemBandExtract libXIE elements
-00000000 T __XieElemBandSelect libXIE elements
-00000000 T __XieElemBlend libXIE elements
-00000000 T __XieElemCompare libXIE elements
-00000000 T __XieElemConstrain libXIE elements
-00000000 T __XieElemConvertFromIndex libXIE elements
-00000000 T __XieElemConvertFromRGB libXIE elements
-00000000 T __XieElemConvertToIndex libXIE elements
-00000000 T __XieElemConvertToRGB libXIE elements
-00000000 T __XieElemConvolve libXIE elements
-00000000 T __XieElemDither libXIE elements
-00000000 T __XieElemGeometry libXIE elements
-00000000 T __XieElemLogical libXIE elements
-00000000 T __XieElemMatchHistogram libXIE elements
-00000000 T __XieElemMath libXIE elements
-00000000 T __XieElemPasteUp libXIE elements
-00000000 T __XieElemPoint libXIE elements
-00000000 T __XieElemUnconstrain libXIE elements
-00000000 T __XieElemExportClientHistogram libXIE elements
-00000000 T __XieElemExportClientLUT libXIE elements
-00000000 T __XieElemExportClientPhoto libXIE elements
-00000000 T __XieElemExportClientROI libXIE elements
-00000000 T __XieElemExportDrawable libXIE elements
-00000000 T __XieElemExportDrawablePlane libXIE elements
-00000000 T __XieElemExportLUT libXIE elements
-00000000 T __XieElemExportPhotomap libXIE elements
-00000000 T __XieElemExportROI libXIE elements
-00000000 T __XieFloError libXIE errors
-00000000 T __XieColorAllocEvent libXIE events
-00000000 T __XieDecodeNotifyEvent libXIE events
-00000000 T __XieExportAvailableEvent libXIE events
-00000000 T __XieImportObscuredEvent libXIE events
-00000000 T __XiePhotofloDoneEvent libXIE events
-00000000 T _XieFreeTechniques libXIE free
-00000000 T _XieFreePhotofloGraph libXIE free
-00000000 T _XieFreeEncodeJPEGBaseline libXIE free
-00000000 T _XieFreeEncodeJPEGLossless libXIE free
-00000000 T _XieFreePasteUpTiles libXIE free
-00000000 T __XieConvertToIEEE libXIE ieee
-00000000 T _XieInitialize libXIE init
-00000000 T _XieQueryTechniques libXIE init
-00000000 T __XieCloseDisplay libXIE init
-00000000 T __XiePrintError libXIE init
-00000000 T _XieCreateLUT libXIE lut
-00000000 T _XieDestroyLUT libXIE lut
-00000000 T _XieAllocatePhotofloGraph libXIE photoflo
-00000000 T _XieCreatePhotoflo libXIE photoflo
-00000000 T _XieDestroyPhotoflo libXIE photoflo
-00000000 T _XieExecutePhotoflo libXIE photoflo
-00000000 T _XieModifyPhotoflo libXIE photoflo
-00000000 T _XieRedefinePhotoflo libXIE photoflo
-00000000 T _XieQueryPhotoflo libXIE photoflo
-00000000 T _XieCreatePhotomap libXIE photomap
-00000000 T _XieDestroyPhotomap libXIE photomap
-00000000 T _XieQueryPhotomap libXIE photomap
-00000000 T _XieCreatePhotospace libXIE photospace
-00000000 T _XieDestroyPhotospace libXIE photospace
-00000000 T _XieExecuteImmediate libXIE photospace
-00000000 T _XieCreateROI libXIE roi
-00000000 T _XieDestroyROI libXIE roi
-00000000 T __XieTechniqueLength libXIE technique
-00000000 T __XieEncodeTechnique libXIE technique
-00000000 T __XieColorAllocAllParam libXIE technique
-00000000 T __XieColorAllocMatchParam libXIE technique
-00000000 T __XieColorAllocRequantizeParam libXIE technique
-00000000 T __XieRGBToCIELabParam libXIE technique
-00000000 T __XieRGBToYCbCrParam libXIE technique
-00000000 T __XieRGBToYCCParam libXIE technique
-00000000 T __XieYCbCrToRGBParam libXIE technique
-00000000 T __XieYCCToRGBParam libXIE technique
-00000000 T __XieCIELabToRGBParam libXIE technique
-00000000 T __XieConvolveConstantParam libXIE technique
-00000000 T __XieClipScaleParam libXIE technique
-00000000 T __XieDecodeUncompressedSingleParam libXIE technique
-00000000 T __XieDecodeUncompressedTripleParam libXIE technique
-00000000 T __XieDecodeG31DParam libXIE technique
-00000000 T __XieDecodeTIFFPackBitsParam libXIE technique
-00000000 T __XieDecodeJPEGBaselineParam libXIE technique
-00000000 T __XieDitherOrderedParam libXIE technique
-00000000 T __XieEncodeUncompressedSingleParam libXIE technique
-00000000 T __XieEncodeUncompressedTripleParam libXIE technique
-00000000 T __XieEncodeG31DParam libXIE technique
-00000000 T __XieEncodeTIFFPackBitsParam libXIE technique
-00000000 T __XieEncodeServerChoiceParam libXIE technique
-00000000 T __XieEncodeG32DParam libXIE technique
-00000000 T __XieEncodeG42DParam libXIE technique
-00000000 T __XieEncodeJPEGBaselineParam libXIE technique
-00000000 T __XieEncodeJPEGLosslessParam libXIE technique
-00000000 T __XieEncodeTIFF2Param libXIE technique
-00000000 T __XieGeomAntialiasByAreaParam libXIE technique
-00000000 T __XieGeomAntialiasByLowpassParam libXIE technique
-00000000 T __XieGeomGaussianParam libXIE technique
-00000000 T __XieGeomNearestNeighborParam libXIE technique
-00000000 T __XieHistogramGaussianParam libXIE technique
-00000000 T __XieHistogramHyperbolicParam libXIE technique
-00000000 T __XieWhiteAdjustCIELabShiftParam libXIE technique
-00000000 T __XieInitTechFuncTable libXIE technique
-00000000 T __XieRegisterTechFunc libXIE utils
-00000000 T __XieLookupTechFunc libXIE utils
diff --git a/xc/lib/XIE/jump_ignore b/xc/lib/XIE/jump_ignore
deleted file mode 100644
index 939a888dc..000000000
--- a/xc/lib/XIE/jump_ignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# $XConsortium: jump_ignore,v 1.2 94/12/07 10:44:37 kaleb Exp $
-# $XFree86: xc/lib/XIE/jump_ignore,v 3.1 1995/01/28 15:43:12 dawes Exp $
-# jump_ignore
diff --git a/xc/lib/XIE/jump_vars b/xc/lib/XIE/jump_vars
deleted file mode 100644
index 481d2e3f4..000000000
--- a/xc/lib/XIE/jump_vars
+++ /dev/null
@@ -1,6 +0,0 @@
-# $XConsortium: jump_vars,v 1.2 94/12/07 10:44:37 kaleb Exp $
-# $XFree86: xc/lib/XIE/jump_vars,v 3.1 1995/01/28 15:43:13 dawes Exp $
-00000004 D __XieExtInfoHeader libXIE init
-000000b4 D __XieElemFuncs libXIE init
-00000004 D __XieTechFuncsInitialized libXIE init
-00000080 C __XieTechFuncs libXIE init
diff --git a/xc/lib/XIE/lut.c b/xc/lib/XIE/lut.c
deleted file mode 100644
index bcfa46cb8..000000000
--- a/xc/lib/XIE/lut.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $TOG: lut.c /main/3 1998/02/06 15:12:36 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/lib/XIE/lut.c,v 1.3 1999/06/13 16:18:10 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-XieLut
-XieCreateLUT (Display *display)
-{
- xieCreateLUTReq *req;
- char *pBuf;
- XieLut id;
-
- LockDisplay (display);
-
- id = XAllocID (display);
-
- GET_REQUEST (CreateLUT, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateLUT, pBuf, req);
-
- STORE_REQUEST_HEADER (CreateLUT, req);
- req->lut = id;
-
- END_REQUEST_HEADER (CreateLUT, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (id);
-}
-
-
-void
-XieDestroyLUT (Display *display, XieLut lut)
-{
- xieDestroyLUTReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (DestroyLUT, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyLUT, pBuf, req);
-
- STORE_REQUEST_HEADER (DestroyLUT, req);
- req->lut = lut;
-
- END_REQUEST_HEADER (DestroyLUT, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
diff --git a/xc/lib/XIE/photoflo.c b/xc/lib/XIE/photoflo.c
deleted file mode 100644
index 43ef91681..000000000
--- a/xc/lib/XIE/photoflo.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* $TOG: photoflo.c /main/7 1998/02/06 15:12: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.
-
-*/
-/* $XFree86: xc/lib/XIE/photoflo.c,v 1.3 1999/06/13 16:18:11 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-XiePhotoElement *
-XieAllocatePhotofloGraph (unsigned int count)
-{
- XiePhotoElement *ptr;
- unsigned size;
-
- size = count * sizeof (XiePhotoElement);
- ptr = (XiePhotoElement *) Xmalloc (size);
- bzero ((char *) ptr, size);
-
- return (ptr);
-}
-
-
-XiePhotoflo
-XieCreatePhotoflo (
- Display *display,
- XiePhotoElement *elem_list,
- int elem_count)
-{
- xieCreatePhotofloReq *req;
- char *pBuf, *pStart;
- unsigned size;
- XiePhotoflo id;
- int i;
-
- LockDisplay (display);
-
- id = XAllocID (display);
-
- size = _XiePhotofloSize (elem_list, elem_count);
-
- GET_REQUEST (CreatePhotoflo, pBuf);
-
- BEGIN_REQUEST_HEADER (CreatePhotoflo, pBuf, req);
-
- STORE_REQUEST_EXTRA_HEADER (CreatePhotoflo, size, req);
- req->floID = id;
- req->numElements = elem_count;
-
- END_REQUEST_HEADER (CreatePhotoflo, pBuf, req);
-
- pBuf = pStart = _XAllocScratch (display, size);
-
- for (i = 0; i < elem_count; i++)
- (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]);
-
- Data (display, pStart, size);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (id);
-}
-
-
-void
-XieDestroyPhotoflo (
- Display *display,
- XiePhotoflo photoflo)
-{
- xieDestroyPhotofloReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (DestroyPhotoflo, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyPhotoflo, pBuf, req);
-
- STORE_REQUEST_HEADER (DestroyPhotoflo, req);
- req->floID = photoflo;
-
- END_REQUEST_HEADER (DestroyPhotoflo, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-void
-XieExecutePhotoflo (
- Display *display,
- XiePhotoflo photoflo,
- Bool notify)
-{
- xieExecutePhotofloReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (ExecutePhotoflo, pBuf);
-
- BEGIN_REQUEST_HEADER (ExecutePhotoflo, pBuf, req);
-
- STORE_REQUEST_HEADER (ExecutePhotoflo, req);
- req->floID = photoflo;
- req->notify = notify;
-
- END_REQUEST_HEADER (ExecutePhotoflo, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-void
-XieModifyPhotoflo (
- Display *display,
- XiePhotoflo photoflo,
- int start,
- XiePhotoElement *elem_list,
- int elem_count)
-{
- xieModifyPhotofloReq *req;
- char *pBuf, *pStart;
- unsigned size;
- int i;
-
- LockDisplay (display);
-
- size = _XiePhotofloSize (elem_list, elem_count);
-
- GET_REQUEST (ModifyPhotoflo, pBuf);
-
- BEGIN_REQUEST_HEADER (ModifyPhotoflo, pBuf, req);
-
- STORE_REQUEST_EXTRA_HEADER (ModifyPhotoflo, size, req);
- req->floID = photoflo;
- req->start = start;
- req->numElements = elem_count;
-
- END_REQUEST_HEADER (ModifyPhotoflo, pBuf, req);
-
- pBuf = pStart = _XAllocScratch (display, size);
-
- for (i = 0; i < elem_count; i++)
- (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]);
-
- Data (display, pStart, size);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-void
-XieRedefinePhotoflo (
- Display *display,
- XiePhotoflo photoflo,
- XiePhotoElement *elem_list,
- int elem_count)
-{
- xieRedefinePhotofloReq *req;
- char *pBuf, *pStart;
- unsigned size;
- int i;
-
- LockDisplay (display);
-
- size = _XiePhotofloSize (elem_list, elem_count);
-
- GET_REQUEST (RedefinePhotoflo, pBuf);
-
- BEGIN_REQUEST_HEADER (RedefinePhotoflo, pBuf, req);
-
- STORE_REQUEST_EXTRA_HEADER (RedefinePhotoflo, size, req);
- req->floID = photoflo;
- req->numElements = elem_count;
-
- END_REQUEST_HEADER (RedefinePhotoflo, pBuf, req);
-
- pBuf = pStart = _XAllocScratch (display, size);
-
- for (i = 0; i < elem_count; i++)
- (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]);
-
- Data (display, pStart, size);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-Status
-XieQueryPhotoflo (
- Display *display,
- unsigned long name_space,
- unsigned long flo_id,
- XiePhotofloState *state_ret,
- XiePhototag **data_expected_ret,
- unsigned int *nexpected_ret,
- XiePhototag **data_available_ret,
- unsigned int *navailable_ret)
-{
- xieQueryPhotofloReq *req;
- xieQueryPhotofloReply rep;
- char *pBuf;
- int i;
-
- LockDisplay (display);
-
- GET_REQUEST (QueryPhotoflo, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryPhotoflo, pBuf, req);
-
- STORE_REQUEST_HEADER (QueryPhotoflo, req);
- req->nameSpace = name_space;
- req->floID = flo_id;
-
- END_REQUEST_HEADER (QueryPhotoflo, pBuf, req);
-
- *state_ret = 0;
- *nexpected_ret = 0;
- *data_expected_ret = NULL;
- *navailable_ret = 0;
- *data_available_ret = NULL;
-
- if (_XReply (display, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (0);
- }
-
- *state_ret = rep.state;
-
- if (rep.expectedCount > 0)
- {
- short *temp = (short *) _XAllocTemp (display,
- sizeof (short) * rep.expectedCount);
-
- *nexpected_ret = rep.expectedCount;
- *data_expected_ret = (XiePhototag *) Xmalloc (
- sizeof (XiePhototag) * rep.expectedCount);
-
- _XRead16Pad (display, temp,
- rep.expectedCount * SIZEOF (xieTypPhototag));
-
- for (i = 0; i < rep.expectedCount; i++)
- (*data_expected_ret)[i] = (XiePhototag) temp[i];
-
- _XFreeTemp (display, (char *) temp,
- sizeof (short) * rep.expectedCount);
- }
-
- if (rep.availableCount > 0)
- {
- short *temp = (short *) _XAllocTemp (display,
- sizeof (short) * rep.availableCount);
-
- *navailable_ret = rep.availableCount;
- *data_available_ret = (XiePhototag *) Xmalloc (
- sizeof (XiePhototag) * rep.availableCount);
-
- _XRead16Pad (display, temp,
- rep.availableCount * SIZEOF (xieTypPhototag));
-
- for (i = 0; i < rep.availableCount; i++)
- (*data_available_ret)[i] = (XiePhototag) temp[i];
-
- _XFreeTemp (display, (char *) temp,
- sizeof (short) * rep.availableCount);
- }
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (1);
-}
diff --git a/xc/lib/XIE/photomap.c b/xc/lib/XIE/photomap.c
deleted file mode 100644
index 3ad31dcaa..000000000
--- a/xc/lib/XIE/photomap.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* $TOG: photomap.c /main/7 1998/02/06 15:12: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.
-
-*/
-/* $XFree86: xc/lib/XIE/photomap.c,v 1.3 1999/06/13 16:18:11 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-XiePhotomap
-XieCreatePhotomap (Display *display)
-{
- xieCreatePhotomapReq *req;
- char *pBuf;
- XiePhotomap id;
-
- LockDisplay (display);
-
- id = XAllocID (display);
-
- GET_REQUEST (CreatePhotomap, pBuf);
-
- BEGIN_REQUEST_HEADER (CreatePhotomap, pBuf, req);
-
- STORE_REQUEST_HEADER (CreatePhotomap, req);
- req->photomap = id;
-
- END_REQUEST_HEADER (CreatePhotomap, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (id);
-}
-
-
-void
-XieDestroyPhotomap (Display *display, XiePhotomap photomap)
-{
- xieDestroyPhotomapReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (DestroyPhotomap, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyPhotomap, pBuf, req);
-
- STORE_REQUEST_HEADER (DestroyPhotomap, req);
- req->photomap = photomap;
-
- END_REQUEST_HEADER (DestroyPhotomap, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-Status
-XieQueryPhotomap (
- Display *display,
- XiePhotomap photomap,
- Bool *populated_ret,
- XieDataType *datatype_ret,
- XieDataClass *dataclass_ret,
- XieDecodeTechnique *decode_technique_ret,
- XieLTriplet width_ret,
- XieLTriplet height_ret,
- XieLTriplet levels_ret)
-{
- xieQueryPhotomapReq *req;
- xieQueryPhotomapReply rep;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (QueryPhotomap, pBuf);
-
- BEGIN_REQUEST_HEADER (QueryPhotomap, pBuf, req);
-
- STORE_REQUEST_HEADER (QueryPhotomap, req);
- req->photomap = photomap;
-
- END_REQUEST_HEADER (QueryPhotomap, pBuf, req);
-
- if (_XReply (display, (xReply *)&rep,
- (SIZEOF (xieQueryPhotomapReply) - 32) >> 2, xTrue) == 0)
- {
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (0);
- }
-
- *populated_ret = rep.populated;
- *datatype_ret = rep.dataType;
- *dataclass_ret = rep.dataClass;
- *decode_technique_ret = rep.decodeTechnique;
- width_ret[0] = rep.width0;
- width_ret[1] = rep.width1;
- width_ret[2] = rep.width2;
- height_ret[0] = rep.height0;
- height_ret[1] = rep.height1;
- height_ret[2] = rep.height2;
- levels_ret[0] = rep.levels0;
- levels_ret[1] = rep.levels1;
- levels_ret[2] = rep.levels2;
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (1);
-}
diff --git a/xc/lib/XIE/photospace.c b/xc/lib/XIE/photospace.c
deleted file mode 100644
index ff57e5f9e..000000000
--- a/xc/lib/XIE/photospace.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $TOG: photospace.c /main/3 1998/02/06 15:12:51 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/lib/XIE/photospace.c,v 1.3 1999/06/13 16:18:11 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-
-XiePhotospace
-XieCreatePhotospace (Display *display)
-{
- xieCreatePhotospaceReq *req;
- char *pBuf;
- XiePhotospace id;
-
- LockDisplay (display);
-
- id = XAllocID (display);
-
- GET_REQUEST (CreatePhotospace, pBuf);
-
- BEGIN_REQUEST_HEADER (CreatePhotospace, pBuf, req);
-
- STORE_REQUEST_HEADER (CreatePhotospace, req);
- req->nameSpace = id;
-
- END_REQUEST_HEADER (CreatePhotospace, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (id);
-}
-
-
-void
-XieDestroyPhotospace (Display *display, XiePhotospace photospace)
-{
- xieDestroyPhotospaceReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (DestroyPhotospace, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyPhotospace, pBuf, req);
-
- STORE_REQUEST_HEADER (DestroyPhotospace, req);
- req->nameSpace = photospace;
-
- END_REQUEST_HEADER (DestroyPhotospace, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
-
-
-void
-XieExecuteImmediate (
- Display *display,
- XiePhotospace photospace,
- unsigned long flo_id,
- Bool notify,
- XiePhotoElement *elem_list,
- int elem_count)
-{
- xieExecuteImmediateReq *req;
- char *pBuf, *pStart;
- unsigned size;
- int i;
-
- LockDisplay (display);
-
- size = _XiePhotofloSize (elem_list, elem_count);
-
- GET_REQUEST (ExecuteImmediate, pBuf);
-
- BEGIN_REQUEST_HEADER (ExecuteImmediate, pBuf, req);
-
- STORE_REQUEST_EXTRA_HEADER (ExecuteImmediate, size, req);
- req->nameSpace = photospace;
- req->floID = flo_id;
- req->numElements = elem_count;
- req->notify = notify;
-
- END_REQUEST_HEADER (ExecuteImmediate, pBuf, req);
-
- pBuf = pStart = _XAllocScratch (display, size);
-
- for (i = 0; i < elem_count; i++)
- (*_XieElemFuncs[elem_list[i].elemType - 1]) (&pBuf, &elem_list[i]);
-
- Data (display, pStart, size);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
diff --git a/xc/lib/XIE/roi.c b/xc/lib/XIE/roi.c
deleted file mode 100644
index 82b9869a9..000000000
--- a/xc/lib/XIE/roi.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $TOG: roi.c /main/3 1998/02/06 15:12:57 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/lib/XIE/roi.c,v 1.3 1999/06/13 16:18:12 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-XieRoi
-XieCreateROI (Display *display)
-{
- xieCreateROIReq *req;
- char *pBuf;
- XieRoi id;
-
- LockDisplay (display);
-
- id = XAllocID (display);
-
- GET_REQUEST (CreateROI, pBuf);
-
- BEGIN_REQUEST_HEADER (CreateROI, pBuf, req);
-
- STORE_REQUEST_HEADER (CreateROI, req);
- req->roi = id;
-
- END_REQUEST_HEADER (CreateROI, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-
- return (id);
-}
-
-
-void
-XieDestroyROI (Display *display, XieRoi roi)
-{
- xieDestroyROIReq *req;
- char *pBuf;
-
- LockDisplay (display);
-
- GET_REQUEST (DestroyROI, pBuf);
-
- BEGIN_REQUEST_HEADER (DestroyROI, pBuf, req);
-
- STORE_REQUEST_HEADER (DestroyROI, req);
- req->roi = roi;
-
- END_REQUEST_HEADER (DestroyROI, pBuf, req);
-
- UnlockDisplay (display);
- SYNC_HANDLE (display);
-}
diff --git a/xc/lib/XIE/technique.c b/xc/lib/XIE/technique.c
deleted file mode 100644
index b4c72c7a0..000000000
--- a/xc/lib/XIE/technique.c
+++ /dev/null
@@ -1,1329 +0,0 @@
-/* $TOG: technique.c /main/8 1998/02/06 15:13:02 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.
-
-*/
-/* $XFree86: xc/lib/XIE/technique.c,v 1.3 1999/06/13 16:18:12 dawes Exp $ */
-
-#include "XIElibint.h"
-#include "technique.h"
-
-/* these really should have been static, but they're listed in XIEos2.def */
-
-extern int _XieColorAllocAllParam (char **, XiePointer, int);
-extern int _XieColorAllocMatchParam (char **, XiePointer, int);
-extern int _XieColorAllocRequantizeParam (char **, XiePointer, int);
-extern int _XieRGBToCIELabParam (char **, XiePointer, int);
-extern int _XieRGBToYCbCrParam (char **, XiePointer, int);
-extern int _XieRGBToYCCParam (char **, XiePointer, int);
-extern int _XieYCbCrToRGBParam (char **, XiePointer, int);
-extern int _XieYCCToRGBParam (char **, XiePointer, int);
-extern int _XieCIELabToRGBParam (char **, XiePointer, int);
-extern int _XieConvolveConstantParam (char **, XiePointer, int);
-extern int _XieClipScaleParam (char **, XiePointer, int);
-extern int _XieDecodeUncompressedSingleParam (char **, XiePointer, int);
-extern int _XieDecodeUncompressedTripleParam (char **, XiePointer, int);
-extern int _XieDecodeG31DParam (char **, XiePointer, int);
-extern int _XieDecodeTIFFPackBitsParam (char **, XiePointer, int);
-extern int _XieDecodeJPEGBaselineParam (char **, XiePointer, int);
-extern int _XieDitherOrderedParam (char **, XiePointer, int);
-extern int _XieEncodeUncompressedSingleParam (char **, XiePointer, int);
-extern int _XieEncodeUncompressedTripleParam (char **, XiePointer, int);
-extern int _XieEncodeG31DParam (char **, XiePointer, int);
-extern int _XieEncodeTIFFPackBitsParam (char **, XiePointer, int);
-extern int _XieEncodeServerChoiceParam (char **, XiePointer, int);
-extern int _XieEncodeG32DParam (char **, XiePointer, int);
-extern int _XieEncodeG42DParam (char **, XiePointer, int);
-extern int _XieEncodeJPEGBaselineParam (char **, XiePointer, int);
-extern int _XieEncodeJPEGLosslessParam (char **, XiePointer, int);
-extern int _XieEncodeTIFF2Param (char **, XiePointer, int);
-extern int _XieGeomAntialiasByAreaParam (char **, XiePointer, int);
-extern int _XieGeomAntialiasByLowpassParam (char **, XiePointer, int);
-extern int _XieGeomGaussianParam (char **, XiePointer, int);
-extern int _XieGeomNearestNeighborParam (char **, XiePointer, int);
-extern int _XieHistogramGaussianParam (char **, XiePointer, int);
-extern int _XieHistogramHyperbolicParam (char **, XiePointer, int);
-extern int _XieWhiteAdjustCIELabShiftParam (char **, XiePointer, int);
-
-
-int
-_XieTechniqueLength (int group, int technique, XiePointer param)
-{
- XieTechFuncPtr techfunc = _XieLookupTechFunc (group, technique);
- int length;
-
- if (techfunc)
- length = (*techfunc) (NULL, param, 0);
- else
- length = 0;
-
- return (length);
-}
-
-
-void
-_XieEncodeTechnique (
- char **bufDest,
- int group,
- int technique,
- XiePointer param)
-{
- XieTechFuncPtr techfunc = _XieLookupTechFunc (group, technique);
-
- if (techfunc)
- (void) (*techfunc) (bufDest, param, 1);
-}
-
-
-
-#define srcParam ((XieColorAllocAllParam *)srcPtr)
-int
-_XieColorAllocAllParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (CARD32);
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- STORE_CARD32 (srcParam->fill, *bufDest);
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieColorAllocMatchParam *)srcPtr)
-int
-_XieColorAllocMatchParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecColorAllocMatch);
- xieTecColorAllocMatch *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecColorAllocMatch, *bufDest, dstParam);
-
- dstParam->matchLimit = _XieConvertToIEEE (srcParam->match_limit);
- dstParam->grayLimit = _XieConvertToIEEE (srcParam->gray_limit);
-
- END_TECHNIQUE (xieTecColorAllocMatch, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieColorAllocRequantizeParam *)srcPtr)
-int
-_XieColorAllocRequantizeParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (CARD32);
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- STORE_CARD32 (srcParam->max_cells, *bufDest);
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieRGBToCIELabParam *)srcPtr)
-int
-_XieRGBToCIELabParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length, techLen;
- xieTecRGBToCIELab *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- techLen = _XieTechniqueLength (xieValWhiteAdjust,
- srcParam->white_adjust_tech, srcParam->white_adjust_param);
-
- length = LENOF (xieTecRGBToCIELab) + techLen;
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecRGBToCIELab, *bufDest, dstParam);
-
- /* memcpy (dstParam->matrix00, srcParam->matrix, 36); */
- dstParam->matrix00 = _XieConvertToIEEE (srcParam->matrix[0]);
- dstParam->matrix01 = _XieConvertToIEEE (srcParam->matrix[1]);
- dstParam->matrix02 = _XieConvertToIEEE (srcParam->matrix[2]);
- dstParam->matrix10 = _XieConvertToIEEE (srcParam->matrix[3]);
- dstParam->matrix11 = _XieConvertToIEEE (srcParam->matrix[4]);
- dstParam->matrix12 = _XieConvertToIEEE (srcParam->matrix[5]);
- dstParam->matrix20 = _XieConvertToIEEE (srcParam->matrix[6]);
- dstParam->matrix21 = _XieConvertToIEEE (srcParam->matrix[7]);
- dstParam->matrix22 = _XieConvertToIEEE (srcParam->matrix[8]);
-
- dstParam->whiteAdjusted = srcParam->white_adjust_tech;
- dstParam->lenParams = techLen;
-
- END_TECHNIQUE (xieTecRGBToCIELab, *bufDest, dstParam);
-
- _XieEncodeTechnique (bufDest, xieValWhiteAdjust,
- srcParam->white_adjust_tech, srcParam->white_adjust_param);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieRGBToYCbCrParam *)srcPtr)
-int
-_XieRGBToYCbCrParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecRGBToYCbCr);
- xieTecRGBToYCbCr *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecRGBToYCbCr, *bufDest, dstParam);
-
- dstParam->levels0 = srcParam->levels[0];
- dstParam->levels1 = srcParam->levels[1];
- dstParam->levels2 = srcParam->levels[2];
- dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red);
- dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green);
- dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue);
- dstParam->bias0 = _XieConvertToIEEE (srcParam->bias[0]);
- dstParam->bias1 = _XieConvertToIEEE (srcParam->bias[1]);
- dstParam->bias2 = _XieConvertToIEEE (srcParam->bias[2]);
-
- END_TECHNIQUE (xieTecRGBToYCbCr, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieRGBToYCCParam *)srcPtr)
-int
-_XieRGBToYCCParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecRGBToYCC);
- xieTecRGBToYCC *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecRGBToYCC, *bufDest, dstParam);
-
- dstParam->levels0 = srcParam->levels[0];
- dstParam->levels1 = srcParam->levels[1];
- dstParam->levels2 = srcParam->levels[2];
- dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red);
- dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green);
- dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue);
- dstParam->scale = _XieConvertToIEEE (srcParam->scale);
-
- END_TECHNIQUE (xieTecRGBToYCC, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieYCbCrToRGBParam *)srcPtr)
-int
-_XieYCbCrToRGBParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length, gamutLen;
- xieTecYCbCrToRGB *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- gamutLen = _XieTechniqueLength (xieValGamut,
- srcParam->gamut_tech, srcParam->gamut_param);
-
- length = LENOF (xieTecYCbCrToRGB) + gamutLen;
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecYCbCrToRGB, *bufDest, dstParam);
-
- dstParam->levels0 = srcParam->levels[0];
- dstParam->levels1 = srcParam->levels[1];
- dstParam->levels2 = srcParam->levels[2];
- dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red);
- dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green);
- dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue);
- dstParam->bias0 = _XieConvertToIEEE (srcParam->bias[0]);
- dstParam->bias1 = _XieConvertToIEEE (srcParam->bias[1]);
- dstParam->bias2 = _XieConvertToIEEE (srcParam->bias[2]);
- dstParam->gamutCompress = srcParam->gamut_tech;
- dstParam->lenGamutParams = gamutLen;
-
- END_TECHNIQUE (xieTecYCbCrToRGB, *bufDest, dstParam);
-
- _XieEncodeTechnique (bufDest, xieValGamut,
- srcParam->gamut_tech, srcParam->gamut_param);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieYCCToRGBParam *)srcPtr)
-int
-_XieYCCToRGBParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length, gamutLen;
- xieTecYCCToRGB *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- gamutLen = _XieTechniqueLength (xieValGamut,
- srcParam->gamut_tech, srcParam->gamut_param);
-
- length = LENOF (xieTecYCCToRGB) + gamutLen;
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecYCCToRGB, *bufDest, dstParam);
-
- dstParam->levels0 = srcParam->levels[0];
- dstParam->levels1 = srcParam->levels[1];
- dstParam->levels2 = srcParam->levels[2];
- dstParam->lumaRed = _XieConvertToIEEE (srcParam->luma_red);
- dstParam->lumaGreen = _XieConvertToIEEE (srcParam->luma_green);
- dstParam->lumaBlue = _XieConvertToIEEE (srcParam->luma_blue);
- dstParam->scale = _XieConvertToIEEE (srcParam->scale);
- dstParam->gamutCompress = srcParam->gamut_tech;
- dstParam->lenGamutParams = gamutLen;
-
- END_TECHNIQUE (xieTecYCCToRGB, *bufDest, dstParam);
-
- _XieEncodeTechnique (bufDest, xieValGamut,
- srcParam->gamut_tech, srcParam->gamut_param);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieCIELabToRGBParam *)srcPtr)
-int
-_XieCIELabToRGBParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- xieTecCIELabToRGB *dstParam;
- int length, whiteLen, gamutLen;
-
- if (srcParam == NULL)
- return(0);
-
- whiteLen = _XieTechniqueLength (xieValWhiteAdjust,
- srcParam->white_adjust_tech, srcParam->white_adjust_param);
-
- gamutLen = _XieTechniqueLength (xieValGamut,
- srcParam->gamut_tech, srcParam->gamut_param);
-
- length = LENOF (xieTecCIELabToRGB) + whiteLen + gamutLen;
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecCIELabToRGB, *bufDest, dstParam);
-
- /* memcpy (dstParam->matrix00, srcParam->matrix, 36); */
- dstParam->matrix00 = _XieConvertToIEEE (srcParam->matrix[0]);
- dstParam->matrix01 = _XieConvertToIEEE (srcParam->matrix[1]);
- dstParam->matrix02 = _XieConvertToIEEE (srcParam->matrix[2]);
- dstParam->matrix10 = _XieConvertToIEEE (srcParam->matrix[3]);
- dstParam->matrix11 = _XieConvertToIEEE (srcParam->matrix[4]);
- dstParam->matrix12 = _XieConvertToIEEE (srcParam->matrix[5]);
- dstParam->matrix20 = _XieConvertToIEEE (srcParam->matrix[6]);
- dstParam->matrix21 = _XieConvertToIEEE (srcParam->matrix[7]);
- dstParam->matrix22 = _XieConvertToIEEE (srcParam->matrix[8]);
-
- dstParam->whiteAdjusted = srcParam->white_adjust_tech;
- dstParam->lenWhiteParams = whiteLen;
- dstParam->gamutCompress = srcParam->gamut_tech;
- dstParam->lenGamutParams = gamutLen;
-
- END_TECHNIQUE (xieTecCIELabToRGB, *bufDest, dstParam);
-
- _XieEncodeTechnique (bufDest, xieValWhiteAdjust,
- srcParam->white_adjust_tech, srcParam->white_adjust_param);
-
- _XieEncodeTechnique (bufDest, xieValGamut,
- srcParam->gamut_tech, srcParam->gamut_param);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieConvolveConstantParam *)srcPtr)
-int
-_XieConvolveConstantParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- xieTecConvolveConstant *dstParam;
- int length = LENOF (xieTecConvolveConstant);
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecConvolveConstant, *bufDest, dstParam);
-
- dstParam->constant0 = _XieConvertToIEEE (srcParam->constant[0]);
- dstParam->constant1 = _XieConvertToIEEE (srcParam->constant[1]);
- dstParam->constant2 = _XieConvertToIEEE (srcParam->constant[2]);
-
- END_TECHNIQUE (xieTecConvolveConstant, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieClipScaleParam *)srcPtr)
-int
-_XieClipScaleParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- xieTecClipScale *dstParam;
- int length = LENOF (xieTecClipScale);
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecClipScale, *bufDest, dstParam);
-
- dstParam->inputLow0 = _XieConvertToIEEE (srcParam->input_low[0]);
- dstParam->inputLow1 = _XieConvertToIEEE (srcParam->input_low[1]);
- dstParam->inputLow2 = _XieConvertToIEEE (srcParam->input_low[2]);
- dstParam->inputHigh0 = _XieConvertToIEEE (srcParam->input_high[0]);
- dstParam->inputHigh1 = _XieConvertToIEEE (srcParam->input_high[1]);
- dstParam->inputHigh2 = _XieConvertToIEEE (srcParam->input_high[2]);
- dstParam->outputLow0 = srcParam->output_low[0];
- dstParam->outputLow1 = srcParam->output_low[1];
- dstParam->outputLow2 = srcParam->output_low[2];
- dstParam->outputHigh0 = srcParam->output_high[0];
- dstParam->outputHigh1 = srcParam->output_high[1];
- dstParam->outputHigh2 = srcParam->output_high[2];
-
- END_TECHNIQUE (xieTecClipScale, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieDecodeUncompressedSingleParam *)srcPtr)
-int
-_XieDecodeUncompressedSingleParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecDecodeUncompressedSingle);
- xieTecDecodeUncompressedSingle *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecDecodeUncompressedSingle, *bufDest, dstParam);
-
- dstParam->fillOrder = srcParam->fill_order;
- dstParam->pixelOrder = srcParam->pixel_order;
- dstParam->pixelStride = srcParam->pixel_stride;
- dstParam->leftPad = srcParam->left_pad;
- dstParam->scanlinePad = srcParam->scanline_pad;
-
- END_TECHNIQUE (xieTecDecodeUncompressedSingle, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieDecodeUncompressedTripleParam *)srcPtr)
-int
-_XieDecodeUncompressedTripleParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecDecodeUncompressedTriple);
- xieTecDecodeUncompressedTriple *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecDecodeUncompressedTriple, *bufDest, dstParam);
-
- dstParam->leftPad[0] = srcParam->left_pad[0];
- dstParam->leftPad[1] = srcParam->left_pad[1];
- dstParam->leftPad[2] = srcParam->left_pad[2];
- dstParam->fillOrder = srcParam->fill_order;
- dstParam->pixelStride[0] = srcParam->pixel_stride[0];
- dstParam->pixelStride[1] = srcParam->pixel_stride[1];
- dstParam->pixelStride[2] = srcParam->pixel_stride[2];
- dstParam->pixelOrder = srcParam->pixel_order;
- dstParam->scanlinePad[0] = srcParam->scanline_pad[0];
- dstParam->scanlinePad[1] = srcParam->scanline_pad[1];
- dstParam->scanlinePad[2] = srcParam->scanline_pad[2];
- dstParam->bandOrder = srcParam->band_order;
- dstParam->interleave = srcParam->interleave;
-
- END_TECHNIQUE (xieTecDecodeUncompressedTriple, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieDecodeG31DParam *)srcPtr)
-int
-_XieDecodeG31DParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecDecodeG31D);
- xieTecDecodeG31D *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecDecodeG31D, *bufDest, dstParam);
-
- dstParam->encodedOrder = srcParam->encoded_order;
- dstParam->normal = srcParam->normal;
- dstParam->radiometric = srcParam->radiometric;
-
- END_TECHNIQUE (xieTecDecodeG31D, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieDecodeTIFFPackBitsParam *)srcPtr)
-int
-_XieDecodeTIFFPackBitsParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecDecodeTIFFPackBits);
- xieTecDecodeTIFFPackBits *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecDecodeTIFFPackBits, *bufDest, dstParam);
-
- dstParam->encodedOrder = srcParam->encoded_order;
- dstParam->normal = srcParam->normal;
-
- END_TECHNIQUE (xieTecDecodeTIFFPackBits, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieDecodeJPEGBaselineParam *)srcPtr)
-int
-_XieDecodeJPEGBaselineParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- xieTecDecodeJPEGBaseline *dstParam;
- int length = LENOF (xieTecDecodeJPEGBaseline);
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecDecodeJPEGBaseline, *bufDest, dstParam);
-
- dstParam->interleave = srcParam->interleave;
- dstParam->bandOrder = srcParam->band_order;
- dstParam->upSample = srcParam->up_sample;
-
- END_TECHNIQUE (xieTecDecodeJPEGBaseline, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieDitherOrderedParam *)srcPtr)
-int
-_XieDitherOrderedParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecDitherOrdered);
- xieTecDitherOrdered *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecDitherOrdered, *bufDest, dstParam);
-
- dstParam->thresholdOrder = srcParam->threshold_order;
-
- END_TECHNIQUE (xieTecDitherOrdered, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeUncompressedSingleParam *)srcPtr)
-int
-_XieEncodeUncompressedSingleParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeUncompressedSingle);
- xieTecEncodeUncompressedSingle *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeUncompressedSingle, *bufDest, dstParam);
-
- dstParam->fillOrder = srcParam->fill_order;
- dstParam->pixelOrder = srcParam->pixel_order;
- dstParam->pixelStride = srcParam->pixel_stride;
- dstParam->scanlinePad = srcParam->scanline_pad;
-
- END_TECHNIQUE (xieTecEncodeUncompressedSingle, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeUncompressedTripleParam *)srcPtr)
-int
-_XieEncodeUncompressedTripleParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeUncompressedTriple);
- xieTecEncodeUncompressedTriple *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeUncompressedTriple, *bufDest, dstParam);
-
- dstParam->pixelStride[0] = srcParam->pixel_stride[0];
- dstParam->pixelStride[1] = srcParam->pixel_stride[1];
- dstParam->pixelStride[2] = srcParam->pixel_stride[2];
- dstParam->pixelOrder = srcParam->pixel_order;
- dstParam->scanlinePad[0] = srcParam->scanline_pad[0];
- dstParam->scanlinePad[1] = srcParam->scanline_pad[1];
- dstParam->scanlinePad[2] = srcParam->scanline_pad[2];
- dstParam->fillOrder = srcParam->fill_order;
- dstParam->bandOrder = srcParam->band_order;
- dstParam->interleave = srcParam->interleave;
-
- END_TECHNIQUE (xieTecEncodeUncompressedTriple, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeG31DParam *)srcPtr)
-int
-_XieEncodeG31DParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeG31D);
- xieTecEncodeG31D *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeG31D, *bufDest, dstParam);
-
- dstParam->alignEol = srcParam->align_eol;
- dstParam->encodedOrder = srcParam->encoded_order;
- dstParam->radiometric = srcParam->radiometric;
-
- END_TECHNIQUE (xieTecEncodeG31D, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeTIFFPackBitsParam *)srcPtr)
-int
-_XieEncodeTIFFPackBitsParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeTIFFPackBits);
- xieTecEncodeTIFFPackBits *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeTIFFPackBits, *bufDest, dstParam);
-
- dstParam->encodedOrder = srcParam->encoded_order;
-
- END_TECHNIQUE (xieTecEncodeTIFFPackBits, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeServerChoiceParam *)srcPtr)
-int
-_XieEncodeServerChoiceParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeServerChoice);
- xieTecEncodeServerChoice *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeServerChoice, *bufDest, dstParam);
-
- dstParam->preference = srcParam->preference;
-
- END_TECHNIQUE (xieTecEncodeServerChoice, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeG32DParam *)srcPtr)
-int
-_XieEncodeG32DParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeG32D);
- xieTecEncodeG32D *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeG32D, *bufDest, dstParam);
-
- dstParam->uncompressed = srcParam->uncompressed;
- dstParam->alignEol = srcParam->align_eol;
- dstParam->encodedOrder = srcParam->encoded_order;
- dstParam->kFactor = srcParam->k_factor;
- dstParam->radiometric = srcParam->radiometric;
-
- END_TECHNIQUE (xieTecEncodeG32D, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeG42DParam *)srcPtr)
-int
-_XieEncodeG42DParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeG42D);
- xieTecEncodeG42D *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeG42D, *bufDest, dstParam);
-
- dstParam->uncompressed = srcParam->uncompressed;
- dstParam->encodedOrder = srcParam->encoded_order;
- dstParam->radiometric = srcParam->radiometric;
-
- END_TECHNIQUE (xieTecEncodeG42D, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeJPEGBaselineParam *)srcPtr)
-int
-_XieEncodeJPEGBaselineParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeJPEGBaseline) +
- ((srcParam->q_size + srcParam->ac_size + srcParam->dc_size) >> 2);
- xieTecEncodeJPEGBaseline *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeJPEGBaseline, *bufDest, dstParam);
-
- dstParam->interleave = srcParam->interleave;
- dstParam->bandOrder = srcParam->band_order;
- dstParam->horizontalSamples[0] = srcParam->horizontal_samples[0];
- dstParam->horizontalSamples[1] = srcParam->horizontal_samples[1];
- dstParam->horizontalSamples[2] = srcParam->horizontal_samples[2];
- dstParam->verticalSamples[0] = srcParam->vertical_samples[0];
- dstParam->verticalSamples[1] = srcParam->vertical_samples[1];
- dstParam->verticalSamples[2] = srcParam->vertical_samples[2];
- dstParam->lenQtable = srcParam->q_size;
- dstParam->lenACtable = srcParam->ac_size;
- dstParam->lenDCtable = srcParam->dc_size;
-
- END_TECHNIQUE (xieTecEncodeJPEGBaseline, *bufDest, dstParam);
-
- /*
- * q_size, ac_size, dc_size should be multiple of 4,
- * so no need to pad.
- */
-
- memcpy (*bufDest, srcParam->q_table, srcParam->q_size);
- *bufDest += srcParam->q_size;
- memcpy (*bufDest, srcParam->ac_table, srcParam->ac_size);
- *bufDest += srcParam->ac_size;
- memcpy (*bufDest, srcParam->dc_table, srcParam->dc_size);
- *bufDest += srcParam->dc_size;
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeJPEGLosslessParam *)srcPtr)
-int
-_XieEncodeJPEGLosslessParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeJPEGLossless) +
- (srcParam->table_size >> 2);
- xieTecEncodeJPEGLossless *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeJPEGLossless, *bufDest, dstParam);
-
- dstParam->interleave = srcParam->interleave;
- dstParam->bandOrder = srcParam->band_order;
- dstParam->lenTable = srcParam->table_size;
- dstParam->predictor[0] = srcParam->predictor[0];
- dstParam->predictor[1] = srcParam->predictor[1];
- dstParam->predictor[2] = srcParam->predictor[2];
-
- END_TECHNIQUE (xieTecEncodeJPEGLossless, *bufDest, dstParam);
-
- /* table_size should be multiple of 4, so no need to pad */
-
- memcpy (*bufDest, srcParam->table, srcParam->table_size);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieEncodeTIFF2Param *)srcPtr)
-int
-_XieEncodeTIFF2Param (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecEncodeTIFF2);
- xieTecEncodeTIFF2 *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecEncodeTIFF2, *bufDest, dstParam);
-
- dstParam->encodedOrder = srcParam->encoded_order;
- dstParam->radiometric = srcParam->radiometric;
-
- END_TECHNIQUE (xieTecEncodeTIFF2, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieGeomAntialiasByAreaParam *)srcPtr)
-int
-_XieGeomAntialiasByAreaParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecGeomAntialiasByArea);
- xieTecGeomAntialiasByArea *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecGeomAntialiasByArea, *bufDest, dstParam);
-
- dstParam->simple = srcParam->simple;
-
- END_TECHNIQUE (xieTecGeomAntialiasByArea, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieGeomAntialiasByLowpassParam *)srcPtr)
-int
-_XieGeomAntialiasByLowpassParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecGeomAntialiasByLowpass);
- xieTecGeomAntialiasByLowpass *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecGeomAntialiasByLowpass, *bufDest, dstParam);
-
- dstParam->kernelSize = srcParam->kernel_size;
-
- END_TECHNIQUE (xieTecGeomAntialiasByLowpass, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieGeomGaussianParam *)srcPtr)
-int
-_XieGeomGaussianParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecGeomGaussian);
- xieTecGeomGaussian *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecGeomGaussian, *bufDest, dstParam);
-
- dstParam->radius = srcParam->radius;
- dstParam->simple = srcParam->simple;
- dstParam->sigma = _XieConvertToIEEE (srcParam->sigma);
- dstParam->normalize = _XieConvertToIEEE (srcParam->normalize);
-
- END_TECHNIQUE (xieTecGeomGaussian, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieGeomNearestNeighborParam *)srcPtr)
-int
-_XieGeomNearestNeighborParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- xieTecGeomNearestNeighbor *dstParam;
- int length = LENOF (xieTecGeomNearestNeighbor);
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecGeomNearestNeighbor, *bufDest, dstParam);
-
- dstParam->modify = srcParam->modify;
-
- END_TECHNIQUE (xieTecGeomNearestNeighbor, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieHistogramGaussianParam *)srcPtr)
-int
-_XieHistogramGaussianParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecHistogramGaussian);
- xieTecHistogramGaussian *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecHistogramGaussian, *bufDest, dstParam);
-
- dstParam->mean = _XieConvertToIEEE (srcParam->mean);
- dstParam->sigma = _XieConvertToIEEE (srcParam->sigma);
-
- END_TECHNIQUE (xieTecHistogramGaussian, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieHistogramHyperbolicParam *)srcPtr)
-int
-_XieHistogramHyperbolicParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecHistogramHyperbolic);
- xieTecHistogramHyperbolic *dstParam;
-
- if (srcParam == NULL)
- return(0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecHistogramHyperbolic, *bufDest, dstParam);
-
- dstParam->shapeFactor = srcParam->shape_factor;
- dstParam->constant = _XieConvertToIEEE (srcParam->constant);
-
- END_TECHNIQUE (xieTecHistogramHyperbolic, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-#define srcParam ((XieWhiteAdjustCIELabShiftParam *)srcPtr)
-int
-_XieWhiteAdjustCIELabShiftParam (
- char ** bufDest,
- XiePointer srcPtr,
- int encode)
-{
- int length = LENOF (xieTecWhiteAdjustCIELabShift);
- xieTecWhiteAdjustCIELabShift *dstParam;
-
- if (srcParam == NULL)
- return (0);
-
- if (encode)
- {
- BEGIN_TECHNIQUE (xieTecWhiteAdjustCIELabShift, *bufDest, dstParam);
-
- dstParam->whitePoint0 = _XieConvertToIEEE (srcParam->white_point[0]);
- dstParam->whitePoint1 = _XieConvertToIEEE (srcParam->white_point[1]);
- dstParam->whitePoint2 = _XieConvertToIEEE (srcParam->white_point[2]);
-
- END_TECHNIQUE (xieTecWhiteAdjustCIELabShift, *bufDest, dstParam);
- }
-
- return (length);
-}
-#undef srcParam
-
-
-
-void _XieInitTechFuncTable (void)
-{
- int i;
-
- for (i = 0; i < xieValMaxTechGroup; i++)
- _XieTechFuncs[i] = NULL;
-
-
- _XieRegisterTechFunc (xieValColorAlloc,
- xieValColorAllocDefault, 0);
- _XieRegisterTechFunc (xieValColorAlloc,
- xieValColorAllocAll, _XieColorAllocAllParam);
- _XieRegisterTechFunc (xieValColorAlloc,
- xieValColorAllocMatch, _XieColorAllocMatchParam);
- _XieRegisterTechFunc (xieValColorAlloc,
- xieValColorAllocRequantize, _XieColorAllocRequantizeParam);
-
- _XieRegisterTechFunc (xieValConvertFromRGB,
- xieValRGBToCIELab, _XieRGBToCIELabParam);
- _XieRegisterTechFunc (xieValConvertFromRGB,
- xieValRGBToCIEXYZ, _XieRGBToCIEXYZParam);
- _XieRegisterTechFunc (xieValConvertFromRGB,
- xieValRGBToYCbCr, _XieRGBToYCbCrParam);
- _XieRegisterTechFunc (xieValConvertFromRGB,
- xieValRGBToYCC, _XieRGBToYCCParam);
-
- _XieRegisterTechFunc (xieValConvertToRGB,
- xieValCIELabToRGB, _XieCIELabToRGBParam);
- _XieRegisterTechFunc (xieValConvertToRGB,
- xieValCIEXYZToRGB, _XieCIEXYZToRGBParam);
- _XieRegisterTechFunc (xieValConvertToRGB,
- xieValYCbCrToRGB, _XieYCbCrToRGBParam);
- _XieRegisterTechFunc (xieValConvertToRGB,
- xieValYCCToRGB, _XieYCCToRGBParam);
-
- _XieRegisterTechFunc (xieValConstrain,
- xieValConstrainClipScale, _XieClipScaleParam);
- _XieRegisterTechFunc (xieValConstrain,
- xieValConstrainHardClip, 0);
-
- _XieRegisterTechFunc (xieValConvolve,
- xieValConvolveDefault, 0);
- _XieRegisterTechFunc (xieValConvolve,
- xieValConvolveConstant, _XieConvolveConstantParam);
- _XieRegisterTechFunc (xieValConvolve,
- xieValConvolveReplicate, 0);
-
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeUncompressedSingle, _XieDecodeUncompressedSingleParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeUncompressedTriple, _XieDecodeUncompressedTripleParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeG31D, _XieDecodeG31DParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeG32D, _XieDecodeG32DParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeG42D, _XieDecodeG42DParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeJPEGBaseline, _XieDecodeJPEGBaselineParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeJPEGLossless, _XieDecodeJPEGLosslessParam);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeTIFF2, _XieDecodeTIFF2Param);
- _XieRegisterTechFunc (xieValDecode,
- xieValDecodeTIFFPackBits, _XieDecodeTIFFPackBitsParam);
-
- _XieRegisterTechFunc (xieValDither,
- xieValDitherDefault, 0);
- _XieRegisterTechFunc (xieValDither,
- xieValDitherErrorDiffusion, 0);
- _XieRegisterTechFunc (xieValDither,
- xieValDitherOrdered, _XieDitherOrderedParam);
-
-/*
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeServerChoice, 0);
-*/
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeServerChoice, _XieEncodeServerChoiceParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeUncompressedSingle, _XieEncodeUncompressedSingleParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeUncompressedTriple, _XieEncodeUncompressedTripleParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeG31D, _XieEncodeG31DParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeG32D, _XieEncodeG32DParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeG42D, _XieEncodeG42DParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeJPEGBaseline, _XieEncodeJPEGBaselineParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeJPEGLossless, _XieEncodeJPEGLosslessParam);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeTIFF2, _XieEncodeTIFF2Param);
- _XieRegisterTechFunc (xieValEncode,
- xieValEncodeTIFFPackBits, _XieEncodeTIFFPackBitsParam);
-
- _XieRegisterTechFunc (xieValGamut,
- xieValGamutDefault, 0);
- _XieRegisterTechFunc (xieValGamut,
- xieValGamutNone, 0);
- _XieRegisterTechFunc (xieValGamut,
- xieValGamutClipRGB, 0);
-
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomDefault, 0);
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomAntialias, 0);
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomAntialiasByArea, _XieGeomAntialiasByAreaParam);
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomAntialiasByLPF, _XieGeomAntialiasByLowpassParam);
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomBilinearInterp, 0);
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomGaussian, _XieGeomGaussianParam);
- _XieRegisterTechFunc (xieValGeometry,
- xieValGeomNearestNeighbor, _XieGeomNearestNeighborParam);
-
- _XieRegisterTechFunc (xieValHistogram,
- xieValHistogramFlat, 0);
- _XieRegisterTechFunc (xieValHistogram,
- xieValHistogramGaussian, _XieHistogramGaussianParam);
- _XieRegisterTechFunc (xieValHistogram,
- xieValHistogramHyperbolic, _XieHistogramHyperbolicParam);
-
- _XieRegisterTechFunc (xieValWhiteAdjust,
- xieValWhiteAdjustDefault, 0);
- _XieRegisterTechFunc (xieValWhiteAdjust,
- xieValWhiteAdjustNone, 0);
- _XieRegisterTechFunc (xieValWhiteAdjust,
- xieValWhiteAdjustCIELabShift, _XieWhiteAdjustCIELabShiftParam);
-}
diff --git a/xc/lib/XIE/technique.h b/xc/lib/XIE/technique.h
deleted file mode 100644
index 163ce6af8..000000000
--- a/xc/lib/XIE/technique.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $TOG: technique.h /main/5 1998/02/06 15:13:09 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.
-
-*/
-
-#ifndef WORD64
-
-#define BEGIN_TECHNIQUE(_name, _bufDest, _dstParam) \
- _dstParam = (_name *) _bufDest;
-
-#define END_TECHNIQUE(_name, _bufDest, _dstParam) \
- _bufDest += SIZEOF (_name);
-
-#else /* WORD64 */
-
-#define BEGIN_TECHNIQUE(_name, _bufDest, _dstParam) \
-{ \
- _name tParam; \
- _dstParam = &tParam;
-
-#define END_TECHNIQUE(_name, _bufDest, _dstParam) \
- memcpy (_bufDest, _dstParam, SIZEOF (_name)); \
- _bufDest += SIZEOF (_name); \
-}
-
-#endif /* WORD64 */
-
-
-
-#ifndef WORD64
-
-#define STORE_CARD32(_val, _pBuf) \
-{ \
- *((CARD32 *) _pBuf) = _val; \
- _pBuf += SIZEOF (CARD32); \
-}
-
-#else /* WORD64 */
-
-typedef struct {
- int value :32;
-} Long;
-
-#define STORE_CARD32(_val, _pBuf) \
-{ \
- Long _d; \
- _d.value = _val; \
- memcpy (_pBuf, &_d, SIZEOF (CARD32)); \
- _pBuf += SIZEOF (CARD32); \
-}
-
-#endif /* WORD64 */
-
-
-#define _XieRGBToCIEXYZParam _XieRGBToCIELabParam
-#define _XieCIEXYZToRGBParam _XieCIELabToRGBParam
-#define _XieDecodeG32DParam _XieDecodeG31DParam
-#define _XieDecodeG42DParam _XieDecodeG31DParam
-#define _XieDecodeTIFF2Param _XieDecodeG31DParam
-#define _XieDecodeJPEGLosslessParam _XieDecodeJPEGBaselineParam
diff --git a/xc/lib/XIE/utils.c b/xc/lib/XIE/utils.c
deleted file mode 100644
index dfd24be10..000000000
--- a/xc/lib/XIE/utils.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $TOG: utils.c /main/4 1998/04/30 14:40: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/lib/XIE/utils.c,v 1.3 1999/06/13 16:18:12 dawes Exp $ */
-
-#include "XIElibint.h"
-
-
-Status
-_XieRegisterTechFunc (int group, int technique, XieTechFuncPtr techfunc)
-{
- XieTechFuncRec *ptr = _XieTechFuncs[group - 1];
- XieTechFuncRec *prev = NULL, *newrec;
- int status = 1;
-
- newrec = (XieTechFuncRec *) Xmalloc (sizeof (XieTechFuncRec));
- newrec->technique = technique;
- newrec->techfunc = techfunc;
-
- if (ptr == NULL)
- {
- _XieTechFuncs[group - 1] = newrec;
- newrec->next = NULL;
- }
- else
- {
- while (ptr && ptr->technique < technique)
- {
- prev = ptr;
- ptr = ptr->next;
- }
-
- if (ptr == NULL)
- {
- prev->next = newrec;
- newrec->next = NULL;
- }
- else
- {
- if (ptr->technique == technique)
- {
- Xfree ((char *) newrec);
- status = 0;
- }
- else if (prev == NULL)
- {
- newrec->next = _XieTechFuncs[group - 1];
- _XieTechFuncs[group - 1] = newrec;
- }
- else
- {
- newrec->next = prev->next;
- prev->next = newrec;
- }
- }
- }
-
- return (status);
-}
-
-
-
-XieTechFuncPtr
-_XieLookupTechFunc (int group, int technique)
-{
- XieTechFuncRec *ptr = _XieTechFuncs[group - 1];
- int found = 0;
-
- while (ptr && !found)
- {
- if (ptr->technique == technique)
- found = 1;
- else
- ptr = ptr->next;
- }
-
- if (found)
- return (ptr->techfunc);
- else
- return (NULL);
-}
-
-
diff --git a/xc/lib/Xaw/Actions.c b/xc/lib/Xaw/Actions.c
deleted file mode 100644
index 92c4966eb..000000000
--- a/xc/lib/Xaw/Actions.c
+++ /dev/null
@@ -1,1130 +0,0 @@
-/*
- * Copyright (c) 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 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.
- */
-
-/* $XFree86: xc/lib/Xaw/Actions.c,v 3.14 1999/06/06 08:47:50 dawes Exp $ */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/CoreP.h>
-#include <X11/Constraint.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xfuncs.h>
-#include "Private.h"
-
-#ifndef OLDXAW
-
-/*
- * Definitions
- */
-#define ERROR -2
-#define END -1
-#define BOOLEAN 0
-#define AND '&'
-#define OR '|'
-#define XOR '^'
-#define NOT '~'
-#define LP '('
-#define RP ')'
-
-/*
- * Types
- */
-/* boolean expressions */
-typedef struct _XawEvalInfo {
- Widget widget;
- XawActionResList *rlist;
- XawActionVarList *vlist;
- XawParseBooleanProc parse_proc;
- XEvent *event;
- char *cp, *lp;
- int token;
- Bool value;
-} XawEvalInfo;
-
-/* resources */
-typedef struct _XawActionRes {
- XrmQuark qname;
- XrmQuark qtype;
- Cardinal size;
-} XawActionRes;
-
-struct _XawActionResList {
- WidgetClass widget_class;
- XawActionRes **resources;
- Cardinal num_common_resources;
- Cardinal num_constraint_resources;
-};
-
-/* variables */
-typedef struct _XawActionVar {
- XrmQuark qname;
- XrmQuark qvalue;
-} XawActionVar;
-
-struct _XawActionVarList {
- Widget widget;
- Cardinal num_variables;
- XawActionVar **variables;
-};
-
-/*
- * Private methods
- */
-/* expressions */
-static int get_token(XawEvalInfo*);
-static Bool expr(XawEvalInfo*);
-static Bool and(XawEvalInfo*);
-static Bool prim(XawEvalInfo*);
-
-/* resources */
-static String XawConvertActionRes(XawActionResList*, Widget w, String);
-
-static String _XawEscapeActionVarValue(String);
-static String _XawUnescapeActionVarValue(String);
-static XawActionResList *_XawCreateActionResList(WidgetClass);
-static XawActionResList *_XawFindActionResList(WidgetClass);
-static void _XawBindActionResList(XawActionResList*);
-static XawActionRes *_XawFindActionRes(XawActionResList*, Widget, String);
-static int qcmp_action_resource_list(_Xconst void*, _Xconst void*);
-static int bcmp_action_resource_list(_Xconst void*, _Xconst void*);
-static int qcmp_action_resource(_Xconst void*, _Xconst void*);
-static int bcmp_action_resource(_Xconst void*, _Xconst void*);
-
-/* variables */
-static String XawConvertActionVar(XawActionVarList*, String);
-static void XawDeclareActionVar(XawActionVarList*, String, String);
-
-static XawActionVarList *_XawCreateActionVarList(Widget);
-static XawActionVarList *_XawFindActionVarList(Widget);
-static XawActionVar *_XawCreateActionVar(XawActionVarList*, String);
-static XawActionVar *_XawFindActionVar(XawActionVarList*, String);
-static void _XawDestroyActionVarList(Widget, XtPointer, XtPointer);
-
-/*
- * Initialization
- */
-/* resources */
-static XawActionResList **resource_list;
-static Cardinal num_resource_list;
-
-/* variables */
-static XawActionVarList **variable_list;
-static Cardinal num_variable_list;
-
-/*
- * Implementation
- */
-/*
- * Start of Boolean Expression Evaluation Implementation Code
- */
-Bool
-XawParseBoolean(Widget w, String param, XEvent *event, Bool *succed)
-{
- char *tmp = param;
- int value;
-
- if (!param)
- return (False);
-
- value = (int)strtod(param, &tmp);
- if (*tmp == '\0')
- return (value);
-
- if (XmuCompareISOLatin1(param, "true") == 0
- || XmuCompareISOLatin1(param, "yes") == 0
- || XmuCompareISOLatin1(param, "on") == 0
- || XmuCompareISOLatin1(param, "in") == 0
- || XmuCompareISOLatin1(param, "up") == 0)
- return (True);
- else if (XmuCompareISOLatin1(param, "false") == 0
- || XmuCompareISOLatin1(param, "no") == 0
- || XmuCompareISOLatin1(param, "off") == 0
- || XmuCompareISOLatin1(param, "out") == 0
- || XmuCompareISOLatin1(param, "down") == 0)
- ;
- else if (XmuCompareISOLatin1(param, "my") == 0
- || XmuCompareISOLatin1(param, "mine") == 0)
- return (event->xany.window == XtWindow(w));
- else if (XmuCompareISOLatin1(param, "faked") == 0)
- return (event->xany.send_event != 0);
- else
- *succed = False;
-
- return (False);
-}
-
-Bool
-XawBooleanExpression(Widget w, String param, XEvent *event)
-{
- XawEvalInfo info;
- Bool retval;
-
- if (!param)
- return (False);
-
- info.widget = w;
-
- info.rlist = XawGetActionResList(XtClass(w));
- info.vlist = XawGetActionVarList(w);
-
- /*
- * Verify widget class, in case we will allow the parse proc procedure
- * as a widget class element, or if we allow overriding the default
- * parse boolean proc.
- */
- info.parse_proc = XawParseBoolean;
-
- info.event = event;
- info.cp = info.lp = param;
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "(*) Parsing expression \"%s\"\n", param);
-#endif
-
- (void)get_token(&info);
- if (info.token == ERROR)
- return (False);
- retval = expr(&info);
-
- return (info.token != ERROR ? retval : False);
-}
-
-static int
-get_token(XawEvalInfo *info)
-{
- int ch;
- char *p, name[256];
-
- info->lp = info->cp;
-
- /*COSTCOND*/
- while (1) /* eat white spaces */
- {
- ch = *info->cp++;
- if (isspace(ch))
- continue;
- break;
- }
-
- switch (ch)
- {
- case AND: case OR: case XOR: case NOT: case LP: case RP:
- return (info->token = ch);
- }
-
- /* It's a symbol name, resolve it. */
- if (ch == XAW_PRIV_VAR_PREFIX || isalnum(ch) || ch == '_' || ch == '\\')
- {
- Bool succed = True;
-
- p = info->cp - 1;
-
- while ((ch = *info->cp) && (isalnum(ch) || ch == '_'))
- ++info->cp;
-
- strncpy(name, p, XawMin((int)sizeof(name) - 1,
- (unsigned)(info->cp - p)));
- name[XawMin((int)sizeof(name) -1, info->cp - p)] = '\0';
-
- if (name[0] == XAW_PRIV_VAR_PREFIX)
- {
- String value = XawConvertActionVar(info->vlist, name);
-
- info->value = info->parse_proc(info->widget, value, info->event,
- &succed) & 1;
- }
- else
- {
- info->value = info->parse_proc(info->widget, name, info->event,
- &succed) & 1;
- if (!succed)
- {
- String value =
- XawConvertActionRes(info->rlist, info->widget,
- name[0] == '\\' ? &name[1] : name);
- /* '\\' may have been used to escape a resource name.
- */
-
- info->value = info->parse_proc(info->widget, value, info->event,
- &succed) & 1;
- if (!succed)
- {
- /* not a numeric value or boolean string */
- info->value = True;
- succed = True;
- }
- }
- }
- if (succed)
- return (info->token = BOOLEAN);
- }
- else if (ch == '\0')
- return (info->token = END);
-
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "evaluate(): bad token \"%c\" at \"%s\"", ch, info->cp - 1);
-
- XtAppWarning(XtWidgetToApplicationContext(info->widget), msg);
- }
-
- return (info->token = ERROR);
-}
-
-static Bool
-expr(XawEvalInfo *info)
-{
- Bool left = and(info);
-
- for (;;)
- switch (info->token)
- {
- case OR:
- (void)get_token(info);
- left |= and(info);
- break;
- case XOR:
- (void)get_token(info);
- left ^= and(info);
- break;
- default:
- return (left);
- }
- /* NOTREACHED */
-}
-
-static Bool
-and(XawEvalInfo *info)
-{
- Bool left = prim(info);
-
- for (;;)
- switch (info->token)
- {
- case AND:
- (void)get_token(info);
- left &= prim(info);
- break;
- default:
- return (left);
- }
- /* NOTREACHED */
-}
-
-static Bool
-prim(XawEvalInfo *info)
-{
- Bool e;
-
- switch (info->token)
- {
- case BOOLEAN:
- e = info->value;
- (void)get_token(info);
- return (e);
- case NOT:
- (void)get_token(info);
- return (!prim(info));
- case LP:
- (void)get_token(info);
- e = expr(info);
- if (info->token != RP)
- {
- char msg[256];
-
- info->token = ERROR;
- XmuSnprintf(msg, sizeof(msg),
- "evaluate(): expecting ), at \"%s\"", info->lp);
- XtAppWarning(XtWidgetToApplicationContext(info->widget), msg);
- return (False);
- }
- (void)get_token(info);
- return (e);
- case END:
- return (True);
- default:
- {
- char msg[256];
-
- info->token = ERROR;
- XmuSnprintf(msg, sizeof(msg),
- "evaluate(): sintax error, at \"%s\"", info->lp);
- XtAppWarning(XtWidgetToApplicationContext(info->widget), msg);
- } return (False);
- }
- /* NOTREACHED */
-}
-
-/*
- * Start of Resources Implementation Code
- */
-void
-XawSetValuesAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- Arg *arglist;
- Cardinal num_args, count;
- XawActionResList *rlist;
- XawActionVarList *vlist;
- XawActionRes *resource;
- XrmValue from, to;
- String value;
- char c_1;
- short c_2;
- int c_4;
-#ifdef LONG_64
- long c_8;
-#endif
-
- if (!(*num_params & 1))
- {
- XawPrintActionErrorMsg("set-values", w, params, num_params);
- return;
- }
-
- if (!XawBooleanExpression(w, params[0], event))
- return;
-
- rlist = XawGetActionResList(XtClass(w));
- vlist = XawGetActionVarList(w);
-
- num_args = 0;
- arglist = (Arg *)XtMalloc(sizeof(Arg) * ((*num_params) >> 1));
-
- for (count = 1; count < *num_params; count += 2)
- {
- if ((resource = _XawFindActionRes(rlist, w, params[count])) == NULL)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "set-values(): bad resource name \"%s\"",
- params[count]);
- XtAppWarning(XtWidgetToApplicationContext(w), msg);
- continue;
- }
- value = XawConvertActionVar(vlist, params[count + 1]);
- from.size = strlen(value) + 1;
- from.addr = value;
- to.size = resource->size;
- switch (to.size)
- {
- case 1: to.addr = (XPointer)&c_1; break;
- case 2: to.addr = (XPointer)&c_2; break;
- case 4: to.addr = (XPointer)&c_4; break;
-#ifdef LONG_64
- case 8: to.addr = (XPointer)&c_8; break;
-#endif
- default:
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "set-values(): bad resource size for \"%s\"",
- params[count]);
- XtAppWarning(XtWidgetToApplicationContext(w), msg);
- } continue;
- }
-
- if (strcmp(XtRString, XrmQuarkToString(resource->qtype)) == 0)
-#ifdef LONG_64
- c_8 = (int)from.addr;
-#else
- c_4 = (int)from.addr;
-#endif
- else if (!XtConvertAndStore(w, XtRString, &from,
- XrmQuarkToString(resource->qtype), &to))
- continue;
-
- switch (to.size)
- {
- case 1:
- XtSetArg(arglist[num_args], XrmQuarkToString(resource->qname), c_1);
- break;
- case 2:
- XtSetArg(arglist[num_args], XrmQuarkToString(resource->qname), c_2);
- break;
- case 4:
- XtSetArg(arglist[num_args], XrmQuarkToString(resource->qname), c_4);
- break;
-#ifdef LONG_64
- case 8:
- XtSetArg(arglist[num_args], XrmQuarkToString(resource->qname), c_8);
- break;
-#endif
- }
- ++num_args;
- }
-
- XtSetValues(w, arglist, num_args);
- XtFree((char *)arglist);
-}
-
-void
-XawGetValuesAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- XawActionResList *rlist;
- XawActionVarList *vlist;
- String value;
- Cardinal count;
-
- if (!(*num_params & 1))
- {
- XawPrintActionErrorMsg("get-values", w, params, num_params);
- return;
- }
- if (!XawBooleanExpression(w, params[0], event))
- return;
-
- rlist = XawGetActionResList(XtClass(w));
- vlist = XawGetActionVarList(w);
-
- for (count = 1; count < *num_params; count += 2)
- {
- if ((value = XawConvertActionRes(rlist, w, params[count + 1])) == NULL)
- continue;
- XawDeclareActionVar(vlist, params[count], value);
- }
-}
-
-void
-XawDeclareAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- XawActionVarList *vlist;
- Cardinal count;
-
- if (!(*num_params & 1))
- {
- XawPrintActionErrorMsg("declare", w, params, num_params);
- return;
- }
- if (!XawBooleanExpression(w, params[0], event))
- return;
-
- vlist = XawGetActionVarList(w);
-
- for (count = 1; count < *num_params; count += 2)
- XawDeclareActionVar(vlist, params[count], params[count + 1]);
-}
-
-void
-XawCallProcAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- String *args;
- Cardinal num_args;
-
- if (*num_params < 2)
- {
- XawPrintActionErrorMsg("call-proc", w, params, num_params);
- return;
- }
-
- if (*num_params && !XawBooleanExpression(w, params[0], event))
- return;
-
- if (*num_params > 2)
- {
- args = &params[2];
- num_args = *num_params - 2;
- }
- else
- {
- args = NULL;
- num_args = 0;
- }
-
- XtCallActionProc(w, params[1], event, args, num_args);
-}
-
-static String
-XawConvertActionRes(XawActionResList *list, Widget w, String name)
-{
- XawActionRes *resource;
- XrmValue from, to;
- Arg arg;
- char c_1;
- short c_2;
- int c_4;
-#ifdef LONG_64
- long c_8;
-#endif
-
- if ((resource = _XawFindActionRes(list, w, name)) == NULL)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "convert(): bad resource name \"%s\"", name);
- XtAppWarning(XtWidgetToApplicationContext(w), msg);
- return (NULL);
- }
-
- from.size = resource->size;
- switch (from.size)
- {
- case 1:
- XtSetArg(arg, XrmQuarkToString(resource->qname),
- from.addr = (XPointer)&c_1);
- break;
- case 2:
- XtSetArg(arg, XrmQuarkToString(resource->qname),
- from.addr = (XPointer)&c_2);
- break;
- case 4:
- XtSetArg(arg, XrmQuarkToString(resource->qname),
- from.addr = (XPointer)&c_4);
- break;
-#ifdef LONG_64
- case 8:
- XtSetArg(arg, XrmQuarkToString(resource->qname),
- from.addr = (XPointer)&c_8);
- break;
-#endif
- default:
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "convert(): bad resource size for \"%s\"", name);
- XtAppWarning(XtWidgetToApplicationContext(w), name);
- } return (NULL);
- }
-
- XtGetValues(w, &arg, 1);
- to.size = sizeof(String);
- to.addr = NULL;
-
- if (strcmp(XtRString, XrmQuarkToString(resource->qtype)) == 0)
- to.addr = *(char **)from.addr;
- else if (!XtConvertAndStore(w, XrmQuarkToString(resource->qtype),
- &from, XtRString, &to))
- return (NULL);
-
- return ((String)to.addr);
-}
-
-void
-XawPrintActionErrorMsg(String action_name, Widget w,
- String *params, Cardinal *num_params)
-{
- char msg[1024];
- unsigned int size, idx;
-
- size = XmuSnprintf(msg, sizeof(msg), "%s(): bad number of parameters.\n\t(",
- action_name, action_name);
-
- idx = 0;
- while (idx < *num_params - 1 && size < sizeof(msg))
- size += XmuSnprintf(&msg[size], sizeof(msg) - size, "%s, ",
- params[idx++]);
- if (*num_params)
- XmuSnprintf(&msg[size], sizeof(msg) - size, "%s)", params[idx]);
- else
- XmuSnprintf(&msg[size], sizeof(msg) - size, ")");
- XtAppWarning(XtWidgetToApplicationContext(w), msg);
-}
-
-XawActionResList *
-XawGetActionResList(WidgetClass wc)
-{
- XawActionResList *list;
-
- list = _XawFindActionResList(wc);
-
- if (!list)
- list = _XawCreateActionResList(wc);
-
- return (list);
-}
-
-static int
-qcmp_action_resource_list(register _Xconst void *left,
- register _Xconst void *right)
-{
- return ((int)((*(XawActionResList **)left)->widget_class) -
- (int)((*(XawActionResList **)right)->widget_class));
-}
-
-static XawActionResList *
-_XawCreateActionResList(WidgetClass wc)
-{
- XawActionResList *list;
-
- list = (XawActionResList *)XtMalloc(sizeof(XawActionResList));
- list->widget_class = wc;
- list->num_common_resources = list->num_constraint_resources = 0;
- list->resources = NULL;
-
- if (!resource_list)
- {
- num_resource_list = 1;
- resource_list = (XawActionResList **)XtMalloc(sizeof(XawActionResList*));
- resource_list[0] = list;
- }
- else
- {
- ++num_resource_list;
- resource_list = (XawActionResList **)XtRealloc((char *)resource_list,
- sizeof(XawActionResList*)
- * num_resource_list);
- resource_list[num_resource_list - 1] = list;
- qsort(resource_list, num_resource_list, sizeof(XawActionResList*),
- qcmp_action_resource_list);
- }
-
- _XawBindActionResList(list);
-
- return (list);
-}
-
-static int
-bcmp_action_resource_list(register _Xconst void *wc,
- register _Xconst void *list)
-{
- return ((int)wc - (int)((*(XawActionResList **)list)->widget_class));
-}
-
-static XawActionResList *
-_XawFindActionResList(WidgetClass wc)
-{
- XawActionResList **list;
-
- if (!resource_list)
- return (NULL);
-
- list = (XawActionResList **)bsearch(wc, resource_list,
- num_resource_list,
- sizeof(XawActionResList*),
- bcmp_action_resource_list);
-
- return (list ? *list : NULL);
-}
-
-static int
-qcmp_action_resource(register _Xconst void *left,
- register _Xconst void *right)
-{
- return (strcmp(XrmQuarkToString((*(XawActionRes **)left)->qname),
- XrmQuarkToString((*(XawActionRes **)right)->qname)));
-}
-
-static void
-_XawBindActionResList(XawActionResList *list)
-{
- XtResourceList xt_list, cons_list;
- Cardinal i, num_xt, num_cons;
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "(*) Creating resource list for class \'%s\'\n---------\n",
- list->widget_class->core_class.class_name);
-#endif
-
- XtGetResourceList(list->widget_class, &xt_list, &num_xt);
- XtGetConstraintResourceList(list->widget_class, &cons_list, &num_cons);
- list->num_common_resources = num_xt;
- list->num_constraint_resources = num_cons;
-
- list->resources = (XawActionRes **)
- XtMalloc(sizeof(XawActionRes*) * (num_xt + num_cons));
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "Common resources\n---\n");
-#endif
-
- for (i = 0; i < num_xt; i++)
- {
- list->resources[i] = (XawActionRes *)XtMalloc(sizeof(XawActionRes));
- list->resources[i]->qname =
- XrmPermStringToQuark(xt_list[i].resource_name);
- list->resources[i]->qtype =
- XrmPermStringToQuark(xt_list[i].resource_type);
- list->resources[i]->size = xt_list[i].resource_size;
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "%-20s\t%-20s\t(%d)\n",
- xt_list[i].resource_name,
- xt_list[i].resource_type,
- xt_list[i].resource_size);
-#endif
- }
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "---\nContraint resources\n---");
-#endif
-
- for (; i < num_xt + num_cons; i++)
- {
- list->resources[i] = (XawActionRes *)XtMalloc(sizeof(XawActionRes));
- list->resources[i]->qname =
- XrmPermStringToQuark(cons_list[i - num_xt].resource_name);
- list->resources[i]->qtype =
- XrmPermStringToQuark(cons_list[i - num_xt].resource_type);
- list->resources[i]->size = cons_list[i - num_xt].resource_size;
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "%-20s\t%-20s\t(%d)\n",
- cons_list[i - num_xt].resource_name,
- cons_list[i - num_xt].resource_type,
- cons_list[i - num_xt].resource_size);
-#endif
- }
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "---\n");
-#endif
-
- XtFree((char *)xt_list);
- if (cons_list)
- XtFree((char *)cons_list);
-
- qsort(list->resources, list->num_common_resources, sizeof(XawActionRes*),
- qcmp_action_resource);
- if (num_cons)
- qsort(&list->resources[num_xt], list->num_constraint_resources,
- sizeof(XawActionRes*), qcmp_action_resource);
-}
-
-static int
-bcmp_action_resource(register _Xconst void *string,
- register _Xconst void *resource)
-{
- return (strcmp((String)string,
- XrmQuarkToString((*(XawActionRes **)resource)->qname)));
-}
-
-static XawActionRes *
-_XawFindActionRes(XawActionResList *list, Widget detail, String name)
-{
- XawActionRes **res;
-
- if (!list->resources)
- return (NULL);
-
- res = (XawActionRes **)bsearch(name, list->resources,
- list->num_common_resources,
- sizeof(XawActionRes*), bcmp_action_resource);
-
- if (!res && XtParent(detail)
- && XtIsSubclass(XtParent(detail), constraintWidgetClass))
- {
- XawActionResList *cons = XawGetActionResList(XtClass(XtParent(detail)));
-
- if (cons)
- res = (XawActionRes **)
- bsearch(name, &cons->resources[cons->num_common_resources],
- cons->num_constraint_resources,
- sizeof(XawActionRes*), bcmp_action_resource);
- }
-
- return (res ? *res : NULL);
-}
-
-/*
- * Start of Variables Implementation Code
- */
-/* For speed, only does memory allocation when really required */
-static String
-_XawEscapeActionVarValue(String value)
-{
- String escape;
-
- if (value[0] == '$' || value[0] == '\\')
- {
- escape = XtMalloc(strlen(value) + 2);
- escape[0] = '\\';
- strcpy(escape + 1, value);
- return (escape);
- }
- return (NULL);
-}
-
-/* For speed, only does memory allocation when really required */
-static String
-_XawUnescapeActionVarValue(String value)
-{
- String unescape;
-
- if (value[0] == '\\')
- {
- unescape = XtMalloc(strlen(value));
- strcpy(unescape, value + 1);
- return (unescape);
- }
- return (NULL);
-}
-
-static void
-XawDeclareActionVar(XawActionVarList *list, String name, String value)
-{
- XawActionVar *variable;
- String escape = NULL;
-
- if (name[0] != XAW_PRIV_VAR_PREFIX)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg), "declare(): variable name must begin with "
- "\'%c\', at %s = %s", XAW_PRIV_VAR_PREFIX, name, value);
- XtAppWarning(XtWidgetToApplicationContext(list->widget), msg);
- return;
- }
- variable = _XawFindActionVar(list, name);
- if (!variable)
- variable = _XawCreateActionVar(list, name);
- if (value)
- escape = _XawEscapeActionVarValue(value);
-
- if (variable->qvalue)
- {
- String val = escape ? escape : value;
-
- if (strcmp(XrmQuarkToString(variable->qvalue), val) == 0)
- {
- if (escape)
- XtFree(escape);
- return;
- }
- }
- variable->qvalue = (escape ? XrmStringToQuark(escape) :
- (value ? XrmStringToQuark(value) : NULLQUARK));
- if (escape)
- XtFree(escape);
-}
-
-static String
-XawConvertActionVar(XawActionVarList *list, String name)
-{
- XawActionVar *variable;
- String unescape;
- XrmQuark quark;
-
- if (name[0] != XAW_PRIV_VAR_PREFIX)
- return (name);
-
- variable = _XawFindActionVar(list, name);
- if (!variable || variable->qvalue == NULLQUARK)
- return (name);
- unescape = _XawUnescapeActionVarValue(XrmQuarkToString(variable->qvalue));
- if (unescape)
- {
- quark = XrmStringToQuark(unescape);
- XtFree(unescape);
- }
- else
- quark = variable->qvalue;
-
- return (XrmQuarkToString(quark));
-}
-
-XawActionVarList *
-XawGetActionVarList(Widget w)
-{
- XawActionVarList *list;
-
- list = _XawFindActionVarList(w);
- if (!list)
- list = _XawCreateActionVarList(w);
-
- return (list);
-}
-
-static int
-qcmp_action_variable_list(register _Xconst void *left,
- register _Xconst void *right)
-{
- return ((int)((*(XawActionVarList **)left)->widget) -
- (int)((*(XawActionVarList **)right)->widget));
-}
-
-static XawActionVarList *
-_XawCreateActionVarList(Widget w)
-{
- XawActionVarList *list;
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "(*) Creating action variable list for widget %s (%p)\n",
- XtName(w), w);
-#endif
-
- list = (XawActionVarList *)XtMalloc(sizeof(XawActionVarList));
- list->widget = w;
- list->num_variables = 0;
- list->variables = NULL;
-
- if (!variable_list)
- {
- num_variable_list = 1;
- variable_list = (XawActionVarList **)XtMalloc(sizeof(XawActionVarList*));
- variable_list[0] = list;
- }
- else
- {
- ++num_variable_list;
- variable_list = (XawActionVarList **)
- XtRealloc((char *)variable_list,
- sizeof(XawActionVarList *) * num_variable_list);
- variable_list[num_variable_list - 1] = list;
- qsort(variable_list, num_variable_list, sizeof(XawActionVarList*),
- qcmp_action_variable_list);
- }
-
- XtAddCallback(w, XtNdestroyCallback, _XawDestroyActionVarList,
- (XtPointer)list);
-
- return (list);
-}
-
-static int
-bcmp_action_variable_list(register _Xconst void *widget,
- register _Xconst void *list)
-{
- return ((int)widget - (int)((*(XawActionVarList **)list)->widget));
-}
-
-static XawActionVarList *
-_XawFindActionVarList(Widget w)
-{
- XawActionVarList **list;
-
- if (!num_variable_list)
- return (NULL);
-
- list = (XawActionVarList **)bsearch(w, variable_list, num_variable_list,
- sizeof(XawActionVarList*),
- bcmp_action_variable_list);
-
- return (list ? *list : NULL);
-}
-
-static int
-qcmp_action_variable(register _Xconst void *left,
- register _Xconst void *right)
-{
- return (strcmp(XrmQuarkToString((*(XawActionVar **)left)->qname),
- XrmQuarkToString((*(XawActionVar **)right)->qname)));
-}
-
-static XawActionVar *
-_XawCreateActionVar(XawActionVarList *list, String name)
-{
- XawActionVar *variable;
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "(*) Creating action variable '%s' for widget %s (%p)\n",
- name, XtName(list->widget), list->widget);
-#endif
-
- variable = (XawActionVar *)XtMalloc(sizeof(XawActionVar));
- variable->qname = XrmStringToQuark(name);
- variable->qvalue = NULLQUARK;
-
- if (!list->variables)
- {
- list->num_variables = 1;
- list->variables = (XawActionVar **)XtMalloc(sizeof(XawActionVar*));
- list->variables[0] = variable;
- }
- else
- {
- ++list->num_variables;
- list->variables = (XawActionVar **)XtRealloc((char *)list->variables,
- sizeof(XawActionVar *) *
- list->num_variables);
- list->variables[list->num_variables - 1] = variable;
- qsort(list->variables, list->num_variables, sizeof(XawActionVar*),
- qcmp_action_variable);
- }
- return (variable);
-}
-
-static int
-bcmp_action_variable(register _Xconst void *string,
- register _Xconst void *variable)
-{
- return (strcmp((String)string,
- XrmQuarkToString((*(XawActionVar **)variable)->qname)));
-}
-
-static XawActionVar *
-_XawFindActionVar(XawActionVarList *list, String name)
-{
- XawActionVar **var;
-
- if (!list->variables)
- return (NULL);
-
- var = (XawActionVar **)bsearch(name, list->variables, list->num_variables,
- sizeof(XawActionVar*), bcmp_action_variable);
-
- return (var ? *var : NULL);
-}
-
-/*ARGSUSED*/
-static void
-_XawDestroyActionVarList(Widget w, XtPointer client_data, XtPointer call_data)
-{
- XawActionVarList *list = (XawActionVarList *)client_data;
- Cardinal i;
-
- for (i = 0; i < num_variable_list; i++)
- if (variable_list[i] == list)
- break;
- if (i >= num_variable_list || list->widget != w
- || variable_list[i]->widget != w)
- {
- XtWarning("destroy-variable-list(): Bad widget argument.");
- return;
- }
- if (--num_variable_list > 0)
- {
- memmove(&variable_list[i], &variable_list[i + 1],
- (num_variable_list - i) * sizeof(XawActionVarList *));
- variable_list = (XawActionVarList **)
- XtRealloc((char *)variable_list, sizeof(XawActionVarList *) *
- num_variable_list);
- }
- else
- {
- XtFree((char *)variable_list);
- variable_list = NULL;
- }
-
- XtFree((char *)list->variables);
- XtFree((char *)list);
-}
-
-#endif /* OLDXAW */
diff --git a/xc/lib/Xaw/AllWidgets.c b/xc/lib/Xaw/AllWidgets.c
deleted file mode 100644
index 2fcf96670..000000000
--- a/xc/lib/Xaw/AllWidgets.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $TOG: AllWidgets.c /main/9 1998/02/06 12:43:49 kaleb $ */
-
-/*
-
-Copyright (c) 1991, 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 <X11/IntrinsicP.h>
-#include <X11/Xmu/WidgetNode.h>
-
-extern WidgetClass applicationShellWidgetClass;
-extern WidgetClass asciiSinkObjectClass;
-extern WidgetClass asciiSrcObjectClass;
-extern WidgetClass asciiTextWidgetClass;
-extern WidgetClass boxWidgetClass;
-extern WidgetClass commandWidgetClass;
-extern WidgetClass compositeWidgetClass;
-extern WidgetClass constraintWidgetClass;
-extern WidgetClass coreWidgetClass;
-extern WidgetClass dialogWidgetClass;
-extern WidgetClass formWidgetClass;
-extern WidgetClass gripWidgetClass;
-extern WidgetClass labelWidgetClass;
-extern WidgetClass listWidgetClass;
-extern WidgetClass menuButtonWidgetClass;
-extern WidgetClass multiSinkObjectClass;
-extern WidgetClass multiSrcObjectClass;
-extern WidgetClass objectClass;
-extern WidgetClass overrideShellWidgetClass;
-extern WidgetClass panedWidgetClass;
-extern WidgetClass pannerWidgetClass;
-extern WidgetClass portholeWidgetClass;
-extern WidgetClass rectObjClass;
-extern WidgetClass repeaterWidgetClass;
-extern WidgetClass scrollbarWidgetClass;
-extern WidgetClass shellWidgetClass;
-extern WidgetClass simpleMenuWidgetClass;
-extern WidgetClass simpleWidgetClass;
-extern WidgetClass smeBSBObjectClass;
-extern WidgetClass smeLineObjectClass;
-extern WidgetClass smeObjectClass;
-extern WidgetClass stripChartWidgetClass;
-extern WidgetClass textSinkObjectClass;
-extern WidgetClass textSrcObjectClass;
-extern WidgetClass textWidgetClass;
-extern WidgetClass toggleWidgetClass;
-extern WidgetClass topLevelShellWidgetClass;
-extern WidgetClass transientShellWidgetClass;
-extern WidgetClass treeWidgetClass;
-extern WidgetClass vendorShellWidgetClass;
-extern WidgetClass viewportWidgetClass;
-extern WidgetClass wmShellWidgetClass;
-
-XmuWidgetNode XawWidgetArray[] = {
-{ "applicationShell", &applicationShellWidgetClass },
-{ "asciiSink", &asciiSinkObjectClass },
-{ "asciiSrc", &asciiSrcObjectClass },
-{ "asciiText", &asciiTextWidgetClass },
-{ "box", &boxWidgetClass },
-{ "command", &commandWidgetClass },
-{ "composite", &compositeWidgetClass },
-{ "constraint", &constraintWidgetClass },
-{ "core", &coreWidgetClass },
-{ "dialog", &dialogWidgetClass },
-{ "form", &formWidgetClass },
-{ "grip", &gripWidgetClass },
-{ "label", &labelWidgetClass },
-{ "list", &listWidgetClass },
-{ "menuButton", &menuButtonWidgetClass },
-{ "multiSink", &multiSinkObjectClass },
-{ "multiSrc", &multiSrcObjectClass },
-{ "object", &objectClass },
-{ "overrideShell", &overrideShellWidgetClass },
-{ "paned", &panedWidgetClass },
-{ "panner", &pannerWidgetClass },
-{ "porthole", &portholeWidgetClass },
-{ "rect", &rectObjClass },
-{ "repeater", &repeaterWidgetClass },
-{ "scrollbar", &scrollbarWidgetClass },
-{ "shell", &shellWidgetClass },
-{ "simpleMenu", &simpleMenuWidgetClass },
-{ "simple", &simpleWidgetClass },
-{ "smeBSB", &smeBSBObjectClass },
-{ "smeLine", &smeLineObjectClass },
-{ "sme", &smeObjectClass },
-{ "stripChart", &stripChartWidgetClass },
-{ "textSink", &textSinkObjectClass },
-{ "textSrc", &textSrcObjectClass },
-{ "text", &textWidgetClass },
-{ "toggle", &toggleWidgetClass },
-{ "topLevelShell", &topLevelShellWidgetClass },
-{ "transientShell", &transientShellWidgetClass },
-{ "tree", &treeWidgetClass },
-{ "vendorShell", &vendorShellWidgetClass },
-{ "viewport", &viewportWidgetClass },
-{ "wmShell", &wmShellWidgetClass },
-};
-
-int XawWidgetCount = XtNumber(XawWidgetArray);
-
diff --git a/xc/lib/Xaw/AllWidgets.h b/xc/lib/Xaw/AllWidgets.h
deleted file mode 100644
index 7e33c640c..000000000
--- a/xc/lib/Xaw/AllWidgets.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * $TOG: AllWidgets.h /main/4 1998/02/06 12:43:57 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.
- */
-
-#ifndef _XawAllWidgets_h
-#define _XawAllWidgets_h
-
-/*
- * This file matches the generated AllWidgets.c
- */
-extern XmuWidgetNode XawWidgetArray[];
-extern int XawWidgetCount;
-
-#endif /* _XawAllWidgets_h */
diff --git a/xc/lib/Xaw/AsciiSink.c b/xc/lib/Xaw/AsciiSink.c
deleted file mode 100644
index 7d4887d24..000000000
--- a/xc/lib/Xaw/AsciiSink.c
+++ /dev/null
@@ -1,1908 +0,0 @@
-/* $TOG: AsciiSink.c /main/63 1998/02/06 12:44:08 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiSink.c,v 1.20 1999/08/28 09:00:25 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xatom.h>
-#include <X11/Xaw/XawInit.h>
-#include <X11/Xaw/AsciiSinkP.h>
-#include <X11/Xaw/AsciiSrcP.h>
-#include <X11/Xaw/TextP.h>
-#include "Private.h"
-
-#ifdef GETLASTPOS
-#undef GETLASTPOS /* We will use our own GETLASTPOS */
-#endif
-
-#define GETLASTPOS \
- XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True)
-
-/*
- * Class Methods
- */
-static void XawAsciiSinkClassPartInitialize(WidgetClass);
-static void XawAsciiSinkInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawAsciiSinkDestroy(Widget);
-static void XawAsciiSinkResize(Widget);
-static Boolean XawAsciiSinkSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static int MaxLines(Widget, unsigned int);
-static int MaxHeight(Widget, int);
-static void SetTabs(Widget, int, short*);
-static void DisplayText(Widget, int, int,
- XawTextPosition, XawTextPosition, Bool);
-static void InsertCursor(Widget, int, int, XawTextInsertState);
-static void FindPosition(Widget, XawTextPosition, int, int, Bool,
- XawTextPosition*, int*, int*);
-static void FindDistance(Widget, XawTextPosition, int, XawTextPosition, int*,
- XawTextPosition*, int*);
-static void Resolve(Widget, XawTextPosition, int, int, XawTextPosition*);
-static void GetCursorBounds(Widget, XRectangle*);
-#ifndef OLDXAW
-static void AsciiPreparePaint(Widget, int, int,
- XawTextPosition, XawTextPosition, Bool);
-static void AsciiDoPaint(Widget);
-#endif
-
-/*
- * Prototypes
- */
-static void GetGC(AsciiSinkObject);
-static int CharWidth(AsciiSinkObject, XFontStruct*, int, unsigned int);
-static unsigned int PaintText(Widget w, GC gc, int x, int y,
- char *buf, int len, Bool);
-
-/*
- * Defined in TextSink.c
- */
-void _XawTextSinkClearToBackground(Widget, int, int, unsigned, unsigned);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(AsciiSinkRec, ascii_sink.field)
-static XtResource resources[] = {
- {
- XtNfont,
- XtCFont,
- XtRFontStruct,
- sizeof(XFontStruct*),
- offset(font),
- XtRString,
- XtDefaultFont
- },
- {
- XtNecho,
- XtCOutput,
- XtRBoolean,
- sizeof(Boolean),
- offset(echo),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNdisplayNonprinting,
- XtCOutput,
- XtRBoolean,
- sizeof(Boolean),
- offset(display_nonprinting),
- XtRImmediate,
- (XtPointer)
- True
- },
-};
-#undef offset
-
-#define Superclass (&textSinkClassRec)
-AsciiSinkClassRec asciiSinkClassRec = {
- /* object */
- {
- (WidgetClass)Superclass, /* superclass */
- "AsciiSink", /* class_name */
- sizeof(AsciiSinkRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- XawAsciiSinkClassPartInitialize, /* class_part_initialize */
- False, /* class_inited */
- XawAsciiSinkInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* obj1 */
- NULL, /* obj2 */
- 0, /* obj3 */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* obj4 */
- False, /* obj5 */
- False, /* obj6 */
- False, /* obj7 */
- XawAsciiSinkDestroy, /* destroy */
- (XtProc)XawAsciiSinkResize, /* obj8 */
- NULL, /* obj9 */
- XawAsciiSinkSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* obj10 */
- NULL, /* get_values_hook */
- NULL, /* obj11 */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* obj12 */
- NULL, /* obj13 */
- NULL, /* obj14 */
- NULL, /* extension */
- },
- /* text_sink */
- {
- DisplayText, /* DisplayText */
- InsertCursor, /* InsertCursor */
- XtInheritClearToBackground, /* ClearToBackground */
- FindPosition, /* FindPosition */
- FindDistance, /* FindDistance */
- Resolve, /* Resolve */
- MaxLines, /* MaxLines */
- MaxHeight, /* MaxHeight */
- SetTabs, /* SetTabs */
- GetCursorBounds, /* GetCursorBounds */
-#ifndef OLDXAW
- NULL /* extension */
-#endif
- },
- /* ascii_sink */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec;
-
-/*
- * Implementation
- */
-static void
-XawAsciiSinkClassPartInitialize(WidgetClass wc)
-{
-#ifndef OLDXAW
- AsciiSinkObjectClass cclass = (AsciiSinkObjectClass)wc;
- TextSinkObjectClass super = (TextSinkObjectClass)cclass->object_class.superclass;
- XrmQuark record_type = XrmPermStringToQuark("TextSink");
- TextSinkExt ext = cclass->text_sink_class.extension;
-
- while (ext) {
- if (ext->record_type == record_type &&
- ext->version == 1) {
- ext->PreparePaint = AsciiPreparePaint;
- ext->DoPaint = AsciiDoPaint;
- break;
- }
- ext = (TextSinkExt)ext->next_extension;
- }
- if (ext == NULL)
- XtError("TextSinkClass: cannot resolve extension.\n");
-#endif
-}
-
-static int
-CharWidth(AsciiSinkObject sink, XFontStruct *font, int x, unsigned int c)
-{
- int width = 0;
-
- if (c == XawLF)
- return (0);
-
- if (c == XawTAB) {
- int i;
- Position *tab;
-
- width = x;
- /* Adjust for Left Margin */
- x -= ((TextWidget)XtParent((Widget)sink))->text.left_margin;
-
- i = 0;
- tab = sink->text_sink.tabs;
- /*CONSTCOND*/
- while (1) {
- if (x >= 0 && x < *tab)
- return (*tab - x);
- /* Start again */
- if (++i >= sink->text_sink.tab_count) {
- x -= *tab;
- i = 0;
- tab = sink->text_sink.tabs;
- if (width == x)
- return (0);
- }
- else
- ++tab;
- }
- /*NOTREACHED*/
- }
-
- if ((c & 0177) < XawSP || c == 0177) {
- if (sink->ascii_sink.display_nonprinting) {
- if (c > 0177) {
- width = CharWidth(sink, font, x, '\\');
- width += CharWidth(sink, font, x, ((c >> 6) & 7) + '0');
- width += CharWidth(sink, font, x, ((c >> 3) & 7) + '0');
- c = (c & 7) + '0';
- }
- else {
- width = CharWidth(sink, font, x, '^');
- if ((c |= 0100) == 0177)
- c = '?';
- }
- }
- else
- c = XawSP;
- }
-
- if (font->per_char
- && (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
- width += font->per_char[c - font->min_char_or_byte2].width;
- else
- width += font->min_bounds.width;
-
- return (width);
-}
-
-#ifndef OLDXAW
-static int
-GetTextWidth(TextWidget ctx, int current_width, XFontStruct *font,
- XawTextPosition from, int length)
-{
- int i, width = 0;
- XawTextBlock block;
- XawTextPosition pos = from;
-
- while (length > 0) {
- pos = XawTextSourceRead(ctx->text.source, from, &block, length);
- length -= pos - from;
- from = pos;
- for (i = 0; i < block.length; i++)
- width += CharWidth((AsciiSinkObject)ctx->text.sink, font,
- current_width + width,
- (unsigned char)block.ptr[i]);
- }
-
- return (width);
-}
-
-static
-void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y,
- int ascent, int descent, Bool highlight, Bool right)
-{
-/*
- * Sample case:
- *
- * lbearing| width |rbearing
- * | |
- * | ####
- * | ### |
- * | #### |
- * | #### |
- * | ########## |
- * | #### |
- * | #### |
- * | #### |
- * | #### |
- * |### |
- * #### |
- * | |
- *
- */
- /* esta primeira versão do código apenas checa um caracter */
- AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink;
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
- XawTextPaintStruct *paint;
- XawTextBlock block;
- XFontStruct *font;
-
- property = NULL;
- if (XawTextSourceAnchorAndEntity(ctx->text.source, position,
- &anchor, &entity) &&
- (property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- else
- font = sink->ascii_sink.font;
- if (right) {
- if (font->max_bounds.rbearing > 0) {
- int rbearing = font->max_bounds.rbearing - font->max_bounds.width;
- unsigned char c;
-
- (void)XawTextSourceRead(ctx->text.source, position, &block, 1);
- c = *(unsigned char*)block.ptr;
- if (c == '\t' || c == '\n')
- c = ' ';
- else if ((c & 0177) < XawSP || c == 0177) {
- if (sink->ascii_sink.display_nonprinting)
- c = c > 0177 ? (c & 7) + '0' : c + '@';
- else
- c = ' ';
- }
- if (font->per_char &&
- (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
- rbearing = font->per_char[c - font->min_char_or_byte2].rbearing -
- font->per_char[c - font->min_char_or_byte2].width;
- if (rbearing > 0) {
- paint = XtNew(XawTextPaintStruct);
- paint->next = sink->text_sink.paint->bearings;
- sink->text_sink.paint->bearings = paint;
- paint->x = x - (paint->width = CharWidth(sink, font, 0, c));
- paint->y = y + ascent;
- paint->property = property;
- paint->max_ascent = ascent;
- paint->max_descent = descent;
- paint->backtabs = NULL;
- paint->highlight = highlight;
- paint->length = 1;
- paint->text = XtMalloc(1);
- paint->text[0] = c;
- }
- }
- }
- else {
- if (font->min_bounds.lbearing < 0) {
- int lbearing = font->min_bounds.lbearing;
- unsigned char c;
-
- (void)XawTextSourceRead(ctx->text.source, position, &block, 1);
- c = *(unsigned char*)block.ptr;
- if (c == '\t' || c == '\n')
- c = ' ';
- else if ((c & 0177) < XawSP || c == 0177) {
- if (sink->ascii_sink.display_nonprinting)
- c = c > 0177 ? '\\' : c + '^';
- else
- c = ' ';
- }
- if (font->per_char &&
- (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
- lbearing = font->per_char[c - font->min_char_or_byte2].lbearing;
- if (lbearing < 0) {
- paint = XtNew(XawTextPaintStruct);
- paint->next = sink->text_sink.paint->bearings;
- sink->text_sink.paint->bearings = paint;
- paint->x = x;
- paint->width = -CharWidth(sink, font, 0, c);
- paint->y = y + ascent;
- paint->property = property;
- paint->max_ascent = ascent;
- paint->max_descent = descent;
- paint->backtabs = NULL;
- paint->highlight = highlight;
- paint->length = 1;
- paint->text = XtMalloc(1);
- paint->text[0] = c;
- }
- }
- }
-}
-
-static void
-AsciiPreparePaint(Widget w, int y, int line,
- XawTextPosition from, XawTextPosition to, Bool highlight)
-{
- static XmuSegment segment;
- static XmuScanline next;
- static XmuScanline scanline = {0, &segment, &next};
- static XmuArea area = {&scanline};
-
- TextWidget ctx = (TextWidget)XtParent(w);
- AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink;
- XawTextPosition left, right, pos, pos2, tmp, length;
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
- int i, ascent = 0, descent = 0, xl, xr, x = ctx->text.left_margin, bufsiz;
- XawTextBlock block;
- XFontStruct *font;
- XawTextPaintStruct *paint;
-
- /* pass 1: calculate ascent/descent values and x coordinate */
- /* XXX the MAX ascent/descent value should be in the line table XXX */
- /* XXX the x coordinate can be a parameter, but since it is required
- to calculate the ascent/descent, do it here to avoid an extra
- search in the entities */
- pos = tmp = left = ctx->text.lt.info[line].position;
- right = ctx->text.lt.info[line + 1].position;
- right = XawMin(right, ctx->text.lastPos + 1);
- while (pos < right) {
- if (XawTextSourceAnchorAndEntity(ctx->text.source, pos,
- &anchor, &entity)) {
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- else
- font = sink->ascii_sink.font;
- tmp = pos;
- pos = anchor->position + entity->offset + entity->length;
- if ((length = XawMin(from, pos) - tmp) > 0)
- x += GetTextWidth(ctx, x, font, tmp, length);
- ascent = XawMax(font->ascent, ascent);
- descent = XawMax(font->descent, descent);
- }
- else if (anchor) {
- ascent = XawMax(sink->ascii_sink.font->ascent, ascent);
- descent = XawMax(sink->ascii_sink.font->descent, descent);
- while (entity && pos < right) {
- tmp = pos;
- if ((pos = anchor->position + entity->offset) < tmp)
- pos = tmp;
- else {
- if ((length = XawMin(from, pos) - tmp) > 0) {
- x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp,
- length);
- tmp += length;
- }
- if (pos < right) {
- pos += entity->length;
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- else
- font = sink->ascii_sink.font;
- if ((length = XawMin(from, pos) - tmp) > 0)
- x += GetTextWidth(ctx, x, font, tmp, length);
- ascent = XawMax(font->ascent, ascent);
- descent = XawMax(font->descent, descent);
- }
- }
- entity = entity->next;
- }
-
- if (anchor->entities == NULL) {
- tmp = XawMin(pos, from);
- if ((length = from - tmp) > 0)
- x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, length);
- break;
- }
- }
- else {
- tmp = XawMin(pos, from);
- if ((length = from - tmp) > 0)
- x += GetTextWidth(ctx, x, sink->ascii_sink.font, tmp, length);
- ascent = XawMax(sink->ascii_sink.font->ascent, ascent);
- descent = XawMax(sink->ascii_sink.font->descent, descent);
- break;
- }
- }
- if (!ascent)
- ascent = sink->ascii_sink.font->ascent;
- if (!descent)
- descent = sink->ascii_sink.font->descent;
-
- xl = x;
-
- /* pass 2: feed the XawTextPaintStruct lists */
- pos = from;
- while (pos < to) {
- paint = XtNew(XawTextPaintStruct);
- paint->next = sink->text_sink.paint->paint;
- paint->x = x;
- paint->y = y + ascent;
- paint->property = NULL;
- paint->max_ascent = ascent;
- paint->max_descent = descent;
- paint->backtabs = NULL;
- paint->highlight = highlight;
-
- tmp = pos;
- if (XawTextSourceAnchorAndEntity(ctx->text.source, pos,
- &anchor, &entity)) {
- pos = anchor->position + entity->offset + entity->length;
- if ((paint->property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (paint->property->mask & XAW_TPROP_FONT))
- font = paint->property->font;
- else
- font = sink->ascii_sink.font;
- }
- else {
- if (anchor) {
- while (entity && anchor->position + entity->offset < pos)
- entity = entity->next;
- if (entity)
- pos = anchor->position + entity->offset;
- else
- pos = to;
- }
- else
- pos = to;
- font = sink->ascii_sink.font;
- }
- pos = XawMin(pos, to);
- length = pos - tmp;
-
- paint->text = XtMalloc(bufsiz = pos - tmp + 4);
- paint->length = 0;
- segment.x1 = x;
-
- pos2 = tmp;
- while (length > 0) {
- pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, length);
- length = pos - pos2;
- tmp = pos2;
- for (i = 0; i < block.length; i++) {
- unsigned char c = (unsigned char)block.ptr[i];
-
- if (paint->length + 4 > bufsiz)
- paint->text = XtRealloc(paint->text, bufsiz += 32);
- paint->text[paint->length] = c;
- if (c == '\n') {
- x += CharWidth(sink, font, 0, ' ');
- continue;
- }
- if (c == '\t') {
- x += XTextWidth(font, paint->text, paint->length);
- segment.x2 = x + CharWidth(sink, font, x, '\t');
-
- if (XmuValidSegment(&segment)) {
- if (!highlight && (paint->property &&
- (paint->property->mask & XAW_TPROP_BACKGROUND))) {
- if (ascent > font->ascent) {
- scanline.y = y;
- next.y = y + ascent - font->ascent;
- XmuAreaOr(sink->text_sink.paint->clip, &area);
- }
- if (descent >= font->descent) {
- scanline.y = y + ascent + font->descent;
- next.y = scanline.y + descent - font->descent + 1;
- XmuAreaOr(sink->text_sink.paint->clip, &area);
- }
- if (paint->backtabs == NULL)
- paint->backtabs = XmuCreateArea();
- scanline.y = y + ascent - font->ascent;
- next.y = y + ascent + font->descent;
- XmuAreaOr(paint->backtabs, &area);
- }
- else {
- scanline.y = y;
- next.y = ctx->text.lt.info[line + 1].y;
- if (highlight) {
- if (!sink->text_sink.paint->hightabs)
- sink->text_sink.paint->hightabs =
- XmuCreateArea();
- XmuAreaOr(sink->text_sink.paint->hightabs, &area);
- }
- else
- XmuAreaOr(sink->text_sink.paint->clip, &area);
- }
- }
-
- x = segment.x1 = segment.x2;
- paint->width = x - segment.x1;
-
- if (paint->length == 0) {
- paint->x = x;
- continue;
- }
- paint->text = XtRealloc(paint->text, paint->length);
-
- sink->text_sink.paint->paint = paint;
-
- paint = XtNew(XawTextPaintStruct);
- paint->next = sink->text_sink.paint->paint;
- paint->x = x;
- paint->y = y + ascent;
- paint->property = sink->text_sink.paint->paint->property;
- paint->max_ascent = ascent;
- paint->max_descent = descent;
- paint->backtabs = NULL;
- paint->highlight = highlight;
- paint->text = XtMalloc(bufsiz = pos - tmp - length +
- block.length - i + 4);
- paint->length = 0;
- continue;
- }
- if ((c & 0177) < XawSP || c == 0177) {
- if (sink->ascii_sink.display_nonprinting) {
- if (c > 0177) {
- paint->text[paint->length++] = '\\';
- paint->text[paint->length++] = ((c >> 6) & 7) + '0';
- paint->text[paint->length++] = ((c >> 3) & 7) + '0';
- paint->text[paint->length] = (c & 7) + '0';
- }
- else {
- c |= 0100;
- paint->text[paint->length++] = '^';
- paint->text[paint->length] = c == 0177 ? '?' : c;
- }
- }
- else
- paint->text[paint->length] = ' ';
- }
- paint->length++;
- }
- }
-
- x += XTextWidth(font, paint->text, paint->length);
- segment.x2 = x;
- if (XmuValidSegment(&segment)) {
- /* erase only what really is needed */
- /*if (!highlight || (paint->property &&
- (paint->property->mask & XAW_TPROP_BACKGROUND))) {
- if (ascent > font->ascent) {
- scanline.y = y;
- next.y = y + ascent - font->ascent;
- XmuAreaOr(sink->text_sink.paint->clip, &area);
- }
- if (descent > font->descent) {
- scanline.y = y + ascent + font->descent;
- next.y = scanline.y + descent - font->descent;
- XmuAreaOr(sink->text_sink.paint->clip, &area);
- }
- }
- else*/ {
- scanline.y = y;
- next.y = ctx->text.lt.info[line + 1].y;
- XmuAreaOr(sink->text_sink.paint->clip, &area);
- }
- }
-
- paint->width = x - segment.x1;
- sink->text_sink.paint->paint = paint;
- }
-
- xr = x;
-
- /* pass 3: bearing clipping */
- if (left < from) {
- CalculateBearing(ctx, from - 1, xl, y, ascent, descent, highlight, True);
- if (ctx->text.s.left < ctx->text.s.right) {
- if (ctx->text.s.right == from)
- CalculateBearing(ctx, from, xl, y, ascent, descent, True, False);
- else if (ctx->text.s.left == from)
- CalculateBearing(ctx, from, xl, y, ascent, descent, False, False);
- }
- }
- right = XawMin(right, ctx->text.lastPos);
- if (right >= to && to > from) {
- if (to < right)
- CalculateBearing(ctx, to, xr, y, ascent, descent, highlight, False);
- if (ctx->text.s.left < ctx->text.s.right) {
- if (ctx->text.s.right == to)
- CalculateBearing(ctx, to - 1, xr, y, ascent, descent, False, True);
- else if (ctx->text.s.left == to)
- CalculateBearing(ctx, to - 1, xr, y, ascent, descent, True, True);
- }
- }
-}
-
-static int
-qcmp_paint_struct(_Xconst void *left, _Xconst void *right)
-{
- return ((*(XawTextPaintStruct**)left)->property -
- (*(XawTextPaintStruct**)right)->property);
-}
-
-static void
-AsciiDoPaint(Widget w)
-{
- TextWidget ctx = (TextWidget)XtParent(w);
- AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink;
- XmuScanline *scan;
- XmuSegment *seg;
- XawTextPaintList *list = sink->text_sink.paint;
- XawTextPaintStruct *base, *head, *paint = list->paint;
- XawTextProperty *property;
- XFontStruct *font;
- XRectangle *rects;
- int n_rects, i_rects;
- GC gc;
- Bool highlight;
- XRectangle rect;
- int width, height, line_width = -1;
- XGCValues values;
-
- /* pass 1: clear clipping areas */
- /* XXX Don't use XDrawImageString because the font may be italic, and
- will get incorrectly drawn. Probably, it could be a good idea to
- check if this is the case, and do special processing. But this
- will need to be checked if required. */
- for (scan = list->clip->scanline; scan && scan->next; scan = scan->next)
- for (seg = scan->segment; seg; seg = seg->next)
- _XawTextSinkClearToBackground(ctx->text.sink,
- seg->x1, scan->y,
- seg->x2 - seg->x1,
- scan->next->y - scan->y);
-
- /* pass 2: optimize drawing list to avoid too much GC change requests */
- /* XXX this assumes there will not exist entities drawn over other
- entities. */
- /*while (paint) {
- base = paint;
- head = paint->next;
- while (head) {
- if (head->property == paint->property) {
- base->next = head->next;
- head->next = paint->next;
- paint->next = head;
- paint = head;
- }
- base = head;
- head = head->next;
- }
- paint = paint->next;
- }*/
- if (paint && paint->next) {
- XawTextPaintStruct **paints;
- int i = 0, n_paints = 0;
-
- while (paint) {
- paint = paint->next;
- ++n_paints;
- }
- paints = (XawTextPaintStruct**)
- XtMalloc(n_paints * sizeof(XawTextPaintStruct));
- paint = list->paint;
- while (paint) {
- paints[i++] = paint;
- paint = paint->next;
- }
- qsort((void*)paints, n_paints, sizeof(XawTextPaintStruct*),
- qcmp_paint_struct);
- list->paint = paints[0];
- for (i = 0; i < n_paints - 1; i++)
- paints[i]->next = paints[i + 1];
- paints[i]->next = NULL;
- XtFree((XtPointer)paints);
- }
-
- /* pass 3: clip gc */
- gc = sink->ascii_sink.normgc;
-
- rect.x = ctx->text.r_margin.left;
- rect.y = ctx->text.r_margin.top;
- width = (int)XtWidth(ctx) - RHMargins(ctx);
- height = (int)XtHeight(ctx) - RVMargins(ctx);
- rect.width = width;
- rect.height = height;
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), gc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), gc, None);
-
- /* pass 4: draw backgrounds */
- paint = list->paint;
- property = NULL;
- rects = NULL;
- i_rects = n_rects = 0;
- while (paint) {
- if (paint->property && (paint->property->mask & XAW_TPROP_BACKGROUND)) {
- if (property != paint->property) {
- if (i_rects)
- XFillRectangles(XtDisplay(ctx), XtWindow(ctx), gc,
- rects, i_rects);
- i_rects = 0;
- property = paint->property;
- if (property->mask & XAW_TPROP_FONT)
- font = property->font;
- else
- font = sink->ascii_sink.font;
- XSetForeground(XtDisplay(ctx), gc, property->background);
- }
- if (i_rects <= n_rects)
- rects = (XRectangle*)
- XtRealloc((XtPointer)rects, sizeof(XRectangle) *
- ++n_rects);
- rects[i_rects].x = paint->x;
- rects[i_rects].y = paint->y - font->ascent;
- rects[i_rects].width = paint->width;
- rects[i_rects++].height = font->ascent + font->descent;
-
- if (paint->backtabs) {
- for (scan = paint->backtabs->scanline; scan && scan->next;
- scan = scan->next)
- for (seg = scan->segment; seg; seg = seg->next) {
- if (i_rects <= n_rects)
- rects = (XRectangle*)
- XtRealloc((XtPointer)rects, sizeof(XRectangle) *
- ++n_rects);
- rects[i_rects].x = seg->x1;
- rects[i_rects].y = scan->y;
- rects[i_rects].width = seg->x2 - seg->x1;
- rects[i_rects++].height = scan->next->y - scan->y;
- }
- }
-
-
- }
- paint = paint->next;
- }
- if (i_rects)
- XFillRectangles(XtDisplay(ctx), XtWindow(ctx), gc, rects, i_rects);
-
- paint = list->paint;
- i_rects = 0;
- while (paint) {
- if (paint->highlight) {
- if (i_rects == 0)
- XSetForeground(XtDisplay(ctx), gc, sink->text_sink.cursor_color);
- if (i_rects <= n_rects)
- rects = (XRectangle*)
- XtRealloc((XtPointer)rects, sizeof(XRectangle) *
- ++n_rects);
- rects[i_rects].x = paint->x;
- rects[i_rects].y = paint->y - paint->max_ascent;
- rects[i_rects].width = paint->width;
- rects[i_rects++].height = paint->max_ascent + paint->max_descent + 1;
- }
- paint = paint->next;
- }
- if (list->hightabs) {
- for (scan = list->hightabs->scanline; scan && scan->next;
- scan = scan->next)
- for (seg = scan->segment; seg; seg = seg->next) {
- if (i_rects == 0)
- XSetForeground(XtDisplay(ctx), gc,
- sink->text_sink.cursor_color);
- if (i_rects <= n_rects)
- rects = (XRectangle*)
- XtRealloc((XtPointer)rects, sizeof(XRectangle) *
- ++n_rects);
- rects[i_rects].x = seg->x1;
- rects[i_rects].y = scan->y;
- rects[i_rects].width = seg->x2 - seg->x1;
- rects[i_rects++].height = scan->next->y - scan->y;
- }
- }
-
- if (i_rects)
- XFillRectangles(XtDisplay(ctx), XtWindow(ctx), gc, rects, i_rects);
- if (rects)
- XtFree((XtPointer)rects);
-
- /* pass 5: draw text! */
- paint = list->paint;
- if (paint && (property = paint->property) == NULL) {
- font = sink->ascii_sink.font;
- XSetFont(XtDisplay(ctx), gc, font->fid);
- if (!paint->highlight)
- XSetForeground(XtDisplay(ctx), gc, sink->text_sink.foreground);
- }
- else
- property = NULL;
- highlight = False;
- while (paint) {
- if (!highlight && paint->highlight)
- XSetForeground(XtDisplay(ctx), gc, sink->text_sink.background);
- if (highlight || paint->highlight || paint->property != property) {
- if (!paint->property || !(paint->property->mask & XAW_TPROP_FONT))
- font = sink->ascii_sink.font;
- else
- font = paint->property->font;
- XSetFont(XtDisplay(ctx), gc, font->fid);
- if (!paint->highlight) {
- if (!paint->property ||
- !(paint->property->mask & XAW_TPROP_FOREGROUND))
- XSetForeground(XtDisplay(ctx), gc,
- sink->text_sink.foreground);
- else
- XSetForeground(XtDisplay(ctx), gc,
- paint->property->foreground);
- }
- highlight = paint->highlight;
- property = paint->property;
- }
-
- if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) {
- XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, paint->x, paint->y,
- paint->text, paint->length);
- if (property) {
- if (property->mask & XAW_TPROP_UNDERLINE) {
- if (line_width != property->underline_thickness) {
- values.line_width = line_width =
- property->underline_thickness;
- XChangeGC(XtDisplay(ctx), gc, GCLineWidth, &values);
- }
-
- XDrawLine(XtDisplay(ctx), XtWindow(ctx), gc, paint->x,
- paint->y + property->underline_position,
- paint->x + paint->width,
- paint->y + property->underline_position);
- }
- if (property->mask & XAW_TPROP_OVERSTRIKE) {
- if (line_width != property->underline_thickness) {
- values.line_width = line_width =
- property->underline_thickness;
- XChangeGC(XtDisplay(ctx), gc, GCLineWidth, &values);
- }
-
- XDrawLine(XtDisplay(ctx), XtWindow(ctx), gc, paint->x,
- paint->y - (font->ascent>>1) + (font->descent>>1),
- paint->x + paint->width,
- paint->y - (font->ascent>>1) + (font->descent>>1));
- }
- }
- }
-
- paint = paint->next;
- }
-
- /* pass 6: bearing clipping */
- /* dont care on order of drawing or caching of state (by now) */
- paint = list->bearings;
- while (paint) {
- XRectangle rect;
-
- if (paint->highlight)
- XSetForeground(XtDisplay(ctx), gc, sink->text_sink.background);
- if (!paint->property || !(paint->property->mask & XAW_TPROP_FONT))
- font = sink->ascii_sink.font;
- else
- font = paint->property->font;
- XSetFont(XtDisplay(ctx), gc, font->fid);
- if (!paint->highlight) {
- if (!paint->property ||
- !(paint->property->mask & XAW_TPROP_FOREGROUND))
- XSetForeground(XtDisplay(ctx), gc, sink->text_sink.foreground);
- else
- XSetForeground(XtDisplay(ctx), gc, paint->property->foreground);
- }
- if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) {
- rect.x = paint->x + paint->width;
- rect.width = XawAbs(paint->width); /* more than enough */
- rect.y = paint->y - font->ascent;
- rect.height = rect.y + font->ascent + font->descent;
- XSetClipRectangles(XtDisplay((Widget)ctx), gc,
- 0, 0, &rect, 1, Unsorted);
- XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, paint->x, paint->y,
- paint->text, paint->length);
- }
- paint = paint->next;
- }
-}
-#endif
-
-/*
- * Function:
- * PaintText
- *
- * Parameters:
- * w - text sink object
- * gc - gc to paint text with
- * x - location to paint the text
- * y - ""
- * buf - buffer and length of text to paint.
- * len - ""
- * clear_bg - clear background before drawing ?
- *
- * Description:
- * Actually paints the text into the window.
- *
- * Returns:
- * the width of the text painted
- */
-static unsigned int
-PaintText(Widget w, GC gc, int x, int y, char *buf, int len, Bool clear_bg)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- int width = XTextWidth(sink->ascii_sink.font, buf, len);
-
- if ((x > XtWidth(ctx)) || width <= -x) /* Don't draw if we can't see it */
- return (width);
-
- if (clear_bg) {
- _XawTextSinkClearToBackground(w, x, y - sink->ascii_sink.font->ascent,
- width, sink->ascii_sink.font->ascent
- + sink->ascii_sink.font->descent);
- XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, x, y, buf, len);
- }
- else
- XDrawImageString(XtDisplay(ctx), XtWindow(ctx), gc, x, y, buf, len);
-
- return (width);
-}
-
-static void
-DisplayText(Widget w, int x, int y,
- XawTextPosition pos1, XawTextPosition pos2, Bool highlight)
-{
- TextWidget ctx = (TextWidget)XtParent(w);
- AsciiSinkObject sink = (AsciiSinkObject)w;
- XFontStruct *font = sink->ascii_sink.font;
- Widget source = XawTextGetSource(XtParent(w));
- unsigned char buf[260];
- int j, k;
- XawTextBlock blk;
- GC gc, invgc, tabgc;
- int max_x;
- Bool clear_bg;
-
- if (!sink->ascii_sink.echo || !ctx->text.lt.lines)
- return;
-
- max_x = (int)XtWidth(ctx) - ctx->text.r_margin.right;
- clear_bg = !highlight && ctx->core.background_pixmap != XtUnspecifiedPixmap;
-
- gc = highlight ? sink->ascii_sink.invgc : sink->ascii_sink.normgc;
- invgc = highlight ? sink->ascii_sink.normgc : sink->ascii_sink.invgc;
-
- if (highlight && sink->ascii_sink.xorgc)
- tabgc = sink->ascii_sink.xorgc;
- else
- tabgc = invgc;
-
- y += sink->ascii_sink.font->ascent;
- for (j = 0; pos1 < pos2;) {
- pos1 = XawTextSourceRead(source, pos1, &blk, pos2 - pos1);
- for (k = 0; k < blk.length; k++) {
- if (j >= sizeof(buf) - 4) { /* buffer full, dump the text */
- if ((x += PaintText(w, gc, x, y, (char*)buf, j, clear_bg))
- >= max_x)
- return;
- j = 0;
- }
- buf[j] = blk.ptr[k];
- if (buf[j] == XawLF) /* line feeds ('\n') are not printed */
- continue;
-
- else if (buf[j] == '\t') {
- int width;
-
- if (j != 0
- && (x += PaintText(w, gc, x, y, (char*)buf, j, clear_bg))
- >= max_x)
- return;
-
- if ((width = CharWidth(sink, font, x, '\t')) > -x) {
- if (clear_bg)
- _XawTextSinkClearToBackground(w, x, y-font->ascent, width,
- font->ascent+font->descent);
- else
- XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
- tabgc, x, y - font->ascent, width,
- font->ascent + font->descent);
- }
-
- if ((x += width) >= max_x)
- return;
-
- j = -1;
- }
- else if ((buf[j] & 0177) < XawSP || buf[j] == 0177) {
- if (sink->ascii_sink.display_nonprinting) {
- unsigned char c = buf[j];
-
- if (c > 0177) {
- buf[j++] = '\\';
- buf[j++] = ((c >> 6) & 7) + '0';
- buf[j++] = ((c >> 3) & 7) + '0';
- buf[j] = (c & 7) + '0';
- }
- else {
- c |= 0100;
- buf[j++] = '^';
- buf[j] = c == 0177 ? '?' : c;
- }
- }
- else
- buf[j] = ' ';
- }
- j++;
- }
- }
-
- if (j > 0)
- (void)PaintText(w, gc, x, y, (char*)buf, j, clear_bg);
-}
-
-/*
- * Function:
- * GetCursorBounds
- *
- * Parameters:
- * w - text sink object
- * rect - X rectangle to return the cursor bounds
- *
- * Description:
- * Returns the size and location of the cursor.
- */
-static void
-GetCursorBounds(Widget w, XRectangle *rect)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
- XFontStruct *font = sink->ascii_sink.font;
- unsigned char ch;
-#ifndef OLDXAW
- TextWidget ctx = (TextWidget)XtParent(w);
- XawTextBlock block;
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
-
- if (XawTextSourceAnchorAndEntity(XawTextGetSource(XtParent(w)),
- sink->ascii_sink.cursor_position,
- &anchor, &entity)) {
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- }
- (void)XawTextSourceRead(XawTextGetSource((Widget)ctx),
- ctx->text.insertPos, &block, 1);
- if (!block.length || block.ptr[0] == '\n' || block.ptr[0] == '\t')
- ch = ' ';
- else if ((*((unsigned char*)block.ptr) & 0177) < XawSP ||
- *(unsigned char*)block.ptr == 0177) {
- if (sink->ascii_sink.display_nonprinting)
- ch = *((unsigned char*)block.ptr) > 0177 ? '\\' : '^';
- else
- ch = ' ';
- }
- else
- ch = *(unsigned char*)block.ptr;
-#else
- ch = ' ';
-#endif
-
- rect->width = CharWidth(sink, font, 0, ch);
- rect->height = font->descent + font->ascent + 1;
-
- rect->x = sink->ascii_sink.cursor_x;
- rect->y = sink->ascii_sink.cursor_y - font->ascent;
-}
-
-/* this function is required to support diferent fonts and correctly place
- * the cursor. There are better ways to calculate the base line, but there is
- * no place/code (yet) to store this information.
- */
-static int
-FindCursorY(TextWidget ctx, XawTextPosition position)
-{
- int y, line, ascent;
- AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink;
-#ifndef OLDXAW
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
- XawTextPosition left, right;
-#endif
-
- for (line = 0; line < ctx->text.lt.lines; line++)
- if (position < ctx->text.lt.info[line + 1].position)
- break;
-
- y = ctx->text.lt.info[line].y;
-#ifndef OLDXAW
- ascent = 0;
- left = ctx->text.lt.info[line].position;
- right = ctx->text.lt.info[line + 1].position;
- right = XawMin(right, ctx->text.lastPos + 1);
- while (left < right) {
- if (XawTextSourceAnchorAndEntity(ctx->text.source, left,
- &anchor, &entity)) {
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- ascent = XawMax(property->font->ascent, ascent);
- else
- ascent = XawMax(sink->ascii_sink.font->ascent, ascent);
- left = anchor->position + entity->offset + entity->length;
- }
- else if (anchor) {
- ascent = XawMax(sink->ascii_sink.font->ascent, ascent);
- while (entity) {
- XawTextPosition tmp = anchor->position + entity->offset + entity->length;
-
- if (tmp > left && tmp < right) {
- left = tmp;
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- ascent = XawMax(property->font->ascent, ascent);
- else
- ascent = XawMax(sink->ascii_sink.font->ascent, ascent);
- }
- entity = entity->next;
- }
- if (entity == NULL)
- break;
- }
- else {
- ascent = XawMax(sink->ascii_sink.font->ascent, ascent);
- break;
- }
- }
- if (!ascent)
- ascent = sink->ascii_sink.font->ascent;
-#else
- ascent = sink->ascii_sink.font->ascent;
-#endif
-
- return (y + ascent);
-}
-
-static void
-InsertCursor(Widget w, int x, int y, XawTextInsertState state)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
- XFontStruct *font = sink->ascii_sink.font;
- TextWidget ctx = (TextWidget)XtParent(w);
- XawTextPosition position = XawTextGetInsertionPoint((Widget)ctx);
- Boolean overflow = (x & 0xffff8000) != 0;
- GC gc;
- int ascent;
-#ifndef OLDXAW
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
-#endif
-
- if (XtIsRealized((Widget)ctx)) {
- int fheight;
- XawTextBlock block;
- XawTextPosition selection_start, selection_end;
- Boolean has_selection;
-
- XawTextGetSelectionPos((Widget)ctx, &selection_start, &selection_end);
- has_selection = selection_start != selection_end;
-
- if (sink->ascii_sink.laststate != state) {
- unsigned char ch;
-
-#ifndef OLDXAW
- if (XawTextSourceAnchorAndEntity(ctx->text.source,
- position, &anchor, &entity) &&
- (property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- else
- font = sink->ascii_sink.font;
-#endif
-
- fheight = font->ascent + font->descent;
- (void)XawTextSourceRead(XawTextGetSource((Widget)ctx),
- position, &block, 1);
- if (!block.length || block.ptr[0] == '\n' || block.ptr[0] == '\t')
- ch = ' ';
- else if ((*((unsigned char*)block.ptr) & 0177) < XawSP
- || *(unsigned char*)block.ptr == 0177) {
- if (sink->ascii_sink.display_nonprinting)
- ch = *((unsigned char*)block.ptr) > 0177 ? '\\' : '^';
- else
- ch = ' ';
- }
- else
- ch = *(unsigned char*)block.ptr;
-
- y = FindCursorY(ctx, position);
- if (ctx->text.hasfocus && !has_selection)
- XFillRectangle(XtDisplay(ctx), XtWindow(ctx),
- sink->ascii_sink.xorgc, x, y - font->ascent,
- CharWidth(sink, font, 0, ch), fheight + 1);
- else
- XDrawRectangle(XtDisplay(ctx), XtWindow(ctx),
- sink->ascii_sink.xorgc, x, y - font->ascent,
- CharWidth(sink, font, 0, ch) - 1, fheight);
- }
- }
-
- sink->ascii_sink.cursor_x = overflow ? -16384 : x;
- sink->ascii_sink.cursor_y = y;
- sink->ascii_sink.laststate = state;
- sink->ascii_sink.cursor_position = position;
-}
-
-/*
- * Given two positions, find the distance between them
- */
-static void
-FindDistance(Widget w, XawTextPosition fromPos, int fromx,
- XawTextPosition toPos, int *resWidth,
- XawTextPosition *resPos, int *resHeight)
-{
-#ifndef OLDXAW
- AsciiSinkObject sink = (AsciiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- XFontStruct *font = sink->ascii_sink.font;
- Widget source = ctx->text.source;
- XawTextPosition idx, pos;
- unsigned char c;
- XawTextBlock blk;
- int i, rWidth, ascent = 0, descent = 0;
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
- Cardinal length;
- Bool done = False;
-
- pos = idx = fromPos;
- rWidth = 0;
- c = 0;
-
- while (!done) {
- if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) {
- length = anchor->position + entity->offset + entity->length;
- length = XawMin(toPos, length) - pos;
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- else
- font = sink->ascii_sink.font;
- }
- else {
- if (anchor) {
- while (entity && anchor->position + entity->offset < pos)
- entity = entity->next;
- if (entity) {
- length = anchor->position + entity->offset;
- length = XawMin(toPos, length) - pos;
- }
- else
- length = XawMin(toPos - pos, 4096);
- }
- else
- length = XawMin(toPos - pos, 4096);
- font = sink->ascii_sink.font;
- }
-
- ascent = XawMax(font->ascent, ascent);
- descent = XawMax(font->descent, descent);
-
- pos = XawTextSourceRead(source, pos, &blk, length);
- if (blk.length == 0 && pos == idx) /* eof reached */
- break;
-
- idx = blk.firstPos;
- for (i = 0; idx < toPos; i++, idx++) {
- if (i >= blk.length)
- break;
- c = blk.ptr[i];
- rWidth += CharWidth(sink, font, fromx + rWidth, c);
- if (c == XawLF) {
- idx++;
- done = True;
- break;
- }
- }
- if (idx >= toPos)
- break;
- }
-
- *resPos = idx;
- *resWidth = rWidth;
- *resHeight = ascent + descent + 1;
-#else
- AsciiSinkObject sink = (AsciiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- XFontStruct *font = sink->ascii_sink.font;
- Widget source = ctx->text.source;
- XawTextPosition idx, pos;
- unsigned char c;
- XawTextBlock blk;
- int i, rWidth;
-
- pos = XawTextSourceRead(source, fromPos, &blk, toPos - fromPos);
- rWidth = 0;
- for (i = 0, idx = fromPos; idx < toPos; i++, idx++) {
- if (i >= blk.length) {
- i = 0;
- pos = XawTextSourceRead(source, pos, &blk, toPos - pos);
- if (blk.length == 0)
- break;
- }
- c = blk.ptr[i];
- rWidth += CharWidth(sink, font, fromx + rWidth, c);
- if (c == XawLF) {
- idx++;
- break;
- }
- }
-
- *resPos = idx;
- *resWidth = rWidth;
- *resHeight = font->ascent + font->descent + 1;
-#endif
-}
-
-static void
-FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width,
- Bool stopAtWordBreak, XawTextPosition *resPos,
- int *resWidth, int *resHeight)
-{
-#ifndef OLDXAW
- AsciiSinkObject sink = (AsciiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- Widget source = ctx->text.source;
- XFontStruct *font = sink->ascii_sink.font;
- XawTextPosition idx, pos, whiteSpacePosition = 0;
- int i, lastWidth, whiteSpaceWidth, rWidth, ascent = 0, descent = 0;
- Boolean whiteSpaceSeen;
- unsigned char c;
- XawTextBlock blk;
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
- Cardinal length;
- Bool done = False;
-
- pos = idx = fromPos;
- rWidth = lastWidth = whiteSpaceWidth = 0;
- whiteSpaceSeen = False;
- c = 0;
-
- while (!done) {
- font = sink->ascii_sink.font;
- if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) {
- length = anchor->position + entity->offset + entity->length - pos;
- if ((property = XawTextSinkGetProperty((Widget)sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- }
- else {
- if (anchor) {
- while (entity && anchor->position + entity->offset < pos)
- entity = entity->next;
- if (entity)
- length = anchor->position + entity->offset - pos;
- else
- length = 4096;
- }
- else
- length = 4096;
- }
-
- ascent = XawMax(font->ascent, ascent);
- descent = XawMax(font->descent, descent);
-
- pos = XawTextSourceRead(source, pos, &blk, length);
- if (blk.length == 0 && pos == idx) /* eof reached */
- break;
-
- idx = blk.firstPos;
- for (i = 0; rWidth <= width && i < blk.length; i++, idx++) {
- c = blk.ptr[i];
- lastWidth = rWidth;
- rWidth += CharWidth(sink, font, fromx + rWidth, c);
-
- if (c == XawLF) {
- idx++;
- done = True;
- break;
- }
- else if ((c == XawSP || c == XawTAB) && rWidth <= width) {
- whiteSpaceSeen = True;
- whiteSpacePosition = idx;
- whiteSpaceWidth = rWidth;
- }
- }
- if (rWidth > width)
- break;
- }
-
- if (rWidth > width && idx > fromPos) {
- idx--;
- rWidth = lastWidth;
- if (stopAtWordBreak && whiteSpaceSeen) {
- idx = whiteSpacePosition + 1;
- rWidth = whiteSpaceWidth;
- }
- }
-
- if (idx >= ctx->text.lastPos && c != XawLF)
- idx = ctx->text.lastPos + 1;
-
- *resPos = idx;
- *resWidth = rWidth;
- *resHeight = ascent + descent + 1;
-#else
- AsciiSinkObject sink = (AsciiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- Widget source = ctx->text.source;
- XFontStruct *font = sink->ascii_sink.font;
- XawTextPosition idx, pos, whiteSpacePosition = 0;
- int i, lastWidth, whiteSpaceWidth, rWidth;
- Boolean whiteSpaceSeen;
- unsigned char c;
- XawTextBlock blk;
-
- pos = XawTextSourceRead(source, fromPos, &blk, BUFSIZ);
- rWidth = lastWidth = whiteSpaceWidth = 0;
- whiteSpaceSeen = False;
- c = 0;
-
- for (i = 0, idx = fromPos; rWidth <= width; i++, idx++) {
- if (i >= blk.length) {
- i = 0;
- pos = XawTextSourceRead(source, pos, &blk, BUFSIZ);
- if (blk.length == 0)
- break;
- }
- c = blk.ptr[i];
- lastWidth = rWidth;
- rWidth += CharWidth(sink, font, fromx + rWidth, c);
-
- if (c == XawLF) {
- idx++;
- break;
- }
- else if ((c == XawSP || c == XawTAB) && rWidth <= width) {
- whiteSpaceSeen = True;
- whiteSpacePosition = idx;
- whiteSpaceWidth = rWidth;
- }
- }
-
- if (rWidth > width && idx > fromPos) {
- idx--;
- rWidth = lastWidth;
- if (stopAtWordBreak && whiteSpaceSeen) {
- idx = whiteSpacePosition + 1;
- rWidth = whiteSpaceWidth;
- }
- }
-
- if (idx >= ctx->text.lastPos && c != XawLF)
- idx = ctx->text.lastPos + 1;
-
- *resPos = idx;
- *resWidth = rWidth;
- *resHeight = font->ascent + font->descent + 1;
-#endif
-}
-
-static void
-Resolve(Widget w, XawTextPosition pos, int fromx, int width,
- XawTextPosition *pos_return)
-{
- int resWidth, resHeight;
- Widget source = XawTextGetSource(XtParent(w));
-
- FindPosition(w, pos, fromx, width, False, pos_return, &resWidth, &resHeight);
- if (*pos_return > GETLASTPOS)
- *pos_return = GETLASTPOS;
-}
-
-static void
-GetGC(AsciiSinkObject sink)
-{
- XtGCMask valuemask = (GCFont | GCGraphicsExposures | GCClipXOrigin |
- GCForeground | GCBackground);
- XGCValues values;
-
- /* XXX We dont want do share a gc that will change the clip-mask */
- values.clip_x_origin = (int)sink;
- values.clip_mask = None;
- values.font = sink->ascii_sink.font->fid;
- values.graphics_exposures = False;
-
- values.foreground = sink->text_sink.foreground;
- values.background = sink->text_sink.background;
- sink->ascii_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values,
- GCClipMask | GCFont | GCForeground |
- GCBackground, 0);
-
- values.foreground = sink->text_sink.background;
-#ifndef OLDXAW
- values.background = sink->text_sink.cursor_color;
-#else
- values.background = sink->text_sink.foreground;
-#endif
- sink->ascii_sink.invgc = XtAllocateGC((Widget)sink, 0, valuemask, &values,
- GCClipMask | GCFont, 0);
-
- valuemask |= GCFunction;
- values.function = GXxor;
-#ifndef OLDXAW
- values.foreground = sink->text_sink.background ^ sink->text_sink.cursor_color;
-#else
- values.foreground = sink->text_sink.background ^ sink->text_sink.foreground;
-#endif
- values.background = 0L;
- sink->ascii_sink.xorgc = XtAllocateGC((Widget)sink, 0, valuemask,
- &values, GCClipMask | GCFont, 0);
-
- XawAsciiSinkResize((Widget)sink);
-}
-
-/* Function:
- * XawAsciiSinkInitialize
- *
- * Parameters:
- * request - the requested and new values for the object instance
- * cnew - ""
- *
- * Description:
- * Initializes the TextSink Object.
- */
-/*ARGSUSED*/
-static void
-XawAsciiSinkInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- AsciiSinkObject sink = (AsciiSinkObject)cnew;
-
- GetGC(sink);
-
- sink->ascii_sink.cursor_position = 0;
- sink->ascii_sink.laststate = XawisOff;
- sink->ascii_sink.cursor_x = sink->ascii_sink.cursor_y = 0;
-}
-
-/*
- * Function:
- * XawAsciiSinkDestroy
- *
- * Parameters:
- * w - AsciiSink Object
- *
- * Description:
- * This function cleans up when the object is destroyed.
- */
-static void
-XawAsciiSinkDestroy(Widget w)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
-
- XtReleaseGC(w, sink->ascii_sink.normgc);
- XtReleaseGC(w, sink->ascii_sink.invgc);
- XtReleaseGC(w, sink->ascii_sink.xorgc);
-
- sink->ascii_sink.normgc =
- sink->ascii_sink.invgc =
- sink->ascii_sink.xorgc = NULL;
-}
-
-static void
-XawAsciiSinkResize(Widget w)
-{
- TextWidget ctx = (TextWidget)XtParent(w);
- AsciiSinkObject sink = (AsciiSinkObject)w;
- XRectangle rect;
- int width, height;
-
- if (w->core.widget_class != asciiSinkObjectClass)
- return;
-
- rect.x = ctx->text.r_margin.left;
- rect.y = ctx->text.r_margin.top;
- width = (int)XtWidth(ctx) - RHMargins(ctx);
- height = (int)XtHeight(ctx) - RVMargins(ctx);
- rect.width = width;
- rect.height = height;
-
- if (sink->ascii_sink.normgc) {
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), sink->ascii_sink.normgc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), sink->ascii_sink.normgc, None);
- }
- if (sink->ascii_sink.invgc) {
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), sink->ascii_sink.invgc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), sink->ascii_sink.invgc, None);
- }
- if (sink->ascii_sink.xorgc) {
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), sink->ascii_sink.xorgc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), sink->ascii_sink.xorgc, None);
- }
-}
-
-/*
- * Function:
- * XawAsciiSinkSetValues
- *
- * Parameters:
- * current - current state of the object
- * request - what was requested
- * cnew - what the object will become
- *
- * Description:
- * Sets the values for the AsciiSink.
- *
- * Returns:
- * True if redisplay is needed
- */
-/*ARGSUSED*/
-static Boolean
-XawAsciiSinkSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- AsciiSinkObject w = (AsciiSinkObject)cnew;
- AsciiSinkObject old_w = (AsciiSinkObject)current;
-
- if (w->ascii_sink.font != old_w->ascii_sink.font
- || w->text_sink.background != old_w->text_sink.background
- || w->text_sink.foreground != old_w->text_sink.foreground
-#ifndef OLDXAW
- || w->text_sink.cursor_color != old_w->text_sink.cursor_color
- || w->text_sink.properties != old_w->text_sink.properties
-#endif
- ) {
-#ifdef OLDXAW
- XtReleaseGC(cnew, w->ascii_sink.normgc);
- XtReleaseGC(cnew, w->ascii_sink.invgc);
- XtReleaseGC(cnew, w->ascii_sink.xorgc);
- GetGC(w);
-#endif
- ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
- }
- else if (w->ascii_sink.echo != old_w->ascii_sink.echo
- || w->ascii_sink.display_nonprinting
- != old_w->ascii_sink.display_nonprinting)
- ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
-#ifndef OLDXAW
- if (w->text_sink.properties != old_w->text_sink.properties) {
- XawTextProperty *property =
- XawTextSinkGetProperty(cnew, XrmStringToQuark("default"));
-
- if (property) {
- if (property->mask & XAW_TPROP_FONT)
- w->ascii_sink.font = property->font;
- if (property->mask & XAW_TPROP_FOREGROUND)
- w->text_sink.foreground = property->foreground;
- if (property->mask & XAW_TPROP_BACKGROUND)
- w->text_sink.background = property->background;
- }
- }
-#endif
-
- return (False);
-}
-
-/*
- * Function:
- * MaxLines
- *
- * Parameters:
- * w - AsciiSink Object
- * height - height to fit lines into
- *
- * Description:
- * Finds the Maximum number of lines that will fit in a given height.
- *
- * Returns:
- * The number of lines that will fit
- */
-/*ARGSUSED*/
-static int
-MaxLines(Widget w, unsigned int height)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
- int font_height;
-
- font_height = sink->ascii_sink.font->ascent + sink->ascii_sink.font->descent + 1;
-
- return ((int)height / font_height);
-}
-
-/*
- * Function:
- * MaxHeight
- *
- * Parameters:
- * w - AsciiSink Object
- * lines - number of lines
- *
- * Description:
- * Finds the Minium height that will contain a given number lines.
- *
- * Returns:
- * the height
- */
-static int
-MaxHeight(Widget w, int lines)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
-
- return (lines * (sink->ascii_sink.font->ascent +
- sink->ascii_sink.font->descent + 1));
-}
-
-/*
- * Function:
- * SetTabs
- *
- * Parameters:
- * w - AsciiSink Object
- * tab_count - number of tabs in the list
- * tabs - text positions of the tabs
- *
- * Description:
- * Sets the Tab stops.
- */
-static void
-SetTabs(Widget w, int tab_count, short *tabs)
-{
- AsciiSinkObject sink = (AsciiSinkObject)w;
- int i;
- Atom XA_FIGURE_WIDTH;
- unsigned long figure_width = 0;
- XFontStruct *font = sink->ascii_sink.font;
-
- /*
- * Find the figure width of the current font
- */
- XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", False);
- if (XA_FIGURE_WIDTH != None
- && (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)
- || figure_width == 0)) {
- if (font->per_char && font->min_char_or_byte2 <= '$'
- && font->max_char_or_byte2 >= '$')
- figure_width = font->per_char['$' - font->min_char_or_byte2].width;
- else
- figure_width = font->max_bounds.width;
- }
-
- if (tab_count > sink->text_sink.tab_count) {
- sink->text_sink.tabs = (Position *)
- XtRealloc((char*)sink->text_sink.tabs, tab_count * sizeof(Position));
- sink->text_sink.char_tabs = (short *)
- XtRealloc((char*)sink->text_sink.char_tabs, tab_count * sizeof(short));
- }
-
- for (i = 0 ; i < tab_count ; i++) {
- sink->text_sink.tabs[i] = tabs[i] * figure_width;
- sink->text_sink.char_tabs[i] = tabs[i];
- }
-
- sink->text_sink.tab_count = tab_count;
-
-#ifndef NO_TAB_FIX
- {
- TextWidget ctx = (TextWidget)XtParent(w);
- ctx->text.redisplay_needed = True;
- _XawTextBuildLineTable(ctx, ctx->text.lt.top, True);
- }
-#endif
-}
diff --git a/xc/lib/Xaw/AsciiSink.h b/xc/lib/Xaw/AsciiSink.h
deleted file mode 100644
index a25282063..000000000
--- a/xc/lib/Xaw/AsciiSink.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $TOG: AsciiSink.h /main/10 1998/02/06 12:44:13 kaleb $
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiSink.h,v 1.4 1998/10/03 08:41:59 dawes Exp $ */
-
-#ifndef _XawAsciiSink_h
-#define _XawAsciiSink_h
-
-/*
- * AsciiSink Object
- */
-
-#include <X11/Xaw/TextSink.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- echo Output Boolean True
- displayNonprinting Output Boolean True
-
-*/
-
-#define XtCOutput "Output"
-
-#define XtNdisplayNonprinting "displayNonprinting"
-#define XtNecho "echo"
-
-/* Class record constants */
-extern WidgetClass asciiSinkObjectClass;
-
-typedef struct _AsciiSinkClassRec *AsciiSinkObjectClass;
-typedef struct _AsciiSinkRec *AsciiSinkObject;
-
-#endif /* _XawAsciiSink_h */
diff --git a/xc/lib/Xaw/AsciiSinkP.h b/xc/lib/Xaw/AsciiSinkP.h
deleted file mode 100644
index 7bb45bd73..000000000
--- a/xc/lib/Xaw/AsciiSinkP.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-* $TOG: AsciiSinkP.h /main/5 1998/02/06 12:44:02 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiSinkP.h,v 1.8 1999/06/20 08:40:55 dawes Exp $ */
-
-#ifndef _XawAsciiSinkP_h
-#define _XawAsciiSinkP_h
-
-/*
- * AsciiSink Object Private Data
- */
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/AsciiSink.h>
-
-/* New fields for the AsciiSink object class record */
-typedef struct _AsciiSinkClassPart {
- XtPointer extension;
-} AsciiSinkClassPart;
-
-/* Full class record declaration */
-typedef struct _AsciiSinkClassRec {
- ObjectClassPart object_class;
- TextSinkClassPart text_sink_class;
- AsciiSinkClassPart ascii_sink_class;
-} AsciiSinkClassRec;
-
-extern AsciiSinkClassRec asciiSinkClassRec;
-
-/* New fields for the AsciiSink object record */
-typedef struct {
- /* resources */
- XFontStruct *font; /* Font to draw in. */
- Boolean echo;
- Boolean display_nonprinting;
-
- /* private */
- GC normgc, invgc, xorgc;
- XawTextPosition cursor_position;
- XawTextInsertState laststate;
- short cursor_x, cursor_y; /* Cursor Location. */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} AsciiSinkPart;
-
-/* Full instance record declaration */
-typedef struct _AsciiSinkRec {
- ObjectPart object;
- TextSinkPart text_sink;
- AsciiSinkPart ascii_sink;
-} AsciiSinkRec;
-
-#endif /* _XawAsciiSinkP_h */
diff --git a/xc/lib/Xaw/AsciiSrc.c b/xc/lib/Xaw/AsciiSrc.c
deleted file mode 100644
index 242f0e0d6..000000000
--- a/xc/lib/Xaw/AsciiSrc.c
+++ /dev/null
@@ -1,1869 +0,0 @@
-/* $TOG: AsciiSrc.c /main/69 1998/05/14 14:55:34 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.
-
-*/
-
-/* $XFree86: xc/lib/Xaw/AsciiSrc.c,v 1.22 1999/08/28 09:00:25 dawes Exp $ */
-
-/*
- * AsciiSrc.c - AsciiSrc object. (For use with the text widget).
- *
- */
-
-#include <stdio.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#endif
-#include <ctype.h>
-#include <errno.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/XawInit.h>
-#include <X11/Xaw/AsciiSrcP.h>
-#include <X11/Xaw/MultiSrcP.h>
-#ifndef OLDXAW
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/AsciiSinkP.h>
-#endif
-#include "Private.h"
-
-#if (defined(ASCII_STRING) || defined(ASCII_DISK))
-#include <X11/Xaw/AsciiText.h> /* for Widget Classes */
-#endif
-
-#ifdef X_NOT_POSIX
-#define Off_t long
-#define Size_t unsigned int
-#else
-#define Off_t off_t
-#define Size_t size_t
-#endif
-
-#define MAGIC_VALUE ((XawTextPosition)-1)
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
-/*
- * Class Methods
- */
-static void XawAsciiSrcClassInitialize(void);
-static void XawAsciiSrcDestroy(Widget);
-static void XawAsciiSrcGetValuesHook(Widget, ArgList, Cardinal*);
-static void XawAsciiSrcInitialize(Widget, Widget, ArgList, Cardinal*);
-static Boolean XawAsciiSrcSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static XawTextPosition ReadText(Widget, XawTextPosition, XawTextBlock*, int);
-static int ReplaceText(Widget, XawTextPosition, XawTextPosition,
- XawTextBlock*);
-static XawTextPosition Scan(Widget, XawTextPosition, XawTextScanType,
- XawTextScanDirection, int, Bool);
-static XawTextPosition Search(Widget, XawTextPosition, XawTextScanDirection,
- XawTextBlock*);
-
-/*
- * Prototypes
- */
-static Piece *AllocNewPiece(AsciiSrcObject, Piece*);
-static void BreakPiece(AsciiSrcObject, Piece*);
-static Boolean CvtAsciiTypeToString(Display*, XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr, XtPointer*);
-static void CvtStringToAsciiType(XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr);
-static Piece *FindPiece(AsciiSrcObject, XawTextPosition, XawTextPosition*);
-static void FreeAllPieces(AsciiSrcObject);
-static FILE *InitStringOrFile(AsciiSrcObject, Bool);
-static void LoadPieces(AsciiSrcObject, FILE*, char*);
-static void RemoveOldStringOrFile(AsciiSrcObject, Bool);
-static void RemovePiece(AsciiSrcObject, Piece*);
-static String StorePiecesInString(AsciiSrcObject);
-static Bool WriteToFile(String, String, unsigned);
-static Bool WritePiecesToFile(AsciiSrcObject, String);
-static void GetDefaultPieceSize(Widget, int, XrmValue*);
-
-/*
- * More Prototypes
- */
-#ifdef ASCII_DISK
-Widget XawAsciiDiskSourceCreate(Widget, ArgList, Cardinal);
-#endif
-#ifdef ASCII_STRING
-Widget XawStringSourceCreate(Widget, ArgList, Cardinal);
-void XawTextSetLastPos(Widget, XawTextPosition);
-#endif
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(AsciiSrcRec, ascii_src.field)
-static XtResource resources[] = {
- {
- XtNstring,
- XtCString,
- XtRString,
- sizeof(char*),
- offset(string),
- XtRString,
- NULL
- },
- {
- XtNtype,
- XtCType,
- XtRAsciiType,
- sizeof(XawAsciiType),
- offset(type),
- XtRImmediate,
- (XtPointer)XawAsciiString
- },
- {
- XtNdataCompression,
- XtCDataCompression,
- XtRBoolean,
- sizeof(Boolean),
- offset(data_compression),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNpieceSize,
- XtCPieceSize,
- XtRInt,
- sizeof(XawTextPosition),
- offset(piece_size),
- XtRCallProc,
- (XtPointer)GetDefaultPieceSize
- },
-#ifdef OLDXAW
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(callback),
- XtRCallback,
- (XtPointer)NULL
- },
-#endif
- {
- XtNuseStringInPlace,
- XtCUseStringInPlace,
- XtRBoolean,
- sizeof(Boolean),
- offset(use_string_in_place),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNlength,
- XtCLength,
- XtRInt,
- sizeof(int),
- offset(ascii_length),
- XtRImmediate,
- (XtPointer)MAGIC_VALUE
- },
-#ifdef ASCII_DISK
- {
- XtNfile,
- XtCFile,
- XtRString,
- sizeof(String),
- offset(filename),
- XtRString,
- NULL
- },
-#endif /* ASCII_DISK */
-};
-#undef offset
-
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
-#define Superclass (&textSrcClassRec)
-AsciiSrcClassRec asciiSrcClassRec = {
- /* object */
- {
- (WidgetClass)Superclass, /* superclass */
- "AsciiSrc", /* class_name */
- sizeof(AsciiSrcRec), /* widget_size */
- XawAsciiSrcClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawAsciiSrcInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- False, /* compress_exposure */
- False, /* compress_enterleave */
- False, /* visible_interest */
- XawAsciiSrcDestroy, /* destroy */
- NULL, /* resize */
- NULL, /* expose */
- XawAsciiSrcSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* set_values_almost */
- XawAsciiSrcGetValuesHook, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- NULL, /* query_geometry */
- NULL, /* display_accelerator */
- NULL, /* extension */
- },
- /* text_src */
- {
- ReadText, /* Read */
- ReplaceText, /* Replace */
- Scan, /* Scan */
- Search, /* Search */
- XtInheritSetSelection, /* SetSelection */
- XtInheritConvertSelection, /* ConvertSelection */
- },
- /* ascii_src */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass asciiSrcObjectClass = (WidgetClass)&asciiSrcClassRec;
-
-static XrmQuark Qstring, Qfile;
-
-/*
- * Implementation
- */
-/*
- * Function:
- * XawAsciiSrcClassInitialize()
- *
- * Description:
- * Initializes the asciiSrcObjectClass and install the converters for
- * AsciiType <-> String.
- */
-static void
-XawAsciiSrcClassInitialize(void)
-{
- XawInitializeWidgetSet();
- Qstring = XrmPermStringToQuark(XtEstring);
- Qfile = XrmPermStringToQuark(XtEfile);
- XtAddConverter(XtRString, XtRAsciiType, CvtStringToAsciiType, NULL, 0);
- XtSetTypeConverter(XtRAsciiType, XtRString, CvtAsciiTypeToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/*
- * Function:
- * XawAsciiSrcInitialize
- *
- * Parameters:
- * request - widget requested by the argument list
- * cnew - new widget with both resource and non resource values
- * args - (unused)
- * num_args - (unused)
- *
- * Description:
- * Initializes the ascii src object.
- */
-/*ARGSUSED*/
-static void
-XawAsciiSrcInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- AsciiSrcObject src = (AsciiSrcObject)cnew;
- FILE *file;
-
- /*
- * Set correct flags (override resources) depending upon widget class
- */
- src->text_src.text_format = XawFmt8Bit;
-
-#ifdef ASCII_DISK
- if (XtIsSubclass(XtParent(cnew), asciiDiskWidgetClass)) {
- src->ascii_src.type = XawAsciiFile;
- src->ascii_src.string = src->ascii_src.filename;
- }
-#endif
-
-#ifdef ASCII_STRING
- if (XtIsSubclass(XtParent(cnew), asciiStringWidgetClass)) {
- src->ascii_src.use_string_in_place = True;
- src->ascii_src.type = XawAsciiString;
- }
-#endif
-
-#ifdef OLDXAW
- src->ascii_src.changes = False;
-#else
- src->text_src.changed = False;
-#endif
- src->ascii_src.allocated_string = False;
-
- file = InitStringOrFile(src, src->ascii_src.type == XawAsciiFile);
- LoadPieces(src, file, NULL);
-
- if (file != NULL)
- fclose(file);
-}
-
-/*
- * Function:
- * ReadText
- *
- * Parameters:
- * w - AsciiSource widget
- * pos - position of the text to retreive.
- * text - text block that will contain returned text
- * length - maximum number of characters to read
- *
- * Description:
- * This function reads the source.
- *
- * Returns:
- * The number of characters read into the buffer
- */
-static XawTextPosition
-ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
- XawTextPosition count, start;
- Piece *piece;
-#ifndef OLDXAW
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextPosition offset, end = pos + length;
- Bool state;
-
- end = XawMin(end, src->ascii_src.length);
- while ((state = XawTextSourceAnchorAndEntity(w, pos, &anchor, &entity)) &&
- (entity->flags & XAW_TENTF_HIDE) && pos < end)
- pos = anchor->position + entity->offset + entity->length;
- if (state == False && anchor) {
- while (entity) {
- offset = anchor->position + entity->offset;
- if (offset >= end)
- break;
- if (offset > pos &&
- (entity->flags & (XAW_TENTF_HIDE | XAW_TENTF_REPLACE))) {
- end = XawMin(end, offset);
- break;
- }
- if ((entity = entity->next) == NULL &&
- (anchor = XawTextSourceNextAnchor(w, anchor)) != NULL)
- entity = anchor->entities;
- }
- }
- else if (state && (entity->flags & XAW_TENTF_REPLACE) && pos < end) {
- XawTextBlock *block = (XawTextBlock*)entity->data;
-
- offset = anchor->position + entity->offset;
- end = XawMin(end, offset + block->length);
- if ((length = end - pos) < 0)
- length = 0;
- text->length = length;
- text->format = XawFmt8Bit;
- if (length == 0) {
- text->firstPos = end = offset + entity->length;
- text->ptr = "";
- }
- else {
- text->firstPos = pos;
- text->ptr = block->ptr + (pos - offset);
- if (pos + length < offset + block->length)
- end = pos + length; /* there is data left to be read */
- else
- end = offset + entity->length;
- }
-
- return (end);
- }
-
- if ((length = end - pos) < 0)
- length = 0;
-#endif
-
- piece = FindPiece(src, pos, &start);
- text->firstPos = pos;
- text->ptr = piece->text + (pos - start);
- count = piece->used - (pos - start);
- text->length = (length > count) ? count : length;
- text->format = XawFmt8Bit;
-
- return (pos + text->length);
-}
-
-/*
- * Function:
- * ReplaceText
- *
- * Parameters:
- * w - AsciiSource object
- * startPos - ends of text that will be replaced
- * endPos - ""
- * text - new text to be inserted into buffer at startPos
- *
- * Description:
- * Replaces a block of text with new text.
- *
- * Returns:
- * XawEditDone on success, XawEditError otherwise
- */
-/*ARGSUSED*/
-static int
-ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
- XawTextBlock *text)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
- Piece *start_piece, *end_piece, *temp_piece;
- XawTextPosition start_first, end_first;
- int length, firstPos;
-
- /*
- * Editing a read only source is not allowed
- */
- if (src->text_src.edit_mode == XawtextRead)
- return (XawEditError);
-
- start_piece = FindPiece(src, startPos, &start_first);
- end_piece = FindPiece(src, endPos, &end_first);
-
-#ifndef OLDXAW
- /*
- * This is a big hack, but I can't think about a clever way to know
- * if the character being moved forward has a negative lbearing.
- *
- */
- if (start_piece->used) {
- int i;
-
- for (i = 0; i < src->text_src.num_text; i++) {
- int line;
- TextWidget ctx = (TextWidget)src->text_src.text[i];
-
- for (line = 0; line < ctx->text.lt.lines; line++)
- if (startPos < ctx->text.lt.info[line + 1].position)
- break;
- if (i < ctx->text.lt.lines &&
- startPos > ctx->text.lt.info[i].position) {
- AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink;
- XawTextAnchor *anchor;
- XawTextEntity *entity;
- XawTextProperty *property;
- XFontStruct *font;
-
- if (XawTextSourceAnchorAndEntity(w, startPos, &anchor, &entity) &&
- (property = XawTextSinkGetProperty(ctx->text.sink,
- entity->property)) != NULL &&
- (property->mask & XAW_TPROP_FONT))
- font = property->font;
- else
- font = sink->ascii_sink.font;
-
- if (font->min_bounds.lbearing < 0) {
- int lbearing = font->min_bounds.lbearing;
- unsigned char c = *(unsigned char*)
- (start_piece->text + (startPos - start_first));
-
- if (c == '\t' || c == '\n')
- c = ' ';
- else if ((c & 0177) < XawSP || c == 0177) {
- if (sink->ascii_sink.display_nonprinting)
- c = c > 0177 ? '\\' : c + '^';
- else
- c = ' ';
- }
- if (font->per_char &&
- (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2))
- lbearing = font->per_char[c - font->min_char_or_byte2].lbearing;
- if (lbearing < 0)
- _XawTextNeedsUpdating(ctx, startPos - 1, startPos);
- }
- }
- }
- }
-
-
-#endif
-
- /*
- * Remove Old Stuff
- */
- if (start_piece != end_piece) {
- temp_piece = start_piece->next;
-
- /*
- * If empty and not the only piece then remove it.
- */
- if (((start_piece->used = startPos - start_first) == 0)
- && !(start_piece->next == NULL && start_piece->prev == NULL))
- RemovePiece(src, start_piece);
-
- while (temp_piece != end_piece) {
- temp_piece = temp_piece->next;
- RemovePiece(src, temp_piece->prev);
- }
-
- end_piece->used -= endPos - end_first;
- if (end_piece->used != 0)
- memmove(end_piece->text, end_piece->text + endPos - end_first,
- (unsigned)end_piece->used);
- }
- else { /* We are fully in one piece */
- if ((start_piece->used -= endPos - startPos) == 0) {
- if (!(start_piece->next == NULL && start_piece->prev == NULL))
- RemovePiece(src, start_piece);
- }
- else {
- memmove(start_piece->text + (startPos - start_first),
- start_piece->text + (endPos - start_first),
- (unsigned)(start_piece->used - (startPos - start_first)));
- if (src->ascii_src.use_string_in_place
- && src->ascii_src.length - (endPos - startPos)
- < src->ascii_src.piece_size - 1)
- start_piece->text[src->ascii_src.length - (endPos - startPos)] =
- '\0';
- }
- }
-
- src->ascii_src.length += -(endPos - startPos) + text->length;
-
- if ( text->length != 0) {
- /*
- * Put in the New Stuff
- */
- start_piece = FindPiece(src, startPos, &start_first);
-
- length = text->length;
- firstPos = text->firstPos;
-
- while (length > 0) {
- char *ptr;
- int fill;
-
- if (src->ascii_src.use_string_in_place) {
- if (start_piece->used == src->ascii_src.piece_size - 1) {
- /*
- * If we are in ascii string emulation mode. Then the
- * string is not allowed to grow
- */
- start_piece->used = src->ascii_src.length =
- src->ascii_src.piece_size - 1;
- start_piece->text[src->ascii_src.length] = '\0';
- return (XawEditError);
- }
- }
-
- if (start_piece->used == src->ascii_src.piece_size) {
- BreakPiece(src, start_piece);
- start_piece = FindPiece(src, startPos, &start_first);
- }
-
- fill = Min((int)(src->ascii_src.piece_size - start_piece->used),
- length);
-
- ptr = start_piece->text + (startPos - start_first);
- memmove(ptr + fill, ptr,
- (unsigned)(start_piece->used - (startPos - start_first)));
- memcpy(ptr, text->ptr + firstPos, (unsigned)fill);
-
- startPos += fill;
- firstPos += fill;
- start_piece->used += fill;
- length -= fill;
- }
- }
-
- if (src->ascii_src.use_string_in_place)
- start_piece->text[start_piece->used] = '\0';
-
-#ifdef OLDXAW
- src->ascii_src.changes = True;
- XtCallCallbacks(w, XtNcallback, NULL);
-#endif
-
- return (XawEditDone);
-}
-
-/*
- * Function:
- * Scan
- *
- * Parameters:
- * w - AsciiSource object
- * position - position to start scanning
- * type - type of thing to scan for
- * dir - direction to scan
- * count - which occurance if this thing to search for.
- * include - whether or not to include the character found in
- * the position that is returned
- *
- * Description:
- * Scans the text source for the number and type of item specified.
- *
- * Returns:
- * The position of the item found
- *
- * Note:
- * While there are only 'n' characters in the file there are n+1
- * possible cursor positions (one before the first character and
- * one after the last character
- */
-static XawTextPosition
-Scan(Widget w, register XawTextPosition position, XawTextScanType type,
- XawTextScanDirection dir, int count, Bool include)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
- Piece *piece;
- XawTextPosition first, first_eol_position = 0;
- register char *ptr, *lim;
- register int cnt = count;
- register unsigned char c;
-
- if (dir == XawsdLeft) {
- if (position <= 0)
- return (0);
- --position;
- }
- else if (position >= src->ascii_src.length)
- return (src->ascii_src.length);
-
- piece = FindPiece(src, position, &first);
- if (piece->used == 0)
- return (0);
-
- ptr = (position - first) + piece->text;
-
- if (dir == XawsdRight) {
- lim = piece->text + piece->used;
- switch (type) {
- case XawstEOL:
- case XawstParagraph:
- case XawstWhiteSpace:
- case XawstAlphaNumeric:
- for (; cnt > 0; cnt--) {
- Bool non_space = False, first_eol = True;
-
- /*CONSTCOND*/
- while (True) {
- if (ptr >= lim) {
- piece = piece->next;
- if (piece == NULL) /* End of text */
- return (src->ascii_src.length);
- ptr = piece->text;
- lim = piece->text + piece->used;
- }
-
- c = *ptr++;
- ++position;
-
- if (type == XawstEOL) {
- if (c == '\n')
- break;
- }
- else if (type == XawstAlphaNumeric) {
- if (!isalnum(c)) {
- if (non_space)
- break;
- }
- else
- non_space = True;
- }
- else if (type == XawstWhiteSpace) {
- if (isspace(c)) {
- if (non_space)
- break;
- }
- else
- non_space = True;
- }
- else { /* XawstParagraph */
- if (first_eol) {
- if (c == '\n') {
- first_eol_position = position;
- first_eol = False;
- }
- }
- else if (c == '\n')
- break;
- else if (!isspace(c))
- first_eol = True;
- }
- }
- }
- break;
- case XawstPositions:
- position += count;
- return (position < src->ascii_src.length ?
- position : src->ascii_src.length);
- case XawstAll:
- return (src->ascii_src.length);
- default:
- break;
- }
- if (!include) {
- if (type == XawstParagraph)
- position = first_eol_position;
- if (count)
- --position;
- }
- }
- else {
- lim = piece->text;
- switch (type) {
- case XawstEOL:
- case XawstParagraph:
- case XawstWhiteSpace:
- case XawstAlphaNumeric:
- for (; cnt > 0; cnt--) {
- Bool non_space = False, first_eol = True;
-
- /*CONSTCOND*/
- while (True) {
- if (ptr < lim) {
- piece = piece->prev;
- if (piece == NULL) /* Begining of text */
- return (0);
- ptr = piece->text + piece->used - 1;
- lim = piece->text;
- }
-
- c = *ptr--;
- --position;
-
- if (type == XawstEOL) {
- if (c == '\n')
- break;
- }
- else if (type == XawstAlphaNumeric) {
- if (!isalnum(c)) {
- if (non_space)
- break;
- }
- else
- non_space = True;
- }
- else if (type == XawstWhiteSpace) {
- if (isspace(c)) {
- if (non_space)
- break;
- }
- else
- non_space = True;
- }
- else { /* XawstParagraph */
- if (first_eol) {
- if (c == '\n') {
- first_eol_position = position;
- first_eol = False;
- }
- }
- else if (c == '\n')
- break;
- else if (!isspace(c))
- first_eol = True;
- }
- }
- }
- break;
- case XawstPositions:
- position -= count - 1;
- return (position > 0 ? position : 0);
- case XawstAll:
- return (0);
- default:
- break;
- }
- if (!include) {
- if (type == XawstParagraph)
- position = first_eol_position;
- if (count)
- ++position;
- }
- position++;
- }
-
- return (position);
-}
-
-/*
- * Function:
- * Search
- *
- * Parameters:
- * w - AsciiSource object
- * position - the position to start scanning
- * dir - direction to scan
- * text - text block to search for
- *
- * Description:
- * Searchs the text source for the text block passed.
- *
- * Returns:
- * The position of the item found
- */
-static XawTextPosition
-Search(Widget w, register XawTextPosition position, XawTextScanDirection dir,
- XawTextBlock *text)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
- register int count = 0;
- register char *ptr, c;
- char *str;
- Piece *piece;
- char *buf;
- XawTextPosition first;
- int cnt, case_sensitive;
-
- if (dir == XawsdLeft) {
- if (position == 0)
- return (XawTextSearchError);
- position--;
- }
-
- buf = XtMalloc((unsigned)sizeof(unsigned char) * text->length);
- memcpy(buf, text->ptr, (unsigned)text->length);
- piece = FindPiece(src, position, &first);
- ptr = (position - first) + piece->text;
- case_sensitive = text->firstPos;
-
- if (dir == XawsdRight) {
- str = buf;
- c = *str;
- /*CONSTCOND*/
- while (1) {
- if (*ptr++ == c
- || (case_sensitive && isalpha(c) && isalpha(ptr[-1])
- && toupper(c) == toupper(ptr[-1]))) {
- if (++count == text->length)
- break;
- c = *++str;
- }
- else if (count) {
- ptr -= count;
- str -= count;
- position -= count;
- count = 0;
- c = *str;
-
- if (ptr < piece->text) {
- do {
- cnt = piece->text - ptr;
- piece = piece->prev;
- if (piece == NULL) {
- XtFree(buf);
- return (XawTextSearchError);
- }
- ptr = piece->text + piece->used - cnt;
- } while (ptr < piece->text);
- }
- }
- position++;
- if (ptr >= (piece->text + piece->used)) {
- do {
- cnt = ptr - (piece->text + piece->used);
- piece = piece->next;
- if (piece == NULL) {
- XtFree(buf);
- return (XawTextSearchError);
- }
- ptr = piece->text + cnt;
- } while (ptr >= (piece->text + piece->used));
- }
- }
-
- position -= text->length - 1;
- }
- else {
- str = buf + text->length - 1;
- c = *str;
- /*CONSTCOND*/
- while (1) {
- if (*ptr-- == c
- || (case_sensitive && isalpha(c) && isalpha(ptr[1])
- && toupper(c) == toupper(ptr[1]))) {
- if (++count == text->length)
- break;
- c = *--str;
- }
- else if (count) {
- ptr += count;
- str += count;
- position += count;
- count = 0;
- c = *str;
-
- if (ptr >= (piece->text + piece->used)) {
- do {
- cnt = ptr - (piece->text + piece->used);
- piece = piece->next;
- if (piece == NULL) {
- XtFree(buf);
- return (XawTextSearchError);
- }
- ptr = piece->text + cnt;
- } while (ptr >= (piece->text + piece->used));
- }
- }
- position--;
- if (ptr < piece->text) {
- do {
- cnt = piece->text - ptr;
- piece = piece->prev;
- if (piece == NULL) {
- XtFree(buf);
- return (XawTextSearchError);
- }
- ptr = piece->text + piece->used - cnt;
- } while (ptr < piece->text);
- }
- }
- }
-
- XtFree(buf);
-
- return (position);
-}
-
-/*
- * Function:
- * XawAsciiSrcSetValues
- *
- * Parameters:
- * current - current state of the widget
- * request - what was requested
- * cnew - what the widget will become
- * args - representation of changed resources
- * num_args - number of resources that have changed
- *
- * Description:
- * Sets the values for the AsciiSource.
- *
- * Returns:
- * True if redisplay is needed
- */
-static Boolean
-XawAsciiSrcSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- AsciiSrcObject src = (AsciiSrcObject)cnew;
- AsciiSrcObject old_src = (AsciiSrcObject)current;
- Bool total_reset = False, string_set = False;
- FILE *file;
- unsigned int i;
-
- if (old_src->ascii_src.use_string_in_place
- != src->ascii_src.use_string_in_place) {
- XtAppWarning(XtWidgetToApplicationContext(cnew),
- "AsciiSrc: The XtNuseStringInPlace resource may "
- "not be changed.");
- src->ascii_src.use_string_in_place =
- old_src->ascii_src.use_string_in_place;
- }
-
- for (i = 0; i < *num_args ; i++)
- if (streq(args[i].name, XtNstring)) {
- string_set = True;
- break;
- }
-
- if (string_set || (old_src->ascii_src.type != src->ascii_src.type)) {
- RemoveOldStringOrFile(old_src, string_set); /* remove old info */
- file = InitStringOrFile(src, string_set); /* Init new info */
- LoadPieces(src, file, NULL); /* load new info into internal buffers */
- if (file != NULL)
- fclose(file);
-#ifndef OLDXAW
- for (i = 0; i < src->text_src.num_text; i++)
- /* Tell text widget what happened */
- XawTextSetSource(src->text_src.text[i], cnew, 0);
-#else
- XawTextSetSource(XtParent(cnew), cnew, 0);
-#endif
- total_reset = True;
- }
-
- if (old_src->ascii_src.ascii_length != src->ascii_src.ascii_length)
- src->ascii_src.piece_size = src->ascii_src.ascii_length + 1;
-
- if (!total_reset &&
- old_src->ascii_src.piece_size != src->ascii_src.piece_size) {
- String string = StorePiecesInString(old_src);
-
- FreeAllPieces(old_src);
- LoadPieces(src, NULL, string);
- XtFree(string);
- }
-
- return (False);
-}
-
-/*
- * Function:
- * XawAsciiSrcGetValuesHook
- *
- * Parameters:
- * w - AsciiSource Widget
- * args - argument list
- * num_args - number of args
- *
- * Description:
- * This is a get values hook routine that sets the
- * values specific to the ascii source.
- */
-static void
-XawAsciiSrcGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
- unsigned int i;
-
- if (src->ascii_src.type == XawAsciiString) {
- for (i = 0; i < *num_args ; i++)
- if (streq(args[i].name, XtNstring)) {
- if (src->ascii_src.use_string_in_place)
- *((char **)args[i].value) = src->ascii_src.first_piece->text;
- else if (XawAsciiSave(w)) /* If save sucessful */
- *((char **)args[i].value) = src->ascii_src.string;
- break;
- }
- }
- }
-
-/*
- * Function:
- * XawAsciiSrcDestroy
- *
- * Parameters:
- * src - Ascii source object to free
- *
- * Description:
- * Destroys an ascii source (frees all data)
- */
-static void
-XawAsciiSrcDestroy(Widget w)
-{
- RemoveOldStringOrFile((AsciiSrcObject) w, True);
-}
-
-/*
- * Public routines
- */
-/*
- * Function:
- * XawAsciiSourceFreeString
- *
- * Parameters:
- * w - AsciiSrc widget
- *
- * Description:
- * Frees the string returned by a get values call
- * on the string when the source is of type string.
- */
-void
-XawAsciiSourceFreeString(Widget w)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
-
- /* If the src is really a multi, call the multi routine */
- if (XtIsSubclass(w, multiSrcObjectClass)) {
- _XawMultiSourceFreeString(w);
- return;
- }
- else if (!XtIsSubclass(w, asciiSrcObjectClass)) {
- XtErrorMsg("bad argument", "asciiSource", "XawError",
- "XawAsciiSourceFreeString's parameter must be "
- "an asciiSrc or multiSrc.",
- NULL, NULL);
- }
-
- if (src->ascii_src.allocated_string && src->ascii_src.type != XawAsciiFile) {
- src->ascii_src.allocated_string = False;
- XtFree(src->ascii_src.string);
- src->ascii_src.string = NULL;
- }
-}
-
-/*
- * Function:
- * XawAsciiSave
- *
- * Parameters:
- * w - asciiSrc Widget
- *
- * Description:
- * Saves all the pieces into a file or string as required.
- *
- * Returns:
- * True if the save was successful
- */
-Bool
-XawAsciiSave(Widget w)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
-
- /* If the src is really a multi, call the multi save */
- if (XtIsSubclass(w, multiSrcObjectClass ))
- return (_XawMultiSave(w));
-
- else if (!XtIsSubclass(w, asciiSrcObjectClass))
- XtErrorMsg("bad argument", "asciiSource", "XawError",
- "XawAsciiSave's parameter must be an asciiSrc or multiSrc.",
- NULL, NULL);
-
- /*
- * If using the string in place then there is no need to play games
- * to get the internal info into a readable string.
- */
- if (src->ascii_src.use_string_in_place)
- return (True);
-
- if (src->ascii_src.type == XawAsciiFile) {
-#ifdef OLDXAW
- if (!src->ascii_src.changes)
-#else
- if (!src->text_src.changed) /* No changes to save */
-#endif
- return (True);
-
- if (WritePiecesToFile(src, src->ascii_src.string) == False)
- return (False);
- }
- else {
- if (src->ascii_src.allocated_string == True)
- XtFree(src->ascii_src.string);
- else
- src->ascii_src.allocated_string = True;
-
- src->ascii_src.string = StorePiecesInString(src);
- }
-#ifdef OLDXAW
- src->ascii_src.changes = False;
-#else
- src->text_src.changed = False;
-#endif
-
- return (True);
-}
-
-/*
- * Function:
- * XawAsciiSaveAsFile
- *
- * Arguments:
- * w - AsciiSrc widget
- * name - name of the file to save this file into
- *
- * Description:
- * Save the current buffer as a file.
- *
- * Returns:
- * True if the save was sucessful
- */
-Bool
-XawAsciiSaveAsFile(Widget w, _Xconst char *name)
-{
- AsciiSrcObject src = (AsciiSrcObject)w;
- Bool ret;
-
- /* If the src is really a multi, call the multi save */
-
- if (XtIsSubclass( w, multiSrcObjectClass))
- return (_XawMultiSaveAsFile(w, name));
-
- else if (!XtIsSubclass(w, asciiSrcObjectClass))
- XtErrorMsg("bad argument", "asciiSource", "XawError",
- "XawAsciiSaveAsFile's 1st parameter must be an "
- "asciiSrc or multiSrc.",
- NULL, NULL);
-
- if (src->ascii_src.type == XawAsciiFile)
- ret = WritePiecesToFile(src, (String)name);
- else {
- String string = StorePiecesInString(src);
-
- ret = WriteToFile(string, (String)name, src->ascii_src.length);
- XtFree(string);
- }
-
- return (ret);
-}
-
-/*
- * Function:
- * XawAsciiSourceChanged
- *
- * Parameters:
- * w - ascii source widget
- *
- * Description:
- * Returns true if the source has changed since last saved.
- *
- * Returns:
- * A Boolean (see description).
- */
-Bool
-XawAsciiSourceChanged(Widget w)
-{
-#ifdef OLDXAW
- if (XtIsSubclass(w, multiSrcObjectClass))
- return (((MultiSrcObject)w)->multi_src.changes);
-
- if (XtIsSubclass(w, asciiSrcObjectClass))
- return (((AsciiSrcObject)w)->ascii_src.changes);
-#else
- if (XtIsSubclass(w, textSrcObjectClass))
- return (((TextSrcObject)w)->textSrc.changed);
-#endif
- XtErrorMsg("bad argument", "asciiSource", "XawError",
- "XawAsciiSourceChanged parameter must be an "
- "asciiSrc or multiSrc.",
- NULL, NULL);
-
- return (True);
-}
-
-/*
- * Private Functions
- */
-static void
-RemoveOldStringOrFile(AsciiSrcObject src, Bool checkString)
-{
- FreeAllPieces(src);
-
- if (checkString && src->ascii_src.allocated_string) {
- XtFree(src->ascii_src.string);
- src->ascii_src.allocated_string = False;
- src->ascii_src.string = NULL;
- }
-}
-
-/*
- * Function:
- * WriteToFile
- *
- * Parameters:
- * string - string to write
- * name - the name of the file
- *
- * Description:
- * Write the string specified to the begining of the file specified.
- *
- * Returns:
- * returns True if sucessful, False otherwise
- */
-static Bool
-WriteToFile(String string, String name, unsigned length)
-{
- int fd;
-
- if ((fd = creat(name, 0666)) == -1
- || write(fd, string, length) == -1)
- return (False);
-
- if (close(fd) == -1)
- return (False);
-
- return (True);
-}
-
-/*
- * Function:
- * WritePiecesToFile
- *
- * Parameters:
- * src - ascii source object
- * name - name of the file
- *
- * Description:
- * Almost identical to WriteToFile, but only works for ascii src objects
- * of type XawAsciiFile. This function avoids allocating temporary memory,
- * what can be useful when editing very large files.
- *
- * Returns:
- * returns True if sucessful, False otherwise
- */
-static Bool
-WritePiecesToFile(AsciiSrcObject src, String name)
-{
- Piece *piece;
- int fd;
-
- if (src->ascii_src.data_compression) {
- Piece *tmp;
-
- piece = src->ascii_src.first_piece;
- while (piece) {
- int bytes = src->ascii_src.piece_size - piece->used;
-
- if (bytes > 0 && (tmp = piece->next) != NULL) {
- bytes = XawMin(bytes, tmp->used);
- memcpy(piece->text + piece->used, tmp->text, bytes);
- memmove(tmp->text, tmp->text + bytes, tmp->used - bytes);
- piece->used += bytes;
- if ((tmp->used -= bytes) == 0) {
- RemovePiece(src, tmp);
- continue;
- }
- }
- piece = piece->next;
- }
- }
-
- if ((fd = creat(name, 0666)) == -1)
- return (False);
-
- for (piece = src->ascii_src.first_piece; piece; piece = piece->next)
- if (write(fd, piece->text, piece->used) == -1)
- return (False);
-
- if (close(fd) == -1)
- return (False);
-
- return (True);
-}
-
-/*
- * Function:
- * StorePiecesInString
- *
- * Parameters:
- * data - ascii pointer data
- *
- * Description:
- * Store the pieces in memory into a standard ascii string.
- */
-static String
-StorePiecesInString(AsciiSrcObject src)
-{
- String string;
- XawTextPosition first;
- Piece *piece;
-
- string = XtMalloc((unsigned)(src->ascii_src.length + 1));
-
- for (first = 0, piece = src->ascii_src.first_piece ; piece != NULL;
- first += piece->used, piece = piece->next)
- memcpy(string + first, piece->text, (unsigned)piece->used);
-
- string[src->ascii_src.length] = '\0';
-
- /*
- * This will refill all pieces to capacity
- */
- if (src->ascii_src.data_compression) {
- FreeAllPieces(src);
- LoadPieces(src, NULL, string);
- }
-
- return (string);
-}
-
-/*
- * Function:
- * InitStringOrFile
- *
- * Parameters:
- * src - AsciiSource
- *
- * Description:
- * Initializes the string or file.
- */
-static FILE *
-InitStringOrFile(AsciiSrcObject src, Bool newString)
-{
- char *open_mode = NULL;
- FILE *file;
- char fileName[TMPSIZ];
-
- if (src->ascii_src.type == XawAsciiString) {
- if (src->ascii_src.string == NULL)
- src->ascii_src.length = 0;
-
- else if (!src->ascii_src.use_string_in_place) {
- src->ascii_src.string = XtNewString(src->ascii_src.string);
- src->ascii_src.allocated_string = True;
- src->ascii_src.length = strlen(src->ascii_src.string);
- }
-
- if (src->ascii_src.use_string_in_place) {
- src->ascii_src.length = strlen(src->ascii_src.string);
- /* In case the length resource is incorrectly set */
- if (src->ascii_src.length > src->ascii_src.ascii_length)
- src->ascii_src.ascii_length = src->ascii_src.length;
-
- if (src->ascii_src.ascii_length == MAGIC_VALUE)
- src->ascii_src.piece_size = src->ascii_src.length;
- else
- src->ascii_src.piece_size = src->ascii_src.ascii_length + 1;
- }
-
- return (NULL);
- }
-
- /*
- * type is XawAsciiFile
- */
- src->ascii_src.is_tempfile = False;
-
- switch (src->text_src.edit_mode) {
- case XawtextRead:
- if (src->ascii_src.string == NULL)
- XtErrorMsg("NoFile", "asciiSourceCreate", "XawError",
- "Creating a read only disk widget and no file specified.",
- NULL, 0);
- open_mode = "r";
- break;
- case XawtextAppend:
- case XawtextEdit:
- if (src->ascii_src.string == NULL) {
- src->ascii_src.string = fileName;
- (void)tmpnam(src->ascii_src.string);
- src->ascii_src.is_tempfile = True;
- open_mode = "w";
- }
- else
- open_mode = "r+";
- break;
- default:
- XtErrorMsg("badMode", "asciiSourceCreate", "XawError",
- "Bad editMode for ascii source; must be Read, "
- "Append or Edit.",
- NULL, NULL);
- }
-
- /* Allocate new memory for the temp filename, because it is held in
- * a stack variable, not static memory. This widget does not need
- * to keep the private state field is_tempfile -- it is only accessed
- * in this routine, and its former setting is unused
- */
- if (newString || src->ascii_src.is_tempfile) {
- src->ascii_src.string = XtNewString(src->ascii_src.string);
- src->ascii_src.allocated_string = True;
- }
-
- if (!src->ascii_src.is_tempfile) {
- if ((file = fopen(src->ascii_src.string, open_mode)) != 0) {
- (void)fseek(file, 0, 2);
- src->ascii_src.length = (XawTextPosition)ftell(file);
- return (file);
- }
- else {
- String params[2];
- Cardinal num_params = 2;
-
- params[0] = src->ascii_src.string;
- params[1] = strerror(errno);
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src),
- "openError", "asciiSourceCreate", "XawWarning",
- "Cannot open file %s; %s", params, &num_params);
- }
- }
- src->ascii_src.length = 0;
- return (NULL);
-}
-
-static void
-LoadPieces(AsciiSrcObject src, FILE *file, char *string)
-{
- char *ptr;
- Piece *piece = NULL;
- XawTextPosition left;
-
- if (string == NULL) {
- if (src->ascii_src.type == XawAsciiFile) {
- if (src->ascii_src.length != 0) {
- int len;
-
- left = 0;
- fseek(file, 0, 0);
- while (left < src->ascii_src.length) {
- ptr = XtMalloc((unsigned)src->ascii_src.piece_size);
- if ((len = fread(ptr, (Size_t)sizeof(unsigned char),
- (Size_t)src->ascii_src.piece_size, file)) < 0)
- XtErrorMsg("readError", "asciiSourceCreate", "XawError",
- "fread returned error.", NULL, NULL);
- piece = AllocNewPiece(src, piece);
- piece->text = ptr;
- piece->used = XawMin(len, src->ascii_src.piece_size);
- left += piece->used;
- }
- }
- else {
- piece = AllocNewPiece(src, NULL);
- piece->text = XtMalloc((unsigned)src->ascii_src.piece_size);
- piece->used = 0;
- }
- return;
- }
- else
- string = src->ascii_src.string;
- }
-
- if (src->ascii_src.use_string_in_place) {
- piece = AllocNewPiece(src, piece);
- piece->used = XawMin(src->ascii_src.length, src->ascii_src.piece_size);
- piece->text = src->ascii_src.string;
- return;
- }
-
- ptr = string;
- left = src->ascii_src.length;
- do {
- piece = AllocNewPiece(src, piece);
-
- piece->text = XtMalloc((unsigned)src->ascii_src.piece_size);
- piece->used = XawMin(left, src->ascii_src.piece_size);
- if (piece->used != 0)
- memcpy(piece->text, ptr, (unsigned)piece->used);
-
- left -= piece->used;
- ptr += piece->used;
- } while (left > 0);
-}
-
-/*
- * Function:
- * AllocNewPiece
- *
- * Parameters:
- * src - AsciiSrc Widget
- * prev - piece just before this one, or NULL
- *
- * Description:
- * Allocates a new piece of memory.
- *
- * Returns:
- * The allocated piece
- */
-static Piece *
-AllocNewPiece(AsciiSrcObject src, Piece *prev)
-{
- Piece *piece = XtNew(Piece);
-
- if (prev == NULL) {
- src->ascii_src.first_piece = piece;
- piece->next = NULL;
- }
- else {
- if (prev->next != NULL)
- (prev->next)->prev = piece;
- piece->next = prev->next;
- prev->next = piece;
- }
-
- piece->prev = prev;
-
- return (piece);
-}
-
-/*
- * Function:
- * FreeAllPieces
- *
- * Parameters:
- * src - AsciiSrc Widget
- *
- * Description:
- * Frees all the pieces.
- */
-static void
-FreeAllPieces(AsciiSrcObject src)
-{
- Piece *next, * first = src->ascii_src.first_piece;
-
-#ifdef DEBUG
- if (first->prev != NULL)
- printf("Xaw AsciiSrc Object: possible memory leak in FreeAllPieces().\n");
-#endif
-
- for (; first != NULL ; first = next) {
- next = first->next;
- RemovePiece(src, first);
- }
-}
-
-/*
- * Function:
- * RemovePiece
- *
- * Parameters:
- * piece - piece to remove
- *
- * Description:
- * Removes a piece from the list.
- */
-static void
-RemovePiece(AsciiSrcObject src, Piece *piece)
-{
- if (piece->prev == NULL)
- src->ascii_src.first_piece = piece->next;
- else
- piece->prev->next = piece->next;
-
- if (piece->next != NULL)
- piece->next->prev = piece->prev;
-
- if (!src->ascii_src.use_string_in_place)
- XtFree(piece->text);
-
- XtFree((char *)piece);
-}
-
-/*
- * Function:
- * FindPiece
- *
- * Parameters:
- * src - AsciiSrc Widget
- * position - position that we are searching for
- * first - position of the first character in this piece (return)
- *
- * Description:
- * Finds the piece containing the position indicated.
- *
- * Returns:
- * the piece that contains this position
- */
-static Piece *
-FindPiece(AsciiSrcObject src, XawTextPosition position, XawTextPosition *first)
-{
- Piece *old_piece, *piece;
- XawTextPosition temp;
-
- for (old_piece = NULL, piece = src->ascii_src.first_piece, temp = 0;
- piece; old_piece = piece, piece = piece->next)
- if ((temp += piece->used) > position) {
- *first = temp - piece->used;
- return (piece);
- }
-
- *first = temp - (old_piece ? old_piece->used : 0);
-
- return (old_piece); /* if we run off the end the return the last piece */
-}
-
-/*
- * Function:
- * BreakPiece
- *
- * Parameters:
- * src - AsciiSrc Widget
- * piece - piece to break
- *
- * Description:
- * Breaks a full piece into two new pieces.
- */
-#define HALF_PIECE (src->ascii_src.piece_size >> 1)
-static void
-BreakPiece(AsciiSrcObject src, Piece *piece)
-{
- Piece *cnew = AllocNewPiece(src, piece);
-
- cnew->text = XtMalloc((unsigned)src->ascii_src.piece_size);
- memcpy(cnew->text, piece->text + HALF_PIECE,
- (unsigned)(src->ascii_src.piece_size - HALF_PIECE));
- piece->used = HALF_PIECE;
- cnew->used = src->ascii_src.piece_size - HALF_PIECE;
-}
-
-/*ARGSUSED*/
-static void
-CvtStringToAsciiType(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XawAsciiType type;
- XrmQuark q;
- char name[7];
-
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- if (q == Qstring)
- type = XawAsciiString;
- else if (q == Qfile)
- type = XawAsciiFile;
- else {
- toVal->size = 0;
- toVal->addr = NULL;
- XtStringConversionWarning((char *)fromVal->addr, XtRAsciiType);
- }
-
- toVal->size = sizeof(XawAsciiType);
- toVal->addr = (XPointer)&type;
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtAsciiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(XawAsciiType *)fromVal->addr) {
- case XawAsciiFile:
- buffer = XtEfile;
- break;
- case XawAsciiString:
- buffer = XtEstring;
- break;
- default:
- XawTypeToStringWarning(dpy, XtRAsciiType);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-/*ARGSUSED*/
-static void
-GetDefaultPieceSize(Widget w, int offset, XrmValue *value)
-{
- static int pagesize;
-
- if (pagesize == 0) {
- pagesize = _XawGetPageSize();
- if (pagesize < BUFSIZ)
- pagesize = BUFSIZ;
- }
-
- value->addr = (XtPointer)&pagesize;
-}
-
-#if (defined(ASCII_STRING) || defined(ASCII_DISK))
-# include <X11/Xaw/Cardinals.h>
-#endif
-
-#ifdef ASCII_STRING
-/*
- * Compatability functions.
- */
-/*
- * Function:
- * AsciiStringSourceCreate
- *
- * Parameters:
- * parent - widget that will own this source
- * args - the argument list
- * num_args - ""
- *
- * Description:
- * Creates a string source.
- *
- * Returns:
- * A pointer to the new text source.
- */
-Widget
-XawStringSourceCreate(Widget parent, ArgList args, Cardinal num_args)
-{
- XawTextSource src;
- ArgList ascii_args;
- Arg temp[2];
-
- XtSetArg(temp[0], XtNtype, XawAsciiString);
- XtSetArg(temp[1], XtNuseStringInPlace, True);
- ascii_args = XtMergeArgLists(temp, TWO, args, num_args);
-
- src = XtCreateWidget("genericAsciiString", asciiSrcObjectClass, parent,
- ascii_args, num_args + TWO);
- XtFree((char *)ascii_args);
-
- return (src);
-}
-
-/*
- * This is hacked up to try to emulate old functionality, it
- * may not work, as I have not old code to test it on.
- *
- * Chris D. Peterson 8/31/89.
- */
-void
-XawTextSetLastPos(Widget w, XawTextPosition lastPos)
-{
- AsciiSrcObject src = (AsciiSrcObject)XawTextGetSource(w);
-
- src->ascii_src.piece_size = lastPos;
-}
-#endif /* ASCII_STRING */
-
-#ifdef ASCII_DISK
-/*
- * Function:
- * AsciiDiskSourceCreate
- *
- * Parameters:
- * parent - widget that will own this source
- * args - argument list
- * num_args - ""
- *
- * Description:
- * Creates a disk source.
- *
- * Returns:
- * A pointer to the new text source
- */
-Widget
-XawDiskSourceCreate(Widget parent, ArgList args, Cardinal num_args)
-{
- XawTextSource src;
- ArgList ascii_args;
- Arg temp[1];
- int i;
-
- XtSetArg(temp[0], XtNtype, XawAsciiFile);
- ascii_args = XtMergeArgLists(temp, ONE, args, num_args);
- num_args++;
-
- for (i = 0; i < num_args; i++)
- if (streq(ascii_args[i].name, XtNfile)
- || streq(ascii_args[i].name, XtCFile))
- ascii_args[i].name = XtNstring;
-
- src = XtCreateWidget("genericAsciiDisk", asciiSrcObjectClass, parent,
- ascii_args, num_args);
- XtFree((char *)ascii_args);
-
- return (src);
-}
-#endif /* ASCII_DISK */
diff --git a/xc/lib/Xaw/AsciiSrc.h b/xc/lib/Xaw/AsciiSrc.h
deleted file mode 100644
index e4d11e60f..000000000
--- a/xc/lib/Xaw/AsciiSrc.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* $TOG: AsciiSrc.h /main/17 1998/02/11 14:53:05 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.
-
-*/
-/* $XFree86: xc/lib/Xaw/AsciiSrc.h,v 1.6 1999/05/09 10:51:36 dawes Exp $ */
-
-
-/*
- * AsciiSrc.h - Public Header file for Ascii Text Source.
- *
- * This is the public header file for the Ascii Text Source.
- * It is intended to be used with the Text widget, the simplest way to use
- * this text source is to use the AsciiText Object.
- *
- * Date: June 29, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-
-#ifndef _XawAsciiSrc_h
-#define _XawAsciiSrc_h
-
-#include <X11/Xaw/TextSrc.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- dataCompression DataCompression Boolean True
- length Length int (internal)
- pieceSize PieceSize int BUFSIZ
- string String String NULL
- type Type XawAsciiType XawAsciiString
- useStringInPlace UseStringInPlace Boolean False
-
-*/
-
-extern WidgetClass asciiSrcObjectClass;
-
-typedef struct _AsciiSrcClassRec *AsciiSrcObjectClass;
-typedef struct _AsciiSrcRec *AsciiSrcObject;
-
-#define AsciiSourceObjectClass AsciiSrcObjectClass
-#define AsciiSourceObject AsciiSrcObject
-
-/*
- * Resource Definitions
- */
-#define XtCDataCompression "DataCompression"
-#define XtCPieceSize "PieceSize"
-#define XtCType "Type"
-#define XtCUseStringInPlace "UseStringInPlace"
-
-#define XtNdataCompression "dataCompression"
-#define XtNpieceSize "pieceSize"
-#define XtNtype "type"
-#define XtNuseStringInPlace "useStringInPlace"
-
-#define XtRAsciiType "AsciiType"
-
-#define XtEstring "string"
-#define XtEfile "file"
-
-typedef enum {
- XawAsciiFile,
- XawAsciiString
-} XawAsciiType;
-
-/*
- * Public routines
- */
-
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawAsciiSourceFreeString
- *
- * Parameters:
- * w - AsciiSrc object
- *
- * Description:
- * Frees the string returned by a get values call
- * on the string when the source is of type string.
- */
-void XawAsciiSourceFreeString
-(
- Widget w
- );
-
-/*
- * Function:
- * XawAsciiSave
- *
- * Arguments:
- * w - asciiSrc Object.
- *
- * Description:
- * Saves all the pieces into a file or string as required.
- *
- * Returns:
- * True if the save was successful
- */
-Bool XawAsciiSave
-(
- Widget w
- );
-
-/*
- * Function:
- * XawAsciiSaveAsFile
- *
- * Parameters:
- * w - asciiSrc object
- * name - name of the file to save this file into
- *
- * Description:
- * Save the current buffer as a file.
- *
- * Returns:
- * True if the save was successful
- */
-Bool XawAsciiSaveAsFile
-(
- Widget w,
- _Xconst char *name
- );
-
-/*
- * Function:
- * XawAsciiSourceChanged
- *
- * Parameters:
- * w - asciiSource object
- *
- * Description:
- * Returns true if the source has changed since last saved.
- *
- * Returns:
- * a Boolean (see description)
- */
-Bool XawAsciiSourceChanged
-(
- Widget w
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawAsciiSrc_h */
diff --git a/xc/lib/Xaw/AsciiSrcP.h b/xc/lib/Xaw/AsciiSrcP.h
deleted file mode 100644
index 4513eb4b5..000000000
--- a/xc/lib/Xaw/AsciiSrcP.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-* $TOG: AsciiSrcP.h /main/13 1998/06/24 11:53:13 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiSrcP.h,v 1.7 1999/06/20 08:40:57 dawes Exp $ */
-
-/*
- * AsciiSrcP.h - Private Header for Ascii Text Source.
- *
- * This is the private header file for the Ascii Text Source.
- * It is intended to be used with the Text widget, the simplest way to use
- * this text source is to use the AsciiText Object.
- *
- * Date: June 29, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _XawAsciiSrcP_h
-#define _XawAsciiSrcP_h
-
-#include <X11/Xaw/TextSrcP.h>
-#include <X11/Xaw/AsciiSrc.h>
-
-#ifdef L_tmpnam
-#define TMPSIZ L_tmpnam
-#else
-#ifdef PATH_MAX
-#define TMPSIZ PATH_MAX
-#else
-#define TMPSIZ 1024 /* bytes to allocate for tmpnam */
-#endif
-#endif
-
-typedef struct _Piece { /* Piece of the text file of BUFSIZ allocated
- characters */
- char *text; /* The text in this buffer */
- XawTextPosition used; /* The number of characters of this buffer
- that have been used */
- struct _Piece *prev, *next; /* linked list pointers */
-} Piece;
-
-typedef struct _AsciiSrcClassPart {
- XtPointer extension;
-} AsciiSrcClassPart;
-
-/* Full class record */
-typedef struct _AsciiSrcClassRec {
- ObjectClassPart object_class;
- TextSrcClassPart text_src_class;
- AsciiSrcClassPart ascii_src_class;
-} AsciiSrcClassRec;
-
-extern AsciiSrcClassRec asciiSrcClassRec;
-
-/* New fields for the AsciiSrc object */
-typedef struct _AsciiSrcPart {
- /* resources */
- char *string; /* either the string, or the
- file name, depending upon the type */
- XawAsciiType type; /* either string or disk */
- XawTextPosition piece_size; /* Size of text buffer for each piece */
- Boolean data_compression; /* compress to minimum memory automatically
- on save? */
-#ifdef OLDXAW
- XtCallbackList callback;
-#endif
- Boolean use_string_in_place;/* Use the string passed in place */
- int ascii_length; /* length field for ascii string emulation */
-
-#ifdef ASCII_DISK
- String filename; /* name of file for Compatability */
-#endif /* ASCII_DISK */
-
- /* private */
- Boolean is_tempfile; /* Is this a temporary file? */
-#ifdef OLDXAW
- Boolean changes;
-#endif
- Boolean allocated_string; /* Have I allocated the
- string in ascii_src->string? */
- XawTextPosition length; /* length of file */
- Piece *first_piece; /* first piece of the text */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} AsciiSrcPart;
-
-/* instance record */
-typedef struct _AsciiSrcRec {
- ObjectPart object;
- TextSrcPart text_src;
- AsciiSrcPart ascii_src;
-} AsciiSrcRec;
-
-#endif /* _XawAsciiSrcP_h */
diff --git a/xc/lib/Xaw/AsciiText.c b/xc/lib/Xaw/AsciiText.c
deleted file mode 100644
index f4d6d52bb..000000000
--- a/xc/lib/Xaw/AsciiText.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/* $TOG: AsciiText.c /main/49 1998/02/11 14:53:14 kaleb $ */
-
-/*
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiText.c,v 3.8 1999/06/13 13:47:15 dawes Exp $ */
-
-/*
- * AsciiText.c - Source code for AsciiText Widget
- *
- * This Widget is intended to be used as a simple front end to the
- * text widget with an ascii source and ascii sink attached to it
- *
- * Date: June 29, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/AsciiTextP.h>
-#include <X11/Xaw/AsciiSrcP.h>
-#include <X11/Xaw/AsciiSink.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/MultiSinkP.h>
-#include <X11/Xaw/MultiSrc.h>
-#include <X11/Xaw/XawImP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define TAB_COUNT 32
-
-/*
- * Class Methods
- */
-static void XawAsciiInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawAsciiDestroy(Widget);
-
-/*
- * From TextSrc.c
- */
-void _XawSourceAddText(Widget, Widget);
-void _XawSourceRemoveText(Widget, Widget, Bool);
-
-#define Superclass (&textClassRec)
-AsciiTextClassRec asciiTextClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Text", /* class_name */
- sizeof(AsciiRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- XawAsciiInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- NULL, /* resources */
- 0, /* num_resource */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- XtExposeGraphicsExpose | /* compress_exposure */
- XtExposeNoExpose,
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawAsciiDestroy, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- XtInheritAcceptFocus, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- XtInheritTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* text */
- {
- NULL, /* extension */
- },
- /* ascii */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec;
-
-#ifdef ASCII_STRING
-AsciiStringClassRec asciiStringClassRec = {
- /* core */
- {
- (WidgetClass)&asciiTextClassRec, /* superclass */
- "Text", /* class_name */
- sizeof(AsciiStringRec), /* widget_size */
- NULL, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- NULL, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- NULL, /* resources */
- 0, /* num_resource */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- XtExposeGraphicsExpose | /* compress_exposure */
- XtExposeNoExpose,
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- XtInheritAcceptFocus, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- XtInheritTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* text */
- {
- NULL, /* extension */
- },
- /* ascii */
- {
- NULL, /* extension */
- },
- /* string */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec;
-#endif /* ASCII_STRING */
-
-#ifdef ASCII_DISK
-AsciiDiskClassRec asciiDiskClassRec = {
- /* core */
- {
- (WidgetClass)&asciiTextClassRec, /* superclass */
- "Text", /* class_name */
- sizeof(AsciiDiskRec), /* widget_size */
- NULL, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- NULL, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- NULL, /* resources */
- 0, /* num_resource */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- XtExposeGraphicsExpose | /* compress_enterleave */
- XtExposeNoExpose,
- False, /* visible_interest */
- NULL, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- XtInheritAcceptFocus, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- XtInheritTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* text */
- {
- NULL, /* extension */
- },
- /* ascii */
- {
- NULL, /* extension */
- },
- /* disk */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec;
-#endif /* ASCII_DISK */
-
-/*
- * Implementation
- */
-static void
-XawAsciiInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- AsciiWidget w = (AsciiWidget)cnew;
- int i;
- int tabs[TAB_COUNT], tab;
-
- MultiSinkObject sink;
-
- /* superclass Initialize can't set the following,
- * as it didn't know the source or sink when it was called
- */
- if (XtHeight(request) == DEFAULT_TEXT_HEIGHT)
- XtHeight(cnew) = DEFAULT_TEXT_HEIGHT;
-
- /* This is the main change for internationalization */
- if (w->simple.international == True) { /* The multi* are international */
- if (w->text.sink == NULL)
- w->text.sink = XtCreateWidget("textSink", multiSinkObjectClass,
- cnew, args, *num_args);
- else if (!XtIsSubclass(w->text.sink, multiSinkObjectClass))
- XtError("Sink object is not a subclass of multiSink");
-
- if (w->text.source == NULL)
- w->text.source = XtCreateWidget("textSource", multiSrcObjectClass,
- cnew, args, *num_args);
- else if (!XtIsSubclass(w->text.source, multiSrcObjectClass))
- XtError("Source object is not a subclass of multiSrc");
-#ifndef OLDXAW
- else
- _XawSourceAddText(w->text.source, cnew);
-#endif
- }
- else {
- if (w->text.sink == NULL)
- w->text.sink = XtCreateWidget("textSink", asciiSinkObjectClass,
- cnew, args, *num_args);
- else if (!XtIsSubclass(w->text.source, asciiSinkObjectClass))
- XtError("Sink object is not a subclass of asciiSink");
-
- if (w->text.source == NULL)
- w->text.source = XtCreateWidget("textSource", asciiSrcObjectClass,
- cnew, args, *num_args);
- else if (!XtIsSubclass(w->text.source, asciiSrcObjectClass))
- XtError("Source object is not a subclass of asciiSrc");
-#ifndef OLDXAW
- else
- _XawSourceAddText(w->text.source, cnew);
-#endif
- }
-
- if (XtHeight(w) == DEFAULT_TEXT_HEIGHT)
- XtHeight(w) = VMargins(w) + XawTextSinkMaxHeight(w->text.sink, 1);
-
- for (i = 0, tab = 0; i < TAB_COUNT; i++)
- tabs[i] = (tab += 8);
-
- XawTextSinkSetTabs(w->text.sink, TAB_COUNT, tabs);
-
- XawTextDisableRedisplay(cnew);
- XawTextEnableRedisplay(cnew);
-
- _XawImRegister(cnew);
-
- /* If we are using a MultiSink we need to tell the input method stuff */
- if (w->simple.international == True) {
- Arg list[4];
- Cardinal ac = 0;
-
- sink = (MultiSinkObject)w->text.sink;
- XtSetArg(list[ac], XtNfontSet, sink->multi_sink.fontset); ac++;
- XtSetArg(list[ac], XtNinsertPosition, w->text.insertPos); ac++;
- XtSetArg(list[ac], XtNforeground, sink->text_sink.foreground); ac++;
- XtSetArg(list[ac], XtNbackground, sink->text_sink.background); ac++;
- _XawImSetValues(cnew, list, ac);
- }
-}
-
-static void
-XawAsciiDestroy(Widget w)
-{
- AsciiWidget ascii = (AsciiWidget)w;
-
- _XawImUnregister(w);
-
- if (w == XtParent(ascii->text.sink))
- XtDestroyWidget(ascii->text.sink);
-
-#ifdef OLDXAW
- if (w == XtParent(ascii->text.source))
- XtDestroyWidget(ascii->text.source);
-#else
- _XawSourceRemoveText(ascii->text.source, w,
- ascii->text.source &&
- w == XtParent(ascii->text.source));
-#endif
-}
diff --git a/xc/lib/Xaw/AsciiText.h b/xc/lib/Xaw/AsciiText.h
deleted file mode 100644
index 3772b0f10..000000000
--- a/xc/lib/Xaw/AsciiText.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * $TOG: AsciiText.h /main/20 1998/02/11 14:53:18 kaleb $
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiText.h,v 1.4 1998/10/03 08:42:01 dawes Exp $ */
-
-/*
- * AsciiText.h - Public header file for AsciiText Widget
- *
- * This Widget is intended to be used as a simple front end to the
- * text widget with an ascii source and ascii sink attached to it
- *
- * Date: June 29, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-#ifndef _AsciiText_h
-#define _AsciiText_h
-
-#include <X11/Xaw/Text.h>
-#include <X11/Xaw/AsciiSrc.h>
-#include <X11/Xaw/MultiSrc.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- autoFill AutoFill Boolean False
- background Background Pixel XtDefaultBackground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- bottomMargin Margin Position 2
- cursor Cursor Cursor xterm
- destroyCallback Callback Pointer NULL
- displayCaret Output Boolean True
- displayPosition TextPosition int 0
- editType EditType XawTextEditType XawtextRead
- font Font XFontStruct* Fixed
- foreground Foreground Pixel Black
- height Height Dimension font height
- insertPosition TextPosition int 0
- international International Boolean false
- leftMargin Margin Position 2
- mappedWhenManaged MappedWhenManaged Boolean True
- resize Resize XawTextResizeMode XawtextResizeNever
- rightMargin Margin Position 4
- scrollHorizontal Scroll XawTextScrollMode XawtextScrollNever
- scrollVertical Scroll XawTextScrollMode XawtextScrollNever
- selectTypes SelectTypes Pointer pos/word/line/par/all
- selection Selection Pointer (empty selection)
- sensitive Sensitive Boolean True
- sink TextSink Widget (none)
- source TextSource Widget (none)
- string String String NULL
- topMargin Margin Position 2
- width Width Dimension 100
- wrap Wrap XawTextWrapMode XawtextWrapNever
- x Position Position 0
- y Position Position 0
-
- (see also *Src.h and *Sink.h)
-*/
-
-typedef struct _AsciiTextClassRec *AsciiTextWidgetClass;
-typedef struct _AsciiRec *AsciiWidget;
-
-extern WidgetClass asciiTextWidgetClass;
-
-/*
- * Disk and String Emulation Info
- */
-#ifdef ASCII_STRING
-extern WidgetClass asciiStringWidgetClass;
-#endif
-
-#ifdef ASCII_DISK
-extern WidgetClass asciiDiskWidgetClass;
-#endif
-
-#endif /* _AsciiText_h */
diff --git a/xc/lib/Xaw/AsciiTextP.h b/xc/lib/Xaw/AsciiTextP.h
deleted file mode 100644
index 806dfe640..000000000
--- a/xc/lib/Xaw/AsciiTextP.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * $TOG: AsciiTextP.h /main/19 1998/02/11 14:53:10 kaleb $
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/AsciiTextP.h,v 1.7 1999/06/20 08:40:57 dawes Exp $ */
-
-/*
- * AsciiText.c - Private header file for AsciiText Widget.
- *
- * This Widget is intended to be used as a simple front end to the
- * text widget with an ascii source and ascii sink attached to it.
- *
- * Date: June 29, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _AsciiTextP_h
-#define _AsciiTextP_h
-
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/AsciiSrc.h>
-#include <X11/Xaw/MultiSrc.h>
-
-typedef struct {
- XtPointer extension;
-} AsciiClassPart;
-
-typedef struct _AsciiTextClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- TextClassPart text_class;
- AsciiClassPart ascii_class;
-} AsciiTextClassRec;
-
-extern AsciiTextClassRec asciiTextClassRec;
-
-typedef struct {
- int resource;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} AsciiPart;
-
-typedef struct _AsciiRec {
- CorePart core;
- SimplePart simple;
- TextPart text;
- AsciiPart ascii;
-} AsciiRec;
-
-/*
- * Ascii String Emulation widget
- */
-#ifdef ASCII_STRING
-typedef struct {
- XtPointer extension;
-} AsciiStringClassPart;
-
-typedef struct _AsciiStringClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- TextClassPart text_class;
- AsciiClassPart ascii_class;
- AsciiStringClassPart string_class;
-} AsciiStringClassRec;
-
-extern AsciiStringClassRec asciiStringClassRec;
-
-typedef struct {
- int resource;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} AsciiStringPart;
-
-typedef struct _AsciiStringRec {
- CorePart core;
- SimplePart simple;
- TextPart text;
- AsciiPart ascii;
- AsciiStringPart ascii_str;
-} AsciiStringRec;
-#endif /* ASCII_STRING */
-
-#ifdef ASCII_DISK
-/*
- * Ascii Disk Emulation widget
- */
-typedef struct {
- XtPointer extension;
-} AsciiDiskClassPart;
-
-typedef struct _AsciiDiskClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- TextClassPart text_class;
- AsciiClassPart ascii_class;
- AsciiDiskClassPart disk_class;
-} AsciiDiskClassRec;
-
-extern AsciiDiskClassRec asciiDiskClassRec;
-
-typedef struct {
- char resource;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} AsciiDiskPart;
-
-typedef struct _AsciiDiskRec {
- CorePart core;
- SimplePart simple;
- TextPart text;
- AsciiPart ascii;
- AsciiDiskPart ascii_disk;
-} AsciiDiskRec;
-#endif /* ASCII_DISK */
-
-#endif /* _AsciiTextP_h */
diff --git a/xc/lib/Xaw/Box.c b/xc/lib/Xaw/Box.c
deleted file mode 100644
index 1ff4c1734..000000000
--- a/xc/lib/Xaw/Box.c
+++ /dev/null
@@ -1,668 +0,0 @@
-/* $TOG: Box.c /main/50 1998/02/06 12:44:59 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Box.c,v 1.13 1999/06/06 08:47:53 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/BoxP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static void XawBoxChangeManaged(Widget);
-static void XawBoxClassInitialize(void);
-#ifndef OLDXAW
-static void XawBoxExpose(Widget, XEvent*, Region);
-#endif
-static XtGeometryResult XawBoxGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawBoxInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawBoxQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawBoxRealize(Widget, Mask*, XSetWindowAttributes*);
-static void XawBoxResize(Widget);
-static Boolean XawBoxSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void DoLayout(BoxWidget, unsigned int, unsigned int,
- Dimension*, Dimension*, Bool);
-static Bool TryNewLayout(BoxWidget);
-
-/*
- * Initialization
- */
-#ifndef OLDXAW
-static XtActionsRec actions[] = {
- {"set-values", XawSetValuesAction},
- {"get-values", XawGetValuesAction},
- {"declare", XawDeclareAction},
- {"call-proc", XawCallProcAction},
-};
-#endif
-
-static XtResource resources[] = {
- {
- XtNhSpace,
- XtCHSpace,
- XtRDimension,
- sizeof(Dimension),
- XtOffsetOf(BoxRec, box.h_space),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNvSpace,
- XtCVSpace,
- XtRDimension,
- sizeof(Dimension),
- XtOffsetOf(BoxRec, box.v_space),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNorientation,
- XtCOrientation,
- XtROrientation,
- sizeof(XtOrientation),
- XtOffsetOf(BoxRec, box.orientation),
- XtRImmediate,
- (XtPointer)XtorientVertical
- },
-#ifndef OLDXAW
- {
- XawNdisplayList,
- XawCDisplayList,
- XawRDisplayList,
- sizeof(XawDisplayList*),
- XtOffsetOf(BoxRec, box.display_list),
- XtRImmediate,
- NULL
- },
-#endif
-};
-
-BoxClassRec boxClassRec = {
- /* core */
- {
- (WidgetClass)&compositeClassRec, /* superclass */
- "Box", /* class_name */
- sizeof(BoxRec), /* widget_size */
- XawBoxClassInitialize, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- XawBoxInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawBoxRealize, /* realize */
-#ifndef OLDXAW
- actions, /* actions */
- XtNumber(actions), /* num_actions */
-#else
- NULL, /* actions */
- 0, /* num_actions */
-#endif
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XawBoxResize, /* resize */
-#ifndef OLDXAW
- XawBoxExpose, /* expose */
-#else
- NULL, /* expose */
-#endif
- XawBoxSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XawBoxQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XawBoxGeometryManager, /* geometry_manager */
- XawBoxChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- /* box */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec;
-
-/*
- * Do a layout, either actually assigning positions, or just calculating size.
- * Returns minimum width and height that will preserve the same layout.
- */
-static void
-DoLayout(BoxWidget bbw, unsigned int width, unsigned int height,
- Dimension *reply_width, Dimension *reply_height, Bool position)
-{
- Boolean vbox = (bbw->box.orientation == XtorientVertical);
- Cardinal i;
- Dimension w, h; /* Width and height needed for box */
- Dimension lw, lh; /* Width and height needed for current line */
- Dimension bw, bh; /* Width and height needed for current widget */
- Dimension h_space; /* Local copy of bbw->box.h_space */
- Widget widget; /* Current widget */
- unsigned int num_mapped_children = 0;
-
- /* Box width and height */
- h_space = bbw->box.h_space;
-
- w = 0;
- for (i = 0; i < bbw->composite.num_children; i++) {
- if (XtIsManaged(bbw->composite.children[i])
- && bbw->composite.children[i]->core.width > w)
- w = bbw->composite.children[i]->core.width;
- }
- w += h_space;
- if (w > width)
- width = w;
- h = bbw->box.v_space;
-
- /* Line width and height */
- lh = 0;
- lw = h_space;
-
- for (i = 0; i < bbw->composite.num_children; i++) {
- widget = bbw->composite.children[i];
- if (widget->core.managed) {
- if (widget->core.mapped_when_managed)
- num_mapped_children++;
- /* Compute widget width */
- bw = XtWidth(widget) + (XtBorderWidth(widget)<<1) + h_space;
- if ((Dimension)(lw + bw) > width) {
- if (lw > h_space) {
- /* At least one widget on this line, and
- * can't fit any more. Start new line if vbox
- */
- AssignMax(w, lw);
- if (vbox) {
- h += lh + bbw->box.v_space;
- lh = 0;
- lw = h_space;
- }
- }
- else if (!position) {
- /* too narrow for this widget; we'll assume we can grow */
- DoLayout(bbw, (unsigned)(lw + bw), height, reply_width,
- reply_height, position);
- return;
- }
- }
- if (position && (lw != XtX(widget) || h != XtY(widget))) {
- /* It would be nice to use window gravity, but there isn't
- * sufficient fine-grain control to nicely handle all
- * situations (e.g. when only the height changes --
- * a common case). Explicit unmapping is a cheap hack
- * to speed things up & avoid the visual jitter as
- * things slide around.
- *
- * %%% perhaps there should be a client resource to
- * control this. If so, we'll have to optimize to
- * perform the moves from the correct end so we don't
- * force extra exposures as children occlude each other.
- */
- if (XtIsRealized(widget) && widget->core.mapped_when_managed)
- XUnmapWindow( XtDisplay(widget), XtWindow(widget));
- XtMoveWidget(widget, (int)lw, (int)h);
- }
- lw += bw;
- bh = XtHeight(widget) + (XtBorderWidth(widget) << 1);
- AssignMax(lh, bh);
- }
- }
-
- if (!vbox && width && lw > width && lh < height) {
- /* reduce width if too wide and height not filled */
- Dimension sw = lw, sh = lh;
- Dimension width_needed = width;
- XtOrientation orientation = bbw->box.orientation;
-
- bbw->box.orientation = XtorientVertical;
- while (sh < height && sw > width) {
- width_needed = sw;
- DoLayout(bbw, (unsigned)(sw-1), height, &sw, &sh, False);
- }
- if (sh < height)
- width_needed = sw;
- if (width_needed != lw) {
- DoLayout(bbw, width_needed, height,
- reply_width, reply_height, position);
- bbw->box.orientation = orientation;
- return;
- }
- bbw->box.orientation = orientation;
- }
- if (vbox && (width < w || width < lw)) {
- AssignMax(w, lw);
- DoLayout(bbw, w, height, reply_width, reply_height, position);
- return;
- }
- if (position && XtIsRealized((Widget)bbw)) {
- if (bbw->composite.num_children == num_mapped_children)
- XMapSubwindows(XtDisplay((Widget)bbw), XtWindow((Widget)bbw));
- else {
- int ii = bbw->composite.num_children;
- Widget *childP = bbw->composite.children;
-
- for (; ii > 0; childP++, ii--)
- if (XtIsRealized(*childP) && XtIsManaged(*childP)
- && (*childP)->core.mapped_when_managed)
- XtMapWidget(*childP);
- }
- }
-
- /* Finish off last line */
- if (lw > h_space) {
- AssignMax(w, lw);
- h += lh + bbw->box.v_space;
- }
-
- *reply_width = Max(w, 1);
- *reply_height = Max(h, 1);
-}
-
-/*
- * Calculate preferred size, given constraining box, caching it in the widget
- */
-static XtGeometryResult
-XawBoxQueryGeometry(Widget widget, XtWidgetGeometry *constraint,
- XtWidgetGeometry *preferred)
-{
- BoxWidget w = (BoxWidget)widget;
- Dimension width;
- Dimension preferred_width = w->box.preferred_width;
- Dimension preferred_height = w->box.preferred_height;
-
- constraint->request_mode &= CWWidth | CWHeight;
-
- if (constraint->request_mode == 0)
- /* parent isn't going to change w or h, so nothing to re-compute */
- return (XtGeometryYes);
-
- if (constraint->request_mode == w->box.last_query_mode
- && (!(constraint->request_mode & CWWidth)
- || constraint->width == w->box.last_query_width)
- && (!(constraint->request_mode & CWHeight)
- || constraint->height == w->box.last_query_height)) {
- /* same query; current preferences are still valid */
- preferred->request_mode = CWWidth | CWHeight;
- preferred->width = preferred_width;
- preferred->height = preferred_height;
- if (constraint->request_mode == (CWWidth | CWHeight)
- && constraint->width == preferred_width
- && constraint->height == preferred_height)
- return (XtGeometryYes);
- else
- return (XtGeometryAlmost);
- }
-
- /* else gotta do it the long way...
- I have a preference for tall and narrow, so if my width is
- constrained, I'll accept it; otherwise, I'll compute the minimum
- width that will fit me within the height constraint */
-
- w->box.last_query_mode = constraint->request_mode;
- w->box.last_query_width = constraint->width;
- w->box.last_query_height= constraint->height;
-
- if (constraint->request_mode & CWWidth)
- width = constraint->width;
- else { /* if (constraint->request_mode & CWHeight) */
- /* let's see if I can become any narrower */
- width = 0;
- constraint->width = 65535;
- }
-
- /* height is currently ignored by DoLayout.
- height = (constraint->request_mode & CWHeight) ? constraint->height
- : *preferred_height;
- */
- DoLayout(w, width, 0, &preferred_width, &preferred_height, False);
-
- if (constraint->request_mode & CWHeight
- && preferred_height > constraint->height) {
- /* find minimum width for this height */
- if (preferred_width <= constraint->width) {
- width = preferred_width;
- do { /* find some width big enough to stay within this height */
- width <<= 1;
- if (width > constraint->width)
- width = constraint->width;
- DoLayout(w, width, 0, &preferred_width, &preferred_height, False);
- } while (preferred_height > constraint->height
- && width < constraint->width);
- if (width != constraint->width) {
- do { /* find minimum width */
- width = preferred_width;
- DoLayout(w, (unsigned)(preferred_width - 1), 0,
- &preferred_width, &preferred_height, False);
- } while (preferred_height < constraint->height);
- /* one last time */
- DoLayout(w, width, 0, &preferred_width, &preferred_height, False);
- }
- }
- }
-
- preferred->request_mode = CWWidth | CWHeight;
- preferred->width = w->box.preferred_width = preferred_width;
- preferred->height = w->box.preferred_height = preferred_height;
-
- if (constraint->request_mode == (CWWidth|CWHeight)
- && constraint->width == preferred_width
- && constraint->height == preferred_height)
- return (XtGeometryYes);
-
- return (XtGeometryAlmost);
-}
-
-/*
- * Actually layout the box
- */
-static void
-XawBoxResize(Widget w)
-{
- Dimension tmp;
-
- DoLayout((BoxWidget)w, XtWidth(w), XtHeight(w), &tmp, &tmp, True);
-}
-
-/*
- * Try to do a new layout within the current width and height;
- * if that fails try to resize and do it within the box returne
- * by XawBoxQueryGeometry
- *
- * TryNewLayout just says if it's possible, and doesn't actually move the kids
- */
-static Bool
-TryNewLayout(BoxWidget bbw)
-{
- Dimension preferred_width, preferred_height;
- Dimension proposed_width, proposed_height;
- int iterations;
-
- DoLayout(bbw, bbw->core.width, bbw->core.height,
- &preferred_width, &preferred_height, False);
-
- /* at this point, preferred_width is guaranteed to not be greater
- than bbw->core.width unless some child is larger, so there's no
- point in re-computing another layout */
-
- if (XtWidth(bbw) == preferred_width && XtHeight(bbw) == preferred_height)
- return (True);
-
- /* let's see if our parent will go for a new size */
- iterations = 0;
- proposed_width = preferred_width;
- proposed_height = preferred_height;
- do {
- switch (XtMakeResizeRequest((Widget)bbw,proposed_width,proposed_height,
- &proposed_width, &proposed_height)) {
- case XtGeometryYes:
- return (True);
- case XtGeometryNo:
- if (iterations > 0)
- /* protect from malicious parents who change their minds */
- DoLayout(bbw, bbw->core.width, bbw->core.height,
- &preferred_width, &preferred_height, False);
- if (preferred_width <= XtWidth(bbw)
- && preferred_height <= XtHeight(bbw))
- return (True);
- else
- return (False);
- case XtGeometryAlmost:
- if (proposed_height >= preferred_height &&
- proposed_width >= preferred_width) {
- /*
- * Take it, and assume the parent knows what it is doing.
- *
- * The parent must accept this since it was returned in
- * almost.
- */
- (void)XtMakeResizeRequest((Widget)bbw,
- proposed_width, proposed_height,
- &proposed_width, &proposed_height);
- return (True);
- }
- else if (proposed_width != preferred_width) {
- /* recalc bounding box; height might change */
- DoLayout(bbw, proposed_width, 0,
- &preferred_width, &preferred_height, False);
- proposed_height = preferred_height;
- }
- else { /* proposed_height != preferred_height */
- XtWidgetGeometry constraints, reply;
-
- constraints.request_mode = CWHeight;
- constraints.height = proposed_height;
- (void)XawBoxQueryGeometry((Widget)bbw, &constraints, &reply);
- proposed_width = preferred_width;
- }
- /*FALLTHROUGH*/
- default:
- break;
- }
- iterations++;
- } while (iterations < 10);
-
- return (False);
-}
-
-/*
- * Geometry Manager
- *
- * 'reply' is unused; we say only yeay or nay, never almost.
- */
-/*ARGSUSED*/
-static XtGeometryResult
-XawBoxGeometryManager(Widget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- Dimension width, height, borderWidth;
- BoxWidget bbw;
-
- /* Position request always denied */
- if (((request->request_mode & CWX) && request->x != XtX(w))
- || ((request->request_mode & CWY) && request->y != XtY(w)))
- return (XtGeometryNo);
-
- /* Size changes must see if the new size can be accomodated */
- if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth)) {
- /* Make all three fields in the request valid */
- if ((request->request_mode & CWWidth) == 0)
- request->width = XtWidth(w);
- if ((request->request_mode & CWHeight) == 0)
- request->height = XtHeight(w);
- if ((request->request_mode & CWBorderWidth) == 0)
- request->border_width = XtBorderWidth(w);
-
- /* Save current size and set to new size */
- width = XtWidth(w);
- height = XtHeight(w);
- borderWidth = XtBorderWidth(w);
- XtWidth(w) = request->width;
- XtHeight(w) = request->height;
- XtBorderWidth(w) = request->border_width;
-
- /* Decide if new layout works:
- (1) new widget is smaller,
- (2) new widget fits in existing Box,
- (3) Box can be expanded to allow new widget to fit
- */
-
- bbw = (BoxWidget) w->core.parent;
-
- if (TryNewLayout(bbw)) {
- /* Fits in existing or new space, relayout */
- (*XtClass((Widget)bbw)->core_class.resize)((Widget)bbw);
- return (XtGeometryYes);
- }
- else {
- /* Cannot satisfy request, change back to original geometry */
- XtWidth(w) = width;
- XtHeight(w) = height;
- XtBorderWidth(w) = borderWidth;
- return (XtGeometryNo);
- }
- }
-
- /* Any stacking changes don't make a difference, so allow if that's all */
- return (XtGeometryYes);
-}
-
-static void
-XawBoxChangeManaged(Widget w)
-{
- /* Reconfigure the box */
- (void)TryNewLayout((BoxWidget)w);
- XawBoxResize(w);
-}
-
-static void
-XawBoxClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation,
- NULL, 0);
- XtSetTypeConverter(XtROrientation, XtRString, XmuCvtOrientationToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/*ARGSUSED*/
-static void
-XawBoxInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- BoxWidget newbbw = (BoxWidget)cnew;
-
- newbbw->box.last_query_mode = CWWidth | CWHeight;
- newbbw->box.last_query_width = newbbw->box.last_query_height = 0;
- newbbw->box.preferred_width = Max(newbbw->box.h_space, 1);
- newbbw->box.preferred_height = Max(newbbw->box.v_space, 1);
-
- if (XtWidth(newbbw) == 0)
- XtWidth(newbbw) = newbbw->box.preferred_width;
-
- if (XtHeight(newbbw) == 0)
- XtHeight(newbbw) = newbbw->box.preferred_height;
-}
-
-static void
-XawBoxRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
-{
-#ifndef OLDXAW
- XawPixmap *pixmap;
-#endif
-
- XtCreateWindow(w, InputOutput, (Visual *)CopyFromParent,
- *valueMask, attributes);
-
-#ifndef OLDXAW
- if (w->core.background_pixmap > XtUnspecifiedPixmap) {
- pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
- w->core.colormap, w->core.depth);
- if (pixmap && pixmap->mask)
- XawReshapeWidget(w, pixmap);
- }
-#endif
-}
-
-/*ARGSUSED*/
-static Boolean
-XawBoxSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- /* need to relayout if h_space or v_space change */
-#ifndef OLDXAW
- BoxWidget b_old = (BoxWidget)current;
- BoxWidget b_new = (BoxWidget)cnew;
-
- if (b_old->core.background_pixmap != b_new->core.background_pixmap) {
- XawPixmap *opix, *npix;
-
- opix = XawPixmapFromXPixmap(b_old->core.background_pixmap,
- XtScreen(b_old), b_old->core.colormap,
- b_old->core.depth);
- npix = XawPixmapFromXPixmap(b_new->core.background_pixmap,
- XtScreen(b_new), b_new->core.colormap,
- b_new->core.depth);
- if ((npix && npix->mask) || (opix && opix->mask))
- XawReshapeWidget(cnew, npix);
- }
-#endif /* OLDXAW */
-
- return (False);
-}
-
-#ifndef OLDXAW
-static void
-XawBoxExpose(Widget w, XEvent *event, Region region)
-{
- BoxWidget xaw = (BoxWidget)w;
-
- if (xaw->box.display_list)
- XawRunDisplayList(w, xaw->box.display_list, event, region);
-}
-#endif /* OLDXAW */
diff --git a/xc/lib/Xaw/Box.h b/xc/lib/Xaw/Box.h
deleted file mode 100644
index baaf140c6..000000000
--- a/xc/lib/Xaw/Box.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-* $TOG: Box.h /main/23 1998/02/06 12:45:05 kaleb $
-*/
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/Box.h,v 1.6 1999/06/06 08:47:53 dawes Exp $ */
-
-#ifndef _XawBox_h
-#define _XawBox_h
-
-#include <X11/Xmu/Converters.h>
-
-/*
- * Box Widget (subclass of CompositeClass)
- */
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- destroyCallback Callback Pointer NULL
- displayList DisplayList XawDisplayList* NULL
- hSpace HSpace Dimension 4
- height Height Dimension 0
- mappedWhenManaged MappedWhenManaged Boolean True
- orientation Orientation XtOrientation vertical
- vSpace VSpace Dimension 4
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-#ifndef _XtStringDefs_h_
-#define XtNhSpace "hSpace"
-#define XtNvSpace "vSpace"
-#endif
-
-#ifndef OLDXAW
-#ifndef XawNdisplayList
-#define XawNdisplayList "displayList"
-#endif
-
-#ifndef XawCDisplayList
-#define XawCDisplayList "DisplayList"
-#endif
-
-#ifndef XawRDisplayList
-#define XawRDisplayList "XawDisplayList"
-#endif
-#endif /* OLDXAW */
-
-/* Class record constants */
-extern WidgetClass boxWidgetClass;
-
-typedef struct _BoxClassRec *BoxWidgetClass;
-typedef struct _BoxRec *BoxWidget;
-
-#endif /* _XawBox_h */
diff --git a/xc/lib/Xaw/BoxP.h b/xc/lib/Xaw/BoxP.h
deleted file mode 100644
index 479b71237..000000000
--- a/xc/lib/Xaw/BoxP.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-* $TOG: BoxP.h /main/19 1998/02/06 12:44:53 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/BoxP.h,v 1.9 1999/06/20 08:40:57 dawes Exp $ */
-
-#ifndef _XawBoxP_h
-#define _XawBoxP_h
-
-/*
- * Box Widget Private Data
- */
-#include <X11/Xaw/Box.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xaw/XawInit.h>
-
-/* New fields for the Box widget class record */
-typedef struct {
- XtPointer extension;
-} BoxClassPart;
-
-/* Full class record declaration */
-typedef struct _BoxClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- BoxClassPart box_class;
-} BoxClassRec;
-
-extern BoxClassRec boxClassRec;
-
-/* New fields for the Box widget record */
-typedef struct {
- /* resources */
- Dimension h_space, v_space;
- XtOrientation orientation;
-
- /* private state */
- Dimension preferred_width, preferred_height;
- Dimension last_query_width, last_query_height;
- XtGeometryMask last_query_mode;
-#ifndef OLDXAW
- XawDisplayList *display_list;
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} BoxPart;
-
-/*
- * Full instance record declaration
- */
-typedef struct _BoxRec {
- CorePart core;
- CompositePart composite;
- BoxPart box;
-} BoxRec;
-
-#endif /* _XawBoxP_h */
diff --git a/xc/lib/Xaw/CHANGES b/xc/lib/Xaw/CHANGES
deleted file mode 100644
index 2eb316abb..000000000
--- a/xc/lib/Xaw/CHANGES
+++ /dev/null
@@ -1,153 +0,0 @@
-
- These changes have been made to Xaw since X11R4.
-
-
-
-Documentation:
- Fixed definition of XtAppInitialize().
-
- Changed all references to XawOrient* and XtOrient* to Xtorient*.
-
- Many other corrections and clarifications.
-
-Everywhere:
- Function prototypes for public interfaces.
-
- Many bugs not mentioned here have been fixed.
-
-AllWidgets:
- Add WidgetNode table for use with listres and viewres.
-
-AsciiSrc (Text):
- No warning message is printed when the file can not be
- written to, the return value should be enough info.
-
- GetValues on the string resource was failing when
- "useStringInPlace" was set to true.
-
- Memory leak when freeing pieces in a source of type "ascii String"
- has been plugged.
-
- Buffer is now updated whenever the "string" resource is set using
- XtSetValues(). If type is file then the file is read in again.
-
-Box:
- The public header file now includes Xmu/Converters.h for the
- orientation resources.
-
-Clock:
- Made subclass of simple instead of Core
-
-Command:
- Fixed bug in changing shape style to Rectangular.
-
-Dialog:
- Resource Type of Icon changed from Pixmap -> Bitmap.
-
-Form:
- The geometry handler now will now disallow geometry management
- reqests that will force the child outside the Form's window.
-
- Fixed missing parens typo in PreferredGeometry.
-
- Fixed EdgeTypes to be Xaw* instead of Xt*, but left the
- old definitions around with #define so that code will still work.
-
- StringToWidget converter no longer caches resources.
-
-Logo:
- Made subclass of simple instead of Core.
- Fixed reverse video.
-
-Mailbox:
- Made subclass of simple instead of Core.
- Fixed reverse video and many other bugs.
-
-MenuButton:
-* The MenuButton widget no longer places a server grab on itself.
- Instead, PopupMenu is registered as a grab action. As a result
- of this, clients which popped up menus without using XtMenuPopup
- or MenuPopup or PopupMenu in the menu button translations will
- fail to have a grab active. They should make a call to
- XtRegisterGrabAction on the appropriate action in the application
- initialization routine, or use a different translation.
-
-Paned:
- The public header file now includes Xmu/Converters.h for the
- orientation resources.
-
-Panner: This widget is new in R5.
-
-Porthole:
- New for R5.
-
-Scrollbar:
- Fixed bug that could call XtReleaseGC() with garbage
- Made subclass of simple instead of Core
-
- Type of thumb resource is XtRBitmap; it used to be XtRPixmap.
- However, if applications provide the resource conversion, the
- Scrollbar's SetValues can still handle pixmaps of correct depth.
-
-Simple:
- Added a color cursor converter. and the new resource types:
- XtNpointerColor
- XtNpointerColorBackground
- XtNcursorName
-
-SmeBSB:
- Right bitmaps are now painted in the correct location.
-
- Right and Left Bitmaps can be specified in resource files, and
- at startup time.
-
-Text:
- If there is no current selection the the selection extends
- from the insert point, rather than some random location.
-
- Forward (Backward) Paragraph works at the paragraph boundaries now.
-
- Selecting a word now transitions correctly at BOTH end points.
-
- Infinite loop when using fill paragraph in a read only text widget
- has been found and fixed.
-
- When the "resize" resource is set the text will start up with
- exactly enough space to contain the text in the widget.
-
- Fixed a bug that could cause an infinite loop when Meta-Q was used
- to invoke the form-paragraph function on a read-only text widget.
-
- Exposures fixed.
-
-TextP.h:
- Symbolic constants private to the Text widget should not conflict
- with operating system headers files. The names of these symbolic
- constants have each had the prefix Xaw added to them:
- #define XawLF 0x0a
- #define XawCR 0x0d
- #define XawTAB 0x09
- #define XawBS 0x08
- #define XawSP 0x20
- #define XawDEL 0x7f
- #define XawBSLASH '\\'
-
-
-Toggle:
-* Toggle widget state is preserved across changes in sensitivity.
-
- A string to widget converter is regisetered for radio groups.
-
-Tree:
- New for R5.
-
-Paned:
- Fixed bug that caused XtGeometryYes returns to have bogus values,
- causes panes to get random sizes.
-
-Vendor:
- Added support for the Resource Editor.
- Fixed bug causing Shell to ignore all but first child.
-
-Viewport:
- Added XawPannerReport support.
diff --git a/xc/lib/Xaw/Cardinals.h b/xc/lib/Xaw/Cardinals.h
deleted file mode 100644
index 91dd87683..000000000
--- a/xc/lib/Xaw/Cardinals.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $TOG: Cardinals.h /main/7 1998/02/06 12:45:10 kaleb $ */
-/*
-
-Copyright 1985, 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.
-
-*/
-
-#ifndef _Cardinals_h
-#define _Cardinals_h
-
-#define ZERO ((Cardinal)0)
-#define ONE ((Cardinal)1)
-#define TWO ((Cardinal)2)
-#define THREE ((Cardinal)3)
-#define FOUR ((Cardinal)4)
-#define FIVE ((Cardinal)5)
-#define SIX ((Cardinal)6)
-#define SEVEN ((Cardinal)7)
-#define EIGHT ((Cardinal)8)
-#define NINE ((Cardinal)9)
-#define TEN ((Cardinal)10)
-
-#endif /* _Cardinals_h */
diff --git a/xc/lib/Xaw/Changelog b/xc/lib/Xaw/Changelog
deleted file mode 100644
index 5a1d67408..000000000
--- a/xc/lib/Xaw/Changelog
+++ /dev/null
@@ -1,1370 +0,0 @@
-Patch 1 (#1655) 15 April 1998
-
- Description of the actions system:
---------------------------------------------------------------------
- All the actions have the syntax:
-
-action-name(boolean-expression, args)
-
- Where:
-action-name:
- Any string with a translation binding in the binary for the widget.
-
-boolean-expression:
- [{~}]variable-name|resource-name|constant-name[{&|^}[[{~}]variable-name|resource-name|constant-name]]...
-
-variable-name:
- Any string starting with a '$' character (actually it's not possible
- to mask this character; I'll fix it). Variables are actually created
- with the translations 'declare' and 'get-values'. Example:
- get-values(1, $x, x)
- declare(1, $armed, true)
-
-resource-name:
- Any resource name of the widget. Note that it requires a <TYPE> to
- string converter in the code (I added some on the patches), since
- all variables values are stored in a 'String' format. Example:
- borderWidth
- height
- font
- background
-
-constant-name:
- Especial values. They aren't normally contants, but a special state
- not triggered with resources or variables (They have the highest
- precedence, so, to allow these strings as resource names I'll need
- to allow some sort of escape sequences). Examples:
- mine # event->xany.window == XtWindow(widget)
- faked # event->xany.send_event != 0
- true # you know
- false # " "
-
-args:
- Special strings values interpreted by the translation binding.
-
-The operators (currently) understood are:
- ~ - NOT
- & - AND
- | - OR
- ^ - XOR
- ( - RP
- ) - LP
- The final result value is and'ed with 1.
-
-Sample translation to make a label widget behave like a button:
-<Map>:\
- get-values(1, $fg, foreground, $bg, background)\n\
-<Btn1Down>:\
- set-values(1, foreground, yellow, background, gray30)\n\
-<Btn1Up>:\
- set-values(1, foreground, $fg, background, $bg)\n
-
-
- Description of the displayList system:
---------------------------------------------------------------------
- The display list has the syntax:
-
-[class-name:]function-name args[{;|\n}]...
-
- Where:
-class-name:
- Any registered set of functions. The code registers the class 'xlib',
- and if the class name is not specified, this class is assumed.
-
-function-name:
- A string binding to the correct function to be called.
-
-args:
- A set of converted and shareable arguments, to the function. The
- positioning/sizing arguments currently implemented have the syntax:
-{+-}<integer> or <integer>/<integer>. Examples:
- +0,+0 top, left
- -0,-0 bottom, right
- -+10,-+10 bottom+10, right+10
- +0,1/2 left, vcenter
-
- All displayLists are shared by:
- widget->core.screen
- widget->core.colormap
- widget->core.depth
- I have added only partial code for handling non-windowed widgets (gadgets).
-I'll fix it.
-
- Example for drawing two lines crossing the widget:
-foreground black;\
-line +0,+0,-0,-0;\
-line +0,-0,-0,+0
-
-
-
-Patch 2 (#1660) 19 April 1998
-
- + More functions for displayList's
- + Fixes for simpleMenuWidget, xfontsel should work very better now. Try
- this with the newer patches to verify the changes:
- xfontsel -xrm '*XFontSel*SimpleMenu*font:
--*-helvetica-medium-r-*-*-16-*-*-*-*-*-*-1'
- + Small bug fix to boxWidget, viewres should work better now. Try this
- to verify the changes:
- viewres -xrm '*Viewres*Box.borderWidth: 1'
- + Small bug fix to panedWidget, when pressing in a gripWidget but not
- moving the pointer, or releasing at the same coordinates.
-
-Patch 3 (#1673) 25 April 1998
-
- + Changes in layout code for the Form widget. To see the changes, run xcalc
- and resize it several times (try giving it a very small size and the
- restore the size). The new code uses a 'known' reference size/position
- to avoid integer rounding problems.
- + A optimization for the Form widget. Now it unmaps itself before resizing
- the child widgets. This way the layout process is very faster.
- + The List widget will try to fit in a 32767x32767 window size. It checks
- if the width or height will become bigger than 32767 and if will, changes
- the number of columns. This fixes xman (at least for me, that have several
- entries in the section 3 of the manpages).
- + New functions to displayList's and fixes to some bad bugs (I'm yet working
- on that file).
- + Change in the Scrollbar functionality. It was redrawing the thumb when
- triggering the MoveThumb action. This is bad because several programs
- choose to recalculate the thumb position with XawScrollbarSetThumb, causing
- screen flickering. Now it redraws the thumb when triggering the NotifyThumb
- action. To verify the changes, run xfm or xman and try to scroll past the
- end of a window; it will keep erasing and redrawing the thumb.
- + Other change in the Scrollbar is that it will only draw in the rectangle:
- 1, 1, core.width - 1, core.height - 1. It is better when creatting a 3d
- effect with displayList's.
-
-
-Patch 4 (#1678) 3 May 1998
-
-Included the patches for the recent problems with libXaw.
-Several 'gratuitous' small changes, to compile cleanly with gcc -Wall.
-Some bug fixes for DisplayList.c.
-Colored pixmaps support. I'm building a abstraction layer for the colored
- pixmaps, so that it should be easy to support more pixmap formats
- (actually, only X bitmaps).
-
-
-Patch 5 (#1686) 11 May 1998
-
- + Patch to libXmu, so that the StringToCursor converter will understand the
- string 'None', that means not to use a cursor. This is useful when
- overriding resource settings, and the user wants to use the parent window
- cursor, or the root window cursor. Any unrecognized name will generate
- a 'None' cursor, but then with a warning message.
- + SimpleWidget was modified to allow setting the cursor to none, when it
- was a valid cursor.
- + Modification in the Actions.c,
- from:
- typedef struct _XawActionVar {
- XrmQuark qname;
- String value;
- } XawActionVar;
- to:
- typedef struct _XawActionVar {
- XrmQuark qname;
- XrmQuark qvalue;
- } XawActionVar;
- This does not cause any problems, since the exported interface remains
- the same. This is required to avoid to much copies of the same string.
- + Values of action variables can start with '$'.
- + If a resource name clashes with a special constant name when evaluating
- a boolean expression (in the translations code), it's enough
- start the resource name with '\\' (it can always be used, but is
- only useful if there is a name clash :).
- + The only code that loads data files actually is the pixmap code. To avoid
- security problems, the code only loads files that are group readable,
- regular file, non suid and non sgid.
- + If the code to load a pixmap does not find a match, and the pixmap name
- has a extension, try without the extension.
- + Function 'line-with' added to displayList code.
- + Added DisplayListToString and PixmapToString converters.
- + Bug fixes in the pixmap name interpretation.
-
-
-Patch 6 (#1701) 24 May 1998
-
- Xaw
- ------
- + Allows setting the resources label_x and label_y inherited from labelWidget.
- This is useful for moving the contents of a button when it is pressed
- ( I included a simple test for it )
- + Added OS/2 patchs
- + The buffer overflow problems were resolved in a different way. I added
- a function XmuSnprintf, that is used by Xaw and Xmu.
- + Correction of a problem in SimpleMenu, when it tries to optimize the
- space used by the menu.
-
- Xmu
- -----
- + Function XmuNCopyISOLatin1Lowered, defined in <X11/Xmu/CharSet.h>
- + Function XmuSnprintf, defined in <X11/Xmu/SysUtil.h>
- + All ocurrences of sprintf were replaced by XmuSnprintf and all ocurrences
- of XmuCopyISOLatin1Lowered were replaced by XmuNCopyISOLation1Lowered.
-
-
-Patch 7 (#1738) 21 June 1998
-
- + Corrected problem with the Command widget, when it was made insensitive
- without calling the 'reset' action.
- + Rework of the SimpleMenu code for optimizing the space used. Now it
- really works as intended.
- + Fixed portability problems with my previous patches.
- + Corrected problem pointed by 'grano@cs.Helsinki.FI'. He have followed up
- a bug report to the devel mailing list. While the problem exist, his
- patch was not complete, so I did a rework of the AsciiSrc.c:Scan() and
- MultiSrc.c:Scan() functions.
- + I added clipping code to the {Ascii,Multi}Sink widgets, to allow use of
- displayList's as decoration. The best solution I found to avoid too much
- server requests, and keep full binary compatability was to use the resize
- method of these widgets, to tell them to the parent widget have changed
- it's size.
- + Now the TextWidget has a xterm/emacs like cursor. And it is possible to
- especify a cursor color.
- + Fixed several problems caused by code assuming a line of text will be
- shown as one line in the TextWidget. This is not always true when
- it uses XawtextWrapLine or XawTextWrapWord, the most common problem was
- the cursor becomming invisible, after calling the function
- Text.c:_XawTextShowPosition() that is called to make sure it is visible ;)
- + Added code that it will not forget the cursor distance from the left of
- the window while moving the cursor one line up or down.
- + Ansification of the text code (not yet complete). Private routines now
- uses prototypes and wide parameters. External routines were kept
- as before (but with prototypes not masked by NeedFunctionPrototypes),
- to avoid binary compatability problems. The bigger problem I found in the
- ansification was a function with 6 parameters being called with only 5.
- + Several routines were rewritten, sometimes from scratch.
- + The cursor navigation of the TextWidget was completely reviewed. It
- should be very familiar to Emacs users. The most Emacs like behaviour is
- when the cursor in move one line up or down and becomes invisible; the
- text will be scrolled so that the line with the cursor will be centered
- in the screen. Also, when doing page up, the cursor will be positioned
- in the bottom-left, instead of allways in the top-left.
-
-Patch 8 (#1752) 27 June 1998
-
- + There was a problem with the previous patch regarding to portability.
- The problem was strcasecmp. I was planning to provide the funcionality
- in libXmu, and forgot when creating the previous patch :(. There is
- already a strcasecmp equivalent in libXmu, that is
- Lower.c:XmuCompareISOLatin1(), so I used that function.
- + The previous patch was working correctly for viewing text, but there were
- some cases the text window could end not displaying correctly the text.
- This problem was fixed.
- + Now, the only real need of scrollbars is when doing long jumps on the
- text, because the cursor will be always visible since this new patch
- does horizontal scrolling automatically.
-
-
-Patch 9 (#1755) 28 June 1998
-
- + Removed all my RCS idents in the files.
- + Declared functions as static in the prototype and in the definition
- (this basically reverts a previous patch, but should help when applying
- the patches sequentially).
- + Changed the code in Pixmap.c to use strtok instead of strsep, that is
- not portable.
- + Corrected problem with previous patch that would cause trouble when
- a text widget had more than 32K bytes, and would also cause offset
- mismatches if a program access private structures (AsciiSinkP.h).
-
-
-#1776 6 July 1998
-
-Corrected problem when moving the cursor over a non-printing character,
- i.e. ^Q ^X
-Does not allow anymore scrolling of the text width Ctrl+Z if the text has
- only one line, or only one line of text.
-Several changes in the TextWidget. I did not gratuitously break binary
- compatability. Source compatability is only granted to programs that
- do not access private structures. This is required because there are
- several changes in the behaviour of the TextWidget, and if a program
- becomes non compilable, it is because it will not work properly with
- the changes in the text widget (please read bellow for a explanation)
-Better cursor navigation when moving line-up or line-down over a tab:
- cursor
- |
- v
- spaces | |#| | | |text
- tab | |text
- Move one line down:
- before:
- tab |# |text
- now:
- tab | |#ext
-There were several problems in the Text.c:_XawTextReplace(), when deleting
- a character and the cursor (shoud be) moved to the previous line. This
- problem was corrected.
-The text code was doing too much redrawing! When typping text, it would
- redraw all the current line at each character typped, and also redraw the
- entire window till the bottom. Now it only redraws the minimum necessary
- (and makes a minimum of requests for the Xserver, when clearing areas),
- most of these problems were related to Text.c:_XawTextReplace() (rewritten
- from scratch), Text.c:_BuildLineTable() (mostly rewritten) and
- Text.c:DisplayText() (mostly rewritten).
-Now, when selecting text, with: button1-down, button1-move, the window will
- be scrolled automatically, if the mouse is moved to the top or bottom of
- the text window, making it easier to extend selections.
-Added a set-keyboard-focus translation to the text code, and in the
- default translation, it is called when pressing the left mouse button over
- a text widget (so that the mouse does not need to be over the text window
- when typping)
-
-These are the changes to Xaw that made it not fully source compatable (I'm
-open to comments, to make it source compatable, but as I said above, if
-a program does not compile anymore, it is because it is not granted it will
-work properly):
-scrollMode set to WhenNeeded is not supported anymore. I spent several
- hours fighting side-effects caused when a scrollbar is created or destroyed
- 'on demand', and have (after tired of long debug sessions) choosed that
- it is not required (it saves a lot of potencial unespected conditions
- being found by a user). I changed the 'type' of the scroll mode to Boolean,
- so, to have a scrollbar, is enough to say: *Text.scrollVertical: True.
- Since the type now is Boolean, Xt will print warning messages when the
- scroll is set to 'Always', 'Never' or 'WhenNeeded'
-automatic resize is nonsense since the text does automatic horizontal
- scrolling. IMHO, to be useful, automatic resize should also shrink the
- text window when needed, anyway, it's not required anymore
-
-Comments:
-auto-fill mode does not work properly (never did)
-wrap-mode set to line may not work properly
-wrap-mode set to word does not work properly always (never did)
-the multiply should be setable to a variable value; the default value
- is 4, i.e. Ctrl+U <text+action>
-I will work on the itens listed above, and I'm also planning:
-one level undo, for text actions
-C style indentation and 'jumping' the cursor to show matching '(', '['
- and '{'
-other things that I don't remember now :)
-
-
--- XMU --
-Moved the code clipping code I have put in Text.c in my previous patch to
- Xmu/Clip.c. There was a bug in the code I have put in Text.c (this is what
- I get by cutting and pasting code under a #if 0 :(), but it was corrected.
- The code in the new file 'Clip.c' is very useful for creating clipiing lists
- and thus, avoiding too much server requests, or code for the same
- functionality (poorly) repeteated in several places around the libary. This
- code is now heavily used by the TextWidget.
-
-
--- XEDIT --
-Removed a XDefineCursor in xedit.c:main(). There are several ways to specify
- a cursor for a program (most times inherited from the wm decoration window),
- so, it is better to let the user choose one.
-Before starting the main loop, now xedit sets the keyboard focus to the
- text window if a file was loaded, or to the prompt for a file name if
- none was especified in the command line (do not use the new xedit without
- the new Xaw library, or you will not be able to change the keyboard focus).
-Updated the Scrollbar configurations in Xedit.ad
-
-
-#1788 12 July 1998
-
--- TextWidget --
- + Corrected problem whem moving the cursor over a non-printing character
- + Now, does not allow scroll with ^Z when there is only one line of text
- + Automatic resize was removed, it is not required with automatic horizontal
- scroll, but I will look for programs that rely on it; the only program
- affected (that I know) is xmh, because it popups dialogs of a small size,
- and expects that the text widget (with a warning message) do a geometry
- request.
- + Scroll mode set to "WhenNeeded" was removed. It generates several unespected
- conditions when editing text, and the new feature of automatic scrolling
- the text widget while typping is more useful.
- + Removed a leak in TextAction.c:AutoFill(), generated by the code
- text.ptr = (char *)XtMalloc(sizeof(wchar_t) * 2);
- that memory was never released, but the fix was simple, since the amount
- of memory requested is fixed.
- + Several optimizations in the redisplay of the text.
- + Now, wrap mode set to word or line is expected to work, while typping text.
- + AutoFill will only break lines in word boundaries now.
- + Added a set-keyboard-focus action to TextAction.c, so that when pressing
- the left button over a text widget, it will receive the keyboard focus.
- This behaviour is the default, but can be disabled, with something like:
- *Text.translations: #override\n<Btn1Down>: select-start()\n
- in your .Xdefaults.
- + Corrected several cases that would left the text widget showing incorrect
- data. All the problems should have been fixed, but in case you find one,
- a quick fix is:
- *Text.backgroundPixmap: black?foreground=<some-color>
- because it does not try to optimize the redrawing when using a background
- pixmap, and thus, avoid several possible problems.
-
-
--- XAW --
- + I had added a XawStackAlloc definition to "Private.h", to avoid a XtMalloc
- request for every character typped in TextAction.c:InsertChar(), but
- when syncing with 3.9Aj, saw that the file "XawAlloc.h" is no longer
- required. Please, remove XawAlloc.h from 3.9Aj.
-
-
--- XMU --
- + Added the file Clip.c, with clipping code, that, now is being used by
- the text widget, but can be used by other widgets.
-
--- xedit --
- + Removed a XDefineCursor from xedit.c:main()
- + I have added a XtSetKeyboardFocus in xedit.c:main(), but comented it
- because it would make xedit unusable with previous versions of Xaw,
- or with the Xaw replacements (Xaw3d, Xaw95 ...)
-
-Comments:
- I wrote a lot of code to work properly with italic fonts in the text widget,
-that code made the cursor do not erase portions of the text while moving the
-it, but it was failing at some places that would need that the TextWidget,
-and not only the {Ascii,Multi}SinkObject had access to the fonts, so I
-choosed to left it to the future (and keep the sources simple, by now).
-The text widget is useable with italic fonts, but fonts with:
- f->per_char[<char> - f->min_char_or_byte2].rbearing
- > f->per_char[<char> - f->min_char_or_byte2].width
-or
- f->per_char[<char> - f->min_char_or_byte2].lbearing < 0
-will not allways be displayed correctly.
-
- I haved also added a xedit configuration file to this mail.
-
-
-#1842 27 July 1998
-
-Fixed problem with the default macro for type conversion, where it was
- possible to the code tell the wrong size of a string, since it was
- returning the string size with 'strlen' but making the copy with strcpy.
-Complete ansification of Xaw (and Xmu).
-Corrected some problems caused due to an alteration in the text code, to
- make the cursor always visible when the wrap mode is 'line' or 'word'.
-Text.c:VJump() was made a bit smarter and a problem that would cause it
- to jump incorrectly was also corrected so that now the jumping should be
- very smooth.
-Corrected problem that would cause a coredump due to the
- Text.c:_XawTextReplace() deferencing a NULL pointer. Now ctx->text.lt.info
- is initialized when the text widget is created, solving this problem.
-All the variables with name 'new' and 'class' where renamed to 'cnew' and
- 'cclass'. This allows even building Xaw with 'gcc -x c++'.
-Variables shadowing other variables or functions where also renamed.
-Static functions were changed to use wide parameters, where applicable.
-(Almost) every time a StringTo<Type> converter is installed in the class
- initialization of a widget, the code also installs a <Type>ToString converter
- since now editres seens to work better.
-Complete reestilization of the indentation. See the files Template*.{c,h}.
-Corrected problem with the 'virtual' function Layout of the Form widget. That
- function requires 4 parameters, but the Viewport widget (a Form subclass) was
- calling that function with only 3 parameters; the ansification flagred that
- error.
-TextTr.c was modified to have only one string. I believe that that weird
- thing was due to the inheritance of compatability with some very old and
- probably buggy ld.
-Xaw is expected to be binary compatable with R6.3; there are some
- preprocessor macros that keeps binary compatability, and unless the gains
- of breaking binary compatability show worth enough (and people think) it
- is good that code would be made default, otherwise it will be forgotten.
-I have also added a XFree86 copyright notice to Text.c, since there is
- a very large amount of work in that file (and it is not yet ready).
----------------------
-
--------- Xmu --------
-Complete ansification of Xmu.
-Rework of EditresCom.c to allow editres working correctly. It was also
- added a new feature, that allows editres finding some extra child widgets,
- i.e. widgets that aren't a child of a subclass of composite and aren't in
- the popup list. This modification is not enough, since it does not find
- child widgets that don't a XtRWidget resource in the parent widget.
-Rework of ShapeWidg.c, so that it will give the correct feeling to the
- ellipse shape, and inversion of the oval, if shape is oval and
- height > width. To see these changes, run a program with:
- <prog> -xrm '*shapeStyle: ellipse'
- and/or
- <prog> -xrm '*shapeStyle: oval'
-Revision of DrRndRect.c to make the widget looks 'more correct' when using:
- <prog> -xrm '*shapeStyle: roundedRectangle'
----------------------
-
------- editres ------
-Added small patch to bug in handler.c so that editres will correctly now.
----------------------
-
-------- xedit -------
-Changed the resources file, to avoid a problem when resizing xedit to a
- very small size and than restoring it's size. Probably the culprit is the
- Paned widget, but the new resource file is at least a good workaround for
- the problem.
-The resource file was also modified so that the default xedit size will
- give a 80x25 rows/columns when using the default font.
----------------------
-
--------- xgc --------
-Small patch to clear correctly the status text window, when pressing the
- 'Clear window' button. Note that this patch showed a bug in
- Xaw/{Ascii,Multi}Src.c; only apply this patch with the latest Xaw, or
- be sure that Xaw/{Ascii,Multi}Src.c:*SetValues() has something like:
- if (old_src->ascii_src.ascii_length != src->ascii_src.ascii_length)
- src->ascii_src.piece_size = src->ascii_src.ascii_length + 1;
- instead of:
- if (old_src->ascii_src.ascii_length != src->ascii_src.ascii_length)
- src->ascii_src.piece_size = src->ascii_src.ascii_length;
- or it will enter a infinite XtMalloc(0) loop :(
-also fixed a possible buffer overflow while searching the source of the
- bug described above.
----------------------
-
-#1945, 31 Aug 1998
-
--- XAW --
- + Corrected bug in Viewport.c:ComputeLayout(), that would put the scrollbar
- in the incorrect position, if w->viewport.useright == True
- + Corrected bug in Converters.c:_XawCvtCARD32ToString(), so that now it
- will correctly format the converted value.
- + Corrected problem in {Ascii,Multi}Src.c:Search(), that would cause a
- incorrect offset to be returned, if the searched text (or a substring of
- it) were in a 'Piece' boundary.
- + Some small patches to other sections of the code, to reduce the number
- of warnings generated by gcc, when using more restrictive warning options.
-
--- XMU --
- + Corrected a problem in Atoms.c:GetAtomName(), to return a NULL pointer,
- instead of a const if the given atom is 0.
- + Corrected a typo in Xmu.h
- + Several 'ansification' patches, to get function definitions and avoid
- unecessary definitions.
-
-
-#2028, 2033, 7 Oct 1998
-
--- Xaw --
-Added a delete translation to the text widget, that deletes the current
- selection if any, else the backwards char.
-Corrected bug that would not update correctly the screen if page-up or
- page-down was pressed while there was an selection.
-Added a ^Q<any-char> translation to the text widget, to be able to insert
- any char in the text.
-Changed TextAction.c:Move() to set ctx->text.showposition, so that even
- if the cursor did not change the position, it will become visible.
-Corrected problem with the 'form-paragraph' translation, so that the
- text will be always correclty shown.
-Modified the automatic scrolling of the text to one line at a time, to
- make it easier to see what is being selected.
-Added a 'hack' to be able to type ^U<any-numeric-sequence> to be able
- set the multiply of the text widget. Since it is a hack (besides seens
- to work very well) it can be disabled with -DNO_NUMERIC_HACK
-Corrected a nasty bug in Text.c:CvtStringToScrollMode(); XtConvertAndStore
- can't be called from a type converter!
-added UNDO/REDO to the text widget. Please try it, I think it is very nice.
- Undo is enabled by the new resource 'enableUndo', and, by default is
- triggered with 'Ctrl+_'.
-
--- editres --
-Resubmitting a patch to editres/handler.c, to make editres work properly.
-
--- xedit --
-NOTE that with this patch, xedit probably will not work with Xaw3d, neXtaw...
- this surelly can be fixed, or in the xedit side or the *Xaw* side, but
- the patch seens to be necessary.
-Changed the defaults file to be more user friendly and previsible.
- Added some 'Emacs like' binding translations.
-Added file completion in the filename prompt. This is a very nice
- feature, but I'm not sure if the code is portable to all the XFree86
- supported platforms (surely it will not work 'as is' with OS/2).
-
-
-#2083 18 Oct 1998
-
--- XAW --
-Changed the functions {Ascii,Multi}Sink.c:CharWidth and PaintText, to
- improve speed, and avoid too much recalculations. On normal files, it
- becames about 5:1 faster, but can go up to 20:1 when editting files with
- very large lines. Besides this speed improvement, I believe it can
- surely be made faster (based on comparition with some popular X editors).
-Changed the way the AsciiSink prints characters with value bigger than
- 126 decimal. Now it prints DEL as ^?, and the other characters as \XXX
- where 'X' is an octal digit. The MultiSink widget was unchanged in this
- respect, i.e. when calling xedit with something like:
- xedit -xrm '*international: true'
-Converted all calls to strncpy, in AsciiSrc.c to memcpy, so that the (ascii)
- text widget will work properly with data containing nulls.
-Added a experimental 'Xaw Scan Type' XawstAlphaNumeric, that shoud make
- edition of C (or any other language) easier in xedit (i.e. the text widget).
- It can be tested with Ctrl-Left and Ctrl-Right, by now.
-Changed the TextWidget to handle text lines that would result in more than
- 32767 pixels. Besides the text widget is not meant to be used in the
- edition of binary files, this change allows it.
-Changed Text.c:TextScroll() to be smarter when calculating the offset of
- the line table on scroll up.
-Added a nice feature, to show the matching '(', '[' or '{', when a ')',
- ']' or '}' is typped.
-Changed TextAction.c:FormParagraph() to generate only one undo/redo step.
-
--- xedit --
-Changed the defaults file to enable backups and made the backup suffix
- the character '~'.
-Replaced all instances of sprintf by XmuSnprintf.
-Changed xedit to set the label when saving a file also, to reflect what
- is being edited correctly.
-Corrected a bug in the new action 'file-completion', to replace correctly
- the home directory, and keep correctly whatever was after the '~'. This
- isn't the correct place to this code (xedit/commands.c), since there are
- several other file name prompt windows in Xaw, but since it is required
- another window to show the possible matches, I'll study a better way to
- implement it.
-Added a 'hints' feature to xedit. Instead of a 'dead'
- "Use Control-S and Control-R to Search." label, now it allows the label
- string being changed at user settable intervals.
-
-
-#2205 10 Nov 1998
-
--- xaw --
- + Fixed some 16 bit overflows in AsciiSink.c and some cases where it would draw
- past the end of the text window (a no-op), the overflows were not a
- problem, but could left the text window with incorrect data.
- + Moved the undo/redo code to TextSrc.c, and some code/data from
- {Ascii,Multi}Src.c to TextSrc.c. The callback now is called when the
- source is changed, or becames unchanged due to an undo/redo. Also
- changed the Scan procedure to be a bit faster.
- + The asciiTextWidget will now accept a source or sink object being set at
- creation time.
- + Fixed the 'struct XawDisplayList' being redefined when compiling Xaw under
- SunOS.
- + Several changes to the SimpleMenuWidget to make the geometry management
- work correctly when adding/removing/changing menu entries at run-time.
- + Added a 'kill-ring' feature to the TextWidget. The behaviour is identical
- to Emacs. Pressing C-K repeteadely will merge the lines being killed, so
- that a C-Y latter will paste all the killed lines.
- + Added the enough glue code (and as backwards compatible as possible) to
- allow the *src object be shared between several TextWidgets. My initial idea
- was to make the TextWidget be able to have more than one source, but, to
- be backwards compatible, I did the reverse (the source can have more than
- one TextWidget).
- + Fixed a automatic wrap bug (TextWidget) that could eat non white space
- characters (my previous patch to this problem was completely wrong).
-
--- xedit --
- + Added a split-window feature to xedit. To keep xedit simple, it only allows
- two windows at the same time: or subdivides in the vertical or horizontal.
- + Added more some key-bindings, that should do the same as Emacs.
-
-#2291 5 Dec 1998
-
--- Xaw (only changes to the 'text' code) --
- + Changed the default 'piece size' from BUFSIZ to the value returned by
- the getpagesize() function (or keep BUFSIZ if that value is smaller).
- + Added a case sensitive option to the search popup. This is a 'hack' by
- now, but should not cause trouble to anybody.
- + Fixed a bug inserted when changing the code for the search, the only side
- effect I saw was that the jumping cursor to show the matching '(', '[' or '{'
- stopped working in my last patch.
- + Moved back my change to the function XawTextSetSource. The 'correct' function
- is _XawTextSetSource. This is only to make sure old code should compile
- cleanly.
- + Added line and column number calculation code (and a callback to tell when
- that information changed) to the TextWidget. This was not an easy task,
- because I tried to optimize as much as possible the code, and do relative
- calculations, instead of scanning the entire file to count the number of
- lines (there are several special cases, when removing/inserting text).
- + Added the selection type XawselectAlphaNumeric. This adds one step in
- the sequence word-line-all when doing multiclick in the text.
- + Fixed some bugs in the 'kill ring' feature added in the last patch. Now
- it is expected to never fail.
- + Corrected the indentation of TextP.h, and changed more some fields. The
- internal data of the TextWidget changed a lot, so it is not expected that
- program code read directly the private data, at the price of requiring the
- correct library version.
- + Fixed a small bug in the undo code, that would 'think' the file was unchanged
- in the incorrect position in the undo buffer.
- + Changed the default key bindings for delete/kill word functions to use the
- alpha numeric versions (this is better for coding, and more compatible with
- other text editors).
-
--- xedit --
- + Changed the labelWindow, to show the current line number (but it is also
- possible to show the current column number, offset or file size).
- + Fixed bug when saving the *scratch* buffer with a new name.
- + The 'changedBitmap' is now correctly displayed on all the windows showing a
- changed file.
- + Small changes to the xedit man page.
-
-
-
-#2371 8 Jan 1999
-
---- Xaw ---
- + More some changes to AsciiSrc.c:Scan(). This improves a bit the speed when
- scanning text.
- + Added sanity checking for AsciiSrc.c:Search(), to avoid the risk of
- deferecing a null pointer (or reading memory out of the text piece) if the
- searched text happens to be larger than a "piece size".
- + Fixed bug when trying to optimize line number calculation, due to a typo,
- while meaning XawTextWrapNever I wrote XawTextWrapLine.
- + Fixed a problem shown by xclipboard, when setting the "string" resource
- of the text source, the sink object was keeping the insertPosition in the
- old text contents, and then, when showing the cursor, it was incorrectly
- 'erasing' the old cursor position.
- + Fixed problem in XawTextReplace, that would not update correctly all the
- TextWidget's sharing the same source.
- + Added a kill ring list to the text code. This works like the emacs feature,
- but, unlike emacs, it is not required to press C-Y before M-Y, to start
- looping through the kill ring list. To use it, just press M-Y repeteadly,
- and all the text that was killed will be inserted, one at a time, so that
- you can choose one. Note that the text inserted from the kill ring list
- will also enter in the undo list.
- + Changed the Move{Backward,Forward}Paragraph actions to make the cursor always
- stop in a blank line. This makes only one step moving from a paragragh to
- another, instead of two.
- + Added code to check for overflows in the C-U<number> sequence.
- + Changed the FormParagraph action to keep the cursor at the correct position.
- + Changed the default translations in TextTr.c to get a more emacs like
- behaviour with the kill ring list.
-
---- xedit ---
- + Added a few more resource settings to the Xedit-sample file.
- + Added some sanity checkings when trying to save a file. This avoids the
- case of saving a file with the name of a directory (but moving the directoy
- to other name before). A possible case is: have a directory named 'dir',
- saves a file as 'dir', but before saving, renames the directory as 'dir~'.
- + Allows saving a file that xedit thinks is not changed (the file may have
- changed on the disk, but the user really wants to rewrite it).
- + Corrected several bugs in the FileCompletion action, and added a new
- feature, that is to complete the partial names, when there is a '/' or '.'
- after the cursor position.
-
-
-#2479 19 Feb 1999
-
--- Xaw --
- + Fixed bug in the line numbering code, when removing lines before the
- top position.
- + Changed code to form regions to always show the cursor after formatting the
- text.
-
--- xedit --
- + Added code to keep the file mode, after saving. This is useful when editting
- scripts, so that the executable flag will not be lost after edition.
-
-
-#2544 12 Mar 1999
-
--- Xaw --
- Mostly changes to add support to latin-* languages in the text code, when not
- using the international resource.
-Actions.c:
- + Corrected some bugs in the boolean expression parser. The old version would
- not parse correclty parenthized expressions, and was giving equal precedence
- to AND, OR and XOR (what is incorrect).
-AsciiSink.c:
- + Changed to display characters in the range 0x32-0x7e and 0xa0-0xff literally.
- The other characters are represented as control-codes, as before. This is
- better for edition of Latin-* text files.
-AsciiText.c:
- + Changed the code, so that even if the *international resource is not set,
- _XawImRegister and _XawImUnregister are called for the text widget. This is
- useful for latin-* locales, that use one byte wide characters, and makes Xaw
- more compatable with modern toolkits, like qt and gtk.
-List.c:
- + Added code to work correctly with a background pixmap.
- + Added a smarter code for list window size calculation, that is used if the
- number of columns is especified to be zero (automatic).
-MultiSink.c:
- + Fixed a core-dump problem caused when passing a null pointer to
- XwcTextEscapement.
-Text.c:
- + Removed the resource adjustScrollbars. This resource was not used, and its
- funcionality was not finished, and by now, it is not required.
-TextAction.c:
- + Does not call XLookpupString in InsertChar any more, but the new function
- _XawLookupString (in XawIm.c) to work correclty with composed characters.
-XawIm.c:
- + Added the private function _XawLookupString, that just calls XmbLookupString,
- or in case of any initialization error, XLookupString.
-
--- xedit --
- The most important change is the addition of a new functionality, that allows
- the user to navigate the file system, in a 'ls -a' like list widget, if
- the file is not a directory it is loaded for edition, else, the list widget
- is rebuilt with the contents of the selected directory. To test it, just
- type: C-X d, or tab when 'finding a file'. To exit the dirwindow without
- loading a file, type C-G or Escape.
-Xedit-sample:
- + Added more some resource entries, to use the new 'emacs dired like' feature.
-Xedit.ad:
- + Same as for Xedit-sample, but more important resource settings.
-commands.c:
- + The code now checks if the filename is a directory and calls the dirwindow
- code in that case, when trying to open a file.
- + Changed the function IsDir from static to global, to use it from xedit.c.
- + Most of the code for the filesystem navigation window was added to this file.
-util.c:
- + Fixed a bug that was causing core dump due to passing garbage to XtGetValues
- as the widget address.
- + Added the code for managing the dirwindow and its relationship with the
- text windows to this file.
-xedit.c:
- + Added the code for creation the dirwindow to this file.
-
-
-#2638 2 Apr 1999
--- Xaw --
- + Added xpm pixmaps support to the library. This time, it is required to
- compile Xaw with -DUSE_XPM.
- + If the xpm image has a mask, the widget will be automatically reshaped
- to the pixmap mask.
- + Changed the kill_ring code in TextAction.c to always end in a text block
- of zero length, this way, it is easier to know when one traversed the
- entire kill ring (it may be interesting to forget the undo sequences
- while traversing the kill ring list).
-
--- xedit --
- + Changed the Xedit.ad file to avoid overriding a translation that would
- make the search window do not respond to WM_DELETE_WINODW messages.
- + Fixed a core dump condition in the new code for listing files and
- directories, due to deferencing a null pointer.
-
-
-#2662 10 Apr 1999
--- Xaw --
- + Corrected the problems gererated in my last patch. I was compiling with
- -DUSE_XPM defined, and did'nt realize that the patch would not compile
- without it. Just ifdef'ed again the code to avoid warnings or dead code.
-
--- xedit --
- + Added a ispell interface to xedit. Sorry for not documenting enough about it
- the man page, but here is a small explanation of the new funcionality:
- Replace: Replace's the selected word.
- All (right side of Replace button): Replaces all occurrences of the selected
- word.
- Undo: When this button is sensitive, allow undoing the last replace,
- this is useful when doing a incorrect "Replace All" action.
- Ignore: Ignore this word, and continues spell checking.
- All (right side of Ignore button): Ignore any further ocurrences of the
- selected word.
- Add: Add's the selected word to the user's private dictionary.
- Suspend: Go back to text edition, but does not kill the ispell process,
- This is useful if you have a really big dictionary or slow
- machine. I believe it is mostly useful to keep in memory
- the words selected to be ignored, but that you don't want to
- add to your private dictionary.
- Close: Kill the ispell process, and go back to text edition.
- Automatically saves the user's private dictionary.
- When pressing the Add button, the word in the "Mispelled word:" field is
- added to the user private dictionary (normally ~/.ispell_*). When pressing
- the Replace button, the text in the "Replace with:" field is used.
- If no word is selected in the "Suggestions:" field, this mean that the
- selected word was not found in the ispell dictionary.
-
-
-#2716 24 Apr 1999
--- Xaw --
- + Minor changes to AsciiSrc.c to try to get more speed in the FindPiece
- function. Xedit may become very slow when editing files bigger than 1M,
- and I'm studing ways to get more speed in the Scan and FindPiece functions.
- The FindPosition function in *Sink.c also can consume a lot of cpu time,
- and may need some rework.
- + Added submenus support to the SimpleMenuWidget. This is something essencial
- to a widget toolkit. Just plugged in the code of a menu widget I wrote some
- time ago. Xedit uses submenus now. To use it, set the resource menuName
- of a SmeBSBObject to the name of the submenu.
- + Added code for text justification to the TextWidget. To use the justification,
- set the resources autoFill, leftColumn and rightColumn. If autoFill is set,
- and leftColumn is smaller than rightColumn, an alternate code will be
- used in the form-paragrpah action, normally triggered with M-Q. The values
- for justification can be left, right, center and full.
- + Added a overwrite mode to the TextWidget. The default translation is to
- press the Insert key, that will toggle the overwrite mode.
- + Made the TextWidget understand negative values for the multiply. This is
- like the emacs feature, to indent text to the left. To set a negative value
- to the multiply, just start the numeric sequence with a '-'. Like C-U -1.
- + The code for justification added several new functions to TextAction.c.
- Functions to tabify, untabify, get block boundaries, verify if a line
- is completely blank, and strip excess of spaces.
- + Added a indent action to the TextWidget. The default translation, only
- used by xedit, is C-X Tab, did this way, to make it fully compatable with
- emacs, but other translations can be used. The multiply value is used to
- calculate the amount of spaces to move to the left or right.
- + Corrected a very hard to find (and reproduce) bug in the undo code, that
- would easily cause core dumps. The problem would happen when starting
- editing exactly in the moment the redo automatically reverts to undo.
- + Added translations for toggling the overwriting mode with the Insert key,
- and to paste the selection with S-Insert.
-
--- xedit --
- + Corrected all the known bugs in the ispell code (including a memory leak).
- And added a compile time limit of 16 levels of undo, for all the actions,
- that include Add, Ignore and Replace. 16 levels is more than enough, but
- more than this can be done with the undo action, but then, only to revert
- replaced text, to remove added words that the undo code forgot, it is
- required to edit the personal dictionary file. The code now also understands
- root/affix combinations, that ispell normally returns when using the
- -m option. The ispell code should now also work when using the international
- resource of the edit window.
- + Added a new file, called options.c, that holds the code for the editMenu,
- to enabling setting the wrap, autoFill, justify, leftColumn, rightColumn,
- verticalScroll and horizontalScroll resources of the current edit window.
-
-
-#2746 1 May 1999
--- Xaw --
- + Reverted most of the #if NeedWidePrototypes definitions, only two
- functions were kept, to not break some of the new features, but these
- functions aren't called by any program: XawTextSinkDisplayText and
- XawTextSinkClearToBackground.
- + Rewrite of the functions *Sink.c:FindPosition() and FindDistance() to
- try to get more speed.
- + Reworked the function Text.c:_BuildLineTable, to correct some strange
- code, and to avoid unecessary recalculations.
- + Made negative values of the multiply work for all the actions, not only
- for negative indentations. This makes the TextWidget behaviour more
- compatable with emacs.
- + Optimization of the new code for text justification, to avoid a call to
- malloc on every char typped, when undo is enabled.
- + Reorganized the offsets of the fields of the TextWidget, trying to make
- xxgdb work again with the new Xaw code, but, unfortunately, the SimpleWidget
- (a subclass of the TextWidget) have growed by 4 bytes (a XawDisplayList*)
- added at the end of the structure, and xxgdb incorrectly reads the text.sink
- field. Old xxgdb binaries dont work with the current code.
- + Removed several XtIsSubclass checks in TextSrc.c. While those checks could
- be useful for debugging, the functions are called so frequently that it is
- a big waste of time for running programs.
-
--- xedit --
- + Added/Changed some translations to work correctly when CapsLock and/or NumLock
- are pressed.
- + Fixed some bugs in the ispell code. The biggest bug was that it was not
- correctly saving the Add'ed words in the user dictionary when pressing the
- Close button.
-
-
-#2764 8 May 1999
--- Xaw --
- + Create two new private functions, to replace internally the public interfaces.
- These two functions are XawTextSinkClearToBackground and
- XawTextSinkDisplayText. These two functions use wide prototypes, and
- are required to support text lines that are represented by more than
- 32767 pixels. This was done to make sure that the public interfaces remain
- 100% backwards compatible.
- + Fixed the deferencing of a null pointer when the source object of a text
- widget is not initialized. I noticed this problem when recompiling xcolorsel.
- + Added a new type converter to Converters.c, that is Short -> String.
- + Added a new compile time option, called NO_BIN_COMPAT_HACK. If defined,
- it will break some programs that access private data. It only works with
- programs that access private data structures, but don't subclassify any
- widget. It fixed old binaries of chimera1, the Offix editor and xxgdb.
- There is no way to fix old binaries of chimera2, xcolorsel and xmh, these
- programs need to be recompiled. I would like to know of other programs that
- became broken, to try to fix them with the NO_BIN_COMPAT_HACK option.
- + Fixed some compile warnings, with shadowed, uninitialized and unused
- variables.
- + Fixed a inifite loop problem that could happen when the text widget window
- was resized to a very small width.
- + Reverted some of the text widget translations, to avoid conflicts when
- setting the input focus and programs that do so.
-
--- xedit --
- + Fixed a problem in the file-completion code, that would insert the partial
- match in the incorrect position, if the cursor was not at the end of the
- string.
- + Changed ispell.c to use only one hash for ignored and added words. Also
- changed the IspellSend function to not call itself recursively, what is
- a big problem when spell checking big files that are correct or have too
- few errors.
-
--- editres --
- + Changed Editres.ad in several places, to try to avoid resource setting
- problems. Most of them were changed to address more directly the resource,
- and avoid confusion. Also, added some new resource settings to configure
- the code I added to widgets.c.
- + Changed widgets.c to make sure the resource setting dialog is allways
- entirely in the screen, and if it does not fit, scrollbars will be created.
-
-
-#2793 15 May 1999
--- Xaw --
- + Changed AsciiSrc.c:LoadPieces to load the file incrementally, instead of
- allocating a big buffer.
- + Added several new functions to DisplayList.c. Almost all gc and painting
- related functions were mapped to displayList functions. There are
- several optimizations that can yet be done to the displayList code, and
- I'm working on it. That code is clearly not finished yet, but is stable.
- Also, changed some functions to be more exigent with it's parameters,
- because it is better to receive a warning message than see the program
- core dumping. The functions are documented in Xaw.man.
- + Corrected a problem in the SimpleMenu code, to make the sub menus popup
- more 'visually' correct, when popping up in the left side.
- + Added a optimization in Text.c, to avoid unnecessarily recalculating
- the line and column number when scrolling text. A big speed up should
- be seen when scrolling large files.
- + Modified all code that expected TAB_SIZE to be equal to 8, to read the
- TextSink resources, and work properly with whatever value the program
- had set to the tab stops.
- + Fixed a very bad bug in the form-paragraph function. It was very hard
- to find because I was looking at the wrong places. If the text was
- allready formatted, or did not need formatting, the code was not
- reenabling undo, making the undo/redo behaviour imprevisible.
-
--- xedit --
- + Added Xedit-color.ad file, to show some of the new features of Xaw.
- Tried to keep it simple, but since it uses gradients, maybe it should
- better be called Xedit-TrueColor. The better way to see the functionality
- of this file is (if you don't have it already) add to your .Xdefaults:
-#ifdef COLOR
-*customization: -color
-#endif
- and make sure xrdb parses it.
- + Changed a bit Xedit.ad, to work properly when Caps Lock is pressed.
- + Several changes to ispell.c. It should run very faster now, because
- the code keeps information about words already ignored or correct
- in the xedit side, instead of asking ispell every time. Added also
- a terseMode resource, and made the interface ask for user interaction
- allways ispell does not say the word is completely correct; the
- terseMode resource makes ispell itself decide what words are correct
- or not.
-
--- editres --
- + Small patch to Edit-col.ad, to use a default text cursor color of 'Azure'
- in text fields, instead of the default 'black'.
-
-
-#2811 22 May 1999
--- Xaw --
- + Removed the 'NO_NUMERIC_HACK' preprocessor definition, and renamed the
- 'doing_numeric_hack' field of the text widget to 'numeric'.
- + Changed the code to always create the horizontal scrollbar, if requested.
- + Small changes to TextPop.c, to automatically scroll horizontally the
- text window when the text found in a search/replace action is not visible.
- + Added a optimization when editting large files, to rebuild the line table
- if the region containing the text being added/replaced overlaps the lt.top
- field of the text widget.
- + Changed the undo code to also merge text typed when overwrite mode is
- active. The new behaviour is not like emacs (that generates a undo step
- for every character), but uses less memory, making only one undo/redo step.
-
--- xedit --
- + Added a new file, hook.c that is intended to be used for the addition of
- some new features to xedit, like auto indentation of program files. The
- first feature added is the 'autoReplace' resource, described in the xedit
- man page.
- + Corrected a bug in ispell.c, that would make the code alocate lots of
- memory unnecessarily, due to an uninitialized variable. Thanks to David
- Dawes that found the bug. The bug was not in 3.9Pn, but the solution in
- the later release was not completely correct.
-
-
-#2834 29 May 1999
--- Xaw --
- + Added a ChangeSensitive function to Command.c, to avoid it creating an
- incorrect insensitive border if the button is set. This is a side effect of
- the function XawCommandToggle I added some time ago. The solution for the
- problem is not very elegant, since it copies almost verbatim the code from
- Simple.c, but it works as expected.
- + Moved some calls to _XawTextSetLineAndColumnNumber in Text.c to other places,
- to make sure it is safe to change the text when the positionCallback is
- called (like what is done by the new xedit file hook.c).
- + Another optimization was added to the undo/redo code. Now it also merge
- erases, needing yet less memory for undo, and this way, generating less
- undo/redo steps.
- + Removed the default translation to call the toggle-overwrite action from
- TextTr.c. Only the xedit edit windows calls this translation now, instead of
- every text widget.
-
--- xedit --
- + Changed the auto replace feature to be a bit more easier to use. The new
- behaviour is almost identical, but if the user types some text, and it is
- auto replaced, only one undo step is enough to correct it. Example:
- 1) user types 'nto.'
- 2) text is auto replaced by 'not.'
- 3) user call undo action
- 4) text is converted to 'nto.'
- It should be a very infrequent problem, but makes the xedit behaviour
- identical to a "well known text editor", from where this feature was borrowed.
- + Added a 'Check' button to the ispell interface. This button allows
- checking the word in the text field. This feature was borrowed from the spell
- checking interface of the Netscape html editor.
- + The ispell checking interface now also asks for user interaction if there are
- two identical words togheter.
- + Added a status bar to the ispell interface, to give feedback to the user
- about what is happening.
- + Added some new resources, to let easier customization of the ispell status
- bar strings. The new resources are documented in xedit.man.
-
-#2849 5 Jun 1999
--- Xaw --
- + Add a OLDXAW define, to enable building a binary compatible version with
- 6.1, and changes to the Imakefile, to try to keep the changes only in Xaw.
- I hope it can be removed in the future.
- + Add a XawVendor define, with the value "XFree86". If this is not a good
- idea, please correct it an let me know.
- + Add a XawVersion define. The value for the new xaw is 7000L, and for the
- compatible one is 6700L (same comments as for the XawVendor define).
- + Bug fixes to the undo/redo code, and code to merge erases generated by
- ^H and ^D. Also, if the cursor is moved, it stops merging the text typped
- in the undo buffer.
- + Bug fixes to the Form widget geometry management code, to work correctly
- when child widgets are removed or added at run time.
- + Xaw now links with XPM by default, and the config files where changed to
- enable newly compiled programs to do so.
- + Added 16 pad bytes to every widget, to try to avoid binary compatability
- problems in the future.
- + Added a displayList resource to the Tree Widget.
- + Added the functions XawTextGetSink and XawTextLastPosition, to enable a
- public way to get the <TextWidget>->text.sink and <TextWidget>->text.lastPos,
- since these are the most commonly private fields the programs access in
- the text widget.
- + Added the actions 'capitalize-word', 'donwcase-word' and 'upcase-word' to
- TextAction.c. The bindings are the same as of Emacs (and the way it works).
- + Corrected some problems with negative values of the <TextWidget>->text.mult.
-
--- xedit --
- + Correct possible problem in the file hook.c, when interpreting the auto
- replace list, that is, it was not checking the buffer size when finding
- the '\' character.
- + Updates for the configuration files.
- + Added a 'Look' button the the ispell interface, that will by default run
- "/usr/bin/bin/egrep -i '^<VALUE OF TEXT FIELD>.*$' /usr/share/dict/words"
- and put up to 256 returned words in the ispell list. The behavior is
- almost identical to the one in the terminal interface of ispell.
- + The ispell interface works correctly with aspell now.
- + Added some resources and a popup to enable changing the dictionaries in
- run time.
- + Added a toggle button to the ispell interface to allow changing the terse
- mode in run-time.
- + Added a 'Uncap' button, to allow adding an uncapitalized word to the
- private dictionary, and enough code to do the capitalization checks inside
- of xedit (to enable undo actions).
- + Added a "text mode" and a "html mode". The html mode is not yet completely
- finished. It must work correctly with some html specific things like
- converting internally "&aacute;" to "á" and so on. I'm planning also, at
- least a nroff mode too.
- + The wordChars resource is set by dictionary now.
- To set the word chars for the br dictionary, write something like:
- *ispell*options.dictionaries.br.wordChars: <VALUE>
- or
- *ispell*br.wordChars: <VALUE>
- or simply
- *ispell*wordChars: <VALUE>
- + The skipLines resource is set only for the text mode now.
- To set it, write something like:
- *ispell*options.formats.text.skipLines: <VALUE>
- or
- *ispell*options*text.skipLines: <VALUE>
- or simply
- *ispell*skipLines: <VALUE>
-
-
-#2877 12 Jun 1999
--- Xaw --
- + Note: The compatible old version of Xaw is not fully compatible. There
- a few things that are not equal to the standard old Xaw. These are:
- + The cursor code in the *Sink.c files is not identical, and the
- field insertCursorOn (type Pixmap) was replaced by the field
- cursor_position (type XawTextPosition).
- + There are some changes in TextP.h, that include changes to the fields:
- options -> left_margin
- unrealize_callbacks -> pad1
- updateFrom -> update
- updateTo -> pad2
- numranges -> pad3
- maxranges -> from_left
- copy_area_offsets -> pad4
- + The text window does not increase its size when text is typed past
- the end of the window, instead of it, it is automatically scrolled
- horizontally, but this may not be enough to every usage of this
- feature; xmh uses that code to make the text widget auto resize
- warning popup widgets. I dont know what is better in this case,
- if re-enabling the auto resize code of changing xmh to use label
- widgets in the warning popups.
- It is very unlikely that exists code that will have problems with these
- changes in the fields of the TextWidget and the *SinkObject, but if any
- code that has trouble with it exists, I will promptly make the required
- changes to correct it (at least for the compatible version of Xaw).
- + Several optimizations for the code to redisplay the text window in the
- TextWidget. Including fixes for bugs in the XawTextScroll function, and
- making it really works. Previous versions of the library have made this
- function ineffective, because it was always redrawing everything when
- the text window was scrolled. The optimizations should be more noticeable
- when running some application that uses the TextWidget (like xedit) on
- slow hardware, or over slow connections.
- + Corrections for the FormWidget geometry management code, to work correctly
- in the old version of Xaw, and some bug fixes for the new Xaw. Also added
- 8 pad bytes to the FormConstraintsPart structure, to have space for extra
- information on possible future optimizations for the FormWidget geometry
- management code.
- + Some fixes for the OLDXAW define in the SimpleMenuWidget code, that was
- not hiding some of the new fields introduced in the new Xaw code.
- + Some corrections for the code handling the necessity of having scrollbars
- in the text widget, and bug fixes for cases where the scrollbars were not
- being updated when the text window contents were changed.
- + Re-enabled code to also process GraphicsExpose events in the text code. It
- became required due to the optimizations in the text redisplay code.
- + Several fixes in TextAction.c, for symbols that were not being included
- in the compatible version of the library, and for symbols that were being
- included with no need.
- + Fixes for the form-paragraph action, in the old Xaw code.
-
--- xedit --
- + Some bug fixes for the ispell undo code, to avoid deferencing a NULL pointer
- in the function IspellCheckUndo.
- + Added code to handle correctly &<VALUE>; in ispell.c, when using the html
- mode.
- + Fixed some compile time warnings, and updated the code for setting the
- scrollbars in options.c.
-
-
-#2899 19 Jun 1999
--- Xaw --
- + Changed all the 'char pad[<number>]' to 'XtPointer pad[<number>/4]' to
- make sure 64 bit machines will not have binary compatibility problems before
- the 32 bit ones.
- + Added a new static function 'WritePiecesToFile' to AsciiSrc.c, to avoid
- allocation of temporary memory. This is useful when editing very large
- files (I have some people using xedit on text files that can have up to
- 80,000 lines).
- + Added more some optimizations to AsciiSrc.c:Scan, to try to get the maximum
- speed of this function.
- + Added a new function to the displayList's, called 'image', that will tile
- pixmaps on the widget. It is documented in Xaw.man.
- + Several widget classes did not have a 'extension' field. I added it to them.
- The first usage of this field that I'm planning is to extend the *Src and
- *Sink objects to handle formatted text, and add text properties, like
- foreground, background, font and so on.
- + Fixed a bug in MultiSrc.c, that was crashing Xaw after the first character
- was typed, or if text was removed.
- + Some minor changes to SimpleMenu.c, to work properly with very large menus.
- + Fixed some bugs that were caused by my previous optimizations of the text
- redisplay code.
- + Bug fixes and optimizations to TextPop.c, there were some cases that the
- function XawTextDisableRediplay was being called, but XawTextEnableRedisplay
- was not being called later because of a error condition (the error
- conditions were only warnings).
-+ Updates to Xaw.man.
-
--- xedit --
- + Fixed a memory leak when freeing list widget strings. The code was not
- releasing the memory of the string at offset 0, in the list.
- + Changed the way the ispell undo code handles the terse mode, to not need
- to make the toggle button insensitive.
- + Updated xedit.man.
-
-
-#2932 26 Jun 1999
--- Xaw --
- + Added a new tip resource to the SimpleWidget. This may also be seen as
- a test of the binary compatibility issues. Besides of being a new feature,
- it cannot cause problems with old binaries, because the code is only
- called if the tip resource is set to any SimpleWidget subclass. If the
- tip resource is set or reset, the SimpleWidget code will call one of the
- two new functions XawTipEnable or XawTipDisable.
- + Added 3 new files: Tip.c, Tip.h and TipP.h. These files are used only
- by the new Xaw.
- + Updates to Xaw.man, including a problem with accented characters on SunOS.
-
--- xedit --
- + Added resource configurations to show the new tip code in Xaw.
- + Some fixes to ispell.c, to make it more previsible/user-friendly.
- + Fixes xedit.man to avoid problems with accented characters.
-
-
-#2964 3 Jul 1999
--- Xaw --
- + Fix for problem found in the search/replace dialog when using splitted
- windows in xedit.
- + Added initialization for the display_list field of the Tree widget.
-
--- xedit --
- + Fixed some problems in the undo code of ispell interface.
-
-
-#2999 10 Jul 1999
--- Xaw --
- + Added code to check the return value of XAllocColor and XAllocNamedColor in
- Pixmap.c.
- + Reverted back some code, and did a carefull review of the code in TextPop.c
- to avoid the possibility of calling XawTextDisableRedisplay, and not calling
- XawTextEnableRedisplay later (due to errors or end of file reached).
- + Added code to TextSrc.c, to use two static variables, that represent a new
- line in 8 bits and wchar_t, to avoid allocating memory in the undo buffers
- to store only a new line.
- + Small change in the behavior of the Tip widget, to not unmap the tip window
- when the cursor is moved.
-
--- Xmu --
- + Fixed a bug and a typo in the XmuToupper macro.
-
--- xedit --
- + Small update to the Xedit-sample file.
- + Fixed a bug in the ispell code that checks for repeated words.
-
-
-#3122 14 Aug 1999
--- Xaw --
- + Mixed fonts and colors can be used in the text widget (currently only
- in the Ascii*Object).
- + Added the XawTextAnchor, XawTextEntity, XawTextProperty, XawTextPropertyList,
- XawTextPaintStruct, XawTextPaintList and XawTextPropertyInfo structures to
- Xaw, to be used in the new text code.
- + Added the functions XawTextSourceAddAnchor, XawTextSourceNextAnchor,
- XawTextSourcePrevAnchor, XawTextSourceRemoveAnchor and
- XawTextSinkConvertPropertyList, that probably should not be used outside of
- Xaw.
- + Added the functions XawTextSourceFindAnchor, XawTextSourceAnchorAndEntity,
- XawTextSourceAddEntity, XawTextSourceClearEntities and XawTextSinkGetProperty
- that are probably the ones that should be most used in programs.
- + Italic fonts should be always displayed correctly.
- + The text widget cursor is now displayed with a gc with the Xor function, to
- avoid unnecessary computation/redrawing.
- + Most changes were done in the {Ascii,Text}{Src,Sink}Object, but the text
- widget was also a bit modified for things like automatically changing the
- number of lines in the line table when needed.
-
--- Xmu --
- + Fixed bug in Clip.c, that could cause a SEGV.
-
--- xedit --
- + Added the file c-mode.c, to interface with the new Xaw text code, and show
- what can be done when interfacing that new code.
- + Added the necessary code to util.c and options.c to let the user select
- if he or she wants to use the color/font syntax highlight in the C/C++ mode.
-
-
-# 26 Aug 1999
-
---Xaw--
- + Added initial support for two new XawTextEntity attributes, that enable
- hidden text and replaced text. This initial support was the minimum
- required to get the new html mode in xedit working. A lot of code does
- math with text positions, and became broken with the addition of these
- two attributes. Since only code that knows about these two attributes
- should use it, it is only a question to fix the remaining code in
- Xaw/xedit.
- + Bug fixes to AsciiSink.c:PreparePaint to work correctly with tabs and
- the two new entity attributes.
- + Disabled the translation "c<Key>q,<Key>Tab" of the search/replace popup.
- This action is already done by the translation "<Ctrl>Q,<Key>" that I added
- to TextTr.c. Disabling that translation has the advantage that now it
- is possible to replace ^Ms by nothing.
- + Added some new functions to TextSink.c. The functions XawTextSinkCopyProperty,
- XawTextSinkAddProperty and XawTextSinkCombineProperty are candidates to being
- public in the future, but, there is a problem when using
- XawTextSinkCombineProperty, that requires the AsciiSinkObject having the
- correct XawTextPropertyList, what can generate a "chicken and egg" like
- problem (I did some hacks in xedit to have the first html-mode version
- working).
- + Added several new flags to the XawTextProperty attributes, and a new field,
- called xlfd_mask.
- + Some bug fixes to XawTextSourceReplace and to the code to manage the
- XawTextAnchor e XawTextEntity structures. The form-paragraph, called with
- M-Q does several consecutive text changes, and was very useful to find bugs.
- + The flag XAW_TENTF_REPLACE is a hack for XawTextSourceAddEntity currently.
- The function XawTextSourceAddEntity will probably change its parameters
- to receive a structure pointer, or a pointer parameter.
-
---xedit--
- + Fixed some bugs in c-mode.c. Again, this patch fixes all the bugs I have
- found.
- + Added the html-mode.c file to xedit. The html-mode is in its initial steps.
- It is not usable yet, but should not core-dump or leak memory (unless you
- try to edit the file, then, I cannot say what will happen). The html mode
- should be used only to see a rendered version of the file, but, there are
- several markups not implemented. To be usable, it must yet understand at
- least <ul>, <ol>, <li>, <dl>, <dd>, <hr> and the table tags.
-
-
-
-$XFree86: xc/lib/Xaw/Changelog,v 3.32 1999/08/28 09:00:26 dawes Exp $
diff --git a/xc/lib/Xaw/Command.c b/xc/lib/Xaw/Command.c
deleted file mode 100644
index c29d1e89f..000000000
--- a/xc/lib/Xaw/Command.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/* $TOG: Command.c /main/80 1998/02/06 12:45:20 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Command.c,v 1.11 1999/06/13 13:47:18 dawes Exp $ */
-
-/*
- * Command.c - Command button widget
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/extensions/shape.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/CommandP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define DEFAULT_HIGHLIGHT_THICKNESS 2
-#define DEFAULT_SHAPE_HIGHLIGHT 32767
-
-/*
- * Class Methods
- */
-static void XawCommandClassInitialize(void);
-static void XawCommandDestroy(Widget);
-static void XawCommandInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawCommandRealize(Widget, Mask*, XSetWindowAttributes*);
-static void XawCommandResize(Widget);
-static void XawCommandRedisplay(Widget, XEvent*, Region);
-static Boolean XawCommandSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-static Bool ChangeSensitive(Widget);
-
-/*
- * Prototypes
- */
-static GC Get_GC(CommandWidget, Pixel, Pixel);
-static void PaintCommandWidget(Widget, XEvent*, Region, Bool);
-static Region HighlightRegion(CommandWidget);
-static Bool ShapeButton(CommandWidget, Bool);
-static void XawCommandToggle(Widget);
-
-/*
- * Actions
- */
-static void Highlight(Widget, XEvent*, String*, Cardinal*);
-static void Notify(Widget, XEvent*, String*, Cardinal*);
-static void Reset(Widget, XEvent*, String*, Cardinal*);
-static void Set(Widget, XEvent*, String*, Cardinal*);
-static void Unhighlight(Widget, XEvent*, String*, Cardinal*);
-static void Unset(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-static char defaultTranslations[] =
-"<Enter>:" "highlight()\n"
-"<Leave>:" "reset()\n"
-"<Btn1Down>:" "set()\n"
-"<Btn1Up>:" "notify() unset()\n"
-;
-
-#define offset(field) XtOffsetOf(CommandRec, field)
-static XtResource resources[] = {
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(command.callbacks),
- XtRCallback,
- NULL
- },
- {
- XtNhighlightThickness,
- XtCThickness,
- XtRDimension,
- sizeof(Dimension),
- offset(command.highlight_thickness),
- XtRImmediate,
- (XtPointer)DEFAULT_SHAPE_HIGHLIGHT
- },
- {
- XtNshapeStyle,
- XtCShapeStyle,
- XtRShapeStyle,
- sizeof(int),
- offset(command.shape_style),
- XtRImmediate,
- (XtPointer)XawShapeRectangle
- },
- {
- XtNcornerRoundPercent,
- XtCCornerRoundPercent,
- XtRDimension,
- sizeof(Dimension),
- offset(command.corner_round),
- XtRImmediate,
- (XtPointer)25
- },
-};
-#undef offset
-
-static XtActionsRec actionsList[] = {
- {"set", Set},
- {"notify", Notify},
- {"highlight", Highlight},
- {"reset", Reset},
- {"unset", Unset},
- {"unhighlight", Unhighlight}
-};
-
-#define SuperClass ((LabelWidgetClass)&labelClassRec)
-
-CommandClassRec commandClassRec = {
- /* core */
- {
- (WidgetClass)SuperClass, /* superclass */
- "Command", /* class_name */
- sizeof(CommandRec), /* size */
- XawCommandClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawCommandInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawCommandRealize, /* realize */
- actionsList, /* actions */
- XtNumber(actionsList), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawCommandDestroy, /* destroy */
- XawCommandResize, /* resize */
- XawCommandRedisplay, /* expose */
- XawCommandSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- ChangeSensitive, /* change_sensitive */
- },
- /* label */
- {
- 0, /* not used */
- },
- /* command */
- {
- 0, /* not used */
- },
-};
-
-WidgetClass commandWidgetClass = (WidgetClass)&commandClassRec;
-
-/*
- * Implementation
- */
-static GC
-Get_GC(CommandWidget cbw, Pixel fg, Pixel bg)
-{
- XGCValues values;
-
- values.foreground = fg;
- values.background = bg;
- values.font = cbw->label.font->fid;
- values.cap_style = CapProjecting;
-
- if (cbw->command.highlight_thickness > 1)
- values.line_width = cbw->command.highlight_thickness;
- else
- values.line_width = 0;
-
- if (cbw->simple.international == True)
- return (XtAllocateGC((Widget)cbw, 0,
- GCForeground | GCBackground | GCLineWidth |
- GCCapStyle, &values, GCFont, 0));
- else
- return (XtGetGC((Widget)cbw,
- GCForeground | GCBackground | GCFont | GCLineWidth |
- GCCapStyle, &values));
-}
-
-/*ARGSUSED*/
-static void
-XawCommandInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- CommandWidget cbw = (CommandWidget)cnew;
- int shape_event_base, shape_error_base;
-
- if (cbw->command.shape_style != XawShapeRectangle &&
- !XShapeQueryExtension(XtDisplay(cnew), &shape_event_base,
- &shape_error_base))
- cbw->command.shape_style = XawShapeRectangle;
-
- if (cbw->command.highlight_thickness == DEFAULT_SHAPE_HIGHLIGHT) {
- if (cbw->command.shape_style != XawShapeRectangle)
- cbw->command.highlight_thickness = 0;
- else
- cbw->command.highlight_thickness = DEFAULT_HIGHLIGHT_THICKNESS;
- }
-
- cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground,
- cbw->core.background_pixel);
- cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
- cbw->label.foreground);
- XtReleaseGC(cnew, cbw->label.normal_GC);
- cbw->label.normal_GC = cbw->command.normal_GC;
-
- cbw->command.set = False;
- cbw->command.highlighted = HighlightNone;
-}
-
-static Region
-HighlightRegion(CommandWidget cbw)
-{
- static Region outerRegion = NULL, innerRegion, emptyRegion;
- XRectangle rect;
-
- if (cbw->command.highlight_thickness == 0 ||
- cbw->command.highlight_thickness > Min(XtWidth(cbw), XtHeight(cbw)) / 2)
- return (NULL);
-
- if (outerRegion == NULL) {
- /* save time by allocating scratch regions only once. */
- outerRegion = XCreateRegion();
- innerRegion = XCreateRegion();
- emptyRegion = XCreateRegion();
- }
-
- rect.x = rect.y = 0;
- rect.width = XtWidth(cbw);
- rect.height = XtHeight(cbw);
- XUnionRectWithRegion(&rect, emptyRegion, outerRegion);
- rect.x = rect.y = cbw->command.highlight_thickness;
- rect.width -= cbw->command.highlight_thickness * 2;
- rect.height -= cbw->command.highlight_thickness * 2;
- XUnionRectWithRegion(&rect, emptyRegion, innerRegion);
- XSubtractRegion(outerRegion, innerRegion, outerRegion);
-
- return (outerRegion);
-}
-
-/***************************
-* Action Procedures
-***************************/
-static void
-XawCommandToggle(Widget w)
-{
- CommandWidget xaw = (CommandWidget)w;
- Arg args[2];
- Cardinal num_args;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNbackground,
- xaw->label.foreground); ++num_args;
- XtSetArg(args[num_args], XtNforeground,
- xaw->core.background_pixel); ++num_args;
- XtSetValues(w, args, num_args);
-}
-
-/*ARGSUSED*/
-static void
-Set(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- if (cbw->command.set)
- return;
-
- cbw->command.set= True;
- XawCommandToggle(w);
-}
-
-/*ARGSUSED*/
-static void
-Unset(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- if (!cbw->command.set)
- return;
-
- cbw->command.set = False;
- XawCommandToggle(w);
-}
-
-/*ARGSUSED*/
-static void
-Reset(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- if (cbw->command.set) {
- cbw->command.highlighted = HighlightNone;
- Unset(w, event, params, num_params);
- }
- else
- Unhighlight(w, event, params, num_params);
-}
-
-/*ARGSUSED*/
-static void
-Highlight(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- if (*num_params == (Cardinal)0)
- cbw->command.highlighted = HighlightWhenUnset;
- else {
- if (*num_params != (Cardinal)1)
- XtWarning("Too many parameters passed to highlight action table.");
- switch (params[0][0]) {
- case 'A':
- case 'a':
- cbw->command.highlighted = HighlightAlways;
- break;
- default:
- cbw->command.highlighted = HighlightWhenUnset;
- break;
- }
- }
-
- if (XtIsRealized(w))
- PaintCommandWidget(w, event, HighlightRegion(cbw), True);
-}
-
-/*ARGSUSED*/
-static void
-Unhighlight(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- cbw->command.highlighted = HighlightNone;
- if (XtIsRealized(w))
- PaintCommandWidget(w, event, HighlightRegion(cbw), True);
-}
-
-/*ARGSUSED*/
-static void
-Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- /* check to be sure state is still Set so that user can cancel
- the action (e.g. by moving outside the window, in the default
- bindings.
- */
- if (cbw->command.set)
- XtCallCallbackList(w, cbw->command.callbacks, (XtPointer) NULL);
-}
-
-static void
-XawCommandRedisplay(Widget w, XEvent *event, Region region)
-{
- PaintCommandWidget(w, event, region, False);
-}
-
-/*
- * Function:
- * PaintCommandWidget
- * Parameters:
- * w - command widget
- * region - region to paint (passed to the superclass)
- * change - did it change either set or highlight state?
- */
-static void
-PaintCommandWidget(Widget w, XEvent *event, Region region, Bool change)
-{
- CommandWidget cbw = (CommandWidget)w;
- Bool very_thick;
- GC norm_gc, rev_gc;
-
- very_thick = cbw->command.highlight_thickness
- > Min(XtWidth(cbw), XtHeight(cbw)) / 2;
-
- if (cbw->command.highlight_thickness == 0) {
- (*SuperClass->core_class.expose) (w, event, region);
- return;
- }
-
- /*
- * If we are set then use the same colors as if we are not highlighted
- */
-
- if (cbw->command.highlighted != HighlightNone) {
- norm_gc = cbw->command.inverse_GC;
- rev_gc = cbw->command.normal_GC;
- }
- else {
- norm_gc = cbw->command.normal_GC;
- rev_gc = cbw->command.inverse_GC;
- }
-
- if (!((!change && cbw->command.highlighted == HighlightNone)
- || (cbw->command.highlighted == HighlightWhenUnset
- && cbw->command.set))) {
- if (very_thick)
- XFillRectangle(XtDisplay(w),XtWindow(w), rev_gc,
- 0, 0, XtWidth(cbw), XtHeight(cbw));
- else {
- /* wide lines are centered on the path, so indent it */
- if (cbw->core.background_pixmap != XtUnspecifiedPixmap &&
- rev_gc == cbw->command.inverse_GC) {
- XClearArea(XtDisplay(w), XtWindow(w),
- 0, 0, XtWidth(cbw), cbw->command.highlight_thickness,
- False);
- XClearArea(XtDisplay(w), XtWindow(w),
- 0, cbw->command.highlight_thickness,
- cbw->command.highlight_thickness,
- XtHeight(cbw) - (cbw->command.highlight_thickness<<1),
- False);
- XClearArea(XtDisplay(w), XtWindow(w),
- XtWidth(cbw) - cbw->command.highlight_thickness,
- cbw->command.highlight_thickness,
- cbw->command.highlight_thickness,
- XtHeight(cbw) - (cbw->command.highlight_thickness<<1),
- False);
- XClearArea(XtDisplay(w), XtWindow(w),
- 0, XtHeight(cbw) - cbw->command.highlight_thickness,
- XtWidth(cbw), cbw->command.highlight_thickness,
- False);
- }
- else {
- int offset = cbw->command.highlight_thickness / 2;
-
- XDrawRectangle(XtDisplay(w),XtWindow(w), rev_gc, offset, offset,
- XtWidth(cbw) - cbw->command.highlight_thickness,
- XtHeight(cbw) - cbw->command.highlight_thickness);
- }
- }
- }
-
- (*SuperClass->core_class.expose)(w, event, region);
-}
-
-static void
-XawCommandDestroy(Widget w)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- /* Label will release cbw->command.normal_GC */
- XtReleaseGC(w, cbw->command.inverse_GC);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawCommandSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- CommandWidget oldcbw = (CommandWidget)current;
- CommandWidget cbw = (CommandWidget)cnew;
- Boolean redisplay = False;
-
- if (oldcbw->core.sensitive != cbw->core.sensitive && !cbw->core.sensitive) {
- if (cbw->command.set)
- XawCommandToggle(cnew);
- cbw->command.set = False;
- cbw->command.highlighted = HighlightNone;
- redisplay = True;
- }
-
- if (oldcbw->label.foreground != cbw->label.foreground
- || oldcbw->core.background_pixel != cbw->core.background_pixel
- || oldcbw->command.highlight_thickness
- != cbw->command.highlight_thickness
- || oldcbw->label.font != cbw->label.font) {
- XtReleaseGC(cnew, cbw->command.inverse_GC);
-
- cbw->command.normal_GC = Get_GC(cbw, cbw->label.foreground,
- cbw->core.background_pixel);
- cbw->command.inverse_GC = Get_GC(cbw, cbw->core.background_pixel,
- cbw->label.foreground);
- XtReleaseGC(cnew, cbw->label.normal_GC);
- cbw->label.normal_GC = cbw->command.normal_GC;
-
- redisplay = True;
- }
-
- if (XtIsRealized(cnew)
- && oldcbw->command.shape_style != cbw->command.shape_style
- && !ShapeButton(cbw, True))
- cbw->command.shape_style = oldcbw->command.shape_style;
-
- return (redisplay);
-}
-
-static void
-XawCommandClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtSetTypeConverter(XtRString, XtRShapeStyle, XmuCvtStringToShapeStyle,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRShapeStyle, XtRString, XmuCvtShapeStyleToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-static Bool
-ShapeButton(CommandWidget cbw, Bool checkRectangular)
-{
- Dimension corner_size = 0;
-
- if (cbw->command.shape_style == XawShapeRoundedRectangle) {
- corner_size = XtWidth(cbw) < XtHeight(cbw) ?
- XtWidth(cbw) : XtHeight(cbw);
- corner_size = (corner_size * cbw->command.corner_round) / 100;
- }
-
- if (checkRectangular || cbw->command.shape_style != XawShapeRectangle) {
- if (!XmuReshapeWidget((Widget)cbw, cbw->command.shape_style,
- corner_size, corner_size)) {
- cbw->command.shape_style = XawShapeRectangle;
- return (False);
- }
- }
-
- return (True);
-}
-
-static void
-XawCommandRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
-{
- (*commandWidgetClass->core_class.superclass->core_class.realize)
- (w, valueMask, attributes);
-
- ShapeButton((CommandWidget)w, False);
-}
-
-static void
-XawCommandResize(Widget w)
-{
- if (XtIsRealized(w))
- ShapeButton((CommandWidget)w, False);
-
- (*commandWidgetClass->core_class.superclass->core_class.resize)(w);
-}
-
-static Bool
-ChangeSensitive(Widget w)
-{
- CommandWidget cbw = (CommandWidget)w;
-
- if (XtIsRealized(w)) {
- if (XtIsSensitive(w)) {
- if (w->core.border_pixmap != XtUnspecifiedPixmap)
- XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
- w->core.border_pixmap);
- else
- XSetWindowBorder(XtDisplay(w), XtWindow(w),
- w->core.border_pixel);
- }
- else {
- if (cbw->simple.insensitive_border == None)
- cbw->simple.insensitive_border =
- XmuCreateStippledPixmap(XtScreen(w),
- w->core.border_pixel,
- cbw->command.set ?
- cbw->label.foreground :
- w->core.background_pixel,
- w->core.depth);
- XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
- cbw->simple.insensitive_border);
- }
- }
-
- return (False);
-}
diff --git a/xc/lib/Xaw/Command.h b/xc/lib/Xaw/Command.h
deleted file mode 100644
index 38d417914..000000000
--- a/xc/lib/Xaw/Command.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $TOG: Command.h /main/30 1998/02/06 12:45:25 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Command.h,v 1.4 1998/10/03 08:42:03 dawes Exp $ */
-
-#ifndef _XawCommand_h
-#define _XawCommand_h
-
-#include <X11/Xaw/Label.h>
-
-/* Command widget resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- accelerators Accelerators AcceleratorTable NULL
- ancestorSensitive AncestorSensitive Boolean True
- background Background Pixel XtDefaultBackground
- backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
- bitmap Pixmap Pixmap None
- borderColor BorderColor Pixel XtDefaultForeground
- borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
- borderWidth BorderWidth Dimension 1
- callback Callback XtCallbackList NULL
- colormap Colormap Colormap parent's colormap
- cornerRoundPercent CornerRoundPercent Dimension 25
- cursor Cursor Cursor None
- cursorName Cursor String NULL
- depth Depth int parent's depth
- destroyCallback Callback XtCallbackList NULL
- displayList DisplayList XawDisplayList* NULL
- encoding Encoding UnsignedChar XawTextEncoding8bit
- font Font XFontStruct* XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension text height
- highlightThickness Thickness Dimension 0 if shaped, else 2
- insensitiveBorder Insensitive Pixmap Gray
- internalHeight Height Dimension 2
- internalWidth Width Dimension 4
- justify Justify XtJustify XtJustifyCenter
- label Label String NULL
- leftBitmap LeftBitmap Pixmap None
- mappedWhenManaged MappedWhenManaged Boolean True
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- resize Resize Boolean True
- screen Screen Screen parent's Screen
- sensitive Sensitive Boolean True
- shapeStyle ShapeStyle ShapeStyle Rectangle
- translations Translations TranslationTable see doc or source
- width Width Dimension text width
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtNhighlightThickness "highlightThickness"
-
-#define XtNshapeStyle "shapeStyle"
-#define XtCShapeStyle "ShapeStyle"
-#define XtRShapeStyle "ShapeStyle"
-#define XtNcornerRoundPercent "cornerRoundPercent"
-#define XtCCornerRoundPercent "CornerRoundPercent"
-
-#define XawShapeRectangle XmuShapeRectangle
-#define XawShapeOval XmuShapeOval
-#define XawShapeEllipse XmuShapeEllipse
-#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
-
-extern WidgetClass commandWidgetClass;
-
-typedef struct _CommandClassRec *CommandWidgetClass;
-typedef struct _CommandRec *CommandWidget;
-
-#endif /* _XawCommand_h */
diff --git a/xc/lib/Xaw/CommandP.h b/xc/lib/Xaw/CommandP.h
deleted file mode 100644
index 516b86146..000000000
--- a/xc/lib/Xaw/CommandP.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-* $TOG: CommandP.h /main/28 1998/02/06 12:45:15 kaleb $
-*/
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/CommandP.h,v 1.6 1999/06/20 08:40:58 dawes Exp $ */
-
-#ifndef _XawCommandP_h
-#define _XawCommandP_h
-
-/*
- * Command Widget Private Data
- */
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/LabelP.h>
-
-typedef enum {
- HighlightNone, /* Do not highlight */
- HighlightWhenUnset, /* Highlight only when unset, this is
- to preserve current command widget
- functionality */
- HighlightAlways /* Always highlight, lets the toggle widget
- and other subclasses do the right thing */
-} XtCommandHighlight;
-
-/* New fields for the Command widget class record */
-typedef struct _CommandClass {
- XtPointer extension;
-} CommandClassPart;
-
-/* Full class record declaration */
-typedef struct _CommandClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- LabelClassPart label_class;
- CommandClassPart command_class;
-} CommandClassRec;
-
-extern CommandClassRec commandClassRec;
-
-/* New fields for the Command widget record */
-typedef struct {
- /* resources */
- Dimension highlight_thickness;
- XtCallbackList callbacks;
-
- /* private state */
- Pixmap gray_pixmap;
- GC normal_GC;
- GC inverse_GC;
- Boolean set;
- XtCommandHighlight highlighted;
-
- /* more resources */
- int shape_style;
- Dimension corner_round;
-
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} CommandPart;
-
-/* Full widget declaration */
-typedef struct _CommandRec {
- CorePart core;
- SimplePart simple;
- LabelPart label;
- CommandPart command;
-} CommandRec;
-
-#endif /* _XawCommandP_h */
diff --git a/xc/lib/Xaw/Converters.c b/xc/lib/Xaw/Converters.c
deleted file mode 100644
index 99ea5aa94..000000000
--- a/xc/lib/Xaw/Converters.c
+++ /dev/null
@@ -1,698 +0,0 @@
-/*
- * Copyright (c) 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 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.
- */
-
-/* $XFree86: xc/lib/Xaw/Converters.c,v 3.14 1999/06/20 08:40:59 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/Simple.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#ifndef OLDXAW
-
-/*
- * Definitions
- */
-#define done(type, value) \
-{ \
- if (toVal->addr != NULL) \
- { \
- if (toVal->size < sizeof(type)) \
- { \
- toVal->size = sizeof(type); \
- return (False); \
- } \
- *(type *)(toVal->addr) = (value); \
- } \
- else \
- { \
- static type static_val; \
- \
- static_val = (value); \
- toVal->addr = (XPointer)&static_val; \
- } \
- toVal->size = sizeof(type); \
- return (True); \
-}
-
-#define string_done(value) \
-{ \
- if (toVal->addr != NULL) \
- { \
- if (toVal->size < size) \
- { \
- toVal->size = size; \
- return (False); \
- } \
- strcpy((char *)toVal->addr, (value)); \
- } \
- else \
- toVal->addr = (XPointer)(value); \
- toVal->size = size; \
- return (True); \
-}
-
-/*
- * Prototypes
- */
-static Boolean _XawCvtAtomToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtBooleanToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtBoolToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtCARD32ToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtCardinalToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtDimensionToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtDisplayListToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtFontStructToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtIntToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtPixelToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtPixmapToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtShortToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtPositionToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtStringToDisplayList(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtStringToPixmap(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean _XawCvtUnsignedCharToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static void TypeToStringNoArgsWarning(Display*, String);
-
-/*
- * Initialization
- */
-static XtConvertArgRec PixelArgs[] = {
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
- sizeof(Colormap)},
-};
-
-static XtConvertArgRec DLArgs[] = {
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)},
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
- sizeof(Colormap)},
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.depth),
- sizeof(int)},
-};
-#endif /* OLDXAW */
-
-static String XtCToolkitError = "ToolkitError";
-static String XtNconversionError = "conversionError";
-
-#ifndef OLDXAW
-static String XtNwrongParameters = "wrongParameters";
-
-/*
- * Implementation
- */
-void
-XawInitializeDefaultConverters(void)
-{
- static Boolean first_time = True;
-
- if (first_time == False)
- return;
-
- first_time = False;
-
- /* Replace with more apropriate converters */
- XtSetTypeConverter(XtRCallback, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRColormap, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRFunction, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRPointer, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRScreen, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRStringArray, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRVisual, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRWidget, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRWidgetList, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRWindow, XtRString, _XawCvtCARD32ToString,
- NULL, 0, XtCacheNone, NULL);
-
- XtSetTypeConverter(XtRAtom, XtRString, _XawCvtAtomToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRBool, XtRString, _XawCvtBoolToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRBoolean, XtRString, _XawCvtBooleanToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRCardinal, XtRString, _XawCvtCardinalToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRDimension, XtRString, _XawCvtDimensionToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XawRDisplayList, XtRString, _XawCvtDisplayListToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRFontStruct, XtRString, _XawCvtFontStructToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRInt, XtRString, _XawCvtIntToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRPixel, XtRString, _XawCvtPixelToString,
- &PixelArgs[0], XtNumber(PixelArgs), XtCacheNone, NULL);
- XtSetTypeConverter(XtRPixmap, XtRString, _XawCvtPixmapToString,
- &DLArgs[0], XtNumber(DLArgs), XtCacheNone, NULL);
- XtSetTypeConverter(XtRPosition, XtRString, _XawCvtPositionToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRShort, XtRString, _XawCvtShortToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRString, XawRDisplayList, _XawCvtStringToDisplayList,
- &DLArgs[0], XtNumber(DLArgs), XtCacheAll, NULL);
- XtSetTypeConverter(XtRString, XtRPixmap, _XawCvtStringToPixmap,
- &DLArgs[0], XtNumber(DLArgs), XtCacheAll, NULL);
- XtSetTypeConverter(XtRUnsignedChar, XtRString, _XawCvtUnsignedCharToString,
- NULL, 0, XtCacheNone, NULL);
-}
-#endif /* OLDXAW */
-
-void
-XawTypeToStringWarning(Display *dpy, String type)
-{
- char fname[64];
- String params[1];
- Cardinal num_params;
-
- XmuSnprintf(fname, sizeof(fname), "cvt%sToString", type);
-
- params[0] = type;
- num_params = 1;
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNconversionError, fname, XtCToolkitError,
- "Cannot convert %s to String",
- params, &num_params);
-}
-
-#ifndef OLDXAW
-static void
-TypeToStringNoArgsWarning(Display *dpy, String type)
-{
- char fname[64];
- String params[1];
- Cardinal num_params;
-
- XmuSnprintf(fname, sizeof(fname), "cvt%sToString", type);
-
- params[0] = type;
- num_params = 1;
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNconversionError, fname,
- XtCToolkitError,
- "%s to String conversion needs no extra arguments",
- params, &num_params);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtBooleanToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[6];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRBoolean);
-
- XmuSnprintf(buffer, sizeof(buffer), "%s",
- *(Boolean *)fromVal->addr ? XtEtrue : XtEfalse);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtBoolToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[6];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRBool);
-
- XmuSnprintf(buffer, sizeof(buffer), "%s",
- *(Bool *)fromVal->addr ? XtEtrue : XtEfalse);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtPositionToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[7];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRPosition);
-
- XmuSnprintf(buffer, sizeof(buffer), "%d", *(Position *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtShortToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[7];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRShort);
-
- XmuSnprintf(buffer, sizeof(buffer), "%d", *(short *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtDimensionToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[6];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRDimension);
-
- XmuSnprintf(buffer, sizeof(buffer), "%u", *(Dimension *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtCARD32ToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[11];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, "CARD32");
-
- XmuSnprintf(buffer, sizeof(buffer), "0x%08hx", *(int *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtIntToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[12];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRInt);
-
- XmuSnprintf(buffer, sizeof(buffer), "%d", *(int *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtCardinalToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[11];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRCardinal);
-
- XmuSnprintf(buffer, sizeof(buffer), "%u", *(Cardinal *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtAtomToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char *buffer = NULL;
- static char *nullatom = "NULL";
- Cardinal size;
- Atom atom;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRAtom);
-
- if (buffer && buffer != nullatom)
- XFree(buffer);
-
- atom = *(Atom *)fromVal[0].addr;
- if (atom == 0)
- buffer = nullatom;
- else if ((buffer = XGetAtomName(dpy, *(Atom *)fromVal[0].addr)) == NULL)
- {
- XawTypeToStringWarning(dpy, XtRAtom);
- toVal->addr = NULL;
- toVal->size = sizeof(String);
- return (False);
- }
-
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtPixelToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[19];
- Cardinal size;
- Colormap colormap;
- XColor color;
-
- if (*num_args != 1)
- {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters, "cvtPixelToString",
- XtCToolkitError,
- "Pixel to String conversion needs colormap argument",
- NULL, NULL);
- return (False);
- }
-
- colormap = *(Colormap *)args[0].addr;
- color.pixel = *(Pixel *)fromVal->addr;
-
- /* Note:
- * If we know the visual type, we can calculate the xcolor
- * without asking Xlib.
- */
- XQueryColor(dpy, colormap, &color);
- XmuSnprintf(buffer, sizeof(buffer), "rgb:%04hx/%04hx/%04hx",
- color.red, color.green, color.blue);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtFontStructToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[128];
- Cardinal size;
- Atom atom;
- unsigned long value;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRFontStruct);
-
- if ((atom = XInternAtom(dpy, "FONT", True)) == None)
- return (False);
-
- size = 0;
-
- if (XGetFontProperty(*(XFontStruct **)fromVal->addr, atom, &value))
- {
- char *tmp = XGetAtomName(dpy, value);
-
- if (tmp)
- {
- XmuSnprintf(buffer, sizeof(buffer), "%s", tmp);
- size = strlen(tmp);
- XFree(tmp);
- }
- }
-
- if (size)
- {
- ++size;
- string_done(buffer);
- }
-
- XawTypeToStringWarning(dpy, XtRFontStruct);
-
- return (False);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtUnsignedCharToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char buffer[4];
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XtRUnsignedChar);
-
- XmuSnprintf(buffer, sizeof(buffer), "%u",
- *(unsigned char *)fromVal->addr);
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtStringToDisplayList(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- XawDisplayList *dlist;
- Screen *screen;
- Colormap colormap;
- int depth;
- String commands;
-
- if (*num_args != 3)
- {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters, "cvtStringToDisplayList",
- XtCToolkitError,
- "String to DisplayList conversion needs screen, "
- "colormap, and depth arguments",
- NULL, NULL);
- return (False);
- }
-
- screen = *(Screen **)args[0].addr;
- colormap = *(Colormap *)args[1].addr;
- depth = *(int *)args[2].addr;
-
- commands = (String)(fromVal[0].addr);
-
- dlist = XawCreateDisplayList(commands, screen, colormap, depth);
-
- if (!dlist)
- {
- XtDisplayStringConversionWarning(dpy, (String)fromVal->addr,
- XawRDisplayList);
- toVal->addr = NULL;
- toVal->size = sizeof(XawDisplayList*);
- return (False);
- }
-
- done(XawDisplayList*, dlist);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtDisplayListToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- String buffer;
- Cardinal size;
-
- if (*num_args != 0)
- TypeToStringNoArgsWarning(dpy, XawRDisplayList);
-
- buffer = XawDisplayListString(*(XawDisplayList **)(fromVal[0].addr));
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtStringToPixmap(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- XawPixmap *xaw_pixmap;
- Pixmap pixmap;
- Screen *screen;
- Colormap colormap;
- int depth;
- String name;
-
- if (*num_args != 3)
- {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters, "cvtStringToPixmap",
- XtCToolkitError,
- "String to Pixmap conversion needs screen, "
- "colormap, and depth arguments",
- NULL, NULL);
- return (False);
- }
-
- screen = *(Screen **)args[0].addr;
- colormap = *(Colormap *)args[1].addr;
- depth = *(int *)args[2].addr;
-
- name = (String)(fromVal[0].addr);
-
- if (XmuCompareISOLatin1(name, "None") == 0)
- pixmap = None;
- else if (XmuCompareISOLatin1(name, "ParentRelative") == 0)
- pixmap = ParentRelative;
- else if (XmuCompareISOLatin1(name, "XtUnspecifiedPixmap") == 0)
- pixmap = XtUnspecifiedPixmap;
- else
- {
- xaw_pixmap = XawLoadPixmap(name, screen, colormap, depth);
- if (!xaw_pixmap)
- {
- XtDisplayStringConversionWarning(dpy, (String)fromVal->addr,
- XtRPixmap);
- toVal->addr = (XtPointer)XtUnspecifiedPixmap;
- toVal->size = sizeof(Pixmap);
- return (False);
- }
- else
- pixmap = xaw_pixmap->pixmap;
- }
-
- done(Pixmap, pixmap);
-}
-
-/*ARGSUSED*/
-static Boolean
-_XawCvtPixmapToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- XawPixmap *xaw_pixmap;
- Pixmap pixmap;
- Screen *screen;
- Colormap colormap;
- int depth;
- String buffer = NULL;
- Cardinal size;
-
- if (*num_args != 3)
- {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters, "cvtPixmapToString",
- XtCToolkitError,
- "Pixmap to String conversion needs screen, "
- "colormap, and depth arguments",
- NULL, NULL);
- return (False);
- }
-
- screen = *(Screen **)args[0].addr;
- colormap = *(Colormap *)args[1].addr;
- depth = *(int *)args[2].addr;
-
- pixmap = *(Pixmap *)(fromVal[0].addr);
-
- switch (pixmap)
- {
- case None:
- buffer = "None";
- break;
- case ParentRelative:
- buffer = "ParentRelative";
- break;
- case XtUnspecifiedPixmap:
- buffer = "XtUnspecifiedPixmap";
- break;
- default:
- xaw_pixmap = XawPixmapFromXPixmap(pixmap, screen, colormap, depth);
- if (xaw_pixmap)
- buffer = xaw_pixmap->name;
- break;
- }
-
- if (!buffer)
- /* Bad Pixmap or Pixmap was not loaded by XawLoadPixmap() */
- return (_XawCvtCARD32ToString(dpy, args, num_args, fromVal, toVal,
- converter_data));
-
- size = strlen(buffer) + 1;
-
- string_done(buffer);
-}
-
-#endif /* OLDXAW */
diff --git a/xc/lib/Xaw/Dialog.c b/xc/lib/Xaw/Dialog.c
deleted file mode 100644
index 8aa828920..000000000
--- a/xc/lib/Xaw/Dialog.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/* $TOG: Dialog.c /main/49 1998/02/06 12:45:36 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Dialog.c,v 1.5 1999/06/06 08:47:55 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Label.h>
-#include <X11/Xaw/DialogP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * After we have set the string in the value widget we set the
- * string to a magic value. So that when a SetValues request is made
- * on the dialog value we will notice it, and reset the string
- */
-#define MAGIC_VALUE ((char *)3)
-
-#define streq(a,b) (strcmp((a), (b)) == 0)
-
-/*
- * Class Methods
- */
-static void XawDialogConstraintInitialize(Widget, Widget,
- ArgList, Cardinal*);
-static void XawDialogGetValuesHook(Widget, ArgList, Cardinal*);
-static void XawDialogInitialize(Widget, Widget, ArgList, Cardinal*);
-static Boolean XawDialogSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void CreateDialogValueWidget(Widget);
-
-/*
- * Initialization
- */
-static XtResource resources[] = {
- {
- XtNlabel,
- XtCLabel,
- XtRString,
- sizeof(String),
- XtOffsetOf(DialogRec, dialog.label),
- XtRString,
- NULL
- },
- {
- XtNvalue,
- XtCValue,
- XtRString,
- sizeof(String),
- XtOffsetOf(DialogRec, dialog.value),
- XtRString,
- NULL
- },
- {
- XtNicon,
- XtCIcon,
- XtRBitmap,
- sizeof(Pixmap),
- XtOffsetOf(DialogRec, dialog.icon),
- XtRImmediate,
- 0
- },
-};
-
-DialogClassRec dialogClassRec = {
- /* core */
- {
- (WidgetClass)&formClassRec, /* superclass */
- "Dialog", /* class_name */
- sizeof(DialogRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part init */
- False, /* class_inited */
- XawDialogInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- XawDialogSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- XawDialogGetValuesHook, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XtInheritGeometryManager, /* geometry_manager */
- XtInheritChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- /* constraint */
- {
- NULL, /* subresourses */
- 0, /* subresource_count */
- sizeof(DialogConstraintsRec), /* constraint_size */
- XawDialogConstraintInitialize, /* initialize */
- NULL, /* destroy */
- NULL, /* set_values */
- NULL, /* extension */
- },
- /* form */
- {
- XtInheritLayout, /* layout */
- },
- /* dialog */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec;
-
-/*
- * Implementation
- */
-/*ARGSUSED*/
-static void
-XawDialogInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- DialogWidget dw = (DialogWidget)cnew;
- Arg arglist[9];
- Cardinal arg_cnt = 0;
-
- XtSetArg(arglist[arg_cnt], XtNborderWidth, 0); arg_cnt++;
- XtSetArg(arglist[arg_cnt], XtNleft, XtChainLeft); arg_cnt++;
-
- if (dw->dialog.icon != (Pixmap)0) {
- XtSetArg(arglist[arg_cnt], XtNbitmap, dw->dialog.icon); arg_cnt++;
- XtSetArg(arglist[arg_cnt], XtNright, XtChainLeft); arg_cnt++;
- dw->dialog.iconW = XtCreateManagedWidget("icon", labelWidgetClass,
- cnew, arglist, arg_cnt);
- arg_cnt = 2;
- XtSetArg(arglist[arg_cnt], XtNfromHoriz, dw->dialog.iconW); arg_cnt++;
- }
- else
- dw->dialog.iconW = NULL;
-
- XtSetArg(arglist[arg_cnt], XtNlabel, dw->dialog.label); arg_cnt++;
- XtSetArg(arglist[arg_cnt], XtNright, XtChainRight); arg_cnt++;
-
- dw->dialog.labelW = XtCreateManagedWidget("label", labelWidgetClass,
- cnew, arglist, arg_cnt);
-
- if (dw->dialog.iconW != NULL &&
- XtHeight(dw->dialog.labelW) < XtHeight(dw->dialog.iconW)) {
- XtSetArg(arglist[0], XtNheight, XtHeight(dw->dialog.iconW));
- XtSetValues(dw->dialog.labelW, arglist, 1);
- }
- if (dw->dialog.value != NULL)
- CreateDialogValueWidget((Widget)dw);
- else
- dw->dialog.valueW = NULL;
-}
-
-/*ARGSUSED*/
-static void
-XawDialogConstraintInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- DialogWidget dw = (DialogWidget)cnew->core.parent;
- DialogConstraints constraint = (DialogConstraints)cnew->core.constraints;
-
- if (!XtIsSubclass(cnew, commandWidgetClass)) /* if not a button */
- return; /* then just use defaults */
-
- constraint->form.left = constraint->form.right = XtChainLeft;
- if (dw->dialog.valueW == NULL)
- constraint->form.vert_base = dw->dialog.labelW;
- else
- constraint->form.vert_base = dw->dialog.valueW;
-
- if (dw->composite.num_children > 1) {
- WidgetList children = dw->composite.children;
- Widget *childP;
-
- for (childP = children + dw->composite.num_children - 1;
- childP >= children; childP-- ) {
- if (*childP == dw->dialog.labelW || *childP == dw->dialog.valueW)
- break;
- if (XtIsManaged(*childP) &&
- XtIsSubclass(*childP, commandWidgetClass)) {
- constraint->form.horiz_base = *childP;
- break;
- }
- }
- }
-}
-
-#define ICON 0
-#define LABEL 1
-#define NUM_CHECKS 2
-/*ARGSUSED*/
-static Boolean
-XawDialogSetValues(Widget current, Widget request, Widget cnew,
- ArgList in_args, Cardinal *in_num_args)
-{
- DialogWidget w = (DialogWidget)cnew;
- DialogWidget old = (DialogWidget)current;
- Arg args[5];
- Cardinal num_args;
- unsigned int i;
- Bool checks[NUM_CHECKS];
-
- for (i = 0; i < NUM_CHECKS; i++)
- checks[i] = False;
-
- for (i = 0; i < *in_num_args; i++) {
- if (streq(XtNicon, in_args[i].name))
- checks[ICON] = True;
- else if (streq(XtNlabel, in_args[i].name))
- checks[LABEL] = True;
- }
-
- if (checks[ICON]) {
- if (w->dialog.icon != 0) {
- XtSetArg(args[0], XtNbitmap, w->dialog.icon);
- if (old->dialog.iconW != NULL)
- XtSetValues(old->dialog.iconW, args, 1);
- else {
- XtSetArg(args[1], XtNborderWidth, 0);
- XtSetArg(args[2], XtNleft, XtChainLeft);
- XtSetArg(args[3], XtNright, XtChainLeft);
- w->dialog.iconW = XtCreateWidget("icon", labelWidgetClass,
- cnew, args, 4);
- ((DialogConstraints)w->dialog.labelW->core.constraints)->
- form.horiz_base = w->dialog.iconW;
- XtManageChild(w->dialog.iconW);
- }
- }
- else if (old->dialog.icon != 0) {
- ((DialogConstraints)w->dialog.labelW->core.constraints)->
- form.horiz_base = NULL;
- XtDestroyWidget(old->dialog.iconW);
- w->dialog.iconW = NULL;
- }
- }
-
- if (checks[LABEL]) {
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, w->dialog.label); num_args++;
- if (w->dialog.iconW != NULL &&
- XtHeight(w->dialog.labelW) <= XtHeight(w->dialog.iconW)) {
- XtSetArg(args[num_args], XtNheight, XtHeight(w->dialog.iconW));
- num_args++;
- }
- XtSetValues(w->dialog.labelW, args, num_args);
- }
-
- if (w->dialog.value != old->dialog.value) {
- if (w->dialog.value == NULL) /* only get here if it
- wasn't NULL before */
- XtDestroyWidget(old->dialog.valueW);
- else if (old->dialog.value == NULL) { /* create a new value widget */
- XtWidth(w) = XtWidth(old);
- XtHeight(w) = XtHeight(old);
- CreateDialogValueWidget(cnew);
- }
- else { /* Widget ok, just change string */
- Arg nargs[1];
-
- XtSetArg(nargs[0], XtNstring, w->dialog.value);
- XtSetValues(w->dialog.valueW, nargs, 1);
- w->dialog.value = MAGIC_VALUE;
- }
- }
-
- return (False);
-}
-
-/*
- * Function:
- * XawDialogGetValuesHook
- *
- * Parameters:
- * w - Dialog Widget
- * args - argument list
- * num_args - number of args
- *
- * Description:
- * This is a get values hook routine that gets the values in the dialog.
- */
-static void
-XawDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
-{
- Arg a[1];
- String s;
- DialogWidget src = (DialogWidget)w;
- unsigned int i;
-
- for (i = 0; i < *num_args; i++)
- if (streq(args[i].name, XtNvalue)) {
- XtSetArg(a[0], XtNstring, &s);
- XtGetValues(src->dialog.valueW, a, 1);
- *((char **)args[i].value) = s;
- }
-}
-
-/*
- * Function:
- * CreateDialogValueWidget
- *
- * Parameters:
- * w - dialog widget
- *
- * Description:
- * Creates the dialog widgets value widget.
- *
- * Note
- * Must be called only when w->dialog.value is non-nil
- */
-static void
-CreateDialogValueWidget(Widget w)
-{
- DialogWidget dw = (DialogWidget)w;
- Arg arglist[10];
- Cardinal num_args = 0;
-
- XtSetArg(arglist[num_args], XtNstring, dw->dialog.value); num_args++;
- XtSetArg(arglist[num_args], XtNresizable, True); num_args++;
- XtSetArg(arglist[num_args], XtNeditType, XawtextEdit); num_args++;
- XtSetArg(arglist[num_args], XtNfromVert, dw->dialog.labelW); num_args++;
- XtSetArg(arglist[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(arglist[num_args], XtNright, XtChainRight); num_args++;
-
- dw->dialog.valueW = XtCreateWidget("value", asciiTextWidgetClass,
- w, arglist, num_args);
-
- /* if the value widget is being added after buttons,
- * then the buttons need new layout constraints
- */
- if (dw->composite.num_children > 1) {
- WidgetList children = dw->composite.children;
- Widget *childP;
-
- for (childP = children + dw->composite.num_children - 1;
- childP >= children; childP-- ) {
- if (*childP == dw->dialog.labelW || *childP == dw->dialog.valueW)
- continue;
-
- if (XtIsManaged(*childP) &&
- XtIsSubclass(*childP, commandWidgetClass)) {
- ((DialogConstraints)(*childP)->core.constraints)->
- form.vert_base = dw->dialog.valueW;
- }
- }
- }
- XtManageChild(dw->dialog.valueW);
-
- /*
- * Value widget gets the keyboard focus
- */
- XtSetKeyboardFocus(w, dw->dialog.valueW);
- dw->dialog.value = MAGIC_VALUE;
-}
-
-void
-XawDialogAddButton(Widget dialog, _Xconst char* name, XtCallbackProc function,
- XtPointer param)
-{
- /*
- * Correct Constraints are all set in ConstraintInitialize()
- */
- Widget button;
-
- button = XtCreateManagedWidget(name, commandWidgetClass, dialog, NULL, 0);
-
- if (function != NULL) /* don't add NULL callback func */
- XtAddCallback(button, XtNcallback, function, param);
-}
-
-char *
-XawDialogGetValueString(Widget w)
-{
- Arg args[1];
- char *value;
-
- XtSetArg(args[0], XtNstring, &value);
- XtGetValues(((DialogWidget)w)->dialog.valueW, args, 1);
-
- return(value);
-}
diff --git a/xc/lib/Xaw/Dialog.h b/xc/lib/Xaw/Dialog.h
deleted file mode 100644
index 4a5863b86..000000000
--- a/xc/lib/Xaw/Dialog.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $TOG: Dialog.h /main/29 1998/02/06 12:45:41 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Dialog.h,v 1.4 1998/10/03 08:42:04 dawes Exp $ */
-
-#ifndef _XawDialog_h
-#define _XawDialog_h
-
-#include <X11/Xaw/Form.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- borderColor BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- destroyCallback Callback Pointer NULL
- height Height Dimension computed at create
- icon Icon Pixmap 0
- label Label String NULL
- mappedWhenManaged MappedWhenManaged Boolean True
- sensitive Sensitive Boolean True
- value Value String NULL
- width Width Dimension computed at create
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtCIcon "Icon"
-#define XtNicon "icon"
-
-typedef struct _DialogClassRec *DialogWidgetClass;
-typedef struct _DialogRec *DialogWidget;
-
-extern WidgetClass dialogWidgetClass;
-
-_XFUNCPROTOBEGIN
-
-void XawDialogAddButton
-(
- Widget dialog,
- _Xconst char *name,
- XtCallbackProc function,
- XtPointer client_data
- );
-
-char *XawDialogGetValueString
-(
- Widget w
-);
-
-_XFUNCPROTOEND
-
-#endif /* _XawDialog_h */
diff --git a/xc/lib/Xaw/DialogP.h b/xc/lib/Xaw/DialogP.h
deleted file mode 100644
index 3e4054ba0..000000000
--- a/xc/lib/Xaw/DialogP.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $TOG: DialogP.h /main/14 1998/02/06 12:45:30 kaleb $ */
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/DialogP.h,v 1.7 1999/06/20 08:40:59 dawes Exp $ */
-
-#ifndef _DialogP_h
-#define _DialogP_h
-
-#include <X11/Xaw/Dialog.h>
-#include <X11/Xaw/FormP.h>
-
-typedef struct {
- XtPointer extension;
-} DialogClassPart;
-
-typedef struct _DialogClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
- FormClassPart form_class;
- DialogClassPart dialog_class;
-} DialogClassRec;
-
-extern DialogClassRec dialogClassRec;
-
-typedef struct _DialogPart {
- /* resources */
- String label; /* description of the dialog */
- String value; /* for the user response */
- Pixmap icon; /* icon bitmap */
-
- /* private */
- Widget iconW; /* widget to display the icon */
- Widget labelW; /* widget to display description */
- Widget valueW; /* user response TextWidget */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} DialogPart;
-
-typedef struct _DialogRec {
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
- FormPart form;
- DialogPart dialog;
-} DialogRec;
-
-typedef struct {
- XtPointer extension;
-} DialogConstraintsPart;
-
-typedef struct _DialogConstraintsRec {
- FormConstraintsPart form;
- DialogConstraintsPart dialog;
-} DialogConstraintsRec, *DialogConstraints;
-
-#endif /* _DialogP_h */
diff --git a/xc/lib/Xaw/DisplayList.c b/xc/lib/Xaw/DisplayList.c
deleted file mode 100644
index e791de74f..000000000
--- a/xc/lib/Xaw/DisplayList.c
+++ /dev/null
@@ -1,2250 +0,0 @@
-/*
- * Copyright (c) 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 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.
- *
- * Author: Paulo César Pereira de Andrade
- */
-
-/* $XFree86: xc/lib/Xaw/DisplayList.c,v 3.15 1999/08/28 09:00:26 dawes Exp $ */
-
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/CoreP.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/SysUtil.h>
-#include "Private.h"
-
-#ifndef OLDXAW
-
-/*
- * Types
- */
-typedef struct _XawDLProc XawDLProc;
-typedef struct _XawDLData XawDLData;
-typedef struct _XawDLInfo XawDLInfo;
-
-struct _XawDLProc {
- XrmQuark qname;
- String *params;
- Cardinal num_params;
- XawDisplayListProc proc;
- XtPointer args;
- XawDLData *data;
-};
-
-struct _XawDLData {
- XawDLClass *dlclass;
- XtPointer data;
-};
-
-struct _XawDLInfo {
- String name;
- XrmQuark qname;
- XawDisplayListProc proc;
-};
-
-struct _XawDL {
- XawDLProc **procs;
- Cardinal num_procs;
- XawDLData **data;
- Cardinal num_data;
- Screen *screen;
- Colormap colormap;
- int depth;
- XrmQuark qrep; /* for cache lookup */
-};
-
-struct _XawDLClass {
- String name;
- XawDLInfo **infos;
- Cardinal num_infos;
- XawDLArgsInitProc args_init;
- XawDLArgsDestructor args_destructor;
- XawDLDataInitProc data_init;
- XawDLDataDestructor data_destructor;
-};
-
-/*
- * Private Methods
- */
-static XawDLClass *_XawFindDLClass(String);
-static int qcmp_dlist_class(_Xconst void*, _Xconst void*);
-static int bcmp_dlist_class(_Xconst void*, _Xconst void*);
-static XawDLInfo *_XawFindDLInfo(XawDLClass*, String);
-static int qcmp_dlist_info(_Xconst void*, _Xconst void*);
-static int bcmp_dlist_info(_Xconst void*, _Xconst void*);
-static void *_Xaw_Xlib_ArgsInitProc(String, String*, Cardinal*,
- Screen*, Colormap, int);
-static void _Xaw_Xlib_ArgsDestructor(Display*, String, XtPointer,
- String*, Cardinal*);
-static void *_Xaw_Xlib_DataInitProc(String, Screen*, Colormap, int);
-static void _Xaw_Xlib_DataDestructor(Display*, String, XtPointer);
-
-/*
- * Initialization
- */
-static XawDLClass **classes;
-static Cardinal num_classes;
-static String xlib = "xlib";
-
-/*
- * Implementation
- */
-void
-XawRunDisplayList(Widget w, _XawDisplayList *list,
- XEvent *event, Region region)
-{
- XawDLProc *proc;
- Cardinal i;
-
- if (!XtIsRealized(w))
- return;
-
- for (i = 0; i < list->num_procs; i++)
- {
- proc = list->procs[i];
- proc->proc(w, proc->args, proc->data->data, event, region);
- }
-}
-
-#define DLERR -2
-#define DLEOF -1
-#define DLEND 1
-#define DLNAME 2
-#define DLARG 3
-static char *
-read_token(char *src, char *dst, Cardinal size, int *status)
-{
- int ch;
- Bool esc, quote;
- Cardinal i;
-
- i = 0;
- esc = quote = False;
-
- /*CONSTCOND*/
- while (1)
- {
- ch = *src;
- if (ch != '\n' && isspace(ch))
- ++src;
- else
- break;
- }
-
- for (; i < size - 1; src++)
- {
- ch = *src;
- if (ch == '"')
- {
- if (quote)
- {
- quote = False;
- continue;
- }
- quote = True;
- continue;
- }
- if (ch == '\\')
- {
- if (esc)
- {
- dst[i++] = ch;
- esc = False;
- continue;
- }
- esc = True;
- continue;
- }
- if (ch == '\0')
- {
- *status = DLEOF;
- dst[i] = '\0';
- return (src);
- }
- else if (!esc)
- {
- if (!quote)
- {
- if (ch == ',')
- {
- *status = DLARG;
- dst[i] = '\0';
- return (++src);
- }
- else if (ch == ' ' || ch == '\t')
- {
- *status = DLNAME;
- dst[i] = '\0';
- return (++src);
- }
- else if (ch == ';' || ch == '\n')
- {
- *status = DLEND;
- dst[i] = '\0';
- return (++src);
- }
- }
- }
- else
- esc = False;
- dst[i++] = ch;
- }
-
- *status = DLERR;
- dst[i] = '\0';
-
- return (src);
-}
-
-_XawDisplayList *XawCreateDisplayList(String string, Screen *screen,
- Colormap colormap, int depth)
-{
- _XawDisplayList *dlist;
- XawDLClass *lc, *xlibc;
- XawDLData *data;
- XawDLInfo *info;
- XawDLProc *proc;
- char cname[64], fname[64], aname[1024];
- Cardinal i;
- char *cp, *fp, *lp;
- int status;
-
- xlibc = XawGetDisplayListClass(xlib);
- if (!xlibc)
- {
- XawDisplayListInitialize();
- xlibc = XawGetDisplayListClass(xlib);
- }
-
- dlist = (_XawDisplayList *)XtMalloc(sizeof(_XawDisplayList));
- dlist->procs = NULL;
- dlist->num_procs = 0;
- dlist->data = NULL;
- dlist->num_data = 0;
- dlist->screen = screen;
- dlist->colormap = colormap;
- dlist->depth = depth;
- dlist->qrep = NULLQUARK;
- if (!string || !string[0])
- return (dlist);
-
- cp = string;
-
- status = 0;
- while (status != DLEOF)
- {
- lp = cp;
- cp = read_token(cp, fname, sizeof(fname), &status);
-
- if (status != DLNAME && status != DLEND && status != DLEOF)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "Error parsing displayList at \"%s\"", lp);
- XtAppWarning(XtDisplayToApplicationContext(DisplayOfScreen(screen)),
- msg);
- XawDestroyDisplayList(dlist);
- return (NULL);
- }
- fp = fname;
- /*CONSTCOND*/
- while (1)
- {
- fp = strchr(fp, ':');
- if (!fp || (fp == cp || fp[-1] != '\\'))
- break;
- ++fp;
- }
- if (fp)
- {
- XmuSnprintf(cname, fp - fname + 1, fname);
- memmove(fname, fp + 1, strlen(fp));
- lc = cname[0] ? XawGetDisplayListClass(cname) : xlibc;
- if (!lc)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "Cannot find displayList class \"%s\"", cname);
- XtAppWarning(XtDisplayToApplicationContext
- (DisplayOfScreen(screen)), msg);
- XawDestroyDisplayList(dlist);
- return (NULL);
- }
- }
- else
- lc = xlibc;
-
- if (status == DLEOF && !fname[0])
- break;
-
- if ((info = _XawFindDLInfo(lc, fname)) == NULL)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "Cannot find displayList procedure \"%s\"", fname);
- XtAppWarning(XtDisplayToApplicationContext(DisplayOfScreen(screen)),
- msg);
- XawDestroyDisplayList(dlist);
- return (NULL);
- }
-
- proc = (XawDLProc *)XtMalloc(sizeof(XawDLProc));
- proc->qname = info->qname;
- proc->params = NULL;
- proc->num_params = 0;
- proc->proc = info->proc;
- proc->args = NULL;
- proc->data = NULL;
-
- if (!dlist->procs)
- {
- dlist->num_procs = 1;
- dlist->procs = (XawDLProc**)XtMalloc(sizeof(XawDLProc*));
- }
- else
- {
- ++dlist->num_procs;
- dlist->procs = (XawDLProc**)
- XtRealloc((char *)dlist->procs, sizeof(XawDLProc*) *
- dlist->num_procs);
- }
- dlist->procs[dlist->num_procs - 1] = proc;
-
- while (status != DLEND && status != DLEOF)
- {
- lp = cp;
- cp = read_token(cp, aname, sizeof(aname), &status);
-
- if (status != DLARG && status != DLEND && status != DLEOF)
- {
- char msg[256];
-
- XmuSnprintf(msg, sizeof(msg),
- "Error parsing displayList at \"%s\"", lp);
- XtAppWarning(XtDisplayToApplicationContext
- (DisplayOfScreen(screen)), msg);
- XawDestroyDisplayList(dlist);
- return (NULL);
- }
-
- if (!proc->num_params)
- {
- proc->num_params = 1;
- proc->params = (String *)XtMalloc(sizeof(String));
- }
- else
- {
- ++proc->num_params;
- proc->params = (String *)XtRealloc((char *)proc->params,
- sizeof(String) *
- proc->num_params);
- }
- proc->params[proc->num_params - 1] = XtNewString(aname);
- }
-
- /* verify if data is already created for lc */
- data = NULL;
- for (i = 0; i < dlist->num_data; i++)
- if (dlist->data[i]->dlclass == lc)
- {
- data = dlist->data[i];
- break;
- }
-
- if (!data)
- {
- data = (XawDLData *)XtMalloc(sizeof(XawDLData));
- data->dlclass = lc;
- if (lc->data_init)
- data->data = lc->data_init(lc->name, screen, colormap, depth);
- else
- data->data = NULL;
-
- if (!dlist->data)
- {
- dlist->num_data = 1;
- dlist->data = (XawDLData **)XtMalloc(sizeof(XawDLData*));
- }
- else
- {
- ++dlist->num_data;
- dlist->data = (XawDLData **)
- XtRealloc((char *)dlist->data, sizeof(XawDLData*) *
- dlist->num_data);
- }
- dlist->data[dlist->num_data - 1] = data;
- }
-
- if (lc->args_init)
- {
- proc->args = lc->args_init(fname, proc->params, &proc->num_params,
- screen, colormap, depth);
- if (proc->args == XAWDL_CONVERT_ERROR)
- {
- char msg[256];
-
- proc->args = NULL;
- XmuSnprintf(msg, sizeof(msg),
- "Cannot convert arguments to displayList function \"%s\"", fname);
- XtAppWarning(XtDisplayToApplicationContext
- (DisplayOfScreen(screen)), msg);
- XawDestroyDisplayList(dlist);
- return (NULL);
- }
- }
- else
- proc->args = NULL;
-
- proc->data = data;
- }
-
- dlist->qrep = XrmStringToQuark(string);
- return (dlist);
-}
-
-String
-XawDisplayListString(_XawDisplayList *dlist)
-{
- if (!dlist || dlist->qrep == NULLQUARK)
- return ("");
- return (XrmQuarkToString(dlist->qrep));
-}
-
-void
-XawDestroyDisplayList(_XawDisplayList *dlist)
-{
- Cardinal i, j;
- XawDLProc *proc;
- XawDLData *data;
-
- if (!dlist)
- return;
-
- for (i = 0; i < dlist->num_procs; i++)
- {
- proc = dlist->procs[i];
- data = proc->data;
-
- if (data)
- {
- if (data->dlclass->args_destructor)
- data->dlclass->args_destructor(DisplayOfScreen(dlist->screen),
- XrmQuarkToString(proc->qname),
- proc->args,
- proc->params, &proc->num_params);
- if (data->data)
- {
- if (data->dlclass->data_destructor)
- {
- data->dlclass
- ->data_destructor(DisplayOfScreen(dlist->screen),
- data->dlclass->name, data->data);
- data->data = NULL;
- }
- }
- }
-
- for (j = 0; j < proc->num_params; j++)
- XtFree(proc->params[j]);
- if (proc->num_params)
- XtFree((char *)proc->params);
- XtFree((char *)proc);
- }
-
- if (dlist->num_procs)
- XtFree((char *)dlist->procs);
-
- XtFree((char *)dlist);
-}
-
-/**********************************************************************
- * If you want to implement your own class of procedures, look at
- * the code bellow.
- **********************************************************************/
-/* Start of Implementation of class "xlib" */
-typedef struct _XawXlibData {
- GC gc;
- unsigned long mask;
- XGCValues values;
- int shape;
- int mode;
- char *dashes;
- /* these fields can be used for optimization, to
- * avoid unnecessary coordinates recalculation.
- */
- Position x, y;
- Dimension width, height;
-} XawXlibData;
-
-typedef struct _XawDLPosition {
- Position pos;
- short denom;
- Boolean high;
-} XawDLPosition;
-
-typedef struct _XawDLPositionPtr {
- XawDLPosition *pos;
- Cardinal num_pos;
-} XawDLPositionPtr;
-
-typedef struct _XawDLArcArgs {
- XawDLPosition pos[4];
- int angle1;
- int angle2;
-} XawDLArcArgs;
-
-typedef struct _XawDLStringArgs {
- XawDLPosition pos[2];
- char *string;
- int length;
-} XawDLStringArgs;
-
-typedef struct _XawDLCopyArgs {
- XawPixmap *pixmap;
- XawDLPosition pos[6];
- int plane;
-} XawDLCopyArgs;
-
-typedef struct _XawDLImageArgs {
- XawPixmap *pixmap;
- XawDLPosition pos[4];
- int depth;
-} XawDLImageArgs;
-
-#define X_ARG(x) (Position)(((x).denom != 0) ? \
- ((float)XtWidth(w) * ((float)(x).pos / (float)(x).denom)) : \
- ((x).high ? XtWidth(w) - (x).pos : (x).pos))
-#define Y_ARG(x) (Position)(((x).denom != 0) ? \
- ((float)XtHeight(w) * ((float)(x).pos / (float)(x).denom)): \
- ((x).high ? XtHeight(w) - (x).pos : (x).pos))
-#define DRECT 0
-#define FRECT 1
-#define LINE 2
-#define GCFG 3
-#define GCBG 4
-#define FPOLY 5
-#define DARC 6
-#define FARC 7
-#define DLINES 8
-#define MASK 9
-#define UMASK 10
-#define LWIDTH 11
-#define POINT 12
-#define POINTS 13
-#define SEGMENTS 14
-#define ARCMODE 15
-#define COORDMODE 16
-#define SHAPEMODE 17
-#define LINESTYLE 18
-#define CAPSTYLE 19
-#define JOINSTYLE 20
-#define FILLSTYLE 21
-#define FILLRULE 22
-#define TILE 23
-#define STIPPLE 24
-#define TSORIGIN 25
-#define FUNCTION 26
-#define PLANEMASK 27
-#define DSTRING 28
-#define PSTRING 29
-#define FONT 30
-#define DASHES 31
-#define SUBWMODE 32
-#define EXPOSURES 33
-#define CLIPORIGIN 34
-#define CLIPMASK 35
-#define CLIPRECTS 36
-#define COPYAREA 37
-#define COPYPLANE 38
-#define IMAGE 39
-
-static void
-Dl1Point(Widget w, XtPointer args, XtPointer data, int id)
-{
- XawDLPosition *pos = (XawDLPosition *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- Display *display;
- Window window;
- Position x, y;
-
- x = X_ARG(pos[0]);
- y = Y_ARG(pos[1]);
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- x += xpad;
- x += xpad;
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- if (id == POINT)
- XDrawPoint(display, window, xdata->gc, x, y);
- else if (id == TSORIGIN)
- {
- xdata->values.ts_x_origin = x;
- xdata->values.ts_y_origin = y;
- xdata->mask |= GCTileStipXOrigin | GCTileStipYOrigin;
- XSetTSOrigin(display, xdata->gc, x, y);
- }
- else if (id == CLIPORIGIN)
- {
- xdata->values.clip_x_origin = x;
- xdata->values.clip_y_origin = y;
- xdata->mask |= GCClipXOrigin | GCClipYOrigin;
- XSetClipOrigin(display, xdata->gc, x, y);
- }
-}
-
-static void
-Dl2Points(Widget w, XtPointer args, XtPointer data, int id)
-{
- XawDLPosition *pos = (XawDLPosition *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- Display *display;
- Window window;
- Position x1, y1, x2, y2;
-
- x1 = X_ARG(pos[0]);
- y1 = Y_ARG(pos[1]);
- x2 = X_ARG(pos[2]);
- y2 = Y_ARG(pos[3]);
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- x1 += xpad; y1 += ypad;
- x2 += xpad; y2 += ypad;
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- if (id == DRECT)
- XDrawRectangle(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1);
- else if (id == FRECT)
- XFillRectangle(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1);
- else if (id == LINE)
- XDrawLine(display, window, xdata->gc, x1, y1, x2, y2);
-}
-
-/* ARGSUSED */
-static void
-DlLine(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region)
-{
- Dl2Points(w, args, data, LINE);
-}
-
-/* ARGSUSED */
-static void
-DlDrawRectangle(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- Dl2Points(w, args, data, DRECT);
-}
-
-/* ARGSUSED */
-static void
-DlFillRectangle(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- Dl2Points(w, args, data, FRECT);
-}
-
-static void
-DlXPoints(Widget w, XtPointer args, XtPointer data, int id)
-{
- XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- XawDLPosition *pos;
- XPoint points_buf[16];
- XPoint *points;
- Display *display;
- Window window;
- Cardinal num_points, i, j;
-
- num_points = pos_ptr->num_pos>>1;
- points = (XPoint *)XawStackAlloc(sizeof(XPoint) * num_points, points_buf);
-
- for (i = j = 0; i < num_points; i++, j = i << 1)
- {
- pos = &pos_ptr->pos[j];
- points[i].x = X_ARG(pos[0]);
- points[i].y = Y_ARG(pos[1]);
- }
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- if (xdata->mode != CoordModePrevious)
- {
- for (i = 0; i < num_points; i++)
- {
- points[i].x += xpad;
- points[i].y += ypad;
- }
- }
- else
- {
- points[0].x += xpad;
- points[0].y += ypad;
- }
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- if (id == FPOLY)
- XFillPolygon(display, window, xdata->gc, points, num_points,
- xdata->shape, xdata->mode);
- else if (id == DLINES)
- XDrawLines(display, window, xdata->gc, points, num_points, xdata->mode);
- else if (id == POINTS)
- XDrawPoints(display, window, xdata->gc, points, num_points, xdata->mode);
-
- XawStackFree(points, points_buf);
-}
-
-/* ARGSUSED */
-static void
-DlFillPolygon(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlXPoints(w, args, data, FPOLY);
-}
-
-/* ARGSUSED */
-static void
-DlDrawLines(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlXPoints(w, args, data, DLINES);
-}
-
-/* ARGSUSED */
-static void
-DlDrawPoints(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlXPoints(w, args, data, POINTS);
-}
-
-/* ARGSUSED */
-static void
-DlForeground(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- Pixel foreground = (Pixel)args;
-
- if (xdata->values.foreground != foreground)
- {
- xdata->mask |= GCForeground;
- xdata->values.foreground = foreground;
- XSetForeground(XtDisplayOfObject(w), xdata->gc, foreground);
- }
-}
-
-/* ARGSUSED */
-static void
-DlBackground(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- Pixel background = (Pixel)args;
-
- if (xdata->values.background != background)
- {
- xdata->mask |= GCBackground;
- xdata->values.background = background;
- XSetBackground(XtDisplayOfObject(w), xdata->gc, background);
- }
-}
-
-static void
-DlArc(Widget w, XtPointer args, XtPointer data, Bool fill)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- XawDLArcArgs *arc = (XawDLArcArgs *)args;
- Position x1, y1, x2, y2;
- Display *display;
- Window window;
-
- x1 = X_ARG(arc->pos[0]);
- y1 = Y_ARG(arc->pos[1]);
- x2 = X_ARG(arc->pos[2]);
- y2 = Y_ARG(arc->pos[3]);
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- x1 += xpad;
- y1 += ypad;
- x2 += xpad;
- y2 += ypad;
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- if (fill)
- XFillArc(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1,
- arc->angle1, arc->angle2);
- else
- XDrawArc(display, window, xdata->gc, x1, y1, x2 - x1, y2 - y1,
- arc->angle1, arc->angle2);
-}
-
-/* ARGSUSED */
-static void
-DlDrawArc(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlArc(w, args, data, False);
-}
-
-/* ARGSUSED */
-static void
-DlFillArc(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlArc(w, args, data, True);
-}
-
-/*ARGSUSED*/
-static void
-DlMask(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- Display *display = XtDisplayOfObject(w);
-
- if (region)
- XSetRegion(display, xdata->gc, region);
- else if (event)
- {
- XRectangle rect;
-
- rect.x = event->xexpose.x;
- rect.y = event->xexpose.y;
- rect.width = event->xexpose.width;
- rect.height = event->xexpose.height;
- XSetClipRectangles(display, xdata->gc, 0, 0, &rect, 1, Unsorted);
- }
-}
-
-/* ARGSUSED */
-static void
-DlUmask(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
-
- XSetClipMask(XtDisplayOfObject(w), xdata->gc, None);
-}
-
-/* ARGSUSED */
-static void
-DlLineWidth(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- unsigned line_width = (unsigned)args;
-
- if (xdata->values.line_width != line_width)
- {
- xdata->mask |= GCLineWidth;
- xdata->values.line_width = line_width;
- XChangeGC(XtDisplayOfObject(w), xdata->gc, GCLineWidth, &xdata->values);
- }
-}
-
-/* ARGSUSED */
-static void
-DlDrawPoint(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region)
-{
- Dl1Point(w, args, data, POINT);
-}
-
-/* ARGSUSED */
-static void
-DlDrawSegments(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- XawDLPosition *pos;
- XSegment *segments;
- XSegment segments_buf[8];
- Display *display;
- Window window;
- Cardinal num_segments, i, j;
-
- num_segments = pos_ptr->num_pos>>2;
- segments = (XSegment *)XawStackAlloc(sizeof(XSegment) * num_segments, segments_buf);
-
- for (i = j = 0; i < num_segments; i++, j = i << 2)
- {
- pos = &pos_ptr->pos[j];
- segments[i].x1 = X_ARG(pos[0]);
- segments[i].y1 = Y_ARG(pos[1]);
- segments[i].x2 = X_ARG(pos[2]);
- segments[i].y2 = Y_ARG(pos[3]);
- }
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- for (i = 0; i < num_segments; i++)
- {
- segments[i].x1 += xpad;
- segments[i].y1 += ypad;
- segments[i].x2 += xpad;
- segments[i].y2 += ypad;
- }
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- XDrawSegments(display, window, xdata->gc, segments, num_segments);
-
- XawStackFree(segments, segments_buf);
-}
-
-/* ARGSUSED */
-static void
-DlArcMode(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int arc_mode = (int)args;
-
- if (xdata->values.arc_mode != arc_mode)
- {
- xdata->mask |= GCArcMode;
- xdata->values.arc_mode = arc_mode;
- XSetArcMode(XtDisplayOfObject(w), xdata->gc, arc_mode);
- }
-}
-
-/* ARGSUSED */
-static void
-DlCoordMode(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int mode = (int)args;
-
- xdata->mode = mode;
-}
-
-/* ARGSUSED */
-static void
-DlShapeMode(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int shape = (int)args;
-
- xdata->shape = shape;
-}
-
-/* ARGSUSED */
-static void
-DlLineStyle(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int line_style = (int)args;
-
- if (xdata->values.line_style != line_style)
- {
- xdata->mask |= GCLineStyle;
- xdata->values.line_style = line_style;
- XChangeGC(XtDisplayOfObject(w), xdata->gc, GCLineStyle, &xdata->values);
- }
-}
-
-/* ARGSUSED */
-static void
-DlCapStyle(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int cap_style = (int)args;
-
- if (xdata->values.cap_style != cap_style)
- {
- xdata->mask |= GCCapStyle;
- xdata->values.cap_style = cap_style;
- XChangeGC(XtDisplayOfObject(w), xdata->gc, GCCapStyle, &xdata->values);
- }
-}
-
-/* ARGSUSED */
-static void
-DlJoinStyle(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int join_style = (int)args;
-
- if (xdata->values.join_style != join_style)
- {
- xdata->mask |= GCJoinStyle;
- xdata->values.join_style = join_style;
- XChangeGC(XtDisplayOfObject(w), xdata->gc, GCJoinStyle, &xdata->values);
- }
-}
-
-/* ARGSUSED */
-static void
-DlFillStyle(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int fill_style = (int)args;
-
- if (xdata->values.fill_style != fill_style)
- {
- xdata->mask |= GCFillStyle;
- xdata->values.fill_style = fill_style;
- XSetFillStyle(XtDisplayOfObject(w), xdata->gc, fill_style);
- }
-}
-
-/* ARGSUSED */
-static void
-DlFillRule(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int fill_rule = (int)args;
-
- if (xdata->values.fill_rule != fill_rule)
- {
- xdata->mask |= GCFillRule;
- xdata->values.fill_rule = fill_rule;
- XSetFillRule(XtDisplayOfObject(w), xdata->gc, fill_rule);
- }
-}
-
-/* ARGSUSED */
-static void
-DlTile(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- XawPixmap *pixmap = (XawPixmap *)args;
-
- if (pixmap && xdata->values.tile != pixmap->pixmap)
- {
- xdata->mask |= GCTile;
- xdata->values.tile = pixmap->pixmap;
- XSetTile(XtDisplayOfObject(w), xdata->gc, xdata->values.tile);
- }
-}
-
-/* ARGSUSED */
-static void
-DlStipple(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- XawPixmap *pixmap = (XawPixmap *)args;
-
- if (pixmap && xdata->values.stipple != pixmap->pixmap)
- {
- xdata->mask |= GCStipple;
- xdata->values.stipple = pixmap->pixmap;
- XSetStipple(XtDisplayOfObject(w), xdata->gc, xdata->values.stipple);
- }
-}
-
-/* ARGSUSED */
-static void
-DlTSOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region)
-{
- Dl1Point(w, args, data, TSORIGIN);
-}
-
-/* ARGSUSED */
-static void
-DlFunction(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int function = (int)args;
-
- if (function != xdata->values.function)
- {
- xdata->mask |= GCFunction;
- xdata->values.function = function;
- XSetFunction(XtDisplayOfObject(w), xdata->gc, function);
- }
-}
-
-/* ARGSUSED */
-static void
-DlPlaneMask(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- unsigned long plane_mask = (unsigned long)args;
-
- if (xdata->values.plane_mask != plane_mask)
- {
- xdata->mask |= GCPlaneMask;
- xdata->values.plane_mask = plane_mask;
- XSetPlaneMask(XtDisplayOfObject(w), xdata->gc, plane_mask);
- }
-}
-
-static void
-DlString(Widget w, XtPointer args, XtPointer data, Bool image)
-{
- XawDLStringArgs *string = (XawDLStringArgs *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- Display *display;
- Window window;
- Position x, y;
-
- x = X_ARG(string->pos[0]);
- y = Y_ARG(string->pos[1]);
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- x += xpad;
- x += xpad;
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- if (image)
- XDrawImageString(display, window, xdata->gc, x, y, string->string, string->length);
- else
- XDrawString(display, window, xdata->gc, x, y, string->string, string->length);
-}
-
-/* ARGSUSED */
-static void
-DlDrawString(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlString(w, args, data, False);
-}
-
-/* ARGSUSED */
-static void
-DlPaintString(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlString(w, args, data, True);
-}
-
-/* ARGSUSED */
-static void
-DlFont(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- Font font = (Font)args;
-
- if (xdata->values.font != font)
- {
- xdata->mask |= GCFont;
- xdata->values.font = font;
- XSetFont(XtDisplayOfObject(w), xdata->gc, font);
- }
-}
-
-/* ARGSUSED */
-static void
-DlDashes(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- char *dashes = args;
-
- if (xdata->dashes != dashes)
- {
- xdata->mask |= GCDashOffset | GCDashList;
- xdata->dashes = dashes;
- XSetDashes(XtDisplayOfObject(w), xdata->gc, 0, dashes + 1, *dashes);
- }
-}
-
-/* ARGSUSED */
-static void
-DlSubwindowMode(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- int subwindow_mode = (int)args;
-
- if (xdata->values.subwindow_mode != subwindow_mode)
- {
- xdata->mask |= GCSubwindowMode;
- xdata->values.subwindow_mode = subwindow_mode;
- XSetSubwindowMode(XtDisplayOfObject(w), xdata->gc, subwindow_mode);
- }
-}
-
-/* ARGSUSED */
-static void
-DlExposures(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- Bool graphics_exposures = (Bool)args;
-
- if (xdata->values.graphics_exposures != graphics_exposures)
- {
- xdata->mask |= GCGraphicsExposures;
- xdata->values.graphics_exposures = graphics_exposures;
- XSetGraphicsExposures(XtDisplayOfObject(w), xdata->gc, graphics_exposures);
- }
-}
-
-/* ARGSUSED */
-static void
-DlClipOrigin(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region)
-{
- Dl1Point(w, args, data, CLIPORIGIN);
-}
-
-/* ARGSUSED */
-static void
-DlClipMask(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawXlibData *xdata = (XawXlibData *)data;
- XawPixmap *pixmap = (XawPixmap *)args;
- Pixmap clip_mask;
-
- if (pixmap)
- clip_mask = pixmap->mask ? pixmap->mask : pixmap->pixmap;
- else
- clip_mask = None;
-
- if (xdata->values.clip_mask != clip_mask)
- {
- xdata->mask |= GCClipMask;
- XSetClipMask(XtDisplayOfObject(w), xdata->gc, clip_mask);
- }
-}
-
-/* ARGSUSED */
-static void
-DlClipRectangles(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- XawDLPosition *pos;
- XRectangle *rects;
- XRectangle rects_buf[8];
- Position x1, y1, x2, y2;
- Cardinal num_rects, i, j;
-
- num_rects = pos_ptr->num_pos>>2;
- rects = (XRectangle *)XawStackAlloc(sizeof(XRectangle) * num_rects, rects_buf);
-
- for (i = j = 0; i < num_rects; i++, j = i << 2)
- {
- pos = &pos_ptr->pos[j];
- x1 = X_ARG(pos[0]);
- y1 = Y_ARG(pos[1]);
- x2 = X_ARG(pos[2]);
- y2 = Y_ARG(pos[3]);
- rects[i].x = XawMin(x1, x2);
- rects[i].y = XawMin(y1, y2);
- rects[i].width = XawMax(x1, x2) - rects[i].x;
- rects[i].height = XawMax(y1, y2) - rects[i].y;
- }
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- for (i = 0; i < num_rects; i++)
- {
- rects[i].x += xpad;
- rects[i].y += ypad;
- }
- }
-
- XSetClipRectangles(XtDisplayOfObject(w), xdata->gc, 0, 0, rects, num_rects, Unsorted);
-
- XawStackFree(rects, rects_buf);
-}
-
-static void
-DlCopy(Widget w, XtPointer args, XtPointer data, Bool plane)
-{
- XawDLCopyArgs *copy = (XawDLCopyArgs *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- int src_x, src_y, dst_x, dst_y, width, height, tmp1, tmp2;
-
- tmp1 = X_ARG(copy->pos[0]);
- tmp2 = X_ARG(copy->pos[2]);
- dst_x = XawMin(tmp1, tmp2);
- width = XawMax(tmp1, tmp2) - dst_x;
-
- tmp1 = Y_ARG(copy->pos[1]);
- tmp2 = Y_ARG(copy->pos[3]);
- dst_y = XawMin(tmp1, tmp2);
- height = XawMax(tmp1, tmp2) - dst_y;
-
- src_x = X_ARG(copy->pos[4]);
- src_y = Y_ARG(copy->pos[5]);
-
- if (width <= 0)
- {
- if (copy->pixmap)
- width = copy->pixmap->width;
- else
- {
- if ((width = XtWidth(w) - src_x) < 0)
- width = 0;
- }
- }
- if (height <= 0)
- {
- if (copy->pixmap)
- height = copy->pixmap->height;
- else
- {
- if ((height = XtHeight(w) - src_y) < 0)
- height = 0;
- }
- }
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- src_x += xpad;
- src_y += ypad;
- dst_x += xpad;
- dst_y += ypad;
- }
-
- if (plane)
- XCopyPlane(XtDisplayOfObject(w), XtWindowOfObject(w),
- copy->pixmap ? copy->pixmap->pixmap : XtWindowOfObject(w),
- xdata->gc, src_x, src_y, width, height, dst_x, dst_y,
- copy->plane ? copy->plane : 1);
- else
- XCopyArea(XtDisplayOfObject(w),
- copy->pixmap ? copy->pixmap->pixmap : XtWindowOfObject(w),
- XtWindowOfObject(w), xdata->gc, src_x, src_y, width, height, dst_x, dst_y);
-}
-
-/* ARGSUSED */
-static void
-DlCopyArea(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlCopy(w, args, data, False);
-}
-
-/* ARGSUSED */
-static void
-DlCopyPlane(Widget w, XtPointer args, XtPointer data,
- XEvent *event, Region region)
-{
- DlCopy(w, args, data, True);
-}
-
-/*ARGSUSED*/
-/* Note:
- * This function is destructive if you set the ts_x_origin, ts_y_origin,
- * and/or clip-mask. It is meant to be the only function used in a display
- * list. If you need to use other functions (and those values), be sure to
- * set them after calling this function.
- */
-static void
-DlImage(Widget w, XtPointer args, XtPointer data, XEvent *event, Region region)
-{
- XawDLImageArgs *image = (XawDLImageArgs *)args;
- XawXlibData *xdata = (XawXlibData *)data;
- int x, y, xs, ys, xe, ye, width, height;
- Display *display;
- Window window;
-
- width = image->pixmap->width;
- height = image->pixmap->height;
- xs = X_ARG(image->pos[0]);
- ys = Y_ARG(image->pos[1]);
- xe = X_ARG(image->pos[2]);
- ye = Y_ARG(image->pos[3]);
-
- if (xe <= 0)
- xe = xs + width;
- if (ye <= 0)
- ye = ys + height;
-
- if (!XtIsWidget(w))
- {
- Position xpad, ypad;
-
- xpad = XtX(w) + XtBorderWidth(w);
- ypad = XtY(w) + XtBorderWidth(w);
- xe += xpad;
- ye += ypad;
- xe += xpad;
- ye += ypad;
- display = XtDisplayOfObject(w);
- window = XtWindowOfObject(w);
- }
- else
- {
- display = XtDisplay(w);
- window = XtWindow(w);
- }
-
- for (y = ys; y < ye; y += height)
- for (x = xs; x < xe; x += width)
- {
- XSetClipOrigin(display, xdata->gc, x, y);
- if (image->pixmap->mask)
- XSetClipMask(display, xdata->gc, image->pixmap->mask);
- if (image->depth == 1)
- XCopyPlane(display, image->pixmap->pixmap, window, xdata->gc,
- 0, 0, XawMin(width, xe - x), XawMin(height, ye - y),
- x, y, 1L);
- else
- XCopyArea(display, image->pixmap->pixmap, window, xdata->gc, 0, 0,
- XawMin(width, xe - x), XawMin(height, ye - y), x, y);
- }
-
- XSetClipMask(display, xdata->gc, None);
-}
-
-typedef struct _Dl_init Dl_init;
-struct _Dl_init {
- String name;
- XawDisplayListProc proc;
- Cardinal id;
-};
-
-static Dl_init dl_init[] =
-{
- {"arc-mode", DlArcMode, ARCMODE},
- {"background", DlBackground, GCBG},
- {"bg", DlBackground, GCBG},
- {"cap-style", DlCapStyle, CAPSTYLE},
- {"clip-mask", DlClipMask, CLIPMASK},
- {"clip-origin", DlClipOrigin, CLIPORIGIN},
- {"clip-rectangles", DlClipRectangles, CLIPRECTS},
- {"clip-rects", DlClipRectangles, CLIPRECTS},
- {"coord-mode", DlCoordMode, COORDMODE},
- {"copy-area", DlCopyArea, COPYAREA},
- {"copy-plane", DlCopyPlane, COPYPLANE},
- {"dashes", DlDashes, DASHES},
- {"draw-arc", DlDrawArc, DARC},
- {"draw-line", DlLine, LINE},
- {"draw-lines", DlDrawLines, DLINES},
- {"draw-point", DlDrawPoint, POINT},
- {"draw-points", DlDrawPoints, POINTS},
- {"draw-rect", DlDrawRectangle, DRECT},
- {"draw-rectangle", DlDrawRectangle, DRECT},
- {"draw-segments", DlDrawSegments, SEGMENTS},
- {"draw-string", DlDrawString, DSTRING},
- {"exposures", DlExposures, EXPOSURES},
- {"fg", DlForeground, GCFG},
- {"fill-arc", DlFillArc, FARC},
- {"fill-poly", DlFillPolygon, FPOLY},
- {"fill-polygon", DlFillPolygon, FPOLY},
- {"fill-rect", DlFillRectangle, FRECT},
- {"fill-rectangle", DlFillRectangle, FRECT},
- {"fill-rule", DlFillRule, FILLRULE},
- {"fill-style", DlFillStyle, FILLSTYLE},
- {"font", DlFont, FONT},
- {"foreground", DlForeground, GCFG},
- {"function", DlFunction, FUNCTION},
- {"image", DlImage, IMAGE},
- {"join-style", DlJoinStyle, JOINSTYLE},
- {"line", DlLine, LINE},
- {"line-style", DlLineStyle, LINESTYLE},
- {"line-width", DlLineWidth, LWIDTH},
- {"lines", DlDrawLines, DLINES},
- {"mask", DlMask, MASK},
- {"paint-string", DlPaintString, PSTRING},
- {"plane-mask", DlPlaneMask, PLANEMASK},
- {"point", DlDrawPoint, POINT},
- {"points", DlDrawPoints, POINTS},
- {"segments", DlDrawSegments, SEGMENTS},
- {"shape-mode", DlShapeMode, SHAPEMODE},
- {"stipple", DlStipple, STIPPLE},
- {"subwindow-mode", DlSubwindowMode, SUBWMODE},
- {"tile", DlTile, TILE},
- {"ts-origin", DlTSOrigin, TSORIGIN},
- {"umask", DlUmask, UMASK},
-};
-
-void
-XawDisplayListInitialize(void)
-{
- static Bool first_time = True;
- XawDLClass *lc;
- Cardinal i;
-
- if (first_time == False)
- return;
-
- first_time = False;
-
- lc = XawCreateDisplayListClass(xlib,
- _Xaw_Xlib_ArgsInitProc,
- _Xaw_Xlib_ArgsDestructor,
- _Xaw_Xlib_DataInitProc,
- _Xaw_Xlib_DataDestructor);
- for (i = 0; i < sizeof(dl_init) / sizeof(dl_init[0]); i++)
- (void)XawDeclareDisplayListProc(lc, dl_init[i].name, dl_init[i].proc);
-}
-
-static int
-bcmp_cvt_proc(register _Xconst void *string,
- register _Xconst void *dlinfo)
-{
- return (strcmp((String)string, ((Dl_init*)dlinfo)->name));
-}
-
-static int
-read_int(char *cp, char **cpp)
-{
- int value = 0, sign = 1;
-
- if (*cp == '-')
- {
- sign = -1;
- ++cp;
- }
- else if (*cp == '+')
- ++cp;
- value = 0;
- while (*cp >= '0' && *cp <= '9')
- {
- value = value * 10 + *cp - '0';
- ++cp;
- }
- if (cpp)
- *cpp = cp;
- return (value * sign);
-}
-
-static void
-read_position(char *arg, XawDLPosition *pos)
-{
- int ch;
- char *str = arg;
-
- ch = *str;
- if (ch == '-' || ch == '+')
- {
- ++str;
- if (ch == '-')
- pos->high = True;
- pos->pos = read_int(str, NULL);
- }
- else if (isdigit(ch))
- {
- pos->pos = read_int(str, &str);
- ch = *str++;
- if (ch == '/')
- pos->denom = read_int(str, NULL);
- }
-}
-
-/* ARGSUSED */
-static void *
-_Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params,
- Screen *screen, Colormap colormap, int depth)
-{
- Cardinal id, i;
- Dl_init *init;
- void *retval = XAWDL_CONVERT_ERROR;
-
- init = (Dl_init *)bsearch(proc_name, dl_init,
- sizeof(dl_init) / sizeof(dl_init[0]),
- sizeof(dl_init[0]),
- bcmp_cvt_proc);
-
- id = init->id;
-
- switch (id)
- {
- case LINE:
- case DRECT:
- case FRECT:
- if (*num_params == 4)
- {
- XawDLPosition *pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) * 4);
-
- for (i = 0; i < 4; i++)
- read_position(params[i], &pos[i]);
- retval = (void *)pos;
- }
- break;
- case POINT:
- case TSORIGIN:
- case CLIPORIGIN:
- if (*num_params == 2)
- {
- XawDLPosition *pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) * 2);
-
- read_position(params[0], &pos[0]);
- read_position(params[1], &pos[1]);
- retval = (void *)pos;
- }
- break;
- case DLINES:
- case FPOLY:
- case POINTS:
- if (*num_params >= 4 && !(*num_params & 1))
- {
- XawDLPositionPtr *pos = XtNew(XawDLPositionPtr);
-
- pos->pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) *
- *num_params);
- pos->num_pos = *num_params;
- for (i = 0; i < *num_params; i++)
- read_position(params[i], &pos->pos[i]);
- retval = (void *)pos;
- }
- break;
- case SEGMENTS:
- case CLIPRECTS:
- if (*num_params >= 4 && !(*num_params % 4))
- {
- XawDLPositionPtr *pos = XtNew(XawDLPositionPtr);
-
- pos->pos = (XawDLPosition *)XtCalloc(1, sizeof(XawDLPosition) *
- *num_params);
- pos->num_pos = *num_params;
- for (i = 0; i < *num_params; i++)
- read_position(params[i], &pos->pos[i]);
- retval = (void *)pos;
- }
- break;
- case DARC:
- case FARC:
- if (*num_params >= 4 && *num_params <= 6)
- {
- XawDLArcArgs *args = (XawDLArcArgs *)XtCalloc(1, sizeof(XawDLArcArgs));
-
- args->angle1 = 0;
- args->angle2 = 360;
- for (i = 0; i < 4; i++)
- read_position(params[i], &args->pos[i]);
- if (*num_params > 4)
- args->angle1 = read_int(params[4], NULL);
- if (*num_params > 5)
- args->angle2 = read_int(params[5], NULL);
- args->angle1 *= 64;
- args->angle2 *= 64;
- retval = (void *)args;
- }
- break;
- case GCFG:
- case GCBG:
- {
- XColor xcolor;
-
- if (*num_params == 1 &&
- XAllocNamedColor(DisplayOfScreen(screen), colormap,
- params[0], &xcolor, &xcolor))
- retval = (void *)xcolor.pixel;
- } break;
- case MASK:
- case UMASK:
- if (*num_params == 0)
- retval = NULL;
- break;
- case LWIDTH:
- if (*num_params == 1)
- retval = (void *)read_int(params[0], NULL);
- break;
- case ARCMODE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "pieslice") == 0)
- retval = (void *)ArcPieSlice;
- else if (XmuCompareISOLatin1(params[0], "chord") == 0)
- retval = (void *)ArcChord;
- }
- break;
- case COORDMODE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "origin") == 0)
- retval = (void *)CoordModeOrigin;
- else if (XmuCompareISOLatin1(params[0], "previous") == 0)
- retval = (void *)CoordModePrevious;
- }
- break;
- case SHAPEMODE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "complex") == 0)
- retval = (void *)Complex;
- else if (XmuCompareISOLatin1(params[0], "convex") == 0)
- retval = (void *)Convex;
- else if (XmuCompareISOLatin1(params[0], "nonconvex") == 0)
- retval = (void *)Nonconvex;
- }
- break;
- case LINESTYLE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "solid") == 0)
- retval = (void *)LineSolid;
- else if (XmuCompareISOLatin1(params[0], "onoffdash") == 0)
- retval = (void *)LineOnOffDash;
- else if (XmuCompareISOLatin1(params[0], "doubledash") == 0)
- retval = (void *)LineDoubleDash;
- }
- break;
- case CAPSTYLE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "notlast") == 0)
- retval = (void *)CapNotLast;
- else if (XmuCompareISOLatin1(params[0], "butt") == 0)
- retval = (void *)CapButt;
- else if (XmuCompareISOLatin1(params[0], "round") == 0)
- retval = (void *)CapRound;
- else if (XmuCompareISOLatin1(params[0], "projecting") == 0)
- retval = (void *)CapProjecting;
- }
- break;
- case JOINSTYLE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "miter") == 0)
- retval = (void *)JoinMiter;
- else if (XmuCompareISOLatin1(params[0], "round") == 0)
- retval = (void *)JoinRound;
- else if (XmuCompareISOLatin1(params[0], "bevel") == 0)
- retval = (void *)JoinBevel;
- }
- break;
- case FILLSTYLE:
- if (*num_params == 1)
- {
- if (*num_params && XmuCompareISOLatin1(params[0], "solid") == 0)
- retval = (void *)FillSolid;
- else if (*num_params && XmuCompareISOLatin1(params[0], "tiled") == 0)
- retval = (void *)FillTiled;
- else if (*num_params && XmuCompareISOLatin1(params[0], "stippled") == 0)
- retval = (void *)FillStippled;
- else if (*num_params && XmuCompareISOLatin1(params[0], "opaquestippled") == 0)
- retval = (void *)FillOpaqueStippled;
- }
- break;
- case FILLRULE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "evenodd") == 0)
- retval = (void *)EvenOddRule;
- else if (XmuCompareISOLatin1(params[0], "winding") == 0)
- retval = (void *)WindingRule;
- }
- break;
- case TILE:
- if (*num_params == 1)
- retval = (void *)XawLoadPixmap(params[0], screen, colormap, depth);
- if (retval == NULL)
- {
- XtDisplayStringConversionWarning(DisplayOfScreen(screen), (String)params[0],
- XtRPixmap);
- retval = XAWDL_CONVERT_ERROR;
- }
- break;
- case STIPPLE:
- if (*num_params == 1)
- retval = (void *)XawLoadPixmap(params[0], screen, colormap, 1);
- if (retval == NULL)
- {
- XtDisplayStringConversionWarning(DisplayOfScreen(screen), (String)params[0],
- XtRBitmap);
- retval = XAWDL_CONVERT_ERROR;
- }
- break;
- case FUNCTION:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "set") == 0)
- retval = (void *)GXset;
- else if (XmuCompareISOLatin1(params[0], "clear") == 0)
- retval = (void *)GXclear;
- else if (XmuCompareISOLatin1(params[0], "and") == 0)
- retval = (void *)GXand;
- else if (XmuCompareISOLatin1(params[0], "andreverse") == 0)
- retval = (void *)GXandReverse;
- else if (XmuCompareISOLatin1(params[0], "copy") == 0)
- retval = (void *)GXcopy;
- else if (XmuCompareISOLatin1(params[0], "andinverted") == 0)
- retval = (void *)GXandInverted;
- else if (XmuCompareISOLatin1(params[0], "noop") == 0)
- retval = (void *)GXnoop;
- else if (XmuCompareISOLatin1(params[0], "xor") == 0)
- retval = (void *)GXxor;
- else if (XmuCompareISOLatin1(params[0], "or") == 0)
- retval = (void *)GXor;
- else if (XmuCompareISOLatin1(params[0], "nor") == 0)
- retval = (void *)GXnor;
- else if (XmuCompareISOLatin1(params[0], "equiv") == 0)
- retval = (void *)GXequiv;
- else if (XmuCompareISOLatin1(params[0], "invert") == 0)
- retval = (void *)GXinvert;
- else if (XmuCompareISOLatin1(params[0], "orreverse") == 0)
- retval = (void *)GXorReverse;
- else if (XmuCompareISOLatin1(params[0], "copyinverted") == 0)
- retval = (void *)GXcopyInverted;
- else if (XmuCompareISOLatin1(params[0], "nand") == 0)
- retval = (void *)GXnand;
- }
- break;
- case PLANEMASK:
- if (*num_params == 1)
- retval = (void *)read_int(params[0], NULL);
- break;
- case DSTRING:
- case PSTRING:
- if (*num_params == 3)
- {
- XawDLStringArgs *string = (XawDLStringArgs *)
- XtCalloc(1, sizeof(XawDLStringArgs));
-
- read_position(params[0], &string->pos[0]);
- read_position(params[1], &string->pos[1]);
- string->string = XtNewString(params[2]);
- string->length = strlen(string->string);
- retval = string;
- }
- break;
- case FONT:
- if (*num_params == 1)
- retval = (void *)XLoadFont(DisplayOfScreen(screen), params[0]);
- break;
- case DASHES:
- if (*num_params && *num_params < 127)
- {
- char *dashes;
-
- dashes = XtMalloc(*num_params + 1);
-
- for (i = 0; i < *num_params; i++)
- dashes[i + 1] = read_int(params[i], NULL);
- *dashes = *num_params;
- retval = dashes;
- }
- break;
- case SUBWMODE:
- if (*num_params == 1)
- {
- if (XmuCompareISOLatin1(params[0], "clipbychildren") == 0)
- retval = (void *)ClipByChildren;
- else if (XmuCompareISOLatin1(params[0], "includeinferiors") == 0)
- retval = (void *)IncludeInferiors;
- }
- break;
- case EXPOSURES:
- if (*num_params == 1)
- {
- if (isdigit(params[0][0]) || params[0][0] == '+' || params[0][0] == '-')
- retval = (void *)read_int(params[0], NULL);
- else if (XmuCompareISOLatin1(params[0], "true") == 0 ||
- XmuCompareISOLatin1(params[0], "on") == 0)
- retval = (void *)True;
- else if (XmuCompareISOLatin1(params[0], "false") == 0 ||
- XmuCompareISOLatin1(params[0], "off") == 0)
- retval = (void *)False;
- }
- break;
- case CLIPMASK:
- if (*num_params == 1)
- retval = (void *)XawLoadPixmap(params[0], screen, colormap, 1);
- if (retval == NULL)
- {
- retval = XAWDL_CONVERT_ERROR;
- XtDisplayStringConversionWarning(DisplayOfScreen(screen), (String)params[0],
- XtRPixmap);
- }
- break;
- case COPYAREA:
- case COPYPLANE:
- if (*num_params > 2 && *num_params <= 7 + (id == COPYPLANE))
- {
- XawDLCopyArgs *args = (XawDLCopyArgs *)
- XtCalloc(1, sizeof(XawDLCopyArgs));
-
- retval = args;
- if (params[0][0] == '\0' || strcmp(params[0], ".") == 0)
- args->pixmap = NULL;
- else
- {
- args->pixmap = XawLoadPixmap(params[0], screen, colormap, id == COPYPLANE ? 1 : depth);
- if (args->pixmap == NULL)
- {
- XtDisplayStringConversionWarning(DisplayOfScreen(screen), (String)params[0],
- XtRBitmap);
- retval = XAWDL_CONVERT_ERROR;
- XtFree((char *)args);
- }
- }
- if (retval != XAWDL_CONVERT_ERROR)
- {
- for (i = 1; i < *num_params && i < 7; i++)
- read_position(params[i], &args->pos[i - 1]);
- if (*num_params > 7)
- args->plane = read_int(params[7], NULL);
- }
- }
- break;
- case IMAGE:
- if (*num_params > 2 && *num_params <= 7)
- {
- XawDLImageArgs *args = (XawDLImageArgs *)
- XtCalloc(1, sizeof(XawDLImageArgs));
-
- retval = args;
- args->pixmap = XawLoadPixmap(params[0], screen, colormap, depth);
- if (args->pixmap == NULL)
- {
- XtDisplayStringConversionWarning(DisplayOfScreen(screen),
- (String)params[0], XtRPixmap);
- retval = XAWDL_CONVERT_ERROR;
- XtFree((char *)args);
- }
- else
- {
- args->depth = depth;
- for (i = 1; i < *num_params && i < 5; i++)
- read_position(params[i], &args->pos[i - 1]);
- }
- }
- break;
- }
-
- return (retval);
-}
-
-/* ARGSUSED */
-static void *
-_Xaw_Xlib_DataInitProc(String class_name,
- Screen *screen, Colormap colormap, int depth)
-{
- XawXlibData *data;
- Window tmp_win;
-
- data = (XawXlibData *)XtMalloc(sizeof(XawXlibData));
-
- tmp_win = XCreateWindow(DisplayOfScreen(screen),
- RootWindowOfScreen(screen),
- 0, 0, 1, 1, 1, depth,
- InputOutput, CopyFromParent, 0, NULL);
- data->mask = 0;
- data->gc = XCreateGC(DisplayOfScreen(screen), tmp_win, 0, &data->values);
- XDestroyWindow(DisplayOfScreen(screen), tmp_win);
- data->shape = Complex;
- data->mode = CoordModeOrigin;
- data->dashes = NULL;
-
- return ((void *)data);
-}
-
-/* ARGSUSED */
-static void
-_Xaw_Xlib_ArgsDestructor(Display *display, String proc_name, XtPointer args,
- String *params, Cardinal *num_params)
-{
- Cardinal id;
- Dl_init *init;
-
- init = (Dl_init *)bsearch(proc_name, dl_init,
- sizeof(dl_init) / sizeof(dl_init[0]),
- sizeof(dl_init[0]),
- bcmp_cvt_proc);
-
- id = init->id;
-
- switch (id)
- {
- case LINE:
- case DRECT:
- case FRECT:
- case DARC:
- case FARC:
- case POINT:
- case TSORIGIN:
- case DASHES:
- case CLIPORIGIN:
- case COPYAREA:
- case COPYPLANE:
- case IMAGE:
- XtFree(args);
- break;
- case DSTRING:
- case PSTRING:
- {
- XawDLStringArgs *string = (XawDLStringArgs *)args;
- XtFree(string->string);
- XtFree(args);
- } break;
- case DLINES:
- case FPOLY:
- case POINTS:
- case SEGMENTS:
- case CLIPRECTS:
- {
- XawDLPositionPtr *ptr = (XawDLPositionPtr *)args;
-
- XtFree((char *)ptr->pos);
- XtFree(args);
- } break;
- }
-}
-
-/* ARGSUSED */
-static void
-_Xaw_Xlib_DataDestructor(Display *display, String class_name, XtPointer data)
-{
- if (data)
- {
- XawXlibData *xdata = (XawXlibData *)data;
-
- XFreeGC(display, xdata->gc);
- if (xdata->dashes)
- XtFree(xdata->dashes);
- XtFree((char *)data);
- }
-}
-
-/* Start of DLInfo Management Functions */
-static int
-qcmp_dlist_info(register _Xconst void *left, register _Xconst void *right)
-{
- return (strcmp((*(XawDLInfo **)left)->name, (*(XawDLInfo **)right)->name));
-}
-
-Bool XawDeclareDisplayListProc(XawDLClass *lc, String name,
- XawDisplayListProc proc)
-{
- XawDLInfo *info;
-
- if (!lc || !proc || !name || name[0] == '\0')
- return (False);
-
- if ((info = _XawFindDLInfo(lc, name)) != NULL)
- /* Since the data structures to the displayList classes are(should be)
- * opaque, it is not a good idea to allow overriding a displayList
- * procedure; it's better to choose another name or class name!
- */
- return (False);
-
- info = (XawDLInfo *)XtMalloc(sizeof(XawDLInfo));
- info->name = XtNewString(name);
- info->qname = XrmStringToQuark(info->name);
- info->proc = proc;
-
- if (!lc->num_infos)
- {
- lc->num_infos = 1;
- lc->infos = (XawDLInfo **)XtMalloc(sizeof(XawDLInfo*));
- }
- else
- {
- ++lc->num_infos;
- lc->infos = (XawDLInfo **)
- XtRealloc((char *)lc->infos, sizeof(XawDLInfo*) * lc->num_infos);
- }
- lc->infos[lc->num_infos - 1] = info;
-
- if (lc->num_infos > 1)
- qsort(lc->infos, lc->num_infos, sizeof(XawDLInfo*), qcmp_dlist_info);
-
- return (True);
-}
-
-static int
-bcmp_dlist_info(register _Xconst void *string,
- register _Xconst void *dlinfo)
-{
- return (strcmp((String)string, (*(XawDLClass **)dlinfo)->name));
-}
-
-static XawDLInfo *
-_XawFindDLInfo(XawDLClass *lc, String name)
-{
- XawDLInfo **info;
-
- if (!lc->infos)
- return (NULL);
-
- info = (XawDLInfo **)bsearch(name, lc->infos, lc->num_infos,
- sizeof(XawDLInfo*), bcmp_dlist_info);
-
- return (info ? *info : NULL);
-}
-
-/* Start of DLClass Management Functions */
-XawDLClass *
-XawGetDisplayListClass(String name)
-{
- return (_XawFindDLClass(name));
-}
-
-static int
-qcmp_dlist_class(register _Xconst void *left, register _Xconst void *right)
-{
- return (strcmp((*(XawDLClass **)left)->name, (*(XawDLClass **)right)->name));
-}
-
-XawDLClass *
-XawCreateDisplayListClass(String name,
- XawDLArgsInitProc args_init,
- XawDLArgsDestructor args_destructor,
- XawDLDataInitProc data_init,
- XawDLDataDestructor data_destructor)
-{
- XawDLClass *lc;
-
- if (!name || name[0] == '\0')
- return (NULL);
-
- lc = (XawDLClass *)XtMalloc(sizeof(XawDLClass));
- lc->name = XtNewString(name);
- lc->infos = NULL;
- lc->num_infos = 0;
- lc->args_init = args_init;
- lc->args_destructor = args_destructor;
- lc->data_init = data_init;
- lc->data_destructor = data_destructor;
-
- if (!classes)
- {
- num_classes = 1;
- classes = (XawDLClass **)XtMalloc(sizeof(XawDLClass));
- }
- else
- {
- ++num_classes;
- classes = (XawDLClass **)XtRealloc((char *)classes,
- sizeof(XawDLClass) * num_classes);
- }
- classes[num_classes - 1] = lc;
-
- if (num_classes > 1)
- qsort(&classes[0], num_classes, sizeof(XawDLClass*), qcmp_dlist_class);
-
- return (lc);
-}
-
-static int
-bcmp_dlist_class(register _Xconst void *string,
- register _Xconst void *dlist)
-{
- return (strcmp((String)string, (*(XawDLClass **)dlist)->name));
-}
-
-static XawDLClass *
-_XawFindDLClass(String name)
-{
- XawDLClass **lc;
-
- if (!classes)
- return (NULL);
-
- lc = (XawDLClass **)bsearch(name, &classes[0], num_classes,
- sizeof(XawDLClass*), bcmp_dlist_class);
-
- return (lc ? *lc : NULL);
-}
-
-#endif /* OLDXAW */
diff --git a/xc/lib/Xaw/Form.c b/xc/lib/Xaw/Form.c
deleted file mode 100644
index 8222fd4e7..000000000
--- a/xc/lib/Xaw/Form.c
+++ /dev/null
@@ -1,1118 +0,0 @@
-/* $TOG: Form.c /main/54 1998/05/14 14:55:45 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Form.c,v 1.15 1999/07/19 13:36:01 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xaw/FormP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static void XawFormChangeManaged(Widget);
-static void XawFormClassInitialize(void);
-static void XawFormClassPartInitialize(WidgetClass);
-static void XawFormConstraintInitialize(Widget, Widget, ArgList, Cardinal*);
-static Boolean XawFormConstraintSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static XtGeometryResult XawFormGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawFormInitialize(Widget, Widget, ArgList, Cardinal*);
-#ifndef OLDXAW
-static void XawFormRealize(Widget, Mask*, XSetWindowAttributes*);
-static void XawFormRedisplay(Widget, XEvent*, Region);
-#endif
-static XtGeometryResult XawFormQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawFormResize(Widget);
-static Boolean XawFormSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-static Boolean Layout(FormWidget, unsigned int, unsigned int, Bool);
-
-/*
- * Prototypes
- */
-static void _CvtStringToEdgeType(XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr);
-static Bool ChangeFormGeometry(Widget, Bool, unsigned int, unsigned int,
- Dimension*, Dimension*);
-Boolean CvtEdgeTypeToString(Display*, XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr, XtPointer*);
-static void LayoutChild(Widget);
-static int TransformCoord(int, unsigned int, unsigned int, XtEdgeType);
-static void ResizeChildren(Widget);
-
-/*
- * Initialization
- */
-#ifndef OLDXAW
-static XtActionsRec actions[] = {
- {"set-values", XawSetValuesAction},
- {"get-values", XawGetValuesAction},
- {"declare", XawDeclareAction},
- {"call-proc", XawCallProcAction},
-};
-#endif
-
-static XrmQuark QchainLeft, QchainRight, QchainTop, QchainBottom, Qrubber;
-
-#define default_value -99999
-#define Offset(field) XtOffsetOf(FormRec, form.field)
-static XtResource resources[] = {
- {
- XtNdefaultDistance,
- XtCThickness,
- XtRInt,
- sizeof(int),
- Offset(default_spacing),
- XtRImmediate,
- (XtPointer)4
- },
-#ifndef OLDXAW
- {
- XawNdisplayList,
- XawCDisplayList,
- XawRDisplayList,
- sizeof(XawDisplayList*),
- Offset(display_list),
- XtRImmediate,
- NULL
- },
-#endif
-};
-#undef Offset
-
-#define defEdge XtRubber
-
-#define Offset(field) XtOffsetOf(FormConstraintsRec, form.field)
-static XtResource formConstraintResources[] = {
- {
- XtNtop,
- XtCEdge,
- XtREdgeType,
- sizeof(XtEdgeType),
- Offset(top),
- XtRImmediate,
- (XtPointer)defEdge
- },
- {
- XtNbottom,
- XtCEdge,
- XtREdgeType,
- sizeof(XtEdgeType),
- Offset(bottom),
- XtRImmediate,
- (XtPointer)defEdge
- },
- {
- XtNleft,
- XtCEdge,
- XtREdgeType,
- sizeof(XtEdgeType),
- Offset(left),
- XtRImmediate,
- (XtPointer)defEdge
- },
- {
- XtNright,
- XtCEdge,
- XtREdgeType,
- sizeof(XtEdgeType),
- Offset(right),
- XtRImmediate,
- (XtPointer)defEdge
- },
- {
- XtNhorizDistance,
- XtCThickness,
- XtRInt,
- sizeof(int),
- Offset(dx),
- XtRImmediate,
- (XtPointer)default_value
- },
- {
- XtNfromHoriz,
- XtCWidget,
- XtRWidget,
- sizeof(Widget),
- Offset(horiz_base),
- XtRWidget,
- NULL
- },
- {
- XtNvertDistance,
- XtCThickness,
- XtRInt,
- sizeof(int),
- Offset(dy),
- XtRImmediate,
- (XtPointer)default_value
- },
- {
- XtNfromVert,
- XtCWidget,
- XtRWidget,
- sizeof(Widget),
- Offset(vert_base),
- XtRWidget,
- NULL
- },
- {
- XtNresizable,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- Offset(allow_resize),
- XtRImmediate,
- (XtPointer)False
- },
-};
-#undef Offset
-
-FormClassRec formClassRec = {
- /* core */
- {
- (WidgetClass)&constraintClassRec, /* superclass */
- "Form", /* class_name */
- sizeof(FormRec), /* widget_size */
- XawFormClassInitialize, /* class_initialize */
- XawFormClassPartInitialize, /* class_part_init */
- False, /* class_inited */
- XawFormInitialize, /* initialize */
- NULL, /* initialize_hook */
-#ifndef OLDXAW
- XawFormRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
-#else
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
-#endif
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XawFormResize, /* resize */
-#ifndef OLDXAW
- XawFormRedisplay, /* expose */
-#else
- XtInheritExpose, /* expose */
-#endif
- XawFormSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XawFormQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XawFormGeometryManager, /* geometry_manager */
- XawFormChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- /* constraint */
- {
- formConstraintResources, /* subresourses */
- XtNumber(formConstraintResources), /* subresource_count */
- sizeof(FormConstraintsRec), /* constraint_size */
- XawFormConstraintInitialize, /* initialize */
- NULL, /* destroy */
- XawFormConstraintSetValues, /* set_values */
- NULL, /* extension */
- },
- /* form */
- {
- Layout, /* layout */
- },
-};
-
-WidgetClass formWidgetClass = (WidgetClass)&formClassRec;
-
-/*
- * Implementation
- */
-#ifndef OLDXAW
-static void
-XawFormRealize(Widget w, Mask *mask, XSetWindowAttributes *attr)
-{
- XawPixmap *pixmap;
-
- (*formWidgetClass->core_class.superclass->core_class.realize)(w, mask, attr);
-
- if (w->core.background_pixmap > XtUnspecifiedPixmap) {
- pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
- w->core.colormap, w->core.depth);
- if (pixmap && pixmap->mask)
- XawReshapeWidget(w, pixmap);
- }
-}
-
-static void
-XawFormRedisplay(Widget w, XEvent *event, Region region)
-{
- FormWidget xaw = (FormWidget)w;
-
- if (xaw->form.display_list)
- XawRunDisplayList(w, xaw->form.display_list, event, region);
-}
-#endif
-
-/*ARGSUSED*/
-static void
-_CvtStringToEdgeType(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XtEdgeType edgeType;
- XrmQuark q;
- char name[12];
-
- XmuNCopyISOLatin1Lowered(name, (char*)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- if (q == QchainLeft)
- edgeType = XtChainLeft;
- else if (q == QchainRight)
- edgeType = XtChainRight;
- else if (q == QchainTop)
- edgeType = XtChainTop;
- else if (q == QchainBottom)
- edgeType = XtChainBottom;
- else if (q == Qrubber)
- edgeType = XtRubber;
- else {
- XtStringConversionWarning(fromVal->addr, XtREdgeType);
- toVal->size = 0;
- toVal->addr = NULL;
- return;
- }
-
- toVal->size = sizeof(XtEdgeType);
- toVal->addr = (XPointer)&edgeType;
-}
-
-/*ARGSUSED*/
-Boolean
-CvtEdgeTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(XtEdgeType *)fromVal->addr) {
- case XtChainLeft:
- buffer = XtEchainLeft;
- break;
- case XtChainRight:
- buffer = XtEchainRight;
- break;
- case XtChainTop:
- buffer = XtEchainTop;
- break;
- case XtChainBottom:
- buffer = XtEchainBottom;
- break;
- case XtRubber:
- buffer = XtErubber;
- break;
- default:
- XawTypeToStringWarning(dpy, XtREdgeType);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-static void
-XawFormClassInitialize(void)
-{
- static XtConvertArgRec parentCvtArgs[] = {
- {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent),
- sizeof(Widget)}
- };
-
- char name[12];
-
- XawInitializeWidgetSet();
- XmuNCopyISOLatin1Lowered(name, XtEchainLeft, sizeof(name));
- QchainLeft = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtEchainRight, sizeof(name));
- QchainRight = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtEchainTop, sizeof(name));
- QchainTop = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtEchainBottom, sizeof(name));
- QchainBottom = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtErubber, sizeof(name));
- Qrubber = XrmStringToQuark(name);
-
- XtAddConverter(XtRString, XtREdgeType, _CvtStringToEdgeType, NULL, 0);
- XtSetTypeConverter(XtREdgeType, XtRString, CvtEdgeTypeToString,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget,
- parentCvtArgs, XtNumber(parentCvtArgs), XtCacheNone,
- NULL);
- XtSetTypeConverter(XtRWidget, XtRString, XmuCvtWidgetToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-static void
-XawFormClassPartInitialize(WidgetClass cclass)
-{
- FormWidgetClass c = (FormWidgetClass)cclass;
- FormWidgetClass super = (FormWidgetClass)c->core_class.superclass;
-
- if (c->form_class.layout == XtInheritLayout)
- c->form_class.layout = super->form_class.layout;
-}
-
-/*ARGSUSED*/
-static void
-XawFormInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- FormWidget fw = (FormWidget)cnew;
-
- fw->form.old_width = fw->form.old_height = 0;
- fw->form.no_refigure = False;
- fw->form.needs_relayout = False;
- fw->form.resize_in_layout = True;
- fw->form.resize_is_no_op = False;
-}
-
-/*
- * Function:
- * ChangeFormGeometry
- *
- * Parameters:
- * w - Form widget
- * query_only - is only a query?
- * width - new width and height
- * height - ""
- * ret_width - actual size the form is allowed to resize to (return)
- * ret_height - ""
- *
- * Description:
- * Ask the parent to change the form widget's geometry.
- *
- * Returns:
- * True of children may always be resized
- */
-static Bool
-ChangeFormGeometry(Widget w, Bool query_only,
- unsigned int width, unsigned int height,
- Dimension *ret_width, Dimension *ret_height)
-{
- FormWidget fw = (FormWidget)w;
- Boolean always_resize_children;
- XtGeometryResult result;
- XtWidgetGeometry request, return_request;
-
- /*
- * If we are already at the desired size then there is no need
- * to ask our parent of we can change size
- */
- if (width == XtWidth(fw) && height == XtHeight(fw))
- return (True);
-
- request.width = width;
- request.height = height;
- request.request_mode = CWWidth | CWHeight;
- if (query_only)
- request.request_mode |= XtCWQueryOnly;
-
- /*
- * Do no invoke the resize rules if our size changes here
- */
- fw->form.resize_is_no_op = True;
-
- result = XtMakeGeometryRequest(w, &request, &return_request);
- if (result == XtGeometryAlmost) {
- request = return_request;
- (void)XtMakeGeometryRequest(w, &request, &return_request);
- always_resize_children = False;
- }
- else
- always_resize_children = result == XtGeometryYes;
-
- fw->form.resize_is_no_op = False;
-
- if (ret_width != NULL)
- *ret_width = request.width;
- if (ret_height != NULL)
- *ret_height = request.height;
-
- return (always_resize_children);
-}
-
-/*
- * Function:
- * Layout
- *
- * Parameters:
- * fw - Form widget
- * width - unused
- * height - ""
- * force_relayout - will force the children to be moved, even if some
- * go past the edge of the form
- *
- * Description:
- * Moves all the children around.
- *
- * Returns:
- * True if the children are allowed to move from their
- * current locations to the new ones.
- */
-/*ARGSUSED*/
-static Boolean
-Layout(FormWidget fw, unsigned int width, unsigned int height,
- Bool force_relayout)
-{
- int num_children = fw->composite.num_children;
- WidgetList children = fw->composite.children;
- Widget *childP;
- Dimension maxx, maxy;
- Boolean ret_val;
-
- for (childP = children; childP - children < num_children; childP++) {
- FormConstraints form = (FormConstraints)(*childP)->core.constraints;
- form->form.layout_state = LayoutPending;
- }
-
- maxx = maxy = 1;
- for (childP = children; childP - children < num_children; childP++) {
- if (XtIsManaged(*childP)) {
- FormConstraints form;
- Position x, y;
-
- form = (FormConstraints)(*childP)->core.constraints;
-
- LayoutChild(*childP);
-
- x = form->form.new_x + XtWidth(*childP)
- + (XtBorderWidth(*childP) << 1);
- if (x > (int)maxx)
- maxx = x;
-
- y = form->form.new_y + XtHeight(*childP)
- + (XtBorderWidth(*childP) << 1);
- if (y > (int)maxy)
- maxy = y;
- }
- }
-
- fw->form.preferred_width = (maxx += fw->form.default_spacing);
- fw->form.preferred_height = (maxy += fw->form.default_spacing);
-
- if (fw->form.resize_in_layout) {
- Boolean always_resize_children;
-
- always_resize_children =
- ChangeFormGeometry((Widget)fw, False, maxx, maxy, NULL, NULL);
-
- if (force_relayout)
- ret_val = True;
- else
- ret_val = always_resize_children ||
- (XtWidth(fw) >= maxx && XtHeight(fw) >= maxy);
-
- if (ret_val)
- ResizeChildren((Widget)fw);
- }
- else
- ret_val = False;
-
- fw->form.needs_relayout = False;
-
- return (ret_val);
-}
-
-/*
- * Function:
- * ResizeChildren
- *
- * Parameters:
- * w - form widget
- *
- * Description:
- * Resizes all children to new_x and new_y.
- */
-static void
-ResizeChildren(Widget w)
-{
- FormWidget fw = (FormWidget)w;
- int num_children = fw->composite.num_children;
- WidgetList children = fw->composite.children;
- Widget *childP;
-
- for (childP = children; childP - children < num_children; childP++) {
- FormConstraints form;
- Position x, y;
-
- if (!XtIsManaged(*childP))
- continue;
-
- form = (FormConstraints)(*childP)->core.constraints;
-
- if (fw->form.old_width && fw->form.old_height) {
- x = TransformCoord(form->form.new_x, fw->form.old_width,
- XtWidth(fw), form->form.left);
- y = TransformCoord(form->form.new_y, fw->form.old_height,
- XtHeight(fw), form->form.top);
- }
- else {
- x = form->form.new_x;
- y = form->form.new_y;
- }
-
- if (fw->form.no_refigure) {
- /*
- * I am changing the widget wrapper w/o modifing the window. This is
- * risky, but I can get away with it since I am the parent of this
- * widget, and he must ask me for any geometry changes
- *
- * The window will be updated when no_refigure is set back to False
- */
- XtX(*childP) = x;
- XtY(*childP) = y;
- }
- else
- XtMoveWidget(*childP, x, y);
- }
-}
-
-static void
-LayoutChild(Widget w)
-{
- FormWidget fw = (FormWidget)XtParent(w);
- FormConstraints form = (FormConstraints)w->core.constraints;
- Widget ref;
-
- switch (form->form.layout_state) {
- case LayoutPending:
- form->form.layout_state = LayoutInProgress;
- break;
- case LayoutDone:
- return;
- case LayoutInProgress: {
- String subs[2];
- Cardinal num_subs = 2;
- subs[0] = w->core.name;
- subs[1] = w->core.parent->core.name;
-
- XtAppWarningMsg(XtWidgetToApplicationContext(w),
- "constraintLoop", "xawFormLayout", "XawToolkitError",
- "constraint loop detected while laying out "
- "child '%s' in FormWidget '%s'",
- subs, &num_subs);
- } return;
- }
-
- form->form.new_x = form->form.dx;
- form->form.new_y = form->form.dy;
- if ((ref = form->form.horiz_base) != NULL) {
- FormConstraints ref_form = (FormConstraints)ref->core.constraints;
- Dimension width;
-
- LayoutChild(ref);
- width = fw->form.old_width ?
- ref_form->form.virtual_width : XtWidth(ref);
- form->form.new_x += ref_form->form.new_x + width +
- (XtBorderWidth(ref) << 1);
- }
- if ((ref = form->form.vert_base) != NULL) {
- FormConstraints ref_form = (FormConstraints)ref->core.constraints;
- Dimension height;
-
- LayoutChild(ref);
- height = fw->form.old_height ?
- ref_form->form.virtual_height : XtHeight(ref);
- form->form.new_y += ref_form->form.new_y + height +
- (XtBorderWidth(ref) << 1);
- }
-
- form->form.layout_state = LayoutDone;
-}
-
-static int
-TransformCoord(int loc, unsigned int old, unsigned int cnew, XtEdgeType type)
-{
- if (type == XtRubber) {
- if ((int)old > 0)
- loc = (int)(loc * ((double)cnew / (double)old));
- }
- else if (type == XtChainBottom || type == XtChainRight)
- loc += (int)cnew - (int)old;
-
- return (loc);
-}
-
-static void
-XawFormResize(Widget w)
-{
- FormWidget fw = (FormWidget)w;
- WidgetList children = fw->composite.children;
- int num_children = fw->composite.num_children;
- Widget *childP;
- int x, y;
- int width, height;
- Boolean unmap = XtIsRealized(w) && w->core.mapped_when_managed &&
- XtIsManaged(w);
-
- if (unmap)
- XtUnmapWidget(w);
-
- if (!fw->form.resize_is_no_op)
- for (childP = children; childP - children < num_children; childP++) {
- FormConstraints form = (FormConstraints)(*childP)->core.constraints;
-
- if (!XtIsManaged(*childP))
- continue;
-
-#ifndef OLDXAW
- x = TransformCoord(form->form.virtual_x, fw->form.old_width,
- XtWidth(fw), form->form.left);
- y = TransformCoord(form->form.virtual_y, fw->form.old_height,
- XtHeight(fw), form->form.top);
- width = TransformCoord(form->form.virtual_x +
- form->form.virtual_width +
- (XtBorderWidth(*childP) << 1),
- fw->form.old_width, XtWidth(fw),
- form->form.right) -
- (x + (XtBorderWidth(*childP) << 1));
- height = TransformCoord(form->form.virtual_y +
- form->form.virtual_height +
- (XtBorderWidth(*childP) << 1),
- fw->form.old_height, XtHeight(fw),
- form->form.bottom) -
- (y + (XtBorderWidth(*childP) << 1));
-#else
- x = TransformCoord(XtX(*childP), fw->form.old_width,
- XtWidth(fw), form->form.left);
- y = TransformCoord(XtY(*childP), fw->form.old_height,
- XtHeight(fw), form->form.top);
- width = TransformCoord(XtX(*childP) + form->form.virtual_width +
- (XtBorderWidth(*childP) << 1),
- fw->form.old_width, XtWidth(fw),
- form->form.right) -
- (x + (XtBorderWidth(*childP) << 1));
- height = TransformCoord(XtY(*childP) + form->form.virtual_height +
- (XtBorderWidth(*childP) << 1),
- fw->form.old_height, XtHeight(fw),
- form->form.bottom) -
- (y + (XtBorderWidth(*childP) << 1));
- form->form.virtual_width = width;
- form->form.virtual_height = height;
-#endif
-
- width = width < 1 ? 1 : width;
- height = height < 1 ? 1 : height;
-
- XtConfigureWidget(*childP, x, y, width, height,
- XtBorderWidth(*childP));
- }
-
- if (unmap)
- XtMapWidget(w);
-
-#ifdef OLDXAW
- fw->form.old_width = XtWidth(fw);
- fw->form.old_height = XtHeight(fw);
-#endif
-}
-
-/*ARGSUSED*/
-static XtGeometryResult
-XawFormGeometryManager(Widget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- Dimension old_width, old_height;
- FormWidget fw = (FormWidget)XtParent(w);
- FormConstraints form = (FormConstraints)w->core.constraints;
- XtWidgetGeometry allowed;
- XtGeometryResult ret_val;
-
- if ((request->request_mode & (unsigned)~(XtCWQueryOnly | CWWidth | CWHeight))
- || !form->form.allow_resize) {
- /* If GeometryManager is invoked during a SetValues call on a child
- * then it is necessary to compute a new layout if ConstraintSetValues
- * allowed any constraint changes
- */
- if (fw->form.needs_relayout)
- (*((FormWidgetClass)fw->core.widget_class)->form_class.layout)
- (fw, 0, 0, True);
- return (XtGeometryNo);
- }
-
- if (request->request_mode & CWWidth)
- allowed.width = request->width;
- else
- allowed.width = XtWidth(w);
-
- if (request->request_mode & CWHeight)
- allowed.height = request->height;
- else
- allowed.height = XtHeight(w);
-
- if (allowed.width == XtWidth(w) && allowed.height == XtHeight(w)) {
- /* If GeometryManager is invoked during a SetValues call on a child
- * then it is necessary to compute a new layout if ConstraintSetValues
- * allowed any constraint changes
- */
- if (fw->form.needs_relayout)
- (*((FormWidgetClass)fw->core.widget_class)->form_class.layout)
- (fw, 0, 0, True);
- return (XtGeometryNo);
- }
-
- /*
- * Remember the old size, and then set the size to the requested size
- */
- old_width = XtWidth(w);
- old_height = XtHeight(w);
- XtWidth(w) = allowed.width;
- XtHeight(w) = allowed.height;
-
- if (request->request_mode & XtCWQueryOnly) {
- Boolean always_resize_children;
- Dimension ret_width, ret_height;
-
- fw->form.resize_in_layout = False;
-
- (*((FormWidgetClass)fw->core.widget_class)->form_class.layout)
- (fw, XtWidth(w), XtHeight(w), False);
-
- /*
- * Reset the size of this child back to what it used to be
- */
- XtWidth(w) = old_width;
- XtHeight(w) = old_height;
-
- fw->form.resize_in_layout = True;
-
- always_resize_children = ChangeFormGeometry(w, True,
- fw->form.preferred_width,
- fw->form.preferred_height,
- &ret_width, &ret_height);
-
- if (always_resize_children
- || (ret_width >= fw->form.preferred_width
- && ret_height >= fw->form.preferred_height))
- ret_val = XtGeometryYes;
- else
- ret_val = XtGeometryNo;
- }
- else {
- if ((*((FormWidgetClass)fw->core.widget_class)->form_class.layout)
- (fw, XtWidth(w), XtHeight(w), False)) {
- if (fw->form.no_refigure) {
- /*
- * I am changing the widget wrapper w/o modifing the window.
- * This is risky, but I can get away with it since I am the
- * parent of this widget, and he must ask me for any geometry
- * changes
- *
- * The window will be updated when no_refigure is set back
- * to False
- */
- form->form.deferred_resize = True;
- ret_val = XtGeometryDone;
- }
- else
- ret_val = XtGeometryYes;
- }
- else {
- XtWidth(w) = old_width;
- XtHeight(w) = old_height;
- ret_val = XtGeometryNo;
- }
- }
-
- if (ret_val == XtGeometryDone) {
-#ifndef OLDXAW
- int x, y, width, height;
-
- if (fw->form.old_width && fw->form.old_height) {
- x = TransformCoord(XtX(w), XtWidth(fw), fw->form.old_width,
- form->form.left);
- y = TransformCoord(XtY(w), XtHeight(fw), fw->form.old_height,
- form->form.top);
- width = TransformCoord(XtX(w) + XtWidth(w) +
- (XtBorderWidth(w) << 1),
- XtWidth(fw), fw->form.old_width,
- form->form.right) -
- (x + (XtBorderWidth(w) << 1));
- height = TransformCoord(XtY(w) + XtHeight(w) +
- (XtBorderWidth(w) << 1),
- XtHeight(fw), fw->form.old_height,
- form->form.bottom) -
- (y + (XtBorderWidth(w) << 1));
- }
- else {
- x = XtX(w);
- y = XtY(w);
- width = XtWidth(w);
- height = XtHeight(w);
- }
- form->form.virtual_x = x;
- form->form.virtual_y = y;
- form->form.virtual_width = width;
- form->form.virtual_height = height;
-#else
- form->form.virtual_width = XtWidth(w);
- form->form.virtual_height = XtHeight(w);
-#endif /* OLDXAW */
- }
-
- return (ret_val);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawFormSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
-#ifndef OLDXAW
- FormWidget f_old = (FormWidget)current;
- FormWidget f_new = (FormWidget)cnew;
-
- if (f_old->core.background_pixmap != f_new->core.background_pixmap) {
- XawPixmap *opix, *npix;
-
- opix = XawPixmapFromXPixmap(f_old->core.background_pixmap, XtScreen(f_old),
- f_old->core.colormap, f_old->core.depth);
- npix = XawPixmapFromXPixmap(f_new->core.background_pixmap, XtScreen(f_new),
- f_new->core.colormap, f_new->core.depth);
- if ((npix && npix->mask) || (opix && opix->mask))
- XawReshapeWidget(cnew, npix);
- }
-#endif /* OLDXAW */
-
- return (False);
-}
-
-/* ARGSUSED */
-static void
-XawFormConstraintInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- FormConstraints form = (FormConstraints)cnew->core.constraints;
- FormWidget fw = (FormWidget)cnew->core.parent;
-
-#ifndef OLDXAW
- form->form.virtual_x = XtX(cnew);
- form->form.virtual_y = XtY(cnew);
-#endif
- form->form.virtual_width = XtWidth(cnew);
- form->form.virtual_height = XtHeight(cnew);
-
- if (form->form.dx == default_value)
- form->form.dx = fw->form.default_spacing;
-
- if (form->form.dy == default_value)
- form->form.dy = fw->form.default_spacing;
-
- form->form.deferred_resize = False;
-}
-
-/*ARGSUSED*/
-static Boolean
-XawFormConstraintSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- FormConstraints cfc = (FormConstraints)current->core.constraints;
- FormConstraints nfc = (FormConstraints)cnew->core.constraints;
-
- if (cfc->form.top != nfc->form.top || cfc->form.bottom != nfc->form.bottom
- || cfc->form.left != nfc->form.left || cfc->form.right != nfc->form.right
- || cfc->form.dx != nfc->form.dx || cfc->form.dy != nfc->form.dy
- || cfc->form.horiz_base != nfc->form.horiz_base
- || cfc->form.vert_base != nfc->form.vert_base) {
- FormWidget fp = (FormWidget)XtParent(cnew);
-
- /* If there are no subclass ConstraintSetValues procedures remaining
- * to be invoked, and if there is no geometry request about to be
- * made, then invoke the new layout now; else defer it
- */
- if (XtClass(XtParent(cnew)) == formWidgetClass
- && XtX(current) == XtX(cnew)
- && XtY(current) == XtY(cnew)
- && XtWidth(current) == XtWidth(cnew)
- && XtHeight(current) == XtHeight(cnew)
- && XtBorderWidth(current) == XtBorderWidth(cnew))
- Layout(fp, 0, 0, True);
- else
- fp->form.needs_relayout = True;
- }
-
- return (False);
-}
-
-static void
-XawFormChangeManaged(Widget w)
-{
- FormWidget fw = (FormWidget)w;
- FormConstraints form;
- WidgetList children, childP;
- int num_children = fw->composite.num_children;
- Widget child;
-
- (*((FormWidgetClass)w->core.widget_class)->form_class.layout)
- (fw, XtWidth(w), XtHeight(w), True);
-
- if (!fw->form.old_width || !fw->form.old_height) {
- fw->form.old_width = XtWidth(w);
- fw->form.old_height = XtHeight(w);
- for (children = childP = fw->composite.children;
- childP - children < num_children;
- childP++) {
- child = *childP;
- if (!XtIsManaged(child))
- continue;
- form = (FormConstraints)child->core.constraints;
-#ifndef OLDXAW
- form->form.virtual_x = XtX(child);
- form->form.virtual_y = XtY(child);
-#endif
- form->form.virtual_width = XtWidth(child);
- form->form.virtual_height = XtHeight(child);
- }
- }
-}
-
-static XtGeometryResult
-XawFormQueryGeometry(Widget widget, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- FormWidget w = (FormWidget)widget;
-
- reply->width = w->form.preferred_width;
- reply->height = w->form.preferred_height;
- reply->request_mode = CWWidth | CWHeight;
-
- if ((request->request_mode & (CWWidth | CWHeight)) == (CWWidth | CWHeight)
- && request->width == reply->width
- && request->height == reply->height)
- return (XtGeometryYes);
- else if (reply->width == XtWidth(w) && reply->height == XtHeight(w))
- return (XtGeometryNo);
-
- return (XtGeometryAlmost);
-}
-
-/*
- * Public routines
- */
-/*
- * Set or reset figuring (ignored if not realized)
- */
-void
-XawFormDoLayout(Widget w,
-#if NeedWidePrototypes
- Bool force
-#else
- Boolean force
-#endif
-)
-{
- Widget *childP;
- FormWidget fw = (FormWidget)w;
- int num_children = fw->composite.num_children;
- WidgetList children = fw->composite.children;
-
- if ((fw->form.no_refigure = !force) == True || !XtIsRealized(w))
- return;
-
- for (childP = children; childP - children < num_children; childP++) {
- Widget nw = *childP;
-
- if (XtIsManaged(nw)) {
- FormConstraints form = (FormConstraints)w->core.constraints;
-
- /*
- * Xt Configure widget is too smart, and optimizes out
- * my changes
- */
- XMoveResizeWindow(XtDisplay(nw), XtWindow(nw),
- XtX(nw), XtY(nw), XtWidth(nw), XtHeight(nw));
-
- if (form->form.deferred_resize &&
- XtClass(nw)->core_class.resize != NULL) {
- (*(XtClass(nw)->core_class.resize))(nw);
- form->form.deferred_resize = False;
- }
- }
- }
-}
diff --git a/xc/lib/Xaw/Form.h b/xc/lib/Xaw/Form.h
deleted file mode 100644
index 56dfbb30e..000000000
--- a/xc/lib/Xaw/Form.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/* $TOG: Form.h /main/31 1998/02/06 12:45:58 kaleb $ */
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Form.h,v 1.7 1999/06/06 08:47:56 dawes Exp $ */
-
-#ifndef _XawForm_h
-#define _XawForm_h
-
-#include <X11/Constraint.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- defaultDistance Thickness int 4
- destroyCallback Callback Pointer NULL
- displayList DisplayList XawDisplayList* NULL
- height Height Dimension computed at realize
- mappedWhenManaged MappedWhenManaged Boolean True
- sensitive Sensitive Boolean True
- width Width Dimension computed at realize
- x Position Position 0
- y Position Position 0
-
-*/
-
-/* Constraint parameters:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- bottom Edge XtEdgeType XtRubber
- fromHoriz Widget Widget (left edge of form)
- fromVert Widget Widget (top of form)
- horizDistance Thickness int defaultDistance
- left Edge XtEdgeType XtRubber
- resizable Boolean Boolean False
- right Edge XtEdgeType XtRubber
- top Edge XtEdgeType XtRubber
- vertDistance Thickness int defaultDistance
-
-*/
-
-
-#ifndef _XtStringDefs_h_
-#define XtNtop "top"
-#define XtRWidget "Widget"
-#endif
-
-#define XtNdefaultDistance "defaultDistance"
-#define XtNbottom "bottom"
-#define XtNleft "left"
-#define XtNright "right"
-#define XtNfromHoriz "fromHoriz"
-#define XtNfromVert "fromVert"
-#define XtNhorizDistance "horizDistance"
-#define XtNvertDistance "vertDistance"
-#define XtNresizable "resizable"
-
-#define XtCEdge "Edge"
-#define XtCWidget "Widget"
-
-typedef enum {
- XawChainTop, /* Keep this edge a constant distance from
- the top of the form */
- XawChainBottom, /* Keep this edge a constant distance from
- the bottom of the form */
- XawChainLeft, /* Keep this edge a constant distance from
- the left of the form */
- XawChainRight, /* Keep this edge a constant distance from
- the right of the form */
- XawRubber /* Keep this edge a proportional distance
- from the edges of the form */
-} XawEdgeType;
-
-#define XtEdgeType XawEdgeType
-
-#define XtChainTop XawChainTop
-#define XtChainBottom XawChainBottom
-#define XtChainLeft XawChainLeft
-#define XtChainRight XawChainRight
-#define XtRubber XawRubber
-
-#define XtEchainLeft "chainLeft"
-#define XtEchainRight "chainRight"
-#define XtEchainTop "chainTop"
-#define XtEchainBottom "chainBottom"
-#define XtErubber "rubber"
-
-#ifndef OLDXAW
-#ifndef XawNdisplayList
-#define XawNdisplayList "displayList"
-#endif
-
-#ifndef XawCDisplayList
-#define XawCDisplayList "DisplayList"
-#endif
-
-#ifndef XawRDisplayList
-#define XawRDisplayList "XawDisplayList"
-#endif
-#endif
-
-typedef struct _FormClassRec *FormWidgetClass;
-typedef struct _FormRec *FormWidget;
-
-extern WidgetClass formWidgetClass;
-
-_XFUNCPROTOBEGIN
-
-void XawFormDoLayout
-(
- Widget w,
-#if NeedWidePrototypes
- Bool do_layout
-#else
- Boolean do_layout
-#endif
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawForm_h */
diff --git a/xc/lib/Xaw/FormP.h b/xc/lib/Xaw/FormP.h
deleted file mode 100644
index 8134ce5c1..000000000
--- a/xc/lib/Xaw/FormP.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $TOG: FormP.h /main/23 1998/02/06 12:45:46 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/FormP.h,v 1.11 1999/06/20 08:41:00 dawes Exp $ */
-
-/* Form widget private definitions */
-
-#ifndef _XawFormP_h
-#define _XawFormP_h
-
-#include <X11/Xaw/Form.h>
-#include <X11/Xaw/XawInit.h>
-
-#define XtREdgeType "EdgeType"
-
-typedef enum {
- LayoutPending,
- LayoutInProgress,
- LayoutDone
-} LayoutState;
-
-#define XtInheritLayout \
-((Boolean (*)(FormWidget, unsigned int, unsigned int, Bool))_XtInherit)
-
-typedef struct {
- Boolean(*layout)(FormWidget, unsigned int, unsigned int, Bool);
-#ifndef OLDXAW
- XtPointer extension;
-#endif
-} FormClassPart;
-
-typedef struct _FormClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
- FormClassPart form_class;
-} FormClassRec;
-
-extern FormClassRec formClassRec;
-
-typedef struct _FormPart {
- /* resources */
- int default_spacing; /* default distance between children */
-
- /* private */
- Dimension old_width, old_height; /* reference value for *_virtual */
- int no_refigure; /* no re-layout while > 0 */
- Boolean needs_relayout; /* next time no_refigure == 0 */
- Boolean resize_in_layout; /* should layout() do geom request? */
- Dimension preferred_width, preferred_height; /* cached from layout */
- Boolean resize_is_no_op; /* Causes resize to take not action */
-#ifndef OLDXAW
- XawDisplayList *display_list;
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} FormPart;
-
-typedef struct _FormRec {
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
- FormPart form;
-} FormRec;
-
-typedef struct _FormConstraintsPart {
- /* resources */
- XtEdgeType top, bottom, left, right;/* where to drag edge on resize */
- int dx; /* desired horiz offset */
- int dy; /* desired vertical offset */
- Widget horiz_base; /* measure dx from here if non-null */
- Widget vert_base; /* measure dy from here if non-null */
- Boolean allow_resize; /* True if child may request resize */
-
- /* private */
- short virtual_width, virtual_height;
- Position new_x, new_y;
- LayoutState layout_state; /* temporary layout state */
- Boolean deferred_resize;/* was resized while no_refigure is set */
-#ifndef OLDXAW
- short virtual_x, virtual_y;
- XtPointer pad[2]; /* leave some space for further optimizations
- * in the form widget geometry
- */
-#endif
-} FormConstraintsPart;
-
-typedef struct _FormConstraintsRec {
- FormConstraintsPart form;
-} FormConstraintsRec, *FormConstraints;
-
-#endif /* _XawFormP_h */
diff --git a/xc/lib/Xaw/Grip.c b/xc/lib/Xaw/Grip.c
deleted file mode 100644
index c8ac68c3d..000000000
--- a/xc/lib/Xaw/Grip.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $TOG: Grip.c /main/34 1998/02/06 12:46:09 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Grip.c,v 1.6 1999/06/06 08:47:57 dawes Exp $ */
-
-/*
- * Grip.c - Grip Widget (Used by Paned Widget)
- *
- */
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/GripP.h>
-#include <X11/Xaw/XawInit.h>
-
-/*
- * Prototypes
- */
-static void
-GripAction(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-static XtResource resources[] = {
- {
- XtNwidth,
- XtCWidth,
- XtRDimension,
- sizeof(Dimension),
- XtOffsetOf(GripRec, core.width),
- XtRImmediate,
- (XtPointer)DEFAULT_GRIP_SIZE
- },
- {
- XtNheight,
- XtCHeight,
- XtRDimension,
- sizeof(Dimension),
- XtOffsetOf(GripRec, core.height),
- XtRImmediate,
- (XtPointer)DEFAULT_GRIP_SIZE
- },
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- XtOffsetOf(GripRec, core.background_pixel),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNborderWidth,
- XtCBorderWidth,
- XtRDimension,
- sizeof(Dimension),
- XtOffsetOf(GripRec, core.border_width),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- XtOffsetOf(GripRec, grip.grip_action),
- XtRCallback,
- NULL
- },
-};
-
-static XtActionsRec actionsList[] =
-{
- {"GripAction", GripAction},
-};
-
-#define Superclass (&simpleClassRec)
-
-GripClassRec gripClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Grip", /* class name */
- sizeof(GripRec), /* size */
- XawInitializeWidgetSet, /* class initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- NULL, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actionsList, /* actions */
- XtNumber(actionsList), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- NULL, /* resize */
- XtInheritExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* grip */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass gripWidgetClass = (WidgetClass)&gripClassRec;
-
-/*
- * Implementation
- */
-static void
-GripAction(Widget widget, XEvent *event, String *params, Cardinal *num_params)
-{
- XawGripCallDataRec call_data;
-
- call_data.event = event;
- call_data.params = params;
- call_data.num_params = *num_params;
-
- XtCallCallbacks(widget, XtNcallback, (XtPointer)&call_data);
-}
diff --git a/xc/lib/Xaw/Grip.h b/xc/lib/Xaw/Grip.h
deleted file mode 100644
index fe861ac7d..000000000
--- a/xc/lib/Xaw/Grip.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $TOG: Grip.h /main/20 1998/02/06 12:46:14 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/Grip.h,v 1.5 1999/06/06 08:47:57 dawes Exp $ */
-
-/*
- * Grip.h - Public Definitions for Grip widget (used by VPane Widget)
- *
- */
-
-#ifndef _XawGrip_h
-#define _XawGrip_h
-
-#include <X11/Xaw/Simple.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- foreground Foreground Pixel XtDefaultForeground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 0
- callback Callback Pointer GripAction
- cursor Cursor Cursor None
- cursorName Cursor String NULL
- destroyCallback Callback Pointer NULL
- height Height Dimension 8
- mappedWhenManaged MappedWhenManaged Boolean True
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- sensitive Sensitive Boolean True
- width Width Dimension 8
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtNgripTranslations "gripTranslations"
-
-typedef struct _XawGripCallData {
- XEvent *event; /* the event causing the GripAction */
- String *params; /* the TranslationTable params */
- Cardinal num_params; /* count of params */
-} XawGripCallDataRec, *XawGripCallData,
- GripCallDataRec, *GripCallData; /* supported for R4 compatibility */
-
-/* Class Record Constant */
-
-extern WidgetClass gripWidgetClass;
-
-typedef struct _GripClassRec *GripWidgetClass;
-typedef struct _GripRec *GripWidget;
-
-#endif /* _XawGrip_h */
diff --git a/xc/lib/Xaw/GripP.h b/xc/lib/Xaw/GripP.h
deleted file mode 100644
index ac2d82c27..000000000
--- a/xc/lib/Xaw/GripP.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-* $TOG: GripP.h /main/16 1998/02/06 12:46:03 kaleb $
-*/
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/GripP.h,v 1.6 1999/06/20 08:41:01 dawes Exp $ */
-
-#ifndef _XawGripP_h
-#define _XawGripP_h
-
-#include <X11/Xaw/Grip.h>
-#include <X11/Xaw/SimpleP.h>
-
-#define DEFAULT_GRIP_SIZE 8
-
-/* New fields for the Grip widget class */
-typedef struct {
- XtPointer extension;
-} GripClassPart;
-
-/* Full Class record */
-typedef struct _GripClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- GripClassPart grip_class;
-} GripClassRec;
-
-extern GripClassRec gripClassRec;
-
-/* New fields for the Grip widget */
-typedef struct {
- XtCallbackList grip_action;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} GripPart;
-
-/* Full instance record */
-typedef struct _GripRec {
- CorePart core;
- SimplePart simple;
- GripPart grip;
-} GripRec;
-
-#endif /* _XawGripP_h */
diff --git a/xc/lib/Xaw/Imakefile b/xc/lib/Xaw/Imakefile
deleted file mode 100644
index 9d8176c35..000000000
--- a/xc/lib/Xaw/Imakefile
+++ /dev/null
@@ -1,200 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/87 1996/09/28 16:43:34 rws $
-XCOMM $XFree86: xc/lib/Xaw/Imakefile,v 1.8 1999/06/27 14:07:33 dawes Exp $
-#define DoNormalLib NormalLibXaw
-#define DoSharedLib SharedLibXaw
-#define DoExtraLib SharedLibXaw
-#define DoDebugLib DebugLibXaw
-#define DoProfileLib ProfileLibXaw
-#define HasSharedData YES
-#define LibName Xaw
-#define SoRev SOXAWREV
-#define IncSubdir X11
-#define IncSubSubdir Xaw
-
-#ifdef SharedXawReqs
-REQUIREDLIBS = SharedXawReqs
-#endif
-
-DEFINES = XawI18nDefines
-
- LINTLIBS = $(LINTXLIB) $(LINTXTOOL)
-
-HEADERS = \
- AllWidgets.h \
- AsciiSink.h \
- AsciiSinkP.h \
- AsciiSrc.h \
- AsciiSrcP.h \
- AsciiText.h \
- AsciiTextP.h \
- Box.h \
- BoxP.h \
- Cardinals.h \
- Command.h \
- CommandP.h \
- Dialog.h \
- DialogP.h \
- Form.h \
- FormP.h \
- Grip.h \
- GripP.h \
- Label.h \
- LabelP.h \
- List.h \
- ListP.h \
- MenuButton.h \
- MenuButtoP.h \
- MultiSrc.h \
- MultiSrcP.h \
- MultiSink.h \
- MultiSinkP.h \
- Paned.h \
- PanedP.h \
- Panner.h \
- PannerP.h \
- Porthole.h \
- PortholeP.h \
- Repeater.h \
- RepeaterP.h \
- Reports.h \
- Scrollbar.h \
- ScrollbarP.h \
- Simple.h \
- SimpleP.h \
- SimpleMenu.h \
- SimpleMenP.h \
- Sme.h \
- SmeP.h \
- SmeBSB.h \
- SmeBSBP.h \
- SmeLine.h \
- SmeLineP.h \
- StripChart.h \
- StripCharP.h \
- Template.c \
- Template.h \
- TemplateP.h \
- Text.h \
- TextP.h \
- TextSink.h \
- TextSinkP.h \
- TextSrc.h \
- TextSrcP.h \
- Tip.h \
- TipP.h \
- Toggle.h \
- ToggleP.h \
- Tree.h \
- TreeP.h \
- VendorEP.h \
- Viewport.h \
- ViewportP.h \
- XawImP.h \
- XawInit.h
-
-SRCS = \
- Actions.c \
- AllWidgets.c \
- AsciiSink.c \
- AsciiSrc.c \
- AsciiText.c \
- Box.c \
- Command.c \
- Converters.c \
- Dialog.c \
- DisplayList.c \
- Form.c \
- Grip.c \
- Label.c \
- List.c \
- MenuButton.c \
- MultiSrc.c \
- MultiSink.c \
- OS.c \
- Paned.c \
- Panner.c \
- Pixmap.c \
- Porthole.c \
- Repeater.c \
- Scrollbar.c \
- Simple.c \
- SimpleMenu.c \
- Sme.c \
- SmeBSB.c \
- SmeLine.c \
- StripChart.c \
- Text.c \
- TextSink.c \
- TextSrc.c \
- TextAction.c \
- TextPop.c \
- TextTr.c \
- Tip.c \
- Toggle.c \
- Tree.c \
- Vendor.c \
- Viewport.c \
- XawIm.c \
- XawInit.c \
- XawI18n.c \
- sharedlib.c
-
-#if SharedDataSeparation
-UNSHAREDOBJS = AllWidgets.o sharedlib.o
-#endif
-
-OBJS = \
- Actions.o \
- AllWidgets.o \
- AsciiSink.o \
- AsciiSrc.o \
- AsciiText.o \
- Box.o \
- Command.o \
- Converters.o \
- Dialog.o \
- DisplayList.o \
- Form.o \
- Grip.o \
- Label.o \
- List.o \
- MenuButton.o \
- MultiSrc.o \
- MultiSink.o \
- OS.o \
- Paned.o \
- Panner.o \
- Pixmap.o \
- Porthole.o \
- Repeater.o \
- Scrollbar.o \
- Simple.o \
- SimpleMenu.o \
- Sme.o \
- SmeBSB.o \
- SmeLine.o \
- StripChart.o \
- Text.o \
- TextSink.o \
- TextSrc.o \
- TextAction.o \
- TextPop.o \
- TextTr.o \
- Tip.o \
- Toggle.o \
- Tree.o \
- Vendor.o \
- Viewport.o \
- XawIm.o \
- XawI18n.o \
- XawInit.o
-
-#include <Library.tmpl>
-
-#if DoSharedLib && SharedDataSeparation
-SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF))
-#endif
-
-MANSUFFIX = $(LIBMANSUFFIX)
-InstallManPage(Xaw,$(LIBMANDIR))
-DependTarget()
diff --git a/xc/lib/Xaw/Label.c b/xc/lib/Xaw/Label.c
deleted file mode 100644
index b62fa46ad..000000000
--- a/xc/lib/Xaw/Label.c
+++ /dev/null
@@ -1,813 +0,0 @@
-/* $TOG: Label.c /main/98 1998/02/06 12:46:24 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Label.c,v 1.11 1999/06/27 14:07:33 dawes Exp $ */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xaw/LabelP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
-#define MULTI_LINE_LABEL 32767
-
-#ifdef CRAY
-#define WORD64
-#endif
-
-/*
- * Class Methods
- */
-static void XawLabelClassInitialize(void);
-static void XawLabelDestroy(Widget);
-static void XawLabelInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawLabelQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawLabelRedisplay(Widget, XEvent*, Region);
-static void XawLabelResize(Widget);
-static Boolean XawLabelSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-#ifdef WORD64
-static int _XawLabelWidth16(XFontStruct*, char*, int);
-static void _XawLabelDraw16(Display*, Drawable, GC, int, int, char*, int);
-#endif
-static void compute_bitmap_offsets(LabelWidget);
-static void GetGrayGC(LabelWidget);
-static void GetNormalGC(LabelWidget);
-static void _Reposition(LabelWidget, unsigned int, unsigned int,
- Position*, Position*);
-static void set_bitmap_info(LabelWidget);
-static void SetTextWidthAndHeight(LabelWidget);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(LabelRec, field)
-static XtResource resources[] = {
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(label.foreground),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNfont,
- XtCFont,
- XtRFontStruct,
- sizeof(XFontStruct*),
- offset(label.font),
- XtRString,
- XtDefaultFont
- },
- {
- XtNfontSet,
- XtCFontSet,
- XtRFontSet,
- sizeof(XFontSet),
- offset(label.fontset),
- XtRString,
- XtDefaultFontSet
- },
- {
- XtNlabel,
- XtCLabel,
- XtRString,
- sizeof(String),
- offset(label.label),
- XtRString,
- NULL
- },
- {
- XtNencoding,
- XtCEncoding,
- XtRUnsignedChar,
- sizeof(unsigned char),
- offset(label.encoding),
- XtRImmediate,
- (XtPointer)XawTextEncoding8bit
- },
- {
- XtNjustify,
- XtCJustify,
- XtRJustify,
- sizeof(XtJustify),
- offset(label.justify),
- XtRImmediate,
- (XtPointer)XtJustifyCenter
- },
- {
- XtNinternalWidth,
- XtCWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(label.internal_width),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNinternalHeight,
- XtCHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(label.internal_height),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNleftBitmap,
- XtCLeftBitmap,
- XtRBitmap,
- sizeof(Pixmap),
- offset(label.left_bitmap),
- XtRImmediate,
- (XtPointer)None
- },
- {
- XtNbitmap,
- XtCPixmap,
- XtRBitmap,
- sizeof(Pixmap),
- offset(label.pixmap),
- XtRImmediate,
- (XtPointer)None
- },
- {
- XtNresize,
- XtCResize,
- XtRBoolean,
- sizeof(Boolean),
- offset(label.resize),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNlabelX,
- XtCPosition,
- XtRPosition,
- sizeof(Position),
- offset(label.label_x),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNlabelY,
- XtCPosition,
- XtRPosition,
- sizeof(Position),
- offset(label.label_y),
- XtRImmediate,
- (XtPointer)0
- },
-};
-#undef offset
-
-#define Superclass (&simpleClassRec)
-LabelClassRec labelClassRec = {
- /* core */
- {
- (WidgetClass)&simpleClassRec, /* superclass */
- "Label", /* class_name */
- sizeof(LabelRec), /* widget_size */
- XawLabelClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawLabelInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawLabelDestroy, /* destroy */
- XawLabelResize, /* resize */
- XawLabelRedisplay, /* expose */
- XawLabelSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XawLabelQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* label */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;
-
-/*
- * Implementation
- */
-static void
-XawLabelClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0);
- XtSetTypeConverter(XtRJustify, XtRString, XmuCvtJustifyToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-#ifndef WORD64
-#define TXT16 XChar2b
-#else
-#define TXT16 char
-
-static XChar2b *buf2b;
-static int buf2blen = 0;
-
-static int
-_XawLabelWidth16(XFontStruct *fs, char *str, int n)
-{
- int i;
- XChar2b *ptr;
-
- if (n > buf2blen) {
- buf2b = (XChar2b *)XtRealloc((char *)buf2b, n * sizeof(XChar2b));
- buf2blen = n;
- }
- for (ptr = buf2b, i = n; --i >= 0; ptr++) {
- ptr->byte1 = *str++;
- ptr->byte2 = *str++;
- }
-
- return (XTextWidth16(fs, buf2b, n));
-}
-
-static void
-_XawLabelDraw16(Display *dpy, Drawable d, GC gc, int x, int y,
- char *str, int n)
-{
- int i;
- XChar2b *ptr;
-
- if (n > buf2blen) {
- buf2b = (XChar2b *)XtRealloc((char *)buf2b, n * sizeof(XChar2b));
- buf2blen = n;
- }
- for (ptr = buf2b, i = n; --i >= 0; ptr++) {
- ptr->byte1 = *str++;
- ptr->byte2 = *str++;
- }
- XDrawString16(dpy, d, gc, x, y, buf2b, n);
-}
-
-#define XTextWidth16 _XawLabelWidth16
-#define XDrawString16 _XawLabelDraw16
-#endif /* WORD64 */
-
-/*
- * Calculate width and height of displayed text in pixels
- */
-static void
-SetTextWidthAndHeight(LabelWidget lw)
-{
- XFontStruct *fs = lw->label.font;
- char *nl;
-
- if (lw->label.pixmap != None) {
- Window root;
- int x, y;
- unsigned int width, height, bw, depth;
-
- if (XGetGeometry(XtDisplay(lw), lw->label.pixmap, &root, &x, &y,
- &width, &height, &bw, &depth)) {
- lw->label.label_height = height;
- lw->label.label_width = width;
- lw->label.label_len = depth;
- return;
- }
- }
- if (lw->simple.international == True) {
- XFontSet fset = lw->label.fontset;
- XFontSetExtents *ext = XExtentsOfFontSet(fset);
-
- lw->label.label_height = ext->max_ink_extent.height;
- if (lw->label.label == NULL) {
- lw->label.label_len = 0;
- lw->label.label_width = 0;
- }
- else if ((nl = index(lw->label.label, '\n')) != NULL) {
- char *label;
-
- lw->label.label_len = MULTI_LINE_LABEL;
- lw->label.label_width = 0;
- for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) {
- int width = XmbTextEscapement(fset, label, (int)(nl - label));
-
- if (width > (int)lw->label.label_width)
- lw->label.label_width = width;
- label = nl + 1;
- if (*label)
- lw->label.label_height += ext->max_ink_extent.height;
- }
- if (*label) {
- int width = XmbTextEscapement(fset, label, strlen(label));
-
- if (width > (int)lw->label.label_width)
- lw->label.label_width = width;
- }
- }
- else {
- lw->label.label_len = strlen(lw->label.label);
- lw->label.label_width =
- XmbTextEscapement(fset, lw->label.label, lw->label.label_len);
- }
- }
- else {
- lw->label.label_height = fs->max_bounds.ascent + fs->max_bounds.descent;
- if (lw->label.label == NULL) {
- lw->label.label_len = 0;
- lw->label.label_width = 0;
- }
- else if ((nl = index(lw->label.label, '\n')) != NULL) {
- char *label;
-
- lw->label.label_len = MULTI_LINE_LABEL;
- lw->label.label_width = 0;
- for (label = lw->label.label; nl != NULL; nl = index(label, '\n')) {
- int width;
-
- if (lw->label.encoding)
- width = XTextWidth16(fs, (TXT16*)label, (int)(nl - label) / 2);
- else
- width = XTextWidth(fs, label, (int)(nl - label));
- if (width > (int)lw->label.label_width)
- lw->label.label_width = width;
- label = nl + 1;
- if (*label)
- lw->label.label_height +=
- fs->max_bounds.ascent + fs->max_bounds.descent;
- }
- if (*label) {
- int width = XTextWidth(fs, label, strlen(label));
-
- if (lw->label.encoding)
- width = XTextWidth16(fs, (TXT16*)label, strlen(label) / 2);
- else
- width = XTextWidth(fs, label, strlen(label));
- if (width > (int) lw->label.label_width)
- lw->label.label_width = width;
- }
- }
- else {
- lw->label.label_len = strlen(lw->label.label);
- if (lw->label.encoding)
- lw->label.label_width =
- XTextWidth16(fs, (TXT16*)lw->label.label,
- (int)lw->label.label_len / 2);
- else
- lw->label.label_width =
- XTextWidth(fs, lw->label.label, (int)lw->label.label_len);
- }
- }
-}
-
-static void
-GetNormalGC(LabelWidget lw)
-{
- XGCValues values;
-
- values.foreground = lw->label.foreground;
- values.background = lw->core.background_pixel;
- values.font = lw->label.font->fid;
- values.graphics_exposures = False;
-
- if (lw->simple.international == True)
- /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */
- lw->label.normal_GC = XtAllocateGC((Widget)lw, 0,
- GCForeground | GCBackground |
- GCGraphicsExposures,
- &values, GCFont, 0);
- else
- lw->label.normal_GC = XtGetGC((Widget)lw,
- GCForeground | GCBackground | GCFont |
- GCGraphicsExposures, &values);
-}
-
-static void
-GetGrayGC(LabelWidget lw)
-{
- XGCValues values;
-
- values.foreground = lw->label.foreground;
- values.background = lw->core.background_pixel;
- values.font = lw->label.font->fid;
- values.fill_style = FillTiled;
- values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw),
- lw->label.foreground,
- lw->core.background_pixel,
- lw->core.depth);
- values.graphics_exposures = False;
-
- lw->label.stipple = values.tile;
- if (lw->simple.international == True)
- /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */
- lw->label.gray_GC = XtAllocateGC((Widget)lw, 0,
- GCForeground | GCBackground |
- GCTile | GCFillStyle |
- GCGraphicsExposures,
- &values, GCFont, 0);
- else
- lw->label.gray_GC = XtGetGC((Widget)lw,
- GCForeground | GCBackground |
- GCFont | GCTile | GCFillStyle |
- GCGraphicsExposures,
- &values);
-}
-
-static void
-compute_bitmap_offsets(LabelWidget lw)
-{
- /*
- * bitmap will be eventually be displayed at
- * (internal_width, internal_height + lbm_y)
- */
- if (lw->label.lbm_height != 0)
- lw->label.lbm_y = (XtHeight(lw) - (lw->label.internal_height * 2 +
- lw->label.lbm_height)) / 2;
- else
- lw->label.lbm_y = 0;
-}
-
-static void
-set_bitmap_info(LabelWidget lw)
-{
- Window root;
- int x, y;
- unsigned int bw, depth;
-
- if (!(lw->label.left_bitmap
- && XGetGeometry(XtDisplay(lw), lw->label.left_bitmap, &root, &x, &y,
- &lw->label.lbm_width, &lw->label.lbm_height,
- &bw, &depth)))
- lw->label.lbm_width = lw->label.lbm_height = 0;
-
- compute_bitmap_offsets(lw);
-}
-
-/*ARGSUSED*/
-static void
-XawLabelInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- LabelWidget lw = (LabelWidget)cnew;
-
- if (lw->label.label == NULL)
- lw->label.label = XtNewString(lw->core.name);
- else
- lw->label.label = XtNewString(lw->label.label);
-
- GetNormalGC(lw);
- GetGrayGC(lw);
-
- SetTextWidthAndHeight(lw);
-
- if (XtHeight(lw) == 0)
- XtHeight(lw) = lw->label.label_height + 2 * lw->label.internal_height;
-
- set_bitmap_info(lw); /* need core.height */
-
- if (XtWidth(lw) == 0) /* need label.lbm_width */
- XtWidth(lw) = lw->label.label_width + 2 * lw->label.internal_width +
- LEFT_OFFSET(lw);
-
- lw->label.label_x = lw->label.label_y = 0;
- (*XtClass(cnew)->core_class.resize)((Widget)lw);
-}
-
-/*ARGSUSED*/
-static void
-XawLabelRedisplay(Widget gw, XEvent *event, Region region)
-{
- LabelWidget w = (LabelWidget)gw;
- GC gc;
-
- if (*Superclass->core_class.expose != NULL)
- (*Superclass->core_class.expose)(gw, event, region);
-
- gc = XtIsSensitive(gw) ? w->label.normal_GC : w->label.gray_GC;
-#ifdef notdef
- if (region != NULL)
- XSetRegion(XtDisplay(gw), gc, region);
-#endif /*notdef*/
-
- if (w->label.pixmap == None) {
- int len = w->label.label_len;
- char *label = w->label.label;
- Position y = w->label.label_y + w->label.font->max_bounds.ascent;
- Position ksy = w->label.label_y;
-
- /* display left bitmap */
- if (w->label.left_bitmap && w->label.lbm_width != 0)
- XCopyPlane (XtDisplay(gw), w->label.left_bitmap, XtWindow(gw), gc,
- 0, 0, w->label.lbm_width, w->label.lbm_height,
- w->label.internal_width,
- w->label.internal_height + w->label.lbm_y, 1L);
-
- if (w->simple.international == True) {
- XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset);
-
- ksy += XawAbs(ext->max_ink_extent.y);
-
- if (len == MULTI_LINE_LABEL) {
- char *nl;
-
- while ((nl = index(label, '\n')) != NULL) {
- XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset,
- gc, w->label.label_x, ksy, label,
- (int)(nl - label));
- ksy += ext->max_ink_extent.height;
- label = nl + 1;
- }
- len = strlen(label);
- }
- if (len)
- XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc,
- w->label.label_x, ksy, label, len);
- }
- else {
- if (len == MULTI_LINE_LABEL) {
- char *nl;
-
- while ((nl = index(label, '\n')) != NULL) {
- if (w->label.encoding)
- XDrawString16(XtDisplay(gw), XtWindow(gw), gc,
- w->label.label_x, y,
- (TXT16*)label, (int)(nl - label) / 2);
- else
- XDrawString(XtDisplay(gw), XtWindow(gw), gc,
- w->label.label_x, y, label, (int)(nl - label));
- y += w->label.font->max_bounds.ascent +
- w->label.font->max_bounds.descent;
- label = nl + 1;
- }
- len = strlen(label);
- }
- if (len) {
- if (w->label.encoding)
- XDrawString16(XtDisplay(gw), XtWindow(gw), gc,
- w->label.label_x, y, (TXT16*)label, len / 2);
- else
- XDrawString(XtDisplay(gw), XtWindow(gw), gc,
- w->label.label_x, y, label, len);
- }
- }
- }
- else if (w->label.label_len == 1)
- XCopyPlane(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc,
- 0, 0, w->label.label_width, w->label.label_height,
- w->label.label_x, w->label.label_y, 1L);
- else
- XCopyArea(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc,
- 0, 0, w->label.label_width, w->label.label_height,
- w->label.label_x, w->label.label_y);
-
-#ifdef notdef
- if (region != NULL)
- XSetClipMask(XtDisplay(gw), gc, (Pixmap)None);
-#endif /* notdef */
-}
-
-static void
-_Reposition(LabelWidget lw, unsigned int width, unsigned int height,
- Position *dx, Position *dy)
-{
- Position newPos;
- Position leftedge = lw->label.internal_width + LEFT_OFFSET(lw);
-
- switch (lw->label.justify) {
- case XtJustifyLeft:
- newPos = leftedge;
- break;
- case XtJustifyRight:
- newPos = width - (lw->label.label_width + lw->label.internal_width);
- break;
- case XtJustifyCenter:
- /*FALLTRHOUGH*/
- default:
- newPos = (int)(width - lw->label.label_width) >> 1;
- break;
- }
- if (newPos < (Position)leftedge)
- newPos = leftedge;
- *dx = newPos - lw->label.label_x;
- lw->label.label_x = newPos;
-
- newPos = (height - lw->label.label_height) >> 1;
- *dy = newPos - lw->label.label_y;
- lw->label.label_y = newPos;
-}
-
-static void
-XawLabelResize(Widget w)
-{
- LabelWidget lw = (LabelWidget)w;
- Position dx, dy;
-
- _Reposition(lw, XtWidth(w), XtHeight(w), &dx, &dy);
- compute_bitmap_offsets(lw);
-}
-
-#define PIXMAP 0
-#define WIDTH 1
-#define HEIGHT 2
-#define NUM_CHECKS 3
-static Boolean
-XawLabelSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- LabelWidget curlw = (LabelWidget)current;
- LabelWidget reqlw = (LabelWidget)request;
- LabelWidget newlw = (LabelWidget)cnew;
- unsigned int i;
- Boolean was_resized = False, redisplay = False, checks[NUM_CHECKS];
-
- for (i = 0; i < NUM_CHECKS; i++)
- checks[i] = False;
-
- for (i = 0; i < *num_args; i++) {
- if (streq(XtNbitmap, args[i].name))
- checks[PIXMAP] = True;
- else if (streq(XtNwidth, args[i].name))
- checks[WIDTH] = True;
- else if (streq(XtNheight, args[i].name))
- checks[HEIGHT] = True;
- }
-
- if (newlw->label.label == NULL)
- newlw->label.label = newlw->core.name;
-
- /*
- * resize on bitmap change
- */
- if (curlw->label.left_bitmap != newlw->label.left_bitmap)
- was_resized = True;
-
- if (curlw->label.encoding != newlw->label.encoding)
- was_resized = True;
-
- if (curlw->label.fontset != newlw->label.fontset &&
- curlw->simple.international)
- was_resized = True;
-
- if (curlw->label.label != newlw->label.label) {
- if (curlw->label.label != curlw->core.name)
- XtFree((char *)curlw->label.label);
-
- if (newlw->label.label != newlw->core.name)
- newlw->label.label = XtNewString(newlw->label.label);
-
- was_resized = True;
- }
-
- if (was_resized || (curlw->label.font != newlw->label.font) ||
- curlw->label.justify != newlw->label.justify || checks[PIXMAP]) {
- SetTextWidthAndHeight(newlw);
- was_resized = True;
- }
-
- /* recalculate the window size if something has changed */
- if (newlw->label.resize && was_resized) {
- if (XtHeight(curlw) == XtHeight(reqlw) && !checks[HEIGHT])
- XtHeight(newlw) = newlw->label.label_height +
- (newlw->label.internal_height << 1);
-
- set_bitmap_info(newlw);
-
- if (XtWidth(curlw) == XtWidth(reqlw) && !checks[WIDTH])
- XtWidth(newlw) = newlw->label.label_width + LEFT_OFFSET(newlw) +
- (newlw->label.internal_width << 1);
- }
-
- if (curlw->label.foreground != newlw->label.foreground
- || curlw->core.background_pixel != newlw->core.background_pixel
- || curlw->label.font->fid != newlw->label.font->fid) {
- /* The Fontset is not in the GC - don't make a new GC if FS changes! */
- XtReleaseGC(cnew, curlw->label.normal_GC);
- XtReleaseGC(cnew, curlw->label.gray_GC);
- XmuReleaseStippledPixmap(XtScreen(current), curlw->label.stipple);
- GetNormalGC(newlw);
- GetGrayGC(newlw);
- redisplay = True;
- }
-
- if (curlw->label.label_x != newlw->label.label_x ||
- curlw->label.label_y != newlw->label.label_y)
- redisplay = True;
-
- if (curlw->label.internal_width != newlw->label.internal_width
- || curlw->label.internal_height != newlw->label.internal_height
- || was_resized) {
- /* Resize() will be called if geometry changes succeed */
- Position dx, dy;
-
- _Reposition(newlw, XtWidth(curlw), XtHeight(curlw), &dx, &dy);
- }
-
- return (was_resized || redisplay ||
- XtIsSensitive(current) != XtIsSensitive(cnew));
-}
-
-static void
-XawLabelDestroy(Widget w)
-{
- LabelWidget lw = (LabelWidget)w;
-
- if (lw->label.label != lw->core.name)
- XtFree(lw->label.label);
- XtReleaseGC(w, lw->label.normal_GC);
- XtReleaseGC(w, lw->label.gray_GC);
- XmuReleaseStippledPixmap(XtScreen(w), lw->label.stipple);
-}
-
-static XtGeometryResult
-XawLabelQueryGeometry(Widget w, XtWidgetGeometry *intended,
- XtWidgetGeometry *preferred)
-{
- LabelWidget lw = (LabelWidget)w;
-
- preferred->request_mode = CWWidth | CWHeight;
- preferred->width = lw->label.label_width +
- (lw->label.internal_width << 1) + LEFT_OFFSET(lw);
- preferred->height = lw->label.label_height +
- (lw->label.internal_height << 1);
-
- if (((intended->request_mode & (CWWidth | CWHeight)) == (CWWidth | CWHeight))
- && intended->width == preferred->width
- && intended->height == preferred->height)
- return (XtGeometryYes);
- else if (preferred->width == XtWidth(w) && preferred->height == XtHeight(w))
- return (XtGeometryNo);
-
- return (XtGeometryAlmost);
-}
diff --git a/xc/lib/Xaw/Label.h b/xc/lib/Xaw/Label.h
deleted file mode 100644
index 649d39b9a..000000000
--- a/xc/lib/Xaw/Label.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* $TOG: Label.h /main/35 1998/02/06 12:46:30 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Label.h,v 1.5 1998/10/03 08:42:06 dawes Exp $ */
-
-#ifndef _XawLabel_h
-#define _XawLabel_h
-
-/*
- * Label Widget
- */
-
-#include <X11/Xaw/Simple.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- bitmap Pixmap Pixmap None
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- cursor Cursor Cursor None
- cursorName Cursor String NULL
- destroyCallback Callback XtCallbackList NULL
- encoding Encoding UnsignedChar XawTextEncoding8bit
- font Font XFontStruct* XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension text height
- insensitiveBorder Insensitive Pixmap Gray
- internalHeight Height Dimension 2
- internalWidth Width Dimension 4
- justify Justify XtJustify XtJustifyCenter
- label Label String NULL
- leftBitmap LeftBitmap Pixmap None
- mappedWhenManaged MappedWhenManaged Boolean True
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- resize Resize Boolean True
- sensitive Sensitive Boolean True
- width Width Dimension text width
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XawTextEncoding8bit 0
-#define XawTextEncodingChar2b 1
-
-#define XtNleftBitmap "leftBitmap"
-#define XtCLeftBitmap "LeftBitmap"
-#define XtNencoding "encoding"
-#define XtCEncoding "Encoding"
-
-#ifndef XtNfontSet
-#define XtNfontSet "fontSet"
-#endif
-
-#ifndef XtCFontSet
-#define XtCFontSet "FontSet"
-#endif
-
-#ifndef _XtStringDefs_h_
-#define XtNbitmap "bitmap"
-#define XtNforeground "foreground"
-#define XtNlabel "label"
-#define XtNfont "font"
-#define XtNinternalWidth "internalWidth"
-#define XtNinternalHeight "internalHeight"
-#define XtNresize "resize"
-#define XtCResize "Resize"
-#define XtCBitmap "Bitmap"
-#endif
-
-#ifndef XtNlabelX
-#define XtNlabelX "labelX"
-#endif
-
-#ifndef XtNlabelY
-#define XtNlabelY "labelY"
-#endif
-
-/* Class record constants */
-
-extern WidgetClass labelWidgetClass;
-
-typedef struct _LabelClassRec *LabelWidgetClass;
-typedef struct _LabelRec *LabelWidget;
-
-#endif /* _XawLabel_h */
diff --git a/xc/lib/Xaw/LabelP.h b/xc/lib/Xaw/LabelP.h
deleted file mode 100644
index 55b20ac6f..000000000
--- a/xc/lib/Xaw/LabelP.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-* $TOG: LabelP.h /main/30 1998/02/06 12:46:19 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/LabelP.h,v 1.6 1999/06/20 08:41:02 dawes Exp $ */
-
-#ifndef _XawLabelP_h
-#define _XawLabelP_h
-
-/*
- * Label Widget Private Data
- */
-#include <X11/Xaw/Label.h>
-#include <X11/Xaw/SimpleP.h>
-
-/* New fields for the Label widget class record */
-typedef struct {
- XtPointer extension;
-} LabelClassPart;
-
-/* Full class record declaration */
-typedef struct _LabelClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- LabelClassPart label_class;
-} LabelClassRec;
-
-extern LabelClassRec labelClassRec;
-
-/* New fields for the Label widget record */
-typedef struct {
- /* resources */
- Pixel foreground;
- XFontStruct *font;
- XFontSet fontset;
- char *label;
- XtJustify justify;
- Dimension internal_width;
- Dimension internal_height;
- Pixmap pixmap;
- Boolean resize;
- unsigned char encoding;
- Pixmap left_bitmap;
-
- /* private state */
- GC normal_GC;
- GC gray_GC;
- Pixmap stipple;
- Position label_x;
- Position label_y;
- Dimension label_width;
- Dimension label_height;
- Dimension label_len;
- int lbm_y; /* where in label */
- unsigned int lbm_width, lbm_height; /* size of pixmap */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} LabelPart;
-
-/*
- * Full instance record declaration
- */
-typedef struct _LabelRec {
- CorePart core;
- SimplePart simple;
- LabelPart label;
-} LabelRec;
-
-#define LEFT_OFFSET(lw) ((lw)->label.left_bitmap \
- ? (lw)->label.lbm_width + (lw)->label.internal_width \
- : 0)
-
-#endif /* _XawLabelP_h */
diff --git a/xc/lib/Xaw/List.c b/xc/lib/Xaw/List.c
deleted file mode 100644
index 7ee1a8be1..000000000
--- a/xc/lib/Xaw/List.c
+++ /dev/null
@@ -1,1238 +0,0 @@
-/* $TOG: List.c /main/38 1998/02/11 14:53:23 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.
-*/
-/* $XFree86: xc/lib/Xaw/List.c,v 1.11 1999/06/06 08:47:58 dawes Exp $ */
-
-/*
- * List.c - List widget
- *
- * This is a List widget. It allows the user to select an item in a list and
- * notifies the application through a callback function.
- *
- * Created: 8/13/88
- * By: Chris D. Peterson
- * MIT X Consortium
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xaw/ListP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define HeightLock 1
-#define WidthLock 2
-#define LongestLock 4
-
-#define HeightFree(w) !(((ListWidget)(w))->list.freedoms & HeightLock)
-#define WidthFree(w) !(((ListWidget)(w))->list.freedoms & WidthLock)
-#define LongestFree(w) !(((ListWidget)(w))->list.freedoms & LongestLock)
-
-#define MaxSize 32767
-
-/*
- * Class Methods
- */
-static void XawListDestroy(Widget);
-static void XawListInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawListQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawListRedisplay(Widget, XEvent*, Region);
-static void XawListResize(Widget);
-static Boolean XawListSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void CalculatedValues(Widget);
-static void ChangeSize(Widget, unsigned int, unsigned int);
-static void ClipToShadowInteriorAndLongest(ListWidget, GC*, unsigned int);
-static int CvtToItem(Widget, int, int, int*);
-static void FindCornerItems(Widget, XEvent*, int*, int*);
-static void GetGCs(Widget);
-static void HighlightBackground(Widget, int, int, GC);
-static Bool ItemInRectangle(Widget, int, int, int);
-static Bool Layout(Widget, Bool, Bool, Dimension*, Dimension*);
-static void PaintItemName(Widget, int);
-static void ResetList(Widget, Bool, Bool);
-
-/*
- * Actions
- */
-static void Notify(Widget, XEvent*, String*, Cardinal*);
-static void Set(Widget, XEvent*, String*, Cardinal*);
-static void Unset(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-static char defaultTranslations[] =
-"<Btn1Down>:" "Set()\n"
-"<Btn1Up>:" "Notify()\n"
-;
-
-#define offset(field) XtOffset(ListWidget, field)
-static XtResource resources[] = {
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(list.foreground),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNcursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(simple.cursor),
- XtRString,
- "left_ptr"
- },
- {
- XtNfont,
- XtCFont,
- XtRFontStruct,
- sizeof(XFontStruct*),
- offset(list.font),
- XtRString,
- XtDefaultFont
- },
- {
- XtNfontSet,
- XtCFontSet,
- XtRFontSet,
- sizeof(XFontSet),
- offset(list.fontset),
- XtRString,
- XtDefaultFontSet
- },
- {
- XtNlist,
- XtCList,
- XtRPointer,
- sizeof(char**),
- offset(list.list),
-#ifdef notyet
- XtRStringArray,
-#else
- XtRString,
-#endif
- NULL
- },
- {
- XtNdefaultColumns,
- XtCColumns,
- XtRInt,
- sizeof(int),
- offset(list.default_cols),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNlongest,
- XtCLongest,
- XtRInt,
- sizeof(int),
- offset(list.longest),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNnumberStrings,
- XtCNumberStrings,
- XtRInt,
- sizeof(int),
- offset(list.nitems),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNpasteBuffer,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(list.paste),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNforceColumns,
- XtCColumns,
- XtRBoolean,
- sizeof(Boolean),
- offset(list.force_cols),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNverticalList,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(list.vertical_cols),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNinternalWidth,
- XtCWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(list.internal_width),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNinternalHeight,
- XtCHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(list.internal_height),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNcolumnSpacing,
- XtCSpacing,
- XtRDimension,
- sizeof(Dimension),
- offset(list.column_space),
- XtRImmediate,
- (XtPointer)6
- },
- {
- XtNrowSpacing,
- XtCSpacing,
- XtRDimension,
- sizeof(Dimension),
- offset(list.row_space),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(list.callback),
- XtRCallback,
- NULL
- },
-};
-#undef offset
-
-static XtActionsRec actions[] = {
- {"Notify", Notify},
- {"Set", Set},
- {"Unset", Unset},
-};
-
-#define Superclass (&simpleClassRec)
-ListClassRec listClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "List", /* class_name */
- sizeof(ListRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawListInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- False, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawListDestroy, /* destroy */
- XawListResize, /* resize */
- XawListRedisplay, /* expose */
- XawListSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XawListQueryGeometry, /* query_geometry */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* list */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass listWidgetClass = (WidgetClass)&listClassRec;
-
-/*
- * Implementation
- */
-static void
-GetGCs(Widget w)
-{
- XGCValues values;
- ListWidget lw = (ListWidget)w;
-
- values.foreground = lw->list.foreground;
- values.font = lw->list.font->fid;
-
- if (lw->simple.international == True)
- lw->list.normgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0);
- else
- lw->list.normgc = XtGetGC(w, GCForeground | GCFont, &values);
-
- values.foreground = lw->core.background_pixel;
-
- if (lw->simple.international == True)
- lw->list.revgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0);
- else
- lw->list.revgc = XtGetGC(w, GCForeground | GCFont, &values);
-
- values.tile = XmuCreateStippledPixmap(XtScreen(w),
- lw->list.foreground,
- lw->core.background_pixel,
- lw->core.depth);
- values.fill_style = FillTiled;
-
- if (lw->simple.international == True)
- lw->list.graygc = XtAllocateGC(w, 0, GCTile | GCFillStyle,
- &values, GCFont, 0);
- else
- lw->list.graygc = XtGetGC(w, GCFont | GCTile | GCFillStyle, &values);
-}
-
-static void
-CalculatedValues(Widget w)
-{
- int i, len;
- ListWidget lw = (ListWidget)w;
-
- /* If list is NULL then the list will just be the name of the widget */
- if (lw->list.list == NULL) {
- lw->list.list = &lw->core.name;
- lw->list.nitems = 1;
- }
-
- /* Get number of items */
- if (lw->list.nitems == 0)
- for (; lw->list.list[lw->list.nitems] != NULL ; lw->list.nitems++)
- ;
-
- /* Get column width */
- if (LongestFree(lw)) {
- lw->list.longest = 0; /* so it will accumulate real longest below */
-
- for (i = 0 ; i < lw->list.nitems; i++) {
- if (lw->simple.international == True)
- len = XmbTextEscapement(lw->list.fontset, lw->list.list[i],
- strlen(lw->list.list[i]));
- else
- len = XTextWidth(lw->list.font, lw->list.list[i],
- strlen(lw->list.list[i]));
- if (len > lw->list.longest)
- lw->list.longest = len;
- }
- }
-
- lw->list.col_width = lw->list.longest + lw->list.column_space;
-}
-
-/*
- * Function:
- * ResetList
- *
- * Parameters:
- * w - list widget
- * changex - allow the height or width to change?
- * changey - ""
- *
- * Description:
- * Resets the new list when important things change.
- *
- * Returns:
- * True if width or height have been changed
- */
-static void
-ResetList(Widget w, Bool changex, Bool changey)
-{
- Dimension width = XtWidth(w);
- Dimension height = XtHeight(w);
-
- CalculatedValues(w);
-
- if (Layout(w, changex, changey, &width, &height)) {
- if (XtIsComposite(XtParent(w)))
- ChangeSize(w, width, height);
- else {
- XtWidth(w) = width;
- XtHeight(w) = height;
- }
- }
-}
-
-/*
- * Function:
- * ChangeSize
- *
- * Parameters:
- * w - widget to try change the size of
- *
- * Description:
- * Laysout the widget.
- */
-static void
-ChangeSize(Widget w, unsigned int width, unsigned int height)
-{
- XtWidgetGeometry request, reply;
-
- request.request_mode = CWWidth | CWHeight;
- request.width = width;
- request.height = height;
-
- switch (XtMakeGeometryRequest(w, &request, &reply)) {
- case XtGeometryYes:
- case XtGeometryNo:
- break;
- case XtGeometryAlmost:
- Layout(w, request.height != reply.height,
- request.width != reply.width, &reply.width, &reply.height);
- request = reply;
- switch (XtMakeGeometryRequest(w, &request, &reply)) {
- case XtGeometryYes:
- case XtGeometryNo:
- break;
- case XtGeometryAlmost:
- request = reply;
- Layout(w, False, False, &request.width, &request.height);
- request.request_mode = CWWidth | CWHeight;
- XtMakeGeometryRequest(w, &request, &reply);
- /*FALLTROUGH*/
- default:
- break;
- }
- /*FALLTROUGH*/
- default:
- break;
- }
-}
-
-/*ARGSUSED*/
-static void
-XawListInitialize(Widget temp1, Widget cnew, ArgList args, Cardinal *num_args)
-{
- ListWidget lw = (ListWidget)cnew;
-
- /*
- * Initialize all private resources
- */
- /* record for posterity if we are free */
- lw->list.freedoms = ((XtWidth(lw) != 0) * WidthLock +
- (XtHeight(lw) != 0) * HeightLock +
- (lw->list.longest != 0) * LongestLock);
-
- GetGCs(cnew);
-
- /* Set row height, based on font or fontset */
- if (lw->simple.international == True)
- lw->list.row_height =
- XExtentsOfFontSet(lw->list.fontset)->max_ink_extent.height +
- lw->list.row_space;
- else
- lw->list.row_height = lw->list.font->max_bounds.ascent +
- lw->list.font->max_bounds.descent +
- lw->list.row_space;
-
- ResetList(cnew, WidthFree(lw), HeightFree(lw));
-
- lw->list.highlight = lw->list.is_highlighted = NO_HIGHLIGHT;
-}
-
-/*
- * Function:
- * CvtToItem
- *
- * Parameters:
- * w - list widget
- * xloc - x location
- * yloc - y location
- *
- * Description:
- * Converts Xcoord to item number of item containing that point.
- *
- * Returns:
- * Item number
- */
-static int
-CvtToItem(Widget w, int xloc, int yloc, int *item)
-{
- int one, another;
- ListWidget lw = (ListWidget)w;
- int ret_val = OKAY;
-
- if (lw->list.vertical_cols) {
- one = lw->list.nrows * ((xloc - (int)lw->list.internal_width)
- / lw->list.col_width);
- another = (yloc - (int)lw->list.internal_height) / lw->list.row_height;
- /* If out of range, return minimum possible value */
- if (another >= lw->list.nrows) {
- another = lw->list.nrows - 1;
- ret_val = OUT_OF_RANGE;
- }
- }
- else {
- one = (lw->list.ncols * ((yloc - (int)lw->list.internal_height)
- / lw->list.row_height));
- /* If in right margin handle things right */
- another = (xloc - (int)lw->list.internal_width) / lw->list.col_width;
- if (another >= lw->list.ncols) {
- another = lw->list.ncols - 1;
- ret_val = OUT_OF_RANGE;
- }
- }
- if (xloc < 0 || yloc < 0)
- ret_val = OUT_OF_RANGE;
- if (one < 0)
- one = 0;
- if (another < 0)
- another = 0;
- *item = one + another;
- if (*item >= lw->list.nitems)
- return (OUT_OF_RANGE);
-
- return (ret_val);
-}
-
-/*
- * Function:
- * FindCornerItems
- *
- * Arguments:
- * w - list widget
- * event - event structure that has the rectangle it it
- * ul_ret - the corners (return)
- * lr_ret - ""
- *
- * Description:
- * Find the corners of the rectangle in item space.
- */
-static void
-FindCornerItems(Widget w, XEvent *event, int *ul_ret, int *lr_ret)
-{
- int xloc, yloc;
-
- xloc = event->xexpose.x;
- yloc = event->xexpose.y;
- CvtToItem(w, xloc, yloc, ul_ret);
- xloc += event->xexpose.width;
- yloc += event->xexpose.height;
- CvtToItem(w, xloc, yloc, lr_ret);
-}
-
-/*
- * Function:
- * ItemInRectangle
- *
- * Parameters:
- * w - list widget
- * ul - corners of the rectangle in item space
- * lr - ""
- * item - item to check
- *
- * Returns:
- * True if the item passed is in the given rectangle
- */
-static Bool
-ItemInRectangle(Widget w, int ul, int lr, int item)
-{
- ListWidget lw = (ListWidget)w;
- int mod_item;
- int things;
-
- if (item < ul || item > lr)
- return (False);
- if (lw->list.vertical_cols)
- things = lw->list.nrows;
- else
- things = lw->list.ncols;
-
- mod_item = item % things;
- if ((mod_item >= ul % things) && (mod_item <= lr % things))
- return (True);
-
- return (False);
-}
-
-/* HighlightBackground()
- *
- * Paints the color of the background for the given item. It performs
- * clipping to the interior of internal_width/height by hand, as its a
- * simple calculation and probably much faster than using Xlib and a clip mask.
- *
- * x, y - ul corner of the area item occupies.
- * gc - the gc to use to paint this rectangle
- */
-static void
-HighlightBackground(Widget w, int x, int y, GC gc)
-{
- ListWidget lw = (ListWidget)w;
- Dimension width = lw->list.col_width;
- Dimension height = lw->list.row_height;
- Dimension frame_limited_width = XtWidth(w) - lw->list.internal_width - x;
- Dimension frame_limited_height= XtHeight(w) - lw->list.internal_height - y;
-
- /* Clip the rectangle width and height to the edge of the drawable area */
- if (width > frame_limited_width)
- width = frame_limited_width;
- if (height > frame_limited_height)
- height = frame_limited_height;
-
- /* Clip the rectangle x and y to the edge of the drawable area */
- if (x < lw->list.internal_width) {
- width = width - (lw->list.internal_width - x);
- x = lw->list.internal_width;
- }
- if (y < lw->list.internal_height) {
- height = height - (lw->list.internal_height - y);
- y = lw->list.internal_height;
- }
-
- if (gc == lw->list.revgc && lw->core.background_pixmap != XtUnspecifiedPixmap)
- XClearArea(XtDisplay(w), XtWindow(w), x, y, width, height, False);
- else
- XFillRectangle(XtDisplay(w), XtWindow(w), gc, x, y, width, height);
-}
-
-
-/* ClipToShadowInteriorAndLongest()
- *
- * Converts the passed gc so that any drawing done with that GC will not
- * write in the empty margin (specified by internal_width/height) (which also
- * prevents erasing the shadow. It also clips against the value longest.
- * If the user doesn't set longest, this has no effect (as longest is the
- * maximum of all item lengths). If the user does specify, say, 80 pixel
- * columns, though, this prevents items from overwriting other items.
- */
-static void
-ClipToShadowInteriorAndLongest(ListWidget lw, GC *gc_p, unsigned int x)
-{
- XRectangle rect;
-
- rect.x = x;
- rect.y = lw->list.internal_height;
- rect.height = XtHeight(lw) - (lw->list.internal_height << 1);
- rect.width = XtWidth(lw) - lw->list.internal_width - x;
- if (rect.width > lw->list.longest)
- rect.width = lw->list.longest;
-
- XSetClipRectangles(XtDisplay((Widget)lw), *gc_p, 0, 0, &rect, 1, YXBanded);
-}
-
-static void
-PaintItemName(Widget w, int item)
-{
- char *str;
- GC gc;
- int x, y, str_y;
- ListWidget lw = (ListWidget)w;
- XFontSetExtents *ext = XExtentsOfFontSet(lw->list.fontset);
-
- if (!XtIsRealized(w))
- return;
-
- if (lw->list.vertical_cols) {
- x = lw->list.col_width * (item / lw->list.nrows)
- + lw->list.internal_width;
- y = lw->list.row_height * (item % lw->list.nrows)
- + lw->list.internal_height;
- }
- else {
- x = lw->list.col_width * (item % lw->list.ncols)
- + lw->list.internal_width;
- y = lw->list.row_height * (item / lw->list.ncols)
- + lw->list.internal_height;
- }
-
- if ( lw->simple.international == True )
- str_y = y + XawAbs(ext->max_ink_extent.y);
- else
- str_y = y + lw->list.font->max_bounds.ascent;
-
- if (item == lw->list.is_highlighted) {
- if (item == lw->list.highlight) {
- gc = lw->list.revgc;
- HighlightBackground(w, x, y, lw->list.normgc);
- }
- else {
- if (XtIsSensitive(w))
- gc = lw->list.normgc;
- else
- gc = lw->list.graygc;
- HighlightBackground(w, x, y, lw->list.revgc);
- lw->list.is_highlighted = NO_HIGHLIGHT;
- }
- }
- else {
- if (item == lw->list.highlight) {
- gc = lw->list.revgc;
- HighlightBackground(w, x, y, lw->list.normgc);
- lw->list.is_highlighted = item;
- }
- else {
- if (XtIsSensitive(w))
- gc = lw->list.normgc;
- else
- gc = lw->list.graygc;
- }
- }
-
- /* List's overall width contains the same number of inter-column
- column_space's as columns. There should thus be a half
- column_width margin on each side of each column.
- The row case is symmetric */
-
- x += lw->list.column_space >> 1;
- str_y += lw->list.row_space >> 1;
-
- str = lw->list.list[item]; /* draw it */
-
- ClipToShadowInteriorAndLongest(lw, &gc, x);
-
- if (lw->simple.international == True)
- XmbDrawString(XtDisplay(w), XtWindow(w), lw->list.fontset,
- gc, x, str_y, str, strlen(str));
- else
- XDrawString(XtDisplay(w), XtWindow(w), gc, x, str_y, str, strlen(str));
-
- XSetClipMask(XtDisplay(w), gc, None);
-}
-
-static void
-XawListRedisplay(Widget w, XEvent *event, Region region)
-{
- int item; /* an item to work with */
- int ul_item, lr_item; /* corners of items we need to paint */
- ListWidget lw = (ListWidget)w;
-
- if (event == NULL) {
- ul_item = 0;
- lr_item = lw->list.nrows * lw->list.ncols - 1;
- XClearWindow(XtDisplay(w), XtWindow(w));
- }
- else
- FindCornerItems(w, event, &ul_item, &lr_item);
-
- if (Superclass->core_class.expose)
- (Superclass->core_class.expose)(w, event, region);
-
- for (item = ul_item; item <= lr_item && item < lw->list.nitems; item++)
- if (ItemInRectangle(w, ul_item, lr_item, item))
- PaintItemName(w, item);
-}
-
-/* XawListQueryGeometry()
- *
- * This tells the parent what size we would like to be
- * given certain constraints.
- * w - the widget.
- * intended - what the parent intends to do with us.
- * requested - what we want to happen */
-static XtGeometryResult
-XawListQueryGeometry(Widget w, XtWidgetGeometry *intended,
- XtWidgetGeometry *requested)
-{
- Dimension new_width, new_height;
- Bool change, width_req, height_req;
-
- width_req = intended->request_mode & CWWidth;
- height_req = intended->request_mode & CWHeight;
-
- if (width_req)
- new_width = intended->width;
- else
- new_width = XtWidth(w);
-
- if (height_req)
- new_height = intended->height;
- else
- new_height = XtHeight(w);
-
- requested->request_mode = 0;
-
- /*
- * We only care about our height and width
- */
- if (!width_req && !height_req)
- return (XtGeometryYes);
-
- change = Layout(w, !width_req, !height_req, &new_width, &new_height);
-
- requested->request_mode |= CWWidth;
- requested->width = new_width;
- requested->request_mode |= CWHeight;
- requested->height = new_height;
-
- if (change)
- return (XtGeometryAlmost);
-
- return (XtGeometryYes);
-}
-
-static void
-XawListResize(Widget w)
-{
- Dimension width, height;
-
- width = XtWidth(w);
- height = XtHeight(w);
-
- if (Layout(w, False, False, &width, &height))
- XtAppWarning(XtWidgetToApplicationContext(w),
- "List Widget: Size changed when it shouldn't "
- "have when resising.");
-}
-
-/* Layout()
- *
- * lays out the item in the list.
- * w - the widget.
- * xfree, yfree - True if we are free to resize the widget in
- * this direction.
- * width, height- the is the current width and height that we are going
- * we are going to layout the list widget to,
- * depending on xfree and yfree of course.
- *
- * Return:
- * True if width or height have been changed */
-static Bool
-Layout(Widget w, Bool xfree, Bool yfree, Dimension *width, Dimension *height)
-{
- ListWidget lw = (ListWidget)w;
- Bool change = False;
- unsigned long width2 = 0, height2 = 0;
-
- /*
- * If force columns is set then always use number of columns specified
- * by default_cols
- */
- if (lw->list.force_cols) {
- lw->list.ncols = lw->list.default_cols;
- if (lw->list.ncols <= 0)
- lw->list.ncols = 1;
- lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
- if (xfree) {
- /* this counts the same number
- of inter-column column_space 's as columns. There should thus
- be a half column_space margin on each side of each column...*/
- width2 = lw->list.ncols * lw->list.col_width +
- (lw->list.internal_width << 1);
- change = True;
- }
- if (yfree) {
- height2 = lw->list.nrows * lw->list.row_height +
- (lw->list.internal_height << 1);
- change = True;
- }
- }
-
- /*
- * If both width and height are free to change the use default_cols
- * to determine the number columns and set new width and height to
- * just fit the window
- */
- else if (xfree && yfree) {
- lw->list.ncols = lw->list.default_cols;
- if (lw->list.ncols <= 0) {
- int wid = (int)XtWidth(lw) - (int)(lw->list.internal_width << 1)
- + (int)lw->list.column_space;
-
- if (wid <= 0 || lw->list.col_width <= 0
- || (lw->list.ncols = wid / lw->list.col_width) <= 0)
- lw->list.ncols = 1;
- }
- width2 = lw->list.ncols * lw->list.col_width
- + (lw->list.internal_width << 1);
- height2 = (lw->list.nrows * lw->list.row_height)
- + (lw->list.internal_height << 1);
- change = True;
- }
-
- /*
- * If the width is fixed then use it to determine the number of columns.
- * If the height is free to move (width still fixed) then resize the height
- * of the widget to fit the current list exactly
- */
- else if (!xfree) {
- lw->list.ncols = ((int)(*width - (lw->list.internal_width << 1))
- / (int)lw->list.col_width);
- if (lw->list.ncols <= 0)
- lw->list.ncols = 1;
- lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
- if (yfree) {
- height2 = lw->list.nrows * lw->list.row_height +
- (lw->list.internal_height << 1);
- change = True;
- }
- }
-
- /*
- * The last case is xfree and !yfree we use the height to determine
- * the number of rows and then set the width to just fit the resulting
- * number of columns
- */
- else if (!yfree) {
- lw->list.nrows = ((int)(*height - (lw->list.internal_height << 1))
- / (int)lw->list.row_height);
- if (lw->list.nrows <= 0)
- lw->list.nrows = 1;
- lw->list.ncols = ((lw->list.nitems - 1) / lw->list.nrows) + 1;
- width2 = lw->list.ncols * lw->list.col_width +
- (lw->list.internal_width << 1);
- change = True;
- }
-
- if (!lw->list.force_cols && lw->list.nrows) {
- /*CONSTCOND*/
- while (1) {
- lw->list.nrows = ((lw->list.nitems - 1) / lw->list.ncols) + 1;
- width2 = lw->list.ncols * lw->list.col_width +
- (lw->list.internal_width << 1);
- height2 = lw->list.nrows * lw->list.row_height +
- (lw->list.internal_height << 1);
- if (width2 >= MaxSize && height2 >= MaxSize)
- break;
- if (height2 > MaxSize)
- ++lw->list.ncols;
- else if (width2 > MaxSize && lw->list.ncols > 1)
- --lw->list.ncols;
- else
- break;
- }
- }
- if (width2)
- *width = width2;
- if (height2)
- *height = height2;
-
- return (change);
-}
-
-/* Notify() - Action
- *
- * Notifies the user that a button has been pressed, and
- * calls the callback; if the XtNpasteBuffer resource is true
- * then the name of the item is also put in CUT_BUFFER0 */
-/*ARGSUSED*/
-static void
-Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- ListWidget lw = (ListWidget)w;
- int item, item_len;
- XawListReturnStruct ret_value;
-
- /*
- * Find item and if out of range then unhighlight and return
- *
- * If the current item is unhighlighted then the user has aborted the
- * notify, so unhighlight and return
- */
- if ((CvtToItem(w, event->xbutton.x, event->xbutton.y, &item) == OUT_OF_RANGE)
- || lw->list.highlight != item) {
- XawListUnhighlight(w);
- return;
- }
-
- item_len = strlen(lw->list.list[item]);
-
- if (lw->list.paste) /* if XtNpasteBuffer set then paste it */
- XStoreBytes(XtDisplay(w), lw->list.list[item], item_len);
-
- /*
- * Call Callback function
- */
- ret_value.string = lw->list.list[item];
- ret_value.list_index = item;
-
- XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value);
-}
-
-/* Unset() - Action
- *
- * unhighlights the current element */
-/*ARGSUSED*/
-static void
-Unset(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- XawListUnhighlight(w);
-}
-
-/* Set() - Action
- *
- * Highlights the current element */
-/*ARGSUSED*/
-static void
-Set(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- int item;
- ListWidget lw = (ListWidget)w;
-
- if (CvtToItem(w, event->xbutton.x, event->xbutton.y, &item) == OUT_OF_RANGE)
- XawListUnhighlight(w); /* Unhighlight current item */
- else if (lw->list.is_highlighted != item) /* If this item is not */
- XawListHighlight(w, item); /* highlighted then do it */
-}
-
-/*
- * Set specified arguments into widget
- */
-/*ARGSUSED*/
-static Boolean
-XawListSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ListWidget cl = (ListWidget)current;
- ListWidget rl = (ListWidget)request;
- ListWidget nl = (ListWidget)cnew;
- Bool redraw = False;
- XFontSetExtents *ext = XExtentsOfFontSet(nl->list.fontset);
-
- /* If the request height/width is different, lock it. Unless its 0. If
- neither new nor 0, leave it as it was. Not in R5 */
- if (XtWidth(nl) != XtWidth(cl))
- nl->list.freedoms |= WidthLock;
- if (XtWidth(nl) == 0)
- nl->list.freedoms &= ~WidthLock;
-
- if (XtHeight(nl) != XtHeight(cl))
- nl->list.freedoms |= HeightLock;
- if (XtHeight(nl) == 0)
- nl->list.freedoms &= ~HeightLock;
-
- if (nl->list.longest != cl->list.longest)
- nl->list.freedoms |= LongestLock;
- if (nl->list.longest == 0)
- nl->list.freedoms &= ~LongestLock;
-
- if (cl->list.foreground != nl->list.foreground ||
- cl->core.background_pixel != nl->core.background_pixel ||
- cl->list.font != nl->list.font) {
- XGCValues values;
-
- XGetGCValues(XtDisplay(current), cl->list.graygc, GCTile, &values);
- XmuReleaseStippledPixmap(XtScreen(current), values.tile);
- XtReleaseGC(current, cl->list.graygc);
- XtReleaseGC(current, cl->list.revgc);
- XtReleaseGC(current, cl->list.normgc);
- GetGCs(cnew);
- redraw = True;
- }
-
- if (cl->list.font != nl->list.font && cl->simple.international == False)
- nl->list.row_height = nl->list.font->max_bounds.ascent
- + nl->list.font->max_bounds.descent
- + nl->list.row_space;
- else if (cl->list.fontset != nl->list.fontset
- && cl->simple.international == True)
- nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
-
- /* ...If the above two font(set) change checkers above both failed, check
- if row_space was altered. If one of the above passed, row_height will
- already have been re-calculated */
- else if (cl->list.row_space != nl->list.row_space) {
- if (cl->simple.international == True)
- nl->list.row_height = ext->max_ink_extent.height + nl->list.row_space;
- else
- nl->list.row_height = nl->list.font->max_bounds.ascent
- + nl->list.font->max_bounds.descent
- + nl->list.row_space;
- }
-
- if (XtWidth(cl) != XtWidth(nl) || XtHeight(cl) != XtHeight(nl)
- || cl->list.internal_width != nl->list.internal_width
- || cl->list.internal_height != nl->list.internal_height
- || cl->list.column_space != nl->list.column_space
- || cl->list.row_space != nl->list.row_space
- || cl->list.default_cols != nl->list.default_cols
- || (cl->list.force_cols != nl->list.force_cols
- && rl->list.force_cols != nl->list.ncols)
- || cl->list.vertical_cols != nl->list.vertical_cols
- || cl->list.longest != nl->list.longest
- || cl->list.nitems != nl->list.nitems
- || cl->list.font != nl->list.font
- /* Equiv. fontsets might have different values, but the same fonts,
- so the next comparison is sloppy but not dangerous */
- || cl->list.fontset != nl->list.fontset
- || cl->list.list != nl->list.list) {
- CalculatedValues(cnew);
- Layout(cnew, WidthFree(nl), HeightFree(nl),
- &nl->core.width, &nl->core.height);
- redraw = True;
- }
-
- if (cl->list.list != nl->list.list)
- nl->list.is_highlighted = nl->list.highlight = NO_HIGHLIGHT;
-
- if (cl->core.sensitive != nl->core.sensitive
- || cl->core.ancestor_sensitive != nl->core.ancestor_sensitive) {
- nl->list.highlight = NO_HIGHLIGHT;
- redraw = True;
- }
-
- return (redraw);
-}
-
-static void
-XawListDestroy(Widget w)
-{
- ListWidget lw = (ListWidget)w;
- XGCValues values;
-
- XGetGCValues(XtDisplay(w), lw->list.graygc, GCTile, &values);
- XmuReleaseStippledPixmap(XtScreen(w), values.tile);
- XtReleaseGC(w, lw->list.graygc);
- XtReleaseGC(w, lw->list.revgc);
- XtReleaseGC(w, lw->list.normgc);
-}
-
-/*
- * Function:
- * XawListChange
- *
- * Parameters:
- * w - list widget
- * list - new list
- * nitems - number of items in the list
- * longest - length (in Pixels) of the longest element in the list
- * resize - if True the the list widget will try to resize itself
- *
- * Description:
- * Changes the list being used and shown.
- *
- * Note:
- * If nitems of longest are <= 0 then they will be calculated
- * If nitems is <= 0 then the list needs to be NULL terminated
- */
-void
-XawListChange(Widget w, char **list, int nitems, int longest,
-#if NeedWidePrototypes
- int resize_it
-#else
- Boolean resize_it
-#endif
-)
-{
- ListWidget lw = (ListWidget)w;
- Dimension new_width = XtWidth(w);
- Dimension new_height = XtHeight(w);
-
- lw->list.list = list;
-
- if (nitems <= 0)
- nitems = 0;
- lw->list.nitems = nitems;
- if (longest <= 0)
- longest = 0;
-
- /* If the user passes 0 meaning "calculate it", it must be free */
- if (longest != 0)
- lw->list.freedoms |= LongestLock;
- else
- lw->list.freedoms &= ~LongestLock;
-
- if (resize_it)
- lw->list.freedoms &= ~WidthLock & ~HeightLock;
-
- lw->list.longest = longest;
-
- CalculatedValues(w);
-
- if (Layout(w, WidthFree(w), HeightFree(w), &new_width, &new_height))
- ChangeSize(w, new_width, new_height);
-
- lw->list.is_highlighted = lw->list.highlight = NO_HIGHLIGHT;
- if (XtIsRealized(w))
- XawListRedisplay(w, NULL, NULL);
-}
-
-void
-XawListUnhighlight(Widget w)
-{
- ListWidget lw = (ListWidget)w;
-
- lw->list.highlight = NO_HIGHLIGHT;
- if (lw->list.is_highlighted != NO_HIGHLIGHT)
- PaintItemName(w, lw->list.is_highlighted);
-}
-
-void
-XawListHighlight(Widget w, int item)
-{
- ListWidget lw = (ListWidget)w;
-
- if (XtIsSensitive(w)) {
- lw->list.highlight = item;
- if (lw->list.is_highlighted != NO_HIGHLIGHT)
- PaintItemName(w, lw->list.is_highlighted);
- PaintItemName(w, item);
- }
-}
-
-/*
- * Function:
- * XawListShowCurrent
- *
- * Parameters:
- * w - list widget
- *
- * Returns:
- * Info about the currently highlighted object
- */
-XawListReturnStruct *
-XawListShowCurrent(Widget w)
-{
- ListWidget lw = (ListWidget)w;
- XawListReturnStruct *ret_val;
-
- ret_val = (XawListReturnStruct *)XtMalloc(sizeof(XawListReturnStruct));
-
- ret_val->list_index = lw->list.highlight;
- if (ret_val->list_index == XAW_LIST_NONE)
- ret_val->string = "";
- else
- ret_val->string = lw->list.list[ret_val->list_index];
-
- return (ret_val);
-}
diff --git a/xc/lib/Xaw/List.h b/xc/lib/Xaw/List.h
deleted file mode 100644
index 642fd5926..000000000
--- a/xc/lib/Xaw/List.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/* $TOG: List.h /main/21 1998/02/11 14:53:28 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.
-*/
-/* $XFree86: xc/lib/Xaw/List.h,v 1.5 1999/05/03 12:15:40 dawes Exp $ */
-
-/* This is the List widget, it is useful to display a list, without the
- * overhead of having a widget for each item in the list. It allows
- * the user to select an item in a list and notifies the application through
- * a callback function.
- *
- * Created: 8/13/88
- * By: Chris D. Peterson
- * MIT X Consortium
- */
-
-#ifndef _XawList_h
-#define _XawList_h
-
-#include <X11/Xaw/Simple.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- borderColor BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- callback Callback XtCallbackList NULL **6
- columnSpacing Spacing Dimension 6
- cursor Cursor Cursor left_ptr
- cursorName Cursor String NULL
- defaultColumns Columns int 2 **5
- destroyCallback Callback Pointer NULL
- font Font XFontStruct* XtDefaultFont
- forceColumns Columns Boolean False **5
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension 0 **1
- insensitiveBorder Insensitive Pixmap Gray
- internalHeight Height Dimension 2
- internalWidth Width Dimension 4
- list List String* NULL **2
- longest Longest int 0 **3 **4
- mappedWhenManaged MappedWhenManaged Boolean True
- numberStrings NumberStrings int 0 **4
- pasteBuffer Boolean Boolean False
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- rowSpacing Spacing Dimension 4
- sensitive Sensitive Boolean True
- verticalList Boolean Boolean False
- width Width Dimension 0 **1
- x Position Position 0
- y Position Position 0
-
- **1 - If the Width or Height of the list widget is zero (0) then the value
- is set to the minimum size necessay to fit the entire list.
-
- If both Width and Height are zero then they are adjusted to fit the
- entire list that is created width the number of default columns
- specified in the defaultColumns resource.
-
- **2 - This is an array of strings the specify elements of the list.
- This resource must be specified.
- (What good is a list widget without a list?? :-)
-
- **3 - Longest is the length of the widest string in pixels.
-
- **4 - If either of these values are zero (0) then the list widget calculates
- the correct value.
-
- (This allows you to make startup faster if you already have
- this information calculated)
-
- NOTE: If the numberStrings value is zero the list must
- be NULL terminated.
-
- **5 - By setting the List.Columns resource you can force the application to
- have a given number of columns.
-
- **6 - This returns the name and index of the item selected in an
- XawListReturnStruct that is pointed to by the client_data
- in the CallbackProc.
-
-*/
-
-/*
- * Value returned when there are no highlighted objects
- */
-#define XAW_LIST_NONE -1
-
-#define XtCList "List"
-#define XtCSpacing "Spacing"
-#define XtCColumns "Columns"
-#define XtCLongest "Longest"
-#define XtCNumberStrings "NumberStrings"
-
-#define XtNcursor "cursor"
-#define XtNcolumnSpacing "columnSpacing"
-#define XtNdefaultColumns "defaultColumns"
-#define XtNforceColumns "forceColumns"
-#define XtNlist "list"
-#define XtNlongest "longest"
-#define XtNnumberStrings "numberStrings"
-#define XtNpasteBuffer "pasteBuffer"
-#define XtNrowSpacing "rowSpacing"
-#define XtNverticalList "verticalList"
-
-#ifndef XtNfontSet
-#define XtNfontSet "fontSet"
-#endif
-
-#ifndef XtCFontSet
-#define XtCFontSet "FontSet"
-#endif
-
-extern WidgetClass listWidgetClass;
-
-typedef struct _ListClassRec *ListWidgetClass;
-typedef struct _ListRec *ListWidget;
-
-/* list return structure */
-typedef struct _XawListReturnStruct {
- String string;
- int list_index;
-} XawListReturnStruct;
-
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawListChange
- *
- * Parameters:
- * w - list widget
- * list - new list
- * nitems - number of items in the list
- * longest - length (in Pixels) of the longest element in the list
- * resize - if True the the list widget will try to resize itself
- *
- * Description:
- * Changes the list being used and shown.
- *
- * Note:
- * If nitems of longest are <= 0 then they will be caluculated
- * If nitems is <= 0 then the list needs to be NULL terminated
- */
-void XawListChange
-(
- Widget w,
- String *list,
- int nitems,
- int longest,
-#if NeedWidePrototypes
- int resize
-#else
- Boolean resize
-#endif
- );
-
-/*
- * Function:
- * XawListUnhighlight
- *
- * Parameters:
- * w - list widget
- *
- * Description:
- * Unlights the current highlighted element.
- */
-void XawListUnhighlight
-(
- Widget w
- );
-
-/*
- * Function:
- * XawListHighlight
- *
- * Parameters:
- * w - list widget
- * item - item to highlight
- *
- * Description:
- * Highlights the given item.
- */
-void XawListHighlight
-(
- Widget w,
- int item
- );
-
-
-/*
- * Function:
- * XawListShowCurrent
- *
- * Paraneters:
- * w - list widget
- *
- * Description:
- * Returns the currently highlighted object.
- *
- * Returns:
- * The info about the currently highlighted object
- */
-
-XawListReturnStruct *XawListShowCurrent
-(
- Widget w
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawList_h */
diff --git a/xc/lib/Xaw/ListP.h b/xc/lib/Xaw/ListP.h
deleted file mode 100644
index a5ca1c56c..000000000
--- a/xc/lib/Xaw/ListP.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $TOG: ListP.h /main/13 1998/02/06 12:46:36 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.
-*/
-/* $XFree86: xc/lib/Xaw/ListP.h,v 1.6 1999/06/20 08:41:02 dawes Exp $ */
-
-
-/*
- * This is a List widget. It allows the user to select an item in a list and
- * notifies the application through a callback function.
- *
- * Created: 8/13/88
- * By: Chris D. Peterson
- * MIT - Project Athena
- */
-
-#ifndef _XawListP_h
-#define _XawListP_h
-
-/*
- * List Widget Private Data
- */
-#include <X11/Xaw/SimpleP.h>
-#include <X11/Xaw/List.h>
-
-#define NO_HIGHLIGHT XAW_LIST_NONE
-#define OUT_OF_RANGE -1
-#define OKAY 0
-
-/* New fields for the List widget class */
-typedef struct {
- XtPointer extension;
-} ListClassPart;
-
-/* Full class record */
-typedef struct _ListClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- ListClassPart list_class;
-} ListClassRec;
-
-extern ListClassRec listClassRec;
-
-/* New fields for the List widget */
-typedef struct {
- /* resources */
- Pixel foreground;
- Dimension internal_width; /* if not 3d, user sets directly */
- Dimension internal_height;
- Dimension column_space; /* half of *_space is add on
- top/bot/left of */
- Dimension row_space; /* each item's text bounding box
- half added to longest for right */
- int default_cols;
- Boolean force_cols;
- Boolean paste;
- Boolean vertical_cols;
- int longest; /* in pixels */
- int nitems;
- XFontStruct *font;
- XFontSet fontset; /* Sheeran, Omron KK, 93/03/05 */
- String *list; /* for i18n, always in multibyte
- format */
- XtCallbackList callback;
-
- /* private */
- int is_highlighted; /* set to the item currently
- highlighted */
- int highlight; /* set to the item that should be
- highlighted */
- int col_width; /* width of each column */
- int row_height; /* height of each row */
- int nrows; /* number of rows in the list */
- int ncols; /* number of columns in the list */
- GC normgc;
- GC revgc;
- GC graygc;
- int freedoms; /* flags for resizing height
- and width */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} ListPart;
-
-
-/* Full instance record */
-typedef struct _ListRec {
- CorePart core;
- SimplePart simple;
- ListPart list;
-} ListRec;
-
-#endif /* _XawListP_h */
diff --git a/xc/lib/Xaw/MenuButtoP.h b/xc/lib/Xaw/MenuButtoP.h
deleted file mode 100644
index 7110fa0c9..000000000
--- a/xc/lib/Xaw/MenuButtoP.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $TOG: MenuButtoP.h /main/10 1998/02/11 14:53:41 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/lib/Xaw/MenuButtoP.h,v 1.6 1999/06/20 08:41:02 dawes Exp $ */
-
-/*
- * MenuButtonP.h - Private Header file for MenuButton widget.
- *
- * This is the private header file for the Athena MenuButton widget.
- * It is intended to provide an easy method of activating pulldown menus.
- *
- * Date: May 2, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _XawMenuButtonP_h
-#define _XawMenuButtonP_h
-
-#include <X11/Xaw/MenuButton.h>
-#include <X11/Xaw/CommandP.h>
-
-/* New fields for the MenuButton widget class */
-typedef struct _MenuButtonClass {
- XtPointer extension;
-} MenuButtonClassPart;
-
-/* class record declaration */
-typedef struct _MenuButtonClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- LabelClassPart label_class;
- CommandClassPart command_class;
- MenuButtonClassPart menuButton_class;
-} MenuButtonClassRec;
-
-extern MenuButtonClassRec menuButtonClassRec;
-
-/* New fields for the MenuButton widget */
-typedef struct {
- /* resources */
- String menu_name;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} MenuButtonPart;
-
-/* widget declaration */
-typedef struct _MenuButtonRec {
- CorePart core;
- SimplePart simple;
- LabelPart label;
- CommandPart command;
- MenuButtonPart menu_button;
-} MenuButtonRec;
-
-#endif /* _XawMenuButtonP_h */
diff --git a/xc/lib/Xaw/MenuButton.c b/xc/lib/Xaw/MenuButton.c
deleted file mode 100644
index 361667333..000000000
--- a/xc/lib/Xaw/MenuButton.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* $TOG: MenuButton.c /main/24 1998/06/24 11:53:20 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.
- *
- */
-
-/* $XFree86: xc/lib/Xaw/MenuButton.c,v 3.7 1999/06/06 08:47:59 dawes Exp $ */
-
-/*
- * MenuButton.c - Source code for MenuButton widget.
- *
- * This is the source code for the Athena MenuButton widget.
- * It is intended to provide an easy method of activating pulldown menus.
- *
- * Date: May 2, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/MenuButtoP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static void XawMenuButtonClassInitialize(void);
-
-/*
- * Actions
- */
-static void PopupMenu(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-#define superclass ((CommandWidgetClass)&commandClassRec)
-
-static char defaultTranslations[] =
-"<Enter>:" "highlight()\n"
-"<Leave>:" "reset()\n"
-"Any<BtnDown>:" "reset() PopupMenu()\n";
-
-#define offset(field) XtOffsetOf(MenuButtonRec, field)
-static XtResource resources[] = {
- {
- XtNmenuName,
- XtCMenuName,
- XtRString,
- sizeof(String),
- offset(menu_button.menu_name),
- XtRString,
- (XtPointer)"menu"
- },
-};
-#undef offset
-
-static XtActionsRec actionsList[] =
-{
- {"PopupMenu", PopupMenu},
-};
-
-MenuButtonClassRec menuButtonClassRec = {
- /* core */
- {
- (WidgetClass)superclass, /* superclass */
- "MenuButton", /* class_name */
- sizeof(MenuButtonRec), /* size */
- XawMenuButtonClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- NULL, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actionsList, /* actions */
- XtNumber(actionsList), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive /* change_sensitive */
- },
- /* label */
- {
- NULL, /* extension */
- },
- /* command */
- {
- NULL, /* extension */
- },
- /* menu_button */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass menuButtonWidgetClass = (WidgetClass)&menuButtonClassRec;
-
-/*
- * Implementation
- */
-static void
-XawMenuButtonClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtRegisterGrabAction(PopupMenu, True,
- ButtonPressMask | ButtonReleaseMask,
- GrabModeAsync, GrabModeAsync);
-}
-
-/*ARGSUSED*/
-static void
-PopupMenu(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- MenuButtonWidget mbw = (MenuButtonWidget)w;
- Widget menu = NULL, temp;
- Arg arglist[2];
- Cardinal num_args;
- int menu_x, menu_y, menu_width, menu_height, button_height;
- Position button_x, button_y;
-
- temp = w;
- while(temp != NULL) {
- menu = XtNameToWidget(temp, mbw->menu_button.menu_name);
- if (menu == NULL)
- temp = XtParent(temp);
- else
- break;
- }
-
- if (menu == NULL) {
- char error_buf[BUFSIZ];
-
- (void)XmuSnprintf(error_buf, sizeof(error_buf),
- "MenuButton: Could not find menu widget named %s.",
- mbw->menu_button.menu_name);
- XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
- return;
- }
-
- if (!XtIsRealized(menu))
- XtRealizeWidget(menu);
-
- menu_width = XtWidth(menu) + (XtBorderWidth(menu) << 1);
- button_height = XtHeight(w) + (XtBorderWidth(w) << 1);
- menu_height = XtHeight(menu) + (XtBorderWidth(menu) << 1);
-
- XtTranslateCoords(w, 0, 0, &button_x, &button_y);
- menu_x = button_x;
- menu_y = button_y + button_height;
-
- if (menu_y >= 0) {
- int scr_height = HeightOfScreen(XtScreen(menu));
-
- if (menu_y + menu_height > scr_height)
- menu_y = button_y - menu_height;
- if (menu_y < 0) {
- menu_y = scr_height - menu_height;
- menu_x = button_x + XtWidth(w) + (XtBorderWidth(w) << 1);
- if (menu_x + menu_width > WidthOfScreen(XtScreen(menu)))
- menu_x = button_x - menu_width;
- }
- }
- if (menu_y < 0)
- menu_y = 0;
-
- if (menu_x >= 0) {
- int scr_width = WidthOfScreen(XtScreen(menu));
-
- if (menu_x + menu_width > scr_width)
- menu_x = scr_width - menu_width;
- }
- if (menu_x < 0)
- menu_x = 0;
-
- num_args = 0;
- XtSetArg(arglist[num_args], XtNx, menu_x); num_args++;
- XtSetArg(arglist[num_args], XtNy, menu_y); num_args++;
- XtSetValues(menu, arglist, num_args);
-
- XtPopupSpringLoaded(menu);
-}
diff --git a/xc/lib/Xaw/MenuButton.h b/xc/lib/Xaw/MenuButton.h
deleted file mode 100644
index b7ff60cef..000000000
--- a/xc/lib/Xaw/MenuButton.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * $TOG: MenuButton.h /main/11 1998/02/11 14:53:37 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.
- */
-/* $XFree86: xc/lib/Xaw/MenuButton.h,v 1.4 1998/10/03 08:42:08 dawes Exp $ */
-
-/***********************************************************************
- *
- * MenuButton Widget
- *
- ***********************************************************************/
-
-/*
- * MenuButton.h - Public Header file for MenuButton widget.
- *
- * This is the public header file for the Athena MenuButton widget.
- * It is intended to provide an easy method of activating pulldown menus.
- *
- * Date: May 2, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _XawMenuButton_h
-#define _XawMenuButton_h
-
-#include <X11/Xaw/Command.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- bitmap Pixmap Pixmap None
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- callback Callback Pointer NULL
- cursor Cursor Cursor None
- destroyCallback Callback Pointer NULL
- displayList DisplayList XawDisplayList* NULL
- font Font XFontStruct* XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension text height
- highlightThickness Thickness Dimension 2
- insensitiveBorder Insensitive Pixmap Gray
- internalHeight Height Dimension 2
- internalWidth Width Dimension 4
- justify Justify XtJustify XtJustifyCenter
- label Label String NULL
- mappedWhenManaged MappedWhenManaged Boolean True
- menuName MenuName String "menu"
- resize Resize Boolean True
- sensitive Sensitive Boolean True
- width Width Dimension text width
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtNmenuName "menuName"
-#define XtCMenuName "MenuName"
-
-extern WidgetClass menuButtonWidgetClass;
-
-typedef struct _MenuButtonClassRec *MenuButtonWidgetClass;
-typedef struct _MenuButtonRec *MenuButtonWidget;
-
-#endif /* _XawMenuButton_h */
diff --git a/xc/lib/Xaw/MultiSink.c b/xc/lib/Xaw/MultiSink.c
deleted file mode 100644
index 90e7bb959..000000000
--- a/xc/lib/Xaw/MultiSink.c
+++ /dev/null
@@ -1,969 +0,0 @@
-/* $TOG: MultiSink.c /main/7 1998/02/06 12:47:13 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission. OMRON makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Li Yuhong OMRON Corporation
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/MultiSink.c,v 1.17 1999/06/13 13:47:19 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xatom.h>
-#include <X11/Xaw/XawInit.h>
-#include <X11/Xaw/MultiSinkP.h>
-#include <X11/Xaw/MultiSrcP.h>
-#include <X11/Xaw/TextP.h>
-#include "XawI18n.h"
-#include <stdio.h>
-#include <ctype.h>
-#include "Private.h"
-
-#ifdef GETLASTPOS
-#undef GETLASTPOS /* We will use our own GETLASTPOS */
-#endif
-
-#define GETLASTPOS \
- XawTextSourceScan(source, 0, XawstAll, XawsdRight, 1, True)
-
-/*
- * Class Methods
- */
-static void XawMultiSinkClassInitialize(void);
-static void XawMultiSinkInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawMultiSinkDestroy(Widget);
-static void XawMultiSinkResize(Widget);
-static Boolean XawMultiSinkSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static int MaxLines(Widget, unsigned int);
-static int MaxHeight(Widget, int);
-static void SetTabs(Widget, int, short*);
-static void DisplayText(Widget, int, int,
- XawTextPosition, XawTextPosition, Bool);
-static void InsertCursor(Widget, int, int, XawTextInsertState);
-static void FindPosition(Widget, XawTextPosition, int, int, Bool,
- XawTextPosition*, int*, int*);
-static void FindDistance(Widget, XawTextPosition, int, XawTextPosition, int*,
- XawTextPosition*, int*);
-static void Resolve(Widget, XawTextPosition, int, int, XawTextPosition*);
-static void GetCursorBounds(Widget, XRectangle*);
-
-/*
- * Prototypes
- */
-static void GetGC(MultiSinkObject);
-static int CharWidth(MultiSinkObject, XFontSet, int, wchar_t);
-static unsigned int PaintText(Widget w, GC gc, int x, int y,
- wchar_t *buf, int len, Bool);
-
-/*
- * Defined in TextSink.c
- */
-void _XawTextSinkClearToBackground(Widget, int, int, unsigned, unsigned);
-
-/*
- * Initialization
- */
-static wchar_t wspace[2];
-
-#define offset(field) XtOffsetOf(MultiSinkRec, multi_sink.field)
-static XtResource resources[] = {
- {
- XtNfontSet,
- XtCFontSet,
- XtRFontSet,
- sizeof(XFontSet),
- offset(fontset),
- XtRString,
- XtDefaultFontSet
- },
- {
- XtNecho,
- XtCOutput,
- XtRBoolean,
- sizeof(Boolean),
- offset(echo),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNdisplayNonprinting,
- XtCOutput,
- XtRBoolean,
- sizeof(Boolean),
- offset(display_nonprinting),
- XtRImmediate,
- (XtPointer)True
- },
-};
-#undef offset
-
-#define SuperClass (&textSinkClassRec)
-MultiSinkClassRec multiSinkClassRec = {
- /* object */
- {
- (WidgetClass)SuperClass, /* superclass */
- "MultiSink", /* class_name */
- sizeof(MultiSinkRec), /* widget_size */
- XawMultiSinkClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawMultiSinkInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* obj1 */
- NULL, /* obj2 */
- 0, /* obj3 */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* obj4 */
- False, /* obj5 */
- False, /* obj6 */
- False, /* obj7 */
- XawMultiSinkDestroy, /* destroy */
- (XtProc)XawMultiSinkResize, /* obj8 */
- NULL, /* obj9 */
- XawMultiSinkSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* obj10 */
- NULL, /* get_values_hook */
- NULL, /* obj11 */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* obj12 */
- NULL, /* obj13 */
- NULL, /* obj14 */
- NULL, /* extension */
- },
- /* text_sink */
- {
- DisplayText, /* DisplayText */
- InsertCursor, /* InsertCursor */
- XtInheritClearToBackground, /* ClearToBackground */
- FindPosition, /* FindPosition */
- FindDistance, /* FindDistance */
- Resolve, /* Resolve */
- MaxLines, /* MaxLines */
- MaxHeight, /* MaxHeight */
- SetTabs, /* SetTabs */
- GetCursorBounds, /* GetCursorBounds */
- },
- /* multi_sink */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec;
-
-/*
- * Implementation
- */
-static int
-CharWidth(MultiSinkObject sink, XFontSet fontset, int x, wchar_t c)
-{
- int width = 0;
-
- if (c == _Xaw_atowc(XawLF))
- return (0);
-
- if (c == _Xaw_atowc(XawTAB)) {
- int i;
- Position *tab;
-
- width = x;
- /* Adjust for Left Margin. */
- x -= ((TextWidget)XtParent((Widget)sink))->text.left_margin;
-
- i = 0;
- tab = sink->text_sink.tabs;
- /*CONSTCOND*/
- while (1) {
- if (x < *tab)
- return (*tab - x);
- /* Start again */
- if (++i >= sink->text_sink.tab_count) {
- x -= *tab;
- i = 0;
- tab = sink->text_sink.tabs;
- if (width == x)
- return (0);
- }
- else
- ++tab;
- }
- /*NOTREACHED*/
- }
-
- if (XwcTextEscapement(fontset, &c, 1) == 0) {
- if (sink->multi_sink.display_nonprinting)
- c = _Xaw_atowc('@');
- else
- c = _Xaw_atowc(XawSP);
- }
-
- /*
- * if more efficiency(suppose one column is one ASCII char)
-
- width = XwcGetColumn(fontset->font_charset, fontset->num_of_fonts, c) *
- fontset->font_struct_list[0]->min_bounds.width;
- *
- * WARNING: Very Slower!!!
- *
- * Li Yuhong.
- */
-
- width = XwcTextEscapement(fontset, &c, 1);
-
- return (width);
-}
-
-/*
- * Function:
- * PaintText
- *
- * Parameters:
- * w - text sink object
- * gc - gc to paint text
- * x - location to paint the text
- * y - ""
- * buf - buffer and length of text to paint
- * len - ""
- * clear_bg - clear background before drawing ?
- *
- * Description:
- * Actually paints the text into the window.
- *
- * Returns:
- * The width of the text painted
- */
-static unsigned int
-PaintText(Widget w, GC gc, int x, int y, wchar_t *buf, int len, Bool clear_bg)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- XFontSet fontset = sink->multi_sink.fontset;
- unsigned int width = XwcTextEscapement(fontset, buf, len);
-
- if (((int)width) <= -x) /* Don't draw if we can't see it */
- return (width);
-
- if (clear_bg) {
- XFontSetExtents *ext = XExtentsOfFontSet(fontset);
-
- _XawTextSinkClearToBackground(w, x, y - abs(ext->max_logical_extent.y),
- width, ext->max_logical_extent.height);
- XwcDrawString(XtDisplay(ctx), XtWindow(ctx), fontset, gc, x, y, buf, len);
- }
- else
- XwcDrawImageString(XtDisplay(ctx), XtWindow(ctx), fontset, gc,
- x, y, buf, len);
-
- return (width);
-}
-
-/* Sink Object Functions */
-/*
- * This function does not know about drawing more than one line of text
- */
-static void
-DisplayText(Widget w, int x, int y,
- XawTextPosition pos1, XawTextPosition pos2, Bool highlight)
-{
- TextWidget ctx = (TextWidget)XtParent(w);
- MultiSinkObject sink = (MultiSinkObject)w;
- XFontSet fontset = sink->multi_sink.fontset;
- Widget source = XawTextGetSource(XtParent(w));
- wchar_t buf[256];
- XFontSetExtents *ext = XExtentsOfFontSet(fontset);
- int j, k;
- XawTextBlock blk;
- GC gc, invgc, tabgc;
- int max_x;
- Bool clear_bg;
-
- if (!sink->multi_sink.echo || !ctx->text.lt.lines)
- return;
-
- max_x = (int)XtWidth(ctx) - ctx->text.r_margin.right;
- clear_bg = !highlight && ctx->core.background_pixmap != XtUnspecifiedPixmap;
-
- gc = highlight ? sink->multi_sink.invgc : sink->multi_sink.normgc;
- invgc = highlight ? sink->multi_sink.normgc : sink->multi_sink.invgc;
-
- if (highlight && sink->multi_sink.xorgc)
- tabgc = sink->multi_sink.xorgc;
- else
- tabgc = invgc;
-
- y += abs(ext->max_logical_extent.y);
- for (j = 0; pos1 < pos2;) {
- pos1 = XawTextSourceRead(source, pos1, &blk, (int) pos2 - pos1);
- for (k = 0; k < blk.length; k++) {
- if ((unsigned) j >= (sizeof(buf) / sizeof(wchar_t)) - 1) {
- /* buffer full, dump the text */
- if ((x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x)
- return;
- j = 0;
- }
- buf[j] = ((wchar_t *)blk.ptr)[k];
- if (buf[j] == _Xaw_atowc(XawLF))
- continue;
-
- else if (buf[j] == _Xaw_atowc(XawTAB)) {
- unsigned int width;
-
- if (j != 0 &&
- (x += PaintText(w, gc, x, y, buf, j, clear_bg)) >= max_x)
- return;
-
- width = CharWidth(sink, fontset, x, _Xaw_atowc(XawTAB));
- if (clear_bg)
- _XawTextSinkClearToBackground(w,
- x, y - abs(ext->max_logical_extent.y),
- width, ext->max_logical_extent.height);
- else
- XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
- tabgc, x,
- y - abs(ext->max_logical_extent.y),
- width,
- ext->max_logical_extent.height);
- x += width;
- j = -1;
- }
- else if (XwcTextEscapement(sink->multi_sink.fontset, &buf[j], 1)
- == 0) {
- if (sink->multi_sink.display_nonprinting)
- buf[j] = _Xaw_atowc('@');
- else
- buf[j] = _Xaw_atowc(XawSP);
- }
- j++;
- }
- }
-
- if (j > 0)
- (void)PaintText(w, gc, x, y, buf, j, clear_bg);
-}
-
-/*
- * Function:
- * GetCursorBounds
- *
- * Parameters:
- * w - text sink object
- * rect - X rectangle to return the cursor bounds
- *
- * Description:
- * Returns the size and location of the cursor.
- */
-static void
-GetCursorBounds(Widget w, XRectangle *rect)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
-
- rect->width = CharWidth(sink, sink->multi_sink.fontset, 0, _Xaw_atowc(XawSP));
- rect->height = (XExtentsOfFontSet(sink->multi_sink.fontset)
- ->max_logical_extent.height);
- rect->x = sink->multi_sink.cursor_x;
- rect->y = sink->multi_sink.cursor_y - (short)rect->height;
-}
-
-/*
- * The following procedure manages the "insert" cursor
- */
-static void
-InsertCursor(Widget w, int x, int y, XawTextInsertState state)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- XFontSet fontset = sink->multi_sink.fontset;
- Widget ctx = XtParent(w);
- XawTextPosition position = XawTextGetInsertionPoint(ctx);
-
- if (XtIsRealized(ctx)) {
- int fheight, fdiff;
- XawTextBlock block;
- wchar_t c;
- XawTextPosition selection_start, selection_end;
- Boolean has_selection;
- XFontSetExtents *ext = XExtentsOfFontSet(fontset);
-
- XawTextGetSelectionPos((Widget)ctx, &selection_start, &selection_end);
- has_selection = selection_start != selection_end;
-
- fheight = ext->max_logical_extent.height;
- fdiff = fheight - abs(ext->max_logical_extent.y);
-
- if ((sink->multi_sink.cursor_position != position || state == XawisOff)
- && !has_selection && sink->multi_sink.laststate != XawisOff) {
- wchar_t *ochar;
-
- (void)XawTextSourceRead(XawTextGetSource(ctx),
- sink->multi_sink.cursor_position,
- &block, 1);
- if (!block.length)
- ochar = NULL;
- else {
- c = ((wchar_t *)block.ptr)[0];
- if (c == _Xaw_atowc(XawLF))
- ochar = NULL;
- else if (c == _Xaw_atowc(XawTAB))
- ochar = wspace;
- else
- ochar = (wchar_t *)block.ptr;
- }
-
- if (!ochar)
- _XawTextSinkClearToBackground(w, sink->multi_sink.cursor_x,
- (sink->multi_sink.cursor_y - 1 -
- fheight), CharWidth(sink, fontset,
- 0, wspace[0]),
- fheight);
- else {
- if (XwcTextEscapement(sink->multi_sink.fontset, ochar, 1) != 0)
- DisplayText(w, sink->multi_sink.cursor_x,
- sink->multi_sink.cursor_y - 1 - fheight,
- sink->multi_sink.cursor_position,
- sink->multi_sink.cursor_position + 1,
- False);
- else
- PaintText(w, sink->multi_sink.normgc,
- sink->multi_sink.cursor_x,
- sink->multi_sink.cursor_y - 1 - fdiff,
- ochar, 1,
- ctx->core.background_pixmap != XtUnspecifiedPixmap);
- }
- }
-
- if (!has_selection && state != XawisOff) {
- wchar_t *nchar;
- Boolean focus = ((TextWidget)ctx)->text.hasfocus;
-
- (void)XawTextSourceRead(XawTextGetSource(ctx),
- position, &block, 1);
- c = ((wchar_t *)block.ptr)[0];
- if (!block.length || c == _Xaw_atowc(XawLF)
- || c == _Xaw_atowc(XawTAB))
- nchar = wspace;
- else
- nchar = (wchar_t *)block.ptr;
-
- if (focus) {
- if (XwcTextEscapement(sink->multi_sink.fontset, nchar, 1) != 0)
- XwcDrawImageString(XtDisplay(ctx), XtWindow(ctx),
- fontset, sink->multi_sink.invgc,
- x, (y - 1 - fdiff), nchar, 1);
- else
- DisplayText(w, x, y - 1 - fheight,
- position, position + 1, True);
- }
- else
- XDrawRectangle(XtDisplay(ctx), XtWindow(ctx),
- sink->multi_sink.xorgc ?
- sink->multi_sink.xorgc : sink->multi_sink.normgc,
- x, y - 1 - fheight,
- CharWidth(sink, fontset, 0, *nchar) - 1,
- fheight - 1);
- }
- }
-
- sink->multi_sink.cursor_x = x;
- sink->multi_sink.cursor_y = y;
- sink->multi_sink.laststate = state;
- sink->multi_sink.cursor_position = position;
-}
-
-/*
- * Given two positions, find the distance between them
- */
-static void
-FindDistance(Widget w, XawTextPosition fromPos, int fromx,
- XawTextPosition toPos, int *resWidth,
- XawTextPosition *resPos, int *resHeight)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- XFontSet fontset = sink->multi_sink.fontset;
- TextWidget ctx = (TextWidget)XtParent(w);
- Widget source = ctx->text.source;
- XawTextPosition idx, pos;
- wchar_t c;
- XFontSetExtents *ext = XExtentsOfFontSet(fontset);
- XawTextBlock blk;
- int i, rWidth;
-
- pos = XawTextSourceRead(source, fromPos, &blk, toPos - fromPos);
- rWidth = 0;
- for (i = 0, idx = fromPos; idx < toPos; i++, idx++) {
- if (i >= blk.length) {
- i = 0;
- XawTextSourceRead(source, pos, &blk, toPos - pos);
- if (blk.length == 0)
- break;
- }
- c = ((wchar_t *)blk.ptr)[i];
- rWidth += CharWidth(sink, fontset, fromx + rWidth, c);
- if (c == _Xaw_atowc(XawLF)) {
- idx++;
- break;
- }
- }
-
- *resPos = idx;
- *resWidth = rWidth;
- *resHeight = ext->max_logical_extent.height;
-}
-
-static void
-FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width,
- Bool stopAtWordBreak, XawTextPosition *resPos, int *resWidth,
- int *resHeight)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- TextWidget ctx = (TextWidget)XtParent(w);
- Widget source = ctx->text.source;
- XFontSet fontset = sink->multi_sink.fontset;
- XawTextPosition idx, pos, whiteSpacePosition = 0;
- int i, lastWidth, whiteSpaceWidth, rWidth;
- Boolean whiteSpaceSeen;
- wchar_t c;
- XFontSetExtents *ext = XExtentsOfFontSet(fontset);
- XawTextBlock blk;
-
- pos = XawTextSourceRead(source, fromPos, &blk, BUFSIZ);
- rWidth = lastWidth = whiteSpaceWidth = 0;
- whiteSpaceSeen = False;
- c = 0;
-
- for (i = 0, idx = fromPos; rWidth <= width; i++, idx++) {
- if (i >= blk.length) {
- i = 0;
- pos = XawTextSourceRead(source, pos, &blk, BUFSIZ);
- if (blk.length == 0)
- break;
- }
- c = ((wchar_t *)blk.ptr)[i];
- lastWidth = rWidth;
- rWidth += CharWidth(sink, fontset, fromx + rWidth, c);
-
- if (c == _Xaw_atowc(XawLF)) {
- idx++;
- break;
- }
- else if ((c == _Xaw_atowc(XawSP) || c == _Xaw_atowc(XawTAB))
- && rWidth <= width) {
- whiteSpaceSeen = True;
- whiteSpacePosition = idx;
- whiteSpaceWidth = rWidth;
- }
- }
-
- if (rWidth > width && idx > fromPos) {
- idx--;
- rWidth = lastWidth;
- if (stopAtWordBreak && whiteSpaceSeen) {
- idx = whiteSpacePosition + 1;
- rWidth = whiteSpaceWidth;
- }
- }
-
- if (idx >= ctx->text.lastPos && c != _Xaw_atowc(XawLF))
- idx = ctx->text.lastPos + 1;
-
- *resPos = idx;
- *resWidth = rWidth;
- *resHeight = ext->max_logical_extent.height;
-}
-
-static void
-Resolve(Widget w, XawTextPosition pos, int fromx, int width,
- XawTextPosition *pos_return)
-{
- int resWidth, resHeight;
- Widget source = XawTextGetSource(XtParent(w));
-
- FindPosition(w, pos, fromx, width, False, pos_return, &resWidth, &resHeight);
- if (*pos_return > GETLASTPOS)
- *pos_return = GETLASTPOS;
-}
-
-static void
-GetGC(MultiSinkObject sink)
-{
- XtGCMask valuemask = (GCGraphicsExposures | GCClipXOrigin |
- GCForeground | GCBackground);
- XGCValues values;
-
- /* XXX We dont want do share a gc that will change the clip-mask */
- values.clip_x_origin = (int)sink;
- values.clip_mask = None;
- values.graphics_exposures = False;
-
- values.foreground = sink->text_sink.foreground;
- values.background = sink->text_sink.background;
-
- sink->multi_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values,
- GCFont | GCClipMask, 0);
-
- values.foreground = sink->text_sink.background;
-#ifndef OLDXAW
- values.background = sink->text_sink.cursor_color;
-#else
- values.background = sink->text_sink.foreground;
-#endif
- sink->multi_sink.invgc = XtAllocateGC((Widget)sink, 0, valuemask, &values,
- GCFont | GCClipMask, 0);
-#ifndef OLDXAW
- if (sink->text_sink.cursor_color != sink->text_sink.foreground) {
- values.foreground = sink->text_sink.cursor_color;
- values.background = sink->text_sink.foreground;
- sink->multi_sink.xorgc = XtAllocateGC((Widget)sink, 0, valuemask,
- &values, GCFont | GCClipMask, 0);
- }
- else
-#endif /* OLDXAW */
- sink->multi_sink.xorgc = NULL;
-
- XawMultiSinkResize((Widget)sink);
-}
-
-static void
-XawMultiSinkClassInitialize(void)
-{
- wspace[0] = _Xaw_atowc(XawSP);
- XawInitializeWidgetSet();
-}
-
-/*
- * Function:
- * XawMultiSinkInitialize
- *
- * Parameters:
- * request - requested and new values for the object instance
- * cnew - ""
- *
- * Description:
- * Initializes the TextSink Object.
- */
-/* ARGSUSED */
-static void
-XawMultiSinkInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- MultiSinkObject sink = (MultiSinkObject)cnew;
-
- GetGC(sink);
-
- sink->multi_sink.cursor_position = 0;
- sink->multi_sink.laststate = XawisOff;
- sink->multi_sink.cursor_x = sink->multi_sink.cursor_y = 0;
-}
-
-/*
- * Function:
- * XawMultiSinkDestroy
- *
- * Parameters:
- * w - MultiSink Object
- *
- * Description:
- * This function cleans up when the object is destroyed.
- */
-static void
-XawMultiSinkDestroy(Widget w)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
-
- XtReleaseGC(w, sink->multi_sink.normgc);
- XtReleaseGC(w, sink->multi_sink.invgc);
- if (sink->multi_sink.xorgc)
- XtReleaseGC(w, sink->multi_sink.xorgc);
- sink->multi_sink.normgc =
- sink->multi_sink.invgc =
- sink->multi_sink.xorgc = NULL;
-}
-
-static void
-XawMultiSinkResize(Widget w)
-{
- TextWidget ctx = (TextWidget)XtParent(w);
- MultiSinkObject sink = (MultiSinkObject)w;
- XRectangle rect;
- int width, height;
-
- if (w->core.widget_class != multiSinkObjectClass)
- return;
-
- rect.x = ctx->text.r_margin.left;
- rect.y = ctx->text.r_margin.top;
- width = (int)XtWidth(ctx) -
- (int)ctx->text.r_margin.right - (int)ctx->text.r_margin.left;
- height = (int)XtHeight(ctx) -
- (int)ctx->text.r_margin.top - (int)ctx->text.r_margin.bottom;
- rect.width = width;
- rect.height = height;
-
- if (sink->multi_sink.normgc) {
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), sink->multi_sink.normgc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), sink->multi_sink.normgc, None);
- }
- if (sink->multi_sink.invgc) {
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), sink->multi_sink.invgc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), sink->multi_sink.invgc, None);
- }
- if (sink->multi_sink.xorgc) {
- if (width >= 0 && height >= 0)
- XSetClipRectangles(XtDisplay((Widget)ctx), sink->multi_sink.xorgc,
- 0, 0, &rect, 1, Unsorted);
- else
- XSetClipMask(XtDisplay((Widget)ctx), sink->multi_sink.xorgc, None);
- }
-}
-
-/*
- * Function:
- * XawMultiSinkSetValues
- *
- * Parameters:
- * current - current state of the object
- * request - what was requested
- * cnew - what the object will become
- *
- * Description:
- * Sets the values for the MultiSink.
- *
- * Returns:
- * True if redisplay is needed
- */
-/*ARGSUSED*/
-static Boolean
-XawMultiSinkSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- MultiSinkObject w = (MultiSinkObject)cnew;
- MultiSinkObject old_w = (MultiSinkObject)current;
-
- /* Font set is not in the GC! Do not make a new GC when font set changes! */
-
- if (w->multi_sink.fontset != old_w->multi_sink.fontset) {
- ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
-#ifndef NO_TAB_FIX
- SetTabs((Widget)w, w->text_sink.tab_count, w->text_sink.char_tabs);
-#endif
- }
-
- if (w->text_sink.background != old_w->text_sink.background
- || w->text_sink.foreground != old_w->text_sink.foreground
-#ifndef OLDXAW
- || w->text_sink.cursor_color != old_w->text_sink.cursor_color
-#endif
- ) {
- XtReleaseGC(cnew, w->multi_sink.normgc);
- XtReleaseGC(cnew, w->multi_sink.invgc);
- if (w->multi_sink.xorgc)
- XtReleaseGC(cnew, w->multi_sink.xorgc);
- GetGC(w);
- ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
- }
- else if (w->multi_sink.echo != old_w->multi_sink.echo
- || w->multi_sink.display_nonprinting
- != old_w->multi_sink.display_nonprinting)
- ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
-
- return (False);
-}
-
-/*
- * Function:
- * MaxLines
- *
- * Parameters:
- * w - MultiSink Object
- * height - height to fit lines into
- *
- * Description:
- * Finds the Maximum number of lines that will fit in a given height.
- *
- * Returns:
- * The number of lines that will fit
- */
-/*ARGSUSED*/
-static int
-MaxLines(Widget w, unsigned int height)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- int font_height;
- XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
-
- font_height = ext->max_logical_extent.height;
- return (height / font_height);
-}
-
-/*
- * Function:
- * MaxHeight
- *
- * Parameters:
- * w - MultiSink Object
- * lines - number of lines
- *
- * Description:
- * Finds the Minium height that will contain a given number lines.
- * Returns:
- * The height
- */
-/*ARGSUSED*/
-static int
-MaxHeight(Widget w, int lines)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
-
- return (lines * ext->max_logical_extent.height);
-}
-
-/*
- * Function:
- * SetTabs
- *
- * Arguments:
- * w - MultiSink Object
- * tab_count - number of tabs in the list
- * tabs - text positions of the tabs
- *
- * Description:
- * Sets the Tab stops.
- */
-static void
-SetTabs(Widget w, int tab_count, short* tabs)
-{
- MultiSinkObject sink = (MultiSinkObject)w;
- int i;
- Atom XA_FIGURE_WIDTH;
- unsigned long figure_width = 0;
- XFontStruct *font;
-
- /*
- * Bug:
- * Suppose the first font of fontset stores the unit of column.
- *
- * By Li Yuhong, Mar. 14, 1991
- */
- {
- XFontStruct **f_list;
- char **f_name;
-
- (void)XFontsOfFontSet(sink->multi_sink.fontset, &f_list, &f_name);
- font = f_list[0];
- }
-
- /*
- * Find the figure width of the current font
- */
- XA_FIGURE_WIDTH = XInternAtom(XtDisplayOfObject(w), "FIGURE_WIDTH", False);
- if (XA_FIGURE_WIDTH != None
- && (!XGetFontProperty(font, XA_FIGURE_WIDTH, &figure_width)
- || figure_width == 0)) {
- if (font->per_char && font->min_char_or_byte2 <= '$'
- && font->max_char_or_byte2 >= '$')
- figure_width = font->per_char['$' - font->min_char_or_byte2].width;
- else
- figure_width = font->max_bounds.width;
- }
-
- if (tab_count > sink->text_sink.tab_count) {
- sink->text_sink.tabs = (Position *)
- XtRealloc((char *)sink->text_sink.tabs,
- (Cardinal)(tab_count * sizeof(Position)));
- sink->text_sink.char_tabs = (short *)
- XtRealloc((char *)sink->text_sink.char_tabs,
- (Cardinal)(tab_count * sizeof(short)));
- }
-
- for (i = 0 ; i < tab_count ; i++) {
- sink->text_sink.tabs[i] = tabs[i] * figure_width;
- sink->text_sink.char_tabs[i] = tabs[i];
- }
-
- sink->text_sink.tab_count = tab_count;
-
-#ifndef NO_TAB_FIX
- ((TextWidget)XtParent(w))->text.redisplay_needed = True;
-#endif
-}
-
-void
-_XawMultiSinkPosToXY(Widget w, XawTextPosition pos, Position *x, Position *y)
-{
- MultiSinkObject sink = (MultiSinkObject)((TextWidget)w)->text.sink;
- XFontSetExtents *ext = XExtentsOfFontSet(sink->multi_sink.fontset);
-
- _XawTextPosToXY(w, pos, x, y);
- *y += abs(ext->max_logical_extent.y);
-}
diff --git a/xc/lib/Xaw/MultiSink.h b/xc/lib/Xaw/MultiSink.h
deleted file mode 100644
index 679329fde..000000000
--- a/xc/lib/Xaw/MultiSink.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $TOG: MultiSink.h /main/3 1998/02/06 12:47:18 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON is not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OMRON makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Li Yuhong OMRON Corporation
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/MultiSink.h,v 1.4 1998/10/03 08:42:09 dawes Exp $ */
-
-#ifndef _XawMultiSink_h
-#define _XawMultiSink_h
-
-/*
- * MultiSink Object
- */
-
-#include <X11/Xaw/TextSink.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- echo Output Boolean True
- displayNonprinting Output Boolean True
- fontSet FontSet XFontSet XtDefaultFontSet
-
-*/
-
-#define XtCOutput "Output"
-
-#define XtNdisplayNonprinting "displayNonprinting"
-#define XtNecho "echo"
-
-#ifndef XtNfontSet /*Sheeran, Omron KK, 93/03/04*/
-#define XtNfontSet "fontSet"
-#endif
-
-#ifndef XtCFontSet /*Sheeran, Omron KK, 93/03/04*/
-#define XtCFontSet "FontSet"
-#endif
-
-/* Class record constants */
-extern WidgetClass multiSinkObjectClass;
-
-typedef struct _MultiSinkClassRec *MultiSinkObjectClass;
-typedef struct _MultiSinkRec *MultiSinkObject;
-
-#endif /* _XawMultiSink_h */
diff --git a/xc/lib/Xaw/MultiSinkP.h b/xc/lib/Xaw/MultiSinkP.h
deleted file mode 100644
index 436aeccf4..000000000
--- a/xc/lib/Xaw/MultiSinkP.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $TOG: MultiSinkP.h /main/3 1998/02/06 12:47:08 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OMRON make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Li Yuhong OMRON Corporation
- */
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/MultiSinkP.h,v 1.7 1999/06/20 08:41:02 dawes Exp $ */
-
-#ifndef _XawMultiSinkP_h
-#define _XawMultiSinkP_h
-
-#include <X11/Xfuncproto.h>
-
-/*
- * MultiSink Object Private Data
- */
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/MultiSink.h>
-
-/* new fields for the MultiSink object class */
-typedef struct _MultiSinkClassPart {
- XtPointer extension;
-} MultiSinkClassPart;
-
-/* Full class record declaration */
-typedef struct _MultiSinkClassRec {
- ObjectClassPart object_class;
- TextSinkClassPart text_sink_class;
- MultiSinkClassPart multi_sink_class;
-} MultiSinkClassRec;
-
-extern MultiSinkClassRec multiSinkClassRec;
-
-/* New fields for the MultiSink object record */
-typedef struct {
- /* resources */
- Boolean echo;
- Boolean display_nonprinting;
-
- /* private */
- GC normgc, invgc, xorgc;
- XawTextPosition cursor_position;
- XawTextInsertState laststate;
- short cursor_x, cursor_y; /* Cursor Location */
- XFontSet fontset; /* font set to draw */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} MultiSinkPart;
-
-/* Full instance record declaration */
-typedef struct _MultiSinkRec {
- ObjectPart object;
- TextSinkPart text_sink;
- MultiSinkPart multi_sink;
-} MultiSinkRec;
-
-/*
- * Semi-private functions
- * for use by other Xaw modules only
- */
-_XFUNCPROTOBEGIN
-
-void _XawMultiSinkPosToXY
-(
- Widget w,
- XawTextPosition pos,
- Position *x,
- Position *y
-);
-
-_XFUNCPROTOEND
-
-#endif /* _XawMultiSinkP_h */
diff --git a/xc/lib/Xaw/MultiSrc.c b/xc/lib/Xaw/MultiSrc.c
deleted file mode 100644
index b917e671c..000000000
--- a/xc/lib/Xaw/MultiSrc.c
+++ /dev/null
@@ -1,1604 +0,0 @@
-/* $TOG: MultiSrc.c /main/12 1998/05/14 14:55:50 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OMRON makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Chris Peterson MIT X Consortium
- * Li Yuhong OMRON Corporation
- * Frank Sheeran OMRON Corporation
- *
- * Much code taken from X11R3 String and Disk Sources.
- */
-/* $XFree86: xc/lib/Xaw/MultiSrc.c,v 1.19 1999/07/19 13:36:02 dawes Exp $ */
-
-/*
-
-Copyright 1991, 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 <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/XawInit.h>
-#include <X11/Xaw/MultiSrcP.h>
-#include <X11/Xaw/XawImP.h>
-#include "XawI18n.h"
-#include "Private.h"
-
-#define MAGIC_VALUE ((XawTextPosition)-1)
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
-#ifdef X_NOT_POSIX
-#define Off_t long
-#define Size_t unsigned int
-#else
-#define Off_t off_t
-#define Size_t size_t
-#endif
-
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
-/*
- * Class Methods
- */
-static XawTextPosition ReadText(Widget, XawTextPosition, XawTextBlock*, int);
-static int ReplaceText(Widget, XawTextPosition, XawTextPosition,
- XawTextBlock*);
-static XawTextPosition Scan(Widget, XawTextPosition, XawTextScanType,
- XawTextScanDirection, int, Bool);
-static XawTextPosition Search(Widget, XawTextPosition, XawTextScanDirection,
- XawTextBlock*);
-static void XawMultiSrcClassInitialize(void);
-static void XawMultiSrcDestroy(Widget);
-static void XawMultiSrcInitialize(Widget, Widget, ArgList, Cardinal*);
-static Boolean XawMultiSrcSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static void XawMultiSrcGetValuesHook(Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static MultiPiece *AllocNewPiece(MultiSrcObject, MultiPiece*);
-static void BreakPiece(MultiSrcObject, MultiPiece*);
-static Boolean CvtMultiTypeToString(Display*, XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr, XtPointer*);
-static void CvtStringToMultiType(XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr);
-static MultiPiece *FindPiece(MultiSrcObject, XawTextPosition,
- XawTextPosition*);
-static void FreeAllPieces(MultiSrcObject);
-static FILE *InitStringOrFile(MultiSrcObject, Bool);
-static void LoadPieces(MultiSrcObject, FILE*, char*);
-static void RemovePiece(MultiSrcObject, MultiPiece*);
-static void RemoveOldStringOrFile(MultiSrcObject, Bool);
-static String StorePiecesInString(MultiSrcObject);
-static Bool WriteToFile(String, String);
-static void GetDefaultPieceSize(Widget, int, XrmValue*);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(MultiSrcRec, multi_src.field)
-static XtResource resources[] = {
- {
- XtNstring,
- XtCString,
- XtRString,
- sizeof(XtPointer),
- offset(string),
- XtRPointer,
- NULL
- },
- {
- XtNtype,
- XtCType,
- XtRMultiType,
- sizeof(XawAsciiType),
- offset(type),
- XtRImmediate,
- (XtPointer)XawAsciiString
- },
- {
- XtNdataCompression,
- XtCDataCompression,
- XtRBoolean,
- sizeof(Boolean),
- offset(data_compression),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNpieceSize,
- XtCPieceSize,
- XtRInt,
- sizeof(XawTextPosition),
- offset(piece_size),
- XtRCallProc,
- (XtPointer)GetDefaultPieceSize
- },
-#ifdef OLDXAW
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(callback),
- XtRCallback,
- (XtPointer)NULL
- },
-#endif
- {
- XtNuseStringInPlace,
- XtCUseStringInPlace,
- XtRBoolean,
- sizeof(Boolean),
- offset(use_string_in_place),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNlength,
- XtCLength,
- XtRInt,
- sizeof(int),
- offset(multi_length),
- XtRImmediate,
- (XtPointer)MAGIC_VALUE
- },
-};
-#undef offset
-
-#define superclass (&textSrcClassRec)
-MultiSrcClassRec multiSrcClassRec = {
- /* object */
- {
- (WidgetClass)superclass, /* superclass */
- "MultiSrc", /* class_name */
- sizeof(MultiSrcRec), /* widget_size */
- XawMultiSrcClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawMultiSrcInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* obj1 */
- NULL, /* obj2 */
- 0, /* obj3 */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* obj4 */
- False, /* obj5 */
- False, /* obj6 */
- False, /* obj7 */
- XawMultiSrcDestroy, /* destroy */
- NULL, /* obj8 */
- NULL, /* obj9 */
- XawMultiSrcSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* obj10 */
- XawMultiSrcGetValuesHook, /* get_values_hook */
- NULL, /* obj11 */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* obj12 */
- NULL, /* obj13 */
- NULL, /* obj14 */
- NULL, /* extension */
- },
- /* text_src */
- {
- ReadText, /* Read */
- ReplaceText, /* Replace */
- Scan, /* Scan */
- Search, /* Search */
- XtInheritSetSelection, /* SetSelection */
- XtInheritConvertSelection, /* ConvertSelection */
- },
- /* multi_src */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec;
-
-static XrmQuark Qstring, Qfile;
-
-/*
- * Implementation
- */
-static void
-XawMultiSrcClassInitialize(void)
-{
- XawInitializeWidgetSet();
- Qstring = XrmPermStringToQuark(XtEstring);
- Qfile = XrmPermStringToQuark(XtEfile);
- XtAddConverter(XtRString, XtRMultiType, CvtStringToMultiType, NULL, 0);
- XtSetTypeConverter(XtRMultiType, XtRString, CvtMultiTypeToString, NULL, 0,
- XtCacheNone, NULL);
-}
-
-/*
- * Function:
- * XawMultiSrcInitialize
- *
- * Parameters:
- * request - widget requested by the argument list
- * cnew - the new widget with both resource and non resource values
- * args - (unused)
- * num_args - (unused)
- *
- * Description:
- * Initializes the multi src object
- */
-/*ARGSUSED*/
-static void
-XawMultiSrcInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- MultiSrcObject src = (MultiSrcObject)cnew;
- FILE *file;
-
- /*
- * Set correct flags (override resources) depending upon widget class
- */
-#ifdef OLDXAW
- src->multi_src.changes = False;
-#else
- src->text_src.changed = False;
-#endif
- src->multi_src.allocated_string = False;
-
- file = InitStringOrFile(src, src->multi_src.type == XawAsciiFile);
- LoadPieces(src, file, NULL);
-
- if (file != NULL)
- fclose(file);
- src->text_src.text_format = XawFmtWide;
-}
-
-/*
- * Function:
- * ReadText
- *
- * Parameters:
- * w - MultiSource object
- * pos - position of the text to retrieve
- * text - text block that will contain returned text
- * length - maximum number of characters to read
- *
- * Description:
- * This function reads the source.
- *
- * Returns:
- * The number of characters read into the buffer
- */
-static XawTextPosition
-ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- XawTextPosition count, start;
- MultiPiece *piece = FindPiece(src, pos, &start);
-
- text->format = XawFmtWide;
- text->firstPos = pos;
- text->ptr = (char *)(piece->text + (pos - start));
- count = piece->used - (pos - start);
- text->length = (length > count) ? count : length;
-
- return (pos + text->length);
-}
-
-/*
- * Function:
- * ReplaceText
- *
- * Parameters:
- * w - MultiSource object
- * startPos - ends of text that will be removed
- * endPos - ""
- * text - new text to be inserted into buffer at startPos
- *
- * Description:
- * Replaces a block of text with new text.
- *
- * Returns:
- * XawEditDone on success, XawEditError otherwise
- */
-/*ARGSUSED*/
-static int
-ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos,
- XawTextBlock *u_text_p)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- MultiPiece *start_piece, *end_piece, *temp_piece;
- XawTextPosition start_first, end_first;
- int length, firstPos;
- wchar_t *wptr;
- Bool local_artificial_block = False;
- XawTextBlock text;
-
- /* STEP 1: The user handed me a text block called `u_text' that may be
- * in either FMTWIDE or FMT8BIT (ie MB.) Later code needs the block
- * `text' to hold FMTWIDE. So, this copies `u_text' to `text', and if
- * `u_text' was MB, I knock it up to WIDE
- */
- if (u_text_p->length == 0) /* if so, the block contents never ref'd */
- text.length = 0;
-
- else if (u_text_p->format == XawFmtWide) {
- local_artificial_block = False; /* don't have to free it ourselves */
- text.firstPos = u_text_p->firstPos;
- text.length = u_text_p->length;
- text.ptr = u_text_p->ptr;
- }
- else {
- /*
- * WARNING! u_text->firstPos and length are in units of CHAR,
- * not CHARACTERS!
- */
- local_artificial_block = True; /* have to free it ourselves */
- text.firstPos = 0;
- text.length = u_text_p->length; /* _XawTextMBToWC converts this
- * to wchar len
- */
-
- text.ptr = (char*)_XawTextMBToWC(XtDisplay(XtParent(w)),
- &u_text_p->ptr[u_text_p->firstPos],
- &text.length);
-
- /* I assert the following assignment is not needed - since Step 4
- depends on length, it has no need of a terminating NULL. I think
- the ASCII-version has the same needless NULL. */
- /*((wchar_t*)text.ptr)[ text.length ] = NULL;*/
- }
-
- /* STEP 2: some initialization... */
- if (src->text_src.edit_mode == XawtextRead)
- return (XawEditError);
-
- start_piece = FindPiece(src, startPos, &start_first);
- end_piece = FindPiece(src, endPos, &end_first);
-
- /* STEP 3: remove the empty pieces... */
- if (start_piece != end_piece) {
- temp_piece = start_piece->next;
-
- /* If empty and not the only piece then remove it */
- if (((start_piece->used = startPos - start_first) == 0)
- && !(start_piece->next == NULL && start_piece->prev == NULL))
- RemovePiece(src, start_piece);
-
- while (temp_piece != end_piece) {
- temp_piece = temp_piece->next;
- RemovePiece(src, temp_piece->prev);
- }
- end_piece->used -= endPos - end_first;
- if (end_piece->used != 0)
- memmove(end_piece->text, end_piece->text + endPos - end_first,
- end_piece->used * sizeof(wchar_t));
- }
- else { /* We are fully in one piece */
- if ((start_piece->used -= endPos - startPos) == 0) {
- if (!(start_piece->next == NULL && start_piece->prev == NULL))
- RemovePiece(src, start_piece);
- }
- else {
- memmove(start_piece->text + (startPos - start_first),
- start_piece->text + (endPos - start_first),
- (start_piece->used - (startPos - start_first)) *
- sizeof(wchar_t));
- if (src->multi_src.use_string_in_place &&
- ((src->multi_src.length - (endPos - startPos))
- < src->multi_src.piece_size - 1))
- start_piece->text[src->multi_src.length - (endPos - startPos)] =
- (wchar_t)0;
- }
- }
-
- src->multi_src.length += text.length -(endPos - startPos);
-
- /* STEP 4: insert the new stuff */
- if ( text.length != 0) {
- start_piece = FindPiece(src, startPos, &start_first);
- length = text.length;
- firstPos = text.firstPos;
-
- while (length > 0) {
- wchar_t *ptr;
- int fill;
-
- if (src->multi_src.use_string_in_place) {
- if (start_piece->used == src->multi_src.piece_size - 1) {
-
- /*
- * The string is used in place, then the string
- * is not allowed to grow
- */
- start_piece->used = src->multi_src.length =
- src->multi_src.piece_size - 1;
-
- start_piece->text[src->multi_src.length] = (wchar_t)0;
- return (XawEditError);
- }
- }
-
- if (start_piece->used == src->multi_src.piece_size) {
- BreakPiece(src, start_piece);
- start_piece = FindPiece(src, startPos, &start_first);
- }
-
- fill = Min((int)(src->multi_src.piece_size - start_piece->used), length);
-
- ptr = start_piece->text + (startPos - start_first);
- memmove(ptr + fill, ptr, (start_piece->used -
- (startPos - start_first)) * sizeof(wchar_t));
- wptr =(wchar_t *)text.ptr;
- (void)wcsncpy(ptr, wptr + firstPos, fill);
-
- startPos += fill;
- firstPos += fill;
- start_piece->used += fill;
- length -= fill;
- }
- }
-
- if (local_artificial_block == True)
- /* In other words, text is not the u_text that the user handed me but
- one I made myself. I only care, because I need to free the string */
- XtFree(text.ptr);
-
- if (src->multi_src.use_string_in_place)
- start_piece->text[start_piece->used] = (wchar_t)0;
-
-#ifdef OLDXAW
- src->multi_src.changes = True;
- XtCallCallbacks(w, XtNcallback, NULL);
-#endif
-
- return (XawEditDone);
-}
-
-/*
- * Function:
- * Scan
- *
- * Parameters:
- * w - MultiSource widget
- * position - position to start scanning
- * type - type of thing to scan for
- * dir - direction to scan
- * count - which occurance if this thing to search for
- * include - whether or not to include the character found in
- * the position that is returned
- *
- * Description:
- * Scans the text source for the number and type of item specified.
- *
- * Returns:
- * The position of the item found
- *
- * Note:
- * While there are only 'n' characters in the file there are n+1
- * possible cursor positions (one before the first character and
- * one after the last character
- */
-static XawTextPosition
-Scan(Widget w, register XawTextPosition position, XawTextScanType type,
- XawTextScanDirection dir, int count, Bool include)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- register char inc;
- MultiPiece *piece;
- XawTextPosition first, first_eol_position = position;
- register wchar_t *ptr;
- int cnt = count;
-
- if (type == XawstAll) {
- if (dir == XawsdRight)
- return (src->multi_src.length);
- return (0);
- }
-
- /* STEP 1: basic sanity checks */
- if (position > src->multi_src.length)
- position = src->multi_src.length;
-
- if (dir == XawsdRight) {
- if (position == src->multi_src.length)
- return (src->multi_src.length);
- inc = 1;
- }
- else {
- if (position == 0)
- return (0);
- inc = -1;
- position--;
- }
-
- piece = FindPiece(src, position, &first);
-
- if (piece->used == 0)
- return (0);
-
- ptr = (position - first) + piece->text;
-
- switch (type) {
- case XawstEOL:
- case XawstParagraph:
- case XawstWhiteSpace:
- case XawstAlphaNumeric:
- for (; cnt > 0 ; cnt--) {
- Bool non_space = False, first_eol = True;
-
- /*CONSTCOND*/
- while (True) {
- register wchar_t c;
-
- if (ptr < piece->text) {
- piece = piece->prev;
- if (piece == NULL) /* Begining of text */
- return (0);
- ptr = piece->text + piece->used - 1;
- c = *ptr;
- }
- else if (ptr >= piece->text + piece->used) {
- piece = piece->next;
- if (piece == NULL) /* End of text */
- return (src->multi_src.length);
- ptr = piece->text;
- }
-
- c = *ptr;
- ptr += inc;
- position += inc;
-
- if (type == XawstAlphaNumeric) {
- if (!iswalnum(c)) {
- if (non_space)
- break;
- }
- else
- non_space = True;
- }
- else if (type == XawstWhiteSpace) {
- if (iswspace(c)) {
- if (non_space)
- break;
- }
- else
- non_space = True;
- }
- else if (type == XawstEOL) {
- if (c == _Xaw_atowc(XawLF))
- break;
- }
- else { /* XawstParagraph */
- if (first_eol) {
- if (c == _Xaw_atowc(XawLF)) {
- first_eol_position = position;
- first_eol = False;
- }
- }
- else
- if (c == _Xaw_atowc(XawLF))
- break;
- else if (!iswspace(c))
- first_eol = True;
- }
- }
- }
- if (!include) {
- if (type == XawstParagraph)
- position = first_eol_position;
- if (count)
- position -= inc;
- }
- break;
- case XawstPositions:
- position += count * inc;
- break;
- default:
- break;
- }
-
- if (dir == XawsdLeft)
- position++;
-
- if (position >= src->multi_src.length)
- return (src->multi_src.length);
- if (position < 0)
- return (0);
-
- return (position);
-}
-
-/*
- * Function:
- * Search
- *
- * Parameters:
- * w - MultiSource objecy
- * position - position to start scanning
- * dir - direction to scan
- * text - text block to search for
- *
- * Description:
- * Searchs the text source for the text block passed.
- *
- * Returns:
- * The position of the item found
- */
-static XawTextPosition
-Search(Widget w, register XawTextPosition position, XawTextScanDirection dir,
- XawTextBlock *text)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- register int count = 0;
- wchar_t *ptr;
- wchar_t *wtarget;
- int wtarget_len;
- Display *d = XtDisplay(XtParent(w));
- MultiPiece *piece;
- wchar_t *buf;
- XawTextPosition first;
- register char inc;
- int cnt;
-
- /* STEP 1: First, a brief sanity check */
- if (dir == XawsdRight)
- inc = 1;
- else {
- inc = -1;
- if (position == 0)
- return (XawTextSearchError);
- position--;
- }
-
- /* STEP 2: Ensure I have a local wide string.. */
-
- /* Since this widget stores 32bit chars, I check here to see if
- I'm being passed a string claiming to be 8bit chars (ie, MB text.)
- If that is the case, naturally I convert to 32bit format */
-
- /*if the block was FMT8BIT, length will convert to REAL wchar count bellow */
- wtarget_len = text->length;
-
- if (text->format == XawFmtWide)
- wtarget = &(((wchar_t*)text->ptr) [text->firstPos]);
- else {
- /* The following converts wtarget_len from byte len to wchar count */
- wtarget = _XawTextMBToWC(d, &text->ptr[text->firstPos], &wtarget_len);
- }
-
- /* OK, I can now assert that wtarget holds wide characters, wtarget_len
- holds an accurate count of those characters, and that firstPos has been
- effectively factored out of the following computations */
-
- /* STEP 3: SEARCH! */
- buf = (wchar_t *)XtMalloc(sizeof(wchar_t) * wtarget_len);
- (void)wcsncpy(buf, wtarget, wtarget_len);
- piece = FindPiece(src, position, &first);
- ptr = (position - first) + piece->text;
-
- /*CONSTCOND*/
- while (True) {
- if (*ptr == (dir == XawsdRight ? *(buf + count)
- : *(buf + wtarget_len - count - 1))) {
- if (count == text->length - 1)
- break;
- else
- count++;
- }
- else {
- if (count != 0) {
- position -=inc * count;
- ptr -= inc * count;
- }
- count = 0;
- }
-
- ptr += inc;
- position += inc;
-
- while (ptr < piece->text) {
- cnt = piece->text - ptr;
-
- piece = piece->prev;
- if (piece == NULL) { /* Begining of text */
- XtFree((char *)buf);
- return (XawTextSearchError);
- }
- ptr = piece->text + piece->used - cnt;
- }
-
- while (ptr >= piece->text + piece->used) {
- cnt = ptr - (piece->text + piece->used);
-
- piece = piece->next;
- if (piece == NULL) { /* End of text */
- XtFree((char *)buf);
- return (XawTextSearchError);
- }
- ptr = piece->text + cnt;
- }
- }
-
- XtFree((char *)buf);
- if (dir == XawsdLeft)
- return(position);
-
- return(position - (wtarget_len - 1));
-}
-
-/*
- * Function:
- * XawMultiSrcSetValues
- *
- * Parameters:
- * current - current state of the widget
- * request - what was requested
- * cnew - what the widget will become
- * args - representation of resources that have changed
- * num_args - number of changed resources
- *
- * Description:
- * Sets the values for the MultiSource.
- *
- * Returns:
- * True if redisplay is needed
- */
-static Boolean
-XawMultiSrcSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- MultiSrcObject src = (MultiSrcObject)cnew;
- MultiSrcObject old_src = (MultiSrcObject)current;
- XtAppContext app_con = XtWidgetToApplicationContext(cnew);
- Bool total_reset = False, string_set = False;
- FILE *file;
- unsigned int i;
-
- if (old_src->multi_src.use_string_in_place
- != src->multi_src.use_string_in_place) {
- XtAppWarning(app_con,
- "MultiSrc: The XtNuseStringInPlace resources "
- "may not be changed.");
- src->multi_src.use_string_in_place =
- old_src->multi_src.use_string_in_place;
- }
-
- for (i = 0; i < *num_args ; i++)
- if (streq(args[i].name, XtNstring)) {
- string_set = True;
- break;
- }
-
- if (string_set || old_src->multi_src.type != src->multi_src.type) {
- RemoveOldStringOrFile(old_src, string_set);
- src->multi_src.allocated_string = old_src->multi_src.allocated_string;
- file = InitStringOrFile(src, string_set);
-
- LoadPieces(src, file, NULL);
- if (file != NULL)
- fclose(file);
-#ifndef OLDXAW
- for (i = 0; i < src->text_src.num_text; i++)
- /* Tell text widget what happened */
- XawTextSetSource(src->text_src.text[i], cnew, 0);
-#else
- XawTextSetSource(XtParent(cnew), cnew, 0);
-#endif
- total_reset = True;
- }
-
- if (old_src->multi_src.multi_length != src->multi_src.multi_length)
- src->multi_src.piece_size = src->multi_src.multi_length + 1;
-
- if ( !total_reset && old_src->multi_src.piece_size
- != src->multi_src.piece_size) {
- String mb_string = StorePiecesInString(old_src);
-
- if (mb_string != 0) {
- FreeAllPieces(old_src);
- LoadPieces(src, NULL, mb_string);
- XtFree(mb_string);
- }
- else {
- /* If the buffer holds bad chars, don't touch it... */
- XtAppWarningMsg(app_con,
- "convertError", "multiSource", "XawError",
- XtName(XtParent((Widget)old_src)), NULL, NULL);
- XtAppWarningMsg(app_con,
- "convertError", "multiSource", "XawError",
- "Non-character code(s) in buffer.", NULL, NULL);
- }
- }
-
- return (False);
-}
-
-static void
-XawMultiSrcGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- unsigned int i;
-
- if (src->multi_src.type == XawAsciiString) {
- for (i = 0; i < *num_args ; i++) {
- if (streq(args[i].name, XtNstring)) {
- if (src->multi_src.use_string_in_place)
- *((char **)args[i].value) = (char *)
- src->multi_src.first_piece->text;
- else if (_XawMultiSave(w)) /* If save sucessful */
- *((char **)args[i].value) = (char *)src->multi_src.string;
- break;
- }
- }
- }
-}
-
-static void
-XawMultiSrcDestroy(Widget w)
-{
- RemoveOldStringOrFile((MultiSrcObject) w, True);
-}
-
-/*
- * Public routines
- */
-/*
- * Function:
- * XawMultiSourceFreeString
- *
- * Parameters:
- * w - MultiSrc widget
- *
- * Description:
- * Frees the string returned by a get values call
- * on the string when the source is of type string.
- *
- * Note:
- * The public interface is XawAsciiSourceFreeString!
- */
-void
-_XawMultiSourceFreeString(Widget w)
-{
- MultiSrcObject src = (MultiSrcObject)w;
-
- if (src->multi_src.allocated_string) {
- XtFree((char *)src->multi_src.string);
- src->multi_src.allocated_string = False;
- src->multi_src.string = NULL;
- }
-}
-
-/*
- * Function:
- * _XawMultiSave
- *
- * Parameters:
- * w - multiSrc Widget
- *
- * Description:
- * Saves all the pieces into a file or string as required.
- *
- * Returns:
- * True if the save was successful
- *
- * Note:
- * The public interface is XawAsciiSave(w)!
- */
-Bool
-_XawMultiSave(Widget w)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- XtAppContext app_con = XtWidgetToApplicationContext(w);
- char *mb_string;
-
- /*
- * If using the string in place then there is no need to play games
- * to get the internal info into a readable string
- */
- if (src->multi_src.use_string_in_place)
- return (True);
-
- if (src->multi_src.type == XawAsciiFile) {
-#ifdef OLDXAW
- if (!src->multi_src.changes)
-#else
- if (!src->text_src.changed) /* No changes to save */
-#endif
- return (True);
-
- mb_string = StorePiecesInString(src);
-
- if (mb_string != 0) {
- if (WriteToFile(mb_string, (String)src->multi_src.string) == False) {
- XtFree(mb_string);
- return (False);
- }
- XtFree(mb_string);
-#ifndef OLDXAW
- src->text_src.changed = False;
-#else
- src->multi_src.changes = False;
-#endif
- return (True);
- }
- else {
- /* If the buffer holds bad chars, don't touch it... */
- XtAppWarningMsg(app_con,
- "convertError", "multiSource", "XawError",
- "Due to illegal characters, file not saved.",
- NULL, NULL);
- return (False);
- }
- }
- else {
- /* THIS FUNCTIONALITY IS UNDOCUMENTED, probably UNNEEDED? The manual
- says this routine's only function is to save files to
- disk. -Sheeran */
- mb_string = StorePiecesInString(src);
-
- if (mb_string == 0) {
- /* If the buffer holds bad chars, don't touch it... */
- XtAppWarningMsg(app_con,
- "convertError", "multiSource", "XawError",
- XtName(XtParent((Widget)src)), NULL, NULL);
- return (False);
- }
-
- /* assert: mb_string holds good characters so the buffer is fine */
- if (src->multi_src.allocated_string == True)
- XtFree((char *)src->multi_src.string);
- else
- src->multi_src.allocated_string = True;
-
- src->multi_src.string = mb_string;
- }
-#ifdef OLDXAW
- src->multi_src.changes = False;
-#else
- src->text_src.changed = False;
-#endif
-
- return (True);
-}
-
-/*
- * Function:
- * XawMultiSaveAsFile
- *
- * Parameters:
- * w - MultiSrc widget
- * name - name of the file to save this file into
- *
- * Description:
- * Save the current buffer as a file.
- *
- * Returns:
- * True if the save was sucessful
- *
- * Note:
- * The public interface is XawAsciiSaveAsFile!
- */
-Bool
-_XawMultiSaveAsFile(Widget w, _Xconst char* name)
-{
- MultiSrcObject src = (MultiSrcObject)w;
- String mb_string;
- Bool ret;
-
- mb_string = StorePiecesInString(src);
-
- if (mb_string != 0) {
- ret = WriteToFile(mb_string, (char *)name);
- XtFree(mb_string);
-
- return (ret);
- }
-
- /* otherwise there was a conversion error. So print widget name too */
- XtAppWarningMsg(XtWidgetToApplicationContext(w),
- "convertError", "multiSource", "XawError",
- XtName(XtParent(w)), NULL, NULL);
-
- return (False);
-}
-
-/*
- * Private Functions
- */
-static void
-RemoveOldStringOrFile(MultiSrcObject src, Bool checkString)
-{
- FreeAllPieces(src);
-
- if (checkString && src->multi_src.allocated_string) {
- XtFree((char *)src->multi_src.string);
- src->multi_src.allocated_string = False;
- src->multi_src.string = NULL;
- }
-}
-
-/*
- * Function:
- * WriteToFile
- *
- * Parameters:
- * string - string to write
- * name - name of the file
- *
- * Description:
- * Write the string specified to the begining of the file specified.
- *
- * Returns:
- * Returns True if sucessful, False otherwise
- */
-static Bool
-WriteToFile(String string, String name)
-{
- int fd;
-
- if (((fd = creat(name, 0666)) == -1)
- || (write(fd, string, strlen(string)) == -1))
- return (False);
-
- if (close(fd) == -1)
- return (False);
-
- return (True);
-}
-
-
-/*
- * Function:
- * StorePiecesInString
- *
- * Parameters:
- * src - the multiSrc object to gather data from
- *
- * Description:
- * Store the pieces in memory into a char string.
- *
- * Returns:
- * mb_string: Caller must free
- * (or)
- * NULL: conversion error
- */
-static String
-StorePiecesInString(MultiSrcObject src)
-{
- wchar_t *wc_string;
- char *mb_string;
- int char_count = src->multi_src.length;
- XawTextPosition first;
- MultiPiece *piece;
-
- /* I believe the char_count + 1 and the NULL termination are unneeded! FS */
- wc_string = (wchar_t*)XtMalloc((char_count + 1) * sizeof(wchar_t));
-
- for (first = 0, piece = src->multi_src.first_piece ; piece != NULL;
- first += piece->used, piece = piece->next)
- (void)wcsncpy(wc_string + first, piece->text, piece->used);
-
- wc_string[char_count] = 0;
-
- /* This will refill all pieces to capacity */
- if (src->multi_src.data_compression) {
- FreeAllPieces(src);
- LoadPieces(src, NULL, (char *)wc_string);
- }
-
- /* Lastly, convert it to a MB format and send it back */
- mb_string = _XawTextWCToMB(XtDisplayOfObject((Widget)src),
- wc_string, &char_count);
-
- /* NOTE THAT mb_string MAY BE ZERO IF THE CONVERSION FAILED */
- XtFree((char*)wc_string);
-
- return (mb_string);
-}
-
-/*
- * Function:
- * InitStringOrFile
- *
- * Parameters:
- * src - MultiSource
- *
- * Description:
- * Initializes the string or file.
- */
-static FILE *
-InitStringOrFile(MultiSrcObject src, Bool newString)
-{
- char *open_mode = NULL;
- FILE *file;
- char fileName[TMPSIZ];
- Display *d = XtDisplayOfObject((Widget)src);
-
- if (src->multi_src.type == XawAsciiString) {
- if (src->multi_src.string == NULL)
- src->multi_src.length = 0;
-
- else if (!src->multi_src.use_string_in_place) {
- int length;
- String temp = XtNewString((char *)src->multi_src.string);
-
- if (src->multi_src.allocated_string)
- XtFree((char *)src->multi_src.string);
- src->multi_src.allocated_string = True;
- src->multi_src.string = temp;
-
- length = strlen((char *)src->multi_src.string);
-
- /* Wasteful, throwing away the WC string, but need side effect! */
- (void)_XawTextMBToWC(d, (char *)src->multi_src.string, &length);
- src->multi_src.length = (XawTextPosition)length;
- }
- else {
- src->multi_src.length = strlen((char *)src->multi_src.string);
- /* In case the length resource is incorrectly set */
- if (src->multi_src.length > src->multi_src.multi_length)
- src->multi_src.multi_length = src->multi_src.length;
-
- if (src->multi_src.multi_length == MAGIC_VALUE)
- src->multi_src.piece_size = src->multi_src.length;
- else
- src->multi_src.piece_size = src->multi_src.multi_length + 1;
- }
-
- return (NULL);
- }
-
- /*
- * type is XawAsciiFile
- */
- src->multi_src.is_tempfile = False;
-
- switch (src->text_src.edit_mode) {
- case XawtextRead:
- if (src->multi_src.string == NULL)
- XtErrorMsg("NoFile", "multiSourceCreate", "XawError",
- "Creating a read only disk widget and no file specified.",
- NULL, 0);
- open_mode = "r";
- break;
- case XawtextAppend:
- case XawtextEdit:
- if (src->multi_src.string == NULL) {
- src->multi_src.allocated_string = False;
- src->multi_src.string = fileName;
-
- (void)tmpnam((char *)src->multi_src.string);
- src->multi_src.is_tempfile = True;
- open_mode = "w";
- }
- else
- open_mode = "r+";
- break;
- default:
- XtErrorMsg("badMode", "multiSourceCreate", "XawError",
- "Bad editMode for multi source; must be "
- "Read, Append or Edit.", NULL, NULL);
- }
-
- /* Allocate new memory for the temp filename, because it is held in
- * a stack memory buffer. We must verify that all routines that set
- * .string first check .allocated_string and free it - plumbing Sheeran.
- */
- if (newString || src->multi_src.is_tempfile) {
- String temp = XtNewString((char *)src->multi_src.string);
-
- if (src->multi_src.allocated_string)
- XtFree((char *)src->multi_src.string);
- src->multi_src.string = temp;
- src->multi_src.allocated_string = True;
- }
-
- if (!src->multi_src.is_tempfile) {
- if ((file = fopen((char *)src->multi_src.string, open_mode)) != NULL) {
- (void)fseek(file, 0, 2);
- src->multi_src.length = ftell(file);
- return file;
- }
- else {
- String params[2];
- Cardinal num_params = 2;
-
- params[0] = (String)src->multi_src.string;
- params[1] = strerror(errno);
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src),
- "openError", "multiSourceCreate", "XawWarning",
- "Cannot open file %s; %s", params, &num_params);
- }
- }
- src->multi_src.length = 0;
- return (NULL);
-}
-
-/* LoadPieces: This routine takes either the MB contents of open file
- `file' or the MB contents of string or the MB contents of
- src->multi_src.string and places them in Pieces in WC format.
-
- CAUTION: You must have src->multi_src.length set to file length bytes
- when src->multi_src.type == XawAsciiFile. src->multi_src.length must be
- the length of the parameter string if string is non-NULL
-*/
-static void
-LoadPieces(MultiSrcObject src, FILE *file, char *string)
-{
- Display *d = XtDisplayOfObject((Widget)src);
- wchar_t* local_str, *ptr;
- MultiPiece* piece = NULL;
- XawTextPosition left;
- int bytes = sizeof(wchar_t);
- char* temp_mb_holder = NULL;
-
- /*
- * This is tricky - the _XawTextMBtoWC converter uses its 3rd arg
- * in as MB length, out as WC length. We want local_length to be
- * WC count.
- */
- int local_length = src->multi_src.length;
-
- if (string != NULL) {
- /*
- * ASSERT: IF our caller passed a non-null string, THEN
- * src->multi_src.length is currently string's * byte count,
- * AND string is in a MB format
- */
- local_str = _XawTextMBToWC(d, (char *)string, &local_length);
- src->multi_src.length = (XawTextPosition) local_length;
- }
- else if (src->multi_src.type != XawAsciiFile) {
- /*
- * here, we are not changing the contents, just reloading,
- * so don't change len...
- */
- local_length = src->multi_src.string ?
- strlen((char *)src->multi_src.string) : 0;
- local_str = _XawTextMBToWC(d, (char *)src->multi_src.string,
- &local_length);
- }
- else {
- if (src->multi_src.length != 0) {
- temp_mb_holder =
- XtMalloc((src->multi_src.length + 1) * sizeof(unsigned char));
- fseek(file, 0, 0);
- src->multi_src.length = fread(temp_mb_holder,
- (Size_t)sizeof(unsigned char),
- (Size_t)src->multi_src.length, file);
- if (src->multi_src.length <= 0)
- XtAppErrorMsg(XtWidgetToApplicationContext ((Widget) src),
- "readError", "multiSource", "XawError",
- "fread returned error.", NULL, NULL);
- local_length = src->multi_src.length;
- local_str = _XawTextMBToWC(d, temp_mb_holder, &local_length);
- src->multi_src.length = local_length;
-
- if (local_str == 0) {
- String params[2];
- Cardinal num_params;
- static char err_text[] =
- "<<< FILE CONTENTS NOT REPRESENTABLE IN THIS LOCALE >>>";
-
- params[0] = XtName(XtParent((Widget)src));
- params[1] = src->multi_src.string;
- num_params = 2;
-
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget)src),
- "readLocaleError", "multiSource", "XawError",
- "%s: The file `%s' contains characters "
- "not representable in this locale.",
- params, &num_params);
- src->multi_src.length = sizeof err_text;
- local_length = src->multi_src.length;
- local_str = _XawTextMBToWC(d, err_text, &local_length);
- src->multi_src.length = local_length;
- }
- }
- else
- /* ASSERT that since following while loop looks at local_length
- this isn't needed. Sheeran, Omron KK, 1993/07/15
- temp_mb_holder[src->multi_src.length] = '\0'; */
- local_str = (wchar_t*)temp_mb_holder;
- }
-
- if (src->multi_src.use_string_in_place) {
- piece = AllocNewPiece(src, piece);
- piece->used = Min(src->multi_src.length, src->multi_src.piece_size);
- piece->text = (wchar_t*)src->multi_src.string;
- return;
- }
-
- ptr = local_str;
- left = local_length;
-
- do {
- piece = AllocNewPiece(src, piece);
-
- piece->text = (wchar_t*)XtMalloc((unsigned)(src->multi_src.piece_size
- * bytes));
- piece->used = Min(left, src->multi_src.piece_size);
- if (piece->used != 0)
- (void)wcsncpy(piece->text, ptr, piece->used);
-
- left -= piece->used;
- ptr += piece->used;
- } while (left > 0);
-
- if (temp_mb_holder)
- XtFree((char*)temp_mb_holder);
-}
-
-/*
- * Function:
- * AllocNewPiece
- *
- * Parameters:
- * src - MultiSrc Widget
- * prev - the piece just before this one, or NULL
- *
- * Description:
- * Allocates a new piece of memory.
- *
- * Returns:
- * The allocated piece
- */
-static MultiPiece *
-AllocNewPiece(MultiSrcObject src, MultiPiece *prev)
-{
- MultiPiece *piece = XtNew(MultiPiece);
-
- if (prev == NULL) {
- src->multi_src.first_piece = piece;
- piece->next = NULL;
- }
- else {
- if (prev->next != NULL)
- (prev->next)->prev = piece;
- piece->next = prev->next;
- prev->next = piece;
- }
-
- piece->prev = prev;
-
- return (piece);
-}
-
-/*
- * Function:
- * FreeAllPieces
- *
- * Parameters:
- * src - MultiSrc Widget
- *
- * Description:
- * Frees all the pieces
- */
-static void
-FreeAllPieces(MultiSrcObject src)
-{
- MultiPiece *next, *first = src->multi_src.first_piece;
-
-#ifdef DEBUG
- if (first->prev != NULL)
- printf("Xaw MultiSrc Object: possible memory leak in FreeAllPieces().\n");
-#endif
-
- for (; first != NULL ; first = next) {
- next = first->next;
- RemovePiece(src, first);
- }
-}
-
-/*
- * Function:
- * RemovePiece
- *
- * Parameters:
- * piece - piece to remove
- *
- * Description:
- * Removes a piece from the list.
- */
-static void
-RemovePiece(MultiSrcObject src, MultiPiece *piece)
-{
- if (piece->prev == NULL)
- src->multi_src.first_piece = piece->next;
- else
- piece->prev->next = piece->next;
-
- if (piece->next != NULL)
- piece->next->prev = piece->prev;
-
- if (!src->multi_src.use_string_in_place)
- XtFree((char *)piece->text);
-
- XtFree((char *)piece);
-}
-
-/*
- * Function:
- * FindPiece
- *
- * Parameters:
- * src - MultiSrc Widget
- * position - position that we are searching for
- * first - position of the first character in this piece (return)
- *
- * Description:
- * Finds the piece containing the position indicated.
- *
- * Returns:
- * Piece that contains this position
- */
-static MultiPiece *
-FindPiece(MultiSrcObject src, XawTextPosition position, XawTextPosition *first)
-{
- MultiPiece *old_piece, *piece;
- XawTextPosition temp;
-
- for (old_piece = NULL, piece = src->multi_src.first_piece, temp = 0;
- piece; old_piece = piece, piece = piece->next)
- if ((temp += piece->used) > position) {
- *first = temp - piece->used;
- return (piece);
- }
-
- *first = temp - (old_piece ? old_piece->used : 0);
-
- return (old_piece); /* if we run off the end the return the last piece */
-}
-
-/*
- * Function:
- * BreakPiece
- *
- * Parameters:
- * src - MultiSrc Widget
- * piece - piece to break
- *
- * Description:
- * Breaks a full piece into two new pieces.
- */
-#define HALF_PIECE (src->multi_src.piece_size >> 1)
-static void
-BreakPiece(MultiSrcObject src, MultiPiece *piece)
-{
- MultiPiece *cnew = AllocNewPiece(src, piece);
-
- cnew->text = (wchar_t *)
- XtMalloc(src->multi_src.piece_size * sizeof(wchar_t));
- (void)wcsncpy(cnew->text, piece->text + HALF_PIECE,
- src->multi_src.piece_size - HALF_PIECE);
- piece->used = HALF_PIECE;
- cnew->used = src->multi_src.piece_size - HALF_PIECE;
-}
-
-/*ARGSUSED*/
-static void
-CvtStringToMultiType(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XawAsciiType type = XawAsciiString;
- XrmQuark q;
- char name[7];
-
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- if (q == Qstring)
- type = XawAsciiString;
- if (q == Qfile)
- type = XawAsciiFile;
- else {
- toVal->size = 0;
- toVal->addr = NULL;
- XtStringConversionWarning((char *)fromVal->addr, XtRAsciiType);
- }
-
- toVal->size = sizeof(XawAsciiType);
- toVal->addr = (XPointer)&type;
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtMultiTypeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(XawAsciiType *)fromVal->addr) {
- case XawAsciiFile:
- buffer = XtEfile;
- break;
- case XawAsciiString:
- buffer = XtEstring;
- break;
- default:
- XawTypeToStringWarning(dpy, XtRAsciiType);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-/*ARGSUSED*/
-static void
-GetDefaultPieceSize(Widget w, int offset, XrmValue *value)
-{
- static int pagesize;
-
- if (pagesize == 0) {
- pagesize = _XawGetPageSize();
- if (pagesize < BUFSIZ)
- pagesize = BUFSIZ;
- }
-
- value->addr = (XtPointer)&pagesize;
-}
diff --git a/xc/lib/Xaw/MultiSrc.h b/xc/lib/Xaw/MultiSrc.h
deleted file mode 100644
index 586c06d50..000000000
--- a/xc/lib/Xaw/MultiSrc.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $TOG: MultiSrc.h /main/3 1998/02/06 12:47:36 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OMRON makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Li Yuhong OMRON Corporation
- */
-
-/*
-
-Copyright 1989, 1991, 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/lib/Xaw/MultiSrc.h,v 1.5 1999/05/09 10:51:39 dawes Exp $ */
-
-/*
- * This file was modified from AsciiSrc.h.
- *
- * By Li Yuhong, Sept. 18, 1990
- */
-
-#ifndef _XawMultiSrc_h
-#define _XawMultiSrc_h
-
-#include <X11/Xaw/TextSrc.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- dataCompression DataCompression Boolean True
- length Length int (internal)
- pieceSize PieceSize int BUFSIZ
- string String String NULL
- type Type XawAsciiType XawAsciiString
- useStringInPlace UseStringInPlace Boolean False
-
-*/
-
-extern WidgetClass multiSrcObjectClass;
-
-typedef struct _MultiSrcClassRec *MultiSrcObjectClass;
-typedef struct _MultiSrcRec *MultiSrcObject;
-
-#define MultiSourceObjectClass MultiSrcObjectClass
-#define MultiSourceObject MultiSrcObject
-
-#define XtCDataCompression "DataCompression"
-#define XtCPieceSize "PieceSize"
-#define XtCType "Type"
-#define XtCUseStringInPlace "UseStringInPlace"
-
-#define XtNdataCompression "dataCompression"
-#define XtNpieceSize "pieceSize"
-#define XtNtype "type"
-#define XtNuseStringInPlace "useStringInPlace"
-
-#define XtRMultiType "MultiType"
-
-#define XtEstring "string"
-#define XtEfile "file"
-
-/************************************************************
- *
- * THESE ROUTINES ARE NOT PUBLIC: Source should call
- *
- * the AsciiSrc API which currently forwards requests here.
- *
- * future versions (like theres going to be an R7 Xaw!) may
- *
- * eliminate this file or at least these functions entirely.
- *
- ************************************************************/
-
-_XFUNCPROTOBEGIN
-
-void XawMultiSourceFreeString
-(
- Widget w
- );
-
-Bool _XawMultiSave
-(
- Widget w
-);
-
-Bool _XawMultiSaveAsFile
-(
- Widget w,
- _Xconst char *name
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawMultiSrc_h */
diff --git a/xc/lib/Xaw/MultiSrcP.h b/xc/lib/Xaw/MultiSrcP.h
deleted file mode 100644
index 71e58c0bb..000000000
--- a/xc/lib/Xaw/MultiSrcP.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* $TOG: MultiSrcP.h /main/5 1998/06/24 11:53:25 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. OMRON make no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * OMRON DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Li Yuhong OMRON Corporation
- */
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 1991, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/MultiSrcP.h,v 1.7 1999/06/20 08:41:03 dawes Exp $ */
-
-/*
- * MultiSrcP.h - Private Header for Multi Text Source.
- *
- * This is the private header file for the Multi Text Source.
- * It is intended to be used with the Text widget, the simplest way to use
- * this text source is to use the MultiText Object.
- *
- * Date: June 29, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-/*
- * This file was changed from AsciiSrcP.h.
- *
- * By Li Yuhong, Sept. 18, 1990
- */
-
-#ifndef _XawMultiSrcP_h
-#define _XawMultiSrcP_h
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xaw/TextSrcP.h>
-#include <X11/Xaw/MultiSrc.h>
-
-#ifdef L_tmpnam
-#define TMPSIZ L_tmpnam
-#else
-#ifdef PATH_MAX
-#define TMPSIZ PATH_MAX
-#else
-#define TMPSIZ 1024 /* bytes to allocate for tmpnam */
-#endif
-#endif
-
-typedef struct _MultiPiece { /* Piece of the text file of BUFSIZ allocated
- characters */
- wchar_t* text; /* The text in this buffer */
- XawTextPosition used; /* The number of characters of this buffer
- that have been used */
- struct _MultiPiece *prev, *next; /* linked list pointers */
-} MultiPiece;
-
-/* New fields for the MultiSrc object class */
-typedef struct _MultiSrcClassPart {
- XtPointer extension;
-} MultiSrcClassPart;
-
-/* Full class record */
-typedef struct _MultiSrcClassRec {
- ObjectClassPart object_class;
- TextSrcClassPart text_src_class;
- MultiSrcClassPart multi_src_class;
-} MultiSrcClassRec;
-
-extern MultiSrcClassRec multiSrcClassRec;
-
-/* New fields for the MultiSrc object */
-typedef struct _MultiSrcPart {
- /* resources */
- XIC ic; /* for X Input Method */
- XtPointer string; /* either the string, or the file name, depend-
- ing upon the `type'. ALWAYS IN MB FORMAT */
- XawAsciiType type; /* either string or disk */
- XawTextPosition piece_size; /* Size of text buffer for each piece */
- Boolean data_compression; /* compress to minimum memory automatically
- on save? */
-#ifdef OLDXAW
- XtCallbackList callback;
-#endif
- Boolean use_string_in_place;/* Use the string passed in place */
- int multi_length; /* length field for multi string emulation */
-
- /* private */
-
- Boolean is_tempfile; /* Is this a temporary file? */
-#ifdef OLDXAW
- Boolean changes;
-#endif
- Boolean allocated_string; /* Have I allocated the
- string in multi_src->string? */
- XawTextPosition length; /* length of file - IN CHARACTERS, NOT BYTES */
- MultiPiece *first_piece; /* first piece of the text */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} MultiSrcPart;
-
-/* Full instance record */
-typedef struct _MultiSrcRec {
- ObjectPart object;
- TextSrcPart text_src;
- MultiSrcPart multi_src;
-} MultiSrcRec;
-
-_XFUNCPROTOBEGIN
-
-void _XawMultiSourceFreeString
-(
- Widget w
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawMultiSrcP_h */
diff --git a/xc/lib/Xaw/OS.c b/xc/lib/Xaw/OS.c
deleted file mode 100644
index e91f36d0d..000000000
--- a/xc/lib/Xaw/OS.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $XFree86: xc/lib/Xaw/OS.c,v 1.2 1998/12/06 11:24:32 dawes Exp $ */
-
-/* Some OS-dependent utility code */
-
-#include <X11/Xosdefs.h>
-#include <X11/IntrinsicP.h>
-#include "Private.h"
-
-#ifndef X_NOT_POSIX
-#include <unistd.h> /* for sysconf(), and getpagesize() */
-#endif
-
-#if defined(linux)
-#include <asm/page.h> /* for PAGE_SIZE */
-#define HAS_GETPAGESIZE
-#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
-#endif
-
-#if defined(CSRG_BASED)
-#define HAS_GETPAGESIZE
-#endif
-
-#if defined(sun)
-#define HAS_GETPAGESIZE
-#endif
-
-int
-_XawGetPageSize()
-{
- static int pagesize = -1;
-
- if (pagesize != -1)
- return pagesize;
-
- /* Try each supported method in the preferred order */
-
-#if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE)
- pagesize = sysconf(_SC_PAGESIZE);
-#endif
-
-#ifdef _SC_PAGE_SIZE
- if (pagesize == -1)
- pagesize = sysconf(_SC_PAGE_SIZE);
-#endif
-
-#ifdef HAS_GETPAGESIZE
- if (pagesize == -1)
- pagesize = getpagesize();
-#endif
-
-#ifdef PAGE_SIZE
- if (pagesize == -1)
- pagesize = PAGE_SIZE;
-#endif
-
- if (pagesize == -1)
- pagesize = 0;
-
- return pagesize;
-}
diff --git a/xc/lib/Xaw/Paned.c b/xc/lib/Xaw/Paned.c
deleted file mode 100644
index 6fb6bb52b..000000000
--- a/xc/lib/Xaw/Paned.c
+++ /dev/null
@@ -1,2058 +0,0 @@
-/* $TOG: Paned.c /main/29 1998/02/11 14:53:59 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Paned.c,v 1.9 1999/06/06 08:48:01 dawes Exp $ */
-
-/*
- * Updated and significantly modified from the Athena VPaned Widget.
- *
- * Date: March 1, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <X11/IntrinsicP.h>
-#include <X11/cursorfont.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/Grip.h>
-#include <X11/Xaw/PanedP.h>
-#include <X11/Xaw/XawImP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-typedef enum {
- UpLeftPane = 'U',
- LowRightPane = 'L',
- ThisBorderOnly = 'T',
- AnyPane = 'A'
-} Direction;
-
-#define NO_INDEX -100
-#define IS_GRIP NULL
-
-#define PaneInfo(w) ((Pane)(w)->core.constraints)
-#define HasGrip(w) (PaneInfo(w)->grip != NULL)
-#define IsPane(w) ((w)->core.widget_class != gripWidgetClass)
-#define PaneIndex(w) (PaneInfo(w)->position)
-#define IsVert(w) ((w)->paned.orientation == XtorientVertical)
-
-#define ForAllPanes(pw, childP) \
-for ((childP) = (pw)->composite.children; \
- (childP) < (pw)->composite.children + (pw)->paned.num_panes; \
- (childP)++)
-
-#define ForAllChildren(pw, childP) \
-for ((childP) = (pw)->composite.children; \
- (childP) < (pw)->composite.children + (pw)->composite.num_children; \
- (childP)++)
-
-#define PaneSize(paned, vertical) \
- ((vertical) ? XtHeight(paned) : XtWidth(paned))
-
-#define GetRequestInfo(geo, vertical) \
- ((vertical) ? (geo)->height : (geo)->width)
-
-#define SatisfiesRule1(pane, shrink) \
- (((shrink) && ((pane)->size != (pane)->min)) \
- || (!(shrink) && ((pane)->size != (pane)->max)))
-
-#define SatisfiesRule2(pane) \
- (!(pane)->skip_adjust || (pane)->paned_adjusted_me)
-
-#define SatisfiesRule3(pane, shrink) \
- ((pane)->paned_adjusted_me \
- && (((shrink) && ((int)(pane)->wp_size <= (pane)->size)) \
- || (!(shrink) && ((int)(pane)->wp_size >= (pane)->size))))
-
-
-/*
- * Class Methods
- */
-static void XawPanedClassInitialize(void);
-static void XawPanedChangeManaged(Widget);
-static void XawPanedDeleteChild(Widget);
-static void XawPanedDestroy(Widget);
-static XtGeometryResult XawPanedGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawPanedInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawPanedInsertChild(Widget);
-static Boolean XawPanedPaneSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static void XawPanedRealize(Widget, Mask*, XSetWindowAttributes*);
-static void XawPanedRedisplay(Widget, XEvent*, Region);
-static void XawPanedResize(Widget);
-static Boolean XawPanedSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void _DrawInternalBorders(PanedWidget, GC);
-static void _DrawRect(PanedWidget, GC, int, int, unsigned int, unsigned int);
-static void _DrawTrackLines(PanedWidget, Bool);
-static void AdjustPanedSize(PanedWidget, unsigned int, XtGeometryResult*,
- Dimension*, Dimension*);
-static void ChangeAllGripCursors(PanedWidget);
-static Pane ChoosePaneToResize(PanedWidget, int, Direction, Bool);
-static void ClearPaneStack(PanedWidget);
-static void CommitGripAdjustment(PanedWidget);
-static void CreateGrip(Widget);
-static int GetEventLocation(PanedWidget, XEvent*);
-static void GetGCs(Widget);
-static void GetPaneStack(PanedWidget, Bool, Pane*, int*);
-static void HandleGrip(Widget, XtPointer, XtPointer);
-static void LoopAndRefigureChildren(PanedWidget, int, Direction, int*);
-static void ManageAndUnmanageGrips(PanedWidget);
-static void MoveGripAdjustment(PanedWidget, Widget, Direction, int);
-static Bool PopPaneStack(PanedWidget);
-static void PushPaneStack(PanedWidget, Pane);
-static void RefigureLocations(PanedWidget, int, Direction);
-static void RefigureLocationsAndCommit(Widget);
-static void ReleaseGCs(Widget);
-static void ResortChildren(PanedWidget);
-static void SetChildrenPrefSizes(PanedWidget, unsigned int);
-static void StartGripAdjustment(PanedWidget, Widget, Direction);
-
-/*
- * Initialization
- */
-static char defGripTranslations[] =
-"<Btn1Down>:" "GripAction(Start,UpLeftPane)\n"
-"<Btn2Down>:" "GripAction(Start,ThisBorderOnly)\n"
-"<Btn3Down>:" "GripAction(Start,LowRightPane)\n"
-"<Btn1Motion>:" "GripAction(Move,UpLeft)\n"
-"<Btn2Motion>:" "GripAction(Move,ThisBorder)\n"
-"<Btn3Motion>:" "GripAction(Move,LowRight)\n"
-"Any<BtnUp>:" "GripAction(Commit)\n"
-;
-
-#define offset(field) XtOffsetOf(PanedRec, paned.field)
-static XtResource resources[] = {
- {
- XtNinternalBorderColor,
- XtCBorderColor,
- XtRPixel,
- sizeof(Pixel),
- offset(internal_bp),
- XtRString,
- (XtPointer)XtDefaultForeground
- },
- {
- XtNinternalBorderWidth,
- XtCBorderWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(internal_bw),
- XtRImmediate,
- (XtPointer)1
- },
- {
- XtNgripIndent,
- XtCGripIndent,
- XtRPosition,
- sizeof(Position),
- offset(grip_indent),
- XtRImmediate,
- (XtPointer)10
- },
- {
- XtNrefigureMode,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(refiguremode),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNgripTranslations,
- XtCTranslations,
- XtRTranslationTable,
- sizeof(XtTranslations),
- offset(grip_translations),
- XtRString,
- (XtPointer)defGripTranslations
- },
- {
- XtNorientation,
- XtCOrientation,
- XtROrientation,
- sizeof(XtOrientation),
- offset(orientation),
- XtRImmediate,
- (XtPointer)XtorientVertical
- },
- {
- XtNcursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(cursor),
- XtRImmediate,
- None
- },
- {
- XtNgripCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(grip_cursor),
- XtRImmediate,
- None
- },
- {
- XtNverticalGripCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(v_grip_cursor),
- XtRString,
- "sb_v_double_arrow"
- },
- {
- XtNhorizontalGripCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(h_grip_cursor),
- XtRString,
- "sb_h_double_arrow"
- },
- {
- XtNbetweenCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(adjust_this_cursor),
- XtRString,
- None
- },
- {
- XtNverticalBetweenCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(v_adjust_this_cursor),
- XtRString,
- "sb_left_arrow"
- },
- {
- XtNhorizontalBetweenCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(h_adjust_this_cursor),
- XtRString,
- "sb_up_arrow"
- },
- {
- XtNupperCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(adjust_upper_cursor),
- XtRString,
- "sb_up_arrow"
- },
- {
- XtNlowerCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(adjust_lower_cursor),
- XtRString,
- "sb_down_arrow"
- },
- {
- XtNleftCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(adjust_left_cursor),
- XtRString,
- "sb_left_arrow"
- },
- {
- XtNrightCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(adjust_right_cursor),
- XtRString,
- "sb_right_arrow"
- },
-};
-#undef offset
-
-#define offset(field) XtOffsetOf(PanedConstraintsRec, paned.field)
-static XtResource subresources[] = {
- {
- XtNallowResize,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(allow_resize),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNposition,
- XtCPosition,
- XtRInt,
- sizeof(int),
- offset(position),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNmin,
- XtCMin,
- XtRDimension,
- sizeof(Dimension),
- offset(min),
- XtRImmediate,
- (XtPointer)PANED_GRIP_SIZE
- },
- {
- XtNmax,
- XtCMax,
- XtRDimension,
- sizeof(Dimension),
- offset(max),
- XtRImmediate,
- (XtPointer)~0
- },
- {
- XtNpreferredPaneSize,
- XtCPreferredPaneSize,
- XtRDimension,
- sizeof(Dimension),
- offset(preferred_size),
- XtRImmediate,
- (XtPointer)PANED_ASK_CHILD
- },
- {
- XtNresizeToPreferred,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(resize_to_pref),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNskipAdjust,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(skip_adjust),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNshowGrip,
- XtCShowGrip,
- XtRBoolean,
- sizeof(Boolean),
- offset(show_grip),
- XtRImmediate,
- (XtPointer)True
- },
-};
-#undef offset
-
-#define SuperClass ((ConstraintWidgetClass)&constraintClassRec)
-
-PanedClassRec panedClassRec = {
- /* core */
- {
- (WidgetClass)SuperClass, /* superclass */
- "Paned", /* class name */
- sizeof(PanedRec), /* size */
- XawPanedClassInitialize, /* class_initialize */
- NULL, /* class_part init */
- False, /* class_inited */
- XawPanedInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawPanedRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawPanedDestroy, /* destroy */
- XawPanedResize, /* resize */
- XawPanedRedisplay, /* expose */
- XawPanedSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XawPanedGeometryManager, /* geometry_manager */
- XawPanedChangeManaged, /* change_managed */
- XawPanedInsertChild, /* insert_child */
- XawPanedDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- /* constraint */
- {
- subresources, /* subresources */
- XtNumber(subresources), /* subresource_count */
- sizeof(PanedConstraintsRec), /* constraint_size */
- NULL, /* initialize */
- NULL, /* destroy */
- XawPanedPaneSetValues, /* set_values */
- NULL, /* extension */
- },
-};
-
-WidgetClass panedWidgetClass = (WidgetClass)&panedClassRec;
-WidgetClass vPanedWidgetClass = (WidgetClass)&panedClassRec;
-
-/*
- * Implementation
- */
-/* Function:
- * AdjustPanedSize
- *
- * Parameters:
- * pw - paned widget to adjust
- * off_size - new off_size to use
- * result_ret - result of query (return)
- * on_size_ret - new on_size (return)
- * off_size_ret - new off_size (return)
- *
- * Description:
- * Adjusts the size of the pane.
- *
- * Returns:
- * amount of change in size
- */
-static void
-AdjustPanedSize(PanedWidget pw, unsigned int off_size,
- XtGeometryResult *result_ret,
- Dimension *on_size_ret, Dimension *off_size_ret)
-{
- Dimension old_size = PaneSize((Widget)pw, IsVert(pw));
- Dimension newsize = 0;
- Widget *childP;
- XtWidgetGeometry request, reply;
-
- request.request_mode = CWWidth | CWHeight;
-
- ForAllPanes(pw, childP) {
- int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min);
-
- AssignMin(size, (int)PaneInfo(*childP)->max);
- newsize += size + pw->paned.internal_bw;
- }
- newsize -= pw->paned.internal_bw;
-
- if (newsize < 1)
- newsize = 1;
-
- if (IsVert(pw)) {
- request.width = off_size;
- request.height = newsize;
- }
- else {
- request.width = newsize;
- request.height = off_size;
- }
-
- if (result_ret != NULL) {
- request.request_mode |= XtCWQueryOnly;
-
- *result_ret = XtMakeGeometryRequest((Widget)pw, &request, &reply);
- _XawImCallVendorShellExtResize((Widget)pw);
-
- if (newsize == old_size || *result_ret == XtGeometryNo) {
- *on_size_ret = old_size;
- *off_size_ret = off_size;
- return;
- }
- if (*result_ret != XtGeometryAlmost) {
- *on_size_ret = GetRequestInfo(&request, IsVert(pw));
- *off_size_ret = GetRequestInfo(&request, !IsVert(pw));
- return;
- }
- *on_size_ret = GetRequestInfo(&reply, IsVert(pw));
- *off_size_ret = GetRequestInfo(&reply, !IsVert(pw));
- return;
- }
-
- if (newsize == old_size)
- return;
-
- if (XtMakeGeometryRequest((Widget)pw, &request, &reply) == XtGeometryAlmost)
- XtMakeGeometryRequest((Widget)pw, &reply, &request);
-}
-
-/*
- * Function:
- * ChoosePaneToResize.
- *
- * Parameters:
- * pw - paned widget
- * paneindex - index of the current pane
- * dir - direction to search first
- * shrink - True if we need to shrink a pane, False otherwise
- *
- * Description:
- * This function chooses a pane to resize.
- They are chosen using the following rules:
- *
- * 1) size < max && size > min
- * 2) skip adjust == False
- * 3) widget not its prefered height
- * && this change will bring it closer
- * && The user has not resized this pane.
- *
- * If no widgets are found that fits all the rules then
- * rule #3 is broken.
- * If there are still no widgets found than
- * rule #2 is broken.
- * Rule #1 is never broken.
- * If no widgets are found then NULL is returned.
- *
- * Returns:
- * pane to resize or NULL
- */
-static Pane
-ChoosePaneToResize(PanedWidget pw, int paneindex, Direction dir, Bool shrink)
-{
- Widget *childP;
- int rules = 3;
- Direction _dir = dir;
- int _index = paneindex;
-
- if (paneindex == NO_INDEX || dir == AnyPane) { /* Use defaults */
- _dir = LowRightPane; /* Go up - really */
- _index = pw->paned.num_panes - 1; /* Start the last pane, and work
- backwards */
- }
- childP = pw->composite.children + _index;
-
- /*CONSTCOND*/
- while(True) {
- Pane pane = PaneInfo(*childP);
-
- if ((rules < 3 || SatisfiesRule3(pane, shrink))
- && (rules < 2 || SatisfiesRule2(pane))
- && SatisfiesRule1(pane, shrink)
- && (paneindex != PaneIndex(*childP) || dir == AnyPane))
- return (pane);
-
- /*
- * This is counter-intuitive, but if we are resizing the pane
- * above the grip we want to choose a pane below the grip to lose,
- * and visa-versa
- */
- if (_dir == LowRightPane)
- --childP;
- else
- ++childP;
-
- /*
- * If we have come to and edge then reduce the rule set, and try again
- * If we are reduced the rules to none, then return NULL
- */
- if ((childP - pw->composite.children) < 0 ||
- (childP - pw->composite.children) >= pw->paned.num_panes) {
- if (--rules < 1) /* less strict rules */
- return (NULL);
- childP = pw->composite.children + _index;
- }
- }
-}
-
-/*
- * Function:
- * LoopAndRefigureChildren
- *
- * Parameters:
- * pw - paned widget
- * paneindex - number of the pane border we are moving
- * dir - pane to move (either UpLeftPane or LowRightPane)
- * sizeused - current amount of space used (used and returned)
- *
- * Description:
- * If we are resizing either the UpleftPane or LowRight Pane loop
- * through all the children to see if any will allow us to resize them.
- */
-static void
-LoopAndRefigureChildren(PanedWidget pw, int paneindex, Direction dir,
- int *sizeused)
-{
- int pane_size = (int)PaneSize((Widget)pw, IsVert(pw));
- Boolean shrink = (*sizeused > pane_size);
-
- if (dir == LowRightPane)
- paneindex++;
-
- /* While all panes do not fit properly */
- while (*sizeused != pane_size) {
- /*
- * Choose a pane to resize
- * First look on the Pane Stack, and then go hunting for another one
- * If we fail to find a pane to resize then give up
- */
- Pane pane;
- int start_size;
- Dimension old;
- Boolean rule3_ok = False, from_stack = True;
-
- GetPaneStack(pw, shrink, &pane, &start_size);
- if (pane == NULL) {
- pane = ChoosePaneToResize(pw, paneindex, dir, shrink);
- if (pane == NULL)
- return; /* no one to resize, give up */
-
- rule3_ok = SatisfiesRule3(pane, shrink);
- from_stack = False;
- PushPaneStack(pw, pane);
- }
-
- /*
- * Try to resize this pane so that all panes will fit, take min and max
- * into account
- */
- old = pane->size;
- pane->size += pane_size - *sizeused;
-
- if (from_stack) {
- if (shrink) {
- AssignMax(pane->size, start_size);
- } /* don't remove these braces */
- else
- AssignMin(pane->size, start_size);
-
- if (pane->size == start_size)
- (void)PopPaneStack(pw);
- }
- else if (rule3_ok) {
- if (shrink) {
- AssignMax(pane->size, (int)pane->wp_size);
- } /* don't remove these braces */
- else
- AssignMin(pane->size, (int)pane->wp_size);
- }
-
- pane->paned_adjusted_me = pane->size != pane->wp_size;
- AssignMax(pane->size, (int)pane->min);
- AssignMin(pane->size, (int)pane->max);
- *sizeused += (pane->size - old);
- }
-}
-
-/*
- * Function:
- * RefigureLocations
- *
- * Parameters:
- * pw - paned widget
- * paneindex - child to start refiguring at
- * dir - direction to move from child
- *
- * Description:
- * Refigures all locations of children.
- * There are special arguments to paneindex and dir, they are:
- * paneindex - NO_INDEX.
- * dir - AnyPane.
- *
- * If either of these is true then all panes may be resized and
- * the choosing of panes procedes in reverse order starting with the
- * last child.
- */
-static void
-RefigureLocations(PanedWidget pw, int paneindex, Direction dir)
-{
- Widget *childP;
- int pane_size = (int)PaneSize((Widget)pw, IsVert(pw));
- int sizeused = 0;
- Position loc = 0;
-
- if (pw->paned.num_panes == 0 || !pw->paned.refiguremode)
- return;
-
- /*
- * Get an initial estimate of the size we will use
- */
- ForAllPanes(pw, childP) {
- Pane pane = PaneInfo(*childP);
-
- AssignMax(pane->size, (int) pane->min);
- AssignMin(pane->size, (int) pane->max);
- sizeused += (int)pane->size + (int)pw->paned.internal_bw;
- }
- sizeused -= (int)pw->paned.internal_bw;
-
- if (dir != ThisBorderOnly && sizeused != pane_size)
- LoopAndRefigureChildren(pw, paneindex, dir, &sizeused);
-
- /*
- * If we still are not the right size, then tell the pane that
- * wanted to resize that it can't
- */
- if (paneindex != NO_INDEX && dir != AnyPane) {
- Pane pane = PaneInfo(*(pw->composite.children + paneindex));
- Dimension old = pane->size;
-
- pane->size += pane_size - sizeused;
- AssignMax(pane->size, (int) pane->min);
- AssignMin(pane->size, (int) pane->max);
- sizeused += pane->size - old;
- }
-
- /*
- * It is possible that the panes will not fit inside the vpaned widget, but
- * we have tried out best
- *
- * Assign each pane a location
- */
- ForAllPanes(pw, childP) {
- PaneInfo(*childP)->delta = loc;
- loc += PaneInfo(*childP)->size + pw->paned.internal_bw;
- }
-}
-
-/*
- * Function:
- * CommitNewLocations
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Commits all of the previously figured locations.
- */
-static void
-CommitNewLocations(PanedWidget pw)
-{
- Widget *childP;
- XWindowChanges changes;
-
- changes.stack_mode = Above;
-
- ForAllPanes(pw, childP) {
- Pane pane = PaneInfo(*childP);
- Widget grip = pane->grip; /* may be NULL */
-
- if (IsVert(pw)) {
- XtMoveWidget(*childP, (Position) 0, pane->delta);
- XtResizeWidget(*childP, XtWidth(pw), pane->size, 0);
-
- if (HasGrip(*childP)) { /* Move and Display the Grip */
- changes.x = XtWidth(pw) - pw->paned.grip_indent -
- XtWidth(grip) - (XtBorderWidth(grip) << 1);
- changes.y = XtY(*childP) + XtHeight(*childP) -
- (XtHeight(grip) >> 1) - XtBorderWidth(grip) +
- (pw->paned.internal_bw >> 1);
- }
- }
- else {
- XtMoveWidget(*childP, pane->delta, 0);
- XtResizeWidget(*childP, pane->size, XtHeight(pw), 0);
-
- if (HasGrip(*childP)) { /* Move and Display the Grip */
- changes.x = XtX(*childP) + XtWidth(*childP) -
- (XtWidth(grip) >> 1) - XtBorderWidth(grip) +
- (pw->paned.internal_bw >> 1);
- changes.y = XtHeight(pw) - pw->paned.grip_indent -
- XtHeight(grip) - (XtBorderWidth(grip) << 1);
- }
- }
-
- /*
- * This should match XtMoveWidget, except that we're also insuring the
- * grip is Raised in the same request
- */
-
- if (HasGrip(*childP)) {
- XtX(grip) = changes.x;
- XtY(grip) = changes.y;
-
- if (XtIsRealized(pane->grip))
- XConfigureWindow(XtDisplay(pane->grip), XtWindow(pane->grip),
- CWX | CWY | CWStackMode, &changes);
- }
- }
- ClearPaneStack(pw);
-}
-
-/*
- * Function:
- * RefigureLocationsAndCommit
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Refigures all locations in a paned widget and commits them immediately.
- *
- * This function does nothing if any of the following are true.
- * o refiguremode is false.
- * o The widget is unrealized.
- * o There are no panes is the paned widget.
- */
-static void
-RefigureLocationsAndCommit(Widget w)
-{
- PanedWidget pw = (PanedWidget)w;
-
- if (pw->paned.refiguremode && XtIsRealized(w) && pw->paned.num_panes > 0) {
- RefigureLocations(pw, NO_INDEX, AnyPane);
- CommitNewLocations(pw);
- }
-}
-
-/*
- * Function:
- * _DrawRect
- *
- * Parameters:
- * pw - paned widget
- * gc - gc to used for the draw
- * on_olc - location of upper left corner of rect
- * off_loc - ""
- * on_size - size of rectangle
- * off_size - ""
- *
- * Description:
- * Draws a rectangle in the proper orientation.
- */
-static void
-_DrawRect(PanedWidget pw, GC gc, int on_loc, int off_loc,
- unsigned int on_size, unsigned int off_size)
-{
- if (IsVert(pw))
- XFillRectangle(XtDisplay((Widget)pw), XtWindow((Widget)pw), gc,
- off_loc, on_loc, off_size, on_size);
- else
- XFillRectangle(XtDisplay((Widget)pw), XtWindow((Widget)pw), gc,
- on_loc, off_loc, on_size, off_size);
-}
-
-/*
- * Function:
- * _DrawInternalBorders
- *
- * Parameters:
- * pw - paned widget
- * gc - GC to use to draw the borders
- *
- * Description:
- * Draws the internal borders into the paned widget.
- */
-static void
-_DrawInternalBorders(PanedWidget pw, GC gc)
-{
- Widget *childP;
- int on_loc, off_loc;
- unsigned int on_size, off_size;
-
- /*
- * This is an optimization. Do not paint the internal borders if
- * they are the same color as the background
- */
- if (pw->core.background_pixel == pw->paned.internal_bp)
- return;
-
- off_loc = 0;
- off_size = (unsigned int) PaneSize((Widget)pw, !IsVert(pw));
- on_size = (unsigned int)pw->paned.internal_bw;
-
- ForAllPanes(pw, childP) {
- on_loc = IsVert(pw) ? XtY(*childP) : XtX(*childP);
- on_loc -= (int)on_size;
-
- _DrawRect(pw, gc, on_loc, off_loc, on_size, off_size);
- }
-}
-
-#define DrawInternalBorders(pw) \
- _DrawInternalBorders((pw), (pw)->paned.normgc)
-#define EraseInternalBorders(pw) \
- _DrawInternalBorders((pw), (pw)->paned.invgc)
-/*
- * Function Name:
- * _DrawTrackLines
- *
- * Parameters:
- * pw - Paned widget
- * erase - if True then just erase track lines, else draw them in
- *
- * Description:
- * Draws the lines that animate the pane borders when the grips are moved.
- */
-static void
-_DrawTrackLines(PanedWidget pw, Bool erase)
-{
- Widget *childP;
- Pane pane;
- int on_loc, off_loc;
- unsigned int on_size, off_size;
-
- off_loc = 0;
- off_size = PaneSize((Widget)pw, !IsVert(pw));
-
- ForAllPanes(pw, childP) {
- pane = PaneInfo(*childP);
- if (erase || pane->olddelta != pane->delta) {
- on_size = pw->paned.internal_bw;
- if (!erase) {
- on_loc = PaneInfo(*childP)->olddelta - (int) on_size;
- _DrawRect(pw, pw->paned.flipgc,
- on_loc, off_loc, on_size, off_size);
- }
-
- on_loc = PaneInfo(*childP)->delta - (int)on_size;
-
- _DrawRect(pw, pw->paned.flipgc,
- on_loc, off_loc, on_size, off_size);
-
- pane->olddelta = pane->delta;
- }
- }
-}
-
-#define DrawTrackLines(pw) _DrawTrackLines((pw), False);
-#define EraseTrackLines(pw) _DrawTrackLines((pw), True);
-/*
- * Function:
- * GetEventLocation
- *
- * Parameters:
- * pw - the paned widget
- * event - pointer to an event
- *
- * Description:
- * Converts and event to an x and y location.
- *
- * Returns:
- * if this is a vertical pane then (y) else (x)
- */
-static int
-GetEventLocation(PanedWidget pw, XEvent *event)
-{
- int x, y;
-
- switch (event->xany.type) {
- case ButtonPress:
- case ButtonRelease:
- x = event->xbutton.x_root;
- y = event->xbutton.y_root;
- break;
- case KeyPress:
- case KeyRelease:
- x = event->xkey.x_root;
- y = event->xkey.y_root;
- break;
- case MotionNotify:
- x = event->xmotion.x_root;
- y = event->xmotion.y_root;
- break;
- default:
- x = pw->paned.start_loc;
- y = pw->paned.start_loc;
- }
-
- if (IsVert(pw))
- return (y);
-
- return (x);
-}
-
-/*
- * Function:
- * StartGripAdjustment
- *
- * Parameters:
- * pw - paned widget
- * grip - grip widget selected
- * dir - direction that we are to be moving
- *
- * Description:
- * Starts the grip adjustment procedure.
- */
-static void
-StartGripAdjustment(PanedWidget pw, Widget grip, Direction dir)
-{
- Widget *childP;
- Cursor cursor;
-
- pw->paned.whichadd = pw->paned.whichsub = NULL;
-
- if (dir == ThisBorderOnly || dir == UpLeftPane)
- pw->paned.whichadd = pw->composite.children[PaneIndex(grip)];
- if (dir == ThisBorderOnly || dir == LowRightPane)
- pw->paned.whichsub = pw->composite.children[PaneIndex(grip) + 1];
-
- /*
- * Change the cursor
- */
- if (XtIsRealized(grip)) {
- if (IsVert(pw)) {
- if (dir == UpLeftPane)
- cursor = pw->paned.adjust_upper_cursor;
- else if (dir == LowRightPane)
- cursor = pw->paned.adjust_lower_cursor;
- else {
- if (pw->paned.adjust_this_cursor == None)
- cursor = pw->paned.v_adjust_this_cursor;
- else
- cursor = pw->paned.adjust_this_cursor;
- }
- }
- else {
- if (dir == UpLeftPane)
- cursor = pw->paned.adjust_left_cursor;
- else if (dir == LowRightPane)
- cursor = pw->paned.adjust_right_cursor;
- else {
- if (pw->paned.adjust_this_cursor == None)
- cursor = pw->paned.h_adjust_this_cursor;
- else
- cursor = pw->paned.adjust_this_cursor;
- }
- }
-
- XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor);
- }
-
- EraseInternalBorders(pw);
- ForAllPanes(pw, childP)
- PaneInfo(*childP)->olddelta = -99;
-
- EraseTrackLines(pw);
-}
-
-/*
- * Function:
- * MoveGripAdjustment
- *
- * Parameters:
- * pw - paned widget
- * grip - grip that we are moving
- * dir - direction the pane we are interested is w.r.t the grip
- * loc - location of pointer in proper direction
- *
- * Description:
- * This routine moves all panes around when a grip is moved.
- */
-static void
-MoveGripAdjustment(PanedWidget pw, Widget grip, Direction dir, int loc)
-{
- int diff, add_size = 0, sub_size = 0;
-
- diff = loc - pw->paned.start_loc;
-
- if (pw->paned.whichadd)
- add_size = PaneSize(pw->paned.whichadd, IsVert(pw)) + diff;
-
- if (pw->paned.whichsub)
- sub_size = PaneSize(pw->paned.whichsub, IsVert(pw)) - diff;
-
- /*
- * If moving this border only then do not allow either of the borders
- * to go beyond the min or max size allowed
- */
- if (dir == ThisBorderOnly) {
- int old_add_size = add_size, old_sub_size;
-
- AssignMax(add_size, (int)PaneInfo(pw->paned.whichadd)->min);
- AssignMin(add_size, (int)PaneInfo(pw->paned.whichadd)->max);
- if (add_size != old_add_size)
- sub_size += old_add_size - add_size;
-
- old_sub_size = sub_size;
- AssignMax(sub_size, (int)PaneInfo(pw->paned.whichsub)->min);
- AssignMin(sub_size, (int)PaneInfo(pw->paned.whichsub)->max);
- if (sub_size != old_sub_size)
- return; /* Abort to current sizes */
- }
-
- if (add_size != 0)
- PaneInfo(pw->paned.whichadd)->size = add_size;
- if (sub_size != 0)
- PaneInfo(pw->paned.whichsub)->size = sub_size;
- RefigureLocations(pw, PaneIndex(grip), dir);
- DrawTrackLines(pw);
-}
-
-/*
- * Function:
- * CommitGripAdjustment
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Commits the grip adjustment.
- */
-static void
-CommitGripAdjustment(PanedWidget pw)
-{
- EraseTrackLines(pw);
- CommitNewLocations(pw);
- DrawInternalBorders(pw);
-
- /*
- * Since the user selected this size then use it as the preferred size
- */
- if (pw->paned.whichadd) {
- Pane pane = PaneInfo(pw->paned.whichadd);
-
- pane->wp_size = pane->size;
- }
- if (pw->paned.whichsub) {
- Pane pane = PaneInfo(pw->paned.whichsub);
-
- pane->wp_size = pane->size;
- }
-}
-
-/*
- * Function:
- * HandleGrip
- *
- * Parameters:
- * grip - grip widget that has been moved
- * temp - (not used)
- * call_data - data passed to us from the grip widget
- *
- * Description:
- * Handles the grip manipulations.
- */
-/*ARGSUSED*/
-static void
-HandleGrip(Widget grip, XtPointer temp, XtPointer callData)
-{
- XawGripCallData call_data = (XawGripCallData)callData;
- PanedWidget pw = (PanedWidget) XtParent(grip);
- int loc;
- char action_type[2], direction[2];
- Cursor cursor;
- Arg arglist[1];
-
- if (call_data->num_params)
- XmuNCopyISOLatin1Uppered(action_type, call_data->params[0],
- sizeof(action_type));
-
- if (call_data->num_params == 0
- || (action_type[0] == 'C' && call_data->num_params != 1)
- || (action_type[0] != 'C' && call_data->num_params != 2))
- XtAppError(XtWidgetToApplicationContext(grip),
- "Paned GripAction has been passed incorrect parameters.");
-
- loc = GetEventLocation(pw, (XEvent *)call_data->event);
-
- if (action_type[0] != 'C')
- XmuNCopyISOLatin1Uppered(direction, call_data->params[1],
- sizeof(direction));
-
- switch (action_type[0]) {
- case 'S': /* Start adjustment */
- pw->paned.resize_children_to_pref = False;
- StartGripAdjustment(pw, grip, (Direction)direction[0]);
- pw->paned.start_loc = loc;
- break;
- case 'M':
- MoveGripAdjustment(pw, grip, (Direction)direction[0], loc);
- break;
- case 'C':
- XtSetArg(arglist[0], XtNcursor, &cursor);
- XtGetValues(grip, arglist, 1);
- XDefineCursor(XtDisplay(grip), XtWindow(grip), cursor);
- CommitGripAdjustment(pw);
- break;
- default:
- XtAppError(XtWidgetToApplicationContext(grip),
- "Paned GripAction(); 1st parameter invalid");
- break;
- }
-}
-
-/*
- * Function:
- * ResortChildren
- *
- * Arguments:
- * pw - paned widget
- *
- * Description:
- * Resorts the children so that all managed children are first.
- */
-static void
-ResortChildren(PanedWidget pw)
-{
- Widget *unmanagedP, *childP;
-
- unmanagedP = NULL;
- ForAllChildren(pw, childP) {
- if (!IsPane(*childP) || !XtIsManaged(*childP)) {
- /*
- * We only keep track of the first unmanaged pane
- */
- if (unmanagedP == NULL)
- unmanagedP = childP;
- }
- else { /* must be a managed pane */
- /*
- * If an earlier widget was not a managed pane, then swap
- */
- if (unmanagedP != NULL) {
- Widget child = *unmanagedP;
-
- *unmanagedP = *childP;
- *childP = child;
- childP = unmanagedP; /* easiest to just back-track */
- unmanagedP = NULL; /* in case there is another managed */
- }
- }
- }
-}
-
-/*
- * Function:
- * ManageAndUnmanageGrips
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * This function manages and unmanages the grips so that
- * the managed state of each grip matches that of its pane.
- */
-static void
-ManageAndUnmanageGrips(PanedWidget pw)
-{
- WidgetList managed_grips, unmanaged_grips;
- Widget *managedP, *unmanagedP, *childP;
- Cardinal alloc_size;
-
- alloc_size = sizeof(Widget) * (pw->composite.num_children >> 1);
- managedP = managed_grips = (WidgetList)XtMalloc(alloc_size);
- unmanagedP = unmanaged_grips = (WidgetList)XtMalloc(alloc_size);
-
- ForAllChildren(pw, childP)
- if (IsPane(*childP) && HasGrip(*childP)) {
- if (XtIsManaged(*childP))
- *managedP++ = PaneInfo(*childP)->grip;
- else
- *unmanagedP++ = PaneInfo(*childP)->grip;
- }
-
- if (managedP != managed_grips) {
- *unmanagedP++ = *--managedP; /* Last grip is never managed */
- XtManageChildren(managed_grips, managedP - managed_grips);
- }
-
- if (unmanagedP != unmanaged_grips)
- XtUnmanageChildren(unmanaged_grips, unmanagedP - unmanaged_grips);
-
- XtFree((char *)managed_grips);
- XtFree((char *)unmanaged_grips);
-}
-
-/*
- * Function:
- * CreateGrip
- *
- * Parameters:
- * child - child that wants a grip to be created for it
- *
- * Description:
- * Creates a grip widget.
- */
-static void
-CreateGrip(Widget child)
-{
- PanedWidget pw = (PanedWidget)XtParent(child);
- Arg arglist[2];
- Cardinal num_args = 0;
- Cursor cursor;
-
- XtSetArg(arglist[num_args], XtNtranslations, pw->paned.grip_translations);
- num_args++;
- if ((cursor = pw->paned.grip_cursor) == None)
- if (IsVert(pw))
- cursor = pw->paned.v_grip_cursor;
- else
- cursor = pw->paned.h_grip_cursor;
-
- XtSetArg(arglist[num_args], XtNcursor, cursor);
- num_args++;
- PaneInfo(child)->grip = XtCreateWidget("grip", gripWidgetClass, (Widget)pw,
- arglist, num_args);
-
- XtAddCallback(PaneInfo(child)->grip, XtNcallback,
- HandleGrip, (XtPointer)child);
-}
-
-/*
- * Function:
- * GetGCs
- *
- * Parameters:
- * w - paned widget
- */
-static void
-GetGCs(Widget w)
-{
- PanedWidget pw = (PanedWidget)w;
- XtGCMask valuemask;
- XGCValues values;
-
- /*
- * Draw pane borders in internal border color
- */
- values.foreground = pw->paned.internal_bp;
- valuemask = GCForeground;
- pw->paned.normgc = XtGetGC(w, valuemask, &values);
-
- /*
- * Erase pane borders with background color
- */
- values.foreground = pw->core.background_pixel;
- valuemask = GCForeground;
- pw->paned.invgc = XtGetGC(w, valuemask, &values);
-
- /*
- * Draw Track lines (animate pane borders) in
- * internal border color ^ bg color
- */
- values.function = GXinvert;
- values.plane_mask = pw->paned.internal_bp ^ pw->core.background_pixel;
- values.subwindow_mode = IncludeInferiors;
- valuemask = GCPlaneMask | GCFunction | GCSubwindowMode;
- pw->paned.flipgc = XtGetGC(w, valuemask, &values);
-}
-
-/*
- * Function:
- * SetChildrenPrefSizes
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Sets the preferred sizes of the children.
- */
-static void
-SetChildrenPrefSizes(PanedWidget pw, unsigned int off_size)
-{
- Widget *childP;
- Boolean vert = IsVert(pw);
- XtWidgetGeometry request, reply;
-
- ForAllPanes(pw, childP)
- if (pw->paned.resize_children_to_pref || PaneInfo(*childP)->size == 0 ||
- PaneInfo(*childP)->resize_to_pref) {
- if (PaneInfo(*childP)->preferred_size != PANED_ASK_CHILD)
- PaneInfo(*childP)->wp_size = PaneInfo(*childP)->preferred_size;
- else {
- if(vert) {
- request.request_mode = CWWidth;
- request.width = off_size;
- }
- else {
- request.request_mode = CWHeight;
- request.height = off_size;
- }
-
- if ((XtQueryGeometry(*childP, &request, &reply)
- == XtGeometryAlmost)
- && (reply.request_mode = (vert ? CWHeight : CWWidth)))
- PaneInfo(*childP)->wp_size = GetRequestInfo(&reply, vert);
- else
- PaneInfo(*childP)->wp_size = PaneSize(*childP, vert);
- }
-
- PaneInfo(*childP)->size = PaneInfo(*childP)->wp_size;
- }
-}
-
-/*
- * Function:
- * ChangeAllGripCursors
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Changes all the grip cursors.
- */
-static void
-ChangeAllGripCursors(PanedWidget pw)
-{
- Widget *childP;
-
- ForAllPanes(pw, childP) {
- Arg arglist[1];
- Cursor cursor;
-
- if ((cursor = pw->paned.grip_cursor) == None)
- if (IsVert(pw))
- cursor = pw->paned.v_grip_cursor;
- else
- cursor = pw->paned.h_grip_cursor;
-
- if (HasGrip(*childP)) {
- XtSetArg(arglist[0], XtNcursor, cursor);
- XtSetValues(PaneInfo(*childP)->grip, arglist, 1);
- }
- }
-}
-
-/*
- * Function:
- * PushPaneStack
- *
- * Parameters:
- * pw - paned widget
- * pane - pane that we are pushing
- *
- * Description:
- * Pushes a value onto the pane stack.
- */
-static void
-PushPaneStack(PanedWidget pw, Pane pane)
-{
- PaneStack *stack = (PaneStack *)XtMalloc(sizeof(PaneStack));
-
- stack->next = pw->paned.stack;
- stack->pane = pane;
- stack->start_size = pane->size;
-
- pw->paned.stack = stack;
-}
-
-/*
- * Function:
- * GetPaneStack
- *
- * Parameters:
- * pw - paned widget
- * shrink - True if we want to shrink this pane, False otherwise
- * pane - pane that we are popping (return)
- * start_size - size that this pane started at (return)
- *
- * Description:
- * Gets the top value from the pane stack.
- */
-static void
-GetPaneStack(PanedWidget pw, Bool shrink, Pane *pane, int *start_size)
-{
- if (pw->paned.stack == NULL) {
- *pane = NULL;
- return;
- }
-
- *pane = pw->paned.stack->pane;
- *start_size = pw->paned.stack->start_size;
-
- if (shrink != ((*pane)->size > *start_size))
- *pane = NULL;
-}
-
-/*
- * Function:
- * PopPaneStack
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Pops the top item off the pane stack.
- *
- * Returns: True if this is not the last element on the stack
- */
-static Bool
-PopPaneStack(PanedWidget pw)
-{
- PaneStack *stack = pw->paned.stack;
-
- if (stack == NULL)
- return (False);
-
- pw->paned.stack = stack->next;
- XtFree((char *)stack);
-
- if (pw->paned.stack == NULL)
- return (False);
-
- return (True);
-}
-
-/*
- * Function:
- * ClearPaneStack
- *
- * Parameters:
- * pw - paned widget
- *
- * Description:
- * Removes all entries from the pane stack.
- */
-static void
-ClearPaneStack(PanedWidget pw)
-{
- while(PopPaneStack(pw))
- ;
-}
-
-static void
-XawPanedClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation,
- NULL, 0);
- XtSetTypeConverter(XtROrientation, XtRString, XmuCvtOrientationToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/* The Geometry Manager only allows changes after Realize if
- * allow_resize is True in the constraints record.
- *
- * For vertically paned widgets:
- *
- * It only allows height changes, but offers the requested height
- * as a compromise if both width and height changes were requested.
- *
- * For horizontal widgets the converse is true.
- * As all good Geometry Managers should, we will return No if the
- * request will have no effect; i.e. when the requestor is already
- * of the desired geometry.
- */
-static XtGeometryResult
-XawPanedGeometryManager(Widget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- PanedWidget pw = (PanedWidget)XtParent(w);
- XtGeometryMask mask = request->request_mode;
- Dimension old_size, old_wpsize, old_paned_size;
- Pane pane = PaneInfo(w);
- Boolean vert = IsVert(pw);
- Dimension on_size, off_size;
- XtGeometryResult result;
- Boolean almost = False;
-
- /*
- * If any of the following is true, disallow the geometry change
- *
- * o The paned widget is realized and allow_resize is false for the pane
- * o The child did not ask to change the on_size
- * o The request is not a width or height request
- * o The requested size is the same as the current size
- */
-
- if ((XtIsRealized((Widget)pw) && !pane->allow_resize)
- || !(mask & (vert ? CWHeight : CWWidth))
- ||(mask & ~(CWWidth | CWHeight))
- || GetRequestInfo(request, vert) == PaneSize(w, vert))
- return (XtGeometryNo);
-
- old_paned_size = PaneSize((Widget)pw, vert);
- old_wpsize = pane->wp_size;
- old_size = pane->size;
-
- pane->wp_size = pane->size = GetRequestInfo(request, vert);
-
- AdjustPanedSize(pw, PaneSize((Widget)pw, !vert), &result, &on_size,
- &off_size);
-
- /*
- * Fool the Refigure Locations proc to thinking that we are
- * a different on_size
- */
-
- if (result != XtGeometryNo) {
- if (vert)
- XtHeight(pw) = on_size;
- else
- XtWidth(pw) = on_size;
- }
-
- RefigureLocations(pw, PaneIndex(w), AnyPane);
-
- /*
- * Set up reply struct and reset core on_size
- */
- if (vert) {
- XtHeight(pw) = old_paned_size;
- reply->height = pane->size;
- reply->width = off_size;
- }
- else {
- XtWidth(pw) = old_paned_size;
- reply->height = off_size;
- reply->width = pane->size;
- }
-
- /*
- * IF either of the following is true
- *
- * o There was a "off_size" request and the new "off_size" is different
- * from that requested
- * o There was no "off_size" request and the new "off_size" is different
- *
- * o The "on_size" we will allow is different from that requested
- *
- * THEN: set almost
- */
- if (!((vert ? CWWidth : CWHeight) & mask)) {
- if (vert)
- request->width = XtWidth(w);
- else
- request->height = XtHeight(w);
- }
-
- almost = GetRequestInfo(request, !vert) != GetRequestInfo(reply, !vert);
- almost |= (GetRequestInfo(request, vert) != GetRequestInfo(reply, vert));
-
- if ((mask & XtCWQueryOnly) || almost) {
- pane->wp_size = old_wpsize;
- pane->size = old_size;
- RefigureLocations(pw, PaneIndex(w), AnyPane);
- reply->request_mode = CWWidth | CWHeight;
- if (almost)
- return (XtGeometryAlmost);
- }
- else {
- AdjustPanedSize(pw, PaneSize((Widget) pw, !vert), NULL, NULL, NULL);
- CommitNewLocations(pw); /* layout already refigured */
- }
-
- return (XtGeometryDone);
-}
-
-/*ARGSUSED*/
-static void
-XawPanedInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- PanedWidget pw = (PanedWidget)cnew;
-
- GetGCs((Widget)pw);
-
- pw->paned.recursively_called = False;
- pw->paned.stack = NULL;
- pw->paned.resize_children_to_pref = True;
- pw->paned.num_panes = 0;
-}
-
-static void
-XawPanedRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
-{
- PanedWidget pw = (PanedWidget)w;
- Widget *childP;
-
- if ((attributes->cursor = pw->paned.cursor) != None)
- *valueMask |= CWCursor;
-
- (*SuperClass->core_class.realize)(w, valueMask, attributes);
-
- /*
- * Before we commit the new locations we need to realize all the panes and
- * their grips
- */
- ForAllPanes(pw, childP) {
- XtRealizeWidget(*childP);
- if (HasGrip(*childP))
- XtRealizeWidget(PaneInfo(*childP)->grip);
- }
-
- RefigureLocationsAndCommit(w);
- pw->paned.resize_children_to_pref = False;
-}
-
-static void
-XawPanedDestroy(Widget w)
-{
- ReleaseGCs(w);
-}
-
-static void
-ReleaseGCs(Widget w)
-{
- PanedWidget pw = (PanedWidget)w;
-
- XtReleaseGC(w, pw->paned.normgc);
- XtReleaseGC(w, pw->paned.invgc);
- XtReleaseGC(w, pw->paned.flipgc);
-}
-
-static void
-XawPanedInsertChild(Widget w)
-{
- Pane pane = PaneInfo(w);
-
- /* insert the child widget in the composite children list with the
- superclass insert_child routine
- */
- (*SuperClass->composite_class.insert_child)(w);
-
- if (!IsPane(w))
- return;
-
- if (pane->show_grip == True) {
- CreateGrip(w);
- if (pane->min == PANED_GRIP_SIZE)
- pane->min = PaneSize(pane->grip, IsVert((PanedWidget)XtParent(w)));
- }
- else {
- if (pane->min == PANED_GRIP_SIZE)
- pane->min = 1;
- pane->grip = NULL;
- }
-
- pane->size = 0;
- pane->paned_adjusted_me = False;
-}
-
-static void
-XawPanedDeleteChild(Widget w)
-{
- /* remove the subwidget info and destroy the grip */
- if (IsPane(w) && HasGrip(w))
- XtDestroyWidget(PaneInfo(w)->grip);
-
- /* delete the child widget in the composite children list with the
- superclass delete_child routine
- */
- (*SuperClass->composite_class.delete_child)(w);
-}
-
-static void
-XawPanedChangeManaged(Widget w)
-{
- PanedWidget pw = (PanedWidget)w;
- Boolean vert = IsVert(pw);
- Dimension size;
- Widget *childP;
-
- if (pw->paned.recursively_called++)
- return;
-
- /*
- * If the size is zero then set it to the size of the widest or tallest pane
- */
-
- if ((size = PaneSize((Widget)pw, !vert)) == 0) {
- size = 1;
- ForAllChildren(pw, childP)
- if (XtIsManaged(*childP) && (PaneSize(*childP, !vert) > size))
- size = PaneSize(*childP, !vert);
- }
-
- ManageAndUnmanageGrips(pw);
- pw->paned.recursively_called = False;
- ResortChildren(pw);
-
- pw->paned.num_panes = 0;
- ForAllChildren(pw, childP)
- if (IsPane(*childP)) {
- if (XtIsManaged(*childP)) {
- Pane pane = PaneInfo(*childP);
-
- if (HasGrip(*childP))
- PaneInfo(pane->grip)->position = pw->paned.num_panes;
- pane->position = pw->paned.num_panes; /* TEMPORY -CDP 3/89 */
- pw->paned.num_panes++;
- }
- else
- break; /* This list is already sorted */
- }
-
- SetChildrenPrefSizes((PanedWidget) w, size);
-
- /*
- * ForAllPanes can now be used
- */
- if (PaneSize((Widget) pw, vert) == 0)
- AdjustPanedSize(pw, size, NULL, NULL, NULL);
-
- if (XtIsRealized((Widget)pw))
- RefigureLocationsAndCommit((Widget)pw);
-}
-
-static void
-XawPanedResize(Widget w)
-{
- SetChildrenPrefSizes((PanedWidget)w,
- PaneSize(w, !IsVert((PanedWidget)w)));
- RefigureLocationsAndCommit(w);
-}
-
-/*ARGSUSED*/
-static void
-XawPanedRedisplay(Widget w, XEvent *event, Region region)
-{
- DrawInternalBorders((PanedWidget)w);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawPanedSetValues(Widget old, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- PanedWidget old_pw = (PanedWidget)old;
- PanedWidget new_pw = (PanedWidget)cnew;
- Boolean redisplay = False;
-
- if ((old_pw->paned.cursor != new_pw->paned.cursor) && XtIsRealized(cnew))
- XDefineCursor(XtDisplay(cnew), XtWindow(cnew), new_pw->paned.cursor);
-
- if (old_pw->paned.internal_bp != new_pw->paned.internal_bp ||
- old_pw->core.background_pixel != new_pw->core.background_pixel) {
- ReleaseGCs(old);
- GetGCs(cnew);
- redisplay = True;
- }
-
- if (old_pw->paned.grip_cursor != new_pw->paned.grip_cursor ||
- old_pw->paned.v_grip_cursor != new_pw->paned.v_grip_cursor ||
- old_pw->paned.h_grip_cursor != new_pw->paned.h_grip_cursor)
- ChangeAllGripCursors(new_pw);
-
- if (IsVert(old_pw) != IsVert(new_pw)) {
- /*
- * We are fooling the paned widget into thinking that is needs to
- * fully refigure everything, which is what we want
- */
- if (IsVert(new_pw))
- XtWidth(new_pw) = 0;
- else
- XtHeight(new_pw) = 0;
-
- new_pw->paned.resize_children_to_pref = True;
- XawPanedChangeManaged(cnew); /* Seems weird, but does the right thing */
- new_pw->paned.resize_children_to_pref = False;
- if (new_pw->paned.grip_cursor == None)
- ChangeAllGripCursors(new_pw);
- return (True);
- }
-
- if (old_pw->paned.internal_bw != new_pw->paned.internal_bw) {
- AdjustPanedSize(new_pw, PaneSize(cnew, !IsVert(old_pw)),
- NULL, NULL, NULL);
- RefigureLocationsAndCommit(cnew);
- return (True); /* We have done a full configuration, return */
- }
-
- if (old_pw->paned.grip_indent != new_pw->paned.grip_indent &&
- XtIsRealized(cnew)) {
- CommitNewLocations(new_pw);
- redisplay = True;
- }
-
- return (redisplay);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawPanedPaneSetValues(Widget old, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- Pane old_pane = PaneInfo(old);
- Pane new_pane = PaneInfo(cnew);
- Boolean redisplay = False;
-
- /* Check for new min and max */
- if (old_pane->min != new_pane->min || old_pane->max != new_pane->max)
- XawPanedSetMinMax(cnew, (int)new_pane->min, (int)new_pane->max);
-
- /* Check for change in XtNshowGrip */
- if (old_pane->show_grip != new_pane->show_grip) {
- if (new_pane->show_grip == True) {
- CreateGrip(cnew);
- if (XtIsRealized(XtParent(cnew))) {
- if (XtIsManaged(cnew)) /* if paned is unrealized this will
- happen automatically at realize time
- */
- XtManageChild(PaneInfo(cnew)->grip); /* manage the grip */
- XtRealizeWidget(PaneInfo(cnew)->grip); /* realize the grip */
- CommitNewLocations((PanedWidget)XtParent(cnew));
- }
- }
- else if (HasGrip(old)) {
- XtDestroyWidget(old_pane->grip);
- new_pane->grip = NULL;
- redisplay = True;
- }
- }
-
- return (redisplay);
-}
-
-/*
- * Public routines
- */
-/*
- * Function:
- * XawPanedSetMinMax
- *
- * Parameters:
- * widget - widget that is a child of the Paned widget
- * min - new min and max size for the pane
- * max - ""
- *
- * Description:
- * Sets the min and max size for a pane.
- */
-void
-XawPanedSetMinMax(Widget widget, int min, int max)
-{
- Pane pane = PaneInfo(widget);
-
- pane->min = min;
- pane->max = max;
- RefigureLocationsAndCommit(widget->core.parent);
-}
-
-/*
- * Function:
- * XawPanedGetMinMax
- *
- * Parameters:
- * widget - widget that is a child of the Paned widget
- * min - current min and max size for the pane (return)
- * max - ""
- *
- * Description:
- * Gets the min and max size for a pane.
- */
-void
-XawPanedGetMinMax(Widget widget, int *min, int *max)
-{
- Pane pane = PaneInfo(widget);
-
- *min = pane->min;
- *max = pane->max;
-}
-
-/*
- * Function:
- * XawPanedSetRefigureMode
- *
- * Parameters:
- * w - paned widget
- * mode - if False then inhibit refigure
- *
- * Description:
- * Allows a flag to be set the will inhibit
- * the paned widgets relayout routine.
- */
-void
-XawPanedSetRefigureMode(Widget w,
-#if NeedWidePrototypes
- int mode
-#else
- Boolean mode
-#endif
-)
-{
- ((PanedWidget)w)->paned.refiguremode = mode;
- RefigureLocationsAndCommit(w);
-}
-
-/*
- * Function:
- * XawPanedGetNumSub
- *
- * Parameters:
- * w - paned widget
- *
- * Description:
- * Returns the number of panes in the paned widget.
- * Returns:
- * the number of panes in the paned widget
- */
-int
-XawPanedGetNumSub(Widget w)
-{
- return (((PanedWidget)w)->paned.num_panes);
-}
-
-/*
- * Function:
- * XawPanedAllowResize
- *
- * Parameters:
- * widget - child of the paned widget
- *
- * Description:
- * Allows a flag to be set that determines if the paned
- * widget will allow geometry requests from this child.
- */
-void
-XawPanedAllowResize(Widget widget,
-#if NeedWidePrototypes
- int allow_resize
-#else
- Boolean allow_resize
-#endif
-)
-{
- PaneInfo(widget)->allow_resize = allow_resize;
-}
diff --git a/xc/lib/Xaw/Paned.h b/xc/lib/Xaw/Paned.h
deleted file mode 100644
index aa6763b5e..000000000
--- a/xc/lib/Xaw/Paned.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
-* $TOG: Paned.h /main/17 1998/02/11 14:54:05 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Paned.h,v 1.5 1999/05/03 12:15:42 dawes Exp $ */
-
-/*
- * Paned.h - Paned Composite Widget's public header file.
- *
- * Updated and significantly modifided from the Athena VPaned Widget.
- *
- * Date: March 1, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _XawPaned_h
-#define _XawPaned_h
-
-#include <X11/Constraint.h>
-#include <X11/Xmu/Converters.h>
-
-/* RESOURCES:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- betweenCursor Cursor Cursor **
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- cursor Cursor Cursor None
- destroyCallback Callback Pointer NULL
- height Height Dimension 0
- gripIndent GripIndent Position 16
- gripCursor Cursor Cursor **
- horizontalGripCursol Cursor Cursor sb_h_double_arrow
- horizontalBetweencursor Cursor Cursor sb_up_arrow
- internalBorderColor BorderColor Pixel XtDefaultForeground
- internalBorderWidth BorderWidth Position 1
- leftCursor Cursor Cursor sb_left_arrow
- lowerCursor Cursor Cursor sb_down_arrow
- mappedWhenManaged MappedWhenManaged Boolean True
- orientation Orientation XtOrientation XtorientVertical
- refigureMode Boolean Boolean On
- rightCursor Cursor Cursor sb_right_arrow
- sensitive Sensitive Boolean True
- upperCursor Cursor Cursor sb_up_arrow
- verticalBetweenCursor Cursor Cursor sb_left_arrow
- verticalGripCursor Cursor Cursor sb_v_double_arrow
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-** These resources now are set to the vertical or horizontal cursor
- depending upon orientation, by default. If a value is specified here
- then that cursor will be used reguardless of orientation.
-
-
-CONSTRAINT RESOURCES:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- allowResize Boolean Boolean False
- max Max Dimension unlimited
- min Min Dimension Grip Size
- preferredPaneSize PreferredPaneSize Dimension PANED_ASK_CHILD
- resizeToPreferred Boolean Boolean False
- showGrip ShowGrip Boolean True
- skipAdjust Boolean Boolean False
-
-*/
-
-#define PANED_ASK_CHILD 0
-#define PANED_GRIP_SIZE 0
-
-#define XtNallowResize "allowResize"
-#define XtNbetweenCursor "betweenCursor"
-#define XtNverticalBetweenCursor "verticalBetweenCursor"
-#define XtNhorizontalBetweenCursor "horizontalBetweenCursor"
-#define XtNgripCursor "gripCursor"
-#define XtNgripIndent "gripIndent"
-#define XtNhorizontalGripCursor "horizontalGripCursor"
-#define XtNinternalBorderColor "internalBorderColor"
-#define XtNinternalBorderWidth "internalBorderWidth"
-#define XtNleftCursor "leftCursor"
-#define XtNlowerCursor "lowerCursor"
-#define XtNrefigureMode "refigureMode"
-#define XtNposition "position"
-#define XtNmin "min"
-#define XtNmax "max"
-#define XtNpreferredPaneSize "preferredPaneSize"
-#define XtNresizeToPreferred "resizeToPreferred"
-#define XtNrightCursor "rightCursor"
-#define XtNshowGrip "showGrip"
-#define XtNskipAdjust "skipAdjust"
-#define XtNupperCursor "upperCursor"
-#define XtNverticalGripCursor "verticalGripCursor"
-
-#define XtCGripIndent "GripIndent"
-#define XtCMin "Min"
-#define XtCMax "Max"
-#define XtCPreferredPaneSize "PreferredPaneSize"
-#define XtCShowGrip "ShowGrip"
-
-/* Class record constant */
-extern WidgetClass panedWidgetClass;
-
-typedef struct _PanedClassRec *PanedWidgetClass;
-typedef struct _PanedRec *PanedWidget;
-
-/*
- * Public Procedures
- */
-
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawPanedSetMinMax
- *
- * Parameters:
- * widget - widget that is a child of the Paned widget
- * min - new min and max size for the pane
- * max - ""
- *
- * Description:
- * Sets the min and max size for a pane.
- */
-void XawPanedSetMinMax
-(
- Widget w,
- int min,
- int max
- );
-
-/*
- * Function:
- * XawPanedGetMinMax
- *
- * Parameters:
- * widget - widget that is a child of the Paned widget
- * min - return the current min and max size for the pane
- * max - ""
- *
- * Description:
- * Gets the min and max size for a pane.
- */
-void XawPanedGetMinMax
-(
- Widget w,
- int *min_return,
- int *max_return
- );
-
-/*
- * Function:
- * XawPanedSetRefigureMode
- *
- * Parameters:
- * w - paned widget
- * mode - if False then inhibit refigure
- *
- * Description:
- * Allows a flag to be set the will inhibit the paned widgets
- * relayout routine.
- */
-void XawPanedSetRefigureMode
-(
- Widget w,
-#if NeedWidePrototypes
- int mode
-#else
- Boolean mode
-#endif
- );
-
-/*
- * Function:
- * XawPanedGetNumSub
- *
- * Parameters:
- * w - paned widget
- *
- * Returns:
- * Number of panes in the paned widget.
- */
-int XawPanedGetNumSub
-(
- Widget w
- );
-
-/*
- * Function:
- * XawPanedAllowResize
- *
- * Parameters:
- * widget - child of the paned widget
- *
- * Description:
- * Allows a flag to be set that determines if the paned widget will
- * allow geometry requests from this child
- */
-void XawPanedAllowResize
-(
- Widget w,
-#if NeedWidePrototypes
- int allow_resize
-#else
- Boolean allow_resize
-#endif
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawPaned_h */
diff --git a/xc/lib/Xaw/PanedP.h b/xc/lib/Xaw/PanedP.h
deleted file mode 100644
index 9a4ea3236..000000000
--- a/xc/lib/Xaw/PanedP.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/***********************************************************
-
- $TOG: PanedP.h /main/8 1998/02/11 14:53:55 kaleb $
-
-
-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 1987, 1988 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/lib/Xaw/PanedP.h,v 1.6 1999/06/20 08:41:04 dawes Exp $ */
-
-/*
- * Updated and significantly modified from the Athena VPaned Widget.
- *
- * Date: March 1, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _XawPanedP_h
-#define _XawPanedP_h
-
-#include <X11/Xaw/Paned.h>
-
-/* New fields for the Paned widget class record */
-typedef struct _PanedClassPart {
- XtPointer extension;
-} PanedClassPart;
-
-/* Full Class record declaration */
-typedef struct _PanedClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
- PanedClassPart paned_class;
-} PanedClassRec;
-
-extern PanedClassRec panedClassRec;
-
-/* Paned constraint record */
-typedef struct _PanedConstraintsPart {
- /* Resources */
- Dimension min; /* Minimum height */
- Dimension max; /* Maximum height */
- Boolean allow_resize; /* True if child resize requests are ok */
- Boolean show_grip; /* True if child will have grip below it,
- when it is not the bottom pane */
- Boolean skip_adjust; /* True if child's height should not be
- changed without explicit user action */
- int position; /* position location in Paned (relative to
- other children) ** NIY ** */
- Dimension preferred_size; /* The Preferred size of the pane.
- If this is zero then ask child for size*/
- Boolean resize_to_pref; /* resize this pane to its preferred size
- on a resize or change managed after
- realize */
-
- /* Private state */
- Position delta; /* Desired Location */
- Position olddelta; /* The last value of dy */
- Boolean paned_adjusted_me; /* Has the vpaned adjusted this widget w/o
- user interaction to make things fit? */
- Dimension wp_size; /* widget's preferred size */
- int size; /* the size the widget will actually get */
- Widget grip; /* The grip for this child */
-} PanedConstraintsPart, *Pane;
-
-typedef struct _PanedConstraintsRec {
- PanedConstraintsPart paned;
-} PanedConstraintsRec, *PanedConstraints;
-
-/*
- * The Pane Stack Structure
- */
-typedef struct _PaneStack {
- struct _PaneStack *next; /* The next element on the stack */
- Pane pane; /* The pane in this element on the stack */
- int start_size; /* The size of this element when it
- was pushed onto the stack */
-} PaneStack;
-
-/* New Fields for the Paned widget record */
-typedef struct {
- /* resources */
- Position grip_indent; /* Location of grips (offset
- from right margin) */
- Boolean refiguremode; /* Whether to refigure changes
- right now */
- XtTranslations grip_translations; /* grip translation table */
- Pixel internal_bp; /* color of internal borders */
- Dimension internal_bw; /* internal border width */
- XtOrientation orientation; /* Orientation of paned widget */
-
- Cursor cursor; /* Cursor for paned window */
- Cursor grip_cursor; /* inactive grip cursor */
- Cursor v_grip_cursor; /* inactive vert grip cursor */
- Cursor h_grip_cursor; /* inactive horiz grip cursor */
- Cursor adjust_this_cursor; /* active grip cursor: T */
- Cursor v_adjust_this_cursor; /* active vert grip cursor: T */
- Cursor h_adjust_this_cursor; /* active horiz grip cursor: T */
-
- /* vertical */
- Cursor adjust_upper_cursor; /* active grip cursor: U */
- Cursor adjust_lower_cursor; /* active grip cursor: D */
-
- /* horizontal */
- Cursor adjust_left_cursor; /* active grip cursor: U */
- Cursor adjust_right_cursor; /* active grip cursor: D */
-
- /* private */
- Boolean recursively_called; /* for ChangeManaged */
- Boolean resize_children_to_pref; /* override constrain resources
- and resize all children to
- preferred size */
- int start_loc; /* mouse origin when adjusting */
- Widget whichadd; /* Which pane to add changes to */
- Widget whichsub; /* Which pane to sub changes from */
- GC normgc; /* GC to use when drawing borders */
- GC invgc; /* GC to use when erasing borders */
- GC flipgc; /* GC to use when animating borders */
- int num_panes; /* count of managed panes */
- PaneStack *stack; /* The pane stack for this widget */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} PanedPart;
-
-/*
- * Full instance record declaration
- */
-typedef struct _PanedRec {
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
- PanedPart paned;
-} PanedRec;
-
-#endif /* _XawPanedP_h */
diff --git a/xc/lib/Xaw/Panner.c b/xc/lib/Xaw/Panner.c
deleted file mode 100644
index 6be4ac896..000000000
--- a/xc/lib/Xaw/Panner.c
+++ /dev/null
@@ -1,1077 +0,0 @@
-/*
- * $TOG: Panner.c /main/54 1998/02/11 14:54:13 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.
- *
- * Author: Jim Fulton, MIT X Consortium
- */
-
-/* $XFree86: xc/lib/Xaw/Panner.c,v 3.5 1999/06/06 08:48:02 dawes Exp $ */
-
-#include <ctype.h>
-#include <math.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/PannerP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#if defined(ISC) && __STDC__ && !defined(ISC30)
-extern double atof(char *);
-#else
-#if !defined(X_NOT_STDC_ENV) || defined(SCO)
-#include <stdlib.h> /* for atof() */
-#endif
-#endif
-
-/*
- * Class Methods
- */
-static void XawPannerDestroy(Widget);
-static void XawPannerInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawPannerQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawPannerRealize(Widget, XtValueMask*, XSetWindowAttributes*);
-static void XawPannerRedisplay(Widget, XEvent*, Region);
-static void XawPannerResize(Widget);
-static Boolean XawPannerSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-static void XawPannerSetValuesAlmost(Widget, Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-
-/*
- * Prototypes
- */
-static void check_knob(PannerWidget, Bool);
-static void get_default_size(PannerWidget, Dimension*, Dimension*);
-static Bool get_event_xy(PannerWidget, XEvent*, int*, int*);
-static void move_shadow(PannerWidget);
-static int parse_page_string(char*, int, int, Bool*);
-static void rescale(PannerWidget);
-static void reset_shadow_gc(PannerWidget);
-static void reset_slider_gc(PannerWidget);
-static void reset_xor_gc(PannerWidget);
-static void scale_knob(PannerWidget, Bool, Bool);
-
-/*
- * Actions
- */
-static void ActionAbort(Widget, XEvent*, String*, Cardinal*);
-static void ActionMove(Widget, XEvent*, String*, Cardinal*);
-static void ActionNotify(Widget, XEvent*, String*, Cardinal*);
-static void ActionPage(Widget, XEvent*, String*, Cardinal*);
-static void ActionSet(Widget, XEvent*, String*, Cardinal*);
-static void ActionStart(Widget, XEvent*, String*, Cardinal*);
-static void ActionStop(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * From Xmu/Distinct.c
- */
-Bool XmuDistinguishablePixels(Display*, Colormap, unsigned long*, int);
-
-/*
- * Initialization
- */
-static char defaultTranslations[] =
-"<Btn1Down>:" "start()\n"
-"<Btn1Motion>:" "move()\n"
-"<Btn1Up>:" "notify() stop()\n"
-"<Btn2Down>:" "abort()\n"
-":<Key>KP_Enter:" "set(rubberband,toggle)\n"
-"<Key>space:" "page(+1p,+1p)\n"
-"<Key>Delete:" "page(-1p,-1p)\n"
-":<Key>KP_Delete:" "page(-1p,-1p)\n"
-"<Key>BackSpace:" "page(-1p,-1p)\n"
-"<Key>Left:" "page(-.5p,+0)\n"
-":<Key>KP_Left:" "page(-.5p,+0)\n"
-"<Key>Right:" "page(+.5p,+0)\n"
-":<Key>KP_Right:" "page(+.5p,+0)\n"
-"<Key>Up:" "page(+0,-.5p)\n"
-":<Key>KP_Up:" "page(+0,-.5p)\n"
-"<Key>Down:" "page(+0,+.5p)\n"
-":<Key>KP_Down:" "page(+0,+.5p)\n"
-"<Key>Home:" "page(0,0)\n"
-":<Key>KP_Home:" "page(0,0)\n"
-;
-
-static XtActionsRec actions[] = {
- {"start", ActionStart}, /* start tmp graphics */
- {"stop", ActionStop}, /* stop tmp graphics */
- {"abort", ActionAbort}, /* punt */
- {"move", ActionMove}, /* move tmp graphics on Motion event */
- {"page", ActionPage}, /* page around usually from keyboard */
- {"notify", ActionNotify}, /* callback new position */
- {"set", ActionSet}, /* set various parameters */
-};
-
-#define offset(field) XtOffsetOf(PannerRec, panner.field)
-static XtResource resources[] = {
- {
- XtNallowOff,
- XtCAllowOff,
- XtRBoolean,
- sizeof(Boolean),
- offset(allow_off),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNresize,
- XtCResize,
- XtRBoolean,
- sizeof(Boolean),
- offset(resize_to_pref),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNreportCallback,
- XtCReportCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(report_callbacks),
- XtRCallback,
- NULL
- },
- {
- XtNdefaultScale,
- XtCDefaultScale,
- XtRDimension,
- sizeof(Dimension),
- offset(default_scale),
- XtRImmediate,
- (XtPointer)PANNER_DEFAULT_SCALE
- },
- {
- XtNrubberBand,
- XtCRubberBand,
- XtRBoolean,
- sizeof(Boolean),
- offset(rubber_band),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(foreground),
- XtRString,
- (XtPointer)XtDefaultBackground
- },
- {
- XtNinternalSpace,
- XtCInternalSpace,
- XtRDimension,
- sizeof(Dimension),
- offset(internal_border),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNlineWidth,
- XtCLineWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(line_width),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNcanvasWidth,
- XtCCanvasWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(canvas_width),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNcanvasHeight,
- XtCCanvasHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(canvas_height),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNsliderX,
- XtCSliderX,
- XtRPosition,
- sizeof(Position),
- offset(slider_x),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNsliderY,
- XtCSliderY,
- XtRPosition,
- sizeof(Position),
- offset(slider_y),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNsliderWidth,
- XtCSliderWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(slider_width),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNsliderHeight,
- XtCSliderHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(slider_height),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNshadowColor,
- XtCShadowColor,
- XtRPixel,
- sizeof(Pixel),
- offset(shadow_color),
- XtRString,
- (XtPointer)XtDefaultForeground
- },
- {
- XtNshadowThickness,
- XtCShadowThickness,
- XtRDimension,
- sizeof(Dimension),
- offset(shadow_thickness),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNbackgroundStipple,
- XtCBackgroundStipple,
- XtRString,
- sizeof(String),
- offset(stipple_name),
- XtRImmediate,
- NULL
- },
-};
-#undef offset
-
-#define Superclass (&simpleClassRec)
-PannerClassRec pannerClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Panner", /* class_name */
- sizeof(PannerRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawPannerInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawPannerRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawPannerDestroy, /* destroy */
- XawPannerResize, /* resize */
- XawPannerRedisplay, /* expose */
- XawPannerSetValues, /* set_values */
- NULL, /* set_values_hook */
- XawPannerSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XawPannerQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* panner */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec;
-
-
-/*
- * Implementation
- */
-static void
-reset_shadow_gc(PannerWidget pw)
-{
- XtGCMask valuemask = GCForeground;
- XGCValues values;
- unsigned long pixels[3];
-
- if (pw->panner.shadow_gc)
- XtReleaseGC((Widget)pw, pw->panner.shadow_gc);
-
- pixels[0] = pw->panner.foreground;
- pixels[1] = pw->core.background_pixel;
- pixels[2] = pw->panner.shadow_color;
-
- if (!pw->panner.stipple_name &&
- !XmuDistinguishablePixels(XtDisplay(pw), pw->core.colormap,
- pixels, 3) &&
- XmuDistinguishablePixels(XtDisplay(pw), pw->core.colormap,
- pixels, 2)) {
- valuemask = GCTile | GCFillStyle;
- values.fill_style = FillTiled;
- values.tile = XmuCreateStippledPixmap(XtScreen((Widget)pw),
- pw->panner.foreground,
- pw->core.background_pixel,
- pw->core.depth);
- }
- else {
- if (!pw->panner.line_width &&
- !XmuDistinguishablePixels(XtDisplay(pw), pw->core.colormap,
- pixels, 2))
- pw->panner.line_width = 1;
- valuemask = GCForeground;
- values.foreground = pw->panner.shadow_color;
- }
- if (pw->panner.line_width > 0) {
- values.line_width = pw->panner.line_width;
- valuemask |= GCLineWidth;
- }
-
- pw->panner.shadow_gc = XtGetGC((Widget)pw, valuemask, &values);
-}
-
-static void
-reset_slider_gc(PannerWidget pw)
-{
- XtGCMask valuemask = GCForeground;
- XGCValues values;
-
- if (pw->panner.slider_gc)
- XtReleaseGC((Widget)pw, pw->panner.slider_gc);
-
- values.foreground = pw->panner.foreground;
-
- pw->panner.slider_gc = XtGetGC((Widget)pw, valuemask, &values);
-}
-
-static void
-reset_xor_gc(PannerWidget pw)
-{
- if (pw->panner.xor_gc)
- XtReleaseGC((Widget)pw, pw->panner.xor_gc);
-
- if (pw->panner.rubber_band) {
- XtGCMask valuemask = (GCForeground | GCFunction);
- XGCValues values;
- Pixel tmp;
-
- tmp = (pw->panner.foreground == pw->core.background_pixel ?
- pw->panner.shadow_color : pw->panner.foreground);
- values.foreground = tmp ^ pw->core.background_pixel;
- values.function = GXxor;
- if (pw->panner.line_width > 0) {
- valuemask |= GCLineWidth;
- values.line_width = pw->panner.line_width;
- }
- pw->panner.xor_gc = XtGetGC((Widget)pw, valuemask, &values);
- }
- else
- pw->panner.xor_gc = NULL;
-}
-
-static void
-check_knob(PannerWidget pw, Bool knob)
-{
- Position pad = pw->panner.internal_border << 1;
- Position maxx = (Position)XtWidth(pw) - pad -
- (Position)pw->panner.knob_width;
- Position maxy = (Position)XtHeight(pw) - pad -
- (Position)pw->panner.knob_height;
- Position *x = knob ? &pw->panner.knob_x : &pw->panner.tmp.x;
- Position *y = knob ? &pw->panner.knob_y : &pw->panner.tmp.y;
-
- /*
- * note that positions are already normalized (i.e. internal_border
- * has been subtracted out)
- */
- if (*x < 0)
- *x = 0;
- if (*x > maxx)
- *x = maxx;
-
- if (*y < 0)
- *y = 0;
- if (*y > maxy)
- *y = maxy;
-
- if (knob) {
- pw->panner.slider_x = (Position)((double)pw->panner.knob_x
- / pw->panner.haspect + 0.5);
- pw->panner.slider_y = (Position)((double)pw->panner.knob_y
- / pw->panner.vaspect + 0.5);
- pw->panner.last_x = pw->panner.last_y = PANNER_OUTOFRANGE;
- }
-}
-
-static void
-move_shadow(PannerWidget pw)
-{
- if (pw->panner.shadow_thickness > 0) {
- int lw = pw->panner.shadow_thickness + (pw->panner.line_width << 1);
- int pad = pw->panner.internal_border;
-
- if (pw->panner.knob_height > lw && pw->panner.knob_width > lw) {
- XRectangle *r = pw->panner.shadow_rects;
-
- r->x = pw->panner.knob_x + pad + pw->panner.knob_width;
- r->y = pw->panner.knob_y + pad + lw;
- r->width = pw->panner.shadow_thickness;
- r->height = pw->panner.knob_height - lw;
- r++;
- r->x = pw->panner.knob_x + pad + lw;
- r->y = pw->panner.knob_y + pad + pw->panner.knob_height;
- r->width = pw->panner.knob_width - lw + pw->panner.shadow_thickness;
- r->height = pw->panner.shadow_thickness;
- pw->panner.shadow_valid = True;
- return;
- }
- }
- pw->panner.shadow_valid = False;
-}
-
-static void
-scale_knob(PannerWidget pw, Bool location, Bool size)
-{
- if (location) {
- pw->panner.knob_x = (Position)PANNER_HSCALE(pw, pw->panner.slider_x);
- pw->panner.knob_y = (Position)PANNER_VSCALE(pw, pw->panner.slider_y);
- }
- if (size) {
- Dimension width, height;
-
- if (pw->panner.slider_width < 1)
- pw->panner.slider_width = pw->panner.canvas_width;
- if (pw->panner.slider_height < 1)
- pw->panner.slider_height = pw->panner.canvas_height;
- width = Min(pw->panner.slider_width, pw->panner.canvas_width);
- height = Min(pw->panner.slider_height, pw->panner.canvas_height);
-
- pw->panner.knob_width = (Dimension)PANNER_HSCALE(pw, width);
- pw->panner.knob_height = (Dimension)PANNER_VSCALE(pw, height);
- }
- if (!pw->panner.allow_off)
- check_knob(pw, True);
- move_shadow(pw);
-}
-
-static void
-rescale(PannerWidget pw)
-{
- int hpad = pw->panner.internal_border << 1;
- int vpad = hpad;
-
- if (pw->panner.canvas_width < 1)
- pw->panner.canvas_width = XtWidth(pw);
- if (pw->panner.canvas_height < 1)
- pw->panner.canvas_height = XtHeight(pw);
-
- if (XtWidth(pw) <= hpad)
- hpad = 0;
- if (XtHeight(pw) <= vpad)
- vpad = 0;
-
- pw->panner.haspect = ((double)XtWidth(pw) - hpad)
- / (double)pw->panner.canvas_width;
- pw->panner.vaspect = ((double)XtHeight(pw) - vpad)
- / (double)pw->panner.canvas_height;
- scale_knob(pw, True, True);
-}
-
-static void
-get_default_size(PannerWidget pw, Dimension *wp, Dimension *hp)
-{
- Dimension pad = pw->panner.internal_border << 1;
-
- *wp = PANNER_DSCALE(pw, pw->panner.canvas_width) + pad;
- *hp = PANNER_DSCALE(pw, pw->panner.canvas_height) + pad;
-}
-
-static Bool
-get_event_xy(PannerWidget pw, XEvent *event, int *x, int *y)
-{
- int pad = pw->panner.internal_border;
-
- switch (event->type) {
- case ButtonPress:
- case ButtonRelease:
- *x = event->xbutton.x - pad;
- *y = event->xbutton.y - pad;
- return (True);
- case KeyPress:
- case KeyRelease:
- *x = event->xkey.x - pad;
- *y = event->xkey.y - pad;
- return (True);
- case EnterNotify:
- case LeaveNotify:
- *x = event->xcrossing.x - pad;
- *y = event->xcrossing.y - pad;
- return (True);
- case MotionNotify:
- *x = event->xmotion.x - pad;
- *y = event->xmotion.y - pad;
- return (True);
- }
-
- return (False);
-}
-
-static int
-parse_page_string(char *s, int pagesize, int canvassize, Bool *relative)
-{
- char *cp;
- double val = 1.0;
- Bool rel = False;
-
- /*
- * syntax: spaces [+-] number spaces [pc\0] spaces
- */
- for (; isascii(*s) && isspace(*s); s++) /* skip white space */
- ;
-
- if (*s == '+' || *s == '-') { /* deal with signs */
- rel = True;
- if (*s == '-')
- val = -1.0;
- s++;
- }
- if (!*s) { /* if null then return nothing */
- *relative = True;
- return (0);
- }
-
- /* skip over numbers */
- for (cp = s; isascii(*s) && (isdigit(*s) || *s == '.'); s++)
- ;
- val *= atof(cp);
-
- /* skip blanks */
- for (; isascii(*s) && isspace(*s); s++)
- ;
-
- if (*s) { /* if units */
- switch (s[0]) {
- case 'p':
- case 'P':
- val *= (double)pagesize;
- break;
- case 'c':
- case 'C':
- val *= (double)canvassize;
- break;
- }
- }
- *relative = rel;
-
- return ((int)val);
-}
-
-#define DRAW_TMP(pw) \
-{ \
- XDrawRectangle(XtDisplay(pw), XtWindow(pw), \
- pw->panner.xor_gc, \
- pw->panner.tmp.x + pw->panner.internal_border, \
- pw->panner.tmp.y + pw->panner.internal_border, \
- pw->panner.knob_width - 1, \
- pw->panner.knob_height - 1); \
- pw->panner.tmp.showing = !pw->panner.tmp.showing; \
-}
-
-#define UNDRAW_TMP(pw) \
-{ \
- if (pw->panner.tmp.showing) \
- DRAW_TMP(pw); \
-}
-
-#define BACKGROUND_STIPPLE(pw) \
-XmuLocatePixmapFile(pw->core.screen, pw->panner.stipple_name, \
- pw->panner.shadow_color, pw->core.background_pixel, \
- pw->core.depth, NULL, 0, NULL, NULL, NULL, NULL)
-
-#define PIXMAP_OKAY(pm) ((pm) != None && (pm) != XtUnspecifiedPixmap)
-
-/*ARGSUSED*/
-static void
-XawPannerInitialize(Widget greq, Widget gnew, ArgList args, Cardinal *num_args)
-{
- PannerWidget req = (PannerWidget)greq, cnew = (PannerWidget)gnew;
- Dimension defwidth, defheight;
-
- if (req->panner.canvas_width < 1)
- cnew->panner.canvas_width = 1;
- if (req->panner.canvas_height < 1)
- cnew->panner.canvas_height = 1;
- if (req->panner.default_scale < 1)
- cnew->panner.default_scale = PANNER_DEFAULT_SCALE;
-
- get_default_size(req, &defwidth, &defheight);
- if (XtWidth(req) < 1)
- XtWidth(cnew) = defwidth;
- if (XtHeight(req) < 1)
- XtHeight(cnew) = defheight;
-
- cnew->panner.shadow_gc = NULL;
- reset_shadow_gc(cnew); /* shadowColor */
- cnew->panner.slider_gc = NULL;
- reset_slider_gc(cnew); /* foreground */
- cnew->panner.xor_gc = NULL;
- reset_xor_gc(cnew); /* foreground ^ background */
-
- rescale(cnew); /* does a position check */
- cnew->panner.shadow_valid = False;
- cnew->panner.tmp.doing = False;
- cnew->panner.tmp.showing = False;
- }
-
-static void
-XawPannerRealize(Widget gw, XtValueMask *valuemaskp,
- XSetWindowAttributes *attr)
-{
- PannerWidget pw = (PannerWidget)gw;
- Pixmap pm = XtUnspecifiedPixmap;
- Bool gotpm = False;
-
- if (pw->core.background_pixmap == XtUnspecifiedPixmap) {
- if (pw->panner.stipple_name)
- pm = BACKGROUND_STIPPLE(pw);
-
- if (PIXMAP_OKAY(pm)) {
- attr->background_pixmap = pm;
- *valuemaskp |= CWBackPixmap;
- *valuemaskp &= ~CWBackPixel;
- gotpm = True;
- }
- }
- (*pannerWidgetClass->core_class.superclass->core_class.realize)
- (gw, valuemaskp, attr);
-
- if (gotpm)
- XFreePixmap(XtDisplay(gw), pm);
-}
-
-static void
-XawPannerDestroy(Widget gw)
-{
- PannerWidget pw = (PannerWidget)gw;
-
- XtReleaseGC(gw, pw->panner.shadow_gc);
- XtReleaseGC(gw, pw->panner.slider_gc);
- XtReleaseGC(gw, pw->panner.xor_gc);
-}
-
-static void
-XawPannerResize(Widget gw)
-{
- rescale((PannerWidget)gw);
-}
-
-static void
-XawPannerRedisplay(Widget gw, XEvent *event, Region region)
-{
- PannerWidget pw = (PannerWidget)gw;
- Display *dpy = XtDisplay(gw);
- Window w = XtWindow(gw);
- int pad = pw->panner.internal_border;
- Dimension lw = pw->panner.line_width;
- Dimension extra = pw->panner.shadow_thickness + (lw << 1);
- int kx = pw->panner.knob_x + pad, ky = pw->panner.knob_y + pad;
-
- if (Superclass->core_class.expose)
- (Superclass->core_class.expose)(gw, event, region);
-
- pw->panner.tmp.showing = False;
- XClearArea(XtDisplay(pw), XtWindow(pw),
- (int)pw->panner.last_x - ((int)lw) + pad,
- (int)pw->panner.last_y - ((int)lw) + pad,
- pw->panner.knob_width + extra,
- pw->panner.knob_height + extra,
- False);
- pw->panner.last_x = pw->panner.knob_x;
- pw->panner.last_y = pw->panner.knob_y;
-
- XFillRectangle(dpy, w, pw->panner.slider_gc, kx, ky,
- pw->panner.knob_width - 1, pw->panner.knob_height - 1);
-
- if (lw)
- XDrawRectangle(dpy, w, pw->panner.shadow_gc, kx, ky,
- pw->panner.knob_width - 1, pw->panner.knob_height - 1);
-
- if (pw->panner.shadow_valid)
- XFillRectangles(dpy, w, pw->panner.shadow_gc, pw->panner.shadow_rects, 2);
-
- if (pw->panner.tmp.doing && pw->panner.rubber_band)
- DRAW_TMP(pw);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawPannerSetValues(Widget gcur, Widget greq, Widget gnew,
- ArgList args, Cardinal *num_args)
-{
- PannerWidget cur = (PannerWidget)gcur;
- PannerWidget cnew = (PannerWidget)gnew;
- Bool redisplay = False;
-
- if (cur->panner.foreground != cnew->panner.foreground) {
- reset_slider_gc(cnew);
- if (cur->panner.foreground != cur->core.background_pixel)
- reset_xor_gc(cnew);
- redisplay = True;
- }
- else if (cur->panner.line_width != cnew->panner.line_width ||
- cur->core.background_pixel != cnew->core.background_pixel) {
- reset_xor_gc(cnew);
- redisplay = True;
- }
- if (cur->panner.shadow_color != cnew->panner.shadow_color) {
- reset_shadow_gc(cnew);
- if (cur->panner.foreground == cur->core.background_pixel)
- reset_xor_gc(cnew);
- redisplay = True;
- }
- if (cur->panner.shadow_thickness != cnew->panner.shadow_thickness) {
- move_shadow(cnew);
- redisplay = True;
- }
- if (cur->panner.rubber_band != cnew->panner.rubber_band) {
- reset_xor_gc(cnew);
- if (cnew->panner.tmp.doing)
- redisplay = True;
- }
-
- if ((cur->panner.stipple_name != cnew->panner.stipple_name
- || cur->panner.shadow_color != cnew->panner.shadow_color
- || cur->core.background_pixel != cnew->core.background_pixel)
- && XtIsRealized(gnew)) {
- Pixmap pm = cnew->panner.stipple_name ?
- BACKGROUND_STIPPLE(cnew) : XtUnspecifiedPixmap;
-
- if (PIXMAP_OKAY(pm)) {
- XSetWindowBackgroundPixmap(XtDisplay(cnew), XtWindow(cnew), pm);
- XFreePixmap(XtDisplay(cnew), pm);
- }
- else
- XSetWindowBackground(XtDisplay(cnew), XtWindow(cnew),
- cnew->core.background_pixel);
-
- redisplay = True;
- }
-
- if (cnew->panner.resize_to_pref &&
- (cur->panner.canvas_width != cnew->panner.canvas_width
- || cur->panner.canvas_height != cnew->panner.canvas_height
- || cur->panner.resize_to_pref != cnew->panner.resize_to_pref)) {
- get_default_size(cnew, &cnew->core.width, &cnew->core.height);
- redisplay = True;
- }
- else if (cur->panner.canvas_width != cnew->panner.canvas_width
- || cur->panner.canvas_height != cnew->panner.canvas_height
- || cur->panner.internal_border != cnew->panner.internal_border) {
- rescale(cnew); /* does a scale_knob as well */
- redisplay = True;
- }
- else {
- Bool loc = cur->panner.slider_x != cnew->panner.slider_x ||
- cur->panner.slider_y != cnew->panner.slider_y;
- Bool siz = cur->panner.slider_width != cnew->panner.slider_width ||
- cur->panner.slider_height != cnew->panner.slider_height;
- if (loc || siz || (cur->panner.allow_off != cnew->panner.allow_off
- && cnew->panner.allow_off)) {
- scale_knob(cnew, loc, siz);
- redisplay = True;
- }
- }
-
- return (redisplay);
-}
-
-static void
-XawPannerSetValuesAlmost(Widget gold, Widget gnew, XtWidgetGeometry *req,
- XtWidgetGeometry *reply)
-{
- if (reply->request_mode == 0) /* got turned down, so cope */
- XawPannerResize(gnew);
-
- (*pannerWidgetClass->core_class.superclass->core_class.set_values_almost)
- (gold, gnew, req, reply);
-}
-
-static XtGeometryResult
-XawPannerQueryGeometry(Widget gw, XtWidgetGeometry *intended,
- XtWidgetGeometry *pref)
-{
- PannerWidget pw = (PannerWidget)gw;
-
- pref->request_mode = (CWWidth | CWHeight);
- get_default_size(pw, &pref->width, &pref->height);
-
- if (((intended->request_mode & (CWWidth | CWHeight)) == (CWWidth | CWHeight))
- && intended->width == pref->width && intended->height == pref->height)
- return (XtGeometryYes);
- else if (pref->width == XtWidth(pw) && pref->height == XtHeight(pw))
- return (XtGeometryNo);
-
- return (XtGeometryAlmost);
-}
-
-
-/*ARGSUSED*/
-static void
-ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
- int x, y;
-
- if (!get_event_xy(pw, event, &x, &y)) {
- XBell(XtDisplay(gw), 0);
- return;
- }
-
- pw->panner.tmp.doing = True;
- pw->panner.tmp.startx = pw->panner.knob_x;
- pw->panner.tmp.starty = pw->panner.knob_y;
- pw->panner.tmp.dx = x - pw->panner.knob_x;
- pw->panner.tmp.dy = y - pw->panner.knob_y;
- pw->panner.tmp.x = pw->panner.knob_x;
- pw->panner.tmp.y = pw->panner.knob_y;
- if (pw->panner.rubber_band)
- DRAW_TMP(pw);
-}
-
-/*ARGSUSED*/
-static void
-ActionStop(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
- int x, y;
-
- if (get_event_xy(pw, event, &x, &y)) {
- pw->panner.tmp.x = x - pw->panner.tmp.dx;
- pw->panner.tmp.y = y - pw->panner.tmp.dy;
- if (!pw->panner.allow_off)
- check_knob(pw, False);
- }
- if (pw->panner.rubber_band)
- DRAW_TMP(pw);
- pw->panner.tmp.doing = False;
-}
-
-static void
-ActionAbort(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
-
- if (!pw->panner.tmp.doing)
- return;
-
- if (pw->panner.rubber_band)
- UNDRAW_TMP(pw);
-
- if (!pw->panner.rubber_band) { /* restore old position */
- pw->panner.tmp.x = pw->panner.tmp.startx;
- pw->panner.tmp.y = pw->panner.tmp.starty;
- ActionNotify(gw, event, params, num_params);
- }
- pw->panner.tmp.doing = False;
-}
-
-static void
-ActionMove(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
- int x, y;
-
- if (!pw->panner.tmp.doing)
- return;
-
- if (!get_event_xy(pw, event, &x, &y)) {
- XBell(XtDisplay(gw), 0); /* should do error message */
- return;
- }
-
- if (pw->panner.rubber_band)
- UNDRAW_TMP(pw);
- pw->panner.tmp.x = x - pw->panner.tmp.dx;
- pw->panner.tmp.y = y - pw->panner.tmp.dy;
-
- if (!pw->panner.rubber_band)
- ActionNotify(gw, event, params, num_params);
- else {
- if (!pw->panner.allow_off)
- check_knob(pw, False);
- DRAW_TMP(pw);
- }
-}
-
-
-static void
-ActionPage(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
- Cardinal zero = 0;
- Bool isin = pw->panner.tmp.doing;
- int x, y;
- Bool relx, rely;
- int pad = pw->panner.internal_border << 1;
-
- if (*num_params != 2) {
- XBell(XtDisplay(gw), 0);
- return;
- }
-
- x = parse_page_string(params[0], pw->panner.knob_width,
- (int)XtWidth(pw) - pad, &relx);
- y = parse_page_string(params[1], pw->panner.knob_height,
- (int)XtHeight(pw) - pad, &rely);
-
- if (relx)
- x += pw->panner.knob_x;
- if (rely)
- y += pw->panner.knob_y;
-
- if (isin) { /* if in, then use move */
- XEvent ev;
-
- ev.xbutton.type = ButtonPress;
- ev.xbutton.x = x;
- ev.xbutton.y = y;
- ActionMove(gw, &ev, NULL, &zero);
- }
- else {
- pw->panner.tmp.doing = True;
- pw->panner.tmp.x = x;
- pw->panner.tmp.y = y;
- ActionNotify(gw, event, NULL, &zero);
- pw->panner.tmp.doing = False;
- }
-}
-
-/*ARGSUSED*/
-static void
-ActionNotify(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
-
- if (!pw->panner.tmp.doing)
- return;
-
- if (!pw->panner.allow_off)
- check_knob(pw, False);
- pw->panner.knob_x = pw->panner.tmp.x;
- pw->panner.knob_y = pw->panner.tmp.y;
- move_shadow(pw);
-
- pw->panner.slider_x = (Position)((double)pw->panner.knob_x
- / pw->panner.haspect + 0.5);
- pw->panner.slider_y = (Position)((double) pw->panner.knob_y
- / pw->panner.vaspect + 0.5);
- if (!pw->panner.allow_off) {
- Position tmp;
-
- if (pw->panner.slider_x
- > (tmp = (Position)pw->panner.canvas_width -
- (Position)pw->panner.slider_width))
- pw->panner.slider_x = tmp;
- if (pw->panner.slider_x < 0)
- pw->panner.slider_x = 0;
- if (pw->panner.slider_y
- > (tmp = (Position)pw->panner.canvas_height -
- (Position)pw->panner.slider_height))
- pw->panner.slider_y = tmp;
- if (pw->panner.slider_y < 0)
- pw->panner.slider_y = 0;
- }
-
- if (pw->panner.last_x != pw->panner.knob_x ||
- pw->panner.last_y != pw->panner.knob_y) {
- XawPannerReport rep;
-
- XawPannerRedisplay(gw, NULL, NULL);
- rep.changed = XawPRSliderX | XawPRSliderY;
- rep.slider_x = pw->panner.slider_x;
- rep.slider_y = pw->panner.slider_y;
- rep.slider_width = pw->panner.slider_width;
- rep.slider_height = pw->panner.slider_height;
- rep.canvas_width = pw->panner.canvas_width;
- rep.canvas_height = pw->panner.canvas_height;
- XtCallCallbackList(gw, pw->panner.report_callbacks, (XtPointer)&rep);
- }
-}
-
-/*ARGSUSED*/
-static void
-ActionSet(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- PannerWidget pw = (PannerWidget)gw;
- Bool rb;
-
- if (*num_params < 2 ||
- XmuCompareISOLatin1(params[0], "rubberband") != 0) {
- XBell(XtDisplay(gw), 0);
- return;
- }
-
- if (XmuCompareISOLatin1(params[1], "on") == 0)
- rb = True;
- else if (XmuCompareISOLatin1(params[1], "off") == 0)
- rb = False;
- else if (XmuCompareISOLatin1(params[1], "toggle") == 0)
- rb = !pw->panner.rubber_band;
- else {
- XBell(XtDisplay(gw), 0);
- return;
- }
-
- if (rb != pw->panner.rubber_band) {
- Arg args[1];
-
- XtSetArg(args[0], XtNrubberBand, rb);
- XtSetValues(gw, args, 1);
- }
-}
diff --git a/xc/lib/Xaw/Panner.h b/xc/lib/Xaw/Panner.h
deleted file mode 100644
index 5af7ca759..000000000
--- a/xc/lib/Xaw/Panner.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * $TOG: Panner.h /main/24 1998/02/11 14:54: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.
- *
- * Author: Jim Fulton, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/Panner.h,v 1.4 1998/10/03 08:42:14 dawes Exp $ */
-
-#ifndef _XawPanner_h
-#define _XawPanner_h
-
-#include <X11/Xaw/Reports.h>
-
-/*****************************************************************************
- *
- * Panner Widget (subclass of Simple)
- *
- * This widget is used to represent navigation in a 2d coordinate system
- *
- * Resources:
- *
- * Name Class Type Default
- * ---- ----- ---- -------
- *
- * allowOff AllowOff Boolean FALSE
- * background Background Pixel XtDefaultBackground
- * backgroundStipple BackgroundStipple String NULL
- * canvasWidth CanvasWidth Dimension 0
- * canvasHeight CanvasHeight Dimension 0
- * defaultScale DefaultScale Dimension 8 percent
- * foreground Foreground Pixel XtDefaultBackground
- * internalSpace InternalSpace Dimension 4
- * lineWidth LineWidth Dimension 0
- * reportCallback ReportCallback XtCallbackList NULL
- * resize Resize Boolean TRUE
- * rubberBand RubberBand Boolean FALSE
- * shadowColor ShadowColor Pixel XtDefaultForeground
- * shadowThickness ShadowThickness Dimension 2
- * sliderX SliderX Position 0
- * sliderY SliderY Position 0
- * sliderWidth SliderWidth Dimension 0
- * sliderHeight SliderHeight Dimension 0
- *
- *****************************************************************************/
-
-#ifndef _XtStringDefs_h_
-#define XtNresize "resize"
-#define XtCResize "Resize"
-#endif
-
-#define XtNallowOff "allowOff"
-#define XtCAllowOff "AllowOff"
-#define XtNbackgroundStipple "backgroundStipple"
-#define XtCBackgroundStipple "BackgroundStipple"
-#define XtNdefaultScale "defaultScale"
-#define XtCDefaultScale "DefaultScale"
-#define XtNcanvasWidth "canvasWidth"
-#define XtCCanvasWidth "CanvasWidth"
-#define XtNcanvasHeight "canvasHeight"
-#define XtCCanvasHeight "CanvasHeight"
-#define XtNinternalSpace "internalSpace"
-#define XtCInternalSpace "InternalSpace"
-#define XtNlineWidth "lineWidth"
-#define XtCLineWidth "LineWidth"
-#define XtNrubberBand "rubberBand"
-#define XtCRubberBand "RubberBand"
-#define XtNshadowThickness "shadowThickness"
-#define XtCShadowThickness "ShadowThickness"
-#define XtNshadowColor "shadowColor"
-#define XtCShadowColor "ShadowColor"
-#define XtNsliderX "sliderX"
-#define XtCSliderX "SliderX"
-#define XtNsliderY "sliderY"
-#define XtCSliderY "SliderY"
-#define XtNsliderWidth "sliderWidth"
-#define XtCSliderWidth "SliderWidth"
-#define XtNsliderHeight "sliderHeight"
-#define XtCSliderHeight "SliderHeight"
-
-extern WidgetClass pannerWidgetClass;
-
-typedef struct _PannerClassRec *PannerWidgetClass;
-typedef struct _PannerRec *PannerWidget;
-
-#endif /* _XawPanner_h */
diff --git a/xc/lib/Xaw/PannerP.h b/xc/lib/Xaw/PannerP.h
deleted file mode 100644
index 50951e88d..000000000
--- a/xc/lib/Xaw/PannerP.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * $TOG: PannerP.h /main/21 1998/02/11 14:54: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.
- *
- * Author: Jim Fulton, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/PannerP.h,v 1.6 1999/06/20 08:41:04 dawes Exp $ */
-
-#ifndef _XawPannerP_h
-#define _XawPannerP_h
-
-#include <X11/Xaw/Panner.h>
-#include <X11/Xaw/SimpleP.h>
-
-/* new fields in widget class */
-typedef struct {
- XtPointer extension;
-} PannerClassPart;
-
-/* Panner widget class */
-typedef struct _PannerClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- PannerClassPart panner_class;
-} PannerClassRec;
-
-/* new fields in widget */
-typedef struct {
- /* resources */
- XtCallbackList report_callbacks; /* callback/Callback */
- Boolean allow_off; /* allowOff/AllowOff */
- Boolean resize_to_pref; /* resizeToPreferred/Boolean */
- Pixel foreground; /* foreground/Foreground */
- Pixel shadow_color; /* shadowColor/ShadowColor */
- Dimension shadow_thickness; /* shadowThickness/ShadowThickness */
- Dimension default_scale; /* defaultScale/DefaultScale */
- Dimension line_width; /* lineWidth/LineWidth */
- Dimension canvas_width; /* canvasWidth/CanvasWidth */
- Dimension canvas_height; /* canvasHeight/CanvasHeight */
- Position slider_x; /* sliderX/SliderX */
- Position slider_y; /* sliderY/SliderY */
- Dimension slider_width; /* sliderWidth/SliderWidth */
- Dimension slider_height; /* sliderHeight/SliderHeight */
- Dimension internal_border; /* internalBorderWidth/BorderWidth */
- String stipple_name; /* backgroundStipple/BackgroundStipple
- */
- /* private */
- GC slider_gc; /* background of slider */
- GC shadow_gc; /* edge of slider and shadow */
- GC xor_gc; /* for doing XOR tmp graphics */
- double haspect, vaspect; /* aspect ratio of core to canvas */
- Boolean rubber_band; /* true = rubber band, false = move */
- struct {
- Boolean doing; /* tmp graphics in progress */
- Boolean showing; /* true if tmp graphics displayed */
- Position startx, starty; /* initial position of slider */
- Position dx, dy; /* offset loc for tmp graphics */
- Position x, y; /* location for tmp graphics */
- } tmp;
- Position knob_x, knob_y; /* real upper left of knob in canvas */
- Dimension knob_width, knob_height; /* real size of knob in canvas */
- Boolean shadow_valid; /* true if rects are valid */
- XRectangle shadow_rects[2]; /* location of shadows */
- Position last_x, last_y; /* previous location of knob */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} PannerPart;
-
-typedef struct _PannerRec {
- CorePart core;
- SimplePart simple;
- PannerPart panner;
-} PannerRec;
-
-#define PANNER_HSCALE(pw,val) ((pw)->panner.haspect * ((double)(val)))
-#define PANNER_VSCALE(pw,val) ((pw)->panner.vaspect * ((double)(val)))
-
-#define PANNER_DSCALE(pw,val) (Dimension) \
-((((unsigned long)(val)) * (unsigned long)pw->panner.default_scale) / 100L)
-
-#define PANNER_DEFAULT_SCALE 8 /* percent */
-#define PANNER_OUTOFRANGE -30000
-
-extern PannerClassRec pannerClassRec;
-
-#endif /* _XawPannerP_h */
diff --git a/xc/lib/Xaw/Pixmap.c b/xc/lib/Xaw/Pixmap.c
deleted file mode 100644
index a05512066..000000000
--- a/xc/lib/Xaw/Pixmap.c
+++ /dev/null
@@ -1,931 +0,0 @@
-/*
- * Copyright (c) 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 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.
- */
-
-/* $XFree86: xc/lib/Xaw/Pixmap.c,v 3.13 1999/07/11 08:49:14 dawes Exp $ */
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <X11/IntrinsicP.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xfuncs.h>
-#include <X11/extensions/shape.h>
-#include <X11/xpm.h>
-#include "Private.h"
-
-#ifndef OLDXAW
-
-/*
- * Types
- */
-typedef struct _XawCache {
- long value;
- XtPointer *elems;
- unsigned int num_elems;
-} XawCache;
-
-typedef struct _XawPixmapLoaderInfo {
- XawPixmapLoader loader;
- String type;
- String ext;
-} XawPixmapLoaderInfo;
-
-/*
- * Private Methods
- */
-static Bool BitmapLoader(XawParams*, Screen*, Colormap, int,
- Pixmap*, Pixmap*, Dimension*, Dimension*);
-static Bool GradientLoader(XawParams*, Screen*, Colormap, int,
- Pixmap*, Pixmap*, Dimension*, Dimension*);
-static Bool XPixmapLoader(XawParams*, Screen*, Colormap, int,
- Pixmap*, Pixmap*, Dimension*, Dimension*);
-static XawPixmap *_XawFindPixmap(String, Screen*, Colormap, int);
-static void _XawCachePixmap(XawPixmap*, Screen*, Colormap, int);
-static int _XawFindPixmapLoaderIndex(String, String);
-static int qcmp_long(register _Xconst void*, register _Xconst void *);
-static int bcmp_long(register _Xconst void*, register _Xconst void *);
-static int qcmp_string(register _Xconst void*, register _Xconst void *);
-static int bcmp_string(register _Xconst void*, register _Xconst void *);
-
-/*
- * Initialization
- */
-static XawCache xaw_pixmaps;
-static XawCache x_pixmaps; /* for fast reverse search */
-static XawPixmapLoaderInfo **loader_info;
-static Cardinal num_loader_info;
-
-/*
- * Implementation
- */
-Bool
-XawPixmapsInitialize(void)
-{
- static Boolean first_time = True;
-
- if (!first_time)
- return (False);
-
- (void)XawAddPixmapLoader(NULL, NULL, BitmapLoader);
- (void)XawAddPixmapLoader("bitmap", NULL, BitmapLoader);
- (void)XawAddPixmapLoader("gradient", NULL, GradientLoader);
- (void)XawAddPixmapLoader("xpm", "xpm", XPixmapLoader);
-
- return (True);
-}
-
-XawParams *
-XawParseParamsString(String name)
-{
- XawParams *xaw_params;
- char *tok, *str, *type = NULL, *ext = NULL, *params = NULL;
-
- if (!name)
- return (NULL);
-
- xaw_params = (XawParams *)XtMalloc(sizeof(XawParams));
-
- str = XtNewString(name);
-
- /* Find type */
- tok = str;
- while (tok = strchr(tok, ':'), tok)
- {
- if (tok == str || tok[-1] != '\\')
- break;
- memmove(&tok[-1], tok, strlen(tok) + 1);
- }
- if (tok)
- {
- *tok = '\0';
- if (strchr(str, '?'))
- {
- *tok = ':';
- }
- else
- {
- ++tok;
- type = XtNewString(str);
- memmove(str, tok, strlen(tok) + 1);
- }
- }
-
- /* Find params */
- tok = str;
- while (tok = strchr(tok, '?'), tok)
- {
- if (tok == str || tok[-1] != '\\')
- params = tok;
- if (tok != str && tok[-1] == '\\')
- memmove(&tok[-1], tok, strlen(tok) + 1);
- else
- break;
- }
- if (params)
- {
- *params = '\0';
- ++params;
- }
-
- /* Find ext */
- tok = str;
- while (tok = strchr(tok, '.'), tok)
- {
- if (tok == str || tok[-1] != '\\')
- ext = tok;
- if (tok != str && tok[-1] == '\\')
- memmove(&tok[-1], tok, strlen(tok) + 1);
- else
- break;
- }
- if (ext)
- {
- ++ext;
- if (strchr(ext, '/'))
- ext = NULL;
- }
-
- xaw_params->name = XtNewString(str);
- xaw_params->type = type;
- xaw_params->ext = ext ? XtNewString(ext) : ext;
- xaw_params->args = NULL;
- xaw_params->num_args = 0;
-
- /* Parse params */
- if (params)
- {
- char *arg, *val;
- XawArgVal *xaw_arg;
-
- for (tok = strtok(params, "&"); tok; tok = strtok(NULL, "&"))
- {
- val = strchr(tok, '=');
- if (val)
- {
- *val = '\0';
- ++val;
- if (*val != '\0')
- val = XtNewString(val);
- else
- val = NULL;
- }
- arg = XtNewString(tok);
- xaw_arg = (XawArgVal *)XtMalloc(sizeof(XawArgVal));
- xaw_arg->name = arg;
- xaw_arg->value = val;
- if (!xaw_params->num_args)
- {
- xaw_params->num_args = 1;
- xaw_params->args = (XawArgVal **)
- XtMalloc(sizeof(XawArgVal*));
- }
- else
- {
- ++xaw_params->num_args;
- xaw_params->args = (XawArgVal **)
- XtRealloc((char *)xaw_params->args,
- sizeof(XawArgVal*) * xaw_params->num_args);
- }
- xaw_params->args[xaw_params->num_args - 1] = xaw_arg;
- }
- }
-
- if (xaw_params->num_args > 1)
- qsort(xaw_params->args, xaw_params->num_args, sizeof(XtPointer),
- qcmp_string);
-
- XtFree(str);
-
- return (xaw_params);
-}
-
-void
-XawFreeParamsStruct(XawParams *params)
-{
- unsigned int i;
-
- if (!params)
- return;
-
- for (i = 0; i < params->num_args; i++)
- {
- XtFree(params->args[i]->name);
- if (params->args[i]->value)
- XtFree(params->args[i]->value);
- XtFree((char *)params->args[i]);
- }
-
- if (params->args)
- XtFree((char *)params->args);
- XtFree((char *)params);
-}
-
-XawArgVal *
-XawFindArgVal(XawParams *params, String name)
-{
- XawArgVal **arg_val;
-
- if (!params->args)
- return (NULL);
-
- arg_val = (XawArgVal **)bsearch((void *)name, params->args,
- params->num_args, sizeof(XtPointer*),
- bcmp_string);
- if (!arg_val)
- return (NULL);
-
- return (*arg_val);
-}
-
-XawPixmap *
-XawLoadPixmap(String name, Screen *screen, Colormap colormap, int depth)
-{
- int idx;
- Bool success;
- XawPixmap *xaw_pixmap;
- Pixmap pixmap, mask;
- Dimension width, height;
- XawParams *xaw_params;
-
- if (!name)
- return (False);
-
- xaw_pixmap = _XawFindPixmap(name, screen, colormap, depth);
-
- if (xaw_pixmap)
- return (xaw_pixmap);
-
- if ((xaw_params = XawParseParamsString(name)) == NULL)
- return (NULL);
-
- idx = _XawFindPixmapLoaderIndex(xaw_params->type, xaw_params->ext);
- if (idx < 0)
- return (NULL);
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "(*) Loading pixmap \"%s\": ", name);
-#endif
-
- success = loader_info[idx]->loader(xaw_params, screen, colormap, depth,
- &pixmap, &mask, &width, &height);
- if (success)
- {
- xaw_pixmap = (XawPixmap *)XtMalloc(sizeof(XawPixmap));
- xaw_pixmap->name = XtNewString(name);
- xaw_pixmap->pixmap = pixmap;
- xaw_pixmap->mask = mask;
- xaw_pixmap->width = width;
- xaw_pixmap->height = height;
- _XawCachePixmap(xaw_pixmap, screen, colormap, depth);
- }
-
- XawFreeParamsStruct(xaw_params);
-
-#ifdef DIAGNOSTIC
- fprintf(stderr, "%s", success ? "success\n" : "failed\n");
-#endif
-
- return (success ? xaw_pixmap : NULL);
-}
-
-Bool
-XawAddPixmapLoader(String type, String ext, XawPixmapLoader loader)
-{
- XawPixmapLoaderInfo *info;
- int i;
-
- if (!loader)
- return (False);
-
- i = _XawFindPixmapLoaderIndex(type, ext);
-
- if (i >= 0)
- {
- loader_info[i]->loader = loader;
- if (loader_info[i]->type)
- XtFree(loader_info[i]->type);
- if (loader_info[i]->ext)
- XtFree(loader_info[i]->ext);
- loader_info[i]->type = type ? XtNewString(type) : NULL;
- loader_info[i]->ext = ext ? XtNewString(ext) : NULL;
- return (True);
- }
-
- if ((info = (XawPixmapLoaderInfo *)XtMalloc(sizeof(XawPixmapLoaderInfo)))
- == NULL)
- return (False);
-
- info->loader = loader;
- info->type = type ? XtNewString(type) : NULL;
- info->ext = ext ? XtNewString(ext) : NULL;
-
- if (!loader_info)
- {
- num_loader_info = 1;
- loader_info = (XawPixmapLoaderInfo**)
- XtMalloc(sizeof(XawPixmapLoaderInfo*));
- }
- else
- {
- ++num_loader_info;
- loader_info = (XawPixmapLoaderInfo**)
- XtRealloc((char *)loader_info,
- sizeof(XawPixmapLoaderInfo) * num_loader_info);
- }
- loader_info[num_loader_info - 1] = info;
-
- return (True);
-}
-
-static int
-_XawFindPixmapLoaderIndex(String type, String ext)
-{
- Cardinal i;
-
- if (!loader_info)
- return (-1);
-
- for (i = 0; i < num_loader_info; i++)
- if ((type && loader_info[i]->type && strcmp(type, loader_info[i]->type) == 0)
- || (ext && loader_info[i]->ext && strcmp(ext, loader_info[i]->ext) == 0))
- return ((int)i);
-
- if (!type)
- return (0); /* try a bitmap */
-
- return (-1);
-}
-
-static int
-qcmp_x_cache(register _Xconst void *left, register _Xconst void *right)
-{
- return ((int)((*(XawPixmap **)left)->pixmap) -
- (int)((*(XawPixmap **)right)->pixmap));
-}
-
-static int
-bcmp_x_cache(register _Xconst void *pixmap, register _Xconst void *xaw)
-{
- return ((int)pixmap - (int)((*(XawPixmap **)xaw)->pixmap));
-}
-
-static int
-qcmp_long(register _Xconst void *left, register _Xconst void *right)
-{
- return ((long)((*(XawCache **)left)->value) -
- (long)((*(XawCache **)right)->value));
-}
-
-static int
-qcmp_string(register _Xconst void *left, register _Xconst void *right)
-{
- return (strcmp((String)((*(XawCache **)left)->value),
- (String)((*(XawCache **)right)->value)));
-}
-
-static int
-bcmp_long(register _Xconst void *value, register _Xconst void *cache)
-{
- return ((long)value - (long)((*(XawCache **)cache)->value));
-}
-
-static int
-bcmp_string(register _Xconst void *string,
- register _Xconst void *cache)
-{
- return (strcmp((String)string, (String)((*(XawCache **)cache)->value)));
-}
-
-#define FIND_ALL 0
-#define FIND_SCREEN 1
-#define FIND_COLORMAP 2
-#define FIND_DEPTH 3
-static XawCache *
-_XawFindCache(XawCache *xaw,
- Screen *screen, Colormap colormap, int depth, int flags)
-{
- XawCache **cache;
-
- if (!xaw->num_elems)
- return (NULL);
-
- /* Screen */
- cache = (XawCache **)bsearch(screen, xaw->elems,
- xaw->num_elems, sizeof(XtPointer),
- bcmp_long);
- if (!cache)
- return (NULL);
- if (flags == FIND_SCREEN)
- return (*cache);
-
- /* Colormap */
- cache = (XawCache **)bsearch((void *)colormap, (*cache)->elems,
- (*cache)->num_elems, sizeof(XtPointer),
- bcmp_long);
- if (!cache)
- return (NULL);
- if (flags == FIND_COLORMAP)
- return (*cache);
-
- /* Depth */
- cache = (XawCache **)bsearch((void *)depth, (*cache)->elems,
- (*cache)->num_elems, sizeof(XtPointer),
- bcmp_long);
-
- if (!cache)
- return (NULL);
- return (*cache);
-}
-
-static XawCache *
-_XawGetCache(XawCache *xaw, Screen *screen, Colormap colormap, int depth)
-{
- XawCache *s_cache, *c_cache, *d_cache, *cache, *pcache;
-
- cache = _XawFindCache(xaw, screen, colormap, depth, FIND_ALL);
-
- if (!cache)
- {
- s_cache = _XawFindCache(xaw,
- screen, colormap, depth, FIND_SCREEN);
- if (!s_cache)
- {
- pcache = (XawCache *)XtMalloc(sizeof(XawCache));
- if (!xaw->num_elems)
- {
- xaw->num_elems = 1;
- xaw->elems = (XtPointer*)XtMalloc(sizeof(XtPointer));
- }
- else
- {
- ++xaw->num_elems;
- xaw->elems = (XtPointer*)
- XtRealloc((char *)xaw->elems,
- sizeof(XtPointer) * xaw->num_elems);
- }
- pcache->value = (long)screen;
- pcache->elems = NULL;
- pcache->num_elems = 0;
- xaw->elems[xaw->num_elems - 1] = (XtPointer)pcache;
- s_cache = (XawCache *)xaw->elems[xaw->num_elems - 1];
- if (xaw->num_elems > 1)
- qsort(xaw->elems, xaw->num_elems, sizeof(XtPointer), qcmp_long);
- }
-
- c_cache = _XawFindCache(xaw,
- screen, colormap, depth, FIND_COLORMAP);
- if (!c_cache)
- {
- pcache = (XawCache *)XtMalloc(sizeof(XawCache));
- if (!s_cache->num_elems)
- {
- s_cache->num_elems = 1;
- s_cache->elems = (XtPointer*)XtMalloc(sizeof(XtPointer));
- }
- else
- {
- ++s_cache->num_elems;
- s_cache->elems = (XtPointer*)
- XtRealloc((char *)s_cache->elems,
- sizeof(XtPointer) * s_cache->num_elems);
- }
- pcache->value = (long)colormap;
- pcache->elems = NULL;
- pcache->num_elems = 0;
- s_cache->elems[s_cache->num_elems - 1] = (XtPointer)pcache;
- c_cache = (XawCache *)s_cache->elems[s_cache->num_elems - 1];
- if (s_cache->num_elems > 1)
- qsort(s_cache->elems, s_cache->num_elems,
- sizeof(XtPointer), qcmp_long);
- }
-
- d_cache = _XawFindCache(xaw,
- screen, colormap, depth, FIND_DEPTH);
- if (!d_cache)
- {
- pcache = (XawCache *)XtMalloc(sizeof(XawCache));
- if (!c_cache->num_elems)
- {
- c_cache->num_elems = 1;
- c_cache->elems = (XtPointer*)XtMalloc(sizeof(XtPointer));
- }
- else
- {
- ++c_cache->num_elems;
- c_cache->elems = (XtPointer*)
- XtRealloc((char *)c_cache->elems,
- sizeof(XtPointer) * c_cache->num_elems);
- }
- pcache->value = (long)depth;
- pcache->elems = NULL;
- pcache->num_elems = 0;
- c_cache->elems[c_cache->num_elems - 1] = (XtPointer)pcache;
- d_cache = (XawCache *)c_cache->elems[c_cache->num_elems - 1];
- if (c_cache->num_elems > 1)
- qsort(c_cache->elems, c_cache->num_elems,
- sizeof(XtPointer), qcmp_long);
- }
-
- cache = d_cache;
- }
-
- return (cache);
-}
-
-static XawPixmap *
-_XawFindPixmap(String name, Screen *screen, Colormap colormap, int depth)
-{
- XawCache *cache;
- XawPixmap **pixmap;
-
- cache = _XawFindCache(&xaw_pixmaps, screen, colormap, depth, FIND_ALL);
-
- if (!cache)
- return (NULL);
-
- /* Name */
- pixmap = (XawPixmap **)bsearch((void *)name, cache->elems,
- cache->num_elems, sizeof(XtPointer),
- bcmp_string);
- if (!pixmap)
- return (NULL);
-
- return (*pixmap);
-}
-
-XawPixmap *
-XawPixmapFromXPixmap(Pixmap pixmap,
- Screen *screen, Colormap colormap, int depth)
-{
- XawCache *cache;
- XawPixmap **x_pixmap;
-
- cache = _XawFindCache(&x_pixmaps, screen, colormap, depth, FIND_ALL);
-
- if (!cache)
- return (NULL);
-
- /* Pixmap */
- x_pixmap = (XawPixmap **)bsearch((void *)pixmap, cache->elems,
- cache->num_elems, sizeof(XtPointer),
- bcmp_x_cache);
- if (!x_pixmap)
- return (NULL);
-
- return (*x_pixmap);
-}
-
-static void
-_XawCachePixmap(XawPixmap *pixmap,
- Screen *screen, Colormap colormap, int depth)
-{
- XawCache *xaw_cache, *x_cache;
-
- xaw_cache = _XawGetCache(&xaw_pixmaps, screen, colormap, depth);
- x_cache = _XawGetCache(&x_pixmaps, screen, colormap, depth);
-
- if (!xaw_cache->num_elems)
- {
- xaw_cache->num_elems = 1;
- xaw_cache->elems = (XtPointer*)XtMalloc(sizeof(XtPointer));
- }
- else
- {
- ++xaw_cache->num_elems;
- xaw_cache->elems = (XtPointer*)XtRealloc((char *)xaw_cache->elems,
- sizeof(XtPointer) *
- xaw_cache->num_elems);
- }
-
- xaw_cache->elems[xaw_cache->num_elems - 1] = (XtPointer)pixmap;
- if (xaw_cache->num_elems > 1)
- qsort(xaw_cache->elems, xaw_cache->num_elems,
- sizeof(XtPointer), qcmp_string);
-
-
- if (!x_cache->num_elems)
- {
- x_cache->num_elems = 1;
- x_cache->elems = (XtPointer*)XtMalloc(sizeof(XtPointer));
- }
- else
- {
- ++x_cache->num_elems;
- x_cache->elems = (XtPointer*)XtRealloc((char *)x_cache->elems,
- sizeof(XtPointer) *
- x_cache->num_elems);
- }
-
- x_cache->elems[x_cache->num_elems - 1] = (XtPointer)pixmap;
- if (x_cache->num_elems > 1)
- qsort(x_cache->elems, x_cache->num_elems, sizeof(XtPointer), qcmp_x_cache);
-}
-
-static char *pixmap_path =
- "%H/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N";
-
-static Bool
-BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
- Pixmap *pixmap_return, Pixmap *mask_return,
- Dimension *width_return, Dimension *height_return)
-{
- Pixel fg, bg;
- XColor color, exact;
- Pixmap pixmap;
- unsigned int width, height;
- unsigned char *data = NULL;
- int hotX, hotY;
- XawArgVal *argval;
- Bool retval = False;
- static SubstitutionRec sub[] = {
- {'H', NULL},
- {'N', NULL},
- {'T', "bitmaps"},
- };
- char *filename;
-
- fg = BlackPixelOfScreen(screen);
- bg = WhitePixelOfScreen(screen);
-
- if ((argval = XawFindArgVal(params, "foreground")) != NULL
- && argval->value)
- {
- if (XAllocNamedColor(DisplayOfScreen(screen), colormap, argval->value,
- &color, &exact))
- fg = color.pixel;
- else
- return (False);
- }
- if ((argval = XawFindArgVal(params, "background")) != NULL
- && argval->value)
- {
- if (XAllocNamedColor(DisplayOfScreen(screen), colormap, argval->value,
- &color, &exact))
- bg = color.pixel;
- else
- return (False);
- }
-
- if (params->name[0] != '/' && params->name[0] != '.')
- {
- if (!sub[0].substitution)
- sub[0].substitution = getenv("HOME");
- sub[1].substitution = params->name;
- filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL);
- if (!filename)
- return (FALSE);
- }
- else
- filename = params->name;
-
- if (XReadBitmapFileData(filename, &width, &height, &data,
- &hotX, &hotY) == BitmapSuccess)
- {
- pixmap = XCreatePixmapFromBitmapData(DisplayOfScreen(screen),
- RootWindowOfScreen(screen),
- (char *)data,
- width, height, fg, bg, depth);
- if (data)
- XFree(data);
- *pixmap_return = pixmap;
- *mask_return = None;
- *width_return = width;
- *height_return = height;
-
- retval = True;
- }
-
- if (filename != params->name)
- XtFree(filename);
-
- return (retval);
-}
-
-#define VERTICAL 1
-#define HORIZONTAL 2
-static Bool
-GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
- Pixmap *pixmap_return, Pixmap *mask_return,
- Dimension *width_return, Dimension *height_return)
-{
- double ired, igreen, iblue, red, green, blue;
- XColor start, end, color;
- XGCValues values;
- GC gc;
- double i, inc, x, y, xend, yend;
- Pixmap pixmap;
- XawArgVal *argval;
- int orientation, dimension, steps;
- char *value;
-
- if (XmuCompareISOLatin1(params->name, "vertical") == 0)
- orientation = VERTICAL;
- else if (XmuCompareISOLatin1(params->name, "horizontal") == 0)
- orientation = HORIZONTAL;
- else
- return (False);
-
- if ((argval = XawFindArgVal(params, "dimension")) != NULL
- && argval->value)
- {
- dimension = atoi(argval->value);
- if (dimension <= 0)
- return (False);
- }
- else
- dimension = 50;
-
- if ((argval = XawFindArgVal(params, "steps")) != NULL
- && argval->value)
- {
- steps = atoi(argval->value);
- if (steps <= 0)
- return (False);
- }
- else
- steps = dimension;
-
- steps = XawMin(steps, dimension);
-
- value = NULL;
- if ((argval = XawFindArgVal(params, "start")) != NULL)
- value = argval->value;
- if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value,
- &start, &color))
- return (False);
- else if (!value)
- {
- start.pixel = WhitePixelOfScreen(screen);
- XQueryColor(DisplayOfScreen(screen), colormap, &start);
- }
- value = NULL;
- if ((argval = XawFindArgVal(params, "end")) != NULL)
- value = argval->value;
- if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value,
- &end, &color))
- return (False);
- else if (!value)
- {
- end.pixel = BlackPixelOfScreen(screen);
- XQueryColor(DisplayOfScreen(screen), colormap, &end);
- }
-
- if ((pixmap = XCreatePixmap(DisplayOfScreen(screen),
- RootWindowOfScreen(screen),
- orientation == VERTICAL ? 1 : dimension,
- orientation == VERTICAL ? dimension : 1, depth))
- == 0)
- return (False);
-
- ired = (double)(end.red - start.red) / (double)steps;
- igreen = (double)(end.green - start.green) / (double)steps;
- iblue = (double)(end.blue - start.blue) / (double)steps;
-
- red = color.red = start.red;
- green = color.green = start.green;
- blue = color.blue = start.blue;
-
- inc = (double)dimension / (double)steps;
-
- gc = XCreateGC(DisplayOfScreen(screen), pixmap, 0, &values);
-
- x = y = 0.0;
- if (orientation == VERTICAL)
- {
- xend = 1;
- yend = 0;
- }
- else
- {
- xend = 0;
- yend = 1;
- }
-
- color.flags = DoRed | DoGreen | DoBlue;
-
- XSetForeground(DisplayOfScreen(screen), gc, start.pixel);
- for (i = 0.0; i < dimension; i += inc)
- {
- if ((int)color.red != (int)red || (int)color.green != (int)green
- || (int)color.blue != (int)blue)
- {
- XFillRectangle(DisplayOfScreen(screen), pixmap, gc, (int)x, (int)y,
- (unsigned int)xend, (unsigned int)yend);
- color.red = (unsigned short)red;
- color.green = (unsigned short)green;
- color.blue = (unsigned short)blue;
- if (!XAllocColor(DisplayOfScreen(screen), colormap, &color))
- {
- XFreePixmap(DisplayOfScreen(screen), pixmap);
- return (False);
- }
- XSetForeground(DisplayOfScreen(screen), gc, color.pixel);
- if (orientation == VERTICAL)
- y = yend;
- else
- x = xend;
- }
- red += ired;
- green += igreen;
- blue += iblue;
- if (orientation == VERTICAL)
- yend += inc;
- else
- xend += inc;
- }
- XFillRectangle(DisplayOfScreen(screen), pixmap, gc, (int)x, (int)y,
- (unsigned int)xend, (unsigned int)yend);
-
- *pixmap_return = pixmap;
- *mask_return = None;
- *width_return = orientation == VERTICAL ? 1 : dimension;
- *height_return = orientation == VERTICAL ? dimension : 1;
-
- XFreeGC(DisplayOfScreen(screen), gc);
-
- return (True);
-}
-
-static Bool
-XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth,
- Pixmap *pixmap_return, Pixmap *mask_return,
- Dimension *width_return, Dimension *height_return)
-{
- XpmAttributes xpm_attributes;
- XawArgVal *argval;
- unsigned int closeness = 4000;
- static SubstitutionRec sub[] = {
- {'H', NULL},
- {'N', NULL},
- {'T', "pixmaps"},
- };
- char *filename;
-
- if ((argval = XawFindArgVal(params, "closeness")) != NULL
- && argval->value)
- closeness = atoi(argval->value);
-
- if (params->name[0] != '/' && params->name[0] != '.')
- {
- if (!sub[0].substitution)
- sub[0].substitution = getenv("HOME");
- sub[1].substitution = params->name;
- filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL);
- if (!filename)
- return (False);
- }
- else
- filename = params->name;
-
- xpm_attributes.colormap = colormap;
- xpm_attributes.closeness = closeness;
- xpm_attributes.valuemask = XpmSize | XpmColormap | XpmCloseness;
- if (XpmReadFileToPixmap(DisplayOfScreen(screen),
- RootWindowOfScreen(screen), filename, pixmap_return,
- mask_return, &xpm_attributes) == XpmSuccess)
- {
- *width_return = xpm_attributes.width;
- *height_return = xpm_attributes.height;
-
- return (True);
- }
-
- return (False);
-}
-
-void
-XawReshapeWidget(Widget w, XawPixmap *pixmap)
-{
- if (!pixmap || pixmap->mask == None)
- XShapeCombineMask(XtDisplay(w), XtWindow(w), ShapeBounding, 0, 0,
- None, ShapeSet);
- else
- XShapeCombineMask(XtDisplay(w), XtWindow(w), ShapeBounding, 0, 0,
- pixmap->mask, ShapeSet);
-}
-
-#endif /* OLDXAW */
diff --git a/xc/lib/Xaw/Porthole.c b/xc/lib/Xaw/Porthole.c
deleted file mode 100644
index 02a4307dd..000000000
--- a/xc/lib/Xaw/Porthole.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * $TOG: Porthole.c /main/18 1998/02/11 14:54:27 kaleb $
- *
-Copyright 1990, 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.
- *
- * Author: Jim Fulton, MIT X Consortium
- *
- * This widget is a trivial clipping widget. It is typically used with a
- * panner or scrollbar to navigate.
- */
-/* $XFree86: xc/lib/Xaw/Porthole.c,v 1.5 1999/06/06 08:48:06 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/PortholeP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static void XawPortholeChangeManaged(Widget);
-static XtGeometryResult XawPortholeGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static XtGeometryResult XawPortholeQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawPortholeRealize(Widget, Mask*, XSetWindowAttributes*);
-static void XawPortholeResize(Widget);
-
-/*
- * Prototypes
- */
-static Widget find_child(PortholeWidget);
-static void layout_child(PortholeWidget, Widget, XtWidgetGeometry*,
- Position*, Position*, Dimension*, Dimension*);
-static void SendReport(PortholeWidget, unsigned int);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(PortholeRec, porthole.field)
-static XtResource resources[] = {
- {
- XtNreportCallback,
- XtCReportCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(report_callbacks),
- XtRCallback,
- NULL
- },
-};
-#undef offset
-
-#define Superclass (&compositeClassRec)
-PortholeClassRec portholeClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Porthole", /* class_name */
- sizeof(PortholeRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- NULL, /* initialize */
- NULL, /* initialize_hook */
- XawPortholeRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XawPortholeResize, /* resize */
- NULL, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XawPortholeQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XawPortholeGeometryManager, /* geometry_manager */
- XawPortholeChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- { /* porthole */
- NULL, /* extension */
- },
-};
-
-WidgetClass portholeWidgetClass = (WidgetClass)&portholeClassRec;
-
-/*
- * Implementation
- */
-static Widget
-find_child(PortholeWidget pw)
-{
- Widget *children;
- unsigned int i;
-
- /*
- * Find the managed child on which we should operate. Ignore multiple
- * managed children
- */
- for (i = 0, children = pw->composite.children;
- i < pw->composite.num_children; i++, children++)
- if (XtIsManaged(*children))
- return (*children);
-
- return (NULL);
-}
-
-static void
-SendReport(PortholeWidget pw, unsigned int changed)
-{
- Widget child = find_child(pw);
-
- if (pw->porthole.report_callbacks && child) {
- XawPannerReport prep;
-
- prep.changed = changed;
- prep.slider_x = -XtX(child); /* porthole is "inner" */
- prep.slider_y = -XtY(child); /* child is outer since it is larger */
- prep.slider_width = XtWidth(pw);
- prep.slider_height = XtHeight(pw);
- prep.canvas_width = XtWidth(child);
- prep.canvas_height = XtHeight(child);
- XtCallCallbackList((Widget)pw, pw->porthole.report_callbacks,
- (XtPointer)&prep);
- }
-}
-
-static void
-layout_child(PortholeWidget pw, Widget child, XtWidgetGeometry *geomp,
- Position *xp, Position *yp, Dimension *widthp, Dimension *heightp)
-{
- Position minx, miny;
-
- *xp = XtX(child); /* default to current values */
- *yp = XtY(child);
- *widthp = XtWidth(child);
- *heightp = XtHeight(child);
- if (geomp) { /* mix in any requested changes */
- if (geomp->request_mode & CWX)
- *xp = geomp->x;
- if (geomp->request_mode & CWY)
- *yp = geomp->y;
- if (geomp->request_mode & CWWidth)
- *widthp = geomp->width;
- if (geomp->request_mode & CWHeight)
- *heightp = geomp->height;
- }
-
- /*
- * Make sure that the child is at least as large as the porthole; there
- * is no maximum size
- */
- if (*widthp < XtWidth(pw)) *widthp = XtWidth(pw);
- if (*heightp < XtHeight(pw)) *heightp = XtHeight(pw);
-
- /*
- * Make sure that the child is still on the screen. Note that this must
- * be done *after* the size computation so that we know where to put it
- */
- minx = (Position)XtWidth(pw) - (Position)*widthp;
- miny = (Position)XtHeight(pw) - (Position)*heightp;
-
- if (*xp < minx)
- *xp = minx;
- if (*yp < miny)
- *yp = miny;
-
- if (*xp > 0)
- *xp = 0;
- if (*yp > 0)
- *yp = 0;
-}
-
-static void
-XawPortholeRealize(Widget gw, Mask *valueMask, XSetWindowAttributes *attr)
-{
- attr->bit_gravity = NorthWestGravity;
- *valueMask |= CWBitGravity;
-
- if (XtWidth(gw) < 1)
- XtWidth(gw) = 1;
- if (XtHeight(gw) < 1)
- XtHeight(gw) = 1;
- (*portholeWidgetClass->core_class.superclass->core_class.realize)
- (gw, valueMask, attr);
-}
-
-static void
-XawPortholeResize(Widget gw)
-{
- PortholeWidget pw = (PortholeWidget)gw;
- Widget child = find_child(pw);
-
- /*
- * If we have a child, we need to make sure that it is at least as big
- * as we are and in the right place
- */
- if (child) {
- Position x, y;
- Dimension width, height;
-
- layout_child(pw, child, NULL, &x, &y, &width, &height);
- XtConfigureWidget(child, x, y, width, height, 0);
- }
-
- SendReport(pw, XawPRCanvasWidth | XawPRCanvasHeight);
-}
-
-static XtGeometryResult
-XawPortholeQueryGeometry(Widget gw, XtWidgetGeometry *intended,
- XtWidgetGeometry *preferred)
-{
- PortholeWidget pw = (PortholeWidget)gw;
- Widget child = find_child(pw);
-
- if (child) {
-#define SIZEONLY (CWWidth | CWHeight)
- preferred->request_mode = SIZEONLY;
- preferred->width = XtWidth(child);
- preferred->height = XtHeight(child);
-
- if ((intended->request_mode & SIZEONLY) == SIZEONLY &&
- intended->width == preferred->width &&
- intended->height == preferred->height)
- return (XtGeometryYes);
- else if (preferred->width == XtWidth(pw) &&
- preferred->height == XtHeight(pw))
- return (XtGeometryNo);
-
- return (XtGeometryAlmost);
-#undef SIZEONLY
- }
-
- return (XtGeometryNo);
-}
-
-static XtGeometryResult
-XawPortholeGeometryManager(Widget w, XtWidgetGeometry *req,
- XtWidgetGeometry *reply)
-{
- PortholeWidget pw = (PortholeWidget) w->core.parent;
- Widget child = find_child(pw);
- Bool okay = True;
-
- if (child != w)
- return (XtGeometryNo);
-
- *reply = *req; /* assume we'll grant everything */
-
- if ((req->request_mode & CWBorderWidth) && req->border_width != 0) {
- reply->border_width = 0;
- okay = False;
- }
-
- layout_child(pw, child, req, &reply->x, &reply->y,
- &reply->width, &reply->height);
-
- if ((req->request_mode & CWX) && req->x != reply->x)
- okay = False;
- if ((req->request_mode & CWY) && req->x != reply->x)
- okay = False;
- if ((req->request_mode & CWWidth) && req->width != reply->width)
- okay = False;
- if ((req->request_mode & CWHeight) && req->height != reply->height)
- okay = False;
-
- /*
- * If we failed on anything, simply return without touching widget
- */
- if (!okay)
- return (XtGeometryAlmost);
-
- /*
- * If not just doing a query, update widget and send report. Note that
- * we will often set fields that weren't requested because we want to keep
- * the child visible
- */
- if (!(req->request_mode & XtCWQueryOnly)) {
- unsigned int changed = 0;
-
- if (XtX(child) != reply->x) {
- changed |= XawPRSliderX;
- XtX(child) = reply->x;
- }
- if (XtY(child) != reply->y) {
- changed |= XawPRSliderY;
- XtY(child) = reply->y;
- }
- if (XtWidth(child) != reply->width) {
- changed |= XawPRSliderWidth;
- XtWidth(child) = reply->width;
- }
- if (XtHeight(child) != reply->height) {
- changed |= XawPRSliderHeight;
- XtHeight(child) = reply->height;
- }
- if (changed)
- SendReport(pw, changed);
- }
-
- return (XtGeometryYes); /* success! */
-}
-
-static void
-XawPortholeChangeManaged(Widget gw)
-{
- PortholeWidget pw = (PortholeWidget)gw;
- Widget child = find_child (pw); /* ignore extra children */
-
- if (child) {
- if (!XtIsRealized (gw)) {
- XtWidgetGeometry geom, retgeom;
-
- geom.request_mode = 0;
- if (XtWidth(pw) == 0) {
- geom.width = XtWidth(child);
- geom.request_mode |= CWWidth;
- }
- if (XtHeight(pw) == 0) {
- geom.height = XtHeight(child);
- geom.request_mode |= CWHeight;
- }
- if (geom.request_mode &&
- XtMakeGeometryRequest (gw, &geom, &retgeom)
- == XtGeometryAlmost)
- (void)XtMakeGeometryRequest(gw, &retgeom, NULL);
- }
-
- XtResizeWidget(child, Max(XtWidth(child), XtWidth(pw)),
- Max(XtHeight(child), XtHeight(pw)), 0);
-
- SendReport(pw, XawPRAll);
- }
-}
diff --git a/xc/lib/Xaw/Porthole.h b/xc/lib/Xaw/Porthole.h
deleted file mode 100644
index fb929145b..000000000
--- a/xc/lib/Xaw/Porthole.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * $TOG: Porthole.h /main/4 1998/02/11 14:54:31 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: Jim Fulton, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/Porthole.h,v 1.4 1998/10/03 08:42:15 dawes Exp $ */
-
-#ifndef _XawPorthole_h
-#define _XawPorthole_h
-
-#include <X11/Xaw/Reports.h>
-
-/*****************************************************************************
- *
- * Porthole Widget (subclass of Composite)
- *
- * This widget is similar to a viewport without scrollbars. Child movement
- * is done by external panners or scrollbars.
- *
- * Parameters:
- *
- * Name Class Type Default
- * ---- ----- ---- -------
- *
- * background Background Pixel XtDefaultBackground
- * border BorderColor Pixel XtDefaultForeground
- * borderWidth BorderWidth Dimension 1
- * height Height Dimension 0
- * reportCallback ReportCallback Pointer NULL
- * width Width Dimension 0
- * x Position Position 0
- * y Position Position 0
- *
- *****************************************************************************/
-
-extern WidgetClass portholeWidgetClass;
-typedef struct _PortholeClassRec *PortholeWidgetClass;
-typedef struct _PortholeRec *PortholeWidget;
-
-#endif /* _XawPorthole_h */
diff --git a/xc/lib/Xaw/PortholeP.h b/xc/lib/Xaw/PortholeP.h
deleted file mode 100644
index a6dabd82c..000000000
--- a/xc/lib/Xaw/PortholeP.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * $TOG: PortholeP.h /main/5 1998/02/11 14:54:23 kaleb $
- *
-Copyright 1990, 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.
- *
- * Author: Jim Fulton, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/PortholeP.h,v 1.6 1999/06/20 08:41:04 dawes Exp $ */
-
-#ifndef _XawPortholeP_h
-#define _XawPortholeP_h
-
-#include <X11/Xaw/Porthole.h>
-
-/* new fields in widget class */
-typedef struct {
- XtPointer extension;
-} PortholeClassPart;
-
-/* widget class */
-typedef struct _PortholeClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- PortholeClassPart porthole_class;
-} PortholeClassRec;
-
-/* new fields in widget */
-typedef struct {
- /* resources */
- XtCallbackList report_callbacks; /* callback/Callback */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} PortholePart;
-
-typedef struct _PortholeRec {
- CorePart core;
- CompositePart composite;
- PortholePart porthole;
-} PortholeRec;
-
-extern PortholeClassRec portholeClassRec;
-
-#endif /* _XawPortholeP_h */
diff --git a/xc/lib/Xaw/Private.h b/xc/lib/Xaw/Private.h
deleted file mode 100644
index 5bdf73cb4..000000000
--- a/xc/lib/Xaw/Private.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 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 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.
- */
-
-/* $XFree86: xc/lib/Xaw/Private.h,v 3.10 1999/06/06 08:48:07 dawes Exp $ */
-
-#ifndef _XawPrivate_h
-#define _XawPrivate_h
-
-#define XawMax(a, b) ((a) > (b) ? (a) : (b))
-#define XawMin(a, b) ((a) < (b) ? (a) : (b))
-#define XawAbs(a) ((a) < 0 ? -(a) : (a))
-
-#define XawStackAlloc(size, stk_buffer) \
-((size) <= sizeof(stk_buffer) \
- ? (XtPointer)(stk_buffer) \
- : XtMalloc((unsigned)(size)))
-
-#define XawStackFree(pointer, stk_buffer) \
-do { \
- if ((pointer) != (XtPointer)(stk_buffer)) \
- XtFree((char *)pointer); \
-} while (0)
-
-#ifndef XtX
-#define XtX(w) (((RectObj)w)->rectangle.x)
-#endif
-#ifndef XtY
-#define XtY(w) (((RectObj)w)->rectangle.y)
-#endif
-#ifndef XtWidth
-#define XtWidth(w) (((RectObj)w)->rectangle.width)
-#endif
-#ifndef XtHeight
-#define XtHeight(w) (((RectObj)w)->rectangle.height)
-#endif
-#ifndef XtBorderWidth
-#define XtBorderWidth(w) (((RectObj)w)->rectangle.border_width)
-#endif
-
-#ifndef OLDXAW
-#define XAW_PRIV_VAR_PREFIX '$'
-
-typedef Bool (*XawParseBooleanProc)(Widget, String, XEvent*, Bool*);
-
-typedef struct _XawActionVarList XawActionVarList;
-typedef struct _XawActionResList XawActionResList;
-
-/* Boolean expressions */
-Bool XawParseBoolean(Widget, String, XEvent*, Bool*);
-Bool XawBooleanExpression(Widget, String, XEvent*);
-
-/* actions */
-void XawPrintActionErrorMsg(String, Widget, String*, Cardinal*);
-XawActionResList *XawGetActionResList(WidgetClass);
-XawActionVarList *XawGetActionVarList(Widget);
-
-void XawSetValuesAction(Widget, XEvent*, String*, Cardinal*);
-void XawGetValuesAction(Widget, XEvent*, String*, Cardinal*);
-void XawDeclareAction(Widget, XEvent*, String*, Cardinal*);
-void XawCallProcAction(Widget, XEvent*, String*, Cardinal*);
-
-/* display lists */
-#define XAWDL_CONVERT_ERROR (XtPointer)-1
-typedef struct _XawDL _XawDisplayList;
-typedef struct _XawDLClass XawDLClass, XawDisplayListClass;
-
-typedef void (*XawDisplayListProc)(Widget, XtPointer, XtPointer,
- XEvent*, Region);
-typedef void *(*XawDLArgsInitProc)(String, String*, Cardinal*,
- Screen*, Colormap, int);
-typedef void *(*XawDLDataInitProc)(String,
- Screen*, Colormap, int);
-typedef void (*XawDLArgsDestructor)(Display*, String, XtPointer,
- String*, Cardinal*);
-typedef void (*XawDLDataDestructor)(Display*, String, XtPointer);
-
-void XawRunDisplayList(Widget, _XawDisplayList*, XEvent*, Region);
-void XawDisplayListInitialize(void);
-
-_XawDisplayList *XawCreateDisplayList(String, Screen*, Colormap, int);
-void XawDestroyDisplayList(_XawDisplayList*);
-String XawDisplayListString(_XawDisplayList*);
-XawDLClass *XawGetDisplayListClass(String);
-XawDLClass *XawCreateDisplayListClass(String,
- XawDLArgsInitProc, XawDLArgsDestructor,
- XawDLDataInitProc, XawDLDataDestructor);
-Bool XawDeclareDisplayListProc(XawDLClass*, String, XawDisplayListProc);
-
-/* pixmaps */
-typedef struct _XawArgVal {
- String name;
- String value;
-} XawArgVal;
-
-typedef struct _XawParams {
- String name;
- String type;
- String ext;
- XawArgVal **args;
- Cardinal num_args;
-} XawParams;
-
-typedef struct _XawPixmap {
- String name;
- Pixmap pixmap;
- Pixmap mask;
- Dimension width;
- Dimension height;
-} XawPixmap;
-
-typedef Bool (*XawPixmapLoader)(XawParams*, Screen*, Colormap, int,
- Pixmap*, Pixmap*,
- Dimension*, Dimension*);
-Bool XawPixmapsInitialize(void);
-Bool XawAddPixmapLoader(String, String, XawPixmapLoader);
-XawPixmap *XawLoadPixmap(String, Screen*, Colormap, int);
-XawPixmap *XawPixmapFromXPixmap(Pixmap, Screen*, Colormap, int);
-XawParams *XawParseParamsString(String name);
-void XawFreeParamsStruct(XawParams *params);
-XawArgVal *XawFindArgVal(XawParams *params, String name);
-void XawReshapeWidget(Widget, XawPixmap*);
-#endif /* OLDXAW */
-
-/* misc */
-void XawTypeToStringWarning(Display*, String);
-
-/* OS.c */
-int _XawGetPageSize(void);
-
-#endif /* _XawPrivate_h */
diff --git a/xc/lib/Xaw/Repeater.c b/xc/lib/Xaw/Repeater.c
deleted file mode 100644
index f8fc16cdc..000000000
--- a/xc/lib/Xaw/Repeater.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * $TOG: Repeater.c /main/13 1998/02/11 14:54:39 kaleb $
- *
-Copyright 1990, 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.
- *
- * Author: Jim Fulton, MIT X Consortium
- *
- * This widget is used for press-and-hold style buttons.
- */
-/* $XFree86: xc/lib/Xaw/Repeater.c,v 1.5 1999/06/06 08:48:07 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/RepeaterP.h>
-#include <X11/Xaw/XawInit.h>
-
-#define DO_CALLBACK(rw) \
-XtCallCallbackList((Widget)rw, rw->command.callbacks, NULL)
-
-#define ADD_TIMEOUT(rw, delay) \
-XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)rw), \
- delay, tic, (XtPointer)rw)
-
-#define CLEAR_TIMEOUT(rw) \
-if ((rw)->repeater.timer) { \
- XtRemoveTimeOut((rw)->repeater.timer); \
- (rw)->repeater.timer = 0; \
-}
-
-/*
- * Class Methods
- */
-static void XawRepeaterInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawRepeaterDestroy(Widget);
-static Boolean XawRepeaterSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void tic(XtPointer, XtIntervalId*);
-
-/*
- * Actions
- */
-static void ActionStart(Widget, XEvent*, String*, Cardinal*);
-static void ActionStop(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-static char defaultTranslations[] =
-"<Enter>:" "highlight()\n"
-"<Leave>:" "unhighlight()\n"
-"<Btn1Down>:" "set() start()\n"
-"<Btn1Up>:" "stop() unset()\n"
-;
-
-static XtActionsRec actions[] = {
- {"start", ActionStart},
- {"stop", ActionStop},
-};
-
-#define offset(field) XtOffsetOf(RepeaterRec, repeater.field)
-static XtResource resources[] = {
- {
- XtNdecay,
- XtCDecay,
- XtRInt,
- sizeof(int),
- offset(decay),
- XtRImmediate,
- (XtPointer)REP_DEF_DECAY
- },
- {
- XtNinitialDelay,
- XtCDelay,
- XtRInt,
- sizeof(int),
- offset(initial_delay),
- XtRImmediate,
- (XtPointer)REP_DEF_INITIAL_DELAY
- },
- {
- XtNminimumDelay,
- XtCMinimumDelay,
- XtRInt,
- sizeof(int),
- offset(minimum_delay),
- XtRImmediate,
- (XtPointer)REP_DEF_MINIMUM_DELAY
- },
- {
- XtNrepeatDelay,
- XtCDelay,
- XtRInt,
- sizeof(int),
- offset(repeat_delay),
- XtRImmediate,
- (XtPointer)REP_DEF_REPEAT_DELAY
- },
- {
- XtNflash,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(flash),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNstartCallback,
- XtCStartCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(start_callbacks),
- XtRImmediate,
- NULL
- },
- {
- XtNstopCallback,
- XtCStopCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(stop_callbacks),
- XtRImmediate,
- NULL
- },
-};
-#undef offset
-
-#define Superclass (&commandClassRec)
-RepeaterClassRec repeaterClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Repeater", /* class_name */
- sizeof(RepeaterRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawRepeaterInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawRepeaterDestroy, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- XawRepeaterSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* label */
- {
- NULL, /* extension */
- },
- /* command */
- {
- NULL, /* extension */
- },
- /* repeater */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec;
-
-
-/*
- * Implementation
- */
-/*ARGSUSED*/
-static void
-tic(XtPointer client_data, XtIntervalId *id)
-{
- RepeaterWidget rw = (RepeaterWidget)client_data;
-
- rw->repeater.timer = 0; /* timer is removed */
- if (rw->repeater.flash) {
- Widget w = (Widget)rw;
-
- XClearWindow(XtDisplay(w), XtWindow(w));
- XtCallActionProc(w, "reset", NULL, NULL, 0);
- XClearWindow(XtDisplay(w), XtWindow(w));
- XtCallActionProc(w, "set", NULL, NULL, 0);
- }
- DO_CALLBACK(rw);
-
- rw->repeater.timer = ADD_TIMEOUT(rw, rw->repeater.next_delay);
-
- if (rw->repeater.decay) {
- rw->repeater.next_delay -= rw->repeater.decay;
- if (rw->repeater.next_delay < rw->repeater.minimum_delay)
- rw->repeater.next_delay = rw->repeater.minimum_delay;
- }
-}
-
-/*ARGSUSED*/
-static void
-XawRepeaterInitialize(Widget greq, Widget gnew,
- ArgList args, Cardinal *num_args)
-{
- RepeaterWidget cnew = (RepeaterWidget)gnew;
-
- if (cnew->repeater.minimum_delay < 0)
- cnew->repeater.minimum_delay = 0;
- cnew->repeater.timer = 0;
-}
-
-static void
-XawRepeaterDestroy(Widget gw)
-{
- CLEAR_TIMEOUT((RepeaterWidget)gw);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawRepeaterSetValues(Widget gcur, Widget greq, Widget gnew,
- ArgList args, Cardinal *num_args)
-{
- RepeaterWidget cur = (RepeaterWidget)gcur;
- RepeaterWidget cnew = (RepeaterWidget)gnew;
-
- if (cur->repeater.minimum_delay != cnew->repeater.minimum_delay) {
- if (cnew->repeater.next_delay < cnew->repeater.minimum_delay)
- cnew->repeater.next_delay = cnew->repeater.minimum_delay;
- }
-
- return (False);
-}
-
-/*ARGSUSED*/
-static void
-ActionStart(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- RepeaterWidget rw = (RepeaterWidget)gw;
-
- CLEAR_TIMEOUT(rw);
- if (rw->repeater.start_callbacks)
- XtCallCallbackList(gw, rw->repeater.start_callbacks, NULL);
-
- DO_CALLBACK(rw);
- rw->repeater.timer = ADD_TIMEOUT(rw, rw->repeater.initial_delay);
- rw->repeater.next_delay = rw->repeater.repeat_delay;
-}
-
-/*ARGSUSED*/
-static void
-ActionStop(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- RepeaterWidget rw = (RepeaterWidget)gw;
-
- CLEAR_TIMEOUT((RepeaterWidget)gw);
- if (rw->repeater.stop_callbacks)
- XtCallCallbackList(gw, rw->repeater.stop_callbacks, NULL);
-}
diff --git a/xc/lib/Xaw/Repeater.h b/xc/lib/Xaw/Repeater.h
deleted file mode 100644
index e2cf08f2d..000000000
--- a/xc/lib/Xaw/Repeater.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * $TOG: Repeater.h /main/6 1998/02/11 14:54: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.
- *
- * Author: Jim Fulton, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/Repeater.h,v 1.4 1998/10/03 08:42:16 dawes Exp $ */
-
-#ifndef _XawRepeater_h
-#define _XawRepeater_h
-
-#include <X11/Xaw/Command.h>
-
-/*****************************************************************************
- *
- * Repeater Widget (subclass of Command)
- *
- * This widget is a push button that repeatedly fires when held down
- *
- * Parameters:
- *
- * Name Class Type Default
- * ---- ----- ---- -------
- *
- * decay Decay int 5 milliseconds
- * flash Boolean Boolean FALSE
- * initialDelay Delay int 200 milliseconds
- * minimumDelay MinimumDelay int 10 milliseconds
- * repeatDelay Delay int 50 milliseconds
- * startCallback StartCallback XtCallbackList NULL
- * stopCallback StopCallback XtCallbackList NULL
- *
- *****************************************************************************/
-
-#define XtNdecay "decay"
-#define XtCDecay "Decay"
-#define XtNinitialDelay "initialDelay"
-#define XtCDelay "Delay"
-#define XtNminimumDelay "minimumDelay"
-#define XtCMinimumDelay "MinimumDelay"
-#define XtNrepeatDelay "repeatDelay"
-#define XtNflash "flash"
-#define XtNstartCallback "startCallback"
-#define XtCStartCallback "StartCallback"
-#define XtNstopCallback "stopCallback"
-#define XtCStopCallback "StopCallback"
-
-
-extern WidgetClass repeaterWidgetClass;
-
-typedef struct _RepeaterClassRec *RepeaterWidgetClass;
-typedef struct _RepeaterRec *RepeaterWidget;
-
-#endif /* _XawRepeater_h */
diff --git a/xc/lib/Xaw/RepeaterP.h b/xc/lib/Xaw/RepeaterP.h
deleted file mode 100644
index 4fcbb51a7..000000000
--- a/xc/lib/Xaw/RepeaterP.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * $TOG: RepeaterP.h /main/6 1998/02/11 14:54:35 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: Jim Fulton, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/RepeaterP.h,v 1.6 1999/06/20 08:41:05 dawes Exp $ */
-
-#ifndef _XawRepeaterP_h
-#define _XawRepeaterP_h
-
-#include <X11/Xaw/CommandP.h>
-#include <X11/Xaw/Repeater.h>
-
-/* new fields in widget class */
-typedef struct {
- XtPointer extension;
-} RepeaterClassPart;
-
-/* repeater widget class */
-typedef struct _RepeaterClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- LabelClassPart label_class;
- CommandClassPart command_class;
- RepeaterClassPart repeater_class;
-} RepeaterClassRec;
-
-typedef struct {
- /* resources */
- int initial_delay; /* initialDelay/Delay */
- int repeat_delay; /* repeatDelay/Delay */
- int minimum_delay; /* minimumDelay/MinimumDelay */
- int decay; /* decay to minimum delay */
- Boolean flash; /* flash/Boolean */
- XtCallbackList start_callbacks; /* startCallback/StartCallback */
- XtCallbackList stop_callbacks; /* stopCallback/StopCallback */
-
- /* private */
- int next_delay; /* next amount for timer */
- XtIntervalId timer; /* timer that will fire */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} RepeaterPart;
-
-typedef struct _RepeaterRec {
- CorePart core;
- SimplePart simple;
- LabelPart label;
- CommandPart command;
- RepeaterPart repeater;
-} RepeaterRec;
-
- /* milliseconds */
-#define REP_DEF_DECAY 5
-#define REP_DEF_INITIAL_DELAY 200
-#define REP_DEF_MINIMUM_DELAY 10
-#define REP_DEF_REPEAT_DELAY 50
-
-extern RepeaterClassRec repeaterClassRec;
-
-#endif /* _XawRepeaterP_h */
diff --git a/xc/lib/Xaw/Reports.h b/xc/lib/Xaw/Reports.h
deleted file mode 100644
index 2c652d69c..000000000
--- a/xc/lib/Xaw/Reports.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * $TOG: Reports.h /main/5 1998/02/06 12:48: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.
- */
-
-#ifndef _Xaw_Reports_h
-#define _Xaw_Reports_h
-
-/*
- * XawPannerReport - this structure is used by the reportCallback of the
- * Panner, Porthole, Viewport, and Scrollbar widgets to report its position.
- * All fields must be filled in, although the changed field may be used as
- * a hint as to which fields have been altered since the last report.
- */
-typedef struct {
- unsigned int changed; /* mask, see below */
- Position slider_x, slider_y; /* location of slider within outer */
- Dimension slider_width, slider_height; /* size of slider */
- Dimension canvas_width, canvas_height; /* size of canvas */
-} XawPannerReport;
-
-#define XawPRSliderX (1 << 0)
-#define XawPRSliderY (1 << 1)
-#define XawPRSliderWidth (1 << 2)
-#define XawPRSliderHeight (1 << 3)
-#define XawPRCanvasWidth (1 << 4)
-#define XawPRCanvasHeight (1 << 5)
-#define XawPRAll (63) /* union of above */
-
-#define XtNreportCallback "reportCallback"
-#define XtCReportCallback "reportCallback"
-
-#endif /* _Xaw_Reports_h */
diff --git a/xc/lib/Xaw/Scrollbar.c b/xc/lib/Xaw/Scrollbar.c
deleted file mode 100644
index 3e204a450..000000000
--- a/xc/lib/Xaw/Scrollbar.c
+++ /dev/null
@@ -1,873 +0,0 @@
-/* $TOG: Scrollbar.c /main/73 1998/02/06 12:48:56 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Scrollbar.c,v 1.9 1999/06/06 08:48:08 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xaw/ScrollbarP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define NoButton -1
-#define PICKLENGTH(widget, x, y) \
-(((widget)->scrollbar.orientation == XtorientHorizontal) ? (x) : (y))
-
-/*
- * Class Methods
- */
-static void XawScrollbarClassInitialize(void);
-static void XawScrollbarDestroy(Widget);
-static void XawScrollbarInitialize(Widget, Widget, ArgList, Cardinal*_args);
-static void XawScrollbarRealize(Widget, Mask*, XSetWindowAttributes*);
-static void XawScrollbarRedisplay(Widget, XEvent*, Region);
-static void XawScrollbarResize(Widget);
-static Boolean XawScrollbarSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static Boolean CompareEvents(XEvent*, XEvent*);
-static void CreateGC(Widget);
-static float FloatInRange(float, float, float);
-static float FractionLoc(ScrollbarWidget, int, int);
-static void ExtractPosition(XEvent*, Position*, Position*);
-static int InRange(int, int, int);
-static void FillArea(ScrollbarWidget, int, int, int);
-static Bool LookAhead(Widget, XEvent*);
-static void PaintThumb(ScrollbarWidget);
-static Bool PeekNotifyEvent(Display*, XEvent*, char*);
-static void SetDimensions(ScrollbarWidget);
-
-/*
- * Actions
- */
-static void EndScroll(Widget, XEvent*, String*, Cardinal*);
-static void MoveThumb(Widget, XEvent*, String*, Cardinal*);
-static void NotifyScroll(Widget, XEvent*, String*, Cardinal*);
-static void NotifyThumb(Widget, XEvent*, String*, Cardinal*);
-static void StartScroll(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-static char defaultTranslations[] =
-"<Btn1Down>:" "StartScroll(Forward)\n"
-"<Btn2Down>:" "StartScroll(Continuous) MoveThumb() NotifyThumb()\n"
-"<Btn3Down>:" "StartScroll(Backward)\n"
-"<Btn2Motion>:" "MoveThumb() NotifyThumb()\n"
-"<BtnUp>:" "NotifyScroll(Proportional) EndScroll()\n";
-
-static float floatZero = 0.0;
-
-#define Offset(field) XtOffsetOf(ScrollbarRec, field)
-
-static XtResource resources[] = {
- {
- XtNlength,
- XtCLength,
- XtRDimension,
- sizeof(Dimension),
- Offset(scrollbar.length),
- XtRImmediate,
- (XtPointer)1
- },
- {
- XtNthickness,
- XtCThickness,
- XtRDimension,
- sizeof(Dimension),
- Offset(scrollbar.thickness),
- XtRImmediate,
- (XtPointer)14
- },
- {
- XtNorientation,
- XtCOrientation,
- XtROrientation,
- sizeof(XtOrientation),
- Offset(scrollbar.orientation),
- XtRImmediate,
- (XtPointer)XtorientVertical
- },
- {
- XtNscrollProc,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- Offset(scrollbar.scrollProc),
- XtRCallback,
- NULL
- },
- {
- XtNthumbProc,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- Offset(scrollbar.thumbProc),
- XtRCallback,
- NULL
- },
- {
- XtNjumpProc,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- Offset(scrollbar.jumpProc),
- XtRCallback,
- NULL
- },
- {
- XtNthumb,
- XtCThumb,
- XtRBitmap,
- sizeof(Pixmap),
- Offset(scrollbar.thumb),
- XtRImmediate,
- (XtPointer)XtUnspecifiedPixmap
- },
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- Offset(scrollbar.foreground),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNshown,
- XtCShown,
- XtRFloat,
- sizeof(float),
- Offset(scrollbar.shown),
- XtRFloat,
- (XtPointer)&floatZero
- },
- {
- XtNtopOfThumb,
- XtCTopOfThumb,
- XtRFloat,
- sizeof(float),
- Offset(scrollbar.top),
- XtRFloat,
- (XtPointer)&floatZero
- },
- {
- XtNscrollVCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- Offset(scrollbar.verCursor),
- XtRString,
- "sb_v_double_arrow"
- },
- {
- XtNscrollHCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- Offset(scrollbar.horCursor),
- XtRString,
- "sb_h_double_arrow"
- },
- {
- XtNscrollUCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- Offset(scrollbar.upCursor),
- XtRString,
- "sb_up_arrow"
- },
- {
- XtNscrollDCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- Offset(scrollbar.downCursor),
- XtRString,
- "sb_down_arrow"
- },
- {
- XtNscrollLCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- Offset(scrollbar.leftCursor),
- XtRString,
- "sb_left_arrow"
- },
- {
- XtNscrollRCursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- Offset(scrollbar.rightCursor),
- XtRString,
- "sb_right_arrow"
- },
- {
- XtNminimumThumb,
- XtCMinimumThumb,
- XtRDimension,
- sizeof(Dimension),
- Offset(scrollbar.min_thumb),
- XtRImmediate,
- (XtPointer)7
- },
-};
-#undef Offset
-
-static XtActionsRec actions[] = {
- {"StartScroll", StartScroll},
- {"MoveThumb", MoveThumb},
- {"NotifyThumb", NotifyThumb},
- {"NotifyScroll", NotifyScroll},
- {"EndScroll", EndScroll},
-};
-
-#define Superclass (&simpleClassRec)
-ScrollbarClassRec scrollbarClassRec = {
- /* core */
- {
- (WidgetClass)&simpleClassRec, /* superclass */
- "Scrollbar", /* class_name */
- sizeof(ScrollbarRec), /* widget_size */
- XawScrollbarClassInitialize, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- XawScrollbarInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawScrollbarRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawScrollbarDestroy, /* destroy */
- XawScrollbarResize, /* resize */
- XawScrollbarRedisplay, /* expose */
- XawScrollbarSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* scrollbar */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec;
-
-/*
- * Implementation
- */
-static void
-XawScrollbarClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation,
- NULL, 0);
- XtSetTypeConverter(XtROrientation, XtRString, XmuCvtOrientationToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/*
- * Make sure the first number is within the range specified by the other
- * two numbers.
- */
-static int
-InRange(int num, int small, int big)
-{
- return ((num < small) ? small : ((num > big) ? big : num));
-}
-
-/*
- * Same as above, but for floating numbers
- */
-static float
-FloatInRange(float num, float small, float big)
-{
- return ((num < small) ? small : ((num > big) ? big : num));
-}
-
-/* Fill the area specified by top and bottom with the given pattern */
-static float
-FractionLoc(ScrollbarWidget w, int x, int y)
-{
- float result;
-
- result = PICKLENGTH(w, x / (float)XtWidth(w), y / (float)XtHeight(w));
-
- return (FloatInRange(result, 0.0, 1.0));
-}
-
-static void
-FillArea(ScrollbarWidget w, int top, int bottom, int thumb)
-{
- Dimension length;
-
- top = XawMax(1, top);
- if (w->scrollbar.orientation == XtorientHorizontal)
- bottom = XawMin(bottom, XtWidth(w) - 1);
- else
- bottom = XawMin(bottom, XtHeight(w) - 1);
-
- if (bottom <= top)
- return;
-
- length = bottom - top;
-
- switch(thumb) {
- /* Fill the new Thumb location */
- case 1:
- if (w->scrollbar.orientation == XtorientHorizontal)
- XFillRectangle(XtDisplay(w), XtWindow(w), w->scrollbar.gc,
- top, 1, length, XtHeight(w) - 2);
- else
- XFillRectangle(XtDisplay(w), XtWindow(w), w->scrollbar.gc,
- 1, top, XtWidth(w) - 2, length);
- break;
- /* Clear the old Thumb location */
- case 0:
- if (w->scrollbar.orientation == XtorientHorizontal)
- XClearArea(XtDisplay(w), XtWindow(w),
- top, 1, length, XtHeight(w) - 2, False);
- else
- XClearArea(XtDisplay(w), XtWindow(w),
- 1, top, XtWidth(w) - 2, length, False);
- break;
- }
-}
-
-
-/* Paint the thumb in the area specified by w->top and
- w->shown. The old area is erased. The painting and
- erasing is done cleverly so that no flickering will occur. */
-static void
-PaintThumb(ScrollbarWidget w)
-{
- Position oldtop, oldbot, newtop, newbot;
-
- oldtop = w->scrollbar.topLoc;
- oldbot = oldtop + w->scrollbar.shownLength;
- newtop = w->scrollbar.length * w->scrollbar.top;
- newbot = newtop + (int)(w->scrollbar.length * w->scrollbar.shown);
- if (newbot < newtop + (int)w->scrollbar.min_thumb)
- newbot = newtop + w->scrollbar.min_thumb;
- w->scrollbar.topLoc = newtop;
- w->scrollbar.shownLength = newbot - newtop;
-
- if (XtIsRealized((Widget)w)) {
- if (newtop < oldtop)
- FillArea(w, newtop, XawMin(newbot, oldtop), 1);
- if (newtop > oldtop)
- FillArea(w, oldtop, XawMin(newtop, oldbot), 0);
- if (newbot < oldbot)
- FillArea(w, XawMax(newbot, oldtop), oldbot, 0);
- if (newbot > oldbot)
- FillArea(w, XawMax(newtop, oldbot), newbot, 1);
- }
-}
-
-static void
-SetDimensions(ScrollbarWidget w)
-{
- if (w->scrollbar.orientation == XtorientVertical) {
- w->scrollbar.length = XtHeight(w);
- w->scrollbar.thickness = XtWidth(w);
- }
- else {
- w->scrollbar.length = XtWidth(w);
- w->scrollbar.thickness = XtHeight(w);
- }
-}
-
-static void
-XawScrollbarDestroy(Widget w)
-{
- ScrollbarWidget sbw = (ScrollbarWidget)w;
-
- XtReleaseGC(w, sbw->scrollbar.gc);
-}
-
-static void
-CreateGC(Widget w)
-{
- ScrollbarWidget sbw = (ScrollbarWidget)w;
- XGCValues gcValues;
- XtGCMask mask;
- unsigned int depth = 1;
-
- if (sbw->scrollbar.thumb == XtUnspecifiedPixmap)
- sbw->scrollbar.thumb = XmuCreateStippledPixmap(XtScreen(w),
- (Pixel)1, (Pixel)0,
- depth);
- else if (sbw->scrollbar.thumb != None) {
- Window root;
- int x, y;
- unsigned int width, height, bw;
-
- XGetGeometry(XtDisplay(w), sbw->scrollbar.thumb, &root, &x, &y,
- &width, &height, &bw, &depth);
- }
-
- gcValues.foreground = sbw->scrollbar.foreground;
- gcValues.background = sbw->core.background_pixel;
- mask = GCForeground | GCBackground;
-
- if (sbw->scrollbar.thumb != None) {
- if (depth == 1) {
- gcValues.fill_style = FillOpaqueStippled;
- gcValues.stipple = sbw->scrollbar.thumb;
- mask |= GCFillStyle | GCStipple;
- }
- else {
- gcValues.fill_style = FillTiled;
- gcValues.tile = sbw->scrollbar.thumb;
- mask |= GCFillStyle | GCTile;
- }
- }
- sbw->scrollbar.gc = XtGetGC(w, mask, &gcValues);
-}
-
-/* ARGSUSED */
-static void
-XawScrollbarInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ScrollbarWidget w = (ScrollbarWidget)cnew;
-
- CreateGC(cnew);
-
- if (XtWidth(w) == 0)
- XtWidth(w) = w->scrollbar.orientation == XtorientVertical ?
- w->scrollbar.thickness : w->scrollbar.length;
-
- if (XtHeight(w) == 0)
- XtHeight(w) = w->scrollbar.orientation == XtorientHorizontal ?
- w->scrollbar.thickness : w->scrollbar.length;
-
- SetDimensions(w);
- w->scrollbar.direction = 0;
- w->scrollbar.topLoc = 0;
- w->scrollbar.shownLength = w->scrollbar.min_thumb;
-}
-
-static void
-XawScrollbarRealize(Widget gw, Mask *valueMask,
- XSetWindowAttributes *attributes)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
-
- w->scrollbar.inactiveCursor = w->scrollbar.orientation == XtorientVertical ?
- w->scrollbar.verCursor : w->scrollbar.horCursor;
-
- XtVaSetValues(gw, XtNcursor, w->scrollbar.inactiveCursor, NULL);
-
- /*
- * The Simple widget actually stuffs the value in the valuemask
- */
- (*scrollbarWidgetClass->core_class.superclass->core_class.realize)
- (gw, valueMask, attributes);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawScrollbarSetValues(Widget current, Widget request, Widget desired,
- ArgList args, Cardinal *num_args)
-{
- ScrollbarWidget w = (ScrollbarWidget)current;
- ScrollbarWidget dw = (ScrollbarWidget)desired;
- Boolean redraw = False;
-
- /*
- * If these values are outside the acceptable range ignore them...
- */
- if (dw->scrollbar.top < 0.0 || dw->scrollbar.top > 1.0)
- dw->scrollbar.top = w->scrollbar.top;
-
- if (dw->scrollbar.shown < 0.0 || dw->scrollbar.shown > 1.0)
- dw->scrollbar.shown = w->scrollbar.shown;
-
- if (XtIsRealized (desired)) {
- if (w->scrollbar.foreground != dw->scrollbar.foreground ||
- w->core.background_pixel != dw->core.background_pixel ||
- w->scrollbar.thumb != dw->scrollbar.thumb) {
- XtReleaseGC((Widget)dw, w->scrollbar.gc);
- CreateGC((Widget)dw);
- redraw = True;
- }
- if (w->scrollbar.top != dw->scrollbar.top ||
- w->scrollbar.shown != dw->scrollbar.shown)
- redraw = True;
- }
-
- return (redraw);
-}
-
-static void
-XawScrollbarResize(Widget gw)
-{
- /* ForgetGravity has taken care of background, but thumb may
- * have to move as a result of the new size. */
- SetDimensions((ScrollbarWidget)gw);
- XawScrollbarRedisplay(gw, NULL, NULL);
-}
-
-/*ARGSUSED*/
-static void
-XawScrollbarRedisplay(Widget gw, XEvent *event, Region region)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
- int x, y;
- unsigned int width, height;
-
- if (Superclass->core_class.expose)
- (*Superclass->core_class.expose)(gw, event, region);
-
- if (w->scrollbar.orientation == XtorientHorizontal) {
- x = w->scrollbar.topLoc;
- y = 1;
- width = w->scrollbar.shownLength;
- height = XtHeight(w) - 2;
- }
- else {
- x = 1;
- y = w->scrollbar.topLoc;
- width = XtWidth(w) - 2;
- height = w->scrollbar.shownLength;
- }
-
- if (region == NULL ||
- XRectInRegion(region, x, y, width, height) != RectangleOut) {
- /* Forces entire thumb to be painted */
- w->scrollbar.topLoc = -(w->scrollbar.length + 1);
- PaintThumb(w);
- }
-}
-
-/*ARGSUSED*/
-static void
-StartScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
- Cursor cursor;
- char direction;
-
- if (w->scrollbar.direction != 0) /* if we're already scrolling */
- return;
- if (*num_params > 0)
- direction = *params[0];
- else
- direction = 'C';
-
- w->scrollbar.direction = direction;
-
- switch(direction) {
- case 'B':
- case 'b':
- cursor = w->scrollbar.orientation == XtorientVertical ?
- w->scrollbar.downCursor : w->scrollbar.rightCursor;
- break;
- case 'F':
- case 'f':
- cursor = w->scrollbar.orientation == XtorientVertical ?
- w->scrollbar.upCursor : w->scrollbar.leftCursor;
- break;
- case 'C':
- case 'c':
- cursor = w->scrollbar.orientation == XtorientVertical ?
- w->scrollbar.rightCursor : w->scrollbar.upCursor;
- break;
- default:
- return; /* invalid invocation */
- }
-
- XtVaSetValues(gw, XtNcursor, cursor, NULL);
-
- XFlush(XtDisplay(w));
-}
-
-static Boolean
-CompareEvents(XEvent *oldEvent, XEvent *newEvent)
-{
-#define Check(field) if (newEvent->field != oldEvent->field) return (False)
-
- Check(xany.display);
- Check(xany.type);
- Check(xany.window);
-
- switch(newEvent->type) {
- case MotionNotify:
- Check(xmotion.state);
- break;
- case ButtonPress:
- case ButtonRelease:
- Check(xbutton.state);
- Check(xbutton.button);
- break;
- case KeyPress:
- case KeyRelease:
- Check(xkey.state);
- Check(xkey.keycode);
- break;
- case EnterNotify:
- case LeaveNotify:
- Check(xcrossing.mode);
- Check(xcrossing.detail);
- Check(xcrossing.state);
- break;
- }
-#undef Check
-
- return (True);
-}
-
-struct EventData {
- XEvent *oldEvent;
- int count;
-};
-
-static Bool
-PeekNotifyEvent(Display *dpy, XEvent *event, char *args)
-{
- struct EventData *eventData = (struct EventData*)args;
-
- return (++eventData->count == QLength(dpy) /* since PeekIf blocks */
- || CompareEvents(event, eventData->oldEvent));
-}
-
-static Bool
-LookAhead(Widget w, XEvent *event)
-{
- XEvent newEvent;
- struct EventData eventData;
-
- if (QLength(XtDisplay(w)) == 0)
- return (False);
-
- eventData.count = 0;
- eventData.oldEvent = event;
-
- XPeekIfEvent(XtDisplay(w), &newEvent, PeekNotifyEvent, (char*)&eventData);
-
- if (CompareEvents(event, &newEvent))
- return (True);
-
- return (False);
-}
-
-static void
-ExtractPosition(XEvent *event, Position *x, Position *y)
-{
- switch(event->type) {
- case MotionNotify:
- *x = event->xmotion.x;
- *y = event->xmotion.y;
- break;
- case ButtonPress:
- case ButtonRelease:
- *x = event->xbutton.x;
- *y = event->xbutton.y;
- break;
- case KeyPress:
- case KeyRelease:
- *x = event->xkey.x;
- *y = event->xkey.y;
- break;
- case EnterNotify:
- case LeaveNotify:
- *x = event->xcrossing.x;
- *y = event->xcrossing.y;
- break;
- default:
- *x = 0;
- *y = 0;
- break;
- }
-}
-
-static void
-NotifyScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
- int call_data = 0;
- char style;
- Position x, y;
-
- if (w->scrollbar.direction == 0) /* if no StartScroll */
- return;
-
- if (LookAhead(gw, event))
- return;
-
- if (*num_params > 0)
- style = *params[0];
- else
- style = 'P';
-
- switch(style) {
- case 'P': /* Proportional */
- case 'p':
- ExtractPosition(event, &x, &y);
- call_data = InRange(PICKLENGTH(w, x, y), 0, (int)w->scrollbar.length);
- break;
- case 'F': /* FullLength */
- case 'f':
- call_data = w->scrollbar.length;
- break;
- }
-
- switch(w->scrollbar.direction) {
- case 'B':
- case 'b':
- call_data = -call_data;
- /*FALLTHROUGH*/
- case 'F':
- case 'f':
- XtCallCallbacks(gw, XtNscrollProc, (XtPointer)call_data);
- break;
- case 'C':
- case 'c': /* NotifyThumb has already called the thumbProc(s) */
- break;
- }
-}
-
-/*ARGSUSED*/
-static void
-EndScroll(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
-
- XtVaSetValues(gw, XtNcursor, w->scrollbar.inactiveCursor, NULL);
- XFlush(XtDisplay(w)); /* make sure it get propogated */
-
- w->scrollbar.direction = 0;
-}
-
-/*ARGSUSED*/
-static void
-MoveThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
- Position x, y;
-
- if (w->scrollbar.direction == 0) /* if no StartScroll */
- return;
-
- if (LookAhead(gw, event))
- return;
-
- if (!event->xmotion.same_screen)
- return;
-
- ExtractPosition(event, &x, &y);
- w->scrollbar.top = FractionLoc(w, x, y);
-}
-
-/*ARGSUSED*/
-static void
-NotifyThumb(Widget gw, XEvent *event, String *params, Cardinal *num_params)
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
-
- if (w->scrollbar.direction == 0) /* if no StartScroll */
- return;
-
- if (LookAhead(gw, event))
- return;
-
- /* thumbProc is not pretty, but is necessary for backwards
- compatibility on those architectures for which it work{s,ed};
- the intent is to pass a (truncated) float by value. */
- XtCallCallbacks(gw, XtNthumbProc, *(XtPointer*)&w->scrollbar.top);
- XtCallCallbacks(gw, XtNjumpProc, (XtPointer)&w->scrollbar.top);
-
- PaintThumb(w);
-}
-
-/*
- * Public routines
- */
-/* Set the scroll bar to the given location. */
-void
-XawScrollbarSetThumb(Widget gw,
-#if NeedWidePrototypes
- double top, double shown
-#else
- float top, float shown
-#endif
- )
-{
- ScrollbarWidget w = (ScrollbarWidget)gw;
-
- if (w->scrollbar.direction == 'c') /* if still thumbing */
- return;
-
- w->scrollbar.top = top > 1.0 ? 1.0 : top >= 0.0 ? top : w->scrollbar.top;
-
- w->scrollbar.shown = shown > 1.0 ? 1.0 : shown >= 0.0 ?
- shown : w->scrollbar.shown;
- PaintThumb(w);
-}
diff --git a/xc/lib/Xaw/Scrollbar.h b/xc/lib/Xaw/Scrollbar.h
deleted file mode 100644
index b67f2fde7..000000000
--- a/xc/lib/Xaw/Scrollbar.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $TOG: Scrollbar.h /main/9 1998/02/06 12:49:02 kaleb $ */
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/Scrollbar.h,v 1.5 1999/05/03 12:15:42 dawes Exp $ */
-
-#ifndef _Scrollbar_h
-#define _Scrollbar_h
-
-/*
- * Scrollbar Widget
- */
-
-#include <X11/Xmu/Converters.h>
-#include <X11/Xfuncproto.h>
-
-/* Scrollbar resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- accelerators Accelerators AcceleratorTable NULL
- ancestorSensitive AncestorSensitive Boolean True
- background Background Pixel XtDefaultBackground
- backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
- borderColor BorderColor Pixel XtDefaultForeground
- borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
- borderWidth BorderWidth Dimension 1
- colormap Colormap Colormap parent's colormap
- cursor Cursor Cursor None
- cursorName Cursor String NULL
- depth Depth int parent's depth
- destroyCallback Callback XtCallbackList NULL
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension length or thickness
- insensitiveBorder Insensitive Pixmap GreyPixmap
- jumpProc Callback XtCallbackList NULL
- length Length Dimension 1
- mappedWhenManaged MappedWhenManaged Boolean True
- minimumThumb MinimumThumb Dimension 7
- orientation Orientation XtOrientation XtorientVertical
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- screen Screen Screen parent's screen
- scrollDCursor Cursor Cursor XC_sb_down_arrow
- scrollHCursor Cursor Cursor XC_sb_h_double_arrow
- scrollLCursor Cursor Cursor XC_sb_left_arrow
- scrollProc Callback XtCallbackList NULL
- scrollRCursor Cursor Cursor XC_sb_right_arrow
- scrollUCursor Cursor Cursor XC_sb_up_arrow
- scrollVCursor Cursor Cursor XC_sb_v_double_arrow
- sensitive Sensitive Boolean True
- shown Shown Float 0.0
- thickness Thickness Dimension 14
- thumb Thumb Bitmap GreyPixmap
- thumbProc Callback XtCallbackList NULL
- topOfThumb TopOfThumb Float 0.0
- translations Translations TranslationTable see source or doc
- width Width Dimension thickness or length
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtCMinimumThumb "MinimumThumb"
-#define XtCShown "Shown"
-#define XtCTopOfThumb "TopOfThumb"
-
-#define XtNminimumThumb "minimumThumb"
-#define XtNtopOfThumb "topOfThumb"
-
-typedef struct _ScrollbarRec *ScrollbarWidget;
-typedef struct _ScrollbarClassRec *ScrollbarWidgetClass;
-
-extern WidgetClass scrollbarWidgetClass;
-
-_XFUNCPROTOBEGIN
-
-void XawScrollbarSetThumb
-(
- Widget scrollbar,
-#if NeedWidePrototypes
- double top,
- double shown
-#else
- float top,
- float shown
-#endif
- );
-
-_XFUNCPROTOEND
-
-#endif /* _Scrollbar_h */
diff --git a/xc/lib/Xaw/ScrollbarP.h b/xc/lib/Xaw/ScrollbarP.h
deleted file mode 100644
index 45a34d618..000000000
--- a/xc/lib/Xaw/ScrollbarP.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * $TOG: ScrollbarP.h /main/4 1998/02/06 12:48:51 kaleb $
- */
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/ScrollbarP.h,v 1.6 1999/06/20 08:41:05 dawes Exp $ */
-
-#ifndef _ScrollbarP_h
-#define _ScrollbarP_h
-
-#include <X11/Xaw/Scrollbar.h>
-#include <X11/Xaw/SimpleP.h>
-
-typedef struct {
- /* resources */
- Pixel foreground; /* thumb foreground color */
- XtOrientation orientation; /* horizontal or vertical */
- XtCallbackList scrollProc; /* proportional scroll */
- XtCallbackList thumbProc; /* jump (to position) scroll */
- XtCallbackList jumpProc; /* same as thumbProc but pass data by ref */
- Pixmap thumb; /* thumb pixmap */
- Cursor upCursor; /* scroll up cursor */
- Cursor downCursor; /* scroll down cursor */
- Cursor leftCursor; /* scroll left cursor */
- Cursor rightCursor; /* scroll right cursor */
- Cursor verCursor; /* scroll vertical cursor */
- Cursor horCursor; /* scroll horizontal cursor */
- float top;
- float shown;
- Dimension length; /* either height or width */
- Dimension thickness; /* either width or height */
- Dimension min_thumb; /* minium size for the thumb */
-
- /* private */
- Cursor inactiveCursor; /* The normal cursor for scrollbar */
- char direction; /* a scroll has started; which direction */
- GC gc; /* a (shared) gc */
- Position topLoc; /* Pixel that corresponds to top */
- Dimension shownLength; /* Num pixels corresponding to shown */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} ScrollbarPart;
-
-typedef struct _ScrollbarRec {
- CorePart core;
- SimplePart simple;
- ScrollbarPart scrollbar;
-} ScrollbarRec;
-
-typedef struct {
- XtPointer extension;
-} ScrollbarClassPart;
-
-typedef struct _ScrollbarClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- ScrollbarClassPart scrollbar_class;
-} ScrollbarClassRec;
-
-extern ScrollbarClassRec scrollbarClassRec;
-
-#endif /* _ScrollbarP_h */
diff --git a/xc/lib/Xaw/Simple.c b/xc/lib/Xaw/Simple.c
deleted file mode 100644
index 66cfa55e0..000000000
--- a/xc/lib/Xaw/Simple.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/* $TOG: Simple.c /main/38 1998/06/24 11:53:29 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Simple.c,v 1.14 1999/06/27 14:07:34 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/SimpleP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-#ifndef OLDXAW
-#include <X11/Xaw/Tip.h>
-#endif
-
-/*
- * Class Methods
- */
-static Bool ChangeSensitive(Widget);
-static void XawSimpleClassInitialize(void);
-static void XawSimpleClassPartInitialize(WidgetClass);
-#ifndef OLDXAW
-static void XawSimpleExpose(Widget, XEvent*, Region);
-#endif
-static void XawSimpleRealize(Widget, Mask*, XSetWindowAttributes*);
-static Boolean XawSimpleSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void ConvertCursor(Widget);
-
-/*
- * Initialization
- */
-#ifndef OLDXAW
-static XtActionsRec actions[] = {
- {"set-values", XawSetValuesAction},
- {"get-values", XawGetValuesAction},
- {"declare", XawDeclareAction},
- {"call-proc", XawCallProcAction},
-};
-#endif
-
-#define offset(field) XtOffsetOf(SimpleRec, simple.field)
-static XtResource resources[] = {
- {
- XtNcursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(cursor),
- XtRImmediate,
- (XtPointer)None
- },
- {
- XtNinsensitiveBorder,
- XtCInsensitive,
- XtRPixmap,
- sizeof(Pixmap),
- offset(insensitive_border),
- XtRImmediate,
- NULL
- },
- {
- XtNpointerColor,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(pointer_fg),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNpointerColorBackground,
- XtCBackground,
- XtRPixel,
- sizeof(Pixel),
- offset(pointer_bg),
- XtRString,
- XtDefaultBackground
- },
- {
- XtNcursorName,
- XtCCursor,
- XtRString,
- sizeof(String),
- offset(cursor_name),
- XtRString,
- NULL
- },
- {
- XtNinternational,
- XtCInternational,
- XtRBoolean,
- sizeof(Boolean),
- offset(international),
- XtRImmediate,
- (XtPointer)False
- },
-#ifndef OLDXAW
- {
- XawNdisplayList,
- XawCDisplayList,
- XawRDisplayList,
- sizeof(XawDisplayList*),
- offset(display_list),
- XtRImmediate,
- NULL
- },
- {
- XtNtip,
- XtCTip,
- XtRString,
- sizeof(String),
- offset(tip),
- XtRImmediate,
- NULL
- },
-#endif
-#undef offset
-};
-
-SimpleClassRec simpleClassRec = {
- /* core */
- {
- (WidgetClass)&widgetClassRec, /* superclass */
- "Simple", /* class_name */
- sizeof(SimpleRec), /* widget_size */
- XawSimpleClassInitialize, /* class_initialize */
- XawSimpleClassPartInitialize, /* class_part_initialize */
- False, /* class_inited */
- NULL, /* initialize */
- NULL, /* initialize_hook */
- XawSimpleRealize, /* realize */
-#ifndef OLDXAW
- actions, /* actions */
- XtNumber(actions), /* num_actions */
-#else
- NULL, /* actions */
- 0, /* num_actions */
-#endif
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- NULL, /* resize */
-#ifndef OLDXAW
- XawSimpleExpose, /* expose */
-#else
- NULL, /* expose */
-#endif
- XawSimpleSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- ChangeSensitive, /* change_sensitive */
- },
-};
-
-WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec;
-
-static void
-XawSimpleClassInitialize(void)
-{
- static XtConvertArgRec convertArg[] = {
- {
- XtWidgetBaseOffset,
- (XtPointer)XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)
- },
- {
- XtResourceString,
- (XtPointer)XtNpointerColor,
- sizeof(Pixel)
- },
- {
- XtResourceString,
- (XtPointer)XtNpointerColorBackground,
- sizeof(Pixel)
- },
- {
- XtWidgetBaseOffset,
- (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
- sizeof(Colormap)
- },
- };
-
- XawInitializeWidgetSet();
- XtSetTypeConverter(XtRString, XtRColorCursor, XmuCvtStringToColorCursor,
- convertArg, XtNumber(convertArg), XtCacheByDisplay, NULL);
-}
-
-static void
-XawSimpleClassPartInitialize(WidgetClass cclass)
-{
- SimpleWidgetClass c = (SimpleWidgetClass)cclass;
- SimpleWidgetClass super = (SimpleWidgetClass)c->core_class.superclass;
-
- if (c->simple_class.change_sensitive == NULL) {
- char buf[BUFSIZ];
-
- (void)XmuSnprintf(buf, sizeof(buf),
- "%s Widget: The Simple Widget class method "
- "'change_sensitive' is undefined.\nA function "
- "must be defined or inherited.",
- c->core_class.class_name);
- XtWarning(buf);
- c->simple_class.change_sensitive = ChangeSensitive;
- }
-
- if (c->simple_class.change_sensitive == XtInheritChangeSensitive)
- c->simple_class.change_sensitive = super->simple_class.change_sensitive;
-}
-
-static void
-XawSimpleRealize(Widget w, Mask *valueMask, XSetWindowAttributes *attributes)
-{
-#ifndef OLDXAW
- XawPixmap *pixmap;
-#endif
- Pixmap border_pixmap = CopyFromParent;
-
- if (!XtIsSensitive(w))
- {
- /* change border to gray; have to remember the old one,
- * so XtDestroyWidget deletes the proper one */
- if (((SimpleWidget)w)->simple.insensitive_border == None)
- ((SimpleWidget)w)->simple.insensitive_border =
- XmuCreateStippledPixmap(XtScreen(w),
- w->core.border_pixel,
- w->core.background_pixel,
- w->core.depth);
- border_pixmap = w->core.border_pixmap;
- attributes->border_pixmap =
- w->core.border_pixmap = ((SimpleWidget)w)->simple.insensitive_border;
-
- *valueMask |= CWBorderPixmap;
- *valueMask &= ~CWBorderPixel;
- }
-
- ConvertCursor(w);
-
- if ((attributes->cursor = ((SimpleWidget)w)->simple.cursor) != None)
- *valueMask |= CWCursor;
-
- XtCreateWindow(w, InputOutput, (Visual *)CopyFromParent,
- *valueMask, attributes);
-
- if (!XtIsSensitive(w))
- w->core.border_pixmap = border_pixmap;
-
-#ifndef OLDXAW
- if (w->core.background_pixmap > XtUnspecifiedPixmap) {
- pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
- w->core.colormap, w->core.depth);
- if (pixmap && pixmap->mask)
- XawReshapeWidget(w, pixmap);
- }
-
- if (((SimpleWidget)w)->simple.tip)
- XawTipEnable(w);
-#endif
-}
-
-/*
- * Function:
- * ConvertCursor
- *
- * Parameters:
- * w - simple widget
- *
- * Description:
- * Converts a name to a new cursor.
- */
-static void
-ConvertCursor(Widget w)
-{
- SimpleWidget simple = (SimpleWidget) w;
- XrmValue from, to;
- Cursor cursor = None;
-
- if (simple->simple.cursor_name == NULL)
- return;
-
- from.addr = (XPointer)simple->simple.cursor_name;
- from.size = strlen((char *)from.addr) + 1;
-
- to.size = sizeof(Cursor);
- to.addr = (XPointer)&cursor;
-
- if (XtConvertAndStore(w, XtRString, &from, XtRColorCursor, &to))
- simple->simple.cursor = cursor;
- else
- XtAppErrorMsg(XtWidgetToApplicationContext(w),
- "convertFailed","ConvertCursor","XawError",
- "Simple: ConvertCursor failed.",
- NULL, NULL);
-}
-
-
-/*ARGSUSED*/
-static Boolean
-XawSimpleSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SimpleWidget s_old = (SimpleWidget)current;
- SimpleWidget s_new = (SimpleWidget)cnew;
- Bool new_cursor = False;
-
- /* this disables user changes after creation */
- s_new->simple.international = s_old->simple.international;
-
- if (XtIsSensitive(current) != XtIsSensitive(cnew))
- (*((SimpleWidgetClass)XtClass(cnew))->simple_class.change_sensitive)
- (cnew);
-
- if (s_old->simple.cursor != s_new->simple.cursor)
- new_cursor = True;
-
- /*
- * We are not handling the string cursor_name correctly here
- */
-
- if (s_old->simple.pointer_fg != s_new->simple.pointer_fg ||
- s_old->simple.pointer_bg != s_new->simple.pointer_bg ||
- s_old->simple.cursor_name != s_new->simple.cursor_name) {
- ConvertCursor(cnew);
- new_cursor = True;
- }
-
- if (new_cursor && XtIsRealized(cnew)) {
- if (s_new->simple.cursor != None)
- XDefineCursor(XtDisplay(cnew), XtWindow(cnew), s_new->simple.cursor);
- else
- XUndefineCursor(XtDisplay(cnew), XtWindow(cnew));
- }
-
-#ifndef OLDXAW
- if (s_old->core.background_pixmap != s_new->core.background_pixmap) {
- XawPixmap *opix, *npix;
-
- opix = XawPixmapFromXPixmap(s_old->core.background_pixmap,
- XtScreen(s_old), s_old->core.colormap,
- s_old->core.depth);
- npix = XawPixmapFromXPixmap(s_new->core.background_pixmap,
- XtScreen(s_new), s_new->core.colormap,
- s_new->core.depth);
- if ((npix && npix->mask) || (opix && opix->mask))
- XawReshapeWidget(cnew, npix);
- }
-
- if (s_old->simple.tip && !s_new->simple.tip)
- XawTipDisable(cnew);
- else if (!s_old->simple.tip && s_new->simple.tip)
- XawTipEnable(cnew);
-
- if (s_old->simple.display_list != s_new->simple.display_list)
- return (True);
-#endif /* OLDXAW */
-
- return (False);
-}
-
-#ifndef OLDXAW
-static void
-XawSimpleExpose(Widget w, XEvent *event, Region region)
-{
- SimpleWidget xaw = (SimpleWidget)w;
-
- if (xaw->simple.display_list)
- XawRunDisplayList(w, xaw->simple.display_list, event, region);
-}
-#endif
-
-static Bool
-ChangeSensitive(Widget w)
-{
- if (XtIsRealized(w)) {
- if (XtIsSensitive(w))
- if (w->core.border_pixmap != XtUnspecifiedPixmap)
- XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
- w->core.border_pixmap);
- else
- XSetWindowBorder(XtDisplay(w), XtWindow(w),
- w->core.border_pixel);
- else {
- if (((SimpleWidget)w)->simple.insensitive_border == None)
- ((SimpleWidget)w)->simple.insensitive_border =
- XmuCreateStippledPixmap(XtScreen(w),
- w->core.border_pixel,
- w->core.background_pixel,
- w->core.depth);
- XSetWindowBorderPixmap(XtDisplay(w), XtWindow(w),
- ((SimpleWidget)w)->simple.insensitive_border);
- }
- }
-
- return (False);
-}
diff --git a/xc/lib/Xaw/Simple.h b/xc/lib/Xaw/Simple.h
deleted file mode 100644
index 6c1794170..000000000
--- a/xc/lib/Xaw/Simple.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $TOG: Simple.h /main/15 1998/02/06 12:49:39 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Simple.h,v 1.7 1999/06/27 14:07:34 dawes Exp $ */
-
-#ifndef _Simple_h
-#define _Simple_h
-
-#include <X11/Xmu/Converters.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- cursor Cursor Cursor None
- cursorName Cursor String NULL
- destroyCallback Callback Pointer NULL
- displayList DisplayList XawDisplayList* NULL
- height Height Dimension 0
- insensitiveBorder Insensitive Pixmap Gray
- mappedWhenManaged MappedWhenManaged Boolean True
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- sensitive Sensitive Boolean True
- tip Tip String NULL
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtNcursor "cursor"
-#define XtNcursorName "cursorName"
-#define XtNinsensitiveBorder "insensitiveBorder"
-
-#define XtCInsensitive "Insensitive"
-
-#ifndef XtCInternational
-#define XtCInternational "International"
-#endif
-
-#ifndef XtNinternational
-#define XtNinternational "international"
-#endif
-
-#ifndef OLDXAW
-#ifndef XawNdisplayList
-#define XawNdisplayList "displayList"
-#endif
-
-#ifndef XawCDisplayList
-#define XawCDisplayList "DisplayList"
-#endif
-
-#ifndef XawRDisplayList
-#define XawRDisplayList "XawDisplayList"
-#endif
-
-#define XtNtip "tip"
-#define XtCTip "Tip"
-#endif /* OLDXAW */
-
-typedef struct _SimpleClassRec *SimpleWidgetClass;
-typedef struct _SimpleRec *SimpleWidget;
-
-extern WidgetClass simpleWidgetClass;
-
-#endif /* _Simple_h */
diff --git a/xc/lib/Xaw/SimpleMenP.h b/xc/lib/Xaw/SimpleMenP.h
deleted file mode 100644
index 058e91952..000000000
--- a/xc/lib/Xaw/SimpleMenP.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * $TOG: SimpleMenP.h /main/16 1998/02/11 14:54:47 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.
- *
- */
-/* $XFree86: xc/lib/Xaw/SimpleMenP.h,v 1.11 1999/06/20 08:41:05 dawes Exp $ */
-
-/*
- * SimpleMenuP.h - Private Header file for SimpleMenu widget.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _SimpleMenuP_h
-#define _SimpleMenuP_h
-
-#include <X11/Xaw/SimpleMenu.h>
-#include <X11/Xaw/SmeP.h>
-#include <X11/ShellP.h>
-#include <X11/Xaw/XawInit.h>
-
-typedef struct {
- XtPointer extension; /* For future needs */
-} SimpleMenuClassPart;
-
-typedef struct _SimpleMenuClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- OverrideShellClassPart override_shell_class;
- SimpleMenuClassPart simpleMenu_class;
-} SimpleMenuClassRec;
-
-extern SimpleMenuClassRec simpleMenuClassRec;
-
-typedef struct _SimpleMenuPart {
- /* resources */
- String label_string; /* The string for the label or NULL */
- SmeObject label; /* If label_string is non-NULL then this is
- the label widget */
- WidgetClass label_class; /* Widget Class of the menu label object */
- Dimension top_margin; /* Top and bottom margins */
- Dimension bottom_margin;
- Dimension row_height; /* height of each row (menu entry) */
- Cursor cursor; /* The menu's cursor */
- SmeObject popup_entry; /* The entry to position the cursor on for
- when using XawPositionSimpleMenu */
- Boolean menu_on_screen; /* Force the menus to be fully on the screen*/
- int backing_store; /* What type of backing store to use */
-
- /* private */
- Boolean recursive_set_values; /* contain a possible infinite loop */
- Boolean menu_width; /* If true then force width to remain
- core.width */
- Boolean menu_height; /* Just like menu_width, but for height */
- SmeObject entry_set; /* The entry that is currently set or
- highlighted */
-#ifndef OLDXAW
- Dimension left_margin;
- Dimension right_margin;
- XawDisplayList *display_list;
- Widget sub_menu;
- unsigned char state;
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} SimpleMenuPart;
-
-typedef struct _SimpleMenuRec {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- OverrideShellPart override;
- SimpleMenuPart simple_menu;
-} SimpleMenuRec;
-
-#endif /* _SimpleMenuP_h */
diff --git a/xc/lib/Xaw/SimpleMenu.c b/xc/lib/Xaw/SimpleMenu.c
deleted file mode 100644
index 500b210bb..000000000
--- a/xc/lib/Xaw/SimpleMenu.c
+++ /dev/null
@@ -1,1815 +0,0 @@
-/* $TOG: SimpleMenu.c /main/47 1998/06/24 11:53:33 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.
- */
-
-/* $XFree86: xc/lib/Xaw/SimpleMenu.c,v 3.19 1999/07/11 08:49:14 dawes Exp $ */
-
-/*
- * SimpleMenu.c - Source code file for SimpleMenu widget.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Initer.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/SimpleMenP.h>
-#include <X11/Xaw/SmeBSBP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
-#define ForAllChildren(smw, childP) \
-for ((childP) = (SmeObject *)(smw)->composite.children; \
- (childP) < (SmeObject *)((smw)->composite.children \
- + (smw)->composite.num_children); \
- (childP)++)
-
-#ifndef OLDXAW
-#define SMW_UNMAPPING 0x01
-#define SMW_POPLEFT 0x02
-#endif
-
-/*
- * Class Methods
- */
-static void XawSimpleMenuChangeManaged(Widget);
-static void XawSimpleMenuClassInitialize(void);
-static void XawSimpleMenuClassPartInitialize(WidgetClass);
-static XtGeometryResult XawSimpleMenuGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawSimpleMenuInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawSimpleMenuRealize(Widget, XtValueMask*, XSetWindowAttributes*);
-static void XawSimpleMenuRedisplay(Widget, XEvent*, Region);
-static void XawSimpleMenuResize(Widget);
-static Boolean XawSimpleMenuSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static Boolean XawSimpleMenuSetValuesHook(Widget, ArgList, Cardinal*);
-#ifndef OLDXAW
-static void PopupSubMenu(SimpleMenuWidget);
-static void PopdownSubMenu(SimpleMenuWidget);
-static void PopupCB(Widget, XtPointer, XtPointer);
-#endif
-
-/*
- * Prototypes
- */
-static void AddPositionAction(XtAppContext, XPointer);
-static void CalculateNewSize(Widget, Dimension*, Dimension*);
-static void ChangeCursorOnGrab(Widget, XtPointer, XtPointer);
-static void CreateLabel(Widget);
-static SmeObject DoGetEventEntry(Widget, int, int);
-static Widget FindMenu(Widget, String);
-static SmeObject GetEventEntry(Widget, XEvent*);
-static void Layout(Widget, Dimension*, Dimension*);
-static void MakeResizeRequest(Widget);
-static void MakeSetValuesRequest(Widget, unsigned int, unsigned int);
-static void MoveMenu(Widget, int, int);
-static void PositionMenu(Widget, XPoint*);
-
-/*
- * Actions
- */
-static void Highlight(Widget, XEvent*, String*, Cardinal*);
-static void Notify(Widget, XEvent*, String*, Cardinal*);
-#ifndef OLDXAW
-static void Popdown(Widget, XEvent*, String*, Cardinal*);
-#endif
-static void PositionMenuAction(Widget, XEvent*, String*, Cardinal*);
-static void Unhighlight(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(SimpleMenuRec, simple_menu.field)
-
-static XtResource resources[] = {
- /* label */
- {
- XtNlabel,
- XtCLabel,
- XtRString,
- sizeof(String),
- offset(label_string),
- XtRString,
- NULL
- },
- {
- XtNlabelClass,
- XtCLabelClass,
- XtRPointer,
- sizeof(WidgetClass),
- offset(label_class),
- XtRImmediate,
- NULL
- },
-
- /* layout */
- {
- XtNrowHeight,
- XtCRowHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(row_height),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNtopMargin,
- XtCVerticalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(top_margin),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNbottomMargin,
- XtCVerticalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(bottom_margin),
- XtRImmediate,
- (XtPointer)0
- },
-#ifndef OLDXAW
- {
- XtNleftMargin,
- XtCHorizontalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(left_margin),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNrightMargin,
- XtCHorizontalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(right_margin),
- XtRImmediate,
- (XtPointer)0
- },
-#endif
-
- /* misc */
- {
- XtNallowShellResize,
- XtCAllowShellResize,
- XtRBoolean,
- sizeof(Boolean),
- XtOffsetOf(SimpleMenuRec, shell.allow_shell_resize),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNcursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(cursor),
- XtRImmediate,
- (XtPointer)None
- },
- {
- XtNmenuOnScreen,
- XtCMenuOnScreen,
- XtRBoolean,
- sizeof(Boolean),
- offset(menu_on_screen),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNpopupOnEntry,
- XtCPopupOnEntry,
- XtRWidget,
- sizeof(Widget),
- offset(popup_entry),
- XtRWidget,
- NULL
- },
- {
- XtNbackingStore,
- XtCBackingStore,
- XtRBackingStore,
- sizeof(int),
- offset(backing_store),
- XtRImmediate,
- (XtPointer)(Always + WhenMapped + NotUseful)
- },
-#ifndef OLDXAW
- {
- XawNdisplayList,
- XawCDisplayList,
- XawRDisplayList,
- sizeof(XawDisplayList*),
- offset(display_list),
- XtRImmediate,
- NULL
- },
-#endif
-};
-#undef offset
-
-static char defaultTranslations[] =
-"<Enter>:" "highlight()\n"
-"<Leave>:" "unhighlight()\n"
-"<BtnMotion>:" "highlight()\n"
-#ifndef OLDXAW
-"<BtnUp>:" "popdown() notify() unhighlight()\n"
-#else
-"<BtnUp>:" "MenuPopdown() notify() unhighlight()\n"
-#endif
-;
-
-static XtActionsRec actionsList[] =
-{
- {"notify", Notify},
- {"highlight", Highlight},
- {"unhighlight", Unhighlight},
-#ifndef OLDXAW
- {"popdown", Popdown},
- {"set-values", XawSetValuesAction},
- {"get-values", XawGetValuesAction},
- {"declare", XawDeclareAction},
- {"call-proc", XawCallProcAction},
-#endif
-};
-
-static CompositeClassExtensionRec extension_rec = {
- NULL, /* next_extension */
- NULLQUARK, /* record_type */
- XtCompositeExtensionVersion, /* version */
- sizeof(CompositeClassExtensionRec), /* record_size */
- True, /* accepts_objects */
-};
-
-#define Superclass (&overrideShellClassRec)
-SimpleMenuClassRec simpleMenuClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "SimpleMenu", /* class_name */
- sizeof(SimpleMenuRec), /* size */
- XawSimpleMenuClassInitialize, /* class_initialize */
- XawSimpleMenuClassPartInitialize, /* class_part_initialize */
- False, /* class_inited */
- XawSimpleMenuInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawSimpleMenuRealize, /* realize */
- actionsList, /* actions */
- XtNumber(actionsList), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XawSimpleMenuResize, /* resize */
- XawSimpleMenuRedisplay, /* expose */
- XawSimpleMenuSetValues, /* set_values */
- XawSimpleMenuSetValuesHook, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* intrinsics version */
- NULL, /* callback offsets */
- defaultTranslations, /* tm_table */
- NULL, /* query_geometry */
- NULL, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XawSimpleMenuGeometryManager, /* geometry_manager */
- XawSimpleMenuChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- /* shell */
- {
- NULL, /* extension */
- },
- /* override */
- {
- NULL, /* extension */
- },
- /* simple_menu */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec;
-
-/*
- * Implementation
- */
-/*
- * Function:
- * XawSimpleMenuClassInitialize
- *
- * Description:
- * Class Initialize routine, called only once.
- */
-static void
-XawSimpleMenuClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringToBackingStore,
- NULL, 0);
- XtSetTypeConverter(XtRBackingStore, XtRString, XmuCvtBackingStoreToString,
- NULL, 0, XtCacheNone, NULL);
- XmuAddInitializer(AddPositionAction, NULL);
-}
-
-/*
- * Function:
- * XawSimpleMenuClassPartInitialize
- * Arguments: wc - the widget class of the subclass.
- *
- * Description:
- * Class Part Initialize routine, called for every subclass. Makes
- * sure that the subclasses pick up the extension record.
- */
-static void
-XawSimpleMenuClassPartInitialize(WidgetClass wc)
-{
- SimpleMenuWidgetClass smwc = (SimpleMenuWidgetClass)wc;
-
- /*
- * Make sure that our subclass gets the extension rec too
- */
- extension_rec.next_extension = smwc->composite_class.extension;
- smwc->composite_class.extension = (XtPointer) &extension_rec;
-}
-
-/*
- * Function:
- * XawSimpleMenuInitialize
- *
- * Parameters:
- * request - widget requested by the argument list
- * cnew - new widget with both resource and non resource values
- *
- * Description:
- * Initializes the simple menu widget.
- */
-/*ARGSUSED*/
-static void
-XawSimpleMenuInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)cnew;
- Dimension width, height;
-
- XmuCallInitializers(XtWidgetToApplicationContext(cnew));
-
- if (smw->simple_menu.label_class == NULL)
- smw->simple_menu.label_class = smeBSBObjectClass;
-
- smw->simple_menu.label = NULL;
- smw->simple_menu.entry_set = NULL;
- smw->simple_menu.recursive_set_values = False;
-#ifndef OLDXAW
- smw->simple_menu.sub_menu = NULL;
- smw->simple_menu.state = 0;
-
- XtAddCallback(cnew, XtNpopupCallback, PopupCB, NULL);
-#endif
-
- if (smw->simple_menu.label_string != NULL)
- CreateLabel(cnew);
-
- width = height = 0;
- CalculateNewSize(cnew, &width, &height);
-
- smw->simple_menu.menu_width = True;
-
- if (XtWidth(smw) == 0) {
- smw->simple_menu.menu_width = False;
- XtWidth(smw) = width;
- }
-
- smw->simple_menu.menu_height = True;
-
- if (XtHeight(smw) == 0) {
- smw->simple_menu.menu_height = False;
- XtHeight(smw) = height;
- }
-
- /*
- * Add a popup_callback routine for changing the cursor
- */
- XtAddCallback(cnew, XtNpopupCallback, ChangeCursorOnGrab, NULL);
-}
-
-/*
- * Function:
- * XawSimpleMenuRedisplay
- *
- * Parameters:
- * w - simple menu widget
- * event - X event that caused this redisplay
- * region - region the needs to be repainted
- *
- * Description:
- * Redisplays the contents of the widget.
- */
-/*ARGSUSED*/
-static void
-XawSimpleMenuRedisplay(Widget w, XEvent *event, Region region)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- SmeObject *entry;
- SmeObjectClass cclass;
-
- if (region == NULL)
- XClearWindow(XtDisplay(w), XtWindow(w));
-
-#ifndef OLDXAW
- if (smw->simple_menu.display_list)
- XawRunDisplayList(w, smw->simple_menu.display_list, event, region);
-#endif
-
- /*
- * Check and Paint each of the entries - including the label
- */
- ForAllChildren(smw, entry) {
- if (!XtIsManaged((Widget)*entry))
- continue;
-
- if (region != NULL)
- switch(XRectInRegion(region, XtX(*entry),XtY(*entry),
- XtWidth(*entry), XtHeight(*entry))) {
- case RectangleIn:
- case RectanglePart:
- break;
- default:
- continue;
- }
-
- cclass = (SmeObjectClass)(*entry)->object.widget_class;
-
- if (cclass->rect_class.expose != NULL)
- (cclass->rect_class.expose)((Widget)*entry, NULL, NULL);
- }
-}
-
-/*
- * Function:
- * XawSimpleMenuRealize
- *
- * Parameters:
- * w - simple menu widget
- * mask - value mask for the window to create
- * attrs - attributes for the window to create
- *
- * Description:
- * Realizes the widget.
- */
-static void
-XawSimpleMenuRealize(Widget w, XtValueMask *mask, XSetWindowAttributes *attrs)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-#ifndef OLDXAW
- XawPixmap *pixmap;
-#endif
-
- attrs->cursor = smw->simple_menu.cursor;
- *mask |= CWCursor;
- if (smw->simple_menu.backing_store == Always ||
- smw->simple_menu.backing_store == NotUseful ||
- smw->simple_menu.backing_store == WhenMapped) {
- *mask |= CWBackingStore;
- attrs->backing_store = smw->simple_menu.backing_store;
- }
- else
- *mask &= ~CWBackingStore;
-
- (*Superclass->core_class.realize)(w, mask, attrs);
-
-#ifndef OLDXAW
- if (w->core.background_pixmap > XtUnspecifiedPixmap) {
- pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w),
- w->core.colormap, w->core.depth);
- if (pixmap && pixmap->mask)
- XawReshapeWidget(w, pixmap);
- }
-#endif
-}
-
-/*
- * Function:
- * XawSimpleMenuResize
- *
- * Parameters:
- * w - simple menu widget
- *
- * Description:
- * Handle the menu being resized.
- */
-static void
-XawSimpleMenuResize(Widget w)
-{
- if (!XtIsRealized(w))
- return;
-
- Layout(w, NULL, NULL);
-
- XawSimpleMenuRedisplay(w, NULL, NULL);
-}
-
-/*
- * Function:
- * XawSimpleMenuSetValues
- *
- * Parameters:
- * current - current state of the widget
- * request - what was requested
- * cnew - what the widget will become
- *
- * Description:
- * Relayout the menu when one of the resources is changed.
- */
-/*ARGSUSED*/
-static Boolean
-XawSimpleMenuSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SimpleMenuWidget smw_old = (SimpleMenuWidget)current;
- SimpleMenuWidget smw_new = (SimpleMenuWidget)cnew;
- Boolean ret_val = False, layout = False;
-
- if (!XtIsRealized(current))
- return (False);
-
- if (!smw_new->simple_menu.recursive_set_values) {
- if (XtWidth(smw_new) != XtWidth(smw_old)) {
- smw_new->simple_menu.menu_width = XtWidth(smw_new) != 0;
- layout = True;
- }
- if (XtHeight(smw_new) != XtHeight(smw_old)) {
- smw_new->simple_menu.menu_height = XtHeight(smw_new) != 0;
- layout = True;
- }
- }
-
- if (smw_old->simple_menu.cursor != smw_new->simple_menu.cursor)
- XDefineCursor(XtDisplay(cnew), XtWindow(cnew),
- smw_new->simple_menu.cursor);
-
- if (smw_old->simple_menu.label_string !=smw_new->simple_menu.label_string)
- if (smw_new->simple_menu.label_string == NULL) /* Destroy */
- XtDestroyWidget((Widget)smw_old->simple_menu.label);
- else if (smw_old->simple_menu.label_string == NULL) /* Create */
- CreateLabel(cnew);
- else { /* Change */
- Arg arglist[1];
-
- XtSetArg(arglist[0], XtNlabel, smw_new->simple_menu.label_string);
- XtSetValues((Widget)smw_new->simple_menu.label, arglist, ONE);
- }
-
- if (smw_old->simple_menu.label_class != smw_new->simple_menu.label_class)
- XtAppWarning(XtWidgetToApplicationContext(cnew),
- "No Dynamic class change of the SimpleMenu Label.");
-
- if (smw_old->simple_menu.top_margin != smw_new->simple_menu.top_margin
- || smw_old->simple_menu.bottom_margin
- != smw_new->simple_menu.bottom_margin) {
- layout = True;
- ret_val = True;
- }
-
-#ifndef OLDXAW
- if (smw_old->core.background_pixmap != smw_new->core.background_pixmap) {
- XawPixmap *opix, *npix;
-
- opix = XawPixmapFromXPixmap(smw_old->core.background_pixmap,
- XtScreen(smw_old), smw_old->core.colormap,
- smw_old->core.depth);
- npix = XawPixmapFromXPixmap(smw_new->core.background_pixmap,
- XtScreen(smw_new), smw_new->core.colormap,
- smw_new->core.depth);
- if ((npix && npix->mask) || (opix && opix->mask))
- XawReshapeWidget(cnew, npix);
- }
-#endif
-
- if (layout)
- Layout(cnew, NULL, NULL);
-
- return (ret_val);
-}
-
-/*
- * Function:
- * XawSimpleMenuSetValuesHook
- *
- * Parameters:
- * w - menu widget
- * arglist - argument list passed to XtSetValues
- * num_args - number of args
- *
- * Description:
- * To handle a special case, this is passed the actual arguments.
- */
-static Boolean
-XawSimpleMenuSetValuesHook(Widget w, ArgList arglist, Cardinal *num_args)
-{
- Cardinal i;
- Dimension width, height;
-
- width = XtWidth(w);
- height = XtHeight(w);
-
- for (i = 0 ; i < *num_args ; i++) {
- if (streq(arglist[i].name, XtNwidth))
- width = (Dimension)arglist[i].value;
- if (streq(arglist[i].name, XtNheight))
- height = (Dimension) arglist[i].value;
- }
-
- if (width != XtWidth(w) || height != XtHeight(w))
- MakeSetValuesRequest(w, width, height);
-
- return (False);
-}
-
-/*
- * Geometry Management routines
- */
-/*
- * Function:
- * XawSimpleMenuGeometryManager
- *
- * Parameters:
- * w - Menu Entry making the request
- * request - requested new geometry
- * reply - the allowed geometry.
- *
- * Description:
- * This is the SimpleMenu Widget's Geometry Manager.
- *
- * Returns:
- * XtGeometry{Yes, No, Almost}
- */
-static XtGeometryResult
-XawSimpleMenuGeometryManager(Widget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)XtParent(w);
- SmeObject entry = (SmeObject)w;
- XtGeometryMask mode = request->request_mode;
- XtGeometryResult answer;
- Dimension old_height, old_width;
-
- if (!(mode & CWWidth) && !(mode & CWHeight))
- return (XtGeometryNo);
-
- reply->width = request->width;
- reply->height = request->height;
-
- old_width = XtWidth(entry);
- old_height = XtHeight(entry);
-
- Layout(w, &reply->width, &reply->height);
-
- /*
- * Since we are an override shell and have no parent there is no one to
- * ask to see if this geom change is okay, so I am just going to assume
- * we can do whatever we want. If you subclass be very careful with this
- * assumption, it could bite you.
- *
- * Chris D. Peterson - Sept. 1989.
- */
- if ((!(mode & CWWidth) || reply->width == request->width)
- && (!(mode & CWHeight) || reply->height == request->height)) {
- if (mode & XtCWQueryOnly) { /* Actually perform the layout */
- XtWidth(entry) = old_width;
- XtHeight(entry) = old_height;
- }
- else
- Layout((Widget)smw, NULL, NULL);
- answer = XtGeometryDone;
- }
- else {
- XtWidth(entry) = old_width;
- XtHeight(entry) = old_height;
-
- if ((reply->width == request->width && !(mode & CWHeight))
- || (reply->height == request->height && !(mode & CWWidth))
- || (reply->width == request->width
- && reply->height == request->height))
- answer = XtGeometryNo;
- else {
- answer = XtGeometryAlmost;
- reply->request_mode = 0;
- if (reply->width != request->width)
- reply->request_mode |= CWWidth;
- if (reply->height != request->height)
- reply->request_mode |= CWHeight;
- }
- }
-
- return (answer);
-}
-
-/*
- * Function:
- * XawSimpleMenuChangeManaged
- *
- * Parameters:
- * w - simple menu widget
- *
- * Description:
- * Called whenever a new child is managed.
- */
-static void
-XawSimpleMenuChangeManaged(Widget w)
-{
- Layout(w, NULL, NULL);
-}
-
-/*
- * Global Action Routines
- *
- * These actions routines will be added to the application's
- * global action list
- */
-/*
- * Function:
- * PositionMenuAction
- *
- * Parameters:
- * w - a widget (no the simple menu widget)
- * event - the event that caused this action
- * params - parameters passed to the routine.
- * we expect the name of the menu here.
- * num_params - ""
- *
- * Description:
- * Positions the simple menu widget.
- */
-/*ARGSUSED*/
-static void
-PositionMenuAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- Widget menu;
- XPoint loc;
-
- if (*num_params != 1) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "SimpleMenuWidget: position menu action expects "
- "only one parameter which is the name of the menu.");
- return;
- }
-
- if ((menu = FindMenu(w, params[0])) == NULL) {
- char error_buf[BUFSIZ];
-
- (void)XmuSnprintf(error_buf, sizeof(error_buf),
- "SimpleMenuWidget: could not find menu named %s.",
- params[0]);
- XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
- return;
- }
-
- switch (event->type) {
- case ButtonPress:
- case ButtonRelease:
- loc.x = event->xbutton.x_root;
- loc.y = event->xbutton.y_root;
- PositionMenu(menu, &loc);
- break;
- case EnterNotify:
- case LeaveNotify:
- loc.x = event->xcrossing.x_root;
- loc.y = event->xcrossing.y_root;
- PositionMenu(menu, &loc);
- break;
- case MotionNotify:
- loc.x = event->xmotion.x_root;
- loc.y = event->xmotion.y_root;
- PositionMenu(menu, &loc);
- break;
- default:
- PositionMenu(menu, NULL);
- break;
- }
-}
-
-/*
- * Widget Action Routines
- */
-/*
- * Function:
- * Unhighlight
- *
- * Parameters:
- * w - simple menu widget
- * event - event that caused this action
- * params - not used
- * num_params - ""
- *
- * Description:
- * Unhighlights current entry.
- */
-/*ARGSUSED*/
-static void
-Unhighlight(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- SmeObject entry = smw->simple_menu.entry_set;
-
- if (entry == NULL)
- return;
-
-#ifndef OLDXAW
- if (!smw->simple_menu.sub_menu)
-#endif
- {
- SmeObjectClass cclass;
-
- smw->simple_menu.entry_set = NULL;
- cclass = (SmeObjectClass)entry->object.widget_class;
- (cclass->sme_class.unhighlight)((Widget)entry);
- }
-}
-
-/*
- * Function:
- * Highlight
- *
- * Parameters:
- * w - simple menu widget
- * event - event that caused this action
- * params - not used
- * num_params - ""
- *
- * Description:
- * Highlights current entry.
- */
-/*ARGSUSED*/
-static void
-Highlight(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- SmeObject entry;
-
- if (!XtIsSensitive(w))
- return;
-
- entry = GetEventEntry(w, event);
-
- if (entry == smw->simple_menu.entry_set)
- return;
-
-#ifndef OLDXAW
- if (!smw->simple_menu.sub_menu)
-#endif
- Unhighlight(w, event, params, num_params);
-
- if (entry == NULL)
- return;
-
- if (!XtIsSensitive((Widget)entry))
- return;
-
-#ifndef OLDXAW
- if (smw->simple_menu.sub_menu)
- PopdownSubMenu(smw);
-#endif
-
- Unhighlight(w, event, params, num_params);
-
-#ifndef OLDXAW
- if (!(smw->simple_menu.state & SMW_UNMAPPING))
-#endif
- {
- SmeObjectClass cclass;
-
- smw->simple_menu.entry_set = entry;
- cclass = (SmeObjectClass)entry->object.widget_class;
-
- (cclass->sme_class.highlight)((Widget)entry);
-
-#ifndef OLDXAW
- if (XtIsSubclass((Widget)entry, smeBSBObjectClass))
- PopupSubMenu(smw);
-#endif
- }
-}
-
-/*
- * Function:
- * Notify
- *
- * Parameters:
- * w - simple menu widget
- * event - event that caused this action
- * params - not used
- * num_params - ""
- *
- * Description:
- * Notify user of current entry.
- */
-/*ARGSUSED*/
-static void
-Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- SmeObject entry;
- SmeObjectClass cclass;
-
- /* may be a propagated event from a sub menu, need to check it */
- if (XtWindow(w) != event->xany.window)
- return;
- entry = GetEventEntry(w, event);
- if (entry == NULL || !XtIsSensitive((Widget)entry))
- return;
-
- cclass = (SmeObjectClass) entry->object.widget_class;
- (cclass->sme_class.notify)((Widget)entry);
-}
-
-/*
- * Public Functions
- */
-/*
- * Function:
- * XawSimpleMenuAddGlobalActions
- *
- * Arguments:
- * app_con - appcontext
- *
- * Description:
- * Adds the global actions to the simple menu widget.
- */
-void
-XawSimpleMenuAddGlobalActions(XtAppContext app_con)
-{
- XtInitializeWidgetClass(simpleMenuWidgetClass);
- XmuCallInitializers(app_con);
-}
-
-/*
- * Function:
- * XawSimpleMenuGetActiveEntry
- *
- * Parameters:
- * w - smw widget
- *
- * Description:
- * Gets the currently active (set) entry.
- *
- * Returns:
- * The currently set entry or NULL if none is set
- */
-Widget
-XawSimpleMenuGetActiveEntry(Widget w)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-
- return ((Widget)smw->simple_menu.entry_set);
-}
-
-/*
- * Function:
- * XawSimpleMenuClearActiveEntry
- *
- * Parameters:
- * w - smw widget
- *
- * Description:
- * Unsets the currently active (set) entry.
- */
-void
-XawSimpleMenuClearActiveEntry(Widget w)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-
- smw->simple_menu.entry_set = NULL;
-}
-
-/*
- * Private Functions
- */
-/*
- * Function:
- * CreateLabel
- *
- * Parameters:
- * w - smw widget
- *
- * Description:
- * Creates the label object and makes sure it is the first child in
- * in the list.
- */
-static void
-CreateLabel(Widget w)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- Widget *child, *next_child;
- int i;
- Arg args[2];
-
- if (smw->simple_menu.label_string == NULL ||
- smw->simple_menu.label != NULL) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xaw Simple Menu Widget: label string is NULL or "
- "label already exists, no label is being created.");
- return;
- }
-
- XtSetArg(args[0], XtNlabel, smw->simple_menu.label_string);
- XtSetArg(args[1], XtNjustify, XtJustifyCenter);
- smw->simple_menu.label = (SmeObject)
- XtCreateManagedWidget("menuLabel",
- smw->simple_menu.label_class, w, args, TWO);
-
- next_child = NULL;
- for (child = smw->composite.children + smw->composite.num_children,
- i = smw->composite.num_children; i > 0; i--, child--) {
- if (next_child != NULL)
- *next_child = *child;
- next_child = child;
- }
- *child = (Widget)smw->simple_menu.label;
-}
-
-/*
- * Function:
- * Layout
- *
- * Arguments:
- * w - See below
- * width_ret - returned width
- * height_ret - returned height
- *
- * Note:
- * if width == NULL || height == NULL then it assumes the you do not care
- * about the return values, and just want a relayout.
- *
- * if this is not the case then it will set width_ret and height_ret
- * to be width and height that the child would get if it were layed out
- * at this time.
- *
- * "w" can be the simple menu widget or any of its object children.
- */
-static void
-Layout(Widget w, Dimension *width_ret, Dimension *height_ret)
-{
- SmeObject current_entry;
- SimpleMenuWidget smw;
- Dimension width, height;
- Boolean allow_change_size;
- Widget kid;
- Cardinal i, count, n;
- int width_kid, height_kid, tmp_w, tmp_h;
- short vadd, hadd, x_ins, y_ins;
- Dimension *widths;
-
- height = 0;
-
- if (XtIsSubclass(w, simpleMenuWidgetClass)) {
- smw = (SimpleMenuWidget)w;
- current_entry = NULL;
- }
- else {
- smw = (SimpleMenuWidget)XtParent(w);
- current_entry = (SmeObject)w;
- }
-
- allow_change_size = (!XtIsRealized((Widget)smw)
- || smw->shell.allow_shell_resize);
-
- for (i = smw->simple_menu.label ? 1 : 0;
- i < smw->composite.num_children;
- i++) {
- XtWidgetGeometry preferred;
-
- kid = smw->composite.children[i];
- if (!XtIsManaged(kid))
- continue;
- if (smw->simple_menu.row_height != 0)
- XtHeight(kid) = smw->simple_menu.row_height;
- XtQueryGeometry(kid, NULL, &preferred);
- if (preferred.request_mode & CWWidth)
- XtWidth(kid) = preferred.width;
- }
-
- if (smw->simple_menu.label
- && XtIsManaged((Widget)smw->simple_menu.label)) {
- XtWidgetGeometry preferred;
-
- kid = (Widget)smw->simple_menu.label;
- XtQueryGeometry(kid, NULL, &preferred);
- if (preferred.request_mode & CWWidth)
- XtWidth(kid) = preferred.width;
- if (preferred.request_mode & CWHeight)
- XtHeight(kid) = preferred.height;
- }
-
- /* reset */
- if (!smw->simple_menu.menu_width)
- XtWidth(smw) = 0;
- if (!smw->simple_menu.menu_height)
- XtHeight(smw) = 0;
- if (!XtWidth(smw) || !XtHeight(smw))
- MakeResizeRequest((Widget)smw);
-
- widths = (Dimension *)XtMalloc(sizeof(Dimension));
-#ifndef OLDXAW
- hadd = smw->simple_menu.left_margin;
-#else
- hadd = 0;
-#endif
- vadd = smw->simple_menu.top_margin;
- if (smw->simple_menu.label)
- vadd += XtHeight(smw->simple_menu.label);
-
- count = 1;
- width = tmp_w = tmp_h = n = 0;
- height = vadd;
-
- for (i = smw->simple_menu.label ? 1 : 0;
- i < smw->composite.num_children;
- i++) {
- kid = smw->composite.children[i];
- if (!XtIsManaged(kid))
- continue;
- width_kid = XtWidth(kid);
- height_kid = XtHeight(kid);
-
- if (n && (height + height_kid + smw->simple_menu.bottom_margin
- > XtHeight(smw))) {
- ++count;
- widths = (Dimension *)XtRealloc((char *)widths,
- sizeof(Dimension) * count);
- widths[count - 1] = width_kid;
- width += tmp_w;
- tmp_w = width_kid;
- height = height_kid + vadd;
- }
- else
- height += height_kid;
- if (height > tmp_h)
- tmp_h = height;
- if (width_kid > tmp_w)
- widths[count - 1] = tmp_w = width_kid;
- ++n;
- }
-
- height = tmp_h + smw->simple_menu.bottom_margin;
- width += tmp_w;
-
- if (smw->simple_menu.label && width < XtWidth(smw->simple_menu.label)) {
- float inc;
-
- inc = (XtWidth(smw->simple_menu.label) - width) / (float)count;
- width = XtWidth(smw->simple_menu.label);
- for (n = 0; n < count; n++)
- widths[n] += inc;
- }
-
-#ifndef OLDXAW
- width += hadd + smw->simple_menu.right_margin;
-#endif
-
- x_ins = n = count = 0;
- tmp_w = widths[0];
- tmp_h = vadd;
-
- for (i = smw->simple_menu.label ? 1 : 0;
- i < smw->composite.num_children;
- i++) {
- kid = smw->composite.children[i];
- if (!XtIsManaged(kid))
- continue;
-
- height_kid = XtHeight(kid);
-
- if (n && (tmp_h + height_kid + smw->simple_menu.bottom_margin
- > XtHeight(smw))) {
- x_ins = tmp_w;
- y_ins = vadd;
- ++count;
- tmp_w += widths[count];
- tmp_h = height_kid + vadd;
- }
- else {
- y_ins = tmp_h;
- tmp_h += height_kid;
- }
- ++n;
-
- XtX(kid) = x_ins + hadd;
- XtY(kid) = y_ins;
- XtWidth(kid) = widths[count];
- }
-
- XtFree((char *)widths);
-
- if (allow_change_size)
- MakeSetValuesRequest((Widget) smw, width, height);
-
- if (smw->simple_menu.label) {
- XtX(smw->simple_menu.label) = 0;
- XtY(smw->simple_menu.label) = smw->simple_menu.top_margin;
- XtWidth(smw->simple_menu.label) = XtWidth(smw)
-#ifndef OLDXAW
- - (smw->simple_menu.left_margin + smw->simple_menu.right_margin)
-#endif
- ;
- }
- if (current_entry) {
- if (width_ret)
- *width_ret = XtWidth(current_entry);
- if (height_ret)
- *height_ret = XtHeight(current_entry);
- }
-}
-
-/*
- * Function:
- * AddPositionAction
- *
- * Parameters:
- * app_con - application context
- * data - (not used)
- *
- * Description:
- * Adds the XawPositionSimpleMenu action to the global
- * action list for this appcon.
- */
-/*ARGSUSED*/
-static void
-AddPositionAction(XtAppContext app_con, XPointer data)
-{
- static XtActionsRec pos_action[] = {
- {"XawPositionSimpleMenu", PositionMenuAction},
- };
-
- XtAppAddActions(app_con, pos_action, XtNumber(pos_action));
-}
-
-/*
- * Function:
- * FindMenu
- *
- * Parameters:
- * widget - reference widget
- * name - menu widget's name
- *
- * Description:
- * Find the menu give a name and reference widget
- *
- * Returns:
- * The menu widget or NULL.
- */
-static Widget
-FindMenu(Widget widget, String name)
-{
- Widget w, menu;
-
- for (w = widget; w != NULL; w = XtParent(w))
- if ((menu = XtNameToWidget(w, name)) != NULL)
- return (menu);
-
- return (NULL);
-}
-
-/*
- * Function:
- * PositionMenu
- *
- * Parameters:
- * w - simple menu widget
- * location - pointer the the position or NULL
- *
- * Description:
- * Places the menu
- */
-static void
-PositionMenu(Widget w, XPoint *location)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- SmeObject entry;
- XPoint t_point;
-
- if (location == NULL) {
- Window temp1, temp2;
- int root_x, root_y, tempX, tempY;
- unsigned int tempM;
-
- location = &t_point;
- if (XQueryPointer(XtDisplay(w), XtWindow(w), &temp1, &temp2,
- &root_x, &root_y, &tempX, &tempY, &tempM) == False) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "Xaw Simple Menu Widget: "
- "Could not find location of mouse pointer");
- return;
- }
- location->x = (short) root_x;
- location->y = (short) root_y;
- }
-
- /*
- * The width will not be correct unless it is realized
- */
- XtRealizeWidget(w);
-
- location->x -= XtWidth(w) >> 1;
-
- if (smw->simple_menu.popup_entry == NULL)
- entry = smw->simple_menu.label;
- else
- entry = smw->simple_menu.popup_entry;
-
- if (entry != NULL)
- location->y -= XtY(entry) + (XtHeight(entry) >> 1);
-
- MoveMenu(w, location->x, location->y);
-}
-
-/*
- * Function:
- * MoveMenu
- *
- * Parameters:
- * w - simple menu widget
- * x - current location of the widget
- * y - ""
- *
- * Description:
- * Actually moves the menu, may force it to
- * to be fully visable if menu_on_screen is True.
- */
-static void
-MoveMenu(Widget w, int x, int y)
-{
- Arg arglist[2];
- Cardinal num_args = 0;
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-
- if (smw->simple_menu.menu_on_screen) {
- int width = XtWidth(w) + (XtBorderWidth(w) << 1);
- int height = XtHeight(w) + (XtBorderWidth(w) << 1);
-
- if (x >= 0) {
- int scr_width = WidthOfScreen(XtScreen(w));
-
- if (x + width > scr_width)
- x = scr_width - width;
- }
- if (x < 0)
- x = 0;
-
- if (y >= 0) {
- int scr_height = HeightOfScreen(XtScreen(w));
-
- if (y + height > scr_height)
- y = scr_height - height;
- }
- if (y < 0)
- y = 0;
- }
-
- XtSetArg(arglist[num_args], XtNx, x); num_args++;
- XtSetArg(arglist[num_args], XtNy, y); num_args++;
- XtSetValues(w, arglist, num_args);
-}
-
-/*
- * Function:
- * ChangeCursorOnGrab
- *
- * Parameters:
- * w - menu widget
- * temp1 - not used
- * temp2 - ""
- *
- * Description:
- * Changes the cursor on the active grab to the one
- * specified in out resource list.
- */
-/*ARGSUSED*/
-static void
-ChangeCursorOnGrab(Widget w, XtPointer temp1, XtPointer temp2)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-
- /*
- * The event mask here is what is currently in the MIT implementation.
- * There really needs to be a way to get the value of the mask out
- * of the toolkit (CDP 5/26/89).
- */
- XChangeActivePointerGrab(XtDisplay(w), ButtonPressMask | ButtonReleaseMask,
- smw->simple_menu.cursor,
- XtLastTimestampProcessed(XtDisplay(w)));
-}
-
-/*
- * Function:
- * MakeSetValuesRequest
- *
- * Parameters:
- * w - simple menu widget
- * width - size requested
- * height - ""
- */
-static void
-MakeSetValuesRequest(Widget w, unsigned int width, unsigned int height)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- Arg arglist[2];
- Cardinal num_args = 0;
-
- if (!smw->simple_menu.recursive_set_values) {
- if (XtWidth(smw) != width || XtHeight(smw) != height) {
- smw->simple_menu.recursive_set_values = True;
- XtSetArg(arglist[num_args], XtNwidth, width); num_args++;
- XtSetArg(arglist[num_args], XtNheight, height); num_args++;
- XtSetValues(w, arglist, num_args);
- }
- else if (XtIsRealized((Widget)smw))
- XawSimpleMenuRedisplay((Widget)smw, NULL, NULL);
- }
- smw->simple_menu.recursive_set_values = False;
-}
-
-static SmeObject
-DoGetEventEntry(Widget w, int x_loc, int y_loc)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- SmeObject *entry;
-
- ForAllChildren(smw, entry) {
- if (!XtIsManaged((Widget)*entry))
- continue;
-
- if (x_loc > XtX(*entry)
- && x_loc <= XtX(*entry) + XtWidth(*entry)
- && y_loc > XtY(*entry)
- && y_loc <= XtY(*entry) + XtHeight(*entry)) {
- if (*entry == smw->simple_menu.label)
- return (NULL); /* cannot select the label */
- else
- return (*entry);
- }
- }
-
- return (NULL);
-}
-
-/*
- * Function:
- * GetEventEntry
- *
- * Parameters:
- * w - simple menu widget
- * event - X event
- *
- * Description:
- * Gets an entry given an event that has X and Y coords.
- *
- * Returns:
- * The entry that this point is in
- */
-static SmeObject
-GetEventEntry(Widget w, XEvent *event)
-{
- int x_loc, y_loc, x_root;
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
- SmeObject entry;
- int warp, move;
-
- switch (event->type) {
- case MotionNotify:
- x_loc = event->xmotion.x;
- y_loc = event->xmotion.y;
- x_root = event->xmotion.x_root;
- break;
- case EnterNotify:
- case LeaveNotify:
- x_loc = event->xcrossing.x;
- y_loc = event->xcrossing.y;
- x_root = event->xcrossing.x_root;
- break;
- case ButtonPress:
- case ButtonRelease:
- x_loc = event->xbutton.x;
- y_loc = event->xbutton.y;
- x_root = event->xbutton.x_root;
- break;
- default:
- XtAppError(XtWidgetToApplicationContext(w),
- "Unknown event type in GetEventEntry().");
- return (NULL);
- }
-
- if (x_loc < 0 || x_loc >= XtWidth(smw) ||
- y_loc < 0 || y_loc >= XtHeight(smw))
- return (NULL);
-
- /* Move the menu if it's outside the screen, does not check
- * smw->simple_menu.menu_on_screen because menus is bigger than screen
- */
- if (x_root == WidthOfScreen(XtScreen(w)) - 1 &&
- XtX(w) + XtWidth(w) + (XtBorderWidth(w)) > x_root) {
- warp = -8;
- if (smw->simple_menu.entry_set) {
- entry = DoGetEventEntry(w,
- XtX(smw->simple_menu.entry_set)
- + XtWidth(smw->simple_menu.entry_set) + 1,
- y_loc);
- Unhighlight(w, event, NULL, NULL);
- if (entry) {
- warp = -(int)XtWidth(entry) >> 1;
- move = x_loc - XtWidth(entry) - XtX(entry) + XtBorderWidth(w);
- }
- else {
- warp = 0;
- move = WidthOfScreen(XtScreen(w)) -
- (XtX(w) + XtWidth(w) + (XtBorderWidth(w) << 1));
- }
- }
- else {
- warp = 0;
- move = WidthOfScreen(XtScreen(w)) -
- (XtX(w) + XtWidth(w) + (XtBorderWidth(w) << 1));
- }
- }
- else if (x_root == 0 && XtX(w) < 0) {
- warp = 8;
- if (smw->simple_menu.entry_set) {
- entry = DoGetEventEntry(w, XtX(smw->simple_menu.entry_set) - 1,
- y_loc);
- Unhighlight(w, event, NULL, NULL);
- if (entry) {
- warp = XtWidth(entry) >> 1;
- move = x_loc - XtX(entry);
- }
- else
- move = x_loc + XtBorderWidth(w);
- }
- else
- move = x_loc + XtBorderWidth(w);
- }
- else
- move = warp = 0;
-
- if (move)
- XtMoveWidget(w, XtX(w) + move, XtY(w));
- if (warp)
- XWarpPointer(XtDisplay(w), None, None, 0, 0, 0, 0, warp, 0);
-
- return (DoGetEventEntry(w, x_loc, y_loc));
-}
-
-static void
-CalculateNewSize(Widget w, Dimension *width_return, Dimension *height_return)
-{
- SimpleMenuWidget xaw = (SimpleMenuWidget)w;
- Widget kid;
- Cardinal i;
- int width_kid, height_kid;
- int width, height, tmp_w, tmp_h, max_dim;
- short vadd, hadd;
- int n, columns, test_h, num_children = 0;
- Boolean try_layout = False;
-
-#ifndef OLDXAW
- hadd = xaw->simple_menu.left_margin + xaw->simple_menu.right_margin;
-#else
- hadd = 0;
-#endif
- vadd = xaw->simple_menu.top_margin + xaw->simple_menu.bottom_margin;
- if (xaw->simple_menu.label)
- vadd += XtHeight(xaw->simple_menu.label);
-
- if (*height_return)
- max_dim = *height_return;
- else if (!XtHeight(w)) {
- max_dim = HeightOfScreen(XtScreen(w));
- try_layout = True;
- }
- else
- max_dim = XtHeight(w);
- max_dim -= vadd;
-
- width = height = tmp_w = tmp_h = n = test_h = 0;
- columns = 1;
- for (i = xaw->simple_menu.label ? 1 : 0;
- i < xaw->composite.num_children;
- i++) {
- kid = xaw->composite.children[i];
- if (!XtIsManaged(kid))
- continue;
- ++num_children;
- width_kid = XtWidth(kid);
- height_kid = XtHeight(kid);
-
- if (try_layout) {
- if (!test_h)
- test_h = height_kid;
- else if (test_h != height_kid)
- try_layout = False;
- }
-
- if (n && (height + height_kid > max_dim)) {
- ++columns;
- width += tmp_w;
- tmp_w = width_kid;
- height = height_kid;
- }
- else
- height += height_kid;
- if (height > tmp_h)
- tmp_h = height;
- if (width_kid > tmp_w)
- tmp_w = width_kid;
- ++n;
- }
-
- height = tmp_h + vadd;
- width += tmp_w + hadd;
-
- if (xaw->simple_menu.label)
- width = XawMax(width, XtWidth(xaw->simple_menu.label) + hadd);
-
- *width_return = width;
- *height_return = height;
-
- if (try_layout && columns > 1 && num_children > 2) {
- int space;
-
- height = test_h * (xaw->simple_menu.label ?
- num_children - 1 :
- num_children);
-
- max_dim -= max_dim % test_h;
- space = max_dim - (height % max_dim);
- if (space >= test_h * columns) {
- height = max_dim - space / columns;
- if (height % test_h)
- height += test_h - (height % test_h);
- *height_return = height + vadd;
- CalculateNewSize(w, width_return, height_return);
- }
- }
-}
-
-static void
-MakeResizeRequest(Widget w)
-{
- int tries;
- Dimension width, height;
-
- width = XtWidth(w);
- height = XtHeight(w);
-
- for (tries = 0; tries < 100; tries++) {
- CalculateNewSize(w, &width, &height);
- if (width == XtWidth(w) && height == XtHeight(w))
- break;
- if (XtMakeResizeRequest(w, width, height, &width, &height) ==
- XtGeometryNo)
- break;
- }
-}
-
-#ifndef OLDXAW
-static void
-Popdown(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-
- smw->simple_menu.state |= SMW_UNMAPPING;
- if (smw->simple_menu.sub_menu)
- PopdownSubMenu(smw);
- XtCallActionProc(w, "XtMenuPopdown", event, params, *num_params);
-}
-
-static void
-PopupSubMenu(SimpleMenuWidget smw)
-{
- Arg args[2];
- Cardinal num_args;
- Widget menu;
- SmeBSBObject entry = (SmeBSBObject)smw->simple_menu.entry_set;
- Position menu_x, menu_y;
- Bool popleft;
-
- if (entry->sme_bsb.menu_name == NULL)
- return;
-
- if ((menu = FindMenu((Widget)smw, entry->sme_bsb.menu_name)) == NULL)
- return;
-
- smw->simple_menu.sub_menu = menu;
-
- if (!XtIsRealized(menu))
- XtRealizeWidget(menu);
-
- popleft = (smw->simple_menu.state & SMW_POPLEFT) != 0;
-
- if (popleft)
- XtTranslateCoords((Widget)smw, -(int)XtWidth(menu),
- XtY(entry) - XtBorderWidth(menu), &menu_x, &menu_y);
- else
- XtTranslateCoords((Widget)smw, XtWidth(smw), XtY(entry)
- - XtBorderWidth(menu), &menu_x, &menu_y);
-
- if (!popleft && menu_x >= 0) {
- int scr_width = WidthOfScreen(XtScreen(menu));
-
- if (menu_x + XtWidth(menu) > scr_width) {
- menu_x -= XtWidth(menu) + XtWidth(smw);
- popleft = True;
- }
- }
- else if (popleft && menu_x < 0) {
- menu_x = 0;
- popleft = False;
- }
- if (menu_y >= 0) {
- int scr_height = HeightOfScreen(XtScreen(menu));
-
- if (menu_y + XtHeight(menu) > scr_height)
- menu_y = scr_height - XtHeight(menu) - XtBorderWidth(menu);
- }
- if (menu_y < 0)
- menu_y = 0;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNx, menu_x); num_args++;
- XtSetArg(args[num_args], XtNy, menu_y); num_args++;
- XtSetValues(menu, args, num_args);
-
- if (popleft)
- ((SimpleMenuWidget)menu)->simple_menu.state |= SMW_POPLEFT;
- else
- ((SimpleMenuWidget)menu)->simple_menu.state &= ~SMW_POPLEFT;
-
- XtPopup(menu, XtGrabNone);
-}
-
-static void
-PopdownSubMenu(SimpleMenuWidget smw)
-{
- SimpleMenuWidget menu = (SimpleMenuWidget)smw->simple_menu.sub_menu;
-
- if (!menu)
- return;
-
- menu->simple_menu.state |= SMW_UNMAPPING;
- PopdownSubMenu(menu);
-
- XtPopdown((Widget)menu);
-
- smw->simple_menu.sub_menu = NULL;
-}
-
-/*ARGSUSED*/
-static void
-PopupCB(Widget w, XtPointer client_data, XtPointer call_data)
-{
- SimpleMenuWidget smw = (SimpleMenuWidget)w;
-
- smw->simple_menu.state &= ~(SMW_UNMAPPING | SMW_POPLEFT);
-}
-#endif /* OLDXAW */
diff --git a/xc/lib/Xaw/SimpleMenu.h b/xc/lib/Xaw/SimpleMenu.h
deleted file mode 100644
index cf8979ef6..000000000
--- a/xc/lib/Xaw/SimpleMenu.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * $TOG: SimpleMenu.h /main/24 1998/02/11 14:54:57 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.
- *
- * Author: Chris D. Peterson, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/SimpleMenu.h,v 1.6 1999/06/13 13:47:21 dawes Exp $ */
-
-/*
- * SimpleMenu.h - Public Header file for SimpleMenu widget.
- *
- * This is the public header file for the Athena SimpleMenu widget.
- * It is intended to provide one pane pulldown and popup menus within
- * the framework of the X Toolkit. As the name implies it is a first and
- * by no means complete implementation of menu code. It does not attempt to
- * fill the needs of all applications, but does allow a resource oriented
- * interface to menus.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _SimpleMenu_h
-#define _SimpleMenu_h
-
-#include <X11/Shell.h>
-#include <X11/Xmu/Converters.h>
-
-/*
- * SimpleMenu widget
- */
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- backgroundPixmap BackgroundPixmap Pixmap None
- borderColor BorderColor Pixel XtDefaultForeground
- borderPixmap BorderPixmap Pixmap None
- borderWidth BorderWidth Dimension 1
- bottomMargin VerticalMargins Dimension VerticalSpace
- columnWidth ColumnWidth Dimension Width of widest text
- cursor Cursor Cursor None
- destroyCallback Callback Pointer NULL
- displayList DisplayList XawDisplayList* NULL
- height Height Dimension 0
- label Label String NULL (No label)
- labelClass LabelClass Pointer smeBSBObjectClass
- leftMargin HorizontalMargins Dimension 0
- mappedWhenManaged MappedWhenManaged Boolean True
- rightMargin HorizontalMargins Dimension 0
- rowHeight RowHeight Dimension Height of Font
- sensitive Sensitive Boolean True
- topMargin VerticalMargins Dimension VerticalSpace
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-typedef struct _SimpleMenuClassRec* SimpleMenuWidgetClass;
-typedef struct _SimpleMenuRec* SimpleMenuWidget;
-
-extern WidgetClass simpleMenuWidgetClass;
-
-#define XtNcursor "cursor"
-#define XtNbottomMargin "bottomMargin"
-#define XtNcolumnWidth "columnWidth"
-#define XtNlabelClass "labelClass"
-#define XtNmenuOnScreen "menuOnScreen"
-#define XtNpopupOnEntry "popupOnEntry"
-#define XtNrowHeight "rowHeight"
-#define XtNtopMargin "topMargin"
-#define XtNleftMargin "leftMargin"
-#define XtNrightMargin "rightMargin"
-
-#define XtCColumnWidth "ColumnWidth"
-#define XtCLabelClass "LabelClass"
-#define XtCMenuOnScreen "MenuOnScreen"
-#define XtCPopupOnEntry "PopupOnEntry"
-#define XtCRowHeight "RowHeight"
-
-#define XtCVerticalMargins "VerticalMargins"
-
-#ifndef OLDXAW
-#define XtCHorizontalMargins "HorizontalMargins"
-#define XawNdisplayList "displayList"
-#define XawCDisplayList "DisplayList"
-#define XawRDisplayList "XawDisplayList"
-#endif
-
-/*
- * Public Functions
- */
-
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawSimpleMenuAddGlobalActions
- *
- * Parameters:
- * app_con - appcontext
- *
- * Description:
- * Adds the global actions to the simple menu widget.
- */
-void XawSimpleMenuAddGlobalActions
-(
- XtAppContext app_con
- );
-
-/*
- * Function:
- * XawSimpleMenuGetActiveEntry
- *
- * Parameters:
- * w - smw widget
- *
- * Description:
- * Gets the currently active (set) entry.
- *
- * Returns:
- * The currently set entry or NULL if none is set
- */
-Widget XawSimpleMenuGetActiveEntry
-(
- Widget w
- );
-
-/*
- * Function:
- * XawSimpleMenuClearActiveEntry
- *
- * Parameters:
- * w - smw widget
- *
- * Description:
- * Unsets the currently active (set) entry.
- */
-void XawSimpleMenuClearActiveEntry
-(
- Widget w
-);
-
-_XFUNCPROTOEND
-
-#endif /* _SimpleMenu_h */
diff --git a/xc/lib/Xaw/SimpleP.h b/xc/lib/Xaw/SimpleP.h
deleted file mode 100644
index 9b6a8c86b..000000000
--- a/xc/lib/Xaw/SimpleP.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/***********************************************************
-
- $TOG: SimpleP.h /main/13 1998/02/06 12:49:30 kaleb $
-
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/SimpleP.h,v 1.10 1999/06/27 14:07:34 dawes Exp $ */
-
-#ifndef _SimpleP_h
-#define _SimpleP_h
-
-#include <X11/Xaw/Simple.h>
-#include <X11/Xaw/XawInit.h>
-
-typedef struct {
- Bool (*change_sensitive)(Widget);
-#ifndef OLDXAW
- XtPointer extension;
-#endif
-} SimpleClassPart;
-
-#define XtInheritChangeSensitive ((Bool (*)(Widget))_XtInherit)
-
-typedef struct _SimpleClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
-} SimpleClassRec;
-
-extern SimpleClassRec simpleClassRec;
-
-typedef struct {
- /* resources */
- Cursor cursor;
- Pixmap insensitive_border;
- String cursor_name; /* cursor specified by name */
- Pixel pointer_fg, pointer_bg; /* Pointer colors */
- Boolean international;
-
- /* private */
-#ifndef OLDXAW
- XawDisplayList *display_list;
- String tip;
- XtPointer pad[3]; /* for future use and keep binary compatability */
-#endif
-} SimplePart;
-
-typedef struct _SimpleRec {
- CorePart core;
- SimplePart simple;
-} SimpleRec;
-
-#endif /* _SimpleP_h */
diff --git a/xc/lib/Xaw/Sme.c b/xc/lib/Xaw/Sme.c
deleted file mode 100644
index 118957268..000000000
--- a/xc/lib/Xaw/Sme.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $TOG: Sme.c /main/14 1998/02/11 14:55:31 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.
- */
-/* $XFree86: xc/lib/Xaw/Sme.c,v 1.5 1999/06/06 08:48:10 dawes Exp $ */
-
-/*
- * Date: September 26, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/SmeP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static void Highlight(Widget);
-static void Notify(Widget);
-static void Unhighlight(Widget);
-static void XawSmeClassPartInitialize(WidgetClass);
-static void XawSmeInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawSmeQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(SmeRec, sme.field)
-static XtResource resources[] = {
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(callbacks),
- XtRCallback,
- NULL
- },
- {
- XtNinternational,
- XtCInternational,
- XtRBoolean,
- sizeof(Boolean),
- offset(international),
- XtRImmediate,
- (XtPointer)False
- },
-};
-#undef offset
-
-#define Superclass (&rectObjClassRec)
-SmeClassRec smeClassRec = {
- /* rectangle */
- {
- (WidgetClass)Superclass, /* superclass */
- "Sme", /* class_name */
- sizeof(SmeRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- XawSmeClassPartInitialize, /* class_part_initialize */
- False, /* class_initialized */
- XawSmeInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- False, /* compress_exposure */
- False, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- NULL, /* resize */
- NULL, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* intrinsics_version */
- NULL, /* callback offsets */
- NULL, /* tm_table */
- XawSmeQueryGeometry, /* query_geometry */
- NULL, /* display_accelerator */
- NULL, /* extension */
- },
- /* sme */
- {
- Highlight, /* highlight */
- Unhighlight, /* unhighlight */
- Notify, /* notify */
- NULL, /* extension */
- }
-};
-
-WidgetClass smeObjectClass = (WidgetClass)&smeClassRec;
-
-/*
- * Implementation
- */
-/*
- * Function:
- * XawSmeClassPartInitialize
- *
- * Parameters:
- * cclass - widget classs of this widget
- *
- * Description:
- * Handles inheritance of class functions.
- */
-static void
-XawSmeClassPartInitialize(WidgetClass cclass)
-{
- SmeObjectClass m_ent, superC;
-
- m_ent = (SmeObjectClass)cclass;
- superC = (SmeObjectClass)m_ent->rect_class.superclass;
-
- if (m_ent->sme_class.highlight == XtInheritHighlight)
- m_ent->sme_class.highlight = superC->sme_class.highlight;
-
- if (m_ent->sme_class.unhighlight == XtInheritUnhighlight)
- m_ent->sme_class.unhighlight = superC->sme_class.unhighlight;
-
- if (m_ent->sme_class.notify == XtInheritNotify)
- m_ent->sme_class.notify = superC->sme_class.notify;
-}
-
-/*
- * Function:
- * XawSmeInitialize
- *
- * Parameters:
- * request - widget requested by the argument list
- * cnew - new widget with both resource and non resource values
- *
- * Description:
- * Initializes the simple menu widget entry
- */
-/*ARGSUSED*/
-static void
-XawSmeInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SmeObject entry = (SmeObject)cnew;
-
- entry->rectangle.border_width = 0;
-}
-
-/*
- * Function:
- * Highlight
- *
- * Parameters:
- * w - menu entry
- *
- * Description:
- * Default highlight proceedure for menu entries.
- */
-/*ARGSUSED*/
-static void
-Highlight(Widget w)
-{
-}
-
-/*
- * Function:
- * Unhighlight
- *
- * Parameters:
- * w - menu entry
- *
- * Description:
- * Default unhighlight proceedure for menu entries.
- */
-/*ARGSUSED*/
-static void
-Unhighlight(Widget w)
-{
-}
-
-/*
- * Function:
- * Notify
- *
- * Parameters:
- * w - menu entry
- *
- * Description:
- * Calls the callback proceedures for this entry.
- */
-static void
-Notify(Widget w)
-{
- XtCallCallbacks(w, XtNcallback, NULL);
-}
-
-/*
- * Function:
- * QueryGeometry
- *
- * Parameeters:
- * w - menu entry object
- * itended - intended and return geometry info
- * return_val -
- *
- * Description:
- * Returns the preferred geometry for this widget.
- *
- * Returns:
- * Geometry Result
- *
- * Note:
- * See the Intrinsics manual for details on what this function is for.
- */
-static XtGeometryResult
-XawSmeQueryGeometry(Widget w, XtWidgetGeometry *intended,
- XtWidgetGeometry *return_val)
-{
- SmeObject entry = (SmeObject)w;
- Dimension width;
- XtGeometryResult ret_val = XtGeometryYes;
- XtGeometryMask mode = intended->request_mode;
-
- width = 1;
-
- if (((mode & CWWidth) && intended->width != width) || !(mode & CWWidth)) {
- return_val->request_mode |= CWWidth;
- return_val->width = width;
- mode = return_val->request_mode;
-
- if ((mode & CWWidth) && width == XtWidth(entry))
- return (XtGeometryNo);
- return (XtGeometryAlmost);
- }
-
- return (ret_val);
-}
diff --git a/xc/lib/Xaw/Sme.h b/xc/lib/Xaw/Sme.h
deleted file mode 100644
index c592742dd..000000000
--- a/xc/lib/Xaw/Sme.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * $TOG: Sme.h /main/8 1998/02/11 14:55:35 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.
- */
-/* $XFree86: xc/lib/Xaw/Sme.h,v 1.4 1998/10/03 08:42:20 dawes Exp $ */
-
-/*
- * This is the public header file for the Athena Sme object.
- * It is intended to be used with the simple menu widget.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _Sme_h
-#define _Sme_h
-
-#include <X11/RectObj.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- callback Callback Pointer NULL
- destroyCallback Callback Pointer NULL
- height Height Dimension 0
- sensitive Sensitive Boolean True
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-#ifndef XtCInternational
-#define XtCInternational "International"
-#endif
-
-#ifndef XtNinternational
-#define XtNinternational "international"
-#endif
-
-
-typedef struct _SmeClassRec *SmeObjectClass;
-typedef struct _SmeRec *SmeObject;
-
-extern WidgetClass smeObjectClass;
-
-#endif /* _Sme_h */
diff --git a/xc/lib/Xaw/SmeBSB.c b/xc/lib/Xaw/SmeBSB.c
deleted file mode 100644
index f8c65a2df..000000000
--- a/xc/lib/Xaw/SmeBSB.c
+++ /dev/null
@@ -1,765 +0,0 @@
-/* $TOG: SmeBSB.c /main/23 1998/06/24 11:53:39 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.
- */
-
-/* $XFree86: xc/lib/Xaw/SmeBSB.c,v 1.10 1999/06/06 08:48:11 dawes Exp $ */
-
-/*
- * SmeBSB.c - Source code file for BSB Menu Entry object.
- *
- * Date: September 26, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/SimpleMenu.h>
-#include <X11/Xaw/SmeBSBP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define ONE_HUNDRED 100
-
-/*
- * Class Methods
- */
-static void FlipColors(Widget);
-static void XawSmeBSBClassInitialize(void);
-static void XawSmeBSBInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawSmeBSBDestroy(Widget);
-static XtGeometryResult XawSmeBSBQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawSmeBSBRedisplay(Widget, XEvent*, Region);
-static Boolean XawSmeBSBSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void CreateGCs(Widget);
-static void GetBitmapInfo(Widget, Bool);
-static void GetDefaultSize(Widget, Dimension*, Dimension*);
-static void DestroyGCs(Widget);
-static void DrawBitmaps(Widget, GC);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(SmeBSBRec, sme_bsb.field)
-static XtResource resources[] = {
- {
- XtNlabel,
- XtCLabel,
- XtRString,
- sizeof(String),
- offset(label),
- XtRString,
- NULL
- },
- {
- XtNvertSpace,
- XtCVertSpace,
- XtRInt,
- sizeof(int),
- offset(vert_space),
- XtRImmediate,
- (XtPointer)25
- },
- {
- XtNleftBitmap,
- XtCLeftBitmap,
- XtRBitmap,
- sizeof(Pixmap),
- offset(left_bitmap),
- XtRImmediate,
- (XtPointer)None
- },
- {
- XtNjustify,
- XtCJustify,
- XtRJustify,
- sizeof(XtJustify),
- offset(justify),
- XtRImmediate,
- (XtPointer)XtJustifyLeft
- },
- {
- XtNrightBitmap,
- XtCRightBitmap,
- XtRBitmap,
- sizeof(Pixmap),
- offset(right_bitmap),
- XtRImmediate,
- (XtPointer)None
- },
- {
- XtNleftMargin,
- XtCHorizontalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(left_margin),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNrightMargin,
- XtCHorizontalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(right_margin),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(foreground),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNfont,
- XtCFont,
- XtRFontStruct,
- sizeof(XFontStruct*),
- offset(font),
- XtRString,
- XtDefaultFont
- },
- {
- XtNfontSet,
- XtCFontSet,
- XtRFontSet,
- sizeof(XFontSet),
- offset(fontset),
- XtRString,
- XtDefaultFontSet
- },
-#ifndef OLDXAW
- {
- XtNmenuName,
- XtCMenuName,
- XtRString,
- sizeof(String),
- offset(menu_name),
- XtRImmediate,
- (XtPointer)NULL
- },
-#endif
-};
-#undef offset
-
-#define superclass (&smeClassRec)
-SmeBSBClassRec smeBSBClassRec = {
- /* rectangle */
- {
- (WidgetClass)superclass, /* superclass */
- "SmeBSB", /* class_name */
- sizeof(SmeBSBRec), /* size */
- XawSmeBSBClassInitialize, /* class_init */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawSmeBSBInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- False, /* compress_exposure */
- False, /* compress_enterleave */
- False, /* visible_interest */
- XawSmeBSBDestroy, /* destroy */
- NULL, /* resize */
- XawSmeBSBRedisplay, /* expose */
- XawSmeBSBSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* intrinsics version */
- NULL, /* callback offsets */
- NULL, /* tm_table */
- XawSmeBSBQueryGeometry, /* query_geometry */
- NULL, /* display_accelerator */
- NULL, /* extension */
- },
- /* sme */
- {
- FlipColors, /* highlight */
- FlipColors, /* unhighlight */
- XtInheritNotify, /* notify */
- NULL, /* extension */
- },
- /* sme_bsb */
- {
- NULL, /* extension */
- },
-};
-WidgetClass smeBSBObjectClass = (WidgetClass)&smeBSBClassRec;
-
-/*
- * Function:
- * XawSmeBSBClassInitialize
- *
- * Description:
- * Initializes the SmeBSBObject.
- */
-static void
-XawSmeBSBClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0);
- XtSetTypeConverter(XtRJustify, XtRString, XmuCvtJustifyToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/*
- * Function:
- * XawSmeBSBInitialize
- *
- * Parameters:
- * request - widget requested by the argument list
- * cnew - new widget with both resource and non resource values
- *
- * Description:
- * Initializes the simple menu widget entry.
- */
-/*ARGSUSED*/
-static void
-XawSmeBSBInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SmeBSBObject entry = (SmeBSBObject)cnew;
-
- if (entry->sme_bsb.label == NULL)
- entry->sme_bsb.label = XtName(cnew);
- else
- entry->sme_bsb.label = XtNewString(entry->sme_bsb.label);
-
- GetDefaultSize(cnew, &entry->rectangle.width, &entry->rectangle.height);
- CreateGCs(cnew);
-
- entry->sme_bsb.left_bitmap_width = entry->sme_bsb.left_bitmap_height = 0;
- entry->sme_bsb.right_bitmap_width = entry->sme_bsb.right_bitmap_height = 0;
-
- GetBitmapInfo(cnew, True); /* Left Bitmap Info */
- GetBitmapInfo(cnew, False); /* Right Bitmap Info */
-}
-
-/*
- * Function:
- * XawSmeBSBDestroy
- *
- * Parameters:
- * w - simple menu widget entry
- */
-static void
-XawSmeBSBDestroy(Widget w)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
-
- DestroyGCs(w);
- if (entry->sme_bsb.label != XtName(w))
- XtFree(entry->sme_bsb.label);
-}
-
-/*
- * Function:
- * XawSmeBSBRedisplay
- *
- * Parameters:
- * w - simple menu widget entry
- * event - X event that caused this redisplay
- * region - region the needs to be repainted
- *
- * Description:
- * Redisplays the contents of the widget.
- */
-/* ARGSUSED */
-static void
-XawSmeBSBRedisplay(Widget w, XEvent *event, Region region)
-{
- GC gc;
- SmeBSBObject entry = (SmeBSBObject)w;
- int font_ascent, font_descent, y_loc;
- int fontset_ascent, fontset_descent;
- XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
-
- font_ascent = font_descent = fontset_ascent = fontset_descent = 0;
- entry->sme_bsb.set_values_area_cleared = False;
-
- if (entry->sme.international == True) {
- fontset_ascent = XawAbs(ext->max_ink_extent.y);
- fontset_descent = ext->max_ink_extent.height - fontset_ascent;
- }
- else {
- font_ascent = entry->sme_bsb.font->max_bounds.ascent;
- font_descent = entry->sme_bsb.font->max_bounds.descent;
- }
- y_loc = XtY(entry);
-
- if (XtIsSensitive(w) && XtIsSensitive(XtParent(w))) {
- if (w == XawSimpleMenuGetActiveEntry(XtParent(w))) {
- XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
- entry->sme_bsb.norm_gc, XtX(w), y_loc,
- XtWidth(entry), XtHeight(entry));
- gc = entry->sme_bsb.rev_gc;
- }
- else
- gc = entry->sme_bsb.norm_gc;
- }
- else
- gc = entry->sme_bsb.norm_gray_gc;
-
- if (entry->sme_bsb.label != NULL) {
- int x_loc = entry->sme_bsb.left_margin;
- int len = strlen(entry->sme_bsb.label);
- char *label = entry->sme_bsb.label;
- int width, t_width;
-
- switch(entry->sme_bsb.justify) {
- case XtJustifyCenter:
- if (entry->sme.international == True) {
- t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,
- len);
- width = XtWidth(entry) - (entry->sme_bsb.left_margin +
- entry->sme_bsb.right_margin);
- }
- else {
- t_width = XTextWidth(entry->sme_bsb.font, label, len);
- width = XtWidth(entry) - (entry->sme_bsb.left_margin +
- entry->sme_bsb.right_margin);
- }
- x_loc += (width - t_width) >> 1;
- break;
- case XtJustifyRight:
- if (entry->sme.international == True) {
- t_width = XmbTextEscapement(entry->sme_bsb.fontset,label,
- len);
- x_loc = XtWidth(entry) - (entry->sme_bsb.right_margin +
- t_width);
- }
- else {
- t_width = XTextWidth(entry->sme_bsb.font, label, len);
- x_loc = XtWidth(entry) - (entry->sme_bsb.right_margin +
- t_width);
- }
- break;
- case XtJustifyLeft:
- /*FALLTHROUGH*/
- default:
- break;
- }
-
- /* this will center the text in the gadget top-to-bottom */
- if (entry->sme.international == True) {
- y_loc += ((XtHeight(entry) -
- (fontset_ascent + fontset_descent)) >> 1) +
- fontset_ascent;
-
- XmbDrawString(XtDisplayOfObject(w), XtWindowOfObject(w),
- entry->sme_bsb.fontset, gc,
- XtX(w) + x_loc, y_loc, label, len);
- }
- else {
- y_loc += ((XtHeight(entry) -
- (font_ascent + font_descent)) >> 1) + font_ascent;
-
- XDrawString(XtDisplayOfObject(w), XtWindowOfObject(w), gc,
- XtX(w) + x_loc, y_loc, label, len);
- }
- }
-
- DrawBitmaps(w, gc);
-}
-
-
-/*
- * Function:
- * XawSmeBSBSetValues
- *
- * Parameters:
- * current - current state of the widget
- * request - what was requested
- * cnew - what the widget will become
- *
- * Description:
- * Relayout the menu when one of the resources is changed.
- */
-
-/*ARGSUSED*/
-static Boolean
-XawSmeBSBSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SmeBSBObject entry = (SmeBSBObject)cnew;
- SmeBSBObject old_entry = (SmeBSBObject)current;
- Boolean ret_val = False;
-
- if (old_entry->sme_bsb.label != entry->sme_bsb.label) {
- if (old_entry->sme_bsb.label != XtName(cnew))
- XtFree((char *)old_entry->sme_bsb.label);
-
- if (entry->sme_bsb.label != XtName(cnew))
- entry->sme_bsb.label = XtNewString(entry->sme_bsb.label);
-
- ret_val = True;
- }
-
- if (entry->rectangle.sensitive != old_entry->rectangle.sensitive)
- ret_val = True;
-
- if (entry->sme_bsb.left_bitmap != old_entry->sme_bsb.left_bitmap) {
- GetBitmapInfo(cnew, True);
- ret_val = True;
- }
-
- if (entry->sme_bsb.right_bitmap != old_entry->sme_bsb.right_bitmap) {
- GetBitmapInfo(cnew, False);
- ret_val = True;
- }
-
- if ((old_entry->sme_bsb.font != entry->sme_bsb.font
- && old_entry->sme.international == False)
- || old_entry->sme_bsb.foreground != entry->sme_bsb.foreground) {
- DestroyGCs(current);
- CreateGCs(cnew);
- ret_val = True;
- }
-
- if (old_entry->sme_bsb.fontset != entry->sme_bsb.fontset &&
- old_entry->sme.international == True)
- /* DONT changes the GCs, because the fontset is not in them */
- ret_val = True;
-
- if (ret_val) {
- Dimension width, height;
-
- GetDefaultSize(cnew, &width, &height);
- entry->sme_bsb.set_values_area_cleared = True;
- XtMakeResizeRequest(cnew, width, height, NULL, NULL);
- }
-
- return (ret_val);
-}
-
-/*
- * Function:
- * XawSmeBSBQueryGeometry
- *
- * Parameters:
- * w - menu entry object
- * itended - intended and return geometry info
- * return_val - ""
- *
- * Returns:
- * Geometry Result
- *
- * Description:
- * Returns the preferred geometry for this widget.
- * See the Intrinsics manual for details on what this function is for.
- */
-static XtGeometryResult
-XawSmeBSBQueryGeometry(Widget w, XtWidgetGeometry *intended,
- XtWidgetGeometry *return_val)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
- Dimension width, height;
- XtGeometryResult ret_val = XtGeometryYes;
- XtGeometryMask mode = intended->request_mode;
-
- GetDefaultSize(w, &width, &height);
-
- if (((mode & CWWidth) && intended->width != width) || !(mode & CWWidth)) {
- return_val->request_mode |= CWWidth;
- return_val->width = width;
- ret_val = XtGeometryAlmost;
- }
-
- if (((mode & CWHeight) && intended->height != height) || !(mode & CWHeight)) {
- return_val->request_mode |= CWHeight;
- return_val->height = height;
- ret_val = XtGeometryAlmost;
- }
-
- if (ret_val == XtGeometryAlmost) {
- mode = return_val->request_mode;
- if (((mode & CWWidth) && width == XtWidth(entry)) &&
- ((mode & CWHeight) && height == XtHeight(entry)))
- return (XtGeometryNo);
- }
-
- return (ret_val);
-}
-
-/*
- * Function:
- * FlipColors
- *
- * Parameters:
- * w - bsb menu entry widget
- *
- * Description:
- * Invert the colors of the current entry.
- */
-static void
-FlipColors(Widget w)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
-
- if (entry->sme_bsb.set_values_area_cleared)
- return;
-
- XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
- entry->sme_bsb.invert_gc,
- XtX(w), XtY(entry), XtWidth(entry), XtHeight(entry));
-}
-
-/*
- * Function:
- * GetDefaultSize
- *
- * Parameters:
- * w - menu entry widget.
- * width - default width (return)
- * height - default height (return)
- *
- * Description:
- * Calculates the Default (preferred) size of this menu entry.
- */
-static void
-GetDefaultSize(Widget w, Dimension *width, Dimension *height)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
-
- if (entry->sme.international == True) {
- XFontSetExtents *ext = XExtentsOfFontSet(entry->sme_bsb.fontset);
-
- if (entry->sme_bsb.label == NULL)
- *width = 0;
- else
- *width = XmbTextEscapement(entry->sme_bsb.fontset,
- entry->sme_bsb.label,
- strlen(entry->sme_bsb.label));
- *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin;
- *height = ext->max_ink_extent.height;
- *height = ((int)*height * (ONE_HUNDRED +
- entry->sme_bsb.vert_space)) / ONE_HUNDRED;
- }
- else {
- if (entry->sme_bsb.label == NULL)
- *width = 0;
- else
- *width = XTextWidth(entry->sme_bsb.font, entry->sme_bsb.label,
- strlen(entry->sme_bsb.label));
-
- *width += entry->sme_bsb.left_margin + entry->sme_bsb.right_margin;
-
- *height = entry->sme_bsb.font->max_bounds.ascent +
- entry->sme_bsb.font->max_bounds.descent;
-
- *height = ((int)*height * (ONE_HUNDRED +
- entry->sme_bsb.vert_space)) / ONE_HUNDRED;
- }
-}
-
-/*
- * Function:
- * DrawBitmaps
- *
- * Parameters:
- * w - simple menu widget entry
- * gc - graphics context to use for drawing
- *
- * Description:
- * Draws left and right bitmaps.
- */
-static void
-DrawBitmaps(Widget w, GC gc)
-{
- int x_loc, y_loc;
- SmeBSBObject entry = (SmeBSBObject)w;
-
- if (entry->sme_bsb.left_bitmap == None &&
- entry->sme_bsb.right_bitmap == None)
- return;
-
- /*
- * Draw Left Bitmap
- */
- if (entry->sme_bsb.left_bitmap != None) {
- x_loc = ((entry->sme_bsb.left_margin -
- entry->sme_bsb.left_bitmap_width) >> 1) + XtX(w);
-
- y_loc = XtY(entry) + ((XtHeight(entry) -
- entry->sme_bsb.left_bitmap_height) >> 1);
-
- XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.left_bitmap,
- XtWindowOfObject(w), gc, 0, 0,
- entry->sme_bsb.left_bitmap_width,
- entry->sme_bsb.left_bitmap_height, x_loc, y_loc, 1);
- }
-
- /*
- * Draw Right Bitmap
- */
- if (entry->sme_bsb.right_bitmap != None) {
- x_loc = XtWidth(entry) - ((entry->sme_bsb.right_margin +
- entry->sme_bsb.right_bitmap_width) >> 1) +
- XtX(w);
- y_loc = XtY(entry) + ((XtHeight(entry) -
- entry->sme_bsb.right_bitmap_height) >> 1);
-
- XCopyPlane(XtDisplayOfObject(w), entry->sme_bsb.right_bitmap,
- XtWindowOfObject(w), gc, 0, 0,
- entry->sme_bsb.right_bitmap_width,
- entry->sme_bsb.right_bitmap_height, x_loc, y_loc, 1);
- }
-}
-
-/*
- * Function:
- * GetBitmapInfo
- *
- * Parameters:
- * w - bsb menu entry object
- * is_left - True: if we are testing left bitmap
- * False: if we are testing the right bitmap
- *
- * Description:
- * Gets the bitmap information from either of the bitmaps.
- */
-static void
-GetBitmapInfo(Widget w, Bool is_left)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
- unsigned int depth, bw;
- Window root;
- int x, y;
- unsigned int width, height;
-
- if (is_left) {
- if (entry->sme_bsb.left_bitmap != None &&
- XGetGeometry(XtDisplayOfObject(w),
- entry->sme_bsb.left_bitmap, &root,
- &x, &y, &width, &height, &bw, &depth)) {
- entry->sme_bsb.left_bitmap_width = width;
- entry->sme_bsb.left_bitmap_height = height;
- }
- }
- else if (entry->sme_bsb.right_bitmap != None &&
- XGetGeometry(XtDisplayOfObject(w),
- entry->sme_bsb.right_bitmap, &root,
- &x, &y, &width, &height, &bw, &depth)) {
- entry->sme_bsb.right_bitmap_width = width;
- entry->sme_bsb.right_bitmap_height = height;
- }
-}
-
-/*
- * Function:
- * CreateGCs
- *
- * Parameters:
- * w - simple menu widget entry
- *
- * Description:
- * Creates all gc's for the simple menu widget.
- */
-static void
-CreateGCs(Widget w)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
- XGCValues values;
- XtGCMask mask, mask_i18n;
-
- values.foreground = XtParent(w)->core.background_pixel;
- values.background = entry->sme_bsb.foreground;
- values.font = entry->sme_bsb.font->fid;
- values.graphics_exposures = False;
- mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont;
- mask_i18n = GCForeground | GCBackground | GCGraphicsExposures;
- if (entry->sme.international == True)
- entry->sme_bsb.rev_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0);
- else
- entry->sme_bsb.rev_gc = XtGetGC(w, mask, &values);
-
- values.foreground = entry->sme_bsb.foreground;
- values.background = XtParent(w)->core.background_pixel;
- if (entry->sme.international == True)
- entry->sme_bsb.norm_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0);
- else
- entry->sme_bsb.norm_gc = XtGetGC(w, mask, &values);
-
- values.fill_style = FillTiled;
- values.tile = XmuCreateStippledPixmap(XtScreenOfObject(w),
- entry->sme_bsb.foreground,
- XtParent(w)->core.background_pixel,
- XtParent(w)->core.depth);
- values.graphics_exposures = False;
- mask |= GCTile | GCFillStyle;
- mask_i18n |= GCTile | GCFillStyle;
- if (entry->sme.international == True)
- entry->sme_bsb.norm_gray_gc = XtAllocateGC(w, 0, mask_i18n, &values,
- GCFont, 0);
- else
- entry->sme_bsb.norm_gray_gc = XtGetGC(w, mask, &values);
-
- values.foreground ^= values.background;
- values.background = 0;
- values.function = GXxor;
- mask = GCForeground | GCBackground | GCGraphicsExposures | GCFunction;
- entry->sme_bsb.invert_gc = XtGetGC(w, mask, &values);
-}
-
-/*
- * Function:
- * DestroyGCs
- *
- * Parameters:
- * w - simple menu widget entry
- *
- * Description:
- * Removes all gc's for the simple menu widget.
- */
-static void
-DestroyGCs(Widget w)
-{
- SmeBSBObject entry = (SmeBSBObject)w;
-
- XtReleaseGC(w, entry->sme_bsb.norm_gc);
- XtReleaseGC(w, entry->sme_bsb.norm_gray_gc);
- XtReleaseGC(w, entry->sme_bsb.rev_gc);
- XtReleaseGC(w, entry->sme_bsb.invert_gc);
-}
diff --git a/xc/lib/Xaw/SmeBSB.h b/xc/lib/Xaw/SmeBSB.h
deleted file mode 100644
index 886258085..000000000
--- a/xc/lib/Xaw/SmeBSB.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * $TOG: SmeBSB.h /main/9 1998/02/11 14:55:10 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.
- */
-/* $XFree86: xc/lib/Xaw/SmeBSB.h,v 1.5 1999/04/25 10:01:26 dawes Exp $ */
-
-/*
- * SmeBSB.h - Public Header file for SmeBSB object.
- *
- * This is the public header file for the Athena BSB Sme object.
- * It is intended to be used with the simple menu widget. This object
- * provides bitmap - string - bitmap style entries.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _SmeBSB_h
-#define _SmeBSB_h
-
-#include <X11/Xmu/Converters.h>
-#include <X11/Xaw/Sme.h>
-
-/* BSB Menu Entry Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- callback Callback Callback NULL
- destroyCallback Callback Pointer NULL
- font Font XFontStruct * XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension 0
- label Label String Name of entry
- leftBitmap LeftBitmap Pixmap None
- leftMargin HorizontalMargins Dimension 4
- menuName MenuName String NULL
- rightBitmap RightBitmap Pixmap None
- rightMargin HorizontalMargins Dimension 4
- sensitive Sensitive Boolean True
- vertSpace VertSpace int 25
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-typedef struct _SmeBSBClassRec *SmeBSBObjectClass;
-typedef struct _SmeBSBRec *SmeBSBObject;
-
-extern WidgetClass smeBSBObjectClass;
-
-#define XtNleftBitmap "leftBitmap"
-#define XtNleftMargin "leftMargin"
-#define XtNrightBitmap "rightBitmap"
-#define XtNrightMargin "rightMargin"
-#define XtNvertSpace "vertSpace"
-
-#define XtNmenuName "menuName"
-#define XtCMenuName "MenuName"
-
-#ifndef XtNfontSet
-#define XtNfontSet "fontSet"
-#endif
-
-#ifndef XtCFontSet
-#define XtCFontSet "FontSet"
-#endif
-
-#define XtCLeftBitmap "LeftBitmap"
-#define XtCHorizontalMargins "HorizontalMargins"
-#define XtCRightBitmap "RightBitmap"
-#define XtCVertSpace "VertSpace"
-
-#endif /* _SmeBSB_h */
diff --git a/xc/lib/Xaw/SmeBSBP.h b/xc/lib/Xaw/SmeBSBP.h
deleted file mode 100644
index aa2de9f23..000000000
--- a/xc/lib/Xaw/SmeBSBP.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * $TOG: SmeBSBP.h /main/10 1998/02/11 14:55:01 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.
- *
- * Author: Chris D. Peterson, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/SmeBSBP.h,v 1.7 1999/06/20 08:41:07 dawes Exp $ */
-
-#ifndef _XawSmeBSBP_h
-#define _XawSmeBSBP_h
-
-/*
- * Sme Object Private Data
- */
-#include <X11/Xaw/SmeP.h>
-#include <X11/Xaw/SmeBSB.h>
-
-typedef struct _SmeBSBClassPart {
- XtPointer extension;
-} SmeBSBClassPart;
-
-/* Full class record declaration */
-typedef struct _SmeBSBClassRec {
- RectObjClassPart rect_class;
- SmeClassPart sme_class;
- SmeBSBClassPart sme_bsb_class;
-} SmeBSBClassRec;
-
-extern SmeBSBClassRec smeBSBClassRec;
-
-/* New fields for the Sme Object record */
-typedef struct {
- /* resources */
- String label; /* The entry label */
- int vert_space; /* extra vert space to leave, as a
- percentage of the font height of
- the label */
- Pixmap left_bitmap, right_bitmap; /* bitmaps to show */
- Dimension left_margin, right_margin;/* left and right margins */
- Pixel foreground; /* foreground color */
- XFontStruct *font; /* The font to show label in */
- XFontSet fontset; /* or fontset */
- XtJustify justify; /* Justification for the label. */
-
- /* private */
- Boolean set_values_area_cleared; /* do we need to unhighlight? */
- GC norm_gc; /* noral color gc */
- GC rev_gc; /* reverse color gc */
- GC norm_gray_gc; /* Normal color (grayed out) gc */
- GC invert_gc; /* gc for flipping colors */
- Dimension left_bitmap_width; /* size of each bitmap */
- Dimension left_bitmap_height;
- Dimension right_bitmap_width;
- Dimension right_bitmap_height;
-
-#ifndef OLDXAW
- /* new resources */
- String menu_name; /* name of nested sub menu or NULL */
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} SmeBSBPart;
-
-/*
- * Full instance record declaration
- */
-typedef struct _SmeBSBRec {
- ObjectPart object;
- RectObjPart rectangle;
- SmePart sme;
- SmeBSBPart sme_bsb;
-} SmeBSBRec;
-
-#endif /* _XawSmeBSBP_h */
diff --git a/xc/lib/Xaw/SmeLine.c b/xc/lib/Xaw/SmeLine.c
deleted file mode 100644
index bc7578082..000000000
--- a/xc/lib/Xaw/SmeLine.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* $TOG: SmeLine.c /main/17 1998/02/11 14:55: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: Chris D. Peterson, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/SmeLine.c,v 1.6 1999/06/06 08:48:11 dawes Exp $ */
-
-/*
- * Sme.c - Source code for the generic menu entry
- *
- * Date: September 26, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/SmeLineP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static void XawSmeLineDestroy(Widget);
-static void XawSmeLineInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawSmeLineRedisplay(Widget, XEvent*, Region);
-static Boolean XawSmeLineSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void CreateGC(Widget);
-static void DestroyGC(Widget);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(SmeLineRec, sme_line.field)
-static XtResource resources[] = {
- {
- XtNlineWidth,
- XtCLineWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(line_width),
- XtRImmediate,
- (XtPointer)1
- },
- {
- XtNstipple,
- XtCStipple,
- XtRBitmap,
- sizeof(Pixmap),
- offset(stipple),
- XtRImmediate,
- (XtPointer)XtUnspecifiedPixmap
- },
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(foreground),
- XtRString,
- XtDefaultForeground
- },
-};
-#undef offset
-
-#define Superclass (&smeClassRec)
-SmeLineClassRec smeLineClassRec = {
- /* rectangle */
- {
- (WidgetClass)Superclass, /* superclass */
- "SmeLine", /* class_name */
- sizeof(SmeLineRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class inited */
- XawSmeLineInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- False, /* compress_exposure */
- False, /* compress_enterleave */
- False, /* visible_interest */
- XawSmeLineDestroy, /* destroy */
- NULL, /* resize */
- XawSmeLineRedisplay, /* expose */
- XawSmeLineSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* intrinsics version */
- NULL, /* callback offsets */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- NULL, /* display_accelerator */
- NULL, /* extension */
- },
- /* sme */
- {
- XtInheritHighlight, /* highlight */
- XtInheritUnhighlight, /* unhighlight */
- XtInheritNotify, /* notify */
- NULL, /* extension */
- },
- /* sme_line */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass smeLineObjectClass = (WidgetClass)&smeLineClassRec;
-
-/*
- * Implementation
- */
-/*ARGSUSED*/
-static void
-XawSmeLineInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SmeLineObject entry = (SmeLineObject)cnew;
-
- if (XtHeight(entry) == 0)
- XtHeight(entry) = entry->sme_line.line_width;
-
- CreateGC(cnew);
-}
-
-/*
- * Function:
- * CreateGC
- *
- * Parameters:
- * w - Line entry widget
- *
- * Description:
- * Creates the GC for the line entry widget.
- *
- * Note:
- * We can only share the GC if there is no stipple, because
- * we need to change the stipple origin when drawing
- */
-static void
-CreateGC(Widget w)
-{
- SmeLineObject entry = (SmeLineObject)w;
- XGCValues values;
- XtGCMask mask = GCForeground | GCGraphicsExposures | GCLineWidth;
-
- values.foreground = entry->sme_line.foreground;
- values.graphics_exposures = False;
- values.line_width = entry->sme_line.line_width;
-
- if (entry->sme_line.stipple != XtUnspecifiedPixmap) {
- values.stipple = entry->sme_line.stipple;
- values.fill_style = FillStippled;
- mask |= GCStipple | GCFillStyle;
-
- entry->sme_line.gc = XCreateGC(XtDisplayOfObject(w),
- RootWindowOfScreen(XtScreenOfObject(w)),
- mask, &values);
- }
- else
- entry->sme_line.gc = XtGetGC(w, mask, &values);
-}
-
-static void
-XawSmeLineDestroy(Widget w)
-{
- DestroyGC(w);
-}
-
-static void
-DestroyGC(Widget w)
-{
- SmeLineObject entry = (SmeLineObject)w;
-
- if (entry->sme_line.stipple != XtUnspecifiedPixmap)
- XFreeGC(XtDisplayOfObject(w), entry->sme_line.gc);
- else
- XtReleaseGC(w, entry->sme_line.gc);
-}
-
-/*ARGSUSED*/
-static void
-XawSmeLineRedisplay(Widget w, XEvent *event, Region region)
-{
- SmeLineObject entry = (SmeLineObject)w;
- int y = XtY(w) + (((int)XtHeight(w) - entry->sme_line.line_width) >> 1);
-
- if (entry->sme_line.stipple != XtUnspecifiedPixmap)
- XSetTSOrigin(XtDisplayOfObject(w), entry->sme_line.gc, 0, y);
-
- XFillRectangle(XtDisplayOfObject(w), XtWindowOfObject(w),
- entry->sme_line.gc, XtX(w), y,
- XtWidth(w), entry->sme_line.line_width);
-}
-
-/*
- * Function:
- * XawSmeLineSetValues
- *
- * Parameters:
- * current - current state of the widget
- * request - what was requested
- * cnew - what the widget will become
- *
- * Description:
- * Relayout the menu when one of the resources is changed.
- */
-/*ARGSUSED*/
-static Boolean
-XawSmeLineSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- SmeLineObject entry = (SmeLineObject)cnew;
- SmeLineObject old_entry = (SmeLineObject)current;
-
- if (entry->sme_line.line_width != old_entry->sme_line.line_width &&
- entry->sme_line.stipple != old_entry->sme_line.stipple) {
- DestroyGC(current);
- CreateGC(cnew);
- return (True);
- }
-
- return (False);
-}
diff --git a/xc/lib/Xaw/SmeLine.h b/xc/lib/Xaw/SmeLine.h
deleted file mode 100644
index 10d411c80..000000000
--- a/xc/lib/Xaw/SmeLine.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $TOG: SmeLine.h /main/6 1998/02/11 14:55:23 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/lib/Xaw/SmeLine.h,v 1.4 1998/10/03 08:42:21 dawes Exp $ */
-
-/*
- * This is the public header file for the Athena SmeLine object.
- * It is intended to be used with the simple menu widget.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _SmeLine_h
-#define _SmeLine_h
-
-#include <X11/Xaw/Sme.h>
-#include <X11/Xmu/Converters.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- callback Callback Pointer NULL
- destroyCallback Callback Pointer NULL
- height Height Dimension 0
- sensitive Sensitive Boolean True
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define XtCLineWidth "LineWidth"
-#define XtCStipple "Stipple"
-
-#define XtNlineWidth "lineWidth"
-#define XtNstipple "stipple"
-
-typedef struct _SmeLineClassRec *SmeLineObjectClass;
-typedef struct _SmeLineRec *SmeLineObject;
-
-extern WidgetClass smeLineObjectClass;
-
-#endif /* _SmeLine_h */
diff --git a/xc/lib/Xaw/SmeLineP.h b/xc/lib/Xaw/SmeLineP.h
deleted file mode 100644
index 50e89768a..000000000
--- a/xc/lib/Xaw/SmeLineP.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * $TOG: SmeLineP.h /main/6 1998/02/11 14:55: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.
- *
- * Author: Chris D. Peterson, MIT X Consortium
- */
-/* $XFree86: xc/lib/Xaw/SmeLineP.h,v 1.6 1999/06/20 08:41:07 dawes Exp $ */
-
-#ifndef _XawSmeLineP_h
-#define _XawSmeLineP_h
-
-/*
- * SmeLine Widget Private Data
- */
-#include <X11/Xaw/SmeP.h>
-#include <X11/Xaw/SmeLine.h>
-
-/* New fields for the SmeLine widget class */
-typedef struct _SmeLineClassPart {
- XtPointer extension;
-} SmeLineClassPart;
-
-/* Full class record */
-typedef struct _SmeLineClassRec {
- RectObjClassPart rect_class;
- SmeClassPart sme_class;
- SmeLineClassPart sme_line_class;
-} SmeLineClassRec;
-
-extern SmeLineClassRec smeLineClassRec;
-
-/* New fields for the SmeLine widget */
-typedef struct {
- /* resources */
- Pixel foreground; /* Foreground color */
- Pixmap stipple; /* Line Stipple */
- Dimension line_width; /* Width of the line */
-
- /* private */
- GC gc; /* Graphics context for drawing line */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} SmeLinePart;
-
-/* Full instance record */
-typedef struct _SmeLineRec {
- ObjectPart object;
- RectObjPart rectangle;
- SmePart sme;
- SmeLinePart sme_line;
-} SmeLineRec;
-
-#endif /* _XawSmeLineP_h */
diff --git a/xc/lib/Xaw/SmeP.h b/xc/lib/Xaw/SmeP.h
deleted file mode 100644
index 798a8f26a..000000000
--- a/xc/lib/Xaw/SmeP.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * $TOG: SmeP.h /main/8 1998/02/11 14:55:27 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.
- */
-/* $XFree86: xc/lib/Xaw/SmeP.h,v 1.6 1999/06/20 08:41:07 dawes Exp $ */
-
-/*
- * This is the private header file for the Athena Sme object.
- * This object is intended to be used with the simple menu widget.
- *
- * Date: April 3, 1989
- *
- * By: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- */
-
-#ifndef _XawSmeP_h
-#define _XawSmeP_h
-
-/*
- * Sme Widget Private Data
- */
-#include <X11/Xaw/Sme.h>
-
-/* New fields for the Sme widget class */
-typedef struct _SmeClassPart {
- XtWidgetProc highlight;
- XtWidgetProc unhighlight;
- XtWidgetProc notify;
- XtPointer extension;
-} SmeClassPart;
-
-/* Full class record */
-typedef struct _SmeClassRec {
- RectObjClassPart rect_class;
- SmeClassPart sme_class;
-} SmeClassRec;
-
-extern SmeClassRec smeClassRec;
-
-/* New fields for the Sme widget */
-typedef struct {
- /* resources */
- XtCallbackList callbacks;
- Boolean international;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} SmePart;
-
-/* Full instance record */
-typedef struct _SmeRec {
- ObjectPart object;
- RectObjPart rectangle;
- SmePart sme;
-} SmeRec;
-
-#define XtInheritHighlight ((XtWidgetProc)_XtInherit)
-#define XtInheritUnhighlight XtInheritHighlight
-#define XtInheritNotify XtInheritHighlight
-
-#endif /* _XawSmeP_h */
diff --git a/xc/lib/Xaw/StripCharP.h b/xc/lib/Xaw/StripCharP.h
deleted file mode 100644
index 4aec11ce2..000000000
--- a/xc/lib/Xaw/StripCharP.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-* $TOG: StripCharP.h /main/6 1998/02/06 12:50:31 kaleb $
-*/
-
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/StripCharP.h,v 1.6 1999/06/20 08:41:08 dawes Exp $ */
-
-#ifndef _XawStripChartP_h
-#define _XawStripChartP_h
-
-#include <X11/Xaw/StripChart.h>
-#include <X11/Xaw/SimpleP.h>
-
-#define NO_GCS 0
-#define FOREGROUND (1 << 0)
-#define HIGHLIGHT (1 << 1)
-#define ALL_GCS (FOREGROUND | HIGHLIGHT)
-
-/* new fields for the stripChart widget */
-typedef struct {
- /* resources */
- Pixel fgpixel; /* color index for graph */
- Pixel hipixel; /* color index for lines */
- GC fgGC; /* graphics context for fgpixel */
- GC hiGC; /* graphics context for hipixel */
-
- /* private */
- int update; /* update frequence */
- int scale; /* scale factor */
- int min_scale; /* smallest scale factor */
- int interval; /* data point interval */
- XPoint *points; /* Poly point for repairing graph lines */
- double max_value; /* Max Value in window */
- double valuedata[2048]; /* record of data points */
- XtIntervalId interval_id;
- XtCallbackList get_value; /* proc to call to fetch load pt */
- int jump_val; /* Amount to jump on each scroll */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} StripChartPart;
-
-/* instance record declaration */
-typedef struct _StripChartRec {
- CorePart core;
- SimplePart simple;
- StripChartPart strip_chart;
-} StripChartRec;
-
-/* new fields for the StripChart widget class record */
-typedef struct {
- XtPointer extension;
-} StripChartClassPart;
-
-/* class record declaration */
-typedef struct _StripChartClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- StripChartClassPart strip_chart_class;
-} StripChartClassRec;
-
-extern StripChartClassRec stripChartClassRec;
-
-#endif /* _XawStripChartP_h */
diff --git a/xc/lib/Xaw/StripChart.c b/xc/lib/Xaw/StripChart.c
deleted file mode 100644
index cee988f44..000000000
--- a/xc/lib/Xaw/StripChart.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/* $TOG: StripChart.c /main/26 1998/02/06 12:50:36 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/StripChart.c,v 1.6 1999/06/06 08:48:12 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xaw/StripCharP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-#define MS_PER_SEC 1000
-
-/*
- * Class Methods
- */
-static void XawStripChartInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawStripChartDestroy(Widget);
-static void XawStripChartRedisplay(Widget, XEvent*, Region);
-static void XawStripChartResize(Widget);
-static Boolean XawStripChartSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void CreateGC(StripChartWidget, unsigned int);
-static void DestroyGC(StripChartWidget, unsigned int);
-static void draw_it(XtPointer, XtIntervalId*);
-static void MoveChart(StripChartWidget, Bool);
-static int repaint_window(StripChartWidget, int, int);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(StripChartRec, field)
-static XtResource resources[] = {
- {
- XtNwidth,
- XtCWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(core.width),
- XtRImmediate,
- (XtPointer)
- 120
- },
- {
- XtNheight,
- XtCHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(core.height),
- XtRImmediate,
- (XtPointer)120
- },
- {
- XtNupdate,
- XtCInterval,
- XtRInt,
- sizeof(int),
- offset(strip_chart.update),
- XtRImmediate,
- (XtPointer)10
- },
- {
- XtNminScale,
- XtCScale,
- XtRInt,
- sizeof(int),
- offset(strip_chart.min_scale),
- XtRImmediate,
- (XtPointer)1
- },
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(strip_chart.fgpixel),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNhighlight,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(strip_chart.hipixel),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNgetValue,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(strip_chart.get_value),
- XtRImmediate,
- NULL
- },
- {
- XtNjumpScroll,
- XtCJumpScroll,
- XtRInt,
- sizeof(int),
- offset(strip_chart.jump_val),
- XtRImmediate,
- (XtPointer)DEFAULT_JUMP
- },
-};
-#undef offset
-
-StripChartClassRec stripChartClassRec = {
- /* core */
- {
- (WidgetClass)&simpleClassRec, /* superclass */
- "StripChart", /* class_name */
- sizeof(StripChartRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawStripChartInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- XtExposeCompressMultiple /* compress_exposure */
- | XtExposeGraphicsExposeMerged,
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawStripChartDestroy, /* destroy */
- XawStripChartResize, /* resize */
- XawStripChartRedisplay, /* expose */
- XawStripChartSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- }
-};
-
-WidgetClass stripChartWidgetClass = (WidgetClass)&stripChartClassRec;
-
-/*
- * Implementation
- */
-/*
- * Function:
- * CreateGC
- *
- * Parameters:
- * w - strip chart widget
- * which - GC's to create
- *
- * Description:
- * Creates the GC's
- */
-static void
-CreateGC(StripChartWidget w, unsigned int which)
-{
- XGCValues myXGCV;
-
- if (which & FOREGROUND) {
- myXGCV.foreground = w->strip_chart.fgpixel;
- w->strip_chart.fgGC = XtGetGC((Widget)w, GCForeground, &myXGCV);
- }
-
- if (which & HIGHLIGHT) {
- myXGCV.foreground = w->strip_chart.hipixel;
- w->strip_chart.hiGC = XtGetGC((Widget)w, GCForeground, &myXGCV);
- }
-}
-
-/*
- * Function:
- * DestroyGC
- *
- * Arguments:
- * w - strip chart widget
- * which - which GC's to destroy
- *
- * Description:
- * Destroys the GC's
- */
-static void
-DestroyGC(StripChartWidget w, unsigned int which)
-{
- if (which & FOREGROUND)
- XtReleaseGC((Widget)w, w->strip_chart.fgGC);
-
- if (which & HIGHLIGHT)
- XtReleaseGC((Widget)w, w->strip_chart.hiGC);
-}
-
-/*ARGSUSED*/
-static void
-XawStripChartInitialize(Widget greq, Widget gnew,
- ArgList args, Cardinal *num_args)
-{
- StripChartWidget w = (StripChartWidget)gnew;
-
- if (w->strip_chart.update > 0)
- w->strip_chart.interval_id =
- XtAppAddTimeOut(XtWidgetToApplicationContext(gnew),
- w->strip_chart.update * MS_PER_SEC,
- draw_it, (XtPointer)gnew);
- CreateGC(w, ALL_GCS);
-
- w->strip_chart.scale = w->strip_chart.min_scale;
- w->strip_chart.interval = 0;
- w->strip_chart.max_value = 0.0;
- w->strip_chart.points = NULL;
- XawStripChartResize(gnew);
-}
-
-static void
-XawStripChartDestroy(Widget gw)
-{
- StripChartWidget w = (StripChartWidget)gw;
-
- if (w->strip_chart.update > 0)
- XtRemoveTimeOut(w->strip_chart.interval_id);
- if (w->strip_chart.points)
- XtFree((char *)w->strip_chart.points);
- DestroyGC(w, ALL_GCS);
-}
-
-/*
- * NOTE: This function really needs to recieve graphics exposure
- * events, but since this is not easily supported until R4 I am
- * going to hold off until then.
- */
-/*ARGSUSED*/
-static void
-XawStripChartRedisplay(Widget w, XEvent *event, Region region)
-{
- if (event->type == GraphicsExpose)
- (void)repaint_window((StripChartWidget)w, event->xgraphicsexpose.x,
- event->xgraphicsexpose.width);
- else
- (void)repaint_window((StripChartWidget)w, event->xexpose.x,
- event->xexpose.width);
-}
-
-/*ARGSUSED*/
-static void
-draw_it(XtPointer client_data, XtIntervalId *id)
-{
- StripChartWidget w = (StripChartWidget)client_data;
- double value;
-
- if (w->strip_chart.update > 0)
- w->strip_chart.interval_id =
- XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)w),
- w->strip_chart.update * MS_PER_SEC,draw_it,
- client_data);
-
- if (w->strip_chart.interval >= XtWidth(w))
- MoveChart((StripChartWidget)w, True);
-
- /* Get the value, stash the point and draw corresponding line */
- if (w->strip_chart.get_value == NULL)
- return;
-
- XtCallCallbacks((Widget)w, XtNgetValue, (XtPointer)&value);
-
- /*
- * Keep w->strip_chart.max_value up to date, and if this data
- * point is off the graph, change the scale to make it fit
- */
- if (value > w->strip_chart.max_value) {
- w->strip_chart.max_value = value;
- if (XtIsRealized((Widget)w) &&
- w->strip_chart.max_value > w->strip_chart.scale) {
- XClearWindow(XtDisplay(w), XtWindow(w));
- w->strip_chart.interval = repaint_window(w, 0, XtWidth(w));
- }
- }
-
- w->strip_chart.valuedata[w->strip_chart.interval] = value;
- if (XtIsRealized((Widget)w)) {
- int y = (int)(XtHeight(w) - XtHeight(w) * value
- / w->strip_chart.scale);
-
- XFillRectangle(XtDisplay(w), XtWindow(w), w->strip_chart.fgGC,
- w->strip_chart.interval, y,
- 1, XtHeight(w) - y);
-
- /*
- * Fill in the graph lines we just painted over
- */
- if (w->strip_chart.points != NULL) {
- w->strip_chart.points[0].x = w->strip_chart.interval;
- XDrawPoints(XtDisplay(w), XtWindow(w), w->strip_chart.hiGC,
- w->strip_chart.points, w->strip_chart.scale - 1,
- CoordModePrevious);
- }
-
- XFlush(XtDisplay(w)); /* Flush output buffers */
- }
- w->strip_chart.interval++; /* Next point */
-}
-
-/* Blts data according to current size, then redraws the stripChart window
- * Next represents the number of valid points in data. Returns the (possibly)
- * adjusted value of next. If next is 0, this routine draws an empty window
- * (scale - 1 lines for graph). If next is less than the current window width,
- * the returned value is identical to the initial value of next and data is
- * unchanged. Otherwise keeps half a window's worth of data. If data is
- * changed, then w->strip_chart.max_value is updated to reflect the
- * largest data point
- */
-static int
-repaint_window(StripChartWidget w, int left, int width)
-{
- int i, j;
- int next = w->strip_chart.interval;
- int scale = w->strip_chart.scale;
- int scalewidth = 0;
-
- /* Compute the minimum scale required to graph the data, but don't go
- lower than min_scale */
- if (w->strip_chart.interval != 0 || scale <= w->strip_chart.max_value)
- scale = w->strip_chart.max_value + 1;
- if (scale < w->strip_chart.min_scale)
- scale = w->strip_chart.min_scale;
-
- if (scale != w->strip_chart.scale) {
- w->strip_chart.scale = scale;
- left = 0;
- width = next;
- scalewidth = XtWidth(w);
-
- XawStripChartResize((Widget)w);
-
- if (XtIsRealized((Widget)w))
- XClearWindow(XtDisplay(w), XtWindow(w));
- }
-
- if (XtIsRealized((Widget)w)) {
- Display *dpy = XtDisplay(w);
- Window win = XtWindow(w);
-
- width += left - 1;
- if (!scalewidth)
- scalewidth = width;
-
- if (next < ++width)
- width = next;
-
- /* Draw data point lines */
- for (i = left; i < width; i++) {
- int y = XtHeight(w) - (XtHeight(w) * w->strip_chart.valuedata[i])
- / w->strip_chart.scale;
-
- XFillRectangle(dpy, win, w->strip_chart.fgGC,
- i, y, 1, XtHeight(w) - y);
- }
-
- /* Draw graph reference lines */
- for (i = 1; i < w->strip_chart.scale; i++) {
- j = i * ((int)XtHeight(w) / w->strip_chart.scale);
- XDrawLine(dpy, win, w->strip_chart.hiGC, left, j, scalewidth, j);
- }
- }
- return (next);
-}
-
-/*
- * Function:
- * MoveChart
- *
- * Parameters:
- * w - chart widget
- * blit - blit the bits?
- *
- * Description:
- * Moves the chart over when it would run off the end.
- */
-static void
-MoveChart(StripChartWidget w, Bool blit)
-{
- double old_max;
- int left, i, j;
- int next = w->strip_chart.interval;
-
- if (!XtIsRealized((Widget)w))
- return;
-
- if (w->strip_chart.jump_val < 0)
- w->strip_chart.jump_val = DEFAULT_JUMP;
- if (w->strip_chart.jump_val == DEFAULT_JUMP)
- j = XtWidth(w) >> 1;
- else {
- j = (int)XtWidth(w) - w->strip_chart.jump_val;
- if (j < 0)
- j = 0;
- }
-
- (void)memmove((char *)w->strip_chart.valuedata,
- (char *)(w->strip_chart.valuedata + next - j),
- j * sizeof(double));
- next = w->strip_chart.interval = j;
-
- /*
- * Since we just lost some data, recompute the
- * w->strip_chart.max_value
- */
- old_max = w->strip_chart.max_value;
- w->strip_chart.max_value = 0.0;
- for (i = 0; i < next; i++) {
- if (w->strip_chart.valuedata[i] > w->strip_chart.max_value)
- w->strip_chart.max_value = w->strip_chart.valuedata[i];
- }
-
- if (!blit)
- return;
-
- if (old_max != w->strip_chart.max_value) {
- XClearWindow(XtDisplay(w), XtWindow(w));
- repaint_window(w, 0, XtWidth(w));
- return;
- }
-
- XCopyArea(XtDisplay((Widget)w), XtWindow((Widget)w), XtWindow((Widget)w),
- w->strip_chart.hiGC, (int)XtWidth(w) - j, 0, j, XtHeight(w), 0, 0);
-
- XClearArea(XtDisplay((Widget)w), XtWindow((Widget)w),
- j, 0, XtWidth(w) - j, XtHeight(w), False);
-
- /* Draw graph reference lines */
- left = j;
- for (i = 1; i < w->strip_chart.scale; i++) {
- j = i * (XtHeight(w) / w->strip_chart.scale);
- XDrawLine(XtDisplay((Widget)w), XtWindow((Widget)w),
- w->strip_chart.hiGC, left, j, XtWidth(w), j);
- }
-}
-
-/*ARGSUSED*/
-static Boolean
-XawStripChartSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- StripChartWidget old = (StripChartWidget)current;
- StripChartWidget w = (StripChartWidget)cnew;
- Bool ret_val = False;
- unsigned int new_gc = NO_GCS;
-
- if (w->strip_chart.update != old->strip_chart.update) {
- if (old->strip_chart.update > 0)
- XtRemoveTimeOut(old->strip_chart.interval_id);
- if (w->strip_chart.update > 0)
- w->strip_chart.interval_id =
- XtAppAddTimeOut(XtWidgetToApplicationContext(cnew),
- w->strip_chart.update * MS_PER_SEC,
- draw_it, (XtPointer)w);
- }
-
- if (w->strip_chart.min_scale > w->strip_chart.max_value + 1)
- ret_val = True;
-
- if (w->strip_chart.fgpixel != old->strip_chart.fgpixel) {
- new_gc |= FOREGROUND;
- ret_val = True;
- }
-
- if (w->strip_chart.hipixel != old->strip_chart.hipixel) {
- new_gc |= HIGHLIGHT;
- ret_val = True;
- }
-
- DestroyGC(old, new_gc);
- CreateGC(w, new_gc);
-
- return (ret_val);
-}
-
-/*
- * Function:
- * XawStripChartResize
- *
- * Parameters:
- * w - StripChart widget
- *
- * Description:
- * Sets up the polypoint that will be used to draw in the graph lines.
- */
-static void
-XawStripChartResize(Widget widget)
-{
- StripChartWidget w = (StripChartWidget)widget;
- XPoint *points;
- Cardinal size;
- int i;
-
- if (w->strip_chart.scale <= 1) {
- XtFree((char *)w->strip_chart.points);
- w->strip_chart.points = NULL;
- return;
- }
-
- size = sizeof(XPoint) * (w->strip_chart.scale - 1);
-
- points = (XPoint *)XtRealloc((XtPointer)w->strip_chart.points, size);
- w->strip_chart.points = points;
-
- /* Draw graph reference lines into clip mask */
-
- for (i = 1; i < w->strip_chart.scale; i++) {
- points[i - 1].x = 0;
- points[i - 1].y = XtHeight(w) / w->strip_chart.scale;
- }
-}
diff --git a/xc/lib/Xaw/StripChart.h b/xc/lib/Xaw/StripChart.h
deleted file mode 100644
index 531c43852..000000000
--- a/xc/lib/Xaw/StripChart.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $TOG: StripChart.h /main/7 1998/02/06 12:50:41 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xaw/StripChart.h,v 1.4 1998/10/03 08:42:23 dawes Exp $ */
-
-#ifndef _XawStripChart_h
-#define _XawStripChart_h
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- accelerators Accelerators AcceleratorTable NULL
- ancestorSensitive AncestorSensitive Boolean True
- background Background Pixel XtDefaultBackground
- backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
- borderColor BorderColor Pixel XtDefaultForeground
- borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
- borderWidth BorderWidth Dimension 1
- colormap Colormap Colormap parent's colormap
- cursor Cursor Cursor None
- cursorName Cursor String NULL
- depth Depth int parent's depth
- destroyCallback Callback XtCallbackList NULL
- foreground Foreground Pixel XtDefaultForeground
- getValue Callback XtCallbackList NULL
- height Height Dimension 120
- highlight Foreground Pixel XtDefaultForeground
- insensitiveBorder Insensitive Pixmap GreyPixmap
- jumpScroll JumpScroll int 1/2 width
- mappedWhenManaged MappedWhenManaged Boolean True
- minScale Scale int 1
- pointerColor Foreground Pixel XtDefaultForeground
- pointerColorBackground Background Pixel XtDefaultBackground
- screen Screen Screen parent's screen
- sensitive Sensitive Boolean True
- translations Translations TranslationTable NULL
- update Interval int 10 (seconds)
- width Width Dimension 120
- x Position Position 0
- y Position Position 0
-
-*/
-
-#define DEFAULT_JUMP -1
-
-#ifndef _XtStringDefs_h_
-#define XtNhighlight "highlight"
-#define XtNupdate "update"
-#endif
-
-#define XtCJumpScroll "JumpScroll"
-#define XtCScale "Scale"
-
-#define XtNgetValue "getValue"
-#define XtNjumpScroll "jumpScroll"
-#define XtNminScale "minScale"
-#define XtNscale "scale"
-#define XtNvmunix "vmunix"
-
-typedef struct _StripChartRec *StripChartWidget;
-typedef struct _StripChartClassRec *StripChartWidgetClass;
-
-extern WidgetClass stripChartWidgetClass;
-
-#endif /* _XawStripChart_h */
diff --git a/xc/lib/Xaw/Template.c b/xc/lib/Xaw/Template.c
deleted file mode 100644
index 82fcb9f83..000000000
--- a/xc/lib/Xaw/Template.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $TOG: Template.c /main/6 1998/02/06 12:50: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.
-
-*/
-/* $XFree86: xc/lib/Xaw/Template.c,v 1.6 1999/06/06 08:48:13 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include "TemplateP.h"
-
-/*
- * Class Methods
- */
-static void TemplateInitialize(Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static Bool TemplateFunction(TemplateWidget, int, int, Bool);
-
-/*
- * Actions
- */
-static void TemplateAction(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(TemplateRec, template.field)
-static XtResource resources[] = {
-/*{
- name,
- class,
- type,
- size,
- offset,
- default_type,
- default_addr
- },*/
- {
- XtNtemplateResource,
- XtCTemplateResource,
- XtRTemplateResource,
- sizeof(char*),
- offset(resource),
- XtRString,
- (XtPointer)"default"
- },
-};
-#undef offset
-
-static XtActionsRec actions[] =
-{
- /*{name, procedure},*/
- {"template", TemplateAction},
-};
-
-static char translations[] =
-"<Key>:" "template()\n"
-;
-
-#define Superclass (&widgetClassRec)
-TemplateClassRec templateClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Template", /* class_name */
- sizeof(TemplateRec), /* widget_size */
- NULL, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- TemplateInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actions, /* actions */
- XtNumber(actions), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- NULL, /* resize */
- NULL, /* expose */
- NULL, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- translations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* template */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass templateWidgetClass = (WidgetClass)&templateClassRec;
-
-/*
- * Implementation
- */
-/*
- * Function:
- * TemplateInitialize
- *
- * Parameters:
- * request - requested widget
- * w - the widget
- * args - arguments
- * num_args - number of arguments
- *
- * Description:
- * Initializes widget instance.
- */
-/*ARGSUSED*/
-static void
-TemplateInitialize(Widget request, Widget w, ArgList args, Cardinal *num_args)
-{
- TemplateWidget tw = (TemplateWidget)w;
-
- tw->template.private = NULL;
-}
-
-/*
- * Function:
- * TemplateFunction
- *
- * Parameters:
- * tw - template widget
- * x - x coordinate
- * y - y coordinate
- * force - force action
- *
- * Description:
- * This function does nothing.
- *
- * Return:
- * Parameter force
- */
-/*ARGSUSED*/
-static Bool
-TemplateFunction(TemplateWidget tw, int x, int y, Bool force)
-{
- return (force);
-}
-
-/*
- * Function:
- * TemplateAction
- *
- * Parameters:
- * w - template widget
- * event - event that caused this action
- * params - parameters
- * num_params - number of parameters
- *
- * Description:
- * This function does nothing.
- */
-/*ARGSUSED*/
-static void
-TemplateAction(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
-}
diff --git a/xc/lib/Xaw/Template.h b/xc/lib/Xaw/Template.h
deleted file mode 100644
index 3b5281a16..000000000
--- a/xc/lib/Xaw/Template.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $TOG: Template.h /main/7 1998/02/06 12:50:56 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.
-
-*/
-/* $XFree86: xc/lib/Xaw/Template.h,v 1.4 1998/10/03 08:42:23 dawes Exp $ */
-
-#ifndef _Template_h
-#define _Template_h
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- destroyCallback Callback Pointer NULL
- height Height Dimension 0
- mappedWhenManaged MappedWhenManaged Boolean True
- sensitive Sensitive Boolean True
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-/* define any special resource names here that are not in <X11/StringDefs.h> */
-#define XtNtemplateResource "templateResource"
-
-#define XtCTemplateResource "TemplateResource"
-
-/* declare specific TemplateWidget class and instance datatypes */
-typedef struct _TemplateClassRec *TemplateWidgetClass;
-typedef struct _TemplateRec *TemplateWidget;
-
-/* declare the class constant */
-extern WidgetClass templateWidgetClass;
-
-#endif /* _Template_h */
diff --git a/xc/lib/Xaw/TemplateP.h b/xc/lib/Xaw/TemplateP.h
deleted file mode 100644
index 8c900ac31..000000000
--- a/xc/lib/Xaw/TemplateP.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $TOG: TemplateP.h /main/8 1998/02/06 12:50:46 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.
-
-*/
-/* $XFree86: xc/lib/Xaw/TemplateP.h,v 1.5 1999/06/06 08:48:13 dawes Exp $ */
-
-#ifndef _TemplateP_h
-#define _TemplateP_h
-
-#include <X11/Xaw/Template.h>
-
-/* include superclass private header file */
-#include <X11/CoreP.h>
-
-/* define unique representation types not found in <X11/StringDefs.h> */
-#define XtRTemplateResource "TemplateResource"
-
-typedef struct {
- XtPointer extension;
-} TemplateClassPart;
-
-typedef struct _TemplateClassRec {
- CoreClassPart core_class;
- TemplateClassPart template_class;
-} TemplateClassRec;
-
-extern TemplateClassRec templateClassRec;
-
-typedef struct {
- /* resources */
- char* resource;
- /* private */
- char *private;
-} TemplatePart;
-
-typedef struct _TemplateRec {
- CorePart core;
- TemplatePart template;
-} TemplateRec;
-
-#endif /* _TemplateP_h */
diff --git a/xc/lib/Xaw/Text.c b/xc/lib/Xaw/Text.c
deleted file mode 100644
index 2637862f5..000000000
--- a/xc/lib/Xaw/Text.c
+++ /dev/null
@@ -1,4116 +0,0 @@
-/* $TOG: Text.c /main/201 1998/06/24 11:53:44 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-/*
- * Copyright (c) 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 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.
- */
-
-/* $XFree86: xc/lib/Xaw/Text.c,v 3.34 1999/08/21 13:47:35 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Shell.h>
-#include <X11/Xatom.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xmu/Xmu.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/MultiSinkP.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/TextSrcP.h>
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/Scrollbar.h>
-#include <X11/Xaw/XawImP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-#include "XawI18n.h"
-
-#ifndef MAX_LEN_CT
-#define MAX_LEN_CT 6 /* for sequence: ESC $ ( A \xx \xx */
-#endif
-
-unsigned long FMT8BIT = 0L;
-unsigned long XawFmt8Bit = 0L;
-unsigned long XawFmtWide = 0L;
-
-#define SinkClearToBG _XawTextSinkClearToBackground
-
-#define SrcScan XawTextSourceScan
-#define SrcRead XawTextSourceRead
-#define SrcReplace XawTextSourceReplace
-#define SrcSearch XawTextSourceSearch
-#define SrcCvtSel XawTextSourceConvertSelection
-#define SrcSetSelection XawTextSourceSetSelection
-
-#define MULTI_CLICK_TIME 500L
-
-#define SRC_CHANGE_NONE 0
-#define SRC_CHANGE_AFTER 1
-#define SRC_CHANGE_BEFORE 2
-#define SRC_CHANGE_OVERLAP 3
-
-#define Superclass (&simpleClassRec)
-
-/*
- * Compute a the maximum length of a cut buffer that we can pass at any
- * time. The 64 allows for the overhead of the Change Property request.
- */
-#define MAX_CUT_LEN(dpy) (XMaxRequestSize(dpy) - 64)
-
-#define ClearWindow(ctx) \
- _XawTextNeedsUpdating((ctx), \
- (ctx)->text.lt.top, \
- (ctx)->text.lt.info[ctx->text.lt.lines].position)
-
-/*
- * Class Methods
- */
-static void XawTextClassInitialize(void);
-static void XawTextInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawTextRealize(Widget, XtValueMask*, XSetWindowAttributes*);
-static void XawTextDestroy(Widget);
-static void XawTextResize(Widget);
-static void XawTextExpose(Widget, XEvent*, Region);
-static Boolean XawTextSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-static void XawTextGetValuesHook(Widget, ArgList, Cardinal*);
-static Bool XawTextChangeSensitive(Widget);
-
-/*
- * Prototypes
- */
-static XawTextPosition _BuildLineTable(TextWidget, XawTextPosition, int);
-static void _CreateCutBuffers(Display*);
-static Boolean TextConvertSelection(Widget, Atom*, Atom*, Atom*, XtPointer*,
- unsigned long*, int*);
-static int CountLines(TextWidget, XawTextPosition, XawTextPosition);
-static void CreateHScrollBar(TextWidget);
-static void CreateVScrollBar(TextWidget);
-static void CvtStringToScrollMode(XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr);
-static Boolean CvtScrollModeToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static void CvtStringToWrapMode(XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr);
-static Boolean CvtWrapModeToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean CvtStringToJustifyMode(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean CvtJustifyModeToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static void DestroyHScrollBar(TextWidget);
-static void DestroyVScrollBar(TextWidget);
-static void DisplayText(Widget, XawTextPosition, XawTextPosition);
-static void OldDisplayText(Widget, XawTextPosition, XawTextPosition);
-static void DisplayTextWindow(Widget);
-static void DoCopyArea(TextWidget, int, int, unsigned int, unsigned int,
- int, int);
-static void DoSelection(TextWidget, XawTextPosition, Time, Bool);
-static void ExtendSelection(TextWidget, XawTextPosition, Bool);
-static XawTextPosition FindGoodPosition(TextWidget, XawTextPosition);
-static void FlushUpdate(TextWidget);
-static int GetCutBufferNumber(Atom);
-static int GetMaxTextWidth(TextWidget);
-static unsigned int GetWidestLine(TextWidget);
-static void HScroll(Widget, XtPointer, XtPointer);
-static void HJump(Widget, XtPointer, XtPointer);
-static void InsertCursor(Widget, XawTextInsertState);
-static Bool LineAndXYForPosition(TextWidget, XawTextPosition, int*,
- int*, int*);
-static int LineForPosition(TextWidget, XawTextPosition);
-static void TextLoseSelection(Widget, Atom*);
-static Bool MatchSelection(Atom, XawTextSelection*);
-static void ModifySelection(TextWidget, XawTextPosition, XawTextPosition);
-static XawTextPosition PositionForXY(TextWidget, int, int);
-static void PositionHScrollBar(TextWidget);
-static void PositionVScrollBar(TextWidget);
-#ifndef OLDXAW
-static int ResolveColumnNumber(TextWidget);
-static int ResolveLineNumber(TextWidget);
-#endif
-static void _SetSelection(TextWidget, XawTextPosition, XawTextPosition,
- Atom*, Cardinal);
-static void TextSinkResize(Widget);
-static void UpdateTextInRectangle(TextWidget, XRectangle*);
-static void UpdateTextInLine(TextWidget, int, int, int);
-static void VScroll(Widget, XtPointer, XtPointer);
-static void VJump(Widget, XtPointer, XtPointer);
-
-/*
- * External
- */
-void _XawTextAlterSelection(TextWidget,
- XawTextSelectionMode, XawTextSelectionAction,
- String*, Cardinal*);
-void _XawTextCheckResize(TextWidget);
-void _XawTextClearAndCenterDisplay(TextWidget);
-void _XawTextExecuteUpdate(TextWidget);
-char *_XawTextGetText(TextWidget, XawTextPosition, XawTextPosition);
-void _XawTextPrepareToUpdate(TextWidget);
-int _XawTextReplace(TextWidget, XawTextPosition, XawTextPosition,
- XawTextBlock*);
-Atom *_XawTextSelectionList(TextWidget, String*, Cardinal);
-void _XawTextSetScrollBars(TextWidget);
-void _XawTextSetSelection(TextWidget, XawTextPosition, XawTextPosition,
- String*, Cardinal);
-void _XawTextVScroll(TextWidget, int);
-void XawTextScroll(TextWidget, int, int);
-void _XawTextSetSource(Widget, Widget, XawTextPosition, XawTextPosition);
-#ifndef OLDXAW
-void _XawTextSetLineAndColumnNumber(TextWidget, Bool);
-#endif
-void _XawTextSourceChanged(Widget, XawTextPosition, XawTextPosition,
- XawTextBlock*, int);
-
-/* Not used by other modules, but were extern on previous versions
- * of the library
- */
-void _XawTextNeedsUpdating(TextWidget, XawTextPosition, XawTextPosition);
-void _XawTextShowPosition(TextWidget);
-
-/*
- * From TextAction.c
- */
-extern void _XawTextZapSelection(TextWidget, XEvent*, Bool);
-
-/*
- * From TextSrc.c
- */
-void _XawSourceAddText(Widget, Widget);
-void _XawSourceRemoveText(Widget, Widget, Bool);
-Bool _XawTextSourceNewLineAtEOF(Widget);
-
-/*
- * From TextSink.c
- */
-void _XawTextSinkClearToBackground(Widget, int, int, unsigned, unsigned);
-void _XawTextSinkDisplayText(Widget, int, int, XawTextPosition, XawTextPosition,
- Bool);
-
-/****************************************************************
- *
- * Full class record constant
- *
- ****************************************************************/
-/*
- * From TextTr.c
- */
-extern char _XawDefaultTextTranslations[];
-
-static XawTextSelectType defaultSelectTypes[] = {
- XawselectPosition, XawselectAlphaNumeric, XawselectWord, XawselectLine,
- XawselectParagraph, XawselectAll, XawselectNull,
-};
-
-static XPointer defaultSelectTypesPtr = (XPointer)defaultSelectTypes;
-static Dimension defWidth = 100;
-static Dimension defHeight = DEFAULT_TEXT_HEIGHT;
-
-#define offset(field) XtOffsetOf(TextRec, field)
-static XtResource resources[] = {
- {
- XtNwidth,
- XtCWidth,
- XtRDimension,
- sizeof(Dimension),
- offset(core.width),
- XtRDimension,
- (XtPointer)&defWidth
- },
- {
- XtNcursor,
- XtCCursor,
- XtRCursor,
- sizeof(Cursor),
- offset(simple.cursor),
- XtRString,
- "xterm"
- },
- {
- XtNheight,
- XtCHeight,
- XtRDimension,
- sizeof(Dimension),
- offset(core.height),
- XtRDimension,
- (XtPointer)&defHeight
- },
- {
- XtNdisplayPosition,
- XtCTextPosition,
- XtRInt,
- sizeof(XawTextPosition),
- offset(text.lt.top),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNinsertPosition,
- XtCTextPosition,
- XtRInt,
- sizeof(XawTextPosition),
- offset(text.insertPos),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNleftMargin,
- XtCMargin,
- XtRPosition,
- sizeof(Position),
- offset(text.r_margin.left),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNrightMargin,
- XtCMargin,
- XtRPosition,
- sizeof(Position),
- offset(text.r_margin.right),
- XtRImmediate,
- (XtPointer)4
- },
- {
- XtNtopMargin,
- XtCMargin,
- XtRPosition,
- sizeof(Position),
- offset(text.r_margin.top),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNbottomMargin,
- XtCMargin,
- XtRPosition,
- sizeof(Position),
- offset(text.r_margin.bottom),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNselectTypes,
- XtCSelectTypes,
- XtRPointer,
- sizeof(XawTextSelectType*),
- offset(text.sarray),
- XtRPointer,
- (XtPointer)&defaultSelectTypesPtr
- },
- {
- XtNtextSource,
- XtCTextSource,
- XtRWidget,
- sizeof(Widget),
- offset(text.source),
- XtRImmediate,
- NULL
- },
- {
- XtNtextSink,
- XtCTextSink,
- XtRWidget,
- sizeof(Widget),
- offset(text.sink),
- XtRImmediate,
- NULL
- },
- {
- XtNdisplayCaret,
- XtCOutput,
- XtRBoolean,
- sizeof(Boolean),
- offset(text.display_caret),
- XtRImmediate,
- (XtPointer)True
- },
- {
- XtNscrollVertical,
- XtCScroll,
- XtRScrollMode,
- sizeof(XawTextScrollMode),
- offset(text.scroll_vert),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNscrollHorizontal,
- XtCScroll,
- XtRScrollMode,
- sizeof(XawTextScrollMode),
- offset(text.scroll_horiz),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNwrap,
- XtCWrap,
- XtRWrapMode,
- sizeof(XawTextWrapMode),
- offset(text.wrap),
- XtRImmediate,
- (XtPointer)XawtextWrapNever
- },
- {
- XtNautoFill,
- XtCAutoFill,
- XtRBoolean,
- sizeof(Boolean),
- offset(text.auto_fill),
- XtRImmediate,
- (XtPointer)False
- },
-#ifndef OLDXAW
- {
- XtNpositionCallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(text.position_callbacks),
- XtRCallback,
- NULL
- },
- {
- XtNleftColumn,
- XtCColumn,
- XtRShort,
- sizeof(short),
- offset(text.left_column),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNrightColumn,
- XtCColumn,
- XtRShort,
- sizeof(short),
- offset(text.right_column),
- XtRImmediate,
- (XtPointer)0
- },
- {
- XtNjustifyMode,
- XtCJustifyMode,
- XtRJustifyMode,
- sizeof(XawTextJustifyMode),
- offset(text.justify),
- XtRImmediate,
- (XtPointer)XawjustifyLeft
- },
-#endif /* OLDXAW */
-};
-#undef offset
-
-#define done(address, type) \
- { toVal->size = sizeof(type); toVal->addr = (XPointer)address; }
-
-static XrmQuark QWrapNever, QWrapLine, QWrapWord;
-#ifndef notdef
-static XrmQuark QScrollNever, QScrollWhenNeeded, QScrollAlways;
-#endif
-static XrmQuark QJustifyLeft, QJustifyRight, QJustifyCenter, QJustifyFull;
-
-/*ARGSUSED*/
-static void
-CvtStringToScrollMode(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XawTextScrollMode scrollMode = XawtextScrollNever;
- XrmQuark q;
- char name[32];
-
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- if (q == QScrollNever || q == QScrollWhenNeeded)
- scrollMode = XawtextScrollNever;
- else if (q == QScrollAlways)
- scrollMode = XawtextScrollAlways;
- else if (strcmp(name, "true") == 0 || strcmp(name, "1") == 0)
- scrollMode = XawtextScrollAlways;
- else if (strcmp(name, "false") == 0 || strcmp(name, "0") == 0)
- scrollMode = XawtextScrollNever;
- else
- XtStringConversionWarning((char *)fromVal->addr, XtRScrollMode);
-
- done(&scrollMode, XawTextScrollMode);
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtScrollModeToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- static char *buffer;
- Cardinal size;
-
- switch (*(XawTextScrollMode *)fromVal->addr) {
- case XawtextScrollNever:
- case XawtextScrollWhenNeeded:
- buffer = XtEtextScrollNever;
- break;
- case XawtextScrollAlways:
- buffer = XtEtextScrollAlways;
- break;
- default:
- XawTypeToStringWarning(dpy, XtRScrollMode);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-/*ARGSUSED*/
-static void
-CvtStringToWrapMode(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XawTextWrapMode wrapMode = XawtextWrapNever;
- XrmQuark q;
- char lowerName[6];
-
- XmuNCopyISOLatin1Lowered(lowerName, (char *)fromVal->addr,
- sizeof(lowerName));
- q = XrmStringToQuark(lowerName);
-
- if (q == QWrapNever)
- wrapMode = XawtextWrapNever;
- else if (q == QWrapLine)
- wrapMode = XawtextWrapLine;
- else if (q == QWrapWord)
- wrapMode = XawtextWrapWord;
- else
- XtStringConversionWarning((char *)fromVal->addr, XtRWrapMode);
-
- done(&wrapMode, XawTextWrapMode);
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtWrapModeToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- static char *buffer;
- Cardinal size;
-
- switch (*(XawTextWrapMode *)fromVal->addr) {
- case XawtextWrapNever:
- buffer = XtEtextWrapNever;
- break;
- case XawtextWrapLine:
- buffer = XtEtextWrapLine;
- break;
- case XawtextWrapWord:
- buffer = XtEtextWrapWord;
- break;
- default:
- XawTypeToStringWarning(dpy, XtRWrapMode);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtStringToJustifyMode(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- XawTextJustifyMode justify;
- XrmQuark q;
- char lowerName[8];
-
- XmuNCopyISOLatin1Lowered(lowerName, (char *)fromVal->addr,
- sizeof(lowerName));
- q = XrmStringToQuark(lowerName);
-
- if (q == QJustifyLeft)
- justify = XawjustifyLeft;
- else if (q == QJustifyRight)
- justify = XawjustifyRight;
- else if (q == QJustifyCenter)
- justify = XawjustifyCenter;
- else if(q == QJustifyFull)
- justify = XawjustifyFull;
- else {
- XtStringConversionWarning((char *)fromVal->addr, XtRJustifyMode);
- return (False);
- }
-
- toVal->size = sizeof(XawTextJustifyMode);
- *(XawTextJustifyMode *)(toVal->addr) = justify;
-
- return (True);
-}
-
-
-/*ARGSUSED*/
-static Boolean
-CvtJustifyModeToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- static char *buffer;
- Cardinal size;
-
- switch (*(XawTextJustifyMode *)fromVal->addr) {
- case XawjustifyLeft:
- buffer = XtEtextJustifyLeft;
- break;
- case XawjustifyRight:
- buffer = XtEtextJustifyRight;
- break;
- case XawjustifyCenter:
- buffer = XtEtextJustifyCenter;
- break;
- case XawjustifyFull:
- buffer = XtEtextJustifyFull;
- break;
- default:
- XawTypeToStringWarning(dpy, XtRJustifyMode);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-#undef done
-
-static void
-XawTextClassInitialize(void)
-{
- if (!XawFmt8Bit)
- FMT8BIT = XawFmt8Bit = XrmPermStringToQuark("FMT8BIT");
- if (!XawFmtWide)
- XawFmtWide = XrmPermStringToQuark("FMTWIDE");
-
- XawInitializeWidgetSet();
-
- textClassRec.core_class.num_actions = _XawTextActionsTableCount;
-
- QWrapNever = XrmPermStringToQuark(XtEtextWrapNever);
- QWrapLine = XrmPermStringToQuark(XtEtextWrapLine);
- QWrapWord = XrmPermStringToQuark(XtEtextWrapWord);
- XtAddConverter(XtRString, XtRWrapMode, CvtStringToWrapMode, NULL, 0);
- XtSetTypeConverter(XtRWrapMode, XtRString, CvtWrapModeToString,
- NULL, 0, XtCacheNone, NULL);
- QScrollNever = XrmPermStringToQuark(XtEtextScrollNever);
- QScrollWhenNeeded = XrmPermStringToQuark(XtEtextScrollWhenNeeded);
- QScrollAlways = XrmPermStringToQuark(XtEtextScrollAlways);
- XtAddConverter(XtRString, XtRScrollMode, CvtStringToScrollMode,
- NULL, 0);
- XtSetTypeConverter(XtRScrollMode, XtRString, CvtScrollModeToString,
- NULL, 0, XtCacheNone, NULL);
- QJustifyLeft = XrmPermStringToQuark(XtEtextJustifyLeft);
- QJustifyRight = XrmPermStringToQuark(XtEtextJustifyRight);
- QJustifyCenter = XrmPermStringToQuark(XtEtextJustifyCenter);
- QJustifyFull = XrmPermStringToQuark(XtEtextJustifyFull);
- XtSetTypeConverter(XtRString, XtRJustifyMode, CvtStringToJustifyMode,
- NULL, 0, XtCacheNone, NULL);
- XtSetTypeConverter(XtRJustifyMode, XtRString, CvtJustifyModeToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/*
- * Function:
- * PositionHScrollBar
- *
- * Parameters:
- * ctx - text widget
- *
- * Description:
- * Positions the Horizontal scrollbar.
- */
-static void
-PositionHScrollBar(TextWidget ctx)
-{
- Widget hbar = ctx->text.hbar, vbar = ctx->text.vbar;
- Position x, y;
- Dimension width, height;
-
- if (ctx->text.hbar == NULL)
- return;
-
- if (vbar != NULL)
- x = XtWidth(vbar);
- else
- x = -XtBorderWidth(hbar);
- y = XtHeight(ctx) - XtHeight(hbar) - XtBorderWidth(hbar);
- if (vbar != NULL) {
- width = XtWidth(ctx) - XtWidth(vbar) - XtBorderWidth(vbar);
- if (width > XtWidth(ctx))
- width = XtWidth(ctx);
- }
- else
- width = XtWidth(ctx);
- height = XtHeight(hbar);
-
- XtConfigureWidget(hbar, x, y, width, height, XtBorderWidth(hbar));
-}
-
-/*
- * Function:
- * PositionVScrollBar
- *
- * Parameters:
- * ctx - text widget
- *
- * Description:
- * Positions the Vertical scrollbar.
- */
-static void
-PositionVScrollBar(TextWidget ctx)
-{
- Widget vbar = ctx->text.vbar;
- Position x, y;
- Dimension width, height;
-
- if (vbar == NULL)
- return;
-
- x = y = -XtBorderWidth(vbar);
- height = XtHeight(ctx);
- width = XtWidth(vbar);
-
- XtConfigureWidget(vbar, x, y, width, height, XtBorderWidth(vbar));
-}
-
-static void
-CreateVScrollBar(TextWidget ctx)
-{
- Widget vbar;
-
- if (ctx->text.vbar != NULL)
- return;
-
- ctx->text.vbar = vbar =
- XtCreateWidget("vScrollbar", scrollbarWidgetClass, (Widget)ctx, NULL, 0);
- XtAddCallback(vbar, XtNscrollProc, VScroll, (XtPointer)ctx);
- XtAddCallback(vbar, XtNjumpProc, VJump, (XtPointer)ctx);
-
- ctx->text.r_margin.left += XtWidth(vbar) + XtBorderWidth(vbar);
- ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left;
-
- PositionVScrollBar(ctx);
- PositionHScrollBar(ctx);
- TextSinkResize(ctx->text.sink);
-
- if (XtIsRealized((Widget)ctx)) {
- XtRealizeWidget(vbar);
- XtMapWidget(vbar);
- }
-}
-
-/*
- * Function:
- * DestroyVScrollBar
- *
- * Parameters:
- * ctx - parent text widget
- *
- * Description:
- * Removes vertical ScrollBar.
- */
-static void
-DestroyVScrollBar(TextWidget ctx)
-{
- Widget vbar = ctx->text.vbar;
-
- if (vbar == NULL)
- return;
-
- ctx->text.r_margin.left -= XtWidth(vbar) + XtBorderWidth(vbar);
- ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left;
-
- XtDestroyWidget(vbar);
- ctx->text.vbar = NULL;
- PositionHScrollBar(ctx);
- TextSinkResize(ctx->text.sink);
-}
-
-static void
-CreateHScrollBar(TextWidget ctx)
-{
- Arg args[1];
- Widget hbar;
- int bottom;
-
- if (ctx->text.hbar != NULL)
- return;
-
- XtSetArg(args[0], XtNorientation, XtorientHorizontal);
- ctx->text.hbar = hbar =
- XtCreateWidget("hScrollbar", scrollbarWidgetClass, (Widget)ctx, args, 1);
- XtAddCallback(hbar, XtNscrollProc, HScroll, (XtPointer)ctx);
- XtAddCallback(hbar, XtNjumpProc, HJump, (XtPointer)ctx);
-
- bottom = ctx->text.r_margin.bottom + XtHeight(hbar) + XtBorderWidth(hbar);
-
- ctx->text.margin.bottom = ctx->text.r_margin.bottom = bottom;
-
- PositionHScrollBar(ctx);
- TextSinkResize(ctx->text.sink);
-
- if (XtIsRealized((Widget)ctx)) {
- XtRealizeWidget(hbar);
- XtMapWidget(hbar);
- }
-}
-
-/*
- * Function:
- * DestroyHScrollBar
- *
- * Parameters:
- * ctx - parent text widget
- *
- * Description:
- * Removes horizontal ScrollBar.
- */
-static void
-DestroyHScrollBar(TextWidget ctx)
-{
- Widget hbar = ctx->text.hbar;
-
- if (hbar == NULL)
- return;
-
- ctx->text.r_margin.bottom -= XtHeight(hbar) + XtBorderWidth(hbar);
- ctx->text.margin.bottom = ctx->text.r_margin.bottom;
-
- XtDestroyWidget(hbar);
- ctx->text.hbar = NULL;
- TextSinkResize(ctx->text.sink);
-}
-
-/*ARGSUSED*/
-static void
-XawTextInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TextWidget ctx = (TextWidget)cnew;
-
- ctx->text.lt.lines = 0;
- ctx->text.lt.info = (XawTextLineTableEntry *)
- XtCalloc(1, sizeof(XawTextLineTableEntry));
-#ifndef OLDXAW
- ctx->text.lt.base_line = 1;
-#endif
- (void)bzero(&ctx->text.origSel, sizeof(XawTextSelection));
- (void)bzero(&ctx->text.s, sizeof(XawTextSelection));
- ctx->text.s.type = XawselectPosition;
- ctx->text.salt = NULL;
- ctx->text.hbar = ctx->text.vbar = NULL;
- ctx->text.lasttime = 0;
- ctx->text.time = 0;
- ctx->text.showposition = True;
- ctx->text.lastPos = ctx->text.source != NULL ?
- XawTextGetLastPosition(ctx) : 0;
- ctx->text.file_insert = NULL;
- ctx->text.search = NULL;
- ctx->text.update = XmuNewScanline(0, 0, 0);
- ctx->text.gc = DefaultGCOfScreen(XtScreen(ctx));
- ctx->text.hasfocus = False;
- ctx->text.margin = ctx->text.r_margin; /* Strucure copy */
- ctx->text.left_margin = ctx->text.r_margin.left;
- ctx->text.update_disabled = False;
- ctx->text.clear_to_eol = True;
- ctx->text.old_insert = -1;
- ctx->text.mult = 1;
- ctx->text.salt2 = NULL;
- ctx->text.from_left = -1;
-
-#ifndef OLDXAW
- ctx->text.numeric = False;
- ctx->text.selection_state = False;
- ctx->text.kill_ring = 0;
-
- ctx->text.line_number = -1;
- ctx->text.column_number = -1;
- ctx->text.source_changed = SRC_CHANGE_NONE;
-
- ctx->text.kill_ring_ptr = NULL;
- ctx->text.overwrite = False;
-#endif
-
- if (XtHeight(ctx) == DEFAULT_TEXT_HEIGHT) {
- XtHeight(ctx) = VMargins(ctx);
- if (ctx->text.sink != NULL)
- XtHeight(ctx) += XawTextSinkMaxHeight(ctx->text.sink, 1);
- }
-
- if (ctx->text.scroll_vert == XawtextScrollAlways)
- CreateVScrollBar(ctx);
- if (ctx->text.scroll_horiz == XawtextScrollAlways)
- CreateHScrollBar(ctx);
-
-#ifndef OLDXAW
- if (ctx->text.left_column < 0)
- ctx->text.left_column = 0;
- if (ctx->text.right_column < 0)
- ctx->text.right_column = 0;
-#endif
-}
-
-static void
-XawTextRealize(Widget w, XtValueMask *mask, XSetWindowAttributes *attr)
-{
- TextWidget ctx = (TextWidget)w;
-
- (*textClassRec.core_class.superclass->core_class.realize)(w, mask, attr);
-
- if (ctx->text.hbar != NULL) {
- XtRealizeWidget(ctx->text.hbar);
- XtMapWidget(ctx->text.hbar);
- }
-
- if (ctx->text.vbar != NULL) {
- XtRealizeWidget(ctx->text.vbar);
- XtMapWidget(ctx->text.vbar);
- }
-
- _XawTextBuildLineTable(ctx, ctx->text.lt.top, True);
-
-#ifndef OLDXAW
- _XawTextSetLineAndColumnNumber(ctx, True);
-#endif
-}
-
-/* Utility routines for support of Text */
-static void
-_CreateCutBuffers(Display *d)
-{
- static struct _DisplayRec {
- struct _DisplayRec *next;
- Display *dpy;
- } *dpy_list = NULL;
- struct _DisplayRec *dpy_ptr;
-
- for (dpy_ptr = dpy_list; dpy_ptr != NULL; dpy_ptr = dpy_ptr->next)
- if (dpy_ptr->dpy == d)
- return;
-
- dpy_ptr = XtNew(struct _DisplayRec);
- dpy_ptr->next = dpy_list;
- dpy_ptr->dpy = d;
- dpy_list = dpy_ptr;
-
-#define Create(buffer) \
- XChangeProperty(d, RootWindow(d, 0), buffer, XA_STRING, 8, \
- PropModeAppend, NULL, 0);
-
- Create(XA_CUT_BUFFER0);
- Create(XA_CUT_BUFFER1);
- Create(XA_CUT_BUFFER2);
- Create(XA_CUT_BUFFER3);
- Create(XA_CUT_BUFFER4);
- Create(XA_CUT_BUFFER5);
- Create(XA_CUT_BUFFER6);
- Create(XA_CUT_BUFFER7);
-
-#undef Create
-}
-
-/*
- * Procedure to manage insert cursor visibility for editable text. It uses
- * the value of ctx->insertPos and an implicit argument. In the event that
- * position is immediately preceded by an eol graphic, then the insert cursor
- * is displayed at the beginning of the next line.
- */
-static void
-InsertCursor(Widget w, XawTextInsertState state)
-{
- TextWidget ctx = (TextWidget)w;
- int x, y;
- int line;
-
- if (ctx->text.lt.lines < 1)
- return;
-
- if (ctx->text.display_caret &&
- LineAndXYForPosition(ctx, ctx->text.insertPos, &line, &x, &y)) {
- if (line < ctx->text.lt.lines)
- y += (ctx->text.lt.info[line + 1].y - ctx->text.lt.info[line].y) + 1;
- else
- y += (ctx->text.lt.info[line].y - ctx->text.lt.info[line - 1].y) + 1;
-
- XawTextSinkInsertCursor(ctx->text.sink, x, y, state);
- }
-
- /* Keep Input Method up to speed */
- if (ctx->simple.international) {
- Arg list[1];
-
- XtSetArg(list[0], XtNinsertPosition, ctx->text.insertPos);
- _XawImSetValues(w, list, 1);
- }
-}
-
-/*
- * Procedure to register a span of text that is no longer valid on the display
- * It is used to avoid a number of small, and potentially overlapping, screen
- * updates.
-*/
-void
-_XawTextNeedsUpdating(TextWidget ctx,
- XawTextPosition left, XawTextPosition right)
-{
- XmuSegment segment;
-
- if (left >= right)
- return;
-
- segment.x1 = (int)left;
- segment.x2 = (int)right;
- (void)XmuScanlineOrSegment(ctx->text.update, &segment);
-}
-
-/*
- * Procedure to read a span of text in Ascii form. This is purely a hack and
- * we probably need to add a function to sources to provide this functionality.
- * [note: this is really a private procedure but is used in multiple modules].
- */
-char *
-_XawTextGetText(TextWidget ctx, XawTextPosition left, XawTextPosition right)
-{
- char *result, *tempResult;
- XawTextBlock text;
- int bytes;
-
- if (XawTextFormat(ctx, XawFmt8Bit))
- bytes = sizeof(unsigned char);
- else if (XawTextFormat(ctx, XawFmtWide))
- bytes = sizeof(wchar_t);
- else /* if there is another fomat, add here */
- bytes = 1;
-
- /* leave space for ZERO */
- tempResult = result = XtMalloc((unsigned)(right - left + ONE) * bytes);
-
- while (left < right) {
- left = SrcRead(ctx->text.source, left, &text, (int)(right - left));
- if (!text.length)
- break;
- memmove(tempResult, text.ptr, (unsigned)(text.length * bytes));
- tempResult += text.length * bytes;
- }
-
- if (bytes == sizeof(wchar_t))
- *((wchar_t*)tempResult) = (wchar_t)0;
- else
- *tempResult = '\0';
-
- return (result);
-}
-
-/* Like _XawTextGetText, but enforces ICCCM STRING type encoding. This
- * routine is currently used to put just the ASCII chars in the selection
- * into a cut buffer.
- */
-char *
-_XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right)
-{
- unsigned char *s;
- unsigned char c;
- long i, j, n;
- wchar_t *ws, wc;
-
- /* allow ESC in accordance with ICCCM */
- if (XawTextFormat(ctx, XawFmtWide)) {
- MultiSinkObject sink = (MultiSinkObject)ctx->text.sink;
- ws = (wchar_t *)_XawTextGetText(ctx, left, right);
- n = wcslen(ws);
- for (j = 0, i = 0; j < n; j++) {
- wc = ws[j];
- if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1)
- || (wc == _Xaw_atowc(XawTAB)) || (wc == _Xaw_atowc(XawLF))
- || (wc == _Xaw_atowc(XawESC)))
- ws[i++] = wc;
- }
- ws[i] = (wchar_t)0;
- return ((char *)ws);
- }
- else {
- s = (unsigned char *)_XawTextGetText(ctx, left, right);
- /* only HT and NL control chars are allowed, strip out others */
- n = strlen((char *)s);
- i = 0;
- for (j = 0; j < n; j++) {
- c = s[j];
- if (((c >= 0x20) && c <= 0x7f)
- ||(c >= 0xa0) || (c == XawTAB) || (c == XawLF)
- || (c == XawESC)) {
- s[i] = c;
- i++;
- }
- }
- s[i] = 0;
-
- return ((char *)s);
- }
-}
-
-/*
- * This routine maps an x and y position in a window that is displaying text
- * into the corresponding position in the source.
- */
-static XawTextPosition
-PositionForXY(TextWidget ctx, int x, int y)
-{
- int fromx, line, width, height;
- XawTextPosition position;
-
- if (ctx->text.lt.lines == 0)
- return (0);
-
- for (line = 0; line < ctx->text.lt.lines - 1; line++) {
- if (y <= ctx->text.lt.info[line + 1].y)
- break;
- }
- position = ctx->text.lt.info[line].position;
- if (position >= ctx->text.lastPos)
- return (ctx->text.lastPos);
- fromx = ctx->text.left_margin;
- XawTextSinkFindPosition(ctx->text.sink, position, fromx, x - fromx,
- False, &position, &width, &height);
-
- if (position > ctx->text.lastPos)
- return (ctx->text.lastPos);
-
- if (position >= ctx->text.lt.info[line + 1].position)
- position = SrcScan(ctx->text.source, ctx->text.lt.info[line + 1].position,
- XawstPositions, XawsdLeft, 1, True);
-
- return (position);
-}
-
-/*
- * This routine maps a source position in to the corresponding line number
- * of the text that is displayed in the window.
- */
-static int
-LineForPosition(TextWidget ctx, XawTextPosition position)
-{
- int line;
-
- for (line = 0; line < ctx->text.lt.lines; line++)
- if (position < ctx->text.lt.info[line + 1].position)
- break;
-
- return (line);
-}
-
-/*
- * This routine maps a source position into the corresponding line number
- * and the x, y coordinates of the text that is displayed in the window.
- */
-static Bool
-LineAndXYForPosition(TextWidget ctx, XawTextPosition pos,
- int *line, int *x, int *y)
-{
- XawTextPosition linePos, endPos;
- Boolean visible;
- int realW, realH;
-
- *line = 0;
- *x = ctx->text.left_margin;
- *y = ctx->text.margin.top + 1;
- if ((visible = IsPositionVisible(ctx, pos)) != False) {
- *line = LineForPosition(ctx, pos);
- *y = ctx->text.lt.info[*line].y;
- linePos = ctx->text.lt.info[*line].position;
- XawTextSinkFindDistance(ctx->text.sink, linePos,
- *x, pos, &realW, &endPos, &realH);
- *x += realW;
- }
-
- return (visible);
-}
-
-/*
- * This routine builds a line table. It does this by starting at the
- * specified position and measuring text to determine the staring position
- * of each line to be displayed. It also determines and saves in the
- * linetable all the required metrics for displaying a given line (e.g.
- * x offset, y offset, line length, etc.).
- */
-void
-_XawTextBuildLineTable(TextWidget ctx, XawTextPosition position,
- _XtBoolean force_rebuild)
-{
- Dimension height = 0;
- int lines = 0;
- Cardinal size;
-
- if ((int)XtHeight(ctx) > VMargins(ctx)) {
- height = XtHeight(ctx) - VMargins(ctx);
- lines = XawTextSinkMaxLines(ctx->text.sink, height);
- }
- size = sizeof(XawTextLineTableEntry) * (lines + 1);
-
- if (lines != ctx->text.lt.lines || ctx->text.lt.info == NULL) {
- ctx->text.lt.info = (XawTextLineTableEntry *)
- XtRealloc((char *)ctx->text.lt.info, size);
- ctx->text.lt.lines = lines;
- force_rebuild = True;
- }
-
- if (force_rebuild) {
- (void)bzero((char *)ctx->text.lt.info, size);
- /* force a text update in the first text line if it is visible */
- ctx->text.lt.info[0].position = (XawTextPosition)-1;
- }
- if (position != ctx->text.lt.info[0].position) {
- (void)_BuildLineTable(ctx, position, 0);
- ctx->text.clear_to_eol = True;
- }
-}
-
-/*
- * We may need to resize the line table here, since there maybe lines with
- * different fonts (that can be shorter or taller than the default one)
- */
-static XawTextPosition
-_BuildLineTable(TextWidget ctx, XawTextPosition position, int line)
-{
- XawTextLineTableEntry *lt = ctx->text.lt.info + line;
- XawTextPosition end, update_from = -1;
- Position y;
- int wwidth, width, height;
-#ifndef OLDXAW
- Widget src = ctx->text.source;
-#endif
- int max_y = (int)XtHeight(ctx) - (int)ctx->text.margin.bottom;
-
- if (ctx->text.wrap == XawtextWrapNever)
- wwidth = 0x7fffffff;
- else
- wwidth = GetMaxTextWidth(ctx);
-
- /* XXX y may change, due to font size changes. See later */
- y = line == 0 ? ctx->text.margin.top : lt->y;
-
-#ifndef OLDXAW
- if (ctx->text.lt.base_line < 0) {
- if (line == 0)
- ctx->text.lt.top = position;
- }
- else if (line == 0) {
- XawTextPosition pos = ctx->text.lt.top;
- int base_line = ctx->text.lt.base_line;
-
- if (position == 0)
- base_line = 1;
- else if (ctx->text.lt.base_line == 0 ||
- ctx->text.source_changed == SRC_CHANGE_OVERLAP) {
- pos = 0;
- base_line = 1;
-
- while (pos < position) {
- pos = SrcScan(src, pos, XawstEOL, XawsdRight, 1, True);
- if (pos <= position) {
- ++base_line;
- if (pos == ctx->text.lastPos) {
- base_line -= !_XawTextSourceNewLineAtEOF(src);
- break;
- }
- }
- }
- }
- else if (ctx->text.wrap == XawtextWrapNever
- && IsPositionVisible(ctx, position))
- base_line += LineForPosition(ctx, position);
- else if (pos < position) {
- while (pos < position) {
- pos = SrcScan(src, pos, XawstEOL, XawsdRight, 1, True);
- if (pos <= position) {
- ++base_line;
- if (pos == ctx->text.lastPos) {
- base_line -= !_XawTextSourceNewLineAtEOF(src);
- break;
- }
- }
- }
- }
- else if (pos > position) {
- while (pos > position) {
- pos = SrcScan(src, pos, XawstEOL, XawsdLeft, 1, False);
- if (--pos >= position)
- --base_line;
- }
- }
-
- ctx->text.lt.top = position;
- ctx->text.lt.base_line = base_line;
- }
-#else
- if (line == 0)
- ctx->text.lt.top = position;
-#endif
-
- /* CONSTCOND */
- while (True) {
- XawTextSinkFindPosition(ctx->text.sink, position, ctx->text.left_margin,
- wwidth, ctx->text.wrap == XawtextWrapWord,
- &end, &width, &height);
-
- if (lt->position != position) {
- _XawTextNeedsUpdating(ctx, position,
- end <= position ? position + 1 : end);
- ctx->text.clear_to_eol = True;
- }
-
- if (lt->y != y) {
- if (update_from < 0)
- update_from = line == 0 ?
- ctx->text.lt.info[0].position :
- ctx->text.lt.info[line - 1].position;
- lt->y = y;
- ctx->text.clear_to_eol = True;
- }
- lt->position = position;
- lt->textWidth = width;
- y += height;
-
- if (end > ctx->text.lastPos) {
- position = end;
- ctx->text.clear_to_eol = True;
- _XawTextNeedsUpdating(ctx, end, end + ctx->text.lt.lines - line);
- while (line++ < ctx->text.lt.lines) {
- if (line > 1 && y > max_y) {
- ctx->text.lt.lines = line - 1;
- break;
- }
- ++lt;
- if (lt->y != y) {
- if (update_from < 0)
- update_from = line < 2 ?
- ctx->text.lt.info[0].position :
- ctx->text.lt.info[line - 2].position;
- lt->y = y;
- }
- lt->position = ++position;
- lt->textWidth = 0;
- y += height;
- }
- if (update_from >= 0)
- _XawTextNeedsUpdating(ctx, update_from,
- ctx->text.lt.info[ctx->text.lt.lines].position);
- _XawTextSetScrollBars(ctx);
-
- return (ctx->text.lastPos);
- }
-
- if (line && y > max_y)
- /* will return in the next loop */
- ctx->text.lt.lines = line;
-
- if (++line > ctx->text.lt.lines && y < max_y) {
- /* grow the line table */
- ctx->text.lt.info = (XawTextLineTableEntry *)
- XtRealloc((char *)ctx->text.lt.info,
- sizeof(XawTextLineTableEntry) * (line + 1));
- lt = ctx->text.lt.info + line;
- ++ctx->text.lt.lines;
- }
- else
- ++lt;
- if (position == end)
- ++position;
- else
- position = end;
-
- if (line > ctx->text.lt.lines) {
- if (update_from >= 0)
- _XawTextNeedsUpdating(ctx, update_from,
- ctx->text.lt.info[ctx->text.lt.lines].position);
- _XawTextSetScrollBars(ctx);
-
- return (position);
- }
- }
- /*NOTREACHED*/
-}
-
-/*
- * Function:
- * GetWidestLine
- *
- * Parameters:
- * ctx - text widget
- *
- * Description:
- * Returns the width (in pixels) of the widest line that
- * is currently visable.
- *
- * Returns:
- * The width of the widest line
- */
-static unsigned int
-GetWidestLine(TextWidget ctx)
-{
- int i;
- unsigned int widest;
- XawTextLineTablePtr lt = &(ctx->text.lt);
-
- for (i = 0, widest = 0; i < lt->lines; i++)
- if (widest < lt->info[i].textWidth)
- widest = lt->info[i].textWidth;
-
- return (widest);
-}
-
-/*
- * This routine is used by Text to notify an associated scrollbar of the
- * correct metrics (position and shown fraction) for the text being currently
- * displayed in the window.
- */
-void
-_XawTextSetScrollBars(TextWidget ctx)
-{
- float first, last, denom, widest;
-
- if (ctx->text.scroll_vert == XawtextScrollAlways) {
- if (ctx->text.lastPos == 0)
- first = 0.0;
- else
- first = ctx->text.lt.top / (float)ctx->text.lastPos;
-
- if (ctx->text.lt.info[ctx->text.lt.lines].position < ctx->text.lastPos)
- last = ctx->text.lt.info[ctx->text.lt.lines].position /
- (float)ctx->text.lastPos;
- else
- last = 1.0;
-
- XawScrollbarSetThumb(ctx->text.vbar, first, last - first);
- }
-
- if (ctx->text.scroll_horiz == XawtextScrollAlways) {
- denom = GetWidestLine(ctx);
- if (denom <= 0)
- denom = (int)XtWidth(ctx) - RHMargins(ctx);
- if (denom <= 0)
- denom = 1;
- widest = ((int)XtWidth(ctx) - RHMargins(ctx)) / denom;
- first = ctx->text.r_margin.left - ctx->text.left_margin;
- first /= denom;
-
- XawScrollbarSetThumb(ctx->text.hbar, first, widest);
- }
-}
-
-static void
-DoCopyArea(TextWidget ctx, int src_x, int src_y,
- unsigned int width, unsigned int height, int dst_x, int dst_y)
-{
- int x1, y1, x2, y2;
-
- x1 = ctx->text.r_margin.left;
- y1 = ctx->text.r_margin.top;
- x2 = XtWidth(ctx) - ctx->text.r_margin.right;
- y2 = XtHeight(ctx) - ctx->text.r_margin.bottom;
-
- if (x1 >= x2 || y1 >= y2)
- return;
-
- src_x = XawMax(x1, XawMin(src_x, x2));
- src_y = XawMax(y1, XawMin(src_y, y2));
- dst_x = XawMax(x1, XawMin(dst_x, x2));
- dst_y = XawMax(y1, XawMin(dst_y, y2));
- width = XawMax(0, XawMin(x2 - dst_x, (int)width));
- height = XawMax(0, XawMin(y2 - dst_y, (int)height));
-
- XCopyArea(XtDisplay(ctx), XtWindow(ctx), XtWindow(ctx), ctx->text.gc,
- src_x, src_y, width, height, dst_x, dst_y);
-}
-
-/*
- * Function:
- * XawTextScroll
- *
- * Parameters:
- * ctx - text widget
- * vlines - number of lines to scroll vertically
- * hpixels - number of pixels to scroll horizontally
- *
- * Description:
- * Generic function for scrolling the text window.
- * Allows vertical and horizontal scroll at the same time.
- */
-void
-XawTextScroll(TextWidget ctx, int vlines, int hpixels)
-{
- XawTextPosition top, tmp, update_from, update_to;
- XawTextLineTable *lt;
- Arg arglist[1];
- int y0, y1, y2, count, dim, wwidth, lines = ctx->text.lt.lines;
- int vwidth, vheight; /* visible width and height */
- Bool scroll;
-
- vwidth = (int)XtWidth(ctx) - RHMargins(ctx);
- vheight = (int)XtHeight(ctx) - RVMargins(ctx);
- lt = &ctx->text.lt;
-
- if (!lt || vwidth <= 0 || vheight <= 0)
- return;
-
- if ((scroll = ctx->core.background_pixmap == XtUnspecifiedPixmap) == True) {
- dim = lt->info[1].y - lt->info[0].y;
- for (count = 1; count < lt->lines - 1; count++)
- if (lt->info[count + 1].y - lt->info[count].y != dim) {
- scroll = False;
- break;
- }
- }
-
- wwidth = GetMaxTextWidth(ctx);
-
- /*
- * Do the horizontall scrolling
- */
- if (hpixels < 0 && ctx->text.left_margin - hpixels > ctx->text.r_margin.left)
- hpixels = ctx->text.left_margin - ctx->text.r_margin.left;
- ctx->text.left_margin -= hpixels;
-
- update_from = lt->top; /* remember the old value */
- /*
- * Checks the requested number of lines and calculates the top
- * of the line table
- */
- if (vlines < 0) { /* VScroll Up */
- if (IsPositionVisible(ctx, 0))
- vlines = 0;
- else if (ctx->text.wrap != XawtextWrapNever) {
- XawTextPosition end;
- int n_lines = 0;
-
- count = -vlines;
- end = lt->top;
- while (n_lines < count) {
- top = SrcScan(ctx->text.source, end, XawstEOL,
- XawsdLeft, 2, False);
- n_lines += CountLines(ctx, top, end);
- end = top;
- }
-
- while (count++ < n_lines) {
- tmp = top;
- XawTextSinkFindPosition(ctx->text.sink, top,
- ctx->text.left_margin,
- wwidth,ctx->text.wrap == XawtextWrapWord,
- &top, &dim, &dim);
- if (tmp == top)
- ++top;
- }
- }
- else
- top = SrcScan(ctx->text.source, lt->top, XawstEOL,
- XawsdLeft, -vlines + 1, False);
- if (-vlines >= ctx->text.lt.lines)
- scroll = False;
- }
- else if (vlines > 0) { /* VScroll Down */
- if (LineForPosition(ctx, ctx->text.lastPos) == 0)
- vlines = 0;
- if (vlines < lt->lines)
- top = XawMin(lt->info[vlines].position, ctx->text.lastPos);
- else if (ctx->text.wrap == XawtextWrapNever)
- top = SrcScan(ctx->text.source,
- SrcScan(ctx->text.source, lt->top,
- XawstEOL, XawsdRight, vlines,
- True),
- XawstEOL, XawsdLeft, 1, False);
- else {
- top = lt->top;
- count = 0;
- while (count++ < vlines) {
- tmp = top;
- XawTextSinkFindPosition(ctx->text.sink, top,
- ctx->text.left_margin,
- wwidth, ctx->text.wrap == XawtextWrapWord,
- &top, &dim, &dim);
- if (tmp == top)
- ++top;
- }
- }
- if (vlines >= ctx->text.lt.lines
- || lt->info[vlines].position >= ctx->text.lastPos)
- scroll = False;
- }
-
- if (!vlines) {
- if (hpixels) {
- ClearWindow(ctx);
- ctx->text.clear_to_eol = True;
- }
- _XawTextSetScrollBars(ctx);
- return;
- }
-
- /* Flushes any pending updates. Normally, there may be a call to
- * XawTextUnsetSelection not yet updated.
- */
- if (!hpixels && scroll) {
- ctx->text.clear_to_eol = True;
- FlushUpdate(ctx);
- }
-
- /*
- * Rebuild the line table, doing the vertical scroll
- */
- (void)_BuildLineTable(ctx, top, 0);
- lt = &ctx->text.lt;
- if (scroll) {
- for (count = 0; count < lt->lines - 1; count++)
- if (lt->info[count + 1].y - lt->info[count].y != dim) {
- scroll = False;
- break;
- }
- }
-
- XtSetArg(arglist[0], XtNinsertPosition, lt->top + lt->lines);
- _XawImSetValues((Widget)ctx, arglist, 1);
-
- if (hpixels || !scroll || lines != lt->lines)
- return;
-
- /* _BuildLineTable updates everything if the top position changes.
- * It is not required here.
- */
- (void)XmuScanlineXor(ctx->text.update, ctx->text.update);
- if (vlines < 0 && IsPositionVisible(ctx, 0))
- vlines = -LineForPosition(ctx, update_from);
-
- y0 = ctx->text.r_margin.top;
- if (vlines < 0) {
- update_from = lt->top;
- update_to = lt->info[-vlines + 1].position - 1;
- y1 = lt->info[lt->lines + vlines].y;
- y2 = lt->info[-vlines].y;
- DoCopyArea(ctx, ctx->text.r_margin.left, y0, vwidth,
- y1 - y0,
- ctx->text.r_margin.left, y2);
- }
- else {
- update_from = lt->info[lt->lines - vlines].position;
- update_to = lt->info[lt->lines].position;
- y1 = lt->info[lt->lines - vlines].y;
- y2 = lt->info[vlines].y;
- DoCopyArea(ctx, ctx->text.r_margin.left, y2,
- vwidth, lt->info[lt->lines].y - y2,
- ctx->text.r_margin.left, y0);
- }
- _XawTextNeedsUpdating(ctx, update_from, update_to);
- ctx->text.clear_to_eol = True;
-}
-
-/*
- * The routine will scroll the displayed text by lines. If the arg is
- * positive, move up; otherwise, move down. [note: this is really a private
- * procedure but is used in multiple modules].
- */
-void
-_XawTextVScroll(TextWidget ctx, int n)
-{
- XawTextScroll(ctx, n, 0);
-}
-
-/*ARGSUSED*/
-static void
-HScroll(Widget w, XtPointer closure, XtPointer callData)
-{
- TextWidget ctx = (TextWidget)closure;
- int pixels = (int)callData;
-
- if (pixels > 0) {
- int max;
-
- max = (int)GetWidestLine(ctx) + ctx->text.left_margin -
- ctx->text.r_margin.left;
- max = XawMax(0, max);
- pixels = XawMin(pixels, max);
- }
-
- if (pixels) {
- _XawTextPrepareToUpdate(ctx);
- XawTextScroll(ctx, 0, pixels);
- _XawTextExecuteUpdate(ctx);
- }
-}
-
-/*ARGSUSED*/
-static void
-HJump(Widget w, XtPointer closure, XtPointer callData)
-{
- TextWidget ctx = (TextWidget)closure;
- float percent = *(float *)callData;
- int pixels;
-
- pixels = ctx->text.left_margin -
- (ctx->text.r_margin.left - (int)(percent * GetWidestLine(ctx)));
-
- HScroll(w, (XtPointer)ctx, (XtPointer)pixels);
-}
-
-/*
- * Function:
- * UpdateTextInLine
- *
- * Parameters:
- * ctx - text widget
- * line - line to update
- * x1 - left pixel
- * x2 - right pixel
- *
- * Description:
- * Updates the text in the given line and pixel interval
- */
-static void
-UpdateTextInLine(TextWidget ctx, int line, int x1, int x2)
-{
- XawTextLineTableEntry *lt = ctx->text.lt.info + line;
- XawTextPosition left, right;
- int from_x, width, height;
-
- if (lt->position >= ctx->text.lastPos
- || ctx->text.left_margin > x2
- || (int)lt->textWidth + ctx->text.left_margin < x1) {
- /* Mark line to be cleared */
- if (ctx->text.clear_to_eol)
- _XawTextNeedsUpdating(ctx, lt->position, lt->position + 1);
- return;
- }
-
- from_x = ctx->text.left_margin;
- XawTextSinkFindPosition(ctx->text.sink, lt->position,
- from_x, x1 - from_x,
- False, &left, &width, &height);
- if (x2 >= lt->textWidth - from_x)
- right = lt[1].position - 1;
- else {
- from_x += width;
- XawTextSinkFindPosition(ctx->text.sink, left,
- from_x, x2 - from_x,
- False, &right, &width, &height);
- }
-
- if (right + 1 <= lt[1].position)
- ++right;
-
- /* Mark text interval to be repainted */
- _XawTextNeedsUpdating(ctx, left, right);
-}
-
-/*
- * The routine will scroll the displayed text by pixels. If the calldata is
- * positive, move up; otherwise, move down.
- */
-/*ARGSUSED*/
-static void
-VScroll(Widget w, XtPointer closure, XtPointer callData)
-{
- TextWidget ctx = (TextWidget)closure;
- int height, lines = (int)callData;
-
- height = (int)XtHeight(ctx) - (int)VMargins(ctx);
- if (height < 1)
- height = 1;
- lines = (int)(lines * (int)ctx->text.lt.lines) / height;
- _XawTextPrepareToUpdate(ctx);
- XawTextScroll(ctx, lines, 0);
- _XawTextExecuteUpdate(ctx);
-}
-
-/*ARGSUSED*/
-static void
-VJump(Widget w, XtPointer closure, XtPointer callData)
-{
- float percent = *(float *)callData;
- TextWidget ctx = (TextWidget)closure;
- XawTextPosition top, last, position, tmp;
- XawTextLineTable *lt = &(ctx->text.lt);
- int dim, vlines = 0, wwidth = GetMaxTextWidth(ctx);
- Bool scroll = True;
-
- position = percent * ctx->text.lastPos;
- top = lt->top;
-
- if (!lt->lines || (position >= lt->top && position < lt->info[1].position)) {
- _XawTextSetScrollBars(ctx);
- return;
- }
-
-#ifndef OLDXAW
- ctx->text.lt.base_line = -1;
-#endif
-
- if (position > lt->top) { /* VScroll Up */
- if (position > lt->top && position < lt->info[lt->lines].position)
- vlines = LineForPosition(ctx, position);
- else {
- scroll = False;
- top = SrcScan(ctx->text.source, position, XawstEOL,
- XawsdLeft, 1, False);
- if (ctx->text.wrap != XawtextWrapNever) {
- last = top;
- while (last < position) {
- tmp = last;
- XawTextSinkFindPosition(ctx->text.sink, last,
- ctx->text.left_margin, wwidth,
- ctx->text.wrap == XawtextWrapWord,
- &last, &dim, &dim);
- if (last == tmp)
- ++last;
- if (last < position)
- top = last;
- }
- }
- }
- }
- else { /* VScroll Down */
- /*
- * Calculates the number of lines
- */
- while (top > position) {
- last = top;
- top = SrcScan(ctx->text.source, top, XawstEOL,
- XawsdLeft, 2, False);
- vlines -= CountLines(ctx, top, last);
- if (-vlines >= ctx->text.lt.lines) {
- scroll = False;
- top = SrcScan(ctx->text.source, position, XawstEOL,
- XawsdLeft, 1, False);
- break;
- }
- }
- /*
- * Normalize
- */
- if (ctx->text.wrap != XawtextWrapNever) {
- last = top;
- while (last < position) {
- tmp = last;
- XawTextSinkFindPosition(ctx->text.sink, last,
- ctx->text.left_margin,
- wwidth,
- ctx->text.wrap == XawtextWrapWord,
- &last, &dim, &dim);
- if (last == tmp)
- ++last;
- if (last < position)
- top = last;
- ++vlines;
- }
- }
- }
-
- if (vlines || !scroll) {
- _XawTextPrepareToUpdate(ctx);
- if (scroll)
- XawTextScroll(ctx, vlines, 0);
- else
- _BuildLineTable(ctx, top, 0);
- _XawTextExecuteUpdate(ctx);
- }
-}
-
-static Bool
-MatchSelection(Atom selection, XawTextSelection *s)
-{
- Atom *match;
- int count;
-
- for (count = 0, match = s->selections; count < s->atom_count;
- match++, count++)
- if (*match == selection)
- return (True);
-
- return (False);
-}
-
-static Boolean
-TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
- XtPointer *value, unsigned long *length, int *format)
-{
- Display *d = XtDisplay(w);
- TextWidget ctx = (TextWidget)w;
- Widget src = ctx->text.source;
- XawTextEditType edit_mode;
- Arg args[1];
- XawTextSelectionSalt *salt = NULL;
- XawTextSelection *s;
-
- if (*target == XA_TARGETS(d)) {
- Atom *targetP, *std_targets;
- unsigned long std_length;
-
- if (SrcCvtSel(src, selection, target, type, value, length, format))
- return (True);
-
- XmuConvertStandardSelection(w, ctx->text.time, selection,
- target, type, (XPointer*)&std_targets,
- &std_length, format);
-
- *value = XtMalloc((unsigned)sizeof(Atom)*(std_length + 7));
- targetP = *(Atom**)value;
- *length = std_length + 6;
- *targetP++ = XA_STRING;
- *targetP++ = XA_TEXT(d);
- *targetP++ = XA_COMPOUND_TEXT(d);
- *targetP++ = XA_LENGTH(d);
- *targetP++ = XA_LIST_LENGTH(d);
- *targetP++ = XA_CHARACTER_POSITION(d);
-
- XtSetArg(args[0], XtNeditType, &edit_mode);
- XtGetValues(src, args, ONE);
-
- if (edit_mode == XawtextEdit) {
- *targetP++ = XA_DELETE(d);
- (*length)++;
- }
- (void)memmove((char*)targetP, (char*)std_targets,
- sizeof(Atom) * std_length);
- XtFree((char*)std_targets);
- *type = XA_ATOM;
- *format = 32;
- return (True);
- }
-
- if (SrcCvtSel(src, selection, target, type, value, length, format))
- return (True);
-
- if (MatchSelection(*selection, &ctx->text.s))
- s = &ctx->text.s;
- else {
- for (salt = ctx->text.salt; salt; salt = salt->next)
- if (MatchSelection(*selection, &salt->s))
- break;
- if (!salt)
- return (False);
- s = &salt->s;
- }
- if (*target == XA_STRING || *target == XA_TEXT(d)
- || *target == XA_COMPOUND_TEXT(d)) {
- if (*target == XA_TEXT(d)) {
- if (XawTextFormat(ctx, XawFmtWide))
- *type = XA_COMPOUND_TEXT(d);
- else
- *type = XA_STRING;
- }
- else
- *type = *target;
- /*
- * If salt is True, the salt->contents stores CT string,
- * its length is measured in bytes.
- * Refer to _XawTextSaltAwaySelection().
- *
- * by Li Yuhong, Mar. 20, 1991.
- */
- if (!salt) {
- *value = _XawTextGetSTRING(ctx, s->left, s->right);
- if (XawTextFormat(ctx, XawFmtWide)) {
- XTextProperty textprop;
- if (XwcTextListToTextProperty(d, (wchar_t **)value, 1,
- XCompoundTextStyle, &textprop)
- < Success) {
- XtFree((char *)*value);
- return (False);
- }
- XtFree((char *)*value);
- *value = (XtPointer)textprop.value;
- *length = textprop.nitems;
- }
- else
- *length = strlen((char *)*value);
- }
- else {
- *value = XtMalloc((salt->length + 1) * sizeof(unsigned char));
- strcpy ((char *)*value, salt->contents);
- *length = salt->length;
- }
- if (XawTextFormat(ctx, XawFmtWide) && *type == XA_STRING) {
- XTextProperty textprop;
- wchar_t **wlist;
- int count;
-
- textprop.encoding = XA_COMPOUND_TEXT(d);
- textprop.value = (unsigned char *)*value;
- textprop.nitems = strlen(*value);
- textprop.format = 8;
- if (XwcTextPropertyToTextList(d, &textprop, (wchar_t ***)&wlist,
- &count) < Success) {
- XtFree((char *)*value);
- return (False);
- }
- XtFree((char *)*value);
- if (XwcTextListToTextProperty(d, (wchar_t **)wlist, 1,
- XStringStyle, &textprop) < Success) {
- XwcFreeStringList((wchar_t**) wlist);
- return (False);
- }
- *value = (XtPointer)textprop.value;
- *length = textprop.nitems;
- XwcFreeStringList((wchar_t**)wlist);
- }
- *format = 8;
- return (True);
- }
-
- if ((*target == XA_LIST_LENGTH(d)) || (*target == XA_LENGTH(d))) {
- long * temp;
-
- temp = (long *)XtMalloc((unsigned)sizeof(long));
- if (*target == XA_LIST_LENGTH(d))
- *temp = 1L;
- else /* *target == XA_LENGTH(d) */
- *temp = (long) (s->right - s->left);
-
- *value = (XPointer)temp;
- *type = XA_INTEGER;
- *length = 1L;
- *format = 32;
- return (True);
- }
-
- if (*target == XA_CHARACTER_POSITION(d)) {
- long * temp;
-
- temp = (long *)XtMalloc((unsigned)(2 * sizeof(long)));
- temp[0] = (long)(s->left + 1);
- temp[1] = s->right;
- *value = (XPointer)temp;
- *type = XA_SPAN(d);
- *length = 2L;
- *format = 32;
- return (True);
- }
-
- if (*target == XA_DELETE(d)) {
- if (!salt)
- _XawTextZapSelection(ctx, NULL, True);
- *value = NULL;
- *type = XA_NULL(d);
- *length = 0;
- *format = 32;
- return (True);
- }
-
- if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type,
- (XPointer *)value, length, format))
- return (True);
-
- /* else */
- return (False);
-}
-
-/*
- * Function:
- * GetCutBuffferNumber
- *
- * Parameters:
- * atom - atom to check
- *
- * Description:
- * Returns the number of the cut buffer.
- *
- * Returns:
- * The number of the cut buffer representing this atom or NOT_A_CUT_BUFFER
- */
-#define NOT_A_CUT_BUFFER -1
-static int
-GetCutBufferNumber(Atom atom)
-{
- if (atom == XA_CUT_BUFFER0) return (0);
- if (atom == XA_CUT_BUFFER1) return (1);
- if (atom == XA_CUT_BUFFER2) return (2);
- if (atom == XA_CUT_BUFFER3) return (3);
- if (atom == XA_CUT_BUFFER4) return (4);
- if (atom == XA_CUT_BUFFER5) return (5);
- if (atom == XA_CUT_BUFFER6) return (6);
- if (atom == XA_CUT_BUFFER7) return (7);
- return (NOT_A_CUT_BUFFER);
-}
-
-static void
-TextLoseSelection(Widget w, Atom *selection)
-{
- TextWidget ctx = (TextWidget)w;
- Atom *atomP;
- int i;
- XawTextSelectionSalt*salt, *prevSalt, *nextSalt;
-
- atomP = ctx->text.s.selections;
- for (i = 0 ; i < ctx->text.s.atom_count; i++, atomP++)
- if ((*selection == *atomP)
- || (GetCutBufferNumber(*atomP) != NOT_A_CUT_BUFFER))
- *atomP = (Atom)0;
-
- while (ctx->text.s.atom_count
- && ctx->text.s.selections[ctx->text.s.atom_count - 1] == 0)
- ctx->text.s.atom_count--;
-
- /*
- * Must walk the selection list in opposite order from UnsetSelection
- */
- atomP = ctx->text.s.selections;
- for (i = 0 ; i < ctx->text.s.atom_count; i++, atomP++)
- if (*atomP == (Atom)0) {
- *atomP = ctx->text.s.selections[--ctx->text.s.atom_count];
- while (ctx->text.s.atom_count
- && ctx->text.s.selections[ctx->text.s.atom_count-1] == 0)
- ctx->text.s.atom_count--;
- }
-
- if (ctx->text.s.atom_count == 0)
- ModifySelection(ctx, ctx->text.insertPos, ctx->text.insertPos);
-
- prevSalt = 0;
- for (salt = ctx->text.salt; salt; salt = nextSalt) {
- atomP = salt->s.selections;
- nextSalt = salt->next;
- for (i = 0 ; i < salt->s.atom_count; i++, atomP++)
- if (*selection == *atomP)
- *atomP = (Atom)0;
-
- while (salt->s.atom_count
- && salt->s.selections[salt->s.atom_count-1] == 0)
- salt->s.atom_count--;
-
- /*
- * Must walk the selection list in opposite order from UnsetSelection
- */
- atomP = salt->s.selections;
- for (i = 0 ; i < salt->s.atom_count; i++, atomP++)
- if (*atomP == (Atom)0) {
- *atomP = salt->s.selections[--salt->s.atom_count];
- while (salt->s.atom_count
- && salt->s.selections[salt->s.atom_count-1] == 0)
- salt->s.atom_count--;
- }
-
- if (salt->s.atom_count == 0) {
- XtFree ((char *) salt->s.selections);
- XtFree (salt->contents);
- if (prevSalt)
- prevSalt->next = nextSalt;
- else
- ctx->text.salt = nextSalt;
- XtFree((char *)salt);
- }
- else
- prevSalt = salt;
- }
-}
-
-void
-_XawTextSaltAwaySelection(TextWidget ctx, Atom *selections, int num_atoms)
-{
- XawTextSelectionSalt *salt;
- int i, j;
-
- for (i = 0; i < num_atoms; i++)
- TextLoseSelection((Widget)ctx, selections + i);
- if (num_atoms == 0)
- return;
- salt = (XawTextSelectionSalt *)
- XtMalloc((unsigned)sizeof(XawTextSelectionSalt));
- if (!salt)
- return;
- salt->s.selections = (Atom *)XtMalloc((unsigned)(num_atoms * sizeof(Atom)));
- if (!salt->s.selections) {
- XtFree((char *)salt);
- return;
- }
- salt->s.left = ctx->text.s.left;
- salt->s.right = ctx->text.s.right;
- salt->s.type = ctx->text.s.type;
- salt->contents = _XawTextGetSTRING(ctx, ctx->text.s.left, ctx->text.s.right);
- if (XawTextFormat(ctx, XawFmtWide)) {
- XTextProperty textprop;
- if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
- (wchar_t**)(&(salt->contents)), 1,
- XCompoundTextStyle,
- &textprop) < Success) {
- XtFree(salt->contents);
- salt->length = 0;
- return;
- }
- XtFree(salt->contents);
- salt->contents = (char *)textprop.value;
- salt->length = textprop.nitems;
- }
- else
- salt->length = strlen (salt->contents);
- salt->next = ctx->text.salt;
- ctx->text.salt = salt;
- j = 0;
- for (i = 0; i < num_atoms; i++) {
- if (GetCutBufferNumber (selections[i]) == NOT_A_CUT_BUFFER) {
- salt->s.selections[j++] = selections[i];
- XtOwnSelection((Widget)ctx, selections[i], ctx->text.time,
- TextConvertSelection, TextLoseSelection, NULL);
- }
- }
- salt->s.atom_count = j;
-}
-
-static void
-_SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right,
- Atom *selections, Cardinal count)
-{
-#ifndef OLDXAW
- Cardinal i;
- XawTextPosition pos;
- TextSrcObject src = (TextSrcObject)ctx->text.source;
-
- for (i = 0; i < src->textSrc.num_text; i++) {
- TextWidget tw = (TextWidget)src->textSrc.text[i];
- Bool needs_updating = tw->text.old_insert < 0;
- Bool showposition = tw->text.showposition;
-
- if (needs_updating) {
- tw->text.showposition = False;
- _XawTextPrepareToUpdate(tw);
- }
-#else
- TextWidget tw = ctx;
- XawTextPosition pos;
-#endif /* OLDXAW */
-
- if (left < tw->text.s.left) {
- pos = Min(right, tw->text.s.left);
- _XawTextNeedsUpdating(tw, left, pos);
- }
- if (left > tw->text.s.left) {
- pos = Min(left, tw->text.s.right);
- _XawTextNeedsUpdating(tw, tw->text.s.left, pos);
- }
- if (right < tw->text.s.right) {
- pos = Max(right, tw->text.s.left);
- _XawTextNeedsUpdating(tw, pos, tw->text.s.right);
- }
- if (right > tw->text.s.right) {
- pos = Max(left, tw->text.s.right);
- _XawTextNeedsUpdating(tw, pos, right);
- }
-
- tw->text.s.left = left;
- tw->text.s.right = right;
-
-#ifndef OLDXAW
- if (needs_updating) {
- _XawTextExecuteUpdate(tw);
- tw->text.showposition = showposition;
- }
- }
-#endif /* OLDXAW */
-
- SrcSetSelection(ctx->text.source, left, right,
- (count == 0) ? None : selections[0]);
-
- if (left < right) {
- Widget w = (Widget)ctx;
- int buffer;
-
- while (count) {
- Atom selection = selections[--count];
-
- /*
- * If this is a cut buffer
- */
- if ((buffer = GetCutBufferNumber(selection)) != NOT_A_CUT_BUFFER) {
- unsigned char *ptr, *tptr;
- unsigned int amount, max_len = MAX_CUT_LEN(XtDisplay(w));
- unsigned long len;
-
- tptr= ptr= (unsigned char *)_XawTextGetSTRING(ctx,
- ctx->text.s.left,
- ctx->text.s.right);
- if (XawTextFormat(ctx, XawFmtWide)) {
- /*
- * Only XA_STRING(Latin 1) is allowed in CUT_BUFFER,
- * so we get it from wchar string, then free the wchar string
- */
- XTextProperty textprop;
-
- if (XwcTextListToTextProperty(XtDisplay(w), (wchar_t**)&ptr,
- 1, XStringStyle, &textprop)
- < Success){
- XtFree((char *)ptr);
- return;
- }
- XtFree((char *)ptr);
- tptr = ptr = textprop.value;
- }
- if (buffer == 0) {
- _CreateCutBuffers(XtDisplay(w));
- XRotateBuffers(XtDisplay(w), 1);
- }
- amount = Min ((len = strlen((char *)ptr)), max_len);
- XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0),
- selection, XA_STRING, 8, PropModeReplace,
- ptr, amount);
-
- while (len > max_len) {
- len -= max_len;
- tptr += max_len;
- amount = Min (len, max_len);
- XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0),
- selection, XA_STRING, 8, PropModeAppend,
- tptr, amount);
- }
- XtFree ((char *)ptr);
- }
- else /* This is a real selection */
- XtOwnSelection(w, selection, ctx->text.time, TextConvertSelection,
- TextLoseSelection, NULL);
- }
- }
- else
- XawTextUnsetSelection((Widget)ctx);
-}
-
-#ifndef OLDXAW
-void
-_XawTextSetLineAndColumnNumber(TextWidget ctx, Bool force)
-{
- int line_number, column_number;
-
- if (ctx->text.old_insert != ctx->text.insertPos &&
- ctx->text.lt.base_line < 0) {
- ctx->text.lt.base_line = 0;
- (void)_BuildLineTable(ctx, ctx->text.lt.top, 0);
- }
-
- line_number = ResolveLineNumber(ctx);
- column_number = ResolveColumnNumber(ctx);
-
- if (force || (ctx->text.column_number != column_number
- || ctx->text.line_number != line_number)) {
- XawTextPositionInfo info;
-
- ctx->text.line_number = info.line_number = line_number;
- ctx->text.column_number = info.column_number = column_number;
- info.insert_position = ctx->text.insertPos;
- info.last_position = ctx->text.lastPos;
- info.overwrite_mode = ctx->text.overwrite;
-
- XtCallCallbacks((Widget)ctx, XtNpositionCallback, (XtPointer)&info);
- }
-}
-
-static int
-ResolveColumnNumber(TextWidget ctx)
-{
- Widget src = ctx->text.source;
- short column_number = 0;
- XawTextPosition position;
- XawTextBlock block;
- unsigned long format = _XawTextFormat(ctx);
- TextSinkObject sink = (TextSinkObject)ctx->text.sink;
- short *char_tabs = sink->text_sink.char_tabs;
- int tab_count = sink->text_sink.tab_count;
- int tab_index = 0, tab_column = 0, tab_base = 0;
-
- if (ctx->text.lt.base_line < 1)
- return (ctx->text.column_number);
-
- position = SrcScan(src, ctx->text.insertPos, XawstEOL, XawsdLeft, 1, False);
- XawTextSourceRead(src, position, &block, ctx->text.insertPos - position);
-
- for (; position < ctx->text.insertPos; position++) {
- if (position - block.firstPos >= block.length)
- XawTextSourceRead(src, position, &block, ctx->text.insertPos - position);
- if ((format == XawFmt8Bit && block.ptr[position - block.firstPos] == '\t') ||
- (format == XawFmtWide && ((wchar_t*)block.ptr)[position - block.firstPos] == _Xaw_atowc(XawTAB))) {
- while (tab_base + tab_column <= column_number) {
- if (tab_count) {
- for (; tab_index < tab_count; ++tab_index)
- if (tab_base + char_tabs[tab_index] > column_number) {
- tab_column = char_tabs[tab_index];
- break;
- }
- if (tab_index >= tab_count) {
- tab_base += char_tabs[tab_count - 1];
- tab_column = tab_index = 0;
- }
- }
- else
- tab_column += DEFAULT_TAB_SIZE;
- }
- column_number = tab_base + tab_column;
- }
- else
- ++column_number;
- if (column_number >= 16384) {
- column_number = 16383;
- break;
- }
- }
-
- return (column_number);
-}
-#endif /* OLDXAW */
-
-void
-_XawTextSourceChanged(Widget w, XawTextPosition left, XawTextPosition right,
- XawTextBlock *block, int lines)
-{
- TextWidget ctx = (TextWidget)w;
- Widget src = ctx->text.source;
- XawTextPosition update_from, update_to, top;
- Boolean update_disabled;
- int delta, line, line_from;
-
- if (left < ctx->text.old_insert) {
- if (right < ctx->text.old_insert)
- ctx->text.old_insert -= right - left;
- else
- ctx->text.old_insert = left;
-
- ctx->text.insertPos = ctx->text.old_insert + block->length;
- }
-#ifndef OLDXAW
- if (left <= ctx->text.lt.top) {
- if (left + block->length - (right - left) < ctx->text.lt.top) {
- ctx->text.source_changed = SRC_CHANGE_BEFORE;
- ctx->text.lt.base_line += lines;
- }
- else
- ctx->text.source_changed = SRC_CHANGE_OVERLAP;
- }
- else
- ctx->text.source_changed = SRC_CHANGE_AFTER;
-#endif
-
- update_from = left;
- update_to = left + block->length;
- update_to = SrcScan(src, update_to, XawstEOL, XawsdRight, 1, False);
- delta = block->length - (right - left);
- if (delta < 0)
- ctx->text.clear_to_eol = True;
- if (update_to == update_from)
- ++update_to;
- update_disabled = ctx->text.update_disabled;
- ctx->text.update_disabled = True;
- ctx->text.lastPos = XawTextGetLastPosition(ctx);
- top = ctx->text.lt.info[0].position;
-
- XawTextUnsetSelection((Widget)ctx);
-
- if (delta) {
- int i;
- XmuSegment *seg;
-
- for (seg = ctx->text.update->segment; seg; seg = seg->next) {
- if (seg->x1 > (int)left)
- break;
- else if (seg->x2 > (int)left) {
- seg->x2 += delta;
- seg = seg->next;
- break;
- }
- }
- for (; seg; seg = seg->next) {
- seg->x1 += delta;
- seg->x2 += delta;
- }
- XmuOptimizeScanline(ctx->text.update);
-
- for (i = 0; i <= ctx->text.lt.lines; i++)
- if (ctx->text.lt.info[i].position > left)
- break;
- for (; i <= ctx->text.lt.lines; i++)
- ctx->text.lt.info[i].position += delta;
- }
-
- if (top != ctx->text.lt.info[0].position) {
- line_from = line = 0;
- ctx->text.lt.top = top = SrcScan(src, ctx->text.lt.info[0].position,
- XawstEOL, XawsdLeft, 1, False);
- update_from = top;
- }
- else {
- line_from = line = LineForPosition(ctx, update_from + delta);
- top = ctx->text.lt.info[line].position;
- }
-
- if (line > 0 && ctx->text.wrap == XawtextWrapWord) {
- --line;
- top = ctx->text.lt.info[line].position;
- }
-
- (void)_BuildLineTable(ctx, top, line);
-
- if (ctx->text.wrap == XawtextWrapWord) {
- if (line_from != LineForPosition(ctx, update_from)
- || line_from != LineForPosition(ctx, update_to)) {
- ctx->text.clear_to_eol = True;
- update_from = SrcScan(src, update_from,
- XawstWhiteSpace, XawsdLeft, 1, True);
- if (update_to >= ctx->text.lastPos)
- /* this is not an error, it just tells _BuildLineTable to
- * clear to the bottom of the window. The value of update_to
- * should not be > ctx->text.lastPos.
- */
- ++update_to;
- }
- }
- else if (!ctx->text.clear_to_eol) {
- if (LineForPosition(ctx, update_from)
- != LineForPosition(ctx, update_to))
- ctx->text.clear_to_eol = True;
- }
-
- _XawTextNeedsUpdating(ctx, update_from, update_to);
- ctx->text.update_disabled = update_disabled;
-}
-
-/*
- * Function:
- * _XawTextReplace
- *
- * Parameters:
- * ctx - text widget
- * left - left offset
- * right - right offset
- * block - text block
- *
- * Description:
- * Replaces the text between left and right by the text in block.
- * Does all the required calculations of offsets, and rebuild the
- * the line table, from the insertion point (or previous line, if
- * wrap mode is 'word').
- *
- * Returns:
- * XawEditDone - success
- * any other value - error code
- */
-int
-_XawTextReplace(TextWidget ctx, XawTextPosition left, XawTextPosition right,
- XawTextBlock *block)
-{
- Arg args[1];
- Widget src;
- XawTextEditType edit_mode;
-
- if (left == right && block->length == 0)
- return (XawEditDone);
-
- src = ctx->text.source;
- XtSetArg(args[0], XtNeditType, &edit_mode);
- XtGetValues(src, args, 1);
-
- if (edit_mode == XawtextAppend) {
- if (block->length == 0)
- return (XawEditError);
- ctx->text.insertPos = ctx->text.lastPos;
- }
-
-#ifndef OLDXAW
- return (SrcReplace(src, left, right, block));
-#else
- if (SrcReplace(src, left, right, block) == XawEditDone) {
- _XawTextSourceChanged((Widget)ctx, left, right, block, 0);
-
- return (XawEditDone);
- }
-
- return (XawEditError);
-#endif
-}
-
-/*
- * This routine will display text between two arbitrary source positions.
- * In the event that this span contains highlighted text for the selection,
- * only that portion will be displayed highlighted.
- */
-static void
-OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right)
-{
- static XmuSegment segment;
- static XmuScanline next;
- static XmuScanline scanline = {0, &segment, &next};
- static XmuArea area = {&scanline};
-
- TextWidget ctx = (TextWidget)w;
- int x, y, line;
- XawTextPosition start, end, last, final;
- XmuScanline *scan;
- XmuSegment *seg;
- XmuArea *clip = NULL;
- Bool cleol = ctx->text.clear_to_eol;
- Bool has_selection = ctx->text.s.right > ctx->text.s.left;
-
- left = left < ctx->text.lt.top ? ctx->text.lt.top : left;
-
- if (left > right || !LineAndXYForPosition(ctx, left, &line, &x, &y))
- return;
-
- last = XawTextGetLastPosition(ctx);
- segment.x2 = (int)XtWidth(ctx) - ctx->text.r_margin.right;
-
- if (cleol)
- clip = XmuCreateArea();
-
- for (start = left; start < right && line < ctx->text.lt.lines; line++) {
- if ((end = ctx->text.lt.info[line + 1].position) > right)
- end = right;
-
- final = end;
- if (end > last)
- end = last;
-
- if (end > start) {
- if (!has_selection
- || (start >= ctx->text.s.right || end <= ctx->text.s.left))
- _XawTextSinkDisplayText(ctx->text.sink, x, y, start, end, False);
- else if (start >= ctx->text.s.left && end <= ctx->text.s.right)
- _XawTextSinkDisplayText(ctx->text.sink, x, y, start, end, True);
- else {
- OldDisplayText(w, start, ctx->text.s.left);
- OldDisplayText(w, Max(start, ctx->text.s.left),
- Min(end, ctx->text.s.right));
- OldDisplayText(w, ctx->text.s.right, end);
- }
- }
-
- x = ctx->text.left_margin;
- if (cleol) {
- segment.x1 = ctx->text.lt.info[line].textWidth + x;
- if (XmuValidSegment(&segment)) {
- scanline.y = y;
- next.y = ctx->text.lt.info[line + 1].y;
- XmuAreaOr(clip, &area);
- }
- }
-
- start = final;
- y = ctx->text.lt.info[line + 1].y;
- }
-
- if (cleol) {
- for (scan = clip->scanline; scan && scan->next; scan = scan->next)
- for (seg = scan->segment; seg; seg = seg->next)
- SinkClearToBG(ctx->text.sink,
- seg->x1, scan->y,
- seg->x2 - seg->x1, scan->next->y - scan->y);
- XmuDestroyArea(clip);
- }
-}
-
-/*ARGSUSED*/
-static void
-DisplayText(Widget w, XawTextPosition left, XawTextPosition right)
-{
-#ifndef OLDXAW
- static XmuSegment segment;
- static XmuScanline next;
- static XmuScanline scanline = {0, &segment, &next};
- static XmuArea area = {&scanline};
-
- TextWidget ctx = (TextWidget)w;
- int y, line;
- XawTextPosition from, to, lastPos;
- XmuScanline *scan;
- XmuSegment *seg;
- Bool cleol = ctx->text.clear_to_eol;
- Bool has_selection = ctx->text.s.right > ctx->text.s.left;
- XawTextPaintList *paint_list;
-
- left = left < ctx->text.lt.top ? ctx->text.lt.top : left;
-
- if (left > right || !IsPositionVisible(ctx, left))
- return;
-
- line = LineForPosition(ctx, left);
- y = ctx->text.lt.info[line].y;
- segment.x2 = (int)XtWidth(ctx) - ctx->text.r_margin.right;
- lastPos = XawTextGetLastPosition(ctx);
-
- paint_list = ((TextSinkObject)ctx->text.sink)->text_sink.paint;
-
- for (from = left; from < right && line < ctx->text.lt.lines; line++) {
- if ((to = ctx->text.lt.info[line + 1].position) > right)
- to = right;
-
- if (to > lastPos)
- to = lastPos;
-
- if (from < to) {
- if (!has_selection
- || (from >= ctx->text.s.right || to <= ctx->text.s.left))
- XawTextSinkPreparePaint(ctx->text.sink, y, line, from, to, False);
- else if (from >= ctx->text.s.left && to <= ctx->text.s.right)
- XawTextSinkPreparePaint(ctx->text.sink, y, line, from, to, True);
- else {
- XawTextSinkPreparePaint(ctx->text.sink, y, line, from,
- ctx->text.s.left, False);
- XawTextSinkPreparePaint(ctx->text.sink, y, line,
- XawMax(from, ctx->text.s.left),
- XawMin(to, ctx->text.s.right), True);
- XawTextSinkPreparePaint(ctx->text.sink, y, line,
- ctx->text.s.right, to, False);
- }
- }
-
- if (cleol) {
- segment.x1 = ctx->text.lt.info[line].textWidth + ctx->text.left_margin;
- if (XmuValidSegment(&segment)) {
- scanline.y = y;
- next.y = ctx->text.lt.info[line + 1].y;
- XmuAreaOr(paint_list->clip, &area);
- }
- }
- y = ctx->text.lt.info[line + 1].y;
- from = to;
- }
-
- /* clear to the bottom of the window */
- if (cleol && line >= ctx->text.lt.lines) {
- segment.x1 = ctx->text.left_margin;
- if (XmuValidSegment(&segment)) {
- scanline.y = y;
- next.y = (int)XtHeight(ctx) - (int)ctx->text.margin.bottom;
- XmuAreaOr(paint_list->clip, &area);
- }
- }
-#endif
-}
-
-/*
- * This routine implements multi-click selection in a hardwired manner.
- * It supports multi-click entity cycling (char, word, line, file) and mouse
- * motion adjustment of the selected entitie (i.e. select a word then, with
- * button still down, adjust wich word you really meant by moving the mouse).
- * [NOTE: This routine is to be replaced by a set of procedures that
- * will allows clients to implements a wide class of draw through and
- * multi-click selection user interfaces.]
- */
-static void
-DoSelection(TextWidget ctx, XawTextPosition pos, Time time, Bool motion)
-{
- XawTextPosition newLeft, newRight;
- XawTextSelectType newType, *sarray;
- Widget src = ctx->text.source;
-
- if (motion)
- newType = ctx->text.s.type;
- else {
- if ((abs((long) time - (long) ctx->text.lasttime) < MULTI_CLICK_TIME)
- && (pos >= ctx->text.s.left && pos <= ctx->text.s.right)) {
- sarray = ctx->text.sarray;
- for (; *sarray != XawselectNull && *sarray != ctx->text.s.type;
- sarray++)
- ;
- if (*sarray == XawselectNull)
- newType = *(ctx->text.sarray);
- else {
- newType = *(sarray + 1);
- if (newType == XawselectNull)
- newType = *(ctx->text.sarray);
- }
- }
- else /* single-click event */
- newType = *(ctx->text.sarray);
-
- ctx->text.lasttime = time;
- }
- switch (newType) {
- case XawselectPosition:
- newLeft = newRight = pos;
- break;
- case XawselectChar:
- newLeft = pos;
- newRight = SrcScan(src, pos, XawstPositions, XawsdRight, 1, False);
- break;
- case XawselectWord:
- case XawselectParagraph:
- case XawselectAlphaNumeric: {
- XawTextScanType stype;
-
- if (newType == XawselectWord)
- stype = XawstWhiteSpace;
- else if (newType == XawselectParagraph)
- stype = XawstParagraph;
- else
- stype = XawstAlphaNumeric;
-
- /*
- * Somewhat complicated, but basically I treat the space between
- * two objects as another object. The object that I am currently
- * in then becomes the end of the selection.
- *
- * Chris Peterson - 4/19/90.
- */
- newRight = SrcScan(ctx->text.source, pos, stype,
- XawsdRight, 1, False);
- newRight = SrcScan(ctx->text.source, newRight, stype,
- XawsdLeft, 1, False);
-
- if (pos != newRight)
- newLeft = SrcScan(ctx->text.source, pos, stype,
- XawsdLeft, 1, False);
- else
- newLeft = pos;
-
- newLeft =SrcScan(ctx->text.source, newLeft, stype,
- XawsdRight, 1, False);
-
- if (newLeft > newRight) {
- XawTextPosition temp = newLeft;
- newLeft = newRight;
- newRight = temp;
- }
- } break;
- case XawselectLine:
- newLeft = SrcScan(src, pos, XawstEOL, XawsdLeft, 1, False);
- newRight = SrcScan(src, pos, XawstEOL, XawsdRight, 1, False);
- break;
- case XawselectAll:
- newLeft = SrcScan(src, pos, XawstAll, XawsdLeft, 1, False);
- newRight = SrcScan(src, pos, XawstAll, XawsdRight, 1, False);
- break;
- default:
- XtAppWarning(XtWidgetToApplicationContext((Widget) ctx),
- "Text Widget: empty selection array.");
- return;
- }
-
- if (newLeft != ctx->text.s.left || newRight != ctx->text.s.right
- || newType != ctx->text.s.type) {
- ModifySelection(ctx, newLeft, newRight);
- if (pos - ctx->text.s.left < ctx->text.s.right - pos)
- ctx->text.insertPos = newLeft;
- else
- ctx->text.insertPos = newRight;
- ctx->text.s.type = newType;
- }
- if (!motion) { /* setup so we can freely mix select extend calls*/
- ctx->text.origSel.type = ctx->text.s.type;
- ctx->text.origSel.left = ctx->text.s.left;
- ctx->text.origSel.right = ctx->text.s.right;
-
- if (pos >= ctx->text.s.left + (ctx->text.s.right - ctx->text.s.left) / 2)
- ctx->text.extendDir = XawsdRight;
- else
- ctx->text.extendDir = XawsdLeft;
- }
-}
-
-/*
- * This routine implements extension of the currently selected text in
- * the "current" mode (i.e. char word, line, etc.). It worries about
- * extending from either end of the selection and handles the case when you
- * cross through the "center" of the current selection (e.g. switch which
- * end you are extending!).
- */
-static void
-ExtendSelection(TextWidget ctx, XawTextPosition pos, Bool motion)
-{
- XawTextScanDirection dir;
-
- if (!motion) { /* setup for extending selection */
- if (ctx->text.s.left == ctx->text.s.right) /* no current selection. */
- ctx->text.s.left = ctx->text.s.right = ctx->text.insertPos;
- else {
- ctx->text.origSel.left = ctx->text.s.left;
- ctx->text.origSel.right = ctx->text.s.right;
- }
-
- ctx->text.origSel.type = ctx->text.s.type;
-
- if (pos >= ctx->text.s.left + (ctx->text.s.right - ctx->text.s.left) / 2)
- ctx->text.extendDir = XawsdRight;
- else
- ctx->text.extendDir = XawsdLeft;
- }
- else /* check for change in extend direction */
- if ((ctx->text.extendDir == XawsdRight &&
- pos <= ctx->text.origSel.left) ||
- (ctx->text.extendDir == XawsdLeft &&
- pos >= ctx->text.origSel.right)) {
- ctx->text.extendDir = (ctx->text.extendDir == XawsdRight) ?
- XawsdLeft : XawsdRight;
- ModifySelection(ctx, ctx->text.origSel.left, ctx->text.origSel.right);
- }
-
- dir = ctx->text.extendDir;
- switch (ctx->text.s.type) {
- case XawselectWord:
- case XawselectParagraph:
- case XawselectAlphaNumeric: {
- XawTextPosition left_pos, right_pos;
- XawTextScanType stype;
-
- if (ctx->text.s.type == XawselectWord)
- stype = XawstWhiteSpace;
- else if (ctx->text.s.type == XawselectParagraph)
- stype = XawstParagraph;
- else
- stype = XawstAlphaNumeric;
-
- /*
- * Somewhat complicated, but basically I treat the space between
- * two objects as another object. The object that I am currently
- * in then becomes the end of the selection.
- *
- * Chris Peterson - 4/19/90.
- */
- right_pos = SrcScan(ctx->text.source, pos, stype,
- XawsdRight, 1, False);
- right_pos =SrcScan(ctx->text.source, right_pos, stype,
- XawsdLeft, 1, False);
-
- if (pos != right_pos)
- left_pos = SrcScan(ctx->text.source, pos, stype,
- XawsdLeft, 1, False);
- else
- left_pos = pos;
-
- left_pos =SrcScan(ctx->text.source, left_pos, stype,
- XawsdRight, 1, False);
-
- if (dir == XawsdLeft)
- pos = Min(left_pos, right_pos);
- else /* dir == XawsdRight */
- pos = Max(left_pos, right_pos);
- } break;
- case XawselectLine:
- pos = SrcScan(ctx->text.source, pos, XawstEOL,
- dir, 1, dir == XawsdRight);
- break;
- case XawselectAll:
- pos = ctx->text.insertPos;
- /*FALLTHROUGH*/
- case XawselectPosition:
- default:
- break;
- }
-
- if (dir == XawsdRight)
- ModifySelection(ctx, ctx->text.s.left, pos);
- else
- ModifySelection(ctx, pos, ctx->text.s.right);
-
- ctx->text.insertPos = pos;
-}
-
-/*
- * Function:
- * _XawTextClearAndCenterDisplay
- *
- * Parameters:
- * ctx - text widget
- *
- * Description:
- * Redraws the display with the cursor in insert point
- * centered vertically.
- */
-void
-_XawTextClearAndCenterDisplay(TextWidget ctx)
-{
- int left_margin = ctx->text.left_margin;
- Bool visible = IsPositionVisible(ctx, ctx->text.insertPos);
-
- _XawTextShowPosition(ctx);
-
- if (visible && left_margin == ctx->text.left_margin) {
- int insert_line = LineForPosition(ctx, ctx->text.insertPos);
- int scroll_by = insert_line - (ctx->text.lt.lines >> 1);
- Boolean clear_to_eol = ctx->text.clear_to_eol;
-
- XawTextScroll(ctx, scroll_by, 0);
- SinkClearToBG(ctx->text.sink, 0, 0, XtWidth(ctx), XtHeight(ctx));
- ClearWindow(ctx);
- clear_to_eol = ctx->text.clear_to_eol;
- ctx->text.clear_to_eol = False;
- FlushUpdate(ctx);
- ctx->text.clear_to_eol = clear_to_eol;
- }
-}
-
-/*
- * Internal redisplay entire window
- * Legal to call only if widget is realized
- */
-static void
-DisplayTextWindow(Widget w)
-{
- TextWidget ctx = (TextWidget)w;
-
- _XawTextBuildLineTable(ctx, ctx->text.lt.top, False);
- ClearWindow(ctx);
-}
-
-static void
-TextSinkResize(Widget w)
-{
- if (w && XtClass(w)->core_class.resize)
- XtClass(w)->core_class.resize(w);
-}
-
-/* ARGSUSED */
-void
-_XawTextCheckResize(TextWidget ctx)
-{
- return;
-}
-
-/*
- * Converts (params, num_params) to a list of atoms & caches the
- * list in the TextWidget instance.
- */
-Atom *
-_XawTextSelectionList(TextWidget ctx, String *list, Cardinal nelems)
-{
- Atom *sel = ctx->text.s.selections;
- Display *dpy = XtDisplay((Widget)ctx);
- int n;
-
- if (nelems > (Cardinal)ctx->text.s.array_size) {
- sel = (Atom *)XtRealloc((char *)sel, sizeof(Atom) * nelems);
- ctx->text.s.array_size = nelems;
- ctx->text.s.selections = sel;
- }
- for (n = nelems; --n >= 0; sel++, list++)
- *sel = XInternAtom(dpy, *list, False);
- ctx->text.s.atom_count = nelems;
-
- return (ctx->text.s.selections);
-}
-
-/*
- * Function:
- * SetSelection
- *
- * Parameters:
- * ctx - text widget
- * defaultSel - default selection
- * l - left and right ends of the selection
- * r - ""
- * list - the selection list (as strings).
- * nelems - ""
- *
- * Description:
- * Sets the current selection.
- *
- * Note:
- * if (ctx->text.s.left >= ctx->text.s.right) then the selection is unset
- */
-void
-_XawTextSetSelection(TextWidget ctx, XawTextPosition l, XawTextPosition r,
- String *list, Cardinal nelems)
-{
- if (nelems == 1 && !strcmp (list[0], "none"))
- return;
- if (nelems == 0) {
- String defaultSel = "PRIMARY";
- list = &defaultSel;
- nelems = 1;
- }
- _SetSelection(ctx, l, r, _XawTextSelectionList(ctx, list, nelems), nelems);
-}
-
-/*
- * Function:
- * ModifySelection
- *
- * Parameters:
- * ctx - text widget
- * left - left and right ends of the selection
- * right - ""
- *
- * Description:
- * Modifies the current selection.
- *
- * Note:
- * if (ctx->text.s.left >= ctx->text.s.right) then the selection is unset
- */
-static void
-ModifySelection(TextWidget ctx, XawTextPosition left, XawTextPosition right)
-{
- if (left == right)
- ctx->text.insertPos = left;
- _SetSelection(ctx, left, right, NULL, 0);
-}
-
-/*
- * This routine is used to perform various selection functions. The goal is
- * to be able to specify all the more popular forms of draw-through and
- * multi-click selection user interfaces from the outside.
- */
-void
-_XawTextAlterSelection(TextWidget ctx, XawTextSelectionMode mode,
- XawTextSelectionAction action, String *params,
- Cardinal *num_params)
-{
- XawTextPosition position;
- Boolean flag;
-
- /*
- * This flag is used by TextPop.c:DoReplace() to determine if the selection
- * is okay to use, or if it has been modified.
- */
- if (ctx->text.search != NULL)
- ctx->text.search->selection_changed = True;
-
- position = PositionForXY(ctx, (int) ctx->text.ev_x, (int) ctx->text.ev_y);
-
- flag = (action != XawactionStart);
- if (mode == XawsmTextSelect)
- DoSelection(ctx, position, ctx->text.time, flag);
- else /* mode == XawsmTextExtend */
- ExtendSelection (ctx, position, flag);
-
- if (action == XawactionEnd)
- _XawTextSetSelection(ctx, ctx->text.s.left, ctx->text.s.right,
- params, *num_params);
-}
-
-/*
- * Function:
- * UpdateTextInRectangle
- *
- * Parameters:
- * ctx - the text widget
- * rect - rectangle
- *
- * Description:
- * Updates the text in the given rectangle
- */
-static void
-UpdateTextInRectangle(TextWidget ctx, XRectangle *rect)
-{
- XawTextLineTable *lt;
- int line, y1, y2, x2;
-
- y1 = rect->y;
- y2 = y1 + rect->height;
- x2 = rect->x + rect->width;
-
- for (line = 0, lt = &ctx->text.lt; line < lt->lines; line++)
- if (lt->info[line + 1].y > y1)
- break;
- for (; line <= lt->lines; line++) {
- if (lt->info[line].y > y2)
- break;
- UpdateTextInLine(ctx, line, rect->x, x2);
- }
-}
-
-/*
- * This routine processes all "expose region" XEvents. In general, its job
- * is to the best job at minimal re-paint of the text, displayed in the
- * window, that it can.
- */
-/* ARGSUSED */
-static void
-XawTextExpose(Widget w, XEvent *event, Region region)
-{
- TextWidget ctx = (TextWidget)w;
- Boolean clear_to_eol;
- XRectangle expose;
-
- if (event->type == Expose) {
- expose.x = event->xexpose.x;
- expose.y = event->xexpose.y;
- expose.width = event->xexpose.width;
- expose.height = event->xexpose.height;
- }
- else if (event->type == GraphicsExpose) {
- expose.x = event->xgraphicsexpose.x;
- expose.y = event->xgraphicsexpose.y;
- expose.width = event->xgraphicsexpose.width;
- expose.height = event->xgraphicsexpose.height;
- }
- else
- return;
-
- _XawTextPrepareToUpdate(ctx);
-
- if (Superclass->core_class.expose)
- (*Superclass->core_class.expose)(w, event, region);
-
- clear_to_eol = ctx->text.clear_to_eol;
- ctx->text.clear_to_eol = False;
-
- UpdateTextInRectangle(ctx, &expose);
- XawTextSinkGetCursorBounds(ctx->text.sink, &expose);
- UpdateTextInRectangle(ctx, &expose);
- SinkClearToBG(ctx->text.sink, expose.x, expose.y,
- expose.width, expose.height);
- _XawTextExecuteUpdate(ctx);
- ctx->text.clear_to_eol = clear_to_eol;
-}
-
-/*
- * This routine does all setup required to syncronize batched screen updates
- */
-void
-_XawTextPrepareToUpdate(TextWidget ctx)
-{
- if (ctx->text.old_insert < 0) {
- InsertCursor((Widget)ctx, XawisOff);
- ctx->text.showposition = False;
- ctx->text.old_insert = ctx->text.insertPos;
- ctx->text.clear_to_eol = False;
-#ifndef OLDXAW
- ctx->text.source_changed = SRC_CHANGE_NONE;
-#endif
- }
-}
-
-/*
- * This is a private utility routine used by _XawTextExecuteUpdate. It
- * processes all the outstanding update requests and merges update
- * ranges where possible.
- */
-static void
-FlushUpdate(TextWidget ctx)
-{
- XmuSegment *seg;
- void (*display_text)(Widget, XawTextPosition, XawTextPosition);
-
- if (XtIsRealized((Widget)ctx)) {
-#ifndef OLDXAW
- if (XawTextSinkBeginPaint(ctx->text.sink) == False)
-#endif
- display_text = OldDisplayText;
-#ifndef OLDXAW
- else
- display_text = DisplayText;
-#endif
- for (seg = ctx->text.update->segment; seg; seg = seg->next)
- (*display_text)((Widget)ctx,
- (XawTextPosition)seg->x1,
- (XawTextPosition)seg->x2);
-#ifndef OLDXAW
- if (display_text != OldDisplayText) {
- XawTextSinkDoPaint(ctx->text.sink);
- XawTextSinkEndPaint(ctx->text.sink);
- }
-#endif
- }
- (void)XmuScanlineXor(ctx->text.update, ctx->text.update);
-}
-
-static int
-CountLines(TextWidget ctx, XawTextPosition left, XawTextPosition right)
-{
- if (ctx->text.wrap == XawtextWrapNever || left >= right)
- return (1);
- else {
- XawTextPosition tmp;
- int dim, lines = 0, wwidth = GetMaxTextWidth(ctx);
-
- while (left < right) {
- tmp = left;
- XawTextSinkFindPosition(ctx->text.sink, left,
- ctx->text.left_margin,
- wwidth, ctx->text.wrap == XawtextWrapWord,
- &left, &dim, &dim);
- ++lines;
- if (tmp == left)
- ++left;
- }
-
- return (lines);
- }
- /*NOTREACHED*/
-}
-
-static int
-GetMaxTextWidth(TextWidget ctx)
-{
- XRectangle cursor;
- int width;
-
- XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
- width = (int)XtWidth(ctx) - RHMargins(ctx) - cursor.width;
-
- return (XawMax(0, width));
-}
-
-/*
- * Function:
- * _XawTextShowPosition
- *
- * Parameters:
- * ctx - the text widget to show the position
- *
- * Description:
- * Makes sure the text cursor visible, scrolling the text window
- * if required.
- */
-void
-_XawTextShowPosition(TextWidget ctx)
-{
- /*
- * Variable scroll is used to avoid scanning large files to calculate
- * line offsets
- */
- int hpixels, vlines;
- XawTextPosition first, last, top, tmp;
- Bool visible, scroll;
-
- if (!XtIsRealized((Widget)ctx))
- return;
-
- /*
- * Checks if a horizontal scroll is required
- */
- if (ctx->text.wrap == XawtextWrapNever) {
- int x, vwidth, distance, dim;
- XRectangle rect;
-
- vwidth = (int)XtWidth(ctx) - RHMargins(ctx);
- last = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstEOL, XawsdLeft, 1, False);
- XawTextSinkFindDistance(ctx->text.sink, last,
- ctx->text.left_margin,
- ctx->text.insertPos,
- &distance, &first, &dim);
- XawTextSinkGetCursorBounds(ctx->text.sink, &rect);
- x = ctx->text.left_margin - ctx->text.r_margin.left;
-
- if (x + distance + rect.width > vwidth)
- hpixels = x + distance + rect.width - vwidth + (vwidth >> 2);
- else if (x + distance < 0)
- hpixels = x + distance - (vwidth >> 2);
- else
- hpixels = 0;
- }
- else
- hpixels = 0;
-
- visible = IsPositionVisible(ctx, ctx->text.insertPos);
-
- /*
- * If the cursor is already visible
- */
- if (!hpixels && visible)
- return;
-
- scroll = ctx->core.background_pixmap == XtUnspecifiedPixmap && !hpixels;
- vlines = 0;
- first = ctx->text.lt.top;
-
- /*
- * Needs to scroll the text window
- */
- if (visible)
- top = ctx->text.lt.top;
- else {
- top = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstEOL, XawsdLeft, 1, False);
-
- /*
- * Finds the nearest left position from ctx->text.insertPos
- */
- if (ctx->text.wrap != XawtextWrapNever) {
- int dim, vwidth = GetMaxTextWidth(ctx);
-
- last = top;
- /*CONSTCOND*/
- while (1) {
- tmp = last;
- XawTextSinkFindPosition(ctx->text.sink, last,
- ctx->text.left_margin, vwidth,
- ctx->text.wrap == XawtextWrapWord,
- &last, &dim, &dim);
- if (last == tmp)
- ++last;
- if (last <= ctx->text.insertPos)
- top = last;
- else
- break;
- }
- }
- }
-
- if (scroll) {
- if (ctx->text.insertPos < first) { /* Scroll Down */
- while (first > top) {
- last = first;
- first = SrcScan(ctx->text.source, first,
- XawstEOL, XawsdLeft, 2, False);
- vlines -= CountLines(ctx, first, last);
- if (-vlines >= ctx->text.lt.lines) {
- scroll = False;
- break;
- }
- }
- }
- else if (!visible) { /* Scroll Up */
- while (first < top) {
- last = first;
- first = SrcScan(ctx->text.source, first,
- XawstEOL, XawsdRight, 1, True);
- vlines += CountLines(ctx, last, first);
- if (vlines > ctx->text.lt.lines) {
- scroll = False;
- break;
- }
- }
- }
- else
- scroll = False;
- }
-
- /*
- * If a portion of the text that will be scrolled is visible
- */
- if (scroll)
- XawTextScroll(ctx, vlines ? vlines - (ctx->text.lt.lines >> 1) : 0, 0);
- /*
- * Else redraw the entire text window
- */
- else {
- ctx->text.left_margin -= hpixels;
- if (ctx->text.left_margin > ctx->text.r_margin.left)
- ctx->text.left_margin = ctx->text.margin.left =
- ctx->text.r_margin.left;
-
- if (!visible) {
- vlines = ctx->text.lt.lines >> 1;
- if (vlines)
- top = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstEOL, XawsdLeft, vlines + 1, False);
-
- if (ctx->text.wrap != XawtextWrapNever) {
- int dim;
- int n_lines = CountLines(ctx, top, ctx->text.insertPos);
- int vwidth = GetMaxTextWidth(ctx);
-
- while (n_lines-- > vlines) {
- tmp = top;
- XawTextSinkFindPosition(ctx->text.sink, top,
- ctx->text.left_margin,
- vwidth,
- ctx->text.wrap == XawtextWrapWord,
- &top, &dim, &dim);
- if (tmp == top)
- ++top;
- }
- }
- _XawTextBuildLineTable(ctx, top, True);
- }
- else
- ClearWindow(ctx);
- }
- ctx->text.clear_to_eol = True;
-}
-
-#ifndef OLDXAW
-static int
-ResolveLineNumber(TextWidget ctx)
-{
- int line_number = ctx->text.lt.base_line;
- XawTextPosition position = ctx->text.lt.top;
-
- if (ctx->text.lt.base_line < 1)
- return (ctx->text.line_number);
-
- if (ctx->text.wrap == XawtextWrapNever
- && IsPositionVisible(ctx, ctx->text.insertPos))
- line_number += LineForPosition(ctx, ctx->text.insertPos);
- else if (position < ctx->text.insertPos) {
- while (position < ctx->text.insertPos) {
- position = SrcScan(ctx->text.source, position,
- XawstEOL, XawsdRight, 1, True);
- if (position <= ctx->text.insertPos) {
- ++line_number;
- if (position == ctx->text.lastPos) {
- line_number -= !_XawTextSourceNewLineAtEOF(ctx->text.source);
- break;
- }
- }
- }
- }
- else if (position > ctx->text.insertPos) {
- while (position > ctx->text.insertPos) {
- position = SrcScan(ctx->text.source, position,
- XawstEOL, XawsdLeft, 1, False);
- if (--position >= ctx->text.insertPos)
- --line_number;
- }
- }
-
- return (line_number);
-}
-#endif
-
-/*
- * This routine causes all batched screen updates to be performed
- */
-void
-_XawTextExecuteUpdate(TextWidget ctx)
-{
- if (ctx->text.update_disabled || ctx->text.old_insert < 0)
- return;
-
- if(ctx->text.old_insert != ctx->text.insertPos || ctx->text.showposition)
- _XawTextShowPosition(ctx);
-
- FlushUpdate(ctx);
- InsertCursor((Widget)ctx, XawisOn);
- ctx->text.old_insert = -1;
-#ifndef OLDXAW
- _XawTextSetLineAndColumnNumber(ctx, False);
-#endif
-}
-
-static void
-XawTextDestroy(Widget w)
-{
- TextWidget ctx = (TextWidget)w;
-
- DestroyHScrollBar(ctx);
- DestroyVScrollBar(ctx);
-
- XtFree((char *)ctx->text.s.selections);
- XtFree((char *)ctx->text.lt.info);
- XtFree((char *)ctx->text.search);
- XmuDestroyScanline(ctx->text.update);
-}
-
-/*
- * by the time we are managed (and get this far) we had better
- * have both a source and a sink
- */
-static void
-XawTextResize(Widget w)
-{
- TextWidget ctx = (TextWidget)w;
-
- PositionVScrollBar(ctx);
- PositionHScrollBar(ctx);
- TextSinkResize(ctx->text.sink);
-
- ctx->text.showposition = True;
- _XawTextBuildLineTable(ctx, ctx->text.lt.top, True);
-}
-
-/*
- * This routine allow the application program to Set attributes.
- */
-/*ARGSUSED*/
-static Boolean
-XawTextSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TextWidget oldtw = (TextWidget)current;
- TextWidget newtw = (TextWidget)cnew;
- Boolean redisplay = False;
- Boolean display_caret = newtw->text.display_caret;
-#ifndef OLDXAW
- Boolean show_lc = False;
-#endif
-
- newtw->text.display_caret = oldtw->text.display_caret;
- _XawTextPrepareToUpdate(newtw);
- newtw->text.display_caret = display_caret;
-
- if (oldtw->text.r_margin.left != newtw->text.r_margin.left) {
- newtw->text.left_margin = newtw->text.margin.left =
- newtw->text.r_margin.left;
- if (newtw->text.vbar != NULL) {
- newtw->text.left_margin += XtWidth(newtw->text.vbar) +
- XtBorderWidth(newtw->text.vbar);
- }
- redisplay = True;
- }
-
- if (oldtw->text.scroll_vert != newtw->text.scroll_vert) {
- if (newtw->text.scroll_vert == XawtextScrollAlways)
- CreateVScrollBar(newtw);
- else
- DestroyVScrollBar(newtw);
-
- redisplay = True;
- }
-
- if (oldtw->text.r_margin.bottom != newtw->text.r_margin.bottom) {
- newtw->text.margin.bottom = newtw->text.r_margin.bottom;
- if (newtw->text.hbar != NULL)
- newtw->text.margin.bottom += newtw->text.hbar->core.height +
- newtw->text.hbar->core.border_width;
- redisplay = True;
- }
-
- if (oldtw->text.scroll_horiz != newtw->text.scroll_horiz) {
- if (newtw->text.scroll_horiz == XawtextScrollAlways)
- CreateHScrollBar(newtw);
- else
- DestroyHScrollBar(newtw);
-
- redisplay = True;
- }
-
- if (oldtw->text.source != newtw->text.source) {
-#ifndef OLDXAW
- show_lc = True;
- _XawSourceRemoveText(oldtw->text.source, cnew,
- oldtw->text.source &&
- XtParent(oldtw->text.source) == cnew);
- _XawSourceAddText(newtw->text.source, cnew);
-#endif
- _XawTextSetSource((Widget)newtw, newtw->text.source, newtw->text.lt.top,
- newtw->text.insertPos);
- }
-
- newtw->text.redisplay_needed = False;
- XtSetValues((Widget)newtw->text.source, args, *num_args);
- XtSetValues((Widget)newtw->text.sink, args, *num_args);
-
- if (oldtw->text.wrap != newtw->text.wrap
- || oldtw->text.lt.top != newtw->text.lt.top
- || oldtw->text.insertPos != newtw->text.insertPos
- || oldtw->text.r_margin.right != newtw->text.r_margin.right
- || oldtw->text.r_margin.top != newtw->text.r_margin.top
- || oldtw->text.sink != newtw->text.sink
- || newtw->text.redisplay_needed) {
- if (oldtw->text.wrap != newtw->text.wrap) {
- newtw->text.left_margin = newtw->text.margin.left =
- newtw->text.r_margin.left;
- if (oldtw->text.lt.top == newtw->text.lt.top)
- newtw->text.lt.top = SrcScan(newtw->text.source, 0, XawstEOL,
- XawsdLeft, 1, False);
- }
- newtw->text.showposition = True;
-#ifndef OLDXAW
- show_lc = True;
- newtw->text.source_changed = SRC_CHANGE_OVERLAP;
-#endif
- _XawTextBuildLineTable(newtw, newtw->text.lt.top, True);
- redisplay = True;
- }
-
-#ifndef OLDXAW
- if (newtw->text.left_column < 0)
- newtw->text.left_column = 0;
- if (newtw->text.right_column < 0)
- newtw->text.right_column = 0;
-#endif
-
- _XawTextExecuteUpdate(newtw);
-
-#ifndef OLDXAW
- if (show_lc)
- _XawTextSetLineAndColumnNumber(newtw, True);
-#endif
-
- if (redisplay)
- _XawTextSetScrollBars(newtw);
-
- return (redisplay);
-}
-
-/* invoked by the Simple widget's SetValues */
-static Bool
-XawTextChangeSensitive(Widget w)
-{
- Arg args[1];
- TextWidget tw = (TextWidget)w;
-
- (*(&simpleClassRec)->simple_class.change_sensitive)(w);
-
- XtSetArg(args[0], XtNancestorSensitive,
- (tw->core.ancestor_sensitive && tw->core.sensitive));
- if (tw->text.vbar)
- XtSetValues(tw->text.vbar, args, ONE);
- if (tw->text.hbar)
- XtSetValues(tw->text.hbar, args, ONE);
- return (False);
-}
-
-/*
- * Function:
- * XawTextGetValuesHook
- *
- * Parameters:
- * w - Text Widget
- * args - argument list
- * num_args - number of args
- *
- * Description:
- * This is a get values hook routine that gets the
- * values in the text source and sink.
- */
-static void
-XawTextGetValuesHook(Widget w, ArgList args, Cardinal *num_args)
-{
- XtGetValues(((TextWidget)w)->text.source, args, *num_args);
- XtGetValues(((TextWidget)w)->text.sink, args, *num_args);
-}
-
-/*
- * Function:
- * FindGoodPosition
- *
- * Parameters:
- * pos - any position
- *
- * Description:
- * Returns a valid position given any postition.
- *
- * Returns:
- * A position between (0 and lastPos)
- */
-static XawTextPosition
-FindGoodPosition(TextWidget ctx, XawTextPosition pos)
-{
- if (pos < 0)
- return (0);
- return (((pos > ctx->text.lastPos) ? ctx->text.lastPos : pos));
-}
-
-/* Li wrote this so the IM can find a given text position's screen position */
-void
-_XawTextPosToXY(Widget w, XawTextPosition pos, Position *x, Position *y)
-{
- int line, ix, iy;
-
- LineAndXYForPosition((TextWidget)w, pos, &line, &ix, &iy);
- *x = ix;
- *y = iy;
-}
-
-/*******************************************************************
-The following routines provide procedural interfaces to Text window state
-setting and getting. They need to be redone so than the args code can use
-them. I suggest we create a complete set that takes the context as an
-argument and then have the public version lookup the context and call the
-internal one. The major value of this set is that they have actual application
-clients and therefore the functionality provided is required for any future
-version of Text.
-********************************************************************/
-void
-XawTextDisplay(Widget w)
-{
- TextWidget ctx = (TextWidget)w;
-
- if (!XtIsRealized(w))
- return;
-
- _XawTextPrepareToUpdate(ctx);
- ctx->text.clear_to_eol = True;
- DisplayTextWindow(w);
- _XawTextExecuteUpdate(ctx);
-}
-
-void
-XawTextSetSelectionArray(Widget w, XawTextSelectType *sarray)
-{
- ((TextWidget)w)->text.sarray = sarray;
-}
-
-void
-XawTextGetSelectionPos(Widget w, XawTextPosition *left, XawTextPosition *right)
-{
- *left = ((TextWidget)w)->text.s.left;
- *right = ((TextWidget)w)->text.s.right;
-}
-
-void
-_XawTextSetSource(Widget w, Widget source,
- XawTextPosition top, XawTextPosition startPos)
-{
- TextWidget ctx = (TextWidget)w;
-#ifndef OLDXAW
- Bool resolve = False;
-#endif
-
- _XawTextPrepareToUpdate(ctx);
-#ifndef OLDXAW
- if (source != ctx->text.source)
- _XawSourceRemoveText(ctx->text.source, w, ctx->text.source &&
- XtParent(ctx->text.source) == w);
- _XawSourceAddText(source, w);
-
- if (source != ctx->text.source || ctx->text.insertPos != startPos)
- resolve = True;
-
- ctx->text.source_changed = SRC_CHANGE_OVERLAP;
-#endif
- ctx->text.source = source;
- ctx->text.s.left = ctx->text.s.right = 0;
- ctx->text.insertPos = ctx->text.old_insert = startPos;
- ctx->text.lastPos = GETLASTPOS;
-
- _XawTextBuildLineTable(ctx, top, True);
-
- _XawTextExecuteUpdate(ctx);
-#ifndef OLDXAW
- if (resolve)
- _XawTextSetLineAndColumnNumber(ctx, True);
-#endif
-}
-
-void
-XawTextSetSource(Widget w, Widget source, XawTextPosition top)
-{
- _XawTextSetSource(w, source, top, top);
-}
-
-/*
- * This public routine deletes the text from startPos to endPos in a source and
- * then inserts, at startPos, the text that was passed. As a side effect it
- * "invalidates" that portion of the displayed text (if any), so that things
- * will be repainted properly.
- */
-int
-XawTextReplace(Widget w, XawTextPosition startPos, XawTextPosition endPos,
- XawTextBlock *text)
-{
- TextWidget ctx = (TextWidget)w;
- int result;
-#ifndef OLDXAW
- Cardinal i;
- TextSrcObject src = (TextSrcObject)ctx->text.source;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- _XawTextPrepareToUpdate((TextWidget)src->textSrc.text[i]);
-#else
- _XawTextPrepareToUpdate(ctx);
-#endif
-
- endPos = FindGoodPosition(ctx, endPos);
- startPos = FindGoodPosition(ctx, startPos);
- result = _XawTextReplace(ctx, startPos, endPos, text);
-
-#ifndef OLDXAW
- for (i = 0; i < src->textSrc.num_text; i++)
- _XawTextExecuteUpdate((TextWidget)src->textSrc.text[i]);
-#else
- _XawTextExecuteUpdate(ctx);
-#endif
-
- return (result);
-}
-
-XawTextPosition
-XawTextTopPosition(Widget w)
-{
- return (((TextWidget)w)->text.lt.top);
-}
-
-XawTextPosition
-XawTextLastPosition(Widget w)
-{
- return (((TextWidget)w)->text.lastPos);
-}
-
-void
-XawTextSetInsertionPoint(Widget w, XawTextPosition position)
-{
- TextWidget ctx = (TextWidget)w;
-
- _XawTextPrepareToUpdate(ctx);
- ctx->text.insertPos = FindGoodPosition(ctx, position);
- ctx->text.showposition = True;
- ctx->text.from_left = -1;
-
- _XawTextExecuteUpdate(ctx);
-#ifndef OLDXAW
- _XawTextSetLineAndColumnNumber(ctx, False);
-#endif
-}
-
-XawTextPosition
-XawTextGetInsertionPoint(Widget w)
-{
- return (((TextWidget)w)->text.insertPos);
-}
-
-/*
- * Note: Must walk the selection list in opposite order from TextLoseSelection
- */
-void
-XawTextUnsetSelection(Widget w)
-{
- TextWidget ctx = (TextWidget)w;
-
- while (ctx->text.s.atom_count != 0) {
- Atom sel = ctx->text.s.selections[ctx->text.s.atom_count - 1];
-
- if (sel != (Atom) 0) {
- /*
- * As selections are lost the atom_count will decrement
- */
- if (GetCutBufferNumber(sel) == NOT_A_CUT_BUFFER)
- XtDisownSelection(w, sel, ctx->text.time);
- TextLoseSelection(w, &sel); /* In case this is a cut buffer, or
- XtDisownSelection failed to call us */
- }
- }
-}
-
-void
-XawTextSetSelection(Widget w, XawTextPosition left, XawTextPosition right)
-{
- TextWidget ctx = (TextWidget)w;
-
- _XawTextPrepareToUpdate(ctx);
- _XawTextSetSelection(ctx, FindGoodPosition(ctx, left),
- FindGoodPosition(ctx, right), NULL, 0);
- _XawTextExecuteUpdate(ctx);
-}
-
-void
-XawTextInvalidate(Widget w, XawTextPosition from, XawTextPosition to)
-{
- TextWidget ctx = (TextWidget)w;
-
- from = FindGoodPosition(ctx, from);
- to = FindGoodPosition(ctx, to);
- ctx->text.lastPos = GETLASTPOS;
- _XawTextPrepareToUpdate(ctx);
- _XawTextNeedsUpdating(ctx, from, to);
- _XawTextExecuteUpdate(ctx);
-}
-
-/*ARGSUSED*/
-void
-XawTextDisableRedisplay(Widget w)
-{
- ((TextWidget)w)->text.update_disabled = True;
- _XawTextPrepareToUpdate((TextWidget)w);
-}
-
-void
-XawTextEnableRedisplay(Widget w)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition lastPos;
-
- if (!ctx->text.update_disabled)
- return;
-
- ctx->text.update_disabled = False;
- lastPos = ctx->text.lastPos = GETLASTPOS;
- ctx->text.lt.top = FindGoodPosition(ctx, ctx->text.lt.top);
- ctx->text.insertPos = FindGoodPosition(ctx, ctx->text.insertPos);
-
- if (ctx->text.s.left > lastPos || ctx->text.s.right > lastPos)
- ctx->text.s.left = ctx->text.s.right = 0;
-
- _XawTextExecuteUpdate(ctx);
-}
-
-Widget
-XawTextGetSource(Widget w)
-{
- return (((TextWidget)w)->text.source);
-}
-
-Widget
-XawTextGetSink(Widget w)
-{
- return (((TextWidget)w)->text.sink);
-}
-
-void
-XawTextDisplayCaret(Widget w,
-#if NeedWidePrototypes
- int display_caret
-#else
- Boolean display_caret
-#endif
-)
-{
- TextWidget ctx = (TextWidget)w;
-
- if (XtIsRealized(w)) {
- _XawTextPrepareToUpdate(ctx);
- ctx->text.display_caret = display_caret;
- _XawTextExecuteUpdate(ctx);
- }
- else
- ctx->text.display_caret = display_caret;
-}
-
-/*
- * Function:
- * XawTextSearch
- *
- * Parameters:
- * w - text widget
- * dir - direction to search
- * text - text block containing info about the string to search for
- *
- * Description:
- * Searches for the given text block.
- *
- * Returns:
- * The position of the text found, or XawTextSearchError on an error
- */
-XawTextPosition
-XawTextSearch(Widget w,
-#if NeedWidePrototypes
- int dir,
-#else
- XawTextScanDirection dir,
-#endif
- XawTextBlock *text)
-{
- TextWidget ctx = (TextWidget)w;
-
- return (SrcSearch(ctx->text.source, ctx->text.insertPos, dir, text));
-}
-
-TextClassRec textClassRec = {
- /* core */
- {
- (WidgetClass)&simpleClassRec, /* superclass */
- "Text", /* class_name */
- sizeof(TextRec), /* widget_size */
- XawTextClassInitialize, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- XawTextInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawTextRealize, /* realize */
- _XawTextActionsTable, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resource */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- XtExposeGraphicsExpose | /* compress_exposure */
- XtExposeNoExpose,
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawTextDestroy, /* destroy */
- XawTextResize, /* resize */
- XawTextExpose, /* expose */
- XawTextSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- XawTextGetValuesHook, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- _XawDefaultTextTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XawTextChangeSensitive, /* change_sensitive */
- },
- /* text */
- {
- NULL, /* extension */
- }
-};
-
-WidgetClass textWidgetClass = (WidgetClass)&textClassRec;
diff --git a/xc/lib/Xaw/Text.h b/xc/lib/Xaw/Text.h
deleted file mode 100644
index 7bb3ff0fc..000000000
--- a/xc/lib/Xaw/Text.h
+++ /dev/null
@@ -1,369 +0,0 @@
-/* $TOG: Text.h /main/46 1998/02/06 12:52:13 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Text.h,v 1.13 1999/08/15 13:00:34 dawes Exp $ */
-
-#ifndef _XawText_h
-#define _XawText_h
-
-#include <X11/Xaw/Simple.h>
-
-/*
-
- Class: textWidgetClass
- Class Name: Text
- Superclass: Simple
-
- Resources added by the Text widget:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- autoFill AutoFill Boolean False
- bottomMargin Margin Position 2
- displayPosition TextPosition XawTextPosition 0
- insertPosition TextPosition XawTextPosition 0
- justify JustifyMode JustifyMode left
- leftColumn Column Column 0
- rightColumn Column Column 0
- leftMargin Margin Position 2
- rightMargin Margin Position 4
- positionCallback Callback Callback NULL
- scrollHorizontal Scroll Boolean False
- scrollVertical Scroll Boolean False
- selectTypes SelectTypes Pointer see documentation
- textSink TextSink Widget NULL
- textSource TextSource Widget NULL
- topMargin Margin Position 2
- unrealizeCallback Callback Callback NULL
- wrap Wrap XawTextWrapMode XawTextWrapNever
-
-*/
-
-typedef long XawTextPosition;
-
-#ifndef notdef
-typedef enum {
- XawtextScrollNever,
- XawtextScrollWhenNeeded,
- XawtextScrollAlways
-} XawTextScrollMode;
-
-typedef enum {
- XawtextResizeNever,
- XawtextResizeWidth,
- XawtextResizeHeight,
- XawtextResizeBoth
-} XawTextResizeMode;
-#endif
-
-typedef enum {
- XawtextWrapNever,
- XawtextWrapLine,
- XawtextWrapWord
-} XawTextWrapMode;
-
-typedef enum {
- XawsdLeft,
- XawsdRight
-} XawTextScanDirection;
-
-typedef enum {
- XawtextRead,
- XawtextAppend,
- XawtextEdit
-} XawTextEditType;
-
-typedef enum {
- XawselectNull,
- XawselectPosition,
- XawselectChar,
- XawselectWord,
- XawselectLine,
- XawselectParagraph,
- XawselectAll,
- XawselectAlphaNumeric
-} XawTextSelectType;
-
-typedef enum {
- XawjustifyLeft,
- XawjustifyRight,
- XawjustifyCenter,
- XawjustifyFull
-} XawTextJustifyMode;
-
-typedef struct {
- int firstPos;
- int length;
- char *ptr;
- unsigned long format;
-} XawTextBlock, *XawTextBlockPtr;
-
-#ifndef OLDXAW
-typedef struct {
- int line_number;
- int column_number;
- XawTextPosition insert_position;
- XawTextPosition last_position;
- Boolean overwrite_mode;
-} XawTextPositionInfo;
-
-typedef struct {
- XawTextPosition left, right;
- XawTextBlock *block;
-} XawTextPropertyInfo;
-
-typedef struct _XawTextAnchor XawTextAnchor;
-typedef struct _XawTextEntity XawTextEntity;
-typedef struct _XawTextProperty XawTextProperty;
-typedef struct _XawTextPropertyList XawTextPropertyList;
-#endif
-
-#include <X11/Xaw/TextSink.h>
-#include <X11/Xaw/TextSrc.h>
-
-#define XtEtextScrollNever "never"
-#define XtEtextScrollWhenNeeded "whenneeded"
-#define XtEtextScrollAlways "always"
-#define XtEtextResizeNever "never"
-#define XtEtextResizeWidth "width"
-#define XtEtextResizeHeight "height"
-#define XtEtextResizeBoth "both"
-
-#define XtEtextWrapNever "never"
-#define XtEtextWrapLine "line"
-#define XtEtextWrapWord "word"
-
-#define XtNautoFill "autoFill"
-#define XtNbottomMargin "bottomMargin"
-#define XtNdialogHOffset "dialogHOffset"
-#define XtNdialogVOffset "dialogVOffset"
-#define XtNdisplayCaret "displayCaret"
-#define XtNdisplayPosition "displayPosition"
-#define XtNleftMargin "leftMargin"
-#define XtNrightMargin "rightMargin"
-#define XtNpositionCallback "positionCallback"
-#define XtNscrollVertical "scrollVertical"
-#define XtNscrollHorizontal "scrollHorizontal"
-#define XtNselectTypes "selectTypes"
-#define XtNtopMargin "topMargin"
-#define XtNwrap "wrap"
-
-#define XtCColumn "Column"
-#define XtNleftColumn "leftColumn"
-#define XtNrightColumn "rightColumn"
-
-#define XtCJustifyMode XtCJustify
-#define XtNjustifyMode XtNjustify
-#define XtEtextJustifyLeft "left"
-#define XtEtextJustifyRight "right"
-#define XtEtextJustifyCenter "center"
-#define XtEtextJustifyFull "full"
-
-#define XtCAutoFill "AutoFill"
-#define XtCSelectTypes "SelectTypes"
-#define XtCWrap "Wrap"
-#ifndef notdef
-#define XtCScroll "Scroll"
-#endif
-
-#ifndef _XtStringDefs_h_
-#define XtNinsertPosition "insertPosition"
-#ifndef notdef
-#define XtNresize "resize"
-#define XtCResize "Resize"
-#endif
-#define XtNselection "selection"
-#endif
-
-/* return Error code for XawTextSearch */
-#define XawTextSearchError (-12345L)
-
-/* return codes from XawTextReplace */
-#define XawReplaceError -1
-#define XawEditDone 0
-#define XawEditError 1
-#define XawPositionError 2
-
-/* XrmQuark is not unsigned long */
-#define XawTextFormat(tw,fmt) ((unsigned long)_XawTextFormat(tw) == (fmt))
-
-extern unsigned long FMT8BIT;
-extern unsigned long XawFmt8Bit;
-extern unsigned long XawFmtWide;
-
-extern WidgetClass textWidgetClass;
-
-typedef struct _TextClassRec *TextWidgetClass;
-typedef struct _TextRec *TextWidget;
-
-_XFUNCPROTOBEGIN
-
-XrmQuark _XawTextFormat
-(
- TextWidget tw
- );
-
-void XawTextDisplay
-(
- Widget w
- );
-
-void XawTextEnableRedisplay
-(
- Widget w
- );
-
-void XawTextDisableRedisplay
-(
- Widget w
- );
-
-void XawTextSetSelectionArray
-(
- Widget w,
- XawTextSelectType *sarray
- );
-
-void XawTextGetSelectionPos
-(
- Widget w,
- XawTextPosition *begin_return,
- XawTextPosition *end_return
- );
-
-void XawTextSetSource
-(
- Widget w,
- Widget source,
- XawTextPosition top
- );
-
-int XawTextReplace
-(
- Widget w,
- XawTextPosition start,
- XawTextPosition end,
- XawTextBlock *text
- );
-
-XawTextPosition XawTextTopPosition
-(
- Widget w
- );
-
-XawTextPosition XawTextLastPosition
-(
- Widget w
- );
-
-void XawTextSetInsertionPoint
-(
- Widget w,
- XawTextPosition position
- );
-
-XawTextPosition XawTextGetInsertionPoint
-(
- Widget w
- );
-
-void XawTextUnsetSelection
-(
- Widget w
- );
-
-void XawTextSetSelection
-(
- Widget w,
- XawTextPosition left,
- XawTextPosition right
- );
-
-void XawTextInvalidate
-(
- Widget w,
- XawTextPosition from,
- XawTextPosition to
-);
-
-Widget XawTextGetSource
-(
- Widget w
- );
-
-Widget XawTextGetSink
-(
- Widget w
- );
-
-XawTextPosition XawTextSearch
-(
- Widget w,
-#if NeedWidePrototypes
- int dir,
-#else
- XawTextScanDirection dir,
-#endif
- XawTextBlock *text
- );
-
-void XawTextDisplayCaret
-(
- Widget w,
-#if NeedWidePrototypes
- int visible
-#else
- Boolean visible
-#endif
- );
-
-_XFUNCPROTOEND
-
-/*
- * For R3 compatability only
- */
-#include <X11/Xaw/AsciiSrc.h>
-#include <X11/Xaw/AsciiSink.h>
-
-#endif /* _XawText_h */
diff --git a/xc/lib/Xaw/TextAction.c b/xc/lib/Xaw/TextAction.c
deleted file mode 100644
index 93655c982..000000000
--- a/xc/lib/Xaw/TextAction.c
+++ /dev/null
@@ -1,4301 +0,0 @@
-/* $TOG: TextAction.c /main/55 1998/02/06 12:51:01 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.
-
-*/
-/* $XFree86: xc/lib/Xaw/TextAction.c,v 3.33 1999/08/15 13:00:35 dawes Exp $ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <X11/Xos.h> /* for select() and struct timeval */
-#include <ctype.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xatom.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/Atoms.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xmu/StdSel.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/MultiSinkP.h>
-#include <X11/Xaw/MultiSrcP.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/TextSrcP.h>
-#include <X11/Xaw/XawImP.h>
-#include "Private.h"
-#include "XawI18n.h"
-
-#define SrcScan XawTextSourceScan
-#define FindDist XawTextSinkFindDistance
-#define FindPos XawTextSinkFindPosition
-#define MULT(w) (w->text.mult == 0 ? 4 : \
- w->text.mult == 32767 ? -4 : w->text.mult)
-
-#define KILL_RING_APPEND 2
-#define KILL_RING_BEGIN 3
-#define KILL_RING_YANK 100
-#define KILL_RING_YANK_DONE 98
-
-#define XawTextActionMaxHexChars 100
-
-/*
- * Prototypes
- */
-static void _DeleteOrKill(TextWidget, XawTextPosition, XawTextPosition, Bool);
-static void _SelectionReceived(Widget, XtPointer, Atom*, Atom*, XtPointer,
- unsigned long*, int*);
-static void _LoseSelection(Widget, Atom*, char**, int*);
-static void AutoFill(TextWidget);
-static Boolean ConvertSelection(Widget, Atom*, Atom*, Atom*, XtPointer*,
- unsigned long*, int*);
-static void DeleteOrKill(TextWidget, XEvent*, XawTextScanDirection,
- XawTextScanType, Bool, Bool);
-static void EndAction(TextWidget);
-#ifndef OLDXAW
-static Bool BlankLine(Widget, XawTextPosition, int*);
-static int DoFormatText(TextWidget, XawTextPosition, Bool, int,
- XawTextBlock*, XawTextPosition*, int, Bool);
-static int FormatText(TextWidget, XawTextPosition, Bool,
- XawTextPosition*, int);
-static Bool GetBlockBoundaries(TextWidget, XawTextPosition*, XawTextPosition*);
-#endif
-static int FormRegion(TextWidget, XawTextPosition, XawTextPosition,
- XawTextPosition*, int);
-static void GetSelection(Widget, Time, String*, Cardinal);
-static char *IfHexConvertHexElseReturnParam(char*, int*);
-static void InsertNewCRs(TextWidget, XawTextPosition, XawTextPosition,
- XawTextPosition*, int);
-static int InsertNewLineAndBackupInternal(TextWidget);
-static int LocalInsertNewLine(TextWidget, XEvent*);
-static void LoseSelection(Widget, Atom*);
-static void ParameterError(Widget, String);
-static int ProbablyMB(char*);
-static Bool MatchSelection(Atom, XawTextSelection*);
-static void ModifySelection(TextWidget, XEvent*, XawTextSelectionMode,
- XawTextSelectionAction, String*, Cardinal*);
-static void Move(TextWidget, XEvent*, XawTextScanDirection, XawTextScanType,
- Bool);
-static void NotePosition(TextWidget, XEvent*);
-static void StartAction(TextWidget, XEvent*);
-static XawTextPosition StripOutOldCRs(TextWidget, XawTextPosition,
- XawTextPosition, XawTextPosition*, int);
-#ifndef OLDXAW
-static Bool StripSpaces(TextWidget, XawTextPosition, XawTextPosition,
- XawTextPosition*, int, XawTextBlock*);
-static Bool Tabify(TextWidget, XawTextPosition, XawTextPosition,
- XawTextPosition*, int, XawTextBlock*);
-static Bool Untabify(TextWidget, XawTextPosition, XawTextPosition,
- XawTextPosition*, int, XawTextBlock*);
-#endif
-
-/*
- * Actions
- */
-static void CapitalizeWord(Widget, XEvent*, String*, Cardinal*);
-static void DisplayCaret(Widget, XEvent*, String*, Cardinal*);
-static void Delete(Widget, XEvent*, String*, Cardinal*);
-static void DeleteBackwardChar(Widget, XEvent*, String*, Cardinal*);
-static void DeleteBackwardWord(Widget, XEvent*, String*, Cardinal*);
-static void DeleteCurrentSelection(Widget, XEvent*, String*, Cardinal*);
-static void DeleteForwardChar(Widget, XEvent*, String*, Cardinal*);
-static void DeleteForwardWord(Widget, XEvent*, String*, Cardinal*);
-static void DowncaseWord(Widget, XEvent*, String*, Cardinal*);
-static void ExtendAdjust(Widget, XEvent*, String*, Cardinal*);
-static void ExtendEnd(Widget, XEvent*, String*, Cardinal*);
-static void ExtendStart(Widget, XEvent*, String*, Cardinal*);
-static void FormParagraph(Widget, XEvent*, String*, Cardinal*);
-#ifndef OLDXAW
-static void Indent(Widget, XEvent*, String*, Cardinal*);
-#endif
-static void InsertChar(Widget, XEvent*, String*, Cardinal*);
-static void InsertNewLine(Widget, XEvent*, String*, Cardinal*);
-static void InsertNewLineAndBackup(Widget, XEvent*, String*, Cardinal*);
-static void InsertNewLineAndIndent(Widget, XEvent*, String*, Cardinal*);
-static void InsertSelection(Widget, XEvent*, String*, Cardinal*);
-static void InsertString(Widget, XEvent*, String*, Cardinal*);
-#ifndef OLDXAW
-static void KeyboardReset(Widget, XEvent*, String*, Cardinal*);
-#endif
-static void KillBackwardWord(Widget, XEvent*, String*, Cardinal*);
-static void KillCurrentSelection(Widget, XEvent*, String*, Cardinal*);
-static void KillForwardWord(Widget, XEvent*, String*, Cardinal*);
-#ifndef OLDXAW
-static void KillRingYank(Widget, XEvent*, String*, Cardinal*);
-#endif
-static void KillToEndOfLine(Widget, XEvent*, String*, Cardinal*);
-static void KillToEndOfParagraph(Widget, XEvent*, String*, Cardinal*);
-static void MoveBackwardChar(Widget, XEvent*, String*, Cardinal*);
-static void MoveBackwardWord(Widget, XEvent*, String*, Cardinal*);
-static void MoveBackwardParagraph(Widget, XEvent*, String*, Cardinal*);
-static void MoveBeginningOfFile(Widget, XEvent*, String*, Cardinal*);
-static void MoveEndOfFile(Widget, XEvent*, String*, Cardinal*);
-static void MoveForwardChar(Widget, XEvent*, String*, Cardinal*);
-static void MoveForwardWord(Widget, XEvent*, String*, Cardinal*);
-static void MoveForwardParagraph(Widget, XEvent*, String*, Cardinal*);
-static void MoveNextLine(Widget, XEvent*, String*, Cardinal*);
-static void MoveNextPage(Widget, XEvent*, String*, Cardinal*);
-static void MovePage(TextWidget, XEvent*, XawTextScanDirection);
-static void MovePreviousLine(Widget, XEvent*, String*, Cardinal*);
-static void MovePreviousPage(Widget, XEvent*, String*, Cardinal*);
-static void MoveLine(TextWidget, XEvent*, XawTextScanDirection);
-static void MoveToLineEnd(Widget, XEvent*, String*, Cardinal*);
-static void MoveToLineStart(Widget, XEvent*, String*, Cardinal*);
-static void Multiply(Widget, XEvent*, String*, Cardinal*);
-static void NoOp(Widget, XEvent*, String*, Cardinal*);
-#ifndef OLDXAW
-static void Numeric(Widget, XEvent*, String*, Cardinal*);
-#endif
-static void Reconnect(Widget, XEvent*, String*, Cardinal*);
-static void RedrawDisplay(Widget, XEvent*, String*, Cardinal*);
-static void Scroll(TextWidget, XEvent*, XawTextScanDirection);
-static void ScrollOneLineDown(Widget, XEvent*, String*, Cardinal*);
-static void ScrollOneLineUp(Widget, XEvent*, String*, Cardinal*);
-static void SelectAdjust(Widget, XEvent*, String*, Cardinal*);
-static void SelectAll(Widget, XEvent*, String*, Cardinal*);
-static void SelectEnd(Widget, XEvent*, String*, Cardinal*);
-static void SelectSave(Widget, XEvent*, String*, Cardinal*);
-static void SelectStart(Widget, XEvent*, String*, Cardinal*);
-static void SelectWord(Widget, XEvent*, String*, Cardinal*);
-static void SetKeyboardFocus(Widget, XEvent*, String*, Cardinal*);
-static void TextEnterWindow(Widget, XEvent*, String*, Cardinal*);
-static void TextFocusIn(Widget, XEvent*, String*, Cardinal*);
-static void TextFocusOut(Widget, XEvent*, String*, Cardinal*);
-static void TextLeaveWindow(Widget, XEvent*, String*, Cardinal*);
-static void TransposeCharacters(Widget, XEvent*, String*, Cardinal*);
-#ifndef OLDXAW
-static void ToggleOverwrite(Widget, XEvent*, String*, Cardinal*);
-static void Undo(Widget, XEvent*, String*, Cardinal*);
-#endif
-static void UpcaseWord(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * External
- */
-void _XawTextZapSelection(TextWidget, XEvent*, Bool);
-
-/*
- * Defined in TextPop.c
- */
-void _XawTextInsertFileAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextInsertFile(Widget, XEvent*, String*, Cardinal*);
-void _XawTextSearch(Widget, XEvent*, String*, Cardinal*);
-void _XawTextDoSearchAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextDoReplaceAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextSetField(Widget, XEvent*, String*, Cardinal*);
-void _XawTextPopdownSearchAction(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * These are defined in Text.c
- */
-void _XawTextAlterSelection(TextWidget, XawTextSelectionMode,
- XawTextSelectionAction, String*, Cardinal*);
-void _XawTextClearAndCenterDisplay(TextWidget);
-void _XawTextExecuteUpdate(TextWidget);
-char *_XawTextGetText(TextWidget, XawTextPosition, XawTextPosition);
-void _XawTextPrepareToUpdate(TextWidget);
-int _XawTextReplace(TextWidget, XawTextPosition, XawTextPosition,
- XawTextBlock*);
-Atom *_XawTextSelectionList(TextWidget, String*, Cardinal);
-void _XawTextSetSelection(TextWidget, XawTextPosition, XawTextPosition,
- String*, Cardinal);
-void _XawTextVScroll(TextWidget, int);
-void XawTextScroll(TextWidget, int, int);
-void _XawTextSetLineAndColumnNumber(TextWidget, Bool);
-
-#ifndef OLDXAW
-/*
- * Defined in TextSrc.c
- */
-Bool _XawTextSrcUndo(TextSrcObject, XawTextPosition*);
-Bool _XawTextSrcToggleUndo(TextSrcObject);
-void _XawSourceSetUndoErase(TextSrcObject, int);
-void _XawSourceSetUndoMerge(TextSrcObject, Bool);
-#endif /* OLDXAW */
-
-/*
- * Initialization
- */
-#ifndef OLDXAW
-#define MAX_KILL_RINGS 1024
-XawTextKillRing *xaw_text_kill_ring;
-static XawTextKillRing kill_ring_prev, kill_ring_null = { &kill_ring_prev, };
-static unsigned num_kill_rings;
-#endif
-
-/*
- * Implementation
- */
-static void
-ParameterError(Widget w, String param)
-{
- String params[2];
- Cardinal num_params = 2;
- params[0] = XtName(w);
- params[1] = param;
-
- XtAppWarningMsg(XtWidgetToApplicationContext(w),
- "parameterError", "textAction", "XawError",
- "Widget: %s Parameter: %s",
- params, &num_params);
- XBell(XtDisplay(w), 50);
-}
-
-static void
-StartAction(TextWidget ctx, XEvent *event)
-{
-#ifndef OLDXAW
- Cardinal i;
- TextSrcObject src = (TextSrcObject)ctx->text.source;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- _XawTextPrepareToUpdate((TextWidget)src->textSrc.text[i]);
- _XawSourceSetUndoMerge(src, False);
-#else
- _XawTextPrepareToUpdate(ctx);
-#endif
-
- if (event != NULL) {
- switch (event->type) {
- case ButtonPress:
- case ButtonRelease:
- ctx->text.time = event->xbutton.time;
- break;
- case KeyPress:
- case KeyRelease:
- ctx->text.time = event->xkey.time;
- break;
- case MotionNotify:
- ctx->text.time = event->xmotion.time;
- break;
- case EnterNotify:
- case LeaveNotify:
- ctx->text.time = event->xcrossing.time;
- }
- }
-}
-
-static void
-NotePosition(TextWidget ctx, XEvent *event)
-{
- switch (event->type) {
- case ButtonPress:
- case ButtonRelease:
- ctx->text.ev_x = event->xbutton.x;
- ctx->text.ev_y = event->xbutton.y;
- break;
- case KeyPress:
- case KeyRelease: {
- XRectangle cursor;
- XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
- ctx->text.ev_x = cursor.x + cursor.width / 2;
- ctx->text.ev_y = cursor.y + cursor.height / 2;
- } break;
- case MotionNotify:
- ctx->text.ev_x = event->xmotion.x;
- ctx->text.ev_y = event->xmotion.y;
- break;
- case EnterNotify:
- case LeaveNotify:
- ctx->text.ev_x = event->xcrossing.x;
- ctx->text.ev_y = event->xcrossing.y;
- }
-}
-
-static void
-EndAction(TextWidget ctx)
-{
-#ifndef OLDXAW
- Cardinal i;
- TextSrcObject src = (TextSrcObject)ctx->text.source;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- _XawTextExecuteUpdate((TextWidget)src->textSrc.text[i]);
-
- ctx->text.mult = 1;
- ctx->text.numeric = False;
- if (ctx->text.kill_ring) {
- if (--ctx->text.kill_ring == KILL_RING_YANK_DONE) {
- if (ctx->text.kill_ring_ptr) {
- --ctx->text.kill_ring_ptr->refcount;
- ctx->text.kill_ring_ptr = NULL;
- }
- }
- }
-#else
- ctx->text.mult = 1;
- _XawTextExecuteUpdate(ctx);
-#endif /* OLDXAW */
-}
-
-struct _SelectionList {
- String* params;
- Cardinal count;
- Time time;
- Boolean CT_asked; /* flag if asked XA_COMPOUND_TEXT */
- Atom selection; /* selection atom when asking XA_COMPOUND_TEXT */
-};
-
-static int
-ProbablyMB(char *s)
-{
- int escapes = 0;
- int has_hi_bit = False;
-
- /* if it has more than one ESC char, I assume it is COMPOUND_TEXT.
- If it has at least one hi bit set character, I pretend it is multibyte. */
-
- while ((*s) != (wchar_t)0) {
- if (*s & 128)
- has_hi_bit = True;
- if (*s++ == '\033')
- escapes++;
- if (escapes >= 2)
- return (0);
- }
- return (has_hi_bit);
-}
-
-/*ARGSUSED*/
-static void
-_SelectionReceived(Widget w, XtPointer client_data, Atom *selection,
- Atom *type, XtPointer value, unsigned long *length,
- int *format)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextBlock text;
-
- if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0) {
- struct _SelectionList* list = (struct _SelectionList*)client_data;
-
- if (list != NULL) {
- if (list->CT_asked) {
-
- /* If we just asked for a XA_COMPOUND_TEXT and got a null
- response, we'll ask again, this time for an XA_STRING. */
- list->CT_asked = False;
- XtGetSelectionValue(w, list->selection, XA_STRING,
- _SelectionReceived,
- (XtPointer)list, list->time);
- }
- else {
- GetSelection(w, list->time, list->params, list->count);
- XtFree(client_data);
- }
- }
- return;
- }
-
- /* Many programs, especially old terminal emulators, give us multibyte text
- but tell us it is COMPOUND_TEXT :( The following routine checks to see
- if the string is a legal multibyte string in our locale using a spooky
- heuristic :O and if it is we can only assume the sending client is using
- the same locale as we are, and convert it. I also warn the user that the
- other client is evil */
-
- StartAction(ctx, NULL);
- if (XawTextFormat(ctx, XawFmtWide)) {
- XTextProperty textprop;
- Display *d = XtDisplay((Widget)ctx);
- wchar_t **wlist;
- int count;
- int try_CT = 1;
-
- /* IS THE SELECTION IN MULTIBYTE FORMAT? */
- if (ProbablyMB( (char *)value)) {
- char *list[1];
-
- list[0] = (char *)value;
- if (XmbTextListToTextProperty(d, (char**)list, 1, XCompoundTextStyle,
- &textprop) == Success)
- try_CT = 0;
- }
-
- /* OR IN COMPOUND TEXT FORMAT? */
- if (try_CT) {
- textprop.encoding = XA_COMPOUND_TEXT(d);
- textprop.value = (unsigned char *)value;
- textprop.nitems = strlen(value);
- textprop.format = 8;
- }
-
- if (XwcTextPropertyToTextList(d, &textprop, (wchar_t***)&wlist, &count)
- != Success) {
- XwcFreeStringList((wchar_t**)wlist);
-
- /* Notify the user on strerr and in the insertion :) */
- textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << ";
- count = 1;
- fprintf(stderr, "Xaw Text Widget: An attempt was made to insert "
- "an illegal selection.\n");
-
- if (XwcTextPropertyToTextList(d, &textprop, (wchar_t***)&wlist,
- &count) != Success)
- return;
- }
-
- XFree(value);
- value = (XPointer)wlist[0];
-
- *length = wcslen(wlist[0]);
- XtFree((XtPointer)wlist);
- text.format = XawFmtWide;
- }
- else
- text.format = XawFmt8Bit;
- text.ptr = (char*)value;
- text.firstPos = 0;
- text.length = *length;
- if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
- XBell(XtDisplay(ctx), 0);
- EndAction(ctx);
- return;
- }
-
- ctx->text.from_left = -1;
- ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
- XawstPositions, XawsdRight, text.length, True);
-
- EndAction(ctx);
- XtFree(client_data);
- XFree(value); /* the selection value should be freed with XFree */
-}
-
-static void
-GetSelection(Widget w, Time timev, String *params, Cardinal num_params)
-{
- Atom selection;
- int buffer;
-
- selection = XInternAtom(XtDisplay(w), *params, False);
- switch (selection) {
- case XA_CUT_BUFFER0: buffer = 0; break;
- case XA_CUT_BUFFER1: buffer = 1; break;
- case XA_CUT_BUFFER2: buffer = 2; break;
- case XA_CUT_BUFFER3: buffer = 3; break;
- case XA_CUT_BUFFER4: buffer = 4; break;
- case XA_CUT_BUFFER5: buffer = 5; break;
- case XA_CUT_BUFFER6: buffer = 6; break;
- case XA_CUT_BUFFER7: buffer = 7; break;
- default: buffer = -1;
- }
- if (buffer >= 0) {
- int nbytes;
- unsigned long length;
- int fmt8 = 8;
- Atom type = XA_STRING;
- char *line = XFetchBuffer(XtDisplay(w), &nbytes, buffer);
-
- if ((length = nbytes) != 0L)
- _SelectionReceived(w, NULL, &selection, &type, line, &length, &fmt8);
- else if (num_params > 1)
- GetSelection(w, timev, params+1, num_params-1);
- }
- else {
- struct _SelectionList* list;
-
- if (--num_params) {
- list = XtNew(struct _SelectionList);
- list->params = params + 1;
- list->count = num_params;
- list->time = timev;
- list->CT_asked = True;
- list->selection = selection;
- }
- else
- list = NULL;
- XtGetSelectionValue(w, selection, XA_COMPOUND_TEXT(XtDisplay(w)),
- _SelectionReceived, (XtPointer)list, timev);
- }
-}
-
-static void
-InsertSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- StartAction((TextWidget)w, event); /* Get Time. */
- GetSelection(w, ((TextWidget)w)->text.time, params, *num_params);
- EndAction((TextWidget)w);
-}
-
-/*
- * Routines for Moving Around
- */
-static void
-Move(TextWidget ctx, XEvent *event, XawTextScanDirection dir,
- XawTextScanType type, Bool include)
-{
- XawTextPosition insertPos;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- mult = -mult;
- dir = dir == XawsdLeft ? XawsdRight : XawsdLeft;
- }
-
- insertPos = SrcScan(ctx->text.source, ctx->text.insertPos,
- type, dir, mult, include);
-
- StartAction(ctx, event);
-
- if (ctx->text.s.left != ctx->text.s.right)
- XawTextUnsetSelection((Widget)ctx);
-
-#ifndef OLDXAW
- ctx->text.numeric = False;
-#endif
- ctx->text.mult = 1;
- ctx->text.showposition = True;
- ctx->text.from_left = -1;
- ctx->text.insertPos = insertPos;
- EndAction(ctx);
-}
-
-/*ARGSUSED*/
-static void
-MoveForwardChar(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Move((TextWidget)w, event, XawsdRight, XawstPositions, True);
-}
-
-/*ARGSUSED*/
-static void
-MoveBackwardChar(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Move((TextWidget)w, event, XawsdLeft, XawstPositions, True);
-}
-
-static void
-MoveForwardWord(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- if (*n && (p[0][0] == 'A' || p[0][0] == 'a'))
- Move((TextWidget)w, event, XawsdRight, XawstAlphaNumeric, False);
- else
- Move((TextWidget)w, event, XawsdRight, XawstWhiteSpace, False);
-}
-
-static void
-MoveBackwardWord(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- if (*n && (p[0][0] == 'A' || p[0][0] == 'a'))
- Move((TextWidget)w, event, XawsdLeft, XawstAlphaNumeric, False);
- else
- Move((TextWidget)w, event, XawsdLeft, XawstWhiteSpace, False);
-}
-
-static void
-MoveForwardParagraph(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition position = ctx->text.insertPos;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = -mult;
- MoveBackwardParagraph(w, event, p, n);
- return;
- }
-
- while (mult--) {
- position = SrcScan(ctx->text.source, position,
- XawstEOL, XawsdRight, 1, False) - 1;
-
- while (position == SrcScan(ctx->text.source, position,
- XawstEOL, XawsdRight, 1, False))
- if (++position > ctx->text.lastPos) {
- mult = 0;
- break;
- }
-
- position = SrcScan(ctx->text.source, position,
- XawstParagraph, XawsdRight, 1, True);
- if (position != ctx->text.lastPos)
- position = SrcScan(ctx->text.source, position - 1,
- XawstEOL, XawsdLeft, 1, False);
- else
- break;
- }
-
- if (position != ctx->text.insertPos) {
- XawTextUnsetSelection(w);
- StartAction(ctx, event);
- ctx->text.showposition = True;
- ctx->text.from_left = -1;
- ctx->text.insertPos = position;
- EndAction(ctx);
- }
- else
- ctx->text.mult = 1;
-}
-
-/*ARGSUSED*/
-static void
-MoveBackwardParagraph(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition position = ctx->text.insertPos;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = -mult;
- MoveForwardParagraph(w, event, p, n);
- return;
- }
-
- while (mult--) {
- position = SrcScan(ctx->text.source, position,
- XawstEOL, XawsdLeft, 1, False) + 1;
-
- while (position == SrcScan(ctx->text.source, position,
- XawstEOL, XawsdLeft, 1, False))
- if (--position < 0) {
- mult = 0;
- break;
- }
-
- position = SrcScan(ctx->text.source, position,
- XawstParagraph, XawsdLeft, 1, True);
- if (position > 0 && position < ctx->text.lastPos)
- ++position;
- else
- break;
- }
-
- if (position != ctx->text.insertPos) {
- XawTextUnsetSelection(w);
- StartAction(ctx, event);
- ctx->text.showposition = True;
- ctx->text.from_left = -1;
- ctx->text.insertPos = position;
- EndAction(ctx);
- }
- else
- ctx->text.mult = 1;
-}
-
-/*ARGSUSED*/
-static void
-MoveToLineEnd(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Move((TextWidget)w, event, XawsdRight, XawstEOL, False);
-}
-
-/*ARGSUSED*/
-static void
-MoveToLineStart(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Move((TextWidget)w, event, XawsdLeft, XawstEOL, False);
-}
-
-static void
-MoveLine(TextWidget ctx, XEvent *event, XawTextScanDirection dir)
-{
- XawTextPosition cnew, next_line, ltemp;
- int itemp, from_left;
- short mult = MULT(ctx);
-
- StartAction(ctx, event);
-
- XawTextUnsetSelection((Widget)ctx);
-
- if (dir == XawsdLeft)
- mult = mult == 0 ? 5 : mult + 1;
-
- cnew = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstEOL, XawsdLeft, 1, False);
-
- if (ctx->text.from_left < 0)
- FindDist(ctx->text.sink, cnew, ctx->text.left_margin, ctx->text.insertPos,
- &ctx->text.from_left, &ltemp, &itemp);
-
- cnew = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL, dir,
- mult, (dir == XawsdRight));
-
- next_line = SrcScan(ctx->text.source, cnew, XawstEOL, XawsdRight, 1, False);
-
- FindPos(ctx->text.sink, cnew, ctx->text.left_margin, ctx->text.from_left,
- False, &ctx->text.insertPos, &from_left, &itemp);
-
- if (from_left < ctx->text.from_left) {
- XawTextBlock block;
-
- XawTextSourceRead(ctx->text.source, ctx->text.insertPos, &block, 1);
- if (block.length) {
- if (XawTextFormat(ctx, XawFmtWide)) {
- if (*(wchar_t *)block.ptr == _Xaw_atowc(XawTAB))
- ++ctx->text.insertPos;
- }
- else if (block.ptr[0] == XawTAB)
- ++ctx->text.insertPos;
- }
- }
-
- if (ctx->text.insertPos > next_line)
- ctx->text.insertPos = next_line;
-
- EndAction(ctx);
-}
-
-static void
-MoveNextLine(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = -mult;
- MovePreviousLine(w, event, p, n);
- return;
- }
-
- if (ctx->text.insertPos < ctx->text.lastPos)
- MoveLine(ctx, event, XawsdRight);
- else
- ctx->text.mult = 1;
-}
-
-static void
-MovePreviousLine(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = -mult;
- MoveNextLine(w, event, p, n);
- return;
- }
-
- if (ctx->text.lt.top != 0 || (ctx->text.lt.lines > 1 &&
- ctx->text.insertPos >= ctx->text.lt.info[1].position))
- MoveLine(ctx, event, XawsdLeft);
- else
- ctx->text.mult = 1;
-}
-
-/*ARGSUSED*/
-static void
-MoveBeginningOfFile(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Move((TextWidget)w, event, XawsdLeft, XawstAll, True);
-}
-
-/*ARGSUSED*/
-static void
-MoveEndOfFile(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Move((TextWidget)w, event, XawsdRight, XawstAll, True);
-}
-
-static void
-Scroll(TextWidget ctx, XEvent *event, XawTextScanDirection dir)
-{
- short mult = MULT(ctx);
-
- if (mult < 0) {
- mult = -mult;
- dir = dir == XawsdLeft ? XawsdRight : XawsdLeft;
- }
-
- if (ctx->text.lt.lines > 1
- && (dir == XawsdRight
- || ctx->text.lastPos >= ctx->text.lt.info[1].position)) {
- StartAction(ctx, event);
-
- if (dir == XawsdLeft)
- _XawTextVScroll(ctx, mult);
- else
- _XawTextVScroll(ctx, -mult);
-
- EndAction(ctx);
- }
- else {
- ctx->text.mult = 1;
-#ifndef OLDXAW
- ctx->text.numeric = False;
-#endif
- }
-}
-
-/*ARGSUSED*/
-static void
-ScrollOneLineUp(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Scroll((TextWidget)w, event, XawsdLeft);
-}
-
-/*ARGSUSED*/
-static void
-ScrollOneLineDown(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- Scroll((TextWidget)w, event, XawsdRight);
-}
-
-static void
-MovePage(TextWidget ctx, XEvent *event, XawTextScanDirection dir)
-{
- int scroll_val = 0;
- XawTextPosition old_pos;
-
- ctx->text.from_left = -1;
- switch (dir) {
- case XawsdLeft:
- if (ctx->text.lt.top != 0)
- scroll_val = -Max(1, ctx->text.lt.lines - 1);
- break;
- case XawsdRight:
- if (!IsPositionVisible(ctx, Max(0, ctx->text.lastPos)))
- scroll_val = Max(1, ctx->text.lt.lines - 1);
- break;
- }
-
- if (scroll_val)
- XawTextScroll(ctx, scroll_val,
- ctx->text.left_margin - ctx->text.r_margin.left);
-
- old_pos = ctx->text.insertPos;
- switch (dir) {
- case XawsdRight:
- if (IsPositionVisible(ctx, Max(0, ctx->text.lastPos)))
- ctx->text.insertPos = Max(0, ctx->text.lastPos);
- else
- ctx->text.insertPos = ctx->text.lt.top;
- if (ctx->text.insertPos < old_pos)
- ctx->text.insertPos = SrcScan(ctx->text.source, old_pos,
- XawstEOL, XawsdLeft, 1, False);
- break;
- case XawsdLeft:
- if (IsPositionVisible(ctx, 0))
- ctx->text.insertPos = 0;
- else if (ctx->text.lt.lines)
- ctx->text.insertPos =
- ctx->text.lt.info[ctx->text.lt.lines - 1].position;
- else
- ctx->text.insertPos = ctx->text.lt.top;
- if (ctx->text.insertPos > old_pos)
- ctx->text.insertPos = SrcScan(ctx->text.source, old_pos,
- XawstEOL, XawsdLeft, 1, False);
- break;
- }
-}
-
-static void
-MoveNextPage(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = -mult;
- MovePreviousPage(w, event, p, n);
- return;
- }
-
- if (ctx->text.insertPos < ctx->text.lastPos) {
- XawTextUnsetSelection(w);
- StartAction(ctx, event);
- ctx->text.clear_to_eol = True;
- while (mult-- && ctx->text.insertPos < ctx->text.lastPos)
- MovePage(ctx, event, XawsdRight);
- EndAction(ctx);
- }
- else
- ctx->text.mult = 1;
-}
-
-/*ARGSUSED*/
-static void
-MovePreviousPage(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = -mult;
- MoveNextPage(w, event, p, n);
- return;
- }
-
- if (ctx->text.insertPos > 0) {
- XawTextUnsetSelection(w);
- StartAction(ctx, event);
- ctx->text.clear_to_eol = True;
- while (mult-- && ctx->text.insertPos > 0)
- MovePage(ctx, event, XawsdLeft);
- EndAction(ctx);
- }
- else
- ctx->text.mult = 1;
-}
-
-/*
- * Delete Routines
- */
-static Bool
-MatchSelection(Atom selection, XawTextSelection *s)
-{
- Atom *match;
- int count;
-
- for (count = 0, match = s->selections; count < s->atom_count;
- match++, count++)
- if (*match == selection)
- return (True);
-
- return (False);
-}
-
-#define SrcCvtSel XawTextSourceConvertSelection
-
-static Boolean
-ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
- XtPointer *value, unsigned long *length, int *format)
-{
- Display *d = XtDisplay(w);
- TextWidget ctx = (TextWidget)w;
- Widget src = ctx->text.source;
- XawTextEditType edit_mode;
- Arg args[1];
- XawTextSelectionSalt *salt = NULL;
- XawTextSelection *s;
-
- if (*target == XA_TARGETS(d)) {
- Atom *targetP, *std_targets;
- unsigned long std_length;
-
- if (SrcCvtSel(src, selection, target, type, value, length, format))
- return (True);
-
- XmuConvertStandardSelection(w, ctx->text.time, selection,
- target, type, (XPointer *)&std_targets,
- &std_length, format);
-
- *value = XtMalloc((unsigned)sizeof(Atom) * (std_length + 7));
- targetP = *(Atom**)value;
-
- *length = std_length + 6;
- *targetP++ = XA_STRING;
- *targetP++ = XA_TEXT(d);
- *targetP++ = XA_COMPOUND_TEXT(d);
- *targetP++ = XA_LENGTH(d);
- *targetP++ = XA_LIST_LENGTH(d);
- *targetP++ = XA_CHARACTER_POSITION(d);
-
- XtSetArg(args[0], XtNeditType,&edit_mode);
- XtGetValues(src, args, 1);
-
- if (edit_mode == XawtextEdit) {
- *targetP++ = XA_DELETE(d);
- (*length)++;
- }
- memcpy((char*)targetP, (char*)std_targets, sizeof(Atom)*std_length);
- XtFree((char*)std_targets);
- *type = XA_ATOM;
- *format = 32;
- return (True);
- }
-
- if (SrcCvtSel(src, selection, target, type, value, length, format))
- return (True);
-
- for (salt = ctx->text.salt2; salt; salt = salt->next)
- if (MatchSelection (*selection, &salt->s))
- break;
- if (!salt)
- return (False);
- s = &salt->s;
- if (*target == XA_STRING
- || *target == XA_TEXT(d)
- || *target == XA_COMPOUND_TEXT(d)) {
- if (*target == XA_TEXT(d)) {
- if (XawTextFormat(ctx, XawFmtWide))
- *type = XA_COMPOUND_TEXT(d);
- else
- *type = XA_STRING;
- }
- else
- *type = *target;
-
- /*
- * If salt is True, the salt->contents stores CT string,
- * its length is measured in bytes.
- * Refer to _XawTextSaltAwaySelection()
- *
- * by Li Yuhong, Mar. 20, 1991.
- */
- if (!salt) {
- *value = (char *)_XawTextGetSTRING(ctx, s->left, s->right);
- if (XawTextFormat(ctx, XawFmtWide)) {
- XTextProperty textprop;
- if (XwcTextListToTextProperty(d, (wchar_t**)value, 1,
- XCompoundTextStyle, &textprop)
- < Success) {
- XtFree(*value);
- return (False);
- }
- XtFree(*value);
- *value = (XtPointer)textprop.value;
- *length = textprop.nitems;
- }
- else
- *length = strlen(*value);
- }
- else {
- *value = XtMalloc((salt->length + 1) * sizeof(unsigned char));
- strcpy (*value, salt->contents);
- *length = salt->length;
- }
- if (XawTextFormat(ctx, XawFmtWide) && *type == XA_STRING) {
- XTextProperty textprop;
- wchar_t **wlist;
- int count;
-
- textprop.encoding = XA_COMPOUND_TEXT(d);
- textprop.value = (unsigned char *)*value;
- textprop.nitems = strlen(*value);
- textprop.format = 8;
- if (XwcTextPropertyToTextList(d, &textprop, (wchar_t***)&wlist,
- &count) < Success) {
- XtFree(*value);
- return (False);
- }
- XtFree(*value);
- if (XwcTextListToTextProperty(d, (wchar_t**)wlist, 1,
- XStringStyle, &textprop) < Success) {
- XwcFreeStringList((wchar_t**)wlist);
- return (False);
- }
- *value = (XtPointer)textprop.value;
- *length = textprop.nitems;
- XwcFreeStringList((wchar_t**) wlist);
- }
- *format = 8;
- return (True);
- }
-
- if (*target == XA_LIST_LENGTH(d) || *target == XA_LENGTH(d)) {
- long *temp;
-
- temp = (long *)XtMalloc(sizeof(long));
- if (*target == XA_LIST_LENGTH(d))
- *temp = 1L;
- else /* *target == XA_LENGTH(d) */
- *temp = (long)(s->right - s->left);
-
- *value = (XPointer)temp;
- *type = XA_INTEGER;
- *length = 1L;
- *format = 32;
- return (True);
- }
-
- if (*target == XA_CHARACTER_POSITION(d)) {
- long *temp;
-
- temp = (long *) XtMalloc(2 * sizeof(long));
- temp[0] = (long)(s->left + 1);
- temp[1] = s->right;
- *value = (XPointer)temp;
- *type = XA_SPAN(d);
- *length = 2L;
- *format = 32;
- return (True);
- }
-
- if (*target == XA_DELETE(d)) {
- if (!salt)
- _XawTextZapSelection(ctx, NULL, True);
- *value = NULL;
- *type = XA_NULL(d);
- *length = 0;
- *format = 32;
- return (True);
- }
-
- if (XmuConvertStandardSelection(w, ctx->text.time, selection, target, type,
- (XPointer *)value, length, format))
- return (True);
-
- return (False);
-}
-
-static void
-LoseSelection(Widget w, Atom *selection)
-{
- _LoseSelection(w, selection, NULL, NULL);
-}
-
-static void
-_LoseSelection(Widget w, Atom *selection, char **contents, int *length)
-{
- TextWidget ctx = (TextWidget)w;
- Atom *atomP;
- int i;
- XawTextSelectionSalt *salt, *prevSalt, *nextSalt;
-
- prevSalt = 0;
- for (salt = ctx->text.salt2; salt; salt = nextSalt) {
- atomP = salt->s.selections;
- nextSalt = salt->next;
- for (i = 0 ; i < salt->s.atom_count; i++, atomP++)
- if (*selection == *atomP)
- *atomP = (Atom)0;
-
- while (salt->s.atom_count
- && salt->s.selections[salt->s.atom_count-1] == 0)
- salt->s.atom_count--;
-
- /*
- * Must walk the selection list in opposite order from UnsetSelection.
- */
- atomP = salt->s.selections;
- for (i = 0 ; i < salt->s.atom_count; i++, atomP++)
- if (*atomP == (Atom)0) {
- *atomP = salt->s.selections[--salt->s.atom_count];
-
- while (salt->s.atom_count
- && salt->s.selections[salt->s.atom_count-1] == 0)
- salt->s.atom_count--;
- }
- if (salt->s.atom_count == 0) {
-#ifndef OLDXAW
- if (contents == NULL) {
- XawTextKillRing *kill_ring = XtNew(XawTextKillRing);
-
- kill_ring->next = xaw_text_kill_ring;
- kill_ring->contents = salt->contents;
- kill_ring->length = salt->length;
- kill_ring->format = XawFmt8Bit;
- xaw_text_kill_ring = kill_ring;
- kill_ring_prev.next = xaw_text_kill_ring;
-
- if (++num_kill_rings > MAX_KILL_RINGS) {
- XawTextKillRing *tail = NULL;
-
- while (kill_ring->next) {
- tail = kill_ring;
- kill_ring = kill_ring->next;
- }
- if (kill_ring->refcount == 0) {
- --num_kill_rings;
- tail->next = NULL;
- XtFree(kill_ring->contents);
- XtFree((char*)kill_ring);
- }
- }
- }
- else {
- *contents = salt->contents;
- *length = salt->length;
- }
-#endif
- if (prevSalt)
- prevSalt->next = nextSalt;
- else
- ctx->text.salt2 = nextSalt;
-
- XtFree((char *)salt->s.selections);
- XtFree((char *)salt);
- }
- else
- prevSalt = salt;
- }
-}
-
-static void
-_DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to,
- Bool kill)
-{
- XawTextBlock text;
-
-#ifndef OLDXAW
- if (ctx->text.kill_ring_ptr) {
- --ctx->text.kill_ring_ptr->refcount;
- ctx->text.kill_ring_ptr = NULL;
- }
-#endif
- if (kill && from < to) {
-#ifndef OLDXAW
- Bool append = False;
- char *ring = NULL;
- XawTextPosition old_from = from;
-#endif
- char *string;
- int size = 0, length;
- XawTextSelectionSalt *salt;
- Atom selection = XInternAtom(XtDisplay(ctx), "SECONDARY", False);
-
-#ifndef OLDXAW
- if (ctx->text.kill_ring == KILL_RING_APPEND) {
- old_from = ctx->text.salt2->s.left;
- append = True;
- }
- else
- ctx->text.kill_ring = KILL_RING_BEGIN;
-
- if (append)
- _LoseSelection((Widget)ctx, &selection, &ring, &size);
- else
-#endif
- LoseSelection((Widget)ctx, &selection);
-
- salt = (XawTextSelectionSalt*)XtMalloc(sizeof(XawTextSelectionSalt));
- salt->s.selections = (Atom *)XtMalloc(sizeof(Atom));
- salt->s.left = from;
- salt->s.right = to;
-
- string = (char *)_XawTextGetSTRING(ctx, from, to);
-
- if (XawTextFormat(ctx, XawFmtWide)) {
- XTextProperty textprop;
-
- if (XwcTextListToTextProperty(XtDisplay((Widget)ctx),
- (wchar_t**)(&string),
- 1, XCompoundTextStyle,
- &textprop) < Success) {
- XtFree(string);
- XtFree((char*)salt->s.selections);
- XtFree((char*)salt);
- return;
- }
- XtFree(string);
- string = (char *)textprop.value;
- length = textprop.nitems;
- }
- else
- length = strlen(string);
-
- salt->length = length + size;
-
-#ifndef OLDXAW
- if (!append)
- salt->contents = string;
- else {
- salt->contents = XtMalloc(length + size + 1);
- if (from >= old_from) {
- strncpy(salt->contents, ring, size);
- salt->contents[size] = '\0';
- strncat(salt->contents, string, length);
- }
- else {
- strncpy(salt->contents, string, length);
- salt->contents[length] = '\0';
- strncat(salt->contents, ring, size);
- }
- salt->contents[length + size] = '\0';
- XtFree(ring);
- XtFree(string);
- }
-
- kill_ring_prev.contents = salt->contents;
- kill_ring_prev.length = salt->length;
- kill_ring_prev.format = XawFmt8Bit;
-#else
- salt->contents = string;
-#endif
-
- salt->next = ctx->text.salt2;
- ctx->text.salt2 = salt;
-
-#ifndef OLDXAW
- if (append)
- ctx->text.kill_ring = KILL_RING_BEGIN;
-#endif
-
- salt->s.selections[0] = selection;
-
- XtOwnSelection((Widget)ctx, selection, ctx->text.time,
- ConvertSelection, LoseSelection, NULL);
- salt->s.atom_count = 1;
- }
- text.length = 0;
- text.firstPos = 0;
-
- text.format = _XawTextFormat(ctx);
- text.ptr = "";
-
- if (_XawTextReplace(ctx, from, to, &text)) {
- XBell(XtDisplay(ctx), 50);
- return;
- }
- ctx->text.from_left = -1;
- ctx->text.insertPos = from;
- ctx->text.showposition = TRUE;
-}
-
-static void
-DeleteOrKill(TextWidget ctx, XEvent *event, XawTextScanDirection dir,
- XawTextScanType type, Bool include, Bool kill)
-{
- XawTextPosition from, to;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- mult = -mult;
- dir = dir == XawsdLeft ? XawsdRight : XawsdLeft;
- }
-
- StartAction(ctx, event);
-#ifndef OLDXAW
- if (mult == 1)
- _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
-#endif
- to = SrcScan(ctx->text.source, ctx->text.insertPos,
- type, dir, mult, include);
-
- /*
- * If no movement actually happened, then bump the count and try again.
- * This causes the character position at the very beginning and end of
- * a boundary to act correctly
- */
- if (to == ctx->text.insertPos)
- to = SrcScan(ctx->text.source, ctx->text.insertPos,
- type, dir, mult + 1, include);
-
- if (dir == XawsdLeft) {
- from = to;
- to = ctx->text.insertPos;
- }
- else
- from = ctx->text.insertPos;
-
- _DeleteOrKill(ctx, from, to, kill);
- EndAction(ctx);
-}
-
-static void
-Delete(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
-
- if (ctx->text.s.left != ctx->text.s.right)
- DeleteCurrentSelection(w, event, p, n);
- else
- DeleteBackwardChar(w, event, p, n);
-}
-
-static void
-DeleteChar(Widget w, XEvent *event, XawTextScanDirection dir)
-{
- TextWidget ctx = (TextWidget)w;
- short mul = MULT(ctx);
-
- if (mul < 0) {
- ctx->text.mult = mul = -mul;
- dir = dir == XawsdLeft ? XawsdRight : XawsdLeft;
- }
- DeleteOrKill(ctx, event, dir, XawstPositions, True, False);
-#ifndef OLDXAW
- if (mul == 1)
- _XawSourceSetUndoErase((TextSrcObject)ctx->text.source,
- dir == XawsdLeft ? -1 : 1);
-#endif
-}
-
-/*ARGSUSED*/
-static void
-DeleteForwardChar(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- DeleteChar(w, event, XawsdRight);
-}
-
-/*ARGSUSED*/
-static void
-DeleteBackwardChar(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- DeleteChar(w, event, XawsdLeft);
-}
-
-static void
-DeleteForwardWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- XawTextScanType type;
-
- if (*num_params && (*params[0] == 'A' || *params[0] == 'a'))
- type = XawstAlphaNumeric;
- else
- type = XawstWhiteSpace;
-
- DeleteOrKill((TextWidget)w, event, XawsdRight, type, False, False);
-}
-
-static void
-DeleteBackwardWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- XawTextScanType type;
-
- if (*num_params && (*params[0] == 'A' || *params[0] == 'a'))
- type = XawstAlphaNumeric;
- else
- type = XawstWhiteSpace;
-
- DeleteOrKill((TextWidget)w, event, XawsdLeft, type, False, False);
-}
-
-static void
-KillForwardWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- XawTextScanType type;
-
- if (*num_params && (*params[0] == 'A' || *params[0] == 'a'))
- type = XawstAlphaNumeric;
- else
- type = XawstWhiteSpace;
-
- DeleteOrKill((TextWidget)w, event, XawsdRight, type, False, True);
-}
-
-static void
-KillBackwardWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- XawTextScanType type;
-
- if (*num_params && (*params[0] == 'A' || *params[0] == 'a'))
- type = XawstAlphaNumeric;
- else
- type = XawstWhiteSpace;
-
- DeleteOrKill((TextWidget) w, event, XawsdLeft, type, False, True);
-}
-
-/*ARGSUSED*/
-static void
-KillToEndOfLine(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition end_of_line;
- XawTextScanDirection dir = XawsdRight;
- short mult = MULT(ctx);
-
- if (mult < 0) {
- dir = XawsdLeft;
- mult = -mult;
- }
-
- StartAction(ctx, event);
- end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL,
- dir, mult, False);
- if (end_of_line == ctx->text.insertPos)
- end_of_line = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL,
- dir, mult, True);
-
- if (dir == XawsdRight)
- _DeleteOrKill(ctx, ctx->text.insertPos, end_of_line, True);
- else
- _DeleteOrKill(ctx, end_of_line, ctx->text.insertPos, True);
- EndAction(ctx);
-}
-
-/*ARGSUSED*/
-static void
-KillToEndOfParagraph(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- DeleteOrKill((TextWidget)w, event, XawsdRight, XawstParagraph, False, True);
-}
-
-void
-_XawTextZapSelection(TextWidget ctx, XEvent *event, Bool kill)
-{
- StartAction(ctx, event);
- _DeleteOrKill(ctx, ctx->text.s.left, ctx->text.s.right, kill);
- EndAction(ctx);
-}
-
-/*ARGSUSED*/
-static void
-KillCurrentSelection(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- _XawTextZapSelection((TextWidget) w, event, True);
-}
-
-#ifndef OLDXAW
-/*ARGSUSED*/
-static void
-KillRingYank(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition insertPos = ctx->text.insertPos;
- Bool first_yank = False;
-
- if (ctx->text.s.left != ctx->text.s.right)
- XawTextUnsetSelection((Widget)ctx);
-
- StartAction(ctx, event);
-
- if (ctx->text.kill_ring_ptr == NULL) {
- ctx->text.kill_ring_ptr = &kill_ring_prev;
- ++ctx->text.kill_ring_ptr->refcount;
- ctx->text.s.left = ctx->text.s.right = insertPos;
- first_yank = True;
- }
- if (ctx->text.kill_ring_ptr) {
- int mul = MULT(ctx);
- XawTextBlock text;
-
- if (!first_yank) {
- if (mul < 0)
- mul = 1;
- --ctx->text.kill_ring_ptr->refcount;
- while (mul--) {
- if ((ctx->text.kill_ring_ptr = ctx->text.kill_ring_ptr->next) == NULL)
- ctx->text.kill_ring_ptr = &kill_ring_null;
- }
- ++ctx->text.kill_ring_ptr->refcount;
- }
- text.firstPos = 0;
- text.length = ctx->text.kill_ring_ptr->length;
- text.ptr = ctx->text.kill_ring_ptr->contents;
- text.format = ctx->text.kill_ring_ptr->format;
-
- if (_XawTextReplace(ctx, ctx->text.s.left, insertPos, &text) == XawEditDone) {
- ctx->text.kill_ring = KILL_RING_YANK;
- ctx->text.insertPos = ctx->text.s.left + text.length;
- }
- }
- else
- XBell(XtDisplay(w), 0);
-
- EndAction(ctx);
-}
-#endif /* OLDXAW */
-
-/*ARGSUSED*/
-static void
-DeleteCurrentSelection(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- _XawTextZapSelection((TextWidget)w, event, False);
-}
-
-#ifndef OLDXAW
-#define CHECK_SAVE() \
- if (save && !save->ptr) \
- save->ptr = _XawTextGetText(ctx, save->firstPos, \
- save->firstPos + save->length)
-static Bool
-StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right,
- XawTextPosition *pos, int num_pos, XawTextBlock *save)
-{
- Bool done, space;
- int i, cpos, count = 0;
- XawTextBlock block, text;
- XawTextPosition ipos, position = left, tmp = left;
-
- text.firstPos = 0;
- text.format = XawFmt8Bit;
- text.ptr = " ";
- text.length = 1;
-
- position = XawTextSourceRead(ctx->text.source, position,
- &block, right - left);
- done = False;
- space = False;
- /* convert tabs and returns to spaces */
- while (!done) {
- if (XawTextFormat(ctx, XawFmt8Bit)) {
- for (i = 0; i < block.length; i++)
- if (block.ptr[i] == '\t' || block.ptr[i] == '\n') {
- space = True;
- break;
- }
- }
- else {
- wchar_t *wptr = (wchar_t*)block.ptr;
- for (i = 0; i < block.length; i++)
- if (wptr[i] == _Xaw_atowc('\t') || wptr[i] == _Xaw_atowc('\n')) {
- space = True;
- break;
- }
- }
- if (space) {
- CHECK_SAVE();
- if (_XawTextReplace(ctx, tmp + i, tmp + i + 1, &text))
- return (False);
- space = False;
- }
- tmp += i;
- position = XawTextSourceRead(ctx->text.source, tmp,
- &block, right - tmp);
- if (block.length == 0 || tmp == position || tmp >= right)
- done = True;
- }
-
- text.ptr = "";
- text.length = 0;
- position = tmp = left;
- position = XawTextSourceRead(ctx->text.source, position,
- &block, right - left);
- ipos = ctx->text.insertPos;
- done = False;
- while (!done) {
- if (XawTextFormat(ctx, XawFmt8Bit)) {
- for (i = 0; i < block.length; i++)
- if (block.ptr[i] == ' ')
- ++count;
- else if (count == 1)
- count = 0;
- else if (count)
- break;
- }
- else {
- wchar_t *wptr = (wchar_t*)block.ptr;
- for (i = 0; i < block.length; i++)
- if (wptr[i] == _Xaw_atowc(' '))
- ++count;
- else if (count == 1)
- count = 0;
- else if (count)
- break;
- }
- if (--count > 0) {
- CHECK_SAVE();
- if (_XawTextReplace(ctx, tmp + i - count, tmp + i, &text))
- return (False);
- right -= count;
- if (num_pos) {
- for (cpos = 0; cpos < num_pos; cpos++) {
- if (tmp + i - count < pos[cpos]) {
- if (tmp + i < pos[cpos])
- pos[cpos] -= count;
- else
- pos[cpos] = tmp + i - count;
- }
- }
- }
- else {
- if (tmp + i - count < ipos) {
- if (tmp + i < ipos)
- ipos -= count;
- else
- ipos = tmp + i - count;
- }
- }
- tmp += i - count;
- }
- else
- tmp += i + 1;
- count = 0;
- position = XawTextSourceRead(ctx->text.source, tmp,
- &block, right - tmp);
- if (block.length == 0 || tmp == position || tmp >= right)
- done = True;
- }
- if (!num_pos)
- ctx->text.insertPos = ipos;
-
- return (True);
-}
-
-static Bool
-Tabify(TextWidget ctx, XawTextPosition left, XawTextPosition right,
- XawTextPosition *pos, int num_pos, XawTextBlock *save)
-{
- Bool done, zero;
- int i, cpos, count = 0, column = 0, offset = 0;
- XawTextBlock text, block;
- XawTextPosition ipos, position = left, tmp = left;
- TextSinkObject sink = (TextSinkObject)ctx->text.sink;
- short *char_tabs = sink->text_sink.char_tabs;
- int tab_count = sink->text_sink.tab_count;
- int tab_index = 0, tab_column = 0, TAB_SIZE = DEFAULT_TAB_SIZE;
-
- text.firstPos = 0;
- text.ptr = "\t";
- text.format = XawFmt8Bit;
- text.length = 1;
-
- position = XawTextSourceRead(ctx->text.source, position,
- &block, right - left);
- ipos = ctx->text.insertPos;
- done = zero = False;
- if (tab_count)
- TAB_SIZE = *char_tabs;
- while (!done) {
- if (XawTextFormat(ctx, XawFmt8Bit)) {
- for (i = 0; i < block.length; i++) {
- ++offset;
- ++column;
- if (tab_count) {
- if (column > tab_column + char_tabs[tab_index]) {
- TAB_SIZE = tab_index < tab_count - 1 ? char_tabs[tab_index + 1] - char_tabs[tab_index] : *char_tabs;
- if (++tab_index >= tab_count) {
- tab_column += char_tabs[tab_count - 1];
- tab_index = 0;
- }
- }
- }
- if (block.ptr[i] == ' ') {
- if (++count > TAB_SIZE)
- count %= TAB_SIZE;
- if ((tab_count && column == tab_column + char_tabs[tab_index]) ||
- (!tab_count && column % TAB_SIZE == 0)) {
- if (count % (TAB_SIZE + 1) > 1)
- break;
- else
- count = 0;
- }
- }
- else {
- if (block.ptr[i] == '\n') {
- zero = True;
- break;
- }
- count = 0;
- }
- }
- }
- else {
- wchar_t *wptr = (wchar_t*)block.ptr;
- for (i = 0; i < block.length; i++) {
- ++offset;
- ++column;
- if (tab_count) {
- if (column > tab_column + char_tabs[tab_index]) {
- TAB_SIZE = tab_index < tab_count - 1 ? char_tabs[tab_index + 1] - char_tabs[tab_index] : *char_tabs;
- if (++tab_index >= tab_count) {
- tab_column += char_tabs[tab_count - 1];
- tab_index = 0;
- }
- }
- }
- if (wptr[i] == _Xaw_atowc(' ')) {
- if (++count > TAB_SIZE)
- count %= TAB_SIZE;
- if ((tab_count && column == tab_column + char_tabs[tab_index]) ||
- (!tab_count && column % TAB_SIZE == 0)) {
- if (count % (TAB_SIZE + 1) > 1)
- break;
- else
- count = 0;
- }
- }
- else {
- if (wptr[i] == _Xaw_atowc('\n')) {
- zero = True;
- break;
- }
- count = 0;
- }
- }
- }
- count %= TAB_SIZE + 1;
- if (!zero && count > 1 && i < block.length) {
- CHECK_SAVE();
- if (_XawTextReplace(ctx, tmp + i - count + 1, tmp + i + 1, &text))
- return (False);
- right -= count - 1;
- offset -= count - 1;
- if (num_pos) {
- for (cpos = 0; cpos < num_pos; cpos++) {
- if (tmp + i - count + 1 < pos[cpos]) {
- if (tmp + i + 1 < pos[cpos])
- pos[cpos] -= count;
- else
- pos[cpos] = tmp + i - count + 1;
- ++pos[cpos];
- }
- }
- }
- else {
- if (tmp + i - count + 1 < ipos) {
- if (tmp + i + 1 < ipos)
- ipos -= count;
- else
- ipos = tmp + i - count + 1;
- ++ipos;
- }
- }
- }
- if (count)
- --count;
- if (zero) {
- count = column = 0;
- zero = False;
- if (tab_count) {
- tab_column = tab_index = 0;
- TAB_SIZE = *char_tabs;
- }
- }
- else if (i < block.length)
- count = 0;
- tmp = left + offset;
- position = XawTextSourceRead(ctx->text.source, tmp,
- &block, right - tmp);
- if (tmp == position || tmp >= right)
- done = True;
- }
- if (!num_pos)
- ctx->text.insertPos = ipos;
-
- return (True);
-}
-
-static Bool
-Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right,
- XawTextPosition *pos, int num_pos, XawTextBlock *save)
-{
- Bool done, zero;
- int i, cpos, count = 0, diff = 0;
- XawTextBlock block, text;
- XawTextPosition ipos, position = left, tmp = left;
- TextSinkObject sink = (TextSinkObject)ctx->text.sink;
- short *char_tabs = sink->text_sink.char_tabs;
- int tab_count = sink->text_sink.tab_count;
- int tab_index = 0, tab_column = 0, tab_base = 0;
- static char *tabs = " ";
-
- text.firstPos = 0;
- text.format = XawFmt8Bit;
- text.ptr = tabs;
-
- position = XawTextSourceRead(ctx->text.source, position,
- &block, right - left);
- ipos = ctx->text.insertPos;
- done = False;
- zero = False;
- while (!done) {
- if (XawTextFormat(ctx, XawFmt8Bit))
- for (i = 0; i < block.length; i++) {
- if (block.ptr[i] != '\t') {
- ++count;
- if (block.ptr[i] == '\n') {
- zero = True;
- break;
- }
- }
- else
- break;
- }
- else {
- wchar_t *wptr = (wchar_t*)block.ptr;
- for (i = 0; i < block.length; i++)
- if (wptr[i] != _Xaw_atowc('\t')) {
- ++count;
- if (wptr[i] != _Xaw_atowc('\n')) {
- zero = True;
- break;
- }
- }
- else
- break;
- }
- if (!zero && i < block.length) {
- if (tab_count) {
- while (tab_base + tab_column <= count) {
- for (; tab_index < tab_count; ++tab_index)
- if (tab_base + char_tabs[tab_index] > count) {
- tab_column = char_tabs[tab_index];
- break;
- }
- if (tab_index >= tab_count) {
- tab_base += char_tabs[tab_count - 1];
- tab_column = tab_index = 0;
- }
- }
- text.length = (tab_base + tab_column) - count;
- if (text.length > 8) {
- int j;
-
- text.ptr = XtMalloc(text.length);
- for (j = 0; j < text.length; j++)
- text.ptr[j] = ' ';
- }
- else
- text.ptr = tabs;
- }
- else
- text.length = DEFAULT_TAB_SIZE - (count % DEFAULT_TAB_SIZE);
- CHECK_SAVE();
- if (_XawTextReplace(ctx, tmp + i, tmp + i + 1, &text)) {
- if (tab_count && text.length > 8)
- XtFree(text.ptr);
- return (False);
- }
- if (tab_count && text.length > 8)
- XtFree(text.ptr);
- count += text.length;
- right += text.length - 1;
- if (num_pos) {
- for (cpos = 0; cpos < num_pos; cpos++) {
- if (tmp + i < pos[cpos]) {
- if (tmp + i + 1 < pos[cpos])
- --pos[cpos];
- else
- pos[cpos] = tmp + i;
- pos[cpos] += text.length;
- }
- }
- }
- else {
- if (tmp + i < ipos) {
- if (tmp + i + 1 < ipos)
- --ipos;
- else
- ipos = tmp + i;
- ipos += text.length;
- }
- }
- }
- tmp = left + count + diff;
- if (zero) {
- diff += count;
- count = 0;
- zero = False;
- if (tab_count)
- tab_base = tab_column = tab_index = 0;
- }
- position = XawTextSourceRead(ctx->text.source, tmp,
- &block, right - tmp);
- if (tmp == position || tmp >= right)
- done = True;
- }
- if (!num_pos)
- ctx->text.insertPos = ipos;
-
- return (True);
-}
-
-static int
-FormatText(TextWidget ctx, XawTextPosition left, Bool force,
- XawTextPosition *pos, int num_pos)
-{
- char *ptr = NULL;
- Bool freepos = False, undo, paragraph = pos != NULL;
- int i, result;
- XawTextBlock block, *text;
- XawTextPosition end = ctx->text.lastPos, buf[32];
- TextSrcObject src = (TextSrcObject)ctx->text.source;
- XawTextPosition right = SrcScan(ctx->text.source, left, XawstEOL,
- XawsdRight, 1, False);
-
- undo = src->textSrc.enable_undo && src->textSrc.undo_state == False;
- if (undo) {
- if (!pos) {
- num_pos = src->textSrc.num_text;
- pos = XawStackAlloc(sizeof(XawTextPosition) * num_pos, buf);
- for (i = 0; i < num_pos; i++)
- pos[i] = ((TextWidget)src->textSrc.text[i])->text.insertPos;
- freepos = True;
- }
- else
- freepos = False;
- src->textSrc.undo_state = True;
- block.ptr = NULL;
- block.firstPos = left;
- block.length = right - left;
- text = &block;
- }
- else
- text = NULL;
-
- result = DoFormatText(ctx, left, force, 1, text, pos, num_pos, paragraph);
- if (undo && result == XawEditDone && block.ptr) {
- char *lbuf, *rbuf;
- unsigned llen, rlen, size;
-
- ptr = lbuf = block.ptr;
- llen = block.length;
- rlen = llen + (ctx->text.lastPos - end);
-
- block.firstPos = 0;
- block.format = _XawTextFormat(ctx);
-
- rbuf = _XawTextGetText(ctx, left, left + rlen);
-
- size = XawTextFormat(ctx, XawFmtWide) ? sizeof(wchar_t) : sizeof(char);
- if (llen != rlen || memcmp(lbuf, rbuf, llen * size)) {
- block.ptr = lbuf;
- block.length = llen;
- _XawTextReplace(ctx, left, left + rlen, &block);
-
- src->textSrc.undo_state = False;
- block.ptr = rbuf;
- block.length = rlen;
- _XawTextReplace(ctx, left, left + llen, &block);
- }
- else
- src->textSrc.undo_state = False;
- XtFree(rbuf);
- }
- if (undo) {
- src->textSrc.undo_state = False;
- if (freepos) {
- for (i = 0; i < num_pos; i++) {
- TextWidget tw = (TextWidget)src->textSrc.text[i];
- tw->text.insertPos = XawMin(XawMax(0, pos[i]), tw->text.lastPos);
- }
- XawStackFree(pos, buf);
- }
- if (ptr)
- XtFree(ptr);
- }
-
- return (result);
-}
-
-static int
-DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level,
- XawTextBlock *save, XawTextPosition *pos, int num_pos,
- Bool paragraph)
-{
- XawTextPosition right = SrcScan(ctx->text.source, left, XawstEOL,
- XawsdRight, 1, False);
- XawTextPosition position, tmp, ipos;
- XawTextBlock block, text;
- char buf[128];
- wchar_t *wptr;
- int i, count, cpos;
- Bool done, force2 = force, recurse = False;
-
- position = XawTextSourceRead(ctx->text.source, left, &block, right - left);
- if (block.length == 0 || left >= right ||
- (level == 1 && ((XawTextFormat(ctx, XawFmt8Bit) &&
- block.ptr[0] != ' ' &&
- block.ptr[0] != '\t' &&
- !isalnum(*(unsigned char*)block.ptr)) ||
- (XawTextFormat(ctx, XawFmtWide) &&
- _Xaw_atowc(XawSP) != *(wchar_t*)block.ptr &&
- _Xaw_atowc(XawTAB) != *(wchar_t*)block.ptr &&
- !iswalnum(*(wchar_t*)block.ptr)))))
- return (XawEditDone);
-
- if (level == 1 && !paragraph) {
- tmp = ctx->text.lastPos;
- if (Untabify(ctx, left, right, pos, num_pos, save) == False)
- return (XawEditError);
- right += ctx->text.lastPos - tmp;
- position = XawTextSourceRead(ctx->text.source, left, &block,
- right - left);
- }
-
- text.firstPos = 0;
- text.format = XawFmt8Bit;
-
- ipos = ctx->text.insertPos;
- count = 0;
- done = False;
- while (!done) {
- if (XawTextFormat(ctx, XawFmt8Bit)) {
- for (i = 0; i < block.length; i++)
- if (block.ptr[i] == ' ')
- ++count;
- else {
- done = True;
- break;
- }
- }
- else {
- wptr = (wchar_t*)block.ptr;
- for (i = 0; i < block.length; i++)
- if (wptr[i] == _Xaw_atowc(' '))
- ++count;
- else {
- done = True;
- break;
- }
- }
- tmp = position;
- position = XawTextSourceRead(ctx->text.source, position,
- &block, right - position);
- if (tmp == position)
- done = True;
- }
- position = left + count;
- if (count < ctx->text.left_column) {
- int bytes = ctx->text.left_column - count;
-
- text.ptr = XawStackAlloc(bytes, buf);
- text.length = bytes;
- for (i = 0; i < bytes; i++)
- text.ptr[i] = ' ';
- CHECK_SAVE();
- if (_XawTextReplace(ctx, left, left, &text)) {
- XawStackFree(text.ptr, buf);
- return (XawEditError);
- }
- XawStackFree(text.ptr, buf);
- right += bytes;
- if (num_pos) {
- for (cpos = 0; cpos < num_pos; cpos++)
- if (pos[cpos] >= left)
- pos[cpos] += bytes;
- }
- if (ipos >= left)
- ipos += bytes;
- count += bytes;
- }
-
- done = False;
- if (!paragraph && level == 1
- && ipos <= right && ipos - left > ctx->text.right_column) {
- XawTextPosition len = ctx->text.lastPos;
- int skip = ctx->text.justify == XawjustifyRight
- || ctx->text.justify == XawjustifyCenter ?
- ctx->text.left_column : count;
-
- if (pos)
- for (i = 0; i < num_pos; i++)
- if (pos[i] == ipos)
- break;
-
- StripSpaces(ctx, left + skip, right, pos, num_pos, save);
- right += ctx->text.lastPos - len;
- if (pos && i < num_pos)
- ipos = pos[i];
- else
- ipos = ctx->text.insertPos;
- done = ipos - left > ctx->text.right_column;
- count = skip + (count == skip + 1);
- }
- if ((paragraph || done) && right - left > ctx->text.right_column) {
- position = tmp = right;
- XawTextSourceRead(ctx->text.source, position - 1, &block, 1);
- if (block.length &&
- ((XawTextFormat(ctx, XawFmt8Bit) &&
- block.ptr[0] == ' ') ||
- (XawTextFormat(ctx, XawFmtWide) &&
- _Xaw_atowc(XawSP) == *(wchar_t*)block.ptr)))
- --position;
- while (position - left > ctx->text.right_column) {
- tmp = position;
- position = SrcScan(ctx->text.source, position,
- XawstWhiteSpace, XawsdLeft, 1, True);
- }
- if (position <= left + ctx->text.left_column)
- position = tmp;
- if (position > left && position - left > ctx->text.left_column
- && position != right) {
- text.ptr = "\n";
- text.length = 1;
- CHECK_SAVE();
- if (_XawTextReplace(ctx, position, position + 1, &text))
- return (XawEditError);
- right = position;
- recurse = True;
- force = True;
- }
- }
-
- if (force) {
- if (ctx->text.justify == XawjustifyCenter)
- count = ctx->text.right_column - (count - ctx->text.left_column);
- else
- count = ctx->text.right_column;
- if (count > right - left)
- count -= right - left;
- else
- count = 0;
- }
- else
- count = 0;
- if (count > 0) {
- switch (ctx->text.justify) {
- case XawjustifyLeft:
- break;
- case XawjustifyRight:
- case XawjustifyCenter:
- if (ctx->text.justify == XawjustifyCenter) {
- int alnum = 0;
-
- if (!(count & 1)) {
- XawTextSourceRead(ctx->text.source, right, &block, 1);
- if ((XawTextFormat(ctx, XawFmt8Bit)
- && isalnum(*(unsigned char*)block.ptr)) ||
- (XawTextFormat(ctx, XawFmtWide)
- && iswalnum(*(wchar_t*)block.ptr)))
- alnum = 1;
- }
- count = (count + alnum) >> 1;
- }
- text.ptr = XawStackAlloc(count, buf);
- text.length = count;
- for (i = 0; i < count; i++)
- text.ptr[i] = ' ';
- CHECK_SAVE();
- if (_XawTextReplace(ctx, left, left, &text)) {
- XawStackFree(text.ptr, buf);
- return (XawEditError);
- }
- XawStackFree(text.ptr, buf);
- position += count;
- right += count;
- if (num_pos) {
- for (cpos = 0; cpos < num_pos; cpos++)
- if (pos[cpos] > left)
- pos[cpos] += count;
- }
- else if (ipos > left)
- ipos += count;
- break;
- case XawjustifyFull:
- i = 0;
- tmp = left;
- /*CONSTCOND*/
- while (True) {
- tmp = SrcScan(ctx->text.source, tmp, XawstWhiteSpace,
- XawsdRight, 1, True);
- if (tmp < right)
- ++i;
- else
- break;
- }
- if (i) {
- double inc, ii;
- int bytes, steps;
-
- bytes = count;
- inc = ii = (count + .5) / (double)i;
-
- steps = count;
- text.ptr = XawStackAlloc(steps, buf);
- for (i = 0; i < steps; i++)
- text.ptr[i] = ' ';
- tmp = left;
- CHECK_SAVE();
- while (bytes) {
- steps = 1;
- while (inc + ii < 1) {
- ++steps;
- inc += ii;
- }
- tmp = SrcScan(ctx->text.source, tmp, XawstWhiteSpace,
- XawsdRight, steps, True);
- if (bytes > inc)
- text.length = (int)inc;
- else
- text.length = bytes;
- bytes -= text.length;
- if (_XawTextReplace(ctx, tmp, tmp, &text)) {
- XawStackFree(buf, text.ptr);
- return (XawEditError);
- }
- if (num_pos) {
- for (cpos = 0; cpos < num_pos; cpos++)
- if (tmp <= pos[cpos])
- pos[cpos] += text.length;
- }
- else if (tmp <= ipos)
- ipos += text.length;
- inc -= (int)inc;
- inc += ii;
- }
- position += count;
- right += count;
- XawStackFree(buf, text.ptr);
- }
- break;
- }
- }
-
- if (!num_pos)
- ctx->text.insertPos = XawMin(ipos, ctx->text.lastPos);
-
- return (recurse ? DoFormatText(ctx, position + 1,
- ctx->text.justify != XawjustifyFull
- && (force2 || paragraph),
- ++level, save, pos, num_pos, paragraph)
- : XawEditDone);
-}
-#undef CHECK_SAVE
-
-/*ARGSUSED*/
-static void
-Indent(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- TextSrcObject src = (TextSrcObject)ctx->text.source;
- XawTextPosition from, to, tmp, end = 0, *pos, *posbuf[32];
- char buf[32];
- XawTextBlock text;
- int i, spaces = MULT(ctx);
- char *lbuf = NULL, *rbuf;
- unsigned llen = 0, rlen, size;
- Bool undo = src->textSrc.enable_undo && src->textSrc.undo_state == False;
- Bool format = ctx->text.auto_fill
- && ctx->text.left_column < ctx->text.right_column;
-
- text.firstPos = 0;
- text.format = XawFmt8Bit;
- text.ptr = "";
-
- StartAction(ctx, event);
-
- pos = XawStackAlloc(sizeof(XawTextPosition) * src->textSrc.num_text, posbuf);
- for (i = 0; i < src->textSrc.num_text; i++)
- pos[i] = ((TextWidget)src->textSrc.text[i])->text.insertPos;
-
- if (!GetBlockBoundaries(ctx, &from, &to)) {
- EndAction(ctx);
- XawStackFree(pos, posbuf);
- return;
- }
-
- if (undo) {
- llen = to - from;
- end = ctx->text.lastPos;
- lbuf = _XawTextGetText(ctx, from, to);
- src->textSrc.undo_state = True;
- }
-
- tmp = ctx->text.lastPos;
- if (!Untabify(ctx, from, to, pos, src->textSrc.num_text, NULL)) {
- XBell(XtDisplay(ctx), 0);
- EndAction(ctx);
- XawStackFree(pos, posbuf);
- if (undo) {
- src->textSrc.undo_state = True;
- XtFree(lbuf);
- }
- return;
- }
- to += ctx->text.lastPos - tmp;
-
- tmp = from;
-
- if (spaces > 0) {
- text.ptr = XawStackAlloc(spaces, buf);
- for (i = 0; i < spaces; i++)
- text.ptr[i] = ' ';
-
- text.length = spaces;
- while (tmp < to) {
- _XawTextReplace(ctx, tmp, tmp, &text);
-
- for (i = 0; i < src->textSrc.num_text; i++)
- if (tmp < pos[i])
- pos[i] += spaces;
-
- to += spaces;
- tmp = SrcScan(ctx->text.source, tmp, XawstEOL, XawsdRight, 1, True);
- }
- XawStackFree(text.ptr, buf);
- }
- else {
- int min = 32767;
-
- text.length = 0;
- tmp = from;
-
- /* find the amount of spaces to cut */
- while (tmp < to) {
- (void)BlankLine(w, tmp, &i);
- if (i < min)
- min = i;
- tmp = SrcScan(ctx->text.source, tmp, XawstEOL, XawsdRight, 1, True);
- }
- spaces = XawMin(-spaces, min);
-
- /* cut the spaces */
- tmp = from;
- while (tmp < to) {
- _XawTextReplace(ctx, tmp, tmp + spaces, &text);
-
- for (i = 0; i < src->textSrc.num_text; i++)
- if (tmp < pos[i]) {
- if (tmp + spaces < pos[i])
- pos[i] -= spaces;
- else
- pos[i] = tmp;
- }
-
- to -= spaces;
- tmp = SrcScan(ctx->text.source, tmp, XawstEOL, XawsdRight, 1, True);
- }
- }
-
- if (!format)
- Tabify(ctx, from, to, pos, src->textSrc.num_text, NULL);
-
- if (undo) {
- rlen = llen + (ctx->text.lastPos - end);
- rbuf = _XawTextGetText(ctx, from, from + rlen);
-
- text.format = _XawTextFormat(ctx);
- size = XawTextFormat(ctx, XawFmtWide) ? sizeof(wchar_t) : sizeof(char);
- if (llen != rlen || memcmp(lbuf, rbuf, llen * size)) {
- text.ptr = lbuf;
- text.length = llen;
- _XawTextReplace(ctx, from, from + rlen, &text);
-
- src->textSrc.undo_state = False;
- text.ptr = rbuf;
- text.length = rlen;
- _XawTextReplace(ctx, from, from + llen, &text);
- }
- else
- src->textSrc.undo_state = False;
- XtFree(lbuf);
- XtFree(rbuf);
- }
-
- for (i = 0; i < src->textSrc.num_text; i++) {
- TextWidget tw = (TextWidget)src->textSrc.text[i];
-
- tw->text.insertPos = XawMin(XawMax(0, pos[i]), tw->text.lastPos);
- }
- XawStackFree(pos, posbuf);
- ctx->text.showposition = True;
-
- EndAction(ctx);
-}
-
-/*ARGSUSED*/
-static void
-ToggleOverwrite(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
- ctx->text.overwrite = !ctx->text.overwrite;
-
- /* call information callback */
- _XawTextSetLineAndColumnNumber(ctx, True);
-}
-#endif /* OLDXAW */
-
-/*
- * Insertion Routines
- */
-static int
-InsertNewLineAndBackupInternal(TextWidget ctx)
-{
- int count, error = XawEditDone, mult = MULT(ctx);
- XawTextPosition position;
- XawTextBlock text;
- char buf[32];
-
- if (mult < 0) {
- ctx->text.mult = 1;
- return (XawEditError);
- }
-
- text.format = _XawTextFormat(ctx);
- text.length = mult;
- text.firstPos = 0;
-
- if (text.format == XawFmtWide) {
- wchar_t *wptr;
-
- text.ptr = XawStackAlloc(sizeof(wchar_t) * mult, buf);
- wptr = (wchar_t *)text.ptr;
- for (count = 0; count < mult; count++)
- wptr[count] = _Xaw_atowc(XawLF);
- }
- else {
- text.ptr = XawStackAlloc(sizeof(char) * mult, buf);
- for (count = 0; count < mult; count++)
- text.ptr[count] = XawLF;
- }
-
- position = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstEOL, XawsdLeft, 1, False);
- if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
- XBell( XtDisplay(ctx), 50);
- error = XawEditError;
- }
- else {
- ctx->text.showposition = TRUE;
- ctx->text.insertPos += text.length;
- }
-
- XawStackFree(text.ptr, buf);
-
-#ifndef OLDXAW
- if (ctx->text.auto_fill && error == XawEditDone)
- (void)FormatText(ctx, position, ctx->text.justify != XawjustifyFull,
- NULL, 0);
-#endif
-
- return (error);
-}
-
-/*ARGSUSED*/
-static void
-InsertNewLineAndBackup(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition insertPos = ctx->text.insertPos;
-
- StartAction((TextWidget)w, event);
- (void)InsertNewLineAndBackupInternal(ctx);
- ctx->text.insertPos = SrcScan(ctx->text.source, insertPos, XawstEOL,
- XawsdRight, 1, False);
- EndAction((TextWidget)w);
-}
-
-static int
-LocalInsertNewLine(TextWidget ctx, XEvent *event)
-{
- int error;
-
- StartAction(ctx, event);
- error = InsertNewLineAndBackupInternal(ctx);
- ctx->text.from_left = -1;
- EndAction(ctx);
-
- return (error);
-}
-
-/*ARGSUSED*/
-static void
-InsertNewLine(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- (void)LocalInsertNewLine((TextWidget)w, event);
-}
-
-/*ARGSUSED*/
-static void
-InsertNewLineAndIndent(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- XawTextBlock text;
- XawTextPosition pos1;
- int length;
- TextWidget ctx = (TextWidget)w;
- String line_to_ip;
-
- StartAction(ctx, event);
- pos1 = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstEOL, XawsdLeft, 1, False);
-
- line_to_ip = _XawTextGetText(ctx, pos1, ctx->text.insertPos);
-
- text.format = _XawTextFormat(ctx);
- text.firstPos = 0;
-
- if (text.format == XawFmtWide) {
- wchar_t *ptr;
-
- text.ptr = XtMalloc((2 + wcslen((wchar_t*)line_to_ip))
- * sizeof(wchar_t));
- ptr = (wchar_t*)text.ptr;
- ptr[0] = _Xaw_atowc(XawLF);
- wcscpy((wchar_t*)++ptr, (wchar_t*)line_to_ip);
-
- length = wcslen((wchar_t*)text.ptr);
- while (length && (iswspace(*ptr) || *ptr == _Xaw_atowc(XawTAB)))
- ptr++, length--;
- *ptr = (wchar_t)0;
- text.length = wcslen((wchar_t*)text.ptr);
- }
- else {
- char *ptr;
-
- length = strlen(line_to_ip);
- text.ptr = XtMalloc((2 + length) * sizeof(char));
- ptr = text.ptr;
- ptr[0] = XawLF;
- strcpy(++ptr, line_to_ip);
-
- length++;
- while (length && (isspace(*ptr) || (*ptr == XawTAB)))
- ptr++, length--;
- *ptr = '\0';
- text.length = strlen(text.ptr);
- }
- XtFree(line_to_ip);
-
- if (_XawTextReplace(ctx,ctx->text.insertPos, ctx->text.insertPos, &text)) {
- XBell(XtDisplay(ctx), 50);
- XtFree(text.ptr);
- EndAction(ctx);
- return;
- }
-
- XtFree(text.ptr);
- ctx->text.from_left = -1;
- ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
- XawstPositions, XawsdRight, text.length, True);
- EndAction(ctx);
-}
-
-/*
- * Selection Routines
- */
-static void
-SelectWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition l, r;
-
- StartAction(ctx, event);
- l = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstWhiteSpace, XawsdLeft, 1, False);
- r = SrcScan(ctx->text.source, l, XawstWhiteSpace, XawsdRight, 1, False);
- _XawTextSetSelection(ctx, l, r, params, *num_params);
- EndAction(ctx);
-}
-
-static void
-SelectAll(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
- StartAction(ctx, event);
- _XawTextSetSelection(ctx,zeroPosition,ctx->text.lastPos,params,*num_params);
- EndAction(ctx);
-}
-
-static void
-ModifySelection(TextWidget ctx, XEvent *event,
- XawTextSelectionMode mode,
- XawTextSelectionAction action,
- String *params, Cardinal *num_params)
-{
- int old_y = ctx->text.ev_y;
-
- StartAction(ctx, event);
- NotePosition(ctx, event);
-
- if (event->type == MotionNotify) {
- if (ctx->text.ev_y <= ctx->text.margin.top) {
- if (old_y >= ctx->text.ev_y)
- XawTextScroll(ctx, -1, 0);
- }
- else if (ctx->text.ev_y >= XtHeight(ctx) - ctx->text.margin.bottom) {
- if (old_y <= ctx->text.ev_y
- && !IsPositionVisible(ctx, ctx->text.lastPos))
- XawTextScroll(ctx, 1, 0);
- }
- }
- ctx->text.from_left = -1;
-
- _XawTextAlterSelection(ctx, mode, action, params, num_params);
-
- EndAction(ctx);
-}
-
-static void
-SelectStart(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
-#ifndef OLDXAW
- if (!ctx->text.selection_state) {
- ctx->text.selection_state = True;
-#endif
- ModifySelection(ctx, event,
- XawsmTextSelect, XawactionStart, params, num_params);
-#ifndef OLDXAW
- }
-#endif
-}
-
-static void
-SelectAdjust(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
-#ifndef OLDXAW
- if (ctx->text.selection_state)
-#endif
- ModifySelection(ctx, event,
- XawsmTextSelect, XawactionAdjust, params, num_params);
-}
-
-static void
-SelectEnd(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
-#ifndef OLDXAW
- if (ctx->text.selection_state) {
- ctx->text.selection_state = False;
-#endif
- ModifySelection(ctx, event,
- XawsmTextSelect, XawactionEnd, params, num_params);
-#ifndef OLDXAW
- }
-#endif
-}
-
-static void
-ExtendStart(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
-#ifndef OLDXAW
- if (!ctx->text.selection_state) {
- ctx->text.selection_state = True;
-#endif
- ModifySelection(ctx, event,
- XawsmTextExtend, XawactionStart, params, num_params);
-#ifndef OLDXAW
- }
-#endif
-}
-
-static void
-ExtendAdjust(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
-#ifndef OLDXAW
- if (ctx->text.selection_state)
-#endif
- ModifySelection(ctx, event,
- XawsmTextExtend, XawactionAdjust, params, num_params);
-}
-
-static void
-ExtendEnd(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
-#ifndef OLDXAW
- if (ctx->text.selection_state) {
- ctx->text.selection_state = False;
-#endif
- ModifySelection(ctx, event,
- XawsmTextExtend, XawactionEnd, params, num_params);
-#ifndef OLDXAW
- }
-#endif
-}
-
-static void
-SelectSave(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- int num_atoms;
- Atom *sel;
- Display *dpy = XtDisplay(w);
- Atom selections[256];
-
- StartAction((TextWidget)w, event);
- num_atoms = *num_params;
- if (num_atoms > 256)
- num_atoms = 256;
- for (sel=selections; --num_atoms >= 0; sel++, params++)
- *sel = XInternAtom(dpy, *params, False);
- num_atoms = *num_params;
- _XawTextSaltAwaySelection((TextWidget)w, selections, num_atoms);
- EndAction((TextWidget)w);
-}
-
-/*
- * Misc. Routines
- */
-/*ARGSUSED*/
-static void
-SetKeyboardFocus(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- Widget shell, parent;
-
- shell = parent = w;
- while (parent) {
- if (XtIsShell(shell = parent))
- break;
- parent = XtParent(parent);
- }
- XtSetKeyboardFocus(shell, w);
-}
-
-/*ARGSUSED*/
-static void
-RedrawDisplay(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- StartAction((TextWidget)w, event);
- _XawTextClearAndCenterDisplay((TextWidget)w);
- EndAction((TextWidget)w);
-}
-
-/*ARGSUSED*/
-static void
-TextFocusIn(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- Bool display_caret = ctx->text.display_caret;
-
- if (event->xfocus.detail == NotifyPointer)
- return;
-
- /* Let the input method know focus has arrived. */
- _XawImSetFocusValues(w, NULL, 0);
-
- if (display_caret)
- StartAction(ctx, event);
- ctx->text.hasfocus = TRUE;
- if (display_caret)
- EndAction(ctx);
-}
-
-/*ARGSUSED*/
-static void
-TextFocusOut(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- Bool display_caret = ctx->text.display_caret;
-
- if (event->xfocus.detail == NotifyPointer)
- return;
-
- /* Let the input method know focus has left.*/
- _XawImUnsetFocus(w);
-
- if (display_caret)
- StartAction(ctx, event);
- ctx->text.hasfocus = FALSE;
- if (display_caret)
- EndAction(ctx);
-}
-
-/*ARGSUSED*/
-static void
-TextEnterWindow(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
- if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus
- && !ctx->text.hasfocus)
- _XawImSetFocusValues(w, NULL, 0);
-}
-
-/*ARGSUSED*/
-static void
-TextLeaveWindow(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
- if ((event->xcrossing.detail != NotifyInferior) && event->xcrossing.focus
- && !ctx->text.hasfocus)
- _XawImUnsetFocus(w);
-}
-
-/*
- * Function:
- * AutoFill
- * Arguments: ctx - The text widget.
- *
- * Description:
- * Breaks the line at the previous word boundry when
- * called inside InsertChar.
- */
-static void
-AutoFill(TextWidget ctx)
-{
- int width, height, x, line_num, max_width;
- XawTextPosition ret_pos;
- XawTextBlock text;
- XRectangle cursor;
- wchar_t wc_buf[2];
-
- for (line_num = 0; line_num < ctx->text.lt.lines ; line_num++)
- if (ctx->text.lt.info[line_num].position >= ctx->text.insertPos)
- break;
- if (line_num)
- line_num--; /* backup a line. */
-
- XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
- max_width = Max(0, (int)XtWidth(ctx) - RHMargins(ctx) - cursor.width);
-
- x = ctx->text.r_margin.left;
- XawTextSinkFindPosition(ctx->text.sink, ctx->text.lt.info[line_num].position,
- x, max_width, True, &ret_pos,
- &width, &height);
-
- if (ret_pos <= ctx->text.lt.info[line_num].position
- || ret_pos >= ctx->text.insertPos || ret_pos < 1)
- return;
-
- XawTextSourceRead(ctx->text.source, ret_pos - 1, &text, 1);
-
- if (XawTextFormat(ctx, XawFmtWide)) {
- wc_buf[0] = *(wchar_t *)text.ptr;
- if (wc_buf[0] != _Xaw_atowc(XawSP) && wc_buf[0] != _Xaw_atowc(XawTAB))
- /* Only eats white spaces */
- return;
-
- text.format = XawFmtWide;
- text.ptr = (char *)wc_buf;
- wc_buf[0] = _Xaw_atowc(XawLF);
- wc_buf[1] = 0;
- }
- else {
- if (text.ptr[0] != XawSP && text.ptr[0] != XawTAB)
- /* Only eats white spaces */
- return;
-
- text.format = XawFmt8Bit;
- text.ptr = "\n";
- }
- text.length = 1;
- text.firstPos = 0;
-
- if (_XawTextReplace(ctx, ret_pos - 1, ret_pos, &text))
- XBell(XtDisplay((Widget)ctx), 0);
-
- if (++ctx->text.insertPos > ctx->text.lastPos)
- ctx->text.insertPos = ctx->text.lastPos;
-}
-
-/*ARGSUSED*/
-static void
-InsertChar(Widget w, XEvent *event, String *p, Cardinal *n)
-{
- TextWidget ctx = (TextWidget)w;
- char *ptr, strbuf[128], ptrbuf[512];
- int count, error, mult = MULT(ctx);
- KeySym keysym;
- XawTextBlock text;
-#ifndef OLDXAW
- Bool format = False;
-#endif
- XawTextPosition from, to;
-
- if (XtIsSubclass (ctx->text.source, (WidgetClass) multiSrcObjectClass))
- text.length = _XawImWcLookupString(w, &event->xkey, (wchar_t*)strbuf,
- sizeof(strbuf), &keysym);
- else
- text.length = _XawLookupString(w, (XKeyEvent*)event, strbuf,
- sizeof(strbuf), &keysym);
-
- if (text.length == 0)
- return;
-
- if (mult < 0) {
- ctx->text.mult = 1;
- return;
- }
-
- text.format = _XawTextFormat(ctx);
- if (text.format == XawFmtWide) {
- text.ptr = ptr = XawStackAlloc(sizeof(wchar_t) * text.length
- * mult, ptrbuf);
- for (count = 0; count < mult; count++) {
- memcpy((char*)ptr, (char *)strbuf, sizeof(wchar_t) * text.length);
- ptr += sizeof(wchar_t) * text.length;
- }
-#ifndef OLDXAW
- if (mult == 1)
- format = ctx->text.left_column < ctx->text.right_column;
-#endif
- }
- else { /* == XawFmt8Bit */
- text.ptr = ptr = XawStackAlloc(text.length * mult, ptrbuf);
- for (count = 0; count < mult; count++) {
- strncpy(ptr, strbuf, text.length);
- ptr += text.length;
- }
-#ifndef OLDXAW
- if (mult == 1)
- format = ctx->text.left_column < ctx->text.right_column;
-#endif
- }
-
- text.length = text.length * mult;
- text.firstPos = 0;
-
- StartAction(ctx, event);
-#ifndef OLDXAW
- if (mult == 1)
- _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
-#endif
-
- from = ctx->text.insertPos;
-#ifndef OLDXAW
- if (ctx->text.overwrite) {
- XawTextPosition tmp;
-
- to = from + mult;
- tmp = SrcScan(ctx->text.source, from, XawstEOL, XawsdRight, 1, False);
- if (to > tmp)
- to = tmp;
- }
- else
-#endif
- to = from;
-
- error = _XawTextReplace(ctx, from , to, &text);
-
- if (error == XawEditDone) {
- ctx->text.from_left = -1;
- ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
- XawstPositions, XawsdRight,
- text.length, True);
- if (ctx->text.auto_fill) {
-#ifndef OLDXAW
- if (format)
- (void)FormatText(ctx, SrcScan(ctx->text.source,
- ctx->text.insertPos, XawstEOL,
- XawsdLeft, 1, False), False,
- NULL, 0);
- else
-#endif
- AutoFill(ctx);
- }
- }
- else
- XBell(XtDisplay(ctx), 50);
-
- XawStackFree(text.ptr, ptrbuf);
- EndAction(ctx);
-
- if (error == XawEditDone && text.format == XawFmt8Bit && text.length == 1
- && (text.ptr[0] == ')' || text.ptr[0] == ']' || text.ptr[0] == '}')
- && ctx->text.display_caret) {
- static struct timeval tmval = {0, 500000};
- fd_set fds;
- Widget source = ctx->text.source;
- XawTextPosition insertPos = ctx->text.insertPos, pos, tmp, last;
- char left, right = text.ptr[0];
- int level = 0;
-
- left = right == ')' ? '(' : right == ']' ? '[' : '{';
-
- last = insertPos - 1;
- do {
- text.ptr[0] = left;
- pos = XawTextSourceSearch(source, last, XawsdLeft, &text);
- if (pos == XawTextSearchError || !IsPositionVisible(ctx, pos))
- return;
- text.ptr[0] = right;
- tmp = pos;
- do {
- tmp = XawTextSourceSearch(source, tmp, XawsdRight, &text);
- if (tmp == XawTextSearchError)
- return;
- if (tmp <= last)
- ++level;
- } while (++tmp <= last);
- --level;
- last = pos;
- } while (level);
-
- StartAction(ctx, NULL);
-#ifndef OLDXAW
- _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
-#endif
- ctx->text.insertPos = pos;
- EndAction(ctx);
-
- XSync(XtDisplay(w), False);
- while (XtAppPending(XtWidgetToApplicationContext(w)) & XtIMXEvent)
- XtAppProcessEvent(XtWidgetToApplicationContext(w), XtIMXEvent);
- FD_ZERO(&fds);
- FD_SET(ConnectionNumber(XtDisplay(w)), &fds);
- (void)select(FD_SETSIZE, &fds, NULL, NULL, &tmval);
-
- StartAction(ctx, NULL);
-#ifndef OLDXAW
- _XawSourceSetUndoMerge((TextSrcObject)ctx->text.source, True);
-#endif
- ctx->text.insertPos = insertPos;
- EndAction(ctx);
- }
-}
-
-/* IfHexConvertHexElseReturnParam() - called by InsertString
- *
- * i18n requires the ability to specify multiple characters in a hexa-
- * decimal string at once. Since Insert was already too long, I made
- * this a seperate routine.
- *
- * A legal hex string in MBNF: '0' 'x' ( HEX-DIGIT HEX-DIGIT )+ '\0'
- *
- * WHEN: the passed param is a legal hex string
- * RETURNS: a pointer to that converted, null terminated hex string;
- * len_return holds the character count of conversion result
- *
- * WHEN: the passed param is not a legal hex string:
- * RETURNS: the parameter passed;
- * len_return holds the char count of param.
- *
- * NOTE: In neither case will there be strings to free. */
-static char *
-IfHexConvertHexElseReturnParam(char *param, int *len_return)
-{
- char *p; /* steps through param char by char */
- char c; /* holds the character pointed to by p */
- int ind; /* steps through hexval buffer char by char */
- static char hexval[XawTextActionMaxHexChars];
- Boolean first_digit;
-
- /* reject if it doesn't begin with 0x and at least one more character. */
- if ((param[0] != '0') || (param[1] != 'x') || (param[2] == '\0')) {
- *len_return = strlen(param);
- return(param);
- }
-
- /* Skip the 0x; go character by character shifting and adding. */
- first_digit = True;
- ind = 0;
- hexval[ind] = '\0';
-
- for (p = param+2; (c = *p) != '\0'; p++) {
- hexval[ind] *= 16;
- if (c >= '0' && c <= '9')
- hexval[ind] += c - '0';
- else if (c >= 'a' && c <= 'f')
- hexval[ind] += c - 'a' + 10;
- else if (c >= 'A' && c <= 'F')
- hexval[ind] += c - 'A' + 10;
- else
- break;
-
- /* If we didn't break in preceding line, it was a good hex char. */
- if (first_digit)
- first_digit = False;
- else {
- first_digit = True;
- if (++ind < XawTextActionMaxHexChars)
- hexval[ind] = '\0';
- else {
- *len_return = strlen(param);
- return(param);
- }
- }
- }
-
- /* We quit the above loop becasue we hit a non hex. If that char is \0... */
- if ((c == '\0') && first_digit) {
- *len_return = strlen(hexval);
- return (hexval); /* ...it was a legal hex string, so return it */
- }
-
- /* Else, there were non-hex chars or odd digit count, so... */
-
- *len_return = strlen(param);
- return (param); /* ...return the verbatim string. */
-}
-
-/* InsertString() - action
- *
- * Mostly rewritten for R6 i18n.
- *
- * Each parameter, in turn, will be insert at the inputPos
- * and the inputPos advances to the insertion's end.
- *
- * The exception is that parameters composed of the two
- * characters 0x, followed only by an even number of
- * hexadecimal digits will be converted to characters */
-/*ARGSUSED*/
-static void
-InsertString(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- XtAppContext app_con = XtWidgetToApplicationContext(w);
- XawTextBlock text;
- int i;
-
- text.firstPos = 0;
- text.format = _XawTextFormat(ctx);
-
- StartAction(ctx, event);
- for (i = *num_params; i; i--, params++) { /* DO FOR EACH PARAMETER */
- text.ptr = IfHexConvertHexElseReturnParam(*params, &text.length);
-
- if (text.length == 0)
- continue;
-
- if (XawTextFormat(ctx, XawFmtWide)) { /* convert to WC */
- int temp_len;
-
- text.ptr = (char*)_XawTextMBToWC(XtDisplay(w), text.ptr,
- &text.length);
-
- if (text.ptr == NULL) { /* conversion error */
- XtAppWarningMsg(app_con,
- "insertString", "textAction", "XawError",
- "insert-string()'s parameter contents "
- "not legal in this locale.",
- NULL, NULL);
- ParameterError(w, *params);
- continue;
- }
-
- /* Double check that the new input is legal: try to convert to MB. */
-
- temp_len = text.length; /* _XawTextWCToMB's 3rd arg is in_out */
- if (_XawTextWCToMB(XtDisplay(w), (wchar_t*)text.ptr, &temp_len)
- == NULL) {
- XtAppWarningMsg( app_con,
- "insertString", "textAction", "XawError",
- "insert-string()'s parameter contents "
- "not legal in this locale.",
- NULL, NULL);
- ParameterError(w, *params);
- continue;
- }
- } /* convert to WC */
-
- if (_XawTextReplace(ctx, ctx->text.insertPos,
- ctx->text.insertPos, &text)) {
- XBell(XtDisplay(ctx), 50);
- EndAction(ctx);
- return;
- }
-
- ctx->text.from_left = -1;
- /* Advance insertPos to the end of the string we just inserted. */
- ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.old_insert,
- XawstPositions, XawsdRight, text.length,
- True);
-
- } /* DO FOR EACH PARAMETER */
-
- EndAction(ctx);
-}
-
-/* DisplayCaret() - action
- *
- * The parameter list should contain one boolean value. If the
- * argument is true, the cursor will be displayed. If false, not.
- *
- * The exception is that EnterNotify and LeaveNotify events may
- * have a second argument, "always". If they do not, the cursor
- * is only affected if the focus member of the event is true. */
-static void
-DisplayCaret(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- Bool display_caret = True;
-
- if ((event->type == EnterNotify || event->type == LeaveNotify)
- && ((*num_params >= 2) && (strcmp(params[1], "always") == 0))
- && (!event->xcrossing.focus))
- return;
-
- if (*num_params > 0) { /* default arg is "True" */
- XrmValue from, to;
- from.size = strlen(from.addr = params[0]);
- XtConvert(w, XtRString, &from, XtRBoolean, &to);
-
- if (to.addr != NULL)
- display_caret = *(Boolean*)to.addr;
- if (ctx->text.display_caret == display_caret)
- return;
- }
- StartAction(ctx, event);
- ctx->text.display_caret = display_caret;
- EndAction(ctx);
-}
-
-#ifndef OLDXAW
-static void
-Numeric(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
- if (ctx->text.numeric) {
- long mult = ctx->text.mult;
-
- if (*num_params != 1 || strlen(params[0]) != 1
- || (!isdigit(params[0][0])
- && (params[0][0] != '-' || mult != 0))) {
- char err_buf[256];
-
- if (event && (event->type == KeyPress || event->type == KeyRelease)
- && params[0][0] == '-') {
- InsertChar(w, event, params, num_params);
- return;
- }
- XmuSnprintf(err_buf, sizeof(err_buf),
- "numeric: Invalid argument%s'%s'",
- *num_params ? ", " : "", *num_params ? params[0] : "");
- XtAppWarning(XtWidgetToApplicationContext(w), err_buf);
- ctx->text.numeric = False;
- ctx->text.mult = 1;
- return;
- }
- if (params[0][0] == '-') {
- ctx->text.mult = 32767;
- return;
- }
- else if (mult == 32767) {
- mult = ctx->text.mult = - (params[0][0] - '0');
- return;
- }
- else {
- mult = mult * 10 + params[0][0] - '0';
- ctx->text.mult = ctx->text.mult * 10 + params[0][0] - '0';
- }
- if (mult != ctx->text.mult || mult >= 32767) { /* checks for overflow */
- XBell(XtDisplay(w), 0);
- ctx->text.mult = 1;
- ctx->text.numeric = False;
- return;
- }
- }
- else
- InsertChar(w, event, params, num_params);
-}
-
-/*ARGSUSED*/
-static void
-KeyboardReset(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
-
- ctx->text.numeric = False;
- ctx->text.mult = 1;
-
- (void)_XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
-
- if (ctx->text.kill_ring_ptr) {
- --ctx->text.kill_ring_ptr->refcount;
- ctx->text.kill_ring_ptr = NULL;
- }
- ctx->text.kill_ring = 0;
-
- XBell(XtDisplay(w), 0);
-}
-#endif /* OLDXAW */
-
-/* Multiply() - action
- *
- * The parameter list may contain either a number or the string 'Reset'.
- *
- * A number will multiply the current multiplication factor by that number.
- * Many of the text widget actions will will perform n actions, where n is
- * the multiplication factor.
- *
- * The string reset will reset the mutiplication factor to 1. */
-/*ARGSUSED*/
-static void
-Multiply(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- int mult;
-
- if (*num_params != 1) {
- XtAppError(XtWidgetToApplicationContext(w),
- "Xaw Text Widget: multiply() takes exactly one argument.");
- XBell(XtDisplay(w), 0);
- return;
- }
-
- if ((params[0][0] == 'r') || (params[0][0] == 'R')) {
- XBell(XtDisplay(w), 0);
-#ifndef OLDXAW
- ctx->text.numeric = False;
-#endif
- ctx->text.mult = 1;
- return;
- }
-
-#ifndef OLDXAW
- if (params[0][0] == 's' || params[0][0] == 'S') {
- ctx->text.numeric = True;
- ctx->text.mult = 0;
- return;
- }
- else
-#endif
- if ((mult = atoi(params[0])) == 0) {
- char buf[BUFSIZ];
-
- XmuSnprintf(buf, sizeof(buf),
- "%s %s", "Xaw Text Widget: multiply() argument",
- "must be a number greater than zero, or 'Reset'.");
- XtAppError(XtWidgetToApplicationContext(w), buf);
- XBell(XtDisplay(w), 50);
- return;
- }
-
- ctx->text.mult *= mult;
-}
-
-/* StripOutOldCRs() - called from FormRegion
- *
- * removes CRs in widget ctx, from from to to.
- *
- * RETURNS: the new ending location (we may add some characters),
- * or XawReplaceError if the widget can't be written to. */
-static XawTextPosition
-StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
- XawTextPosition *pos, int num_pos)
-{
- XawTextPosition startPos, endPos, eop_begin, eop_end, temp;
- Widget src = ctx->text.source;
- XawTextBlock text;
- char *buf;
- static wchar_t wc_two_spaces[3];
- int idx;
-
- /* Initialize our TextBlock with two spaces. */
- text.firstPos = 0;
- text.format = _XawTextFormat(ctx);
- if (text.format == XawFmt8Bit)
- text.ptr= " ";
- else {
- wc_two_spaces[0] = _Xaw_atowc(XawSP);
- wc_two_spaces[1] = _Xaw_atowc(XawSP);
- wc_two_spaces[2] = 0;
- text.ptr = (char*)wc_two_spaces;
- }
-
- /* Strip out CR's. */
- eop_begin = eop_end = startPos = endPos = from;
-
- /* CONSTCOND */
- while (TRUE) {
- endPos=SrcScan(src, startPos, XawstEOL, XawsdRight, 1, False);
-
- temp = SrcScan(src, endPos, XawstWhiteSpace, XawsdLeft, 1, False);
- temp = SrcScan(src, temp, XawstWhiteSpace, XawsdRight,1, False);
-
- if (temp > startPos)
- endPos = temp;
-
- if (endPos >= to)
- break;
-
- if (endPos >= eop_begin) {
- startPos = eop_end;
- eop_begin=SrcScan(src, startPos, XawstParagraph,
- XawsdRight, 1,False);
- eop_end = SrcScan(src, startPos, XawstParagraph,
- XawsdRight, 1, True);
- }
- else {
- XawTextPosition periodPos, next_word;
- int i, len;
-
- periodPos = SrcScan(src, endPos, XawstPositions,
- XawsdLeft, 1, True);
- next_word = SrcScan(src, endPos, XawstWhiteSpace,
- XawsdRight, 1, False);
-
- len = next_word - periodPos;
-
- text.length = 1;
- buf = _XawTextGetText(ctx, periodPos, next_word);
- if (text.format == XawFmtWide) {
- if (periodPos < endPos && ((wchar_t*)buf)[0] == _Xaw_atowc('.'))
- text.length++;
- }
- else
- if (periodPos < endPos && buf[0] == '.')
- text.length++; /* Put in two spaces. */
-
- /*
- * Remove all extra spaces.
- */
- for (i = 1 ; i < len; i++)
- if (text.format == XawFmtWide) {
- if (!iswspace(((wchar_t*)buf)[i]) || ((periodPos + i) >= to))
- break;
- }
- else if (!isspace(buf[i]) || (periodPos + i) >= to)
- break;
-
- XtFree(buf);
-
- to -= (i - text.length - 1);
- startPos = SrcScan(src, periodPos, XawstPositions,
- XawsdRight, i, True);
- if (_XawTextReplace(ctx, endPos, startPos, &text) != XawEditDone)
- return (XawReplaceError);
-
- for (idx = 0; idx < num_pos; idx++) {
- if (endPos < pos[idx]) {
- if (startPos < pos[idx])
- pos[idx] -= startPos - endPos;
- else
- pos[idx] = endPos;
- pos[idx] += text.length;
- }
- }
-
- startPos -= i - text.length;
- }
- }
-
- return (to);
-}
-
-/* InsertNewCRs() - called from FormRegion
- *
- * inserts new CRs for FormRegion, thus for FormParagraph action */
-static void
-InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to,
- XawTextPosition *pos, int num_pos)
-{
- XawTextPosition startPos, endPos, space, eol;
- XawTextBlock text;
- int i, width, height, len, wwidth, idx;
- char *buf;
- static wchar_t wide_CR[2];
-
- text.firstPos = 0;
- text.length = 1;
- text.format = _XawTextFormat(ctx);
-
- if (text.format == XawFmt8Bit)
- text.ptr = "\n";
- else {
- wide_CR[0] = _Xaw_atowc(XawLF);
- wide_CR[1] = 0;
- text.ptr = (char*)wide_CR;
- }
-
- startPos = from;
-
- wwidth = (int)XtWidth(ctx) - (int)HMargins(ctx);
- if (ctx->text.wrap != XawtextWrapNever) {
- XRectangle cursor;
-
- XawTextSinkGetCursorBounds(ctx->text.sink, &cursor);
- wwidth -= (int)cursor.width;
- }
- wwidth = XawMax(0, wwidth);
-
- /* CONSTCOND */
- while (TRUE) {
- XawTextSinkFindPosition(ctx->text.sink, startPos,
- (int)ctx->text.r_margin.left, wwidth,
- True, &eol, &width, &height);
- if (eol == startPos)
- ++eol;
- if (eol >= to)
- break;
-
- eol = SrcScan(ctx->text.source, eol, XawstPositions,
- XawsdLeft, 1, True);
- space = SrcScan(ctx->text.source, eol, XawstWhiteSpace,
- XawsdRight,1, True);
-
- startPos = endPos = eol;
- if (eol == space)
- return;
-
- len = (int)(space - eol);
- buf = _XawTextGetText(ctx, eol, space);
- for (i = 0 ; i < len ; i++)
- if (text.format == XawFmtWide) {
- if (!iswspace(((wchar_t*)buf)[i]))
- break;
- }
- else if (!isspace(buf[i]))
- break;
-
- to -= (i - 1);
- endPos = SrcScan(ctx->text.source, endPos,
- XawstPositions, XawsdRight, i, True);
- XtFree(buf);
-
- if (_XawTextReplace(ctx, startPos, endPos, &text))
- return;
-
- for (idx = 0; idx < num_pos; idx++) {
- if (startPos < pos[idx]) {
- if (endPos < pos[idx])
- pos[idx] -= endPos - startPos;
- else
- pos[idx] = startPos;
- pos[idx] += text.length;
- }
- }
-
- startPos = SrcScan(ctx->text.source, startPos,
- XawstPositions, XawsdRight, 1, True);
- }
-}
-
-/* FormRegion() - called by FormParagraph
- *
- * oversees the work of paragraph-forming a region
- *
- * Return:
- * XawEditDone if successful, or XawReplaceError
- */
-static int
-FormRegion(TextWidget ctx, XawTextPosition from, XawTextPosition to,
- XawTextPosition *pos, int num_pos)
-{
-#ifndef OLDXAW
- Bool format = ctx->text.auto_fill
- && ctx->text.left_column < ctx->text.right_column;
-#endif
-
- if (from >= to)
- return (XawEditDone);
-
-#ifndef OLDXAW
- if (format) {
- XawTextPosition len = ctx->text.lastPos;
- int inc = 0;
-
- if (ctx->text.justify == XawjustifyLeft ||
- ctx->text.justify == XawjustifyFull) {
- Untabify(ctx, from, to, pos, num_pos, NULL);
- to += ctx->text.lastPos - len;
- len = ctx->text.insertPos;
- (void)BlankLine((Widget)ctx, from, &inc);
- if (from + inc >= to)
- return (XawEditDone);
- }
- if (!StripSpaces(ctx, from + inc, to, pos, num_pos, NULL))
- return (XawReplaceError);
- to += ctx->text.lastPos - len;
-
- FormatText(ctx, from, ctx->text.justify != XawjustifyFull, pos, num_pos);
- }
- else {
-#endif
- if ((to = StripOutOldCRs(ctx, from, to, pos, num_pos)) == XawReplaceError)
- return (XawReplaceError);
- InsertNewCRs(ctx, from, to, pos, num_pos);
-#ifndef OLDXAW
- }
-#endif
- ctx->text.from_left = -1;
-
- return (XawEditDone);
-}
-
-#ifndef OLDXAW
-static Bool
-BlankLine(Widget w, XawTextPosition pos, int *blanks_return)
-{
- int i, blanks = 0;
- XawTextBlock block;
- Widget src = XawTextGetSource(w);
- XawTextPosition l = SrcScan(src, pos, XawstEOL, XawsdLeft, 1, False);
- XawTextPosition r = SrcScan(src, pos, XawstEOL, XawsdRight, 1, False);
-
- while (l < r) {
- l = XawTextSourceRead(src, l, &block, r - l);
- if (block.length == 0) {
- if (blanks_return)
- *blanks_return = blanks;
- return (True);
- }
- if (XawTextFormat((TextWidget)w, XawFmt8Bit)) {
- for (i = 0; i < block.length; i++, blanks++)
- if (block.ptr[i] != ' ' &&
- block.ptr[i] != '\t') {
- if (blanks_return)
- *blanks_return = blanks;
- return (block.ptr[i] == '\n');
- }
- }
- else if (XawTextFormat((TextWidget)w, XawFmtWide)) {
- for (i = 0; i < block.length; i++, blanks++)
- if (_Xaw_atowc(XawSP) != ((wchar_t*)block.ptr)[i] &&
- _Xaw_atowc(XawTAB) != ((wchar_t*)block.ptr)[i]) {
- if (blanks_return)
- *blanks_return = blanks;
- return (_Xaw_atowc(XawLF) == ((wchar_t*)block.ptr)[i]);
- }
- }
- }
-
- return (True);
-}
-
-static Bool
-GetBlockBoundaries(TextWidget ctx,
- XawTextPosition *from_return, XawTextPosition *to_return)
-{
- XawTextPosition from, to;
-
- if (ctx->text.auto_fill && ctx->text.left_column < ctx->text.right_column) {
- if (ctx->text.s.left != ctx->text.s.right) {
- from = SrcScan(ctx->text.source,
- XawMin(ctx->text.s.left, ctx->text.s.right),
- XawstEOL, XawsdLeft, 1, False);
- to = SrcScan(ctx->text.source,
- XawMax(ctx->text.s.right, ctx->text.s.right),
- XawstEOL, XawsdRight, 1, False);
- }
- else {
- XawTextBlock block;
- XawTextPosition tmp;
- Bool first;
-
- from = to = ctx->text.insertPos;
-
- /* find from position */
- first = True;
- while (1) {
- tmp = from;
- from = SrcScan(ctx->text.source, from, XawstEOL, XawsdLeft,
- 1 + !first, False);
- XawTextSourceRead(ctx->text.source, from, &block, 1);
- if (block.length == 0 ||
- (XawTextFormat(ctx, XawFmt8Bit) &&
- block.ptr[0] != ' ' &&
- block.ptr[0] != '\t' &&
- !isalnum(*(unsigned char*)block.ptr)) ||
- (XawTextFormat(ctx, XawFmtWide) &&
- _Xaw_atowc(XawSP) != *(wchar_t*)block.ptr &&
- _Xaw_atowc(XawTAB) != *(wchar_t*)block.ptr &&
- !iswalnum(*(wchar_t*)block.ptr)) ||
- BlankLine((Widget)ctx, from, NULL)) {
- from = tmp;
- break;
- }
- if (from == tmp && !first)
- break;
- first = False;
- }
- if (first)
- return (False);
-
- /* find to position */
- first = True;
- while (1) {
- tmp = to;
- to = SrcScan(ctx->text.source, to, XawstEOL, XawsdRight,
- 1 + !first, False);
- XawTextSourceRead(ctx->text.source, to + (to < ctx->text.lastPos),
- &block, 1);
- if (block.length == 0 ||
- (XawTextFormat(ctx, XawFmt8Bit) &&
- block.ptr[0] != ' ' &&
- block.ptr[0] != '\t' &&
- !isalnum(*(unsigned char*)block.ptr)) ||
- (XawTextFormat(ctx, XawFmtWide) &&
- _Xaw_atowc(XawSP) != *(wchar_t*)block.ptr &&
- _Xaw_atowc(XawTAB) != *(wchar_t*)block.ptr &&
- !iswalnum(*(wchar_t*)block.ptr)) ||
- BlankLine((Widget)ctx, to, NULL))
- break;
- if (to == tmp && !first)
- break;
- first = False;
- }
- }
- }
- else {
- from = SrcScan(ctx->text.source, ctx->text.insertPos, XawstEOL,
- XawsdLeft, 1, False);
- if (BlankLine((Widget)ctx, from, NULL))
- return (False);
- from = SrcScan(ctx->text.source, from, XawstParagraph,
- XawsdLeft, 1, False);
- if (BlankLine((Widget)ctx, from, NULL))
- from = SrcScan(ctx->text.source, from, XawstEOL,
- XawsdRight, 1, True);
- to = SrcScan(ctx->text.source, from, XawstParagraph,
- XawsdRight, 1, False);
- }
-
- if (from < to) {
- *from_return = from;
- *to_return = to;
- return (True);
- }
-
- return (False);
-}
-#endif /* OLDXAW */
-
-/* FormParagraph() - action
- *
- * removes and reinserts CRs to maximize line length without clipping */
-/*ARGSUSED*/
-static void
-FormParagraph(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition from, to, buf[32], *pos;
-#ifndef OLDXAW
- XawTextPosition endPos = 0;
- char *lbuf = NULL, *rbuf;
- TextSrcObject src = (TextSrcObject)ctx->text.source;
- Cardinal i;
- Bool undo = src->textSrc.enable_undo && src->textSrc.undo_state == False;
-#endif
-
- StartAction(ctx, event);
-
-#ifndef OLDXAW
- pos = XawStackAlloc(sizeof(XawTextPosition) * src->textSrc.num_text, buf);
- for (i = 0; i < src->textSrc.num_text; i++)
- pos[i] = ((TextWidget)src->textSrc.text[i])->text.old_insert;
-#else
- pos = buf;
- *pos = ctx->text.old_insert;
-#endif
-
-#ifndef OLDXAW
- if (!GetBlockBoundaries(ctx, &from, &to)) {
- EndAction(ctx);
- XawStackFree(pos, buf);
- return;
- }
-
- if (undo) {
- src->textSrc.undo_state = True;
- lbuf = _XawTextGetText(ctx, from, to);
- endPos = ctx->text.lastPos;
- }
-
- if (FormRegion(ctx, from, to, pos, src->textSrc.num_text) == XawReplaceError) {
-#else
- from = SrcScan(ctx->text.source, ctx->text.insertPos,
- XawstParagraph, XawsdLeft, 1, False);
- to = SrcScan(ctx->text.source, from,
- XawstParagraph, XawsdRight, 1, False);
-
- if (FormRegion(ctx, from, to, pos, 1) == XawReplaceError) {
-#endif
- XawStackFree(pos, buf);
- XBell(XtDisplay(w), 0);
-#ifndef OLDXAW
- if (undo) {
- src->textSrc.undo_state = False;
- XtFree(lbuf);
- }
-#endif
- }
-#ifndef OLDXAW
- else if (undo) {
- /* makes the form-paragraph only one undo/redo step */
- unsigned llen, rlen, size;
- XawTextBlock block;
-
- llen = to - from;
- rlen = llen + (ctx->text.lastPos - endPos);
-
- block.firstPos = 0;
- block.format = _XawTextFormat(ctx);
-
- rbuf = _XawTextGetText(ctx, from, from + rlen);
-
- size = XawTextFormat(ctx, XawFmtWide) ? sizeof(wchar_t) : sizeof(char);
- if (llen != rlen || memcmp(lbuf, rbuf, llen * size)) {
- block.ptr = lbuf;
- block.length = llen;
- _XawTextReplace(ctx, from, from + rlen, &block);
-
- src->textSrc.undo_state = False;
- block.ptr = rbuf;
- block.length = rlen;
- _XawTextReplace(ctx, from, from + llen, &block);
- }
- else
- src->textSrc.undo_state = False;
- XtFree(lbuf);
- XtFree(rbuf);
- }
-
- for (i = 0; i < src->textSrc.num_text; i++) {
- TextWidget tw = (TextWidget)src->textSrc.text[i];
-
- tw->text.old_insert = tw->text.insertPos = pos[i];
- _XawTextBuildLineTable(tw, SrcScan((Widget)src, tw->text.lt.top, XawstEOL,
- XawsdLeft, 1, False), False);
- tw->text.clear_to_eol = True;
- }
-#else
- ctx->text.old_insert = ctx->text.insertPos = *pos;
- _XawTextBuildLineTable(ctx, SrcScan(ctx->text.source, ctx->text.lt.top,
- XawstEOL, XawsdLeft, 1, False), False);
- ctx->text.clear_to_eol = True;
-#endif
- XawStackFree(pos, buf);
- ctx->text.showposition = True;
-
- EndAction(ctx);
-}
-
-/* TransposeCharacters() - action
- *
- * Swaps the character to the left of the mark
- * with the character to the right of the mark */
-/*ARGSUSED*/
-static void
-TransposeCharacters(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextPosition start, end;
- XawTextBlock text;
- char *buf;
- int i, mult = MULT(ctx);
-
- if (mult < 0) {
- ctx->text.mult = 1;
- return;
- }
-
- StartAction(ctx, event);
-
- /* Get bounds. */
-
- start = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions,
- XawsdLeft, 1, True);
- end = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions,
- XawsdRight, mult, True);
-
- /* Make sure we aren't at the very beginning or end of the buffer. */
-
- if (start == ctx->text.insertPos || end == ctx->text.insertPos) {
- XBell(XtDisplay(w), 0); /* complain. */
- EndAction(ctx);
- return;
- }
-
- ctx->text.from_left = -1;
- ctx->text.insertPos = end;
-
- text.firstPos = 0;
- text.format = _XawTextFormat(ctx);
-
- /* Retrieve text and swap the characters. */
- if (text.format == XawFmtWide) {
- wchar_t wc;
- wchar_t *wbuf;
-
- wbuf = (wchar_t*)_XawTextGetText(ctx, start, end);
- text.length = wcslen(wbuf);
- wc = wbuf[0];
- for (i = 1; i < text.length; i++)
- wbuf[i - 1] = wbuf[i];
- wbuf[i - 1] = wc;
- buf = (char*)wbuf; /* so that it gets assigned and freed */
- }
- else { /* thus text.format == XawFmt8Bit */
- char c;
-
- buf = _XawTextGetText(ctx, start, end);
- text.length = strlen(buf);
- c = buf[0];
- for (i = 1; i < text.length; i++)
- buf[i - 1] = buf[i];
- buf[i - 1] = c;
- }
-
- text.ptr = buf;
-
- /* Store new text in source. */
-
- if (_XawTextReplace (ctx, start, end, &text))
- XBell(XtDisplay(w), 0);
- XtFree((char *)buf);
- EndAction(ctx);
-}
-
-#ifndef OLDXAW
-/*ARGSUSED*/
-static void
-Undo(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- int mul = MULT(ctx);
- Bool toggle = False;
-
- if (mul < 0) {
- toggle = True;
- _XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
- ctx->text.mult = mul = -mul;
- }
-
- StartAction(ctx, event);
- for (; mul; --mul)
- if (!_XawTextSrcUndo((TextSrcObject)ctx->text.source, &ctx->text.insertPos))
- break;
- ctx->text.showposition = True;
-
- if (toggle)
- _XawTextSrcToggleUndo((TextSrcObject)ctx->text.source);
- EndAction(ctx);
-}
-#endif
-
-/* NoOp() - action
- * This action performs no action, and allows the user or
- * application programmer to unbind a translation.
- *
- * Note: If the parameter list contains the string "RingBell" then
- * this action will ring the bell.
- */
-/*ARGSUSED*/
-static void
-NoOp(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- if (*num_params != 1)
- return;
-
- switch(params[0][0]) {
- case 'R':
- case 'r':
- XBell(XtDisplay(w), 0);
- /*FALLTROUGH*/
- default:
- break;
- }
-}
-
-/* Reconnect() - action
- * This reconnects to the input method. The user will typically call
- * this action if/when connection has been severed, or when the app
- * was started up before an IM was started up
- */
-/*ARGSUSED*/
-static void
-Reconnect(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- _XawImReconnect(w);
-}
-
-#define CAPITALIZE 1
-#define DOWNCASE 2
-#define UPCASE 3
-
-#ifdef NO_LIBC_I18N
-static int
-ToLower(int ch)
-{
- char buf[2];
-
- *buf = ch;
- XmuNCopyISOLatin1Lowered(buf, buf, sizeof(buf));
-
- return (*buf);
-}
-
-static int
-ToUpper(int ch)
-{
- char buf[2];
-
- *buf = ch;
- XmuNCopyISOLatin1Uppered(buf, buf, sizeof(buf));
-
- return (*buf);
-}
-
-static int
-IsAlnum(int ch)
-{
- return ((ch >= '0' && ch <= '9') || ToUpper(ch) != ch || ToLower(ch) != ch);
-}
-
-static int
-IsLower(int ch)
-{
- char upbuf[2];
- char lobuf[2];
-
- *upbuf = *lobuf = ch;
- XmuNCopyISOLatin1Lowered(lobuf, lobuf, sizeof(lobuf));
- XmuNCopyISOLatin1Uppered(upbuf, upbuf, sizeof(upbuf));
-
- return (*lobuf != *upbuf && ch == *lobuf);
-}
-
-static int
-IsUpper(int ch)
-{
- char upbuf[2];
- char lobuf[2];
-
- *upbuf = *lobuf = ch;
- XmuNCopyISOLatin1Lowered(lobuf, lobuf, sizeof(lobuf));
- XmuNCopyISOLatin1Uppered(upbuf, upbuf, sizeof(upbuf));
-
- return (*lobuf != *upbuf && ch == *upbuf);
-}
-#else
-#define ToLower tolower
-#define ToUpper toupper
-#define IsAlnum isalnum
-#define IsLower islower
-#define IsUpper isupper
-#endif
-
-static void
-CaseProc(Widget w, XEvent *event, int cmd)
-{
- TextWidget ctx = (TextWidget)w;
- short mul = MULT(ctx);
- XawTextPosition left, right;
- XawTextBlock block;
- Bool changed = False;
- unsigned char ch, mb[sizeof(wchar_t)];
- int i, count;
-
- if (mul > 0)
- right = SrcScan(ctx->text.source, left = ctx->text.insertPos,
- XawstAlphaNumeric, XawsdRight, mul, False);
- else
- left = SrcScan(ctx->text.source, right = ctx->text.insertPos,
- XawstAlphaNumeric, XawsdLeft, 1 + -mul, False);
- block.firstPos = 0;
- block.format = _XawTextFormat(ctx);
- block.length = right - left;
- block.ptr = _XawTextGetText(ctx, left, right);
-
- count = 0;
- if (block.format == XawFmt8Bit)
- for (i = 0; i < block.length; i++) {
- if (!IsAlnum(*mb = (unsigned char)block.ptr[i]))
- count = 0;
- else if (++count == 1 || cmd != CAPITALIZE) {
- ch = cmd == DOWNCASE ? ToLower(*mb) : ToUpper(*mb);
- if (ch != *mb) {
- changed = True;
- block.ptr[i] = ch;
- }
- }
- else if (cmd == CAPITALIZE) {
- if ((ch = ToLower(*mb)) != *mb) {
- changed = True;
- block.ptr[i] = ch;
- }
- }
- }
- else
- for (i = 0; i < block.length; i++) {
- wctomb((char*)mb, ((wchar_t*)block.ptr)[i]);
- if (!IsAlnum(*mb))
- count = 0;
- else if (++count == 1 || cmd != CAPITALIZE) {
- ch = cmd == DOWNCASE ? ToLower(*mb) : ToUpper(*mb);
- if (ch != *mb) {
- changed = True;
- ((wchar_t*)block.ptr)[i] = _Xaw_atowc(ch);
- }
- }
- else if (cmd == CAPITALIZE) {
- if ((ch = ToLower(*mb)) != *mb) {
- changed = True;
- ((wchar_t*)block.ptr)[i] = _Xaw_atowc(ch);
- }
- }
- }
-
- StartAction(ctx, event);
- if (changed && _XawTextReplace(ctx, left, right, &block) != XawEditDone)
- XBell(XtDisplay(ctx), 0);
- ctx->text.insertPos = right;
- EndAction(ctx);
-
- XtFree(block.ptr);
-}
-
-/*ARGSUSED*/
-static void
-CapitalizeWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CaseProc(w, event, CAPITALIZE);
-}
-
-/*ARGSUSED*/
-static void
-DowncaseWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CaseProc(w, event, DOWNCASE);
-}
-
-/*ARGSUSED*/
-static void
-UpcaseWord(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- CaseProc(w, event, UPCASE);
-}
-#undef CAPITALIZE
-#undef DOWNCASE
-#undef UPCASE
-
-XtActionsRec _XawTextActionsTable[] = {
- /* motion */
- {"forward-character", MoveForwardChar},
- {"backward-character", MoveBackwardChar},
- {"forward-word", MoveForwardWord},
- {"backward-word", MoveBackwardWord},
- {"forward-paragraph", MoveForwardParagraph},
- {"backward-paragraph", MoveBackwardParagraph},
- {"beginning-of-line", MoveToLineStart},
- {"end-of-line", MoveToLineEnd},
- {"next-line", MoveNextLine},
- {"previous-line", MovePreviousLine},
- {"next-page", MoveNextPage},
- {"previous-page", MovePreviousPage},
- {"beginning-of-file", MoveBeginningOfFile},
- {"end-of-file", MoveEndOfFile},
- {"scroll-one-line-up", ScrollOneLineUp},
- {"scroll-one-line-down", ScrollOneLineDown},
-
- /* delete */
- {"delete-next-character", DeleteForwardChar},
- {"delete-previous-character", DeleteBackwardChar},
- {"delete-next-word", DeleteForwardWord},
- {"delete-previous-word", DeleteBackwardWord},
- {"delete-selection", DeleteCurrentSelection},
- {"delete", Delete},
-
- /* kill */
- {"kill-word", KillForwardWord},
- {"backward-kill-word", KillBackwardWord},
- {"kill-selection", KillCurrentSelection},
- {"kill-to-end-of-line", KillToEndOfLine},
- {"kill-to-end-of-paragraph", KillToEndOfParagraph},
-
- /* new line */
- {"newline-and-indent", InsertNewLineAndIndent},
- {"newline-and-backup", InsertNewLineAndBackup},
- {"newline", InsertNewLine},
-
- /* selection */
- {"select-word", SelectWord},
- {"select-all", SelectAll},
- {"select-start", SelectStart},
- {"select-adjust", SelectAdjust},
- {"select-end", SelectEnd},
- {"select-save", SelectSave},
- {"extend-start", ExtendStart},
- {"extend-adjust", ExtendAdjust},
- {"extend-end", ExtendEnd},
- {"insert-selection", InsertSelection},
-
- /* miscellaneous */
- {"redraw-display", RedrawDisplay},
- {"insert-file", _XawTextInsertFile},
- {"search", _XawTextSearch},
- {"insert-char", InsertChar},
- {"insert-string", InsertString},
- {"focus-in", TextFocusIn},
- {"focus-out", TextFocusOut},
- {"enter-window", TextEnterWindow},
- {"leave-window", TextLeaveWindow},
- {"display-caret", DisplayCaret},
- {"multiply", Multiply},
- {"form-paragraph", FormParagraph},
- {"transpose-characters", TransposeCharacters},
- {"set-keyboard-focus", SetKeyboardFocus},
-#ifndef OLDXAW
- {"numeric", Numeric},
- {"undo", Undo},
- {"keyboard-reset", KeyboardReset},
- {"kill-ring-yank", KillRingYank},
- {"toggle-overwrite", ToggleOverwrite},
- {"indent", Indent},
-#endif
- {"no-op", NoOp},
-
- /* case transformations */
- {"capitalize-word", CapitalizeWord},
- {"downcase-word", DowncaseWord},
- {"upcase-word", UpcaseWord},
-
- /* action to bind translations for text dialogs */
- {"InsertFileAction", _XawTextInsertFileAction},
- {"DoSearchAction", _XawTextDoSearchAction},
- {"DoReplaceAction", _XawTextDoReplaceAction},
- {"SetField", _XawTextSetField},
- {"PopdownSearchAction", _XawTextPopdownSearchAction},
-
- /* reconnect to Input Method */
- {"reconnect-im", Reconnect} /* Li Yuhong, Omron KK, 1991 */
-};
-
-Cardinal _XawTextActionsTableCount = XtNumber(_XawTextActionsTable);
diff --git a/xc/lib/Xaw/TextP.h b/xc/lib/Xaw/TextP.h
deleted file mode 100644
index 3b9e32d30..000000000
--- a/xc/lib/Xaw/TextP.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-* $TOG: TextP.h /main/55 1998/02/06 12:51:17 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/TextP.h,v 3.18 1999/06/20 08:41:10 dawes Exp $ */
-
-#ifndef _XawTextP_h
-#define _XawTextP_h
-
-#include <X11/Xaw/Text.h>
-#include <X11/Xaw/SimpleP.h>
-
-#define MAXCUT 30000 /* Maximum number of characters that can be cut */
-
-#define XawTextGetLastPosition(ctx) \
- XawTextSourceScan((ctx)->text.source, 0, \
- XawstAll, XawsdRight, 1, True)
-#define GETLASTPOS XawTextGetLastPosition(ctx)
-
-#define zeroPosition ((XawTextPosition)0)
-
-extern XtActionsRec _XawTextActionsTable[];
-extern Cardinal _XawTextActionsTableCount;
-
-#define XawLF 0x0a
-#define XawCR 0x0d
-#define XawTAB 0x09
-#define XawBS 0x08
-#define XawSP 0x20
-#define XawDEL 0x7f
-#define XawESC 0x1b
-#define XawBSLASH '\\'
-
-/* constants that subclasses may want to know */
-#define DEFAULT_TEXT_HEIGHT ((Dimension)~0)
-#define DEFAULT_TAB_SIZE 8
-
-/* displayable text management data structures */
-typedef struct {
- XawTextPosition position;
- Position y;
-#ifndef OLDXAW
- unsigned int textWidth;
-#else
- Dimension textWidth;
-#endif
-} XawTextLineTableEntry, *XawTextLineTableEntryPtr;
-
-typedef struct {
- XawTextPosition left, right;
- XawTextSelectType type;
- Atom *selections;
- int atom_count;
- int array_size;
-} XawTextSelection;
-
-typedef struct _XawTextSelectionSalt {
- struct _XawTextSelectionSalt *next;
- XawTextSelection s;
- /*
- * The element "contents" stores the CT string which is gotten in the
- * function _XawTextSaltAwaySelection()
- */
- char *contents;
- int length;
-} XawTextSelectionSalt;
-
-#ifndef OLDXAW
-typedef struct _XawTextKillRing {
- struct _XawTextKillRing *next;
- char *contents;
- int length;
- unsigned refcount;
- unsigned long format;
-} XawTextKillRing;
-
-extern XawTextKillRing *xaw_text_kill_ring;
-#endif
-
-/* Line Tables are n+1 long - last position displayed is in last lt entry */
-typedef struct {
- XawTextPosition top; /* Top of the displayed text */
- int lines; /* How many lines in this table */
-#ifndef OLDXAW
- int base_line; /* line number of first entry */
-#endif
- XawTextLineTableEntry *info; /* A dynamic array, one entry per line */
-} XawTextLineTable, *XawTextLineTablePtr;
-
-typedef struct _XawTextMargin {
- Position left, right, top, bottom;
-} XawTextMargin;
-
-typedef struct _XmuScanline XmuTextUpdate;
-
-#define VMargins(ctx) ((ctx)->text.margin.top + (ctx)->text.margin.bottom)
-#define HMargins(ctx) ((ctx)->text.left_margin + (ctx)->text.margin.right)
-#define RVMargins(ctx) ((ctx)->text.r_margin.top + (ctx)->text.r_margin.bottom)
-#define RHMargins(ctx) ((ctx)->text.r_margin.left + (ctx)->text.r_margin.right)
-
-#define IsPositionVisible(ctx, pos) \
-(pos >= ctx->text.lt.info[0].position && \
- pos < ctx->text.lt.info[ctx->text.lt.lines].position)
-
-/*
- * Search & Replace data structure
- */
-struct SearchAndReplace {
- Boolean selection_changed; /* flag so that the selection cannot be
- changed out from underneath query-replace.*/
- Widget search_popup; /* The poppup widget that allows searches.*/
- Widget label1; /* The label widgets for the search window. */
- Widget label2;
- Widget left_toggle; /* The left search toggle radioGroup. */
- Widget right_toggle; /* The right search toggle radioGroup. */
- Widget rep_label; /* The Replace label string. */
- Widget rep_text; /* The Replace text field. */
- Widget search_text; /* The Search text field. */
- Widget rep_one; /* The Replace one button. */
- Widget rep_all; /* The Replace all button. */
-#ifndef OLDXAW
- Widget case_sensitive; /* The "Case Sensitive" toggle */
-#endif
-};
-
-/* New fields for the Text widget class record */
-typedef struct {
- XtPointer extension;
-} TextClassPart;
-
-/* Full class record declaration */
-typedef struct _TextClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- TextClassPart text_class;
-} TextClassRec;
-
-extern TextClassRec textClassRec;
-
-/* New fields for the Text widget record */
-typedef struct _TextPart {
- /* resources */
- Widget source, sink;
- XawTextPosition insertPos;
- XawTextSelection s;
- XawTextSelectType *sarray; /* Array to cycle for selections */
- XawTextSelectionSalt *salt; /* salted away selections */
- int left_margin;
- int dialog_horiz_offset, dialog_vert_offset; /* position for popup dialog */
- Boolean display_caret; /* insertion pt visible iff T */
- Boolean auto_fill; /* Auto fill mode? */
- XawTextScrollMode scroll_vert, scroll_horiz;
- XawTextWrapMode wrap; /* The type of wrapping */
- XawTextResizeMode resize;
- XawTextMargin r_margin; /* The real margins */
-#ifndef OLDXAW
- XtCallbackList position_callbacks;
-#else
- XtPointer pad1;
-#endif
-
- /* private state */
- XawTextMargin margin; /* The current margins */
- XawTextLineTable lt;
- XawTextScanDirection extendDir;
- XawTextSelection origSel; /* the selection being modified */
- Time lasttime; /* timestamp of last processed action */
- Time time; /* time of last key or button action */
- Position ev_x, ev_y; /* x, y coords for key or button action */
- Widget vbar, hbar; /* The scroll bars (none = NULL) */
- struct SearchAndReplace *search; /* Search and replace structure */
- Widget file_insert; /* The file insert popup widget */
- XmuTextUpdate *update; /* Position intervals to update */
-#ifndef OLDXAW
- int line_number;
- short column_number;
- unsigned char kill_ring;
- Boolean selection_state;
-#else
- XtPointer pad2;
- int pad3;
-#endif
- int from_left; /* Cursor position */
- XawTextPosition lastPos; /* Last position of source */
- GC gc;
- Boolean showposition; /* True if we need to show the position */
- Boolean hasfocus; /* TRUE if we currently have input focus*/
- Boolean update_disabled; /* TRUE if display updating turned off */
- Boolean clear_to_eol; /* Clear to eol when painting text? */
- XawTextPosition old_insert; /* Last insertPos for batched updates */
- short mult; /* Multiplier */
-#ifndef OLDXAW
- XawTextKillRing *kill_ring_ptr;
-#else
- XtPointer pad4;
-#endif
-
- /* private state, shared w/Source and Sink */
- Boolean redisplay_needed; /* in SetValues */
- XawTextSelectionSalt *salt2; /* salted away selections */
-
-#ifndef OLDXAW
- char numeric;
- char source_changed;
- Boolean overwrite; /* Overwrite mode */
-
- /* new resources and states, for text edition
- * Note: a fixed width font is required for these resources/states.
- */
- short left_column, right_column;
- XawTextJustifyMode justify;
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} TextPart;
-
-#define XtRWrapMode "WrapMode"
-#define XtRScrollMode "ScrollMode"
-#define XtRResizeMode "ResizeMode"
-#define XtRJustifyMode "JustifyMode"
-
-/* full instance record */
-typedef struct _TextRec {
- CorePart core;
- SimplePart simple;
- TextPart text;
-} TextRec;
-
-/*
- * Semi-private functions
- * for use by other Xaw modules only
- */
-void _XawTextBuildLineTable
-(
- TextWidget ctx,
- XawTextPosition top_pos,
- _XtBoolean force_rebuild
- );
-
-char *_XawTextGetSTRING
-(
- TextWidget ctx,
- XawTextPosition left,
- XawTextPosition right
- );
-
-void _XawTextSaltAwaySelection
-(
- TextWidget ctx,
- Atom *selections,
- int num_atoms
- );
-
-void _XawTextPosToXY
-(
- Widget w,
- XawTextPosition pos,
- Position *x,
- Position *y
- );
-
-#endif /* _XawTextP_h */
diff --git a/xc/lib/Xaw/TextPop.c b/xc/lib/Xaw/TextPop.c
deleted file mode 100644
index c8ed5ab1c..000000000
--- a/xc/lib/Xaw/TextPop.c
+++ /dev/null
@@ -1,1526 +0,0 @@
-/* $TOG: TextPop.c /main/34 1998/06/24 11:53:54 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.
-
-*/
-
-/* $XFree86: xc/lib/Xaw/TextPop.c,v 1.15 1999/08/28 09:00:27 dawes Exp $ */
-
-/*
- * This file is broken up into three sections one dealing with
- * each of the three popups created here:
- *
- * FileInsert, Search, and Replace.
- *
- * There is also a section at the end for utility functions
- * used by all more than one of these dialogs.
- *
- * The following functions are the only non-static ones defined
- * in this module. They are located at the begining of the
- * section that contains this dialog box that uses them.
- *
- * void _XawTextInsertFileAction(w, event, params, num_params);
- * void _XawTextDoSearchAction(w, event, params, num_params);
- * void _XawTextDoReplaceAction(w, event, params, num_params);
- * void _XawTextInsertFile(w, event, params, num_params);
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Shell.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/AsciiText.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/Command.h>
-#include <X11/Xaw/Form.h>
-#include <X11/Xaw/Toggle.h>
-#include "XawI18n.h"
-
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
-static char* INSERT_FILE = "Enter Filename:";
-static char* SEARCH_LABEL_1 = "Use <Tab> to change fields.";
-static char* SEARCH_LABEL_2 = "Use ^q<Tab> for <Tab>.";
-static char* DISMISS_NAME = "cancel";
-#define DISMISS_NAME_LEN 6
-static char* FORM_NAME = "form";
-static char* LABEL_NAME = "label";
-static char* TEXT_NAME = "text";
-
-#define R_OFFSET 1
-
-typedef void (*AddFunc)(Widget, char*, Widget);
-
-/*
- * Prototypes
- */
-static void _SetField(Widget, Widget);
-static void AddSearchChildren(Widget, char*, Widget);
-static void AddInsertFileChildren(Widget, char*, Widget);
-static void CenterWidgetOnPoint(Widget, XEvent*);
-static Widget CreateDialog(Widget, String, String, AddFunc);
-static void DoInsert(Widget, XtPointer, XtPointer);
-static void DoReplaceAll(Widget, XtPointer, XtPointer);
-static void DoReplaceOne(Widget, XtPointer, XtPointer);
-static Bool DoSearch(struct SearchAndReplace*);
-static Widget GetShell(Widget);
-static String GetString(Widget);
-static String GetStringRaw(Widget);
-static void InitializeSearchWidget(struct SearchAndReplace*,
- XawTextScanDirection, Bool);
-static Bool InParams(String, String*, unsigned int);
-static Bool InsertFileNamed(Widget, char*);
-static void PopdownFileInsert(Widget, XtPointer, XtPointer);
-static void PopdownSearch(Widget, XtPointer, XtPointer);
-static Bool Replace(struct SearchAndReplace*, Bool, Bool);
-static void SearchButton(Widget, XtPointer, XtPointer);
-static void SetResource(Widget, char*, XtArgVal);
-static Bool SetResourceByName(Widget, char*, char*, XtArgVal);
-static void SetSearchLabels(struct SearchAndReplace*, String, String, Bool);
-static void SetWMProtocolTranslations(Widget);
-
-/*
- * Actions
- */
-static void WMProtocols(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * External Actions
- */
-void _XawTextDoReplaceAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextDoSearchAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextInsertFile(Widget, XEvent*, String*, Cardinal*);
-void _XawTextInsertFileAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextPopdownSearchAction(Widget, XEvent*, String*, Cardinal*);
-void _XawTextSearch(Widget, XEvent*, String*, Cardinal*);
-void _XawTextSetField(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * From Text.c
- */
-char *_XawTextGetText(TextWidget, XawTextPosition, XawTextPosition);
-void _XawTextShowPosition(TextWidget);
-
-/*
- * Initialization
- */
-static char radio_trans_string[] =
-"<Btn1Down>,<Btn1Up>:" "set() notify()\n"
-;
-
-static char search_text_trans[] =
-"~s<Key>Return:" "DoSearchAction(Popdown)\n"
-"s<Key>Return:" "DoSearchAction() SetField(Replace)\n"
-"c<Key>c:" "PopdownSearchAction()\n"
-"<Btn1Down>:" "select-start() SetField(Search)\n"
-"<Key>Tab:" "DoSearchAction() SetField(Replace)\n"
-;
-
-static char rep_text_trans[] =
-"~s<Key>Return:" "DoReplaceAction(Popdown)\n"
-"s<Key>Return:" "SetField(Search)\n"
-"c<Key>c:" "PopdownSearchAction()\n"
-"<Btn1Down>:" "select-start() DoSearchAction() SetField(Replace)\n"
-"<Key>Tab:" "SetField(Search)\n"
-;
-
-/*
- * Implementation
- */
-/*
- * This section of the file contains all the functions that
- * the file insert dialog box uses
- */
-
-/*
- * Function:
- * _XawTextInsertFileAction
- *
- * Description:
- * Action routine that can be bound to dialog box's Text Widget
- * that will insert a file into the main Text Widget.
- */
-/*ARGSUSED*/
-void
-_XawTextInsertFileAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- DoInsert(w, (XtPointer)XtParent(XtParent(XtParent(w))), NULL);
-}
-
-/*
- * Function:
- * _XawTextInsertFile
- *
- * Parameters:
- * w - text widget
- * event - X Event (used to get x and y location)
- * params - parameter list
- * num_params - ""
- *
- * Description:
- * Action routine that can be bound to the text widget
- * it will popup the insert file dialog box.
- *
- * Note:
- * The parameter list may contain one entry
- *
- * Entry:
- * This entry is optional and contains the value of the default
- * file to insert
- */
-void
-_XawTextInsertFile(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- char *ptr;
- XawTextEditType edit_mode;
- Arg args[1];
-
- XtSetArg(args[0], XtNeditType, &edit_mode);
- XtGetValues(ctx->text.source, args, 1);
-
- if (edit_mode != XawtextEdit) {
- XBell(XtDisplay(w), 0);
- return;
- }
-
- if (*num_params == 0)
- ptr = "";
- else
- ptr = params[0];
-
- if (!ctx->text.file_insert) {
- ctx->text.file_insert = CreateDialog(w, ptr, "insertFile",
- AddInsertFileChildren);
- XtRealizeWidget(ctx->text.file_insert);
- SetWMProtocolTranslations(ctx->text.file_insert);
- }
-
- CenterWidgetOnPoint(ctx->text.file_insert, event);
- XtPopup(ctx->text.file_insert, XtGrabNone);
-}
-
-/*
- * Function:
- * PopdownFileInsert
- *
- * Parameters:
- * w - widget that caused this action
- * closure - pointer to the main text widget that popped up this dialog
- * call_data - (not used)
- *
- * Description:
- * Pops down the file insert button
- */
-/*ARGSUSED*/
-static void
-PopdownFileInsert(Widget w, XtPointer closure, XtPointer call_data)
-{
- TextWidget ctx = (TextWidget)closure;
-
- XtPopdown(ctx->text.file_insert);
- (void)SetResourceByName(ctx->text.file_insert, LABEL_NAME,
- XtNlabel, (XtArgVal)INSERT_FILE);
-}
-
-/*
- * Function:
- * DoInsert
- *
- * Parameters:
- * w - widget that activated this callback
- * closure - pointer to the text widget to insert the file into
- *
- * Description:
- * Actually insert the file named in the text widget of the file dialog
- */
-/*ARGSUSED*/
-static void
-DoInsert(Widget w, XtPointer closure, XtPointer call_data)
-{
- TextWidget ctx = (TextWidget)closure;
- char buf[BUFSIZ], msg[BUFSIZ];
- Widget temp_widget;
-
- (void)XmuSnprintf(buf, sizeof(buf), "%s.%s", FORM_NAME, TEXT_NAME);
- if ((temp_widget = XtNameToWidget(ctx->text.file_insert, buf)) == NULL) {
- (void)strcpy(msg,
- "Error: Could not get text widget from file insert popup");
- }
- else if (InsertFileNamed((Widget)ctx, GetString(temp_widget))) {
- PopdownFileInsert(w, closure, call_data);
- return;
- }
- else
- (void)XmuSnprintf(msg, sizeof(msg), "Error: %s", strerror(errno));
-
- (void)SetResourceByName(ctx->text.file_insert,
- LABEL_NAME, XtNlabel, (XtArgVal)msg);
- XBell(XtDisplay(w), 0);
-}
-
-/*
- * Function:
- * InsertFileNamed
- *
- * Parameters:
- * tw - text widget to insert this file into
- * str - name of the file to insert
- *
- * Description:
- * Inserts a file into the text widget.
- *
- * Returns:
- * True if the insert was sucessful, False otherwise.
- */
-static Bool
-InsertFileNamed(Widget tw, char *str)
-{
- FILE *file;
- XawTextBlock text;
- XawTextPosition pos;
-
- if (str == NULL || strlen(str) == 0 || (file = fopen(str, "r")) == NULL)
- return (False);
-
- pos = XawTextGetInsertionPoint(tw);
-
- fseek(file, 0L, 2);
-
- text.firstPos = 0;
- text.length = ftell(file);
- text.ptr = XtMalloc(text.length + 1);
- text.format = XawFmt8Bit;
-
- fseek(file, 0L, 0);
- if (fread(text.ptr, 1, text.length, file) != text.length)
- XtErrorMsg("readError", "insertFileNamed", "XawError",
- "fread returned error", NULL, NULL);
-
- if (XawTextReplace(tw, pos, pos, &text) != XawEditDone) {
- XtFree(text.ptr);
- fclose(file);
- return (False);
- }
- pos += text.length;
- XtFree(text.ptr);
- fclose(file);
- XawTextSetInsertionPoint(tw, pos);
- _XawTextShowPosition((TextWidget)tw);
-
- return (True);
-}
-
-/*
- * Function:
- * AddInsertFileChildren
- *
- * Parameters:
- * form - form widget for the insert dialog widget
- * ptr - pointer to the initial string for the Text Widget
- * tw - main text widget
- *
- * Description:
- * Adds all children to the InsertFile dialog widget.
- */
-static void
-AddInsertFileChildren(Widget form, char *ptr, Widget tw)
-{
- Arg args[10];
- Cardinal num_args;
- Widget label, text, cancel, insert;
- XtTranslations trans;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, INSERT_FILE); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNresizable, True); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
- label = XtCreateManagedWidget(LABEL_NAME, labelWidgetClass, form,
- args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNfromVert, label); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainRight); num_args++;
- XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
- XtSetArg(args[num_args], XtNresizable, True); num_args++;
- XtSetArg(args[num_args], XtNstring, ptr); num_args++;
- text = XtCreateManagedWidget(TEXT_NAME, asciiTextWidgetClass, form,
- args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Insert File"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, text); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- insert = XtCreateManagedWidget("insert", commandWidgetClass, form,
- args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Cancel"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, text); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, insert); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- cancel = XtCreateManagedWidget(DISMISS_NAME, commandWidgetClass, form,
- args, num_args);
-
- XtAddCallback(cancel, XtNcallback, PopdownFileInsert, (XtPointer)tw);
- XtAddCallback(insert, XtNcallback, DoInsert, (XtPointer)tw);
-
- XtSetKeyboardFocus(form, text);
-
- /*
- * Bind <CR> to insert file
- */
- trans = XtParseTranslationTable("<Key>Return:InsertFileAction()");
- XtOverrideTranslations(text, trans);
-}
-
-/*
- * This section of the file contains all the functions that
- * the search dialog box uses
- */
-/*
- * Function:
- * _XawTextDoSearchAction
- *
- * Description:
- * Action routine that can be bound to dialog box's Text Widget that
- * will search for a string in the main Text Widget.
- *
- * Note:
- * If the search was sucessful and the argument popdown is passed to
- * this action routine then the widget will automatically popdown the
- * search widget
- */
-/*ARGSUSED*/
-void
-_XawTextDoSearchAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- TextWidget tw = (TextWidget)XtParent(XtParent(XtParent(w)));
- Bool popdown = False;
-
- if (*num_params == 1 && (params[0][0] == 'p' || params[0][0] == 'P'))
- popdown = True;
-
- if (DoSearch(tw->text.search) && popdown)
- PopdownSearch(w, (XtPointer)tw->text.search, NULL);
-}
-
-/*
- * Function:
- * _XawTextPopdownSearchAction
- *
- * Description:
- * Action routine that can be bound to dialog box's Text Widget that
- * will popdown the search widget.
- */
-/*ARGSUSED*/
-void
-_XawTextPopdownSearchAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- TextWidget tw = (TextWidget)XtParent(XtParent(XtParent(w)));
-
- PopdownSearch(w, (XtPointer)tw->text.search, NULL);
-}
-
-/*
- * Function:
- * PopdownSearch
- *
- * Parameters:
- * w - (not used)
- * closure - pointer to the search structure
- * call_data - (not used)
- *
- * Description:
- * Pops down the search widget and resets it
- */
-/*ARGSUSED*/
-static void
-PopdownSearch(Widget w, XtPointer closure, XtPointer call_data)
-{
- struct SearchAndReplace *search = (struct SearchAndReplace *)closure;
-
- XtPopdown(search->search_popup);
- SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, False);
-}
-
-/*
- * Function:
- * SearchButton
- *
- * Arguments:
- * w - (not used)
- * closure - pointer to the search info
- * call_data - (not used)
- *
- * Description:
- * Performs a search when the button is clicked.
- */
-/*ARGSUSED*/
-static void
-SearchButton(Widget w, XtPointer closure, XtPointer call_data)
-{
- (void)DoSearch((struct SearchAndReplace *)closure);
-}
-
-/*
- * Function:
- * _XawTextSearch
- *
- * Parameters:
- * w - text widget
- * event - X Event (used to get x and y location)
- * params - parameter list
- * num_params - ""
- *
- * Description:
- * Action routine that can be bound to the text widget
- * it will popup the search dialog box.
- *
- * Note:
- * The parameter list contains one or two entries that may be
- * the following.
- *
- * First Entry:
- * The first entry is the direction to search by default.
- * This arguement must be specified and may have a value of
- * "left" or "right".
- *
- * Second Entry:
- * This entry is optional and contains the value of the default
- * string to search for.
- */
-
-#define SEARCH_HEADER "Text Widget - Search():"
-void
-_XawTextSearch(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)w;
- XawTextScanDirection dir;
- char *ptr, buf[BUFSIZ];
- XawTextEditType edit_mode;
- Arg args[1];
- wchar_t wcs[1];
-
- if (*num_params < 1 || *num_params > 2) {
- (void)XmuSnprintf(buf, sizeof(buf), "%s %s\n%s", SEARCH_HEADER,
- "This action must have only",
- "one or two parameters");
- XtAppWarning(XtWidgetToApplicationContext(w), buf);
- return;
- }
-
- if (*num_params == 2)
- ptr = params[1];
- else if (XawTextFormat(ctx, XawFmtWide)) {
- /* This just does the equivalent of
- ptr = ""L, a waste because params[1] isnt W aligned */
- ptr = (char *)wcs;
- wcs[0] = 0;
- }
- else
- ptr = "";
-
- switch(params[0][0]) {
- case 'b': /* Left */
- case 'B':
- dir = XawsdLeft;
- break;
- case 'f': /* Right */
- case 'F':
- dir = XawsdRight;
- break;
- default:
- (void)XmuSnprintf(buf, sizeof(buf), "%s %s\n%s", SEARCH_HEADER,
- "The first parameter must be",
- "Either 'backward' or 'forward'");
- XtAppWarning(XtWidgetToApplicationContext(w), buf);
- return;
- }
-
- if (ctx->text.search== NULL) {
- ctx->text.search = XtNew(struct SearchAndReplace);
- ctx->text.search->search_popup = CreateDialog(w, ptr, "search",
- AddSearchChildren);
- XtRealizeWidget(ctx->text.search->search_popup);
- SetWMProtocolTranslations(ctx->text.search->search_popup);
- }
- else if (*num_params > 1)
- XtVaSetValues(ctx->text.search->search_text, XtNstring, ptr, NULL);
-
- XtSetArg(args[0], XtNeditType,&edit_mode);
- XtGetValues(ctx->text.source, args, 1);
-
- InitializeSearchWidget(ctx->text.search, dir, (edit_mode == XawtextEdit));
-
- CenterWidgetOnPoint(ctx->text.search->search_popup, event);
- XtPopup(ctx->text.search->search_popup, XtGrabNone);
-}
-
-/*
- * Function:
- * InitializeSearchWidget
- *
- * Parameters:
- * search - search widget structure
- * dir - direction to search
- * replace_active - state of the sensitivity for the replace button
- *
- * Description:
- * This function initializes the search widget and
- * is called each time the search widget is poped up.
- */
-static void
-InitializeSearchWidget(struct SearchAndReplace *search,
- XawTextScanDirection dir, Bool replace_active)
-{
- SetResource(search->rep_one, XtNsensitive, (XtArgVal)replace_active);
- SetResource(search->rep_all, XtNsensitive, (XtArgVal)replace_active);
- SetResource(search->rep_label, XtNsensitive, (XtArgVal)replace_active);
- SetResource(search->rep_text, XtNsensitive, (XtArgVal)replace_active);
-
- switch (dir) {
- case XawsdLeft:
- SetResource(search->left_toggle, XtNstate, (XtArgVal)True);
- break;
- case XawsdRight:
- SetResource(search->right_toggle, XtNstate, (XtArgVal)True);
- break;
- }
-}
-
-/*
- * Function:
- * AddSearchChildren
- *
- * Parameters:
- * form - form widget for the search widget
- * ptr - pointer to the initial string for the Text Widget
- * tw - main text widget
- *
- * Description:
- * Adds all children to the Search Dialog Widget.
- */
-static void
-AddSearchChildren(Widget form, char *ptr, Widget tw)
-{
- Arg args[10];
- Cardinal num_args;
- Widget cancel, search_button, s_label, s_text, r_text;
- XtTranslations trans;
- struct SearchAndReplace *search = ((TextWidget)tw)->text.search;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNresizable, True); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
- search->label1 = XtCreateManagedWidget("label1", labelWidgetClass, form,
- args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNfromVert, search->label1); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNresizable, True); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
- search->label2 = XtCreateManagedWidget("label2", labelWidgetClass, form,
- args, num_args);
-
- /*
- * We need to add R_OFFSET to the radio_data, because the value zero (0)
- * has special meaning
- */
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Backward"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNradioData, (XPointer)XawsdLeft + R_OFFSET);
- num_args++;
- search->left_toggle = XtCreateManagedWidget("backwards", toggleWidgetClass,
- form, args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Forward"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, search->left_toggle); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNradioGroup, search->left_toggle); num_args++;
- XtSetArg(args[num_args], XtNradioData, (XPointer)XawsdRight + R_OFFSET);
- num_args++;
- search->right_toggle = XtCreateManagedWidget("forwards", toggleWidgetClass,
- form, args, num_args);
-
- {
- XtTranslations radio_translations;
-
- radio_translations = XtParseTranslationTable(radio_trans_string);
- XtOverrideTranslations(search->left_toggle, radio_translations);
- XtOverrideTranslations(search->right_toggle, radio_translations);
- }
-
-#ifndef OLDXAW
- if (XawTextFormat((TextWidget)tw, XawFmt8Bit)) {
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Case Sensitive"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, search->label2); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, search->right_toggle); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNstate, True); num_args++;
- search->case_sensitive = XtCreateManagedWidget("case", toggleWidgetClass,
- form, args, num_args);
- }
- else
- search->case_sensitive = NULL;
-#endif
-
- num_args = 0;
- XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
- XtSetArg(args[num_args], XtNlabel, "Search for: "); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, 0 ); num_args++;
- s_label = XtCreateManagedWidget("searchLabel", labelWidgetClass, form,
- args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNfromVert, search->left_toggle); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, s_label); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainRight); num_args++;
- XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
- XtSetArg(args[num_args], XtNresizable, True); num_args++;
- XtSetArg(args[num_args], XtNstring, ptr); num_args++;
- s_text = XtCreateManagedWidget("searchText", asciiTextWidgetClass, form,
- args, num_args);
- search->search_text = s_text;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNfromVert, s_text); num_args++;
- XtSetArg(args[num_args], XtNlabel, "Replace with:"); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, 0); num_args++;
- search->rep_label = XtCreateManagedWidget("replaceLabel", labelWidgetClass,
- form, args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNfromHoriz, s_label); num_args++;
- XtSetArg(args[num_args], XtNfromVert, s_text); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainRight); num_args++;
- XtSetArg(args[num_args], XtNeditType, XawtextEdit); num_args++;
- XtSetArg(args[num_args], XtNresizable, True); num_args++;
- XtSetArg(args[num_args], XtNstring, ""); num_args++;
- r_text = XtCreateManagedWidget("replaceText", asciiTextWidgetClass,
- form, args, num_args);
- search->rep_text = r_text;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Search"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, r_text); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- search_button = XtCreateManagedWidget("search", commandWidgetClass, form,
- args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Replace"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, r_text); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, search_button); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- search->rep_one = XtCreateManagedWidget("replaceOne", commandWidgetClass,
- form, args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Replace All"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, r_text); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, search->rep_one); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- search->rep_all = XtCreateManagedWidget("replaceAll", commandWidgetClass,
- form, args, num_args);
-
- num_args = 0;
- XtSetArg(args[num_args], XtNlabel, "Cancel"); num_args++;
- XtSetArg(args[num_args], XtNfromVert, r_text); num_args++;
- XtSetArg(args[num_args], XtNfromHoriz, search->rep_all); num_args++;
- XtSetArg(args[num_args], XtNleft, XtChainLeft); num_args++;
- XtSetArg(args[num_args], XtNright, XtChainLeft); num_args++;
- cancel = XtCreateManagedWidget(DISMISS_NAME, commandWidgetClass, form,
- args, num_args);
-
- XtAddCallback(search_button, XtNcallback, SearchButton, (XtPointer)search);
- XtAddCallback(search->rep_one, XtNcallback, DoReplaceOne, (XtPointer)search);
- XtAddCallback(search->rep_all, XtNcallback, DoReplaceAll, (XtPointer)search);
- XtAddCallback(cancel, XtNcallback, PopdownSearch, (XtPointer)search);
-
- /*
- * Initialize the text entry fields
- */
- {
- Pixel color;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNbackground, &color); num_args++;
- XtGetValues(search->rep_text, args, num_args);
- num_args = 0;
- XtSetArg(args[num_args], XtNborderColor, color); num_args++;
- XtSetValues(search->rep_text, args, num_args);
- XtSetKeyboardFocus(form, search->search_text);
- }
-
- SetSearchLabels(search, SEARCH_LABEL_1, SEARCH_LABEL_2, False);
-
- /*
- * Bind Extra translations
- */
- trans = XtParseTranslationTable(search_text_trans);
- XtOverrideTranslations(search->search_text, trans);
-
- trans = XtParseTranslationTable(rep_text_trans);
- XtOverrideTranslations(search->rep_text, trans);
-}
-
-/*
- * Function:
- * DoSearch
- *
- * Parameters:
- * search - search structure
- *
- * Description:
- * Performs a search
- *
- * Returns:
- * True if sucessful
- */
-/*ARGSUSED*/
-static Bool
-DoSearch(struct SearchAndReplace *search)
-{
- char msg[BUFSIZ];
- Widget tw = XtParent(search->search_popup);
- XawTextPosition pos;
- XawTextScanDirection dir;
- XawTextBlock text;
- TextWidget ctx = (TextWidget)tw;
-
- text.firstPos = 0;
- text.ptr = GetStringRaw(search->search_text);
- if ((text.format = _XawTextFormat(ctx)) == XawFmtWide)
- text.length = wcslen((wchar_t*)text.ptr);
- else {
- text.length = strlen(text.ptr);
-
-#ifndef OLDXAW
- if (search->case_sensitive) {
- /* text.firstPos isn't useful here, so I'll use it as an
- * options flag.
- */
- Arg args[1];
- Boolean case_sensitive;
-
- XtSetArg(args[0], XtNstate, &case_sensitive);
- XtGetValues(search->case_sensitive, args, 1);
- text.firstPos = !case_sensitive;
- }
-#endif /* OLDXAW */
- }
-
- dir = (XawTextScanDirection)
- ((XPointer)XawToggleGetCurrent(search->left_toggle) - R_OFFSET);
-
- pos = XawTextSearch(tw, dir, &text);
-
- /* The Raw string in find.ptr may be WC I can't use here, so I re - call
- GetString to get a tame version */
-
- if (pos == XawTextSearchError) {
- (void)XmuSnprintf(msg, sizeof(msg),
- "Could not find string ``%s''.",
- GetString(search->search_text));
- XawTextUnsetSelection(tw);
- SetSearchLabels(search, msg, "", True);
-
- return (False);
- }
- XawTextDisableRedisplay(tw);
- XawTextSetSelection(tw, pos, pos + text.length);
- search->selection_changed = False; /* selection is good */
-
- if (dir == XawsdRight)
- XawTextSetInsertionPoint(tw, pos + text.length);
- else
- XawTextSetInsertionPoint(tw, pos);
- _XawTextShowPosition(ctx);
- XawTextEnableRedisplay(tw);
-
- return (True);
-}
-
-/*
- * This section of the file contains all the functions that
- * the replace dialog box uses
- */
-/*
- * Function:
- * _XawTextDoReplaceAction
- *
- * Description:
- * Action routine that can be bound to dialog box's
- * Text Widget that will replace a string in the main Text Widget.
- */
-/*ARGSUSED*/
-void
-_XawTextDoReplaceAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- TextWidget ctx = (TextWidget)XtParent(XtParent(XtParent(w)));
- Bool popdown = False;
-
- if (*num_params == 1 && (params[0][0] == 'p' || params[0][0] == 'P'))
- popdown = True;
-
- if (Replace( ctx->text.search, True, popdown) && popdown)
- PopdownSearch(w, (XtPointer)ctx->text.search, NULL);
-}
-
-/*
- * Function:
- * DoReplaceOne
- *
- * Arguments:
- * w - *** Not Used ***
- * closure - a pointer to the search structure
- * call_data - *** Not Used ***
- *
- * Description:
- * Replaces the first instance of the string in the search
- * dialog's text widget with the one in the replace dialog's text widget.
- */
-/*ARGSUSED*/
-static void
-DoReplaceOne(Widget w, XtPointer closure, XtPointer call_data)
-{
- Replace((struct SearchAndReplace *)closure, True, False);
-}
-
-/*
- * Function:
- * DoReplaceAll
- *
- * Parameters:
- * w - (not used)
- * closure - pointer to the search structure
- * call_data - (not used)
- *
- * Description:
- * Replaces every instance of the string in the search dialog's
- * text widget with the one in the replace dialog's text widget.
- */
-/*ARGSUSED*/
-static void
-DoReplaceAll(Widget w, XtPointer closure, XtPointer call_data)
-{
- Replace((struct SearchAndReplace *)closure, False, False);
-}
-
-/*
- * Function:
- * Replace
- *
- * Parameters:
- * tw - Text Widget to replce the string in
- * once_only - if True then only replace the first one found,
- * else replace all of them
- * show_current - if true then leave the selection on the
- * string that was just replaced, otherwise
- * move it onto the next one
- *
- * Description:
- * This is the function that does the real work of
- * replacing strings in the main text widget.
- */
-static Bool
-Replace(struct SearchAndReplace *search, Bool once_only, Bool show_current)
-{
- XawTextPosition pos, new_pos, end_pos, ipos;
- XawTextScanDirection dir;
- XawTextBlock find, replace;
- Widget tw = XtParent(search->search_popup);
- int count = 0;
- TextWidget ctx = (TextWidget)tw;
- Bool redisplay;
-
- find.ptr = GetStringRaw(search->search_text);
- if ((find.format = _XawTextFormat(ctx)) == XawFmtWide)
- find.length = (XawTextPosition)wcslen((wchar_t*)find.ptr);
- else
- find.length = (XawTextPosition)strlen(find.ptr);
- find.firstPos = 0;
-
- replace.ptr = GetStringRaw(search->rep_text);
- replace.firstPos = 0;
- if ((replace.format = _XawTextFormat(ctx)) == XawFmtWide)
- replace.length = wcslen((wchar_t*)replace.ptr);
- else
- replace.length = strlen(replace.ptr);
-
- dir = (XawTextScanDirection)
- XawToggleGetCurrent(search->left_toggle) - R_OFFSET;
-
- redisplay = !once_only || (once_only && !show_current);
- ipos = XawTextGetInsertionPoint(tw);
- if (redisplay)
- XawTextDisableRedisplay(tw);
- /*CONSTCOND*/
- while (True) {
- if (count != 0) {
- new_pos = XawTextSearch(tw, dir, &find);
-
- if (new_pos == XawTextSearchError) {
- if (count == 0) {
- char msg[BUFSIZ];
-
- /* The Raw string in find.ptr may be WC I can't use here,
- so I call GetString to get a tame version */
-
- (void)XmuSnprintf(msg, sizeof(msg),
- "Error: Could not find string ``%s''",
- GetString(search->search_text));
- SetSearchLabels(search, msg, "", True);
-
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
- _XawTextShowPosition(ctx);
- XawTextEnableRedisplay(tw);
- }
-
- return (False);
- }
- else
- break;
- }
- pos = new_pos;
- end_pos = pos + find.length;
- }
- else {
- XawTextGetSelectionPos(tw, &pos, &end_pos);
-
- if (search->selection_changed) {
- SetSearchLabels(search, "Selection has been modified, aborting.",
- "", True);
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
- XawTextEnableRedisplay(tw);
- }
-
- return (False);
- }
- if (pos == end_pos) {
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
- XawTextEnableRedisplay(tw);
- }
-
- return (False);
- }
- }
-
- if (XawTextReplace(tw, pos, end_pos, &replace) != XawEditDone) {
- char msg[BUFSIZ];
-
- (void)XmuSnprintf(msg, sizeof(msg),
- "'%s' with '%s'", find.ptr, replace.ptr);
- SetSearchLabels(search, "Error while replacing", msg, True);
- if (redisplay) {
- XawTextSetInsertionPoint(tw, ipos);
- XawTextEnableRedisplay(tw);
- }
-
- return (False);
- }
-
- if (dir == XawsdRight)
- ipos = pos + replace.length;
- else
- ipos = pos;
-
- if (once_only) {
- if (show_current)
- break;
- else {
- DoSearch(search);
- XawTextEnableRedisplay(tw);
-
- return (True);
- }
- }
- count++;
- }
-
- if (replace.length == 0)
- XawTextUnsetSelection(tw);
- else
- XawTextSetSelection(tw, pos, pos + replace.length);
-
- XawTextSetInsertionPoint(tw, ipos);
- _XawTextShowPosition(ctx);
- XawTextEnableRedisplay(tw);
-
- return (True);
-}
-
-/*
- * Function:
- * SetSearchLabels
- *
- * Parameters:
- * search - search structure
- * msg1 - message to put in each search label
- * msg2 - ""
- * bell - if True then ring bell
- *
- * Description:
- * Sets both the search labels, and also rings the bell.
- */
-static void
-SetSearchLabels(struct SearchAndReplace *search, String msg1, String msg2,
- Bool bell)
-{
- (void)SetResource(search->label1, XtNlabel, (XtArgVal)msg1);
- (void)SetResource(search->label2, XtNlabel, (XtArgVal)msg2);
- if (bell)
- XBell(XtDisplay(search->search_popup), 0);
-}
-
-/*
- * This section of the file contains utility routines used by
- * other functions in this file
- */
-/*
- * Function:
- * _XawTextSetField
- *
- * Description:
- * Action routine that can be bound to dialog box's
- * Text Widget that will send input to the field specified.
- */
-/*ARGSUSED*/
-void
-_XawTextSetField(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- struct SearchAndReplace *search;
- Widget cnew, old;
-
- search = ((TextWidget)XtParent(XtParent(XtParent(w))))->text.search;
-
- if (*num_params != 1) {
- SetSearchLabels(search, "Error: SetField Action must have",
- "exactly one argument", True);
- return;
- }
- switch (params[0][0]) {
- case 's':
- case 'S':
- cnew = search->search_text;
- old = search->rep_text;
- break;
- case 'r':
- case 'R':
- old = search->search_text;
- cnew = search->rep_text;
- break;
- default:
- SetSearchLabels(search,
- "Error: SetField Action's first Argument must",
- "be either 'Search' or 'Replace'", True);
- return;
- }
- _SetField(cnew, old);
-}
-
-/*
- * Function:
- * _SetField
- *
- * Parameters:
- * cnew - new and old text fields
- * old - ""
- *
- * Description:
- * Sets the current text field.
- */
-static void
-_SetField(Widget cnew, Widget old)
-{
- Arg args[2];
- Pixel new_border, old_border, old_bg;
-
- if (!XtIsSensitive(cnew)) {
- XBell(XtDisplay(old), 0); /* Don't set field to an inactive Widget */
- return;
- }
-
- XtSetKeyboardFocus(XtParent(cnew), cnew);
-
- XtSetArg(args[0], XtNborderColor, &old_border);
- XtSetArg(args[1], XtNbackground, &old_bg);
- XtGetValues(cnew, args, 2);
-
- XtSetArg(args[0], XtNborderColor, &new_border);
- XtGetValues(old, args, 1);
-
- if (old_border != old_bg) /* Colors are already correct, return */
- return;
-
- SetResource(old, XtNborderColor, (XtArgVal)old_border);
- SetResource(cnew, XtNborderColor, (XtArgVal)new_border);
-}
-
-/*
- * Function:
- * SetResourceByName
- *
- * Parameters:
- * shell - shell widget of the popup
- * name - name of the child
- * res_name - name of the resource
- * value - value of the resource
- *
- * Description:
- * Sets a resource in any of the dialog children given
- * name of the child and the shell widget of the dialog.
- *
- * Returns:
- * True if sucessful
- */
-static Bool
-SetResourceByName(Widget shell, char *name, char *res_name, XtArgVal value)
-{
- Widget temp_widget;
- char buf[BUFSIZ];
-
- (void)XmuSnprintf(buf, sizeof(buf), "%s.%s", FORM_NAME, name);
-
- if ((temp_widget = XtNameToWidget(shell, buf)) != NULL) {
- SetResource(temp_widget, res_name, value);
- return (True);
- }
- return (False);
-}
-
-/*
- * Function:
- * SetResource
- *
- * Parameters:
- * w - widget
- * res_name - name of the resource
- * value - value of the resource
- *
- * Description:
- * Sets a resource in a widget
- */
-static void
-SetResource(Widget w, char *res_name, XtArgVal value)
-{
- Arg args[1];
-
- XtSetArg(args[0], res_name, value);
- XtSetValues( w, args, 1);
-}
-
-/*
- * Function:
- * GetString{Raw}
- *
- * Parameters:
- * text - text widget whose string we will get
- *
- * Description:
- * Gets the value for the string in the popup.
- *
- * Returns:
- * GetString: the string as a MB
- * GetStringRaw: the exact buffer contents suitable for a search
- */
-static String
-GetString(Widget text)
-{
- String string;
- Arg args[1];
-
- XtSetArg(args[0], XtNstring, &string);
- XtGetValues(text, args, 1);
-
- return (string);
-}
-
-static String
-GetStringRaw(Widget tw)
-{
- TextWidget ctx = (TextWidget)tw;
- XawTextPosition last;
-
- last = XawTextSourceScan(ctx->text.source, 0, XawstAll, XawsdRight,
- ctx->text.mult, True);
- return (_XawTextGetText(ctx, 0, last));
-}
-
-/*
- * Function:
- * CenterWidgetOnPoint
- *
- * Parameters:
- * w - shell widget
- * event - event containing the location of the point
- *
- * Description:
- * Centers a shell widget on a point relative to the root window.
- *
- * Note:
- * The widget is not allowed to go off the screen
- */
-static void
-CenterWidgetOnPoint(Widget w, XEvent *event)
-{
- Arg args[3];
- Cardinal num_args;
- Dimension width, height, b_width;
- Position x, y, max_x, max_y;
-
- if (event != NULL) {
- switch (event->type) {
- case ButtonPress:
- case ButtonRelease:
- x = event->xbutton.x_root;
- y = event->xbutton.y_root;
- break;
- case KeyPress:
- case KeyRelease:
- x = event->xkey.x_root;
- y = event->xkey.y_root;
- break;
- default:
- return;
- }
- }
- else
- return;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNwidth, &width); num_args++;
- XtSetArg(args[num_args], XtNheight, &height); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, &b_width); num_args++;
- XtGetValues(w, args, num_args);
-
- width += b_width << 1;
- height += b_width << 1;
-
- x -= (Position)(width >> 1);
- if (x < 0)
- x = 0;
- if (x > (max_x = (Position)(XtScreen(w)->width - width)))
- x = max_x;
-
- y -= (Position)(height >> 1);
- if (y < 0)
- y = 0;
- if (y > (max_y = (Position)(XtScreen(w)->height - height)))
- y = max_y;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNx, x); num_args++;
- XtSetArg(args[num_args], XtNy, y); num_args++;
- XtSetValues(w, args, num_args);
-}
-
-/*
- * Function:
- * CreateDialog
- *
- * Parameters:
- * parent - parent of the dialog - the main text widget
- * ptr - initial_string for the dialog
- * name - name of the dialog
- * func - function to create the children of the dialog
- *
- * Returns:
- * Popup shell of the dialog
- *
- * Note:
- * The function argument is passed the following arguments:
- * form - from widget that is the dialog
- * ptr - initial string for the dialog's text widget
- * parent - parent of the dialog - the main text widget
- */
-static Widget
-CreateDialog(Widget parent, String ptr, String name, AddFunc func)
-{
- Widget popup, form;
- Arg args[5];
- Cardinal num_args;
-
- num_args = 0;
- XtSetArg(args[num_args], XtNiconName, name); num_args++;
- XtSetArg(args[num_args], XtNgeometry, NULL); num_args++;
- XtSetArg(args[num_args], XtNallowShellResize, True); num_args++;
- XtSetArg(args[num_args], XtNtransientFor, GetShell(parent));num_args++;
- popup = XtCreatePopupShell(name, transientShellWidgetClass,
- parent, args, num_args);
-
- form = XtCreateManagedWidget(FORM_NAME, formWidgetClass, popup, NULL, 0);
- XtManageChild (form);
-
- (*func)(form, ptr, parent);
-
- return (popup);
-}
-
-/*
- * Function
- * GetShell
- * nearest shell widget.
- *
- * Parameters:
- * w - widget whose parent shell should be returned
- *
- * Returns:
- * The shell widget among the ancestors of w that is the
- * fewest levels up in the widget hierarchy.
- *
- * Description:
- * Walks up the widget hierarchy to find the topmost shell widget.
- */
-static Widget
-GetShell(Widget w)
-{
- while (w != NULL && !XtIsShell(w))
- w = XtParent(w);
-
- return (w);
-}
-
-static Bool
-InParams(String str, String *p, unsigned int n)
-{
- unsigned int i;
-
- for (i = 0; i < n; p++, i++)
- if (!XmuCompareISOLatin1(*p, str))
- return (True);
- return (False);
-}
-
-static char *WM_DELETE_WINDOW = "WM_DELETE_WINDOW";
-
-static void
-WMProtocols(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- Atom wm_delete_window;
- Atom wm_protocols;
-
- wm_delete_window = XInternAtom(XtDisplay(w), WM_DELETE_WINDOW, True);
- wm_protocols = XInternAtom(XtDisplay(w), "WM_PROTOCOLS", True);
-
- /* Respond to a recognized WM protocol request if
- * event type is ClientMessage and no parameters are passed, or
- * event type is ClientMessage and event data is matched to parameters, or
- * event type isn't ClientMessage and parameters make a request
- */
-#define DO_DELETE_WINDOW InParams(WM_DELETE_WINDOW, params, *num_params)
-
- if ((event->type == ClientMessage
- && event->xclient.message_type == wm_protocols
- && event->xclient.data.l[0] == wm_delete_window
- && (*num_params == 0 || DO_DELETE_WINDOW))
- || (event->type != ClientMessage && DO_DELETE_WINDOW)) {
-#undef DO_DELETE_WINDOW
- Widget cancel;
- char descendant[DISMISS_NAME_LEN + 2];
-
- (void)XmuSnprintf(descendant, sizeof(descendant), "*%s", DISMISS_NAME);
- cancel = XtNameToWidget(w, descendant);
- if (cancel)
- XtCallCallbacks(cancel, XtNcallback, NULL);
- }
-}
-
-static void
-SetWMProtocolTranslations(Widget w)
-{
- static XtTranslations compiled_table;
- static XtAppContext *app_context_list;
- static Cardinal list_size;
-
- unsigned int i;
- XtAppContext app_context;
- Atom wm_delete_window;
-
- app_context = XtWidgetToApplicationContext(w);
-
- /* parse translation table once */
- if (!compiled_table)
- compiled_table =
- XtParseTranslationTable("<Message>WM_PROTOCOLS:XawWMProtocols()\n");
-
- /* add actions once per application context */
- for (i = 0; i < list_size && app_context_list[i] != app_context; i++)
- ;
- if (i == list_size) {
- XtActionsRec actions[1];
-
- actions[0].string = "XawWMProtocols";
- actions[0].proc = WMProtocols;
- list_size++;
- app_context_list = (XtAppContext *)XtRealloc
- ((char *)app_context_list, list_size * sizeof(XtAppContext));
- XtAppAddActions(app_context, actions, 1);
- app_context_list[i] = app_context;
- }
-
- /* establish communication between the window manager and each shell */
- XtAugmentTranslations(w, compiled_table);
- wm_delete_window = XInternAtom(XtDisplay(w), WM_DELETE_WINDOW, False);
- (void)XSetWMProtocols(XtDisplay(w), XtWindow(w), &wm_delete_window, 1);
-}
diff --git a/xc/lib/Xaw/TextSink.c b/xc/lib/Xaw/TextSink.c
deleted file mode 100644
index c6b0cd10c..000000000
--- a/xc/lib/Xaw/TextSink.c
+++ /dev/null
@@ -1,1795 +0,0 @@
-/* $TOG: TextSink.c /main/21 1998/02/11 14:55:39 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.
-
-*/
-/* $XFree86: xc/lib/Xaw/TextSink.c,v 1.14 1999/08/28 09:00:27 dawes Exp $ */
-
-/*
- * Author: Chris Peterson, MIT X Consortium.
- *
- * Much code taken from X11R3 AsciiSink.
- */
-
-/*
- * TextSink.c - TextSink object. (For use with the text widget).
- *
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Prototypes
- */
-static void XawTextSinkClassPartInitialize(WidgetClass);
-static void XawTextSinkInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawTextSinkDestroy(Widget);
-static Boolean XawTextSinkSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-static int MaxLines(Widget, unsigned int);
-static int MaxHeight(Widget, int);
-static void DisplayText(Widget, int, int, XawTextPosition, XawTextPosition,
- Bool);
-static void InsertCursor(Widget, int, int, XawTextInsertState);
-static void ClearToBackground(Widget, int, int, unsigned int, unsigned int);
-static void FindPosition(Widget, XawTextPosition, int, int, Bool,
- XawTextPosition*, int*, int*);
-static void FindDistance(Widget, XawTextPosition, int, XawTextPosition, int*,
- XawTextPosition*, int*);
-static void Resolve(Widget, XawTextPosition, int, int, XawTextPosition*);
-static void SetTabs(Widget, int, short*);
-static void GetCursorBounds(Widget, XRectangle*);
-
-#ifndef OLDXAW
-static Boolean CvtStringToPropertyList(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Boolean CvtPropertyListToString(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static Bool BeginPaint(Widget);
-static Bool EndPaint(Widget);
-static void SetXlfdDefaults(Display*, XawTextProperty*);
-#endif
-
-/*
- * External
- */
-void _XawTextSinkClearToBackground(Widget, int, int, unsigned, unsigned);
-void _XawTextSinkDisplayText(Widget, int, int, XawTextPosition, XawTextPosition,
- Bool);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(TextSinkRec, text_sink.field)
-static XtResource resources[] = {
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(foreground),
- XtRString,
- XtDefaultForeground
- },
- {
- XtNbackground,
- XtCBackground,
- XtRPixel,
- sizeof(Pixel),
- offset(background),
- XtRString,
- XtDefaultBackground
- },
-#ifndef OLDXAW
- {
- XtNcursorColor,
- XtCColor,
- XtRPixel,
- sizeof(Pixel),
- offset(cursor_color),
- XtRString,
- XtDefaultForeground
- },
- {
- XawNtextProperties,
- XawCTextProperties,
- XawRTextProperties,
- sizeof(XawTextPropertyList*),
- offset(properties),
- XtRImmediate,
- NULL
- },
-#endif
-};
-#undef offset
-
-#ifndef OLDXAW
-static TextSinkExtRec extension_rec = {
- NULL, /* next_extension */
- NULLQUARK, /* record_type */
- 1, /* version */
- sizeof(TextSinkExtRec), /* record_size */
- BeginPaint,
- NULL,
- NULL,
- EndPaint
-};
-
-static XrmQuark Qdefault;
-#endif
-
-#define Superclass (&objectClassRec)
-TextSinkClassRec textSinkClassRec = {
- /* object */
- {
- (WidgetClass)Superclass, /* superclass */
- "TextSink", /* class_name */
- sizeof(TextSinkRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- XawTextSinkClassPartInitialize, /* class_part_initialize */
- False, /* class_inited */
- XawTextSinkInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* obj1 */
- NULL, /* obj2 */
- 0, /* obj3 */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* obj4 */
- False, /* obj5 */
- False, /* obj6 */
- False, /* obj7 */
- XawTextSinkDestroy, /* destroy */
- NULL, /* obj8 */
- NULL, /* obj9 */
- XawTextSinkSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* obj10 */
- NULL, /* get_values_hook */
- NULL, /* obj11 */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* obj12 */
- NULL, /* obj13 */
- NULL, /* obj14 */
- NULL, /* extension */
- },
- /* text_sink */
- {
- DisplayText, /* DisplayText */
- InsertCursor, /* InsertCursor */
- ClearToBackground, /* ClearToBackground */
- FindPosition, /* FindPosition */
- FindDistance, /* FindDistance */
- Resolve, /* Resolve */
- MaxLines, /* MaxLines */
- MaxHeight, /* MaxHeight */
- SetTabs, /* SetTabs */
- GetCursorBounds, /* GetCursorBounds */
- },
-};
-
-WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec;
-
-/*
- * Implementation
- */
-static void
-XawTextSinkClassPartInitialize(WidgetClass wc)
-{
- TextSinkObjectClass t_src, superC;
-#ifndef OLDXAW
- static XtConvertArgRec CvtArgs[] = {
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.self),
- sizeof(Widget)},
- };
-#endif
-
- t_src = (TextSinkObjectClass) wc;
- superC = (TextSinkObjectClass) t_src->object_class.superclass;
-
-#ifndef OLDXAW
- extension_rec.record_type = XrmPermStringToQuark("TextSink");
- extension_rec.next_extension = (XtPointer)t_src->text_sink_class.extension;
- t_src->text_sink_class.extension = &extension_rec;
-
- Qdefault = XrmPermStringToQuark("default");
-#endif
-
- /*
- * We don't need to check for null super since we'll get to TextSink
- * eventually.
- */
- if (t_src->text_sink_class.DisplayText == XtInheritDisplayText)
- t_src->text_sink_class.DisplayText =
- superC->text_sink_class.DisplayText;
-
- if (t_src->text_sink_class.InsertCursor == XtInheritInsertCursor)
- t_src->text_sink_class.InsertCursor =
- superC->text_sink_class.InsertCursor;
-
- if (t_src->text_sink_class.ClearToBackground== XtInheritClearToBackground)
- t_src->text_sink_class.ClearToBackground =
- superC->text_sink_class.ClearToBackground;
-
- if (t_src->text_sink_class.FindPosition == XtInheritFindPosition)
- t_src->text_sink_class.FindPosition =
- superC->text_sink_class.FindPosition;
-
- if (t_src->text_sink_class.FindDistance == XtInheritFindDistance)
- t_src->text_sink_class.FindDistance =
- superC->text_sink_class.FindDistance;
-
- if (t_src->text_sink_class.Resolve == XtInheritResolve)
- t_src->text_sink_class.Resolve =
- superC->text_sink_class.Resolve;
-
- if (t_src->text_sink_class.MaxLines == XtInheritMaxLines)
- t_src->text_sink_class.MaxLines =
- superC->text_sink_class.MaxLines;
-
- if (t_src->text_sink_class.MaxHeight == XtInheritMaxHeight)
- t_src->text_sink_class.MaxHeight =
- superC->text_sink_class.MaxHeight;
-
- if (t_src->text_sink_class.SetTabs == XtInheritSetTabs)
- t_src->text_sink_class.SetTabs =
- superC->text_sink_class.SetTabs;
-
- if (t_src->text_sink_class.GetCursorBounds == XtInheritGetCursorBounds)
- t_src->text_sink_class.GetCursorBounds =
- superC->text_sink_class.GetCursorBounds;
-
-#ifndef OLDXAW
- XtSetTypeConverter(XtRString, XawRTextProperties, CvtStringToPropertyList,
- &CvtArgs[0], XtNumber(CvtArgs), XtCacheNone, NULL);
- XtSetTypeConverter(XawRTextProperties, XtRString, CvtPropertyListToString,
- NULL, 0, XtCacheNone, NULL);
-#endif
-}
-
-/*
- * Function:
- * XawTextSinkInitialize
- *
- * Parameters:
- * request - requested and new values for the object instance
- * cnew - ""
- *
- * Description:
- * Initializes the TextSink Object.
- */
-/*ARGSUSED*/
-static void
-XawTextSinkInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TextSinkObject sink = (TextSinkObject)cnew;
-
- sink->text_sink.tab_count = 0; /* Initialize the tab stops. */
- sink->text_sink.tabs = NULL;
- sink->text_sink.char_tabs = NULL;
-#ifndef OLDXAW
- sink->text_sink.paint = NULL;
-#endif
-}
-
-/*
- * Function:
- * XawTextSinkDestroy
- *
- * Parameters:
- * w - TextSink Object
- *
- * Description:
- * This function cleans up when the object is destroyed.
- */
-static void
-XawTextSinkDestroy(Widget w)
-{
- TextSinkObject sink = (TextSinkObject) w;
-
- XtFree((char *)sink->text_sink.tabs);
- XtFree((char *)sink->text_sink.char_tabs);
-}
-
-/*
- * Function:
- * XawTextSinkSetValues
- *
- * Parameters:
- * current - current state of the object
- * request - what was requested
- * cnew - what the object will become
- *
- * Description:
- * Sets the values for the TextSink.
- *
- * Returns:
- * True if redisplay is needed
- */
-/*ARGSUSED*/
-static Boolean
-XawTextSinkSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TextSinkObject w = (TextSinkObject)cnew;
- TextSinkObject old_w = (TextSinkObject)current;
-
- if (w->text_sink.foreground != old_w->text_sink.foreground)
- ((TextWidget)XtParent(cnew))->text.redisplay_needed = True;
-
- return (False);
-}
-
-/*
- * Function:
- * DisplayText
- *
- * Parameters:
- * w - TextSink Object
- * x - location to start drawing text
- * y - ""
- * pos1 - location of starting and ending points in the text buffer
- * pos2 - ""
- * highlight - hightlight this text?
- *
- * Description:
- * Stub function that in subclasses will display text.
- */
-/*ARGSUSED*/
-static void
-DisplayText(Widget w, int x, int y,
- XawTextPosition pos1, XawTextPosition pos2, Bool highlight)
-{
- return;
-}
-
-/*
- * Function:
- * InsertCursor
- *
- * Parameters:
- * w - TextSink Object
- * x - location for the cursor
- * y - ""
- * state - whether to turn the cursor on, or off
- *
- * Description:
- * Places the InsertCursor.
- */
-/*ARGSUSED*/
-static void
-InsertCursor(Widget w, int x, int y, XawTextInsertState state)
-{
- return;
-}
-
-/*
- * Function:
- * ClearToBackground
- *
- * Parameters:
- * w - TextSink Object
- * x - location of area to clear
- * y - ""
- * width - size of area to clear
- * height - ""
- *
- * Description:
- * Clears a region of the sink to the background color.
- */
-/*ARGSUSED*/
-static void
-ClearToBackground(Widget w, int x, int y,
- unsigned int width, unsigned int height)
-{
- /*
- * Don't clear in height or width are zero
- * XClearArea() has special semantic for these values
- */
- TextWidget xaw = (TextWidget)XtParent(w);
- Position x1, y1, x2, y2;
-
- x1 = XawMax(x, xaw->text.r_margin.left);
- y1 = XawMax(y, xaw->text.r_margin.top);
- x2 = XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right);
- y2 = XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom);
-
- x = x1;
- y = y1;
- width = XawMax(0, x2 - x1);
- height = XawMax(0, y2 - y1);
-
- if (height != 0 && width != 0)
- XClearArea(XtDisplayOfObject(w), XtWindowOfObject(w),
- x, y, width, height, False);
-}
-
-/*
- * Function:
- * FindPosition
- *
- * Parameters:
- * w - TextSink Object
- * fromPos - reference position
- * fromX - reference location
- * width - width of section to paint text
- * stopAtWordBreak - returned position is a word break?
- * resPos - position found (return)
- * resWidth - Width actually used (return)
- * resHeight - Height actually used (return)
- *
- * Description:
- * Finds a position in the text.
- */
-/*ARGSUSED*/
-static void
-FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width,
- Bool stopAtWordBreak, XawTextPosition *resPos,
- int *resWidth, int *resHeight)
-{
- *resPos = fromPos;
- *resHeight = *resWidth = 0;
-}
-
-/*
- * Function:
- * FindDistance
- *
- * Parameters:
- * w - TextSink Object
- * fromPos - starting Position
- * fromX - x location of starting Position
- * toPos - end Position
- * resWidth - Distance between fromPos and toPos
- * resPos - Acutal toPos used
- * resHeight - Height required by this text
- *
- * Description:
- * Find the Pixel Distance between two text Positions.
- */
-/*ARGSUSED*/
-static void
-FindDistance(Widget w, XawTextPosition fromPos, int fromx,
- XawTextPosition toPos, int *resWidth,
- XawTextPosition *resPos, int *resHeight)
-{
- *resWidth = *resHeight = 0;
- *resPos = fromPos;
-}
-
-/*
- * Function:
- * Resolve
- *
- * Parameters:
- * w - TextSink Object
- * pos - reference Position
- * fromx - reference Location
- * width - width to move
- * resPos - resulting position
- *
- * Description:
- * Resloves a location to a position.
- */
-/*ARGSUSED*/
-static void
-Resolve(Widget w, XawTextPosition pos, int fromx, int width,
- XawTextPosition *resPos)
-{
- *resPos = pos;
-}
-
-/*
- * Function:
- * MaxLines
- *
- * Parameters:
- * w - TextSink Object
- * height - height to fit lines into
- *
- * Description:
- * Finds the Maximum number of lines that will fit in a given height.
- *
- * Returns:
- * Number of lines that will fit
- */
-/*ARGSUSED*/
-static int
-MaxLines(Widget w, unsigned int height)
-{
- /*
- * The fontset has gone down to descent Sink Widget, so
- * the functions such MaxLines, SetTabs... are bound to the descent.
- *
- * by Li Yuhong, Jan. 15, 1991
- */
- return (0);
-}
-
-/*
- * Function:
- * MaxHeight
- *
- * Parameters:
- * w - TextSink Object
- * lines - number of lines
- *
- * Description:
- * Finds the Minium height that will contain a given number lines.
- *
- * Returns:
- * the height
- */
-/*ARGSUSED*/
-static int
-MaxHeight(Widget w, int lines)
-{
- return (0);
-}
-
-/*
- * Function:
- * SetTabs
- *
- * Parameters:
- * w - TextSink Object
- * tab_count - the number of tabs in the list
- * tabs - text positions of the tabs
- * Description:
- * Sets the Tab stops.
- */
-/*ARGSUSED*/
-static void
-SetTabs(Widget w, int tab_count, short *tabs)
-{
- return;
-}
-
-/*
- * Function:
- * GetCursorBounds
- *
- * Parameters:
- * w - TextSinkObject.
- * rect - X rectangle containing the cursor bounds
- *
- * Description:
- * Finds the bounding box for the insert cursor (caret)
- */
-/*ARGSUSED*/
-static void
-GetCursorBounds(Widget w, XRectangle *rect)
-{
- rect->x = rect->y = rect->width = rect->height = 0;
-}
-
-/*
- * Public Functions
- */
-/*
- * Function:
- * XawTextSinkDisplayText
- *
- * Parameters:
- * w - TextSink Object
- * x - location to start drawing text
- * y - ""
- * pos1 - location of starting and ending points in the text buffer
- * pos2 - ""
- * highlight - hightlight this text?
- */
-/*ARGSUSED*/
-void
-XawTextSinkDisplayText(Widget w,
-#if NeedWidePrototypes
- int x, int y,
-#else
- Position x, Position y,
-#endif
- XawTextPosition pos1, XawTextPosition pos2,
-#if NeedWidePrototypes
- int highlight
-#else
- Boolean highlight
-#endif
-)
-{
- _XawTextSinkDisplayText(w, x, y, pos1, pos2, highlight);
-}
-
-void
-_XawTextSinkDisplayText(Widget w, int x, int y,
- XawTextPosition pos1, XawTextPosition pos2,
- Bool highlight)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.DisplayText)(w, x, y, pos1, pos2, highlight);
-}
-
-/*
- * Function:
- * XawTextSinkInsertCursor
- *
- * Parameters:
- * w - TextSink Object
- * x - location for the cursor
- * y - ""
- * state - whether to turn the cursor on, or off
- *
- * Description:
- * Places the InsertCursor.
- */
-/*ARGSUSED*/
-void
-#if NeedWidePrototypes
-XawTextSinkInsertCursor(Widget w, int x, int y, int state)
-#else
-XawTextSinkInsertCursor(Widget w, Position x, Position y, XawTextInsertState state)
-#endif
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.InsertCursor)(w, x, y, state);
-}
-
-/*
- * Function:
- * XawTextSinkClearToBackground
- *
- * Parameters:
- * w - TextSink Object
- * x - location of area to clear
- * y - ""
- * width - size of area to clear
- * height - ""
- *
- * Description:
- * Clears a region of the sink to the background color.
- */
-/*ARGSUSED*/
-void
-XawTextSinkClearToBackground(Widget w,
-#if NeedWidePrototypes
- int x, int y,
- unsigned int width, unsigned int height
-#else
- Position x, Position y,
- Dimension width, Dimension height
-#endif
-)
-{
- _XawTextSinkClearToBackground(w, x, y, width, height);
-}
-
-void
-_XawTextSinkClearToBackground(Widget w,
- int x, int y,
- unsigned int width, unsigned int height)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.ClearToBackground)(w, x, y, width, height);
-}
-
-/*
- * Function:
- * XawTextSinkFindPosition
- *
- * Parameters:
- * w - TextSink Object
- * fromPos - reference position
- * fromX - reference location
- * width - width of section to paint text
- * stopAtWordBreak - returned position is a word break?
- * resPos - position found (return)
- * resWidth - Width actually used (return)
- * resHeight - Height actually used (return)
- *
- * Description:
- * Finds a position in the text.
- */
-/*ARGSUSED*/
-void
-XawTextSinkFindPosition(Widget w, XawTextPosition fromPos, int fromx, int width,
-#if NeedWidePrototypes
- int stopAtWordBreak,
-#else
- Boolean stopAtWordBreak,
-#endif
- XawTextPosition *resPos, int *resWidth, int *resHeight)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.FindPosition)(w, fromPos, fromx, width,
- stopAtWordBreak,
- resPos, resWidth, resHeight);
-}
-
-/*
- * Function:
- * XawTextSinkFindDistance
- *
- * Parameters:
- * w - TextSink Object
- * fromPos - starting Position
- * fromX - x location of starting Position
- * toPos - end Position
- * resWidth - Distance between fromPos and toPos
- * resPos - Acutal toPos used
- * resHeight - Height required by this text
- *
- * Description:
- * Find the Pixel Distance between two text Positions.
- */
-/*ARGSUSED*/
-void
-XawTextSinkFindDistance(Widget w, XawTextPosition fromPos, int fromx,
- XawTextPosition toPos, int *resWidth,
- XawTextPosition *resPos, int *resHeight)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.FindDistance)(w, fromPos, fromx, toPos,
- resWidth, resPos, resHeight);
-}
-
-/*
- * Function:
- * XawTextSinkResolve
- *
- * Parameters:
- * w - TextSink Object
- * pos - reference Position
- * fromx - reference Location
- * width - width to move
- * resPos - resulting position
- *
- * Description:
- * Resloves a location to a position.
- */
-/*ARGSUSED*/
-void
-XawTextSinkResolve(Widget w, XawTextPosition pos, int fromx, int width,
- XawTextPosition *resPos)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass) w->core.widget_class;
-
- (*cclass->text_sink_class.Resolve)(w, pos, fromx, width, resPos);
-}
-
-/*
- * Function:
- * XawTextSinkMaxLines
- *
- * Parameters:
- * w - TextSink Object
- * height - height to fit lines into
- *
- * Description:
- * Finds the Maximum number of lines that will fit in a given height.
- *
- * Returns:
- * Number of lines that will fit
- */
-/*ARGSUSED*/
-int
-#if NeedWidePrototypes
-XawTextSinkMaxLines(Widget w, unsigned int height)
-#else
-XawTextSinkMaxLines(Widget w, Dimension height)
-#endif
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- return((*cclass->text_sink_class.MaxLines)(w, height));
-}
-
-/*
- * Function:
- * XawTextSinkMaxHeight
- *
- * Parameters:
- * w - TextSink Object
- * lines - number of lines
- *
- * Description:
- * Finds the Minium height that will contain a given number lines.
- *
- * Returns:
- * the height
- */
-/*ARGSUSED*/
-int
-XawTextSinkMaxHeight(Widget w, int lines)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- return((*cclass->text_sink_class.MaxHeight)(w, lines));
-}
-
-/*
- * Function:
- * XawTextSinkSetTabs
- *
- * Parameters:
- * w - TextSink Object
- * tab_count - the number of tabs in the list
- * tabs - text positions of the tabs
- * Description:
- * Sets the Tab stops.
- */
-void
-XawTextSinkSetTabs(Widget w, int tab_count, int *tabs)
-{
- if (tab_count > 0) {
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
- short *char_tabs = (short*)XtMalloc((unsigned)tab_count * sizeof(short));
- short *tab, len = 0;
- int i;
-
- for (i = tab_count, tab = char_tabs; i; i--) {
- if ((short)*tabs > len)
- *tab++ = (len = (short)*tabs++);
- else {
- tabs++;
- --tab_count;
- }
- }
-
- if (tab_count > 0)
- (*cclass->text_sink_class.SetTabs)(w, tab_count, char_tabs);
- XtFree((char *)char_tabs);
- }
-}
-
-/*
- * Function:
- * XawTextSinkGetCursorBounds
- *
- * Parameters:
- * w - TextSinkObject
- * rect - X rectance containing the cursor bounds
- *
- * Description:
- * Finds the bounding box for the insert cursor (caret).
- */
-/*ARGSUSED*/
-void
-XawTextSinkGetCursorBounds(Widget w, XRectangle *rect)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.GetCursorBounds)(w, rect);
-}
-
-#ifndef OLDXAW
-Bool
-XawTextSinkBeginPaint(Widget w)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- if (cclass->text_sink_class.extension->BeginPaint == NULL ||
- cclass->text_sink_class.extension->PreparePaint == NULL ||
- cclass->text_sink_class.extension->DoPaint == NULL ||
- cclass->text_sink_class.extension->EndPaint == NULL)
- return (False);
-
- return ((*cclass->text_sink_class.extension->BeginPaint)(w));
-}
-
-static Bool
-BeginPaint(Widget w)
-{
- TextSinkObject sink = (TextSinkObject)w;
-
- if (sink->text_sink.paint != NULL)
- return (False);
-
- sink->text_sink.paint = XtNew(XawTextPaintList);
- sink->text_sink.paint->clip = XmuCreateArea();
- sink->text_sink.paint->hightabs = NULL;
- sink->text_sink.paint->paint = NULL;
- sink->text_sink.paint->bearings = NULL;
-
- return (True);
-}
-
-void
-XawTextSinkPreparePaint(Widget w, int y, int line, XawTextPosition from,
- XawTextPosition to, Bool highlight)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.extension->PreparePaint)
- (w, y, line, from, to, highlight);
-}
-
-/*ARGSUSED*/
-static void
-PreparePaint(Widget w, int y, int line, XawTextPosition from, XawTextPosition to,
- Bool highlight)
-{
-}
-
-void
-XawTextSinkDoPaint(Widget w)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- (*cclass->text_sink_class.extension->DoPaint)(w);
-}
-
-/*ARGSUSED*/
-static void
-DoPaint(Widget w)
-{
-}
-
-Bool
-XawTextSinkEndPaint(Widget w)
-{
- TextSinkObjectClass cclass = (TextSinkObjectClass)w->core.widget_class;
-
- return ((*cclass->text_sink_class.extension->EndPaint)(w));
-}
-
-static Bool
-EndPaint(Widget w)
-{
- TextSinkObject sink = (TextSinkObject)w;
- XawTextPaintStruct *paint, *next;
-
- if (sink->text_sink.paint == NULL)
- return (False);
-
- XmuDestroyArea(sink->text_sink.paint->clip);
- if (sink->text_sink.paint->hightabs)
- XmuDestroyArea(sink->text_sink.paint->hightabs);
- paint = sink->text_sink.paint->paint;
- while (paint) {
- next = paint->next;
- if (paint->text)
- XtFree((XtPointer)paint->text);
- if (paint->backtabs)
- XmuDestroyArea(paint->backtabs);
- XtFree((XtPointer)paint);
- paint = next;
- }
-
- paint = sink->text_sink.paint->bearings;
- while (paint) {
- next = paint->next;
- if (paint->text)
- XtFree((XtPointer)paint->text);
- XtFree((XtPointer)paint);
- paint = next;
- }
-
- XtFree((XtPointer)sink->text_sink.paint);
- sink->text_sink.paint = NULL;
-}
-
-static XawTextPropertyList **prop_lists;
-static Cardinal num_prop_lists;
-
-static int
-bcmp_qident(_Xconst void *left, _Xconst void *right)
-{
- return ((int)left - (*(XawTextProperty**)right)->identifier);
-}
-
-static int
-qcmp_qident(_Xconst void *left, _Xconst void *right)
-{
- return ((*(XawTextProperty**)left)->identifier -
- (*(XawTextProperty**)right)->identifier);
-}
-
-static void
-SetXlfdDefaults(Display *display, XawTextProperty *property)
-{
- Atom atom = XInternAtom(display, "FONT", True);
- unsigned long value;
- char *str;
-
- if (XGetFontProperty(property->font, atom, &value)) {
- char *xlfd = XGetAtomName(display, value);
-
- if (xlfd) {
- char *sep = xlfd + 1;
- char *name = sep;
-
- property->xlfd = XrmStringToQuark(xlfd);
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->foundry = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->family = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->weight = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->slant = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->setwidth = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->addstyle = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->pixel_size = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->point_size = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->res_x = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->res_y = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->spacing = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->avgwidth = XrmStringToQuark(name);
- name = sep;
-
- sep = strchr(sep, '-'); *sep++ = '\0';
- property->registry = XrmStringToQuark(name);
- name = sep;
-
- property->encoding = XrmStringToQuark(name);
-
- XFree(xlfd);
- }
- }
-
- atom = XInternAtom(display, "UNDERLINE_THICKNESS", True);
- if (XGetFontProperty(property->font, atom, &value) &&
- (str = XGetAtomName(display, value)) != NULL) {
- property->underline_thickness = atoi(str);
- XFree(str);
- }
- else {
- /* XLFD says:
- * CapStemWidth = average width of the stems of capitals
- * if (UNDERLINE_THICKNESS undefined) then
- * UNDERLINE_THICKNESS = CapStemWidth
- *
- * How do I know the value of CapStemWidth??
- */
- if (property->pixel_size != NULLQUARK) {
- property->underline_thickness =
- atoi(XrmQuarkToString(property->pixel_size)) / 10;
- property->underline_thickness =
- XawMax(1, property->underline_thickness);
- }
- else
- property->underline_thickness = 1;
- }
-
- atom = XInternAtom(display, "UNDERLINE_POSITION", True);
- if (XGetFontProperty(property->font, atom, &value) &&
- (str = XGetAtomName(display, value)) != NULL) {
- property->underline_position = atoi(str);
- XFree(str);
- }
- else
- /* XLFD says:
- * if (UNDERLINE_POSITION undefined) then
- * UNDERLINE_POSITION = ROUND((maximum_descent) / 2)
- */
- property->underline_position =
- property->font->max_bounds.descent >> 1;
-
- /* I am assuming xlfd does not consider that lines are
- * centered in the path */
- property->underline_position += property->underline_thickness >> 1;
-
-}
-
-static void
-DestroyTextPropertyList(XawTextPropertyList *list)
-{
- int i;
-
- for (i = 0; i < list->num_properties; i++) {
- if (list->properties[i]->font)
- XFreeFont(DisplayOfScreen(list->screen), list->properties[i]->font);
- XtFree((char*)list->properties[i]);
- }
- if (list->properties)
- XtFree((char*)list->properties);
- XtFree((char*)list);
-}
-
-XawTextProperty *
-_XawTextSinkGetProperty(XawTextPropertyList *list, XrmQuark property)
-{
- if (property != NULLQUARK && list) {
- XawTextProperty **ptr = (XawTextProperty**)
- bsearch((void*)property, list->properties, list->num_properties,
- sizeof(XawTextProperty*), bcmp_qident);
-
- if (ptr)
- return (*ptr);
- }
-
- return (NULL);
-}
-
-XawTextProperty *
-XawTextSinkGetProperty(Widget w, XrmQuark property)
-{
- TextSinkObject sink = (TextSinkObject)w;
- XawTextPropertyList *list = sink->text_sink.properties;
-
- return (_XawTextSinkGetProperty(list, property));
-}
-
-XawTextProperty *
-XawTextSinkCopyProperty(Widget w, XrmQuark property)
-{
- XawTextProperty *cur, *ret;
-
- if ((cur = XawTextSinkGetProperty(w, property)) == NULL)
- cur = XawTextSinkGetProperty(w, Qdefault);
- ret = (XawTextProperty*)XtCalloc(1, sizeof(XawTextProperty));
- if (cur)
- memcpy(ret, cur, sizeof(XawTextProperty));
- ret->identifier = NULLQUARK;
- ret->mask &= ~XAW_TPROP_FONT;
-
- return (ret);
-}
-
-XawTextProperty *
-_XawTextSinkAddProperty(XawTextPropertyList *list, XawTextProperty *property,
- Bool replace)
-{
- XawTextProperty *result;
- XColor color;
- char identifier[1024];
- char foreground[16];
- char background[16];
- char *foundry, *family, *weight, *slant, *setwidth, *addstyle, *pixel_size,
- *point_size, *res_x, *res_y, *spacing, *avgwidth, *registry, *encoding;
- char *xlfd;
- static char *asterisk = "*", *null = "";
- XrmQuark quark;
-
- if (list == NULL || property == NULL)
- return (NULL);
-
- if (property->mask & XAW_TPROP_FOREGROUND) {
- color.pixel = property->foreground;
- XQueryColor(DisplayOfScreen(list->screen), list->colormap, &color);
- XmuSnprintf(foreground, sizeof(foreground), "%04x%04x%04x",
- color.red, color.green, color.blue);
- }
- else
- strcpy(foreground, asterisk);
- if (property->mask & XAW_TPROP_BACKGROUND) {
- color.pixel = property->background;
- XQueryColor(DisplayOfScreen(list->screen), list->colormap, &color);
- XmuSnprintf(background, sizeof(background), "%04x%04x%04x",
- color.red, color.green, color.blue);
- }
- else
- strcpy(background, asterisk);
-
- if (property->xlfd_mask & XAW_TPROP_FOUNDRY)
- foundry = XrmQuarkToString(property->foundry);
- else
- foundry = asterisk;
-
- /* use default, or what was requested */
- if (property->family != NULLQUARK)
- family = XrmQuarkToString(property->family);
- else
- family = asterisk;
- if (property->weight != NULLQUARK)
- weight = XrmQuarkToString(property->weight);
- else
- weight = asterisk;
- if (property->slant != NULLQUARK) {
- slant = XrmQuarkToString(property->slant);
- if (toupper(*slant) != 'R')
- slant = asterisk; /* X defaults to italics, so, don't
- care in resolving between `I' and `O' */
- }
- else
- slant = asterisk;
-
- if (property->xlfd_mask & XAW_TPROP_SETWIDTH)
- setwidth = XrmQuarkToString(property->setwidth);
- else
- setwidth = asterisk;
- if (property->xlfd_mask & XAW_TPROP_ADDSTYLE)
- addstyle = XrmQuarkToString(property->addstyle);
- else
- addstyle = null;
-
- /* use default, or what was requested */
- if (!(property->mask & XAW_TPROP_POINTSIZE) &&
- property->pixel_size != NULLQUARK)
- pixel_size = XrmQuarkToString(property->pixel_size);
- else
- pixel_size = asterisk;
-
- if (property->xlfd_mask & XAW_TPROP_POINTSIZE)
- point_size = XrmQuarkToString(property->point_size);
- else
- point_size = asterisk;
- if (property->xlfd_mask & XAW_TPROP_RESX)
- res_x = XrmQuarkToString(property->res_x);
- else
- res_x = asterisk;
- if (property->xlfd_mask & XAW_TPROP_RESY)
- res_y = XrmQuarkToString(property->res_y);
- else
- res_y = asterisk;
- if (property->xlfd_mask & XAW_TPROP_SPACING)
- spacing = XrmQuarkToString(property->spacing);
- else
- spacing = asterisk;
- if (property->xlfd_mask & XAW_TPROP_AVGWIDTH)
- avgwidth = XrmQuarkToString(property->avgwidth);
- else
- avgwidth = asterisk;
-
- /* use default, or what that was requested */
- if (property->registry != NULLQUARK)
- registry = XrmQuarkToString(property->registry);
- else
- registry = asterisk;
- if (property->encoding != NULLQUARK)
- encoding = XrmQuarkToString(property->encoding);
- else
- encoding = asterisk;
-
- if (replace) {
- result = XtNew(XawTextProperty);
- memcpy(result, property, sizeof(XawTextProperty));
- }
- else
- result = property;
-
- /* XXX should do the best to load a suitable font here */
- if (!(result->mask & XAW_TPROP_FONT)) {
- XmuSnprintf(identifier, sizeof(identifier),
- "-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s",
- foundry, family, weight, slant, setwidth, addstyle, pixel_size,
- point_size, res_x, res_y, spacing, avgwidth, registry, encoding);
- if ((result->font = XLoadQueryFont(DisplayOfScreen(list->screen),
- identifier)) != NULL) {
- result->mask |= XAW_TPROP_FONT;
- SetXlfdDefaults(DisplayOfScreen(list->screen), result);
- }
- else
- result->mask &= ~XAW_TPROP_FONT;
- }
-
- if (result->font)
- xlfd = XrmQuarkToString(result->xlfd);
- else
- xlfd = null;
-
- XmuSnprintf(identifier, sizeof(identifier), "%08x%08x%s%s%d%d%d%d%s",
- property->mask, property->xlfd_mask,
- foreground, background,
- (result->mask & XAW_TPROP_UNDERLINE) != 0,
- (result->mask & XAW_TPROP_OVERSTRIKE) != 0,
- (result->mask & XAW_TPROP_SUBSCRIPT) != 0,
- (result->mask & XAW_TPROP_SUPERSCRIPT) != 0,
- xlfd);
-
- quark = XrmStringToQuark(identifier);
- if (result->identifier == NULLQUARK)
- result->identifier = quark;
- result->code = quark;
-
- if ((property = _XawTextSinkGetProperty(list, result->identifier)) != NULL) {
- if (result->font)
- XFreeFont(DisplayOfScreen(list->screen), result->font);
- if (replace)
- XtFree((XtPointer)result);
-
- return (property);
- }
-
- list->properties = (XawTextProperty**)
- XtRealloc((XtPointer)list->properties, sizeof(XawTextProperty*) *
- (list->num_properties + 1));
- list->properties[list->num_properties++] = result;
- qsort((void*)list->properties, list->num_properties,
- sizeof(XawTextProperty*), qcmp_qident);
-
- return (result);
-}
-
-XawTextProperty *
-XawTextSinkAddProperty(Widget w, XawTextProperty *property)
-{
- TextSinkObject sink = (TextSinkObject)w;
- XawTextPropertyList *list = sink->text_sink.properties;
-
- return (_XawTextSinkAddProperty(list, property, True));
-}
-
-XawTextProperty *
-XawTextSinkCombineProperty(Widget w,
- XawTextProperty *property, XawTextProperty *combine,
- Bool override)
-{
- if (property == NULL || combine == NULL)
- return (property);
-
- if ((override || !(property->mask & XAW_TPROP_FOREGROUND)) &&
- (combine->mask & XAW_TPROP_FOREGROUND)) {
- property->mask |= XAW_TPROP_FOREGROUND;
- property->foreground = combine->foreground;
- }
- if ((override || !(property->mask & XAW_TPROP_BACKGROUND)) &&
- (combine->mask & XAW_TPROP_BACKGROUND)) {
- property->mask |= XAW_TPROP_BACKGROUND;
- property->background = combine->background;
- }
- if ((override || !(property->mask & XAW_TPROP_FPIXMAP)) &&
- (combine->mask & XAW_TPROP_FPIXMAP)) {
- property->mask |= XAW_TPROP_FPIXMAP;
- property->foreground_pixmap = combine->foreground_pixmap;
- }
- if ((override || !(property->mask & XAW_TPROP_BPIXMAP)) &&
- (combine->mask & XAW_TPROP_BPIXMAP)) {
- property->mask |= XAW_TPROP_BPIXMAP;
- property->background_pixmap = combine->background_pixmap;
- }
- if (combine->mask & XAW_TPROP_UNDERLINE)
- property->mask |= XAW_TPROP_UNDERLINE;
- if (combine->mask & XAW_TPROP_OVERSTRIKE)
- property->mask |= XAW_TPROP_OVERSTRIKE;
- if ((override || !(property->mask & XAW_TPROP_SUPERSCRIPT)) &&
- (combine->mask & XAW_TPROP_SUBSCRIPT))
- property->mask |= XAW_TPROP_SUBSCRIPT;
- if ((property->mask & XAW_TPROP_SUBSCRIPT) &&
- (combine->mask & XAW_TPROP_SUPERSCRIPT))
- property->mask |= XAW_TPROP_SUPERSCRIPT;
- if ((override || !(property->xlfd_mask & XAW_TPROP_FOUNDRY)) &&
- (combine->xlfd_mask & XAW_TPROP_FOUNDRY)) {
- property->xlfd_mask |= XAW_TPROP_FOUNDRY;
- property->foundry = combine->foundry;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_FAMILY)) &&
- (combine->xlfd_mask & XAW_TPROP_FAMILY)) {
- property->xlfd_mask |= XAW_TPROP_FAMILY;
- property->family = combine->family;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_WEIGHT)) &&
- (combine->xlfd_mask & XAW_TPROP_WEIGHT)) {
- property->xlfd_mask |= XAW_TPROP_WEIGHT;
- property->weight = combine->weight;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_SLANT)) &&
- (combine->xlfd_mask & XAW_TPROP_SLANT)) {
- property->xlfd_mask |= XAW_TPROP_SLANT;
- property->slant = combine->slant;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_SETWIDTH)) &&
- (combine->xlfd_mask & XAW_TPROP_SETWIDTH)) {
- property->xlfd_mask |= XAW_TPROP_SETWIDTH;
- property->setwidth = combine->setwidth;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_ADDSTYLE)) &&
- (combine->xlfd_mask & XAW_TPROP_ADDSTYLE)) {
- property->xlfd_mask |= XAW_TPROP_ADDSTYLE;
- property->addstyle = combine->addstyle;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_PIXELSIZE)) &&
- (combine->xlfd_mask & XAW_TPROP_PIXELSIZE)) {
- property->xlfd_mask |= XAW_TPROP_PIXELSIZE;
- property->pixel_size = combine->pixel_size;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_POINTSIZE)) &&
- (combine->xlfd_mask & XAW_TPROP_POINTSIZE)) {
- property->xlfd_mask |= XAW_TPROP_POINTSIZE;
- property->point_size = combine->point_size;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_RESX)) &&
- (combine->xlfd_mask & XAW_TPROP_RESX)) {
- property->xlfd_mask |= XAW_TPROP_RESX;
- property->res_x = combine->res_x;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_RESY)) &&
- (combine->xlfd_mask & XAW_TPROP_RESY)) {
- property->xlfd_mask |= XAW_TPROP_RESY;
- property->res_y = combine->res_y;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_SPACING)) &&
- (combine->xlfd_mask & XAW_TPROP_SPACING)) {
- property->xlfd_mask |= XAW_TPROP_SPACING;
- property->spacing = combine->spacing;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_AVGWIDTH)) &&
- (combine->xlfd_mask & XAW_TPROP_AVGWIDTH)) {
- property->xlfd_mask |= XAW_TPROP_AVGWIDTH;
- property->avgwidth = combine->avgwidth;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_REGISTRY)) &&
- (combine->xlfd_mask & XAW_TPROP_REGISTRY)) {
- property->xlfd_mask |= XAW_TPROP_REGISTRY;
- property->registry = combine->registry;
- }
- if ((override || !(property->xlfd_mask & XAW_TPROP_ENCODING)) &&
- (combine->xlfd_mask & XAW_TPROP_ENCODING)) {
- property->xlfd_mask |= XAW_TPROP_ENCODING;
- property->encoding = combine->encoding;
- }
-
- return (property);
-}
-
-/*
- * The default property must be defined first, if the code is willing to
- * combine properties.
- */
-XawTextPropertyList *
-XawTextSinkConvertPropertyList(String name, String spec, Screen *screen,
- Colormap colormap, int depth)
-{
- XrmQuark qname = XrmStringToQuark(name);
- XawTextPropertyList **ptr = (XawTextPropertyList**)
- bsearch((void*)qname, prop_lists, num_prop_lists,
- sizeof(XawTextPropertyList*), bcmp_qident);
- XawTextPropertyList *propl, *prev = NULL;
- XawTextProperty *def_prop = NULL;
- String str, tok, tmp;
-
- if (ptr) {
- propl = *ptr;
- while (propl) {
- prev = propl;
- if (propl->screen == screen &&
- propl->colormap == colormap &&
- propl->depth == depth)
- return (propl);
- propl = propl->next;
- }
- }
-
- propl = XtNew(XawTextPropertyList);
- propl->identifier = qname;
- propl->screen = screen;
- propl->colormap = colormap;
- propl->depth = depth;
- propl->next = NULL;
-
- if (prev)
- prev->next = propl;
-
- propl->properties = NULL;
- propl->num_properties = 0;
-
- str = XtNewString(spec);
- for (tok = str; tok; tok = tmp) {
- XawTextProperty *prop;
- XawParams *params;
- XrmQuark ident;
- XawArgVal *argval;
- XColor color, exact;
-
- if (def_prop == NULL && propl->num_properties)
- def_prop = _XawTextSinkGetProperty(propl, Qdefault);
- tmp = strchr(tok, ',');
- if (tmp) {
- *tmp = '\0';
- if (*++tmp == '\0')
- tmp = NULL;
- }
- params = XawParseParamsString(tok);
- ident = XrmStringToQuark(params->name);
- if (ident == NULLQUARK) {
- DestroyTextPropertyList(propl);
- if (prev)
- prev->next = NULL;
- XawFreeParamsStruct(params);
- return (NULL);
- }
- else if (_XawTextSinkGetProperty(propl, ident) != NULL) {
- XawFreeParamsStruct(params);
- continue;
- }
-
- prop = (XawTextProperty*)XtCalloc(1, sizeof(XawTextProperty));
- prop->identifier = ident;
-
- if ((argval = XawFindArgVal(params, "font")) != NULL &&
- argval->value) {
-
- if ((prop->font = XLoadQueryFont(DisplayOfScreen(screen),
- argval->value)) == NULL) {
- DestroyTextPropertyList(propl);
- if (prev)
- prev->next = NULL;
- XawFreeParamsStruct(params);
- return (NULL);
- }
- prop->mask |= XAW_TPROP_FONT;
- SetXlfdDefaults(DisplayOfScreen(screen), prop);
- }
- /* fontset processing here */
-
- if ((argval = XawFindArgVal(params, "foreground")) != NULL &&
- argval->value) {
- if (!XAllocNamedColor(DisplayOfScreen(screen), colormap,
- argval->value, &color, &exact)) {
- DestroyTextPropertyList(propl);
- if (prev)
- prev->next = NULL;
- XawFreeParamsStruct(params);
- return (NULL);
- }
- prop->foreground = color.pixel;
- prop->mask |= XAW_TPROP_FOREGROUND;
- }
- if ((argval = XawFindArgVal(params, "background")) != NULL &&
- argval->value) {
- if (!XAllocNamedColor(DisplayOfScreen(screen), colormap,
- argval->value, &color, &exact)) {
- DestroyTextPropertyList(propl);
- if (prev)
- prev->next = NULL;
- XawFreeParamsStruct(params);
- return (NULL);
- }
- prop->background = color.pixel;
- prop->mask |= XAW_TPROP_BACKGROUND;
- }
- /* foreground_pixmap and background_pixmap processing here */
-
- if (XawFindArgVal(params, "underline"))
- prop->mask |= XAW_TPROP_UNDERLINE;
- if (XawFindArgVal(params, "overstrike"))
- prop->mask |= XAW_TPROP_OVERSTRIKE;
-
- if (XawFindArgVal(params, "subscript"))
- prop->mask |= XAW_TPROP_SUBSCRIPT;
- else if (XawFindArgVal(params, "superscript"))
- prop->mask |= XAW_TPROP_SUPERSCRIPT;
-
- /* xlfd */
- if ((argval = XawFindArgVal(params, "foundry")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_FOUNDRY;
- prop->foundry = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "family")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_FAMILY;
- prop->family = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "weight")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_WEIGHT;
- prop->weight = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "slant")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_SLANT;
- prop->slant = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "setwidth")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_SETWIDTH;
- prop->setwidth = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "addstyle")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_ADDSTYLE;
- prop->addstyle = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "pixelsize")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_PIXELSIZE;
- prop->pixel_size = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "pointsize")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_POINTSIZE;
- prop->point_size = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "resx")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_RESX;
- prop->res_x = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "resy")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_RESY;
- prop->res_y = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "spacing")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_SPACING;
- prop->spacing = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "avgwidth")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_AVGWIDTH;
- prop->avgwidth = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "registry")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_REGISTRY;
- prop->registry = XrmStringToQuark(argval->value);
- }
- if ((argval = XawFindArgVal(params, "encoding")) != NULL &&
- argval->value) {
- prop->xlfd_mask |= XAW_TPROP_ENCODING;
- prop->encoding = XrmStringToQuark(argval->value);
- }
-
- if (def_prop)
- (void)XawTextSinkCombineProperty(NULL, prop, def_prop, False);
- (void)_XawTextSinkAddProperty(propl, prop, False);
-
- XawFreeParamsStruct(params);
- }
-
- prop_lists = (XawTextPropertyList**)
- XtRealloc((XtPointer)prop_lists, sizeof(XawTextPropertyList*) *
- (num_prop_lists + 1));
- prop_lists[num_prop_lists++] = propl;
- qsort((void*)prop_lists, num_prop_lists, sizeof(XawTextPropertyList*),
- qcmp_qident);
-
- XtFree(str);
-
- return (propl);
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtStringToPropertyList(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- XawTextPropertyList *propl = NULL;
- String name;
- Widget w;
-
- if (*num_args != 1) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "wrongParameters", "cvtStringToTextProperties",
- "ToolkitError",
- "String to textProperties conversion needs widget argument",
- NULL, NULL);
- return (False);
- }
-
- w = *(Widget*)args[0].addr;
- while (w && !XtIsWidget(w))
- w = XtParent(w);
-
- name = (String)(fromVal[0].addr);
-
- if (w) {
- XawTextPropertyList **ptr = (XawTextPropertyList**)
- bsearch((void*)XrmStringToQuark(name), prop_lists, num_prop_lists,
- sizeof(XawTextPropertyList*), bcmp_qident);
-
- if (ptr) {
- Screen *screen = w->core.screen;
- Colormap colormap = w->core.colormap;
- int depth = w->core.depth;
-
- propl = *ptr;
- while (propl) {
- if (propl->screen == screen &&
- propl->colormap == colormap &&
- propl->depth == depth)
- break;
- propl = propl->next;
- }
- }
- }
-
- if (!propl) {
- XtDisplayStringConversionWarning(dpy, (String)fromVal->addr,
- XawRTextProperties);
- toVal->addr = NULL;
- toVal->size = sizeof(XawTextPropertyList*);
- return (False);
- }
-
- if (toVal->addr != NULL) {
- if (toVal->size < sizeof(XawTextPropertyList*)) {
- toVal->size = sizeof(XawTextPropertyList*);
- return (False);
- }
- *(XawTextPropertyList**)(toVal->addr) = propl;
- }
- else {
- static XawTextPropertyList *static_val;
-
- static_val = propl;
- toVal->addr = (XPointer)&static_val;
- }
- toVal->size = sizeof(XawTextProperty*);
-
- return (True);
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtPropertyListToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- static char *buffer;
- Cardinal size;
- XawTextPropertyList *propl;
-
- propl = *(XawTextPropertyList**)fromVal[0].addr;
-
- buffer = XrmQuarkToString(propl->identifier);
- size = strlen(buffer) + 1;
-
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = buffer;
- toVal->size = size;
-
- return (True);
-}
-#endif
diff --git a/xc/lib/Xaw/TextSink.h b/xc/lib/Xaw/TextSink.h
deleted file mode 100644
index 13d026697..000000000
--- a/xc/lib/Xaw/TextSink.h
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * $TOG: TextSink.h /main/11 1998/02/06 12:51:33 kaleb $
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/TextSink.h,v 1.8 1999/08/15 13:00:36 dawes Exp $ */
-
-#ifndef _XawTextSink_h
-#define _XawTextSink_h
-
-#include <X11/Xaw/Text.h>
-
-/***********************************************************************
- *
- * TextSink Object
- *
- ***********************************************************************/
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- font Font XFontStruct * XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- background Background Pixel XtDefaultBackground
- cursorColor Color Pixel XtDefaultForeground
-*/
-
-/* Class record constants */
-
-extern WidgetClass textSinkObjectClass;
-
-typedef struct _TextSinkClassRec *TextSinkObjectClass;
-typedef struct _TextSinkRec *TextSinkObject;
-
-typedef enum {XawisOn, XawisOff} XawTextInsertState;
-
-#ifndef OLDXAW
-#ifndef XtNcursorColor
-#define XtNcursorColor "cursorColor"
-#endif
-
-#define XawNtextProperties "textProperties"
-#define XawCTextProperties "TextProperties"
-#define XawRTextProperties "XawTextProperties"
-#endif
-
-/*
- * Public Functions
- */
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawTextSinkDisplayText
- *
- * Parameters:
- * w - the TextSink Object
- * x - location to start drawing text
- * y - ""
- * pos1 - location of starting and ending points in the text buffer
- * pos2 - ""
- * highlight - hightlight this text?
- *
- * Description:
- * Stub function that in subclasses will display text.
- *
- * Note:
- * This function doesn't actually display anything, it is only a place
- * holder.
- */
-void XawTextSinkDisplayText
-(
- Widget w,
-#if NeedWidePrototypes
- int x,
- int y,
-#else
- Position x,
- Position y,
-#endif
- XawTextPosition pos1,
- XawTextPosition pos2,
-#if NeedWidePrototypes
- int highlight
-#else
- Boolean highlight
-#endif
- );
-
-/*
- * Function:
- * XawTextSinkInsertCursor
- *
- * Parameters:
- * w - the TextSink Object.
- * x - location for the cursor.
- * y - ""
- * state - whether to turn the cursor on, or off
- *
- * Description:
- * Places the InsertCursor.
- *
- * Note:
- * This function doesn't actually display anything, it is only a place
- * holder.
- */
-void XawTextSinkInsertCursor
-(
- Widget w,
-#if NeedWidePrototypes
- int x,
- int y,
- int state
-#else
- Position x,
- Position y,
- XawTextInsertState state
-#endif
- );
-
-/*
- * Function:
- * XawTextSinkClearToBackground
- *
- * Parameters:
- * w - TextSink Object
- * x - location of area to clear
- * y - ""
- * width - size of area to clear
- * height - ""
- *
- * Description:
- * Clears a region of the sink to the background color.
- *
- * Note:
- * This function doesn't actually display anything, it is only a place
- * holder.
- */
-void XawTextSinkClearToBackground
-(
- Widget w,
-#if NeedWidePrototypes
- int x,
- int y,
- unsigned int width,
- unsigned int height
-#else
- Position x,
- Position y,
- Dimension width,
- Dimension height
-#endif
- );
-
-/*
- * Function:
- * XawTextSinkFindPosition
- *
- * Parameters:
- * w - TextSink Object
- * fromPos - reference position
- * fromX - reference location
- * width - width of section to paint text
- * stopAtWordBreak - returned position is a word break?
- * resPos - Position to return
- * resWidth - Width actually used
- * resHeight - Height actually used
- *
- * Description:
- * Finds a position in the text.
- */
-void XawTextSinkFindPosition
-(
- Widget w,
- XawTextPosition fromPos,
- int fromX,
- int width,
-#if NeedWidePrototypes
- int stopAtWordBreak,
-#else
- Boolean stopAtWordBreak,
-#endif
- XawTextPosition* pos_return,
- int *width_return,
- int *height_return
- );
-
-/*
- * Function:
- * XawTextSinkFindDistance
- *
- * Parameters:
- * w - TextSink Object
- * fromPos - starting Position
- * fromX - x location of starting Position
- * toPos - end Position
- * resWidth - Distance between fromPos and toPos
- * resPos - Acutal toPos used
- * resHeight - Height required by this text
- *
- * Description:
- * Find the Pixel Distance between two text Positions.
- */
-void XawTextSinkFindDistance
-(
- Widget w,
- XawTextPosition fromPos,
- int fromX,
- XawTextPosition toPos,
- int *width_return,
- XawTextPosition *pos_return,
- int *height_return
- );
-
-/*
- * Function:
- * XawTextSinkResolve
- *
- * Parameters:
- * w - TextSink Object
- * pos - reference Position
- * fromx - reference Location
- * width - width to move
- * resPos - resulting position
- *
- * Description:
- * Resloves a location to a position.
- */
-void XawTextSinkResolve
-(
- Widget w,
- XawTextPosition fromPos,
- int fromX,
- int width,
- XawTextPosition *pos_return
- );
-
-/*
- * Function:
- * XawTextSinkMaxLines
- *
- * Parameters:
- * w - TextSink Object
- * height - height to fit lines into
- *
- * Returns:
- * Number of lines that will fit
- *
- * Description:
- * Finds the Maximum number of lines that will fit in a given height.
- */
-int XawTextSinkMaxLines
-(
- Widget w,
-#if NeedWidePrototypes
- unsigned int height
-#else
- Dimension height
-#endif
- );
-
-/*
- * Function:
- * XawTextSinkMaxHeight
- *
- * Parameters:
- * w - TextSink Object
- * lines - number of lines
- *
- * Returns:
- * Height
- *
- * Description:
- * Finds the Minium height that will contain a given number lines.
- */
-int XawTextSinkMaxHeight
-(
- Widget w,
- int lines
-);
-
-/*
- * Function:
- * XawTextSinkSetTabs
- *
- * Parameters:
- * w - TextSink Object
- * tab_count - number of tabs in the list
- * tabs - text positions of the tabs
- * Description:
- * Sets the Tab stops.
- */
-void XawTextSinkSetTabs
-(
- Widget w,
- int tab_count,
- int *tabs
-);
-
-/*
- * Function:
- * XawTextSinkGetCursorBounds
- *
- * Parameters:
- * w - TextSink Object
- * rect - X rectance containing the cursor bounds
- * Description:
- * Finds the bounding box for the insert curor (caret).
- */
-void XawTextSinkGetCursorBounds
-(
- Widget w,
- XRectangle *rect_return
-);
-
-_XFUNCPROTOEND
-
-#endif /* _XawTextSink_h */
diff --git a/xc/lib/Xaw/TextSinkP.h b/xc/lib/Xaw/TextSinkP.h
deleted file mode 100644
index c18d21108..000000000
--- a/xc/lib/Xaw/TextSinkP.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
-* $TOG: TextSinkP.h /main/7 1998/02/06 12:51:22 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/TextSinkP.h,v 1.9 1999/08/28 09:00:28 dawes Exp $ */
-
-#ifndef _XawTextSinkP_h
-#define _XawTextSinkP_h
-
-/*
- * TextSink Object Private Data
- */
-#include <X11/Xaw/TextSink.h>
-#include <X11/Xaw/TextP.h> /* This sink works with the Text widget */
-#include <X11/Xaw/TextSrcP.h> /* This sink works with the Text Source */
-#include <X11/Xmu/Xmu.h>
-
-#ifndef OLDXAW
-/* font/fontset defined? */
-#define XAW_TPROP_FONT (1<<0)
-#define XAW_TPROP_FONTSET (1<<1)
-
-/* extra attributes */
-#define XAW_TPROP_FOREGROUND (1<<2)
-#define XAW_TPROP_BACKGROUND (1<<3)
-#define XAW_TPROP_FPIXMAP (1<<4)
-#define XAW_TPROP_BPIXMAP (1<<5)
-#define XAW_TPROP_UNDERLINE (1<<6)
-#define XAW_TPROP_OVERSTRIKE (1<<7)
-#define XAW_TPROP_SUBSCRIPT (1<<8)
-#define XAW_TPROP_SUPERSCRIPT (1<<9)
-
-/* xlfd attributes */
-#define XAW_TPROP_FOUNDRY (1<<0)
-#define XAW_TPROP_FAMILY (1<<1)
-#define XAW_TPROP_WEIGHT (1<<2)
-#define XAW_TPROP_SLANT (1<<3)
-#define XAW_TPROP_SETWIDTH (1<<4)
-#define XAW_TPROP_ADDSTYLE (1<<5)
-#define XAW_TPROP_PIXELSIZE (1<<6)
-#define XAW_TPROP_POINTSIZE (1<<7)
-#define XAW_TPROP_RESX (1<<8)
-#define XAW_TPROP_RESY (1<<9)
-#define XAW_TPROP_SPACING (1<<10)
-#define XAW_TPROP_AVGWIDTH (1<<11)
-#define XAW_TPROP_REGISTRY (1<<12)
-#define XAW_TPROP_ENCODING (1<<13)
-struct _XawTextProperty { /* to be extended/modified */
- XrmQuark identifier, code;
- unsigned long mask;
- XFontStruct *font;
- XFontSet fontset;
- Pixel foreground, background;
- Pixmap foreground_pixmap, background_pixmap;
- XrmQuark xlfd;
-
- unsigned long xlfd_mask;
- XrmQuark foundry, family, weight, slant, setwidth, addstyle, pixel_size,
- point_size, res_x, res_y, spacing, avgwidth, registry, encoding;
-
- short underline_position, underline_thickness;
-};
-
-struct _XawTextPropertyList {
- XrmQuark identifier;
- Screen *screen;
- Colormap colormap;
- int depth;
- XawTextProperty **properties;
- Cardinal num_properties;
- XawTextPropertyList *next;
-};
-
-typedef struct _XawTextPaintStruct XawTextPaintStruct;
-struct _XawTextPaintStruct {
- XawTextPaintStruct *next;
- int x, y, width;
- unsigned char *text; /* formatted text */
- Cardinal length; /* length of text */
- XawTextProperty *property;
- int max_ascent, max_descent;
- XmuArea *backtabs;
- Boolean highlight;
-};
-
-typedef struct {
- XmuArea *clip, *hightabs; /* clip list */
- XawTextPaintStruct *paint, *bearings; /* drawing information */
-} XawTextPaintList;
-
-typedef struct {
- XtPointer next_extension;
- XrmQuark record_type;
- long version;
- Cardinal record_size;
- Bool (*BeginPaint)(Widget);
- void (*PreparePaint)(Widget, int, int,
- XawTextPosition, XawTextPosition, Bool);
- void (*DoPaint)(Widget);
- Bool (*EndPaint)(Widget);
-} TextSinkExtRec, *TextSinkExt;
-#endif
-
-typedef void (*_XawSinkDisplayTextProc)
- (Widget, int, int, XawTextPosition, XawTextPosition, Bool);
-
-typedef void (*_XawSinkInsertCursorProc)
- (Widget, int, int, XawTextInsertState);
-
-typedef void (*_XawSinkClearToBackgroundProc)
- (Widget, int, int, unsigned int, unsigned int);
-
-typedef void (*_XawSinkFindPositionProc)
- (Widget, XawTextPosition, int, int, Bool, XawTextPosition*, int*, int*);
-
-typedef void (*_XawSinkFindDistanceProc)
- (Widget, XawTextPosition, int, XawTextPosition, int*,
- XawTextPosition*, int*);
-
-typedef void (*_XawSinkResolveProc)
- (Widget, XawTextPosition, int, int, XawTextPosition*);
-
-typedef int (*_XawSinkMaxLinesProc)
- (Widget, unsigned int);
-
-typedef int (*_XawSinkMaxHeightProc)
- (Widget, int);
-
-typedef void (*_XawSinkSetTabsProc)
- (Widget, int, short*);
-
-typedef void (*_XawSinkGetCursorBoundsProc)
- (Widget, XRectangle*);
-
-typedef struct _TextSinkClassPart {
- _XawSinkDisplayTextProc DisplayText;
- _XawSinkInsertCursorProc InsertCursor;
- _XawSinkClearToBackgroundProc ClearToBackground;
- _XawSinkFindPositionProc FindPosition;
- _XawSinkFindDistanceProc FindDistance;
- _XawSinkResolveProc Resolve;
- _XawSinkMaxLinesProc MaxLines;
- _XawSinkMaxHeightProc MaxHeight;
- _XawSinkSetTabsProc SetTabs;
- _XawSinkGetCursorBoundsProc GetCursorBounds;
-#ifndef OLDXAW
- TextSinkExt extension;
-#endif
-} TextSinkClassPart;
-
-/* Full class record */
-typedef struct _TextSinkClassRec {
- ObjectClassPart object_class;
- TextSinkClassPart text_sink_class;
-} TextSinkClassRec;
-
-extern TextSinkClassRec textSinkClassRec;
-
-/* New fields for the TextSink object */
-typedef struct {
- /* resources */
- Pixel foreground; /* Foreground color */
- Pixel background; /* Background color */
-
- /* private */
- Position *tabs; /* The tab stops as pixel values */
- short *char_tabs; /* The tabs stops as character values */
- int tab_count; /* number of items in tabs */
-
-#ifndef OLDXAW
- /* more resources */
- Pixel cursor_color;
- XawTextPropertyList *properties;
- XawTextPaintList *paint;
- XtPointer pad[2]; /* for future use and keep binary compatability */
-#endif
-} TextSinkPart;
-
-/* Full instance record */
-typedef struct _TextSinkRec {
- ObjectPart object;
- TextSinkPart text_sink;
-} TextSinkRec;
-
-/* Semi private routines */
-#ifndef OLDXAW
-XawTextPropertyList *XawTextSinkConvertPropertyList
-(
- String name,
- String spec,
- Screen *screen,
- Colormap Colormap,
- int depth
- );
-
-XawTextProperty *XawTextSinkGetProperty
-(
- Widget w,
- XrmQuark property
- );
-
-XawTextProperty *XawTextSinkCopyProperty
-(
- Widget w,
- XrmQuark property
- );
-
-XawTextProperty *XawTextSinkAddProperty
-(
- Widget w,
- XawTextProperty *property
- );
-
-XawTextProperty *XawTextSinkCombineProperty
-(
- Widget w,
- XawTextProperty *result_in_out,
- XawTextProperty *property,
- Bool override
- );
-
-Bool XawTextSinkBeginPaint
-(
- Widget w
- );
-
-void XawTextSinkPreparePaint
-(
- Widget w,
- int y,
- int line,
- XawTextPosition from,
- XawTextPosition to,
- Bool highlight
-);
-
-void XawTextSinkDoPaint
-(
- Widget w
- );
-
-Bool XawTextSinkEndPaint
-(
- Widget w
- );
-#endif
-
-#define XtInheritDisplayText ((_XawSinkDisplayTextProc)_XtInherit)
-#define XtInheritInsertCursor ((_XawSinkInsertCursorProc)_XtInherit)
-#define XtInheritClearToBackground ((_XawSinkClearToBackgroundProc)_XtInherit)
-#define XtInheritFindPosition ((_XawSinkFindPositionProc)_XtInherit)
-#define XtInheritFindDistance ((_XawSinkFindDistanceProc)_XtInherit)
-#define XtInheritResolve ((_XawSinkResolveProc)_XtInherit)
-#define XtInheritMaxLines ((_XawSinkMaxLinesProc)_XtInherit)
-#define XtInheritMaxHeight ((_XawSinkMaxHeightProc)_XtInherit)
-#define XtInheritSetTabs ((_XawSinkSetTabsProc)_XtInherit)
-#define XtInheritGetCursorBounds ((_XawSinkGetCursorBoundsProc)_XtInherit)
-
-#endif /* _XawTextSinkP_h */
diff --git a/xc/lib/Xaw/TextSrc.c b/xc/lib/Xaw/TextSrc.c
deleted file mode 100644
index 28df0127a..000000000
--- a/xc/lib/Xaw/TextSrc.c
+++ /dev/null
@@ -1,1963 +0,0 @@
-/* $TOG: TextSrc.c /main/21 1998/05/25 08:17:30 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.
-
-*/
-
-/* $XFree86: xc/lib/Xaw/TextSrc.c,v 1.22 1999/08/28 09:00:28 dawes Exp $ */
-
-/*
- * Author: Chris Peterson, MIT X Consortium.
- * Much code taken from X11R3 String and Disk Sources.
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/Atoms.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xaw/TextSrcP.h>
-#include <X11/Xaw/XawInit.h>
-#include "XawI18n.h"
-#include "Private.h"
-
-#ifndef OLDXAW
-#define UNDO_DEPTH 16384
-
-#define ANCHORS_DIST 4096 /* default distance between anchors */
-
-/*
- * Types
- */
-typedef struct {
- XawTextPosition position;
- char *buffer;
- unsigned length;
- unsigned refcount;
- unsigned long format;
-} XawTextUndoBuffer;
-
-typedef struct _XawTextUndoList XawTextUndoList;
-struct _XawTextUndoList {
- XawTextUndoBuffer *left, *right;
- XawTextUndoList *undo, *redo;
-};
-
-struct _XawTextUndo {
- XawTextUndoBuffer **undo;
- unsigned num_undo;
- XawTextUndoList *list, *pointer, *end_mark, *head;
- unsigned num_list;
- XawTextScanDirection dir;
- XawTextUndoBuffer *l_save, *r_save;
- XawTextUndoList *u_save;
- XawTextUndoBuffer *l_no_change, *r_no_change;
- int merge;
- int erase; /* there are two types of erases */
-};
-#endif /* OLDXAW */
-
-/*
- * Class Methods
- */
-static Boolean ConvertSelection(Widget, Atom*, Atom*, Atom*, XtPointer*,
- unsigned long*, int*);
-static XawTextPosition Read(Widget, XawTextPosition, XawTextBlock*, int);
-static int Replace(Widget, XawTextPosition, XawTextPosition, XawTextBlock*);
-static XawTextPosition Scan(Widget, XawTextPosition, XawTextScanType,
- XawTextScanDirection, int, Bool);
-static XawTextPosition Search(Widget, XawTextPosition, XawTextScanDirection,
- XawTextBlock*);
-static void SetSelection(Widget, XawTextPosition, XawTextPosition, Atom);
-static void XawTextSrcClassInitialize(void);
-static void XawTextSrcClassPartInitialize(WidgetClass);
-static void XawTextSrcInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawTextSrcDestroy(Widget);
-static Boolean XawTextSrcSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-/*
- * Prototypes
- */
-static void CvtStringToEditMode(XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr);
-static Boolean CvtEditModeToString(Display*, XrmValuePtr, Cardinal*,
- XrmValuePtr, XrmValuePtr, XtPointer*);
-#ifndef OLDXAW
-static void FreeUndoBuffer(XawTextUndo*);
-static void UndoGC(XawTextUndo*);
-static void TellSourceChanged(TextSrcObject, XawTextPosition, XawTextPosition,
- XawTextBlock*, int);
-Bool _XawTextSrcUndo(TextSrcObject, XawTextPosition*);
-Bool _XawTextSrcToggleUndo(TextSrcObject);
-XawTextAnchor *_XawTextSourceFindAnchor(Widget, XawTextPosition);
-
-/*
- * External
- */
-void _XawSourceAddText(Widget, Widget);
-void _XawSourceRemoveText(Widget, Widget, Bool);
-Bool _XawTextSourceNewLineAtEOF(Widget);
-void _XawSourceSetUndoErase(TextSrcObject, int);
-void _XawSourceSetUndoMerge(TextSrcObject, Bool);
-#endif /* OLDXAW */
-
-/*
- * Defined in Text.c
- */
-char *_XawTextGetText(TextWidget, XawTextPosition, XawTextPosition);
-void _XawTextSourceChanged(Widget, XawTextPosition, XawTextPosition,
- XawTextBlock*, int);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(TextSrcRec, textSrc.field)
-static XtResource resources[] = {
- {
- XtNeditType,
- XtCEditType,
- XtREditMode,
- sizeof(XawTextEditType),
- offset(edit_mode),
- XtRString,
- "read"
- },
-#ifndef OLDXAW
- {
- XtNcallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(callback),
- XtRCallback,
- NULL
- },
- {
- XtNsourceChanged,
- XtCChanged,
- XtRBoolean,
- sizeof(Boolean),
- offset(changed),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNenableUndo,
- XtCUndo,
- XtRBoolean,
- sizeof(Boolean),
- offset(enable_undo),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNpropertyCallback,
- XtCCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(property_callback),
- XtRCallback,
- NULL
- },
-#endif /* OLDXAW */
-};
-#undef offset
-
-#define Superclass (&objectClassRec)
-TextSrcClassRec textSrcClassRec = {
- /* object */
- {
- (WidgetClass)Superclass, /* superclass */
- "TextSrc", /* class_name */
- sizeof(TextSrcRec), /* widget_size */
- XawTextSrcClassInitialize, /* class_initialize */
- XawTextSrcClassPartInitialize, /* class_part_initialize */
- False, /* class_inited */
- XawTextSrcInitialize, /* initialize */
- NULL, /* initialize_hook */
- NULL, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- False, /* compress_exposure */
- False, /* compress_enterleave */
- False, /* visible_interest */
- XawTextSrcDestroy, /* destroy */
- NULL, /* resize */
- NULL, /* expose */
- XawTextSrcSetValues, /* set_values */
- NULL, /* set_values_hook */
- NULL, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- NULL, /* query_geometry */
- NULL, /* display_accelerator */
- NULL, /* extension */
- },
- /* text_src */
- {
- Read, /* Read */
- Replace, /* Replace */
- Scan, /* Scan */
- Search, /* Search */
- SetSelection, /* SetSelection */
- ConvertSelection, /* ConvertSelection */
- },
-};
-
-WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec;
-
-static XrmQuark QRead, QAppend, QEdit;
-#ifndef OLDXAW
-static char *SrcNL = "\n";
-static wchar_t SrcWNL[2];
-#endif
-
-/*
- * Implementation
- */
-static void
-XawTextSrcClassInitialize(void)
-{
- XawInitializeWidgetSet();
-
-#ifndef OLDXAW
- SrcWNL[0] = _Xaw_atowc(XawLF);
- SrcWNL[1] = 0;
-#endif
- QRead = XrmPermStringToQuark(XtEtextRead);
- QAppend = XrmPermStringToQuark(XtEtextAppend);
- QEdit = XrmPermStringToQuark(XtEtextEdit);
- XtAddConverter(XtRString, XtREditMode, CvtStringToEditMode, NULL, 0);
- XtSetTypeConverter(XtREditMode, XtRString, CvtEditModeToString, NULL, 0,
- XtCacheNone, NULL);
-}
-
-static void
-XawTextSrcClassPartInitialize(WidgetClass wc)
-{
- TextSrcObjectClass t_src, superC;
-
- t_src = (TextSrcObjectClass)wc;
- superC = (TextSrcObjectClass)t_src->object_class.superclass;
-
- /*
- * We don't need to check for null super since we'll get to TextSrc
- * eventually
- */
- if (t_src->textSrc_class.Read == XtInheritRead)
- t_src->textSrc_class.Read = superC->textSrc_class.Read;
-
- if (t_src->textSrc_class.Replace == XtInheritReplace)
- t_src->textSrc_class.Replace = superC->textSrc_class.Replace;
-
- if (t_src->textSrc_class.Scan == XtInheritScan)
- t_src->textSrc_class.Scan = superC->textSrc_class.Scan;
-
- if (t_src->textSrc_class.Search == XtInheritSearch)
- t_src->textSrc_class.Search = superC->textSrc_class.Search;
-
- if (t_src->textSrc_class.SetSelection == XtInheritSetSelection)
- t_src->textSrc_class.SetSelection = superC->textSrc_class.SetSelection;
-
- if (t_src->textSrc_class.ConvertSelection == XtInheritConvertSelection)
- t_src->textSrc_class.ConvertSelection =
- superC->textSrc_class.ConvertSelection;
-}
-
-/*ARGSUSED*/
-static void
-XawTextSrcInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
-#ifndef OLDXAW
- TextSrcObject src = (TextSrcObject)cnew;
-
- if (src->textSrc.enable_undo) {
- src->textSrc.undo = (XawTextUndo*)XtCalloc(1, sizeof(XawTextUndo));
- src->textSrc.undo->dir = XawsdLeft;
- }
- else
- src->textSrc.undo = NULL;
- src->textSrc.undo_state = False;
- if (XtIsSubclass(XtParent(cnew), textWidgetClass)) {
- src->textSrc.text = (WidgetList)XtMalloc(sizeof(Widget*));
- src->textSrc.text[0] = XtParent(cnew);
- src->textSrc.num_text = 1;
- }
- else {
- src->textSrc.text = NULL;
- src->textSrc.num_text = 0;
- }
-
- src->textSrc.anchors = NULL;
- src->textSrc.num_anchors = 0;
- (void)XawTextSourceAddAnchor(cnew, 0);
-#endif /* OLDXAW */
-}
-
-static void
-XawTextSrcDestroy(Widget w)
-{
-#ifndef OLDXAW
- TextSrcObject src = (TextSrcObject)w;
-
- if (src->textSrc.enable_undo) {
- FreeUndoBuffer(src->textSrc.undo);
- XtFree((char*)src->textSrc.undo);
- }
- XtFree((char*)src->textSrc.text);
-
- if (src->textSrc.num_anchors) {
- XawTextEntity *entity, *enext;
- int i;
-
- for (i = 0; i < src->textSrc.num_anchors; i++) {
- entity = src->textSrc.anchors[i]->entities;
- while (entity) {
- enext = entity->next;
- XtFree((XtPointer)entity);
- entity = enext;
- }
- XtFree((XtPointer)src->textSrc.anchors[i]);
- }
- XtFree((XtPointer)src->textSrc.anchors);
- }
-#endif /* OLDXAW */
-}
-
-/*ARGSUSED*/
-static Boolean
-XawTextSrcSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
-#ifndef OLDXAW
- TextSrcObject oldtw = (TextSrcObject)current;
- TextSrcObject newtw = (TextSrcObject)cnew;
-
- if (oldtw->textSrc.enable_undo != newtw->textSrc.enable_undo) {
- if (newtw->textSrc.enable_undo) {
- newtw->textSrc.undo = (XawTextUndo*)
- XtCalloc(1, sizeof(XawTextUndo));
- newtw->textSrc.undo->dir = XawsdLeft;
- }
- else {
- FreeUndoBuffer(newtw->textSrc.undo);
- XtFree((char*)newtw->textSrc.undo);
- newtw->textSrc.undo = NULL;
- }
- }
- if (oldtw->textSrc.changed != newtw->textSrc.changed) {
- if (newtw->textSrc.enable_undo) {
- if (newtw->textSrc.undo->list) {
- newtw->textSrc.undo->l_no_change =
- newtw->textSrc.undo->list->left;
- newtw->textSrc.undo->r_no_change =
- newtw->textSrc.undo->list->right;
- }
- else
- newtw->textSrc.undo->l_no_change =
- newtw->textSrc.undo->r_no_change = NULL;
- }
- }
-#endif /* OLDXAW */
- return (False);
-}
-
-/*
- * Function:
- * Read
- *
- * Parameters:
- * w - TextSrc Object
- * pos - position of the text to retreive
- * text - text block that will contain returned text
- * length - maximum number of characters to read
- *
- * Description:
- * This function reads the source.
- */
-/*ARGSUSED*/
-static XawTextPosition
-Read(Widget w, XawTextPosition pos, XawTextBlock *text, int length)
-{
- return ((XawTextPosition)0);
-}
-
-/*
- * Function:
- * Replace
- *
- * Parameters:
- * src - Text Source Object
- * startPos - ends of text that will be removed
- * endPos - ""
- * text - new text to be inserted into buffer at startPos
- *
- * Description:
- * Replaces a block of text with new text.
- */
-/*ARGSUSED*/
-static int
-Replace(Widget w, XawTextPosition startPos, XawTextPosition endPos,
- XawTextBlock *text)
-{
- return (XawEditError);
-}
-
-/*
- * Function:
- * Scan
- *
- * Parameters:
- * w - TextSrc Object
- * position - position to start scanning
- * type - type of thing to scan for
- * dir - direction to scan
- * count - which occurance if this thing to search for
- * include - whether or not to include the character found in
- * the position that is returned
- *
- * Description:
- * Scans the text source for the number and type of item specified.
- */
-/*ARGSUSED*/
-static XawTextPosition
-Scan(Widget w, XawTextPosition position, XawTextScanType type,
- XawTextScanDirection dir, int count, Bool include)
-{
- return ((XawTextPosition)0);
-}
-
-/*
- * Function:
- * Search
- *
- * Parameters:
- * w - TextSource Object
- * position - position to start searching
- * dir - direction to search
- * text - the text block to search for
- *
- * Description:
- * Searchs the text source for the text block passed
- */
-/*ARGSUSED*/
-static XawTextPosition
-Search(Widget w, XawTextPosition position, XawTextScanDirection dir,
- XawTextBlock *text)
-{
- return (XawTextSearchError);
-}
-
-/*ARGSUSED*/
-static Boolean
-ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
- XtPointer *value, unsigned long *length, int *format)
-{
- return (False);
-}
-
-/*ARGSUSED*/
-static void
-SetSelection(Widget w, XawTextPosition left, XawTextPosition right,
- Atom selection)
-{
-}
-
-/*ARGSUSED*/
-static void
-CvtStringToEditMode(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XawTextEditType editType;
- XrmQuark q;
- char name[7];
-
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- if (q == QRead)
- editType = XawtextRead;
- else if (q == QAppend)
- editType = XawtextAppend;
- else if (q == QEdit)
- editType = XawtextEdit;
- else {
- toVal->size = 0;
- toVal->addr = NULL;
- XtStringConversionWarning((char *)fromVal->addr, XtREditMode);
- }
- toVal->size = sizeof(XawTextEditType);
- toVal->addr = (XPointer)&editType;
-}
-
-/*ARGSUSED*/
-static Boolean
-CvtEditModeToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(XawTextEditType *)fromVal->addr) {
- case XawtextAppend:
- case XawtextRead:
- buffer = XtEtextRead;
- break;
- buffer = XtEtextAppend;
- break;
- case XawtextEdit:
- buffer = XtEtextEdit;
- break;
- default:
- XawTypeToStringWarning(dpy, XtREditMode);
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL) {
- if (toVal->size < size) {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
-
-#ifndef OLDXAW
-Bool
-_XawTextSourceNewLineAtEOF(Widget w)
-{
- TextSrcObject src = (TextSrcObject)w;
- XawTextBlock text;
-
- text.firstPos = 0;
- if ((text.format = src->textSrc.text_format) == XawFmt8Bit)
- text.ptr = SrcNL;
- else
- text.ptr = (char*)SrcWNL;
- text.length = 1;
-
- return (XawTextSourceSearch(w, XawTextSourceScan(w, 0, XawstAll,
- XawsdRight, 1, True) - 1,
- XawsdRight, &text) != XawTextSearchError);
-}
-
-void
-_XawSourceAddText(Widget source, Widget text)
-{
- TextSrcObject src = (TextSrcObject)source;
- Bool found = False;
- Cardinal i;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- if (src->textSrc.text[i] == text) {
- found = True;
- break;
- }
-
- if (!found) {
- src->textSrc.text = (WidgetList)
- XtRealloc((char*)src->textSrc.text,
- sizeof(Widget) * (src->textSrc.num_text + 1));
- src->textSrc.text[src->textSrc.num_text++] = text;
- }
-}
-
-void
-_XawSourceRemoveText(Widget source, Widget text, Bool destroy)
-{
- TextSrcObject src = (TextSrcObject)source;
- Bool found = False;
- Cardinal i;
-
- if (src == NULL)
- return;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- if (src->textSrc.text[i] == text) {
- found = True;
- break;
- }
-
- if (found) {
- if (--src->textSrc.num_text == 0) {
- if (destroy) {
- XtDestroyWidget(source);
- return;
- }
- else {
- XtFree((char*)src->textSrc.text);
- src->textSrc.text = NULL; /* for realloc "magic" */
- }
- }
- else if (i < src->textSrc.num_text)
- memmove(&src->textSrc.text[i], &src->textSrc.text[i + 1],
- sizeof(Widget) * (src->textSrc.num_text - i));
- }
-}
-#endif /* OLDXAW */
-
-/*
- * Function:
- * XawTextSourceRead
- *
- * Parameters:
- * w - TextSrc Object
- * pos - position of the text to retrieve
- * text - text block that will contain returned text (return)
- * length - maximum number of characters to read
- *
- * Description:
- * This function reads the source.
- *
- * Returns:
- * The number of characters read into the buffer
- */
-XawTextPosition
-XawTextSourceRead(Widget w, XawTextPosition pos, XawTextBlock *text,
- int length)
-{
- TextSrcObjectClass cclass = (TextSrcObjectClass)w->core.widget_class;
-
- return ((*cclass->textSrc_class.Read)(w, pos, text, length));
-}
-
-#ifndef OLDXAW
-static void
-TellSourceChanged(TextSrcObject src, XawTextPosition left,
- XawTextPosition right, XawTextBlock *block, int lines)
-{
- Cardinal i;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- _XawTextSourceChanged(src->textSrc.text[i], left, right, block, lines);
-}
-
-/*
- * This function is required because there is no way to diferentiate
- * if the first erase was generated by a backward-kill-char and the
- * second by a forward-kill-char (or vice-versa) from XawTextSourceReplace.
- * It is only possible to diferentiate after the second character is
- * killed, but then, it is too late.
- */
-void
-_XawSourceSetUndoErase(TextSrcObject src, int value)
-{
- if (src && src->textSrc.enable_undo)
- src->textSrc.undo->erase = value;
-}
-
-/*
- * To diferentiate insert-char's separeted by cursor movements.
- */
-void
-_XawSourceSetUndoMerge(TextSrcObject src, Bool state)
-{
- if (src && src->textSrc.enable_undo)
- src->textSrc.undo->merge += state ? 1 : -1;
-}
-#endif /* OLDXAW */
-
-/*
- * Public Functions
- */
-/*
- * Function:
- * XawTextSourceReplace
- *
- * Parameters:
- * src - Text Source Object
- * startPos - ends of text that will be removed
- * endPos - ""
- * text - new text to be inserted into buffer at startPos
- *
- * Description:
- * Replaces a block of text with new text.
- *
- * Returns:
- * XawEditError or XawEditDone.
- */
-/*ARGSUSED*/
-int
-XawTextSourceReplace(Widget w, XawTextPosition left,
- XawTextPosition right, XawTextBlock *block)
-{
- TextSrcObjectClass cclass = (TextSrcObjectClass)w->core.widget_class;
-#ifndef OLDXAW
- TextSrcObject src = (TextSrcObject)w;
- XawTextUndoBuffer *l_state, *r_state;
- XawTextUndoList *undo;
- Bool enable_undo;
- XawTextPosition start, end;
- int i, error, lines = 0;
-
- if (src->textSrc.edit_mode == XawtextRead)
- return (XawEditError);
-
- enable_undo = src->textSrc.enable_undo && src->textSrc.undo_state == False;
- if (enable_undo) {
- unsigned size, total;
-
- if (src->textSrc.undo->l_save) {
- l_state = src->textSrc.undo->l_save;
- src->textSrc.undo->l_save = NULL;
- }
- else
- l_state = XtNew(XawTextUndoBuffer);
- l_state->refcount = 1;
- l_state->position = left;
- if (left < right) {
- Widget ctx = NULL;
-
- for (i = 0; i < src->textSrc.num_text; i++)
- if (XtIsSubclass(src->textSrc.text[i], textWidgetClass)) {
- ctx = src->textSrc.text[i];
- break;
- }
- l_state->buffer = _XawTextGetText((TextWidget)ctx, left, right);
- l_state->length = right - left;
- }
- else {
- l_state->length = 0;
- l_state->buffer = NULL;
- }
- l_state->format = src->textSrc.text_format;
- if (l_state->length == 1) {
- if (l_state->format == XawFmtWide &&
- *(wchar_t*)l_state->buffer == *SrcWNL) {
- XtFree(l_state->buffer);
- l_state->buffer = (char*)SrcWNL;
- }
- else if (*l_state->buffer == '\n') {
- XtFree(l_state->buffer);
- l_state->buffer = SrcNL;
- }
- }
-
- if (src->textSrc.undo->r_save) {
- r_state = src->textSrc.undo->r_save;
- src->textSrc.undo->r_save = NULL;
- }
- else
- r_state = XtNew(XawTextUndoBuffer);
- r_state->refcount = 1;
- r_state->position = left;
- r_state->format = block->format;
- size = block->format == XawFmtWide ? sizeof(wchar_t) : sizeof(char);
- total = size * block->length;
- r_state->length = block->length;
- r_state->buffer = NULL;
- if (total == size) {
- if (r_state->format == XawFmtWide &&
- *(wchar_t*)block->ptr == *SrcWNL)
- r_state->buffer = (char*)SrcWNL;
- else if (*block->ptr == '\n')
- r_state->buffer = SrcNL;
- }
- if (total && !r_state->buffer) {
- r_state->buffer = XtMalloc(total);
- memcpy(r_state->buffer, block->ptr, total);
- }
-
- if (src->textSrc.undo->u_save) {
- undo = src->textSrc.undo->u_save;
- src->textSrc.undo->u_save = NULL;
- }
- else
- undo = XtNew(XawTextUndoList);
- undo->left = l_state;
- undo->right = r_state;
- undo->undo = src->textSrc.undo->list;
- undo->redo = NULL;
- }
- else {
- undo = NULL;
- l_state = r_state = NULL;
- }
-
-#define LARGE_VALUE 262144 /* 256 K */
- /* optimization, to avoid long delays recalculating the line number
- * when editing huge files
- */
- if (left > LARGE_VALUE) {
- start = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 2, False);
- for (i = 0; i < src->textSrc.num_text; i++) {
- TextWidget tw = (TextWidget)src->textSrc.text[i];
-
- if (left <= tw->text.lt.top &&
- left + block->length - (right - left) > tw->text.lt.top)
- _XawTextBuildLineTable(tw, start, False);
- }
- }
-#undef LARGE_VALUE
-
- start = left;
- end = right;
- while (start < end) {
- start = XawTextSourceScan(w, start, XawstEOL, XawsdRight, 1, True);
- if (start <= end) {
- --lines;
- if (start == XawTextSourceScan(w, 0, XawstAll, XawsdRight, 1, True)) {
- lines += !_XawTextSourceNewLineAtEOF(w);
- break;
- }
- }
- }
-#else
- int error;
-#endif /* OLDXAW */
-
- error = (*cclass->textSrc_class.Replace)(w, left, right, block);
-
-#ifndef OLDXAW
- if (error != XawEditDone) {
- if (enable_undo) {
- if (l_state->buffer) {
- if (l_state->buffer != SrcNL && l_state->buffer != (char*)SrcWNL)
- XtFree(l_state->buffer);
- l_state->buffer = NULL;
- }
- src->textSrc.undo->l_save = l_state;
- if (r_state->buffer) {
- if (r_state->buffer != SrcNL && r_state->buffer != (char*)SrcWNL)
- XtFree(r_state->buffer);
- r_state->buffer = NULL;
- }
- src->textSrc.undo->r_save = r_state;
-
- src->textSrc.undo->u_save = undo;
- }
- }
- else if (enable_undo) {
- XawTextUndoList *list = src->textSrc.undo->list;
- XawTextUndoBuffer *unl, *lnl;
- int erase = undo->right->length == 0 && undo->left->length == 1 && list
- && list->right->length == 0;
-
- if (erase) {
- erase = list->left->position - 1 == undo->left->position ? -1 :
- list->left->position == undo->left->position ? 1 : 0;
- if (src->textSrc.undo->erase && erase != src->textSrc.undo->erase)
- erase = 0;
- else
- src->textSrc.undo->erase = erase;
- }
-
- if (erase) {
- unl = l_state;
- lnl = list->left;
- }
- else {
- unl = r_state;
- lnl = list ? list->right : NULL;
- }
-
- /* Try to merge the undo buffers */
- if (src->textSrc.undo->merge > 0 && ((erase ||
- (list && ((list->left->length == 0 && undo->left->length == 0) ||
- (list->left->length == list->right->length &&
- undo->left->length == 1)) &&
- undo->right->length == 1 &&
- list->right->position + list->right->length
- == undo->right->position))
- && src->textSrc.undo->pointer == list
- && unl->format == list->right->format
- && ((unl->format == XawFmt8Bit && unl->buffer[0] != XawLF) ||
- (unl->format == XawFmtWide &&
- *(wchar_t*)(unl->buffer) != _Xaw_atowc(XawLF)))
- && ((lnl->format == XawFmt8Bit && lnl->buffer[0] != XawLF) ||
- (lnl->format == XawFmtWide &&
- *(wchar_t*)(lnl->buffer) != _Xaw_atowc(XawLF))))) {
- unsigned size = lnl->format == XawFmtWide ?
- sizeof(wchar_t) : sizeof(char);
-
- if (!erase) {
- list->right->buffer = XtRealloc(list->right->buffer,
- (list->right->length + 1) * size);
- memcpy(list->right->buffer + list->right->length * size,
- undo->right->buffer, size);
- ++list->right->length;
- XtFree(r_state->buffer);
- }
- else if (erase < 0) {
- --list->left->position;
- --list->right->position;
- }
-
- src->textSrc.undo->l_save = l_state;
- src->textSrc.undo->r_save = r_state;
- src->textSrc.undo->u_save = undo;
-
- if (list->left->length) {
- list->left->buffer = XtRealloc(list->left->buffer,
- (list->left->length + 1) * size);
- if (erase >= 0)
- memcpy(list->left->buffer + list->left->length * size,
- undo->left->buffer, size);
- else {
- /* use memmove, since strings overlap */
- memmove(list->left->buffer + size, list->left->buffer,
- list->left->length * size);
- memcpy(list->left->buffer, undo->left->buffer, size);
- }
- ++list->left->length;
- XtFree(l_state->buffer);
- }
-
- if (src->textSrc.undo->num_list >= UNDO_DEPTH)
- UndoGC(src->textSrc.undo);
- }
- else {
- src->textSrc.undo->undo = (XawTextUndoBuffer**)
- XtRealloc((char*)src->textSrc.undo->undo,
- (2 + src->textSrc.undo->num_undo)
- * sizeof(XawTextUndoBuffer));
- src->textSrc.undo->undo[src->textSrc.undo->num_undo++] = l_state;
- src->textSrc.undo->undo[src->textSrc.undo->num_undo++] = r_state;
-
- if (src->textSrc.undo->list)
- src->textSrc.undo->list->redo = undo;
- else
- src->textSrc.undo->head = undo;
-
- src->textSrc.undo->merge = l_state->length <= 1 &&
- r_state->length <= 1;
-
- src->textSrc.undo->list = src->textSrc.undo->pointer =
- src->textSrc.undo->end_mark = undo;
-
- if (++src->textSrc.undo->num_list >= UNDO_DEPTH)
- UndoGC(src->textSrc.undo);
- }
- src->textSrc.undo->dir = XawsdLeft;
- if (!src->textSrc.changed) {
- src->textSrc.undo->l_no_change = src->textSrc.undo->list->right;
- src->textSrc.undo->r_no_change = src->textSrc.undo->list->left;
- src->textSrc.changed = True;
- }
- }
- else if (!src->textSrc.enable_undo)
- src->textSrc.changed = True;
-
- if (error == XawEditDone) {
- XawTextPropertyInfo info;
- XawTextAnchor *anchor;
-
- /* find anchor and index */
- /* XXX index (i) could be returned by XawTextSourceFindAnchor
- * or similar function, to speed up */
- if ((anchor = XawTextSourceFindAnchor(w, left))) {
- XawTextEntity *eprev, *entity, *enext;
- XawTextPosition offset, diff = block->length - (right - left);
-
- for (i = 0; i < src->textSrc.num_anchors; i++)
- if (src->textSrc.anchors[i] == anchor)
- break;
- if (anchor->cache && anchor->position + anchor->cache->offset +
- anchor->cache->length <= left)
- eprev = entity = anchor->cache;
- else
- eprev = entity = anchor->entities;
- while (entity) {
- offset = anchor->position + entity->offset;
-
- if (offset > left)
- break;
- if (offset + entity->length > left)
- break;
-
- eprev = entity;
- entity = entity->next;
- }
-
- /* try to do the right thing here (and most likely correct), but
- * other code needs to check what was done */
-
- /* adjust entity length */
- if (entity && offset <= left) {
- if (offset + entity->length < right)
- entity->length = left - offset + block->length;
- else
- entity->length += diff;
-
- if (entity->length == 0) {
- enext = entity->next;
- eprev->next = enext;
- anchor->cache = NULL;
- XtFree((XtPointer)entity);
- if (entity == anchor->entities) {
- if ((anchor->entities = enext) == NULL) {
- anchor = XawTextSourceRemoveAnchor(w, anchor);
- entity = anchor ? anchor->entities : NULL;
- eprev = NULL;
- }
- else
- eprev = entity = enext;
- }
- else
- entity = enext;
- }
- else {
- eprev = entity;
- entity = entity->next;
- }
- }
-
- while (anchor) {
- while (entity) {
- offset = anchor->position + entity->offset + entity->length;
-
- if (offset > right) {
- entity->length = XawMin(entity->length, offset - right);
- goto exit_anchor_loop;
- }
-
- enext = entity->next;
- if (eprev)
- eprev->next = enext;
- XtFree((XtPointer)entity);
- anchor->cache = NULL;
- if (entity == anchor->entities) {
- if ((anchor->entities = enext) == NULL) {
- if (i == 0)
- ++i;
- else if (i < --src->textSrc.num_anchors) {
- memmove(&src->textSrc.anchors[i],
- &src->textSrc.anchors[i + 1],
- (src->textSrc.num_anchors - i) *
- sizeof(XawTextAnchor*));
- XtFree((XtPointer)anchor);
- }
- if (i >= src->textSrc.num_anchors) {
- anchor = NULL;
- entity = NULL;
- break;
- }
- anchor = src->textSrc.anchors[i];
- eprev = NULL;
- entity = anchor->entities;
- continue;
- }
- }
- entity = enext;
- }
- if (i + 1 < src->textSrc.num_anchors) {
- anchor = src->textSrc.anchors[++i];
- entity = anchor->entities;
- eprev = NULL;
- }
- else
- break;
- eprev = NULL;
- }
-
-exit_anchor_loop:
- if (anchor) {
- XawTextAnchor *aprev;
-
- if (anchor->position >= XawMax(right, left + block->length))
- anchor->position += diff;
- else if (anchor->position > left &&
- (aprev = XawTextSourcePrevAnchor(w, anchor))) {
- XawTextPosition tmp = anchor->position - aprev->position;
-
- if (diff) {
- while (entity) {
- entity->offset += diff;
- entity = entity->next;
- }
- }
- entity = anchor->entities;
- while (entity) {
- entity->offset += tmp;
- entity = entity->next;
- }
- if ((entity = aprev->entities) == NULL)
- aprev->entities = anchor->entities;
- else {
- while (entity->next)
- entity = entity->next;
- entity->next = anchor->entities;
- }
- anchor->entities = NULL;
- (void)XawTextSourceRemoveAnchor(w, anchor);
- --i;
- }
- else if (diff) {
- while (entity) {
- entity->offset += diff;
- entity = entity->next;
- }
- }
- }
-
- if (diff) {
- for (++i; i < src->textSrc.num_anchors; i++)
- src->textSrc.anchors[i]->position += diff;
- }
- }
-
- start = left;
- end = start + block->length;
- while (start < end) {
- start = XawTextSourceScan(w, start, XawstEOL, XawsdRight, 1, True);
- if (start <= end) {
- ++lines;
- if (start == XawTextSourceScan(w, 0, XawstAll, XawsdRight, 1, True)) {
- lines -= !_XawTextSourceNewLineAtEOF(w);
- break;
- }
- }
- }
-
- info.left = left;
- info.right = right;
- info.block = block;
- XtCallCallbacks(w, XtNpropertyCallback, &info);
-
- TellSourceChanged(src, left, right, block, lines);
- /* Call callbacks, we have changed the buffer */
- XtCallCallbacks(w, XtNcallback,
- (XtPointer)((int)src->textSrc.changed));
- }
-
-#endif /* OLDXAW */
- return (error);
-}
-
-#ifndef OLDXAW
-Bool
-_XawTextSrcUndo(TextSrcObject src, XawTextPosition *insert_pos)
-{
- static wchar_t wnull = 0;
- XawTextBlock block;
- XawTextUndoList *list, *nlist;
- XawTextUndoBuffer *l_state, *r_state;
- Boolean changed = src->textSrc.changed;
-
- if (!src->textSrc.enable_undo || !src->textSrc.undo->num_undo)
- return (False);
-
- list = src->textSrc.undo->pointer;
-
- if (src->textSrc.undo->dir == XawsdLeft) {
- l_state = list->right;
- r_state = list->left;
- }
- else {
- l_state = list->left;
- r_state = list->right;
- }
-
- if (src->textSrc.undo->l_no_change == l_state
- && src->textSrc.undo->r_no_change == r_state)
- src->textSrc.changed = False;
- else
- src->textSrc.changed = True;
-
- block.firstPos = 0;
- block.length = r_state->length;
- block.ptr = r_state->buffer ? r_state->buffer : (char*)&wnull;
- block.format = r_state->format;
-
- src->textSrc.undo_state = True;
- if (XawTextSourceReplace((Widget)src, l_state->position, l_state->position
- + l_state->length, &block) != XawEditDone) {
- src->textSrc.undo_state = False;
- src->textSrc.changed = changed;
- return (False);
- }
- src->textSrc.undo_state = False;
-
- ++l_state->refcount;
- ++r_state->refcount;
- nlist = XtNew(XawTextUndoList);
- nlist->left = l_state;
- nlist->right = r_state;
- nlist->undo = src->textSrc.undo->list;
- nlist->redo = NULL;
-
- if (list == src->textSrc.undo->list)
- src->textSrc.undo->end_mark = nlist;
-
- if (src->textSrc.undo->dir == XawsdLeft) {
- if (list->undo == NULL)
- src->textSrc.undo->dir = XawsdRight;
- else
- list = list->undo;
- }
- else {
- if (list->redo == NULL || list->redo == src->textSrc.undo->end_mark)
- src->textSrc.undo->dir = XawsdLeft;
- else
- list = list->redo;
- }
- *insert_pos = r_state->position + r_state->length;
- src->textSrc.undo->pointer = list;
- src->textSrc.undo->list->redo = nlist;
- src->textSrc.undo->list = nlist;
- src->textSrc.undo->merge = src->textSrc.undo->erase = 0;
-
- if (++src->textSrc.undo->num_list >= UNDO_DEPTH)
- UndoGC(src->textSrc.undo);
-
- return (True);
-}
-
-Bool
-_XawTextSrcToggleUndo(TextSrcObject src)
-{
- if (!src->textSrc.enable_undo || !src->textSrc.undo->num_undo)
- return (False);
-
- if (src->textSrc.undo->pointer != src->textSrc.undo->list) {
- if (src->textSrc.undo->dir == XawsdLeft) {
- if (src->textSrc.undo->pointer->redo
- && (src->textSrc.undo->pointer->redo
- != src->textSrc.undo->end_mark)) {
- src->textSrc.undo->pointer = src->textSrc.undo->pointer->redo;
- src->textSrc.undo->dir = XawsdRight;
- }
- }
- else {
- if (src->textSrc.undo->pointer->undo
- && (src->textSrc.undo->pointer != src->textSrc.undo->head)) {
- src->textSrc.undo->pointer = src->textSrc.undo->pointer->undo;
- src->textSrc.undo->dir = XawsdLeft;
- }
- }
- }
-
- return (True);
-}
-
-static void
-FreeUndoBuffer(XawTextUndo *undo)
-{
- unsigned i;
- XawTextUndoList *head, *del;
-
- for (i = 0; i < undo->num_undo; i++) {
- if (undo->undo[i]->buffer && undo->undo[i]->buffer != SrcNL &&
- undo->undo[i]->buffer != (char*)SrcWNL)
- XtFree(undo->undo[i]->buffer);
- XtFree((char*)undo->undo[i]);
- }
- XtFree((char*)undo->undo);
- head = undo->head;
-
- del = head;
- while (head) {
- head = head->redo;
- XtFree((char*)del);
- del = head;
- }
-
- if (undo->l_save) {
- XtFree((char*)undo->l_save);
- undo->l_save = NULL;
- }
- if (undo->r_save) {
- XtFree((char*)undo->r_save);
- undo->r_save = NULL;
- }
- if (undo->u_save) {
- XtFree((char*)undo->u_save);
- undo->u_save = NULL;
- }
-
- undo->list = undo->pointer = undo->head = undo->end_mark = NULL;
- undo->l_no_change = undo->r_no_change = NULL;
- undo->undo = NULL;
- undo->dir = XawsdLeft;
- undo->num_undo = undo->num_list = undo->erase = undo->merge = 0;
-}
-
-static void
-UndoGC(XawTextUndo *undo)
-{
- unsigned i;
- XawTextUndoList *head = undo->head, *redo = head->redo;
-
- if (head == undo->pointer || head == undo->end_mark
- || undo->l_no_change == NULL
- || head->left == undo->l_no_change || head->right == undo->l_no_change)
- return;
-
- undo->head = redo;
- redo->undo = NULL;
-
- --head->left->refcount;
- if (--head->right->refcount == 0) {
- for (i = 0; i < undo->num_undo; i+= 2)
- if (head->left == undo->undo[i] || head->left == undo->undo[i+1]) {
- if (head->left == undo->undo[i+1]) {
- XawTextUndoBuffer *tmp = redo->left;
-
- redo->left = redo->right;
- redo->right = tmp;
- }
- if (head->left->buffer && head->left->buffer != SrcNL &&
- head->left->buffer != (char*)SrcWNL)
- XtFree(head->left->buffer);
- XtFree((char*)head->left);
- if (head->right->buffer && head->right->buffer != SrcNL &&
- head->right->buffer != (char*)SrcWNL)
- XtFree(head->right->buffer);
- XtFree((char*)head->right);
-
- undo->num_undo -= 2;
- memmove(&undo->undo[i], &undo->undo[i + 2],
- (undo->num_undo - i) * sizeof(XawTextUndoBuffer*));
- break;
- }
- }
- XtFree((char*)head);
- --undo->num_list;
-}
-#endif /* OLDXAW */
-
-/*
- * Function:
- * XawTextSourceScan
- *
- * Parameters:
- * w - TextSrc Object
- * position - position to start scanning
- * type - type of thing to scan for
- * dir - direction to scan
- * count - which occurance if this thing to search for
- * include - whether or not to include the character found in
- * the position that is returned.
- *
- * Description:
- * Scans the text source for the number and type of item specified.
- *
- * Returns:
- * The position of the text
- */
-XawTextPosition
-XawTextSourceScan(Widget w, XawTextPosition position,
-#if NeedWidePrototypes
- int type, int dir, int count, int include
-#else
- XawTextScanType type, XawTextScanDirection dir,
- int count, Boolean include
-#endif
-)
-{
- TextSrcObjectClass cclass = (TextSrcObjectClass)w->core.widget_class;
-
- return ((*cclass->textSrc_class.Scan)
- (w, position, type, dir, count, include));
-}
-
-/*
- * Function:
- * XawTextSourceSearch
- *
- * Parameters:
- * w - TextSource Object
- * position - position to start scanning
- * dir - direction to scan
- * text - the text block to search for.
- *
- * Returns:
- * The position of the text we are searching for or XawTextSearchError.
- *
- * Description:
- * Searchs the text source for the text block passed
- */
-XawTextPosition
-XawTextSourceSearch(Widget w, XawTextPosition position,
-#if NeedWidePrototypes
- int dir,
-#else
- XawTextScanDirection dir,
-#endif
- XawTextBlock *text)
-{
- TextSrcObjectClass cclass = (TextSrcObjectClass)w->core.widget_class;
-
- return ((*cclass->textSrc_class.Search)(w, position, dir, text));
-}
-
-/*
- * Function:
- * XawTextSourceConvertSelection
- *
- * Parameters:
- * w - TextSrc object
- * selection - current selection atom
- * target - current target atom
- * type - type to conver the selection to
- * value - return value that has been converted
- * length - ""
- * format - format of the returned value
- *
- * Returns:
- * True if the selection has been converted
- */
-Boolean
-XawTextSourceConvertSelection(Widget w, Atom *selection, Atom *target,
- Atom *type, XtPointer *value,
- unsigned long *length, int *format)
-{
- TextSrcObjectClass cclass = (TextSrcObjectClass)w->core.widget_class;
-
- return((*cclass->textSrc_class.ConvertSelection)
- (w, selection, target, type, value, length, format));
-}
-
-/*
- * Function:
- * XawTextSourceSetSelection
- *
- * Parameters:
- * w - TextSrc object
- * left - bounds of the selection
- * rigth - ""
- * selection - selection atom
- *
- * Description:
- * Allows special setting of the selection.
- */
-void
-XawTextSourceSetSelection(Widget w, XawTextPosition left,
- XawTextPosition right, Atom selection)
-{
- TextSrcObjectClass cclass = (TextSrcObjectClass)w->core.widget_class;
-
- (*cclass->textSrc_class.SetSelection)(w, left, right, selection);
-}
-
-/*
- * External Functions for Multi Text
- */
-/*
- * TextFormat():
- * returns the format of text: FMT8BIT or FMTWIDE
- */
-XrmQuark
-_XawTextFormat(TextWidget tw)
-{
- return (((TextSrcObject)(tw->text.source))->textSrc.text_format);
-}
-
-/* _XawTextWCToMB():
- * Convert the wchar string to external encoding
- * The caller is responsible for freeing both the source and ret string
- *
- * wstr - source wchar string
- * len_in_out - lengh of string.
- * As In, length of source wchar string, measured in wchar
- * As Out, length of returned string
- */
-char *
-_XawTextWCToMB(Display *d, wchar_t *wstr, int *len_in_out)
-{
- XTextProperty textprop;
-
- if (XwcTextListToTextProperty(d, (wchar_t**)&wstr, 1,
- XTextStyle, &textprop) < Success) {
- XtWarningMsg("convertError", "textSource", "XawError",
- "Non-character code(s) in buffer.", NULL, NULL);
- *len_in_out = 0;
- return (NULL);
- }
- *len_in_out = textprop.nitems;
-
- return ((char *)textprop.value);
-}
-
-/* _XawTextMBToWC():
- * Convert the string to internal processing codeset WC.
- * The caller is responsible for freeing both the source and ret string.
- *
- * str - source string
- * len_in_out - lengh of string
- * As In, it is length of source string
- * As Out, it is length of returned string, measured in wchar
- */
-wchar_t *
-_XawTextMBToWC(Display *d, char *str, int *len_in_out)
-{
- XTextProperty textprop;
- char *buf;
- wchar_t **wlist, *wstr;
- int count;
-
- if (*len_in_out == 0)
- return (NULL);
-
- buf = XtMalloc(*len_in_out + 1);
-
- strncpy(buf, str, *len_in_out);
- *(buf + *len_in_out) = '\0';
- if (XmbTextListToTextProperty(d, &buf, 1, XTextStyle, &textprop) != Success) {
- XtWarningMsg("convertError", "textSource", "XawError",
- "No Memory, or Locale not supported.", NULL, NULL);
- XtFree(buf);
- *len_in_out = 0;
- return (NULL);
- }
-
- XtFree(buf);
- if (XwcTextPropertyToTextList(d, &textprop,
- (wchar_t***)&wlist, &count) != Success) {
- XtWarningMsg("convertError", "multiSourceCreate", "XawError",
- "Non-character code(s) in source.", NULL, NULL);
- *len_in_out = 0;
- return (NULL);
- }
- wstr = wlist[0];
- *len_in_out = wcslen(wstr);
- XtFree((XtPointer)wlist);
-
- return (wstr);
-}
-
-#ifndef OLDXAW
-static int
-qcmp_anchors(_Xconst void *left, _Xconst void *right)
-{
- return ((*(XawTextAnchor**)left)->position -
- (*(XawTextAnchor**)right)->position);
-}
-
-XawTextAnchor *
-XawTextSourceAddAnchor(Widget w, XawTextPosition position)
-{
- TextSrcObject src = (TextSrcObject)w;
- XawTextAnchor *anchor, *panchor;
-
- if ((panchor = XawTextSourceFindAnchor(w, position)) != NULL) {
- XawTextEntity *pentity, *entity;
-
- if (position - panchor->position < ANCHORS_DIST)
- return (panchor);
-
- anchor = XtNew(XawTextAnchor);
-
- if (panchor->cache && panchor->position + panchor->cache->offset +
- panchor->cache->length < position)
- pentity = entity = panchor->cache;
- else
- pentity = entity = panchor->entities;
-
- while (entity && panchor->position + entity->offset +
- entity->length < position) {
- pentity = entity;
- entity = entity->next;
- }
- if (entity) {
- XawTextPosition diff;
-
- if (panchor->position + entity->offset < position)
- position = panchor->position + entity->offset;
-
- diff = position - panchor->position;
-
- panchor->cache = NULL;
- anchor->entities = entity;
- if (pentity != entity)
- pentity->next = NULL;
- else
- panchor->entities = NULL;
- while (entity) {
- entity->offset -= diff;
- entity = entity->next;
- }
- }
- else
- anchor->entities = NULL;
- }
- else {
- anchor = XtNew(XawTextAnchor);
- anchor->entities = NULL;
- }
-
- anchor->position = position;
- anchor->cache = NULL;
-
- src->textSrc.anchors = (XawTextAnchor**)
- XtRealloc((XtPointer)src->textSrc.anchors, sizeof(XawTextAnchor*) *
- (src->textSrc.num_anchors + 1));
- src->textSrc.anchors[src->textSrc.num_anchors++] = anchor;
- qsort((void*)src->textSrc.anchors, src->textSrc.num_anchors,
- sizeof(XawTextAnchor*), qcmp_anchors);
-
- return (anchor);
-}
-
-XawTextAnchor *
-XawTextSourceFindAnchor(Widget w, XawTextPosition position)
-{
- TextSrcObject src = (TextSrcObject)w;
- int i = 0, left, right, nmemb = src->textSrc.num_anchors;
- XawTextAnchor *anchor, **anchors = src->textSrc.anchors;
-
- left = 0;
- right = nmemb - 1;
- while (left <= right) {
- anchor = anchors[i = (left + right) >> 1];
- if (anchor->position == position)
- return (anchor);
- else if (position < anchor->position)
- right = i - 1;
- else
- left = i + 1;
- }
-
- if (nmemb)
- return (right < 0 ? anchors[0] : anchors[right]);
-
- return (NULL);
-}
-
-Bool
-XawTextSourceAnchorAndEntity(Widget w, XawTextPosition position,
- XawTextAnchor **anchor_return,
- XawTextEntity **entity_return)
-{
- XawTextAnchor *anchor = XawTextSourceFindAnchor(w, position);
- XawTextEntity *pentity, *entity;
- XawTextPosition offset;
- Bool next_anchor = True, retval = False;
-
- if (anchor->cache && anchor->position + anchor->cache->offset +
- anchor->cache->length <= position)
- pentity = entity = anchor->cache;
- else
- pentity = entity = anchor->entities;
- while (entity) {
- offset = anchor->position + entity->offset;
-
- if (offset > position) {
- retval = next_anchor = False;
- break;
- }
- if (offset + entity->length > position) {
- retval = True;
- next_anchor = False;
- break;
- }
- pentity = entity;
- entity = entity->next;
- }
-
- if (next_anchor) {
- *anchor_return = anchor = XawTextSourceNextAnchor(w, anchor);
- *entity_return = anchor ? anchor->entities : NULL;
- }
- else {
- *anchor_return = anchor;
- *entity_return = retval ? entity : pentity;
- }
-
- if (*anchor_return)
- (*anchor_return)->cache = *entity_return;
-
- return (retval);
-}
-
-XawTextAnchor *
-XawTextSourceNextAnchor(Widget w, XawTextAnchor *anchor)
-{
- int i;
- TextSrcObject src = (TextSrcObject)w;
-
- for (i = 0; i < src->textSrc.num_anchors - 1; i++)
- if (src->textSrc.anchors[i] == anchor)
- return (src->textSrc.anchors[i + 1]);
-
- return (NULL);
-}
-
-XawTextAnchor *
-XawTextSourcePrevAnchor(Widget w, XawTextAnchor *anchor)
-{
- int i;
- TextSrcObject src = (TextSrcObject)w;
-
- for (i = src->textSrc.num_anchors - 1; i > 0; i--)
- if (src->textSrc.anchors[i] == anchor)
- return (src->textSrc.anchors[i - 1]);
-
- return (NULL);
-}
-
-XawTextAnchor *
-XawTextSourceRemoveAnchor(Widget w, XawTextAnchor *anchor)
-{
- int i;
- TextSrcObject src = (TextSrcObject)w;
-
- for (i = 0; i < src->textSrc.num_anchors; i++)
- if (src->textSrc.anchors[i] == anchor)
- break;
-
- if (i == 0)
- return (src->textSrc.num_anchors > 1 ? src->textSrc.anchors[1] : NULL);
-
- if (i < src->textSrc.num_anchors) {
- XtFree((XtPointer)anchor);
- if (i < --src->textSrc.num_anchors) {
- memmove(&src->textSrc.anchors[i],
- &src->textSrc.anchors[i + 1],
- (src->textSrc.num_anchors - i) *
- sizeof(XawTextAnchor*));
-
- return (src->textSrc.anchors[i]);
- }
- }
-
- return (NULL);
-}
-
-/*
- * This function is very likely to change soon. Currently, there is a hack
- * to test/develop the XAW_TENTF_REPLACE attribute using the `type' argument
- * as a pointer to a *static* XawTextBlock structure.
- */
-XawTextEntity *
-XawTextSourceAddEntity(Widget w, int type, int flags,
- XawTextPosition position, Cardinal length,
- XrmQuark property)
-{
- TextSrcObject src = (TextSrcObject)w;
- XawTextAnchor *next, *anchor = _XawTextSourceFindAnchor(w, position);
- XawTextEntity *entity, *eprev;
-
- if (anchor->cache && anchor->position + anchor->cache->offset +
- anchor->cache->length <= position)
- eprev = entity = anchor->cache;
- else
- eprev = entity = anchor->entities;
-
- while (entity && anchor->position + entity->offset + entity->length <=
- position) {
- eprev = entity;
- entity = entity->next;
- }
- if (entity && anchor->position + entity->offset < position + length) {
- fprintf(stderr, "Cannot (yet) add more than one entity to same region.\n");
- return (NULL);
- }
-
- next = XawTextSourceFindAnchor(w, position + length);
- if (next && next != anchor) {
- if ((entity = next->entities) != NULL) {
- if (next->position + entity->offset < position + length) {
- fprintf(stderr, "Cannot (yet) add more than one entity to same region.\n");
- return (NULL);
- }
- }
- if (position + length > next->position) {
- XawTextPosition diff = position + length - next->position;
-
- next->position += diff;
- entity = next->entities;
- while (entity) {
- entity->offset -= diff;
- entity = entity->next;
- }
- entity = anchor->entities;
- while (entity && entity->offset < 0)
- entity = entity->next;
- if (entity && entity->offset < 0) {
- if (eprev)
- eprev->next = next->entities;
- else
- anchor->entities = next->entities;
- if ((next->entities = entity->next) == NULL)
- (void)XawTextSourceRemoveAnchor(w, next);
- entity->next = NULL;
-
- return (XawTextSourceAddEntity(w, type, flags, position,
- length, property));
- }
- }
- }
-
- entity = XtNew(XawTextEntity);
- if (flags & XAW_TENTF_REPLACE) {
- entity->type = 0;
- entity->data = (XtPointer)type;
- }
- else
- entity->type = type;
- entity->flags = flags;
- entity->offset = position - anchor->position;
- entity->length = length;
- entity->property = property;
-
- if (eprev == NULL) {
- anchor->entities = entity;
- entity->next = NULL;
- anchor->cache = NULL;
- }
- else if (eprev->offset > entity->offset) {
- anchor->cache = NULL;
- anchor->entities = entity;
- entity->next = eprev;
- }
- else {
- anchor->cache = eprev;
- entity->next = eprev->next;
- eprev->next = entity;
- }
-
- return (entity);
-}
-
-void
-XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right)
-{
- TextSrcObject src = (TextSrcObject)w;
- XawTextAnchor *anchor = XawTextSourceFindAnchor(w, left);
- XawTextEntity *entity, *eprev, *enext;
- XawTextPosition offset;
- int i, length;
-
- while (anchor && anchor->entities == NULL)
- anchor = XawTextSourceRemoveAnchor(w, anchor);
-
- if (anchor == NULL || left >= right)
- return;
-
- if (anchor->cache && anchor->position + anchor->cache->offset +
- anchor->cache->length < left)
- eprev = entity = anchor->cache;
- else
- eprev = entity = anchor->entities;
-
- /* find first entity before left position */
- while (anchor->position + entity->offset + entity->length < left) {
- eprev = entity;
- if ((entity = entity->next) == NULL) {
- if ((anchor = XawTextSourceNextAnchor(w, anchor)) == NULL)
- return;
- if ((eprev = entity = anchor->entities) == NULL) {
- fprintf(stderr, "Bad anchor found!\n");
- return;
- }
- }
- }
-
- offset = anchor->position + entity->offset;
- if (offset <= left) {
- length = XawMin(entity->length, left - offset);
-
- if (length <= 0) {
- enext = entity->next;
- eprev->next = enext;
- XtFree((XtPointer)entity);
- anchor->cache = NULL;
- if (entity == anchor->entities) {
- if ((anchor->entities = enext) == NULL) {
- if ((anchor = XawTextSourceRemoveAnchor(w, anchor)) == NULL)
- return;
- entity = anchor->entities;
- eprev = NULL;
- }
- else
- entity = enext;
- }
- else
- entity = enext;
- }
- else {
- entity->length = length;
- eprev = entity;
- entity = entity->next;
- }
- }
-
- /* clean everything until right position is reached */
- while (anchor) {
- while (entity) {
- offset = anchor->position + entity->offset + entity->length;
-
- if (offset > right) {
- anchor->cache = NULL;
- entity->offset = XawMax(entity->offset, right - anchor->position);
- entity->length = XawMin(entity->length, offset - right);
- return;
- }
-
- enext = entity->next;
- if (eprev)
- eprev->next = enext;
- XtFree((XtPointer)entity);
- if (entity == anchor->entities) {
- eprev = anchor->cache = NULL;
- if ((anchor->entities = enext) == NULL) {
- if ((anchor = XawTextSourceRemoveAnchor(w, anchor)) == NULL)
- return;
- entity = anchor->entities;
- continue;
- }
- }
- entity = enext;
- }
- if (anchor)
- anchor->cache = NULL;
- if ((anchor = XawTextSourceNextAnchor(w, anchor)) != NULL)
- entity = anchor->entities;
- eprev = NULL;
- }
-}
-
-/* checks the anchors up to position, and create an appropriate anchor
- * at position, if required.
- */
-XawTextAnchor *
-_XawTextSourceFindAnchor(Widget w, XawTextPosition position)
-{
- TextSrcObject src = (TextSrcObject)w;
- XawTextAnchor *anchor;
-
- anchor = XawTextSourceFindAnchor(w, position);
-
- if (position - anchor->position >= ANCHORS_DIST)
- return (XawTextSourceAddAnchor(w, position - (position % ANCHORS_DIST)));
-
- return (anchor);
-}
-#endif
diff --git a/xc/lib/Xaw/TextSrc.h b/xc/lib/Xaw/TextSrc.h
deleted file mode 100644
index 26955e934..000000000
--- a/xc/lib/Xaw/TextSrc.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * $TOG: TextSrc.h /main/12 1998/02/06 12:51:49 kaleb $
- */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/TextSrc.h,v 1.10 1999/08/15 13:00:38 dawes Exp $ */
-
-#ifndef _XawTextSrc_h
-#define _XawTextSrc_h
-
-#include <X11/Xaw/Text.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- callback Callback Callback NULL
- editType EditType XawTextEditType XawtextRead
- enableUndo Undo Boolean False
- sourceChanged Changed Boolean False
-
-*/
-
-/* Class record constants */
-extern WidgetClass textSrcObjectClass;
-
-typedef struct _TextSrcClassRec *TextSrcObjectClass;
-typedef struct _TextSrcRec *TextSrcObject;
-
-typedef enum {
- XawstPositions,
- XawstWhiteSpace,
- XawstEOL,
- XawstParagraph,
- XawstAll,
- XawstAlphaNumeric
- } XawTextScanType;
-
-typedef enum {
- Normal,
- Selected
-} highlightType;
-
-typedef enum {
- XawsmTextSelect,
- XawsmTextExtend
-} XawTextSelectionMode;
-
-typedef enum {
- XawactionStart,
- XawactionAdjust,
- XawactionEnd
-} XawTextSelectionAction;
-
-#define XawTextReadError -1
-#define XawTextScanError -1
-
-#ifndef OLDXAW
-#define XtNenableUndo "enableUndo"
-#define XtCUndo "Undo"
-
-#define XtNsourceChanged "sourceChanged"
-#define XtCChanged "Changed"
-
-#define XtNpropertyCallback "propertyCallback"
-#endif
-
-/*
- * Public Functions
- */
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawTextSourceRead
- *
- * Parameters:
- * w - TextSrc Object
- * pos - position of the text to retreive
- * text - text block that will contain returned text
- * length - maximum number of characters to read
- *
- * Description:
- * This function reads the source.
- *
- * Returns:
- * The number of characters read into the buffer
- */
-XawTextPosition XawTextSourceRead
-(
- Widget w,
- XawTextPosition pos,
- XawTextBlock *text_return,
- int length
- );
-
-/*
- * Function:
- * XawTextSourceReplace
- *
- * Parameters:
- * src - Text Source Object
- * startPos - ends of text that will be removed
- * endPos - ""
- * text - new text to be inserted into buffer at startPos
- *
- * Description:
- * Replaces a block of text with new text
- *
- * Returns:
- * XawEditError or XawEditDone
- */
-int XawTextSourceReplace
-(
- Widget w,
- XawTextPosition start,
- XawTextPosition end,
- XawTextBlock *text
- );
-
-/*
- * Function:
- * XawTextSourceScan
- *
- * Parameters:
- * w - TextSrc Object
- * position - position to start scanning
- * type - type of thing to scan for
- * dir - direction to scan
- * count - which occurance if this thing to search for
- * include - whether or not to include the character found in
- * the position that is returned.
- *
- * Description:
- * Scans the text source for the number and type of item specified.
- *
- * Returns:
- * The position of the text
- */
-XawTextPosition XawTextSourceScan
-(
- Widget w,
- XawTextPosition position,
-#if NeedWidePrototypes
- int type,
- int dir,
- int count,
- int include
-#else
- XawTextScanType type,
- XawTextScanDirection dir,
- int count,
- Boolean include
-#endif
- );
-
-/*
- * Function:
- * XawTextSourceSearch
- *
- * Parameters:
- * w - TextSource Object
- * position - position to start scanning
- * dir - direction to search
- * text - the text block to search for
- *
- * Description:
- * Searchs the text source for the text block passed.
- *
- * Returns:
- * The position of the text we are searching for or XawTextSearchError
- */
-XawTextPosition XawTextSourceSearch
-(
- Widget w,
- XawTextPosition position,
-#if NeedWidePrototypes
- int dir,
-#else
- XawTextScanDirection dir,
-#endif
- XawTextBlock *text
- );
-
-/*
- * Function:
- * XawTextSourceConvertSelection
- *
- * Parameters:
- * w - TextSrc object
- * selection - current selection atom
- * target - current target atom
- * type - type to conver the selection to
- * value - return value that has been converted
- * length - ""
- * format - format of the returned value
- *
- * Returns:
- * True if the selection has been converted
- */
-Boolean XawTextSourceConvertSelection
-(
- Widget w,
- Atom *selection,
- Atom *target,
- Atom *type,
- XtPointer *value_return,
- unsigned long *length_return,
- int *format_return
- );
-
-/*
- * Function:
- * XawTextSourceSetSelection
- *
- * Parameters:
- * w - TextSrc object
- * left - bounds of the selection
- * right - ""
- * selection - selection atom
- *
- * Description:
- * Allows special setting of the selection.
- */
-void XawTextSourceSetSelection
-(
- Widget w,
- XawTextPosition start,
- XawTextPosition end,
- Atom selection
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawTextSrc_h */
diff --git a/xc/lib/Xaw/TextSrcP.h b/xc/lib/Xaw/TextSrcP.h
deleted file mode 100644
index 7a95401aa..000000000
--- a/xc/lib/Xaw/TextSrcP.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
-* $TOG: TextSrcP.h /main/21 1998/02/06 12:51:38 kaleb $
-*/
-
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/TextSrcP.h,v 1.11 1999/08/28 09:00:29 dawes Exp $ */
-
-#ifndef _XawTextSrcP_h
-#define _XawTextSrcP_h
-
-/*
- * TextSrc Object Private Data
- */
-#include <X11/Xaw/TextSrc.h>
-#include <X11/Xaw/TextP.h> /* This source works with the Text widget */
-
-#ifndef OLDXAW
-struct _XawTextAnchor {
- XawTextPosition position;
- XawTextEntity *entities, *cache;
-};
-
-#define XAW_TENTF_HIDE 0x0001
-#define XAW_TENTF_READ 0x0002
-#define XAW_TENTF_REPLACE 0x0004
-struct _XawTextEntity {
- short type;
- short flags;
- XawTextEntity *next;
- XtPointer data;
- XawTextPosition offset; /* from the anchor */
- Cardinal length;
- XrmQuark property;
-};
-#endif
-
-#if 0 /* no longer used */
-/* New fields for the TextSrc object class */
-typedef struct {
- XtPointer next_extension;
- XrmQuark record_type;
- long version;
- Cardinal record_size;
- int (*Input)();
-} TextSrcExtRec, *TextSrcExt;
-#endif
-
-typedef XawTextPosition (*_XawSrcReadProc)
- (Widget, XawTextPosition, XawTextBlock*, int);
-
-typedef int (*_XawSrcReplaceProc)
- (Widget, XawTextPosition, XawTextPosition, XawTextBlock*);
-
-typedef XawTextPosition (*_XawSrcScanProc)
- (Widget, XawTextPosition, XawTextScanType, XawTextScanDirection,
- int, Bool);
-
-typedef XawTextPosition (*_XawSrcSearchProc)
- (Widget, XawTextPosition, XawTextScanDirection, XawTextBlock*);
-
-typedef void (*_XawSrcSetSelectionProc)
- (Widget, XawTextPosition, XawTextPosition, Atom);
-
-typedef Boolean (*_XawSrcConvertSelectionProc)
- (Widget, Atom*, Atom*, Atom*, XtPointer*, unsigned long*, int*);
-
-typedef struct _TextSrcClassPart {
- _XawSrcReadProc Read;
- _XawSrcReplaceProc Replace;
- _XawSrcScanProc Scan;
- _XawSrcSearchProc Search;
- _XawSrcSetSelectionProc SetSelection;
- _XawSrcConvertSelectionProc ConvertSelection;
-#ifndef OLDXAW
- XtPointer extension;
-#endif
-} TextSrcClassPart;
-
-/* Full class record */
-typedef struct _TextSrcClassRec {
- ObjectClassPart object_class;
- TextSrcClassPart textSrc_class;
-} TextSrcClassRec;
-
-extern TextSrcClassRec textSrcClassRec;
-
-#ifndef OLDXAW
-typedef struct _XawTextUndo XawTextUndo;
-#endif
-
-/* New fields for the TextSrc object */
-typedef struct {
- /* resources */
- XawTextEditType edit_mode;
- XrmQuark text_format; /* 2 formats: FMT8BIT for Ascii
- FMTWIDE for ISO 10646 */
-#ifndef OLDXAW
- XtCallbackList callback; /* A callback list to call when the
- source is changed */
- Boolean changed;
- Boolean enable_undo;
-
- /* private state */
- Boolean undo_state; /* to protect undo manipulation */
- XawTextUndo *undo;
- WidgetList text; /* TextWidget's using this source */
- Cardinal num_text;
- XtCallbackList property_callback;
- XawTextAnchor **anchors;
- int num_anchors;
- XtPointer pad[1]; /* for future use and keep binary compatability */
-#endif
-} TextSrcPart;
-
-/* Full instance record */
-typedef struct _TextSrcRec {
- ObjectPart object;
- TextSrcPart textSrc;
-} TextSrcRec;
-
-/*
- * Semiprivate declarations of functions used in other modules
- */
-char* _XawTextWCToMB
-(
- Display *display,
- wchar_t *wstr,
- int *len_in_out
- );
-
-wchar_t* _XawTextMBToWC
-(
- Display *display,
- char *str,
- int *len_in_out
- );
-
-#ifndef OLDXAW
-XawTextAnchor *XawTextSourceAddAnchor
-(
- Widget source,
- XawTextPosition position
- );
-
-XawTextAnchor *XawTextSourceFindAnchor
-(
- Widget source,
- XawTextPosition position
- );
-
-XawTextAnchor *XawTextSourceNextAnchor
-(
- Widget source,
- XawTextAnchor *anchor
- );
-
-XawTextAnchor *XawTextSourcePrevAnchor
-(
- Widget source,
- XawTextAnchor *anchor
- );
-
-XawTextAnchor *XawTextSourceRemoveAnchor
-(
- Widget source,
- XawTextAnchor *anchor
- );
-
-Bool XawTextSourceAnchorAndEntity
-(
- Widget w,
- XawTextPosition position,
- XawTextAnchor **anchor_return,
- XawTextEntity **entity_return
- );
-
-XawTextEntity *XawTextSourceAddEntity
-(
- Widget source,
- int type,
- int flags,
- XawTextPosition position,
- Cardinal length,
- XrmQuark property
- );
-
-void XawTextSourceClearEntities
-(
- Widget w,
- XawTextPosition left,
- XawTextPosition right
- );
-#endif
-
-#if 0 /* no longer used */
-typedef XawTextPosition (*_XawTextPositionFunc)();
-#endif
-
-#define XtInheritInput ((_XawTextPositionFunc)_XtInherit)
-#define XtInheritRead ((_XawSrcReadProc)_XtInherit)
-#define XtInheritReplace ((_XawSrcReplaceProc)_XtInherit)
-#define XtInheritScan ((_XawSrcScanProc)_XtInherit)
-#define XtInheritSearch ((_XawSrcSearchProc)_XtInherit)
-#define XtInheritSetSelection ((_XawSrcSetSelectionProc)_XtInherit)
-#define XtInheritConvertSelection ((_XawSrcConvertSelectionProc)_XtInherit)
-#if 0
-#define XtTextSrcExtVersion 1
-#define XtTextSrcExtTypeString "XT_TEXTSRC_EXT"
-#endif
-
-#endif /* _XawTextSrcP_h */
diff --git a/xc/lib/Xaw/TextTr.c b/xc/lib/Xaw/TextTr.c
deleted file mode 100644
index 5de0a9c63..000000000
--- a/xc/lib/Xaw/TextTr.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $TOG: TextTr.c /main/21 1998/02/06 12:51:54 kaleb $ */
-
-/*
-
-Copyright 1991, 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/lib/Xaw/TextTr.c,v 3.13 1999/06/06 08:48:18 dawes Exp $ */
-
-/* INTERNATIONALIZATION:
-
-The OMRON R5 contrib added the following action to the old TextTr:
-
- Ctrl<Key>backslash: reconnect-im()
-
-This is needed when the im is killed or otherwise becomes unreachable.
-This keystroke is evil (inconvenient, hard-to-remember, not obvious)
-so I am adding one more translation:
-
- <Key>Kanji: reconnect-im()
-
-The Japanese user typically hits their Kanji key when they want to do
-input. This merely makes sure the input is connected.
-*/
-
-char _XawDefaultTextTranslations[] =
-"c<Key>A:" "beginning-of-line()\n"
-"c<Key>B:" "backward-character()\n"
-"c<Key>C:" "insert-selection(CUT_BUFFER0)\n"
-"c<Key>D:" "delete-next-character()\n"
-"c<Key>E:" "end-of-line()\n"
-"c<Key>F:" "forward-character()\n"
-#ifndef OLDXAW
-"c<Key>G:" "keyboard-reset()\n"
-#else
-"c<Key>G:" "multiply(Reset)\n"
-#endif
-"c<Key>H:" "delete-previous-character()\n"
-"c<Key>J:" "newline-and-indent()\n"
-"c<Key>K:" "kill-to-end-of-line()\n"
-"c<Key>L:" "redraw-display()\n"
-"c<Key>M:" "newline()\n"
-"c<Key>N:" "next-line()\n"
-"c<Key>O:" "newline-and-backup()\n"
-"c<Key>P:" "previous-line()\n"
-"c<Key>R:" "search(backward)\n"
-"c<Key>S:" "search(forward)\n"
-"c<Key>T:" "transpose-characters()\n"
-#ifndef OLDXAW
-"c<Key>U:" "multiply(Start)\n"
-#else
-"c<Key>U:" "multiply(4)\n"
-#endif
-"c<Key>V:" "next-page()\n"
-"c<Key>W:" "kill-selection()\n"
-"c<Key>Y:" "insert-selection(SECONDARY)\n"
-"c<Key>Z:" "scroll-one-line-up()\n"
-"m<Key>B:" "backward-word()\n"
-"m<Key>C:" "capitalize-word()\n"
-"m<Key>F:" "forward-word()\n"
-"m<Key>I:" "insert-file()\n"
-"m<Key>K:" "kill-to-end-of-paragraph()\n"
-"m<Key>L:" "downcase-word()\n"
-"m<Key>Q:" "form-paragraph()\n"
-"m<Key>U:" "upcase-word()\n"
-"m<Key>V:" "previous-page()\n"
-#ifndef OLDXAW
-"m<Key>Y:" "kill-ring-yank()\n"
-#endif
-"m<Key>Z:" "scroll-one-line-down()\n"
-"~s m<Key>D:" "kill-word(alnum)\n"
-"s m<Key>D:" "delete-next-word(alnum)\n"
-"~s m<Key>H:" "backward-kill-word(alnum)\n"
-"s m<Key>H:" "delete-previous-word(alnum)\n"
-":m<Key>\\<:" "beginning-of-file()\n"
-":m<Key>\\>:" "end-of-file()\n"
-":m<Key>]:" "forward-paragraph()\n"
-":m<Key>[:" "backward-paragraph()\n"
-"~s m<Key>Delete:" "backward-kill-word(alnum)\n"
-"s m<Key>Delete:" "delete-previous-word(alnum)\n"
-"~s m<Key>BackSpace:" "backward-kill-word(alnum)\n"
-"s m<Key>BackSpace:" "delete-previous-word(alnum)\n"
-"c<Key>Left:" "backward-word(alnum)\n"
-"c<Key>Right:" "forward-word(alnum)\n"
-"c<Key>Up:" "backward-paragraph()\n"
-"c<Key>Down:" "forward-paragraph()\n"
-"<Key>Home:" "beginning-of-file()\n"
-":<Key>KP_Home:" "beginning-of-file()\n"
-"<Key>End:" "end-of-file()\n"
-":<Key>KP_End:" "end-of-file()\n"
-"<Key>Next:" "next-page()\n"
-":<Key>KP_Next:" "next-page()\n"
-"<Key>Prior:" "previous-page()\n"
-":<Key>KP_Prior:" "previous-page()\n"
-"<Key>Right:" "forward-character()\n"
-":<Key>KP_Right:" "forward-character()\n"
-"<Key>Left:" "backward-character()\n"
-":<Key>KP_Left:" "backward-character()\n"
-"<Key>Down:" "next-line()\n"
-":<Key>KP_Down:" "next-line()\n"
-"<Key>Up:" "previous-line()\n"
-":<Key>KP_Up:" "previous-line()\n"
-"<Key>Delete:" "delete()\n"
-":<Key>KP_Delete:" "delete()\n"
-"<Key>BackSpace:" "delete-previous-character()\n"
-"<Key>Linefeed:" "newline-and-indent()\n"
-"<Key>Return:" "newline()\n"
-":<Key>KP_Enter:" "newline()\n"
-"c<Key>backslash:" "reconnect-im()\n"
-"<Key>Kanji:" "reconnect-im()\n"
-#ifndef OLDXAW
-":<Key>0:" "numeric(0)\n"
-":<Key>1:" "numeric(1)\n"
-":<Key>2:" "numeric(2)\n"
-":<Key>3:" "numeric(3)\n"
-":<Key>4:" "numeric(4)\n"
-":<Key>5:" "numeric(5)\n"
-":<Key>6:" "numeric(6)\n"
-":<Key>7:" "numeric(7)\n"
-":<Key>8:" "numeric(8)\n"
-":<Key>9:" "numeric(9)\n"
-":<Key>-:" "numeric(-)\n"
-":c<Key>_:" "undo()\n"
-#endif
-"s <Key>Insert:" "insert-selection(PRIMARY, CUT_BUFFER0)\n"
-"<Ctrl>Q,<Key>:" "insert-char()\n"
-"<Key>:" "insert-char()\n"
-"<Enter>:" "enter-window()\n"
-"<Leave>:" "leave-window()\n"
-"<FocusIn>:" "focus-in()\n"
-"<FocusOut>:" "focus-out()\n"
-"<Btn1Down>:" "select-start()\n"
-"<Btn1Motion>:" "extend-adjust()\n"
-"<Btn1Up>:" "extend-end(PRIMARY, CUT_BUFFER0)\n"
-"<Btn2Down>:" "insert-selection(PRIMARY, CUT_BUFFER0)\n"
-"<Btn3Down>:" "extend-start()\n"
-"<Btn3Motion>:" "extend-adjust()\n"
-"<Btn3Up>:" "extend-end(PRIMARY, CUT_BUFFER0)\n"
-;
diff --git a/xc/lib/Xaw/Tip.c b/xc/lib/Xaw/Tip.c
deleted file mode 100644
index be58e270e..000000000
--- a/xc/lib/Xaw/Tip.c
+++ /dev/null
@@ -1,629 +0,0 @@
-/*
- * Copyright (c) 1999 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 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.
- *
- * Author: Paulo César Pereira de Andrade
- */
-
-/* $XFree86: xc/lib/Xaw/Tip.c,v 1.4 1999/07/11 08:49:16 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xaw/TipP.h>
-#include <X11/Xaw/XawInit.h>
-#include <X11/Xmu/Converters.h>
-#include "Private.h"
-
-#define TIP_EVENT_MASK (ButtonPressMask | \
- ButtonReleaseMask | \
- PointerMotionMask | \
- ButtonMotionMask | \
- KeyPressMask | \
- KeyReleaseMask | \
- EnterWindowMask | \
- LeaveWindowMask)
-
-/*
- * Types
- */
-typedef struct _XawTipInfo {
- Screen *screen;
- TipWidget tip;
- Widget widget;
- Bool mapped;
- struct _XawTipInfo *next;
-} XawTipInfo;
-
-/*
- * Class Methods
- */
-static void XawTipClassInitialize(void);
-static void XawTipInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawTipDestroy(Widget);
-static void XawTipExpose(Widget, XEvent*, Region);
-static void XawTipRealize(Widget, Mask*, XSetWindowAttributes*);
-static Boolean XawTipSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void TipEventHandler(Widget, XtPointer, XEvent*, Boolean*);
-static void TipShellEventHandler(Widget, XtPointer, XEvent*, Boolean*);
-static XawTipInfo *CreateTipInfo(Widget);
-static XawTipInfo *FindTipInfo(Widget);
-static void ResetTip(XawTipInfo*, Bool);
-static void TipTimeoutCallback(XtPointer, XtIntervalId*);
-static void TipLayout(XawTipInfo*);
-static void TipPosition(XawTipInfo*);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(TipRec, tip.field)
-static XtResource resources[] = {
- {
- XtNforeground,
- XtCForeground,
- XtRPixel,
- sizeof(Pixel),
- offset(foreground),
- XtRString,
- XtDefaultForeground,
- },
- {
- XtNfont,
- XtCFont,
- XtRFontStruct,
- sizeof(XFontStruct*),
- offset(font),
- XtRString,
- XtDefaultFont
- },
- {
- XtNfontSet,
- XtCFontSet,
- XtRFontSet,
- sizeof(XFontSet),
- offset(fontset),
- XtRString,
- XtDefaultFontSet
- },
- {
- XtNtopMargin,
- XtCVerticalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(top_margin),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNbottomMargin,
- XtCVerticalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(bottom_margin),
- XtRImmediate,
- (XtPointer)2
- },
- {
- XtNleftMargin,
- XtCHorizontalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(left_margin),
- XtRImmediate,
- (XtPointer)6
- },
- {
- XtNrightMargin,
- XtCHorizontalMargins,
- XtRDimension,
- sizeof(Dimension),
- offset(right_margin),
- XtRImmediate,
- (XtPointer)6
- },
- {
- XtNbackingStore,
- XtCBackingStore,
- XtRBackingStore,
- sizeof(int),
- offset(backing_store),
- XtRImmediate,
- (XtPointer)(Always + WhenMapped + NotUseful)
- },
- {
- XtNtimeout,
- XtCTimeout,
- XtRInt,
- sizeof(int),
- offset(timeout),
- XtRImmediate,
- (XtPointer)500
- },
- {
- XawNdisplayList,
- XawCDisplayList,
- XawRDisplayList,
- sizeof(XawDisplayList*),
- offset(display_list),
- XtRImmediate,
- NULL
- },
-};
-#undef offset
-
-TipClassRec tipClassRec = {
- /* core */
- {
- (WidgetClass)&widgetClassRec, /* superclass */
- "Tip", /* class_name */
- sizeof(TipRec), /* widget_size */
- XawTipClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawTipInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawTipRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- XawTipDestroy, /* destroy */
- NULL, /* resize */
- XawTipExpose, /* expose */
- XawTipSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* tip */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass tipWidgetClass = (WidgetClass)&tipClassRec;
-
-static XawTipInfo *first_tip;
-
-/*
- * Implementation
- */
-static void
-XawTipClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringToBackingStore,
- NULL, 0);
- XtSetTypeConverter(XtRBackingStore, XtRString, XmuCvtBackingStoreToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-/*ARGSUSED*/
-static void
-XawTipInitialize(Widget req, Widget w, ArgList args, Cardinal *num_args)
-{
- TipWidget tip = (TipWidget)w;
- XGCValues values;
-
- tip->tip.timer = 0;
-
- values.foreground = tip->tip.foreground;
- values.background = tip->core.background_pixel;
- values.font = tip->tip.font->fid;
- values.graphics_exposures = False;
-
- tip->tip.gc = XtAllocateGC(w, 0, GCForeground | GCBackground | GCFont |
- GCGraphicsExposures, &values, GCFont, 0);
-}
-
-static void
-XawTipDestroy(Widget w)
-{
- XawTipInfo *info = FindTipInfo(w);
- TipWidget tip = (TipWidget)w;
-
- if (tip->tip.timer)
- XtRemoveTimeOut(tip->tip.timer);
-
- XtReleaseGC(w, tip->tip.gc);
-
- XtRemoveEventHandler(XtParent(w), KeyPressMask, False, TipShellEventHandler,
- (XtPointer)NULL);
- if (info == first_tip)
- first_tip = first_tip->next;
- else {
- XawTipInfo *p = first_tip;
-
- while (p && p->next != info)
- p = p->next;
- if (p)
- p->next = info->next;
- }
- XtFree((char*)info);
-}
-
-static void
-XawTipRealize(Widget w, Mask *mask, XSetWindowAttributes *attr)
-{
- TipWidget tip = (TipWidget)w;
-
- if (tip->tip.backing_store == Always ||
- tip->tip.backing_store == NotUseful ||
- tip->tip.backing_store == WhenMapped) {
- *mask |= CWBackingStore;
- attr->backing_store = tip->tip.backing_store;
- }
- else
- *mask &= ~CWBackingStore;
- *mask |= CWOverrideRedirect;
- attr->override_redirect = True;
-
- XtWindow(w) = XCreateWindow(DisplayOfScreen(XtScreen(w)),
- RootWindowOfScreen(XtScreen(w)),
- XtX(w), XtY(w),
- XtWidth(w) ? XtWidth(w) : 1,
- XtHeight(w) ? XtHeight(w) : 1,
- XtBorderWidth(w),
- DefaultDepthOfScreen(XtScreen(w)),
- InputOutput,
- CopyFromParent,
- *mask, attr);
-}
-
-static void
-XawTipExpose(Widget w, XEvent *event, Region region)
-{
- TipWidget tip = (TipWidget)w;
- GC gc = tip->tip.gc;
- char *nl, *label = tip->tip.label;
- Position y = tip->tip.top_margin + tip->tip.font->max_bounds.ascent;
- int len;
-
- if (tip->tip.display_list)
- XawRunDisplayList(w, tip->tip.display_list, event, region);
-
- if (tip->tip.international == True) {
- Position ksy = tip->tip.top_margin;
- XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset);
-
- ksy += XawAbs(ext->max_ink_extent.y);
-
- while ((nl = index(label, '\n')) != NULL) {
- XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset,
- gc, tip->tip.left_margin, ksy, label,
- (int)(nl - label));
- ksy += ext->max_ink_extent.height;
- label = nl + 1;
- }
- len = strlen(label);
- if (len)
- XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset, gc,
- tip->tip.left_margin, ksy, label, len);
- }
- else {
- while ((nl = index(label, '\n')) != NULL) {
- if (tip->tip.encoding)
- XDrawString16(XtDisplay(w), XtWindow(w), gc,
- tip->tip.left_margin, y,
- (XChar2b*)label, (int)(nl - label) >> 1);
- else
- XDrawString(XtDisplay(w), XtWindow(w), gc,
- tip->tip.left_margin, y, label, (int)(nl - label));
- y += tip->tip.font->max_bounds.ascent +
- tip->tip.font->max_bounds.descent;
- label = nl + 1;
- }
- len = strlen(label);
- if (len) {
- if (tip->tip.encoding)
- XDrawString16(XtDisplay(w), XtWindow(w), gc,
- tip->tip.left_margin, y, (XChar2b*)label, len >> 1);
- else
- XDrawString(XtDisplay(w), XtWindow(w), gc,
- tip->tip.left_margin, y, label, len);
- }
- }
-}
-
-/*ARGSUSED*/
-static Boolean
-XawTipSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TipWidget curtip = (TipWidget)current;
- TipWidget newtip = (TipWidget)cnew;
- Boolean redisplay = False;
-
- if (curtip->tip.font->fid != newtip->tip.font->fid ||
- curtip->tip.foreground != newtip->tip.foreground) {
- XGCValues values;
-
- values.foreground = newtip->tip.foreground;
- values.background = newtip->core.background_pixel;
- values.font = newtip->tip.font->fid;
- values.graphics_exposures = False;
- XtReleaseGC(cnew, curtip->tip.gc);
- newtip->tip.gc = XtAllocateGC(cnew, 0, GCForeground | GCBackground |
- GCFont | GCGraphicsExposures, &values,
- GCFont, 0);
- redisplay = True;
- }
- if (curtip->tip.display_list != newtip->tip.display_list)
- redisplay = True;
-
- return (redisplay);
-}
-
-static void
-TipLayout(XawTipInfo *info)
-{
- XFontStruct *fs = info->tip->tip.font;
- int width = 0, height;
- char *nl, *label = info->tip->tip.label;
-
- if (info->tip->tip.international == True) {
- XFontSet fset = info->tip->tip.fontset;
- XFontSetExtents *ext = XExtentsOfFontSet(fset);
-
- height = ext->max_ink_extent.height;
- if ((nl = index(label, '\n')) != NULL) {
- while (nl) {
- int w = XmbTextEscapement(fset, label, (int)(nl - label));
-
- if (w > width)
- width = w;
- label = nl + 1;
- if (*label)
- height += ext->max_ink_extent.height;
- nl = index(label, '\n');
- }
- }
- else
- width = XmbTextEscapement(fset, label, strlen(label));
- }
- else {
- height = fs->max_bounds.ascent + fs->max_bounds.descent;
- if ((nl = index(label, '\n')) != NULL) {
- while (nl) {
- int w = info->tip->tip.encoding ?
- XTextWidth16(fs, (XChar2b*)label, (int)(nl - label) >> 1) :
- XTextWidth(fs, label, (int)(nl - label));
- if (w > width)
- width = w;
- label = nl + 1;
- if (*label)
- height += fs->max_bounds.ascent + fs->max_bounds.descent;
- nl = index(label, '\n');
- }
- }
- else
- width = info->tip->tip.encoding ?
- XTextWidth16(fs, (XChar2b*)label, strlen(label) >> 1) :
- XTextWidth(fs, label, strlen(label));
- }
- XtWidth(info->tip) = width + info->tip->tip.left_margin +
- info->tip->tip.right_margin;
- XtHeight(info->tip) = height + info->tip->tip.top_margin +
- info->tip->tip.bottom_margin;
-}
-
-#define DEFAULT_TIP_Y_OFFSET 12
-static void
-TipPosition(XawTipInfo *info)
-{
- Window r, c;
- int rx, ry, wx, wy;
- unsigned mask;
- Position x, y;
-
- XQueryPointer(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip),
- &r, &c, &rx, &ry, &wx, &wy, &mask);
- x = rx - (XtWidth(info->tip) >> 1);
- y = ry + DEFAULT_TIP_Y_OFFSET;
-
- if (x >= 0) {
- int scr_width = WidthOfScreen(XtScreen(info->tip));
-
- if (x + XtWidth(info->tip) + XtBorderWidth(info->tip) > scr_width)
- x = scr_width - XtWidth(info->tip) - XtBorderWidth(info->tip);
- }
- if (x < 0)
- x = 0;
- if (y >= 0) {
- int scr_height = HeightOfScreen(XtScreen(info->tip));
-
- if (y + XtHeight(info->tip) + XtBorderWidth(info->tip) > scr_height)
- y -= XtHeight(info->tip) + XtBorderWidth(info->tip) +
- (DEFAULT_TIP_Y_OFFSET << 1);
- }
- if (y < 0)
- y = 0;
-
- XMoveResizeWindow(XtDisplay(info->tip), XtWindow(info->tip),
- (int)(XtX(info->tip) = x), (int)(XtY(info->tip) = y),
- (unsigned)XtWidth(info->tip), (unsigned)XtHeight(info->tip));
-}
-
-static XawTipInfo *
-CreateTipInfo(Widget w)
-{
- XawTipInfo *info = XtNew(XawTipInfo);
- Widget shell = w;
-
- info->screen = XtScreen(w);
-
- while (XtParent(shell))
- shell = XtParent(shell);
-
- info->tip = (TipWidget)XtCreateWidget("tip", tipWidgetClass, shell, NULL, 0);
- XtRealizeWidget((Widget)info->tip);
- info->widget = NULL;
- info->mapped = False;
- info->next = NULL;
- XtAddEventHandler(shell, KeyPressMask, False, TipShellEventHandler,
- (XtPointer)NULL);
-
- return (info);
-}
-
-static XawTipInfo *
-FindTipInfo(Widget w)
-{
- XawTipInfo *ptip, *tip = first_tip;
- Screen *screen = XtScreenOfObject(w);
-
- if (tip == NULL)
- return (first_tip = tip = CreateTipInfo(w));
-
- for (ptip = tip; tip; ptip = tip, tip = tip->next)
- if (tip->screen == screen)
- return (tip);
-
- return (ptip->next = CreateTipInfo(w));
-}
-
-static void
-ResetTip(XawTipInfo *info, Bool add_timeout)
-{
- if (info->tip->tip.timer) {
- XtRemoveTimeOut(info->tip->tip.timer);
- info->tip->tip.timer = 0;
- }
- if (info->mapped) {
- XtRemoveGrab(XtParent((Widget)info->tip));
- XUnmapWindow(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
- info->mapped = False;
- }
- if (add_timeout) {
- info->tip->tip.timer =
- XtAppAddTimeOut(XtWidgetToApplicationContext((Widget)info->tip),
- info->tip->tip.timeout, TipTimeoutCallback,
- (XtPointer)info);
- }
-}
-
-static void
-TipTimeoutCallback(XtPointer closure, XtIntervalId *id)
-{
- XawTipInfo *info = (XawTipInfo*)closure;
- String label = info->tip->tip.label;
- Boolean international = info->tip->tip.international;
- unsigned char encoding = info->tip->tip.encoding;
- Arg args[3];
-
- info->tip->tip.label = NULL;
- info->tip->tip.international = False;
- info->tip->tip.encoding = 0;
- XtSetArg(args[0], XtNtip, &info->tip->tip.label);
- XtSetArg(args[1], XtNinternational, &info->tip->tip.international);
- XtSetArg(args[2], XtNencoding, &info->tip->tip.encoding);
- XtGetValues(info->widget, args, 3);
-
- if (info->tip->tip.label) {
- if (label != info->tip->tip.label ||
- international != info->tip->tip.international ||
- encoding != info->tip->tip.encoding)
- TipLayout(info);
- TipPosition(info);
- XMapRaised(XtDisplay((Widget)info->tip), XtWindow((Widget)info->tip));
- XtAddGrab(XtParent((Widget)info->tip), True, True);
- info->mapped = True;
- }
-}
-
-/*ARGSUSED*/
-static void
-TipShellEventHandler(Widget w, XtPointer client_data, XEvent *event,
- Boolean *continue_to_dispatch)
-{
- ResetTip(FindTipInfo(w), False);
-}
-
-/*ARGSUSED*/
-static void
-TipEventHandler(Widget w, XtPointer client_data, XEvent *event,
- Boolean *continue_to_dispatch)
-{
- XawTipInfo *info = FindTipInfo(w);
- Boolean add_timeout;
-
- if (info->widget != w) {
- ResetTip(info, False);
- info->widget = w;
- }
-
- switch (event->type) {
- case EnterNotify:
- add_timeout = True;
- break;
- case MotionNotify:
- /* If any button is pressed, timer is 0 */
- if (info->mapped)
- return;
- add_timeout = info->tip->tip.timer != 0;
- break;
- default:
- add_timeout = False;
- break;
- }
- ResetTip(info, add_timeout);
-}
-
-/*
- * Public routines
- */
-void
-XawTipEnable(Widget w)
-{
- XtAddEventHandler(w, TIP_EVENT_MASK, False, TipEventHandler,
- (XtPointer)NULL);
-}
-
-void
-XawTipDisable(Widget w)
-{
- XawTipInfo *info = FindTipInfo(w);
-
- XtRemoveEventHandler(w, TIP_EVENT_MASK, False, TipEventHandler,
- (XtPointer)NULL);
- if (info->widget == w)
- ResetTip(info, False);
-}
diff --git a/xc/lib/Xaw/Tip.h b/xc/lib/Xaw/Tip.h
deleted file mode 100644
index 5fb56f591..000000000
--- a/xc/lib/Xaw/Tip.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 1999 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 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.
- *
- * Author: Paulo César Pereira de Andrade
- */
-
-/* $XFree86: xc/lib/Xaw/Tip.h,v 1.1 1999/06/27 14:07:35 dawes Exp $ */
-
-#ifndef _XawTip_h
-#define _XawTip_h
-
-/*
- * Tip Widget
- */
-
-#include <X11/Xaw/Simple.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- background Background Pixel XtDefaultBackground
- backgroundPixmap BackgroundPixmap Pixmap XtUnspecifiedPixmap
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- bottomMargin VerticalMargins Dimension 2
- destroyCallback Callback XtCallbackList NULL
- displayList DisplayList XawDisplayList* NULL
- font Font XFontStruct* XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension text height
- leftMargin HorizontalMargins Dimension 6
- rightMargin HorizontalMargins Dimension 6
- timeout Timeout Int 500
- topMargin VerticalMargins Dimension 2
- width Width Dimension text width
- x Position Position 0
- y Position Position 0
-
-*/
-
-typedef struct _TipClassRec *TipWidgetClass;
-typedef struct _TipRec *TipWidget;
-
-extern WidgetClass tipWidgetClass;
-
-#define XtNbottomMargin "bottomMargin"
-#define XawNdisplayList "displayList"
-#define XtNencoding "encoding"
-#define XtNleftMargin "leftMargin"
-#define XtNrightMargin "rightMargin"
-#define XtNtimeout "timeout"
-#define XtNtopMargin "topMargin"
-#define XtNtip "tip"
-
-#define XawCDisplayList "DisplayList"
-#define XtCHorizontalMargins "HorizontalMargins"
-#define XtCTimeout "Timeout"
-#define XtCVerticalMargins "VerticalMargins"
-#define XtCTip "Tip"
-
-#define XawRDisplayList "XawDisplayList"
-
-/*
- * Public Functions
- */
-/*
- * Function:
- * XawTipEnable
- *
- * Parameters:
- * w - widget
- *
- * Description:
- * Enables the tip event handler for this widget.
- */
-void XawTipEnable
-(
- Widget w
- );
-
-/*
- * Function:
- * XawTipEnable
- *
- * Parameters:
- * w - widget
- *
- * Description:
- * Disables the tip event handler for this widget.
- */
-void XawTipDisable
-(
- Widget w
- );
-
-#endif /* _XawTip_h */
diff --git a/xc/lib/Xaw/TipP.h b/xc/lib/Xaw/TipP.h
deleted file mode 100644
index 0c1abc69a..000000000
--- a/xc/lib/Xaw/TipP.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 1999 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 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.
- *
- * Author: Paulo César Pereira de Andrade
- */
-
-/* $XFree86: xc/lib/Xaw/TipP.h,v 1.1 1999/06/27 14:07:35 dawes Exp $ */
-
-#ifndef _XawTipP_h
-#define _XawTipP_h
-
-#include <X11/Xaw/Tip.h>
-#include <X11/CoreP.h>
-#include <X11/Xaw/XawInit.h>
-
-typedef struct {
- XtPointer extension;
-} TipClassPart;
-
-typedef struct _TipClassRec {
- CoreClassPart core_class;
- TipClassPart tip_class;
-} TipClassRec;
-
-extern TipClassRec tipClassRec;
-
-typedef struct _TipPart {
- /* resources */
- Pixel foreground;
- XFontStruct *font;
- XFontSet fontset;
- Dimension top_margin;
- Dimension bottom_margin;
- Dimension left_margin;
- Dimension right_margin;
- int backing_store;
- int timeout;
- XawDisplayList *display_list;
-
- /* private */
- GC gc;
- XtIntervalId timer;
- String label;
- Boolean international;
- unsigned char encoding;
- XtPointer pad[4];
-} TipPart;
-
-typedef struct _TipRec {
- CorePart core;
- TipPart tip;
-} TipRec;
-
-#endif /* _XawTipP_h */
diff --git a/xc/lib/Xaw/Toggle.c b/xc/lib/Xaw/Toggle.c
deleted file mode 100644
index 9f3de2d98..000000000
--- a/xc/lib/Xaw/Toggle.c
+++ /dev/null
@@ -1,624 +0,0 @@
-/* $TOG: Toggle.c /main/30 1998/02/11 14:55:52 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.
-
-*/
-/* $XFree86: xc/lib/Xaw/Toggle.c,v 1.6 1999/06/06 08:48:19 dawes Exp $ */
-
-/*
- * Author: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- *
- * Date: January 12, 1989
- *
- */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xmu/SysUtil.h>
-#include <X11/Xaw/ToggleP.h>
-#include <X11/Xaw/XawInit.h>
-
-/*
- * Class Methods
- */
-static void XawToggleClassInitialize(void);
-static void XawToggleInitialize(Widget, Widget, ArgList, Cardinal*);
-static Boolean XawToggleSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void AddToRadioGroup(RadioGroup*, Widget);
-static void CreateRadioGroup(Widget, Widget);
-static RadioGroup *GetRadioGroup(Widget);
-static void RemoveFromRadioGroup(Widget);
-static void TurnOffRadioSiblings(Widget);
-static void XawToggleDestroy(Widget, XtPointer, XtPointer);
-
-/*
- * Actions
- */
-static void Notify(Widget, XEvent*, String*, Cardinal*);
-static void Toggle(Widget, XEvent*, String*, Cardinal*);
-static void ToggleSet(Widget, XEvent*, String*, Cardinal*);
-
-/*
- * Initialization
- */
-/*
- * The order of toggle and notify are important, as the state has
- * to be set when we call the notify proc
- */
-static char defaultTranslations[] =
-"<Enter>:" "highlight(Always)\n"
-"<Leave>:" "unhighlight()\n"
-"<Btn1Down>,<Btn1Up>:" "toggle() notify()\n"
-;
-
-#define offset(field) XtOffsetOf(ToggleRec, field)
-static XtResource resources[] = {
- {
- XtNstate,
- XtCState,
- XtRBoolean,
- sizeof(Boolean),
- offset(command.set),
- XtRString,
- "off"
- },
- {
- XtNradioGroup,
- XtCWidget,
- XtRWidget,
- sizeof(Widget),
- offset(toggle.widget),
- XtRWidget,
- NULL
- },
- {
- XtNradioData,
- XtCRadioData,
- XtRPointer,
- sizeof(XtPointer),
- offset(toggle.radio_data),
- XtRPointer,
- NULL
- },
-};
-#undef offset
-
-static XtActionsRec actionsList[] = {
- {"toggle", Toggle},
- {"notify", Notify},
- {"set", ToggleSet},
-};
-
-#define Superclass ((CommandWidgetClass)&commandClassRec)
-ToggleClassRec toggleClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Toggle", /* class_name */
- sizeof(ToggleRec), /* size */
- XawToggleClassInitialize, /* class_initialize */
- NULL, /* class_part_initialize */
- False, /* class_inited */
- XawToggleInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- actionsList, /* actions */
- XtNumber(actionsList), /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* resource_count */
- NULLQUARK, /* xrm_class */
- False, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XtInheritResize, /* resize */
- XtInheritExpose, /* expose */
- XawToggleSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- defaultTranslations, /* tm_table */
- XtInheritQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* simple */
- {
- XtInheritChangeSensitive, /* change_sensitive */
- },
- /* label */
- {
- NULL, /* extension */
- },
- /* command */
- {
- NULL, /* extension */
- },
- /* toggle */
- {
- NULL, /* Set */
- NULL, /* Unset */
- NULL, /* extension */
- }
-};
-
-WidgetClass toggleWidgetClass = (WidgetClass)&toggleClassRec;
-
-/*
- * Impelementation
- */
-static void
-XawToggleClassInitialize(void)
-{
- XtActionList actions;
- Cardinal num_actions;
- Cardinal i;
- ToggleWidgetClass cclass = (ToggleWidgetClass)toggleWidgetClass;
- static XtConvertArgRec parentCvtArgs[] = {
- {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.parent),
- sizeof(Widget)}
- };
-
- XawInitializeWidgetSet();
- XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtStringToWidget,
- parentCvtArgs, XtNumber(parentCvtArgs),
- XtCacheNone, NULL);
- XtSetTypeConverter(XtRWidget, XtRString, XmuCvtWidgetToString,
- NULL, 0, XtCacheNone, NULL);
-
- /*
- * Find the set and unset actions in the command widget's action table
- */
- XtGetActionList(commandWidgetClass, &actions, &num_actions);
-
- for (i = 0 ; i < num_actions ; i++) {
- if (streq(actions[i].string, "set"))
- cclass->toggle_class.Set = actions[i].proc;
- if (streq(actions[i].string, "unset"))
- cclass->toggle_class.Unset = actions[i].proc;
-
- if (cclass->toggle_class.Set != NULL &&
- cclass->toggle_class.Unset != NULL) {
- XtFree((char *)actions);
- return;
- }
- }
-
- /* We should never get here */
- XtError("Aborting, due to errors resolving bindings in the Toggle widget.");
-}
-
-/*ARGSUSED*/
-static void
-XawToggleInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ToggleWidget tw = (ToggleWidget)cnew;
- ToggleWidget tw_req = (ToggleWidget)request;
-
- tw->toggle.radio_group = NULL;
-
- if (tw->toggle.radio_data == NULL)
- tw->toggle.radio_data = (XtPointer)cnew->core.name;
-
- if (tw->toggle.widget != NULL) {
- if (GetRadioGroup(tw->toggle.widget) == NULL)
- CreateRadioGroup(cnew, tw->toggle.widget);
- else
- AddToRadioGroup(GetRadioGroup(tw->toggle.widget), cnew);
- }
- XtAddCallback(cnew, XtNdestroyCallback, XawToggleDestroy, NULL);
-
- /*
- * Command widget assumes that the widget is unset, so we only
- * have to handle the case where it needs to be set
- *
- * If this widget is in a radio group then it may cause another
- * widget to be unset, thus calling the notify proceedure
- *
- * I want to set the toggle if the user set the state to "On" in
- * the resource group, reguardless of what my ancestors did
- */
- if (tw_req->command.set)
- ToggleSet(cnew, NULL, NULL, NULL);
-}
-
-/*ARGSUSED*/
-static void
-ToggleSet(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- ToggleWidgetClass cclass = (ToggleWidgetClass)w->core.widget_class;
-
- TurnOffRadioSiblings(w);
- cclass->toggle_class.Set(w, event, NULL, NULL);
-}
-
-static void
-Toggle(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- ToggleWidget tw = (ToggleWidget)w;
- ToggleWidgetClass cclass = (ToggleWidgetClass)w->core.widget_class;
-
- if (tw->command.set)
- cclass->toggle_class.Unset(w, event, NULL, NULL);
- else
- ToggleSet(w, event, params, num_params);
-}
-
-/*ARGSUSED*/
-static void
-Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
-{
- ToggleWidget tw = (ToggleWidget)w;
- long antilint = tw->command.set;
-
- XtCallCallbacks(w, XtNcallback, (XtPointer)antilint);
-}
-
-/*ARGSUSED*/
-static Boolean
-XawToggleSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ToggleWidget oldtw = (ToggleWidget)current;
- ToggleWidget tw = (ToggleWidget)cnew;
- ToggleWidget rtw = (ToggleWidget)request;
-
- if (oldtw->toggle.widget != tw->toggle.widget)
- XawToggleChangeRadioGroup(cnew, tw->toggle.widget);
-
- if (!tw->core.sensitive && oldtw->core.sensitive && rtw->command.set)
- tw->command.set = True;
-
- if (oldtw->command.set != tw->command.set) {
- tw->command.set = oldtw->command.set;
- Toggle(cnew, NULL, NULL, NULL);
- }
-
- return (False);
-}
-
-/*
- * Function:
- * XawToggleDestroy
- *
- * Parameters:
- * w - toggle widget that is being destroyed
- * temp1 - not used
- * temp2 - ""
- *
- * Description:
- * Destroy Callback for toggle widget.
- */
-/*ARGSUSED*/
-static void
-XawToggleDestroy(Widget w, XtPointer temp1, XtPointer temp2)
-{
- RemoveFromRadioGroup(w);
-}
-
-/*
- * Function:
- * GetRadioGroup
- *
- * Parameters:
- * w - toggle widget who's radio group we are getting
- *
- * Description:
- * Gets the radio group associated with a give toggle widget.
- *
- * Returns:
- * The radio group associated with this toggle group
- */
-static RadioGroup *
-GetRadioGroup(Widget w)
-{
- ToggleWidget tw = (ToggleWidget)w;
-
- if (tw == NULL)
- return (NULL);
-
- return (tw->toggle.radio_group);
-}
-
-/*
- * Function:
- * CreateRadioGroup
- *
- * Parameters:
- * w1 - toggle widgets to add to the radio group
- * w2 - ""
- *
- * Description:
- * Creates a radio group. give two widgets.
- *
- * Note:
- * A pointer to the group is added to each widget's radio_group field.
- */
-static void
-CreateRadioGroup(Widget w1, Widget w2)
-{
- ToggleWidget tw1 = (ToggleWidget)w1;
- ToggleWidget tw2 = (ToggleWidget) w2;
-
- if (tw1->toggle.radio_group != NULL || tw2->toggle.radio_group != NULL)
- XtAppWarning(XtWidgetToApplicationContext(w1),
- "Toggle Widget Error - Attempting to create a "
- "new toggle group, when one already exists.");
-
- AddToRadioGroup(NULL, w1);
- AddToRadioGroup(GetRadioGroup(w1), w2);
-}
-
-/*
- * Function:
- * AddToRadioGroup
- *
- * Parameters:
- * group - element of the radio group the we are adding to
- * w - new toggle widget to add to the group
- *
- * Description:
- * Adds a toggle to the radio group.
- */
-static void
-AddToRadioGroup(RadioGroup *group, Widget w)
-{
- ToggleWidget tw = (ToggleWidget)w;
- RadioGroup *local;
-
- local = (RadioGroup *)XtMalloc(sizeof(RadioGroup));
- local->widget = w;
- tw->toggle.radio_group = local;
-
- if (group == NULL) { /* Creating new group */
- group = local;
- group->next = NULL;
- group->prev = NULL;
- return;
- }
- local->prev = group; /* Adding to previous group */
- if ((local->next = group->next) != NULL)
- local->next->prev = local;
- group->next = local;
-}
-
-/*
- * Function:
- * TurnOffRadioSiblings
- *
- * Parameters:
- * widget - toggle widget
- *
- * Description:
- * Deactivates all radio siblings.
- */
-static void
-TurnOffRadioSiblings(Widget w)
-{
- RadioGroup *group;
- ToggleWidgetClass cclass = (ToggleWidgetClass)w->core.widget_class;
-
- if ((group = GetRadioGroup(w)) == NULL) /* Punt if there is no group */
- return;
-
- /* Go to the top of the group */
- for (; group->prev != NULL ; group = group->prev)
- ;
-
- while (group != NULL) {
- ToggleWidget local_tog = (ToggleWidget)group->widget;
-
- if (local_tog->command.set) {
- cclass->toggle_class.Unset(group->widget, NULL, NULL, NULL);
- Notify(group->widget, NULL, NULL, NULL);
- }
- group = group->next;
- }
-}
-
-/*
- * Function:
- * RemoveFromRadioGroup
- *
- * Parameters:
- * w - toggle widget to remove
- *
- * Description:
- * Removes a toggle from a RadioGroup.
- */
-static void
-RemoveFromRadioGroup(Widget w)
-{
- RadioGroup *group = GetRadioGroup(w);
- if (group != NULL) {
- if (group->prev != NULL)
- (group->prev)->next = group->next;
- if (group->next != NULL)
- (group->next)->prev = group->prev;
- XtFree((char *)group);
- }
-}
-
-/*
- * Function:
- * XawToggleChangeRadioGroup
- *
- * Parameters:
- * w - toggle widget to change groups
- * radio_group - any widget in the new group
- *
- * Description:
- * Allows a toggle widget to change radio groups.
- */
-void
-XawToggleChangeRadioGroup(Widget w, Widget radio_group)
-{
- ToggleWidget tw = (ToggleWidget)w;
- RadioGroup *group;
-
- RemoveFromRadioGroup(w);
-
- /*
- * If the toggle that we are about to add is set then we will
- * unset all toggles in the new radio group
- */
-
- if (tw->command.set && radio_group != NULL)
- XawToggleUnsetCurrent(radio_group);
-
- if (radio_group != NULL)
- if ((group = GetRadioGroup(radio_group)) == NULL)
- CreateRadioGroup(w, radio_group);
- else
- AddToRadioGroup(group, w);
-}
-
-/*
- * Function:
- * XawToggleGetCurrent
- *
- * Parameters:
- * w - any toggle widget in the toggle group
- *
- * Description:
- * Returns the RadioData associated with the toggle
- * widget that is currently active in a toggle group.
- *
- * Returns:
- * The XtNradioData associated with the toggle widget
- */
-XtPointer
-XawToggleGetCurrent(Widget w)
-{
- RadioGroup *group;
-
- if ((group = GetRadioGroup(w)) == NULL)
- return (NULL);
-
- for (; group->prev != NULL ; group = group->prev)
- ;
-
- while (group != NULL) {
- ToggleWidget local_tog = (ToggleWidget)group->widget;
-
- if (local_tog->command.set)
- return (local_tog->toggle.radio_data);
- group = group->next;
- }
-
- return (NULL);
-}
-
-/*
- * Function:
- * XawToggleSetCurrent
- *
- * Parameters:
- * radio_group - any toggle widget in the toggle group
- * radio_data - radio data of the toggle widget to set
- *
- * Description:
- * Sets the Toggle widget associated with the radio_data specified.
- */
-void
-XawToggleSetCurrent(Widget radio_group, XtPointer radio_data)
-{
- RadioGroup *group;
- ToggleWidget local_tog;
-
- /* Special case of no radio group */
-
- if ((group = GetRadioGroup(radio_group)) == NULL) {
- local_tog = (ToggleWidget)radio_group;
-
- if (local_tog->toggle.radio_data == radio_data &&
- !local_tog->command.set) {
- ToggleSet(radio_group, NULL, NULL, NULL);
- Notify(radio_group, NULL, NULL, NULL);
- }
- return;
- }
-
- /*
- * find top of radio_roup
- */
- for (; group->prev != NULL ; group = group->prev)
- ;
-
- /*
- * search for matching radio data
- */
- while (group != NULL) {
- local_tog = (ToggleWidget)group->widget;
-
- if (local_tog->toggle.radio_data == radio_data) {
- if (!local_tog->command.set) { /* if not already set */
- ToggleSet(group->widget, NULL, NULL, NULL);
- Notify(group->widget, NULL, NULL, NULL);
- }
- return; /* found it, done */
- }
- group = group->next;
- }
-}
-
-/*
- * Function:
- * XawToggleUnsetCurrent
- *
- * Parameters:
- * radio_group - any toggle widget in the toggle group
- *
- * Description:
- * Unsets all Toggles in the radio_group specified.
- */
-void
-XawToggleUnsetCurrent(Widget radio_group)
-{
- ToggleWidgetClass cclass;
- ToggleWidget local_tog = (ToggleWidget)radio_group;
-
- /* Special Case no radio group */
-
- if (local_tog->command.set) {
- cclass = (ToggleWidgetClass)local_tog->core.widget_class;
- cclass->toggle_class.Unset(radio_group, NULL, NULL, NULL);
- Notify(radio_group, NULL, NULL, NULL);
- }
- if (GetRadioGroup(radio_group) == NULL)
- return;
-
- TurnOffRadioSiblings(radio_group);
-}
diff --git a/xc/lib/Xaw/Toggle.h b/xc/lib/Xaw/Toggle.h
deleted file mode 100644
index 3ef138646..000000000
--- a/xc/lib/Xaw/Toggle.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * $TOG: Toggle.h /main/18 1998/02/11 14:55:57 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.
- */
-/* $XFree86: xc/lib/Xaw/Toggle.h,v 1.4 1998/10/03 08:42:29 dawes Exp $ */
-
-/*
- * ToggleP.h - Private definitions for Toggle widget
- *
- * Author: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- *
- * Date: January 12, 1989
- */
-
-#ifndef _XawToggle_h
-#define _XawToggle_h
-
-#include <X11/Xaw/Command.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- radioGroup RadioGroup Widget NULL +
- radioData RadioData Pointer (XPointer) Widget ++
- state State Boolean Off
-
- background Background Pixel XtDefaultBackground
- bitmap Pixmap Pixmap None
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- callback Callback Pointer NULL
- cursor Cursor Cursor None
- destroyCallback Callback Pointer NULL
- displayList DisplayList XawDisplayList* NULL
- font Font XFontStructx* XtDefaultFont
- foreground Foreground Pixel XtDefaultForeground
- height Height Dimension text height
- highlightThickness Thickness Dimension 2
- insensitiveBorder Insensitive Pixmap Gray
- internalHeight Height Dimension 2
- internalWidth Width Dimension 4
- justify Justify XtJustify XtJustifyCenter
- label Label String NULL
- mappedWhenManaged MappedWhenManaged Boolean True
- resize Resize Boolean True
- sensitive Sensitive Boolean True
- width Width Dimension text width
- x Position Position 0
- y Position Position 0
-
-+ To use the toggle as a radio toggle button, set this resource to point to
- any other widget in the radio group.
-
-++ This is the data returned from a call to XtToggleGetCurrent, by default
- this is set to the name of toggle widget.
-
-*/
-
-/*
- * These should be in StringDefs.h but aren't so we will define
- * them here if they are needed
- */
-#define XtCWidget "Widget"
-#define XtCState "State"
-#define XtCRadioGroup "RadioGroup"
-#define XtCRadioData "RadioData"
-
-#ifndef _XtStringDefs_h_
-#define XtRWidget "Widget"
-#endif
-
-#define XtNstate "state"
-#define XtNradioGroup "radioGroup"
-#define XtNradioData "radioData"
-
-extern WidgetClass toggleWidgetClass;
-
-typedef struct _ToggleClassRec *ToggleWidgetClass;
-typedef struct _ToggleRec *ToggleWidget;
-
-/*
- * Public Functions
- */
-
-_XFUNCPROTOBEGIN
-
-/*
- * Function:
- * XawToggleChangeRadioGroup
- *
- * Parameters:
- * w - toggle widget to change lists
- * radio_group - any widget in the new list
- *
- * Description:
- * Allows a toggle widget to change radio lists.
- */
-void XawToggleChangeRadioGroup
-(
- Widget w,
- Widget radio_group
- );
-
-/*
- * Function:
- * XawToggleGetCurrent
- *
- * Parameters:
- * radio_group - any toggle widget in the toggle list
- *
- * Description:
- * Returns the RadioData associated with the toggle
- * widget that is currently active in a toggle list.
- * Returns:
- * The XtNradioData associated with the toggle widget
- */
-
-XtPointer XawToggleGetCurrent
-(
- Widget radio_group
- );
-
-/*
- * Function:
- * XawToggleSetCurrent
- *
- * Parameters:
- * radio_group - any toggle widget in the toggle list
- * radio_data - radio data of the toggle widget to set
- *
- * Description:
- * Sets the Toggle widget associated with the radio_data specified.
- */
-void XawToggleSetCurrent
-(
- Widget radio_group,
- XtPointer radio_data
- );
-
-/*
- * Function:
- * XawToggleUnsetCurrent
- *
- * Parameters:
- * radio_group - any toggle widget in the toggle list
- *
- * Description:
- * Unsets all Toggles in the radio_group specified.
- */
-void XawToggleUnsetCurrent
-(
- Widget radio_group
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawToggle_h */
diff --git a/xc/lib/Xaw/ToggleP.h b/xc/lib/Xaw/ToggleP.h
deleted file mode 100644
index 1cc564bc7..000000000
--- a/xc/lib/Xaw/ToggleP.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $TOG: ToggleP.h /main/11 1998/02/11 14:55:48 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/lib/Xaw/ToggleP.h,v 1.6 1999/06/20 08:41:11 dawes Exp $ */
-
-/*
- * Author: Chris D. Peterson
- * MIT X Consortium
- * kit@expo.lcs.mit.edu
- *
- * Date: January 12, 1989
- *
- */
-
-#ifndef _XawToggleP_h
-#define _XawToggleP_h
-
-#include <X11/Xaw/Toggle.h>
-#include <X11/Xaw/CommandP.h>
-
-/*
- * Toggle Widget Private Data
- */
-#define streq(a, b) (strcmp((a), (b)) == 0)
-
-typedef struct _RadioGroup {
- struct _RadioGroup *prev, *next; /* Pointers to other elements in group */
- Widget widget; /* Widget corrosponding to this element */
-} RadioGroup;
-
-/* New fields for the Toggle widget class */
-typedef struct _ToggleClass {
- XtActionProc Set;
- XtActionProc Unset;
- XtPointer extension;
-} ToggleClassPart;
-
-/* class record declaration */
-typedef struct _ToggleClassRec {
- CoreClassPart core_class;
- SimpleClassPart simple_class;
- LabelClassPart label_class;
- CommandClassPart command_class;
- ToggleClassPart toggle_class;
-} ToggleClassRec;
-
-extern ToggleClassRec toggleClassRec;
-
-/* New fields for the Toggle widget */
-typedef struct {
- /* resources */
- Widget widget;
- XtPointer radio_data;
-
- /* private */
- RadioGroup *radio_group;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} TogglePart;
-
-/* Full widget declaration */
-typedef struct _ToggleRec {
- CorePart core;
- SimplePart simple;
- LabelPart label;
- CommandPart command;
- TogglePart toggle;
-} ToggleRec;
-
-#endif /* _XawToggleP_h */
diff --git a/xc/lib/Xaw/Tree.c b/xc/lib/Xaw/Tree.c
deleted file mode 100644
index 4a9b0ecd4..000000000
--- a/xc/lib/Xaw/Tree.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/*
- * $TOG: Tree.c /main/47 1998/02/11 14:56:05 kaleb $
- *
-
-Copyright 1990, 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.
-
- * Copyright 1989 Prentice Hall
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation.
- *
- * Prentice Hall and the authors disclaim all warranties with regard
- * to this software, including all implied warranties of merchantability and
- * fitness. In no event shall Prentice Hall or the authors be liable
- * for any special, indirect or cosequential damages or any damages whatsoever
- * resulting from loss of use, data or profits, whether 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: Jim Fulton, MIT X Consortium,
- * based on a version by Douglas Young, Prentice Hall
- *
- * This widget is based on the Tree widget described on pages 397-419 of
- * Douglas Young's book "The X Window System, Programming and Applications
- * with Xt OSF/Motif Edition." The layout code has been rewritten to use
- * additional blank space to make the structure of the graph easier to see
- * as well as to support vertical trees.
- */
-/* $XFree86: xc/lib/Xaw/Tree.c,v 1.8 1999/07/04 06:38:27 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xaw/XawInit.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xaw/TreeP.h>
-#include "Private.h"
-
-#define IsHorizontal(tw) ((tw)->tree.gravity == WestGravity || \
- (tw)->tree.gravity == EastGravity)
-
-/*
- * Class Methods
- */
-static void XawTreeChangeManaged(Widget);
-static void XawTreeClassInitialize(void);
-static void XawTreeConstraintDestroy(Widget);
-static void XawTreeConstraintInitialize(Widget, Widget, ArgList, Cardinal*);
-static Boolean XawTreeConstraintSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static void XawTreeDestroy(Widget);
-static XtGeometryResult XawTreeGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawTreeInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawTreeQueryGeometry(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawTreeRedisplay(Widget, XEvent*, Region);
-static Boolean XawTreeSetValues(Widget, Widget, Widget, ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void arrange_subtree(TreeWidget, Widget, int, int, int);
-static void check_gravity(TreeWidget, XtGravity);
-static void compute_bounding_box_subtree(TreeWidget, Widget, int);
-static void delete_node(Widget, Widget);
-static GC get_tree_gc(TreeWidget);
-static void initialize_dimensions(Dimension**, int*, int);
-static void insert_node(Widget, Widget);
-static void layout_tree(TreeWidget, Bool);
-static void set_positions(TreeWidget, Widget, int);
-static void set_tree_size(TreeWidget, Bool, unsigned int, unsigned int);
-
-/*
- * Initialization
- */
-
-/*
- * resources of the tree itself
- */
-static XtResource resources[] = {
- { XtNautoReconfigure, XtCAutoReconfigure, XtRBoolean, sizeof (Boolean),
- XtOffsetOf(TreeRec, tree.auto_reconfigure), XtRImmediate,
- (XtPointer) FALSE },
- { XtNhSpace, XtCHSpace, XtRDimension, sizeof (Dimension),
- XtOffsetOf(TreeRec, tree.hpad), XtRImmediate, (XtPointer) 0 },
- { XtNvSpace, XtCVSpace, XtRDimension, sizeof (Dimension),
- XtOffsetOf(TreeRec, tree.vpad), XtRImmediate, (XtPointer) 0 },
- { XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel),
- XtOffsetOf(TreeRec, tree.foreground), XtRString,
- XtDefaultForeground},
- { XtNlineWidth, XtCLineWidth, XtRDimension, sizeof (Dimension),
- XtOffsetOf(TreeRec, tree.line_width), XtRImmediate, (XtPointer) 0 },
- { XtNgravity, XtCGravity, XtRGravity, sizeof (XtGravity),
- XtOffsetOf(TreeRec, tree.gravity), XtRImmediate,
- (XtPointer) WestGravity },
-#ifndef OLDXAW
- { XawNdisplayList, XawCDisplayList, XawRDisplayList, sizeof(XawDisplayList*),
- XtOffsetOf(TreeRec, tree.display_list), XtRImmediate,
- NULL },
-#endif
-};
-
-
-/*
- * resources that are attached to all children of the tree
- */
-static XtResource treeConstraintResources[] = {
- { XtNtreeParent, XtCTreeParent, XtRWidget, sizeof (Widget),
- XtOffsetOf(TreeConstraintsRec, tree.parent), XtRImmediate, NULL },
- { XtNtreeGC, XtCTreeGC, XtRGC, sizeof(GC),
- XtOffsetOf(TreeConstraintsRec, tree.gc), XtRImmediate, NULL },
-};
-
-
-TreeClassRec treeClassRec = {
- {
- /* core_class fields */
- (WidgetClass) &constraintClassRec, /* superclass */
- "Tree", /* class_name */
- sizeof(TreeRec), /* widget_size */
- XawTreeClassInitialize, /* class_init */
- NULL, /* class_part_init */
- FALSE, /* class_inited */
- XawTreeInitialize, /* initialize */
- NULL, /* initialize_hook */
- XtInheritRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- TRUE, /* compress_motion */
- TRUE, /* compress_exposure */
- TRUE, /* compress_enterleave*/
- TRUE, /* visible_interest */
- XawTreeDestroy, /* destroy */
- NULL, /* resize */
- XawTreeRedisplay, /* expose */
- XawTreeSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XawTreeQueryGeometry, /* query_geometry */
- NULL, /* display_accelerator*/
- NULL, /* extension */
- },
- {
- /* composite_class fields */
- XawTreeGeometryManager, /* geometry_manager */
- XawTreeChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- {
- /* constraint_class fields */
- treeConstraintResources, /* subresources */
- XtNumber(treeConstraintResources), /* subresource_count */
- sizeof(TreeConstraintsRec), /* constraint_size */
- XawTreeConstraintInitialize, /* initialize */
- XawTreeConstraintDestroy, /* destroy */
- XawTreeConstraintSetValues, /* set_values */
- NULL, /* extension */
- },
- {
- /* Tree class fields */
- 0, /* ignore */
- }
-};
-
-WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec;
-
-
-/*****************************************************************************
- * *
- * tree utility routines *
- * *
- *****************************************************************************/
-
-static void
-initialize_dimensions(Dimension **listp, int *sizep, int n)
-{
- int i;
- Dimension *l;
-
- if (!*listp) {
- *listp = (Dimension *) XtCalloc ((unsigned int) n,
- (unsigned int) sizeof(Dimension));
- *sizep = ((*listp) ? n : 0);
- return;
- }
- if (n > *sizep) {
- *listp = (Dimension *) XtRealloc((char *) *listp,
- (unsigned int) (n*sizeof(Dimension)));
- if (!*listp) {
- *sizep = 0;
- return;
- }
- for (i = *sizep, l = (*listp) + i; i < n; i++, l++) *l = 0;
- *sizep = n;
- }
- return;
-}
-
-static GC
-get_tree_gc(TreeWidget w)
-{
- XtGCMask valuemask = GCBackground | GCForeground;
- XGCValues values;
-
- values.background = w->core.background_pixel;
- values.foreground = w->tree.foreground;
- if (w->tree.line_width != 0) {
- valuemask |= GCLineWidth;
- values.line_width = w->tree.line_width;
- }
-
- return XtGetGC ((Widget) w, valuemask, &values);
-}
-
-static void
-insert_node(Widget parent, Widget node)
-{
- TreeConstraints pc;
- TreeConstraints nc = TREE_CONSTRAINT(node);
- int nindex;
-
- nc->tree.parent = parent;
-
- if (parent == NULL) return;
-
- /*
- * If there isn't more room in the children array,
- * allocate additional space.
- */
- pc = TREE_CONSTRAINT(parent);
- nindex = pc->tree.n_children;
-
- if (pc->tree.n_children == pc->tree.max_children) {
- pc->tree.max_children += (pc->tree.max_children / 2) + 2;
- pc->tree.children = (WidgetList) XtRealloc ((char *)pc->tree.children,
- (unsigned int)
- ((pc->tree.max_children) *
- sizeof(Widget)));
- }
-
- /*
- * Add the sub_node in the next available slot and
- * increment the counter.
- */
- pc->tree.children[nindex] = node;
- pc->tree.n_children++;
-}
-
-static void
-delete_node(Widget parent, Widget node)
-{
- TreeConstraints pc;
- int pos, i;
-
- /*
- * Make sure the parent exists.
- */
- if (!parent) return;
-
- pc = TREE_CONSTRAINT(parent);
-
- /*
- * Find the sub_node on its parent's list.
- */
- for (pos = 0; pos < pc->tree.n_children; pos++)
- if (pc->tree.children[pos] == node) break;
-
- if (pos == pc->tree.n_children) return;
-
- /*
- * Decrement the number of children
- */
- pc->tree.n_children--;
-
- /*
- * Fill in the gap left by the sub_node.
- * Zero the last slot for good luck.
- */
- for (i = pos; i < pc->tree.n_children; i++)
- pc->tree.children[i] = pc->tree.children[i+1];
-
- pc->tree.children[pc->tree.n_children]=0;
-}
-
-static void
-check_gravity(TreeWidget tw, XtGravity grav)
-{
- switch (tw->tree.gravity) {
- case WestGravity: case NorthGravity: case EastGravity: case SouthGravity:
- break;
- default:
- tw->tree.gravity = grav;
- break;
- }
-}
-
-
-/*****************************************************************************
- * *
- * tree class methods *
- * *
- *****************************************************************************/
-
-static void
-XawTreeClassInitialize(void)
-{
- XawInitializeWidgetSet();
- XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, NULL, 0);
- XtSetTypeConverter(XtRGravity, XtRString, XmuCvtGravityToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-
-/*ARGSUSED*/
-static void
-XawTreeInitialize(Widget grequest, Widget gnew,
- ArgList args, Cardinal *num_args)
-{
- TreeWidget request = (TreeWidget) grequest, cnew = (TreeWidget) gnew;
- Arg arglist[2];
-
- /*
- * Make sure the widget's width and height are
- * greater than zero.
- */
- if (request->core.width <= 0) cnew->core.width = 5;
- if (request->core.height <= 0) cnew->core.height = 5;
-
- /*
- * Set the padding according to the orientation
- */
- if (request->tree.hpad == 0 && request->tree.vpad == 0) {
- if (IsHorizontal (request)) {
- cnew->tree.hpad = TREE_HORIZONTAL_DEFAULT_SPACING;
- cnew->tree.vpad = TREE_VERTICAL_DEFAULT_SPACING;
- } else {
- cnew->tree.hpad = TREE_VERTICAL_DEFAULT_SPACING;
- cnew->tree.vpad = TREE_HORIZONTAL_DEFAULT_SPACING;
- }
- }
-
- /*
- * Create a graphics context for the connecting lines.
- */
- cnew->tree.gc = get_tree_gc (cnew);
-
- /*
- * Create the hidden root widget.
- */
- cnew->tree.tree_root = (Widget) NULL;
- XtSetArg(arglist[0], XtNwidth, 1);
- XtSetArg(arglist[1], XtNheight, 1);
- cnew->tree.tree_root = XtCreateWidget ("root", widgetClass, gnew,
- arglist,TWO);
-
- /*
- * Allocate the array used to hold the widest values per depth
- */
- cnew->tree.largest = NULL;
- cnew->tree.n_largest = 0;
- initialize_dimensions (&cnew->tree.largest, &cnew->tree.n_largest,
- TREE_INITIAL_DEPTH);
-
- /*
- * make sure that our gravity is one of the acceptable values
- */
- check_gravity (cnew, WestGravity);
-}
-
-
-/* ARGSUSED */
-static void
-XawTreeConstraintInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TreeConstraints tc = TREE_CONSTRAINT(cnew);
- TreeWidget tw = (TreeWidget) cnew->core.parent;
-
- /*
- * Initialize the widget to have no sub-nodes.
- */
- tc->tree.n_children = 0;
- tc->tree.max_children = 0;
- tc->tree.children = (Widget *) NULL;
- tc->tree.x = tc->tree.y = 0;
- tc->tree.bbsubwidth = 0;
- tc->tree.bbsubheight = 0;
-
-
- /*
- * If this widget has a super-node, add it to that
- * widget' sub-nodes list. Otherwise make it a sub-node of
- * the tree_root widget.
- */
- if (tc->tree.parent)
- insert_node (tc->tree.parent, cnew);
- else if (tw->tree.tree_root)
- insert_node (tw->tree.tree_root, cnew);
-}
-
-
-/* ARGSUSED */
-static Boolean
-XawTreeSetValues(Widget gcurrent, Widget grequest, Widget gnew,
- ArgList args, Cardinal *num_args)
-{
- TreeWidget current = (TreeWidget) gcurrent, cnew = (TreeWidget) gnew;
- Boolean redraw = FALSE;
-
- /*
- * If the foreground color has changed, redo the GC's
- * and indicate a redraw.
- */
- if (cnew->tree.foreground != current->tree.foreground ||
- cnew->core.background_pixel != current->core.background_pixel ||
- cnew->tree.line_width != current->tree.line_width) {
- XtReleaseGC (gnew, cnew->tree.gc);
- cnew->tree.gc = get_tree_gc (cnew);
- redraw = TRUE;
- }
-
- /*
- * If the minimum spacing has changed, recalculate the
- * tree layout. layout_tree() does a redraw, so we don't
- * need SetValues to do another one.
- */
- if (cnew->tree.gravity != current->tree.gravity) {
- check_gravity (cnew, current->tree.gravity);
- }
-
- if (IsHorizontal(cnew) != IsHorizontal(current)) {
- if (cnew->tree.vpad == current->tree.vpad &&
- cnew->tree.hpad == current->tree.hpad) {
- cnew->tree.vpad = current->tree.hpad;
- cnew->tree.hpad = current->tree.vpad;
- }
- }
-
- if (cnew->tree.vpad != current->tree.vpad ||
- cnew->tree.hpad != current->tree.hpad ||
- cnew->tree.gravity != current->tree.gravity) {
- layout_tree (cnew, TRUE);
- redraw = FALSE;
- }
- return redraw;
-}
-
-
-/* ARGSUSED */
-static Boolean
-XawTreeConstraintSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- TreeConstraints newc = TREE_CONSTRAINT(cnew);
- TreeConstraints curc = TREE_CONSTRAINT(current);
- TreeWidget tw = (TreeWidget) cnew->core.parent;
-
- /*
- * If the parent field has changed, remove the widget
- * from the old widget's children list and add it to the
- * new one.
- */
- if (curc->tree.parent != newc->tree.parent){
- if (curc->tree.parent)
- delete_node (curc->tree.parent, cnew);
- if (newc->tree.parent)
- insert_node(newc->tree.parent, cnew);
-
- /*
- * If the Tree widget has been realized,
- * compute new layout.
- */
- if (XtIsRealized((Widget)tw))
- layout_tree (tw, FALSE);
- }
- return False;
-}
-
-
-static void
-XawTreeConstraintDestroy(Widget w)
-{
- TreeConstraints tc = TREE_CONSTRAINT(w);
- TreeWidget tw = (TreeWidget) XtParent(w);
- int i;
-
- /*
- * Remove the widget from its parent's sub-nodes list and
- * make all this widget's sub-nodes sub-nodes of the parent.
- */
-
- if (tw->tree.tree_root == w) {
- if (tc->tree.n_children > 0)
- tw->tree.tree_root = tc->tree.children[0];
- else
- tw->tree.tree_root = NULL;
- }
-
- delete_node (tc->tree.parent, (Widget) w);
- for (i = 0; i< tc->tree.n_children; i++)
- insert_node (tc->tree.parent, tc->tree.children[i]);
-
- layout_tree ((TreeWidget) (w->core.parent), FALSE);
-}
-
-/* ARGSUSED */
-static XtGeometryResult
-XawTreeGeometryManager(Widget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
-
- TreeWidget tw = (TreeWidget) w->core.parent;
-
- /*
- * No position changes allowed!.
- */
- if ((request->request_mode & CWX && request->x!=w->core.x)
- ||(request->request_mode & CWY && request->y!=w->core.y))
- return (XtGeometryNo);
-
- /*
- * Allow all resize requests.
- */
-
- if (request->request_mode & CWWidth)
- w->core.width = request->width;
- if (request->request_mode & CWHeight)
- w->core.height = request->height;
- if (request->request_mode & CWBorderWidth)
- w->core.border_width = request->border_width;
-
- if (tw->tree.auto_reconfigure) layout_tree (tw, FALSE);
- return (XtGeometryYes);
-}
-
-static void
-XawTreeChangeManaged(Widget gw)
-{
- layout_tree ((TreeWidget) gw, FALSE);
-}
-
-
-static void
-XawTreeDestroy(Widget gw)
-{
- TreeWidget w = (TreeWidget) gw;
-
- XtReleaseGC (gw, w->tree.gc);
- if (w->tree.largest) XtFree ((char *) w->tree.largest);
-}
-
-
-/* ARGSUSED */
-static void
-XawTreeRedisplay(Widget gw, XEvent *event, Region region)
-{
- TreeWidget tw = (TreeWidget) gw;
-
-#ifndef OLDXAW
- if (tw->tree.display_list)
- XawRunDisplayList(gw, tw->tree.display_list, event, region);
-#endif
-
- /*
- * If the Tree widget is visible, visit each managed child.
- */
- if (tw->core.visible) {
- Cardinal i;
- int j;
- Display *dpy = XtDisplay (tw);
- Window w = XtWindow (tw);
-
- for (i = 0; i < tw->composite.num_children; i++) {
- Widget child = tw->composite.children[i];
- TreeConstraints tc = TREE_CONSTRAINT(child);
-
- /*
- * Don't draw lines from the fake tree_root.
- */
- if (child != tw->tree.tree_root && tc->tree.n_children) {
- int srcx = child->core.x + child->core.border_width;
- int srcy = child->core.y + child->core.border_width;
-
- switch (tw->tree.gravity) {
- case WestGravity:
- srcx += child->core.width + child->core.border_width;
- /* fall through */
- case EastGravity:
- srcy += child->core.height / 2;
- break;
-
- case NorthGravity:
- srcy += child->core.height + child->core.border_width;
- /* fall through */
- case SouthGravity:
- srcx += child->core.width / 2;
- break;
- }
-
- for (j = 0; j < tc->tree.n_children; j++) {
- Widget k = tc->tree.children[j];
- GC gc = (tc->tree.gc ? tc->tree.gc : tw->tree.gc);
-
- switch (tw->tree.gravity) {
- case WestGravity:
- /*
- * right center to left center
- */
- XDrawLine (dpy, w, gc, srcx, srcy,
- (int) k->core.x,
- (k->core.y + ((int) k->core.border_width) +
- ((int) k->core.height) / 2));
- break;
-
- case NorthGravity:
- /*
- * bottom center to top center
- */
- XDrawLine (dpy, w, gc, srcx, srcy,
- (k->core.x + ((int) k->core.border_width) +
- ((int) k->core.width) / 2),
- (int) k->core.y);
- break;
-
- case EastGravity:
- /*
- * left center to right center
- */
- XDrawLine (dpy, w, gc, srcx, srcy,
- (k->core.x +
- (((int) k->core.border_width) << 1) +
- (int) k->core.width),
- (k->core.y + ((int) k->core.border_width) +
- ((int) k->core.height) / 2));
- break;
-
- case SouthGravity:
- /*
- * top center to bottom center
- */
- XDrawLine (dpy, w, gc, srcx, srcy,
- (k->core.x + ((int) k->core.border_width) +
- ((int) k->core.width) / 2),
- (k->core.y +
- (((int) k->core.border_width) << 1) +
- (int) k->core.height));
- break;
- }
- }
- }
- }
- }
-}
-
-static XtGeometryResult
-XawTreeQueryGeometry(Widget w, XtWidgetGeometry *intended,
- XtWidgetGeometry *preferred)
-{
- TreeWidget tw = (TreeWidget) w;
-
- preferred->request_mode = (CWWidth | CWHeight);
- preferred->width = tw->tree.maxwidth;
- preferred->height = tw->tree.maxheight;
-
- if (((intended->request_mode & (CWWidth | CWHeight)) ==
- (CWWidth | CWHeight)) &&
- intended->width == preferred->width &&
- intended->height == preferred->height)
- return XtGeometryYes;
- else if (preferred->width == w->core.width &&
- preferred->height == w->core.height)
- return XtGeometryNo;
- else
- return XtGeometryAlmost;
-}
-
-
-/*****************************************************************************
- * *
- * tree layout algorithm *
- * *
- * Each node in the tree is "shrink-wrapped" with a minimal bounding *
- * rectangle, laid next to its siblings (with a small about of padding in *
- * between) and then wrapped with their parent. Parents are centered about *
- * their children (or vice versa if the parent is larger than the children). *
- * *
- *****************************************************************************/
-
-static void
-compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth)
-{
- TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */
- int i;
- Bool horiz = IsHorizontal (tree);
- Dimension newwidth, newheight;
- Dimension bw2 = w->core.border_width * 2;
-
- /*
- * Set the max-size per level.
- */
- if (depth >= tree->tree.n_largest) {
- initialize_dimensions (&tree->tree.largest,
- &tree->tree.n_largest, depth + 1);
- }
- newwidth = ((horiz ? w->core.width : w->core.height) + bw2);
- if (tree->tree.largest[depth] < newwidth)
- tree->tree.largest[depth] = newwidth;
-
-
- /*
- * initialize
- */
- tc->tree.bbwidth = w->core.width + bw2;
- tc->tree.bbheight = w->core.height + bw2;
-
- if (tc->tree.n_children == 0) return;
-
- /*
- * Figure the size of the opposite dimension (vertical if tree is
- * horizontal, else vice versa). The other dimension will be set
- * in the second pass once we know the maximum dimensions.
- */
- newwidth = 0;
- newheight = 0;
- for (i = 0; i < tc->tree.n_children; i++) {
- Widget child = tc->tree.children[i];
- TreeConstraints cc = TREE_CONSTRAINT(child);
-
- compute_bounding_box_subtree (tree, child, depth + 1);
-
- if (horiz) {
- if (newwidth < cc->tree.bbwidth) newwidth = cc->tree.bbwidth;
- newheight += tree->tree.vpad + cc->tree.bbheight;
- } else {
- if (newheight < cc->tree.bbheight) newheight = cc->tree.bbheight;
- newwidth += tree->tree.hpad + cc->tree.bbwidth;
- }
- }
-
-
- tc->tree.bbsubwidth = newwidth;
- tc->tree.bbsubheight = newheight;
-
- /*
- * Now fit parent onto side (or top) of bounding box and correct for
- * extra padding. Be careful of unsigned arithmetic.
- */
- if (horiz) {
- tc->tree.bbwidth += tree->tree.hpad + newwidth;
- newheight -= tree->tree.vpad;
- if (newheight > tc->tree.bbheight) tc->tree.bbheight = newheight;
- } else {
- tc->tree.bbheight += tree->tree.vpad + newheight;
- newwidth -= tree->tree.hpad;
- if (newwidth > tc->tree.bbwidth) tc->tree.bbwidth = newwidth;
- }
-}
-
-
-static void
-set_positions(TreeWidget tw, Widget w, int level)
-{
- int i;
-
- if (w) {
- TreeConstraints tc = TREE_CONSTRAINT(w);
-
- if (level > 0) {
- /*
- * mirror if necessary
- */
- switch (tw->tree.gravity) {
- case EastGravity:
- tc->tree.x = (((Position) tw->tree.maxwidth) -
- ((Position) w->core.width) - tc->tree.x);
- break;
-
- case SouthGravity:
- tc->tree.y = (((Position) tw->tree.maxheight) -
- ((Position) w->core.height) - tc->tree.y);
- break;
- }
-
- /*
- * Move the widget into position.
- */
- XtMoveWidget (w, tc->tree.x, tc->tree.y);
- }
-
- /*
- * Set the positions of all children.
- */
- for (i = 0; i < tc->tree.n_children; i++)
- set_positions (tw, tc->tree.children[i], level + 1);
- }
-}
-
-
-static void
-arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y)
-{
- TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */
- TreeConstraints firstcc, lastcc;
- int i;
- int newx, newy;
- Bool horiz = IsHorizontal (tree);
- Widget child = NULL;
- Dimension tmp;
- Dimension bw2 = w->core.border_width * 2;
- Bool relayout = True;
-
-
- /*
- * If no children, then just lay out where requested.
- */
- tc->tree.x = x;
- tc->tree.y = y;
-
- if (horiz) {
- int myh = (w->core.height + bw2);
-
- if (myh > (int)tc->tree.bbsubheight) {
- y += (myh - (int)tc->tree.bbsubheight) / 2;
- relayout = False;
- }
- } else {
- int myw = (w->core.width + bw2);
-
- if (myw > (int)tc->tree.bbsubwidth) {
- x += (myw - (int)tc->tree.bbsubwidth) / 2;
- relayout = False;
- }
- }
-
- if ((tmp = ((Dimension) x) + tc->tree.bbwidth) > tree->tree.maxwidth)
- tree->tree.maxwidth = tmp;
- if ((tmp = ((Dimension) y) + tc->tree.bbheight) > tree->tree.maxheight)
- tree->tree.maxheight = tmp;
-
- if (tc->tree.n_children == 0) return;
-
-
- /*
- * Have children, so walk down tree laying out children, then laying
- * out parents.
- */
- if (horiz) {
- newx = x + tree->tree.largest[depth];
- if (depth > 0) newx += tree->tree.hpad;
- newy = y;
- } else {
- newx = x;
- newy = y + tree->tree.largest[depth];
- if (depth > 0) newy += tree->tree.vpad;
- }
-
- for (i = 0; i < tc->tree.n_children; i++) {
- TreeConstraints cc;
-
- child = tc->tree.children[i]; /* last value is used outside loop */
- cc = TREE_CONSTRAINT(child);
-
- arrange_subtree (tree, child, depth + 1, newx, newy);
- if (horiz) {
- newy += tree->tree.vpad + cc->tree.bbheight;
- } else {
- newx += tree->tree.hpad + cc->tree.bbwidth;
- }
- }
-
- /*
- * now layout parent between first and last children
- */
- if (relayout) {
- Position adjusted;
- firstcc = TREE_CONSTRAINT (tc->tree.children[0]);
- lastcc = TREE_CONSTRAINT (child);
-
- /* Adjustments are disallowed if they result in a position above
- * or to the left of the originally requested position, because
- * this could collide with the position of the previous sibling.
- */
- if (horiz) {
- tc->tree.x = x;
- adjusted = firstcc->tree.y +
- ((lastcc->tree.y + (Position) child->core.height +
- (Position) child->core.border_width * 2 -
- firstcc->tree.y - (Position) w->core.height -
- (Position) w->core.border_width * 2 + 1) / 2);
- if (adjusted > tc->tree.y) tc->tree.y = adjusted;
- } else {
- adjusted = firstcc->tree.x +
- ((lastcc->tree.x + (Position) child->core.width +
- (Position) child->core.border_width * 2 -
- firstcc->tree.x - (Position) w->core.width -
- (Position) w->core.border_width * 2 + 1) / 2);
- if (adjusted > tc->tree.x) tc->tree.x = adjusted;
- tc->tree.y = y;
- }
- }
-}
-
-static void
-set_tree_size(TreeWidget tw, Bool insetvalues,
- unsigned int width, unsigned int height)
-{
- if (insetvalues) {
- tw->core.width = width;
- tw->core.height = height;
- } else {
- Dimension replyWidth = 0, replyHeight = 0;
- XtGeometryResult result = XtMakeResizeRequest ((Widget) tw,
- width, height,
- &replyWidth,
- &replyHeight);
- /*
- * Accept any compromise.
- */
- if (result == XtGeometryAlmost)
- XtMakeResizeRequest ((Widget) tw, replyWidth, replyHeight,
- (Dimension *) NULL, (Dimension *) NULL);
- }
- return;
-}
-
-static void
-layout_tree(TreeWidget tw, Bool insetvalues)
-{
- int i;
- Dimension *dp;
-
- /*
- * Do a depth-first search computing the width and height of the bounding
- * box for the tree at that position (and below). Then, walk again using
- * this information to layout the children at each level.
- */
-
- if (tw->tree.tree_root == NULL)
- return;
-
- tw->tree.maxwidth = tw->tree.maxheight = 0;
- for (i = 0, dp = tw->tree.largest; i < tw->tree.n_largest; i++, dp++)
- *dp = 0;
- initialize_dimensions (&tw->tree.largest, &tw->tree.n_largest,
- tw->tree.n_largest);
- compute_bounding_box_subtree (tw, tw->tree.tree_root, 0);
-
- /*
- * Second pass to do final layout. Each child's bounding box is stacked
- * on top of (if horizontal, else next to) on top of its siblings. The
- * parent is centered between the first and last children.
- */
- arrange_subtree (tw, tw->tree.tree_root, 0, 0, 0);
-
- /*
- * Move each widget into place.
- */
- set_tree_size (tw, insetvalues, tw->tree.maxwidth, tw->tree.maxheight);
- set_positions (tw, tw->tree.tree_root, 0);
-
- /*
- * And redisplay.
- */
- if (XtIsRealized ((Widget) tw)) {
- XClearArea (XtDisplay(tw), XtWindow((Widget)tw), 0, 0, 0, 0, True);
- }
-}
-
-
-
-/*****************************************************************************
- * *
- * Public Routines *
- * *
- *****************************************************************************/
-
-void
-XawTreeForceLayout(Widget tree)
-{
- layout_tree ((TreeWidget) tree, FALSE);
-}
-
diff --git a/xc/lib/Xaw/Tree.h b/xc/lib/Xaw/Tree.h
deleted file mode 100644
index 5071cfa78..000000000
--- a/xc/lib/Xaw/Tree.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * $TOG: Tree.h /main/15 1998/02/11 14:56:11 kaleb $
- *
-
-Copyright 1990, 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.
-
- * Copyright 1989 Prentice Hall
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation.
- *
- * Prentice Hall and the authors disclaim all warranties with regard
- * to this software, including all implied warranties of merchantability and
- * fitness. In no event shall Prentice Hall or the authors be liable
- * for any special, indirect or cosequential damages or any damages whatsoever
- * resulting from loss of use, data or profits, whether 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: Jim Fulton, MIT X Consortium,
- * based on a version by Douglas Young, Prentice Hall
- *
- * This widget is based on the Tree widget described on pages 397-419 of
- * Douglas Young's book "The X Window System, Programming and Applications
- * with Xt OSF/Motif Edition." The layout code has been rewritten to use
- * additional blank space to make the structure of the graph easier to see
- * as well as to support vertical trees.
- */
-/* $XFree86: xc/lib/Xaw/Tree.h,v 1.5 1999/06/06 08:48:20 dawes Exp $ */
-
-
-#ifndef _XawTree_h
-#define _XawTree_h
-
-#include <X11/Xmu/Converters.h>
-
-/******************************************************************************
- *
- * Tree Widget (subclass of ConstraintClass)
- *
- ******************************************************************************
- *
- * Parameters:
- *
- * Name Class Type Default
- * ---- ----- ---- -------
- *
- * autoReconfigure AutoReconfigure Boolean FALSE
- * background Background Pixel XtDefaultBackground
- * foreground Foreground Pixel XtDefaultForeground
- * gravity Gravity XtGravity West
- * hSpace HSpace Dimension 20
- * lineWidth LineWidth Dimension 0
- * vSpace VSpace Dimension 6
- *
- *
- * Constraint Resources attached to children:
- *
- * treeGC TreeGC GC NULL
- * treeParent TreeParent Widget NULL
- *
- *
- *****************************************************************************/
-
- /* new instance field names */
-#ifndef _XtStringDefs_h_
-#define XtNhSpace "hSpace"
-#define XtNvSpace "vSpace"
-#define XtCHSpace "HSpace"
-#define XtCVSpace "VSpace"
-#endif
-
-#define XtNautoReconfigure "autoReconfigure"
-#define XtNlineWidth "lineWidth"
-#define XtNtreeGC "treeGC"
-#define XtNtreeParent "treeParent"
-#define XtNgravity "gravity"
-
- /* new class field names */
-#define XtCAutoReconfigure "AutoReconfigure"
-#define XtCLineWidth "LineWidth"
-#define XtCTreeGC "TreeGC"
-#define XtCTreeParent "TreeParent"
-#define XtCGravity "Gravity"
-
-#define XtRGC "GC"
-
-#ifndef OLDXAW
-#ifndef XawNdisplayList
-#define XawNdisplayList "displayList"
-#endif
-
-#ifndef XawCDisplayList
-#define XawCDisplayList "DisplayList"
-#endif
-
-#ifndef XawRDisplayList
-#define XawRDisplayList "XawDisplayList"
-#endif
-#endif
- /* external declarations */
-extern WidgetClass treeWidgetClass;
-
-typedef struct _TreeClassRec *TreeWidgetClass;
-typedef struct _TreeRec *TreeWidget;
-
-_XFUNCPROTOBEGIN
-
-void XawTreeForceLayout
-(
- Widget tree
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawTree_h */
diff --git a/xc/lib/Xaw/TreeP.h b/xc/lib/Xaw/TreeP.h
deleted file mode 100644
index 3e8b14d7a..000000000
--- a/xc/lib/Xaw/TreeP.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * $TOG: TreeP.h /main/16 1998/02/11 14:56:01 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 1989 Prentice Hall
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose and without fee is hereby granted, provided that the above
- * copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation.
- *
- * Prentice Hall and the authors disclaim all warranties with regard
- * to this software, including all implied warranties of merchantability and
- * fitness. In no event shall Prentice Hall or the authors be liable
- * for any special, indirect or cosequential damages or any damages whatsoever
- * resulting from loss of use, data or profits, whether 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: Jim Fulton, MIT X Consortium,
- * based on a version by Douglas Young, Prentice Hall
- *
- * This widget is based on the Tree widget described on pages 397-419 of
- * Douglas Young's book "The X Window System, Programming and Applications
- * with Xt OSF/Motif Edition." The layout code has been rewritten to use
- * additional blank space to make the structure of the graph easier to see
- * as well as to support vertical trees.
- */
-/* $XFree86: xc/lib/Xaw/TreeP.h,v 1.5 1999/06/20 08:41:12 dawes Exp $ */
-
-
-#ifndef _XawTreeP_h
-#define _XawTreeP_h
-
-#include <X11/Xaw/Tree.h>
-
-typedef struct _TreeClassPart {
- XtPointer extension;
-} TreeClassPart;
-
-typedef struct _TreeClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
- TreeClassPart tree_class;
-} TreeClassRec;
-
-extern TreeClassRec treeClassRec;
-
-typedef struct {
- /* fields available through resources */
- Dimension hpad; /* hSpace/HSpace */
- Dimension vpad; /* vSpace/VSpace */
- Dimension line_width; /* lineWidth/LineWidth */
- Pixel foreground; /* foreground/Foreground */
- XtGravity gravity; /* gravity/Gravity */
- Boolean auto_reconfigure; /* autoReconfigure/AutoReconfigure */
- /* private fields */
- GC gc; /* used to draw lines */
- Widget tree_root; /* hidden root off all children */
- Dimension *largest; /* list of largest per depth */
- int n_largest; /* number of elements in largest */
- Dimension maxwidth, maxheight; /* for shrink wrapping */
-#ifndef OLDXAW
- XawDisplayList *display_list;
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} TreePart;
-
-
-typedef struct _TreeRec {
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
- TreePart tree;
-} TreeRec;
-
-
-/*
- * structure attached to all children
- */
-typedef struct _TreeConstraintsPart {
- /* resources */
- Widget parent; /* treeParent/TreeParent */
- GC gc; /* treeGC/TreeGC */
- /* private data */
- Widget *children;
- int n_children;
- int max_children;
- Dimension bbsubwidth, bbsubheight; /* bounding box of sub tree */
- Dimension bbwidth, bbheight; /* bounding box including node */
- Position x, y;
-#ifndef OLDXAW
- XtPointer pad[2]; /* leave some space for future optimizations, and
- * keep binary compatability
- */
-#endif
-} TreeConstraintsPart;
-
-typedef struct _TreeConstraintsRec {
- TreeConstraintsPart tree;
-} TreeConstraintsRec, *TreeConstraints;
-
-
-/*
- * useful macros
- */
-
-#define TREE_CONSTRAINT(w) \
- ((TreeConstraints)((w)->core.constraints))
-
-#define TREE_INITIAL_DEPTH 10 /* for allocating largest array */
-#define TREE_HORIZONTAL_DEFAULT_SPACING 20
-#define TREE_VERTICAL_DEFAULT_SPACING 6
-
-#endif /* _XawTreeP_h */
-
-
-
diff --git a/xc/lib/Xaw/Vendor.c b/xc/lib/Xaw/Vendor.c
deleted file mode 100644
index 96d753568..000000000
--- a/xc/lib/Xaw/Vendor.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/* $TOG: Vendor.c /main/28 1998/02/06 12:52:56 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Vendor.c,v 1.6 1999/03/21 07:34:32 dawes Exp $ */
-
-/*
- * This is a copy of Xt/Vendor.c with an additional ClassInitialize
- * procedure to register Xmu resource type converters, and all the
- * monkey business associated with input methods...
- *
- */
-
-/* Make sure all wm properties can make it out of the resource manager */
-
-#include <stdio.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/ShellP.h>
-#include <X11/VendorP.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Atoms.h>
-#include <X11/Xmu/Editres.h>
-#include <X11/Xmu/ExtAgent.h>
-
-/* The following two headers are for the input method. */
-
-#include <X11/Xaw/VendorEP.h>
-#include <X11/Xaw/XawImP.h>
-
-/*
- * Class Methods
- */
-static void XawVendorShellChangeManaged(Widget);
-static Boolean XawCvtCompoundTextToString(Display*, XrmValuePtr, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static void XawVendorShellClassInitialize(void);
-static XtGeometryResult XawVendorShellGeometryManager(Widget,
- XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawVendorShellExtClassInitialize(void);
-static void XawVendorShellExtDestroy(Widget);
-static void XawVendorShellExtInitialize(Widget, Widget, ArgList, Cardinal*);
-void XawVendorShellExtResize(Widget);
-static Boolean XawVendorShellExtSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-static void XawVendorShellClassPartInit(WidgetClass);
-static void XawVendorShellInitialize(Widget, Widget, ArgList, Cardinal*);
-static void XawVendorShellRealize(Widget, Mask*, XSetWindowAttributes*);
-static Boolean XawVendorShellSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * External
- */
-void XawVendorStructureNotifyHandler(Widget, XtPointer, XEvent*, Boolean*);
-
-static XtResource resources[] = {
- {XtNinput, XtCInput, XtRBool, sizeof(Bool),
- XtOffsetOf(VendorShellRec, wm.wm_hints.input),
- XtRImmediate, (XtPointer)True}
-};
-
-/***************************************************************************
- *
- * Vendor shell class record
- *
- ***************************************************************************/
-
-#ifdef __EMX__
-/* to fix the EditRes problem because of wrong linker semantics */
-extern WidgetClass vendorShellWidgetClass; /* from Xt/Vendor.c */
-extern VendorShellClassRec _XawVendorShellClassRec;
-extern void _XawFixupVendorShell();
-unsigned long _DLL_InitTerm(unsigned long mod,unsigned long flag)
-{
- switch (flag) {
- case 0: /*called on init*/
- _CRT_init();
- vendorShellWidgetClass = (WidgetClass)(&_XawVendorShellClassRec);
- _XawFixupVendorShell();
- return 1;
- case 1: /*called on exit*/
- return 1;
- default:
- return 0;
- }
-}
-#define vendorShellClassRec _XawVendorShellClassRec
-
-#endif
-
-static CompositeClassExtensionRec vendorCompositeExt = {
- /* next_extension */ NULL,
- /* record_type */ NULLQUARK,
- /* version */ XtCompositeExtensionVersion,
- /* record_size */ sizeof (CompositeClassExtensionRec),
- /* accepts_objects */ TRUE,
- /* allows_change_managed_set */ FALSE
-};
-
-#define SuperClass (&wmShellClassRec)
-externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
- {
- /* superclass */ (WidgetClass)SuperClass,
- /* class_name */ "VendorShell",
- /* size */ sizeof(VendorShellRec),
- /* class_initialize */ XawVendorShellClassInitialize,
- /* class_part_init */ XawVendorShellClassPartInit,
- /* Class init'ed ? */ FALSE,
- /* initialize */ XawVendorShellInitialize,
- /* initialize_hook */ NULL,
- /* realize */ XawVendorShellRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* resource_count */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ XawVendorShellExtResize,
- /* expose */ NULL,
- /* set_values */ XawVendorShellSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator*/ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XawVendorShellGeometryManager,
- /* change_managed */ XawVendorShellChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ (XtPointer) &vendorCompositeExt
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-#ifndef __EMX__
-externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
- (WidgetClass) (&vendorShellClassRec);
-#endif
-
-/***************************************************************************
- *
- * The following section is for the Vendor shell Extension class record
- *
- ***************************************************************************/
-
-static XtResource ext_resources[] = {
- {XtNinputMethod, XtCInputMethod, XtRString, sizeof(String),
- XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.input_method),
- XtRString, (XtPointer)NULL},
- {XtNpreeditType, XtCPreeditType, XtRString, sizeof(String),
- XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.preedit_type),
- XtRString, (XtPointer)"OverTheSpot,OffTheSpot,Root"},
- {XtNopenIm, XtCOpenIm, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(XawVendorShellExtRec, vendor_ext.im.open_im),
- XtRImmediate, (XtPointer)TRUE},
- {XtNsharedIc, XtCSharedIc, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(XawVendorShellExtRec, vendor_ext.ic.shared_ic),
- XtRImmediate, (XtPointer)FALSE}
-};
-
-externaldef(vendorshellextclassrec) XawVendorShellExtClassRec
- xawvendorShellExtClassRec = {
- {
- /* superclass */ (WidgetClass)&objectClassRec,
- /* class_name */ "VendorShellExt",
- /* size */ sizeof(XawVendorShellExtRec),
- /* class_initialize */ XawVendorShellExtClassInitialize,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ XawVendorShellExtInitialize,
- /* initialize_hook */ NULL,
- /* pad */ NULL,
- /* pad */ NULL,
- /* pad */ 0,
- /* resources */ ext_resources,
- /* resource_count */ XtNumber(ext_resources),
- /* xrm_class */ NULLQUARK,
- /* pad */ FALSE,
- /* pad */ FALSE,
- /* pad */ FALSE,
- /* pad */ FALSE,
- /* destroy */ XawVendorShellExtDestroy,
- /* pad */ NULL,
- /* pad */ NULL,
- /* set_values */ XawVendorShellExtSetValues,
- /* set_values_hook */ NULL,
- /* pad */ NULL,
- /* get_values_hook */ NULL,
- /* pad */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* pad */ NULL,
- /* pad */ NULL,
- /* pad */ NULL,
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(xawvendorshellwidgetclass) WidgetClass
- xawvendorShellExtWidgetClass = (WidgetClass) (&xawvendorShellExtClassRec);
-
-
-/*ARGSUSED*/
-static Boolean
-XawCvtCompoundTextToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *cvt_data)
-{
- XTextProperty prop;
- char **list;
- int count;
- static char *mbs = NULL;
- int len;
-
- prop.value = (unsigned char *)fromVal->addr;
- prop.encoding = XA_COMPOUND_TEXT(dpy);
- prop.format = 8;
- prop.nitems = fromVal->size;
-
- if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "converter", "XmbTextPropertyToTextList", "XawError",
- "conversion from CT to MB failed.", NULL, 0);
- return False;
- }
- len = strlen(*list);
- toVal->size = len;
- mbs = XtRealloc(mbs, len + 1); /* keep buffer because no one call free :( */
- strcpy(mbs, *list);
- XFreeStringList(list);
- toVal->addr = (XtPointer)mbs;
- return True;
-}
-
-static void
-XawVendorShellClassInitialize(void)
-{
- static XtConvertArgRec screenConvertArg[] = {
- {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)}
- };
-
- XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
- screenConvertArg, XtNumber(screenConvertArg));
-
- XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
- screenConvertArg, XtNumber(screenConvertArg));
-
- XtSetTypeConverter("CompoundText", XtRString, XawCvtCompoundTextToString,
- NULL, 0, XtCacheNone, NULL);
-}
-
-static void
-XawVendorShellClassPartInit(WidgetClass cclass)
-{
- CompositeClassExtension ext;
- VendorShellWidgetClass vsclass = (VendorShellWidgetClass)cclass;
-
- if ((ext = (CompositeClassExtension)
- XtGetClassExtension (cclass,
- XtOffsetOf(CompositeClassRec,
- composite_class.extension),
- NULLQUARK, 1L, (Cardinal) 0)) == NULL) {
- ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec);
- if (ext != NULL) {
- ext->next_extension = vsclass->composite_class.extension;
- ext->record_type = NULLQUARK;
- ext->version = XtCompositeExtensionVersion;
- ext->record_size = sizeof (CompositeClassExtensionRec);
- ext->accepts_objects = TRUE;
- ext->allows_change_managed_set = FALSE;
- vsclass->composite_class.extension = (XtPointer) ext;
- }
- }
-}
-
-#if defined(__osf__) || defined(__EMX__)
-/* stupid OSF/1 shared libraries have the wrong semantics */
-/* symbols do not get resolved external to the shared library */
-void _XawFixupVendorShell()
-{
- transientShellWidgetClass->core_class.superclass =
- (WidgetClass) &vendorShellClassRec;
- topLevelShellWidgetClass->core_class.superclass =
- (WidgetClass) &vendorShellClassRec;
-}
-#endif
-
-/* ARGSUSED */
-static void
-XawVendorShellInitialize(Widget req, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- XtAddEventHandler(cnew, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL);
- XtAddEventHandler(cnew, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL);
- XtCreateWidget("shellext", xawvendorShellExtWidgetClass,
- cnew, args, *num_args);
-}
-
-/* ARGSUSED */
-static Boolean
-XawVendorShellSetValues(Widget old, Widget ref, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- return FALSE;
-}
-
-static void
-XawVendorShellRealize(Widget wid, Mask *vmask, XSetWindowAttributes *attr)
-{
- WidgetClass super = wmShellWidgetClass;
-
- /* Make my superclass do all the dirty work */
-
- (*super->core_class.realize) (wid, vmask, attr);
- _XawImRealize(wid);
-}
-
-
-static void
-XawVendorShellExtClassInitialize(void)
-{
-}
-
-/* ARGSUSED */
-static void
-XawVendorShellExtInitialize(Widget req, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- _XawImInitialize(cnew->core.parent, cnew);
-}
-
-/* ARGSUSED */
-static void
-XawVendorShellExtDestroy(Widget w)
-{
- _XawImDestroy( w->core.parent, w );
-}
-
-/* ARGSUSED */
-static Boolean
-XawVendorShellExtSetValues(Widget old, Widget ref, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- return FALSE;
-}
-
-void
-XawVendorShellExtResize(Widget w)
-{
- ShellWidget sw = (ShellWidget) w;
- Widget childwid;
- Cardinal i;
- int core_height;
-
- _XawImResizeVendorShell( w );
- core_height = _XawImGetShellHeight( w );
- for( i = 0; i < sw->composite.num_children; i++ ) {
- if( XtIsManaged( sw->composite.children[ i ] ) ) {
- childwid = sw->composite.children[ i ];
- XtResizeWidget( childwid, sw->core.width, core_height,
- childwid->core.border_width );
- }
- }
-}
-
-/*ARGSUSED*/
-void
-XawVendorStructureNotifyHandler(Widget w, XtPointer closure, XEvent *event,
- Boolean *continue_to_dispatch)
-{
- XawVendorShellExtResize(w);
-}
-
-/*ARGSUSED*/
-static XtGeometryResult
-XawVendorShellGeometryManager(Widget wid, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- ShellWidget shell = (ShellWidget)(wid->core.parent);
- XtWidgetGeometry my_request;
-
- if(shell->shell.allow_shell_resize == FALSE && XtIsRealized(wid))
- return(XtGeometryNo);
-
- if (request->request_mode & (CWX | CWY))
- return(XtGeometryNo);
-
- /* %%% worry about XtCWQueryOnly */
- my_request.request_mode = 0;
- if (request->request_mode & CWWidth) {
- my_request.width = request->width;
- my_request.request_mode |= CWWidth;
- }
- if (request->request_mode & CWHeight) {
- my_request.height = request->height
- + _XawImGetImAreaHeight( wid );
- my_request.request_mode |= CWHeight;
- }
- if (request->request_mode & CWBorderWidth) {
- my_request.border_width = request->border_width;
- my_request.request_mode |= CWBorderWidth;
- }
- if (XtMakeGeometryRequest((Widget)shell, &my_request, NULL)
- == XtGeometryYes) {
- /* assert: if (request->request_mode & CWWidth) then
- * shell->core.width == request->width
- * assert: if (request->request_mode & CWHeight) then
- * shell->core.height == request->height
- *
- * so, whatever the WM sized us to (if the Shell requested
- * only one of the two) is now the correct child size
- */
-
- wid->core.width = shell->core.width;
- wid->core.height = shell->core.height;
- if (request->request_mode & CWBorderWidth) {
- wid->core.x = wid->core.y = -request->border_width;
- }
- _XawImCallVendorShellExtResize(wid);
- return XtGeometryYes;
- } else return XtGeometryNo;
-}
-
-static void
-XawVendorShellChangeManaged(Widget wid)
-{
- ShellWidget w = (ShellWidget) wid;
- Widget* childP;
- int i;
-
- (*SuperClass->composite_class.change_managed)(wid);
- for (i = w->composite.num_children, childP = w->composite.children;
- i; i--, childP++) {
- if (XtIsManaged(*childP)) {
- XtSetKeyboardFocus(wid, *childP);
- break;
- }
- }
-}
diff --git a/xc/lib/Xaw/VendorEP.h b/xc/lib/Xaw/VendorEP.h
deleted file mode 100644
index 309162c16..000000000
--- a/xc/lib/Xaw/VendorEP.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $TOG: VendorEP.h /main/3 1998/02/06 12:52:50 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. OMRON makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Author: Seiji Kuwari OMRON Corporation
- * kuwa@omron.co.jp
- * kuwa%omron.co.jp@uunet.uu.net
- */
-
-/*
-
-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.
-
-*/
-/* $XFree86: xc/lib/Xaw/VendorEP.h,v 1.4 1999/06/20 08:41:12 dawes Exp $ */
-
-#ifndef _VendorEP_h
-#define _VendorEP_h
-
-#include <X11/Xaw/XawImP.h>
-
-typedef struct {
- XtPointer extension;
-} XawVendorShellExtClassPart;
-
-typedef struct _VendorShellExtClassRec {
- ObjectClassPart object_class;
- XawVendorShellExtClassPart vendor_shell_ext_class;
-} XawVendorShellExtClassRec;
-
-typedef struct {
- Widget parent;
- XawImPart im;
- XawIcPart ic;
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} XawVendorShellExtPart;
-
-typedef struct XawVendorShellExtRec {
- ObjectPart object;
- XawVendorShellExtPart vendor_ext;
-} XawVendorShellExtRec, *XawVendorShellExtWidget;
-
-#endif /* _VendorEP_h */
diff --git a/xc/lib/Xaw/Viewport.c b/xc/lib/Xaw/Viewport.c
deleted file mode 100644
index 24e2fb7cc..000000000
--- a/xc/lib/Xaw/Viewport.c
+++ /dev/null
@@ -1,1093 +0,0 @@
-/* $TOG: Viewport.c /main/72 1998/02/06 12:53:07 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xaw/Viewport.c,v 1.7 1999/06/06 08:48:21 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Misc.h>
-#include <X11/Xaw/Scrollbar.h>
-#include <X11/Xaw/ViewportP.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-/*
- * Class Methods
- */
-static Boolean Layout(FormWidget, unsigned int, unsigned int, Bool);
-static void XawViewportChangeManaged(Widget);
-static void XawViewportInitialize(Widget, Widget, ArgList, Cardinal*);
-static void
-XawViewportConstraintInitialize(Widget, Widget, ArgList, Cardinal*);
-static XtGeometryResult XawViewportGeometryManager(Widget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static XtGeometryResult XawViewportQueryGeometry(Widget,
- XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void XawViewportRealize(Widget, XtValueMask*, XSetWindowAttributes*);
-static void XawViewportResize(Widget);
-static Boolean XawViewportSetValues(Widget, Widget, Widget,
- ArgList, Cardinal*);
-
-/*
- * Prototypes
- */
-static void ComputeLayout(Widget, Bool, Bool);
-static void ComputeWithForceBars(Widget, Bool, XtWidgetGeometry*,
- int*, int*);
-static Widget CreateScrollbar(ViewportWidget, Bool);
-static XtGeometryResult GeometryRequestPlusScrollbar(ViewportWidget, Bool,
- XtWidgetGeometry*,
- XtWidgetGeometry*);
-static Bool GetGeometry(Widget, unsigned int, unsigned int);
-static void MoveChild(ViewportWidget, int, int);
-static XtGeometryResult QueryGeometry(ViewportWidget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void RedrawThumbs(ViewportWidget);
-static void ScrollUpDownProc(Widget, XtPointer, XtPointer);
-static void SendReport(ViewportWidget, unsigned int);
-static void SetBar(Widget, int, unsigned int, unsigned int);
-static XtGeometryResult TestSmaller(ViewportWidget, XtWidgetGeometry*,
- XtWidgetGeometry*);
-static void ThumbProc(Widget, XtPointer, XtPointer);
-
-/*
- * Initialization
- */
-#define offset(field) XtOffsetOf(ViewportRec, viewport.field)
-static XtResource resources[] = {
- {
- XtNforceBars,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(forcebars),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNallowHoriz,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(allowhoriz),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNallowVert,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(allowvert),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNuseBottom,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(usebottom),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNuseRight,
- XtCBoolean,
- XtRBoolean,
- sizeof(Boolean),
- offset(useright),
- XtRImmediate,
- (XtPointer)False
- },
- {
- XtNreportCallback,
- XtCReportCallback,
- XtRCallback,
- sizeof(XtPointer),
- offset(report_callbacks),
- XtRImmediate,
- NULL
- },
-};
-#undef offset
-
-#define Superclass (&formClassRec)
-ViewportClassRec viewportClassRec = {
- /* core */
- {
- (WidgetClass)Superclass, /* superclass */
- "Viewport", /* class_name */
- sizeof(ViewportRec), /* widget_size */
- XawInitializeWidgetSet, /* class_initialize */
- NULL, /* class_part_init */
- False, /* class_inited */
- XawViewportInitialize, /* initialize */
- NULL, /* initialize_hook */
- XawViewportRealize, /* realize */
- NULL, /* actions */
- 0, /* num_actions */
- resources, /* resources */
- XtNumber(resources), /* num_resources */
- NULLQUARK, /* xrm_class */
- True, /* compress_motion */
- True, /* compress_exposure */
- True, /* compress_enterleave */
- False, /* visible_interest */
- NULL, /* destroy */
- XawViewportResize, /* resize */
- XtInheritExpose, /* expose */
- XawViewportSetValues, /* set_values */
- NULL, /* set_values_hook */
- XtInheritSetValuesAlmost, /* set_values_almost */
- NULL, /* get_values_hook */
- NULL, /* accept_focus */
- XtVersion, /* version */
- NULL, /* callback_private */
- NULL, /* tm_table */
- XawViewportQueryGeometry, /* query_geometry */
- XtInheritDisplayAccelerator, /* display_accelerator */
- NULL, /* extension */
- },
- /* composite */
- {
- XawViewportGeometryManager, /* geometry_manager */
- XawViewportChangeManaged, /* change_managed */
- XtInheritInsertChild, /* insert_child */
- XtInheritDeleteChild, /* delete_child */
- NULL, /* extension */
- },
- /* constraint */
- {
- NULL, /* subresourses */
- 0, /* subresource_count */
- sizeof(ViewportConstraintsRec), /* constraint_size */
- XawViewportConstraintInitialize, /* initialize */
- NULL, /* destroy */
- NULL, /* set_values */
- NULL, /* extension */
- },
- /* form */
- {
- Layout, /* layout */
- },
- /* viewport */
- {
- NULL, /* extension */
- },
-};
-
-WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec;
-
-/*
- * Implementation
- */
-static Widget
-CreateScrollbar(ViewportWidget w, Bool horizontal)
-{
- static Arg barArgs[] = {
- {XtNorientation, 0},
- {XtNlength, 0},
- {XtNleft, 0},
- {XtNright, 0},
- {XtNtop, 0},
- {XtNbottom, 0},
- {XtNmappedWhenManaged, False},
- };
- Widget clip = w->viewport.clip;
- ViewportConstraints constraints =
- (ViewportConstraints)clip->core.constraints;
- Widget bar;
-
- XtSetArg(barArgs[0], XtNorientation,
- horizontal ? XtorientHorizontal : XtorientVertical);
- XtSetArg(barArgs[1], XtNlength,
- horizontal ? XtWidth(clip) : XtHeight(clip));
- XtSetArg(barArgs[2], XtNleft,
- !horizontal && w->viewport.useright ? XtChainRight : XtChainLeft);
- XtSetArg(barArgs[3], XtNright,
- !horizontal && !w->viewport.useright ? XtChainLeft : XtChainRight);
- XtSetArg(barArgs[4], XtNtop,
- horizontal && w->viewport.usebottom ? XtChainBottom: XtChainTop);
- XtSetArg(barArgs[5], XtNbottom,
- horizontal && !w->viewport.usebottom ? XtChainTop: XtChainBottom);
-
- bar = XtCreateWidget(horizontal ? "horizontal" : "vertical",
- scrollbarWidgetClass, (Widget)w,
- barArgs, XtNumber(barArgs));
- XtAddCallback(bar, XtNscrollProc, ScrollUpDownProc, (XtPointer)w);
- XtAddCallback(bar, XtNjumpProc, ThumbProc, (XtPointer)w);
-
- if (horizontal) {
- w->viewport.horiz_bar = bar;
- constraints->form.vert_base = bar;
- }
- else {
- w->viewport.vert_bar = bar;
- constraints->form.horiz_base = bar;
- }
-
- XtManageChild(bar);
-
- return (bar);
-}
-
-/*ARGSUSED*/
-static void
-XawViewportInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ViewportWidget w = (ViewportWidget)cnew;
- static Arg clip_args[8];
- Cardinal arg_cnt;
- Widget h_bar, v_bar;
- Dimension clip_height, clip_width;
-
- w->form.default_spacing = 0; /* Reset the default spacing to 0 pixels */
-
- /*
- * Initialize all widget pointers to NULL
- */
- w->viewport.child = NULL;
- w->viewport.horiz_bar = w->viewport.vert_bar = NULL;
-
- /*
- * Create Clip Widget
- */
- arg_cnt = 0;
- XtSetArg(clip_args[arg_cnt], XtNbackgroundPixmap, None); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNborderWidth, 0); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNleft, XtChainLeft); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNright, XtChainRight); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNtop, XtChainTop); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNbottom, XtChainBottom); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNwidth, XtWidth(w)); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNheight, XtHeight(w)); arg_cnt++;
-
- w->viewport.clip = XtCreateManagedWidget("clip", widgetClass, cnew,
- clip_args, arg_cnt);
-
- if (!w->viewport.forcebars)
- return; /* If we are not forcing the bars then we are done */
-
- if (w->viewport.allowhoriz)
- (void)CreateScrollbar(w, True);
- if (w->viewport.allowvert)
- (void)CreateScrollbar(w, False);
-
- h_bar = w->viewport.horiz_bar;
- v_bar = w->viewport.vert_bar;
-
- /*
- * Set the clip widget to the correct height
- */
- clip_width = XtWidth(w);
- clip_height = XtHeight(w);
-
- if (h_bar != NULL && XtWidth(w) > XtWidth(h_bar) + XtBorderWidth(h_bar))
- clip_width -= XtWidth(h_bar) + XtBorderWidth(h_bar);
-
- if (v_bar != NULL && XtHeight(w) > XtHeight(v_bar) + XtBorderWidth(v_bar))
- clip_height -= XtHeight(v_bar) + XtBorderWidth(v_bar);
-
- arg_cnt = 0;
- XtSetArg(clip_args[arg_cnt], XtNwidth, clip_width); arg_cnt++;
- XtSetArg(clip_args[arg_cnt], XtNheight, clip_height); arg_cnt++;
- XtSetValues(w->viewport.clip, clip_args, arg_cnt);
-}
-
-/*ARGSUSED*/
-static void
-XawViewportConstraintInitialize(Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ((ViewportConstraints)cnew->core.constraints)->viewport.reparented = False;
-}
-
-static void
-XawViewportRealize(Widget widget, XtValueMask *value_mask,
- XSetWindowAttributes *attributes)
-{
- ViewportWidget w = (ViewportWidget)widget;
- Widget child = w->viewport.child;
- Widget clip = w->viewport.clip;
-
- *value_mask |= CWBitGravity;
- attributes->bit_gravity = NorthWestGravity;
- (*Superclass->core_class.realize)(widget, value_mask, attributes);
-
- (*w->core.widget_class->core_class.resize)(widget); /* turn on bars */
-
- if (child != NULL) {
- XtMoveWidget(child, 0, 0);
- XtRealizeWidget(clip);
- XtRealizeWidget(child);
- XReparentWindow(XtDisplay(w), XtWindow(child), XtWindow(clip), 0, 0);
- XtMapWidget(child);
- }
-}
-
-/*ARGSUSED*/
-static Boolean
-XawViewportSetValues(Widget current, Widget request, Widget cnew,
- ArgList args, Cardinal *num_args)
-{
- ViewportWidget w = (ViewportWidget)cnew;
- ViewportWidget cw = (ViewportWidget)current;
-
- if (w->viewport.forcebars != cw->viewport.forcebars
- || w->viewport.allowvert != cw->viewport.allowvert
- || w->viewport.allowhoriz != cw->viewport.allowhoriz
- || w->viewport.useright != cw->viewport.useright
- || w->viewport.usebottom != cw->viewport.usebottom)
- (*w->core.widget_class->core_class.resize)(cnew); /* Recompute layout */
-
- return (False);
-}
-
-static void
-XawViewportChangeManaged(Widget widget)
-{
- ViewportWidget w = (ViewportWidget)widget;
- int num_children = w->composite.num_children;
- Widget child, *childP;
- int i;
-
- child = NULL;
- for (childP = w->composite.children,
- i = 0; i < num_children;
- childP++, i++) {
- if (XtIsManaged(*childP)
- && *childP != w->viewport.clip
- && *childP != w->viewport.horiz_bar
- && *childP != w->viewport.vert_bar) {
- child = *childP;
- break;
- }
- }
-
- if (child != w->viewport.child) {
- w->viewport.child = child;
- if (child != NULL) {
- XtResizeWidget(child, XtWidth(child), XtHeight(child), 0);
- if (XtIsRealized(widget)) {
- ViewportConstraints constraints =
- (ViewportConstraints)child->core.constraints;
- if (!XtIsRealized(child)) {
- Window window = XtWindow(w);
-
- XtMoveWidget(child, 0, 0);
- w->core.window = XtWindow(w->viewport.clip);
- XtRealizeWidget(child);
- w->core.window = window;
- constraints->viewport.reparented = True;
- }
- else if (!constraints->viewport.reparented) {
- XReparentWindow(XtDisplay(w), XtWindow(child),
- XtWindow(w->viewport.clip), 0, 0);
- constraints->viewport.reparented = True;
- if (child->core.mapped_when_managed)
- XtMapWidget(child);
- }
- }
- GetGeometry(widget, XtWidth(child), XtHeight(child));
- (*((ViewportWidgetClass)w->core.widget_class)->form_class.layout)
- ((FormWidget)w, XtWidth(w), XtHeight(w), True /* True? */);
- }
- }
-
-#ifdef notdef
- (*Superclass->composite_class.change_managed)(widget);
-#endif
-}
-
-static void
-SetBar(Widget w, int top, unsigned int length, unsigned int total)
-{
- XawScrollbarSetThumb(w, (float)top / (float)total,
- (float)length / (float)total);
-}
-
-static void
-RedrawThumbs(ViewportWidget w)
-{
- Widget child = w->viewport.child;
- Widget clip = w->viewport.clip;
-
- if (w->viewport.horiz_bar != NULL)
- SetBar(w->viewport.horiz_bar, -(int)XtX(child),
- XtWidth(clip), XtWidth(child));
-
- if (w->viewport.vert_bar != NULL)
- SetBar(w->viewport.vert_bar, -(int)XtY(child),
- XtHeight(clip), XtHeight(child));
-}
-
-static void
-SendReport(ViewportWidget w, unsigned int changed)
-{
- XawPannerReport rep;
-
- if (w->viewport.report_callbacks) {
- Widget child = w->viewport.child;
- Widget clip = w->viewport.clip;
-
- rep.changed = changed;
- rep.slider_x = -XtX(child); /* child is canvas */
- rep.slider_y = -XtY(child); /* clip is slider */
- rep.slider_width = XtWidth(clip);
- rep.slider_height = XtHeight(clip);
- rep.canvas_width = XtWidth(child);
- rep.canvas_height = XtHeight(child);
- XtCallCallbackList((Widget)w, w->viewport.report_callbacks,
- (XtPointer)&rep);
- }
-}
-
-static void
-MoveChild(ViewportWidget w, int x, int y)
-{
- Widget child = w->viewport.child;
- Widget clip = w->viewport.clip;
-
- /* make sure we never move past right/bottom borders */
- if (-x + (int)XtWidth(clip) > XtWidth(child))
- x = -(int)(XtWidth(child) - XtWidth(clip));
-
- if (-y + (int)XtHeight(clip) > XtHeight(child))
- y = -(int)(XtHeight(child) - XtHeight(clip));
-
- /* make sure we never move past left/top borders */
- if (x >= 0)
- x = 0;
- if (y >= 0)
- y = 0;
-
- XtMoveWidget(child, x, y);
- SendReport(w, (XawPRSliderX | XawPRSliderY));
-
- RedrawThumbs(w);
-}
-
-static void
-ComputeLayout(Widget widget, Bool query, Bool destroy_scrollbars)
-{
- ViewportWidget w = (ViewportWidget)widget;
- Widget child = w->viewport.child;
- Widget clip = w->viewport.clip;
- ViewportConstraints constraints =
- (ViewportConstraints)clip->core.constraints;
- Bool needshoriz, needsvert;
- int clip_width, clip_height;
- XtWidgetGeometry intended;
-
- if (child == NULL)
- return;
-
- clip_width = XtWidth(w);
- clip_height = XtHeight(w);
- intended.request_mode = CWBorderWidth;
- intended.border_width = 0;
-
- if (w->viewport.forcebars) {
- needsvert = w->viewport.allowvert;
- needshoriz = w->viewport.allowhoriz;
- ComputeWithForceBars(widget, query, &intended,
- &clip_width, &clip_height);
- }
- else {
- Dimension prev_width, prev_height;
- XtGeometryMask prev_mode;
- XtWidgetGeometry preferred;
-
- needshoriz = needsvert = False;
-
- /*
- * intended.{width,height} caches the eventual child dimensions,
- * but we don't set the mode bits until after we decide that the
- * child's preferences are not acceptable
- */
- if (!w->viewport.allowhoriz)
- intended.request_mode |= CWWidth;
-
- if (XtWidth(child) < clip_width)
- intended.width = clip_width;
- else
- intended.width = XtWidth(child);
-
- if (XtHeight(child) < clip_height)
- intended.height = clip_height;
- else
- intended.height = XtHeight(child);
-
- if (!w->viewport.allowvert)
- intended.request_mode |= CWHeight;
-
- if (!query) {
- preferred.width = XtWidth(child);
- preferred.height = XtHeight(child);
- }
- do { /* while intended != prev */
- if (query) {
- (void)XtQueryGeometry(child, &intended, &preferred);
- if (!(preferred.request_mode & CWWidth))
- preferred.width = intended.width;
- if (!(preferred.request_mode & CWHeight))
- preferred.height = intended.height;
- }
- prev_width = intended.width;
- prev_height = intended.height;
- prev_mode = intended.request_mode;
- /*
- * note that having once decided to turn on either bar
- * we'll not change our mind until we're next resized,
- * thus avoiding potential oscillations
- */
-#define CheckHoriz() \
- if (w->viewport.allowhoriz && \
- preferred.width > clip_width) { \
- if (!needshoriz) { \
- Widget bar; \
- \
- needshoriz = True; \
- if ((bar = w->viewport.horiz_bar) == NULL) \
- bar = CreateScrollbar(w, True); \
- clip_height -= XtHeight(bar) + XtBorderWidth(bar); \
- if (clip_height < 1) \
- clip_height = 1; \
- } \
- intended.width = preferred.width; \
- }
-
- CheckHoriz();
- if (w->viewport.allowvert && preferred.height > clip_height) {
- if (!needsvert) {
- Widget bar;
- needsvert = True;
- if ((bar = w->viewport.vert_bar) == NULL)
- bar = CreateScrollbar(w, False);
- clip_width -= XtWidth(bar) + XtBorderWidth(bar);
- if (clip_width < 1)
- clip_width = 1;
- CheckHoriz();
- }
- intended.height = preferred.height;
- }
- if (!w->viewport.allowhoriz || preferred.width < clip_width) {
- intended.width = clip_width;
- intended.request_mode |= CWWidth;
- }
- if (!w->viewport.allowvert || preferred.height < clip_height) {
- intended.height = clip_height;
- intended.request_mode |= CWHeight;
- }
- } while (intended.request_mode != prev_mode
- || (intended.request_mode & CWWidth
- && intended.width != prev_width)
- || (intended.request_mode & CWHeight
- && intended.height != prev_height));
- }
-
- if (XtIsRealized(clip))
- XRaiseWindow(XtDisplay(clip), XtWindow(clip));
-
- XtMoveWidget(clip,
- needsvert ? w->viewport.useright ? 0 :
- XtWidth(w->viewport.vert_bar)
- + XtBorderWidth(w->viewport.vert_bar) : 0,
- needshoriz ? w->viewport.usebottom ? 0 :
- XtHeight(w->viewport.horiz_bar)
- + XtBorderWidth(w->viewport.horiz_bar) : 0);
- XtResizeWidget(clip, clip_width, clip_height, 0);
-
- if (w->viewport.horiz_bar != NULL) {
- Widget bar = w->viewport.horiz_bar;
-
- if (!needshoriz) {
- constraints->form.vert_base = NULL;
- if (destroy_scrollbars) {
- XtDestroyWidget(bar);
- w->viewport.horiz_bar = NULL;
- }
- }
- else {
- int bw = XtBorderWidth(bar);
-
- XtResizeWidget(bar, clip_width, XtHeight(bar), bw);
- XtMoveWidget(bar,
- needsvert && !w->viewport.useright
- ? XtWidth(w->viewport.vert_bar) : -bw,
- w->viewport.usebottom
- ? XtHeight(w) - XtHeight(bar) - bw : -bw);
- XtSetMappedWhenManaged(bar, True);
- }
- }
-
- if (w->viewport.vert_bar != NULL) {
- Widget bar = w->viewport.vert_bar;
-
- if (!needsvert) {
- constraints->form.horiz_base = NULL;
- if (destroy_scrollbars) {
- XtDestroyWidget(bar);
- w->viewport.vert_bar = NULL;
- }
- }
- else {
- int bw = bar->core.border_width;
-
- XtResizeWidget(bar, XtWidth(bar), clip_height, bw);
- XtMoveWidget(bar,
- w->viewport.useright
- ? XtWidth(w) - XtWidth(bar) - bw : -bw,
- needshoriz && !w->viewport.usebottom
- ? XtHeight(w->viewport.horiz_bar) : -bw);
- XtSetMappedWhenManaged(bar, True);
- }
- }
-
- if (child != NULL) {
- XtResizeWidget(child, intended.width, intended.height, 0);
- MoveChild(w, needshoriz ? XtX(child) : 0, needsvert ? XtY(child) : 0);
- }
-
- SendReport (w, XawPRAll);
-}
-
-/*
- * Function:
- * ComputeWithForceBars
- *
- * Parameters:
- * widget - viewport widget
- * query - whether or not to query the child
- * intended - cache of the childs height is stored here
- * (used and returned)
- * clip_width - size of clip window (used and returned)
- * clip_height - ""
- *
- * Description:
- * Computes the layout give forcebars is set.
- */
-static void
-ComputeWithForceBars(Widget widget, Bool query, XtWidgetGeometry *intended,
- int *clip_width, int *clip_height)
-{
- ViewportWidget w = (ViewportWidget)widget;
- Widget child = w->viewport.child;
- XtWidgetGeometry preferred;
-
- /*
- * If forcebars then needs = allows = has
- * Thus if needsvert is set it MUST have a scrollbar
- */
- if (w->viewport.allowvert) {
- if (w->viewport.vert_bar == NULL)
- w->viewport.vert_bar = CreateScrollbar(w, False);
-
- *clip_width -= XtWidth(w->viewport.vert_bar) +
- XtBorderWidth(w->viewport.vert_bar);
- }
-
- if (w->viewport.allowhoriz) {
- if (w->viewport.horiz_bar == NULL)
- w->viewport.horiz_bar = CreateScrollbar(w, True);
-
- *clip_height -= XtHeight(w->viewport.horiz_bar) +
- XtBorderWidth(w->viewport.horiz_bar);
- }
-
- AssignMax(*clip_width, 1);
- AssignMax(*clip_height, 1);
-
- if (!w->viewport.allowvert) {
- intended->height = *clip_height;
- intended->request_mode = CWHeight;
- }
- if (!w->viewport.allowhoriz) {
- intended->width = *clip_width;
- intended->request_mode = CWWidth;
- }
-
- if (query) {
- if (w->viewport.allowvert || w->viewport.allowhoriz) {
- XtQueryGeometry(child, intended, &preferred);
-
- if (!(intended->request_mode & CWWidth))
- if (preferred.request_mode & CWWidth)
- intended->width = preferred.width;
- else
- intended->width = XtWidth(child);
-
- if (!(intended->request_mode & CWHeight))
- if (preferred.request_mode & CWHeight)
- intended->height = preferred.height;
- else
- intended->height = XtHeight(child);
- }
- }
- else {
- if (w->viewport.allowvert)
- intended->height = XtHeight(child);
- if (w->viewport.allowhoriz)
- intended->width = XtWidth(child);
- }
-
- if (*clip_width > (int)intended->width)
- intended->width = *clip_width;
- if (*clip_height > (int)intended->height)
- intended->height = *clip_height;
-}
-
-static void
-XawViewportResize(Widget widget)
-{
- ComputeLayout(widget, True, True);
-}
-
-/*ARGSUSED*/
-static Boolean
-Layout(FormWidget w, unsigned int width, unsigned int height, Bool force)
-{
- ComputeLayout((Widget)w, True, True);
- w->form.preferred_width = XtWidth(w);
- w->form.preferred_height = XtHeight(w);
-
- return (False);
-}
-
-static void
-ScrollUpDownProc(Widget widget, XtPointer closure, XtPointer call_data)
-{
- ViewportWidget w = (ViewportWidget)closure;
- Widget child = w->viewport.child;
- int pix = (int)call_data;
- int x, y;
-
- if (child == NULL)
- return;
-
- x = XtX(child) - (widget == w->viewport.horiz_bar ? pix : 0);
- y = XtY(child) - (widget == w->viewport.vert_bar ? pix : 0);
- MoveChild(w, x, y);
-}
-
-/*ARGSUSED*/
-static void
-ThumbProc(Widget widget, XtPointer closure, XtPointer call_data)
-{
- ViewportWidget w = (ViewportWidget)closure;
- Widget child = w->viewport.child;
- float percent = *(float *)call_data;
- int x, y;
-
- if (child == NULL)
- return;
-
- if (widget == w->viewport.horiz_bar)
- x = -percent * XtWidth(child);
- else
- x = XtX(child);
-
- if (widget == w->viewport.vert_bar)
- y = -percent * XtHeight(child);
- else
- y = XtY(child);
-
- MoveChild(w, x, y);
-}
-
-static XtGeometryResult
-TestSmaller(ViewportWidget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply_return)
-{
- if (request->width < XtWidth(w) || request->height < XtHeight(w))
- return (XtMakeGeometryRequest((Widget)w, request, reply_return));
-
- return (XtGeometryYes);
-}
-
-static XtGeometryResult
-GeometryRequestPlusScrollbar(ViewportWidget w, Bool horizontal,
- XtWidgetGeometry *request,
- XtWidgetGeometry *reply_return)
-{
- Widget sb;
- XtWidgetGeometry plusScrollbars;
-
- plusScrollbars = *request;
- if ((sb = w->viewport.horiz_bar) == NULL)
- sb = CreateScrollbar(w, horizontal);
- request->width += XtWidth(sb);
- request->height += XtHeight(sb);
- XtDestroyWidget(sb);
- return (XtMakeGeometryRequest((Widget)w, &plusScrollbars, reply_return));
-}
-
-#define WidthChange() (request->width != XtWidth(w))
-#define HeightChange() (request->height != XtHeight(w))
-static XtGeometryResult
-QueryGeometry(ViewportWidget w, XtWidgetGeometry *request,
- XtWidgetGeometry *reply_return)
-{
- if (w->viewport.allowhoriz && w->viewport.allowvert)
- return (TestSmaller(w, request, reply_return));
-
- else if (w->viewport.allowhoriz && !w->viewport.allowvert) {
- if (WidthChange() && !HeightChange())
- return (TestSmaller(w, request, reply_return));
- else if (!WidthChange() && HeightChange())
- return (XtMakeGeometryRequest((Widget)w, request, reply_return));
- else if (WidthChange() && HeightChange())
- return (GeometryRequestPlusScrollbar(w, True, request, reply_return));
- else /* !WidthChange() && !HeightChange() */
- return (XtGeometryYes);
- }
- else if (!w->viewport.allowhoriz && w->viewport.allowvert) {
- if (!WidthChange() && HeightChange())
- return (TestSmaller(w, request, reply_return));
- else if (WidthChange() && !HeightChange())
- return (XtMakeGeometryRequest((Widget)w, request, reply_return));
- else if (WidthChange() && HeightChange())
- return (GeometryRequestPlusScrollbar(w, False, request, reply_return));
- else /* !WidthChange() && !HeightChange() */
- return (XtGeometryYes);
- }
- else /* (!w->viewport.allowhoriz && !w->viewport.allowvert) */
- return (XtMakeGeometryRequest((Widget)w, request, reply_return));
-}
-#undef WidthChange
-#undef HeightChange
-
-static XtGeometryResult
-XawViewportGeometryManager(Widget child, XtWidgetGeometry *request,
- XtWidgetGeometry *reply)
-{
- ViewportWidget w = (ViewportWidget)child->core.parent;
- Bool rWidth = (request->request_mode & CWWidth) != 0;
- Bool rHeight = (request->request_mode & CWHeight) != 0;
- XtWidgetGeometry allowed;
- XtGeometryResult result;
- Bool reconfigured;
- Bool child_changed_size;
- unsigned int height_remaining;
-
- if (request->request_mode & XtCWQueryOnly)
- return (QueryGeometry(w, request, reply));
-
- if (child != w->viewport.child
- || request->request_mode & ~(CWWidth | CWHeight | CWBorderWidth)
- || ((request->request_mode & CWBorderWidth)
- && request->border_width > 0))
- return (XtGeometryNo);
-
- allowed = *request;
-
- reconfigured = GetGeometry((Widget)w,
- rWidth ? request->width : XtWidth(w),
- rHeight ? request->height : XtHeight(w));
-
- child_changed_size = (rWidth && XtWidth(child) != request->width) ||
- (rHeight && XtHeight(child) != request->height);
-
- height_remaining = XtHeight(w);
- if (rWidth && XtWidth(w) != request->width) {
- if (w->viewport.allowhoriz && request->width > XtWidth(w)) {
- /* horizontal scrollbar will be needed so possibly reduce height */
- Widget bar;
-
- if ((bar = w->viewport.horiz_bar) == NULL)
- bar = CreateScrollbar(w, True);
- height_remaining -= XtHeight(bar) + XtBorderWidth(bar);
- reconfigured = True;
- }
- else
- allowed.width = XtWidth(w);
- }
- if (rHeight && height_remaining != request->height) {
- if (w->viewport.allowvert && request->height > height_remaining) {
- /* vertical scrollbar will be needed, so possibly reduce width */
- if (!w->viewport.allowhoriz || request->width < XtWidth(w)) {
- Widget bar;
-
- if ((bar = w->viewport.vert_bar) == NULL)
- bar = CreateScrollbar(w, False);
- if (!rWidth) {
- allowed.width = XtWidth(w);
- allowed.request_mode |= CWWidth;
- }
- if (allowed.width > XtWidth(bar) + XtBorderWidth(bar))
- allowed.width -= XtWidth(bar) + XtBorderWidth(bar);
- else
- allowed.width = 1;
- reconfigured = True;
- }
- }
- else
- allowed.height = height_remaining;
- }
-
- if (allowed.width != request->width || allowed.height != request->height) {
- *reply = allowed;
- result = XtGeometryAlmost;
- }
- else {
- if (rWidth)
- XtWidth(child) = request->width;
- if (rHeight)
- XtHeight(child) = request->height;
- result = XtGeometryYes;
- }
-
- if (reconfigured || child_changed_size)
- ComputeLayout((Widget)w, False, result == XtGeometryYes);
-
- return (result);
-}
-
-static Bool
-GetGeometry(Widget w, unsigned int width, unsigned int height)
-{
- XtWidgetGeometry geometry, return_geom;
- XtGeometryResult result;
-
- if (width == XtWidth(w) && height == XtHeight(w))
- return (False);
-
- geometry.request_mode = CWWidth | CWHeight;
- geometry.width = width;
- geometry.height = height;
-
- if (XtIsRealized(w)) {
- if (((ViewportWidget)w)->viewport.allowhoriz && width > XtWidth(w))
- geometry.width = XtWidth(w);
- if (((ViewportWidget)w)->viewport.allowvert && height > XtHeight(w))
- geometry.height = XtHeight(w);
- }
- else {
- /* This is the Realize call; we'll inherit a w&h iff none currently */
- if (XtWidth(w) != 0) {
- if (XtHeight(w) != 0)
- return (False);
- geometry.width = XtWidth(w);
- }
- if (XtHeight(w) != 0)
- geometry.height = XtHeight(w);
- }
-
- result = XtMakeGeometryRequest(w, &geometry, &return_geom);
- if (result == XtGeometryAlmost)
- result = XtMakeGeometryRequest(w, &return_geom, NULL);
-
- return (result == XtGeometryYes);
-}
-
-static XtGeometryResult
-XawViewportQueryGeometry(Widget w, XtWidgetGeometry *constraints,
- XtWidgetGeometry *reply)
-{
- if (((ViewportWidget)w)->viewport.child != NULL)
- return (XtQueryGeometry(((ViewportWidget)w)->viewport.child,
- constraints, reply));
-
- return (XtGeometryYes);
-}
-
-void
-XawViewportSetLocation
-(
- Widget gw,
-#if NeedWidePrototypes
- double xoff, double yoff
-#else
- float xoff, float yoff
-#endif
- )
-{
- ViewportWidget w = (ViewportWidget)gw;
- Widget child = w->viewport.child;
- int x, y;
-
- if (xoff > 1.0) /* scroll to right */
- x = XtWidth(child);
- else if (xoff < 0.0) /* if the offset is < 0.0 nothing */
- x = XtX(child);
- else
- x = (float)XtWidth(child) * xoff;
-
- if (yoff > 1.0)
- y = XtHeight(child);
- else if (yoff < 0.0)
- y = XtY(child);
- else
- y = (float)XtHeight(child) * yoff;
-
- MoveChild (w, -x, -y);
-}
-
-void
-XawViewportSetCoordinates(Widget gw,
-#if NeedWidePrototypes
- int x, int y
-#else
- Position x, Position y
-#endif
-)
-{
- ViewportWidget w = (ViewportWidget)gw;
- Widget child = w->viewport.child;
-
- if (x > XtWidth(child))
- x = XtWidth(child);
- else if (x < 0)
- x = XtX(child);
-
- if (y > XtHeight(child))
- y = XtHeight(child);
- else if (y < 0)
- y = XtY(child);
-
- MoveChild (w, -x, -y);
-}
diff --git a/xc/lib/Xaw/Viewport.h b/xc/lib/Xaw/Viewport.h
deleted file mode 100644
index c01e456bf..000000000
--- a/xc/lib/Xaw/Viewport.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $TOG: Viewport.h /main/24 1998/02/06 12:53:14 kaleb $ */
-
-/************************************************************
-
-Copyright 1987, 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.
-
-
-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/lib/Xaw/Viewport.h,v 1.5 1999/05/03 12:15:47 dawes Exp $ */
-
-#ifndef _XawViewport_h
-#define _XawViewport_h
-
-#include <X11/Xaw/Form.h>
-#include <X11/Xaw/Reports.h>
-
-/* Resources:
-
- Name Class RepType Default Value
- ---- ----- ------- -------------
- allowHoriz Boolean Boolean False
- allowVert Boolean Boolean False
- background Background Pixel XtDefaultBackground
- border BorderColor Pixel XtDefaultForeground
- borderWidth BorderWidth Dimension 1
- destroyCallback Callback Pointer NULL
- forceBars Boolean Boolean False
- height Height Dimension 0
- mappedWhenManaged MappedWhenManaged Boolean True
- reportCallback ReportCallback Pointer NULL
- sensitive Sensitive Boolean True
- useBottom Boolean Boolean False
- useRight Boolean Boolean False
- width Width Dimension 0
- x Position Position 0
- y Position Position 0
-
-*/
-
-#ifndef _XtStringDefs_h_
-#define XtNforceBars "forceBars"
-#define XtNallowHoriz "allowHoriz"
-#define XtNallowVert "allowVert"
-#define XtNuseBottom "useBottom"
-#define XtNuseRight "useRight"
-#endif
-
-extern WidgetClass viewportWidgetClass;
-
-typedef struct _ViewportClassRec *ViewportWidgetClass;
-typedef struct _ViewportRec *ViewportWidget;
-
-_XFUNCPROTOBEGIN
-
-void XawViewportSetLocation
-(
- Widget gw,
-#if NeedWidePrototypes
- double xoff,
- double yoff
-#else
- float xoff,
- float yoff
-#endif
- );
-
-void XawViewportSetCoordinates
-(
- Widget gw,
-#if NeedWidePrototypes
- int x,
- int y
-#else
- Position x,
- Position y
-#endif
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XawViewport_h */
diff --git a/xc/lib/Xaw/ViewportP.h b/xc/lib/Xaw/ViewportP.h
deleted file mode 100644
index c138822d6..000000000
--- a/xc/lib/Xaw/ViewportP.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * $TOG: ViewportP.h /main/15 1998/02/06 12:53:02 kaleb $
- * Private declarations for ViewportWidgetClass
- */
-
-/************************************************************
-
-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/lib/Xaw/ViewportP.h,v 1.6 1999/06/20 08:41:12 dawes Exp $ */
-
-#ifndef _ViewportP_h
-#define _ViewportP_h
-
-#include <X11/Xaw/Viewport.h>
-#include <X11/Xaw/FormP.h>
-
-typedef struct {
- XtPointer extension;
-} ViewportClassPart;
-
-typedef struct _ViewportClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
- FormClassPart form_class;
- ViewportClassPart viewport_class;
-} ViewportClassRec;
-
-extern ViewportClassRec viewportClassRec;
-
-typedef struct _ViewportPart {
- /* resources */
- Boolean forcebars; /* Whether we should always display
- the selected scrollbars */
- Boolean allowhoriz; /* Whether we allow horizontal scrollbars */
- Boolean allowvert; /* Whether we allow vertical scrollbars */
- Boolean usebottom; /* True if horiz bars appear at bottom */
- Boolean useright; /* True if vert bars appear at right */
- XtCallbackList report_callbacks;/* when size/position changes */
-
- /* private */
- Widget clip, child; /* The clipping and (scrolled) child widgets */
- Widget horiz_bar, vert_bar; /* What scrollbars we currently have */
-#ifndef OLDXAW
- XtPointer pad[4]; /* for future use and keep binary compatability */
-#endif
-} ViewportPart;
-
-typedef struct _ViewportRec {
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
- FormPart form;
- ViewportPart viewport;
-} ViewportRec;
-
-typedef struct {
- Bool reparented; /* True if child has been re-parented */
-} ViewportConstraintsPart;
-
-typedef struct _ViewportConstraintsRec {
- FormConstraintsPart form;
- ViewportConstraintsPart viewport;
-} ViewportConstraintsRec, *ViewportConstraints;
-
-#endif /* _ViewportP_h */
diff --git a/xc/lib/Xaw/Xaw-def.cpp b/xc/lib/Xaw/Xaw-def.cpp
deleted file mode 100644
index cbb5f3c7b..000000000
--- a/xc/lib/Xaw/Xaw-def.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-LIBRARY Xaw
-VERSION LIBRARY_VERSION
-EXPORTS
- asciiSinkClassRec DATA
- asciiSinkObjectClass DATA
- asciiSrcClassRec DATA
- asciiSrcObjectClass DATA
- asciiTextClassRec DATA
- asciiTextWidgetClass DATA
- boxClassRec DATA
- boxWidgetClass DATA
- commandClassRec DATA
- commandWidgetClass DATA
- dialogClassRec DATA
- dialogWidgetClass DATA
- FMT8BIT DATA
- formClassRec DATA
- formWidgetClass DATA
- gripClassRec DATA
- gripWidgetClass DATA
- labelClassRec DATA
- labelWidgetClass DATA
- listClassRec DATA
- listWidgetClass DATA
- menuButtonClassRec DATA
- menuButtonWidgetClass DATA
- multiSinkClassRec DATA
- multiSinkObjectClass DATA
- multiSrcClassRec DATA
- multiSrcObjectClass DATA
- panedClassRec DATA
- panedWidgetClass DATA
- pannerClassRec DATA
- pannerWidgetClass DATA
- portholeClassRec DATA
- portholeWidgetClass DATA
- repeaterClassRec DATA
- repeaterWidgetClass DATA
- scrollbarClassRec DATA
- scrollbarWidgetClass DATA
- simpleClassRec DATA
- simpleMenuClassRec DATA
- simpleMenuWidgetClass DATA
- simpleWidgetClass DATA
- smeBSBClassRec DATA
- smeBSBObjectClass DATA
- smeClassRec DATA
- smeLineClassRec DATA
- smeLineObjectClass DATA
- smeObjectClass DATA
- stripChartClassRec DATA
- stripChartWidgetClass DATA
- textClassRec DATA
- textSinkClassRec DATA
- textSinkObjectClass DATA
- textSrcClassRec DATA
- textSrcObjectClass DATA
- textWidgetClass DATA
- toggleClassRec DATA
- toggleWidgetClass DATA
- treeClassRec DATA
- treeWidgetClass DATA
- vendorShellClassRec DATA
- vendorShellWidgetClass DATA
- viewportClassRec DATA
- viewportWidgetClass DATA
- XawAsciiSave
- XawAsciiSaveAsFile
- XawAsciiSourceChanged
- XawAsciiSourceFreeString
- XawDialogAddButton
- XawDialogGetValueString
- XawFmt8Bit
- XawFmtWide
- XawFormDoLayout
- XawInitializeWidgetSet
- XawListChange
- XawListHighlight
- XawListShowCurrent
- XawListUnhighlight
- XawPanedAllowResize
- XawPanedGetMinMax
- XawPanedGetNumSub
- XawPanedSetMinMax
- XawPanedSetRefigureMode
- XawScrollbarSetThumb
- XawSimpleMenuAddGlobalActions
- XawSimpleMenuClearActiveEntry
- XawSimpleMenuGetActiveEntry
- XawTextDisableRedisplay
- XawTextDisplay
- XawTextDisplayCaret
- XawTextEnableRedisplay
- XawTextGetInsertionPoint
- XawTextGetSelectionPos
- XawTextGetSource
- XawTextInvalidate
- XawTextReplace
- XawTextSearch
- XawTextSetInsertionPoint
- XawTextSetSelection
- XawTextSetSelectionArray
- XawTextSetSource
- XawTextSinkClearToBackground
- XawTextSinkDisplayText
- XawTextSinkFindDistance
- XawTextSinkFindPosition
- XawTextSinkGetCursorBounds
- XawTextSinkInsertCursor
- XawTextSinkMaxHeight
- XawTextSinkMaxLines
- XawTextSinkResolve
- XawTextSinkSetTabs
- XawTextSourceConvertSelection
- XawTextSourceRead
- XawTextSourceReplace
- XawTextSourceScan
- XawTextSourceSearch
- XawTextSourceSetSelection
- XawTextTopPosition
- XawTextUnsetSelection
- XawToggleChangeRadioGroup
- XawToggleGetCurrent
- XawToggleSetCurrent
- XawToggleUnsetCurrent
- XawTreeForceLayout
- xawvendorShellExtClassRec
- XawVendorShellExtResize
- xawvendorShellExtWidgetClass
- XawViewportSetCoordinates
- XawViewportSetLocation
- XawWidgetArray
- XawWidgetCount
-/* $TOG: Xaw-def.cpp /main/1 1997/09/16 10:04:41 kaleb $ */
diff --git a/xc/lib/Xaw/Xaw.man b/xc/lib/Xaw/Xaw.man
deleted file mode 100644
index ff21215f8..000000000
--- a/xc/lib/Xaw/Xaw.man
+++ /dev/null
@@ -1,555 +0,0 @@
-.\"
-.\" Copyright (c) 1999 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 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.
-.\"
-.\" Author: Paulo César Pereira de Andrade
-.\"
-.\" $XFree86: xc/lib/Xaw/Xaw.man,v 1.4 1999/06/27 14:07:35 dawes Exp $
-.\"
-.de TQ
-.br
-.ns
-.TP \\$1
-..
-.TH XAW 3 "Version 3.9" "XFree86"
-
-.SH NAME
- XAW \- X Athena Widgets
-
-.SH DESCRIPTION
-.B Xaw
-is a Widget set based on the Xt Intrinsics. This manual page describes the
-XFree86 additions and modifications to the Xaw library, as well as some of
-the common interfaces.
-
-.SH ACTIONS
-All the \fIXaw\fR widgets now have the additional translations
-.B call-proc, declare, get-values
-and \fBset-values\fP. The syntax for these actions is:
-.br
-.I action-name(boolean-expression, arguments)
-.br
-\fBAction-name\fP is one of \fIcall-proc\fP, \fIdeclare\fP,
-\fIget-values\fP or \fIset-values\fP.
-.br
-\fBBoolean-expression\fP is composed with the operators \fI|\fR (or), \fI&\fR
-(and), \fI^\fR (xor), and \fI~\fR (not). The operands can be a variable name,
-that starts with a \fI$\fR; a resource name without the bindings \fI.\fP
-and \fI*\fP; or a constant name, including \fImine\fP (event->xany.window
-== XtWindow(widget)), \fIfaked\fP (event->xany.send_event != 0), \fItrue\fP (1)
-and \fIfalse\fP (0).
-.br
-\fBArguments\fP are self explanatory, when starting with a \fI$\fP they name
-a variable, else, a resource name.
-.TP 8
-.B call-proc
-This action allows the evaluation of a boolean expression, in the first
-parameter, before calling a action procedure. Only if the expression resolves
-to true the procedure is called. Example:
-.br
-.I call-proc("$inside & $pressed", notify)
-.TP 8
-.B declare
-This action, like \fIget-values\fP is used to create new variables, or
-change their value. Example:
-.br
-.I declare(1, $pressed, 1)
-.TP 8
-.B get-values
-This actions allows reading a resource value into a variable.
-Example:
-.br
-.I get-values(1, $fg, foreground, $bg, background)
-.TP 8
-.B set-values
-This action allow setting a resource in the widget. Example:
-.br
-.I set-values(1, foreground, $bg, background, $fg)
-
-.PP
-Sample translation to make a label widget behave like a button:
-.nf
-<Map>: get-values(1, $fg, foreground, $bg, background)\\n\\
-<Btn1Down>: set-values(1, foreground, yellow, background, gray30)\\n\\
-<Btn1Up>: set-values(1, foreground, $fg, background, $bg)
-.fi
-
-.SH DISPLAY LISTS
-All the \fBXaw\fP widgets have now the additional resource \fIdisplayList\fP.
-This resource allows drawing the widget decorations with commands embedded
-in the resource string.
-The displayList resource has the syntax:
-.br
-\fI[class-name:]function-name arguments[[{;\\n}]...]\fP
-.br
-\fBClass-name\fP is any registered set of functions to draw in the widget.
-Currently the only existing class is \fIxlib\fP.
-.br
-\fBFunction-name\fP is the drawing or configuration function to be called,
-described bellow.
-.br
-\fBArguments\fP may be anything suitable to the displayList function being
-called. When the function requires a coordinate, the syntax is
-\fI{+-}<integer>\fP or \fI<integer>/<integer>\fP. Examples:
-.nf
- +0,+0 top, left
- -0,-0 bottom, right
- -+10,-+10 bottom+10, right+10
- +0,1/2 left, vertical-center
-.fi
-
-.TP 8
-.B arc-mode \fPmode
-Sets the arc mode. Accepted parameters are "pieslice" and "chord", that sets
-the arc to ArcPieSlice or ArcChord, respectively. Example:
-.br
-.I arc-mode chord
-.TP 8
-.B bg \fPcolor-spec
-.TQ
-.B background \fPcolor-spec
-Sets the background color. Argument must as valid color specification.
-Example:
-.br
-.I background red
-.TP 8
-.B cap-style \fPstyle
-Sets the cap style. Accepted parameters are "notlast", "butt", "round", and
-"projecting", that sets the cap style to CapNotLast, CapBut, CapRound or
-CapProjecting, respectively. Example:
-.br
-.I cap-style round
-.TP 8
-.B clip-mask \fPpixmap-spec
-Sets the pixmap for the clip mask. Requires a pixmap parameter, as described
-in the \fBPIXMAPS\fP section of this man page. Example:
-.br
-.I clip-mask xlogo11
-.TP 8
-.B clip-origin \fPx,y
-Sets the clip x and y origin. Requires two arguments, a x and y coordinate.
-Example:
-.br
-.I clip-origin 10,10
-.TP 8
-.B clip-rects \fPx1,y1,x2,y2 [...,xn,yn]
-.TQ
-.B clip-rectangles \fPx1,y1,x2,y2 [...,xn,yn]
-Sets a list of rectangles to the clip mask. The number of arguments must be
-a multiple of four. The arguments are coordinates. The parser calculates the
-width and height of the rectangles. Example:
-.br
-.I clip-rects 0,0,10,20, 20,10,30,30
-.TP 8
-.B coord-mode \fPmode
-Changes the coord mode for \fIfill-polygon\fP, \fIdraw-lines\fP, and
-\fIdraw-points\fP. Accepted parameters are "modeorigin" and "previous", that
-sets the coord mode to CoordModeOrigin or CoordModePrevious, respectively.
-Example:
-.br
-.I coord-mode previous
-.TP 8
-.B copy-area \fP{pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy]
-Calls XCopyArea. The character \fI.\fP means copy the window contents,
-pixmap-spec is as defined in the \fIPIXMAPS\fP sction of this manual page.
-\fIX2\fP, and \fIy2\fP are coordinates of the end copy, not the width and
-height; if not defined, the parser calculates it. \fISrc_x\fP and
-\fIsrc_y\fP defaults to zero. Example:
-.br
-.I copy-area Term,10,10
-.TP 8
-.B copy-plane \fP{pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy,plane]
-Calls XCopyPlane. The character \fI.\fP means copy the window contents,
-pixmap-spec is as defined in the \fIPIXMAPS\fP sction of this manual page.
-\fIX2\fP, and \fIy2\fP are coordinates of the end copy, not the width and
-height; if not defined, the parser calculates it. \fISrc_x\fP and
-\fIsrc_y\fP defaults to zero. \fIPlane\fP defaults to one. Example:
-.br
-.I copy-plane star,10,10
-.TP 8
-.B dashes \fPi1[...,in]
-Sets the dashes for line drawing. Accepts up to 127 arguments. Example:
-.br
-.I dashes 3,7 9,10
-.TP 8
-.B draw-arc \fPx1,y1,x2,y2[,start-angle,end-angle]
-Draws an arc. The four first arguments are the rectangle enclosing the arc.
-The two remaining arguments, if any, are the start and end angle, in
-degrees. Example:
-.br
-.I draw-arc +0,+0,-1,-1,0,90
-.TP 8
-.B draw-rect \fPx1,y1,x2,y2
-.TQ
-.B draw-rectangle \fPx1,y1,x2,y2
-Draws a rectangle. Requires four arguments, that are the start and end
-coordinates. Example:
-.br
-.I draw-rect +1,+1,-5,-5
-.TP 8
-.B draw-string \fPx,y,"string"
-Draws a text string. Requires three arguments, a x coordinate, a y
-coordinate and a string. Strings that have white spaces can be quoted with
-the \fI"\fP character, the character \fI\\\fP can also be used, but, you
-need to escape this character twice. Example:
-.br
-\fI draw-string 10,10, "Hello world!"\fP
-.TP 8
-.B exposures \fPboolean
-Sets the graphics exposures in the GC. Allowed parameters are a integer or
-the strings "true", "false", "on" and "off". Example:
-.br
-.I exposures true
-.TP 8
-.B fill-arc \fPx1,y1,x2,y2[,start-angle,end-angle]
-Like \fIdraw-arc\fP, but fills the contents of the arc with the currently
-selected foreground. Example:
-.br
-.I fill-arc +0,+0,-1,-1,0,180
-.TP 8
-.B fill-poly \fPx1,y1 [...,xn,yn]
-.TQ
-.B fill-polygon \fPx1,y1 [...,xn,yn]
-Like \fIdraw-lines\fP, but fills the enclosed polygon and joins the first
-and last point, if they are not at the same position. Example:
-.br
-.I fill-poly +0,+10, +10,+20, +30,+0
-.TP
-.B fill-rect \fPx1,y1,x2,y2
-.TQ
-.B fill-rectangle \fPx1,y1,x2,y2
-Like \fIdraw-rect\fP, but fills the contents of the rectangle with the
-selected foreground color. Example:
-.br
-.I fill-rect +10,+10,-20,-20
-.TP 8
-.B fill-rule \fPrule
-Sets the fill rule. Accepted parameters are "evenodd" and "winding", that
-sets the fill rule to EvenOddRule or WindingRule, respectively. Example:
-.br
-.I
-fill-rule winding
-.TP 8
-.B fill-style \fPstyle
-Sets the fill style. Allowed parameters are "solid", "tiled", "stippled" and
-"opaquestippled", that sets the fill style to FillSolid, FillTiled,
-FillStippled or FillOpaqueStippled, respectively. Example:
-.br
-.I fill-style tiled
-.TP 8
-.B font \fPfont-spec
-Sets the font for text functions. Example:
-.br
-.I font -*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1
-.TP 8
-.B fg \fPcolor-spec
-.TQ
-.B foreground \fPcolor-spec
-Like \fIbackground\fP, but sets the current foreground color. Example:
-.br
-.I foreground blue
-.TP 8
-.B mask
-This command is useful when you want to draw only in the region that really
-needs to be repainted. Requires no arguments.
-.TP 8
-.B function \fPfunction-spec
-Sets the specific GC function. Allowed parameters are "set", "clear", "and",
-"andreverse", "copy", "andinverted", "noop", "xor", "or", "nor", "equiv",
-"invert", "orreverse", "copyinverted" and "nand", that set the function to
-GXset, GXclear, GXand, GXandReverse, GXcopy, GXandInverted, GXnoop, GXxor,
-GXor, GXnor, GXequiv, GXinvert, GXorReverse, GXcopyInverted or GXnand,
-respectively. Example:
-.br
-.I function xor
-.TP 8
-.B join-style \fPstyle
-Sets the join style. Allowed parameters are "miter", "round" and "bevel",
-that sets the join style to JoinMiter, JoinRound and JoinBevel,
-respectively. Example:
-.br
-.I join-style round
-.TP 8
-.B image \fP{pixmap-spec},xs,ys,[xe,ye]
-This function is implemented as a way to quickly compose complex decorations in
-widgets. \fIPixmap-spec\fP is as defined in the \fIPIXMAPS\fP section of this
-manual page, \fIxs\fP and \fIys\fP are the coodinates from where start copying
-the pixmap, \fIxe\fP and \fIye\fP are optional (defaults to xs + pixmap.width
-and ys + pixmap.height respectively). If the pixmap has a mask, the copy is
-masked accordingly. Example:
-.br
-.I image pixmap.xpm,0,0,20,20
-.TP 8
-.B line \fPx1,y1,x2,y2
-.TQ
-.B draw-line \fPx1,y1,x2,y2
-Draws a line with the current foreground color. Require four arguments.
-Example:
-.br
-.I line +0,+0, -1,-1
-.TP 8
-.B line-width \fPinteger
-Allow selecting a different line width for the drawing. Example:
-.br
-.I line-width 2
-.TP 8
-.B line-style \fPstyle
-Sets the line style. Accepted parameters are "solid", "onoffdash" and
-"doubledash", that sets the line style to LineSolid, LineOnOffDash or
-LineDoubleDash, respectively. Example:
-.br
-.I line-style onoffdash
-.TP 8
-.B lines \fPx1,y1,x2,y2 [...,xn,yn]
-.TQ
-.B draw-lines \fPx1,y1,x2,y2 [...,xn,yn]
-Draws a list of lines. Any number of arguments may be supplied. Example:
-.br
-.I lines +0,-1, -1,-1, -1,+0
-.TP 8
-.B paint-string \fPx,y,"string"
-Identical to draw-string, but also uses the background color. Example:
-.br
-\fI paint-string 10,20, "Sample text"\fP
-.TP 8
-.B point \fPx,y
-.TQ
-.B draw-point \fPx,y
-Draws a point. Requires two arguments. Example:
-.br
-.I point +10,+10
-.TP 8
-.B plane-mask \fPinteger
-Allows setting the plane mask. Requires a integer parameter. Example:
-.br
-.I plane-mask -1
-.TP 8
-.B points \fPx1,y1 [...,xn,yn]
-.TQ
-.B draw-points \fPx1,y1 [...,xn,yn]
-Draws a list of points at the specified coordinates. Example:
-.br
-.I points +1,+2, +1,+4, +1,+6
-.TP 8
-.B segments \fPx1,y1,x2,y2 [...,xn,yn]
-.TQ
-.B draw-segments \fPx1,y1,x2,y2 [...,xn,yn]
-Draws a list of segment lines. Number of parameters must be multiple of 4.
-Example:
-.br
-.I segments +1,+2,+1,-3, +2,-2,-3,-2
-.TP 8
-.B shape-mode \fPmode
-Allows setting the shape mode used in \fIfill-polygon\fP. Accepted
-parameters are "complex", "convex" or "nonconvex", that sets the shape mode
-to Complex, Convex or Nonconvex, accordingly. Example:
-.br
-.I shape-mode convex
-.TP 8
-.B stipple \fPpixmap-spec
-Sets the pixmap for the stipple. Requires a pixmap parameter, as described
-in the \fBPIXMAPS\fP section of this man page. Example:
-.br
-.I stipple plaid
-.TP 8
-.B subwindow-mode \fPmode
-Sets the subwindow mode in the GC. Accepted parameters are
-"includeinferiors" and "clipbychildren", that sets the subwindow mode to
-IncludeInferiors or ClipByChildren, respectively. Example:
-.br
-.I subwindow-mode includeinferiors
-.TP 8
-.B tile \fPpixmap-spec
-Sets the pixmap for the tile. Requires a pixmap parameter, as described in
-the \fBPIXMAPS\fP section of this man page. Example:
-.br
-.I tile xlogo11?foreground=red&background=gray80
-.TP 8
-.B ts-origin \fPx,y
-Sets the tile stipple x and y origin. Requires two arguments, a x and y
-coordinate. Example:
-.br
-.I ts-origin 10,10
-.TP 8
-.B umask
-Disables the gc mask, when it was set with the command \fImask\fP. Requires
-no arguments.
-
-.PP
-Example for drawing a shadow effect in a widget:
-.nf
-foreground gray30;\\
-draw-lines +1,-1,-1,-1,-1,+1;\\
-foreground gray85;\\
-draw-lines -1,+0,+0,+0,+0,-1
-.fi
-
-.SH PIXMAPS
-A String to Pixmap converter was added to \fBXaw\fP. This converter is meant to
-be extended, and has enough abstraction to allow loading several image formats.
-It uses a format that resembles a \fIURL\fP, with the syntax:
-.br
-.I [type:]name[?arg=val[{&}...]]
-.br
-\fBType\fP actually can be one of \fIbitmap\fP, \fIgradient\fP or \fIxpm\fP.
-.br
-\fBName\fP may be a file name, or, in the case of type \fIgradient\fP, may be
-either \fIvertical\fP or \fIhorizontal\fP.
-.br
-\fBArg=val\fP is a list of arguments to the converter. The most common arguments
-are \fIforeground\fP and \fIbackground\fP. Gradients supports also the arguments
-\fIstart\fP and \fIend\fP (colors to start and end the gradient); the
-\fPsteps\fP argument, to allow using less colors; and the \fIsize\fP argument
-to specify the size of the gradient. The \fIxpm\fP converter understands the
-\fIcloseness\fP argument, that helps using less colors (useful if you have a
-limited colormap).
-
-.SH TEXT WIDGET
-Most of the changes to this version of the Xaw library were done in the
-TextWidget, TextSrcObject, TextSinkObject and related files. The text widget
-is based in the emacs text editor. In this release, the emacs compatibility
-was increased. New text actions include:
-.TP 8
-.B indent
-This action allow indenting text blocks. It is not enabled by default. A
-translation to call this action was added to the \fIxedit\fP editor, binded to
-\fIControl<Key>X,<Key>Tab\fP.
-.TP 8
-.B keyboard-reset
-Resets the keyboard state. Reverts the multiply to 1, and if undo is enabled,
-toggle between undo and redo. Binded by default to \fIControl<Key>G\fP.
-.TP 8
-.B kill-ring-yank
-In this version of Xaw, text killed in any text field is kept in memory,
-allowing to cut and paste internally to the program between text fields.
-The default key binding to this actions is \fIMeta<Key>Y\fP.
-.TP 8
-.B numeric
-Listed here only for purposes of documentation. It is called by default when
-one of the characters \fI1, 2, 3, 4, 5, 6, 7, 8, 9, 0,\fP or \fI-\fP is typed,
-allowing composing the multiplication number of text actions.
-.TP 8
-.B set-keyboard-focus
-This action is normally binded to the \fI<Btn1Down>\fP event. Will set the input
-focus on the top level widget to the text field. Not enabled by default.
-.TP 8
-.B toggle-overwrite
-This action toggles overwrite mode. In overwrite mode, any text inserted in
-a text field will replace existing text. Normally binded to \fI<Key>Insert\fP.
-.TP 8
-.B undo
-Binded by default to \fIControl<Key>_\fP, will call the undo function. Undo is
-not enabled by default. It is enabled setting the \fIenableUndo\fP resource of
-the textSrcObject.
-
-.PP
-The new text resources include:
-.TP 8
-.B justify (\fPClass\fB Justify)
-Sets the text justification. Can be one of \fIleft, right, center\fP or
-\fIfull\fP. Only enabled when the \fIautoFill\fP resource is set, and the
-resources \fIleftColumn\fP and \fIrightColumn\fP are correctly set.
-.TP 8
-.B leftColumn (\fPClass\fB Column)
-Specifies the left column to break text. Text lines started with a alphanumeric
-character will automatically start at this column.
-.TP 8
-.B positionCallback (\fPClass\fB Callback)
-Allows installing a callback that will be called every time the cursor is
-moved and/or the file change its size. The callback is called with a pointer
-containing the following data:
-.nf
-typedef struct {
- int line_number;
- int column_number;
- XawTextPosition insert_position;
- XawTextPosition last_position;
- Boolean overwrite_mode;
-} XawTextPositionInfo;
-.fi
-This callback is intended to help programmers to write text editors based on
-the Xaw widget set.
-.TP 8
-.B rightColumn (\fPClass\fB Column)
-Specifies the right column to break text. Text lines started with a alphanumeric
-character will automatically end at this column.
-
-.SH TEXT SOURCE OBJECT
-The textSrcObject was modified to allow showing its contents in more than one
-window, and also store undo information. The new resources for the textSrcObject
-are:
-.TP 8
-.B callback (\fPClass\fB Callback)
-Previous versions of Xaw had this resource in the subclasses. This was changed
-to make it possible to tell the callback the state of the text, when undo is
-enabled.
-.TP 8
-.B enableUndo (\fPClass\fB Undo)
-A boolean resource, that enables or disables the undo function. The default
-value is False.
-.TP 8
-.B sourceChanged (\fPClass\fB Changed)
-Like the callback resource, it was on the subclasses on previous versions. Now
-it is in the textSrcObject to control the changed/unchanged state, when undo
-is enabled.
-
-.SH TEXT SINK OBJECT
-The textSinkObject subclasses asciiSinkObject and multiSinkObject were slightly
-changed to offer a new cursor shape, that indicates the input focus of the
-text widget and allow setting its color. The new resource is:
-.TP 8
-.B cursorColor (\fPClass\fB Color)
-Allows setting the cursor color of the text. This color is also used to draw
-selected text.
-
-.SH SIMPLE MENU WIDGET
-The simpleMenuWidget algorithm to lay out menu entries was changed to
-enable multiple columns when one single column does not fit in the screen.
-It was also modified to enable sub menus.
-
-.SH SME BSB OBJECT
-A new resource was added to the smeBSBObject, to allow binding sub menus to
-it. The new resource is:
-.TP 8
-.B menuName (\fPClass\fB MenuName)
-The name of the popup widget to be popped up when the pointer is over the
-menu entry, or NULL. Note that the named menu must be a child of the popup
-parent of the smeBSBObject.
-
-.SH RESTRICTIONS
-.B Xaw
-is actually being actively worked. Programs intending to be fully compatible
-with future releases of the Xaw library should use only the public
-interfaces. While widget subclassification is not a bad, and some times
-encouraged programming practice, programs that access private data
-structures may have problems with newer releases, in the current stage of
-the
-.I Xaw
-development. Several efforts are being done to avoid such problems, and, at
-least, guarantee that newer releases will be source and binary compatible.
-
-.SH AUTHORS
-The XFree86 additions and modifications to \fIXaw\fR, were written by Paulo
-Cesar Pereira de Andrade
diff --git a/xc/lib/Xaw/XawI18n.c b/xc/lib/Xaw/XawI18n.c
deleted file mode 100644
index 5fdd0a3c5..000000000
--- a/xc/lib/Xaw/XawI18n.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $TOG: XawI18n.c /main/7 1998/02/06 12:53:18 kaleb $ */
-
-/* Copyright 1991 NCR Corporation - Dayton, Ohio, USA */
-
-/*
- * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
- * and Nippon Telegraph and Telephone Corporation
- *
- * 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, and NTT
- * not be used in advertising or publicity pertaining to distribution of the
- * software without specific, written prior permission. OMRON, NTT Software,
- * and NTT 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, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD
- * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT BE
- * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Li Yuhong OMRON Corporation
- */
-
-/*
-
-Copyright 1991, 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/lib/Xaw/XawI18n.c,v 1.6 1999/07/19 13:36:04 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include "XawI18n.h"
-
-wchar_t
-#if NeedWidePrototypes
-_Xaw_atowc(int c)
-#else
-_Xaw_atowc(unsigned char c)
-#endif
-{
- wchar_t wc;
- char str[2];
-
- str[0] = c;
- str[1] = '\0';
-
- mbtowc(&wc, str, 1);
-
- return (wc);
-}
-
-#ifdef NCR
-int
-_Xaw_iswspace(wchar_t w)
-{
- int ret = 0;
- wchar_t s = _Xaw_atowc(' ');
-
- if (s == w)
- ret = 1;
-
- return (ret);
-}
-#endif
-
-int
-_Xaw_iswalnum(wchar_t ch)
-{
- unsigned char mb[sizeof(wchar_t)];
-
- wctomb((char*)mb, ch);
-
- return (isalnum(*mb));
-}
diff --git a/xc/lib/Xaw/XawI18n.h b/xc/lib/Xaw/XawI18n.h
deleted file mode 100644
index 522c18475..000000000
--- a/xc/lib/Xaw/XawI18n.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $TOG: XawI18n.h /main/13 1998/02/06 12:53:23 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.
-
-********************************************************/
-/* $XFree86: xc/lib/Xaw/XawI18n.h,v 3.9 1999/07/19 13:36:04 dawes Exp $ */
-
-#ifdef HAS_WCTYPE_H
-#include <wctype.h>
-#ifndef NO_WIDEC_H
-#include <widec.h>
-#define wcslen(c) wslen(c)
-#define wcscpy(d, s) wscpy(d, s)
-#define wcsncpy(d, s, l) wsncpy(d, s, l)
-#endif
-#endif
-
-#ifdef HAS_WCHAR_H
-#include <wchar.h>
-#endif
-
-#ifdef AIXV3
-#include <ctype.h>
-#endif
-
-#ifdef NCR
-#define iswspace(c) _Xaw_iswspace(c)
-int _Xaw_iswspace
-(
- wchar_t c
- );
-#endif
-
-#ifdef sony
-#ifndef SVR4
-#include <jctype.h>
-#define iswspace(c) jisspace(c)
-#endif
-#endif
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#endif
-
-#ifdef USE_XWCHAR_STRING
-int _Xwcslen
-(
- wchar_t *wstr
- );
-
-#define wcslen(c) _Xwcslen(c)
-
-wchar_t *_Xwcscpy
-(
- wchar_t *wstr1,
- wchar_t *wstr2
- );
-
-#define wcscpy(d,s) _Xwcscpy(d,s)
-
-wchar_t *_Xwcsncpy
-(
- wchar_t *wstr1,
- wchar_t *wstr2,
- int len
- );
-
-#define wcsncpy(d, s, l) _Xwcsncpy(d, s, l)
-
-#ifdef USE_XMBTOWC
-#define mbtowc(wc, s, l) _Xmbtowc(wc, s, l)
-#endif
-#endif
-
-wchar_t _Xaw_atowc
-(
-#if NeedWidePrototypes
- int c
-#else
- unsigned char c
-#endif
- );
-
-#ifndef HAS_ISW_FUNCS
-#include <ctype.h>
-#ifndef iswspace
-#define iswspace(c) (isascii(c) && isspace(toascii(c)))
-#endif
-#endif
-
-#ifndef iswalnum
-#define iswalnum(c) _Xaw_iswalnum(c)
-int _Xaw_iswalnum
-(
- wchar_t c
- );
-#endif
diff --git a/xc/lib/Xaw/XawIm.c b/xc/lib/Xaw/XawIm.c
deleted file mode 100644
index 5f6ca9343..000000000
--- a/xc/lib/Xaw/XawIm.c
+++ /dev/null
@@ -1,1611 +0,0 @@
-/* $TOG: XawIm.c /main/12 1998/04/21 07:40:26 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. OMRON makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Author: Seiji Kuwari OMRON Corporation
- * kuwa@omron.co.jp
- * kuwa%omron.co.jp@uunet.uu.net
- */
-
-
-/*
-
-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.
-
-*/
-/* $XFree86: xc/lib/Xaw/XawIm.c,v 1.9 1999/03/21 07:34:32 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
-#include <X11/ShellP.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/MultiSrc.h>
-#include <X11/Xaw/MultiSinkP.h>
-#include <X11/Xaw/XawImP.h>
-#include <X11/Xaw/VendorEP.h>
-#include "XawI18n.h"
-#include <ctype.h>
-
-#if NeedVarargsPrototypes
-# include <stdarg.h>
-# define Va_start(a,b) va_start(a,b)
-#else
-# include <varargs.h>
-# define Va_start(a,b) va_start(a)
-#endif
-
-#define maxAscentOfFontSet(fontset) \
- ( - (XExtentsOfFontSet((fontset)))->max_logical_extent.y)
-
-#define maxHeightOfFontSet(fontset) \
- ((XExtentsOfFontSet((fontset)))->max_logical_extent.height)
-
-#define maxDescentOfFontSet(fontset) \
- (maxHeightOfFontSet(fontset) - maxAscentOfFontSet(fontset))
-
-#define Offset(field) (XtOffsetOf(XawIcTablePart, field))
-
-/*****************************************************
- *
- * Forward reference prototypes
- *
- *****************************************************/
-
-#define SetVaArg(arg, value) (*((XtPointer *)arg) = (XtPointer)(value))
-
-/*
- * Prototypes
- */
-static void AllCreateIC(XawVendorShellExtPart*);
-static void CloseIM(XawVendorShellExtPart*);
-static void CompileResourceList(XtResourceList, unsigned int);
-static void ConfigureCB(Widget, XtPointer, XEvent*, Boolean*);
-static void CreateIC(Widget, XawVendorShellExtPart*);
-static XawIcTableList CreateIcTable(Widget, XawVendorShellExtPart*);
-static XawIcTableList CurrentSharedIcTable(XawVendorShellExtPart*);
-static void Destroy(Widget, XawVendorShellExtPart*);
-static void DestroyAllIM(XawVendorShellExtPart*);
-static void DestroyIC(Widget, XawVendorShellExtPart*);
-static void FreeAllDataOfVendorShell(XawVendorShellExtPart*,
- VendorShellWidget);
-static XawVendorShellExtPart *GetExtPart(VendorShellWidget);
-static XawIcTableList GetIcTable(Widget, XawVendorShellExtPart*);
-static XawIcTableList GetIcTableShared(Widget, XawVendorShellExtPart*);
-static XIMStyle GetInputStyleOfIC(XawVendorShellExtPart*);
-static Bool Initialize(VendorShellWidget, XawVendorShellExtPart*);
-static Bool IsCreatedIC(Widget, XawVendorShellExtPart*);
-static Bool IsRegistered(Widget, XawVendorShellExtPart*);
-static Bool IsSharedIC(XawVendorShellExtPart*);
-static Bool NoRegistered(XawVendorShellExtPart*);
-static void OpenIM(XawVendorShellExtPart*);
-static void Reconnect(XawVendorShellExtPart*);
-static void Register(Widget, XawVendorShellExtPart*);
-static Bool RegisterToVendorShell(Widget, XawVendorShellExtPart*);
-static void ResizeVendorShell(VendorShellWidget, XawVendorShellExtPart*);
-static Bool ResizeVendorShell_Core(VendorShellWidget, XawVendorShellExtPart*,
- XawIcTableList);
-static VendorShellWidget SearchVendorShell(Widget);
-static Widget SetErrCnxt(Widget, XIM);
-static XawVendorShellExtPart *SetExtPart(VendorShellWidget,
- XawVendorShellExtWidget);
-static void SetFocus(Widget, XawVendorShellExtPart*);
-static void SetFocusValues(Widget, ArgList, Cardinal, Bool);
-static void SetICFocus(Widget, XawVendorShellExtPart*);
-static void SetICValues(Widget, XawVendorShellExtPart*, Bool);
-static void SetICValuesShared(Widget, XawVendorShellExtPart*, XawIcTableList,
- Bool);
-static void SetValues(Widget, XawVendorShellExtPart*, ArgList, Cardinal);
-static unsigned int SetVendorShellHeight(XawVendorShellExtPart*,
- unsigned int);
-static void SharedICChangeFocusWindow(Widget, XawVendorShellExtPart*,
- XawIcTableList);
-static void SizeNegotiation(XawIcTableList, unsigned int, unsigned int);
-static void Unregister(Widget, XawVendorShellExtPart*);
-static void UnregisterFromVendorShell(Widget, XawVendorShellExtPart*);
-static void UnsetFocus(Widget);
-static void UnsetICFocus(Widget, XawVendorShellExtPart*);
-static void VendorShellDestroyed(Widget, XtPointer, XtPointer);
-
-/*
- * From Vendor.c
- */
-void XawVendorShellExtResize(Widget);
-void XawVendorStructureNotifyHandler(Widget, XtPointer, XEvent*, Boolean*);
-
-
-/*
- * From Xt/Resources.c
- */
-void _XtCopyFromArg(XtArgVal src, char*, unsigned int);
-
-static XtResource resources[] =
-{
- {
- XtNfontSet, XtCFontSet, XtRFontSet, sizeof(XFontSet),
- Offset (font_set), XtRString, XtDefaultFontSet
- },
- {
- XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
- Offset (foreground), XtRString, (XtPointer)"XtDefaultForeground"
- },
- {
- XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel),
- Offset (background), XtRString, (XtPointer)"XtDefaultBackground"
- },
- {
- XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
- Offset (bg_pixmap), XtRImmediate, (XtPointer) XtUnspecifiedPixmap
- },
- {
- XtNinsertPosition, XtCTextPosition, XtRInt, sizeof (XawTextPosition),
- Offset (cursor_position), XtRImmediate, (XtPointer) 0
- }
-};
-#undef Offset
-
-
-static VendorShellWidget SearchVendorShell( w )
- Widget w;
-{
- while(w && !XtIsShell(w)) w = XtParent(w);
- if (w && XtIsVendorShell(w)) return((VendorShellWidget)w);
- return(NULL);
-}
-
-static XContext extContext = (XContext)NULL;
-
-static XawVendorShellExtPart *
-SetExtPart(VendorShellWidget w, XawVendorShellExtWidget vew)
-{
- contextDataRec *contextData;
-
- if (extContext == (XContext)NULL) extContext = XUniqueContext();
-
- contextData = XtNew(contextDataRec);
- contextData->parent = (Widget)w;
- contextData->ve = (Widget)vew;
- if (XSaveContext(XtDisplay(w), (Window)w, extContext, (char *)contextData)) {
- return(NULL);
- }
- return(&(vew->vendor_ext));
-}
-
-static XawVendorShellExtPart *
-GetExtPart(VendorShellWidget w)
-{
- contextDataRec *contextData;
- XawVendorShellExtWidget vew;
-
- if (XFindContext(XtDisplay(w), (Window)w, extContext,
- (XPointer*)&contextData)) {
- return(NULL);
- }
- vew = (XawVendorShellExtWidget)contextData->ve;
- return(&(vew->vendor_ext));
-}
-
-static Bool
-IsSharedIC(XawVendorShellExtPart * ve)
-{
- return( ve->ic.shared_ic );
-}
-
-static XawIcTableList
-GetIcTableShared(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- for (p = ve->ic.ic_table; p; p = p->next) {
- if (p->widget == w) {
- if (IsSharedIC(ve)) {
- return(ve->ic.shared_ic_table);
- } else {
- return(p);
- }
- }
- }
- return(NULL);
-}
-
-static XawIcTableList
-GetIcTable(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- for (p = ve->ic.ic_table; p; p = p->next) {
- if (p->widget == w) {
- return(p);
- }
- }
- return(NULL);
-}
-
-static XIMStyle
-GetInputStyleOfIC(XawVendorShellExtPart *ve)
-{
-
- if (!ve) return((XIMStyle)0);
- return(ve->ic.input_style);
-}
-
-/*ARGSUSED*/
-static void
-ConfigureCB(Widget w, XtPointer closure, XEvent *event, Boolean *unused)
-{
- XawIcTableList p;
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
- XVaNestedList pe_attr;
- XRectangle pe_area;
- XawTextMargin *margin;
-
- if (event->type != ConfigureNotify) return;
-
- if ((vw = SearchVendorShell(w)) == NULL) return;
-
- if ((ve = GetExtPart(vw)) != NULL) {
- if (IsSharedIC(ve)) return;
- if ((ve->im.xim == NULL) ||
- ((p = GetIcTableShared(w, ve)) == NULL) ||
- (p->xic == NULL) || !(p->input_style & XIMPreeditPosition)) return;
- pe_area.x = 0;
- pe_area.y = 0;
- pe_area.width = w->core.width;
- pe_area.height = w->core.height;
- margin = &(((TextWidget)w)->text.margin);
- pe_area.x += margin->left;
- pe_area.y += margin->top;
- pe_area.width -= (margin->left + margin->right - 1);
- pe_area.height -= (margin->top + margin->bottom - 1);
-
- pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
- XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
- XtFree(pe_attr);
- }
-}
-
-static XContext errContext = (XContext)NULL;
-
-static Widget SetErrCnxt(Widget w, XIM xim)
-{
- contextErrDataRec *contextErrData;
-
- if (errContext == (XContext)NULL) errContext = XUniqueContext();
-
- contextErrData = XtNew(contextErrDataRec);
- contextErrData->widget = w;
- contextErrData->xim = xim;
- if (XSaveContext(XtDisplay(w), (Window)xim, errContext,
- (char *)contextErrData)) {
- return(NULL);
- }
- return(contextErrData->widget);
-}
-
-#if 0
-static Widget
-GetErrCnxt(XIM error_im)
-{
- contextErrDataRec *contextErrData;
-
- if (XFindContext(XDisplayOfIM(error_im), (Window)error_im, errContext,
- (XPointer*)&contextErrData)) {
- return(NULL);
- }
- return(contextErrData->widget);
-}
-#endif
-
-static void
-CloseIM(XawVendorShellExtPart *ve)
-{
- if (ve->im.xim)
- XCloseIM(ve->im.xim);
-}
-
-static unsigned int
-SetVendorShellHeight(XawVendorShellExtPart* ve, unsigned int height)
-{
- Arg args[2];
- Cardinal i = 0;
-
- if (ve->im.area_height < height || height == 0) {
- XtSetArg(args[i], XtNheight,
- (ve->parent->core.height + height - ve->im.area_height));
- ve->im.area_height = height;
- XtSetValues(ve->parent, args, 1);
- }
- return(ve->im.area_height);
-}
-
-static void
-DestroyAllIM(XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
- contextErrDataRec *contextErrData;
-
- /*
- * Destory all ICs
- */
- if (IsSharedIC(ve)) {
- if ((p = ve->ic.shared_ic_table) && p->xic) {
- DestroyIC(p->widget, ve);
- p->xic = NULL;
- p->ic_focused = FALSE;
- }
- } else {
- for (p = ve->ic.ic_table; p; p = p->next) {
- if (p->xic == NULL) continue;
- DestroyIC(p->widget, ve);
- p->xic = NULL;
- p->ic_focused = FALSE;
- }
- }
- if (!ve->im.xim) return;
- /*
- * Close Input Method
- */
- CloseIM(ve);
- if (!XFindContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext,
- (XPointer*)&contextErrData)) {
- if (contextErrData) XtFree((char *)contextErrData);
- }
- XDeleteContext(XDisplayOfIM(ve->im.xim), (Window)ve->im.xim, errContext);
- ve->im.xim = NULL;
-
- /*
- * resize vendor shell to core size
- */
- (void) SetVendorShellHeight(ve, 0);
- /*
- XawVendorShellExtResize(vw);
- */
- return;
-}
-
-static void
-FreeAllDataOfVendorShell(XawVendorShellExtPart *ve, VendorShellWidget vw)
-{
- XawIcTableList p, next;
- contextErrDataRec *contextErrData;
-
- if (!XFindContext(XtDisplay(vw), (Window)vw, extContext,
- (XPointer*)&contextErrData)) {
- if (contextErrData) XtFree((char *)contextErrData);
- }
- XDeleteContext(XtDisplay(vw), (Window)vw, extContext);
- if (ve->ic.shared_ic_table)
- XtFree((char *)ve->ic.shared_ic_table);
- if (ve->im.resources) XtFree((char *)ve->im.resources);
- for (p = ve->ic.ic_table; p; p = next) {
- next = p->next;
- XtFree((char *)p);
- }
-}
-
-static void
-VendorShellDestroyed(Widget w, XtPointer cl_data, XtPointer ca_data)
-{
- XawVendorShellExtPart *ve;
-
- if ( ( ve = GetExtPart( (VendorShellWidget) w ) ) == NULL ) return;
- DestroyAllIM( ve );
- FreeAllDataOfVendorShell( ve, (VendorShellWidget) w );
- return;
-}
-
-#if 0
-static int
-IOErrorHandler(XIM error_im)
-{
- VendorShellWidget vw;
- XawVendorShellExtPart * ve;
-
- if ((vw = (VendorShellWidget)GetErrCnxt(error_im)) == NULL
- || (ve = GetExtPart(vw)) == NULL) return(0);
-
- DestroyAllIM(ve);
- return(0);
-}
-#endif
-
-/*
- * Attempt to open an input method
- */
-
-static void
-OpenIM(XawVendorShellExtPart *ve)
-{
- int i;
- char *p, *s, *ns, *end, *pbuf, buf[32];
- XIM xim = NULL;
- XIMStyles *xim_styles;
- XIMStyle input_style = 0;
- Boolean found;
-
- if (ve->im.open_im == False) return;
- ve->im.xim = NULL;
- if (ve->im.input_method == NULL) {
- if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p)
- xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL);
- } else {
- /* no fragment can be longer than the whole string */
- Cardinal len = strlen (ve->im.input_method) + 5;
-
- if (len < sizeof buf) pbuf = buf;
- else pbuf = XtMalloc (len);
-
- if (pbuf == NULL) return;
-
- for(ns=s=ve->im.input_method; ns && *s;) {
- /* skip any leading blanks */
- while (*s && isspace(*s)) s++;
- if (!*s) break;
- if ((ns = end = strchr(s, ',')) == NULL)
- end = s + strlen(s);
- /* If there is a spurious comma end can be the same as s */
- if (end > s) {
- /* strip any trailing blanks */
- while (isspace(*(end - 1))) end--;
-
- strcpy (pbuf, "@im=");
- strncat (pbuf, s, end - s);
- pbuf[end - s + 4] = '\0';
- }
-
- if ((p = XSetLocaleModifiers(pbuf)) != NULL && *p
- && (xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL)) != NULL)
- break;
-
- s = ns + 1;
- }
-
- if (pbuf != buf) XtFree (pbuf);
- }
- if (xim == NULL) {
- if ((p = XSetLocaleModifiers("")) != NULL) {
- xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL);
- }
- }
- if (xim == NULL) {
- XtAppWarning(XtWidgetToApplicationContext(ve->parent),
- "Input Method Open Failed");
- return;
- }
- if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL)
- || !xim_styles) {
- XtAppWarning(XtWidgetToApplicationContext(ve->parent),
- "input method doesn't support any style");
- XCloseIM(xim);
- return;
- }
- found = False;
- for(ns = s = ve->im.preedit_type; s && !found;) {
- while (*s && isspace(*s)) s++;
- if (!*s) break;
- if ((ns = end = strchr(s, ',')) == NULL)
- end = s + strlen(s);
- else
- ns++;
- if (end > s)
- while (isspace(*(end - 1))) end--;
-
- if (!strncmp(s, "OverTheSpot", end - s)) {
- input_style = (XIMPreeditPosition | XIMStatusArea);
- } else if (!strncmp(s, "OffTheSpot", end - s)) {
- input_style = (XIMPreeditArea | XIMStatusArea);
- } else if (!strncmp(s, "Root", end - s)) {
- input_style = (XIMPreeditNothing | XIMStatusNothing);
- }
- for (i = 0; (unsigned short)i < xim_styles->count_styles; i++)
- if (input_style == xim_styles->supported_styles[i]) {
- ve->ic.input_style = input_style;
- SetErrCnxt(ve->parent, xim);
- ve->im.xim = xim;
- found = True;
- break;
- }
-
- s = ns;
- }
- XFree(xim_styles);
-
- if (!found) {
- XCloseIM(xim);
- XtAppWarning(XtWidgetToApplicationContext(ve->parent),
- "input method doesn't support my input style");
- }
-}
-
-static Bool
-ResizeVendorShell_Core(VendorShellWidget vw, XawVendorShellExtPart *ve,
- XawIcTableList p)
-{
- XVaNestedList pe_attr, st_attr;
- XRectangle pe_area, st_area;
- XRectangle *get_pe_area = NULL, *get_st_area = NULL;
-
- st_area.width = 0;
- if (p->input_style & XIMStatusArea) {
- st_attr = XVaCreateNestedList(0, XNArea, &get_st_area, NULL);
- XGetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
- XFree(st_attr);
- if (p->xic == NULL) {
- return(FALSE);
- }
- st_area.x = 0;
- st_area.y = vw->core.height - ve->im.area_height;
- st_area.width = get_st_area->width;
- st_area.height = get_st_area->height;
- XFree(get_st_area);
- st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
- XSetICValues(p->xic, XNStatusAttributes, st_attr, NULL);
- XFree(st_attr);
- if (p->xic == NULL) {
- return(FALSE);
- }
- }
- if (p->input_style & XIMPreeditArea) {
- pe_attr = XVaCreateNestedList(0, XNArea, &get_pe_area, NULL);
- XGetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
- XFree(pe_attr);
- if (p->xic == NULL) {
- return(FALSE);
- }
- pe_area.x = st_area.width;
- pe_area.y = vw->core.height - ve->im.area_height;
- pe_area.width = vw->core.width;
- pe_area.height = get_pe_area->height;
- if (p->input_style & XIMStatusArea) {
- pe_area.width -= st_area.width;
- }
- XFree(get_pe_area);
- pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
- XSetICValues(p->xic, XNPreeditAttributes, pe_attr, NULL);
- XFree(pe_attr);
- }
- return(TRUE);
-}
-
-static void
-ResizeVendorShell(VendorShellWidget vw, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- if (IsSharedIC(ve)) {
- p = ve->ic.shared_ic_table;
- if (p->xic == NULL) return;
- ResizeVendorShell_Core(vw, ve, p);
- return;
- }
- for (p = ve->ic.ic_table; p; p = p->next) {
- if (p->xic == NULL) continue;
- if (ResizeVendorShell_Core(vw, ve, p) == FALSE) return;
- }
-}
-
-static XawIcTableList
-CreateIcTable(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList table;
-
- table = (XawIcTableList) XtMalloc(sizeof(XawIcTablePart));
- if (table == NULL) return(NULL);
- table->widget = w;
- table->xic = NULL;
- table->flg = table->prev_flg = 0;
- table->font_set = NULL;
- table->foreground = table->background = 0xffffffff;
- table->bg_pixmap = 0;
- table->cursor_position = 0xffff;
- table->line_spacing = 0;
- table->ic_focused = FALSE;
- table->openic_error = FALSE;
- return(table);
-}
-
-static Bool
-RegisterToVendorShell(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList table;
-
- if ((table = CreateIcTable(w, ve)) == NULL) return(FALSE);
- table->next = ve->ic.ic_table;
- ve->ic.ic_table = table;
- return(TRUE);
-}
-
-static void
-UnregisterFromVendorShell(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList *prev, p;
-
- for (prev = &ve->ic.ic_table; (p = *prev) != NULL; prev = &p->next) {
- if (p->widget == w) {
- *prev = p->next;
- XtFree((char *)p);
- break;
- }
- }
- return;
-}
-
-static void
-SetICValuesShared(Widget w, XawVendorShellExtPart *ve,
- XawIcTableList p, Bool check)
-{
- XawIcTableList pp;
-
- if ((pp = GetIcTable(w, ve)) == NULL) return;
- if (check == TRUE && CurrentSharedIcTable(ve) != pp) return;
-
- if (pp->prev_flg & CICursorP && p->cursor_position != pp->cursor_position) {
- p->cursor_position = pp->cursor_position;
- p->flg |= CICursorP;
- }
- if (pp->prev_flg & CIFontSet && p->font_set != pp->font_set) {
- p->font_set = pp->font_set;
- p->flg |= (CIFontSet|CICursorP);
- }
- if (pp->prev_flg & CIFg && p->foreground != pp->foreground) {
- p->foreground = pp->foreground;
- p->flg |= CIFg;
- }
- if (pp->prev_flg & CIBg && p->background != pp->background) {
- p->background = pp->background;
- p->flg |= CIBg;
- }
- if (pp->prev_flg & CIBgPixmap && p->bg_pixmap != pp->bg_pixmap) {
- p->bg_pixmap = pp->bg_pixmap;
- p->flg |= CIBgPixmap;
- }
- if (pp->prev_flg & CILineS && p->line_spacing != pp->line_spacing) {
- p->line_spacing = pp->line_spacing;
- p->flg |= CILineS;
- }
-}
-
-static Bool
-IsCreatedIC(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- if (ve->im.xim == NULL) return(FALSE);
- if ((p = GetIcTableShared(w, ve)) == NULL) return(FALSE);
- if (p->xic == NULL) return(FALSE);
- return(TRUE);
-}
-
-static void
-SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height)
-{
- XRectangle pe_area, st_area;
- XVaNestedList pe_attr = NULL, st_attr = NULL;
- int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
- XRectangle *pe_area_needed = NULL, *st_area_needed = NULL;
- XPointer ic_a[5];
-
- if (p->input_style & XIMPreeditArea) {
- pe_attr = XVaCreateNestedList(0, XNAreaNeeded, &pe_area_needed, NULL);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
- }
- if (p->input_style & XIMStatusArea) {
- st_attr = XVaCreateNestedList(0, XNAreaNeeded, &st_area_needed, NULL);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
- }
- SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
-
- if (ic_cnt > 0) {
- XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]);
- if (pe_attr) XFree(pe_attr);
- if (st_attr) XFree(st_attr);
- if (p->xic == NULL) {
- p->openic_error = True;
- return;
- }
- pe_attr = st_attr = NULL;
- ic_cnt = pe_cnt = st_cnt = 0;
- if (p->input_style & XIMStatusArea) {
- st_area.height = st_area_needed->height;
- st_area.x = 0;
- st_area.y = height - st_area.height;
- if (p->input_style & XIMPreeditArea) {
- st_area.width = st_area_needed->width;
- } else {
- st_area.width = width;
- }
-
- XFree(st_area_needed);
- st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
- }
- if (p->input_style & XIMPreeditArea) {
- if (p->input_style & XIMStatusArea) {
- pe_area.x = st_area.width;
- pe_area.width = width - st_area.width;
- } else {
- pe_area.x = 0;
- pe_area.width = width;
- }
- pe_area.height = pe_area_needed->height;
- XFree(pe_area_needed);
- pe_area.y = height - pe_area.height;
- pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
- }
- SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
- XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4]);
- if (pe_attr) XFree(pe_attr);
- if (st_attr) XFree(st_attr);
- if (p->xic == NULL) {
- p->openic_error = True;
- return;
- }
- }
-}
-
-static void
-CreateIC(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
- XPoint position;
- XRectangle pe_area, st_area;
- XVaNestedList pe_attr = NULL, st_attr = NULL;
- XPointer ic_a[20], pe_a[20], st_a[20];
- Dimension height = 0;
- int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
- XawTextMargin *margin;
-
- if (!XtIsRealized(w)) return;
- if (((ve->im.xim == NULL) || (p = GetIcTableShared(w, ve)) == NULL) ||
- p->xic || (p->openic_error != FALSE)) return;
-
- p->input_style = GetInputStyleOfIC(ve);
-
- if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, FALSE);
- XFlush(XtDisplay(w));
-
- if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) {
- if (p->flg & CIFontSet) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++;
- height = maxAscentOfFontSet(p->font_set)
- + maxDescentOfFontSet(p->font_set);
- height = SetVendorShellHeight(ve, height);
- }
- if (p->flg & CIFg) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNForeground); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->foreground); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNForeground); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->foreground); st_cnt++;
- }
- if (p->flg & CIBg) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackground); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->background); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNBackground); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->background); st_cnt++;
- }
- if (p->flg & CIBgPixmap) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackgroundPixmap); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->bg_pixmap); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNBackgroundPixmap); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->bg_pixmap); st_cnt++;
- }
- if (p->flg & CILineS) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNLineSpace); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->line_spacing); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNLineSpace); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->line_spacing); st_cnt++;
- }
- }
- if (p->input_style & XIMPreeditArea) {
- pe_area.x = 0;
- pe_area.y = ve->parent->core.height - height;
- pe_area.width = ve->parent->core.width;
- pe_area.height = height;
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++;
- }
- if (p->input_style & XIMPreeditPosition) {
- pe_area.x = 0;
- pe_area.y = 0;
- pe_area.width = w->core.width;
- pe_area.height = w->core.height;
- margin = &(((TextWidget)w)->text.margin);
- pe_area.x += margin->left;
- pe_area.y += margin->top;
- pe_area.width -= (margin->left + margin->right - 1);
- pe_area.height -= (margin->top + margin->bottom - 1);
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++;
- if (p->flg & CICursorP) {
- _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
- } else {
- position.x = position.y = 0;
- }
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNSpotLocation); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) &position); pe_cnt++;
- }
- if (p->input_style & XIMStatusArea) {
- st_area.x = 0;
- st_area.y = ve->parent->core.height - height;
- st_area.width = ve->parent->core.width;
- st_area.height = height;
- SetVaArg( &st_a[st_cnt], (XPointer) XNArea); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) &st_area); st_cnt++;
- }
-
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNInputStyle); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) p->input_style); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNClientWindow); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(ve->parent)); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNFocusWindow); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(w)); ic_cnt++;
-
- if (pe_cnt > 0) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) NULL);
- pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3],
- pe_a[4], pe_a[5], pe_a[6], pe_a[7], pe_a[8],
- pe_a[9], pe_a[10], pe_a[11], pe_a[12],
- pe_a[13], pe_a[14], pe_a[15], pe_a[16],
- pe_a[17], pe_a[18], pe_a[19]);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
- }
-
- if (st_cnt > 0) {
- SetVaArg( &st_a[st_cnt], (XPointer) NULL);
- st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3],
- st_a[4], st_a[5], st_a[6], st_a[7], st_a[8],
- st_a[9], st_a[10], st_a[11], st_a[12],
- st_a[13], st_a[14], st_a[15], st_a[16],
- st_a[17], st_a[18], st_a[19]);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
- }
- SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
-
- p->xic = XCreateIC(ve->im.xim, ic_a[0], ic_a[1], ic_a[2], ic_a[3],
- ic_a[4], ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9],
- ic_a[10], ic_a[11], ic_a[12], ic_a[13], ic_a[14],
- ic_a[15], ic_a[16], ic_a[17], ic_a[18], ic_a[19]);
- if (pe_attr) XtFree(pe_attr);
- if (st_attr) XtFree(st_attr);
-
- if (p->xic == NULL) {
- p->openic_error = True;
- return;
- }
-
- SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height);
-
- p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS);
-
- if (!IsSharedIC(ve)) {
- if (p->input_style & XIMPreeditPosition) {
- XtAddEventHandler(w, (EventMask)StructureNotifyMask, FALSE,
- (XtEventHandler)ConfigureCB, (Opaque)NULL);
- }
- }
-}
-
-static void
-SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus)
-{
- XawIcTableList p;
- XPoint position;
- XRectangle pe_area;
- XVaNestedList pe_attr = NULL, st_attr = NULL;
- XPointer ic_a[20], pe_a[20], st_a[20];
- int ic_cnt = 0, pe_cnt = 0, st_cnt = 0;
- XawTextMargin *margin;
- int height;
-
- if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
- (p->xic == NULL)) return;
-
- if (IsSharedIC(ve)) SetICValuesShared(w, ve, p, TRUE);
- XFlush(XtDisplay(w));
- if (focus == FALSE &&
- !(p->flg & (CIFontSet | CIFg | CIBg |
- CIBgPixmap | CICursorP | CILineS))) return;
-#ifdef SPOT
- if ((p->input_style & XIMPreeditPosition)
- && ((!IsSharedIC(ve) && ((p->flg & ~CIICFocus) == CICursorP))
- || (IsSharedIC(ve) && p->flg == CICursorP))) {
- _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
- _XipChangeSpot(p->xic, position.x, position.y);
- p->flg &= ~CICursorP;
- return;
- }
-#endif
-
- if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) {
- if (p->flg & CIFontSet) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNFontSet); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->font_set); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNFontSet); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->font_set); st_cnt++;
- height = maxAscentOfFontSet(p->font_set)
- + maxDescentOfFontSet(p->font_set);
- height = SetVendorShellHeight(ve, height);
- }
- if (p->flg & CIFg) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNForeground); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->foreground); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNForeground); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->foreground); st_cnt++;
- }
- if (p->flg & CIBg) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackground); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->background); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNBackground); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->background); st_cnt++;
- }
- if (p->flg & CIBgPixmap) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNBackgroundPixmap); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->bg_pixmap); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNBackgroundPixmap); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->bg_pixmap); st_cnt++;
- }
- if (p->flg & CILineS) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNLineSpace); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) p->line_spacing); pe_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) XNLineSpace); st_cnt++;
- SetVaArg( &st_a[st_cnt], (XPointer) p->line_spacing); st_cnt++;
- }
- }
- if (p->input_style & XIMPreeditPosition) {
- if (p->flg & CICursorP) {
- _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y);
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNSpotLocation); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) &position); pe_cnt++;
- }
- }
- if (IsSharedIC(ve)) {
- if (p->input_style & XIMPreeditPosition) {
- pe_area.x = 0;
- pe_area.y = 0;
- pe_area.width = w->core.width;
- pe_area.height = w->core.height;
- margin = &(((TextWidget)w)->text.margin);
- pe_area.x += margin->left;
- pe_area.y += margin->top;
- pe_area.width -= (margin->left + margin->right - 1);
- pe_area.height -= (margin->top + margin->bottom - 1);
- SetVaArg( &pe_a[pe_cnt], (XPointer) XNArea); pe_cnt++;
- SetVaArg( &pe_a[pe_cnt], (XPointer) &pe_area); pe_cnt++;
- }
- }
-
- if (pe_cnt > 0) {
- SetVaArg( &pe_a[pe_cnt], (XPointer) NULL);
- pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3],
- pe_a[4], pe_a[5], pe_a[6], pe_a[7],
- pe_a[8], pe_a[9], pe_a[10], pe_a[11],
- pe_a[12], pe_a[13], pe_a[14], pe_a[15],
- pe_a[16], pe_a[17], pe_a[18], pe_a[19]);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNPreeditAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) pe_attr); ic_cnt++;
- }
- if (st_cnt > 0) {
- SetVaArg( &st_a[st_cnt], (XPointer) NULL);
- st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3],
- st_a[4], st_a[5], st_a[6], st_a[7],
- st_a[8], st_a[9], st_a[10], st_a[11],
- st_a[12], st_a[13], st_a[14], st_a[15],
- st_a[16], st_a[17], st_a[18], st_a[19]);
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNStatusAttributes); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) st_attr); ic_cnt++;
- }
- if (focus == TRUE) {
- SetVaArg( &ic_a[ic_cnt], (XPointer) XNFocusWindow); ic_cnt++;
- SetVaArg( &ic_a[ic_cnt], (XPointer) XtWindow(w)); ic_cnt++;
- }
- if (ic_cnt > 0) {
- SetVaArg( &ic_a[ic_cnt], (XPointer) NULL);
- XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4],
- ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], ic_a[10],
- ic_a[11], ic_a[12], ic_a[13], ic_a[14], ic_a[15],
- ic_a[16], ic_a[17], ic_a[18], ic_a[19]);
- if (pe_attr) XtFree(pe_attr);
- if (st_attr) XtFree(st_attr);
- }
-
- if (IsSharedIC(ve) && p->flg & CIFontSet)
- SizeNegotiation(p, ve->parent->core.width, ve->parent->core.height);
-
- p->flg &= ~(CIFontSet | CIFg | CIBg | CIBgPixmap | CICursorP | CILineS);
-}
-
-static void
-SharedICChangeFocusWindow(Widget w, XawVendorShellExtPart *ve,
- XawIcTableList p)
-{
- XawIcTableList pp;
-
- if (w == NULL) {
- ve->ic.current_ic_table = NULL;
- return;
- }
- if ((pp = GetIcTable(w, ve)) == NULL) return;
- ve->ic.current_ic_table = pp;
- SetICValues(w, ve, TRUE);
-}
-
-static XawIcTableList
-CurrentSharedIcTable(XawVendorShellExtPart *ve)
-{
- return(ve->ic.current_ic_table);
-}
-
-static void
-SetICFocus(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p, pp;
-
- if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
- (p->xic == NULL)) return;
-
- if (IsSharedIC(ve)) {
- pp = CurrentSharedIcTable(ve);
- if (pp == NULL || pp->widget != w) {
- SharedICChangeFocusWindow(w, ve, p);
- }
- }
- if (p->flg & CIICFocus && p->ic_focused == FALSE) {
- p->ic_focused = TRUE;
- XSetICFocus(p->xic);
- }
- p->flg &= ~CIICFocus;
-}
-
-static void
-UnsetICFocus(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p, pp;
-
- if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
- (p->xic == NULL)) return;
-
- if (IsSharedIC(ve) && (pp = CurrentSharedIcTable(ve))) {
- if (pp->widget != w) {
- return;
- }
- SharedICChangeFocusWindow(NULL, ve, p);
- }
- if (p->ic_focused == TRUE) {
- XUnsetICFocus(p->xic);
- p->ic_focused = FALSE;
- }
-}
-
-static void
-SetValues(Widget w, XawVendorShellExtPart *ve,
- ArgList args, Cardinal num_args)
-{
- ArgList arg;
-
- XrmName argName;
- XrmResourceList xrmres;
- Cardinal i;
- XawIcTablePart *p, save_tbl;
-
- if ((p = GetIcTable(w, ve)) == NULL) return;
-
- memcpy(&save_tbl, p, sizeof(XawIcTablePart));
-
- for (arg = args ; num_args != 0; num_args--, arg++) {
- argName = XrmStringToName(arg->name);
- for (xrmres = (XrmResourceList)ve->im.resources, i = 0;
- i < ve->im.num_resources; i++, xrmres++) {
- if (argName == xrmres->xrm_name) {
- _XtCopyFromArg(arg->value,
- (char *)p - xrmres->xrm_offset - 1,
- xrmres->xrm_size);
- break;
- }
- }
- }
- if (p->font_set != save_tbl.font_set) {
- p->flg |= CIFontSet;
- }
- if (p->foreground != save_tbl.foreground) {
- p->flg |= CIFg;
- }
- if (p->background !=save_tbl.background) {
- p->flg |= CIBg;
- }
- if (p->bg_pixmap != save_tbl.bg_pixmap) {
- p->flg |= CIBgPixmap;
- }
- if (p->cursor_position != save_tbl.cursor_position) {
- p->flg |= CICursorP;
- }
- if (p->line_spacing != save_tbl.line_spacing) {
- p->flg |= CILineS;
- }
- p->prev_flg |= p->flg;
-}
-
-static void
-SetFocus(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
- if ((p = GetIcTableShared(w, ve)) == NULL) return;
-
- if ( p->ic_focused == FALSE || IsSharedIC(ve)) {
- p->flg |= CIICFocus;
- }
- p->prev_flg |= p->flg;
-}
-
-static void
-DestroyIC(Widget w, XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) ||
- (p->xic == NULL)) return;
- if (IsSharedIC(ve)) {
- if (GetIcTable(w, ve) == ve->ic.current_ic_table) {
- UnsetICFocus(w, ve);
- }
- return;
- }
- XDestroyIC(p->xic);
- if (!IsSharedIC(ve)) {
- if (p->input_style & XIMPreeditPosition) {
- XtRemoveEventHandler(w, (EventMask)StructureNotifyMask, FALSE,
- (XtEventHandler)ConfigureCB, (Opaque)NULL);
- }
- }
-}
-
-static void
-SetFocusValues(Widget inwidg, ArgList args, Cardinal num_args, Bool focus)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
-
- if ((vw = SearchVendorShell(inwidg)) == NULL) return;
- if ((ve = GetExtPart(vw)) != NULL) {
- if (num_args > 0) SetValues(inwidg, ve, args, num_args);
- if (focus) SetFocus(inwidg, ve);
- if (XtIsRealized((Widget)vw) && ve->im.xim) {
- if (IsCreatedIC(inwidg, ve)) {
- SetICValues(inwidg, ve, FALSE);
- if (focus) SetICFocus(inwidg, ve);
- } else {
- CreateIC(inwidg, ve);
- SetICFocus(inwidg, ve);
- }
- }
- }
-}
-
-static void
-UnsetFocus(Widget inwidg)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
- XawIcTableList p;
-
- if ((vw = SearchVendorShell(inwidg)) == NULL) return;
- if ((ve = GetExtPart(vw)) != NULL) {
- if ((p = GetIcTableShared(inwidg, ve)) == NULL) return;
- if (p->flg & CIICFocus) {
- p->flg &= ~CIICFocus;
- }
- p->prev_flg &= ~CIICFocus;
- if (ve->im.xim && XtIsRealized((Widget)vw) && p->xic) {
- UnsetICFocus(inwidg, ve);
- }
- }
-}
-
-static Bool
-IsRegistered(Widget w, XawVendorShellExtPart* ve)
-{
- XawIcTableList p;
-
- for (p = ve->ic.ic_table; p; p = p->next)
- {
- if (p->widget == w) return(TRUE);
- }
- return(FALSE);
-}
-
-static void
-Register(Widget inwidg, XawVendorShellExtPart* ve)
-{
- if (ve->im.xim == NULL)
- {
- OpenIM(ve);
- }
-
- if (IsRegistered(inwidg, ve)) return;
-
- if (RegisterToVendorShell(inwidg, ve) == FALSE) return;
-
- if (ve->im.xim == NULL) return;
-
- if (XtIsRealized(ve->parent))
- {
- CreateIC(inwidg, ve);
- SetICFocus(inwidg, ve);
- }
-}
-
-static Bool
-NoRegistered(XawVendorShellExtPart* ve)
-{
- if (ve->ic.ic_table == NULL) return(TRUE);
- return(FALSE);
-}
-
-static void
-Unregister(Widget inwidg, XawVendorShellExtPart *ve)
-{
- if (!IsRegistered(inwidg, ve)) return;
-
- DestroyIC(inwidg, ve);
-
- UnregisterFromVendorShell(inwidg, ve);
-
- if (NoRegistered(ve))
- {
- CloseIM(ve);
- ve->im.xim = NULL;
- /*
- * resize vendor shell to core size
- */
- (void) SetVendorShellHeight(ve, 0);
- }
-}
-
-static void
-AllCreateIC(XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- if (ve->im.xim == NULL) return;
- if (IsSharedIC(ve) && ve->ic.ic_table[0].widget) {
- p = ve->ic.shared_ic_table;
- if (p->xic == NULL)
- CreateIC(ve->ic.ic_table[0].widget, ve);
- SetICFocus(ve->ic.ic_table[0].widget, ve);
- return;
- }
- for (p = ve->ic.ic_table; p; p = p->next) {
- if (p->xic == NULL)
- CreateIC(p->widget, ve);
- }
- for (p = ve->ic.ic_table; p; p = p->next) {
- SetICFocus(p->widget, ve);
- }
-}
-
-
-static void
-Reconnect(XawVendorShellExtPart *ve)
-{
- XawIcTableList p;
-
- ve->im.open_im = True;
- if (ve->im.xim == NULL) {
- OpenIM(ve);
- }
- if (ve->im.xim == NULL) return;
-
- if (IsSharedIC(ve)) {
- p = ve->ic.shared_ic_table;
- p->flg = p->prev_flg;
- p->openic_error = FALSE;
- } else {
- for (p = ve->ic.ic_table; p; p = p->next) {
- p->flg = p->prev_flg;
- p->openic_error = FALSE;
- }
- }
- AllCreateIC(ve);
-}
-
-
-static void
-CompileResourceList(XtResourceList res, unsigned int num_res)
-{
- unsigned int count;
-
-#define xrmres ((XrmResourceList) res)
- for (count = 0; count < num_res; res++, count++) {
- xrmres->xrm_name = XrmPermStringToQuark(res->resource_name);
- xrmres->xrm_class = XrmPermStringToQuark(res->resource_class);
- xrmres->xrm_type = XrmPermStringToQuark(res->resource_type);
- xrmres->xrm_offset = -res->resource_offset - 1;
- xrmres->xrm_default_type = XrmPermStringToQuark(res->default_type);
- }
-#undef xrmres
-}
-
-static Bool
-Initialize(VendorShellWidget vw, XawVendorShellExtPart *ve)
-{
- if (!XtIsVendorShell((Widget)vw)) return(FALSE);
- ve->parent = (Widget)vw;
- ve->im.xim = NULL;
- ve->im.area_height = 0;
- ve->im.resources = (XrmResourceList)XtMalloc(sizeof(resources));
- if (ve->im.resources == NULL) return(FALSE);
- memcpy((char *)ve->im.resources, (char *)resources, sizeof(resources));
- ve->im.num_resources = XtNumber(resources);
- CompileResourceList( (XtResourceList) ve->im.resources,
- ve->im.num_resources );
- if ((ve->ic.shared_ic_table = CreateIcTable( (Widget)vw, ve)) == NULL)
- return(FALSE);
- ve->ic.current_ic_table = NULL;
- ve->ic.ic_table = NULL;
- return(TRUE);
-}
-
-
-/* Destroy()
- *
- * This frees all (most?) of the resources malloced by XawIm.
- * It is called by _XawImDestroy, which is called by Vendor.c's
- * VendorExt's Destroy method. Sheeran, Omron KK, 93/08/05 */
-
-static void
-Destroy(Widget w, XawVendorShellExtPart *ve)
-{
- contextDataRec *contextData;
- contextErrDataRec *contextErrData;
-
- if (!XtIsVendorShell( w ) )
- return;
- XtFree( (char*) ve->im.resources );
-
- if (extContext != (XContext)NULL &&
- !XFindContext (XtDisplay (w), (Window)w,
- extContext, (XPointer*)&contextData))
- XtFree( (char*) contextData );
-
- if (errContext != (XContext)NULL &&
- !XFindContext (XDisplayOfIM( ve->im.xim ), (Window) ve->im.xim,
- errContext, (XPointer*) &contextErrData))
- XtFree( (char*) contextErrData );
-}
-
-/*********************************************
- *
- * SEMI-PRIVATE FUNCTIONS
- * For use by other Xaw modules
- *
- ********************************************/
-
-void
-_XawImResizeVendorShell(Widget w)
-{
- XawVendorShellExtPart *ve;
-
- if ( ( ve = GetExtPart( (VendorShellWidget) w ) ) && ve->im.xim ) {
- ResizeVendorShell( (VendorShellWidget) w, ve );
- }
-}
-
-
-Dimension
-_XawImGetShellHeight(Widget w)
-{
- XawVendorShellExtPart *ve;
-
- if (!XtIsVendorShell( w ) ) return( w->core.height );
- if ( (ve = GetExtPart( (VendorShellWidget) w )) != NULL ) {
- return( w->core.height - ve->im.area_height );
- }
- return( w->core.height );
-}
-
-void
-_XawImRealize(Widget w)
-{
- XawVendorShellExtPart *ve;
-
- if ( !XtIsRealized( w ) || !XtIsVendorShell( w ) ) return;
- if ( (ve = GetExtPart( (VendorShellWidget) w )) != NULL ) {
- XtAddEventHandler( w, (EventMask)StructureNotifyMask, FALSE,
- XawVendorStructureNotifyHandler, (XtPointer)NULL );
- AllCreateIC(ve);
- }
-}
-
-void
-_XawImInitialize(Widget w, Widget ext)
-{
- XawVendorShellExtPart *ve;
-
- if ( !XtIsVendorShell( w ) ) return;
- if ( (ve = SetExtPart( (VendorShellWidget) w, (XawVendorShellExtWidget)ext )) != NULL ) {
- if ( Initialize( (VendorShellWidget) w, ve ) == FALSE ) return;
- XtAddCallback( w, XtNdestroyCallback, VendorShellDestroyed,
- (XtPointer) NULL );
- }
-}
-
-void
-_XawImReconnect(Widget inwidg)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
-
- if ((vw = SearchVendorShell(inwidg)) == NULL) return;
- if ((ve = GetExtPart(vw)) != NULL) {
- Reconnect(ve);
- }
-}
-
-void
-_XawImRegister(Widget inwidg)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
-
- if ((vw = SearchVendorShell(inwidg)) == NULL) return;
- if ((ve = GetExtPart(vw)) != NULL) {
- Register(inwidg, ve);
- }
-}
-
-void
-_XawImUnregister(Widget inwidg)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
-
- if ((vw = SearchVendorShell(inwidg)) == NULL) return;
- if ((ve = GetExtPart(vw)) != NULL) {
- Unregister(inwidg, ve);
- }
-}
-
-void
-_XawImSetValues(Widget inwidg, ArgList args, Cardinal num_args)
-{
- SetFocusValues( inwidg, args, num_args, FALSE );
-}
-
-void
-_XawImSetFocusValues(Widget inwidg, ArgList args, Cardinal num_args)
-{
- SetFocusValues(inwidg, args, num_args, TRUE);
-}
-
-void
-_XawImUnsetFocus(Widget inwidg)
-{
- UnsetFocus(inwidg);
-}
-
-int
-_XawImWcLookupString(Widget inwidg, XKeyPressedEvent *event,
- wchar_t* buffer_return, int bytes_buffer,
- KeySym *keysym_return)
-{
- XawVendorShellExtPart* ve;
- VendorShellWidget vw;
- XawIcTableList p;
- int i, ret;
- char tmp_buf[64], *tmp_p;
- wchar_t* buf_p;
-
- if ((vw = SearchVendorShell(inwidg)) && (ve = GetExtPart(vw)) &&
- ve->im.xim && (p = GetIcTableShared(inwidg, ve)) && p->xic) {
- return(XwcLookupString(p->xic, event, buffer_return, bytes_buffer/sizeof(wchar_t),
- keysym_return, NULL));
- }
- ret = XLookupString( event, tmp_buf, sizeof(tmp_buf), keysym_return,
- NULL );
- for ( i = 0, tmp_p = tmp_buf, buf_p = buffer_return; i < ret; i++ ) {
- *buf_p++ = _Xaw_atowc(*tmp_p++);
- }
- return( ret );
-}
-
-int
-_XawLookupString(Widget w, XKeyEvent *event, char *buffer_return, int buffer_size,
- KeySym *keysym_return)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
- XawIcTableList p;
-
- if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))
- && ve->im.xim && (p = GetIcTableShared(w, ve)) && p->xic)
- return (XmbLookupString(p->xic, event, buffer_return, buffer_size,
- keysym_return, NULL));
-
- return (XLookupString(event, buffer_return, buffer_size,
- keysym_return, NULL));
-}
-
-int
-_XawImGetImAreaHeight(Widget w)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
-
- if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) {
- return(ve->im.area_height);
- }
- return(0);
-}
-
-void
-_XawImCallVendorShellExtResize(Widget w)
-{
- XawVendorShellExtPart *ve;
- VendorShellWidget vw;
-
- if ((vw = SearchVendorShell(w)) && (ve = GetExtPart(vw))) {
- XawVendorShellExtResize((Widget)vw);
- }
-}
-
-
-/* _XawImDestroy()
- *
- * This should be called by the VendorExt from its
- * core Destroy method. Sheeran, Omron KK 93/08/05 */
-
-void
-_XawImDestroy(Widget w, Widget ext)
-{
- XawVendorShellExtPart *ve;
-
- if ( !XtIsVendorShell( w ) ) return;
- if ( (ve = GetExtPart( (VendorShellWidget) w )) != NULL )
- Destroy( w, ve );
-}
diff --git a/xc/lib/Xaw/XawImP.h b/xc/lib/Xaw/XawImP.h
deleted file mode 100644
index ae6901cc6..000000000
--- a/xc/lib/Xaw/XawImP.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* $TOG: XawImP.h /main/8 1998/04/21 09:44:31 kaleb $ */
-
-/*
- * Copyright 1991 by OMRON Corporation
- *
- * 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 OMRON not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. OMRON makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
- * OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Author: Seiji Kuwari OMRON Corporation
- * kuwa@omron.co.jp
- * kuwa%omron.co.jp@uunet.uu.net
- */
-
-/*
-
-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.
-
-*/
-/* $XFree86: xc/lib/Xaw/XawImP.h,v 3.7 1999/03/14 11:17:41 dawes Exp $ */
-
-#ifndef _XawImP_h
-#define _XawImP_h
-
-#define XtNinputMethod "inputMethod"
-#define XtCInputMethod "InputMethod"
-#define XtNpreeditType "preeditType"
-#define XtCPreeditType "PreeditType"
-#define XtNopenIm "openIm"
-#define XtCOpenIm "OpenIm"
-#define XtNsharedIc "sharedIc"
-#define XtCSharedIc "SharedIc"
-
-#include <X11/Xaw/Text.h>
-
-#define CIICFocus (1 << 0)
-#define CIFontSet (1 << 1)
-#define CIFg (1 << 2)
-#define CIBg (1 << 3)
-#define CIBgPixmap (1 << 4)
-#define CICursorP (1 << 5)
-#define CILineS (1 << 6)
-
-typedef struct _XawImPart {
- XIM xim;
- XrmResourceList resources;
- Cardinal num_resources;
- Boolean open_im;
- Boolean initialized;
- Dimension area_height;
- String input_method;
- String preedit_type;
-} XawImPart;
-
-typedef struct _XawIcTablePart {
- Widget widget;
- XIC xic;
- XIMStyle input_style;
- unsigned long flg;
- unsigned long prev_flg;
- Boolean ic_focused;
- XFontSet font_set;
- Pixel foreground;
- Pixel background;
- Pixmap bg_pixmap;
- XawTextPosition cursor_position;
- unsigned long line_spacing;
- Boolean openic_error;
- struct _XawIcTablePart *next;
-} XawIcTablePart, *XawIcTableList;
-
-typedef struct _XawIcPart {
- XIMStyle input_style;
- Boolean shared_ic;
- XawIcTableList shared_ic_table;
- XawIcTableList current_ic_table;
- XawIcTableList ic_table;
-} XawIcPart;
-
-typedef struct _contextDataRec {
- Widget parent;
- Widget ve;
-} contextDataRec;
-
-typedef struct _contextErrDataRec {
- Widget widget;
- XIM xim;
-} contextErrDataRec;
-
-void _XawImResizeVendorShell
-(
- Widget w
- );
-
-Dimension _XawImGetShellHeight
-(
- Widget w
-);
-
-void _XawImRealize
-(
- Widget w
- );
-
-void _XawImInitialize
-(
- Widget w,
- Widget ext
- );
-
-void _XawImReconnect
-(
- Widget w
- );
-
-void _XawImRegister
-(
- Widget w
- );
-
-void _XawImUnregister
-(
- Widget w
- );
-
-void _XawImSetValues
-(
- Widget w,
- ArgList args,
- Cardinal num_args
- );
-
-void _XawImSetFocusValues
-(
- Widget w,
- ArgList args,
- Cardinal num_args
-);
-
-void _XawImUnsetFocus
-(
- Widget w
- );
-
-int _XawImWcLookupString
-(
- Widget w,
- XKeyPressedEvent *event,
- wchar_t *buffer_return,
- int bytes_buffer,
- KeySym *keysym_return
- );
-
-int _XawLookupString
-(
- Widget w,
- XKeyEvent *event,
- char *buffer_return,
- int buffer_size,
- KeySym *keysym_return
- );
-
-int _XawImGetImAreaHeight
-(
- Widget w
- );
-
-void _XawImCallVendorShellExtResize
-(
- Widget w
- );
-
-void _XawImDestroy
-(
- Widget w,
- Widget ext
- );
-
-#endif /* _XawImP_h */
diff --git a/xc/lib/Xaw/XawInit.c b/xc/lib/Xaw/XawInit.c
deleted file mode 100644
index 7b8a55251..000000000
--- a/xc/lib/Xaw/XawInit.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * $TOG: XawInit.c /main/4 1998/02/06 12:53: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.
- *
- *
- * XawInitializeWidgetSet
- *
- * This routine forces a reference to vendor shell so that the one in this
- * widget is installed. Any other cross-widget set initialization should be
- * done here as well. All Athena widgets should include "XawInit.h" and
- * call this routine from their ClassInitialize procs (this routine may be
- * used as the class init proc).
- */
-/* $XFree86: xc/lib/Xaw/XawInit.c,v 1.8 1999/06/06 08:48:22 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/Vendor.h>
-#include <X11/Xaw/XawInit.h>
-#include "Private.h"
-
-void
-XawInitializeWidgetSet(void)
-{
- static Boolean firsttime = True;
-
- if (firsttime) {
- firsttime = False;
-#ifndef OLDXAW
- XawPixmapsInitialize();
- XawInitializeDefaultConverters();
-#endif
- XtInitializeWidgetClass(vendorShellWidgetClass);
- }
-}
diff --git a/xc/lib/Xaw/XawInit.h b/xc/lib/Xaw/XawInit.h
deleted file mode 100644
index b58996a47..000000000
--- a/xc/lib/Xaw/XawInit.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $TOG: XawInit.h /main/7 1998/02/06 12:53:44 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.
- */
-/* $XFree86: xc/lib/Xaw/XawInit.h,v 1.11 1999/08/28 09:00:29 dawes Exp $ */
-
-#ifndef _XawInit_h
-#define _XawInit_h
-
-#define XawVendor "XFree86"
-
-#ifdef OLDXAW
-#define XawVersion 6700002L
-#else
-#define XawVersion 7000002L
-
-typedef struct _XawDL XawDisplayList;
-#endif /* OLDXAW */
-
-_XFUNCPROTOBEGIN
-
-void XawInitializeWidgetSet(void);
-#ifndef OLDXAW
-void XawInitializeDefaultConverters(void);
-#endif
-
-_XFUNCPROTOEND
-
-#endif /* _XawInit_h */
diff --git a/xc/lib/Xaw/Xawos2.def b/xc/lib/Xaw/Xawos2.def
deleted file mode 100644
index 3d5df1023..000000000
--- a/xc/lib/Xaw/Xawos2.def
+++ /dev/null
@@ -1,193 +0,0 @@
-LIBRARY Xaw INITINSTANCE TERMINSTANCE
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xaw/Xawos2.def,v 3.7 1999/04/29 09:13:30 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- XawAsciiSourceFreeString @ 1
- XawAsciiSave @ 2
- XawAsciiSaveAsFile @ 3
- XawAsciiSourceChanged @ 4
- XawDialogAddButton @ 5
- XawDialogGetValueString @ 6
- XawFormDoLayout @ 7
- XawListChange @ 8
- XawListUnhighlight @ 9
- XawListHighlight @ 10
- XawListShowCurrent @ 11
- XawPanedSetMinMax @ 13
- XawPanedGetMinMax @ 14
- XawPanedSetRefigureMode @ 15
- XawPanedGetNumSub @ 16
- XawScrollbarSetThumb @ 18
- XawSimpleMenuAddGlobalActions @ 19
- XawSimpleMenuGetActiveEntry @ 20
- XawSimpleMenuClearActiveEntry @ 21
- XawTextDisplay @ 22
- XawTextEnableRedisplay @ 23
- XawTextDisableRedisplay @ 24
- XawTextSetSelectionArray @ 25
- XawTextGetSelectionPos @ 26
- XawTextSetSource @ 27
- XawTextReplace @ 28
- XawTextTopPosition @ 29
- XawTextSetInsertionPoint @ 30
- XawTextGetInsertionPoint @ 31
- XawTextUnsetSelection @ 32
- XawTextSetSelection @ 33
- XawTextInvalidate @ 34
- XawTextGetSource @ 35
- XawTextSearch @ 36
- XawTextDisplayCaret @ 37
- XawTextSinkDisplayText @ 38
- XawTextSinkInsertCursor @ 39
- XawTextSinkClearToBackground @ 40
- XawTextSinkFindPosition @ 41
- XawTextSinkFindDistance @ 42
- XawTextSinkResolve @ 43
- XawTextSinkMaxLines @ 44
- XawTextSinkMaxHeight @ 45
- XawTextSinkSetTabs @ 46
- XawTextSinkGetCursorBounds @ 47
- XawTextSourceRead @ 48
- XawTextSourceReplace @ 49
- XawTextSourceScan @ 50
- XawTextSourceSearch @ 51
- XawTextSourceConvertSelection @ 52
- XawTextSourceSetSelection @ 53
- XawToggleChangeRadioGroup @ 54
- XawToggleGetCurrent @ 55
- XawToggleSetCurrent @ 56
- XawToggleUnsetCurrent @ 57
- XawTreeForceLayout @ 58
- XawViewportSetLocation @ 59
- XawViewportSetCoordinates @ 60
- _XawMultiSinkPosToXY @ 61
- _XawMultiSave @ 62
- _XawMultiSaveAsFile @ 63
- _XawMultiSourceFreeString @ 64
- _XawTextFormat @ 65
- _XawTextBuildLineTable @ 66
- _XawTextGetSTRING @ 67
- _XawTextSaltAwaySelection @ 68
- _XawTextPosToXY @ 69
- _XawTextWCToMB @ 70
- _XawTextMBToWC @ 71
- _Xaw_atowc @ 72
- _XawImResizeVendorShell @ 73
- _XawImGetShellHeight @ 74
- _XawImRealize @ 75
- _XawImInitialize @ 76
- _XawImReconnect @ 77
- _XawImRegister @ 78
- _XawImUnregister @ 79
- _XawImSetValues @ 80
- _XawImSetFocusValues @ 82
- _XawImUnsetFocus @ 84
- _XawImWcLookupString @ 85
- _XawImGetImAreaHeight @ 86
- _XawImCallVendorShellExtResize @ 87
- _XawImDestroy @ 88
- _XawTextZapSelection @ 89
- _XawTextInsertFileAction @ 90
- _XawTextInsertFile @ 91
- _XawTextDoSearchAction @ 92
- _XawTextPopdownSearchAction @ 93
- _XawTextSearch @ 94
- _XawTextDoReplaceAction @ 95
- _XawTextSetField @ 96
- asciiSrcObjectClass @ 100
- asciiSrcClassRec @ 101
- dialogWidgetClass @ 102
- dialogClassRec @ 103
- formWidgetClass @ 104
- formClassRec @ 105
- listWidgetClass @ 106
- listClassRec @ 107
- multiSinkObjectClass @ 108
- multiSinkClassRec @ 109
- multiSrcObjectClass @ 110
- multiSrcClassRec @ 111
- panedWidgetClass @ 112
- panedClassRec @ 113
- scrollbarWidgetClass @ 114
- scrollbarClassRec @ 115
- simpleMenuWidgetClass @ 116
- simpleMenuClassRec @ 117
- FMT8BIT @ 118
- XawFmt8Bit @ 119
- XawFmtWide @ 120
- _XawTextActionsTable @ 121
- _XawTextActionsTableCount @ 122
- textWidgetClass @ 123
- textClassRec @ 124
- textSinkObjectClass @ 125
- textSinkClassRec @ 126
- toggleWidgetClass @ 127
- toggleClassRec @ 128
- treeWidgetClass @ 129
- treeClassRec @ 130
- viewportWidgetClass @ 131
- viewportClassRec @ 132
- menuButtonClassRec @ 133
- menuButtonWidgetClass @ 134
- smeBSBClassRec @ 135
- smeBSBObjectClass @ 136
- smeLineClassRec @ 137
- smeLineObjectClass @ 138
- labelClassRec @ 139
- labelWidgetClass @ 140
- commandClassRec @ 141
- commandWidgetClass @ 142
- boxClassRec @ 143
- boxWidgetClass @ 144
- simpleClassRec @ 145
- simpleWidgetClass @ 146
- XawInitializeWidgetSet @ 147
- asciiTextClassRec @ 148
- asciiTextWidgetClass @ 149
- portholeClassRec @ 150
- portholeWidgetClass @ 151
- pannerClassRec @ 152
- pannerWidgetClass @ 153
- textSrcClassRec @ 154
- textSrcObjectClass @ 155
- gripWidgetClass @ 156
- XawWidgetArray @ 157
- XawWidgetCount @ 158
- XawPanedAllowResize @ 159
- _XawTextNeedsUpdating @ 160
- _XawTextGetText @ 161
- _XawTextSetScrollBars @ 162
- _XawTextVScroll @ 163
- _XawTextReplace @ 164
- _XawTextClearAndCenterDisplay @ 165
- _XawTextCheckResize @ 166
- _XawTextSelectionList @ 167
- _XawTextSetSelection @ 168
- _XawTextAlterSelection @ 169
- _XawTextPrepareToUpdate @ 170
- _XawTextShowPosition @ 171
- _XawTextExecuteUpdate @ 172
- XawVendorShellExtResize @ 173
- asciiSinkClassRec @ 174
- asciiSinkObjectClass @ 175
- gripClassRec @ 176
- vPanedWidgetClass @ 177
- repeaterClassRec @ 178
- repeaterWidgetClass @ 179
- smeClassRec @ 180
- smeObjectClass @ 181
- stripChartClassRec @ 182
- stripChartWidgetClass @ 183
-; _XawDefaultTextTranslations1 @ 184
-; _XawDefaultTextTranslations2 @ 185
-; _XawDefaultTextTranslations3 @ 186
-; vendorShellClassRec @ 187
- _XawVendorShellClassRec @ 187
-; vendorShellWidgetClass @ 188
-; _XawDefaultTextTranslations4 @ 189
- _XawDefaultTextTranslations @ 190
- _XawTextSrcUndo @ 191
diff --git a/xc/lib/Xaw/Xawos2.rsp b/xc/lib/Xaw/Xawos2.rsp
deleted file mode 100644
index 9d952d6b1..000000000
--- a/xc/lib/Xaw/Xawos2.rsp
+++ /dev/null
@@ -1,9 +0,0 @@
-Actions.obj AllWidgets.obj AsciiSink.obj AsciiSrc.obj AsciiText.obj Box.obj+
-Command.obj Converters.obj Dialog.obj DisplayList.obj Form.obj Grip.obj+
-Label.obj List.obj MenuButton.obj MultiSink.obj MultiSrc.obj OS.obj Paned.obj+
-Panner.obj Pixmap.obj Porthole.obj Repeater.obj Scrollbar.obj Simple.obj+
-SimpleMenu.obj Sme.obj SmeBSB.obj SmeLine.obj StripChart.obj Text.obj+
-TextAction.obj TextPop.obj TextSink.obj TextSrc.obj TextTr.obj Toggle.obj+
-Tree.obj Vendor.obj Viewport.obj XawI18n.obj XawIm.obj XawInit.obj /NOI /NOL /NOD /BAT
-Xaw.dll
-Xaw.map
diff --git a/xc/lib/Xaw/genlist.sh b/xc/lib/Xaw/genlist.sh
deleted file mode 100755
index e920337fd..000000000
--- a/xc/lib/Xaw/genlist.sh
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/sh
-
-tmp=/tmp/gl.$$
-nm $* | egrep '(Widget|Obj|Object)Class' | \
-awk '{ if ($2 == "D" || $2 == "G") print $3; }' | sed -e 's/^_//' | \
-(cat - ; echo "objectClass") | sort -u | egrep -v 'ClassRec$' | \
-egrep -v 'vPanedWidgetClass$' | \
-egrep -v 'ascii(Disk|String)WidgetClass$' | \
-awk '
-{
- printf "extern WidgetClass %s;\n", $1;
- printf "{ \"%s\", &%s },\n", $1, $1;
-}' | sed -e 's/WidgetClass"/"/' -e 's/ObjClass"/"/' \
- -e 's/ObjectClass"/"/' -e 's/objectClass"/object"/' \
- -e 's/widgetClass"/widget"/' >$tmp
-
-cat <<EOF
-/*
- * This file is generated by the genlist.sh script and contains an array of
- * all the widgets in Athena widget set.
- *
- * \$XConsortium\$
- */
-#include <X11/IntrinsicP.h>
-#include <X11/Xmu/WidgetNode.h>
-
-EOF
-egrep '^extern WidgetClass' $tmp
-echo ""
-cat <<EOF
-XmuWidgetNode XawWidgetArray[] = {
-EOF
-egrep '^{' $tmp
-cat <<EOF
-};
-
-int XawWidgetCount = XtNumber(XawWidgetArray);
-
-EOF
-
-rm $tmp
diff --git a/xc/lib/Xaw/jump_funcs b/xc/lib/Xaw/jump_funcs
deleted file mode 100644
index df6d0e529..000000000
--- a/xc/lib/Xaw/jump_funcs
+++ /dev/null
@@ -1,113 +0,0 @@
-# $XConsortium: jump_funcs,v 1.2 94/12/07 10:46:47 kaleb Exp $
-# $XFree86: xc/lib/Xaw/jump_funcs,v 3.2 1996/02/12 11:11:15 dawes Exp $
-#
-00000000 T _XawAsciiSourceFreeString libXaw AsciiSrc
-00000000 T _XawAsciiSave libXaw AsciiSrc
-00000000 T _XawAsciiSaveAsFile libXaw AsciiSrc
-00000000 T _XawAsciiSourceChanged libXaw AsciiSrc
-00000000 T _XawDialogAddButton libXaw Dialog
-00000000 T _XawDialogGetValueString libXaw Dialog
-00000000 T _XawFormDoLayout libXaw Form
-00000000 T _XawListChange libXaw List
-00000000 T _XawListUnhighlight libXaw List
-00000000 T _XawListHighlight libXaw List
-00000000 T _XawListShowCurrent libXaw List
-00000000 T _XawPanedSetMinMax libXaw Paned
-00000000 T _XawPanedGetMinMax libXaw Paned
-00000000 T _XawPanedSetRefigureMode libXaw Paned
-00000000 T _XawPanedGetNumSub libXaw Paned
-00000000 T _XawPanedAllowResize libXaw Paned
-00000000 T _XawScrollbarSetThumb libXaw Scrollbar
-00000000 T _XawSimpleMenuAddGlobalActions libXaw SimpleMenu
-00000000 T _XawSimpleMenuGetActiveEntry libXaw SimpleMenu
-00000000 T _XawSimpleMenuClearActiveEntry libXaw SimpleMenu
-00000000 T __XawTextNeedsUpdating libXaw Text
-00000000 T __XawTextGetText libXaw Text
-00000000 T __XawTextGetSTRING libXaw Text
-00000000 T __XawTextBuildLineTable libXaw Text
-00000000 T __XawTextSetScrollBars libXaw Text
-00000000 T __XawTextVScroll libXaw Text
-00000000 T __XawTextSaltAwaySelection libXaw Text
-00000000 T __XawTextReplace libXaw Text
-00000000 T __XawTextClearAndCenterDisplay libXaw Text
-00000000 T __XawTextCheckResize libXaw Text
-00000000 T __XawTextSelectionList libXaw Text
-00000000 T __XawTextSetSelection libXaw Text
-00000000 T __XawTextAlterSelection libXaw Text
-00000000 T __XawTextPrepareToUpdate libXaw Text
-00000000 T __XawTextShowPosition libXaw Text
-00000000 T __XawTextExecuteUpdate libXaw Text
-00000000 T _XawTextDisplay libXaw Text
-00000000 T _XawTextSetSelectionArray libXaw Text
-00000000 T _XawTextGetSelectionPos libXaw Text
-00000000 T _XawTextSetSource libXaw Text
-00000000 T _XawTextReplace libXaw Text
-00000000 T _XawTextTopPosition libXaw Text
-00000000 T _XawTextSetInsertionPoint libXaw Text
-00000000 T _XawTextGetInsertionPoint libXaw Text
-00000000 T _XawTextUnsetSelection libXaw Text
-00000000 T _XawTextSetSelection libXaw Text
-00000000 T _XawTextInvalidate libXaw Text
-00000000 T _XawTextDisableRedisplay libXaw Text
-00000000 T _XawTextEnableRedisplay libXaw Text
-00000000 T _XawTextGetSource libXaw Text
-00000000 T _XawTextDisplayCaret libXaw Text
-00000000 T _XawTextSearch libXaw Text
-00000000 T _XawTextSinkDisplayText libXaw TextSink
-00000000 T _XawTextSinkInsertCursor libXaw TextSink
-00000000 T _XawTextSinkClearToBackground libXaw TextSink
-00000000 T _XawTextSinkFindPosition libXaw TextSink
-00000000 T _XawTextSinkFindDistance libXaw TextSink
-00000000 T _XawTextSinkResolve libXaw TextSink
-00000000 T _XawTextSinkMaxLines libXaw TextSink
-00000000 T _XawTextSinkMaxHeight libXaw TextSink
-00000000 T _XawTextSinkSetTabs libXaw TextSink
-00000000 T _XawTextSinkGetCursorBounds libXaw TextSink
-00000000 T _XawTextSourceRead libXaw TextSrc
-00000000 T _XawTextSourceReplace libXaw TextSrc
-00000000 T _XawTextSourceScan libXaw TextSrc
-00000000 T _XawTextSourceSearch libXaw TextSrc
-00000000 T _XawTextSourceConvertSelection libXaw TextSrc
-00000000 T _XawTextSourceSetSelection libXaw TextSrc
-00000000 T __XawTextZapSelection libXaw TextAction
-00000000 T __XawTextInsertFileAction libXaw TextPop
-00000000 T __XawTextInsertFile libXaw TextPop
-00000000 T __XawTextDoSearchAction libXaw TextPop
-00000000 T __XawTextPopdownSearchAction libXaw TextPop
-00000000 T __XawTextSearch libXaw TextPop
-00000000 T __XawTextDoReplaceAction libXaw TextPop
-00000000 T __XawTextSetField libXaw TextPop
-00000000 T _XawToggleChangeRadioGroup libXaw Toggle
-00000000 T _XawToggleGetCurrent libXaw Toggle
-00000000 T _XawToggleSetCurrent libXaw Toggle
-00000000 T _XawToggleUnsetCurrent libXaw Toggle
-00000000 T _XawTreeForceLayout libXaw Tree
-00000000 T _XawViewportSetLocation libXaw Viewport
-00000000 T _XawViewportSetCoordinates libXaw Viewport
-00000000 T _XawInitializeWidgetSet libXaw XawInit
-00000000 T __XawMultiSourceFreeString libXaw MultiSrc
-00000000 T __XawMultiSave libXaw MultiSrc
-00000000 T __XawMultiSaveAsFile libXaw MultiSrc
-00000000 T __XawMultiSinkPosToXY libXaw MultiSink
-00000000 T __XawTextPosToXY libXaw Text
-00000000 T __XawTextFormat libXaw TextSrc
-00000000 T __XawTextWCToMB libXaw TextSrc
-00000000 T __XawTextMBToWC libXaw TextSrc
-00000000 T _XawVendorShellExtResize libXaw Vendor
-00000000 T __XawImResizeVendorShell libXaw XawIm
-00000000 T __XawImGetShellHeight libXaw XawIm
-00000000 T __XawImRealize libXaw XawIm
-00000000 T __XawImInitialize libXaw XawIm
-00000000 T __XawImReconnect libXaw XawIm
-00000000 T __XawImRegister libXaw XawIm
-00000000 T __XawImUnregister libXaw XawIm
-00000000 T __XawImSetValues libXaw XawIm
-00000000 T __DUMMY__ libXaw XawIm
-00000000 T __XawImSetFocusValues libXaw XawIm
-00000000 T __DUMMY__ libXaw XawIm
-00000000 T __XawImUnsetFocus libXaw XawIm
-00000000 T __XawImWcLookupString libXaw XawIm
-00000000 T __XawImGetImAreaHeight libXaw XawIm
-00000000 T __XawImCallVendorShellExtResize libXaw XawIm
-00000000 T __XawImDestroy libXaw XawIm
-00000000 T __Xaw_atowc libXaw XawI18n
diff --git a/xc/lib/Xaw/jump_ignore b/xc/lib/Xaw/jump_ignore
deleted file mode 100644
index 253b63da1..000000000
--- a/xc/lib/Xaw/jump_ignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# $XConsortium: jump_ignore,v 1.2 94/12/07 10:46:47 kaleb Exp $
-# $XFree86: xc/lib/Xaw/jump_ignore,v 3.1 1995/01/28 15:43:32 dawes Exp $
-# jump_ignore
diff --git a/xc/lib/Xaw/jump_vars b/xc/lib/Xaw/jump_vars
deleted file mode 100644
index 2edecda2e..000000000
--- a/xc/lib/Xaw/jump_vars
+++ /dev/null
@@ -1,79 +0,0 @@
-# $XConsortium: jump_vars,v 1.2 94/12/07 10:46:47 kaleb Exp $
-# $XFree86: xc/lib/Xaw/jump_vars,v 3.1 1995/01/28 15:43:33 dawes Exp $
-#
-00001400 D _XawWidgetArray libXaw AllWidgets
-00000004 D _XawWidgetCount libXaw AllWidgets
-00000140 D _asciiSinkClassRec libXaw AsciiSink
-00000004 D _asciiSinkObjectClass libXaw AsciiSink
-00000120 D _asciiSrcClassRec libXaw AsciiSrc
-00000004 D _asciiSrcObjectClass libXaw AsciiSrc
-00000100 D _asciiTextClassRec libXaw AsciiText
-00000004 D _asciiTextWidgetClass libXaw AsciiText
-00000100 D _boxClassRec libXaw Box
-00000004 D _boxWidgetClass libXaw Box
-00000100 D _commandClassRec libXaw Command
-00000004 D _commandWidgetClass libXaw Command
-00000140 D _dialogClassRec libXaw Dialog
-00000004 D _dialogWidgetClass libXaw Dialog
-00000140 D _formClassRec libXaw Form
-00000004 D _formWidgetClass libXaw Form
-00000100 D _gripClassRec libXaw Grip
-00000004 D _gripWidgetClass libXaw Grip
-00000100 D _labelClassRec libXaw Label
-00000004 D _labelWidgetClass libXaw Label
-00000100 D _listClassRec libXaw List
-00000004 D _listWidgetClass libXaw List
-00000100 D _menuButtonClassRec libXaw MenuButton
-00000004 D _menuButtonWidgetClass libXaw MenuButton
-00000140 D _panedClassRec libXaw Paned
-00000004 D _panedWidgetClass libXaw Paned
-00000004 D _vPanedWidgetClass libXaw Paned
-00000100 D _pannerClassRec libXaw Panner
-00000004 D _pannerWidgetClass libXaw Panner
-00000100 D _portholeClassRec libXaw Porthole
-00000004 D _portholeWidgetClass libXaw Porthole
-00000100 D _repeaterClassRec libXaw Repeater
-00000004 D _repeaterWidgetClass libXaw Repeater
-00000100 D _scrollbarClassRec libXaw Scrollbar
-00000004 D _scrollbarWidgetClass libXaw Scrollbar
-00000100 D _simpleClassRec libXaw Simple
-00000004 D _simpleWidgetClass libXaw Simple
-00000100 D _simpleMenuClassRec libXaw SimpleMenu
-00000004 D _simpleMenuWidgetClass libXaw SimpleMenu
-00000100 D _smeClassRec libXaw Sme
-00000004 D _smeObjectClass libXaw Sme
-00000100 D _smeBSBClassRec libXaw SmeBSB
-00000004 D _smeBSBObjectClass libXaw SmeBSB
-00000100 D _smeLineClassRec libXaw SmeLine
-00000004 D _smeLineObjectClass libXaw SmeLine
-00000100 D _stripChartClassRec libXaw StripChart
-00000004 D _stripChartWidgetClass libXaw StripChart
-00000004 D _FMT8BIT libXaw Text
-00000100 D _textClassRec libXaw Text
-00000004 D _textWidgetClass libXaw Text
-00000100 D _textSinkClassRec libXaw TextSink
-00000004 D _textSinkObjectClass libXaw TextSink
-00000100 D _textSrcClassRec libXaw TextSrc
-00000004 D _textSrcObjectClass libXaw TextSrc
-00000300 D __XawTextActionsTable libXaw TextAction
-00000004 D __XawTextActionsTableCount libXaw TextAction
-00000004 D __XawDefaultTextTranslations1 libXaw TextTr
-00000004 D __XawDefaultTextTranslations2 libXaw TextTr
-00000004 D __XawDefaultTextTranslations3 libXaw TextTr
-00000100 D _toggleClassRec libXaw Toggle
-00000004 D _toggleWidgetClass libXaw Toggle
-00000140 D _treeClassRec libXaw Tree
-00000004 D _treeWidgetClass libXaw Tree
-00000100 D _vendorShellClassRec libXaw Vendor
-00000004 D _vendorShellWidgetClass libXaw Vendor
-00000140 D _viewportClassRec libXaw Viewport
-00000004 D _viewportWidgetClass libXaw Viewport
-00000140 D _multiSrcClassRec libXaw MultiSrc
-00000004 D _multiSrcObjectClass libXaw MultiSrc
-00000140 D _multiSinkClassRec libXaw MultiSink
-00000004 D _multiSinkObjectClass libXaw MultiSink
-00000004 D __XawDefaultTextTranslations4 libXaw TextTr
-00000140 D _xawvendorShellExtClassRec libXaw Vendor
-00000004 D _xawvendorShellExtWidgetClass libXaw Vendor
-00000004 D _XawFmt8Bit libXaw Text
-00000004 D _XawFmtWide libXaw Text
diff --git a/xc/lib/Xaw/sharedlib.c b/xc/lib/Xaw/sharedlib.c
deleted file mode 100644
index 2e83e6f19..000000000
--- a/xc/lib/Xaw/sharedlib.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* $TOG: sharedlib.c /main/7 1998/02/06 12:49:07 kaleb $ */
-/*
-
-Copyright 1991, 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.
-
-*/
-
-#if defined(SUNSHLIB) && !defined(SHAREDCODE)
-
-#include <X11/IntrinsicP.h>
-#include <X11/Xaw/AsciiSinkP.h>
-#include <X11/Xaw/AsciiSrcP.h>
-#include <X11/Xaw/AsciiTextP.h>
-#include <X11/Xaw/MultiSinkP.h>
-#include <X11/Xaw/MultiSrcP.h>
-#include <X11/Xaw/BoxP.h>
-#include <X11/Xaw/CommandP.h>
-#include <X11/Xaw/DialogP.h>
-#include <X11/Xaw/FormP.h>
-#include <X11/Xaw/GripP.h>
-#include <X11/Xaw/LabelP.h>
-#include <X11/Xaw/ListP.h>
-#include <X11/Xaw/MenuButtoP.h>
-#include <X11/Xaw/PanedP.h>
-#include <X11/Xaw/PannerP.h>
-#include <X11/Xaw/PortholeP.h>
-#include <X11/Xaw/RepeaterP.h>
-#include <X11/Xaw/ScrollbarP.h>
-#include <X11/Xaw/SimpleP.h>
-#include <X11/Xaw/SimpleMenP.h>
-#include <X11/Xaw/SmeP.h>
-#include <X11/Xaw/SmeBSBP.h>
-#include <X11/Xaw/SmeLineP.h>
-#include <X11/Xaw/StripCharP.h>
-#include <X11/Xaw/TextP.h>
-#include <X11/Xaw/TextSinkP.h>
-#include <X11/Xaw/TextSrcP.h>
-#include <X11/Xaw/ToggleP.h>
-#include <X11/Xaw/TreeP.h>
-#include <X11/VendorP.h>
-#include <X11/Xaw/ViewportP.h>
-
-extern AsciiSinkClassRec asciiSinkClassRec;
-WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec;
-
-extern AsciiSrcClassRec asciiSrcClassRec;
-WidgetClass asciiSrcObjectClass = (WidgetClass)&asciiSrcClassRec;
-
-extern AsciiTextClassRec asciiTextClassRec;
-WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec;
-
-#ifdef ASCII_STRING
-extern AsciiStringClassRec asciiStringClassRec;
-WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec;
-#endif
-
-#ifdef ASCII_DISK
-extern AsciiDiskClassRec asciiDiskClassRec;
-WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec;
-#endif
-
-extern MultiSinkClassRec multiSinkClassRec;
-WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec;
-
-extern MultiSrcClassRec multiSrcClassRec;
-WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec;
-
-extern BoxClassRec boxClassRec;
-WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec;
-
-extern CommandClassRec commandClassRec;
-WidgetClass commandWidgetClass = (WidgetClass) &commandClassRec;
-
-extern DialogClassRec dialogClassRec;
-WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec;
-
-extern FormClassRec formClassRec;
-WidgetClass formWidgetClass = (WidgetClass)&formClassRec;
-
-extern GripClassRec gripClassRec;
-WidgetClass gripWidgetClass = (WidgetClass) &gripClassRec;
-
-extern LabelClassRec labelClassRec;
-WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec;
-
-extern ListClassRec listClassRec;
-WidgetClass listWidgetClass = (WidgetClass)&listClassRec;
-
-extern MenuButtonClassRec menuButtonClassRec;
-WidgetClass menuButtonWidgetClass = (WidgetClass) &menuButtonClassRec;
-
-extern PanedClassRec panedClassRec;
-WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec;
-WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec;
-
-extern PannerClassRec pannerClassRec;
-WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec;
-
-extern PortholeClassRec portholeClassRec;
-WidgetClass portholeWidgetClass = (WidgetClass) &portholeClassRec;
-
-extern RepeaterClassRec repeaterClassRec;
-WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec;
-
-extern ScrollbarClassRec scrollbarClassRec;
-WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec;
-
-extern SimpleClassRec simpleClassRec;
-WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec;
-
-extern SimpleMenuClassRec simpleMenuClassRec;
-WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec;
-
-extern SmeClassRec smeClassRec;
-WidgetClass smeObjectClass = (WidgetClass) &smeClassRec;
-
-extern SmeBSBClassRec smeBSBClassRec;
-WidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec;
-
-extern SmeLineClassRec smeLineClassRec;
-WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec;
-
-extern StripChartClassRec stripChartClassRec;
-WidgetClass stripChartWidgetClass = (WidgetClass) &stripChartClassRec;
-
-extern TextClassRec textClassRec;
-WidgetClass textWidgetClass = (WidgetClass)&textClassRec;
-
-unsigned long FMT8BIT = 0L;
-unsigned long XawFmt8Bit = 0L;
-unsigned long XawFmtWide = 0L;
-
-extern TextSinkClassRec textSinkClassRec;
-WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec;
-
-extern TextSrcClassRec textSrcClassRec;
-WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec;
-
-extern ToggleClassRec toggleClassRec;
-WidgetClass toggleWidgetClass = (WidgetClass) &toggleClassRec;
-
-extern TreeClassRec treeClassRec;
-WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec;
-
-extern VendorShellClassRec vendorShellClassRec;
-WidgetClass vendorShellWidgetClass = (WidgetClass) &vendorShellClassRec;
-
-extern ViewportClassRec viewportClassRec;
-WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec;
-
-#endif /* SUNSHLIB */
diff --git a/xc/lib/Xaw6/Imakefile b/xc/lib/Xaw6/Imakefile
deleted file mode 100644
index 1ee723933..000000000
--- a/xc/lib/Xaw6/Imakefile
+++ /dev/null
@@ -1,170 +0,0 @@
-XCOMM $XFree86: xc/lib/Xaw6/Imakefile,v 1.2 1999/06/06 14:05:55 dawes Exp $
-#define DoNormalLib NormalLibXaw6
-#define DoSharedLib SharedLibXaw6
-#define DoExtraLib SharedLibXaw6
-#define DoDebugLib DebugLibXaw6
-#define DoProfileLib ProfileLibXaw6
-#define HasSharedData YES
-#define LibName Xaw
-#define SoRev SOXAW6REV
-#define LibHeaders NO
-#define NoSoSymlink
-
-#ifdef SharedXaw6Reqs
-REQUIREDLIBS = SharedXaw6Reqs
-#endif
-
-DEFINES = XawI18nDefines -DOLDXAW
-
- LINTLIBS = $(LINTXLIB) $(LINTXTOOL)
-
-SRCS = \
- Actions.c \
- AllWidgets.c \
- AsciiSink.c \
- AsciiSrc.c \
- AsciiText.c \
- Box.c \
- Command.c \
- Converters.c \
- Dialog.c \
- DisplayList.c \
- Form.c \
- Grip.c \
- Label.c \
- List.c \
- MenuButton.c \
- MultiSrc.c \
- MultiSink.c \
- OS.c \
- Paned.c \
- Panner.c \
- Pixmap.c \
- Porthole.c \
- Repeater.c \
- Scrollbar.c \
- Simple.c \
- SimpleMenu.c \
- Sme.c \
- SmeBSB.c \
- SmeLine.c \
- StripChart.c \
- Text.c \
- TextSink.c \
- TextSrc.c \
- TextAction.c \
- TextPop.c \
- TextTr.c \
- Toggle.c \
- Tree.c \
- Vendor.c \
- Viewport.c \
- XawIm.c \
- XawInit.c \
- XawI18n.c \
- sharedlib.c
-
-#if SharedDataSeparation
-UNSHAREDOBJS = AllWidgets.o sharedlib.o
-#endif
-
-OBJS = \
- Actions.o \
- AllWidgets.o \
- AsciiSink.o \
- AsciiSrc.o \
- AsciiText.o \
- Box.o \
- Command.o \
- Converters.o \
- Dialog.o \
- DisplayList.o \
- Form.o \
- Grip.o \
- Label.o \
- List.o \
- MenuButton.o \
- MultiSrc.o \
- MultiSink.o \
- OS.o \
- Paned.o \
- Panner.o \
- Pixmap.o \
- Porthole.o \
- Repeater.o \
- Scrollbar.o \
- Simple.o \
- SimpleMenu.o \
- Sme.o \
- SmeBSB.o \
- SmeLine.o \
- StripChart.o \
- Text.o \
- TextSink.o \
- TextSrc.o \
- TextAction.o \
- TextPop.o \
- TextTr.o \
- Toggle.o \
- Tree.o \
- Vendor.o \
- Viewport.o \
- XawIm.o \
- XawI18n.o \
- XawInit.o
-
-INCLUDES = -I$(AWIDGETSRC)
-
-#include <Library.tmpl>
-
-#if DoSharedLib && SharedDataSeparation
-SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF))
-#endif
-
-LinkSourceFile(Actions.c,$(AWIDGETSRC))
-LinkSourceFile(AllWidgets.c,$(AWIDGETSRC))
-LinkSourceFile(AsciiSink.c,$(AWIDGETSRC))
-LinkSourceFile(AsciiSrc.c,$(AWIDGETSRC))
-LinkSourceFile(AsciiText.c,$(AWIDGETSRC))
-LinkSourceFile(Box.c,$(AWIDGETSRC))
-LinkSourceFile(Command.c,$(AWIDGETSRC))
-LinkSourceFile(Converters.c,$(AWIDGETSRC))
-LinkSourceFile(Dialog.c,$(AWIDGETSRC))
-LinkSourceFile(DisplayList.c,$(AWIDGETSRC))
-LinkSourceFile(Form.c,$(AWIDGETSRC))
-LinkSourceFile(Grip.c,$(AWIDGETSRC))
-LinkSourceFile(Label.c,$(AWIDGETSRC))
-LinkSourceFile(List.c,$(AWIDGETSRC))
-LinkSourceFile(MenuButton.c,$(AWIDGETSRC))
-LinkSourceFile(MultiSrc.c,$(AWIDGETSRC))
-LinkSourceFile(MultiSink.c,$(AWIDGETSRC))
-LinkSourceFile(OS.c,$(AWIDGETSRC))
-LinkSourceFile(Paned.c,$(AWIDGETSRC))
-LinkSourceFile(Panner.c,$(AWIDGETSRC))
-LinkSourceFile(Pixmap.c,$(AWIDGETSRC))
-LinkSourceFile(Porthole.c,$(AWIDGETSRC))
-LinkSourceFile(Repeater.c,$(AWIDGETSRC))
-LinkSourceFile(Scrollbar.c,$(AWIDGETSRC))
-LinkSourceFile(Simple.c,$(AWIDGETSRC))
-LinkSourceFile(SimpleMenu.c,$(AWIDGETSRC))
-LinkSourceFile(Sme.c,$(AWIDGETSRC))
-LinkSourceFile(SmeBSB.c,$(AWIDGETSRC))
-LinkSourceFile(SmeLine.c,$(AWIDGETSRC))
-LinkSourceFile(StripChart.c,$(AWIDGETSRC))
-LinkSourceFile(Text.c,$(AWIDGETSRC))
-LinkSourceFile(TextSink.c,$(AWIDGETSRC))
-LinkSourceFile(TextSrc.c,$(AWIDGETSRC))
-LinkSourceFile(TextAction.c,$(AWIDGETSRC))
-LinkSourceFile(TextPop.c,$(AWIDGETSRC))
-LinkSourceFile(TextTr.c,$(AWIDGETSRC))
-LinkSourceFile(Toggle.c,$(AWIDGETSRC))
-LinkSourceFile(Tree.c,$(AWIDGETSRC))
-LinkSourceFile(Vendor.c,$(AWIDGETSRC))
-LinkSourceFile(Viewport.c,$(AWIDGETSRC))
-LinkSourceFile(XawIm.c,$(AWIDGETSRC))
-LinkSourceFile(XawInit.c,$(AWIDGETSRC))
-LinkSourceFile(XawI18n.c,$(AWIDGETSRC))
-LinkSourceFile(sharedlib.c,$(AWIDGETSRC))
-
-DependTarget()
-
diff --git a/xc/lib/Xaw6/Xaw6os2.def b/xc/lib/Xaw6/Xaw6os2.def
deleted file mode 100644
index 8a92a2c28..000000000
--- a/xc/lib/Xaw6/Xaw6os2.def
+++ /dev/null
@@ -1,205 +0,0 @@
-LIBRARY Xaw6 INITINSTANCE TERMINSTANCE
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xaw6/Xaw6os2.def,v 1.1 2000/04/05 18:13:18 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- XawAsciiSourceFreeString @ 1
- XawAsciiSave @ 2
- XawAsciiSaveAsFile @ 3
- XawAsciiSourceChanged @ 4
- XawDialogAddButton @ 5
- XawDialogGetValueString @ 6
- XawFormDoLayout @ 7
- XawListChange @ 8
- XawListUnhighlight @ 9
- XawListHighlight @ 10
- XawListShowCurrent @ 11
- XawPanedSetMinMax @ 13
- XawPanedGetMinMax @ 14
- XawPanedSetRefigureMode @ 15
- XawPanedGetNumSub @ 16
- XawScrollbarSetThumb @ 18
- XawSimpleMenuAddGlobalActions @ 19
- XawSimpleMenuGetActiveEntry @ 20
- XawSimpleMenuClearActiveEntry @ 21
- XawTextDisplay @ 22
- XawTextEnableRedisplay @ 23
- XawTextDisableRedisplay @ 24
- XawTextSetSelectionArray @ 25
- XawTextGetSelectionPos @ 26
- XawTextSetSource @ 27
- XawTextReplace @ 28
- XawTextTopPosition @ 29
- XawTextSetInsertionPoint @ 30
- XawTextGetInsertionPoint @ 31
- XawTextUnsetSelection @ 32
- XawTextSetSelection @ 33
- XawTextInvalidate @ 34
- XawTextGetSource @ 35
- XawTextSearch @ 36
- XawTextDisplayCaret @ 37
- XawTextSinkDisplayText @ 38
- XawTextSinkInsertCursor @ 39
- XawTextSinkClearToBackground @ 40
- XawTextSinkFindPosition @ 41
- XawTextSinkFindDistance @ 42
- XawTextSinkResolve @ 43
- XawTextSinkMaxLines @ 44
- XawTextSinkMaxHeight @ 45
- XawTextSinkSetTabs @ 46
- XawTextSinkGetCursorBounds @ 47
- XawTextSourceRead @ 48
- XawTextSourceReplace @ 49
- XawTextSourceScan @ 50
- XawTextSourceSearch @ 51
- XawTextSourceConvertSelection @ 52
- XawTextSourceSetSelection @ 53
- XawToggleChangeRadioGroup @ 54
- XawToggleGetCurrent @ 55
- XawToggleSetCurrent @ 56
- XawToggleUnsetCurrent @ 57
- XawTreeForceLayout @ 58
- XawViewportSetLocation @ 59
- XawViewportSetCoordinates @ 60
- _XawMultiSinkPosToXY @ 61
- _XawMultiSave @ 62
- _XawMultiSaveAsFile @ 63
- _XawMultiSourceFreeString @ 64
- _XawTextFormat @ 65
- _XawTextBuildLineTable @ 66
- _XawTextGetSTRING @ 67
- _XawTextSaltAwaySelection @ 68
- _XawTextPosToXY @ 69
- _XawTextWCToMB @ 70
- _XawTextMBToWC @ 71
- _Xaw_atowc @ 72
- _XawImResizeVendorShell @ 73
- _XawImGetShellHeight @ 74
- _XawImRealize @ 75
- _XawImInitialize @ 76
- _XawImReconnect @ 77
- _XawImRegister @ 78
- _XawImUnregister @ 79
- _XawImSetValues @ 80
- _XawImSetFocusValues @ 82
- _XawImUnsetFocus @ 84
- _XawImWcLookupString @ 85
- _XawImGetImAreaHeight @ 86
- _XawImCallVendorShellExtResize @ 87
- _XawImDestroy @ 88
- _XawTextZapSelection @ 89
- _XawTextInsertFileAction @ 90
- _XawTextInsertFile @ 91
- _XawTextDoSearchAction @ 92
- _XawTextPopdownSearchAction @ 93
- _XawTextSearch @ 94
- _XawTextDoReplaceAction @ 95
- _XawTextSetField @ 96
- asciiSrcObjectClass @ 100
- asciiSrcClassRec @ 101
- dialogWidgetClass @ 102
- dialogClassRec @ 103
- formWidgetClass @ 104
- formClassRec @ 105
- listWidgetClass @ 106
- listClassRec @ 107
- multiSinkObjectClass @ 108
- multiSinkClassRec @ 109
- multiSrcObjectClass @ 110
- multiSrcClassRec @ 111
- panedWidgetClass @ 112
- panedClassRec @ 113
- scrollbarWidgetClass @ 114
- scrollbarClassRec @ 115
- simpleMenuWidgetClass @ 116
- simpleMenuClassRec @ 117
- FMT8BIT @ 118
- XawFmt8Bit @ 119
- XawFmtWide @ 120
- _XawTextActionsTable @ 121
- _XawTextActionsTableCount @ 122
- textWidgetClass @ 123
- textClassRec @ 124
- textSinkObjectClass @ 125
- textSinkClassRec @ 126
- toggleWidgetClass @ 127
- toggleClassRec @ 128
- treeWidgetClass @ 129
- treeClassRec @ 130
- viewportWidgetClass @ 131
- viewportClassRec @ 132
- menuButtonClassRec @ 133
- menuButtonWidgetClass @ 134
- smeBSBClassRec @ 135
- smeBSBObjectClass @ 136
- smeLineClassRec @ 137
- smeLineObjectClass @ 138
- labelClassRec @ 139
- labelWidgetClass @ 140
- commandClassRec @ 141
- commandWidgetClass @ 142
- boxClassRec @ 143
- boxWidgetClass @ 144
- simpleClassRec @ 145
- simpleWidgetClass @ 146
- XawInitializeWidgetSet @ 147
- asciiTextClassRec @ 148
- asciiTextWidgetClass @ 149
- portholeClassRec @ 150
- portholeWidgetClass @ 151
- pannerClassRec @ 152
- pannerWidgetClass @ 153
- textSrcClassRec @ 154
- textSrcObjectClass @ 155
- gripWidgetClass @ 156
- XawWidgetArray @ 157
- XawWidgetCount @ 158
- XawPanedAllowResize @ 159
- _XawTextNeedsUpdating @ 160
- _XawTextGetText @ 161
- _XawTextSetScrollBars @ 162
- _XawTextVScroll @ 163
- _XawTextReplace @ 164
- _XawTextClearAndCenterDisplay @ 165
- _XawTextCheckResize @ 166
- _XawTextSelectionList @ 167
- _XawTextSetSelection @ 168
- _XawTextAlterSelection @ 169
- _XawTextPrepareToUpdate @ 170
- _XawTextShowPosition @ 171
- _XawTextExecuteUpdate @ 172
- XawVendorShellExtResize @ 173
- asciiSinkClassRec @ 174
- asciiSinkObjectClass @ 175
- gripClassRec @ 176
- vPanedWidgetClass @ 177
- repeaterClassRec @ 178
- repeaterWidgetClass @ 179
- smeClassRec @ 180
- smeObjectClass @ 181
- stripChartClassRec @ 182
- stripChartWidgetClass @ 183
-; _XawDefaultTextTranslations1 @ 184
-; _XawDefaultTextTranslations2 @ 185
-; _XawDefaultTextTranslations3 @ 186
-; vendorShellClassRec @ 187
- _XawVendorShellClassRec @ 187
-; vendorShellWidgetClass @ 188
-; _XawDefaultTextTranslations4 @ 189
- _XawDefaultTextTranslations @ 190
-;newAW _XawTextSrcUndo @ 191
-;newAW tipClassRec @ 192
-;newAW tipWidgetClass @ 193
-;newAW XawTipEnable @ 194
-;newAW XawTipDisable @ 195
-; XawTextSinkConvertPropertyList @ 196
-; XawTextGetSink @ 197
-; XawTextSourceClearEntities @ 198
-; XawTextSourceFindAnchor @ 199
-; XawTextSourcePrevAnchor @ 200
-; XawTextSourceNextAnchor @ 201
-; XawTextSourceAnchorAndEntity @ 202
-; XawTextSourceAddEntity @ 203
diff --git a/xc/lib/Xaw6/Xaw6os2.rsp b/xc/lib/Xaw6/Xaw6os2.rsp
deleted file mode 100644
index a1bd96e42..000000000
--- a/xc/lib/Xaw6/Xaw6os2.rsp
+++ /dev/null
@@ -1,10 +0,0 @@
-Actions.obj AllWidgets.obj AsciiSink.obj AsciiSrc.obj AsciiText.obj Box.obj+
-Command.obj Converters.obj Dialog.obj DisplayList.obj Form.obj Grip.obj+
-Label.obj List.obj MenuButton.obj MultiSink.obj MultiSrc.obj OS.obj Paned.obj+
-Panner.obj Pixmap.obj Porthole.obj Repeater.obj Scrollbar.obj Simple.obj+
-SimpleMenu.obj Sme.obj SmeBSB.obj SmeLine.obj StripChart.obj Text.obj+
-TextAction.obj TextPop.obj TextSink.obj TextSrc.obj TextTr.obj+
-Toggle.obj Tree.obj Vendor.obj Viewport.obj XawI18n.obj XawIm.obj+
-XawInit.obj +/NOI /NOL /NOD /BAT
-Xaw6.dll
-Xaw6.map
diff --git a/xc/lib/Xfontcache/FontCache.c b/xc/lib/Xfontcache/FontCache.c
deleted file mode 100644
index f07951194..000000000
--- a/xc/lib/Xfontcache/FontCache.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*-
- * Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
- * All rights reserved.
- * Copyright (c) 1998-1999 X-TrueType Server Project, All rights
- * reserved.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- *
- * $Id: FontCache.c,v 1.1 2000/02/22 15:40:07 kem Exp $
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include "Xlibint.h"
-#include "fontcachstr.h"
-#include "Xext.h"
-#include "extutil.h"
-
-static XExtensionInfo _fontcache_info_data;
-static XExtensionInfo *fontcache_info = &_fontcache_info_data;
-static char *fontcache_extension_name = FONTCACHENAME;
-
-#define FontCacheCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, fontcache_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display();
-static /* const */ XExtensionHooks fontcache_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, fontcache_info,
- fontcache_extension_name,
- &fontcache_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, fontcache_info)
-
-
-/*****************************************************************************
- * *
- * public Font-Misc Extension routines *
- * *
- *****************************************************************************/
-
-Bool FontCacheQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Bool FontCacheQueryVersion(dpy, majorVersion, minorVersion)
- Display* dpy;
- int* majorVersion;
- int* minorVersion;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xFontCacheQueryVersionReply rep;
- xFontCacheQueryVersionReq *req;
-
- FontCacheCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(FontCacheQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->fontcacheReqType = X_FontCacheQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool FontCacheGetCacheSettings(dpy, cacheinfo)
- Display* dpy;
- FontCacheSettings *cacheinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xFontCacheGetCacheSettingsReply rep;
- xFontCacheGetCacheSettingsReq *req;
-
- FontCacheCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(FontCacheGetCacheSettings, req);
- req->reqType = info->codes->major_opcode;
- req->fontcacheReqType = X_FontCacheGetCacheSettings;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- /* XXX */
- cacheinfo->himark = rep.himark;
- cacheinfo->lowmark = rep.lowmark;
- cacheinfo->balance = rep.balance;
- /* XXX */
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool FontCacheChangeCacheSettings(dpy, cacheinfo)
- Display* dpy;
- FontCacheSettings *cacheinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xFontCacheChangeCacheSettingsReq *req;
-
- FontCacheCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(FontCacheChangeCacheSettings, req);
- req->reqType = info->codes->major_opcode;
- req->fontcacheReqType = X_FontCacheChangeCacheSettings;
- /* XXX */
- req->himark = cacheinfo->himark;
- req->lowmark = cacheinfo->lowmark;
- req->balance = cacheinfo->balance;
- /* XXX */
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool FontCacheGetCacheStatistics(dpy, cachestats)
- Display* dpy;
- FontCacheStatistics *cachestats;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xFontCacheGetCacheStatisticsReply rep;
- xFontCacheGetCacheStatisticsReq *req;
-
- FontCacheCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(FontCacheGetCacheStatistics, req);
- req->reqType = info->codes->major_opcode;
- req->fontcacheReqType = X_FontCacheGetCacheStatistics;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xFontCacheGetCacheStatisticsReply)-SIZEOF(xReply))>>2,
- xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- /* XXX */
- cachestats->purge_runs = rep.purge_runs;
- cachestats->purge_stat = rep.purge_stat;
- cachestats->balance = rep.balance;
- cachestats->f.hits = rep.f_hits;
- cachestats->f.misshits = rep.f_misshits;
- cachestats->f.purged = rep.f_purged;
- cachestats->f.usage = rep.f_usage;
- cachestats->v.hits = rep.v_hits;
- cachestats->v.misshits = rep.v_misshits;
- cachestats->v.purged = rep.v_purged;
- cachestats->v.usage = rep.v_usage;
- /* XXX */
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
diff --git a/xc/lib/Xfontcache/Imakefile b/xc/lib/Xfontcache/Imakefile
deleted file mode 100644
index 6a341741f..000000000
--- a/xc/lib/Xfontcache/Imakefile
+++ /dev/null
@@ -1,33 +0,0 @@
-XCOMM $Id: Imakefile,v 1.1 2000/02/22 15:40:07 kem Exp $
-
-#define DoNormalLib NormalLibXfontcache
-#define DoSharedLib SharedLibXfontcache
-#define DoExtraLib SharedLibXfontcache
-#define DoDebugLib DebugLibXfontcache
-#define DoProfileLib ProfileLibXfontcache
-#define LibName Xfontcache
-#define SoRev SOXFONTCACHEREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXfontcacheReqs
- REQUIREDLIBS = SharedXfontcacheReqs
-#endif
-
- FONTCACHESRCS = FontCache.c
- FONTCACHEOBJS = FontCache.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = $(FONTCACHESRCS)
- OBJS = $(FONTCACHEOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xft/Imakefile b/xc/lib/Xft/Imakefile
deleted file mode 100644
index 6265bc53c..000000000
--- a/xc/lib/Xft/Imakefile
+++ /dev/null
@@ -1,80 +0,0 @@
-XCOMM $XFree86: xc/lib/Xft/Imakefile,v 1.14 2001/04/27 14:55:22 tsi Exp $
-
-#define DoNormalLib NormalLibXft
-#define DoSharedLib SharedLibXft
-#define DoExtraLib SharedLibXft
-#define DoDebugLib DebugLibXft
-#define DoProfileLib ProfileLibXft
-#define HasSharedData YES
-#define LibName Xft
-#define SoRev SOXFTREV
-#define IncSubdir X11
-#define IncSubSubdir Xft
-
-#include <Threads.tmpl>
-
-YFLAGS = -d
-
-#ifndef XftLibDir
-#define XftLibDir $(LIBDIR)
-#endif
-#ifndef XftType1Dir
-#define XftType1Dir $(LIBDIR)/fonts/Type1
-#endif
-
-XFTLIBDIR=XftLibDir
-XFTCONFIG=$(XFTLIBDIR)/XftConfig
-
-TYPE1DIR=XftType1Dir
-CONFIG_DEFS=-DXFT_TYPE1_DIR=\"$(TYPE1DIR)\"
-INCLUDES=$(FREETYPE2INCLUDES)
-DEFINES=-DXFT_DEFAULT_PATH=\"$(XFTCONFIG)\" $(FREETYPE2DEFINES) $(RENDERDEFINES)
-
-#if UseFreetype2
-FREETYPE2REQLIB = $(FREETYPE2LIB)
-#endif
-
-REQUIREDLIBS=$(LDPRELIBS) $(XRENDERLIB) $(XLIB) $(FREETYPE2REQLIB)
-
-#if UseFreetype2
-FT_HEADERS = XftFreetype.h
- FT_SRCS = xftcache.c xftdir.c xftfreetype.c xftglyphs.c xftrender.c
- FT_OBJS = xftcache.o xftdir.o xftfreetype.o xftglyphs.o xftrender.o
-#endif
-
-HEADERS = Xft.h $(FT_HEADERS)
-
- SRCS = xftcfg.c xftcolor.c xftcore.c xftdbg.c xftdpy.c \
- xftdraw.c xftextent.c xftfont.c xftfs.c xftgram.c \
- xftinit.c xftlex.c xftlist.c xftmatch.c xftmatrix.c \
- xftname.c xftpat.c xftstr.c xftxlfd.c $(FT_SRCS)
-
- OBJS = xftcfg.o xftcolor.o xftcore.o xftdbg.o xftdpy.o \
- xftdraw.o xftextent.o xftfont.o xftfs.o xftgram.o \
- xftinit.o xftlex.o xftlist.o xftmatch.o xftmatrix.o \
- xftname.o xftpat.o xftstr.o xftxlfd.o $(FT_OBJS)
-
-#include <Library.tmpl>
-
-LexFilePrefix(xftlex,XftConfig)
-YaccFilePrefix(xftgram,$(YFLAGS),XftConfig)
-
-#if DoSharedLib && SharedDataSeparation
-SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF))
-#endif
-
-all:: XftConfig
-
-CppFileTarget(XftConfig,XftConfig.cpp,$(CONFIG_DEFS),$(ICONFIGFILES))
-
-#if InstallFSConfig
-InstallNonExecFile(XftConfig,$(XFTLIBDIR))
-#else
-InstallNonExecFileNoClobber(XftConfig,$(XFTLIBDIR))
-#endif
-
-LinkConfFileLong(XftConfig,XftConfig,$(XFTLIBDIR),$(CONFDIR))
-
-MANSUFFIX = $(LIBMANSUFFIX)
-InstallManPage(Xft,$(LIBMANDIR))
-DependTarget()
diff --git a/xc/lib/Xft/Xft-def.cpp b/xc/lib/Xft/Xft-def.cpp
deleted file mode 100644
index 0f27d645e..000000000
--- a/xc/lib/Xft/Xft-def.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-LIBRARY Xft
-VERSION LIBRARY_VERSION
-EXPORTS
-
-XftConfigAddDir
-XftConfigAddEdit
-XftConfigGetCache
-XftConfigSetCache
-XftConfigSubstitute
-_XftConfigCompareValue
-XftColorAllocName
-XftColorAllocValue
-XftColorFree
-XftCoreConvert16
-XftCoreConvert32
-XftCoreConvertUtf8
-XftCoreExtents16
-XftCoreExtents32
-XftCoreExtents8
-XftCoreExtentsUtf8
-XftCoreGlyphExists
-XftEditPrint
-XftExprPrint
-XftFontSetPrint
-XftOpPrint
-XftPatternPrint
-XftSubstPrint
-XftTestPrint
-XftValueListPrint
-XftValuePrint
-XftDefaultGetBool
-XftDefaultGetDouble
-XftDefaultGetInteger
-XftDefaultHasRender
-XftDefaultParseBool
-XftDefaultSet
-XftDefaultSubstitute
-XftDisplayGetFontSet
-XftDrawChange
-XftDrawCorePrepare
-XftDrawCreate
-XftDrawCreateBitmap
-XftDrawDestroy
-XftDrawRect
-XftDrawRenderPrepare
-XftDrawSetClip
-XftDrawString16
-XftDrawString32
-XftDrawString8
-XftDrawStringUtf8
-XftTextExtents16
-XftTextExtents32
-XftTextExtents8
-XftTextExtentsUtf8
-XftFontClose
-XftFontMatch
-XftFontOpen
-XftFontOpenName
-XftFontOpenPattern
-XftFontOpenXlfd
-XftGlyphExists
-_XftFontDebug
-XftFontSetAdd
-XftFontSetCreate
-XftFontSetDestroy
-XftConfigSaveField
-XftConfigerror
-XftConfigparse
-XftConfigwrap
-XftEditCreate
-XftEditDestroy
-XftExprCreateBool
-XftExprCreateDouble
-XftExprCreateField
-XftExprCreateInteger
-XftExprCreateNil
-XftExprCreateOp
-XftExprCreateString
-XftExprDestroy
-XftTestCreate
-XftInit
-XftConfigLexFile
-XftConfigPushInput
-XftConfig_create_buffer
-XftConfig_delete_buffer
-XftConfig_flush_buffer
-XftConfig_init_buffer
-XftConfig_load_buffer_state
-XftConfig_scan_buffer
-XftConfig_scan_bytes
-XftConfig_scan_string
-XftConfig_switch_to_buffer
-XftConfiglex
-XftConfigrestart
-XftListAppend
-XftListFontSets
-XftListFonts
-XftListFontsPatternObjects
-XftListMatch
-XftListValueCompare
-XftListValueListCompare
-XftObjectSetAdd
-XftObjectSetBuild
-XftObjectSetCreate
-XftObjectSetDestroy
-XftObjectSetVaBuild
-XftFontSetMatch
-XftNameConstant
-XftNameParse
-XftNameUnparse
-XftPatternAdd
-XftPatternAddBool
-XftPatternAddDouble
-XftPatternAddInteger
-XftPatternAddString
-XftPatternBuild
-XftPatternCreate
-XftPatternDel
-XftPatternDestroy
-XftPatternDuplicate
-XftPatternFind
-XftPatternGet
-XftPatternGetBool
-XftPatternGetDouble
-XftPatternGetInteger
-XftPatternGetString
-XftPatternVaBuild
-XftValueDestroy
-XftValueListDestroy
-XftUtf8Len
-XftUtf8ToUcs4
-_XftDownStr
-_XftGetInt
-_XftMatchSymbolic
-_XftSaveString
-_XftSplitField
-_XftSplitStr
-_XftSplitValue
-_XftStrCmpIgnoreCase
-XftCoreAddFonts
-XftCoreClose
-XftCoreOpen
-XftXlfdParse
-
-
-/* $XFree86: xc/lib/Xft/Xft-def.cpp,v 1.1 2001/02/13 19:19:12 dawes Exp $ */
diff --git a/xc/lib/Xft/Xft.h b/xc/lib/Xft/Xft.h
deleted file mode 100644
index 7746a7507..000000000
--- a/xc/lib/Xft/Xft.h
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/Xft.h,v 1.19 2001/04/29 03:21:17 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 _XFT_H_
-#define _XFT_H_
-
-#include <X11/extensions/Xrender.h>
-#include <stdarg.h>
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xosdefs.h>
-
-typedef unsigned char XftChar8;
-typedef unsigned short XftChar16;
-typedef unsigned int XftChar32;
-
-#define XFT_FAMILY "family" /* String */
-#define XFT_STYLE "style" /* String */
-#define XFT_SLANT "slant" /* Int */
-#define XFT_WEIGHT "weight" /* Int */
-#define XFT_SIZE "size" /* Double */
-#define XFT_PIXEL_SIZE "pixelsize" /* Double */
-#define XFT_ENCODING "encoding" /* String */
-#define XFT_SPACING "spacing" /* Int */
-#define XFT_FOUNDRY "foundry" /* String */
-#define XFT_CORE "core" /* Bool */
-#define XFT_ANTIALIAS "antialias" /* Bool */
-#define XFT_XLFD "xlfd" /* String */
-#define XFT_FILE "file" /* String */
-#define XFT_INDEX "index" /* Int */
-#define XFT_RASTERIZER "rasterizer"/* String */
-#define XFT_OUTLINE "outline" /* Bool */
-#define XFT_SCALABLE "scalable" /* Bool */
-#define XFT_RGBA "rgba" /* Int */
-
-/* defaults from resources */
-#define XFT_SCALE "scale" /* double */
-#define XFT_RENDER "render" /* Bool */
-#define XFT_MINSPACE "minspace" /* Bool use minimum line spacing */
-#define XFT_DPI "dpi" /* double */
-
-/* specific to FreeType rasterizer */
-#define XFT_CHAR_WIDTH "charwidth" /* Int */
-#define XFT_CHAR_HEIGHT "charheight"/* Int */
-#define XFT_MATRIX "matrix" /* XftMatrix */
-
-#define XFT_WEIGHT_LIGHT 0
-#define XFT_WEIGHT_MEDIUM 100
-#define XFT_WEIGHT_DEMIBOLD 180
-#define XFT_WEIGHT_BOLD 200
-#define XFT_WEIGHT_BLACK 210
-
-#define XFT_SLANT_ROMAN 0
-#define XFT_SLANT_ITALIC 100
-#define XFT_SLANT_OBLIQUE 110
-
-#define XFT_PROPORTIONAL 0
-#define XFT_MONO 100
-#define XFT_CHARCELL 110
-
-#define XFT_RGBA_NONE 0
-#define XFT_RGBA_RGB 1
-#define XFT_RGBA_BGR 2
-#define XFT_RGBA_VRGB 3
-#define XFT_RGBA_VBGR 4
-
-typedef enum _XftType {
- XftTypeVoid,
- XftTypeInteger,
- XftTypeDouble,
- XftTypeString,
- XftTypeBool,
- XftTypeMatrix
-} XftType;
-
-typedef struct _XftMatrix {
- double xx, xy, yx, yy;
-} XftMatrix;
-
-#define XftMatrixInit(m) ((m)->xx = (m)->yy = 1, \
- (m)->xy = (m)->yx = 0)
-
-typedef enum _XftResult {
- XftResultMatch, XftResultNoMatch, XftResultTypeMismatch, XftResultNoId
-} XftResult;
-
-typedef struct _XftValue {
- XftType type;
- union {
- char *s;
- int i;
- Bool b;
- double d;
- XftMatrix *m;
- } u;
-} XftValue;
-
-typedef struct _XftValueList {
- struct _XftValueList *next;
- XftValue value;
-} XftValueList;
-
-typedef struct _XftPatternElt {
- const char *object;
- XftValueList *values;
-} XftPatternElt;
-
-typedef struct _XftPattern {
- int num;
- int size;
- XftPatternElt *elts;
-} XftPattern;
-
-typedef struct _XftFontSet {
- int nfont;
- int sfont;
- XftPattern **fonts;
-} XftFontSet;
-
-typedef struct _XftFontStruct XftFontStruct;
-
-typedef struct _XftFont {
- int ascent;
- int descent;
- int height;
- int max_advance_width;
- Bool core;
- XftPattern *pattern;
- union {
- struct {
- XFontStruct *font;
- } core;
- struct {
- XftFontStruct *font;
- } ft;
- } u;
-} XftFont;
-
-typedef struct _XftDraw XftDraw;
-
-typedef struct _XftColor {
- unsigned long pixel;
- XRenderColor color;
-} XftColor;
-
-typedef struct _XftObjectSet {
- int nobject;
- int sobject;
- const char **objects;
-} XftObjectSet;
-
-_XFUNCPROTOBEGIN
-
-/* xftcfg.c */
-Bool
-XftConfigSubstitute (XftPattern *p);
-
-/* xftcolor.c */
-Bool
-XftColorAllocName (Display *dpy,
- Visual *visual,
- Colormap cmap,
- char *name,
- XftColor *result);
-
-Bool
-XftColorAllocValue (Display *dpy,
- Visual *visual,
- Colormap cmap,
- XRenderColor *color,
- XftColor *result);
-
-void
-XftColorFree (Display *dpy,
- Visual *visual,
- Colormap cmap,
- XftColor *color);
-
-
-/* xftcore.c */
-/* xftdbg.c */
-void
-XftValuePrint (XftValue v);
-
-void
-XftValueListPrint (XftValueList *l);
-
-void
-XftPatternPrint (XftPattern *p);
-
-void
-XftFontSetPrint (XftFontSet *s);
-
-/* xftdir.c */
-/* xftdpy.c */
-Bool
-XftDefaultHasRender (Display *dpy);
-
-Bool
-XftDefaultSet (Display *dpy, XftPattern *defaults);
-
-void
-XftDefaultSubstitute (Display *dpy, int screen, XftPattern *pattern);
-
-/* xftdraw.c */
-
-XftDraw *
-XftDrawCreate (Display *dpy,
- Drawable drawable,
- Visual *visual,
- Colormap colormap);
-
-XftDraw *
-XftDrawCreateBitmap (Display *dpy,
- Pixmap bitmap);
-
-void
-XftDrawChange (XftDraw *draw,
- Drawable drawable);
-
-void
-XftDrawDestroy (XftDraw *draw);
-
-void
-XftDrawString8 (XftDraw *d,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar8 *string,
- int len);
-
-void
-XftDrawString16 (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar16 *string,
- int len);
-
-void
-XftDrawString32 (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar32 *string,
- int len);
-
-void
-XftDrawStringUtf8 (XftDraw *d,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar8 *string,
- int len);
-
-void
-XftDrawRect (XftDraw *d,
- XftColor *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height);
-
-
-Bool
-XftDrawSetClip (XftDraw *d,
- Region r);
-
-/* xftextent.c */
-
-void
-XftTextExtents8 (Display *dpy,
- XftFont *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftTextExtents16 (Display *dpy,
- XftFont *font,
- XftChar16 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftTextExtents32 (Display *dpy,
- XftFont *font,
- XftChar32 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftTextExtentsUtf8 (Display *dpy,
- XftFont *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents);
-
-/* xftfont.c */
-XftPattern *
-XftFontMatch (Display *dpy, int screen, XftPattern *pattern, XftResult *result);
-
-XftFont *
-XftFontOpenPattern (Display *dpy, XftPattern *pattern);
-
-XftFont *
-XftFontOpen (Display *dpy, int screen, ...);
-
-XftFont *
-XftFontOpenName (Display *dpy, int screen, const char *name);
-
-XftFont *
-XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd);
-
-void
-XftFontClose (Display *dpy, XftFont *font);
-
-Bool
-XftGlyphExists (Display *dpy, XftFont *font, XftChar32 glyph);
-
-/* xftfreetype.c */
-/* xftfs.c */
-
-XftFontSet *
-XftFontSetCreate (void);
-
-void
-XftFontSetDestroy (XftFontSet *s);
-
-Bool
-XftFontSetAdd (XftFontSet *s, XftPattern *font);
-
-/* xftglyphs.c */
-/* see XftFreetype.h */
-
-/* xftgram.y */
-
-/* xftinit.c */
-Bool
-XftInit (char *config);
-
-/* xftlex.l */
-
-/* xftlist.c */
-XftObjectSet *
-XftObjectSetCreate (void);
-
-Bool
-XftObjectSetAdd (XftObjectSet *os, const char *object);
-
-void
-XftObjectSetDestroy (XftObjectSet *os);
-
-XftObjectSet *
-XftObjectSetVaBuild (const char *first, va_list va);
-
-XftObjectSet *
-XftObjectSetBuild (const char *first, ...);
-
-XftFontSet *
-XftListFontSets (XftFontSet **sets,
- int nsets,
- XftPattern *p,
- XftObjectSet *os);
-
-XftFontSet *
-XftListFontsPatternObjects (Display *dpy,
- int screen,
- XftPattern *pattern,
- XftObjectSet *os);
-
-XftFontSet *
-XftListFonts (Display *dpy,
- int screen,
- ...);
-
-/* xftmatch.c */
-XftPattern *
-XftFontSetMatch (XftFontSet **sets,
- int nsets,
- XftPattern *p,
- XftResult *result);
-
-/* xftmatrix.c */
-int
-XftMatrixEqual (const XftMatrix *mat1, const XftMatrix *mat2);
-
-void
-XftMatrixMultiply (XftMatrix *result, XftMatrix *a, XftMatrix *b);
-
-void
-XftMatrixRotate (XftMatrix *m, double c, double s);
-
-void
-XftMatrixScale (XftMatrix *m, double sx, double sy);
-
-void
-XftMatrixShear (XftMatrix *m, double sh, double sv);
-
-/* xftname.c */
-XftPattern *
-XftNameParse (const char *name);
-
-Bool
-XftNameUnparse (XftPattern *pat, char *dest, int len);
-
-/* xftpat.c */
-XftPattern *
-XftPatternCreate (void);
-
-XftPattern *
-XftPatternDuplicate (XftPattern *p);
-
-void
-XftValueDestroy (XftValue v);
-
-void
-XftValueListDestroy (XftValueList *l);
-
-void
-XftPatternDestroy (XftPattern *p);
-
-XftPatternElt *
-XftPatternFind (XftPattern *p, const char *object, Bool insert);
-
-Bool
-XftPatternAdd (XftPattern *p, const char *object, XftValue value, Bool append);
-
-XftResult
-XftPatternGet (XftPattern *p, const char *object, int id, XftValue *v);
-
-Bool
-XftPatternDel (XftPattern *p, const char *object);
-
-Bool
-XftPatternAddInteger (XftPattern *p, const char *object, int i);
-
-Bool
-XftPatternAddDouble (XftPattern *p, const char *object, double d);
-
-Bool
-XftPatternAddString (XftPattern *p, const char *object, const char *s);
-
-Bool
-XftPatternAddMatrix (XftPattern *p, const char *object, const XftMatrix *s);
-
-Bool
-XftPatternAddBool (XftPattern *p, const char *object, Bool b);
-
-XftResult
-XftPatternGetInteger (XftPattern *p, const char *object, int n, int *i);
-
-XftResult
-XftPatternGetDouble (XftPattern *p, const char *object, int n, double *d);
-
-XftResult
-XftPatternGetString (XftPattern *p, const char *object, int n, char **s);
-
-XftResult
-XftPatternGetMatrix (XftPattern *p, const char *object, int n, XftMatrix **s);
-
-XftResult
-XftPatternGetBool (XftPattern *p, const char *object, int n, Bool *b);
-
-XftPattern *
-XftPatternVaBuild (XftPattern *orig, va_list va);
-
-XftPattern *
-XftPatternBuild (XftPattern *orig, ...);
-
-/* xftrender.c */
-/* see XftFreetype.h */
-
-/* xftstr.c */
-
-int
-XftUtf8ToUcs4 (XftChar8 *src_orig,
- XftChar32 *dst,
- int len);
-
-Bool
-XftUtf8Len (XftChar8 *string,
- int len,
- int *nchar,
- int *wchar);
-
-/* xftxlfd.c */
-XftPattern *
-XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable, Bool complete);
-
-XFontStruct *
-XftCoreOpen (Display *dpy, XftPattern *pattern);
-
-void
-XftCoreClose (Display *dpy, XFontStruct *font);
-
-_XFUNCPROTOEND
-
-#endif /* _XFT_H_ */
diff --git a/xc/lib/Xft/Xft.man b/xc/lib/Xft/Xft.man
deleted file mode 100644
index 0a71bc931..000000000
--- a/xc/lib/Xft/Xft.man
+++ /dev/null
@@ -1,181 +0,0 @@
-.\"
-.\" $XFree86: xc/lib/Xft/Xft.man,v 1.2 2000/11/30 06:59:45 keithp Exp $
-.\"
-.\" Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
-.\"
-.\" 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 Keith Packard not be used in
-.\" advertising or publicity pertaining to distribution of the software without
-.\" specific, written prior permission. Keith Packard makes no
-.\" representations about the suitability of this software for any purpose. It
-.\" is provided "as is" without express or implied warranty.
-.\"
-.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-.\" EVENT SHALL KEITH 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.
-.\"
-.de TQ
-.br
-.ns
-.TP \\$1
-..
-.TH XFT 3 "Version 1.0" "XFree86"
-
-.SH NAME
- XFT \- X FreeType interface library
-
-.SH DESCRIPTION
-.B Xft
-is a simple library designed to interface the FreeType rasterizer with the X
-Rendering Extension. This manual page barely scratches the surface of this
-library.
-
-.SH DATATYPES
-
-.B XftPattern
-holds a set of names with associated value lists; each name refers to a
-property of a font. XftPatterns are used as inputs to the matching code as
-well as holding information about specific fonts.
-
-.B XftFont
-contains general font metrics and a pointer to either the core XFontStruct
-data or a structure holding FreeType and X Render Extension data.
-
-.B XftFontStruct
-contains information about FreeType fonts used with the X Render Extension.
-
-.B XftFontSet
-contains a list of XftPatterns. Internally Xft uses this data structure to
-hold sets of fonts. Externally, Xft returns the results of listing fonts in
-this format.
-
-.B XftObjectSet
-holds a set of names and is used to specify which fields from fonts are
-placed in the the list of returned patterns when listing fonts.
-
-.B XftDraw
-is an opaque object which holds information used to render to an X drawable
-using either core protocol or the X Rendering extension.
-
-.SH FUNCTIONS
-.nf
-XftFont *
-XftFontOpen (Display *dpy, int screen, ...);
-.fi
-.B XftFontOpen
-takes a list of pattern elements of the form (field, type, value) terminated
-with a 0, matches that pattern against the available fonts and opens the
-matching font.
-.PP
-Example:
-.br
- font = XftFontOpen (dpy, scr,
- XFT_FAMILY, XftTypeString, "charter",
- XFT_SIZE, XftTypeDouble, 12.0);
-.PP
-This opens the charter font at 12 points. The point size is automatically
-converted to the correct pixel size based on the resolution of the monitor.
-.PP
-.nf
-void
-XftTextExtents8 (Display *dpy,
- XftFont *font,
- unsigned char *string,
- int len,
- XGlyphInfo *extents);
-.fi
-.B XftTextExtents8
-computes the pixel extents of "string" when drawn with "font".
-.PP
-.nf
-XftDraw *
-XftDrawCreate (Display *dpy,
- Drawable drawable,
- Visual *visual,
- Colormap colormap);
-.fi
-.B XtDrawCreate
-creates a structure that can be used to render text and rectangles
-to the screen.
-.PP
-.nf
-void
-XftDrawString8 (XftDraw *d,
- XRenderColor *color,
- XftFont *font,
- int x,
- int y,
- unsigned char *string,
- int len);
-.fi
-.B XftDrawString8
-draws "string" using "font" in "color" at "x, y".
-.PP
-.nf
-void
-XftDrawRect (XftDraw *d,
- XRenderColor *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height);
-.fi
-.B XftDrawRect
-fills a solid rectangle in the specified color.
-.SH XftConfig
-The
-.B XftConfig
-file contains configuration information for the Xft library consisting of
-directories to look at for font information as well as instructions on
-editing program specified font patterns before attempting to match the
-available fonts.
-.PP
-.nf
-config : "dir" STRING
- | "include" STRING
- | "includeif" STRING
- | "match" tests "edit" edits
- ;
-test : qual FIELD-NAME COMPARE CONSTANT
- ;
-qual : "any"
- | "all"
- ;
-edit : FIELD-NAME ASSIGN expr SEMI
- ;
-.fi
-.PP
-STRINGs are double-quote delimited. FIELD-NAMEs are identifiers,
-ASSIGN is one of "=", "+=" or "=+". expr can contain the usual
-arithmetic operators and can include FIELD-NAMEs.
-.PP
-"dir" adds a directory to the list of places Xft will look for fonts.
-There is no particular order implied by the list; Xft treats all fonts about
-the same.
-.PP
-"include" and "includeif" cause Xft to load more configuration parameters
-from the indicated file. "includeif" doesn't elicit a complaint if the file
-doesn't exist. If the file name begins with a '~' character, it refers to a
-path relative to the home directory of the user.
-.PP
-If the tests in a "match" statement all match a user-specified pattern, the
-pattern will be edited with the specified instructions.
-.PP
-Where ASSIGN is "=", the matching value in the pattern will be replaced by
-the given expression. "+="/"=+" will prepend/append a new value to the list
-of values for the indicated field.
-
-.SH RESTRICTIONS
-.B Xft
-will probably change radically in the future; weak attempts will be made to
-retain some level of source-file compatibility.
-
-.SH AUTHOR
-Keith Packard, member of the XFree86 Project, Inc.
diff --git a/xc/lib/Xft/XftConfig.cpp b/xc/lib/Xft/XftConfig.cpp
deleted file mode 100644
index cf04051cd..000000000
--- a/xc/lib/Xft/XftConfig.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-XCOMM $XFree86: xc/lib/Xft/XftConfig.cpp,v 1.6 2001/04/27 14:55:22 tsi Exp $
-
-dir XFT_TYPE1_DIR
-
-XCOMM
-XCOMM alias 'fixed' for 'mono'
-XCOMM
-match any family == "fixed" edit family =+ "mono";
-
-XCOMM
-XCOMM Check users config file
-XCOMM
-includeif "~/.xftconfig"
-
-XCOMM
-XCOMM Use Lucidux fonts for default faces
-XCOMM
-match any family == "serif" edit family += "LuciduxSerif";
-match any family == "sans" edit family += "LuciduxSans";
-match any family == "mono" edit family += "LuciduxMono";
-
-XCOMM
-XCOMM Alias between XLFD families and font file family name, prefer local
-XCOMM fonts
-XCOMM
-match any family == "charter" edit family += "bitstream charter";
-match any family == "bitstream charter" edit family =+ "charter";
-
-match any family == "Lucidux Serif" edit family += "LuciduxSerif";
-match any family == "LuciduxSerif" edit family =+ "Lucidux Serif";
-
-match any family == "Lucidux Sans" edit family += "LuciduxSans";
-match any family == "LuciduxSans" edit family =+ "Lucidux Sans";
-
-match any family == "Lucidux Mono" edit family += "LuciduxMono";
-match any family == "LuciduxMono" edit family =+ "Lucidux Mono";
diff --git a/xc/lib/Xft/XftFreetype.h b/xc/lib/Xft/XftFreetype.h
deleted file mode 100644
index 38635a110..000000000
--- a/xc/lib/Xft/XftFreetype.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/XftFreetype.h,v 1.15 2001/03/31 23:07:29 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 _XFTFREETYPE_H_
-#define _XFTFREETYPE_H_
-
-#include <X11/Xft/Xft.h>
-#include <freetype/freetype.h>
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xosdefs.h>
-
-extern FT_Library _XftFTlibrary;
-
-struct _XftFontStruct {
- FT_Face face; /* handle to face object */
- GlyphSet glyphset;
- int min_char;
- int max_char;
- FT_F26Dot6 size;
- int ascent;
- int descent;
- int height;
- int max_advance_width;
- int spacing;
- int rgba;
- Bool antialias;
- int charmap; /* -1 for unencoded */
- XRenderPictFormat *format;
- XGlyphInfo **realized;
- int nrealized;
- Bool transform;
- FT_Matrix matrix;
-};
-
-_XFUNCPROTOBEGIN
-
-/* xftdir.c */
-Bool
-XftDirScan (XftFontSet *set, const char *dir, Bool force);
-
-Bool
-XftDirSave (XftFontSet *set, const char *dir);
-
-/* xftfreetype.c */
-XftPattern *
-XftFreeTypeQuery (const char *file, int id, int *count);
-
-Bool
-XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap, FT_Matrix *matrix);
-
-XftFontStruct *
-XftFreeTypeOpen (Display *dpy, XftPattern *pattern);
-
-void
-XftFreeTypeClose (Display *dpy, XftFontStruct *font);
-
-XftFontStruct *
-XftFreeTypeGet (XftFont *font);
-
-Bool
-XftInitFtLibrary(void);
-
-/* xftglyphs.c */
-void
-XftGlyphLoad (Display *dpy,
- XftFontStruct *font,
- XftChar32 *glyphs,
- int nglyph);
-
-void
-XftGlyphCheck (Display *dpy,
- XftFontStruct *font,
- XftChar32 glyph,
- XftChar32 *missing,
- int *nmissing);
-
-Bool
-XftFreeTypeGlyphExists (Display *dpy,
- XftFontStruct *font,
- XftChar32 glyph);
-
-/* xftrender.c */
-
-void
-XftRenderString8 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar8 *string, int len);
-
-void
-XftRenderString16 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar16 *string, int len);
-
-void
-XftRenderString32 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar32 *string, int len);
-
-void
-XftRenderStringUtf8 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar8 *string, int len);
-
-void
-XftRenderExtents8 (Display *dpy,
- XftFontStruct *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftRenderExtents16 (Display *dpy,
- XftFontStruct *font,
- XftChar16 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftRenderExtents32 (Display *dpy,
- XftFontStruct *font,
- XftChar32 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftRenderExtentsUtf8 (Display *dpy,
- XftFontStruct *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents);
-
-_XFUNCPROTOEND
-
-#endif /* _XFTFREETYPE_H_ */
diff --git a/xc/lib/Xft/xftcache.c b/xc/lib/Xft/xftcache.c
deleted file mode 100644
index 571d086f5..000000000
--- a/xc/lib/Xft/xftcache.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftcache.c,v 1.1 2001/01/02 02:46:51 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "xftint.h"
-
-typedef struct _XftFileCacheEnt {
- struct _XftFileCacheEnt *next;
- unsigned int hash;
- char *file;
- int id;
- time_t time;
- char *name;
- Bool referenced;
-} XftFileCacheEnt;
-
-#define HASH_SIZE 509
-
-typedef struct _XftFileCache {
- XftFileCacheEnt *ents[HASH_SIZE];
- Bool updated;
- int entries;
- int referenced;
-} XftFileCache;
-
-static XftFileCache _XftFileCache;
-
-static unsigned int
-_XftFileCacheHash (char *string)
-{
- unsigned int h = 0;
- char c;
-
- while ((c = *string++))
- h = (h << 1) ^ c;
- return h;
-}
-
-char *
-XftFileCacheFind (char *file, int id, int *count)
-{
- XftFileCache *cache;
- unsigned int hash;
- char *match;
- XftFileCacheEnt *c, *name;
- int maxid;
- struct stat statb;
-
- cache = &_XftFileCache;
- match = file;
-
- hash = _XftFileCacheHash (match);
- name = 0;
- maxid = -1;
- for (c = cache->ents[hash % HASH_SIZE]; c; c = c->next)
- {
- if (c->hash == hash && !strcmp (match, c->file))
- {
- if (c->id > maxid)
- maxid = c->id;
- if (c->id == id)
- {
- if (stat (file, &statb) < 0)
- {
- if (_XftFontDebug () & XFT_DBG_CACHE)
- printf (" file missing\n");
- return 0;
- }
- if (statb.st_mtime != c->time)
- {
- if (_XftFontDebug () & XFT_DBG_CACHE)
- printf (" timestamp mismatch (was %d is %d)\n",
- (int) c->time, (int) statb.st_mtime);
- return 0;
- }
- if (!c->referenced)
- {
- cache->referenced++;
- c->referenced = True;
- }
- name = c;
- }
- }
- }
- if (!name)
- return 0;
- *count = maxid;
- return name->name;
-}
-
-/*
- * Cache file syntax is quite simple:
- *
- * "file_name" id time "font_name" \n
- */
-
-static Bool
-_XftFileCacheReadString (FILE *f, char *dest, int len)
-{
- int c;
- Bool escape;
-
- while ((c = getc (f)) != EOF)
- if (c == '"')
- break;
- if (c == EOF)
- return False;
- if (len == 0)
- return False;
-
- escape = False;
- while ((c = getc (f)) != EOF)
- {
- if (!escape)
- {
- switch (c) {
- case '"':
- *dest++ = '\0';
- return True;
- case '\\':
- escape = True;
- continue;
- }
- }
- if (--len <= 1)
- return False;
- *dest++ = c;
- escape = False;
- }
- return False;
-}
-
-static Bool
-_XftFileCacheReadUlong (FILE *f, unsigned long *dest)
-{
- unsigned long t;
- int c;
-
- while ((c = getc (f)) != EOF)
- {
- if (!isspace (c))
- break;
- }
- if (c == EOF)
- return False;
- t = 0;
- for (;;)
- {
- if (c == EOF || isspace (c))
- break;
- if (!isdigit (c))
- return False;
- t = t * 10 + (c - '0');
- c = getc (f);
- }
- *dest = t;
- return True;
-}
-
-static Bool
-_XftFileCacheReadInt (FILE *f, int *dest)
-{
- unsigned long t;
- Bool ret;
-
- ret = _XftFileCacheReadUlong (f, &t);
- if (ret)
- *dest = (int) t;
- return ret;
-}
-
-static Bool
-_XftFileCacheReadTime (FILE *f, time_t *dest)
-{
- unsigned long t;
- Bool ret;
-
- ret = _XftFileCacheReadUlong (f, &t);
- if (ret)
- *dest = (time_t) t;
- return ret;
-}
-
-static Bool
-_XftFileCacheAdd (XftFileCache *cache,
- char *file,
- int id,
- time_t time,
- char *name,
- Bool replace)
-{
- XftFileCacheEnt *c;
- XftFileCacheEnt **prev, *old;
- unsigned int hash;
-
- if (_XftFontDebug () & XFT_DBG_CACHE)
- {
- printf ("%s face %s/%d as %s\n", replace ? "Replace" : "Add",
- file, id, name);
- }
- hash = _XftFileCacheHash (file);
- for (prev = &cache->ents[hash % HASH_SIZE];
- (old = *prev);
- prev = &(*prev)->next)
- {
- if (old->hash == hash && old->id == id && !strcmp (old->file, file))
- break;
- }
- if (*prev)
- {
- if (!replace)
- return False;
-
- old = *prev;
- if (old->referenced)
- cache->referenced--;
- *prev = old->next;
- free (old);
- cache->entries--;
- }
-
- c = malloc (sizeof (XftFileCacheEnt) +
- strlen (file) + 1 +
- strlen (name) + 1);
- if (!c)
- return False;
- c->next = *prev;
- *prev = c;
- c->hash = hash;
- c->file = (char *) (c + 1);
- c->id = id;
- c->name = c->file + strlen (file) + 1;
- strcpy (c->file, file);
- c->time = time;
- c->referenced = replace;
- strcpy (c->name, name);
- cache->entries++;
- return True;
-}
-
-void
-XftFileCacheDispose (void)
-{
- XftFileCache *cache;
- XftFileCacheEnt *c, *next;
- int h;
-
- cache = &_XftFileCache;
-
- for (h = 0; h < HASH_SIZE; h++)
- {
- for (c = cache->ents[h]; c; c = next)
- {
- next = c->next;
- free (c);
- }
- cache->ents[h] = 0;
- }
- cache->entries = 0;
- cache->referenced = 0;
- cache->updated = False;
-}
-
-void
-XftFileCacheLoad (char *cache_file)
-{
- XftFileCache *cache;
- FILE *f;
- char file[8192];
- int id;
- time_t time;
- char name[8192];
-
- f = fopen (cache_file, "r");
- if (!f)
- return;
-
- cache = &_XftFileCache;
-
- cache->updated = False;
- while (_XftFileCacheReadString (f, file, sizeof (file)) &&
- _XftFileCacheReadInt (f, &id) &&
- _XftFileCacheReadTime (f, &time) &&
- _XftFileCacheReadString (f, name, sizeof (name)))
- {
- (void) _XftFileCacheAdd (cache, file, id, time, name, False);
- }
- fclose (f);
-}
-
-Bool
-XftFileCacheUpdate (char *file, int id, char *name)
-{
- XftFileCache *cache;
- char *match;
- struct stat statb;
- Bool ret;
-
- cache = &_XftFileCache;
- match = file;
-
- if (stat (file, &statb) < 0)
- return False;
- ret = _XftFileCacheAdd (cache, match, id,
- statb.st_mtime, name, True);
- if (ret)
- cache->updated = True;
- return ret;
-}
-
-static Bool
-_XftFileCacheWriteString (FILE *f, char *string)
-{
- char c;
-
- if (putc ('"', f) == EOF)
- return False;
- while ((c = *string++))
- {
- switch (c) {
- case '"':
- case '\\':
- if (putc ('\\', f) == EOF)
- return False;
- /* fall through */
- default:
- if (putc (c, f) == EOF)
- return False;
- }
- }
- if (putc ('"', f) == EOF)
- return False;
- return True;
-}
-
-static Bool
-_XftFileCacheWriteUlong (FILE *f, unsigned long t)
-{
- int pow;
- unsigned long temp, digit;
-
- temp = t;
- pow = 1;
- while (temp >= 10)
- {
- temp /= 10;
- pow *= 10;
- }
- temp = t;
- while (pow)
- {
- digit = temp / pow;
- if (putc ((char) digit + '0', f) == EOF)
- return False;
- temp = temp - pow * digit;
- pow = pow / 10;
- }
- return True;
-}
-
-static Bool
-_XftFileCacheWriteInt (FILE *f, int i)
-{
- return _XftFileCacheWriteUlong (f, (unsigned long) i);
-}
-
-static Bool
-_XftFileCacheWriteTime (FILE *f, time_t t)
-{
- return _XftFileCacheWriteUlong (f, (unsigned long) t);
-}
-
-Bool
-XftFileCacheSave (char *cache_file)
-{
- XftFileCache *cache;
- char *lck;
- char *tmp;
- FILE *f;
- int h;
- XftFileCacheEnt *c;
-
- cache = &_XftFileCache;
-
- if (!cache->updated && cache->referenced == cache->entries)
- return True;
-
- lck = malloc (strlen (cache_file)*2 + 4);
- if (!lck)
- goto bail0;
- tmp = lck + strlen (cache_file) + 2;
- strcpy (lck, cache_file);
- strcat (lck, "L");
- strcpy (tmp, cache_file);
- strcat (tmp, "T");
- if (link (lck, cache_file) < 0 && errno != ENOENT)
- goto bail1;
- if (access (tmp, F_OK) == 0)
- goto bail2;
- f = fopen (tmp, "w");
- if (!f)
- goto bail2;
-
- for (h = 0; h < HASH_SIZE; h++)
- {
- for (c = cache->ents[h]; c; c = c->next)
- {
- if (!c->referenced)
- continue;
- if (!_XftFileCacheWriteString (f, c->file))
- goto bail4;
- if (putc (' ', f) == EOF)
- goto bail4;
- if (!_XftFileCacheWriteInt (f, c->id))
- goto bail4;
- if (putc (' ', f) == EOF)
- goto bail4;
- if (!_XftFileCacheWriteTime (f, c->time))
- goto bail4;
- if (putc (' ', f) == EOF)
- goto bail4;
- if (!_XftFileCacheWriteString (f, c->name))
- goto bail4;
- if (putc ('\n', f) == EOF)
- goto bail4;
- }
- }
-
- if (fclose (f) == EOF)
- goto bail3;
-
- if (rename (tmp, cache_file) < 0)
- goto bail3;
-
- unlink (lck);
- cache->updated = False;
- return True;
-
-bail4:
- fclose (f);
-bail3:
- unlink (tmp);
-bail2:
- unlink (lck);
-bail1:
- free (lck);
-bail0:
- return False;
-}
-
-Bool
-XftFileCacheReadDir (XftFontSet *set, const char *cache_file)
-{
- XftPattern *font;
- FILE *f;
- char *path;
- char *base;
- char file[8192];
- int id;
- char name[8192];
- Bool ret = False;
-
- if (_XftFontDebug () & XFT_DBG_CACHE)
- {
- printf ("XftFileCacheReadDir cache_file \"%s\"\n", cache_file);
- }
-
- f = fopen (cache_file, "r");
- if (!f)
- {
- if (_XftFontDebug () & XFT_DBG_CACHE)
- {
- printf (" no cache file\n");
- }
- goto bail0;
- }
-
- base = strrchr (cache_file, '/');
- if (!base)
- goto bail1;
- base++;
- path = malloc (base - cache_file + 8192 + 1);
- if (!path)
- goto bail1;
- memcpy (path, cache_file, base - cache_file);
- base = path + (base - cache_file);
-
- while (_XftFileCacheReadString (f, file, sizeof (file)) &&
- _XftFileCacheReadInt (f, &id) &&
- _XftFileCacheReadString (f, name, sizeof (name)))
- {
- font = XftNameParse (name);
- if (font)
- {
- strcpy (base, file);
- if (_XftFontDebug () & XFT_DBG_CACHEV)
- {
- printf (" dir cache file \"%s\"\n", file);
- }
- XftPatternAddString (font, XFT_FILE, path);
- if (!XftFontSetAdd (set, font))
- goto bail2;
- }
- }
- if (_XftFontDebug () & XFT_DBG_CACHE)
- {
- printf (" cache loaded\n");
- }
-
- ret = True;
-bail2:
- free (path);
-bail1:
- fclose (f);
-bail0:
- return ret;
-}
-
-Bool
-XftFileCacheWriteDir (XftFontSet *set, const char *cache_file)
-{
- XftPattern *font;
- FILE *f;
- char name[8192];
- char *file, *base;
- int n;
- int id;
-
- if (_XftFontDebug () & XFT_DBG_CACHE)
- printf ("XftFileCacheWriteDir cache_file \"%s\"\n", cache_file);
-
- f = fopen (cache_file, "w");
- if (!f)
- {
- if (_XftFontDebug () & XFT_DBG_CACHE)
- printf (" can't create \"%s\"\n", cache_file);
- goto bail0;
- }
- for (n = 0; n < set->nfont; n++)
- {
- font = set->fonts[n];
- if (XftPatternGetString (font, XFT_FILE, 0, &file) != XftResultMatch)
- goto bail1;
- base = strrchr (file, '/');
- if (base)
- base = base + 1;
- else
- base = file;
- if (XftPatternGetInteger (font, XFT_INDEX, 0, &id) != XftResultMatch)
- goto bail1;
- if (!XftNameUnparse (font, name, sizeof (name)))
- goto bail1;
- if (_XftFontDebug () & XFT_DBG_CACHEV)
- printf (" write file \"%s\"\n", base);
- if (!_XftFileCacheWriteString (f, base))
- goto bail1;
- if (putc (' ', f) == EOF)
- goto bail1;
- if (!_XftFileCacheWriteInt (f, id))
- goto bail1;
- if (putc (' ', f) == EOF)
- goto bail1;
- if (!_XftFileCacheWriteString (f, name))
- goto bail1;
- if (putc ('\n', f) == EOF)
- goto bail1;
- }
- if (fclose (f) == EOF)
- goto bail0;
-
- if (_XftFontDebug () & XFT_DBG_CACHE)
- printf (" cache written\n");
- return True;
-
-bail1:
- fclose (f);
-bail0:
- unlink (cache_file);
- return False;
-}
diff --git a/xc/lib/Xft/xftcfg.c b/xc/lib/Xft/xftcfg.c
deleted file mode 100644
index 8ddbc463c..000000000
--- a/xc/lib/Xft/xftcfg.c
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftcfg.c,v 1.9 2001/03/31 01:57:20 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "xftint.h"
-
-static char *XftConfigDefaultDirs[] = {
- "/usr/X11R6/lib/X11/fonts/Type1",
- 0
-};
-
-char **XftConfigDirs = XftConfigDefaultDirs;
-static int XftConfigNdirs;
-
-char XftConfigDefaultCache[] = "~/.xftcache";
-char *XftConfigCache = 0;
-
-static XftSubst *XftSubsts;
-/* #define XFT_DEBUG_EDIT */
-
-Bool
-XftConfigAddDir (char *d)
-{
- char **dirs;
- char *dir;
- char *h;
-
- if (*d == '~')
- {
- h = getenv ("HOME");
- if (!h)
- return False;
- dir = (char *) malloc (strlen (h) + strlen (d));
- if (!dir)
- return False;
- strcpy (dir, h);
- strcat (dir, d+1);
- }
- else
- {
- dir = (char *) malloc (strlen (d) + 1);
- if (!dir)
- return False;
- strcpy (dir, d);
- }
- dirs = (char **) malloc ((XftConfigNdirs + 2) * sizeof (char *));
- if (!dirs)
- {
- free (dir);
- return False;
- }
- if (XftConfigNdirs)
- {
- memcpy (dirs, XftConfigDirs, XftConfigNdirs * sizeof (char *));
- }
- dirs[XftConfigNdirs] = dir;
- XftConfigNdirs++;
- dirs[XftConfigNdirs] = 0;
- if (XftConfigDirs != XftConfigDefaultDirs)
- free (XftConfigDirs);
- XftConfigDirs = dirs;
- return True;
-}
-
-Bool
-XftConfigSetCache (char *c)
-{
- char *new;
- char *h;
-
- if (*c == '~')
- {
- h = getenv ("HOME");
- if (!h)
- return False;
- new = (char *) malloc (strlen (h) + strlen (c));
- if (!new)
- return False;
- strcpy (new, h);
- strcat (new, c+1);
- }
- else
- {
- new = _XftSaveString (c);
- }
- if (XftConfigCache)
- free (XftConfigCache);
- XftConfigCache = new;
- return True;
-}
-
-char *
-XftConfigGetCache (void)
-{
- if (!XftConfigCache)
- XftConfigSetCache (XftConfigDefaultCache);
- return XftConfigCache;
-}
-
-static int XftSubstsMaxObjects;
-
-Bool
-XftConfigAddEdit (XftTest *test, XftEdit *edit)
-{
- XftSubst *subst, **prev;
- XftTest *t;
- int num;
-
- subst = (XftSubst *) malloc (sizeof (XftSubst));
- if (!subst)
- return False;
- for (prev = &XftSubsts; *prev; prev = &(*prev)->next);
- *prev = subst;
- subst->next = 0;
- subst->test = test;
- subst->edit = edit;
-#ifdef XFT_DEBUG_EDIT
- printf ("Add Subst ");
- XftSubstPrint (subst);
-#endif
- num = 0;
- for (t = test; t; t = t->next)
- num++;
- if (XftSubstsMaxObjects < num)
- XftSubstsMaxObjects = num;
- return True;
-}
-
-typedef struct _XftSubState {
- XftPatternElt *elt;
- XftValueList *value;
-} XftSubState;
-
-static XftMatrix XftIdentityMatrix = { 1, 0, 0, 1 };
-
-static XftValue
-_XftConfigPromote (XftValue v, XftValue u)
-{
- if (v.type == XftTypeInteger)
- {
- v.type = XftTypeDouble;
- v.u.d = (double) v.u.i;
- }
- if (v.type == XftTypeVoid && u.type == XftTypeMatrix)
- {
- v.u.m = &XftIdentityMatrix;
- v.type = XftTypeMatrix;
- }
- return v;
-}
-
-Bool
-_XftConfigCompareValue (XftValue m,
- XftOp op,
- XftValue v)
-{
- Bool ret;
-
- if (m.type == XftTypeVoid)
- return True;
- m = _XftConfigPromote (m, v);
- v = _XftConfigPromote (v, m);
- if (m.type == v.type)
- {
- ret = False;
- switch (m.type) {
- case XftTypeDouble:
- switch (op) {
- case XftOpEqual:
- ret = m.u.d == v.u.d;
- break;
- case XftOpNotEqual:
- ret = m.u.d != v.u.d;
- break;
- case XftOpLess:
- ret = m.u.d < v.u.d;
- break;
- case XftOpLessEqual:
- ret = m.u.d <= v.u.d;
- break;
- case XftOpMore:
- ret = m.u.d > v.u.d;
- break;
- case XftOpMoreEqual:
- ret = m.u.d >= v.u.d;
- break;
- default:
- break;
- }
- break;
- case XftTypeBool:
- switch (op) {
- case XftOpEqual:
- ret = m.u.b == v.u.b;
- break;
- case XftOpNotEqual:
- ret = m.u.b != v.u.b;
- break;
- default:
- break;
- }
- break;
- case XftTypeString:
- switch (op) {
- case XftOpEqual:
- ret = _XftStrCmpIgnoreCase (m.u.s, v.u.s) == 0;
- break;
- case XftOpNotEqual:
- ret = _XftStrCmpIgnoreCase (m.u.s, v.u.s) != 0;
- break;
- default:
- break;
- }
- break;
- default:
- break;
- }
- }
- else
- {
- if (op == XftOpNotEqual)
- ret = True;
- else
- ret = False;
- }
- return ret;
-}
-
-static XftValueList *
-_XftConfigMatchValueList (XftTest *t,
- XftValueList *v)
-{
- XftValueList *ret = 0;
-
- for (; v; v = v->next)
- {
- if (_XftConfigCompareValue (v->value, t->op, t->value))
- {
- if (!ret)
- ret = v;
- }
- else
- {
- if (t->qual == XftQualAll)
- {
- ret = 0;
- break;
- }
- }
- }
- return ret;
-}
-
-static XftValue
-_XftConfigEvaluate (XftPattern *p, XftExpr *e)
-{
- XftValue v, vl, vr;
- XftResult r;
-
- switch (e->op) {
- case XftOpInteger:
- v.type = XftTypeInteger;
- v.u.i = e->u.ival;
- break;
- case XftOpDouble:
- v.type = XftTypeDouble;
- v.u.d = e->u.dval;
- break;
- case XftOpString:
- v.type = XftTypeString;
- v.u.s = e->u.sval;
- break;
- case XftOpMatrix:
- v.type = XftTypeMatrix;
- v.u.m = e->u.mval;
- break;
- case XftOpBool:
- v.type = XftTypeBool;
- v.u.b = e->u.bval;
- break;
- case XftOpField:
- r = XftPatternGet (p, e->u.field, 0, &v);
- if (r != XftResultMatch)
- v.type = XftTypeVoid;
- break;
- case XftOpQuest:
- vl = _XftConfigEvaluate (p, e->u.tree.left);
- if (vl.type == XftTypeBool)
- {
- if (vl.u.b)
- v = _XftConfigEvaluate (p, e->u.tree.right->u.tree.left);
- else
- v = _XftConfigEvaluate (p, e->u.tree.right->u.tree.right);
- }
- else
- v.type = XftTypeVoid;
- break;
- case XftOpOr:
- case XftOpAnd:
- case XftOpEqual:
- case XftOpNotEqual:
- case XftOpLess:
- case XftOpLessEqual:
- case XftOpMore:
- case XftOpMoreEqual:
- case XftOpPlus:
- case XftOpMinus:
- case XftOpTimes:
- case XftOpDivide:
- vl = _XftConfigEvaluate (p, e->u.tree.left);
- vr = _XftConfigEvaluate (p, e->u.tree.right);
- vl = _XftConfigPromote (vl, vr);
- vr = _XftConfigPromote (vr, vl);
- if (vl.type == vr.type)
- {
- switch (vl.type) {
- case XftTypeDouble:
- switch (e->op) {
- case XftOpPlus:
- v.type = XftTypeDouble;
- v.u.d = vl.u.d + vr.u.d;
- break;
- case XftOpMinus:
- v.type = XftTypeDouble;
- v.u.d = vl.u.d - vr.u.d;
- break;
- case XftOpTimes:
- v.type = XftTypeDouble;
- v.u.d = vl.u.d * vr.u.d;
- break;
- case XftOpDivide:
- v.type = XftTypeDouble;
- v.u.d = vl.u.d / vr.u.d;
- break;
- case XftOpEqual:
- v.type = XftTypeBool;
- v.u.b = vl.u.d == vr.u.d;
- break;
- case XftOpNotEqual:
- v.type = XftTypeBool;
- v.u.b = vl.u.d != vr.u.d;
- break;
- case XftOpLess:
- v.type = XftTypeBool;
- v.u.b = vl.u.d < vr.u.d;
- break;
- case XftOpLessEqual:
- v.type = XftTypeBool;
- v.u.b = vl.u.d <= vr.u.d;
- break;
- case XftOpMore:
- v.type = XftTypeBool;
- v.u.b = vl.u.d > vr.u.d;
- break;
- case XftOpMoreEqual:
- v.type = XftTypeBool;
- v.u.b = vl.u.d >= vr.u.d;
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- if (v.type == XftTypeDouble &&
- v.u.d == (double) (int) v.u.d)
- {
- v.type = XftTypeInteger;
- v.u.i = (int) v.u.d;
- }
- break;
- case XftTypeBool:
- switch (e->op) {
- case XftOpOr:
- v.type = XftTypeBool;
- v.u.b = vl.u.b || vr.u.b;
- break;
- case XftOpAnd:
- v.type = XftTypeBool;
- v.u.b = vl.u.b && vr.u.b;
- break;
- case XftOpEqual:
- v.type = XftTypeBool;
- v.u.b = vl.u.b == vr.u.b;
- break;
- case XftOpNotEqual:
- v.type = XftTypeBool;
- v.u.b = vl.u.b != vr.u.b;
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- break;
- case XftTypeString:
- switch (e->op) {
- case XftOpEqual:
- v.type = XftTypeBool;
- v.u.b = _XftStrCmpIgnoreCase (vl.u.s, vr.u.s) == 0;
- break;
- case XftOpNotEqual:
- v.type = XftTypeBool;
- v.u.b = _XftStrCmpIgnoreCase (vl.u.s, vr.u.s) != 0;
- break;
- case XftOpPlus:
- v.type = XftTypeString;
- v.u.s = malloc (strlen (vl.u.s) + strlen (vr.u.s) + 1);
- if (v.u.s)
- {
- strcpy (v.u.s, vl.u.s);
- strcat (v.u.s, vr.u.s);
- }
- else
- v.type = XftTypeVoid;
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- case XftTypeMatrix:
- switch (e->op) {
- case XftOpEqual:
- v.type = XftTypeBool;
- v.u.b = XftMatrixEqual (vl.u.m, vr.u.m) == 0;
- break;
- case XftOpNotEqual:
- v.type = XftTypeBool;
- v.u.b = XftMatrixEqual (vl.u.m, vr.u.m) != 0;
- break;
- case XftOpTimes:
- v.type = XftTypeMatrix;
- v.u.m = malloc (sizeof (XftMatrix));
- XftMatrixMultiply (v.u.m, vl.u.m, vr.u.m);
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- }
- else
- v.type = XftTypeVoid;
- break;
- case XftOpNot:
- vl = _XftConfigEvaluate (p, e->u.tree.left);
- switch (vl.type) {
- case XftTypeBool:
- v.type = XftTypeBool;
- v.u.b = !vl.u.b;
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- break;
- default:
- v.type = XftTypeVoid;
- break;
- }
- return v;
-}
-
-static Bool
-_XftConfigAdd (XftValueList **head,
- XftValueList *position,
- Bool append,
- XftValue value)
-{
- XftValueList *new, **prev;
-
- new = (XftValueList *) malloc (sizeof (XftValueList));
- if (!new)
- goto bail0;
-
- if (value.type == XftTypeString)
- {
- value.u.s = _XftSaveString (value.u.s);
- if (!value.u.s)
- goto bail1;
-
- }
- new->value = value;
- new->next = 0;
-
- if (append)
- {
- prev = &position->next;
- }
- else
- {
- for (prev = head; *prev; prev = &(*prev)->next)
- {
- if (*prev == position)
- break;
- }
-#ifdef XFT_DEBUG
- if (!*prev)
- printf ("position not on list\n");
-#endif
- }
-
-#ifdef XFT_DEBUG_EDIT
- printf ("%s list before ", append ? "Append" : "Prepend");
- XftValueListPrint (*head);
- printf ("\n");
-#endif
-
- new->next = *prev;
- *prev = new;
-
-#ifdef XFT_DEBUG_EDIT
- printf ("%s list after ", append ? "Append" : "Prepend");
- XftValueListPrint (*head);
- printf ("\n");
-#endif
-
- return True;
-
-bail1:
- free (new);
-bail0:
- return False;
-}
-
-static void
-_XftConfigDel (XftValueList **head,
- XftValueList *position)
-{
- XftValueList **prev;
-
- for (prev = head; *prev; prev = &(*prev)->next)
- {
- if (*prev == position)
- {
- *prev = position->next;
- position->next = 0;
- XftValueListDestroy (position);
- break;
- }
- }
-}
-
-Bool
-XftConfigSubstitute (XftPattern *p)
-{
- XftSubst *s;
- XftSubState *st;
- int i;
- XftTest *t;
- XftEdit *e;
- XftValue v;
-
- st = (XftSubState *) malloc (XftSubstsMaxObjects * sizeof (XftSubState));
- if (!st && XftSubstsMaxObjects)
- return False;
-
-#ifdef XFT_DEBUG_EDIT
- printf ("XftConfigSubstitute ");
- XftPatternPrint (p);
-#endif
- for (s = XftSubsts; s; s = s->next)
- {
- for (t = s->test, i = 0; t; t = t->next, i++)
- {
-#ifdef XFT_DEBUG_EDIT
- printf ("XftConfigSubstitute test ");
- XftTestPrint (t);
-#endif
- st[i].elt = XftPatternFind (p, t->field, False);
- if (!st[i].elt)
- {
- if (t->qual == XftQualAll)
- continue;
- else
- break;
- }
- st[i].value = _XftConfigMatchValueList (t, st[i].elt->values);
- if (!st[i].value)
- break;
- }
- if (t)
- {
-#ifdef XFT_DEBUG_EDIT
- printf ("No match\n");
-#endif
- continue;
- }
-#ifdef XFT_DEBUG_EDIT
- printf ("Substitute ");
- XftSubstPrint (s);
-#endif
- for (e = s->edit; e; e = e->next)
- {
- v = _XftConfigEvaluate (p, e->expr);
- if (v.type == XftTypeVoid)
- continue;
- for (t = s->test, i = 0; t; t = t->next, i++)
- if (!_XftStrCmpIgnoreCase (t->field, e->field))
- break;
- switch (e->op) {
- case XftOpAssign:
- if (t)
- {
- _XftConfigAdd (&st[i].elt->values, st[i].value, True, v);
- _XftConfigDel (&st[i].elt->values, st[i].value);
- }
- else
- {
- XftPatternDel (p, e->field);
- XftPatternAdd (p, e->field, v, True);
- }
- break;
- case XftOpPrepend:
- if (t)
- _XftConfigAdd (&st[i].elt->values, st[i].value, False, v);
- else
- XftPatternAdd (p, e->field, v, False);
- break;
- case XftOpAppend:
- if (t)
- _XftConfigAdd (&st[i].elt->values, st[i].value, True, v);
- else
- XftPatternAdd (p, e->field, v, True);
- break;
- default:
- break;
- }
- }
-#ifdef XFT_DEBUG_EDIT
- printf ("XftConfigSubstitute edit");
- XftPatternPrint (p);
-#endif
- }
- free (st);
-#ifdef XFT_DEBUG_EDIT
- printf ("XftConfigSubstitute done");
- XftPatternPrint (p);
-#endif
- return True;
-}
diff --git a/xc/lib/Xft/xftcolor.c b/xc/lib/Xft/xftcolor.c
deleted file mode 100644
index 6443e00ec..000000000
--- a/xc/lib/Xft/xftcolor.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftcolor.c,v 1.1 2000/12/01 03:27:57 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 "xftint.h"
-
-Bool
-XftColorAllocName (Display *dpy,
- Visual *visual,
- Colormap cmap,
- char *name,
- XftColor *result)
-{
- XColor screen, exact;
-
- if (!XAllocNamedColor (dpy, cmap, name, &screen, &exact))
- {
- /* XXX stick standard colormap stuff here */
- return False;
- }
-
- result->pixel = screen.pixel;
- result->color.red = exact.red;
- result->color.green = exact.green;
- result->color.blue = exact.blue;
- result->color.alpha = 0xffff;
- return True;
-}
-
-static short
-maskbase (unsigned long m)
-{
- short i;
-
- if (!m)
- return 0;
- i = 0;
- while (!(m&1))
- {
- m>>=1;
- i++;
- }
- return i;
-}
-
-static short
-masklen (unsigned long m)
-{
- unsigned long y;
-
- y = (m >> 1) &033333333333;
- y = m - y - ((y >>1) & 033333333333);
- return (short) (((y + (y >> 3)) & 030707070707) % 077);
-}
-
-Bool
-XftColorAllocValue (Display *dpy,
- Visual *visual,
- Colormap cmap,
- XRenderColor *color,
- XftColor *result)
-{
- if (visual->class == TrueColor)
- {
- int red_shift, red_len;
- int green_shift, green_len;
- int blue_shift, blue_len;
-
- red_shift = maskbase (visual->red_mask);
- red_len = masklen (visual->red_mask);
- green_shift = maskbase (visual->green_mask);
- green_len = masklen (visual->green_mask);
- blue_shift = maskbase (visual->blue_mask);
- blue_len = masklen (visual->blue_mask);
- result->pixel = (((color->red >> (16 - red_len)) << red_shift) |
- ((color->green >> (16 - green_len)) << green_shift) |
- ((color->blue >> (16 - blue_len)) << blue_shift));
- }
- else
- {
- XColor xcolor;
-
- xcolor.red = color->red;
- xcolor.green = color->green;
- xcolor.blue = color->blue;
- if (!XAllocColor (dpy, cmap, &xcolor))
- return False;
- result->pixel = xcolor.pixel;
- }
- result->color.red = color->red;
- result->color.green = color->green;
- result->color.blue = color->blue;
- result->color.alpha = 0xffff;
- return True;
-}
-
-void
-XftColorFree (Display *dpy,
- Visual *visual,
- Colormap cmap,
- XftColor *color)
-{
- if (visual->class != TrueColor)
- XFreeColors (dpy, cmap, &color->pixel, 1, 0);
-}
diff --git a/xc/lib/Xft/xftcore.c b/xc/lib/Xft/xftcore.c
deleted file mode 100644
index 114533c69..000000000
--- a/xc/lib/Xft/xftcore.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftcore.c,v 1.5 2000/12/20 00:28:44 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include "xftint.h"
-
-XChar2b *
-XftCoreConvert16 (XftChar16 *string,
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL])
-{
- XChar2b *xc;
- int i;
-
- if (len < XFT_CORE_N16LOCAL)
- xc = xcloc;
- else
- xc = (XChar2b *) malloc (len * sizeof (XChar2b));
- for (i = 0; i < len; i++)
- {
- xc[i].byte1 = string[i] & 0xff;
- xc[i].byte2 = (string[i] >> 8) & 0xff;
- }
- return xc;
-}
-
-XChar2b *
-XftCoreConvert32 (XftChar32 *string,
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL])
-{
- XChar2b *xc;
- int i;
-
- if (len < XFT_CORE_N16LOCAL)
- xc = xcloc;
- else
- xc = (XChar2b *) malloc (len * sizeof (XChar2b));
- for (i = 0; i < len; i++)
- {
- xc[i].byte1 = string[i] & 0xff;
- xc[i].byte2 = (string[i] >> 8) & 0xff;
- }
- return xc;
-}
-
-XChar2b *
-XftCoreConvertUtf8 (XftChar8 *string,
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL],
- int *nchar)
-{
- XChar2b *xc;
- XftChar32 c;
- int i;
- int n, width;
- int clen;
-
- if (!XftUtf8Len (string, len, &n, &width))
- return 0;
-
- if (n < XFT_CORE_N16LOCAL)
- xc = xcloc;
- else
- xc = (XChar2b *) malloc (n * sizeof (XChar2b));
- for (i = 0; i < n; i++)
- {
- clen = XftUtf8ToUcs4 (string, &c, len);
- xc[i].byte1 = c & 0xff;
- xc[i].byte2 = (c >> 8) & 0xff;
- string += clen;
- len -= clen;
- }
- *nchar = n;
- return xc;
-}
-
-void
-XftCoreExtents8 (Display *dpy,
- XFontStruct *fs,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents)
-{
- int direction;
- int ascent, descent;
- XCharStruct overall;
-
- XTextExtents (fs, (char *) string, len, &direction,
- &ascent, &descent, &overall);
- if (overall.lbearing < overall.rbearing)
- {
- extents->x = overall.lbearing;
- extents->width = overall.rbearing - overall.lbearing;
- }
- else
- {
- extents->x = overall.rbearing;
- extents->width = overall.lbearing - overall.rbearing;
- }
- extents->y = -overall.ascent;
- extents->height = overall.ascent + overall.descent;
- extents->xOff = overall.width;
- extents->yOff = 0;
-}
-
-void
-XftCoreExtents16 (Display *dpy,
- XFontStruct *fs,
- XftChar16 *string,
- int len,
- XGlyphInfo *extents)
-{
- int direction;
- int ascent, descent;
- XCharStruct overall;
- XChar2b *xc, xcloc[XFT_CORE_N16LOCAL];
-
- xc = XftCoreConvert16 (string, len, xcloc);
- XTextExtents16 (fs, xc, len, &direction,
- &ascent, &descent, &overall);
- if (xc != xcloc)
- free (xc);
- if (overall.lbearing < overall.rbearing)
- {
- extents->x = overall.lbearing;
- extents->width = overall.rbearing - overall.lbearing;
- }
- else
- {
- extents->x = overall.rbearing;
- extents->width = overall.lbearing - overall.rbearing;
- }
- extents->y = -overall.ascent;
- extents->height = overall.ascent + overall.descent;
- extents->xOff = overall.width;
- extents->yOff = 0;
-}
-
-void
-XftCoreExtents32 (Display *dpy,
- XFontStruct *fs,
- XftChar32 *string,
- int len,
- XGlyphInfo *extents)
-{
- int direction;
- int ascent, descent;
- XCharStruct overall;
- XChar2b *xc, xcloc[XFT_CORE_N16LOCAL];
-
- xc = XftCoreConvert32 (string, len, xcloc);
- XTextExtents16 (fs, xc, len, &direction,
- &ascent, &descent, &overall);
- if (xc != xcloc)
- free (xc);
- if (overall.lbearing < overall.rbearing)
- {
- extents->x = overall.lbearing;
- extents->width = overall.rbearing - overall.lbearing;
- }
- else
- {
- extents->x = overall.rbearing;
- extents->width = overall.lbearing - overall.rbearing;
- }
- extents->y = -overall.ascent;
- extents->height = overall.ascent + overall.descent;
- extents->xOff = overall.width;
- extents->yOff = 0;
-}
-
-void
-XftCoreExtentsUtf8 (Display *dpy,
- XFontStruct *fs,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents)
-{
- int direction;
- int ascent, descent;
- XCharStruct overall;
- XChar2b *xc, xcloc[XFT_CORE_N16LOCAL];
- int n;
-
- xc = XftCoreConvertUtf8 (string, len, xcloc, &n);
- XTextExtents16 (fs, xc, n, &direction,
- &ascent, &descent, &overall);
- if (xc != xcloc)
- free (xc);
- if (overall.lbearing < overall.rbearing)
- {
- extents->x = overall.lbearing;
- extents->width = overall.rbearing - overall.lbearing;
- }
- else
- {
- extents->x = overall.rbearing;
- extents->width = overall.lbearing - overall.rbearing;
- }
- extents->y = -overall.ascent;
- extents->height = overall.ascent + overall.descent;
- extents->xOff = overall.width;
- extents->yOff = 0;
-}
-
-Bool
-XftCoreGlyphExists (Display *dpy,
- XFontStruct *fs,
- XftChar32 glyph)
-{
- int direction;
- int ascent, descent;
- XCharStruct overall;
- XChar2b xc;
-
- XftCoreConvert32 (&glyph, 1, &xc);
- XTextExtents16 (fs, &xc, 1, &direction,
- &ascent, &descent, &overall);
- return (overall.lbearing != 0 ||
- overall.rbearing != 0 ||
- overall.width != 0 ||
- overall.ascent != 0 ||
- overall.descent != 0);
-}
-
diff --git a/xc/lib/Xft/xftdbg.c b/xc/lib/Xft/xftdbg.c
deleted file mode 100644
index 69e3e6695..000000000
--- a/xc/lib/Xft/xftdbg.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftdbg.c,v 1.1 2000/11/29 08:39:21 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 "xftint.h"
-#include <stdio.h>
-
-void
-XftValuePrint (XftValue v)
-{
- switch (v.type) {
- case XftTypeVoid:
- printf (" <void>");
- break;
- case XftTypeInteger:
- printf (" %d", v.u.i);
- break;
- case XftTypeDouble:
- printf (" %g", v.u.d);
- break;
- case XftTypeString:
- printf (" \"%s\"", v.u.s);
- break;
- case XftTypeBool:
- printf (" %s", v.u.b ? "True" : "False");
- break;
- }
-}
-
-void
-XftValueListPrint (XftValueList *l)
-{
- for (; l; l = l->next)
- XftValuePrint (l->value);
-}
-
-void
-XftPatternPrint (XftPattern *p)
-{
- int i;
- XftPatternElt *e;
-
- printf ("Pattern %d of %d\n", p->num, p->size);
- for (i = 0; i < p->num; i++)
- {
- e = &p->elts[i];
- printf ("\t%s:", e->object);
- XftValueListPrint (e->values);
- printf ("\n");
- }
- printf ("\n");
-}
-
-void
-XftOpPrint (XftOp op)
-{
- switch (op) {
- case XftOpInteger: printf ("Integer"); break;
- case XftOpDouble: printf ("Double"); break;
- case XftOpString: printf ("String"); break;
- case XftOpBool: printf ("Bool"); break;
- case XftOpField: printf ("Field"); break;
- case XftOpAssign: printf ("Assign"); break;
- case XftOpPrepend: printf ("Prepend"); break;
- case XftOpAppend: printf ("Append"); break;
- case XftOpQuest: printf ("Quest"); break;
- case XftOpOr: printf ("Or"); break;
- case XftOpAnd: printf ("And"); break;
- case XftOpEqual: printf ("Equal"); break;
- case XftOpNotEqual: printf ("NotEqual"); break;
- case XftOpLess: printf ("Less"); break;
- case XftOpLessEqual: printf ("LessEqual"); break;
- case XftOpMore: printf ("More"); break;
- case XftOpMoreEqual: printf ("MoreEqual"); break;
- case XftOpPlus: printf ("Plus"); break;
- case XftOpMinus: printf ("Minus"); break;
- case XftOpTimes: printf ("Times"); break;
- case XftOpDivide: printf ("Divide"); break;
- case XftOpNot: printf ("Not"); break;
- case XftOpNil: printf ("Nil"); break;
- }
-}
-
-void
-XftTestPrint (XftTest *test)
-{
- switch (test->qual) {
- case XftQualAny:
- printf ("any ");
- break;
- case XftQualAll:
- printf ("all ");
- break;
- }
- printf ("%s ", test->field);
- XftOpPrint (test->op);
- printf (" ");
- XftValuePrint (test->value);
- printf ("\n");
-}
-
-void
-XftExprPrint (XftExpr *expr)
-{
- switch (expr->op) {
- case XftOpInteger: printf ("%d", expr->u.ival); break;
- case XftOpDouble: printf ("%g", expr->u.dval); break;
- case XftOpString: printf ("\"%s\"", expr->u.sval); break;
- case XftOpBool: printf ("%s", expr->u.bval ? "true" : "false"); break;
- case XftOpField: printf ("%s", expr->u.field); break;
- case XftOpQuest:
- XftExprPrint (expr->u.tree.left);
- printf (" quest ");
- XftExprPrint (expr->u.tree.right->u.tree.left);
- printf (" colon ");
- XftExprPrint (expr->u.tree.right->u.tree.right);
- break;
- case XftOpOr:
- case XftOpAnd:
- case XftOpEqual:
- case XftOpNotEqual:
- case XftOpLess:
- case XftOpLessEqual:
- case XftOpMore:
- case XftOpMoreEqual:
- case XftOpPlus:
- case XftOpMinus:
- case XftOpTimes:
- case XftOpDivide:
- XftExprPrint (expr->u.tree.left);
- printf (" ");
- switch (expr->op) {
- case XftOpOr: printf ("Or"); break;
- case XftOpAnd: printf ("And"); break;
- case XftOpEqual: printf ("Equal"); break;
- case XftOpNotEqual: printf ("NotEqual"); break;
- case XftOpLess: printf ("Less"); break;
- case XftOpLessEqual: printf ("LessEqual"); break;
- case XftOpMore: printf ("More"); break;
- case XftOpMoreEqual: printf ("MoreEqual"); break;
- case XftOpPlus: printf ("Plus"); break;
- case XftOpMinus: printf ("Minus"); break;
- case XftOpTimes: printf ("Times"); break;
- case XftOpDivide: printf ("Divide"); break;
- default: break;
- }
- printf (" ");
- XftExprPrint (expr->u.tree.right);
- break;
- case XftOpNot:
- printf ("Not ");
- XftExprPrint (expr->u.tree.left);
- break;
- default:
- break;
- }
-}
-
-void
-XftEditPrint (XftEdit *edit)
-{
- printf ("Edit %s ", edit->field);
- XftOpPrint (edit->op);
- printf (" ");
- XftExprPrint (edit->expr);
-}
-
-void
-XftSubstPrint (XftSubst *subst)
-{
- XftEdit *e;
- XftTest *t;
-
- printf ("match\n");
- for (t = subst->test; t; t = t->next)
- {
- printf ("\t");
- XftTestPrint (t);
- }
- printf ("edit\n");
- for (e = subst->edit; e; e = e->next)
- {
- printf ("\t");
- XftEditPrint (e);
- printf (";\n");
- }
- printf ("\n");
-}
-
-void
-XftFontSetPrint (XftFontSet *s)
-{
- int i;
-
- printf ("FontSet %d of %d\n", s->nfont, s->sfont);
- for (i = 0; i < s->nfont; i++)
- {
- printf ("Font %d ", i);
- XftPatternPrint (s->fonts[i]);
- }
-}
diff --git a/xc/lib/Xft/xftdir.c b/xc/lib/Xft/xftdir.c
deleted file mode 100644
index d515a2ac9..000000000
--- a/xc/lib/Xft/xftdir.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftdir.c,v 1.1 2000/11/29 08:39:21 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <sys/types.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <string.h>
-#include "xftint.h"
-
-Bool
-XftDirScan (XftFontSet *set, const char *dir)
-{
- DIR *d;
- struct dirent *e;
- char *file;
- char *base;
- XftPattern *font;
- int count;
- Bool ret = True;
- int id;
-
- d = opendir (dir);
- if (!d)
- return False;
- file = (char *) malloc (strlen (dir) + 1 + 256 + 1);
- if (!file)
- {
- closedir (d);
- return False;
- }
- strcpy (file, dir);
- strcat (file, "/");
- base = file + strlen (file);
- while (ret && (e = readdir (d)))
- {
- if (e->d_name[0] != '.')
- {
- strcpy (base, e->d_name);
- id = 0;
- do
- {
- font = XftFreeTypeQuery (file, id, &count);
- if (font)
- {
- if (!XftFontSetAdd (set, font))
- ret = False;
- }
- id++;
- } while (font && ret && id < count);
- }
- }
- free (file);
- closedir (d);
- return ret;
-}
-
-
diff --git a/xc/lib/Xft/xftdpy.c b/xc/lib/Xft/xftdpy.c
deleted file mode 100644
index 2b4472a9a..000000000
--- a/xc/lib/Xft/xftdpy.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftdpy.c,v 1.7 2001/04/29 03:21:17 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <ctype.h>
-#include <X11/Xlibint.h>
-#include "xftint.h"
-
-XftDisplayInfo *_XftDisplayInfo;
-
-static int
-_XftCloseDisplay (Display *dpy, XExtCodes *codes)
-{
- XftDisplayInfo *info, **prev;
-
- for (prev = &_XftDisplayInfo; (info = *prev); prev = &(*prev)->next)
- if (info->codes == codes)
- break;
- if (!info)
- return 0;
- *prev = info->next;
- if (info->defaults)
- XftPatternDestroy (info->defaults);
- if (info->coreFonts)
- XftFontSetDestroy (info->coreFonts);
- free (info);
- return 0;
-}
-
-static XftDisplayInfo *
-_XftDisplayInfoGet (Display *dpy)
-{
- XftDisplayInfo *info, **prev;
-
- for (prev = &_XftDisplayInfo; (info = *prev); prev = &(*prev)->next)
- {
- if (info->display == dpy)
- {
- /*
- * MRU the list
- */
- if (prev != &_XftDisplayInfo)
- {
- *prev = info->next;
- info->next = _XftDisplayInfo;
- _XftDisplayInfo = info;
- }
- return info;
- }
- }
- info = (XftDisplayInfo *) malloc (sizeof (XftDisplayInfo));
- if (!info)
- goto bail0;
- info->codes = XAddExtension (dpy);
- if (!info->codes)
- goto bail1;
- (void) XESetCloseDisplay (dpy, info->codes->extension, _XftCloseDisplay);
-
- info->display = dpy;
- info->defaults = 0;
- info->coreFonts = 0;
- info->hasRender = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0;
- if (_XftFontDebug () & XFT_DBG_RENDER)
- {
- Visual *visual = DefaultVisual (dpy, DefaultScreen (dpy));
- XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual);
-
- printf ("XftDisplayInfoGet Default visual 0x%x ",
- (int) visual->visualid);
- if (format)
- {
- if (format->type == PictTypeDirect)
- {
- printf ("format %d,%d,%d,%d\n",
- format->direct.alpha,
- format->direct.red,
- format->direct.green,
- format->direct.blue);
- }
- else
- {
- printf ("format indexed\n");
- }
- }
- else
- printf ("No Render format for default visual\n");
-
- printf ("XftDisplayInfoGet initialized, hasRender set to \"%s\"\n",
- info->hasRender ? "True" : "False");
- }
-
- info->next = _XftDisplayInfo;
- _XftDisplayInfo = info;
- return info;
-
-bail1:
- free (info);
-bail0:
- if (_XftFontDebug () & XFT_DBG_RENDER)
- {
- printf ("XftDisplayInfoGet failed to initialize, Xft unhappy\n");
- }
- return 0;
-}
-
-Bool
-XftDefaultHasRender (Display *dpy)
-{
-#ifdef FREETYPE2
- XftDisplayInfo *info = _XftDisplayInfoGet (dpy);
-
- if (!info)
- return False;
- return info->hasRender;
-#else
- return False;
-#endif
-}
-
-Bool
-XftDefaultSet (Display *dpy, XftPattern *defaults)
-{
- XftDisplayInfo *info = _XftDisplayInfoGet (dpy);
-
- if (!info)
- return False;
- if (info->defaults)
- XftPatternDestroy (info->defaults);
- info->defaults = defaults;
- return True;
-}
-
-int
-XftDefaultParseBool (char *v)
-{
- char c0, c1;
-
- c0 = *v;
- if (isupper (c0))
- c0 = tolower (c0);
- if (c0 == 't' || c0 == 'y' || c0 == '1')
- return 1;
- if (c0 == 'f' || c0 == 'n' || c0 == '0')
- return 0;
- if (c0 == 'o')
- {
- c1 = v[1];
- if (isupper (c1))
- c1 = tolower (c1);
- if (c1 == 'n')
- return 1;
- if (c1 == 'f')
- return 0;
- }
- return -1;
-}
-
-static Bool
-_XftDefaultInitBool (Display *dpy, XftPattern *pat, char *option)
-{
- char *v;
- int i;
-
- v = XGetDefault (dpy, "Xft", option);
- if (v && (i = XftDefaultParseBool (v)) >= 0)
- return XftPatternAddBool (pat, option, i != 0);
- return True;
-}
-
-static Bool
-_XftDefaultInitDouble (Display *dpy, XftPattern *pat, char *option)
-{
- char *v, *e;
- double d;
-
- v = XGetDefault (dpy, "Xft", option);
- if (v)
- {
- d = strtod (v, &e);
- if (e != v)
- return XftPatternAddDouble (pat, option, d);
- }
- return True;
-}
-
-static Bool
-_XftDefaultInitInteger (Display *dpy, XftPattern *pat, char *option)
-{
- char *v, *e;
- int i;
-
- v = XGetDefault (dpy, "Xft", option);
- if (v)
- {
- if (XftNameConstant (v, &i))
- return XftPatternAddInteger (pat, option, i);
- i = strtol (v, &e, 0);
- if (e != v)
- return XftPatternAddInteger (pat, option, i);
- }
- return True;
-}
-
-static XftPattern *
-_XftDefaultInit (Display *dpy)
-{
- XftPattern *pat;
-
- pat = XftPatternCreate ();
- if (!pat)
- goto bail0;
-
- if (!_XftDefaultInitBool (dpy, pat, XFT_CORE))
- goto bail1;
- if (!_XftDefaultInitDouble (dpy, pat, XFT_SCALE))
- goto bail1;
- if (!_XftDefaultInitDouble (dpy, pat, XFT_DPI))
- goto bail1;
- if (!_XftDefaultInitBool (dpy, pat, XFT_RENDER))
- goto bail1;
- if (!_XftDefaultInitInteger (dpy, pat, XFT_RGBA))
- goto bail1;
- if (!_XftDefaultInitBool (dpy, pat, XFT_ANTIALIAS))
- goto bail1;
- if (!_XftDefaultInitBool (dpy, pat, XFT_MINSPACE))
- goto bail1;
-
- return pat;
-
-bail1:
- XftPatternDestroy (pat);
-bail0:
- return 0;
-}
-
-static XftResult
-_XftDefaultGet (Display *dpy, const char *object, int screen, XftValue *v)
-{
- XftDisplayInfo *info = _XftDisplayInfoGet (dpy);
- XftResult r;
-
- if (!info)
- return XftResultNoMatch;
-
- if (!info->defaults)
- {
- info->defaults = _XftDefaultInit (dpy);
- if (!info->defaults)
- return XftResultNoMatch;
- }
- r = XftPatternGet (info->defaults, object, screen, v);
- if (r == XftResultNoId && screen > 0)
- r = XftPatternGet (info->defaults, object, 0, v);
- return r;
-}
-
-Bool
-XftDefaultGetBool (Display *dpy, const char *object, int screen, Bool def)
-{
- XftResult r;
- XftValue v;
-
- r = _XftDefaultGet (dpy, object, screen, &v);
- if (r != XftResultMatch || v.type != XftTypeBool)
- return def;
- return v.u.b;
-}
-
-int
-XftDefaultGetInteger (Display *dpy, const char *object, int screen, int def)
-{
- XftResult r;
- XftValue v;
-
- r = _XftDefaultGet (dpy, object, screen, &v);
- if (r != XftResultMatch || v.type != XftTypeInteger)
- return def;
- return v.u.i;
-}
-
-double
-XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def)
-{
- XftResult r;
- XftValue v;
-
- r = _XftDefaultGet (dpy, object, screen, &v);
- if (r != XftResultMatch || v.type != XftTypeDouble)
- return def;
- return v.u.d;
-}
-
-XftFontSet *
-XftDisplayGetFontSet (Display *dpy)
-{
- XftDisplayInfo *info = _XftDisplayInfoGet (dpy);
-
- if (!info)
- return 0;
- if (!info->coreFonts)
- {
- info->coreFonts = XftFontSetCreate ();
- if (info->coreFonts)
- {
- if (!XftCoreAddFonts (info->coreFonts, dpy,
- XftDefaultGetBool (dpy, XFT_SCALABLE,
- DefaultScreen (dpy),
- False)))
- {
- XftFontSetDestroy (info->coreFonts);
- info->coreFonts = 0;
- }
- }
- }
- return info->coreFonts;
-}
-
-void
-XftDefaultSubstitute (Display *dpy, int screen, XftPattern *pattern)
-{
- XftValue v;
- double size;
- double scale;
-
- if (XftPatternGet (pattern, XFT_STYLE, 0, &v) == XftResultNoMatch)
- {
- if (XftPatternGet (pattern, XFT_WEIGHT, 0, &v) == XftResultNoMatch )
- {
- XftPatternAddInteger (pattern, XFT_WEIGHT, XFT_WEIGHT_MEDIUM);
- }
- if (XftPatternGet (pattern, XFT_SLANT, 0, &v) == XftResultNoMatch)
- {
- XftPatternAddInteger (pattern, XFT_SLANT, XFT_SLANT_ROMAN);
- }
- }
- if (XftPatternGet (pattern, XFT_ENCODING, 0, &v) == XftResultNoMatch)
- XftPatternAddString (pattern, XFT_ENCODING, "iso8859-1");
- if (XftPatternGet (pattern, XFT_RENDER, 0, &v) == XftResultNoMatch)
- {
- XftPatternAddBool (pattern, XFT_RENDER,
- XftDefaultGetBool (dpy, XFT_RENDER, screen,
- XftDefaultHasRender (dpy)));
- }
- if (XftPatternGet (pattern, XFT_CORE, 0, &v) == XftResultNoMatch)
- {
- XftPatternAddBool (pattern, XFT_CORE,
- XftDefaultGetBool (dpy, XFT_CORE, screen,
- !XftDefaultHasRender (dpy)));
- }
- if (XftPatternGet (pattern, XFT_ANTIALIAS, 0, &v) == XftResultNoMatch)
- {
- XftPatternAddBool (pattern, XFT_ANTIALIAS,
- XftDefaultGetBool (dpy, XFT_ANTIALIAS, screen,
- True));
- }
- if (XftPatternGet (pattern, XFT_RGBA, 0, &v) == XftResultNoMatch)
- {
- XftPatternAddInteger (pattern, XFT_RGBA,
- XftDefaultGetInteger (dpy, XFT_RGBA, screen,
- XFT_RGBA_NONE));
- }
- if (XftPatternGet (pattern, XFT_MINSPACE, 0, &v) == XftResultNoMatch)
- {
- XftPatternAddBool (pattern, XFT_MINSPACE,
- XftDefaultGetBool (dpy, XFT_MINSPACE, screen,
- False));
- }
- if (XftPatternGet (pattern, XFT_PIXEL_SIZE, 0, &v) == XftResultNoMatch)
- {
- int pixels, mm;
- double dpi;
-
- if (XftPatternGet (pattern, XFT_SIZE, 0, &v) != XftResultMatch)
- {
- size = 12.0;
- XftPatternAddDouble (pattern, XFT_SIZE, size);
- }
- else
- {
- switch (v.type) {
- case XftTypeInteger:
- size = (double) v.u.i;
- break;
- case XftTypeDouble:
- size = v.u.d;
- break;
- default:
- size = 12.0;
- break;
- }
- }
- scale = XftDefaultGetDouble (dpy, XFT_SCALE, screen, 1.0);
- size *= scale;
- pixels = DisplayHeight (dpy, screen);
- mm = DisplayHeightMM (dpy, screen);
- dpi = (((double) DisplayHeight (dpy, screen) * 25.4) /
- (double) DisplayHeightMM (dpy, screen));
- dpi = XftDefaultGetDouble (dpy, XFT_DPI, screen, dpi);
- size = size * dpi / 72.0;
- XftPatternAddDouble (pattern, XFT_PIXEL_SIZE, size);
- }
-}
-
diff --git a/xc/lib/Xft/xftdraw.c b/xc/lib/Xft/xftdraw.c
deleted file mode 100644
index 49ca016ed..000000000
--- a/xc/lib/Xft/xftdraw.c
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftdraw.c,v 1.15 2001/05/16 19:20:43 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <string.h>
-#include "xftint.h"
-#include <X11/Xutil.h>
-
-XftDraw *
-XftDrawCreate (Display *dpy,
- Drawable drawable,
- Visual *visual,
- Colormap colormap)
-{
- XftDraw *draw;
-
- draw = (XftDraw *) malloc (sizeof (XftDraw));
- if (!draw)
- return 0;
- draw->dpy = dpy;
- draw->drawable = drawable;
- draw->visual = visual;
- draw->colormap = colormap;
- draw->core_set = False;
- draw->render_set = False;
- draw->render_able = False;
- draw->clip = 0;
- return draw;
-}
-
-XftDraw *
-XftDrawCreateBitmap (Display *dpy,
- Pixmap bitmap)
-{
- XftDraw *draw;
-
- draw = (XftDraw *) malloc (sizeof (XftDraw));
- if (!draw)
- return 0;
- draw->dpy = dpy;
- draw->drawable = (Drawable) bitmap;
- draw->visual = 0;
- draw->colormap = 0;
- draw->core_set = False;
- draw->render_set = False;
- draw->render_able = False;
- draw->clip = 0;
- return draw;
-}
-
-static XRenderPictFormat *
-_XftDrawFormat (XftDraw *draw)
-{
- if (draw->visual == 0)
- {
- XRenderPictFormat pf;
-
- pf.type = PictTypeDirect;
- pf.depth = 1;
- pf.direct.alpha = 0;
- pf.direct.alphaMask = 1;
- return XRenderFindFormat (draw->dpy,
- (PictFormatType|
- PictFormatDepth|
- PictFormatAlpha|
- PictFormatAlphaMask),
- &pf,
- 0);
- }
- else
- return XRenderFindVisualFormat (draw->dpy, draw->visual);
-}
-
-static XRenderPictFormat *
-_XftDrawFgFormat (XftDraw *draw)
-{
- XRenderPictFormat pf;
-
- if (draw->visual == 0)
- {
- pf.type = PictTypeDirect;
- pf.depth = 1;
- pf.direct.alpha = 0;
- pf.direct.alphaMask = 1;
- return XRenderFindFormat (draw->dpy,
- (PictFormatType|
- PictFormatDepth|
- PictFormatAlpha|
- PictFormatAlphaMask),
- &pf,
- 0);
- }
- else
- {
- pf.type = PictTypeDirect;
- pf.depth = 32;
- pf.direct.redMask = 0xff;
- pf.direct.greenMask = 0xff;
- pf.direct.blueMask = 0xff;
- pf.direct.alphaMask = 0xff;
- return XRenderFindFormat (draw->dpy,
- (PictFormatType|
- PictFormatDepth|
- PictFormatRedMask|
- PictFormatGreenMask|
- PictFormatBlueMask|
- PictFormatAlphaMask),
- &pf,
- 0);
- }
-}
-
-void
-XftDrawChange (XftDraw *draw,
- Drawable drawable)
-{
- draw->drawable = drawable;
- if (draw->render_able)
- {
- XRenderPictFormat *format;
-
- XRenderFreePicture (draw->dpy, draw->render.pict);
- format = XRenderFindVisualFormat (draw->dpy, draw->visual);
- draw->render.pict = XRenderCreatePicture (draw->dpy, draw->drawable,
- format, 0, 0);
- }
-}
-
-void
-XftDrawDestroy (XftDraw *draw)
-{
- int n;
-
- if (draw->render_able)
- {
- XRenderFreePicture (draw->dpy, draw->render.pict);
- for (n = 0; n < XFT_DRAW_N_SRC; n++)
- XRenderFreePicture (draw->dpy, draw->render.src[n].pict);
- }
- if (draw->core_set)
- XFreeGC (draw->dpy, draw->core.draw_gc);
- if (draw->clip)
- XDestroyRegion (draw->clip);
- free (draw);
-}
-
-Bool
-XftDrawRenderPrepare (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int src)
-{
- if (!draw->render_set)
- {
- XRenderPictFormat *format;
- XRenderPictFormat *pix_format;
- XRenderPictureAttributes pa;
- int n;
- Pixmap pix;
-
- draw->render_set = True;
- draw->render_able = False;
- format = _XftDrawFormat (draw);
- pix_format = _XftDrawFgFormat (draw);
- if (format && pix_format)
- {
- draw->render_able = True;
-
- draw->render.pict = XRenderCreatePicture (draw->dpy, draw->drawable,
- format, 0, 0);
- for (n = 0; n < XFT_DRAW_N_SRC; n++)
- {
- pix = XCreatePixmap (draw->dpy, draw->drawable,
- 1, 1, pix_format->depth);
- pa.repeat = True;
- draw->render.src[n].pict = XRenderCreatePicture (draw->dpy,
- pix,
- pix_format,
- CPRepeat, &pa);
- XFreePixmap (draw->dpy, pix);
-
- draw->render.src[n].color = color->color;
- XRenderFillRectangle (draw->dpy, PictOpSrc,
- draw->render.src[n].pict,
- &color->color, 0, 0, 1, 1);
- }
- if (draw->clip)
- XRenderSetPictureClipRegion (draw->dpy, draw->render.pict,
- draw->clip);
- }
- }
- if (!draw->render_able)
- return False;
- if (memcmp (&color->color, &draw->render.src[src].color,
- sizeof (XRenderColor)))
- {
- if (_XftFontDebug () & XFT_DBG_DRAW)
- {
- printf ("Switching to color %04x,%04x,%04x,%04x\n",
- color->color.alpha,
- color->color.red,
- color->color.green,
- color->color.blue);
- }
- XRenderFillRectangle (draw->dpy, PictOpSrc,
- draw->render.src[src].pict,
- &color->color, 0, 0, 1, 1);
- draw->render.src[src].color = color->color;
- }
- return True;
-}
-
-Bool
-XftDrawCorePrepare (XftDraw *draw,
- XftColor *color,
- XftFont *font)
-{
-
- if (!draw->core_set)
- {
- XGCValues gcv;
- unsigned long mask;
- draw->core_set = True;
-
- draw->core.fg = color->pixel;
- gcv.foreground = draw->core.fg;
- mask = GCForeground;
- if (font)
- {
- draw->core.font = font->u.core.font->fid;
- gcv.font = draw->core.font;
- mask |= GCFont;
- }
- draw->core.draw_gc = XCreateGC (draw->dpy, draw->drawable,
- mask, &gcv);
- if (draw->clip)
- XSetRegion (draw->dpy, draw->core.draw_gc, draw->clip);
- }
- if (draw->core.fg != color->pixel)
- {
- draw->core.fg = color->pixel;
- XSetForeground (draw->dpy, draw->core.draw_gc, draw->core.fg);
- }
- if (font && draw->core.font != font->u.core.font->fid)
- {
- draw->core.font = font->u.core.font->fid;
- XSetFont (draw->dpy, draw->core.draw_gc, draw->core.font);
- }
- return True;
-}
-
-void
-XftDrawString8 (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar8 *string,
- int len)
-{
- if (_XftFontDebug () & XFT_DBG_DRAW)
- {
- printf ("DrawString \"%*.*s\"\n", len, len, string);
- }
- if (font->core)
- {
- XftDrawCorePrepare (draw, color, font);
- XDrawString (draw->dpy, draw->drawable, draw->core.draw_gc, x, y,
- (char *) string, len);
- }
-#ifdef FREETYPE2
- else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT))
- {
- XftRenderString8 (draw->dpy,
- draw->render.src[XFT_DRAW_SRC_TEXT].pict,
- font->u.ft.font,
- draw->render.pict, 0, 0, x, y, string, len);
- }
-#endif
-}
-
-#define N16LOCAL 256
-
-void
-XftDrawString16 (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar16 *string,
- int len)
-{
- if (font->core)
- {
- XChar2b *xc;
- XChar2b xcloc[XFT_CORE_N16LOCAL];
-
- XftDrawCorePrepare (draw, color, font);
- xc = XftCoreConvert16 (string, len, xcloc);
- XDrawString16 (draw->dpy, draw->drawable, draw->core.draw_gc, x, y,
- xc, len);
- if (xc != xcloc)
- free (xc);
- }
-#ifdef FREETYPE2
- else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT))
- {
- XftRenderString16 (draw->dpy,
- draw->render.src[XFT_DRAW_SRC_TEXT].pict,
- font->u.ft.font,
- draw->render.pict, 0, 0, x, y, string, len);
- }
-#endif
-}
-
-void
-XftDrawString32 (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar32 *string,
- int len)
-{
- if (font->core)
- {
- XChar2b *xc;
- XChar2b xcloc[XFT_CORE_N16LOCAL];
-
- XftDrawCorePrepare (draw, color, font);
- xc = XftCoreConvert32 (string, len, xcloc);
- XDrawString16 (draw->dpy, draw->drawable, draw->core.draw_gc, x, y,
- xc, len);
- if (xc != xcloc)
- free (xc);
- }
-#ifdef FREETYPE2
- else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT))
- {
- XftRenderString32 (draw->dpy,
- draw->render.src[XFT_DRAW_SRC_TEXT].pict,
- font->u.ft.font,
- draw->render.pict, 0, 0, x, y, string, len);
- }
-#endif
-}
-
-void
-XftDrawStringUtf8 (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int x,
- int y,
- XftChar8 *string,
- int len)
-{
- if (font->core)
- {
- XChar2b *xc;
- XChar2b xcloc[XFT_CORE_N16LOCAL];
- int n;
-
- XftDrawCorePrepare (draw, color, font);
- xc = XftCoreConvertUtf8 (string, len, xcloc, &n);
- if (xc)
- {
- XDrawString16 (draw->dpy, draw->drawable, draw->core.draw_gc, x, y,
- xc, n);
- }
- if (xc != xcloc)
- free (xc);
- }
-#ifdef FREETYPE2
- else if (XftDrawRenderPrepare (draw, color, font, XFT_DRAW_SRC_TEXT))
- {
- XftRenderStringUtf8 (draw->dpy,
- draw->render.src[XFT_DRAW_SRC_TEXT].pict,
- font->u.ft.font,
- draw->render.pict, 0, 0, x, y, string, len);
- }
-#endif
-}
-
-
-void
-XftDrawRect (XftDraw *draw,
- XftColor *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height)
-{
- if (XftDrawRenderPrepare (draw, color, 0, XFT_DRAW_SRC_RECT))
- {
- XRenderFillRectangle (draw->dpy, PictOpOver, draw->render.pict,
- &color->color, x, y, width, height);
- }
- else
- {
- XftDrawCorePrepare (draw, color, 0);
- XFillRectangle (draw->dpy, draw->drawable, draw->core.draw_gc,
- x, y, width, height);
- }
-}
-
-Bool
-XftDrawSetClip (XftDraw *draw,
- Region r)
-{
- Region n = 0;
-
- if (!r && !draw->clip)
- return True;
-
- if (r)
- {
- n = XCreateRegion ();
- if (n)
- {
- if (!XUnionRegion (n, r, n))
- {
- XDestroyRegion (n);
- return False;
- }
- }
- }
- if (draw->clip)
- {
- XDestroyRegion (draw->clip);
- }
- draw->clip = n;
- if (draw->render_able)
- {
- XRenderPictureAttributes pa;
- if (n)
- {
- XRenderSetPictureClipRegion (draw->dpy, draw->render.pict, n);
- }
- else
- {
- pa.clip_mask = None;
- XRenderChangePicture (draw->dpy, draw->render.pict,
- CPClipMask, &pa);
- }
- }
- if (draw->core_set)
- {
- XGCValues gv;
-
- if (n)
- XSetRegion (draw->dpy, draw->core.draw_gc, n);
- else
- {
- gv.clip_mask = None;
- XChangeGC (draw->dpy, draw->core.draw_gc,
- GCClipMask, &gv);
- }
- }
- return True;
-}
diff --git a/xc/lib/Xft/xftextent.c b/xc/lib/Xft/xftextent.c
deleted file mode 100644
index dab433f9b..000000000
--- a/xc/lib/Xft/xftextent.c
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftextent.c,v 1.6 2001/04/01 14:00:01 tsi Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <string.h>
-#include "xftint.h"
-
-void
-XftTextExtents8 (Display *dpy,
- XftFont *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents)
-{
- if (font->core)
- {
- XftCoreExtents8 (dpy, font->u.core.font, string, len, extents);
- }
-#ifdef FREETYPE2
- else
- {
- XftRenderExtents8 (dpy, font->u.ft.font, string, len, extents);
- }
-#endif
-}
-
-void
-XftTextExtents16 (Display *dpy,
- XftFont *font,
- XftChar16 *string,
- int len,
- XGlyphInfo *extents)
-{
- if (font->core)
- {
- XftCoreExtents16 (dpy, font->u.core.font, string, len, extents);
- }
-#ifdef FREETYPE2
- else
- {
- XftRenderExtents16 (dpy, font->u.ft.font, string, len, extents);
- }
-#endif
-}
-
-void
-XftTextExtents32 (Display *dpy,
- XftFont *font,
- XftChar32 *string,
- int len,
- XGlyphInfo *extents)
-{
- if (font->core)
- {
- XftCoreExtents32 (dpy, font->u.core.font, string, len, extents);
- }
-#ifdef FREETYPE2
- else
- {
- XftRenderExtents32 (dpy, font->u.ft.font, string, len, extents);
- }
-#endif
-}
-
-void
-XftTextExtentsUtf8 (Display *dpy,
- XftFont *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents)
-{
- XftChar8 *src;
- XftChar32 c;
- XftChar32 lbuf[4096];
- XftChar32 *dst;
- XftChar8 *dst8;
- XftChar16 *dst16;
- XftChar32 *dst32;
- int rlen, clen;
- int width = 1;
- int n;
-
- /* compute needed width */
- src = string;
- rlen = len;
- n = 0;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (src, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- {
- memset (extents, 0, sizeof (XGlyphInfo));
- return;
- }
- if (c >= 0x10000)
- width = 4;
- else if (c >= 0x100)
- {
- if (width == 1)
- width = 2;
- }
- src += clen;
- rlen -= clen;
- n++;
- }
- dst = lbuf;
- if (n * width > sizeof (lbuf))
- {
- dst = (XftChar32 *) malloc (n * width);
- if (!dst)
- {
- memset (extents, 0, sizeof (XGlyphInfo));
- return;
- }
- }
-
- switch (width) {
- case 4:
- src = string;
- rlen = len;
- dst32 = dst;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (src, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- return;
- *dst32++ = c;
- src += clen;
- rlen -= clen;
- }
- dst32 = dst;
- XftTextExtents32 (dpy, font, dst32, n, extents);
- break;
- case 2:
- src = string;
- rlen = len;
- dst16 = (XftChar16 *) dst;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (src, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- return;
- *dst16++ = c;
- src += clen;
- rlen -= clen;
- }
- dst16 = (XftChar16 *) dst;
- XftTextExtents16 (dpy, font, dst16, n, extents);
- break;
- case 1:
- src = string;
- rlen = len;
- dst8 = (XftChar8 *) dst;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (src, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- return;
- *dst8++ = c;
- src += clen;
- rlen -= clen;
- }
- dst8 = (XftChar8 *) dst;
- XftTextExtents8 (dpy, font, dst8, n, extents);
- break;
- }
- if (dst != lbuf)
- free (dst);
-}
diff --git a/xc/lib/Xft/xftfont.c b/xc/lib/Xft/xftfont.c
deleted file mode 100644
index 9c3f071d3..000000000
--- a/xc/lib/Xft/xftfont.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftfont.c,v 1.8 2000/12/20 00:20:48 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include "xftint.h"
-
-XftPattern *
-XftFontMatch (Display *dpy, int screen, XftPattern *pattern, XftResult *result)
-{
- XftPattern *new;
- XftPattern *match;
- XftFontSet *sets[2];
- int nsets;
-#ifdef FREETYPE2
- Bool render, core;
-#endif
-
- if (!XftInit (0))
- return 0;
-
- new = XftPatternDuplicate (pattern);
- if (!new)
- return 0;
-
- if (_XftFontDebug () & XFT_DBG_OPENV)
- {
- printf ("XftFontMatch pattern ");
- XftPatternPrint (new);
- }
- XftConfigSubstitute (new);
- if (_XftFontDebug () & XFT_DBG_OPENV)
- {
- printf ("XftFontMatch after XftConfig substitutions ");
- XftPatternPrint (new);
- }
- XftDefaultSubstitute (dpy, screen, new);
- if (_XftFontDebug () & XFT_DBG_OPENV)
- {
- printf ("XftFontMatch after X resource substitutions ");
- XftPatternPrint (new);
- }
- nsets = 0;
-
-#ifdef FREETYPE2
- render = False;
- core = True;
- (void) XftPatternGetBool (new, XFT_RENDER, 0, &render);
- (void) XftPatternGetBool (new, XFT_CORE, 0, &core);
- if (_XftFontDebug () & XFT_DBG_OPENV)
- {
- printf ("XftFontMatch: use core fonts \"%s\", use render fonts \"%s\"\n",
- core ? "True" : "False", render ? "True" : "False");
- }
-
- if (render)
- {
- if (XftInitFtLibrary ())
- {
- sets[nsets] = _XftFontSet;
- if (sets[nsets])
- nsets++;
- }
- }
- if (core)
-#endif
- {
- sets[nsets] = XftDisplayGetFontSet (dpy);
- if (sets[nsets])
- nsets++;
- }
-
- match = XftFontSetMatch (sets, nsets, new, result);
- XftPatternDestroy (new);
- return match;
-}
-
-XftFont *
-XftFontOpenPattern (Display *dpy, XftPattern *pattern)
-{
- Bool core = True;
- XFontStruct *xfs = 0;
- XftFont *font;
-#ifdef FREETYPE2
- XftFontStruct *fs = 0;
-
- if (XftPatternGetBool (pattern, XFT_CORE, 0, &core) != XftResultMatch)
- return 0;
- if (core)
-#endif
- {
- xfs = XftCoreOpen (dpy, pattern);
- if (!xfs) return 0;
- }
-#ifdef FREETYPE2
- else
- {
- fs = XftFreeTypeOpen (dpy, pattern);
- if (!fs) return 0;
- }
-#endif
- font = (XftFont *) malloc (sizeof (XftFont));
- font->core = core;
- font->pattern = pattern;
-#ifdef FREETYPE2
- if (core)
-#endif
- {
- font->u.core.font = xfs;
- font->ascent = xfs->ascent;
- font->descent = xfs->descent;
- font->height = xfs->ascent + xfs->descent;
- font->max_advance_width = xfs->max_bounds.width;
- }
-#ifdef FREETYPE2
- else
- {
- font->u.ft.font = fs;
- font->ascent = fs->ascent;
- font->descent = fs->descent;
- font->height = fs->height;
- font->max_advance_width = fs->max_advance_width;
- }
-#endif
- return font;
-}
-
-int
-_XftFontDebug (void)
-{
- static int initialized;
- static int debug;
-
- if (!initialized)
- {
- char *e;
-
- initialized = 1;
- e = getenv ("XFT_DEBUG");
- if (e)
- {
- printf ("XFT_DEBUG=%s\n", e);
- debug = atoi (e);
- if (debug <= 0)
- debug = 1;
- }
- }
- return debug;
-}
-
-XftFont *
-XftFontOpen (Display *dpy, int screen, ...)
-{
- va_list va;
- XftPattern *pat;
- XftPattern *match;
- XftResult result;
- XftFont *font;
-
- va_start (va, screen);
- pat = XftPatternVaBuild (0, va);
- va_end (va);
- if (!pat)
- {
- if (_XftFontDebug () & XFT_DBG_OPEN)
- printf ("XftFontOpen: Invalid pattern argument\n");
- return 0;
- }
- match = XftFontMatch (dpy, screen, pat, &result);
- if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- printf ("Pattern ");
- XftPatternPrint (pat);
- if (match)
- {
- printf ("Match ");
- XftPatternPrint (match);
- }
- else
- printf ("No Match\n");
- }
- XftPatternDestroy (pat);
- if (!match)
- return 0;
-
- font = XftFontOpenPattern (dpy, match);
- if (!font)
- {
- if (_XftFontDebug () & XFT_DBG_OPEN)
- printf ("No Font\n");
- XftPatternDestroy (match);
- }
-
- return font;
-}
-
-XftFont *
-XftFontOpenName (Display *dpy, int screen, const char *name)
-{
- XftPattern *pat;
- XftPattern *match;
- XftResult result;
- XftFont *font;
-
- pat = XftNameParse (name);
- if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- printf ("XftFontOpenName \"%s\": ", name);
- if (pat)
- XftPatternPrint (pat);
- else
- printf ("Invalid name\n");
- }
-
- if (!pat)
- return 0;
- match = XftFontMatch (dpy, screen, pat, &result);
- if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- if (match)
- {
- printf ("Match ");
- XftPatternPrint (match);
- }
- else
- printf ("No Match\n");
- }
- XftPatternDestroy (pat);
- if (!match)
- return 0;
-
- font = XftFontOpenPattern (dpy, match);
- if (!font)
- XftPatternDestroy (match);
-
- return font;
-}
-
-XftFont *
-XftFontOpenXlfd (Display *dpy, int screen, const char *xlfd)
-{
- XftPattern *pat;
- XftPattern *match;
- XftResult result;
- XftFont *font;
-
- pat = XftXlfdParse (xlfd, False, False);
- if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- printf ("XftFontOpenXlfd \"%s\": ", xlfd);
- if (pat)
- printf ("Invalid xlfd\n");
- else
- XftPatternPrint (pat);
- }
-
- if (!pat)
- return 0;
- match = XftFontMatch (dpy, screen, pat, &result);
- if (_XftFontDebug () & XFT_DBG_OPEN)
- {
- if (match)
- {
- printf ("Match ");
- XftPatternPrint (match);
- }
- else
- printf ("No Match\n");
- }
- XftPatternDestroy (pat);
- if (!match)
- return 0;
-
- font = XftFontOpenPattern (dpy, match);
- if (!font)
- XftPatternDestroy (match);
-
- return font;
-}
-
-void
-XftFontClose (Display *dpy, XftFont *font)
-{
- if (font->core)
- XftCoreClose (dpy, font->u.core.font);
-#ifdef FREETYPE2
- else
- XftFreeTypeClose (dpy, font->u.ft.font);
-#endif
- if (font->pattern)
- XftPatternDestroy (font->pattern);
- free (font);
-}
-
-Bool
-XftGlyphExists (Display *dpy, XftFont *font, XftChar32 glyph)
-{
- if (font->core)
- return XftCoreGlyphExists (dpy, font->u.core.font, glyph);
- else
-#ifdef FREETYPE2
- return XftFreeTypeGlyphExists (dpy, font->u.ft.font, glyph);
-#else
- return False;
-#endif
-}
diff --git a/xc/lib/Xft/xftfreetype.c b/xc/lib/Xft/xftfreetype.c
deleted file mode 100644
index 62096da0b..000000000
--- a/xc/lib/Xft/xftfreetype.c
+++ /dev/null
@@ -1,678 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftfreetype.c,v 1.13 2001/05/16 10:32:54 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include "xftint.h"
-
-FT_Library _XftFTlibrary;
-
-typedef struct _XftFtEncoding {
- const char *name;
- FT_Encoding encoding;
-} XftFtEncoding;
-
-static XftFtEncoding xftFtEncoding[] = {
- { "iso10646-1", ft_encoding_unicode, },
- { "iso8859-1", ft_encoding_unicode, },
- { "apple-roman", ft_encoding_apple_roman },
- { "adobe-fontspecific", ft_encoding_symbol, },
- { "glyphs-fontspecific",ft_encoding_none, },
-};
-
-#define NUM_FT_ENCODINGS (sizeof xftFtEncoding / sizeof xftFtEncoding[0])
-
-#define FT_Matrix_Equal(a,b) ((a)->xx == (b)->xx && \
- (a)->yy == (b)->yy && \
- (a)->xy == (b)->xy && \
- (a)->yx == (b)->yx)
-
-XftPattern *
-XftFreeTypeQuery (const char *file, int id, int *count)
-{
- FT_Face face;
- XftPattern *pat;
- int slant;
- int weight;
- int i, j;
-
- if (FT_New_Face (_XftFTlibrary, file, id, &face))
- return 0;
-
- *count = face->num_faces;
-
- pat = XftPatternCreate ();
- if (!pat)
- goto bail0;
-
-
- if (!XftPatternAddBool (pat, XFT_CORE, False))
- goto bail1;
-
- if (!XftPatternAddBool (pat, XFT_OUTLINE,
- (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0))
- goto bail1;
-
- if (!XftPatternAddBool (pat, XFT_SCALABLE,
- (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0))
- goto bail1;
-
-
- slant = XFT_SLANT_ROMAN;
- if (face->style_flags & FT_STYLE_FLAG_ITALIC)
- slant = XFT_SLANT_ITALIC;
-
- if (!XftPatternAddInteger (pat, XFT_SLANT, slant))
- goto bail1;
-
- weight = XFT_WEIGHT_MEDIUM;
- if (face->style_flags & FT_STYLE_FLAG_BOLD)
- weight = XFT_WEIGHT_BOLD;
-
- if (!XftPatternAddInteger (pat, XFT_WEIGHT, weight))
- goto bail1;
-
- if (!XftPatternAddString (pat, XFT_FAMILY, face->family_name))
- goto bail1;
-
- if (!XftPatternAddString (pat, XFT_STYLE, face->style_name))
- goto bail1;
-
- if (!XftPatternAddString (pat, XFT_FILE, file))
- goto bail1;
-
- if (!XftPatternAddInteger (pat, XFT_INDEX, id))
- goto bail1;
-
-#if 0
- if ((face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) != 0)
- if (!XftPatternAddInteger (pat, XFT_SPACING, XFT_MONO))
- goto bail1;
-#endif
-
- if (!(face->face_flags & FT_FACE_FLAG_SCALABLE))
- {
- for (i = 0; i < face->num_fixed_sizes; i++)
- if (!XftPatternAddDouble (pat, XFT_PIXEL_SIZE,
- (double) face->available_sizes[i].height))
- goto bail1;
- }
-
- for (i = 0; i < face->num_charmaps; i++)
- {
-#if 0
- printf ("face %s encoding %d %c%c%c%c\n",
- face->family_name, i,
- face->charmaps[i]->encoding >> 24,
- face->charmaps[i]->encoding >> 16,
- face->charmaps[i]->encoding >> 8,
- face->charmaps[i]->encoding >> 0);
-#endif
- for (j = 0; j < NUM_FT_ENCODINGS; j++)
- {
- if (face->charmaps[i]->encoding == xftFtEncoding[j].encoding)
- {
- if (!XftPatternAddString (pat, XFT_ENCODING,
- xftFtEncoding[j].name))
- goto bail1;
- }
- }
- }
-
- if (!XftPatternAddString (pat, XFT_ENCODING,
- "glyphs-fontspecific"))
- goto bail1;
-
-
- FT_Done_Face (face);
- return pat;
-
-bail1:
- XftPatternDestroy (pat);
-bail0:
- FT_Done_Face (face);
- return 0;
-}
-
-/*
- * List of all open files (each face in a file is managed separately)
- */
-typedef struct _XftFtFile {
- struct _XftFtFile *next;
- int ref;
-
- char *file;
- int id;
-
- FT_Face face;
- FT_F26Dot6 size;
- FT_Matrix matrix;
- int charmap;
-} XftFtFile;
-
-static XftFtFile *_XftFtFiles;
-
-static XftFtFile *
-_XftFreeTypeOpenFile (char *file, int id)
-{
- XftFtFile *f;
- FT_Face face;
-
- for (f = _XftFtFiles; f; f = f->next)
- {
- if (!strcmp (f->file, file) && f->id == id)
- {
- ++f->ref;
- if (_XftFontDebug () & XFT_DBG_REF)
- printf ("FontFile %s/%d matches existing (%d)\n",
- file, id, f->ref);
- return f;
- }
- }
- if (FT_New_Face (_XftFTlibrary, file, id, &face))
- return 0;
-
- f = malloc (sizeof (XftFtFile) + strlen (file) + 1);
- if (!f)
- return 0;
-
- if (_XftFontDebug () & XFT_DBG_REF)
- printf ("FontFile %s/%d matches new\n",
- file, id);
- f->next = _XftFtFiles;
- _XftFtFiles = f;
- f->ref = 1;
-
- f->file = (char *) (f+1);
- strcpy (f->file, file);
- f->id = id;
-
- f->face = face;
- f->size = 0;
- f->charmap = -1;
- return f;
-}
-
-Bool
-XftFreeTypeSetFace (FT_Face face, FT_F26Dot6 size, int charmap, FT_Matrix *matrix)
-{
- XftFtFile *f, **prev;
-
- for (prev = &_XftFtFiles; (f = *prev); prev = &f->next)
- {
- if (f->face == face)
- {
- /* LRU */
- if (prev != &_XftFtFiles)
- {
- *prev = f->next;
- f->next = _XftFtFiles;
- _XftFtFiles = f;
- }
- if (f->size != size)
- {
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- printf ("Set face size to %d (%d)\n",
- (int) (size >> 6), (int) size);
- if (FT_Set_Char_Size (face, size, size, 0, 0))
- return False;
- f->size = size;
- }
- if (f->charmap != charmap && charmap != -1)
- {
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- printf ("Set face charmap to %d\n", charmap);
- if (FT_Set_Charmap (face, face->charmaps[charmap]))
- return False;
- f->charmap = charmap;
- }
- if (!FT_Matrix_Equal (&f->matrix, matrix))
- {
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- printf ("Set face matrix to (%g,%g,%g,%g)\n",
- (double) matrix->xx / 0x10000,
- (double) matrix->xy / 0x10000,
- (double) matrix->yx / 0x10000,
- (double) matrix->yy / 0x10000);
- FT_Set_Transform (face, matrix, 0);
- f->matrix = *matrix;
- }
- break;
- }
- }
- return True;
-}
-
-static void
-_XftFreeTypeCloseFile (XftFtFile *f)
-{
- XftFtFile **prev;
-
- if (--f->ref != 0)
- return;
- for (prev = &_XftFtFiles; *prev; prev = &(*prev)->next)
- {
- if (*prev == f)
- {
- *prev = f->next;
- break;
- }
- }
- FT_Done_Face (f->face);
- free (f);
-}
-
-/*
- * Cache of all glyphsets
- */
-typedef struct _XftFtGlyphSet {
- struct _XftFtGlyphSet *next;
- int ref;
-
- XftFtFile *file;
- Bool minspace;
- int char_width;
-
- XftFontStruct font;
-} XftFtGlyphSet;
-
-static XftFtGlyphSet *_XftFtGlyphSets;
-
-XftFontStruct *
-XftFreeTypeOpen (Display *dpy, XftPattern *pattern)
-{
- XftFtFile *file;
- FT_Face face;
- XftFtGlyphSet *gs;
- char *filename;
- int id;
- double dsize;
- FT_F26Dot6 size;
- int rgba;
- int spacing;
- int char_width;
- Bool antialias;
- Bool minspace;
- char *encoding_name;
- XftFontStruct *font;
- int j;
- FT_Encoding encoding;
- int charmap;
- FT_Matrix matrix;
- XftMatrix *font_matrix;
-
- int extra;
- int height, ascent, descent;
- XRenderPictFormat pf, *format;
-
- /*
- * Open the file
- */
- if (XftPatternGetString (pattern, XFT_FILE, 0, &filename) != XftResultMatch)
- goto bail0;
-
- if (XftPatternGetInteger (pattern, XFT_INDEX, 0, &id) != XftResultMatch)
- goto bail0;
-
- file = _XftFreeTypeOpenFile (filename, id);
- if (!file)
- goto bail0;
-
- face = file->face;
-
- /*
- * Extract the glyphset information from the pattern
- */
- if (XftPatternGetString (pattern, XFT_ENCODING, 0, &encoding_name) != XftResultMatch)
- goto bail0;
-
- if (XftPatternGetDouble (pattern, XFT_PIXEL_SIZE, 0, &dsize) != XftResultMatch)
- goto bail0;
-
- switch (XftPatternGetInteger (pattern, XFT_RGBA, 0, &rgba)) {
- case XftResultNoMatch:
- rgba = XFT_RGBA_NONE;
- break;
- case XftResultMatch:
- break;
- default:
- goto bail0;
- }
-
- switch (XftPatternGetBool (pattern, XFT_ANTIALIAS, 0, &antialias)) {
- case XftResultNoMatch:
- antialias = True;
- break;
- case XftResultMatch:
- break;
- default:
- goto bail0;
- }
-
- switch (XftPatternGetBool (pattern, XFT_MINSPACE, 0, &minspace)) {
- case XftResultNoMatch:
- minspace = False;
- break;
- case XftResultMatch:
- break;
- default:
- goto bail0;
- }
-
- switch (XftPatternGetInteger (pattern, XFT_SPACING, 0, &spacing)) {
- case XftResultNoMatch:
- spacing = XFT_PROPORTIONAL;
- break;
- case XftResultMatch:
- break;
- default:
- goto bail1;
- }
-
- if (XftPatternGetInteger (pattern, XFT_CHAR_WIDTH,
- 0, &char_width) != XftResultMatch)
- {
- char_width = 0;
- }
- else if (char_width)
- spacing = XFT_MONO;
-
- matrix.xx = matrix.yy = 0x10000;
- matrix.xy = matrix.yx = 0;
-
- switch (XftPatternGetMatrix (pattern, XFT_MATRIX, 0, &font_matrix)) {
- case XftResultNoMatch:
- break;
- case XftResultMatch:
- matrix.xx = 0x10000L * font_matrix->xx;
- matrix.yy = 0x10000L * font_matrix->yy;
- matrix.xy = 0x10000L * font_matrix->xy;
- matrix.yx = 0x10000L * font_matrix->yx;
- break;
- default:
- goto bail1;
- }
-
-
-
- if (XftPatternGetInteger (pattern, XFT_CHAR_WIDTH,
- 0, &char_width) != XftResultMatch)
- {
- char_width = 0;
- }
- else if (char_width)
- spacing = XFT_MONO;
-
- encoding = face->charmaps[0]->encoding;
-
- for (j = 0; j < NUM_FT_ENCODINGS; j++)
- if (!strcmp (encoding_name, xftFtEncoding[j].name))
- {
- encoding = xftFtEncoding[j].encoding;
- break;
- }
-
- size = (FT_F26Dot6) (dsize * 64.0);
-
- if (encoding == ft_encoding_none)
- charmap = -1;
- else
- {
- for (charmap = 0; charmap < face->num_charmaps; charmap++)
- if (face->charmaps[charmap]->encoding == encoding)
- break;
-
- if (charmap == face->num_charmaps)
- goto bail1;
- }
-
-
- /*
- * Match an existing glyphset
- */
- for (gs = _XftFtGlyphSets; gs; gs = gs->next)
- {
- if (gs->file == file &&
- gs->minspace == minspace &&
- gs->char_width == char_width &&
- gs->font.size == size &&
- gs->font.spacing == spacing &&
- gs->font.charmap == charmap &&
- gs->font.rgba == rgba &&
- gs->font.antialias == antialias &&
- FT_Matrix_Equal (&gs->font.matrix, &matrix))
- {
- ++gs->ref;
- if (_XftFontDebug () & XFT_DBG_REF)
- {
- printf ("Face size %g matches existing (%d)\n",
- dsize, gs->ref);
- }
- return &gs->font;
- }
- }
-
- if (_XftFontDebug () & XFT_DBG_REF)
- {
- printf ("Face size %g matches new\n",
- dsize);
- }
- /*
- * No existing glyphset, create another
- */
- gs = malloc (sizeof (XftFtGlyphSet));
- if (!gs)
- goto bail1;
-
- gs->ref = 1;
-
- gs->file = file;
- gs->minspace = minspace;
- gs->char_width = char_width;
-
- font = &gs->font;
-
- if (antialias)
- {
- if (rgba)
- {
- pf.depth = 32;
- pf.type = PictTypeDirect;
- pf.direct.alpha = 24;
- pf.direct.alphaMask = 0xff;
- pf.direct.red = 16;
- pf.direct.redMask = 0xff;
- pf.direct.green = 8;
- pf.direct.greenMask = 0xff;
- pf.direct.blue = 0;
- pf.direct.blueMask = 0xff;
- format = XRenderFindFormat(dpy,
- PictFormatType|
- PictFormatDepth|
- PictFormatAlpha|
- PictFormatAlphaMask|
- PictFormatRed|
- PictFormatRedMask|
- PictFormatGreen|
- PictFormatGreenMask|
- PictFormatBlue|
- PictFormatBlueMask,
- &pf, 0);
- }
- else
- {
- pf.depth = 8;
- pf.type = PictTypeDirect;
- pf.direct.alpha = 0;
- pf.direct.alphaMask = 0xff;
- format = XRenderFindFormat(dpy,
- PictFormatType|
- PictFormatDepth|
- PictFormatAlpha|
- PictFormatAlphaMask,
- &pf, 0);
- }
- }
- else
- {
- pf.depth = 1;
- pf.type = PictTypeDirect;
- pf.direct.alpha = 0;
- pf.direct.alphaMask = 0x1;
- format = XRenderFindFormat(dpy,
- PictFormatType|
- PictFormatDepth|
- PictFormatAlpha|
- PictFormatAlphaMask,
- &pf, 0);
- }
-
- if (!format)
- goto bail2;
-
- if (!XftFreeTypeSetFace (face, size, charmap, &matrix))
- goto bail2;
-
- descent = -(face->size->metrics.descender >> 6);
- ascent = face->size->metrics.ascender >> 6;
- if (minspace)
- {
- height = ascent + descent;
- }
- else
- {
- height = face->size->metrics.height >> 6;
- extra = (height - (ascent + descent));
- if (extra > 0)
- {
- ascent = ascent + extra / 2;
- descent = height - ascent;
- }
- else if (extra < 0)
- height = ascent + descent;
- }
- font->ascent = ascent;
- font->descent = descent;
- font->height = height;
-
- if (char_width)
- font->max_advance_width = char_width;
- else
- font->max_advance_width = face->size->metrics.max_advance >> 6;
-
- gs->next = _XftFtGlyphSets;
- _XftFtGlyphSets = gs;
-
- font->glyphset = XRenderCreateGlyphSet (dpy, format);
-
- font->size = size;
- font->spacing = spacing;
- font->format = format;
- font->realized =0;
- font->nrealized = 0;
- font->rgba = rgba;
- font->antialias = antialias;
- font->charmap = charmap;
- font->transform = (matrix.xx != 0x10000 || matrix.xy != 0 ||
- matrix.yx != 0 || matrix.yy != 0x10000);
- font->matrix = matrix;
- font->face = face;
-
- return font;
-
-bail2:
- free (gs);
-bail1:
- _XftFreeTypeCloseFile (file);
-bail0:
- return 0;
-}
-
-void
-XftFreeTypeClose (Display *dpy, XftFontStruct *font)
-{
- XftFtGlyphSet *gs, **prev;
-
- for (prev = &_XftFtGlyphSets; (gs = *prev); prev = &gs->next)
- {
- if (&gs->font == font)
- {
- if (--gs->ref == 0)
- {
- XRenderFreeGlyphSet (dpy, font->glyphset);
- if (font->realized)
- free (font->realized);
-
- _XftFreeTypeCloseFile (gs->file);
-
- *prev = gs->next;
- free (gs);
- }
- break;
- }
- }
-}
-
-XftFontStruct *
-XftFreeTypeGet (XftFont *font)
-{
- if (font->core)
- return 0;
- return font->u.ft.font;
-}
-
-/* #define XFT_DEBUG_FONTSET */
-
-Bool
-XftInitFtLibrary (void)
-{
- char **d;
- char *cache;
-
- if (_XftFTlibrary)
- return True;
- if (FT_Init_FreeType (&_XftFTlibrary))
- return False;
- _XftFontSet = XftFontSetCreate ();
- if (!_XftFontSet)
- return False;
- cache = XftConfigGetCache ();
- if (cache)
- XftFileCacheLoad (cache);
- for (d = XftConfigDirs; d && *d; d++)
- {
-#ifdef XFT_DEBUG_FONTSET
- printf ("scan dir %s\n", *d);
-#endif
- XftDirScan (_XftFontSet, *d, False);
- }
-#ifdef XFT_DEBUG_FONTSET
- XftFontSetPrint (_XftFontSet);
-#endif
- if (cache)
- XftFileCacheSave (cache);
- XftFileCacheDispose ();
- return True;
-}
diff --git a/xc/lib/Xft/xftfs.c b/xc/lib/Xft/xftfs.c
deleted file mode 100644
index ad8027933..000000000
--- a/xc/lib/Xft/xftfs.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftfs.c,v 1.1 2000/11/29 08:39:22 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include "xftint.h"
-
-XftFontSet *
-XftFontSetCreate (void)
-{
- XftFontSet *s;
-
- s = (XftFontSet *) malloc (sizeof (XftFontSet));
- if (!s)
- return 0;
- s->nfont = 0;
- s->sfont = 0;
- s->fonts = 0;
- return s;
-}
-
-void
-XftFontSetDestroy (XftFontSet *s)
-{
- int i;
-
- for (i = 0; i < s->nfont; i++)
- XftPatternDestroy (s->fonts[i]);
- if (s->fonts)
- free (s->fonts);
- free (s);
-}
-
-Bool
-XftFontSetAdd (XftFontSet *s, XftPattern *font)
-{
- XftPattern **f;
- int sfont;
-
- if (s->nfont == s->sfont)
- {
- sfont = s->sfont + 32;
- if (s->fonts)
- f = (XftPattern **) realloc (s->fonts, sfont * sizeof (XftPattern *));
- else
- f = (XftPattern **) malloc (sfont * sizeof (XftPattern *));
- if (!f)
- return False;
- s->sfont = sfont;
- s->fonts = f;
- }
- s->fonts[s->nfont++] = font;
- return True;
-}
diff --git a/xc/lib/Xft/xftglyphs.c b/xc/lib/Xft/xftglyphs.c
deleted file mode 100644
index 5d6460a5e..000000000
--- a/xc/lib/Xft/xftglyphs.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftglyphs.c,v 1.13 2001/05/16 10:32:54 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <string.h>
-#include "xftint.h"
-#include <freetype/ftoutln.h>
-
-static const int filters[3][3] = {
- /* red */
-#if 0
-{ 65538*4/7,65538*2/7,65538*1/7 },
- /* green */
-{ 65536*1/4, 65536*2/4, 65537*1/4 },
- /* blue */
-{ 65538*1/7,65538*2/7,65538*4/7 },
-#endif
-{ 65538*9/13,65538*3/13,65538*1/13 },
- /* green */
-{ 65538*1/6, 65538*4/6, 65538*1/6 },
- /* blue */
-{ 65538*1/13,65538*3/13,65538*9/13 },
-};
-
-#define _UntestedGlyph ((XGlyphInfo *) 1)
-
-void
-XftGlyphLoad (Display *dpy,
- XftFontStruct *font,
- XftChar32 *glyphs,
- int nglyph)
-{
- FT_Error error;
- FT_ULong charcode;
- FT_UInt glyphindex;
- FT_GlyphSlot glyph;
- XGlyphInfo *gi;
- Glyph g;
- unsigned char bufLocal[4096];
- unsigned char *bufBitmap = bufLocal;
- unsigned char *b;
- int bufSize = sizeof (bufLocal);
- int size, pitch;
- unsigned char bufLocalRgba[4096];
- unsigned char *bufBitmapRgba = bufLocalRgba;
- int bufSizeRgba = sizeof (bufLocalRgba);
- int sizergba, pitchrgba, widthrgba;
- int width;
- int height;
- int i;
- int left, right, top, bottom;
- int hmul = 1;
- int vmul = 1;
- FT_Bitmap ftbit;
- FT_Matrix matrix;
- FT_Vector vector;
- Bool subpixel = False;
-
- if (!XftFreeTypeSetFace (font->face, font->size, font->charmap, &font->matrix))
- return ;
-
- matrix.xx = matrix.yy = 0x10000L;
- matrix.xy = matrix.yx = 0;
-
- if (font->antialias)
- {
- switch (font->rgba) {
- case XFT_RGBA_RGB:
- case XFT_RGBA_BGR:
- matrix.xx *= 3;
- subpixel = True;
- hmul = 3;
- break;
- case XFT_RGBA_VRGB:
- case XFT_RGBA_VBGR:
- matrix.yy *= 3;
- vmul = 3;
- subpixel = True;
- break;
- }
- }
-
- while (nglyph--)
- {
- charcode = (FT_ULong) *glyphs++;
- gi = font->realized[charcode];
- if (!gi)
- continue;
-
- if (font->charmap != -1)
- {
- glyphindex = FT_Get_Char_Index (font->face, charcode);
-#if 0
- if (!glyphindex)
- {
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- printf ("glyph (%c) %d missing\n",
- (int) charcode, (int) charcode);
- continue;
- }
-#endif
- }
- else
- glyphindex = (FT_UInt) charcode;
- error = FT_Load_Glyph (font->face, glyphindex, 0/*|FT_LOAD_NO_HINTING */);
- if (error)
- continue;
-
-#define FLOOR(x) ((x) & -64)
-#define CEIL(x) (((x)+63) & -64)
-#define TRUNC(x) ((x) >> 6)
-#define ROUND(x) (((x)+32) & -64)
-
- glyph = font->face->glyph;
-
- if(font->transform)
- {
- /*
- * calculate the true width by transforming all four corners.
- */
- int xc, yc;
- left = right = top = bottom = 0;
- for(xc = 0; xc <= 1; xc ++) {
- for(yc = 0; yc <= 1; yc++) {
- vector.x = glyph->metrics.horiBearingX + xc * glyph->metrics.width;
- vector.y = glyph->metrics.horiBearingY - yc * glyph->metrics.height;
- FT_Vector_Transform(&vector, &font->matrix);
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- printf("Trans %d %d: %d %d\n", (int) xc, (int) yc,
- (int) vector.x, (int) vector.y);
- if(xc == 0 && yc == 0) {
- left = right = vector.x;
- top = bottom = vector.y;
- } else {
- if(left > vector.x) left = vector.x;
- if(right < vector.x) right = vector.x;
- if(bottom > vector.y) bottom = vector.y;
- if(top < vector.y) top = vector.y;
- }
-
- }
- }
- left = FLOOR(left);
- right = CEIL(right);
- bottom = FLOOR(bottom);
- top = CEIL(top);
-
- } else {
- left = FLOOR( glyph->metrics.horiBearingX );
- right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
-
- top = CEIL( glyph->metrics.horiBearingY );
- bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height );
- }
-
- width = TRUNC(right - left);
- height = TRUNC( top - bottom );
-
-
- /*
- * Try to keep monospace fonts ink-inside
- * XXX transformed?
- */
- if (font->spacing != XFT_PROPORTIONAL && !font->transform)
- {
- if (TRUNC(right) > font->max_advance_width)
- {
- int adjust;
-
- adjust = right - (font->max_advance_width << 6);
- if (adjust > left)
- adjust = left;
- left -= adjust;
- right -= adjust;
- width = font->max_advance_width;
- }
- }
-
- if ( glyph->format == ft_glyph_format_outline )
- {
- if (font->antialias)
- pitch = (width * hmul + 3) & ~3;
- else
- pitch = ((width + 31) & ~31) >> 3;
-
- size = pitch * height * vmul;
-
- if (size > bufSize)
- {
- if (bufBitmap != bufLocal)
- free (bufBitmap);
- bufBitmap = (unsigned char *) malloc (size);
- if (!bufBitmap)
- continue;
- bufSize = size;
- }
- memset (bufBitmap, 0, size);
-
- ftbit.width = width * hmul;
- ftbit.rows = height * vmul;
- ftbit.pitch = pitch;
- if (font->antialias)
- ftbit.pixel_mode = ft_pixel_mode_grays;
- else
- ftbit.pixel_mode = ft_pixel_mode_mono;
-
- ftbit.buffer = bufBitmap;
-
- if (subpixel)
- FT_Outline_Transform (&glyph->outline, &matrix);
-
- FT_Outline_Translate ( &glyph->outline, -left*hmul, -bottom*vmul );
-
- FT_Outline_Get_Bitmap( _XftFTlibrary, &glyph->outline, &ftbit );
- i = size;
- b = (unsigned char *) bufBitmap;
- /*
- * swap bit order around
- */
- if (!font->antialias)
- {
- if (BitmapBitOrder (dpy) != MSBFirst)
- {
- unsigned char *line;
- unsigned char c;
- int i;
-
- line = (unsigned char *) bufBitmap;
- i = size;
- while (i--)
- {
- c = *line;
- c = ((c << 1) & 0xaa) | ((c >> 1) & 0x55);
- c = ((c << 2) & 0xcc) | ((c >> 2) & 0x33);
- c = ((c << 4) & 0xf0) | ((c >> 4) & 0x0f);
- *line++ = c;
- }
- }
- }
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- {
- printf ("char 0x%x (%c):\n", (int) charcode, (char) charcode);
- printf (" xywh (%d %d %d %d), trans (%d %d %d %d) wh (%d %d)\n",
- (int) glyph->metrics.horiBearingX,
- (int) glyph->metrics.horiBearingY,
- (int) glyph->metrics.width,
- (int) glyph->metrics.height,
- left, right, top, bottom,
- width, height);
- if (_XftFontDebug() & XFT_DBG_GLYPHV)
- {
- int x, y;
- unsigned char *line;
-
- line = bufBitmap;
- for (y = 0; y < height * vmul; y++)
- {
- if (font->antialias)
- {
- static char den[] = { " .:;=+*#" };
- for (x = 0; x < pitch; x++)
- printf ("%c", den[line[x] >> 5]);
- }
- else
- {
- for (x = 0; x < pitch * 8; x++)
- {
- printf ("%c", line[x>>3] & (1 << (x & 7)) ? '#' : ' ');
- }
- }
- printf ("|\n");
- line += pitch;
- }
- printf ("\n");
- }
- }
- }
- else
- {
- if (_XftFontDebug() & XFT_DBG_GLYPH)
- printf ("glyph (%c) %d no outline\n",
- (int) charcode, (int) charcode);
- continue;
- }
-
- gi->width = width;
- gi->height = height;
- gi->x = -TRUNC(left);
- gi->y = TRUNC(top);
- if (font->spacing != XFT_PROPORTIONAL)
- {
- if (font->transform)
- {
- vector.x = font->max_advance_width;
- vector.y = 0;
- FT_Vector_Transform (&vector, &font->matrix);
- gi->xOff = vector.x;
- gi->yOff = -vector.y;
- }
- else
- {
- gi->xOff = font->max_advance_width;
- gi->yOff = 0;
- }
- }
- else
- {
- gi->xOff = TRUNC(ROUND(glyph->advance.x));
- gi->yOff = -TRUNC(ROUND(glyph->advance.y));
- }
- g = charcode;
-
- if (subpixel)
- {
- int x, y;
- unsigned char *in_line, *out_line, *in;
- unsigned int *out;
- unsigned int red, green, blue;
- int rf, gf, bf;
- int s;
- int o, os;
-
- widthrgba = width;
- pitchrgba = (widthrgba * 4 + 3) & ~3;
- sizergba = pitchrgba * height;
-
- os = 1;
- switch (font->rgba) {
- case XFT_RGBA_VRGB:
- os = pitch;
- case XFT_RGBA_RGB:
- default:
- rf = 0;
- gf = 1;
- bf = 2;
- break;
- case XFT_RGBA_VBGR:
- os = pitch;
- case XFT_RGBA_BGR:
- bf = 0;
- gf = 1;
- rf = 2;
- break;
- }
- if (sizergba > bufSizeRgba)
- {
- if (bufBitmapRgba != bufLocalRgba)
- free (bufBitmapRgba);
- bufBitmapRgba = (unsigned char *) malloc (sizergba);
- if (!bufBitmapRgba)
- continue;
- bufSizeRgba = sizergba;
- }
- memset (bufBitmapRgba, 0, sizergba);
- in_line = bufBitmap;
- out_line = bufBitmapRgba;
- for (y = 0; y < height; y++)
- {
- in = in_line;
- out = (unsigned int *) out_line;
- in_line += pitch * vmul;
- out_line += pitchrgba;
- for (x = 0; x < width * hmul; x += hmul)
- {
- red = green = blue = 0;
- o = 0;
- for (s = 0; s < 3; s++)
- {
- red += filters[rf][s]*in[x+o];
- green += filters[gf][s]*in[x+o];
- blue += filters[bf][s]*in[x+o];
- o += os;
- }
- red = red / 65536;
- green = green / 65536;
- blue = blue / 65536;
- *out++ = (green << 24) | (red << 16) | (green << 8) | blue;
- }
- }
-
- XRenderAddGlyphs (dpy, font->glyphset, &g, gi, 1,
- (char *) bufBitmapRgba, sizergba);
- }
- else
- {
- XRenderAddGlyphs (dpy, font->glyphset, &g, gi, 1,
- (char *) bufBitmap, size);
- }
- }
- if (bufBitmap != bufLocal)
- free (bufBitmap);
- if (bufBitmapRgba != bufLocalRgba)
- free (bufBitmapRgba);
-}
-
-#define STEP 256
-
-/*
- * Return whether the given glyph generates any image on the screen,
- * this means it exists or a default glyph exists
- */
-static Bool
-XftGlyphDrawable (Display *dpy,
- XftFontStruct *font,
- XftChar32 glyph)
-{
- if (font->charmap != -1)
- {
- FT_Set_Charmap (font->face, font->face->charmaps[font->charmap]);
- glyph = (XftChar32) FT_Get_Char_Index (font->face, (FT_ULong) glyph);
- }
- return glyph <= font->face->num_glyphs;
-}
-
-void
-XftGlyphCheck (Display *dpy,
- XftFontStruct *font,
- XftChar32 glyph,
- XftChar32 *missing,
- int *nmissing)
-{
- XGlyphInfo **realized;
- int nrealized;
- int n;
-
- if (glyph >= font->nrealized)
- {
- nrealized = glyph + STEP;
-
- if (font->realized)
- realized = (XGlyphInfo **) realloc ((void *) font->realized,
- nrealized * sizeof (XGlyphInfo *));
- else
- realized = (XGlyphInfo **) malloc (nrealized * sizeof (XGlyphInfo *));
- if (!realized)
- return;
- for (n = font->nrealized; n < nrealized; n++)
- realized[n] = _UntestedGlyph;
-
- font->realized = realized;
- font->nrealized = nrealized;
- }
- if (font->realized[glyph] == _UntestedGlyph)
- {
- if (XftGlyphDrawable (dpy, font, glyph))
- {
- font->realized[glyph] = (XGlyphInfo *) malloc (sizeof (XGlyphInfo));
- n = *nmissing;
- missing[n++] = glyph;
- if (n == XFT_NMISSING)
- {
- XftGlyphLoad (dpy, font, missing, n);
- n = 0;
- }
- *nmissing = n;
- }
- else
- font->realized[glyph] = 0;
- }
-}
-
-Bool
-XftFreeTypeGlyphExists (Display *dpy,
- XftFontStruct *font,
- XftChar32 glyph)
-{
- if (font->charmap != -1)
- {
- FT_Set_Charmap (font->face, font->face->charmaps[font->charmap]);
- glyph = (XftChar32) FT_Get_Char_Index (font->face, (FT_ULong) glyph);
- }
- return glyph && glyph <= font->face->num_glyphs;
-}
diff --git a/xc/lib/Xft/xftgram.y b/xc/lib/Xft/xftgram.y
deleted file mode 100644
index e9dad4d2b..000000000
--- a/xc/lib/Xft/xftgram.y
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftgram.y,v 1.5 2001/05/16 10:32:54 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <stdio.h>
-#include "xftint.h"
-
-static XftMatrix matrix;
-
-%}
-
-%union {
- int ival;
- double dval;
- char *sval;
- XftExpr *eval;
- XftPattern *pval;
- XftValue vval;
- XftEdit *Eval;
- XftOp oval;
- XftQual qval;
- XftTest *tval;
-}
-
-%token <ival> INTEGER
-%token <dval> DOUBLE
-%token <sval> STRING NAME
-%token <ival> ANY ALL
-%token <ival> DIR CACHE INCLUDE INCLUDEIF MATCH EDIT
-%token <ival> TOK_TRUE TOK_FALSE TOK_NIL
-%token <ival> EQUAL SEMI OS CS
-
-%type <eval> expr
-%type <vval> value
-%type <sval> field
-%type <Eval> edit
-%type <Eval> edits
-%type <oval> eqop
-%type <qval> qual
-%type <oval> compare
-%type <tval> tests test
-%type <dval> number
-
-%right <ival> QUEST COLON
-%left <ival> OROR
-%left <ival> ANDAND
-%left <ival> EQEQ NOTEQ
-%left <ival> LESS LESSEQ MORE MOREEQ
-%left <ival> PLUS MINUS
-%left <ival> TIMES DIVIDE
-%right <ival> NOT
-
-%%
-configs : configs config
- |
- ;
-config : DIR STRING
- { XftConfigAddDir ($2); }
- | CACHE STRING
- { XftConfigSetCache ($2); }
- | INCLUDE STRING
- { XftConfigPushInput ($2, True); }
- | INCLUDEIF STRING
- { XftConfigPushInput ($2, False); }
- | MATCH tests EDIT edits
- { XftConfigAddEdit ($2, $4); }
- ;
-tests : test tests
- { $1->next = $2; $$ = $1; }
- |
- { $$ = 0; }
- ;
-test : qual field compare value
- { $$ = XftTestCreate ($1, $2, $3, $4); }
- ;
-qual : ANY
- { $$ = XftQualAny; }
- | ALL
- { $$ = XftQualAll; }
- |
- { $$ = XftQualAny; }
- ;
-field : NAME
- {
- $$ = XftConfigSaveField ($1);
- }
- ;
-compare : EQUAL
- { $$ = XftOpEqual; }
- | EQEQ
- { $$ = XftOpEqual; }
- | NOTEQ
- { $$ = XftOpNotEqual; }
- | LESS
- { $$ = XftOpLess; }
- | LESSEQ
- { $$ = XftOpLessEqual; }
- | MORE
- { $$ = XftOpMore; }
- | MOREEQ
- { $$ = XftOpMoreEqual; }
- ;
-value : INTEGER
- {
- $$.type = XftTypeInteger;
- $$.u.i = $1;
- }
- | DOUBLE
- {
- $$.type = XftTypeDouble;
- $$.u.d = $1;
- }
- | STRING
- {
- $$.type = XftTypeString;
- $$.u.s = $1;
- }
- | TOK_TRUE
- {
- $$.type = XftTypeBool;
- $$.u.b = True;
- }
- | TOK_FALSE
- {
- $$.type = XftTypeBool;
- $$.u.b = False;
- }
- | TOK_NIL
- {
- $$.type = XftTypeVoid;
- }
- | matrix
- {
- $$.type = XftTypeMatrix;
- $$.u.m = &matrix;
- }
- ;
-matrix : OS number number number number CS
- {
- matrix.xx = $2;
- matrix.xy = $3;
- matrix.yx = $4;
- matrix.__REALLY_YY__ = $5;
- }
-number : INTEGER
- { $$ = (double) $1; }
- | DOUBLE
- ;
-edits : edit edits
- { $1->next = $2; $$ = $1; }
- |
- { $$ = 0; }
- ;
-edit : field eqop expr SEMI
- { $$ = XftEditCreate ($1, $2, $3); }
- ;
-eqop : EQUAL
- { $$ = XftOpAssign; }
- | PLUS EQUAL
- { $$ = XftOpPrepend; }
- | EQUAL PLUS
- { $$ = XftOpAppend; }
- ;
-expr : INTEGER
- { $$ = XftExprCreateInteger ($1); }
- | DOUBLE
- { $$ = XftExprCreateDouble ($1); }
- | STRING
- { $$ = XftExprCreateString ($1); }
- | TOK_TRUE
- { $$ = XftExprCreateBool (True); }
- | TOK_FALSE
- { $$ = XftExprCreateBool (False); }
- | TOK_NIL
- { $$ = XftExprCreateNil (); }
- | matrix
- { $$ = XftExprCreateMatrix (&matrix); }
- | NAME
- { $$ = XftExprCreateField ($1); }
- | expr OROR expr
- { $$ = XftExprCreateOp ($1, XftOpOr, $3); }
- | expr ANDAND expr
- { $$ = XftExprCreateOp ($1, XftOpAnd, $3); }
- | expr EQEQ expr
- { $$ = XftExprCreateOp ($1, XftOpEqual, $3); }
- | expr NOTEQ expr
- { $$ = XftExprCreateOp ($1, XftOpNotEqual, $3); }
- | expr LESS expr
- { $$ = XftExprCreateOp ($1, XftOpLess, $3); }
- | expr LESSEQ expr
- { $$ = XftExprCreateOp ($1, XftOpLessEqual, $3); }
- | expr MORE expr
- { $$ = XftExprCreateOp ($1, XftOpMore, $3); }
- | expr MOREEQ expr
- { $$ = XftExprCreateOp ($1, XftOpMoreEqual, $3); }
- | expr PLUS expr
- { $$ = XftExprCreateOp ($1, XftOpPlus, $3); }
- | expr MINUS expr
- { $$ = XftExprCreateOp ($1, XftOpMinus, $3); }
- | expr TIMES expr
- { $$ = XftExprCreateOp ($1, XftOpTimes, $3); }
- | expr DIVIDE expr
- { $$ = XftExprCreateOp ($1, XftOpDivide, $3); }
- | NOT expr
- { $$ = XftExprCreateOp ($2, XftOpNot, (XftExpr *) 0); }
- | expr QUEST expr COLON expr
- { $$ = XftExprCreateOp ($1, XftOpQuest, XftExprCreateOp ($3, XftOpQuest, $5)); }
- ;
-%%
-
-int
-XftConfigwrap (void)
-{
- return 1;
-}
-
-void
-XftConfigerror (char *fmt, ...)
-{
- va_list args;
-
- fprintf (stderr, "\"%s\": line %d, ", XftConfigFile, XftConfigLineno);
- va_start (args, fmt);
- vfprintf (stderr, fmt, args);
- va_end (args);
- fprintf (stderr, "\n");
-}
-
-XftTest *
-XftTestCreate (XftQual qual, const char *field, XftOp compare, XftValue value)
-{
- XftTest *test = (XftTest *) malloc (sizeof (XftTest));;
-
- if (test)
- {
- test->next = 0;
- test->qual = qual;
- test->field = field; /* already saved in grammar */
- test->op = compare;
- if (value.type == XftTypeString)
- value.u.s = _XftSaveString (value.u.s);
- else if (value.type == XftTypeMatrix)
- value.u.m = _XftSaveMatrix (value.u.m);
- test->value = value;
- }
- return test;
-}
-
-XftExpr *
-XftExprCreateInteger (int i)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpInteger;
- e->u.ival = i;
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateDouble (double d)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpDouble;
- e->u.dval = d;
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateString (const char *s)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpString;
- e->u.sval = _XftSaveString (s);
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateMatrix (const XftMatrix *m)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpMatrix;
- e->u.mval = _XftSaveMatrix (m);
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateBool (Bool b)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpBool;
- e->u.bval = b;
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateNil (void)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpNil;
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateField (const char *field)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = XftOpField;
- e->u.field = _XftSaveString (field);
- }
- return e;
-}
-
-XftExpr *
-XftExprCreateOp (XftExpr *left, XftOp op, XftExpr *right)
-{
- XftExpr *e = (XftExpr *) malloc (sizeof (XftExpr));
-
- if (e)
- {
- e->op = op;
- e->u.tree.left = left;
- e->u.tree.right = right;
- }
- return e;
-}
-
-void
-XftExprDestroy (XftExpr *e)
-{
- switch (e->op) {
- case XftOpInteger:
- break;
- case XftOpDouble:
- break;
- case XftOpString:
- free (e->u.sval);
- break;
- case XftOpMatrix:
- free (e->u.mval);
- break;
- case XftOpBool:
- break;
- case XftOpField:
- free (e->u.field);
- break;
- case XftOpAssign:
- case XftOpPrepend:
- case XftOpAppend:
- break;
- case XftOpOr:
- case XftOpAnd:
- case XftOpEqual:
- case XftOpNotEqual:
- case XftOpLess:
- case XftOpLessEqual:
- case XftOpMore:
- case XftOpMoreEqual:
- case XftOpPlus:
- case XftOpMinus:
- case XftOpTimes:
- case XftOpDivide:
- case XftOpQuest:
- XftExprDestroy (e->u.tree.right);
- /* fall through */
- case XftOpNot:
- XftExprDestroy (e->u.tree.left);
- break;
- case XftOpNil:
- break;
- }
- free (e);
-}
-
-XftEdit *
-XftEditCreate (const char *field, XftOp op, XftExpr *expr)
-{
- XftEdit *e = (XftEdit *) malloc (sizeof (XftEdit));
-
- if (e)
- {
- e->next = 0;
- e->field = field; /* already saved in grammar */
- e->op = op;
- e->expr = expr;
- }
- return e;
-}
-
-void
-XftEditDestroy (XftEdit *e)
-{
- if (e->next)
- XftEditDestroy (e->next);
- free ((void *) e->field);
- if (e->expr)
- XftExprDestroy (e->expr);
-}
-
-char *
-XftConfigSaveField (const char *field)
-{
- return _XftSaveString (field);
-}
diff --git a/xc/lib/Xft/xftinit.c b/xc/lib/Xft/xftinit.c
deleted file mode 100644
index bae4714aa..000000000
--- a/xc/lib/Xft/xftinit.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftinit.c,v 1.2 2000/12/15 17:12:53 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include "xftint.h"
-
-XftFontSet *_XftFontSet;
-Bool _XftConfigInitialized;
-
-Bool
-XftInit (char *config)
-{
- if (_XftConfigInitialized)
- return True;
- _XftConfigInitialized = True;
- if (!config)
- {
- config = getenv ("XFT_CONFIG");
- if (!config)
- config = XFT_DEFAULT_PATH;
- }
- if (XftConfigLexFile (config))
- {
- XftConfigparse ();
- }
- return True;
-}
diff --git a/xc/lib/Xft/xftint.h b/xc/lib/Xft/xftint.h
deleted file mode 100644
index 46e0c0997..000000000
--- a/xc/lib/Xft/xftint.h
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftint.h,v 1.26 2001/07/13 18:16:10 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 _XFTINT_H_
-#define _XFTINT_H_
-
-#include <X11/Xlib.h>
-#ifdef FREETYPE2
-#include "XftFreetype.h"
-#else
-#include "Xft.h"
-#endif
-
-typedef struct _XftMatcher {
- char *object;
- double (*compare) (char *object, XftValue value1, XftValue value2);
-} XftMatcher;
-
-typedef struct _XftSymbolic {
- const char *name;
- int value;
-} XftSymbolic;
-
-#define XFT_DRAW_N_SRC 2
-
-#define XFT_DRAW_SRC_TEXT 0
-#define XFT_DRAW_SRC_RECT 1
-
-struct _XftDraw {
- Display *dpy;
- Drawable drawable;
- Visual *visual; /* NULL for bitmaps */
- Colormap colormap;
- Region clip;
- Bool core_set;
- Bool render_set;
- Bool render_able;
- struct {
- Picture pict;
- struct {
- Picture pict;
- XRenderColor color;
- } src[XFT_DRAW_N_SRC];
- } render;
- struct {
- GC draw_gc;
- unsigned long fg;
- Font font;
- } core;
-};
-
-typedef struct _XftDisplayInfo {
- struct _XftDisplayInfo *next;
- Display *display;
- XExtCodes *codes;
- XftPattern *defaults;
- XftFontSet *coreFonts;
- Bool hasRender;
-} XftDisplayInfo;
-
-extern XftFontSet *_XftGlobalFontSet;
-extern XftDisplayInfo *_XftDisplayInfo;
-extern char **XftConfigDirs;
-extern XftFontSet *_XftFontSet;
-
-#define XFT_NMISSING 256
-
-#ifndef XFT_DEFAULT_PATH
-#define XFT_DEFAULT_PATH "/usr/X11R6/lib/X11/XftConfig"
-#endif
-
-#define XFT_DBG_OPEN 1
-#define XFT_DBG_OPENV 2
-#define XFT_DBG_RENDER 4
-#define XFT_DBG_DRAW 8
-#define XFT_DBG_REF 16
-#define XFT_DBG_GLYPH 32
-#define XFT_DBG_GLYPHV 64
-#define XFT_DBG_CACHE 128
-#define XFT_DBG_CACHEV 256
-#define XFT_DBG_MATCH 512
-#define XFT_DBG_MATCHV 1024
-
-typedef enum _XftOp {
- XftOpInteger, XftOpDouble, XftOpString, XftOpMatrix, XftOpBool, XftOpNil,
- XftOpField,
- XftOpAssign, XftOpPrepend, XftOpAppend,
- XftOpQuest,
- XftOpOr, XftOpAnd, XftOpEqual, XftOpNotEqual,
- XftOpLess, XftOpLessEqual, XftOpMore, XftOpMoreEqual,
- XftOpPlus, XftOpMinus, XftOpTimes, XftOpDivide,
- XftOpNot
-} XftOp;
-
-typedef struct _XftExpr {
- XftOp op;
- union {
- int ival;
- double dval;
- char *sval;
- XftMatrix *mval;
- Bool bval;
- char *field;
- struct {
- struct _XftExpr *left, *right;
- } tree;
- } u;
-} XftExpr;
-
-typedef enum _XftQual {
- XftQualAny, XftQualAll
-} XftQual;
-
-typedef struct _XftTest {
- struct _XftTest *next;
- XftQual qual;
- const char *field;
- XftOp op;
- XftValue value;
-} XftTest;
-
-typedef struct _XftEdit {
- struct _XftEdit *next;
- const char *field;
- XftOp op;
- XftExpr *expr;
-} XftEdit;
-
-typedef struct _XftSubst {
- struct _XftSubst *next;
- XftTest *test;
- XftEdit *edit;
-} XftSubst;
-
-/*
- * I tried this with functions that took va_list* arguments
- * but portability concerns made me change these functions
- * into macros (sigh).
- */
-
-#define _XftPatternVapBuild(result, orig, va) \
-{ \
- XftPattern *__p__ = (orig); \
- const char *__o__; \
- XftValue __v__; \
- \
- if (!__p__) \
- { \
- __p__ = XftPatternCreate (); \
- if (!__p__) \
- goto _XftPatternVapBuild_bail0; \
- } \
- for (;;) \
- { \
- __o__ = va_arg (va, const char *); \
- if (!__o__) \
- break; \
- __v__.type = va_arg (va, XftType); \
- switch (__v__.type) { \
- case XftTypeVoid: \
- goto _XftPatternVapBuild_bail1; \
- case XftTypeInteger: \
- __v__.u.i = va_arg (va, int); \
- break; \
- case XftTypeDouble: \
- __v__.u.d = va_arg (va, double); \
- break; \
- case XftTypeString: \
- __v__.u.s = va_arg (va, char *); \
- break; \
- case XftTypeBool: \
- __v__.u.b = va_arg (va, Bool); \
- break; \
- case XftTypeMatrix: \
- __v__.u.m = va_arg (va, XftMatrix *); \
- break; \
- } \
- if (!XftPatternAdd (__p__, __o__, __v__, True)) \
- goto _XftPatternVapBuild_bail1; \
- } \
- result = __p__; \
- goto _XftPatternVapBuild_return; \
- \
-_XftPatternVapBuild_bail1: \
- if (!orig) \
- XftPatternDestroy (__p__); \
-_XftPatternVapBuild_bail0: \
- result = 0; \
- \
-_XftPatternVapBuild_return: \
- ; \
-}
-
-
-/* xftcache.c */
-
-char *
-XftFileCacheFind (char *file, int id, int *count);
-
-void
-XftFileCacheDispose (void);
-
-void
-XftFileCacheLoad (char *cache);
-
-Bool
-XftFileCacheUpdate (char *file, int id, char *name);
-
-Bool
-XftFileCacheSave (char *cache);
-
-Bool
-XftFileCacheReadDir (XftFontSet *set, const char *cache_file);
-
-Bool
-XftFileCacheWriteDir (XftFontSet *set, const char *cache_file);
-
-/* xftcfg.c */
-Bool
-XftConfigAddDir (char *d);
-
-Bool
-XftConfigSetCache (char *c);
-
-char *
-XftConfigGetCache (void);
-
-Bool
-XftConfigAddEdit (XftTest *test, XftEdit *edit);
-
-Bool
-_XftConfigCompareValue (XftValue m,
- XftOp op,
- XftValue v);
-
-/* xftcore.c */
-
-#define XFT_CORE_N16LOCAL 256
-
-XChar2b *
-XftCoreConvert16 (XftChar16 *string,
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL]);
-
-XChar2b *
-XftCoreConvert32 (XftChar32 *string,
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL]);
-
-XChar2b *
-XftCoreConvertUtf8 (XftChar8 *string,
- int len,
- XChar2b xcloc[XFT_CORE_N16LOCAL],
- int *nchar);
-
-void
-XftCoreExtents8 (Display *dpy,
- XFontStruct *fs,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftCoreExtents16 (Display *dpy,
- XFontStruct *fs,
- XftChar16 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftCoreExtents32 (Display *dpy,
- XFontStruct *fs,
- XftChar32 *string,
- int len,
- XGlyphInfo *extents);
-
-void
-XftCoreExtentsUtf8 (Display *dpy,
- XFontStruct *fs,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents);
-
-Bool
-XftCoreGlyphExists (Display *dpy,
- XFontStruct *fs,
- XftChar32 glyph);
-
-/* xftdbg.c */
-void
-XftOpPrint (XftOp op);
-
-void
-XftTestPrint (XftTest *test);
-
-void
-XftExprPrint (XftExpr *expr);
-
-void
-XftEditPrint (XftEdit *edit);
-
-void
-XftSubstPrint (XftSubst *subst);
-
-/* xftdpy.c */
-int
-XftDefaultParseBool (char *v);
-
-Bool
-XftDefaultGetBool (Display *dpy, const char *object, int screen, Bool def);
-
-int
-XftDefaultGetInteger (Display *dpy, const char *object, int screen, int def);
-
-double
-XftDefaultGetDouble (Display *dpy, const char *object, int screen, double def);
-
-XftFontSet *
-XftDisplayGetFontSet (Display *dpy);
-
-/* xftdraw.c */
-Bool
-XftDrawRenderPrepare (XftDraw *draw,
- XftColor *color,
- XftFont *font,
- int src);
-
-Bool
-XftDrawCorePrepare (XftDraw *draw,
- XftColor *color,
- XftFont *font);
-
-/* xftextent.c */
-/* xftfont.c */
-int
-_XftFontDebug (void);
-
-/* xftfs.c */
-/* xftgram.y */
-int
-XftConfigparse (void);
-
-int
-XftConfigwrap (void);
-
-void
-XftConfigerror (char *fmt, ...);
-
-char *
-XftConfigSaveField (const char *field);
-
-XftTest *
-XftTestCreate (XftQual qual, const char *field, XftOp compare, XftValue value);
-
-XftExpr *
-XftExprCreateInteger (int i);
-
-XftExpr *
-XftExprCreateDouble (double d);
-
-XftExpr *
-XftExprCreateString (const char *s);
-
-XftExpr *
-XftExprCreateMatrix (const XftMatrix *m);
-
-XftExpr *
-XftExprCreateBool (Bool b);
-
-XftExpr *
-XftExprCreateNil (void);
-
-XftExpr *
-XftExprCreateField (const char *field);
-
-XftExpr *
-XftExprCreateOp (XftExpr *left, XftOp op, XftExpr *right);
-
-void
-XftExprDestroy (XftExpr *e);
-
-XftEdit *
-XftEditCreate (const char *field, XftOp op, XftExpr *expr);
-
-void
-XftEditDestroy (XftEdit *e);
-
-/* xftinit.c */
-
-/* xftlex.l */
-extern int XftConfigLineno;
-extern char *XftConfigFile;
-
-int
-XftConfiglex (void);
-
-Bool
-XftConfigLexFile(char *s);
-
-Bool
-XftConfigPushInput (char *s, Bool complain);
-
-/* xftlist.c */
-Bool
-XftListValueCompare (XftValue v1,
- XftValue v2);
-
-Bool
-XftListValueListCompare (XftValueList *v1orig,
- XftValueList *v2orig,
- XftQual qual);
-
-Bool
-XftListMatch (XftPattern *p,
- XftPattern *font,
- XftQual qual);
-
-Bool
-XftListAppend (XftFontSet *s,
- XftPattern *font,
- XftObjectSet *os);
-
-
-/* xftmatch.c */
-
-/* xftname.c */
-Bool
-XftNameConstant (char *string, int *result);
-
-/* xftpat.c */
-
-/* xftrender.c */
-
-/* xftmatrix.c */
-XftMatrix *
-_XftSaveMatrix (const XftMatrix *mat);
-
-/* xftstr.c */
-char *
-_XftSaveString (const char *s);
-
-const char *
-_XftGetInt(const char *ptr, int *val);
-
-char *
-_XftSplitStr (const char *field, char *save);
-
-char *
-_XftDownStr (const char *field, char *save);
-
-const char *
-_XftSplitField (const char *field, char *save);
-
-const char *
-_XftSplitValue (const char *field, char *save);
-
-int
-_XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def);
-
-int
-_XftStrCmpIgnoreCase (const char *s1, const char *s2);
-
-/* xftxlfd.c */
-Bool
-XftCoreAddFonts (XftFontSet *set, Display *dpy, Bool ignore_scalable);
-
-#endif /* _XFT_INT_H_ */
diff --git a/xc/lib/Xft/xftlex.l b/xc/lib/Xft/xftlex.l
deleted file mode 100644
index 3eff3f429..000000000
--- a/xc/lib/Xft/xftlex.l
+++ /dev/null
@@ -1,275 +0,0 @@
-%{
-/*
- * $XFree86: xc/lib/Xft/xftlex.l,v 1.7 2001/05/18 16:03:06 tsi Exp $
- *
- * Copyright (c) 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <string.h>
-#include "xftint.h"
-
-#include "xftgram.h"
-
-int XftConfigLineno;
-
-static void _XftConfigSkipComment (void);
-
-static void _XftConfigSkipLine (void);
-
-static int _XftConfigPopInput (void);
-
-
-#define XFT_CONFIG_IN_DEEP 20
-FILE *XftConfigInStack[XFT_CONFIG_IN_DEEP];
-FILE **XftConfigInpt = XftConfigInStack + XFT_CONFIG_IN_DEEP;
-FILE *XftConfigInput;
-int XftConfigLinenos[XFT_CONFIG_IN_DEEP];
-int *XftConfigLinenopt = XftConfigLinenos + XFT_CONFIG_IN_DEEP;
-char *XftConfigFile = "";
-char *XftConfigFileNames[XFT_CONFIG_IN_DEEP];
-char **XftConfigFileNamePt = XftConfigFileNames + XFT_CONFIG_IN_DEEP;
-int XftConfigFiledeep = 0;
-
-#undef YY_INPUT
-
-#define YY_INPUT(buf,result,max_size) \
-{ \
- int c; \
- result = 0; \
- while (result < max_size) { \
- c = getc (XftConfigInput); \
- if (c < 0) { \
- c = _XftConfigPopInput (); \
- if (c < 0) \
- break; \
- } \
- buf[result++] = c; \
- if (c == '\n') \
- { \
- XftConfigLineno++; \
- break; \
- } \
- } \
-}
-
-#ifndef FLEX_SCANNER
-#undef input
-#undef unput
-static int input (void)
-{
- char buf[1];
- static int r = EOF;
-
- if (r == 0)
- return 0;
- YY_INPUT(buf, r, 1);
- if (r == 0)
- return EOF;
- return buf[0];
-}
-
-static void unput (char c)
-{
- if (!c || c == EOF)
- return;
- if (c == '\n')
- XftConfigLineno--;
- ungetc (c, XftConfigInput);
-}
-#endif
-
-%}
-%%
-"/\052" _XftConfigSkipComment();
-^# _XftConfigSkipLine();
-dir return DIR;
-cache return CACHE;
-include return INCLUDE;
-includeif return INCLUDEIF;
-match return MATCH;
-edit return EDIT;
-true return TOK_TRUE;
-false return TOK_FALSE;
-nil return TOK_NIL;
-any return ANY;
-all return ALL;
-"=" return EQUAL;
-":" return COLON;
-";" return SEMI;
-"+" return PLUS;
-"-" return MINUS;
-"*" return TIMES;
-"/" return DIVIDE;
-"!" return NOT;
-"&&" return ANDAND;
-"||" return OROR;
-"<" return LESS;
-"<=" return LESSEQ;
-"==" return EQEQ;
-">=" return MOREEQ;
-">" return MORE;
-"!=" return NOTEQ;
-"?" return QUEST;
-"[" return OS;
-"]" return CS;
-\"([^\n\"]|\\\")*\" {
- yytext[yyleng - 1] = '\0';
- yylval.sval = yytext+1;
- return STRING;
- }
-[0-9]+ {
- yylval.ival = strtol (yytext, 0, 10);
- return INTEGER;
- }
-(([0-9]+((\.[0-9]*(\{[0-9]+\})?)?))|(\.[0-9]+)|(\.[0-9]*\{[0-9]+\}))(([Ee][-+]?[0-9]+)?) {
- yylval.dval = strtod (yytext, 0);
- return DOUBLE;
- }
-[a-zA-Z][0-9a-zA-Z_]* {
- if (XftNameConstant (yytext, &yylval.ival))
- return INTEGER;
- yylval.sval = yytext;
- return NAME;
- }
-. ;
-"\n" ;
-%%
-static void
-_XftConfigSkipComment (void)
-{
- int c;
-
- c = input();
- for (;;) {
- while (c != EOF && c != '*')
- c = input();
- if (c == EOF)
- return;
- c = input();
- if (c == EOF || c == '/')
- return;
- }
-}
-
-static void
-_XftConfigSkipLine (void)
-{
- int c;
-
- do {
- c = input();
- } while (c != EOF && c != '\n');
- if (c == '\n') unput('\n');
-}
-
-Bool
-XftConfigLexFile(char *s)
-{
- FILE *f;
-
- f = fopen (s, "r");
- if (f == 0)
- {
- fprintf (stderr, "cannot open file \"%s\"\n", s);
- return False;
- }
- ++XftConfigFiledeep;
- XftConfigInput = f;
- XftConfigFile = s;
- return True;
-}
-
-Bool
-XftConfigPushInput (char *s, Bool complain)
-{
- FILE *f;
- char *t;
- char *h;
-
- if (XftConfigInpt == XftConfigInStack)
- {
- (void) fprintf (stderr, "files nested too deeply\n");
- return False;
- }
- t = s;
- if (*s == '~')
- {
- h = getenv ("HOME");
- if (h)
- {
- t = (char *) malloc (strlen (h) + strlen (s));
- if (t)
- {
- strcpy (t, h);
- strcat (t, s+1);
- }
- else
- t = s;
- }
- }
- f = fopen (t, "r");
- if (t != s)
- free (t);
- if (f == 0)
- {
- if (complain)
- (void) fprintf (stderr, "cannot open file %s\n", s);
- return False;
- }
- ++XftConfigFiledeep;
- *--XftConfigInpt = XftConfigInput;
- *--XftConfigLinenopt = XftConfigLineno;
- *--XftConfigFileNamePt = XftConfigFile;
- XftConfigInput = f;
- XftConfigLineno = 1;
- XftConfigFile = _XftSaveString (s);
- return True;
-}
-
-static int
-_XftConfigPopInput (void)
-{
- int c;
-
- for (;;)
- {
- c = getc (XftConfigInput);
- if (c >= 0)
- return c;
- fclose (XftConfigInput);
- XftConfigInput = 0;
- if (XftConfigInpt == XftConfigInStack + XFT_CONFIG_IN_DEEP)
- return EOF;
- XftConfigInput = *XftConfigInpt++;
- XftConfigLineno = *XftConfigLinenopt++;
- free (XftConfigFile);
- XftConfigFile = *XftConfigFileNamePt++;
- --XftConfigFiledeep;
- }
-}
-
-void
-XftConfigLexDone (void)
-{
-#ifdef FLEX_SCANNER
- XftConfig_delete_buffer (XftConfig_current_buffer);
-#endif
-}
diff --git a/xc/lib/Xft/xftlist.c b/xc/lib/Xft/xftlist.c
deleted file mode 100644
index 478dce07f..000000000
--- a/xc/lib/Xft/xftlist.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftlist.c,v 1.2 2000/12/07 23:57:28 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include "xftint.h"
-
-XftObjectSet *
-XftObjectSetCreate (void)
-{
- XftObjectSet *os;
-
- os = (XftObjectSet *) malloc (sizeof (XftObjectSet));
- if (!os)
- return 0;
- os->nobject = 0;
- os->sobject = 0;
- os->objects = 0;
- return os;
-}
-
-Bool
-XftObjectSetAdd (XftObjectSet *os, const char *object)
-{
- int s;
- const char **objects;
-
- if (os->nobject == os->sobject)
- {
- s = os->sobject + 4;
- if (os->objects)
- objects = (const char **) realloc ((void *) os->objects,
- s * sizeof (const char **));
- else
- objects = (const char **) malloc (s * sizeof (const char **));
- if (!objects)
- return False;
- os->objects = objects;
- os->sobject = s;
- }
- os->objects[os->nobject++] = object;
- return True;
-}
-
-void
-XftObjectSetDestroy (XftObjectSet *os)
-{
- if (os->objects)
- free ((void *) os->objects);
- free (os);
-}
-
-#define _XftObjectSetVapBuild(__ret__, __first__, __va__) \
-{ \
- XftObjectSet *__os__; \
- const char *__ob__; \
- \
- __ret__ = 0; \
- __os__ = XftObjectSetCreate (); \
- if (!__os__) \
- goto _XftObjectSetVapBuild_bail0; \
- __ob__ = __first__; \
- while (__ob__) \
- { \
- if (!XftObjectSetAdd (__os__, __ob__)) \
- goto _XftObjectSetVapBuild_bail1; \
- __ob__ = va_arg (__va__, const char *); \
- } \
- __ret__ = __os__; \
- \
-_XftObjectSetVapBuild_bail1: \
- if (!__ret__ && __os__) \
- XftObjectSetDestroy (__os__); \
-_XftObjectSetVapBuild_bail0: \
- ; \
-}
-
-XftObjectSet *
-XftObjectSetVaBuild (const char *first, va_list va)
-{
- XftObjectSet *ret;
-
- _XftObjectSetVapBuild (ret, first, va);
- return ret;
-}
-
-XftObjectSet *
-XftObjectSetBuild (const char *first, ...)
-{
- va_list va;
- XftObjectSet *os;
-
- va_start (va, first);
- _XftObjectSetVapBuild (os, first, va);
- va_end (va);
- return os;
-}
-
-Bool
-XftListValueCompare (XftValue v1,
- XftValue v2)
-{
- return _XftConfigCompareValue (v1, XftOpEqual, v2);
-}
-
-Bool
-XftListValueListCompare (XftValueList *v1orig,
- XftValueList *v2orig,
- XftQual qual)
-{
- XftValueList *v1, *v2;
-
- for (v1 = v1orig; v1; v1 = v1->next)
- {
- for (v2 = v2orig; v2; v2 = v2->next)
- {
- if (_XftConfigCompareValue (v1->value, XftOpEqual, v2->value))
- {
- if (qual == XftQualAny)
- return True;
- else
- break;
- }
- }
- if (qual == XftQualAll)
- {
- if (!v2)
- return False;
- }
- }
- if (qual == XftQualAll)
- return True;
- else
- return False;
-}
-
-/*
- * True iff all objects in "p" match "font"
- */
-Bool
-XftListMatch (XftPattern *p,
- XftPattern *font,
- XftQual qual)
-{
- int i;
- XftPatternElt *e;
-
- for (i = 0; i < p->num; i++)
- {
- e = XftPatternFind (font, p->elts[i].object, False);
- if (!e)
- {
- if (qual == XftQualAll)
- continue;
- else
- return False;
- }
- if (!XftListValueListCompare (p->elts[i].values, e->values, qual))
- return False;
- }
- return True;
-}
-
-Bool
-XftListAppend (XftFontSet *s,
- XftPattern *font,
- XftObjectSet *os)
-{
- int f;
- int o;
- XftPattern *l;
- XftPatternElt *e;
- XftValueList *v;
-
- for (f = 0; f < s->nfont; f++)
- {
- l = s->fonts[f];
- if (XftListMatch (l, font, XftQualAll))
- return True;
- }
- l = XftPatternCreate ();
- if (!l)
- goto bail0;
- for (o = 0; o < os->nobject; o++)
- {
- e = XftPatternFind (font, os->objects[o], False);
- if (e)
- {
- for (v = e->values; v; v = v->next)
- {
- if (!XftPatternAdd (l, os->objects[o], v->value, True))
- goto bail1;
- }
- }
- }
- if (!XftFontSetAdd (s, l))
- goto bail1;
- return True;
-bail1:
- XftPatternDestroy (l);
-bail0:
- return False;
-}
-
-XftFontSet *
-XftListFontSets (XftFontSet **sets,
- int nsets,
- XftPattern *p,
- XftObjectSet *os)
-{
- XftFontSet *ret;
- XftFontSet *s;
- int f;
- int set;
-
- ret = XftFontSetCreate ();
- if (!ret)
- goto bail0;
- for (set = 0; set < nsets; set++)
- {
- s = sets[set];
- for (f = 0; f < s->nfont; f++)
- {
- if (XftListMatch (p, s->fonts[f], XftQualAny))
- {
- if (!XftListAppend (ret, s->fonts[f], os))
- goto bail1;
- }
- }
- }
- return ret;
-bail1:
- XftFontSetDestroy (ret);
-bail0:
- return 0;
-}
-
-XftFontSet *
-XftListFontsPatternObjects (Display *dpy,
- int screen,
- XftPattern *pattern,
- XftObjectSet *os)
-{
- XftFontSet *sets[2];
- int nsets = 0;
-#ifdef FREETYPE2
- Bool core, render;
- XftResult result;
-#endif
-
- if (!XftInit (0))
- return 0;
-
-#ifdef FREETYPE2
- render = core = False;
- result = XftPatternGetBool (pattern, XFT_CORE, 0, &core);
- if (result != XftResultMatch)
- core = XftDefaultGetBool (dpy, XFT_CORE, screen,
- !XftDefaultHasRender (dpy));
-
- result = XftPatternGetBool (pattern, XFT_RENDER, 0, &render);
- if (result != XftResultMatch)
- render = XftDefaultGetBool (dpy, XFT_RENDER, screen,
- XftDefaultHasRender (dpy));
- if (render)
- {
- if (XftInitFtLibrary ())
- {
- sets[nsets] = _XftFontSet;
- if (sets[nsets])
- nsets++;
- }
- }
- if (core)
-#endif
- {
- sets[nsets] = XftDisplayGetFontSet (dpy);
- if (sets[nsets])
- nsets++;
- }
- return XftListFontSets (sets, nsets, pattern, os);
-}
-
-XftFontSet *
-XftListFonts (Display *dpy,
- int screen,
- ...)
-{
- va_list va;
- XftFontSet *fs;
- XftObjectSet *os;
- XftPattern *pattern;
- const char *first;
-
- va_start (va, screen);
-
- _XftPatternVapBuild (pattern, 0, va);
-
- first = va_arg (va, const char *);
- _XftObjectSetVapBuild (os, first, va);
-
- va_end (va);
-
- fs = XftListFontsPatternObjects (dpy, screen, pattern, os);
- XftPatternDestroy (pattern);
- XftObjectSetDestroy (os);
- return fs;
-}
diff --git a/xc/lib/Xft/xftmatch.c b/xc/lib/Xft/xftmatch.c
deleted file mode 100644
index e0e9b0f00..000000000
--- a/xc/lib/Xft/xftmatch.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftmatch.c,v 1.5 2001/03/06 18:00:26 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <string.h>
-#include <ctype.h>
-#include "xftint.h"
-#include <stdio.h>
-
-static double
-_XftCompareInteger (char *object, XftValue value1, XftValue value2)
-{
- int v;
-
- if (value2.type != XftTypeInteger || value1.type != XftTypeInteger)
- return -1.0;
- v = value2.u.i - value1.u.i;
- if (v < 0)
- v = -v;
- return (double) v;
-}
-
-static double
-_XftCompareString (char *object, XftValue value1, XftValue value2)
-{
- if (value2.type != XftTypeString || value1.type != XftTypeString)
- return -1.0;
- return (double) _XftStrCmpIgnoreCase (value1.u.s, value2.u.s) != 0;
-}
-
-static double
-_XftCompareBool (char *object, XftValue value1, XftValue value2)
-{
- if (value2.type != XftTypeBool || value1.type != XftTypeBool)
- return -1.0;
- return (double) value2.u.b != value1.u.b;
-}
-
-static double
-_XftCompareSize (char *object, XftValue value1, XftValue value2)
-{
- double v1, v2, v;
-
- switch (value1.type) {
- case XftTypeInteger:
- v1 = value1.u.i;
- break;
- case XftTypeDouble:
- v1 = value1.u.d;
- break;
- default:
- return -1;
- }
- switch (value2.type) {
- case XftTypeInteger:
- v2 = value2.u.i;
- break;
- case XftTypeDouble:
- v2 = value2.u.d;
- break;
- default:
- return -1;
- }
- if (v2 == 0)
- return 0;
- v = v2 - v1;
- if (v < 0)
- v = -v;
- return v;
-}
-
-/*
- * Order is significant, it defines the precedence of
- * each value, earlier values are more significant than
- * later values
- */
-static XftMatcher _XftMatchers [] = {
- { XFT_FOUNDRY, _XftCompareString, },
- { XFT_ENCODING, _XftCompareString, },
- { XFT_ANTIALIAS, _XftCompareBool, },
- { XFT_FAMILY, _XftCompareString, },
- { XFT_SPACING, _XftCompareInteger, },
- { XFT_PIXEL_SIZE, _XftCompareSize, },
- { XFT_STYLE, _XftCompareString, },
- { XFT_SLANT, _XftCompareInteger, },
- { XFT_WEIGHT, _XftCompareInteger, },
- { XFT_RASTERIZER, _XftCompareString, },
- { XFT_OUTLINE, _XftCompareBool, },
-};
-
-#define NUM_MATCHER (sizeof _XftMatchers / sizeof _XftMatchers[0])
-
-static Bool
-_XftCompareValueList (const char *object,
- XftValueList *v1orig, /* pattern */
- XftValueList *v2orig, /* target */
- XftValue *bestValue,
- double *value,
- XftResult *result)
-{
- XftValueList *v1, *v2;
- double v, best;
- int j;
- int i;
-
- for (i = 0; i < NUM_MATCHER; i++)
- {
- if (!_XftStrCmpIgnoreCase (_XftMatchers[i].object, object))
- break;
- }
- if (i == NUM_MATCHER)
- {
- if (bestValue)
- *bestValue = v2orig->value;
- return True;
- }
-
- best = 1e99;
- j = 0;
- for (v1 = v1orig; v1; v1 = v1->next)
- {
- for (v2 = v2orig; v2; v2 = v2->next)
- {
- v = (*_XftMatchers[i].compare) (_XftMatchers[i].object,
- v1->value,
- v2->value);
- if (v < 0)
- {
- *result = XftResultTypeMismatch;
- return False;
- }
- if (_XftFontDebug () & XFT_DBG_MATCHV)
- printf (" v %g j %d ", v, j);
- v = v * 100 + j;
- if (v < best)
- {
- if (bestValue)
- *bestValue = v2->value;
- best = v;
- }
- }
- j++;
- }
- if (_XftFontDebug () & XFT_DBG_MATCHV)
- {
- printf (" %s: %g ", object, best);
- XftValueListPrint (v1orig);
- printf (", ");
- XftValueListPrint (v2orig);
- printf ("\n");
- }
- value[i] += best;
- return True;
-}
-
-/*
- * Return a value indicating the distance between the two lists of
- * values
- */
-
-static Bool
-_XftCompare (XftPattern *pat,
- XftPattern *fnt,
- double *value,
- XftResult *result)
-{
- int i, i1, i2;
-
- for (i = 0; i < NUM_MATCHER; i++)
- value[i] = 0.0;
-
- for (i1 = 0; i1 < pat->num; i1++)
- {
- for (i2 = 0; i2 < fnt->num; i2++)
- {
- if (!_XftStrCmpIgnoreCase (pat->elts[i1].object,
- fnt->elts[i2].object))
- {
- if (!_XftCompareValueList (pat->elts[i1].object,
- pat->elts[i1].values,
- fnt->elts[i2].values,
- 0,
- value,
- result))
- return False;
- break;
- }
- }
-#if 0
- /*
- * Overspecified patterns are slightly penalized in
- * case some other font includes the requested field
- */
- if (i2 == fnt->num)
- {
- for (i2 = 0; i2 < NUM_MATCHER; i2++)
- {
- if (!_XftStrCmpIgnoreCase (_XftMatchers[i2].object,
- pat->elts[i1].object))
- {
- value[i2] = 1.0;
- break;
- }
- }
- }
-#endif
- }
- return True;
-}
-
-XftPattern *
-XftFontSetMatch (XftFontSet **sets,
- int nsets,
- XftPattern *p,
- XftResult *result)
-{
- double score[NUM_MATCHER], bestscore[NUM_MATCHER];
- int f;
- XftFontSet *s;
- XftPattern *best;
- XftPattern *new;
- XftPatternElt *fe, *pe;
- XftValue v;
- int i;
- int set;
-
- for (i = 0; i < NUM_MATCHER; i++)
- bestscore[i] = 0;
- best = 0;
- if (_XftFontDebug () & XFT_DBG_MATCH)
- {
- printf ("Match ");
- XftPatternPrint (p);
- }
- for (set = 0; set < nsets; set++)
- {
- s = sets[set];
- for (f = 0; f < s->nfont; f++)
- {
- if (_XftFontDebug () & XFT_DBG_MATCH)
- {
- printf ("Font %d ", f);
- XftPatternPrint (s->fonts[f]);
- }
- if (!_XftCompare (p, s->fonts[f], score, result))
- return 0;
- if (_XftFontDebug () & XFT_DBG_MATCH)
- {
- printf ("Score");
- for (i = 0; i < NUM_MATCHER; i++)
- {
- printf (" %g", score[i]);
- }
- printf ("\n");
- }
- for (i = 0; i < NUM_MATCHER; i++)
- {
- if (best && bestscore[i] < score[i])
- break;
- if (!best || score[i] < bestscore[i])
- {
- for (i = 0; i < NUM_MATCHER; i++)
- bestscore[i] = score[i];
- best = s->fonts[f];
- break;
- }
- }
- }
- }
- if (_XftFontDebug () & XFT_DBG_MATCH)
- {
- printf ("Best score");
- for (i = 0; i < NUM_MATCHER; i++)
- printf (" %g", bestscore[i]);
- XftPatternPrint (best);
- }
- if (!best)
- {
- *result = XftResultNoMatch;
- return 0;
- }
- new = XftPatternCreate ();
- if (!new)
- return 0;
- for (i = 0; i < best->num; i++)
- {
- fe = &best->elts[i];
- pe = XftPatternFind (p, fe->object, False);
- if (pe)
- {
- if (!_XftCompareValueList (pe->object, pe->values,
- fe->values, &v, score, result))
- {
- XftPatternDestroy (new);
- return 0;
- }
- }
- else
- v = fe->values->value;
- XftPatternAdd (new, fe->object, v, True);
- }
- for (i = 0; i < p->num; i++)
- {
- pe = &p->elts[i];
- fe = XftPatternFind (best, pe->object, False);
- if (!fe)
- XftPatternAdd (new, pe->object, pe->values->value, True);
- }
- return new;
-}
diff --git a/xc/lib/Xft/xftmatrix.c b/xc/lib/Xft/xftmatrix.c
deleted file mode 100644
index bd6f155ed..000000000
--- a/xc/lib/Xft/xftmatrix.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftmatrix.c,v 1.1 2001/03/30 18:50:18 keithp Exp $
- *
- * Copyright © 2000 Tuomas J. Lukka
- *
- * 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 Tuomas Lukka not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Tuomas Lukka makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * TUOMAS LUKKA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL TUOMAS LUKKA BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER 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 <math.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "xftint.h"
-
-XftMatrix *
-_XftSaveMatrix (const XftMatrix *mat)
-{
- XftMatrix *r;
- if(!mat)
- return 0;
- r = (XftMatrix *) malloc (sizeof (*r) );
- if (!r)
- return 0;
- *r = *mat;
- return r;
-}
-
-int
-XftMatrixEqual (const XftMatrix *mat1, const XftMatrix *mat2)
-{
- if(mat1 == mat2) return True;
- if(mat1 == 0 || mat2 == 0) return False;
- return mat1->xx == mat2->xx &&
- mat1->xy == mat2->xy &&
- mat1->yx == mat2->yx &&
- mat1->yy == mat2->yy;
-}
-
-void
-XftMatrixMultiply (XftMatrix *result, XftMatrix *a, XftMatrix *b)
-{
- XftMatrix r;
-
- r.xx = a->xx * b->xx + a->xy * b->yx;
- r.xy = a->xx * b->xy + a->xy * b->yy;
- r.yx = a->yx * b->xx + a->yy * b->yx;
- r.yy = a->yx * b->xy + a->yy * b->yy;
- *result = r;
-}
-
-void
-XftMatrixRotate (XftMatrix *m, double c, double s)
-{
- XftMatrix r;
-
- /*
- * X Coordinate system is upside down, swap to make
- * rotations counterclockwise
- */
- r.xx = c;
- r.xy = -s;
- r.yx = s;
- r.yy = c;
- XftMatrixMultiply (m, &r, m);
-}
-
-void
-XftMatrixScale (XftMatrix *m, double sx, double sy)
-{
- XftMatrix r;
-
- r.xx = sx;
- r.xy = 0;
- r.yx = 0;
- r.yy = sy;
- XftMatrixMultiply (m, &r, m);
-}
-
-void
-XftMatrixShear (XftMatrix *m, double sh, double sv)
-{
- XftMatrix r;
-
- r.xx = 1;
- r.xy = sh;
- r.yx = sv;
- r.yy = 1;
- XftMatrixMultiply (m, &r, m);
-}
diff --git a/xc/lib/Xft/xftname.c b/xc/lib/Xft/xftname.c
deleted file mode 100644
index 39af64a43..000000000
--- a/xc/lib/Xft/xftname.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftname.c,v 1.10 2001/03/30 18:50:18 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 "xftint.h"
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-typedef struct _XftObjectType {
- const char *object;
- XftType type;
-} XftObjectType;
-
-static const XftObjectType _XftObjectTypes[] = {
- { XFT_FAMILY, XftTypeString, },
- { XFT_STYLE, XftTypeString, },
- { XFT_SLANT, XftTypeInteger, },
- { XFT_WEIGHT, XftTypeInteger, },
- { XFT_SIZE, XftTypeDouble, },
- { XFT_PIXEL_SIZE, XftTypeDouble, },
- { XFT_ENCODING, XftTypeString, },
- { XFT_SPACING, XftTypeInteger, },
- { XFT_FOUNDRY, XftTypeString, },
- { XFT_CORE, XftTypeBool, },
- { XFT_ANTIALIAS, XftTypeBool, },
- { XFT_XLFD, XftTypeString, },
- { XFT_FILE, XftTypeString, },
- { XFT_INDEX, XftTypeInteger, },
- { XFT_RASTERIZER, XftTypeString, },
- { XFT_OUTLINE, XftTypeBool, },
- { XFT_SCALABLE, XftTypeBool, },
- { XFT_RGBA, XftTypeInteger, },
- { XFT_SCALE, XftTypeDouble, },
- { XFT_RENDER, XftTypeBool, },
- { XFT_MINSPACE, XftTypeBool, },
- { XFT_CHAR_WIDTH, XftTypeInteger },
- { XFT_CHAR_HEIGHT, XftTypeInteger },
- { XFT_MATRIX, XftTypeMatrix },
-};
-
-#define NUM_OBJECT_TYPES (sizeof _XftObjectTypes / sizeof _XftObjectTypes[0])
-
-static const XftObjectType *
-XftNameGetType (const char *object)
-{
- int i;
-
- for (i = 0; i < NUM_OBJECT_TYPES; i++)
- {
- if (!_XftStrCmpIgnoreCase (object, _XftObjectTypes[i].object))
- return &_XftObjectTypes[i];
- }
- return 0;
-}
-
-typedef struct _XftConstant {
- const char *name;
- const char *object;
- int value;
-} XftConstant;
-
-static XftConstant XftConstants[] = {
- { "light", "weight", XFT_WEIGHT_LIGHT, },
- { "medium", "weight", XFT_WEIGHT_MEDIUM, },
- { "demibold", "weight", XFT_WEIGHT_DEMIBOLD, },
- { "bold", "weight", XFT_WEIGHT_BOLD, },
- { "black", "weight", XFT_WEIGHT_BLACK, },
-
- { "roman", "slant", XFT_SLANT_ROMAN, },
- { "italic", "slant", XFT_SLANT_ITALIC, },
- { "oblique", "slant", XFT_SLANT_OBLIQUE, },
-
- { "proportional", "spacing", XFT_PROPORTIONAL, },
- { "mono", "spacing", XFT_MONO, },
- { "charcell", "spacing", XFT_CHARCELL, },
-
- { "rgb", "rgba", XFT_RGBA_RGB, },
- { "bgr", "rgba", XFT_RGBA_BGR, },
- { "vrgb", "rgba", XFT_RGBA_VRGB },
- { "vbgr", "rgba", XFT_RGBA_VBGR },
-};
-
-#define NUM_XFT_CONSTANTS (sizeof XftConstants/sizeof XftConstants[0])
-
-static XftConstant *
-_XftNameConstantLookup (char *string)
-{
- int i;
-
- for (i = 0; i < NUM_XFT_CONSTANTS; i++)
- if (!_XftStrCmpIgnoreCase (string, XftConstants[i].name))
- return &XftConstants[i];
- return 0;
-}
-
-Bool
-XftNameConstant (char *string, int *result)
-{
- XftConstant *c;
-
- if ((c = _XftNameConstantLookup(string)))
- {
- *result = c->value;
- return True;
- }
- return False;
-}
-
-static XftValue
-_XftNameConvert (XftType type, char *string, XftMatrix *m)
-{
- XftValue v;
-
- v.type = type;
- switch (v.type) {
- case XftTypeInteger:
- if (!XftNameConstant (string, &v.u.i))
- v.u.i = atoi (string);
- break;
- case XftTypeString:
- v.u.s = string;
- break;
- case XftTypeBool:
- v.u.b = XftDefaultParseBool (string);
- break;
- case XftTypeDouble:
- v.u.d = strtod (string, 0);
- break;
- case XftTypeMatrix:
- v.u.m = m;
- sscanf (string, "%lg %lg %lg %lg", &m->xx, &m->xy, &m->yx, &m->yy);
- break;
- default:
- break;
- }
- return v;
-}
-
-static const char *
-_XftNameFindNext (const char *cur, const char *delim, char *save, char *last)
-{
- char c;
-
- while ((c = *cur))
- {
- if (c == '\\')
- {
- ++cur;
- if (!(c = *cur))
- break;
- }
- else if (strchr (delim, c))
- break;
- ++cur;
- *save++ = c;
- }
- *save = 0;
- *last = *cur;
- if (*cur)
- cur++;
- return cur;
-}
-
-XftPattern *
-XftNameParse (const char *name)
-{
- char *save;
- XftPattern *pat;
- double d;
- char *e;
- char delim;
- XftValue v;
- XftMatrix m;
- const XftObjectType *t;
- XftConstant *c;
-
- save = malloc (strlen (name) + 1);
- if (!save)
- goto bail0;
- pat = XftPatternCreate ();
- if (!pat)
- goto bail1;
-
- for (;;)
- {
- name = _XftNameFindNext (name, "-,:", save, &delim);
- if (save[0])
- {
- if (!XftPatternAddString (pat, XFT_FAMILY, save))
- goto bail2;
- }
- if (delim != ',')
- break;
- }
- if (delim == '-')
- {
- for (;;)
- {
- name = _XftNameFindNext (name, "-,:", save, &delim);
- d = strtod (save, &e);
- if (e != save)
- {
- if (!XftPatternAddDouble (pat, XFT_SIZE, d))
- goto bail2;
- }
- if (delim != ',')
- break;
- }
- }
- while (delim == ':')
- {
- name = _XftNameFindNext (name, "=_:", save, &delim);
- if (save[0])
- {
- if (delim == '=' || delim == '_')
- {
- t = XftNameGetType (save);
- for (;;)
- {
- name = _XftNameFindNext (name, ":,", save, &delim);
- if (save[0] && t)
- {
- v = _XftNameConvert (t->type, save, &m);
- if (!XftPatternAdd (pat, t->object, v, True))
- goto bail2;
- }
- if (delim != ',')
- break;
- }
- }
- else
- {
- if ((c = _XftNameConstantLookup (save)))
- {
- if (!XftPatternAddInteger (pat, c->object, c->value))
- goto bail2;
- }
- }
- }
- }
-
- free (save);
- return pat;
-
-bail2:
- XftPatternDestroy (pat);
-bail1:
- free (save);
-bail0:
- return 0;
-}
-
-static Bool
-_XftNameUnparseString (const char *string, char *escape, char **destp, int *lenp)
-{
- int len = *lenp;
- char *dest = *destp;
- char c;
-
- while ((c = *string++))
- {
- if (escape && strchr (escape, c))
- {
- if (len-- == 0)
- return False;
- *dest++ = escape[0];
- }
- if (len-- == 0)
- return False;
- *dest++ = c;
- }
- *destp = dest;
- *lenp = len;
- return True;
-}
-
-static Bool
-_XftNameUnparseValue (XftValue v, char *escape, char **destp, int *lenp)
-{
- char temp[1024];
-
- switch (v.type) {
- case XftTypeVoid:
- return True;
- case XftTypeInteger:
- sprintf (temp, "%d", v.u.i);
- return _XftNameUnparseString (temp, 0, destp, lenp);
- case XftTypeDouble:
- sprintf (temp, "%g", v.u.d);
- return _XftNameUnparseString (temp, 0, destp, lenp);
- case XftTypeString:
- return _XftNameUnparseString (v.u.s, escape, destp, lenp);
- case XftTypeBool:
- return _XftNameUnparseString (v.u.b ? "True" : "False", 0, destp, lenp);
- case XftTypeMatrix:
- sprintf (temp, "%g %g %g %g",
- v.u.m->xx, v.u.m->xy, v.u.m->yx, v.u.m->yy);
- return _XftNameUnparseString (temp, 0, destp, lenp);
- }
- return False;
-}
-
-static Bool
-_XftNameUnparseValueList (XftValueList *v, char *escape, char **destp, int *lenp)
-{
- while (v)
- {
- if (!_XftNameUnparseValue (v->value, escape, destp, lenp))
- return False;
- if ((v = v->next))
- if (!_XftNameUnparseString (",", 0, destp, lenp))
- return False;
- }
- return True;
-}
-
-#define XFT_ESCAPE_FIXED "\\-:,"
-#define XFT_ESCAPE_VARIABLE "\\=_:,"
-
-Bool
-XftNameUnparse (XftPattern *pat, char *dest, int len)
-{
- int i;
- XftPatternElt *e;
- const XftObjectType *o;
-
- e = XftPatternFind (pat, XFT_FAMILY, False);
- if (e)
- {
- if (!_XftNameUnparseValueList (e->values, XFT_ESCAPE_FIXED,
- &dest, &len))
- return False;
- }
- e = XftPatternFind (pat, XFT_SIZE, False);
- if (e)
- {
- if (!_XftNameUnparseString ("-", 0, &dest, &len))
- return False;
- if (!_XftNameUnparseValueList (e->values, XFT_ESCAPE_FIXED, &dest, &len))
- return False;
- }
- for (i = 0; i < NUM_OBJECT_TYPES; i++)
- {
- o = &_XftObjectTypes[i];
- if (!strcmp (o->object, XFT_FAMILY) ||
- !strcmp (o->object, XFT_SIZE) ||
- !strcmp (o->object, XFT_FILE))
- continue;
-
- e = XftPatternFind (pat, o->object, False);
- if (e)
- {
- if (!_XftNameUnparseString (":", 0, &dest, &len))
- return False;
- if (!_XftNameUnparseString (o->object, XFT_ESCAPE_VARIABLE,
- &dest, &len))
- return False;
- if (!_XftNameUnparseString ("=", 0, &dest, &len))
- return False;
- if (!_XftNameUnparseValueList (e->values, XFT_ESCAPE_VARIABLE,
- &dest, &len))
- return False;
- }
- }
- if (len == 0)
- return False;
- *dest = '\0';
- return True;
-}
diff --git a/xc/lib/Xft/xftpat.c b/xc/lib/Xft/xftpat.c
deleted file mode 100644
index d93dacae2..000000000
--- a/xc/lib/Xft/xftpat.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftpat.c,v 1.6 2001/03/30 18:50:18 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <string.h>
-#include "xftint.h"
-
-XftPattern *
-XftPatternCreate (void)
-{
- XftPattern *p;
-
- p = (XftPattern *) malloc (sizeof (XftPattern));
- if (!p)
- return 0;
- p->num = 0;
- p->size = 0;
- p->elts = 0;
- return p;
-}
-
-void
-XftValueDestroy (XftValue v)
-{
- if (v.type == XftTypeString)
- free (v.u.s);
- if( v.type == XftTypeMatrix)
- free (v.u.m);
-}
-
-void
-XftValueListDestroy (XftValueList *l)
-{
- XftValueList *next;
- for (; l; l = next)
- {
- if (l->value.type == XftTypeString)
- free (l->value.u.s);
- if (l->value.type == XftTypeMatrix)
- free (l->value.u.m);
- next = l->next;
- free (l);
- }
-}
-
-void
-XftPatternDestroy (XftPattern *p)
-{
- int i;
-
- for (i = 0; i < p->num; i++)
- XftValueListDestroy (p->elts[i].values);
-
- if (p->elts)
- {
- free (p->elts);
- p->elts = 0;
- }
- p->num = p->size = 0;
- free (p);
-}
-
-XftPatternElt *
-XftPatternFind (XftPattern *p, const char *object, Bool insert)
-{
- int i;
- int s;
- XftPatternElt *e;
-
- /* match existing */
- for (i = 0; i < p->num; i++)
- {
- if (!_XftStrCmpIgnoreCase (object, p->elts[i].object))
- return &p->elts[i];
- }
-
- if (!insert)
- return 0;
-
- /* grow array */
- if (i == p->size)
- {
- s = p->size + 16;
- if (p->elts)
- e = (XftPatternElt *) realloc (p->elts, s * sizeof (XftPatternElt));
- else
- e = (XftPatternElt *) malloc (s * sizeof (XftPatternElt));
- if (!e)
- return False;
- p->elts = e;
- while (p->size < s)
- {
- p->elts[p->size].object = 0;
- p->elts[p->size].values = 0;
- p->size++;
- }
- }
-
- /* bump count */
- p->num++;
-
- return &p->elts[i];
-}
-
-Bool
-XftPatternAdd (XftPattern *p, const char *object, XftValue value, Bool append)
-{
- XftPatternElt *e;
- XftValueList *new, **prev;
-
- new = (XftValueList *) malloc (sizeof (XftValueList));
- if (!new)
- goto bail0;
-
- /* dup string */
- if (value.type == XftTypeString)
- {
- value.u.s = _XftSaveString (value.u.s);
- if (!value.u.s)
- goto bail1;
- }
- else if (value.type == XftTypeMatrix)
- {
- value.u.m = _XftSaveMatrix (value.u.m);
- if (!value.u.m)
- goto bail1;
- }
- new->value = value;
- new->next = 0;
-
- e = XftPatternFind (p, object, True);
- if (!e)
- goto bail2;
-
- e->object = object;
- if (append)
- {
- for (prev = &e->values; *prev; prev = &(*prev)->next);
- *prev = new;
- }
- else
- {
- new->next = e->values;
- e->values = new;
- }
-
- return True;
-
-bail2:
- if (value.type == XftTypeString)
- free (value.u.s);
- else if (value.type == XftTypeMatrix)
- free (value.u.m);
-bail1:
- free (new);
-bail0:
- return False;
-}
-
-Bool
-XftPatternDel (XftPattern *p, const char *object)
-{
- XftPatternElt *e;
- int i;
-
- e = XftPatternFind (p, object, False);
- if (!e)
- return False;
-
- i = e - p->elts;
-
- /* destroy value */
- XftValueListDestroy (e->values);
-
- /* shuffle existing ones down */
- memmove (e, e+1, (p->elts + p->num - (e + 1)) * sizeof (XftPatternElt));
- p->num--;
- p->elts[p->num].object = 0;
- p->elts[p->num].values = 0;
- return True;
-}
-
-Bool
-XftPatternAddInteger (XftPattern *p, const char *object, int i)
-{
- XftValue v;
-
- v.type = XftTypeInteger;
- v.u.i = i;
- return XftPatternAdd (p, object, v, True);
-}
-
-Bool
-XftPatternAddDouble (XftPattern *p, const char *object, double d)
-{
- XftValue v;
-
- v.type = XftTypeDouble;
- v.u.d = d;
- return XftPatternAdd (p, object, v, True);
-}
-
-
-Bool
-XftPatternAddString (XftPattern *p, const char *object, const char *s)
-{
- XftValue v;
-
- v.type = XftTypeString;
- v.u.s = (char *) s;
- return XftPatternAdd (p, object, v, True);
-}
-
-Bool
-XftPatternAddMatrix (XftPattern *p, const char *object, const XftMatrix *s)
-{
- XftValue v;
-
- v.type = XftTypeMatrix;
- v.u.m = (XftMatrix *) s;
- return XftPatternAdd (p, object, v, True);
-}
-
-
-Bool
-XftPatternAddBool (XftPattern *p, const char *object, Bool b)
-{
- XftValue v;
-
- v.type = XftTypeBool;
- v.u.b = b;
- return XftPatternAdd (p, object, v, True);
-}
-
-XftResult
-XftPatternGet (XftPattern *p, const char *object, int id, XftValue *v)
-{
- XftPatternElt *e;
- XftValueList *l;
-
- e = XftPatternFind (p, object, False);
- if (!e)
- return XftResultNoMatch;
- for (l = e->values; l; l = l->next)
- {
- if (!id)
- {
- *v = l->value;
- return XftResultMatch;
- }
- id--;
- }
- return XftResultNoId;
-}
-
-XftResult
-XftPatternGetInteger (XftPattern *p, const char *object, int id, int *i)
-{
- XftValue v;
- XftResult r;
-
- r = XftPatternGet (p, object, id, &v);
- if (r != XftResultMatch)
- return r;
- switch (v.type) {
- case XftTypeDouble:
- *i = (int) v.u.d;
- break;
- case XftTypeInteger:
- *i = v.u.i;
- break;
- default:
- return XftResultTypeMismatch;
- }
- return XftResultMatch;
-}
-
-XftResult
-XftPatternGetDouble (XftPattern *p, const char *object, int id, double *d)
-{
- XftValue v;
- XftResult r;
-
- r = XftPatternGet (p, object, id, &v);
- if (r != XftResultMatch)
- return r;
- switch (v.type) {
- case XftTypeDouble:
- *d = v.u.d;
- break;
- case XftTypeInteger:
- *d = (double) v.u.i;
- break;
- default:
- return XftResultTypeMismatch;
- }
- return XftResultMatch;
-}
-
-XftResult
-XftPatternGetString (XftPattern *p, const char *object, int id, char **s)
-{
- XftValue v;
- XftResult r;
-
- r = XftPatternGet (p, object, id, &v);
- if (r != XftResultMatch)
- return r;
- if (v.type != XftTypeString)
- return XftResultTypeMismatch;
- *s = v.u.s;
- return XftResultMatch;
-}
-
-XftResult
-XftPatternGetMatrix (XftPattern *p, const char *object, int id, XftMatrix **m)
-{
- XftValue v;
- XftResult r;
-
- r = XftPatternGet (p, object, id, &v);
- if (r != XftResultMatch)
- return r;
- if (v.type != XftTypeMatrix)
- return XftResultTypeMismatch;
- *m = v.u.m;
- return XftResultMatch;
-}
-
-
-XftResult
-XftPatternGetBool (XftPattern *p, const char *object, int id, Bool *b)
-{
- XftValue v;
- XftResult r;
-
- r = XftPatternGet (p, object, id, &v);
- if (r != XftResultMatch)
- return r;
- if (v.type != XftTypeBool)
- return XftResultTypeMismatch;
- *b = v.u.b;
- return XftResultMatch;
-}
-
-XftPattern *
-XftPatternDuplicate (XftPattern *orig)
-{
- XftPattern *new;
- int i;
- XftValueList *l;
-
- new = XftPatternCreate ();
- if (!new)
- goto bail0;
-
- for (i = 0; i < orig->num; i++)
- {
- for (l = orig->elts[i].values; l; l = l->next)
- if (!XftPatternAdd (new, orig->elts[i].object, l->value, True))
- goto bail1;
- }
-
- return new;
-
-bail1:
- XftPatternDestroy (new);
-bail0:
- return 0;
-}
-
-XftPattern *
-XftPatternVaBuild (XftPattern *orig, va_list va)
-{
- XftPattern *ret;
-
- _XftPatternVapBuild (ret, orig, va);
- return ret;
-}
-
-XftPattern *
-XftPatternBuild (XftPattern *orig, ...)
-{
- va_list va;
-
- va_start (va, orig);
- _XftPatternVapBuild (orig, orig, va);
- va_end (va);
- return orig;
-}
diff --git a/xc/lib/Xft/xftrender.c b/xc/lib/Xft/xftrender.c
deleted file mode 100644
index 02dd97b95..000000000
--- a/xc/lib/Xft/xftrender.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftrender.c,v 1.8 2001/07/13 18:16:10 keithp Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include "xftint.h"
-
-void
-XftRenderString8 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar8 *string, int len)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar8 *s;
- int l;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l--)
- XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing);
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
- XRenderCompositeString8 (dpy, PictOpOver, src, dst,
- font->format, font->glyphset,
- srcx, srcy, x, y, (char *) string, len);
-}
-
-void
-XftRenderString16 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar16 *string, int len)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar16 *s;
- int l;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l--)
- XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing);
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
- XRenderCompositeString16 (dpy, PictOpOver, src, dst,
- font->format, font->glyphset,
- srcx, srcy, x, y, string, len);
-}
-
-void
-XftRenderString32 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar32 *string, int len)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar32 *s;
- int l;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l--)
- XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing);
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
- XRenderCompositeString32 (dpy, PictOpOver, src, dst,
- font->format, font->glyphset,
- srcx, srcy, x, y, string, len);
-}
-
-void
-XftRenderStringUtf8 (Display *dpy, Picture src,
- XftFontStruct *font, Picture dst,
- int srcx, int srcy,
- int x, int y,
- XftChar8 *string, int len)
-{
- XftChar8 *s;
- XftChar32 c;
- XftChar32 lbuf[4096];
- XftChar32 *d;
- XftChar8 *dst8;
- XftChar16 *dst16;
- XftChar32 *dst32;
- int rlen, clen;
- int width = 1;
- int n;
-
- /* compute needed width */
- if (!XftUtf8Len (string, len, &n, &width))
- return;
-
- d = lbuf;
- if (n * width > sizeof (lbuf))
- {
- d = (XftChar32 *) malloc (n * width);
- if (!d)
- return;
- }
-
- switch (width) {
- case 4:
- s = string;
- rlen = len;
- dst32 = d;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (s, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- return;
- *dst32++ = c;
- s += clen;
- rlen -= clen;
- }
- dst32 = d;
- XftRenderString32 (dpy, src, font, dst, srcx, srcy, x, y,
- dst32, n);
- break;
- case 2:
- s = string;
- rlen = len;
- dst16 = (XftChar16 *) d;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (s, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- return;
- *dst16++ = c;
- s += clen;
- rlen -= clen;
- }
- dst16 = (XftChar16 *) d;
- XftRenderString16 (dpy, src, font, dst, srcx, srcy, x, y,
- dst16, n);
- break;
- case 1:
- s = string;
- rlen = len;
- dst8 = (XftChar8 *) d;
- while (rlen)
- {
- clen = XftUtf8ToUcs4 (s, &c, rlen);
- if (clen <= 0) /* malformed UTF8 string */
- return;
- *dst8++ = c;
- s += clen;
- rlen -= clen;
- }
- dst8 = (XftChar8 *) d;
- XftRenderString8 (dpy, src, font, dst, srcx, srcy, x, y,
- dst8, n);
- break;
- }
- if (d != lbuf)
- free (d);
-}
-
-void
-XftRenderExtents8 (Display *dpy,
- XftFontStruct *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar8 *s, c;
- int l;
- XGlyphInfo *gi;
- int x, y;
- int left, right, top, bottom;
- int overall_left, overall_right;
- int overall_top, overall_bottom;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l--)
- XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing);
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
-
- gi = 0;
- while (len)
- {
- c = *string++;
- len--;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (gi)
- break;
- }
- if (len == 0 && !gi)
- {
- extents->width = 0;
- extents->height = 0;
- extents->x = 0;
- extents->y = 0;
- extents->yOff = 0;
- extents->xOff = 0;
- return;
- }
- x = 0;
- y = 0;
- overall_left = x - gi->x;
- overall_top = y - gi->y;
- overall_right = overall_left + (int) gi->width;
- overall_bottom = overall_top + (int) gi->height;
- x += gi->xOff;
- y += gi->yOff;
- while (len--)
- {
- c = *string++;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (!gi)
- continue;
- left = x - gi->x;
- top = y - gi->y;
- right = left + (int) gi->width;
- bottom = top + (int) gi->height;
- if (left < overall_left)
- overall_left = left;
- if (top < overall_top)
- overall_top = top;
- if (right > overall_right)
- overall_right = right;
- if (bottom > overall_bottom)
- overall_bottom = bottom;
- x += gi->xOff;
- y += gi->yOff;
- }
- extents->x = -overall_left;
- extents->y = -overall_top;
- extents->width = overall_right - overall_left;
- extents->height = overall_bottom - overall_top;
- extents->xOff = x;
- extents->yOff = y;
-}
-
-void
-XftRenderExtents16 (Display *dpy,
- XftFontStruct *font,
- XftChar16 *string,
- int len,
- XGlyphInfo *extents)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar16 *s, c;
- int l;
- XGlyphInfo *gi;
- int x, y;
- int left, right, top, bottom;
- int overall_left, overall_right;
- int overall_top, overall_bottom;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l--)
- XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing);
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
-
- gi = 0;
- while (len)
- {
- c = *string++;
- len--;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (gi)
- break;
- }
- if (len == 0 && !gi)
- {
- extents->width = 0;
- extents->height = 0;
- extents->x = 0;
- extents->y = 0;
- extents->yOff = 0;
- extents->xOff = 0;
- return;
- }
- x = 0;
- y = 0;
- overall_left = x - gi->x;
- overall_top = y - gi->y;
- overall_right = overall_left + (int) gi->width;
- overall_bottom = overall_top + (int) gi->height;
- x += gi->xOff;
- y += gi->yOff;
- while (len--)
- {
- c = *string++;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (!gi)
- continue;
- left = x - gi->x;
- top = y - gi->y;
- right = left + (int) gi->width;
- bottom = top + (int) gi->height;
- if (left < overall_left)
- overall_left = left;
- if (top < overall_top)
- overall_top = top;
- if (right > overall_right)
- overall_right = right;
- if (bottom > overall_bottom)
- overall_bottom = bottom;
- x += gi->xOff;
- y += gi->yOff;
- }
- extents->x = -overall_left;
- extents->y = -overall_top;
- extents->width = overall_right - overall_left;
- extents->height = overall_bottom - overall_top;
- extents->xOff = x;
- extents->yOff = y;
-}
-
-void
-XftRenderExtents32 (Display *dpy,
- XftFontStruct *font,
- XftChar32 *string,
- int len,
- XGlyphInfo *extents)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar32 *s, c;
- int l;
- XGlyphInfo *gi;
- int x, y;
- int left, right, top, bottom;
- int overall_left, overall_right;
- int overall_top, overall_bottom;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l--)
- XftGlyphCheck (dpy, font, (XftChar32) *s++, missing, &nmissing);
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
-
- gi = 0;
- while (len)
- {
- c = *string++;
- len--;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (gi)
- break;
- }
- if (len == 0 && !gi)
- {
- extents->width = 0;
- extents->height = 0;
- extents->x = 0;
- extents->y = 0;
- extents->yOff = 0;
- extents->xOff = 0;
- return;
- }
- x = 0;
- y = 0;
- overall_left = x - gi->x;
- overall_top = y - gi->y;
- overall_right = overall_left + (int) gi->width;
- overall_bottom = overall_top + (int) gi->height;
- x += gi->xOff;
- y += gi->yOff;
- while (len--)
- {
- c = *string++;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (!gi)
- continue;
- left = x - gi->x;
- top = y - gi->y;
- right = left + (int) gi->width;
- bottom = top + (int) gi->height;
- if (left < overall_left)
- overall_left = left;
- if (top < overall_top)
- overall_top = top;
- if (right > overall_right)
- overall_right = right;
- if (bottom > overall_bottom)
- overall_bottom = bottom;
- x += gi->xOff;
- y += gi->yOff;
- }
- extents->x = -overall_left;
- extents->y = -overall_top;
- extents->width = overall_right - overall_left;
- extents->height = overall_bottom - overall_top;
- extents->xOff = x;
- extents->yOff = y;
-}
-
-void
-XftRenderExtentsUtf8 (Display *dpy,
- XftFontStruct *font,
- XftChar8 *string,
- int len,
- XGlyphInfo *extents)
-{
- XftChar32 missing[XFT_NMISSING];
- int nmissing;
- XftChar8 *s;
- XftChar32 c;
- int l, clen;
- XGlyphInfo *gi;
- int x, y;
- int left, right, top, bottom;
- int overall_left, overall_right;
- int overall_top, overall_bottom;
-
- s = string;
- l = len;
- nmissing = 0;
- while (l)
- {
- clen = XftUtf8ToUcs4 (s, &c, l);
- if (clen < 0)
- break;
- XftGlyphCheck (dpy, font, (XftChar32) c, missing, &nmissing);
- s += clen;
- l -= clen;
- }
- if (nmissing)
- XftGlyphLoad (dpy, font, missing, nmissing);
-
- gi = 0;
- while (len)
- {
- clen = XftUtf8ToUcs4 (string, &c, len);
- if (clen < 0)
- {
- len = 0;
- break;
- }
- len -= clen;
- string += clen;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (gi)
- break;
- }
- if (len == 0 && !gi)
- {
- extents->width = 0;
- extents->height = 0;
- extents->x = 0;
- extents->y = 0;
- extents->yOff = 0;
- extents->xOff = 0;
- return;
- }
- x = 0;
- y = 0;
- overall_left = x - gi->x;
- overall_top = y - gi->y;
- overall_right = overall_left + (int) gi->width;
- overall_bottom = overall_top + (int) gi->height;
- x += gi->xOff;
- y += gi->yOff;
- while (len)
- {
- clen = XftUtf8ToUcs4 (string, &c, len);
- if (clen < 0)
- break;
- len -= clen;
- string += clen;
- gi = c < font->nrealized ? font->realized[c] : 0;
- if (!gi)
- continue;
- left = x - gi->x;
- top = y - gi->y;
- right = left + (int) gi->width;
- bottom = top + (int) gi->height;
- if (left < overall_left)
- overall_left = left;
- if (top < overall_top)
- overall_top = top;
- if (right > overall_right)
- overall_right = right;
- if (bottom > overall_bottom)
- overall_bottom = bottom;
- x += gi->xOff;
- y += gi->yOff;
- }
- extents->x = -overall_left;
- extents->y = -overall_top;
- extents->width = overall_right - overall_left;
- extents->height = overall_bottom - overall_top;
- extents->xOff = x;
- extents->yOff = y;
-}
diff --git a/xc/lib/Xft/xftstr.c b/xc/lib/Xft/xftstr.c
deleted file mode 100644
index 8ab743b6f..000000000
--- a/xc/lib/Xft/xftstr.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftstr.c,v 1.6 2001/04/01 14:00:01 tsi Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include "xftint.h"
-
-char *
-_XftSaveString (const char *s)
-{
- char *r;
-
- if (!s)
- return 0;
- r = (char *) malloc (strlen (s) + 1);
- if (!r)
- return 0;
- strcpy (r, s);
- return r;
-}
-
-const char *
-_XftGetInt(const char *ptr, int *val)
-{
- if (*ptr == '*') {
- *val = -1;
- ptr++;
- } else
- for (*val = 0; *ptr >= '0' && *ptr <= '9';)
- *val = *val * 10 + *ptr++ - '0';
- if (*ptr == '-')
- return ptr;
- return (char *) 0;
-}
-
-char *
-_XftSplitStr (const char *field, char *save)
-{
- char *s = save;
- char c;
-
- while (*field)
- {
- if (*field == '-')
- break;
- c = *field++;
- *save++ = c;
- }
- *save = 0;
- return s;
-}
-
-char *
-_XftDownStr (const char *field, char *save)
-{
- char *s = save;
- char c;
-
- while (*field)
- {
- c = *field++;
- *save++ = c;
- }
- *save = 0;
- return s;
-}
-
-const char *
-_XftSplitField (const char *field, char *save)
-{
- char c;
-
- while (*field)
- {
- if (*field == '-' || *field == '=')
- break;
- c = *field++;
- *save++ = c;
- }
- *save = 0;
- return field;
-}
-
-const char *
-_XftSplitValue (const char *field, char *save)
-{
- char c;
-
- while (*field)
- {
- if (*field == '-' || *field == ',')
- break;
- c = *field++;
- *save++ = c;
- }
- *save = 0;
- if (*field)
- field++;
- return field;
-}
-
-int
-_XftMatchSymbolic (XftSymbolic *s, int n, const char *name, int def)
-{
- while (n--)
- {
- if (!_XftStrCmpIgnoreCase (s->name, name))
- return s->value;
- s++;
- }
- return def;
-}
-
-int
-_XftStrCmpIgnoreCase (const char *s1, const char *s2)
-{
- char c1, c2;
-
- for (;;)
- {
- c1 = *s1++;
- c2 = *s2++;
- if (!c1 || !c2)
- break;
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
- if (c1 != c2)
- break;
- }
- return (int) c2 - (int) c1;
-}
-
-int
-XftUtf8ToUcs4 (XftChar8 *src_orig,
- XftChar32 *dst,
- int len)
-{
- XftChar8 *src = src_orig;
- XftChar8 s;
- int extra;
- XftChar32 result;
-
- if (len == 0)
- return 0;
-
- s = *src++;
- len--;
-
- if (!(s & 0x80))
- {
- result = s;
- extra = 0;
- }
- else if (!(s & 0x40))
- {
- return -1;
- }
- else if (!(s & 0x20))
- {
- result = s & 0x1f;
- extra = 1;
- }
- else if (!(s & 0x10))
- {
- result = s & 0xf;
- extra = 2;
- }
- else if (!(s & 0x08))
- {
- result = s & 0x07;
- extra = 3;
- }
- else if (!(s & 0x04))
- {
- result = s & 0x03;
- extra = 4;
- }
- else if ( ! (s & 0x02))
- {
- result = s & 0x01;
- extra = 5;
- }
- else
- {
- return -1;
- }
- if (extra > len)
- return -1;
-
- while (extra--)
- {
- result <<= 6;
- s = *src++;
-
- if ((s & 0xc0) != 0x80)
- return -1;
-
- result |= s & 0x3f;
- }
- *dst = result;
- return src - src_orig;
-}
-
-Bool
-XftUtf8Len (XftChar8 *string,
- int len,
- int *nchar,
- int *wchar)
-{
- int n;
- int clen;
- int width = 1;
- XftChar32 c;
-
- n = 0;
- while (len)
- {
- clen = XftUtf8ToUcs4 (string, &c, len);
- if (clen <= 0) /* malformed UTF8 string */
- return False;
- if (c >= 0x10000)
- width = 4;
- else if (c >= 0x100)
- {
- if (width == 1)
- width = 2;
- }
- string += clen;
- len -= clen;
- n++;
- }
- *nchar = n;
- *wchar = width;
- return True;
-}
diff --git a/xc/lib/Xft/xftxlfd.c b/xc/lib/Xft/xftxlfd.c
deleted file mode 100644
index cd7b7b7fb..000000000
--- a/xc/lib/Xft/xftxlfd.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * $XFree86: xc/lib/Xft/xftxlfd.c,v 1.7 2000/12/22 05:05:16 tsi Exp $
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * 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 Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH 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 <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include "xftint.h"
-
-static XftSymbolic XftXlfdWeights[] = {
- { "light", XFT_WEIGHT_LIGHT },
- { "medium", XFT_WEIGHT_MEDIUM },
- { "regular", XFT_WEIGHT_MEDIUM },
- { "demibold", XFT_WEIGHT_DEMIBOLD },
- { "bold", XFT_WEIGHT_BOLD },
- { "black", XFT_WEIGHT_BLACK },
-};
-
-#define NUM_XLFD_WEIGHTS (sizeof XftXlfdWeights/sizeof XftXlfdWeights[0])
-
-static XftSymbolic XftXlfdSlants[] = {
- { "r", XFT_SLANT_ROMAN },
- { "i", XFT_SLANT_ITALIC },
- { "o", XFT_SLANT_OBLIQUE },
-};
-
-#define NUM_XLFD_SLANTS (sizeof XftXlfdSlants/sizeof XftXlfdSlants[0])
-
-XftPattern *
-XftXlfdParse (const char *xlfd_orig, Bool ignore_scalable, Bool complete)
-{
- XftPattern *pat;
- const char *xlfd = xlfd_orig;
- const char *foundry;
- const char *family;
- const char *weight_name;
- const char *slant;
- const char *registry;
- const char *encoding;
- char *save;
- char style[128];
- int pixel;
- int point;
- int resx;
- int resy;
- int slant_value, weight_value;
- double dpixel;
-
- if (*xlfd != '-')
- return 0;
- if (!(xlfd = strchr (foundry = ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (family = ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (weight_name = ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (slant = ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (/* setwidth_name = */ ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (/* add_style_name = */ ++xlfd, '-'))) return 0;
- if (!(xlfd = _XftGetInt (++xlfd, &pixel))) return 0;
- if (!(xlfd = _XftGetInt (++xlfd, &point))) return 0;
- if (!(xlfd = _XftGetInt (++xlfd, &resx))) return 0;
- if (!(xlfd = _XftGetInt (++xlfd, &resy))) return 0;
- if (!(xlfd = strchr (/* spacing = */ ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (/* average_width = */ ++xlfd, '-'))) return 0;
- if (!(xlfd = strchr (registry = ++xlfd, '-'))) return 0;
- /* make sure no fields follow this one */
- if ((xlfd = strchr (encoding = ++xlfd, '-'))) return 0;
-
- if (ignore_scalable && !pixel)
- return 0;
-
- pat = XftPatternCreate ();
- if (!pat)
- return 0;
-
- save = (char *) malloc (strlen (foundry) + 1);
-
- if (!save)
- return 0;
-
- if (!XftPatternAddString (pat, XFT_XLFD, xlfd_orig)) goto bail;
-
- _XftSplitStr (foundry, save);
- if (save[0] && strcmp (save, "*") != 0)
- if (!XftPatternAddString (pat, XFT_FOUNDRY, save)) goto bail;
-
- _XftSplitStr (family, save);
- if (save[0] && strcmp (save, "*") != 0)
- if (!XftPatternAddString (pat, XFT_FAMILY, save)) goto bail;
-
- weight_value = _XftMatchSymbolic (XftXlfdWeights, NUM_XLFD_WEIGHTS,
- _XftSplitStr (weight_name, save),
- XFT_WEIGHT_MEDIUM);
- if (!XftPatternAddInteger (pat, XFT_WEIGHT, weight_value))
- goto bail;
-
- slant_value = _XftMatchSymbolic (XftXlfdSlants, NUM_XLFD_SLANTS,
- _XftSplitStr (slant, save),
- XFT_SLANT_ROMAN);
- if (!XftPatternAddInteger (pat, XFT_SLANT, slant_value))
- goto bail;
-
- dpixel = (double) pixel;
-
- if (complete)
- {
- /*
- * Build a style name
- */
- style[0] = '\0';
- switch (weight_value) {
- case XFT_WEIGHT_LIGHT: strcat (style, "light"); break;
- case XFT_WEIGHT_DEMIBOLD: strcat (style, "demibold"); break;
- case XFT_WEIGHT_BOLD: strcat (style, "bold"); break;
- case XFT_WEIGHT_BLACK: strcat (style, "black"); break;
- }
- if (slant_value != XFT_SLANT_ROMAN) {
- if (style[0])
- strcat (style, " ");
- switch (slant_value) {
- case XFT_SLANT_ITALIC: strcat (style, "italic"); break;
- case XFT_SLANT_OBLIQUE: strcat (style, "oblique"); break;
- }
- }
- if (!style[0])
- strcat (style, "Regular");
-
- if (!XftPatternAddString (pat, XFT_STYLE, style))
- goto bail;
- if (!XftPatternAddBool (pat, XFT_SCALABLE, pixel == 0)) goto bail;
- if (!XftPatternAddBool (pat, XFT_CORE, True)) goto bail;
- if (!XftPatternAddBool (pat, XFT_ANTIALIAS, False)) goto bail;
- }
- else
- {
- if (point > 0)
- {
- if (!XftPatternAddDouble (pat, XFT_SIZE, ((double) point) / 10.0)) goto bail;
- if (pixel <= 0 && resy > 0)
- {
- dpixel = (double) point * (double) resy / 720.0;
- }
- }
- }
-
- if (dpixel > 0)
- if (!XftPatternAddDouble (pat, XFT_PIXEL_SIZE, dpixel)) goto bail;
-
- _XftDownStr (registry, save);
- if (registry[0] && !strchr (registry, '*'))
- if (!XftPatternAddString (pat, XFT_ENCODING, save)) goto bail;
-
- free (save);
- return pat;
-
-bail:
- free (save);
- XftPatternDestroy (pat);
- return 0;
-}
-
-Bool
-XftCoreAddFonts (XftFontSet *set, Display *dpy, Bool ignore_scalable)
-{
- char **xlfds;
- int num;
- int i;
- XftPattern *font;
- Bool ret;
-
- xlfds = XListFonts (dpy,
- "-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
- 10000, &num);
- if (!xlfds)
- return False;
- ret = True;
- for (i = 0; ret && i < num; i++)
- {
- font = XftXlfdParse (xlfds[i], ignore_scalable, True);
- if (font)
- {
- if (!XftFontSetAdd (set, font))
- {
- XftPatternDestroy (font);
- ret = False;
- }
- }
- }
- XFreeFontNames (xlfds);
- return ret;
-}
-
-typedef struct _XftCoreFont {
- struct _XftCoreFont *next;
- int ref;
-
- XFontStruct *font;
- Display *display;
- char *xlfd;
-} XftCoreFont;
-
-static XftCoreFont *_XftCoreFonts;
-
-XFontStruct*
-XftCoreOpen (Display *dpy, XftPattern *pattern)
-{
- XftCoreFont *cf;
- char *xlfd;
- char *xlfd_pixel = 0;
- char *i, *o;
- int d;
- Bool scalable;
- double pixel_size;
- int pixel_int;
- XFontStruct *ret;
-
-#if 0
- printf ("Core ");
- XftPatternPrint (pattern);
-#endif
- if (XftPatternGetString (pattern, XFT_XLFD, 0, &xlfd) != XftResultMatch)
- return 0;
- if (XftPatternGetBool (pattern, XFT_SCALABLE, 0, &scalable) != XftResultMatch)
- return 0;
- if (scalable)
- {
- if (XftPatternGetDouble (pattern, XFT_PIXEL_SIZE, 0, &pixel_size) != XftResultMatch)
- return 0;
- pixel_int = (int) (pixel_size + 0.5);
- if (pixel_int)
- {
- xlfd_pixel = (char *) malloc (strlen (xlfd) + 32);
- i = xlfd;
- o = xlfd_pixel;
- d = 0;
- while (d != 7 && *i)
- {
- if ((*o++ = *i++) == '-')
- d++;
- }
- if (*i)
- {
- sprintf (o, "%d", pixel_int);
- o += strlen (o);
- while (*i != '-')
- ++i;
- }
- while ((*o++ = *i++));
-#if 0
- printf ("original %s sized %s\n", xlfd, xlfd_pixel);
-#endif
- xlfd = xlfd_pixel;
- }
- }
- for (cf = _XftCoreFonts; cf; cf = cf->next)
- {
- if (cf->display == dpy &&
- !_XftStrCmpIgnoreCase (cf->xlfd, xlfd))
- {
- cf->ref++;
- if (_XftFontDebug () & XFT_DBG_REF)
- {
- printf ("Xlfd \"%s\" matches existing font (%d)\n",
- xlfd, cf->ref);
- }
- break;
- }
- }
- if (!cf)
- {
- ret = XLoadQueryFont (dpy, xlfd);
- if (!ret)
- return 0;
-
- cf = (XftCoreFont *) malloc (sizeof (XftCoreFont) +
- strlen (xlfd) + 1);
- if (!cf)
- {
- XFreeFont (dpy, ret);
- return 0;
- }
-
- if (_XftFontDebug () & XFT_DBG_REF)
- printf ("Xlfd \"%s\" matches new font\n", xlfd);
-
- cf->next = _XftCoreFonts;
- _XftCoreFonts = cf;
- cf->ref = 1;
-
- cf->font = ret;
- cf->xlfd = (char *) (cf + 1);
- strcpy (cf->xlfd, xlfd);
- }
- if (xlfd_pixel)
- free (xlfd_pixel);
- return cf->font;
-}
-
-void
-XftCoreClose (Display *dpy, XFontStruct *font)
-{
- XftCoreFont *cf, **prev;
-
- for (prev = &_XftCoreFonts; (cf = *prev); prev = &cf->next)
- {
- if (cf->display == dpy && cf->font == font)
- {
- if (--cf->ref == 0)
- {
- XFreeFont (dpy, cf->font);
- *prev = cf->next;
- free (cf);
- }
- break;
- }
- }
-}
diff --git a/xc/lib/Xi/Imakefile b/xc/lib/Xi/Imakefile
deleted file mode 100644
index 9a8b87332..000000000
--- a/xc/lib/Xi/Imakefile
+++ /dev/null
@@ -1,103 +0,0 @@
-XCOMM $XConsortium: Imakefile,v 1.17 94/03/27 15:54:53 rws Exp $
-XCOMM $XFree86: xc/lib/Xi/Imakefile,v 1.3 1998/12/20 22:18:56 dawes Exp $
-#define DoNormalLib NormalLibXi
-#define DoSharedLib SharedLibXi
-#define DoExtraLib SharedLibXi
-#define DoDebugLib DebugLibXi
-#define DoProfileLib ProfileLibXi
-#define LibName Xi
-#define SoRev SOXINPUTREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXiReqs
-REQUIREDLIBS = SharedXiReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
-INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
-SRCS = XAllowDv.c \
- XChgDCtl.c \
- XChgFCtl.c \
- XChgKbd.c \
- XChgKMap.c \
- XChgPnt.c \
- XChgProp.c \
- XCloseDev.c \
- XDevBell.c \
- XExtToWire.c \
- XGetBMap.c \
- XGetDCtl.c \
- XGetFCtl.c \
- XGetKMap.c \
- XGetMMap.c \
- XGetProp.c \
- XGetVers.c \
- XGMotion.c \
- XGrabDev.c \
- XGrDvBut.c \
- XGrDvKey.c \
- XGtFocus.c \
- XGtSelect.c \
- XListDev.c \
- XOpenDev.c \
- XQueryDv.c \
- XSelect.c \
- XSetBMap.c \
- XSetDVal.c \
- XSetMMap.c \
- XSetMode.c \
- XSndExEv.c \
- XStFocus.c \
- XUngrDev.c \
- XUngrDvB.c \
- XUngrDvK.c \
- XExtInt.c
-OBJS = XAllowDv.o \
- XChgDCtl.o \
- XChgFCtl.o \
- XChgKbd.o \
- XChgKMap.o \
- XChgPnt.o \
- XChgProp.o \
- XCloseDev.o \
- XDevBell.o \
- XExtToWire.o \
- XGetBMap.o \
- XGetDCtl.o \
- XGetFCtl.o \
- XGetKMap.o \
- XGetMMap.o \
- XGetProp.o \
- XGetVers.o \
- XGMotion.o \
- XGrabDev.o \
- XGrDvBut.o \
- XGrDvKey.o \
- XGtFocus.o \
- XGtSelect.o \
- XListDev.o \
- XOpenDev.o \
- XQueryDv.o \
- XSelect.o \
- XSetBMap.o \
- XSetDVal.o \
- XSetMMap.o \
- XSetMode.o \
- XSndExEv.o \
- XStFocus.o \
- XUngrDev.o \
- XUngrDvB.o \
- XUngrDvK.o \
- XExtInt.o
-
- LINTLIBS = $(LINTXLIB) $(LINTXEXT)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xi/XAllowDv.c b/xc/lib/Xi/XAllowDv.c
deleted file mode 100644
index 35aebc859..000000000
--- a/xc/lib/Xi/XAllowDv.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $TOG: XAllowDv.c /main/6 1998/02/06 15:01: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/lib/Xi/XAllowDv.c,v 3.1 1998/10/03 09:06:04 dawes Exp $ */
-
-/***********************************************************************
- *
- * XAllowDeviceEvents - Thaw a frozen extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XAllowDeviceEvents (dpy, dev, event_mode, time)
- register Display *dpy;
- XDevice *dev;
- int event_mode;
- Time time;
- {
- xAllowDeviceEventsReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(AllowDeviceEvents,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_AllowDeviceEvents;
- req->deviceid = dev->device_id;
- req->mode = event_mode;
- req->time = time;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XChgDCtl.c b/xc/lib/Xi/XChgDCtl.c
deleted file mode 100644
index ba56e68bb..000000000
--- a/xc/lib/Xi/XChgDCtl.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $TOG: XChgDCtl.c /main/5 1998/02/06 15:02: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/lib/Xi/XChgDCtl.c,v 3.1 1998/10/03 09:06:04 dawes Exp $ */
-
-/***********************************************************************
- *
- * XChangeDeviceControl - Change the control attributes of an extension
- * input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XChangeDeviceControl (dpy, dev, control, d)
- register Display *dpy;
- XDevice *dev;
- int control;
- XDeviceControl *d;
- {
- int length;
- xChangeDeviceControlReq *req;
- xChangeDeviceControlReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1)
- return (NoSuchExtension);
-
- GetReq(ChangeDeviceControl,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ChangeDeviceControl;
- req->deviceid = dev->device_id;
- req->control = control;
-
- switch (control)
- {
- case DEVICE_RESOLUTION:
- {
- XDeviceResolutionControl *R;
- xDeviceResolutionCtl r;
-
- R = (XDeviceResolutionControl *) d;
- r.control = DEVICE_RESOLUTION;
- r.length = sizeof (xDeviceResolutionCtl) +
- R->num_valuators * sizeof(int);
- r.first_valuator = R->first_valuator;
- r.num_valuators = R->num_valuators;
- req->length += ((unsigned)(r.length + 3) >> 2);
- length = sizeof (xDeviceResolutionCtl);
- Data (dpy, (char *) &r, length);
- length = r.num_valuators * sizeof(int);
- Data (dpy, (char *) R->resolutions, length);
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (NoSuchExtension);
- }
- else
- return (rep.status);
- }
- default:
- {
- xDeviceCtl u;
-
- u.control = d->control;
- u.length = d->length - sizeof (int);
- length = ((unsigned)(u.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &u, length);
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XChgFCtl.c b/xc/lib/Xi/XChgFCtl.c
deleted file mode 100644
index d81e3ecb3..000000000
--- a/xc/lib/Xi/XChgFCtl.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* $TOG: XChgFCtl.c /main/8 1998/02/06 15:02: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/lib/Xi/XChgFCtl.c,v 3.1 1998/10/03 09:06:05 dawes Exp $ */
-
-/***********************************************************************
- *
- * XChangeFeedbackControl - Change the control attributes of feedbacks on
- * an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XChangeFeedbackControl (dpy, dev, mask, f)
- register Display *dpy;
- XDevice *dev;
- unsigned long mask;
- XFeedbackControl *f;
- {
- int length;
- xChangeFeedbackControlReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(ChangeFeedbackControl,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ChangeFeedbackControl;
- req->deviceid = dev->device_id;
- req->mask = mask;
- req->feedbackid = f->class;
-
- if (f->class == KbdFeedbackClass)
- {
- XKbdFeedbackControl *K;
- xKbdFeedbackCtl k;
-
- K = (XKbdFeedbackControl *) f;
- k.class = KbdFeedbackClass;
- k.length = sizeof (xKbdFeedbackCtl);
- k.id = K->id;
- k.click = K->click;
- k.percent = K->percent;
- k.pitch = K->pitch;
- k.duration = K->duration;
- k.led_mask = K->led_mask;
- k.led_values = K->led_value;
- k.key = K->key;
- k.auto_repeat_mode = K->auto_repeat_mode;
- length = ((unsigned)(k.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &k, length);
- }
- else if (f->class == PtrFeedbackClass)
- {
- XPtrFeedbackControl *P;
- xPtrFeedbackCtl p;
-
- P = (XPtrFeedbackControl *) f;
- p.class = PtrFeedbackClass;
- p.length = sizeof (xPtrFeedbackCtl);
- p.id = P->id;
- p.num = P->accelNum;
- p.denom = P->accelDenom;
- p.thresh = P->threshold;
- length = ((unsigned)(p.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &p, length);
- }
- else if (f->class == IntegerFeedbackClass)
- {
- XIntegerFeedbackControl *I;
- xIntegerFeedbackCtl i;
-
- I = (XIntegerFeedbackControl *) f;
- i.class = IntegerFeedbackClass;
- i.length = sizeof (xIntegerFeedbackCtl);
- i.id = I->id;
- i.int_to_display = I->int_to_display;
- length = ((unsigned)(i.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &i, length);
- }
- else if (f->class == StringFeedbackClass)
- {
- XStringFeedbackControl *S;
- xStringFeedbackCtl s;
-
- S = (XStringFeedbackControl *) f;
- s.class = StringFeedbackClass;
- s.length = sizeof (xStringFeedbackCtl) +
- (S->num_keysyms * sizeof (KeySym));
- s.id = S->id;
- s.num_keysyms = S->num_keysyms;
- req->length += ((unsigned)(s.length + 3) >> 2);
- length = sizeof (xStringFeedbackCtl);
- Data (dpy, (char *) &s, length);
- length = (s.num_keysyms * sizeof (KeySym));
- Data (dpy, (char *) S->syms_to_display, length);
- }
- else if (f->class == BellFeedbackClass)
- {
- XBellFeedbackControl *B;
- xBellFeedbackCtl b;
-
- B = (XBellFeedbackControl *) f;
- b.class = BellFeedbackClass;
- b.length = sizeof (xBellFeedbackCtl);
- b.id = B->id;
- b.percent = B->percent;
- b.pitch = B->pitch;
- b.duration = B->duration;
- length = ((unsigned)(b.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &b, length);
- }
- else if (f->class == LedFeedbackClass)
- {
- XLedFeedbackControl *L;
- xLedFeedbackCtl l;
-
- L = (XLedFeedbackControl *) f;
- l.class = LedFeedbackClass;
- l.length = sizeof (xLedFeedbackCtl);
- l.id = L->id;
- l.led_mask = L->led_mask;
- l.led_values = L->led_values;
- length = ((unsigned)(l.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &l, length);
- }
- else
- {
- xFeedbackCtl u;
-
- u.class = f->class;
- u.length = f->length - sizeof (int);
- u.id = f->id;
- length = ((unsigned)(u.length + 3) >> 2);
- req->length += length;
- length <<= 2;
- Data (dpy, (char *) &u, length);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XChgKMap.c b/xc/lib/Xi/XChgKMap.c
deleted file mode 100644
index a10067172..000000000
--- a/xc/lib/Xi/XChgKMap.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $TOG: XChgKMap.c /main/5 1998/02/06 15:02: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/lib/Xi/XChgKMap.c,v 3.1 1998/10/03 09:06:05 dawes Exp $ */
-
-/***********************************************************************
- *
- * XChangeDeviceKeyMapping - change the keymap of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XChangeDeviceKeyMapping (dpy, dev, first, syms_per_code, keysyms, count)
- register Display *dpy;
- XDevice *dev;
- int first;
- int syms_per_code;
- KeySym *keysyms;
- int count;
- {
- register long nbytes;
- xChangeDeviceKeyMappingReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(ChangeDeviceKeyMapping,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ChangeDeviceKeyMapping;
- req->deviceid = dev->device_id;
- req->firstKeyCode = first;
- req->keyCodes = count;
- req->keySymsPerKeyCode = syms_per_code;
- req->length += count * syms_per_code;
- nbytes = syms_per_code * count * sizeof (CARD32);
- Data (dpy, (char *)keysyms, nbytes);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XChgKbd.c b/xc/lib/Xi/XChgKbd.c
deleted file mode 100644
index f7c2ca693..000000000
--- a/xc/lib/Xi/XChgKbd.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $TOG: XChgKbd.c /main/7 1998/02/06 15:02:11 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/lib/Xi/XChgKbd.c,v 3.1 1998/10/03 09:06:05 dawes Exp $ */
-
-/***********************************************************************
- *
- * XChangeKeyboardDevice - Change the device used as the X keyboard.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XChangeKeyboardDevice (dpy, dev)
- register Display *dpy;
- XDevice *dev;
- {
- xChangeKeyboardDeviceReq *req;
- xChangeKeyboardDeviceReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(ChangeKeyboardDevice,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ChangeKeyboardDevice;
- req->deviceid = dev->device_id;
- rep.status = Success;
-
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (rep.status);
- }
-
diff --git a/xc/lib/Xi/XChgPnt.c b/xc/lib/Xi/XChgPnt.c
deleted file mode 100644
index 59a245c06..000000000
--- a/xc/lib/Xi/XChgPnt.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $TOG: XChgPnt.c /main/7 1998/02/06 15:02: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/lib/Xi/XChgPnt.c,v 3.1 1998/10/03 09:06:05 dawes Exp $ */
-
-/***********************************************************************
- *
- * XChangePointerDevice - Change the device used as the X Pointer.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XChangePointerDevice (dpy, dev, xaxis, yaxis)
- register Display *dpy;
- XDevice *dev;
- int xaxis;
- int yaxis;
- {
- xChangePointerDeviceReq *req;
- xChangePointerDeviceReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(ChangePointerDevice,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ChangePointerDevice;
- req->deviceid = dev->device_id;
- req->xaxis = xaxis;
- req->yaxis = yaxis;
- rep.status = Success;
-
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (rep.status);
- }
-
diff --git a/xc/lib/Xi/XChgProp.c b/xc/lib/Xi/XChgProp.c
deleted file mode 100644
index 8ad8ccaa6..000000000
--- a/xc/lib/Xi/XChgProp.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $TOG: XChgProp.c /main/7 1998/02/06 15:02:27 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/lib/Xi/XChgProp.c,v 3.1 1998/10/03 09:06:06 dawes Exp $ */
-
-/***********************************************************************
- *
- * XChangeDeviceDontPropagateList - Get the dont_propagate_list for a
- * window.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XChangeDeviceDontPropagateList (dpy, window, count, events, mode)
- register Display *dpy;
- Window window;
- int count;
- XEventClass *events;
- int mode;
- {
- xChangeDeviceDontPropagateListReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(ChangeDeviceDontPropagateList,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ChangeDeviceDontPropagateList;
- req->window = window;
- req->count = count;
- req->mode = mode;
- req->length += count;
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "nvalues" is changed in a separate assignment
- statement */
-
- count <<= 2;
- Data32 (dpy, (long *) events, count);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XCloseDev.c b/xc/lib/Xi/XCloseDev.c
deleted file mode 100644
index f117dc3c8..000000000
--- a/xc/lib/Xi/XCloseDev.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $TOG: XCloseDev.c /main/6 1998/02/06 15:02: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/lib/Xi/XCloseDev.c,v 3.1 1998/10/03 09:06:06 dawes Exp $ */
-
-/***********************************************************************
- *
- * XCloseDevice - Request the server to close an extension device.
- *
- */
-
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XI.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XCloseDevice(dpy, dev)
- register Display *dpy;
- register XDevice *dev;
- {
- xCloseDeviceReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(CloseDevice,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_CloseDevice;
- req->deviceid = dev->device_id;
-
- XFree ((char *)dev);
- UnlockDisplay (dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XDevBell.c b/xc/lib/Xi/XDevBell.c
deleted file mode 100644
index 150bf27fc..000000000
--- a/xc/lib/Xi/XDevBell.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $TOG: XDevBell.c /main/6 1998/02/06 15:02: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/lib/Xi/XDevBell.c,v 3.1 1998/10/03 09:06:06 dawes Exp $ */
-
-/***********************************************************************
- *
- * XDeviceBell - Ring a bell on an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XDeviceBell (dpy, dev, feedbackclass, feedbackid, percent)
- register Display *dpy;
- XDevice *dev;
- XID feedbackclass, feedbackid;
- int percent;
- {
- xDeviceBellReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell) == -1)
- return (NoSuchExtension);
-
- GetReq(DeviceBell,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_DeviceBell;
- req->deviceid = dev->device_id;
- req->feedbackclass = feedbackclass;
- req->feedbackid = feedbackid;
- req->percent = percent;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XExtInt.c b/xc/lib/Xi/XExtInt.c
deleted file mode 100644
index 7dd80bc1e..000000000
--- a/xc/lib/Xi/XExtInt.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/* $TOG: XExtInt.c /main/34 1998/04/30 15:52: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/lib/Xi/XExtInt.c,v 3.3 1998/10/03 09:06:07 dawes Exp $ */
-
-/***********************************************************************
- *
- * Input Extension library internal functions.
- *
- */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <stdio.h>
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-#define ENQUEUE_EVENT True
-#define DONT_ENQUEUE False
-
-static XExtensionInfo *xinput_info;
-static /* const */ char *xinput_extension_name = INAME;
-static int XInputClose();
-static char *XInputError();
-static Bool XInputWireToEvent();
-Status _XiEventToWire();
-static /* const */ XEvent emptyevent;
-
-typedef struct _XInputData
- {
- XEvent data;
- XExtensionVersion *vers;
- } XInputData;
-
-#define XInputCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xinput_extension_name, val)
-
-static /* const */ XExtensionHooks xinput_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- XInputClose, /* close_display */
- XInputWireToEvent, /* wire_to_event */
- _XiEventToWire, /* event_to_wire */
- NULL, /* error */
- XInputError, /* error_string */
-};
-
-static char *XInputErrorList[] = {
- "BadDevice, invalid or uninitialized input device", /* BadDevice */
- "BadEvent, invalid event type", /* BadEvent */
- "BadMode, invalid mode parameter", /* BadMode */
- "DeviceBusy, device is busy", /* DeviceBusy */
- "BadClass, invalid event class", /* BadClass */
-};
-
-XEXT_GENERATE_FIND_DISPLAY (XInput_find_display, xinput_info,
- xinput_extension_name, &xinput_extension_hooks, IEVENTS, NULL)
-
-static XEXT_GENERATE_ERROR_STRING (XInputError, xinput_extension_name,
- IERRORS, XInputErrorList)
-/*******************************************************************
- *
- * Input extension versions.
- *
- */
-
-static XExtensionVersion versions[] = {{XI_Absent,0,0},
- {XI_Present, XI_Initial_Release_Major, XI_Initial_Release_Minor},
- {XI_Present, XI_Add_XDeviceBell_Major, XI_Add_XDeviceBell_Minor},
- {XI_Present, XI_Add_XSetDeviceValuators_Major,
- XI_Add_XSetDeviceValuators_Minor},
- {XI_Present, XI_Add_XChangeDeviceControl_Major,
- XI_Add_XChangeDeviceControl_Minor}};
-
-/***********************************************************************
- *
- * Return errors reported by this extension.
- *
- */
-
-void _xibaddevice (dpy, error)
- Display *dpy;
- int *error;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
- *error = info->codes->first_error + XI_BadDevice;
- }
-
-void _xibadclass (dpy, error)
- Display *dpy;
- int *error;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
- *error = info->codes->first_error + XI_BadClass;
- }
-
-void _xibadevent (dpy, error)
- Display *dpy;
- int *error;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
- *error = info->codes->first_error + XI_BadEvent;
- }
-
-void _xibadmode (dpy, error)
- Display *dpy;
- int *error;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
- *error = info->codes->first_error + XI_BadMode;
- }
-
-void _xidevicebusy (dpy, error)
- Display *dpy;
- int *error;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
- *error = info->codes->first_error + XI_DeviceBusy;
- }
-
-/***********************************************************************
- *
- * Check to see if the input extension is installed in the server.
- * Also check to see if the version is >= the requested version.
- *
- */
-
-_XiCheckExtInit(dpy, version_index)
- register Display *dpy;
- register int version_index;
- {
- XExtensionVersion *ext;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- XInputCheckExtension (dpy, info, -1);
-
- if (info->data == NULL)
- {
- info->data = (XPointer) Xmalloc (sizeof (XInputData));
- if (!info->data)
- {
- UnlockDisplay(dpy);
- return (-1);
- }
- ((XInputData *) info->data)->vers =
- XGetExtensionVersion (dpy, "XInputExtension");
- }
-
- if (versions[version_index].major_version > Dont_Check)
- {
- ext = ((XInputData *) info->data)->vers;
- if ((ext->major_version < versions[version_index].major_version) ||
- ((ext->major_version == versions[version_index].major_version) &&
- (ext->minor_version < versions[version_index].minor_version)))
- {
- UnlockDisplay(dpy);
- return (-1);
- }
- }
- return (0);
- }
-
-/***********************************************************************
- *
- * Close display routine.
- *
- */
-
-static int
-XInputClose (dpy, codes)
- Display *dpy;
- XExtCodes *codes;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- if(info->data != NULL) {
- XFree((char *)((XInputData *) info->data)->vers);
- XFree((char *)info->data);
- }
- return XextRemoveDisplay (xinput_info, dpy);
- }
-
-
-static int
-Ones(mask)
- Mask mask;
-{
- register Mask y;
-
- y = (mask >> 1) &033333333333;
- y = mask - y - ((y >>1) & 033333333333);
- return (((y + (y >> 3)) & 030707070707) % 077);
-}
-
-/***********************************************************************
- *
- * Handle Input extension events.
- * Reformat a wire event into an XEvent structure of the right type.
- *
- */
-
-static Bool
-XInputWireToEvent (dpy, re, event)
- Display *dpy;
- XEvent *re;
- xEvent *event;
- {
- unsigned int type, reltype;
- unsigned int i,j;
- XExtDisplayInfo *info = XInput_find_display (dpy);
- XEvent *save = (XEvent *) info->data;
-
- type = event->u.u.type & 0x7f;
- reltype = (type - info->codes->first_event);
-
-
-
- if (reltype != XI_DeviceValuator &&
- reltype != XI_DeviceKeystateNotify &&
- reltype != XI_DeviceButtonstateNotify)
- {
- *save = emptyevent;
- save->type = type;
- ((XAnyEvent *)save)->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *)event);
- ((XAnyEvent *)save)->send_event = ((event->u.u.type & 0x80) != 0);
- ((XAnyEvent *)save)->display = dpy;
- }
-
- switch (reltype)
- {
- case XI_DeviceMotionNotify:
- {
- register XDeviceMotionEvent *ev = (XDeviceMotionEvent*) save;
- deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
-
- ev->root = ev2->root;
- ev->window = ev2->event;
- ev->subwindow = ev2->child;
- ev->time = ev2->time;
- ev->x_root = ev2->root_x;
- ev->y_root = ev2->root_y;
- ev->x = ev2->event_x;
- ev->y = ev2->event_y;
- ev->state = ev2->state;
- ev->same_screen = ev2->same_screen;
- ev->is_hint = ev2->detail;
- ev->deviceid = ev2->deviceid & DEVICE_BITS;
- return (DONT_ENQUEUE);
- }
- break;
- case XI_DeviceKeyPress:
- case XI_DeviceKeyRelease:
- {
- register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) save;
- deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
-
- ev->root = ev2->root;
- ev->window = ev2->event;
- ev->subwindow = ev2->child;
- ev->time = ev2->time;
- ev->x_root = ev2->root_x;
- ev->y_root = ev2->root_y;
- ev->x = ev2->event_x;
- ev->y = ev2->event_y;
- ev->state = ev2->state;
- ev->same_screen = ev2->same_screen;
- ev->keycode = ev2->detail;
- ev->deviceid = ev2->deviceid & DEVICE_BITS;
- if (ev2->deviceid & MORE_EVENTS)
- return (DONT_ENQUEUE);
- else
- {
- *re = *save;
- return (ENQUEUE_EVENT);
- }
- }
- break;
- case XI_DeviceButtonPress:
- case XI_DeviceButtonRelease:
- {
- register XDeviceButtonEvent *ev = (XDeviceButtonEvent*) save;
- deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
-
- ev->root = ev2->root;
- ev->window = ev2->event;
- ev->subwindow = ev2->child;
- ev->time = ev2->time;
- ev->x_root = ev2->root_x;
- ev->y_root = ev2->root_y;
- ev->x = ev2->event_x;
- ev->y = ev2->event_y;
- ev->state = ev2->state;
- ev->same_screen = ev2->same_screen;
- ev->button = ev2->detail;
- ev->deviceid = ev2->deviceid & DEVICE_BITS;
- if (ev2->deviceid & MORE_EVENTS)
- return (DONT_ENQUEUE);
- else
- {
- *re = *save;
- return (ENQUEUE_EVENT);
- }
- }
- break;
- case XI_ProximityIn:
- case XI_ProximityOut:
- {
- register XProximityNotifyEvent *ev =
- (XProximityNotifyEvent *) save;
- deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
-
- ev->root = ev2->root;
- ev->window = ev2->event;
- ev->subwindow = ev2->child;
- ev->time = ev2->time;
- ev->x_root = ev2->root_x;
- ev->y_root = ev2->root_y;
- ev->x = ev2->event_x;
- ev->y = ev2->event_y;
- ev->state = ev2->state;
- ev->same_screen = ev2->same_screen;
- ev->deviceid = ev2->deviceid & DEVICE_BITS;
- if (ev2->deviceid & MORE_EVENTS)
- return (DONT_ENQUEUE);
- else
- {
- *re = *save;
- return (ENQUEUE_EVENT);
- }
- }
- break;
- case XI_DeviceValuator:
- {
- deviceValuator *xev = (deviceValuator *) event;
- int save_type = save->type - info->codes->first_event;
-
- if (save_type == XI_DeviceKeyPress ||
- save_type == XI_DeviceKeyRelease)
- {
- XDeviceKeyEvent *kev = (XDeviceKeyEvent*) save;
- kev->device_state = xev->device_state;
- kev->axes_count = xev->num_valuators;
- kev->first_axis = xev->first_valuator;
- i = xev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: kev->axis_data[5] = xev->valuator5;
- case 5: kev->axis_data[4] = xev->valuator4;
- case 4: kev->axis_data[3] = xev->valuator3;
- case 3: kev->axis_data[2] = xev->valuator2;
- case 2: kev->axis_data[1] = xev->valuator1;
- case 1: kev->axis_data[0] = xev->valuator0;
- }
- }
- else if (save_type == XI_DeviceButtonPress ||
- save_type == XI_DeviceButtonRelease)
- {
- XDeviceButtonEvent *bev = (XDeviceButtonEvent*) save;
- bev->device_state = xev->device_state;
- bev->axes_count = xev->num_valuators;
- bev->first_axis = xev->first_valuator;
- i = xev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: bev->axis_data[5] = xev->valuator5;
- case 5: bev->axis_data[4] = xev->valuator4;
- case 4: bev->axis_data[3] = xev->valuator3;
- case 3: bev->axis_data[2] = xev->valuator2;
- case 2: bev->axis_data[1] = xev->valuator1;
- case 1: bev->axis_data[0] = xev->valuator0;
- }
- }
- else if (save_type == XI_DeviceMotionNotify)
- {
- XDeviceMotionEvent *mev = (XDeviceMotionEvent*) save;
- mev->device_state = xev->device_state;
- mev->axes_count = xev->num_valuators;
- mev->first_axis = xev->first_valuator;
- i = xev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: mev->axis_data[5] = xev->valuator5;
- case 5: mev->axis_data[4] = xev->valuator4;
- case 4: mev->axis_data[3] = xev->valuator3;
- case 3: mev->axis_data[2] = xev->valuator2;
- case 2: mev->axis_data[1] = xev->valuator1;
- case 1: mev->axis_data[0] = xev->valuator0;
- }
- }
- else if (save_type == XI_ProximityIn ||
- save_type == XI_ProximityOut)
- {
- XProximityNotifyEvent *pev =
- (XProximityNotifyEvent*) save;
- pev->device_state = xev->device_state;
- pev->axes_count = xev->num_valuators;
- pev->first_axis = xev->first_valuator;
- i = xev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: pev->axis_data[5] = xev->valuator5;
- case 5: pev->axis_data[4] = xev->valuator4;
- case 4: pev->axis_data[3] = xev->valuator3;
- case 3: pev->axis_data[2] = xev->valuator2;
- case 2: pev->axis_data[1] = xev->valuator1;
- case 1: pev->axis_data[0] = xev->valuator0;
- }
- }
- else if (save_type == XI_DeviceStateNotify)
- {
- XDeviceStateNotifyEvent *sev =
- (XDeviceStateNotifyEvent*) save;
- XInputClass *any = (XInputClass *) &sev->data[0];
- XValuatorStatus *v;
-
- for (i=0; i<sev->num_classes; i++)
- if (any->class != ValuatorClass)
- any = (XInputClass *) ((char *) any + any->length);
- v = (XValuatorStatus *) any;
- i = v->num_valuators;
- j = xev->num_valuators;
- if (j > 3) j = 3;
- switch (j)
- {
- case 3: v->valuators[i + 2] = xev->valuator2;
- case 2: v->valuators[i + 1] = xev->valuator1;
- case 1: v->valuators[i + 0] = xev->valuator0;
- }
- v->num_valuators += j;
-
- }
- *re = *save;
- return (ENQUEUE_EVENT);
- }
- break;
- case XI_DeviceFocusIn:
- case XI_DeviceFocusOut:
- {
- register XDeviceFocusChangeEvent *ev =
- (XDeviceFocusChangeEvent *) re;
- deviceFocus *fev = (deviceFocus *) event;
-
- *ev = *((XDeviceFocusChangeEvent *) save);
- ev->window = fev->window;
- ev->time = fev->time;
- ev->mode = fev->mode;
- ev->detail = fev->detail;
- ev->deviceid = fev->deviceid & DEVICE_BITS;
- return (ENQUEUE_EVENT);
- }
- break;
- case XI_DeviceStateNotify:
- {
- XDeviceStateNotifyEvent *stev =
- (XDeviceStateNotifyEvent *) save;
- deviceStateNotify *sev = (deviceStateNotify *) event;
- char *data;
-
- stev->window = None;
- stev->deviceid = sev->deviceid & DEVICE_BITS;
- stev->time = sev->time;
- stev->num_classes = Ones ((Mask)sev->classes_reported & InputClassBits);
- data = (char *) &stev->data[0];
- if (sev->classes_reported & (1 << KeyClass))
- {
- register XKeyStatus *kstev = (XKeyStatus *) data;
- kstev->class = KeyClass;
- kstev->length = sizeof (XKeyStatus);
- kstev->num_keys = sev->num_keys;
- memcpy ((char *) &kstev->keys[0], (char *) &sev->keys[0], 4);
- data += sizeof (XKeyStatus);
- }
- if (sev->classes_reported & (1 << ButtonClass))
- {
- register XButtonStatus *bev = (XButtonStatus *) data;
- bev->class = ButtonClass;
- bev->length = sizeof (XButtonStatus);
- bev->num_buttons = sev->num_buttons;
- memcpy ((char *) bev->buttons, (char *) sev->buttons, 4);
- data += sizeof (XButtonStatus);
- }
- if (sev->classes_reported & (1 << ValuatorClass))
- {
- register XValuatorStatus *vev = (XValuatorStatus *) data;
- vev->class = ValuatorClass;
- vev->length = sizeof (XValuatorStatus);
- vev->num_valuators = sev->num_valuators;
- vev->mode = sev->classes_reported >> ModeBitsShift;
- j = sev->num_valuators;
- if (j > 3) j = 3;
- switch (j)
- {
- case 3: vev->valuators[2] = sev->valuator2;
- case 2: vev->valuators[1] = sev->valuator1;
- case 1: vev->valuators[0] = sev->valuator0;
- }
- data += sizeof (XValuatorStatus);
- }
- if (sev->deviceid & MORE_EVENTS)
- return (DONT_ENQUEUE);
- else
- {
- *re = *save;
- stev = (XDeviceStateNotifyEvent *) re;
- return (ENQUEUE_EVENT);
- }
- }
- break;
- case XI_DeviceKeystateNotify:
- {
- int i;
- XInputClass *anyclass;
- register XKeyStatus *kv;
- deviceKeyStateNotify *ksev = (deviceKeyStateNotify *) event;
- XDeviceStateNotifyEvent *kstev =
- (XDeviceStateNotifyEvent *) save;
-
- anyclass = (XInputClass *) &kstev->data[0];
- for (i=0; i<kstev->num_classes; i++)
- if (anyclass->class == KeyClass)
- break;
- else
- anyclass = (XInputClass *) ((char *) anyclass +
- anyclass->length);
-
- kv = (XKeyStatus *) anyclass;
- kv->num_keys = 256;
- memcpy ((char *) &kv->keys[4], (char *) ksev->keys, 28);
- if (ksev->deviceid & MORE_EVENTS)
- return (DONT_ENQUEUE);
- else
- {
- *re = *save;
- kstev = (XDeviceStateNotifyEvent *) re;
- return (ENQUEUE_EVENT);
- }
- }
- break;
- case XI_DeviceButtonstateNotify:
- {
- int i;
- XInputClass *anyclass;
- register XButtonStatus *bv;
- deviceButtonStateNotify *bsev = (deviceButtonStateNotify *) event;
- XDeviceStateNotifyEvent *bstev =
- (XDeviceStateNotifyEvent *) save;
-
-
- anyclass = (XInputClass *) &bstev->data[0];
- for (i=0; i<bstev->num_classes; i++)
- if (anyclass->class == ButtonClass)
- break;
- else
- anyclass = (XInputClass *) ((char *) anyclass +
- anyclass->length);
-
- bv = (XButtonStatus *) anyclass;
- bv->num_buttons = 256;
- memcpy ((char *) &bv->buttons[4], (char *) bsev->buttons, 28);
- if (bsev->deviceid & MORE_EVENTS)
- return (DONT_ENQUEUE);
- else
- {
- *re = *save;
- bstev = (XDeviceStateNotifyEvent *) re;
- return (ENQUEUE_EVENT);
- }
- }
- break;
- case XI_DeviceMappingNotify:
- {
- register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
- deviceMappingNotify *ev2 = (deviceMappingNotify *) event;
-
- *ev = *((XDeviceMappingEvent *) save);
- ev->window = 0;
- ev->first_keycode = ev2->firstKeyCode;
- ev->request = ev2->request;
- ev->count = ev2->count;
- ev->time = ev2->time;
- ev->deviceid = ev2->deviceid & DEVICE_BITS;
- return (ENQUEUE_EVENT);
- }
- break;
- case XI_ChangeDeviceNotify:
- {
- register XChangeDeviceNotifyEvent *ev =
- (XChangeDeviceNotifyEvent *) re;
- changeDeviceNotify *ev2 = (changeDeviceNotify *) event;
-
- *ev = *((XChangeDeviceNotifyEvent *) save);
- ev->window = 0;
- ev->request = ev2->request;
- ev->time = ev2->time;
- ev->deviceid = ev2->deviceid & DEVICE_BITS;
- return (ENQUEUE_EVENT);
- }
- break;
- default:
- printf ("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",type);
- break;
- }
-
- return (DONT_ENQUEUE);
- }
diff --git a/xc/lib/Xi/XExtToWire.c b/xc/lib/Xi/XExtToWire.c
deleted file mode 100644
index 4c7909e86..000000000
--- a/xc/lib/Xi/XExtToWire.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/* $TOG: XExtToWire.c /main/17 1998/02/06 15:02:48 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/lib/Xi/XExtToWire.c,v 3.1 1998/10/03 09:06:07 dawes Exp $ */
-
-/****************************************************************
- *
- * XExtToWire.c - reformat an XEvent into a wire event.
- */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-
-#include "Xlibint.h"
-#include "XInput.h"
-#include "XIproto.h"
-#include "extutil.h"
-#include "XIint.h"
-
-Status
-_XiEventToWire(dpy, re, event, count)
- register Display *dpy; /* pointer to display structure */
- register XEvent *re; /* pointer to client event */
- register xEvent **event; /* wire protocol event */
- register int *count;
- {
- XExtDisplayInfo *info = XInput_find_display (dpy);
- int i;
-
- switch ((re->type & 0x7f) - info->codes->first_event)
- {
- case XI_DeviceKeyPress:
- case XI_DeviceKeyRelease:
- {
- register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) re;
- register deviceKeyButtonPointer *kev;
- register deviceValuator *vev;
-
- *count = 2;
- kev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
- if (!kev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) kev;
-
- kev->type = ev->type;
- kev->root = ev->root;
- kev->event = ev->window;
- kev->child = ev->subwindow;
- kev->time = ev->time;
- kev->event_x = ev->x ;
- kev->event_y = ev->y ;
- kev->root_x = ev->x_root;
- kev->root_y = ev->y_root;
- kev->state = ev->state;
- kev->same_screen = ev->same_screen;
- kev->detail = ev->keycode;
- kev->deviceid = ev->deviceid | MORE_EVENTS;
-
- vev = (deviceValuator *) ++kev;
- vev->type = info->codes->first_event + XI_DeviceValuator;
- vev->deviceid = ev->deviceid;
- vev->device_state = ev->device_state;
- vev->first_valuator = ev->first_axis;
- vev->num_valuators = ev->axes_count;
- i = vev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: vev->valuator5 = ev->axis_data[5];
- case 5: vev->valuator4 = ev->axis_data[4];
- case 4: vev->valuator3 = ev->axis_data[3];
- case 3: vev->valuator2 = ev->axis_data[2];
- case 2: vev->valuator1 = ev->axis_data[1];
- case 1: vev->valuator0 = ev->axis_data[0];
- }
- break;
- }
- case XI_ProximityIn:
- case XI_ProximityOut:
- {
- register XProximityNotifyEvent *ev =
- (XProximityNotifyEvent *) re;
- register deviceKeyButtonPointer *pev;
- register deviceValuator *vev;
-
- *count = 2;
- pev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
- if (!pev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) pev;
-
- pev->type = ev->type;
- pev->root = ev->root;
- pev->event = ev->window;
- pev->child = ev->subwindow;
- pev->time = ev->time;
- pev->event_x = ev->x ;
- pev->event_y = ev->y ;
- pev->root_x = ev->x_root;
- pev->root_y = ev->y_root;
- pev->state = ev->state;
- pev->same_screen = ev->same_screen;
- pev->deviceid = ev->deviceid | MORE_EVENTS;
-
- vev = (deviceValuator *) ++pev;
- vev->type = info->codes->first_event + XI_DeviceValuator;
- vev->deviceid = ev->deviceid;
- vev->device_state = ev->device_state;
- vev->first_valuator = ev->first_axis;
- vev->num_valuators = ev->axes_count;
-
- i = vev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: vev->valuator5 = ev->axis_data[5];
- case 5: vev->valuator4 = ev->axis_data[4];
- case 4: vev->valuator3 = ev->axis_data[3];
- case 3: vev->valuator2 = ev->axis_data[2];
- case 2: vev->valuator1 = ev->axis_data[1];
- case 1: vev->valuator0 = ev->axis_data[0];
- }
- break;
- }
- case XI_DeviceButtonPress:
- case XI_DeviceButtonRelease:
- {
- register XDeviceButtonEvent *ev =
- (XDeviceButtonEvent *) re;
- register deviceKeyButtonPointer *bev;
- register deviceValuator *vev;
-
- *count = 2;
- bev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
- if (!bev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) bev;
-
- bev->type = ev->type;
- bev->root = ev->root;
- bev->event = ev->window;
- bev->child = ev->subwindow;
- bev->time = ev->time;
- bev->event_x = ev->x ;
- bev->event_y = ev->y ;
- bev->root_x = ev->x_root;
- bev->root_y = ev->y_root;
- bev->state = ev->state;
- bev->same_screen = ev->same_screen;
- bev->detail = ev->button;
- bev->deviceid = ev->deviceid | MORE_EVENTS;
-
- vev = (deviceValuator *) ++bev;
- vev->type = info->codes->first_event + XI_DeviceValuator;
- vev->deviceid = ev->deviceid;
- vev->device_state = ev->device_state;
- vev->first_valuator = ev->first_axis;
- vev->num_valuators = ev->axes_count;
-
- i = vev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: vev->valuator5 = ev->axis_data[5];
- case 5: vev->valuator4 = ev->axis_data[4];
- case 4: vev->valuator3 = ev->axis_data[3];
- case 3: vev->valuator2 = ev->axis_data[2];
- case 2: vev->valuator1 = ev->axis_data[1];
- case 1: vev->valuator0 = ev->axis_data[0];
- }
- break;
- }
- case XI_DeviceMotionNotify:
- {
- register XDeviceMotionEvent *ev =
- (XDeviceMotionEvent *)re;
- register deviceKeyButtonPointer *mev;
- register deviceValuator *vev;
-
- *count = 2;
- mev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
- if (!mev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) mev;
-
- mev->type = ev->type;
- mev->root = ev->root;
- mev->event = ev->window;
- mev->child = ev->subwindow;
- mev->time = ev->time;
- mev->event_x = ev->x ;
- mev->event_y = ev->y ;
- mev->root_x = ev->x_root;
- mev->root_y = ev->y_root;
- mev->state = ev->state;
- mev->same_screen = ev->same_screen;
- mev->detail = ev->is_hint;
- mev->deviceid = ev->deviceid | MORE_EVENTS;
-
- vev = (deviceValuator *) ++mev;
- vev->type = info->codes->first_event + XI_DeviceValuator;
- vev->deviceid = ev->deviceid;
- vev->device_state = ev->device_state;
- vev->first_valuator = ev->first_axis;
- vev->num_valuators = ev->axes_count;
-
- i = vev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: vev->valuator5 = ev->axis_data[5];
- case 5: vev->valuator4 = ev->axis_data[4];
- case 4: vev->valuator3 = ev->axis_data[3];
- case 3: vev->valuator2 = ev->axis_data[2];
- case 2: vev->valuator1 = ev->axis_data[1];
- case 1: vev->valuator0 = ev->axis_data[0];
- }
- break;
- }
- case XI_DeviceFocusIn:
- case XI_DeviceFocusOut:
- {
- register XDeviceFocusChangeEvent *ev =
- (XDeviceFocusChangeEvent *) re;
- register deviceFocus *fev;
-
- *count = 1;
- fev = (deviceFocus *) Xmalloc (*count * sizeof (xEvent));
- if (!fev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) fev;
-
- fev->type = ev->type;
- fev->window = ev->window;
- fev->mode = ev->mode;
- fev->detail = ev->detail;
- fev->time = ev->time;
- fev->deviceid = ev->deviceid;
- break;
- }
- case XI_DeviceMappingNotify:
- {
- register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
- register deviceMappingNotify *mev;
-
- *count = 1;
- mev = (deviceMappingNotify *) Xmalloc (*count * sizeof (xEvent));
- if (!mev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) mev;
-
- mev->type = ev->type;
- mev->firstKeyCode = ev->first_keycode;
- mev->request = ev->request;
- mev->count = ev->count;
- mev->time = ev->time;
- mev->deviceid = ev->deviceid;
- break;
- }
- case XI_DeviceStateNotify:
- {
- register XDeviceStateNotifyEvent *ev =
- (XDeviceStateNotifyEvent *) re;
- register deviceStateNotify *sev;
- register xEvent *tev;
- XInputClass *any = (XInputClass *) &ev->data[0];
- unsigned char *sav_id;
- *count = 1;
-
- for (i=0; i<ev->num_classes; i++)
- {
- if (any->class == KeyClass)
- {
- XKeyStatus *k = (XKeyStatus *) any;
- if (k->num_keys > 32)
- (*count)++;
- }
- else if (any->class == ButtonClass)
- {
- XButtonStatus *b = (XButtonStatus *) any;
- if (b->num_buttons > 32)
- (*count)++;
- }
- else if (any->class == ValuatorClass)
- {
- XValuatorStatus *v = (XValuatorStatus *) any;
- if (v->num_valuators > 3)
- (*count)++;
- }
- any = (XInputClass *) ((char *) any + any->length);
- }
-
- sev = (deviceStateNotify *) Xmalloc (*count * sizeof (xEvent));
- if (!sev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) sev;
- tev = (xEvent *) (sev+1);
-
- sev->type = ev->type;
- sev->deviceid = ev->deviceid;
- sav_id = &(sev->deviceid);
- sev->time = ev->time;
- sev->classes_reported = 0;
-
- any = (XInputClass *) &ev->data[0];
- for (i=0; i<ev->num_classes; i++)
- {
- if (any->class == KeyClass)
- {
- XKeyStatus *k = (XKeyStatus *) any;
- register deviceKeyStateNotify *kev;
-
- sev->classes_reported |= (1 << KeyClass);
- sev->num_keys = k->num_keys;
- memcpy ((char *) (sev->keys), (char *) (k->keys), 4);
- if (k->num_keys > 32)
- {
- kev = (deviceKeyStateNotify *) tev++;
- kev->type = info->codes->first_event +
- XI_DeviceKeystateNotify;
- kev->deviceid = ev->deviceid;
- *sav_id |= MORE_EVENTS;
- sav_id = &(kev->deviceid);
- memcpy ((char *) (kev->keys), (char *) (&k->keys[4]),
- 28);
- }
- }
- else if (any->class == ButtonClass)
- {
- XButtonStatus *b = (XButtonStatus *) any;
- register deviceButtonStateNotify *bev;
-
- sev->classes_reported |= (1 << ButtonClass);
- sev->num_buttons = b->num_buttons;
- memcpy ((char *) (sev->buttons), (char *) (b->buttons), 4);
- if (b->num_buttons > 32)
- {
- bev = (deviceButtonStateNotify *) tev++;
- bev->type = info->codes->first_event +
- XI_DeviceButtonstateNotify;
- bev->deviceid = ev->deviceid;
- *sav_id |= MORE_EVENTS;
- sav_id = &(bev->deviceid);
- memcpy ((char *)(bev->buttons), (char *)(&b->buttons[4]),
- 28);
- }
- }
- else if (any->class == ValuatorClass)
- {
- XValuatorStatus *val = (XValuatorStatus *) any;
- register deviceValuator *vev;
-
- sev->classes_reported |= (1 << ValuatorClass);
- sev->num_valuators = val->num_valuators < 3 ?
- val->num_valuators : 3;
- switch (sev->num_valuators)
- {
- case 3: sev->valuator2 = val->valuators[2];
- case 2: sev->valuator1 = val->valuators[1];
- case 1: sev->valuator0 = val->valuators[0];
- }
- if (val->num_valuators > 3)
- {
- vev = (deviceValuator *) tev++;
- vev->type = info->codes->first_event +
- XI_DeviceValuator;
- vev->deviceid = ev->deviceid;
- vev->first_valuator = 3;
- vev->num_valuators = val->num_valuators - 3;
- *sav_id |= MORE_EVENTS;
- sav_id = &(vev->deviceid);
- i = val->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: vev->valuator2 = val->valuators[5];
- case 5: vev->valuator1 = val->valuators[4];
- case 4: vev->valuator0 = val->valuators[3];
- }
- }
- }
- any = (XInputClass *) ((char *) any + any->length);
- }
- break;
- }
- case XI_ChangeDeviceNotify:
- {
- register XChangeDeviceNotifyEvent *ev =
- (XChangeDeviceNotifyEvent *) re;
- register changeDeviceNotify *cev;
-
- *count = 1;
- cev = (changeDeviceNotify *) Xmalloc (*count * sizeof (xEvent));
- if (!cev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) cev;
-
- cev->type = ev->type;
- cev->request = ev->request;
- cev->time = ev->time;
- cev->deviceid = ev->deviceid;
- break;
- }
- default:
- return(_XUnknownNativeEvent(dpy, re, event));
- }
- return(1);
- }
diff --git a/xc/lib/Xi/XFreeLst.c b/xc/lib/Xi/XFreeLst.c
deleted file mode 100644
index e28055df9..000000000
--- a/xc/lib/Xi/XFreeLst.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $TOG: XFreeLst.c /main/3 1998/02/06 15:02: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.
-
-********************************************************/
-
-/***********************************************************************
- *
- * XFreeDeviceList - free the input device list.
- *
- */
-
-#include <stdio.h>
-#include "Xlib.h"
-
-/***********************************************************************
- *
- * Free the list of input devices.
- *
- */
-
-XFreeDeviceList (list)
- XDeviceList *list;
- {
- if (list != NULL)
- {
- XFree ((list->name) - sizeof(XDeviceList));
- XFree ((XDeviceList *) list);
- }
- }
diff --git a/xc/lib/Xi/XGMotion.c b/xc/lib/Xi/XGMotion.c
deleted file mode 100644
index 14ce0cd5b..000000000
--- a/xc/lib/Xi/XGMotion.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* $TOG: XGMotion.c /main/15 1998/04/30 15:52: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/lib/Xi/XGMotion.c,v 3.1 1998/10/03 09:06:07 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceMotionEvents - Get the motion history of an input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XDeviceTimeCoord
-*XGetDeviceMotionEvents (dpy, dev, start, stop, nEvents, mode, axis_count)
- register Display *dpy;
- XDevice *dev;
- Time start;
- Time stop;
- int *nEvents;
- int *mode;
- int *axis_count;
- {
- xGetDeviceMotionEventsReq *req;
- xGetDeviceMotionEventsReply rep;
- XDeviceTimeCoord *tc;
- int *data, *bufp, *readp, *savp;
- long size, size2;
- int i, j;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XDeviceTimeCoord *) NoSuchExtension);
-
- GetReq(GetDeviceMotionEvents,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceMotionEvents;
- req->start = start;
- req->stop = stop;
- req->deviceid = dev->device_id;
-
- if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- *nEvents = 0;
- return (NULL);
- }
-
- *mode = rep.mode;
- *axis_count = rep.axes;
- *nEvents = rep.nEvents;
- if (!rep.nEvents)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (NULL);
- }
- size = rep.length << 2;
- size2 = rep.nEvents *
- (sizeof (XDeviceTimeCoord) + (rep.axes * sizeof (int)));
- savp = readp = (int *) Xmalloc (size);
- bufp = (int *) Xmalloc (size2);
- if (!bufp || !savp)
- {
- *nEvents = 0;
- _XEatData (dpy, (unsigned long) size);
- UnlockDisplay(dpy);
- SyncHandle();
- return (NULL);
- }
- _XRead (dpy, (char *) readp, size);
-
- tc = (XDeviceTimeCoord *) bufp;
- data = (int *) (tc + rep.nEvents);
- for (i=0; i<*nEvents; i++,tc++)
- {
- tc->time = *readp++;
- tc->data = data;
- for (j=0; j<*axis_count; j++)
- *data++ = *readp++;
- }
- XFree ((char *)savp);
- UnlockDisplay(dpy);
- SyncHandle();
- return ((XDeviceTimeCoord *) bufp);
- }
-
-void XFreeDeviceMotionEvents (events)
- XDeviceTimeCoord *events;
- {
- XFree ((char *)events);
- }
diff --git a/xc/lib/Xi/XGetBMap.c b/xc/lib/Xi/XGetBMap.c
deleted file mode 100644
index 6ee5a2d16..000000000
--- a/xc/lib/Xi/XGetBMap.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $TOG: XGetBMap.c /main/6 1998/02/06 15:03: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/lib/Xi/XGetBMap.c,v 3.1 1998/10/03 09:06:07 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceButtonMapping - Get the button mapping of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-#ifdef MIN /* some systems define this in <sys/param.h> */
-#undef MIN
-#endif
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-
-int
-XGetDeviceButtonMapping (dpy, device, map, nmap)
- register Display *dpy;
- XDevice *device;
- unsigned char map[];
- unsigned int nmap;
- {
- int status = 0;
- unsigned char mapping[256]; /* known fixed size */
- long nbytes;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- register xGetDeviceButtonMappingReq *req;
- xGetDeviceButtonMappingReply rep;
-
- LockDisplay(dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
- GetReq(GetDeviceButtonMapping, req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceButtonMapping;
- req->deviceid = device->device_id;
-
- status = _XReply (dpy, (xReply *)&rep, 0, xFalse);
- if (status == 1)
- {
- nbytes = (long)rep.length << 2;
- _XRead (dpy, (char *)mapping, nbytes);
-
- /* don't return more data than the user asked for. */
- if (rep.nElts)
- memcpy ((char *) map, (char *) mapping, MIN((int)rep.nElts, nmap));
- status = rep.nElts;
- }
- else
- status = 0;
- UnlockDisplay(dpy);
- SyncHandle();
- return (status);
- }
diff --git a/xc/lib/Xi/XGetDCtl.c b/xc/lib/Xi/XGetDCtl.c
deleted file mode 100644
index d329a6fc7..000000000
--- a/xc/lib/Xi/XGetDCtl.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* $TOG: XGetDCtl.c /main/6 1998/04/30 15:52: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/lib/Xi/XGetDCtl.c,v 3.1 1998/10/03 09:06:08 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceControl - get the Device control state of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "Xlib.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XDeviceControl
-*XGetDeviceControl (dpy, dev, control)
- register Display *dpy;
- XDevice *dev;
- int control;
- {
- int size = 0;
- int nbytes, i;
- XDeviceControl *Device = NULL;
- XDeviceControl *Sav = NULL;
- xDeviceState *d = NULL;
- xDeviceState *sav = NULL;
- xGetDeviceControlReq *req;
- xGetDeviceControlReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl) == -1)
- return ((XDeviceControl *) NoSuchExtension);
-
- GetReq(GetDeviceControl,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceControl;
- req->deviceid = dev->device_id;
- req->control = control;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceControl *) NULL;
- }
- if (rep.length > 0)
- {
- nbytes = (long)rep.length << 2;
- d = (xDeviceState *) Xmalloc((unsigned) nbytes);
- if (!d)
- {
- _XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceControl *) NULL;
- }
- sav = d;
- _XRead (dpy, (char *) d, nbytes);
-
- switch (d->control)
- {
- case DEVICE_RESOLUTION:
- {
- xDeviceResolutionState *r;
-
- r = (xDeviceResolutionState *) d;
- size += sizeof (XDeviceResolutionState) +
- (3 * sizeof(int) * r->num_valuators);
- break;
- }
- default:
- size += d->length;
- break;
- }
-
- Device = (XDeviceControl *) Xmalloc((unsigned) size);
- if (!Device)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceControl *) NULL;
- }
- Sav = Device;
-
- d = sav;
- switch (control)
- {
- case DEVICE_RESOLUTION:
- {
- int *iptr, *iptr2;
- xDeviceResolutionState *r;
- XDeviceResolutionState *R;
- r = (xDeviceResolutionState *) d;
- R = (XDeviceResolutionState *) Device;
-
- R->control = DEVICE_RESOLUTION;
- R->length = sizeof (XDeviceResolutionState);
- R->num_valuators = r->num_valuators;
- iptr = (int *) (R+1);
- iptr2 = (int *) (r+1);
- R->resolutions = iptr;
- R->min_resolutions = iptr + R->num_valuators;
- R->max_resolutions = iptr + (2 * R->num_valuators);
- for (i=0; i < (3 * R->num_valuators); i++)
- *iptr++ = *iptr2++;
- break;
- }
- default:
- break;
- }
- XFree (sav);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Sav);
- }
-
-void XFreeDeviceControl (control)
- XDeviceControl *control;
- {
- XFree (control);
- }
diff --git a/xc/lib/Xi/XGetFCtl.c b/xc/lib/Xi/XGetFCtl.c
deleted file mode 100644
index 4f3e671eb..000000000
--- a/xc/lib/Xi/XGetFCtl.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* $TOG: XGetFCtl.c /main/15 1998/04/30 15:52:23 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/lib/Xi/XGetFCtl.c,v 3.1 1998/10/03 09:06:08 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetFeedbackControl - get the feedback attributes of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "Xlib.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XFeedbackState
-*XGetFeedbackControl (dpy, dev, num_feedbacks)
- register Display *dpy;
- XDevice *dev;
- int *num_feedbacks;
- {
- int size = 0;
- int nbytes, i;
- XFeedbackState *Feedback = NULL;
- XFeedbackState *Sav = NULL;
- xFeedbackState *f = NULL;
- xFeedbackState *sav = NULL;
- xGetFeedbackControlReq *req;
- xGetFeedbackControlReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XFeedbackState *) NoSuchExtension);
-
- GetReq(GetFeedbackControl,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetFeedbackControl;
- req->deviceid = dev->device_id;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XFeedbackState *) NULL;
- }
- if (rep.length > 0)
- {
- *num_feedbacks = rep.num_feedbacks;
- nbytes = (long)rep.length << 2;
- f = (xFeedbackState *) Xmalloc((unsigned) nbytes);
- if (!f)
- {
- _XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay(dpy);
- SyncHandle();
- return (XFeedbackState *) NULL;
- }
- sav = f;
- _XRead (dpy, (char *) f, nbytes);
-
- for (i=0; i<*num_feedbacks; i++)
- {
- switch (f->class)
- {
- case KbdFeedbackClass:
- size += sizeof (XKbdFeedbackState);
- break;
- case PtrFeedbackClass:
- size += sizeof (XPtrFeedbackState);
- break;
- case IntegerFeedbackClass:
- size += sizeof (XIntegerFeedbackState);
- break;
- case StringFeedbackClass:
- {
- xStringFeedbackState *strf = (xStringFeedbackState *) f;
-
- size += sizeof (XStringFeedbackState) +
- (strf->num_syms_supported * sizeof (KeySym));
- }
- break;
- case LedFeedbackClass:
- size += sizeof (XLedFeedbackState);
- break;
- case BellFeedbackClass:
- size += sizeof (XBellFeedbackState);
- break;
- default:
- size += f->length;
- break;
- }
- f = (xFeedbackState *) ((char *) f + f->length);
- }
-
- Feedback = (XFeedbackState *) Xmalloc((unsigned) size);
- if (!Feedback)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XFeedbackState *) NULL;
- }
- Sav = Feedback;
-
- f = sav;
- for (i=0; i<*num_feedbacks; i++)
- {
- switch (f->class)
- {
- case KbdFeedbackClass:
- {
- xKbdFeedbackState *k;
- XKbdFeedbackState *K;
- k = (xKbdFeedbackState *) f;
- K = (XKbdFeedbackState *) Feedback;
-
- K->class = k->class;
- K->length = sizeof (XKbdFeedbackState);
- K->id = k->id;
- K->click = k->click;
- K->percent = k->percent;
- K->pitch = k->pitch;
- K->duration = k->duration;
- K->led_mask = k->led_mask;
- K->global_auto_repeat = k->global_auto_repeat;
- memcpy ((char *) &K->auto_repeats[0],
- (char *) &k->auto_repeats[0], 32);
- break;
- }
- case PtrFeedbackClass:
- {
- xPtrFeedbackState *p;
- XPtrFeedbackState *P;
- p = (xPtrFeedbackState *) f;
- P = (XPtrFeedbackState *) Feedback;
-
- P->class = p->class;
- P->length = sizeof (XPtrFeedbackState);
- P->id = p->id;
- P->accelNum = p->accelNum;
- P->accelDenom = p->accelDenom;
- P->threshold = p->threshold;
- break;
- }
- case IntegerFeedbackClass:
- {
- xIntegerFeedbackState *i;
- XIntegerFeedbackState *I;
- i = (xIntegerFeedbackState *) f;
- I = (XIntegerFeedbackState *) Feedback;
-
- I->class = i->class;
- I->length = sizeof (XIntegerFeedbackState);
- I->id = i->id;
- I->resolution = i->resolution;
- I->minVal = i->min_value;
- I->maxVal = i->max_value;
- break;
- }
- case StringFeedbackClass:
- {
- xStringFeedbackState *s;
- XStringFeedbackState *S;
- s = (xStringFeedbackState *) f;
- S = (XStringFeedbackState *) Feedback;
-
- S->class = s->class;
- S->length = sizeof (XStringFeedbackState) +
- (s->num_syms_supported * sizeof (KeySym));
- S->id = s->id;
- S->max_symbols = s->max_symbols;
- S->num_syms_supported = s->num_syms_supported;
- S->syms_supported = (KeySym *) (S+1);
- memcpy ((char *) S->syms_supported, (char *) (s+1),
- (S->num_syms_supported * sizeof (KeySym)));
- break;
- }
- case LedFeedbackClass:
- {
- xLedFeedbackState *l;
- XLedFeedbackState *L;
- l = (xLedFeedbackState *) f;
- L = (XLedFeedbackState *) Feedback;
-
- L->class = l->class;
- L->length = sizeof (XLedFeedbackState);
- L->id = l->id;
- L->led_values = l->led_values;
- L->led_mask = l->led_mask;
- break;
- }
- case BellFeedbackClass:
- {
- xBellFeedbackState *b;
- XBellFeedbackState *B;
- b = (xBellFeedbackState *) f;
- B = (XBellFeedbackState *) Feedback;
-
- B->class = b->class;
- B->length = sizeof (XBellFeedbackState);
- B->id = b->id;
- B->percent = b->percent;
- B->pitch = b->pitch;
- B->duration = b->duration;
- break;
- }
- default:
- break;
- }
- f = (xFeedbackState *) ((char *) f + f->length);
- Feedback = (XFeedbackState *) ((char *) Feedback+Feedback->length);
- }
- XFree ((char *)sav);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Sav);
- }
-
-void XFreeFeedbackList (list)
- XFeedbackState *list;
- {
- XFree ((char *)list);
- }
diff --git a/xc/lib/Xi/XGetKMap.c b/xc/lib/Xi/XGetKMap.c
deleted file mode 100644
index f3a4d2e26..000000000
--- a/xc/lib/Xi/XGetKMap.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $TOG: XGetKMap.c /main/7 1998/02/06 15:03: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/lib/Xi/XGetKMap.c,v 3.1 1998/10/03 09:06:08 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceKeyMapping - get the keymap of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-KeySym
-#if NeedFunctionPrototypes
-*XGetDeviceKeyMapping (
- register Display *dpy,
- XDevice *dev,
-#if NeedWidePrototypes
- unsigned int first,
-#else
- KeyCode first,
-#endif
- int keycount,
- int *syms_per_code)
-#else
-*XGetDeviceKeyMapping (dpy, dev, first, keycount, syms_per_code)
- register Display *dpy;
- XDevice *dev;
- KeyCode first;
- int keycount;
- int *syms_per_code; /* RETURN */
-#endif
- {
- long nbytes;
- register KeySym *mapping = NULL;
- xGetDeviceKeyMappingReq *req;
- xGetDeviceKeyMappingReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((KeySym *) NoSuchExtension);
-
- GetReq(GetDeviceKeyMapping,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceKeyMapping;
- req->deviceid = dev->device_id;
- req->firstKeyCode = first;
- req->count = keycount;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (KeySym *) NULL;
- }
- if (rep.length > 0) {
- *syms_per_code = rep.keySymsPerKeyCode;
- nbytes = (long)rep.length << 2;
- mapping = (KeySym *) Xmalloc((unsigned) nbytes);
- if (mapping)
- _XRead (dpy, (char *)mapping, nbytes);
- else
- _XEatData (dpy, (unsigned long) nbytes);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (mapping);
- }
diff --git a/xc/lib/Xi/XGetMMap.c b/xc/lib/Xi/XGetMMap.c
deleted file mode 100644
index 69e151743..000000000
--- a/xc/lib/Xi/XGetMMap.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* $TOG: XGetMMap.c /main/6 1998/02/06 15:03:21 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/lib/Xi/XGetMMap.c,v 3.1 1998/10/03 09:06:09 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceModifierMapping - get the modifier map of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XModifierKeymap
-*XGetDeviceModifierMapping (dpy, dev)
- register Display *dpy;
- XDevice *dev;
- {
- unsigned long nbytes;
- XModifierKeymap *res;
- xGetDeviceModifierMappingReq *req;
- xGetDeviceModifierMappingReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XModifierKeymap *) NoSuchExtension);
-
- GetReq(GetDeviceModifierMapping,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceModifierMapping;
- req->deviceid = dev->device_id;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XModifierKeymap *) NULL;
- }
- nbytes = (unsigned long)rep.length << 2;
- res = (XModifierKeymap *) Xmalloc(sizeof (XModifierKeymap));
- if (res)
- {
- res->modifiermap = (KeyCode *) Xmalloc (nbytes);
- if (res->modifiermap)
- _XReadPad(dpy, (char *) res->modifiermap, nbytes);
- else
- _XEatData (dpy, (unsigned long) nbytes);
- res->max_keypermod = rep.numKeyPerModifier;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (res);
- }
diff --git a/xc/lib/Xi/XGetProp.c b/xc/lib/Xi/XGetProp.c
deleted file mode 100644
index 051e1d92d..000000000
--- a/xc/lib/Xi/XGetProp.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $TOG: XGetProp.c /main/9 1998/02/06 15:03:26 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/lib/Xi/XGetProp.c,v 3.1 1998/10/03 09:06:09 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceDontPropagateList - Get the dont_propagate_list for a
- * window.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XEventClass
-*XGetDeviceDontPropagateList (dpy, window, count)
- register Display *dpy;
- Window window;
- int *count;
- {
- XEventClass *list = NULL;
- int rlen;
- xGetDeviceDontPropagateListReq *req;
- xGetDeviceDontPropagateListReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XEventClass *) NoSuchExtension);
-
- GetReq(GetDeviceDontPropagateList,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceDontPropagateList;
- req->window = window;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XEventClass *) NULL;
- }
- *count = rep.count;
-
- if (*count)
- {
- rlen = rep.length << 2;
- list = (XEventClass *) Xmalloc (rlen);
- if (list)
- {
- int i;
- CARD32 ec;
-
- /* read and assign each XEventClass separately because
- * the library representation may not be the same size
- * as the wire representation (64 bit machines)
- */
- for (i = 0; i < rep.length; i++)
- {
- _XRead (dpy, (char *)(&ec), sizeof(CARD32));
- list[i] = (XEventClass)ec;
- }
- }
- else
- _XEatData (dpy, (unsigned long) rlen);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (list);
- }
-
diff --git a/xc/lib/Xi/XGetVers.c b/xc/lib/Xi/XGetVers.c
deleted file mode 100644
index abaa5785c..000000000
--- a/xc/lib/Xi/XGetVers.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $TOG: XGetVers.c /main/8 1998/02/06 15:03: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/lib/Xi/XGetVers.c,v 3.1 1998/10/03 09:06:09 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetExtensionVersion - Get the version of the input extension.
- *
- */
-
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XI.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XExtensionVersion
-#if NeedFunctionPrototypes
-*XGetExtensionVersion (
- register Display *dpy,
- _Xconst char *name)
-#else
-*XGetExtensionVersion (dpy, name)
- register Display *dpy;
- char *name;
-#endif
- {
- xGetExtensionVersionReq *req;
- xGetExtensionVersionReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, Dont_Check) == -1)
- return ((XExtensionVersion *) NoSuchExtension);
-
- GetReq(GetExtensionVersion,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetExtensionVersion;
- req->nbytes = name ? strlen(name) : 0;
- req->length += (unsigned)(req->nbytes+3)>>2;
- _XSend(dpy, name, (long)req->nbytes);
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XExtensionVersion *) NULL;
- }
- ext = (XExtensionVersion *) Xmalloc (sizeof (XExtensionVersion));
- if (ext)
- {
- ext->present = rep.present;
- if (ext->present)
- {
- ext->major_version = rep.major_version;
- ext->minor_version = rep.minor_version;
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return (ext);
- }
-
diff --git a/xc/lib/Xi/XGrDvBut.c b/xc/lib/Xi/XGrDvBut.c
deleted file mode 100644
index fedeed09a..000000000
--- a/xc/lib/Xi/XGrDvBut.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $TOG: XGrDvBut.c /main/8 1998/02/06 15:03: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/lib/Xi/XGrDvBut.c,v 3.2 1998/10/03 09:06:09 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGrabDeviceBut - Grab a button on an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XGrabDeviceButton (dpy, dev, button, modifiers, modifier_device,
- grab_window, owner_events, event_count, event_list, this_device_mode,
- other_devices_mode)
- register Display *dpy;
- XDevice *dev;
- unsigned int button; /* CARD8 */
- unsigned int modifiers; /* CARD16 */
- XDevice *modifier_device;
- Window grab_window;
- Bool owner_events;
- unsigned int event_count;
- XEventClass *event_list;
- int this_device_mode;
- int other_devices_mode;
- {
- register xGrabDeviceButtonReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(GrabDeviceButton, req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GrabDeviceButton;
- req->grabbed_device = dev->device_id;
- req->button = button;
- req->modifiers = modifiers;
- if (modifier_device)
- req->modifier_device = modifier_device->device_id;
- else
- req->modifier_device = UseXKeyboard;
- req->grabWindow = grab_window;
- req->ownerEvents = owner_events;
- req->event_count = event_count;
- req->this_device_mode = this_device_mode;
- req->other_devices_mode = other_devices_mode;
- req->length += event_count;
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "nvalues" is changed in a separate assignment
- statement */
-
- event_count <<= 2;
- Data32 (dpy, (long *) event_list, event_count);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XGrDvKey.c b/xc/lib/Xi/XGrDvKey.c
deleted file mode 100644
index e24323fc7..000000000
--- a/xc/lib/Xi/XGrDvKey.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $TOG: XGrDvKey.c /main/9 1998/02/06 15:04: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/lib/Xi/XGrDvKey.c,v 3.1 1998/10/03 09:06:10 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGrabDeviceKey - Grab a key on an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XGrabDeviceKey (dpy, dev, key, modifiers, modifier_device,
- grab_window, owner_events, event_count, event_list, this_device_mode,
- other_devices_mode)
- register Display *dpy;
- XDevice *dev;
- unsigned int key; /* CARD8 */
- unsigned int modifiers; /* CARD16 */
- XDevice *modifier_device;
- Window grab_window;
- Bool owner_events;
- unsigned int event_count;
- XEventClass *event_list;
- int this_device_mode;
- int other_devices_mode;
- {
- register xGrabDeviceKeyReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(GrabDeviceKey, req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GrabDeviceKey;
- req->grabbed_device = dev->device_id;
- req->key = key;
- req->modifiers = modifiers;
- if (modifier_device)
- req->modifier_device = modifier_device->device_id;
- else
- req->modifier_device = UseXKeyboard;
- req->grabWindow = grab_window;
- req->ownerEvents = owner_events;
- req->event_count = event_count;
- req->this_device_mode = this_device_mode;
- req->other_devices_mode = other_devices_mode;
- req->length += event_count;
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "nvalues" is changed in a separate assignment
- statement */
-
- if (event_count)
- {
- event_count <<= 2;
- Data32 (dpy, (long *) event_list, event_count);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XGrabDev.c b/xc/lib/Xi/XGrabDev.c
deleted file mode 100644
index beb363a6e..000000000
--- a/xc/lib/Xi/XGrabDev.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* $TOG: XGrabDev.c /main/7 1998/02/06 15:03: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/lib/Xi/XGrabDev.c,v 3.1 1998/10/03 09:06:10 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGrabDevice - grab an extension input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XGrabDevice (dpy, dev, grab_window, ownerEvents, event_count, event_list,
- this_device_mode, other_devices_mode, time)
- register Display *dpy;
- XDevice *dev;
- Window grab_window;
- Bool ownerEvents;
- int event_count;
- XEventClass *event_list;
- int this_device_mode;
- int other_devices_mode;
- Time time;
- {
- xGrabDeviceReply rep;
- register xGrabDeviceReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(GrabDevice,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GrabDevice;
-
- req->deviceid = dev->device_id;
- req->grabWindow = grab_window;
- req->ownerEvents = ownerEvents;
- req->event_count = event_count;
- req->this_device_mode = this_device_mode;
- req->other_devices_mode = other_devices_mode;
- req->time = time;
- req->length += event_count;
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "nvalues" is changed in a separate assignment
- statement */
-
- event_count <<= 2;
- Data32 (dpy, (long *) event_list, event_count);
-
- if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0)
- rep.status = GrabSuccess;
- UnlockDisplay(dpy);
- SyncHandle();
- return (rep.status);
- }
diff --git a/xc/lib/Xi/XGtFocus.c b/xc/lib/Xi/XGtFocus.c
deleted file mode 100644
index 70d91854f..000000000
--- a/xc/lib/Xi/XGtFocus.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* $TOG: XGtFocus.c /main/6 1998/02/06 15:04:06 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/lib/Xi/XGtFocus.c,v 3.1 1998/10/03 09:06:10 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetDeviceFocus - Get the focus of an input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XGetDeviceFocus (dpy, dev, focus, revert_to, time)
- register Display *dpy;
- XDevice *dev;
- Window *focus;
- int *revert_to;
- Time *time;
- {
- xGetDeviceFocusReq *req;
- xGetDeviceFocusReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(GetDeviceFocus,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetDeviceFocus;
- req->deviceid = dev->device_id;
-
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
- *focus = rep.focus;
- *revert_to = rep.revertTo;
- *time = rep.time;
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
-
diff --git a/xc/lib/Xi/XGtSelect.c b/xc/lib/Xi/XGtSelect.c
deleted file mode 100644
index 4ea0cf068..000000000
--- a/xc/lib/Xi/XGtSelect.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $TOG: XGtSelect.c /main/11 1998/02/06 15:04:11 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/lib/Xi/XGtSelect.c,v 3.1 1998/10/03 09:06:11 dawes Exp $ */
-
-/***********************************************************************
- *
- * XGetSelectedExtensionEvents - return a list of currently selected events.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XGetSelectedExtensionEvents (dpy, w, this_client_count, this_client_list,
- all_clients_count, all_clients_list)
- register Display *dpy;
- Window w;
- int *this_client_count;
- XEventClass **this_client_list;
- int *all_clients_count;
- XEventClass **all_clients_list;
- {
- int tlen, alen;
- register xGetSelectedExtensionEventsReq *req;
- xGetSelectedExtensionEventsReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
- GetReq(GetSelectedExtensionEvents,req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_GetSelectedExtensionEvents;
- req->window = w;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return Success;
- }
-
- *this_client_count = rep.this_client_count;
- *all_clients_count = rep.all_clients_count;
-
- if (rep.length)
- {
- int i;
- CARD32 ec;
- tlen = (*this_client_count) * sizeof(CARD32);
- alen = (rep.length << 2) - tlen;
-
- if (tlen)
- {
- *this_client_list = (XEventClass *) Xmalloc (
- *this_client_count * sizeof(XEventClass));
- if (!*this_client_list)
- {
- _XEatData (dpy, (unsigned long) tlen+alen);
- return (Success);
- }
- for (i = 0; i < *this_client_count; i++)
- {
- _XRead (dpy, (char *)(&ec), sizeof(CARD32));
- (*this_client_list)[i] = (XEventClass)ec;
- }
- }
- else
- *this_client_list = (XEventClass *) NULL;
- if (alen)
- {
- *all_clients_list = (XEventClass *) Xmalloc (
- *all_clients_count * sizeof(XEventClass));
- if (!*all_clients_list)
- {
- Xfree((char *)*this_client_list);
- *this_client_list = NULL;
- _XEatData (dpy, (unsigned long) alen);
- return (Success);
- }
- for (i = 0; i < *all_clients_count; i++)
- {
- _XRead (dpy, (char *)(&ec), sizeof(CARD32));
- (*all_clients_list)[i] = (XEventClass)ec;
- }
- }
- else
- *all_clients_list = (XEventClass *) NULL;
-
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XIint.h b/xc/lib/Xi/XIint.h
deleted file mode 100644
index 5c810b262..000000000
--- a/xc/lib/Xi/XIint.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $XFree86: xc/lib/Xi/XIint.h,v 3.0 1996/08/25 13:52:55 dawes Exp $ */
-
-/*
- * XIint.h - Header definition and support file for the internal
- * support routines used by the Xi library.
- */
-
-XExtDisplayInfo * XInput_find_display(
-#if NeedFunctionPrototypes
- Display*
-#endif
- );
diff --git a/xc/lib/Xi/XListDev.c b/xc/lib/Xi/XListDev.c
deleted file mode 100644
index 545a38ef6..000000000
--- a/xc/lib/Xi/XListDev.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* $TOG: XListDev.c /main/22 1998/04/30 15:52: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/lib/Xi/XListDev.c,v 3.1 1998/10/03 09:06:11 dawes Exp $ */
-
-/***********************************************************************
- *
- * XListInputDevices - Request the server to return a list of
- * available input devices.
- *
- */
-
-#define NEED_REPLIES
-#define NEED_EVENTS
-#include "Xlibint.h"
-#include "XIproto.h"
-#include "XI.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XDeviceInfo
-*XListInputDevices(dpy, ndevices)
- register Display *dpy;
- int *ndevices;
- {
- int size;
- xListInputDevicesReq *req;
- xListInputDevicesReply rep;
- xDeviceInfo *list, *slist;
- XDeviceInfo *sclist;
- XDeviceInfo *clist = NULL;
- xAnyClassPtr any, sav_any;
- XAnyClassPtr Any;
- char *nptr, *Nptr;
- register int i,j,k;
- register long rlen;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XDeviceInfo *) NULL);
-
- GetReq(ListInputDevices,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_ListInputDevices;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceInfo *) NULL;
- }
-
- if (*ndevices = rep.ndevices) /* at least 1 input device */
- {
- size = *ndevices * sizeof (XDeviceInfo);
- rlen = rep.length << 2; /* multiply length by 4 */
- list = (xDeviceInfo *) Xmalloc (rlen);
- slist = list;
- if (!slist)
- {
- _XEatData (dpy, (unsigned long) rlen);
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceInfo *) NULL;
- }
- _XRead (dpy, (char *)list, rlen);
-
- any = (xAnyClassPtr) ((char *) list +
- (*ndevices * sizeof(xDeviceInfo)));
- sav_any = any;
- for (i=0; i<*ndevices; i++, list++)
- {
- for (j=0; j<(int)list->num_classes; j++)
- {
- switch (any->class)
- {
- case KeyClass:
- size += sizeof (XKeyInfo);
- break;
- case ButtonClass:
- size += sizeof (XButtonInfo);
- break;
- case ValuatorClass:
- {
- xValuatorInfoPtr v;
- v = (xValuatorInfoPtr) any;
- size += sizeof (XValuatorInfo) +
- (v->num_axes * sizeof (XAxisInfo));
- break;
- }
- default:
- break;
- }
- any = (xAnyClassPtr) ((char *) any + any->length);
- }
- }
-
- for (i=0, nptr = (char *) any; i<*ndevices; i++)
- {
- size += *nptr +1;
- nptr += (*nptr + 1);
- }
-
- clist = (XDeviceInfoPtr) Xmalloc (size);
- if (!clist)
- {
- XFree ((char *)slist);
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceInfo *) NULL;
- }
- sclist = clist;
- Any = (XAnyClassPtr) ((char *) clist +
- (*ndevices * sizeof (XDeviceInfo)));
- list = slist;
- any = sav_any;
- for (i=0; i<*ndevices; i++, list++, clist++)
- {
- clist->type = list->type;
- clist->id = list->id;
- clist->use = list->use;
- clist->num_classes = list->num_classes;
- clist->inputclassinfo = Any;
- for (j=0; j<(int)list->num_classes; j++)
- {
- switch (any->class)
- {
- case KeyClass:
- {
- XKeyInfoPtr K = (XKeyInfoPtr) Any;
- xKeyInfoPtr k = (xKeyInfoPtr) any;
- K->class = KeyClass;
- K->length = sizeof (XKeyInfo);
- K->min_keycode = k->min_keycode;
- K->max_keycode = k->max_keycode;
- K->num_keys = k->num_keys;
- break;
- }
- case ButtonClass:
- {
- XButtonInfoPtr B = (XButtonInfoPtr) Any;
- xButtonInfoPtr b = (xButtonInfoPtr) any;
- B->class = ButtonClass;
- B->length = sizeof (XButtonInfo);
- B->num_buttons = b->num_buttons;
- break;
- }
- case ValuatorClass:
- {
- XValuatorInfoPtr V = (XValuatorInfoPtr) Any;
- xValuatorInfoPtr v = (xValuatorInfoPtr) any;
- XAxisInfoPtr A;
- xAxisInfoPtr a;
-
- V->class = ValuatorClass;
- V->length = sizeof (XValuatorInfo) +
- (v->num_axes * sizeof (XAxisInfo));
- V->num_axes = v->num_axes;
- V->motion_buffer = v->motion_buffer_size;
- V->mode = v->mode;
- A = (XAxisInfoPtr) ((char *) V + sizeof(XValuatorInfo));
- V->axes = A;
- a = (xAxisInfoPtr) ((char *) any +
- sizeof (xValuatorInfo));
- for (k=0; k<(int)v->num_axes; k++,a++,A++)
- {
- A->min_value = a->min_value;
- A->max_value = a->max_value;
- A->resolution = a->resolution;
- }
- break;
- }
- default:
- break;
- }
- any = (xAnyClassPtr) ((char *) any + any->length);
- Any = (XAnyClassPtr) ((char *) Any + Any->length);
- }
- }
-
- clist = sclist;
- nptr = (char *) any;
- Nptr = (char *) Any;
- for (i=0; i<*ndevices; i++,clist++)
- {
- clist->name = (char *) Nptr;
- memcpy (Nptr, nptr+1, *nptr);
- Nptr += (*nptr);
- *Nptr++ = '\0';
- nptr += (*nptr + 1);
- }
- }
-
- XFree ((char *)slist);
- UnlockDisplay(dpy);
- SyncHandle();
- return (sclist);
- }
-
-/***********************************************************************
- *
- * Free the list of input devices.
- *
- */
-
-void XFreeDeviceList (list)
- XDeviceInfo *list;
- {
- if (list != NULL)
- {
- XFree ((char *) list);
- }
- }
diff --git a/xc/lib/Xi/XOpenDev.c b/xc/lib/Xi/XOpenDev.c
deleted file mode 100644
index 3d0bc0daa..000000000
--- a/xc/lib/Xi/XOpenDev.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* $TOG: XOpenDev.c /main/11 1998/02/06 15:04: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/lib/Xi/XOpenDev.c,v 3.1 1998/10/03 09:06:11 dawes Exp $ */
-
-/***********************************************************************
- *
- * XOpenDevice - Request the server to open and extension input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XDevice
-*XOpenDevice(dpy, id)
- register Display *dpy;
- register XID id;
- {
- register long rlen; /* raw length */
- xOpenDeviceReq *req;
- xOpenDeviceReply rep;
- XDevice *dev;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XDevice *) NoSuchExtension);
-
- GetReq(OpenDevice,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_OpenDevice;
- req->deviceid = id;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDevice *) NULL;
- }
-
- rlen = rep.length << 2;
- dev = (XDevice *) Xmalloc (sizeof(XDevice) + rep.num_classes *
- sizeof (XInputClassInfo));
- if (dev)
- {
- int dlen; /* data length */
-
- dev->device_id = req->deviceid;
- dev->num_classes = rep.num_classes;
- dev->classes = (XInputClassInfo *) ((char *) dev + sizeof (XDevice));
- dlen = rep.num_classes * sizeof(xInputClassInfo);
- _XRead (dpy, (char *)dev->classes, dlen);
- /* could be padding that we still need to eat (yummy!) */
- if(rlen - dlen > 0)
- _XEatData (dpy, (unsigned long) rlen - dlen);
- }
- else
- _XEatData (dpy, (unsigned long) rlen);
-
- UnlockDisplay (dpy);
- SyncHandle();
- return (dev);
- }
-
diff --git a/xc/lib/Xi/XQueryDv.c b/xc/lib/Xi/XQueryDv.c
deleted file mode 100644
index 30f955df3..000000000
--- a/xc/lib/Xi/XQueryDv.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $TOG: XQueryDv.c /main/13 1998/04/30 15:52: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/lib/Xi/XQueryDv.c,v 3.1 1998/10/03 09:06:12 dawes Exp $ */
-
-/***********************************************************************
- *
- * XQueryDeviceState - Query the state of an extension input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-XDeviceState
-*XQueryDeviceState (dpy, dev)
- register Display *dpy;
- XDevice *dev;
- {
- int i,j;
- int rlen;
- int size = 0;
- xQueryDeviceStateReq *req;
- xQueryDeviceStateReply rep;
- XDeviceState *state = NULL;
- XInputClass *any, *Any;
- char *data;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return ((XDeviceState *) NoSuchExtension);
-
- GetReq(QueryDeviceState,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_QueryDeviceState;
- req->deviceid = dev->device_id;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return (XDeviceState *) NULL;
- }
-
- rlen = rep.length << 2;
- if (rlen > 0)
- {
- data = Xmalloc (rlen);
- if (!data)
- {
- _XEatData (dpy, (unsigned long) rlen);
- UnlockDisplay(dpy);
- SyncHandle();
- return ((XDeviceState *) NULL);
- }
- _XRead (dpy, data, rlen);
-
- for (i=0, any=(XInputClass *) data; i<(int)rep.num_classes; i++)
- {
- switch (any->class)
- {
- case KeyClass:
- size += sizeof (XKeyState);
- break;
- case ButtonClass:
- size += sizeof (XButtonState);
- break;
- case ValuatorClass:
- {
- xValuatorState *v = (xValuatorState *) any;
- size += (sizeof (XValuatorState) +
- (v->num_valuators * sizeof(int)));
- }
- break;
- }
- any = (XInputClass *) ((char *) any + any->length);
- }
- state = (XDeviceState *) Xmalloc (size + sizeof(XDeviceState));
- if (!state)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return ((XDeviceState *) NULL);
- }
- state->device_id = dev->device_id;
- state->num_classes = rep.num_classes;
- state->data = (XInputClass *) (state + 1);
-
- Any = state->data;
- for (i=0, any=(XInputClass *) data; i<(int)rep.num_classes; i++)
- {
- switch (any->class)
- {
- case KeyClass:
- {
- xKeyState *k = (xKeyState *) any;
- XKeyState *K = (XKeyState *) Any;
- K->class = k->class;
- K->length = sizeof (XKeyState);
- K->num_keys = k->num_keys;
- memcpy ((char *) &K->keys[0], (char *) &k->keys[0], 32);
- Any = (XInputClass *) (K+1);
- }
- break;
- case ButtonClass:
- {
- xButtonState *b = (xButtonState *) any;
- XButtonState *B = (XButtonState *) Any;
- B->class = b->class;
- B->length = sizeof (XButtonState);
- B->num_buttons = b->num_buttons;
- memcpy ((char *) &B->buttons[0], (char *) &b->buttons[0],
- 32);
- Any = (XInputClass *) (B+1);
- }
- break;
- case ValuatorClass:
- {
- xValuatorState *v = (xValuatorState *) any;
- XValuatorState *V = (XValuatorState *) Any;
- CARD32 *valuators = (CARD32 *) (v+1);
- V->class = v->class;
- V->length = sizeof (XValuatorState);
- V->num_valuators = v->num_valuators;
- V->mode = v->mode;
- Any = (XInputClass *) (V+1);
- V->valuators = (int *) Any;
- for (j=0; j<(int)V->num_valuators; j++)
- *(V->valuators + j) = *valuators++;
- Any = (XInputClass *)((char *) Any +
- V->num_valuators * sizeof (int));
- }
- break;
- }
- any = (XInputClass *) ((char *) any + any->length);
- }
- Xfree(data);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (state);
- }
-
-void XFreeDeviceState (list)
- XDeviceState *list;
- {
- XFree ((char *)list);
- }
diff --git a/xc/lib/Xi/XSelect.c b/xc/lib/Xi/XSelect.c
deleted file mode 100644
index 8eed2c7cd..000000000
--- a/xc/lib/Xi/XSelect.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $TOG: XSelect.c /main/6 1998/02/06 15:04: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/lib/Xi/XSelect.c,v 3.1 1998/10/03 09:06:12 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSelectExtensionEvent - Select input from an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XSelectExtensionEvent (dpy, w, event_list, count)
- register Display *dpy;
- Window w;
- XEventClass *event_list;
- int count;
- {
- register xSelectExtensionEventReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy,XInput_Initial_Release) == -1)
- return (NoSuchExtension);
- GetReq(SelectExtensionEvent,req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SelectExtensionEvent;
- req->window = w;
- req->count = count;
- req->length += count;
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "nvalues" is changed in a separate assignment
- statement */
-
- count <<= 2;
- Data (dpy, (char *) event_list, count);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XSetBMap.c b/xc/lib/Xi/XSetBMap.c
deleted file mode 100644
index c8f581950..000000000
--- a/xc/lib/Xi/XSetBMap.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $TOG: XSetBMap.c /main/5 1998/02/06 15:04: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/lib/Xi/XSetBMap.c,v 3.1 1998/10/03 09:06:12 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSetDeviceButtonMapping - Set the button mapping of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-#define NEED_REPLIES
-
-/* returns either DeviceMappingSuccess or DeviceMappingBusy */
-
-int
-XSetDeviceButtonMapping (dpy, device, map, nmap)
- register Display *dpy;
- XDevice *device;
- unsigned char map[];
- int nmap;
- {
- register xSetDeviceButtonMappingReq *req;
- xSetDeviceButtonMappingReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay(dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
- GetReq (SetDeviceButtonMapping, req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SetDeviceButtonMapping;
- req->map_length = nmap;
- req->length += (nmap + 3)>>2;
- req->deviceid = device->device_id;
-
- Data (dpy, (char *)map, (long) nmap); /* note that map is char[] */
- if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) /* suppress error */
- rep.status = MappingSuccess;
- UnlockDisplay(dpy);
- SyncHandle();
- return ((int) rep.status);
- }
diff --git a/xc/lib/Xi/XSetDVal.c b/xc/lib/Xi/XSetDVal.c
deleted file mode 100644
index 768636301..000000000
--- a/xc/lib/Xi/XSetDVal.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* $TOG: XSetDVal.c /main/4 1998/02/06 15:04: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.
-
-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/lib/Xi/XSetDVal.c,v 3.1 1998/10/03 09:06:14 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSetDeviceValuators - Set the value of valuators on an extension input
- * device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XSetDeviceValuators (dpy, dev, valuators, first_valuator, num_valuators)
- register Display *dpy;
- XDevice *dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
- {
- xSetDeviceValuatorsReq *req;
- xSetDeviceValuatorsReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators) == -1)
- return (NoSuchExtension);
-
- GetReq(SetDeviceValuators,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SetDeviceValuators;
- req->deviceid = dev->device_id;
- req->first_valuator = first_valuator;
- req->num_valuators = num_valuators;
- req->length += num_valuators;
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "nvalues" is changed in a separate assignment
- statement */
-
- num_valuators <<= 2;
- Data (dpy, (char *) valuators, num_valuators);
-
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
- UnlockDisplay(dpy);
- SyncHandle();
- return (rep.status);
- }
-
diff --git a/xc/lib/Xi/XSetMMap.c b/xc/lib/Xi/XSetMMap.c
deleted file mode 100644
index 192ad6392..000000000
--- a/xc/lib/Xi/XSetMMap.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $TOG: XSetMMap.c /main/7 1998/02/06 15:04:51 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/lib/Xi/XSetMMap.c,v 3.1 1998/10/03 09:06:14 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSetDeviceModifierMapping - set the modifier map of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XSetDeviceModifierMapping (dpy, dev, modmap)
- register Display *dpy;
- XDevice *dev;
- XModifierKeymap *modmap;
- {
- int mapSize = modmap->max_keypermod << 3; /* 8 modifiers */
- xSetDeviceModifierMappingReq *req;
- xSetDeviceModifierMappingReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReqExtra(SetDeviceModifierMapping, mapSize, req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SetDeviceModifierMapping;
- req->deviceid = dev->device_id;
- req->numKeyPerModifier = modmap->max_keypermod;
- memcpy((char *)&req[1], modmap->modifiermap, mapSize);
-
- (void) _XReply(dpy, (xReply *) &rep,
- (sizeof(xSetDeviceModifierMappingReply) - sizeof(xReply)) >> 2, xTrue);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (rep.success);
- }
diff --git a/xc/lib/Xi/XSetMode.c b/xc/lib/Xi/XSetMode.c
deleted file mode 100644
index 8cd484d24..000000000
--- a/xc/lib/Xi/XSetMode.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $TOG: XSetMode.c /main/8 1998/02/06 15:04: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/lib/Xi/XSetMode.c,v 3.1 1998/10/03 09:06:14 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSetDeviceMode - Set the mode of an extension input device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XSetDeviceMode (dpy, dev, mode)
- register Display *dpy;
- XDevice *dev;
- int mode;
- {
- xSetDeviceModeReq *req;
- xSetDeviceModeReply rep;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(SetDeviceMode,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SetDeviceMode;
- req->deviceid = dev->device_id;
- req->mode = mode;
-
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
- UnlockDisplay(dpy);
- SyncHandle();
- return (rep.status);
- }
-
diff --git a/xc/lib/Xi/XSndExEv.c b/xc/lib/Xi/XSndExEv.c
deleted file mode 100644
index a1ee390e2..000000000
--- a/xc/lib/Xi/XSndExEv.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $TOG: XSndExEv.c /main/8 1998/02/06 15:05:03 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/lib/Xi/XSndExEv.c,v 3.1 1998/10/03 09:06:14 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSendExtensionEvent - send an extension event to a client.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-extern Status _XiEventToWire();
-
-Status
-XSendExtensionEvent (dpy, dev, dest, prop, count, list, event)
- register Display *dpy;
- XDevice *dev;
- Window dest;
- Bool prop;
- int count;
- XEventClass *list;
- XEvent *event;
- {
- int num_events;
- int ev_size;
- xSendExtensionEventReq *req;
- xEvent *ev;
- register Status (**fp)();
- Status status;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- /* call through display to find proper conversion routine */
-
- fp = &dpy->wire_vec[event->type & 0177];
- if (*fp == NULL)
- *fp = _XiEventToWire;
- status = (**fp)(dpy, event, &ev, &num_events);
-
- if (status)
- {
- GetReq(SendExtensionEvent,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SendExtensionEvent;
- req->deviceid = dev->device_id;
- req->destination = dest;
- req->propagate = prop;
- req->count = count;
- req->num_events = num_events;
- ev_size = num_events * sizeof (xEvent);
- req->length += (count + (ev_size >> 2));
-
- /* note: Data is a macro that uses its arguments multiple
- times, so "count" is changed in a separate assignment
- statement. Any extra events must be sent before the event
- list, in order to ensure quad alignment. */
-
- Data (dpy, (char *) ev, ev_size);
-
- count <<= 2;
- Data32 (dpy, (long *) list, count);
- XFree ((char *)ev);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (status);
- }
-
diff --git a/xc/lib/Xi/XStFocus.c b/xc/lib/Xi/XStFocus.c
deleted file mode 100644
index 166df78bf..000000000
--- a/xc/lib/Xi/XStFocus.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $TOG: XStFocus.c /main/4 1998/02/06 15:05: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/lib/Xi/XStFocus.c,v 3.1 1998/10/03 09:06:15 dawes Exp $ */
-
-/***********************************************************************
- *
- * XSetDeviceFocus - Set the focus of an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XSetDeviceFocus(dpy, dev, focus, revert_to, time)
- register Display *dpy;
- XDevice *dev;
- Window focus;
- int revert_to;
- Time time;
- {
- xSetDeviceFocusReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
-
- GetReq(SetDeviceFocus,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_SetDeviceFocus;
- req->device = dev->device_id;
- req->focus = focus;
- req->revertTo = revert_to;
- req->time = time;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XUngrDev.c b/xc/lib/Xi/XUngrDev.c
deleted file mode 100644
index 4d39c3911..000000000
--- a/xc/lib/Xi/XUngrDev.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $TOG: XUngrDev.c /main/5 1998/02/06 15:05: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/lib/Xi/XUngrDev.c,v 3.1 1998/10/03 09:06:15 dawes Exp $ */
-
-/***********************************************************************
- *
- * XUngrabDevice - Ungrab an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XUngrabDevice (dpy, dev, time)
- register Display *dpy;
- XDevice *dev;
- Time time;
- {
- register xUngrabDeviceReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay (dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
-
- GetReq(UngrabDevice,req);
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_UngrabDevice;
-
- req->deviceid = dev->device_id;
- req->time = time;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XUngrDvB.c b/xc/lib/Xi/XUngrDvB.c
deleted file mode 100644
index a6536474d..000000000
--- a/xc/lib/Xi/XUngrDvB.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $TOG: XUngrDvB.c /main/7 1998/02/06 15:05: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/lib/Xi/XUngrDvB.c,v 3.1 1998/10/03 09:06:15 dawes Exp $ */
-
-/***********************************************************************
- *
- * XUngrabDeviceButton - Ungrab a button on an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XUngrabDeviceButton(dpy, dev, button, modifiers, modifier_dev, grab_window)
- register Display *dpy;
- XDevice *dev;
- unsigned int button; /* CARD8 */
- unsigned int modifiers; /* CARD16 */
- XDevice *modifier_dev;
- Window grab_window;
- {
- register xUngrabDeviceButtonReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay(dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
- GetReq(UngrabDeviceButton, req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_UngrabDeviceButton;
- req->grabbed_device = dev->device_id;
- req->button = button;
- req->modifiers = modifiers;
- if (modifier_dev)
- req->modifier_device = modifier_dev->device_id;
- else
- req->modifier_device = UseXKeyboard;
- req->grabWindow = grab_window;
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/XUngrDvK.c b/xc/lib/Xi/XUngrDvK.c
deleted file mode 100644
index 4ba0ee976..000000000
--- a/xc/lib/Xi/XUngrDvK.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $TOG: XUngrDvK.c /main/7 1998/02/06 15:05: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.
-
-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/lib/Xi/XUngrDvK.c,v 3.1 1998/10/03 09:06:16 dawes Exp $ */
-
-/***********************************************************************
- *
- * XUngrabDeviceKey - Ungrab a key on an extension device.
- *
- */
-
-#include "XI.h"
-#include "XIproto.h"
-#include "Xlibint.h"
-#include "XInput.h"
-#include "extutil.h"
-#include "XIint.h"
-
-int
-XUngrabDeviceKey (dpy, dev, key, modifiers, modifier_dev, grab_window)
- register Display *dpy;
- XDevice *dev;
- unsigned int key; /* CARD8 */
- unsigned int modifiers; /* CARD16 */
- XDevice *modifier_dev;
- Window grab_window;
- {
- register xUngrabDeviceKeyReq *req;
- XExtDisplayInfo *info = XInput_find_display (dpy);
-
- LockDisplay(dpy);
- if (_XiCheckExtInit(dpy, XInput_Initial_Release) == -1)
- return (NoSuchExtension);
- GetReq(UngrabDeviceKey, req);
-
- req->reqType = info->codes->major_opcode;
- req->ReqType = X_UngrabDeviceKey;
- req->grabbed_device = dev->device_id;
- req->key = key;
- req->modifiers = modifiers;
- if (modifier_dev)
- req->modifier_device = modifier_dev->device_id;
- else
- req->modifier_device = UseXKeyboard;
- req->grabWindow = grab_window;
- UnlockDisplay(dpy);
- SyncHandle();
- return (Success);
- }
diff --git a/xc/lib/Xi/Xi-def.cpp b/xc/lib/Xi/Xi-def.cpp
deleted file mode 100644
index b9ef6ba73..000000000
--- a/xc/lib/Xi/Xi-def.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-LIBRARY XI
-VERSION LIBRARY_VERSION
-EXPORTS
- XAllowDeviceEvents
- XChangeDeviceControl
- XChangeDeviceDontPropagateList
- XChangeDeviceKeyMapping
- XChangeFeedbackControl
- XChangeKeyboardDevice
- XChangePointerDevice
- XCloseDevice
- XDeviceBell
- XFreeDeviceControl
- XFreeDeviceList
- XFreeDeviceMotionEvents
- XFreeDeviceState
- XFreeFeedbackList
- XGetDeviceButtonMapping
- XGetDeviceControl
- XGetDeviceDontPropagateList
- XGetDeviceFocus
- XGetDeviceKeyMapping
- XGetDeviceModifierMapping
- XGetDeviceMotionEvents
- XGetExtensionVersion
- XGetFeedbackControl
- XGetSelectedExtensionEvents
- XGrabDevice
- XGrabDeviceButton
- XGrabDeviceKey
- XListInputDevices
- XOpenDevice
- XQueryDeviceState
- XSelectExtensionEvent
- XSendExtensionEvent
- XSetDeviceButtonMapping
- XSetDeviceFocus
- XSetDeviceMode
- XSetDeviceModifierMapping
- XSetDeviceValuators
- XUngrabDevice
- XUngrabDeviceButton
- XUngrabDeviceKey
- _xibadclass
- _xibaddevice
- _xibadevent
- _xibadmode
- _xidevicebusy
-/* $XConsortium: Xi-def.cpp /main/3 1996/05/07 13:15:35 kaleb $ */
diff --git a/xc/lib/Xi/Xios2.def b/xc/lib/Xi/Xios2.def
deleted file mode 100644
index be668a960..000000000
--- a/xc/lib/Xi/Xios2.def
+++ /dev/null
@@ -1,53 +0,0 @@
-LIBRARY XI
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xi/Xios2.def,v 3.6 1999/04/29 09:13:31 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- XAllowDeviceEvents @ 1
- XChangeDeviceControl @ 2
- XChangeDeviceDontPropagateList @ 3
- XChangeDeviceKeyMapping @ 4
- XChangeFeedbackControl @ 5
- XChangeKeyboardDevice @ 6
- XChangePointerDevice @ 7
- XCloseDevice @ 8
- XDeviceBell @ 9
- XFreeDeviceControl @ 10
- XFreeDeviceList @ 11
- XFreeDeviceMotionEvents @ 12
- XFreeDeviceState @ 13
- XFreeFeedbackList @ 14
- XGetDeviceButtonMapping @ 15
- XGetDeviceControl @ 16
- XGetDeviceDontPropagateList @ 17
- XGetDeviceFocus @ 18
- XGetDeviceKeyMapping @ 19
- XGetDeviceModifierMapping @ 20
- XGetDeviceMotionEvents @ 21
- XGetExtensionVersion @ 22
- XGetFeedbackControl @ 23
- XGetSelectedExtensionEvents @ 24
- XGrabDevice @ 25
- XGrabDeviceButton @ 26
- XGrabDeviceKey @ 27
- XListInputDevices @ 28
- XOpenDevice @ 29
- XQueryDeviceState @ 30
- XSelectExtensionEvent @ 31
- XSendExtensionEvent @ 32
- XSetDeviceButtonMapping @ 33
- XSetDeviceFocus @ 34
- XSetDeviceMode @ 35
- XSetDeviceModifierMapping @ 36
- XSetDeviceValuators @ 37
- XUngrabDevice @ 38
- XUngrabDeviceButton @ 39
- XUngrabDeviceKey @ 40
- _xibadclass @ 41
- _xibaddevice @ 42
- _xibadevent @ 43
- _xibadmode @ 44
- _xidevicebusy @ 45
diff --git a/xc/lib/Xi/Xios2.rsp b/xc/lib/Xi/Xios2.rsp
deleted file mode 100644
index e56c36250..000000000
--- a/xc/lib/Xi/Xios2.rsp
+++ /dev/null
@@ -1,9 +0,0 @@
-XAllowDv.obj XChgDCtl.obj XChgFCtl.obj XChgKMap.obj XChgKbd.obj XChgPnt.obj+
-XChgProp.obj XCloseDev.obj XDevBell.obj XExtInt.obj XExtToWire.obj+
-XGMotion.obj XGetBMap.obj XGetDCtl.obj XGetFCtl.obj XGetKMap.obj+
-XGetMMap.obj XGetProp.obj XGetVers.obj XGrDvBut.obj XGrDvKey.obj XGrabDev.obj+
-XGtFocus.obj XGtSelect.obj XListDev.obj XOpenDev.obj XQueryDv.obj XSelect.obj+
-XSetBMap.obj XSetDVal.obj XSetMMap.obj XSetMode.obj XSndExEv.obj XStFocus.obj+
-XUngrDev.obj XUngrDvB.obj XUngrDvK.obj /NOI /NOL /NOD /BAT
-Xi.dll
-
diff --git a/xc/lib/Xinerama/Imakefile b/xc/lib/Xinerama/Imakefile
deleted file mode 100644
index 1c4854f34..000000000
--- a/xc/lib/Xinerama/Imakefile
+++ /dev/null
@@ -1,29 +0,0 @@
-XCOMM $XFree86: xc/lib/Xinerama/Imakefile,v 1.2 2000/02/29 18:38:42 dawes Exp $
-
-#define DoNormalLib NormalLibXinerama
-#define DoSharedLib SharedLibXinerama
-#define DoDebugLib DebugLibXinerama
-#define DoProfileLib ProfileLibXinerama
-#define LibName Xinerama
-#define SoRev SOXINERAMAREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXineramaReqs
-REQUIREDLIBS = SharedXineramaReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = Xinerama.c
- OBJS = Xinerama.o
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xinerama/Xinerama.c b/xc/lib/Xinerama/Xinerama.c
deleted file mode 100644
index 72970c613..000000000
--- a/xc/lib/Xinerama/Xinerama.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $TOG: XPanoramiX.c /main/2 1997/11/16 08:45:41 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/lib/Xinerama/Xinerama.c,v 1.1 2000/02/27 23:10:04 mvojkovi Exp $ */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include "Xext.h" /* in ../include */
-#include "extutil.h" /* in ../include */
-#include "panoramiXext.h"
-#include "panoramiXproto.h" /* in ../include */
-#include "Xinerama.h"
-
-
-static XExtensionInfo _panoramiX_ext_info_data;
-static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data;
-static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME;
-
-#define PanoramiXCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, panoramiX_extension_name, val)
-#define PanoramiXSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, panoramiX_extension_name)
-
-static int close_display();
-static /* const */ XExtensionHooks panoramiX_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info,
- panoramiX_extension_name,
- &panoramiX_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info)
-
-
-
-/****************************************************************************
- * *
- * PanoramiX public interfaces *
- * *
- ****************************************************************************/
-
-Bool XPanoramiXQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XPanoramiXQueryVersion(
- Display *dpy,
- int *major_versionp,
- int *minor_versionp
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXQueryVersionReply rep;
- register xPanoramiXQueryVersionReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXQueryVersion;
- req->clientMajor = PANORAMIX_MAJOR_VERSION;
- req->clientMinor = PANORAMIX_MINOR_VERSION;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-XPanoramiXInfo *XPanoramiXAllocInfo(void)
-{
- return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo));
-}
-
-Status XPanoramiXGetState (
- Display *dpy,
- Drawable drawable,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetStateReply rep;
- register xPanoramiXGetStateReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetState, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetState;
- req->window = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->State = rep.state;
- return 1;
-}
-
-Status XPanoramiXGetScreenCount (
- Display *dpy,
- Drawable drawable,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetScreenCountReply rep;
- register xPanoramiXGetScreenCountReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetScreenCount, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetScreenCount;
- req->window = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->ScreenCount = rep.ScreenCount;
- return 1;
-}
-
-Status XPanoramiXGetScreenSize (
- Display *dpy,
- Drawable drawable,
- int screen_num,
- XPanoramiXInfo *panoramiX_info
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xPanoramiXGetScreenSizeReply rep;
- register xPanoramiXGetScreenSizeReq *req;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (PanoramiXGetScreenSize, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_PanoramiXGetScreenSize;
- req->window = drawable;
- req->screen = screen_num; /* need to define */
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- panoramiX_info->window = rep.window;
- panoramiX_info->screen = rep.screen;
- panoramiX_info->width = rep.width;
- panoramiX_info->height = rep.height;
- return 1;
-}
-
-/*******************************************************************\
- Alternate interface to make up for shortcomings in the original,
- namely, the omission of the screen origin. The new interface is
- in the "Xinerama" namespace instead of "PanoramiX".
-\*******************************************************************/
-
-Bool XineramaQueryExtension (
- Display *dpy,
- int *event_base,
- int *error_base
-)
-{
- return XPanoramiXQueryExtension(dpy, event_base, error_base);
-}
-
-Status XineramaQueryVersion(
- Display *dpy,
- int *major,
- int *minor
-)
-{
- return XPanoramiXQueryVersion(dpy, major, minor);
-}
-
-Bool XineramaIsActive(Display *dpy)
-{
- xXineramaIsActiveReply rep;
- xXineramaIsActiveReq *req;
- XExtDisplayInfo *info = find_display (dpy);
-
- if(!XextHasExtension(info))
- return False; /* server doesn't even have the extension */
-
- LockDisplay (dpy);
- GetReq (XineramaIsActive, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaIsActive;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return False;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return rep.state;
-}
-
-#include <stdio.h>
-
-XineramaScreenInfo *
-XineramaQueryScreens(
- Display *dpy,
- int *number
-)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXineramaQueryScreensReply rep;
- xXineramaQueryScreensReq *req;
- XineramaScreenInfo *scrnInfo = NULL;
-
- PanoramiXCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (XineramaQueryScreens, req);
- req->reqType = info->codes->major_opcode;
- req->panoramiXReqType = X_XineramaQueryScreens;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- if(rep.number) {
- if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) {
- xXineramaScreenInfo scratch;
- int i;
-
- for(i = 0; i < rep.number; i++) {
- _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo);
- scrnInfo[i].screen_number = i;
- scrnInfo[i].x_org = scratch.x_org;
- scrnInfo[i].y_org = scratch.y_org;
- scrnInfo[i].width = scratch.width;
- scrnInfo[i].height = scratch.height;
- }
-
- *number = rep.number;
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return scrnInfo;
-}
-
-
-
diff --git a/xc/lib/Xmu/AllCmap.c b/xc/lib/Xmu/AllCmap.c
deleted file mode 100644
index f0e3dad09..000000000
--- a/xc/lib/Xmu/AllCmap.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $TOG: AllCmap.c /main/8 1998/02/06 15:40: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/AllCmap.c,v 1.6 1999/03/21 07:34:35 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-static XVisualInfo *getDeepestVisual(int, XVisualInfo*, int);
-
-/*
- * To create all of the appropriate standard colormaps for every visual of
- * every screen on a given display, use XmuAllStandardColormaps.
- *
- * Define and retain as permanent resources all standard colormaps which are
- * meaningful for the visuals of each screen of the display. Return 0 on
- * failure, non-zero on success. If the property of any standard colormap
- * is already defined, redefine it.
- *
- * This interface is intended to be used by window managers or a client
- * upon start-up of a session.
- *
- * The standard colormaps of a screen are defined by properties associated
- * with the screen's root window. Each screen has exactly one root window.
- * The property names of standard colormaps are predefined, and each property
- * name may describe at most one colormap.
- *
- * The standard colormaps are
- * RGB_BEST_MAP
- * RGB_RED_MAP
- * RGB_GREEN_MAP
- * RGB_BLUE_MAP
- * RGB_DEFAULT_MAP
- * RGB_GRAY_MAP
- *
- * Therefore a screen may have at most 6 standard colormap properties defined.
- *
- * A standard colormap is associated with a particular visual of the screen.
- * A screen may have multiple visuals defined, including visuals of the same
- * class at different depths. Note that a visual id might be repeated for
- * more than one depth, so the visual id and the depth of a visual identify
- * the visual. The characteristics of the visual will determine which
- * standard colormaps are meaningful under that visual, and will determine
- * how the standard colormap is defined. Because a standard colormap is
- * associated with a specific visual, there must be a method of determining
- * which visuals take precedence in defining standard colormaps.
- *
- * The method used here is: for the visual of greatest depth, define all
- * standard colormaps meaningful to that visual class, according to this
- * order of (descending) precedence:
- * 1. DirectColor
- * 2. PseudoColor
- * 3. TrueColor and GrayScale
- * 4. StaticColor and StaticGray
- *
- * Allows partial success by screenful. For example, if a map on screen 1
- * fails, the maps on screen 0, created earlier, will remain. However,
- * none on screen 1 will remain. If a map on 0 fails, none will remain.
- *
- * See the comments under XmuVisualStandardColormaps() for notes on which
- * standard colormaps are meaningful under these classes of visuals.
- */
-
-Status
-XmuAllStandardColormaps(Display *dpy)
-{
- int nvisuals, scr;
- Status status;
- long vinfo_mask;
- XVisualInfo template, *vinfo, *v1, *v2;
-
- status = 0;
- /* for each screen, determine all visuals of this server */
- for (scr=0; scr < ScreenCount(dpy); scr++)
- {
- template.screen = scr;
- vinfo_mask = VisualScreenMask;
- vinfo = XGetVisualInfo(dpy, vinfo_mask, &template, &nvisuals);
- if (vinfo == NULL) /* unexpected: a screen with no visuals */
- continue;
-
- v1 = getDeepestVisual(DirectColor, vinfo, nvisuals);
- v2 = getDeepestVisual(PseudoColor, vinfo, nvisuals);
-
- if (v2 &&
- (!v1 || (v2->colormap_size >=
- ((v1->red_mask | v1->green_mask | v1->blue_mask) + 1))))
- status = XmuVisualStandardColormaps(dpy, scr, v2->visualid,
- (unsigned) v2->depth, 1, 1);
- else if (v1)
- status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
- (unsigned) v1->depth, 1, 1);
-
- else {
- if (((v1 = getDeepestVisual(TrueColor, vinfo, nvisuals)) != NULL)
- || ((v1 = getDeepestVisual(StaticColor, vinfo, nvisuals)) !=
- NULL))
- status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
- (unsigned) v1->depth, 1, 1);
- if (status &&
- (((v1 = getDeepestVisual(GrayScale, vinfo, nvisuals)) != NULL)
- || ((v1 = getDeepestVisual(StaticGray, vinfo, nvisuals)) !=
- NULL)))
- status = XmuVisualStandardColormaps(dpy, scr, v1->visualid,
- (unsigned) v1->depth, 1, 1);
- }
- XFree ((char *) vinfo);
- if (!status) break;
- }
- return status;
-}
-
-static XVisualInfo *
-getDeepestVisual(int visual_class, XVisualInfo *vinfo, int nvisuals)
-{
- register int i;
- register int maxdepth = 0;
- XVisualInfo *v = NULL;
-
- for (i=0; i < nvisuals; i++, vinfo++)
- if (vinfo->class == visual_class && vinfo->depth > maxdepth)
- {
- maxdepth = vinfo->depth;
- v = vinfo;
- }
- return(v);
-}
-
diff --git a/xc/lib/Xmu/Atoms.c b/xc/lib/Xmu/Atoms.c
deleted file mode 100644
index f6ed51b8e..000000000
--- a/xc/lib/Xmu/Atoms.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* $TOG: Atoms.c /main/20 1998/02/06 15:41:04 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Atoms.c,v 3.4 1998/10/03 09:06:20 dawes Exp $ */
-
-/*
- * This file contains routines to cache atoms, avoiding multiple
- * server round-trips. Not so useful now that Xlib caches them.
- *
- * Public entry points:
- *
- * XmuMakeAtom creates & initializes an opaque AtomRec
- * XmuInternAtom fetches an Atom from cache or Display
- * XmuInternStrings fetches multiple Atoms as strings
- * XmuGetAtomName returns name of an Atom
- * XmuNameOfAtom returns name from an AtomPtr
- */
-
-#include <X11/Intrinsic.h>
-#include "Atoms.h"
-
-typedef struct _DisplayRec {
- struct _DisplayRec* next;
- Display *dpy;
- Atom atom;
-} DisplayRec;
-
-struct _AtomRec {
- char *name;
- DisplayRec* head;
-};
-
-#ifdef SUNSHLIB
-#define STATIC
-#else
-#define STATIC static
-#endif
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define DeclareAtom(atom,text) \
-STATIC struct _AtomRec __##atom = { text, NULL }; \
-AtomPtr _##atom = &__##atom;
-#else
-#define DeclareAtom(atom,text) \
-STATIC struct _AtomRec __/**/atom = { text, NULL }; \
-AtomPtr _/**/atom = &__/**/atom;
-#endif
-
-DeclareAtom(XA_ATOM_PAIR, "ATOM_PAIR" )
-DeclareAtom(XA_CHARACTER_POSITION, "CHARACTER_POSITION" )
-DeclareAtom(XA_CLASS, "CLASS" )
-DeclareAtom(XA_CLIENT_WINDOW, "CLIENT_WINDOW" )
-DeclareAtom(XA_CLIPBOARD, "CLIPBOARD" )
-DeclareAtom(XA_COMPOUND_TEXT, "COMPOUND_TEXT" )
-DeclareAtom(XA_DECNET_ADDRESS, "DECNET_ADDRESS" )
-DeclareAtom(XA_DELETE, "DELETE" )
-DeclareAtom(XA_FILENAME, "FILENAME" )
-DeclareAtom(XA_HOSTNAME, "HOSTNAME" )
-DeclareAtom(XA_IP_ADDRESS, "IP_ADDRESS" )
-DeclareAtom(XA_LENGTH, "LENGTH" )
-DeclareAtom(XA_LIST_LENGTH, "LIST_LENGTH" )
-DeclareAtom(XA_NAME, "NAME" )
-DeclareAtom(XA_NET_ADDRESS, "NET_ADDRESS" )
-DeclareAtom(XA_NULL, "NULL" )
-DeclareAtom(XA_OWNER_OS, "OWNER_OS" )
-DeclareAtom(XA_SPAN, "SPAN" )
-DeclareAtom(XA_TARGETS, "TARGETS" )
-DeclareAtom(XA_TEXT, "TEXT" )
-DeclareAtom(XA_TIMESTAMP, "TIMESTAMP" )
-DeclareAtom(XA_USER, "USER" )
-
-/******************************************************************
-
- Public procedures
-
- ******************************************************************/
-
-
-AtomPtr
-XmuMakeAtom(_Xconst char *name)
-{
- AtomPtr ptr = XtNew(struct _AtomRec);
- ptr->name = (char *) name;
- ptr->head = NULL;
- return ptr;
-}
-
-char *
-XmuNameOfAtom(AtomPtr atom_ptr)
-{
- return atom_ptr->name;
-}
-
-
-Atom
-XmuInternAtom(Display *d, AtomPtr atom_ptr)
-{
- DisplayRec* display_rec;
- for (display_rec = atom_ptr->head; display_rec != NULL;
- display_rec = display_rec->next) {
- if (display_rec->dpy == d)
- return display_rec->atom;
- }
- display_rec = XtNew(DisplayRec);
- display_rec->next = atom_ptr->head;
- atom_ptr->head = display_rec;
- display_rec->dpy = d;
- display_rec->atom = XInternAtom(d, atom_ptr->name, False);
- return display_rec->atom;
-}
-
-
-char *
-XmuGetAtomName(Display *d, Atom atom)
-{
- if (atom == 0) return (NULL);
- return XGetAtomName(d, atom);
-}
-
-/* convert (names, count) to a list of atoms. Caller allocates list */
-void
-XmuInternStrings(Display *d, register String *names,
- register Cardinal count, register Atom *atoms)
-{
- (void) XInternAtoms(d, (char**)names, (int)count, FALSE, atoms);
-}
diff --git a/xc/lib/Xmu/Atoms.h b/xc/lib/Xmu/Atoms.h
deleted file mode 100644
index ae0c1f0bc..000000000
--- a/xc/lib/Xmu/Atoms.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* $TOG: Atoms.h /main/10 1998/02/06 15:41:11 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Atoms.h,v 1.4 1998/10/03 09:06:21 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_ATOMS_H_
-#define _XMU_ATOMS_H_
-
-#include <X11/Intrinsic.h>
-#include <X11/Xfuncproto.h>
-
-typedef struct _AtomRec *AtomPtr;
-
-extern AtomPtr
- _XA_ATOM_PAIR,
- _XA_CHARACTER_POSITION,
- _XA_CLASS,
- _XA_CLIENT_WINDOW,
- _XA_CLIPBOARD,
- _XA_COMPOUND_TEXT,
- _XA_DECNET_ADDRESS,
- _XA_DELETE,
- _XA_FILENAME,
- _XA_HOSTNAME,
- _XA_IP_ADDRESS,
- _XA_LENGTH,
- _XA_LIST_LENGTH,
- _XA_NAME,
- _XA_NET_ADDRESS,
- _XA_NULL,
- _XA_OWNER_OS,
- _XA_SPAN,
- _XA_TARGETS,
- _XA_TEXT,
- _XA_TIMESTAMP,
- _XA_USER;
-
-#define XA_ATOM_PAIR(d) XmuInternAtom(d, _XA_ATOM_PAIR)
-#define XA_CHARACTER_POSITION(d) XmuInternAtom(d, _XA_CHARACTER_POSITION)
-#define XA_CLASS(d) XmuInternAtom(d, _XA_CLASS)
-#define XA_CLIENT_WINDOW(d) XmuInternAtom(d, _XA_CLIENT_WINDOW)
-#define XA_CLIPBOARD(d) XmuInternAtom(d, _XA_CLIPBOARD)
-#define XA_COMPOUND_TEXT(d) XmuInternAtom(d, _XA_COMPOUND_TEXT)
-#define XA_DECNET_ADDRESS(d) XmuInternAtom(d, _XA_DECNET_ADDRESS)
-#define XA_DELETE(d) XmuInternAtom(d, _XA_DELETE)
-#define XA_FILENAME(d) XmuInternAtom(d, _XA_FILENAME)
-#define XA_HOSTNAME(d) XmuInternAtom(d, _XA_HOSTNAME)
-#define XA_IP_ADDRESS(d) XmuInternAtom(d, _XA_IP_ADDRESS)
-#define XA_LENGTH(d) XmuInternAtom(d, _XA_LENGTH)
-#define XA_LIST_LENGTH(d) XmuInternAtom(d, _XA_LIST_LENGTH)
-#define XA_NAME(d) XmuInternAtom(d, _XA_NAME)
-#define XA_NET_ADDRESS(d) XmuInternAtom(d, _XA_NET_ADDRESS)
-#define XA_NULL(d) XmuInternAtom(d, _XA_NULL)
-#define XA_OWNER_OS(d) XmuInternAtom(d, _XA_OWNER_OS)
-#define XA_SPAN(d) XmuInternAtom(d, _XA_SPAN)
-#define XA_TARGETS(d) XmuInternAtom(d, _XA_TARGETS)
-#define XA_TEXT(d) XmuInternAtom(d, _XA_TEXT)
-#define XA_TIMESTAMP(d) XmuInternAtom(d, _XA_TIMESTAMP)
-#define XA_USER(d) XmuInternAtom(d, _XA_USER)
-
-_XFUNCPROTOBEGIN
-
-char *XmuGetAtomName
-(
- Display *dpy,
- Atom atom
- );
-
-Atom XmuInternAtom
-(
- Display *dpy,
- AtomPtr atom_ptr
- );
-
-void XmuInternStrings
-(
- Display *dpy,
- String *names,
- Cardinal count,
- Atom *atoms_return
-);
-
-AtomPtr XmuMakeAtom
-(
- _Xconst char *name
- );
-
-char *XmuNameOfAtom
-(
- AtomPtr atom_ptr
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_ATOMS_H_ */
diff --git a/xc/lib/Xmu/CharSet.h b/xc/lib/Xmu/CharSet.h
deleted file mode 100644
index 732406a9f..000000000
--- a/xc/lib/Xmu/CharSet.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $TOG: CharSet.h /main/6 1998/02/06 15:41:16 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.
-
-*/
-
-/* $XFree86: xc/lib/Xmu/CharSet.h,v 1.6 1998/10/03 09:06:21 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_CHARSET_H_
-#define _XMU_CHARSET_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-void XmuCopyISOLatin1Lowered
-(
- char *dst_return,
- _Xconst char *src
- );
-
-void XmuCopyISOLatin1Uppered
-(
- char *dst_return,
- _Xconst char *src
- );
-
-int XmuCompareISOLatin1
-(
- _Xconst char *first,
- _Xconst char *second
- );
-
-void XmuNCopyISOLatin1Lowered
-(
- char *dst_return,
- _Xconst char *src,
- int size
- );
-
-void XmuNCopyISOLatin1Uppered
-(
- char *dst_return,
- _Xconst char *src,
- int size
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_CHARSET_H_ */
diff --git a/xc/lib/Xmu/ClientWin.c b/xc/lib/Xmu/ClientWin.c
deleted file mode 100644
index 4741e224b..000000000
--- a/xc/lib/Xmu/ClientWin.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $TOG: ClientWin.c /main/5 1998/02/06 15:41:21 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/lib/Xmu/ClientWin.c,v 1.5 1999/03/21 07:34:35 dawes Exp $ */
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-
-#include <X11/Xmu/WinUtil.h>
-
-/*
- * Prototypes
- */
-static Window TryChildren(Display*, Window, Atom);
-
-/* Find a window with WM_STATE, else return win itself, as per ICCCM */
-
-Window
-XmuClientWindow(Display *dpy, Window win)
-{
- Atom WM_STATE;
- Atom type = None;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
- Window inf;
-
- WM_STATE = XInternAtom(dpy, "WM_STATE", True);
- if (!WM_STATE)
- return win;
- XGetWindowProperty(dpy, win, WM_STATE, 0, 0, False, AnyPropertyType,
- &type, &format, &nitems, &after, &data);
- if (type)
- return win;
- inf = TryChildren(dpy, win, WM_STATE);
- if (!inf)
- inf = win;
- return inf;
-}
-
-static Window
-TryChildren(Display *dpy, Window win, Atom WM_STATE)
-{
- Window root, parent;
- Window *children;
- unsigned int nchildren;
- unsigned int i;
- Atom type = None;
- int format;
- unsigned long nitems, after;
- unsigned char *data;
- Window inf = 0;
-
- if (!XQueryTree(dpy, win, &root, &parent, &children, &nchildren))
- return 0;
- for (i = 0; !inf && (i < nchildren); i++) {
- XGetWindowProperty(dpy, children[i], WM_STATE, 0, 0, False,
- AnyPropertyType, &type, &format, &nitems,
- &after, &data);
- if (type)
- inf = children[i];
- }
- for (i = 0; !inf && (i < nchildren); i++)
- inf = TryChildren(dpy, children[i], WM_STATE);
- if (children) XFree((char *)children);
- return inf;
-}
diff --git a/xc/lib/Xmu/Clip.c b/xc/lib/Xmu/Clip.c
deleted file mode 100644
index 0f6d410b4..000000000
--- a/xc/lib/Xmu/Clip.c
+++ /dev/null
@@ -1,1614 +0,0 @@
-/*
- * Copyright (c) 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 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.
- */
-/* $XFree86: xc/lib/Xmu/Clip.c,v 1.2 1999/08/15 13:00:44 dawes Exp $ */
-
-#include <stdlib.h>
-
-#include <X11/IntrinsicP.h>
-#include <X11/Xmu/Xmu.h>
-
-#define XmuMax(a, b) ((a) > (b) ? (a) : (b))
-#define XmuMin(a, b) ((a) < (b) ? (a) : (b))
-
-/*
- * Function:
- * XmuNewArea
- *
- * Parameters:
- * x1 - Coordinates of the rectangle
- * y1 - ""
- * x2 - ""
- * y2 - ""
- *
- * Description:
- * Creates a new rectangular clipping area
- */
-XmuArea *
-XmuNewArea(int x1, int y1, int x2, int y2)
-{
- XmuArea *area;
-
- area = (XmuArea *)XtMalloc(sizeof(XmuArea));
- if (x2 > x1 && y2 > y1)
- {
- area->scanline = XmuNewScanline(y1, x1, x2);
- area->scanline->next = XmuNewScanline(y2, 0, 0);
- }
- else
- area->scanline = (XmuScanline *)NULL;
-
- return (area);
-}
-
-/*
- * Function:
- * XmuAreaDup
- *
- * Parameters:
- * area - Area to copy
- *
- * Description:
- * Returns a copy of its argument
- */
-XmuArea *
-XmuAreaDup(XmuArea *area)
-{
- XmuArea *dst;
-
- if (!area)
- return ((XmuArea *)NULL);
-
- dst = XmuCreateArea();
- XmuAreaCopy(dst, area);
- return (dst);
-}
-
-/*
- * Function:
- * XmuAreaCopy
- *
- * Parameters:
- * dst - destination area
- * src - source area
- *
- * Description:
- * Minimizes memory alocation, trying to use already alocated memory
- * in dst, freeing what is not required anymore.
- */
-XmuArea *
-XmuAreaCopy(XmuArea *dst, XmuArea *src)
-{
- XmuScanline *z, *p, *Z;
-
- if (!dst || !src || dst == src)
- return (dst);
-
- z = p = dst->scanline;
- Z = src->scanline;
-
- /*CONSTCOND*/
- while (1)
- {
- if (!Z)
- {
- if (z == dst->scanline)
- {
- XmuDestroyScanlineList(dst->scanline);
- dst->scanline = (XmuScanline *)NULL;
- }
- else
- {
- XmuDestroyScanlineList(p->next);
- p->next = (XmuScanline *)NULL;
- }
- return (dst);
- }
- if (z)
- {
- XmuScanlineCopy(z, Z);
- z->y = Z->y;
- }
- else
- {
- z = XmuNewScanline(Z->y, 0, 0);
- XmuScanlineCopy(z, Z);
- if (p == dst->scanline && !dst->scanline)
- p = dst->scanline = z;
- else
- p->next = z;
- }
- p = z;
- z = z->next;
- Z = Z->next;
- }
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuAreaNot
- *
- * Parameters:
- * area - area to operate
- * x1 - retangle to clip the result against
- * y1 - ""
- * x2 - ""
- * y2 - ""
- *
- * Description:
- * (Input)
- * (x1, y1) (x2, y1)
- * +-------------+
- * +------------+ +----+
- * | +--------------+
- * +----------------+
- * (x1, y2) (x2, y2)
- *
- * (Output)
- * (x1, y1) (x2, y1)
- * +--------------+ +--------------------------+
- * | +------------+ +----+ |
- * | | +--------------+ |
- * +-+ +------------------------------------+
- * (x1, y2) (x2, y2)
- */
-XmuArea *
-XmuAreaNot(XmuArea *area, int x1, int y1, int x2, int y2)
-{
- XmuScanline *z;
- XmuArea *and;
-
- if (!area)
- return (area);
-
- if (x1 > x2)
- {
- x1 ^= x2; x2 ^= x1; x1 ^= x2;
- }
- if (y1 > y2)
- {
- y1 ^= y2; y2 ^= y1; y1 ^= y2;
- }
- if (!area->scanline)
- {
- if ((area->scanline = XmuNewScanline(y1, x1, x2)) != NULL)
- area->scanline->next = XmuNewScanline(y2, 0, 0);
- return (area);
- }
- and = XmuNewArea(x1, y1, x2, y2);
- XmuAreaAnd(area, and);
- XmuDestroyArea(and);
- z = area->scanline;
- if (z->y != y1)
- {
- XmuScanline *q = XmuNewScanline(y1, x1, x2);
- q->next = z;
- area->scanline = q;
- }
- else
- {
- area->scanline = area->scanline->next;
- XmuDestroyScanline(z);
- XmuOptimizeArea(area);
- if((z = area->scanline) == (XmuScanline *)NULL)
- return (area);
- }
-
- /* CONSTCOND */
- while (1)
- {
- XmuScanlineNot(z, x1, x2);
- if (!z->next)
- {
- z->next = XmuNewScanline(y2, 0, 0);
- break;
- }
- if (z->next->y == y2)
- {
- XmuDestroyScanlineList(z->next);
- z->next = XmuNewScanline(y2, 0, 0);
- break;
- }
- z = z->next;
- }
-
- return (area);
-}
-
-/*
- * Function:
- * XmuAreaOrXor
- *
- * Parameters:
- * dst - destination area
- * src - source area
- * or - or operation if true, else xor operation
- *
- * Description:
- * Executes Or (Union) or Xor (Reverse intesection) of the areas
- */
-XmuArea *
-XmuAreaOrXor(XmuArea *dst, XmuArea *src, Bool or)
-{
- XmuScanline *z, *p, *Z, *P, *ins, *top;
-
- if (!dst || !src)
- return (dst);
-
- if (dst == src)
- {
- if (or)
- return (dst);
- XmuDestroyScanlineList(dst->scanline);
- dst->scanline = (XmuScanline *)NULL;
- return (dst);
- }
- if (!XmuValidArea(src))
- return (dst);
- if (!XmuValidArea(dst))
- {
- XmuAreaCopy(dst, src);
- return (dst);
- }
-
- p = z = dst->scanline;
- P = Z = src->scanline;
- ins = XmuNewScanline(dst->scanline->y, 0, 0);
- top = XmuNewScanline(dst->scanline->y, 0, 0);
- XmuScanlineCopy(ins, dst->scanline);
- XmuScanlineCopy(top, dst->scanline);
-
- /*CONSTCOND*/
- while (1)
- {
- if (!Z)
- break;
- else if (Z->y < z->y)
- {
- XmuScanline *q = XmuNewScanline(Z->y, 0, 0);
- XmuScanlineCopy(q, Z);
-
- if (z == dst->scanline)
- {
- dst->scanline = p = q;
- q->next = z;
- }
- else
- {
- p->next = q;
- q->next = z;
- if (Z->y >= p->y)
- {
- if (ins->y >= top->y
- && (p->y != P->y || !XmuScanlineEqu(p, P)
- || (ins->y <= P->y && !XmuScanlineEqu(ins, P))))
- {
- if (or)
- XmuScanlineOr(q, ins);
- else
- XmuScanlineXor(q, ins);
- }
- else if (Z->y >= top->y
- && (top->y == p->y || top->y > ins->y
- || !XmuValidScanline(Z)
- || (p->y == P->y && XmuValidScanline(p)
- && XmuValidScanline(P))
- || XmuScanlineEqu(ins, top)))
- {
- if (or)
- XmuScanlineOr(q, top);
- else
- XmuScanlineXor(q, top);
- }
- if (ins->y != p->y && p->y != P->y)
- {
- XmuScanlineCopy(ins, p);
- ins->y = p->y;
- }
- }
- if (!XmuValidScanline(p) || Z->y <= p->y)
- {
- XmuScanlineCopy(top, p);
- top->y = p->y;
- }
- p = q;
- }
- P = Z;
- Z = Z->next;
- continue;
- }
- else if (Z->y == z->y)
- {
- if (top->y != z->y)
- {
- XmuScanlineCopy(top, z);
- top->y = z->y;
- }
- if (or)
- XmuScanlineOr(z, Z);
- else
- XmuScanlineXor(z, Z);
- P = Z;
- Z = Z->next;
- }
- else if (P != Z) /* && Z->y > z->y */
- {
- if (top->y == ins->y && top->y != z->y)
- {
- XmuScanlineCopy(top, z);
- top->y = z->y;
- }
- if (ins->y != z->y)
- {
- XmuScanlineCopy(ins, z);
- ins->y = z->y;
- }
- if (or)
- XmuScanlineOr(z, P);
- else
- XmuScanlineXor(z, P);
- }
- else if (ins->y != z->y)
- {
- XmuScanlineCopy(ins, z);
- ins->y = z->y;
- }
- p = z;
- z = z->next;
- if (!z)
- {
- while (Z)
- {
- p->next = XmuNewScanline(Z->y, 0, 0);
- XmuScanlineCopy(p->next, Z);
- p = p->next;
- Z = Z->next;
- }
- break;
- }
- else if (ins->y > top->y && !XmuValidScanline(z)
- && XmuValidScanline(ins))
- {
- XmuScanlineCopy(top, ins);
- top->y = ins->y;
- }
- }
- XmuOptimizeArea(dst);
- XmuDestroyScanline(ins);
- XmuDestroyScanline(top);
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuAreaAnd(dst, src)
- *
- * Parameters:
- * dst - destination area
- * src - source area
- *
- * Description:
- * Executes And (intersection) of the areas
- */
-XmuArea *
-XmuAreaAnd(XmuArea *dst, XmuArea *src)
-{
- XmuScanline *z, *p, *Z, *P, *top;
-
- if (!dst || !src || dst == src)
- return (dst);
- if (!XmuValidArea(dst) || !XmuValidArea(src))
- {
- XmuDestroyScanlineList(dst->scanline);
- dst->scanline = (XmuScanline *)NULL;
- return (dst);
- }
- z = p = dst->scanline;
- Z = P = src->scanline;
- top = XmuNewScanline(dst->scanline->y, 0, 0);
- XmuScanlineCopy(top, dst->scanline);
-
- while (z)
- {
- while (Z->next && Z->next->y < z->y)
- {
- P = Z;
- Z = Z->next;
- if (Z->y >= p->y)
- {
- XmuScanline *q = XmuNewScanline(Z->y, 0, 0);
- XmuScanlineCopy(q, Z);
-
- XmuScanlineAnd(q, top);
- if (p->y != P->y)
- {
- XmuScanlineAnd(p, P);
- p->y = XmuMax(p->y, P->y);
- }
- p->next = q;
- q->next = z;
- p = q;
- }
- }
- if (!z->next)
- {
- z->y = XmuMax(z->y, Z->y);
- break;
- }
- while (Z->y >= z->next->y)
- {
- if (z == dst->scanline)
- {
- p = dst->scanline = dst->scanline->next;
- XmuDestroyScanline(z);
- z = dst->scanline;
- }
- else
- {
- p->next = z->next;
- XmuDestroyScanline(z);
- z = p;
- }
- if (!z || !z->next)
- {
- XmuOptimizeArea(dst);
- XmuDestroyScanline(top);
-
- return (dst);
- }
- }
- if (Z->y > p->y)
- z->y = XmuMax(z->y, Z->y);
- if (top->y != z->y)
- {
- XmuScanlineCopy(top, z);
- top->y = z->y;
- }
- XmuScanlineAnd(z, Z);
- p = z;
- z = z->next;
- }
- XmuOptimizeArea(dst);
- XmuDestroyScanline(top);
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuValidArea(area)
- *
- * Parameters:
- * area - area to verify
- *
- * Description:
- * Verifies if the area is valid and/or useful
- */
-Bool
-XmuValidArea(XmuArea *area)
-{
- XmuScanline *at;
-
- if (!area || !area->scanline)
- return (False);
-
- at = area->scanline;
- while (at)
- {
- if (XmuValidScanline(at))
- return (True);
- at = at->next;
- }
-
- return (False);
-}
-
-/*
- * Function:
- * XmuValidScanline
- *
- * Parameters:
- * scanline - scanline to verify
- *
- * Description:
- * Verifies if a scanline is useful
- */
-Bool
-XmuValidScanline(XmuScanline *scanline)
-{
- XmuSegment *z;
-
- if (!scanline)
- return (False);
-
- z = scanline->segment;
- while (z)
- {
- if (XmuValidSegment(z))
- return (True);
- z = z->next;
- }
-
- return (False);
-}
-
-/*
- * Function:
- * XmuScanlineEqu
- *
- * Parameters:
- * s1 - scanline 1
- * s2 - scanline 2
- *
- * Description:
- * Checks if s1 and s2 are equal
- */
-Bool
-XmuScanlineEqu(XmuScanline *s1, XmuScanline *s2)
-{
- XmuSegment *z, *Z;
-
- if ((!s1 && !s2) || s1 == s2)
- return (True);
- if (!s1 || !s2)
- return (False);
-
- z = s1->segment;
- Z = s2->segment;
-
- /*CONSTCOND*/
- while (1)
- {
- if (!z && !Z)
- return (True);
- if (!z || !Z)
- return (False);
- if (!XmuSegmentEqu(z, Z))
- return (False);
- z = z->next;
- Z = Z->next;
- }
- /*NOTREACHED*/
-}
-
-/*
- * Function:
- * XmuNewSegment
- *
- * Parameters:
- * x1 - coordinates of the segment
- * x2 - ""
- *
- * Description:
- * Creates a new segments with the coordinates x1 and x2
- *
- * Returns:
- * New Segment of NULL
- */
-XmuSegment *
-XmuNewSegment(int x1, int x2)
-{
- XmuSegment *segment;
-
- if ((segment = (XmuSegment *)XtMalloc(sizeof(XmuSegment))) == NULL)
- return (segment);
-
- segment->x1 = x1;
- segment->x2 = x2;
- segment->next = (XmuSegment *)NULL;
-
- return (segment);
-}
-
-/*
- * Function:
- * XmuDestroySegmentList
- *
- * Parameters:
- * segment - Segment to destroy
- *
- * Description:
- * Frees the memory used by the list headed by segment
- */
-void
-XmuDestroySegmentList(XmuSegment *segment)
-{
- XmuSegment *z;
-
- if (!segment)
- return;
-
- while (segment)
- {
- z = segment;
- segment = segment->next;
- XmuDestroySegment(z);
- }
-}
-
-/*
- * Function:
- * XmuScanlineCopy
- *
- * Parameters:
- * dst - destination scanline
- * src - source scanline
- *
- * Description:
- * Makes dst contain the same data as src
- */
-XmuScanline *
-XmuScanlineCopy(XmuScanline *dst, XmuScanline *src)
-{
- XmuSegment *z, *p, *Z;
-
- if (!dst || !src || dst == src)
- return (dst);
-
- z = p = dst->segment;
- Z = src->segment;
-
- /*CONSTCOND*/
- while (1)
- {
- if (!Z)
- {
- if (z == dst->segment)
- dst->segment = (XmuSegment *)NULL;
- else
- p->next = (XmuSegment *)NULL;
- XmuDestroySegmentList(z);
- return (dst);
- }
- if (z)
- {
- z->x1 = Z->x1;
- z->x2 = Z->x2;
- }
- else
- {
- z = XmuNewSegment(Z->x1, Z->x2);
- if (p == dst->segment && !dst->segment)
- p = dst->segment = z;
- else
- p->next = z;
- }
- p = z;
- z = z->next;
- Z = Z->next;
- }
- /*NOTREACHED*/
-}
-
-/*
- * Function:
- * XmuAppendSegment
- *
- * Parameters:
- * segment - destination segment
- * append - segment to add
- *
- * Description:
- * Adds a copy of the append list at the end of the segment list
- */
-Bool
-XmuAppendSegment(XmuSegment *segment, XmuSegment *append)
-{
- if (!segment || !append)
- return (False);
-
- if (segment->next)
- /* Should not happen! */
- XmuDestroySegmentList(segment->next);
-
- while (append)
- {
- if (XmuValidSegment(append))
- {
- if ((segment->next = XmuNewSegment(append->x1, append->x2)) == NULL)
- return (False);
- segment = segment->next;
- }
- append = append->next;
- }
-
- return (True);
-}
-
-/*
- * Function:
- * XmuOptimizeScanline
- *
- * Parameters:
- * scanline - scanline to optimize
- *
- * Description:
- * Some functions, when transforming Segments of Scanlines, left these
- * with unnecessary data (that may cause error in these same functions).
- * This function corrects these incorrect segments.
- */
-XmuScanline *
-XmuOptimizeScanline(XmuScanline *scanline)
-{
- XmuSegment *z, *p;
-
- while (scanline->segment && !XmuValidSegment(scanline->segment))
- {
- XmuSegment *s = scanline->segment;
-
- scanline->segment = scanline->segment->next;
- XmuDestroySegment(s);
- }
- for (z = p = scanline->segment; z; p = z, z = z->next)
- {
- if (!XmuValidSegment(z))
- {
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- }
- }
- return (scanline);
-}
-
-/*
- * Name:
- * XmuScanlineNot(scanline, minx, maxx)
- *
- * Parameters:
- * scanline - scanlines operate
- * minx - minimum x coordinate
- * maxx - maximum x coordinate
- *
- * Description:
- * (minx) (maxx)
- * + +
- * (input) +---------+ +--------+ +--------+
- * (output) +-----+ +-----+ +--------+ +------------+
- */
-XmuScanline *
-XmuScanlineNot(XmuScanline *scanline, int minx, int maxx)
-{
- XmuSegment *z;
- static XmuSegment x = { 0, 0, 0 };
- static XmuScanline and = { 0, &x, 0 };
-
- if (!scanline)
- return (scanline);
-
- XmuOptimizeScanline(scanline);
- if (minx > maxx)
- {
- minx ^= maxx; maxx ^= minx; minx ^= maxx;
- }
- and.segment->x1 = minx;
- and.segment->x2 = maxx;
- XmuScanlineAnd(scanline, &and);
- if (!scanline->segment)
- {
- scanline->segment = XmuNewSegment(minx, maxx);
- return (scanline);
- }
- z = scanline->segment;
- if (z->x1 != minx)
- {
- XmuSegment *q = XmuNewSegment(minx, z->x1);
-
- q->next = z;
- scanline->segment = q;
- }
-
- /*CONSTCOND*/
- while (1)
- {
- z->x1 = z->x2;
- if (!z->next)
- {
- z->x2 = maxx;
- break;
- }
- z->x2 = z->next->x1;
- if (z->next->x2 == maxx)
- {
- XmuDestroySegment(z->next);
- z->next = (XmuSegment *)NULL;
- break;
- }
- z = z->next;
- }
-
- return (scanline);
-}
-
-
-#ifndef notdef
-/*
- * Function:
- * XmuScanlineOrSegment
- *
- * Parameters:
- * dst - destionation scanline
- * src - source segment
- *
- * Description:
- * (input) +-----------+ +--------+ +---------+
- * (src) +-------------------+
- * (output) +-------------------------+ +---------+
- */
-XmuScanline *
-XmuScanlineOrSegment(XmuScanline *dst, XmuSegment *src)
-{
- XmuSegment *z, *p, ins;
-
- if (!src || !dst || !XmuValidSegment(src))
- return (dst);
-
- if (!dst->segment)
- {
- dst->segment = XmuNewSegment(src->x1, src->x2);
- return (dst);
- }
-
- z = p = dst->segment;
- ins.x1 = src->x1;
- ins.x2 = src->x2;
-
- /*CONSTCOND*/
- while (1)
- {
- if (!z)
- {
- XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
-
- if (p == dst->segment && z == p)
- dst->segment = q;
- else
- p->next = q;
- break;
- }
- else if (ins.x2 < z->x1)
- {
- XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
-
- if (p == dst->segment && z == p)
- {
- q->next = dst->segment;
- dst->segment = q;
- }
- else
- {
- p->next = q;
- q->next = z;
- }
- break;
- }
- else if (ins.x2 <= z->x2)
- {
- z->x1 = XmuMin(z->x1, ins.x1);
- break;
- }
- else if (ins.x1 <= z->x2)
- {
- ins.x1 = XmuMin(z->x1, ins.x1);
- if (!z->next)
- {
- z->x1 = ins.x1;
- z->x2 = ins.x2;
- break;
- }
- else
- {
- if (z == dst->segment)
- {
- p = dst->segment = dst->segment->next;
- XmuDestroySegment(z);
- z = dst->segment;
- continue;
- }
- else
- {
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- }
- }
- }
- p = z;
- z = z->next;
- }
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuScanlineAndSegment
- *
- * Parameters:
- * dst - destination scanline
- * src - source segment
- *
- * Description:
- * (input) +------------+ +------+ +----------+
- * (src) +---------------------+
- * (output) +-------+ +------+
- */
-XmuScanline *
-XmuScanlineAndSegment(XmuScanline *dst, XmuSegment *src)
-{
- XmuSegment *z, *p;
-
- if (!dst || !src)
- return (dst);
-
- if (!XmuValidSegment(src))
- {
- XmuDestroySegmentList(dst->segment);
- dst->segment = (XmuSegment *)NULL;
- return (dst);
- }
- if (!dst->segment)
- return (dst);
-
- z = p = dst->segment;
- while (z)
- {
- if (src->x2 <= z->x1 || src->x1 >= z->x2)
- {
- if (z == dst->segment)
- {
- p = dst->segment = dst->segment->next;
- XmuDestroySegment(z);
- z = dst->segment;
- continue;
- }
- else
- {
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- }
- }
- else
- {
- z->x1 = XmuMax(z->x1, src->x1);
- z->x2 = XmuMin(z->x2, src->x2);
- }
- p = z;
- z = z->next;
- }
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuScanlineXorSegment
- *
- * Parameters:
- * dst - destionation scanline
- * src - source segment
- *
- * Descriptipn:
- * (input) +------------+ +----------+ +-----------+
- * (src) +------------------------+
- * (output) +---+ +--+ +-+ +-----------+
- */
-XmuScanline *
-XmuScanlineXorSegment(XmuScanline *dst, XmuSegment *src)
-{
- XmuSegment *p, *z, ins;
- int tmp1, tmp2;
-
- if (!dst || !src || !XmuValidSegment(src))
- return (dst);
- if (!dst->segment)
- {
- dst->segment = XmuNewSegment(src->x1, src->x2);
- return (dst);
- }
-
- p = z = dst->segment;
- ins.x1 = src->x1;
- ins.x2 = src->x2;
-
- /*CONSTCOND*/
- while (1)
- {
- if (!XmuValidSegment((&ins)))
- break;
- if (!z || ins.x2 < z->x1)
- {
- XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
-
- q->next = z;
- if (z == dst->segment)
- dst->segment = q;
- else
- p->next = q;
- break;
- }
- else if (ins.x2 == z->x1)
- {
- z->x1 = ins.x1;
- break;
- }
- else if (ins.x1 < z->x2)
- {
- if (ins.x1 < z->x1)
- {
- tmp1 = ins.x2;
- tmp2 = z->x2;
- ins.x2 = XmuMax(ins.x2, z->x2);
- z->x2 = z->x1;
- z->x1 = ins.x1;
- ins.x1 = XmuMin(tmp1, tmp2);
- }
- else if (ins.x1 > z->x1)
- {
- tmp1 = ins.x1;
- ins.x1 = XmuMin(ins.x2, z->x2);
- ins.x2 = XmuMax(z->x2, ins.x2);
- z->x2 = tmp1;
- }
- else /* ins.x1 == z->x1 */
- {
- if (ins.x2 < z->x2)
- {
- z->x1 = ins.x2;
- break;
- }
- else
- {
- ins.x1 = z->x2;
- if (z == dst->segment)
- p = dst->segment = dst->segment->next;
- else
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- continue;
- }
- }
- }
- else if (ins.x1 == z->x2)
- {
- ins.x1 = z->x1;
- if (z == dst->segment)
- p = dst->segment = dst->segment->next;
- else
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- continue;
- }
- p = z;
- z = z->next;
- }
-
- return (dst);
-}
-#endif /* notdef */
-
-/*
- * Function:
- * ScanlineOr
- *
- * Parameters:
- * dst - destionation scanline
- * src - source scanline
- *
- * Description:
- * (input) +--------------+ +-----+ +----------+
- * (src) +---------------------+ +-----------+
- * (output) +-------------------------+ +----------------+
- */
-XmuScanline *
-XmuScanlineOr(XmuScanline *dst, XmuScanline *src)
-{
- XmuSegment *z, *p, *Z, ins;
-
- if (!src || !src->segment || !dst || dst == src)
- return (dst);
- if (!dst->segment)
- {
- XmuScanlineCopy(dst, src);
- return (dst);
- }
-
- z = p = dst->segment;
- Z = src->segment;
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
-
- /*CONSTCOND*/
- while (1)
- {
- while (!XmuValidSegment((&ins)))
- {
- if ((Z = Z->next) == (XmuSegment *)NULL)
- return (dst);
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- }
- if (!z)
- {
- XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
-
- if (p == dst->segment && z == p)
- dst->segment = p = q;
- else
- {
- p->next = q;
- p = q;
- }
- Z = Z->next;
- XmuAppendSegment(p, Z);
- break;
- }
- else if (ins.x2 < z->x1)
- {
- XmuSegment *r = XmuNewSegment(ins.x1, ins.x2);
-
- if (p == dst->segment && z == p)
- {
- r->next = dst->segment;
- dst->segment = p = r;
- }
- else
- {
- p->next = r;
- r->next = z;
- p = r;
- }
- Z = Z->next;
- if (!Z)
- break;
- else
- {
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- continue;
- }
- }
- else if (ins.x2 <= z->x2)
- {
- z->x1 = XmuMin(z->x1, ins.x1);
- Z = Z->next;
- if (!Z)
- break;
- else
- {
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- continue;
- }
- }
- else if (ins.x1 <= z->x2)
- {
- ins.x1 = XmuMin(z->x1, ins.x1);
- if (!z->next)
- {
- z->x1 = ins.x1;
- z->x2 = ins.x2;
- p = z;
- Z = Z->next;
- XmuAppendSegment(p, Z);
- break;
- }
- else
- {
- if (z == dst->segment)
- {
- p = dst->segment = dst->segment->next;
- XmuDestroySegment(z);
- z = p;
- continue;
- }
- else
- {
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- }
- }
- }
- p = z;
- z = z->next;
- }
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuScanlineAnd
- *
- * Parameters:
- * dst - destination scanline
- * src - source scanline
- *
- * Description:
- * (input) +--------------+ +-----+ +----------+
- * (src) +---------------------+ +-----------+
- * (output) +----------+ +-----+ +-----+
- */
-XmuScanline *
-XmuScanlineAnd(XmuScanline *dst, XmuScanline *src)
-{
- XmuSegment *z, *p, *Z;
-
- if (!dst || !src || dst == src || !dst->segment) {
- return (dst);
- }
- if (!src->segment)
- {
- XmuDestroySegmentList(dst->segment);
- dst->segment = (XmuSegment *)NULL;
- return (dst);
- }
- z = p = dst->segment;
- Z = src->segment;
-
- while (z)
- {
- while (!XmuValidSegment(Z) || Z->x2 <= z->x1)
- {
- Z = Z->next;
- if (!Z)
- {
- if (z == dst->segment)
- dst->segment = (XmuSegment *)NULL;
- else
- p->next = (XmuSegment *)0;
- XmuDestroySegmentList(z);
- return (dst);
- }
- }
- if (Z->x1 >= z->x2)
- {
- if (z == dst->segment)
- {
- p = dst->segment = dst->segment->next;
- XmuDestroySegment(z);
- z = dst->segment;
- }
- else
- {
- p->next = z->next;
- XmuDestroySegment(z);
- z = p->next;
- }
- if (!z)
- return (dst);
- else
- continue;
- }
- z->x1 = XmuMax(z->x1, Z->x1);
- if (z->x2 > Z->x2)
- {
- if (Z->next)
- {
- XmuSegment *q = XmuNewSegment(Z->x2, z->x2);
-
- q->next = z->next;
- z->next = q;
- }
- z->x2 = Z->x2;
- }
- p = z;
- z = z->next;
- }
-
- return (dst);
-}
-
-/*
- * Function:
- * ScanlineXor
- *
- * Parameters:
- * dst - destination scanline
- * src - source scanline
- *
- * Description:
- * (input) +--------------+ +-----+ +----------+
- * (src) +---------------------+ +-----------+
- * (output) +---+ +--+ +-+ +----+ +-----+
- */
-XmuScanline *
-XmuScanlineXor(XmuScanline *dst, XmuScanline *src)
-{
- XmuSegment *z, *p, *Z, ins;
- int tmp1, tmp2;
-
- if (!src || !dst || !src->segment)
- return (dst);
- if (src == dst)
- {
- XmuDestroySegmentList(dst->segment);
- dst->segment = (XmuSegment *)NULL;
- return (dst);
- }
- if (!dst->segment)
- {
- XmuScanlineCopy(dst, src);
- return (dst);
- }
-
- z = p = dst->segment;
- Z = src->segment;
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
-
- /*CONSTCOND*/
- while (1)
- {
- while (!XmuValidSegment((&ins)))
- {
- if ((Z = Z->next) == (XmuSegment *)NULL)
- return (dst);
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- }
- if (!z)
- {
- XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
-
- if (!dst->segment)
- dst->segment = q;
- else
- p->next = q;
- p = q;
- Z = Z->next;
- XmuAppendSegment(p, Z);
- break;
- }
- else if (ins.x2 < z->x1)
- {
- XmuSegment *q = XmuNewSegment(ins.x1, ins.x2);
-
- q->next = z;
- if (z == dst->segment)
- dst->segment = q;
- else
- p->next = q;
- if ((Z = Z->next) == (XmuSegment *)NULL)
- return (dst);
-
- p = q;
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- continue;
- }
- else if (ins.x2 == z->x1)
- {
- z->x1 = ins.x1;
- if ((Z = Z->next) == (XmuSegment *)NULL)
- break;
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- continue;
- }
- else if (ins.x1 < z->x2)
- {
- if (ins.x1 == z->x1)
- {
- if (ins.x2 < z->x2)
- {
- z->x1 = ins.x2;
- if ((Z = Z->next) == (XmuSegment *)NULL)
- break;
- ins.x1 = Z->x1;
- ins.x2 = Z->x2;
- continue;
- }
- else
- {
- ins.x1 = z->x2;
- if (z == dst->segment)
- p = dst->segment = dst->segment->next;
- else
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- continue;
- }
- }
- else
- {
- if (Z->x2 < z->x2)
- {
- XmuSegment *q = XmuNewSegment(XmuMin(ins.x1, z->x1),
- XmuMax(z->x1, ins.x1));
-
- q->next = z;
- if (z == dst->segment)
- dst->segment = q;
- else
- p->next = q;
- ins.x1 = z->x2;
- z->x1 = ins.x2;
- p = q;
- continue;
- }
- else
- {
- tmp1 = ins.x2;
- tmp2 = z->x2;
- ins.x2 = XmuMax(ins.x2, z->x2);
- z->x2 = XmuMax(z->x1, ins.x1);
- z->x1 = XmuMin(ins.x1, z->x1);
- ins.x1 = XmuMin(tmp1, tmp2);
- }
- }
- }
- else if (ins.x1 == z->x2)
- {
- ins.x1 = z->x1;
- if (z == dst->segment)
- p = dst->segment = dst->segment->next;
- else
- p->next = z->next;
- XmuDestroySegment(z);
- z = p;
- continue;
- }
- p = z;
- z = z->next;
- }
-
- return (dst);
-}
-
-/*
- * Function:
- * XmuNewScanline
- *
- * Parameters:
- * y - y coordinate
- * x1 - left coordinate
- * x2 - right coordinate
- *
- * Description:
- * Creates a new Scanline
- */
-XmuScanline *
-XmuNewScanline(int y, int x1, int x2)
-{
- XmuScanline *scanline;
-
- scanline = (XmuScanline *)XtMalloc(sizeof(XmuScanline));
- scanline->y = y;
- if (x1 < x2)
- scanline->segment = XmuNewSegment(x1, x2);
- else
- scanline->segment = (XmuSegment *)NULL;
-
- scanline->next = (XmuScanline *)NULL;
-
- return (scanline);
-}
-
-/*
- * Function:
- * XmuDestroyScanlineList
- *
- * Parameters:
- * scanline - scanline list to destroy
- *
- * Description:
- * Destroy a scanline list
- *
- * Observation:
- * Use as follow:
- * XmuDestroyScanlineList(area->scanline);
- * area->scanline = (XmuScanline *)NULL;
- */
-void
-XmuDestroyScanlineList(XmuScanline *scanline)
-{
- XmuScanline *z;
-
- if (!scanline)
- return;
-
- while (scanline)
- {
- z = scanline;
- scanline = scanline->next;
- XmuDestroyScanline(z);
- }
-}
-
-/*
- * Function:
- * XmuOptimizeArea
- *
- * Parameters:
- * area - area to optimize
- *
- * Description:
- * Optimizes an area. This function is called when finishing a
- * operation between areas, since they can end with redundant data,
- * and the algorithms for area combination waits a area with
- * correct data (but can left unnecessary data in the area, to avoid
- * to much paranoia tests).
- */
-XmuArea *XmuOptimizeArea(XmuArea *area)
-{
- XmuScanline *pr, *at;
-
- if (!area || !area->scanline)
- return (area);
-
- if (!area->scanline->next)
- {
- XmuDestroyScanlineList(area->scanline);
- area->scanline = (XmuScanline *)0;
- return (area);
- }
-
- pr = area->scanline;
- at = area->scanline->next;
- while (area->scanline && (!XmuValidScanline(area->scanline)
- || (area->scanline->next && area->scanline->y
- >= area->scanline->next->y)))
- {
- area->scanline = area->scanline->next;
- XmuDestroyScanline(pr);
- pr = area->scanline;
- if (pr)
- at = pr->next;
- }
-
- for (; at; pr = at, at = at->next)
- {
- if (XmuScanlineEqu(at, pr)
- || (!XmuValidScanline(at) && !XmuValidScanline(pr))
- || (at->next && at->y >= at->next->y))
- {
- pr->next = at->next;
- XmuDestroyScanline(at);
- at = pr;
- }
- }
- if (pr && XmuValidScanline(pr))
- {
- XmuDestroySegmentList(pr->segment);
- pr->segment = (XmuSegment *)NULL;
- }
- if (area->scanline && !area->scanline->next)
- {
- XmuDestroyScanlineList(area->scanline);
- area->scanline = (XmuScanline *)NULL;
- }
-
- return (area);
-}
diff --git a/xc/lib/Xmu/CloseHook.c b/xc/lib/Xmu/CloseHook.c
deleted file mode 100644
index 68aeb333c..000000000
--- a/xc/lib/Xmu/CloseHook.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* $TOG: CloseHook.c /main/10 1998/02/06 15:41:26 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/lib/Xmu/CloseHook.c,v 3.3 1998/10/03 09:06:22 dawes Exp $ */
-
-/*
- * CloseDisplayHook package - provide callback on XCloseDisplay
- *
- * *
- * Author: Jim Fulton, MIT X Consortium
- *
- *
- * Public Entry Points
- *
- * CloseHook XmuAddCloseDisplayHook (dpy, func, arg)
- * Display *dpy;
- * XmuCloseHookProc func;
- * XPointer arg;
- *
- * Bool XmuRemoveCloseDisplayHook (dpy, hook, func, arg)
- * Display *dpy;
- * CloseHook hook;
- * XmuCloseHookProc func;
- * XPointer arg;
- *
- * Bool XmuLookupCloseDisplayHook (dpy, hook, func, arg)
- * Display *dpy;
- * CloseHook hook;
- * XmuCloseHookProc func;
- * XPointer arg;
- *
- */
-
-#include <stdio.h> /* for NULL */
-#include <X11/Xos.h>
-#include <X11/Xlib.h>
-#include <X11/Xmu/CloseHook.h>
-
-#ifdef X_NOT_STDC_ENV
-extern char *malloc(); /* should be void * */
-#else
-#include <stdlib.h>
-#endif
-
-/*
- * Private data
- *
- * This is a list of display entries, each of which contains a list of callback
- * records.
- */
-
-typedef struct _CallbackRec {
- struct _CallbackRec *next; /* next link in chain */
- XmuCloseHookProc func; /* function to call */
- XPointer arg; /* argument to pass with function */
-} CallbackRec;
-
-
-typedef struct _DisplayEntry {
- struct _DisplayEntry *next; /* next link in chain */
- Display *dpy; /* the display this represents */
- int extension; /* from XAddExtension */
- struct _CallbackRec *start, *end; /* linked list of callbacks */
- struct _CallbackRec *calling; /* currently being called back */
-} DisplayEntry;
-
-/*
- * Prototypes
- */
-static DisplayEntry *_FindDisplayEntry(Display*, DisplayEntry**);
-static Bool _MakeExtension(Display*, int*);
-
-static DisplayEntry *elist = NULL;
-
-
-/*
- *****************************************************************************
- * Public Entry Points *
- *****************************************************************************
- */
-
-/*
- * Add - add a callback for the given display. When the display is closed,
- * the given function will be called as:
- *
- * (*func) (dpy, arg)
- *
- * This function is declared to return an int even though the value is ignored
- * because some compilers have problems with functions returning void.
- *
- * This routine returns NULL if it was unable to add the callback, otherwise
- * it returns an untyped pointer that can be used with Remove or Lookup, but
- * not dereferenced.
- */
-CloseHook
-XmuAddCloseDisplayHook(Display *dpy, XmuCloseHookProc func, XPointer arg)
-{
- DisplayEntry *de;
- CallbackRec *cb;
-
- /* allocate ahead of time so that we can fail atomically */
- cb = (CallbackRec *) malloc (sizeof (CallbackRec));
- if (!cb) return ((XPointer) NULL);
-
- de = _FindDisplayEntry (dpy, NULL);
- if (!de) {
- if ((de = (DisplayEntry *) malloc (sizeof (DisplayEntry))) == NULL ||
- !_MakeExtension (dpy, &de->extension)) {
- free ((char *) cb);
- if (de) free ((char *) de);
- return ((CloseHook) NULL);
- }
- de->dpy = dpy;
- de->start = de->end = NULL;
- de->calling = NULL;
- de->next = elist;
- elist = de;
- }
-
- /* add to end of list of callback recordss */
- cb->func = func;
- cb->arg = arg;
- cb->next = NULL;
- if (de->end) {
- de->end->next = cb;
- } else {
- de->start = cb;
- }
- de->end = cb;
-
- return ((CloseHook) cb);
-}
-
-
-/*
- * Remove - get rid of a callback. If handle is non-null, use that to compare
- * entries. Otherwise, remove first instance of the function/argument pair.
- */
-Bool
-XmuRemoveCloseDisplayHook(Display *dpy, CloseHook handle,
- XmuCloseHookProc func, XPointer arg)
-{
- DisplayEntry *de = _FindDisplayEntry (dpy, NULL);
- register CallbackRec *h, *prev;
-
- if (!de) return False;
-
- /* look for handle or function/argument pair */
- for (h = de->start, prev = NULL; h; h = h->next) {
- if (handle) {
- if (h == (CallbackRec *) handle) break;
- } else {
- if (h->func == func && h->arg == arg) break;
- }
- prev = h;
- }
- if (!h) return False;
-
-
- /* remove from list, watch head and tail */
- if (de->start == h) {
- de->start = h->next;
- } else {
- prev->next = h->next;
- }
- if (de->end == h) de->end = prev;
- if (de->calling != h) free ((char *) h);
- return True;
-}
-
-
-/*
- * Lookup - see whether or not a handle has been installed. If handle is
- * non-NULL, look for an entry that matches it; otherwise look for an entry
- * with the same function/argument pair.
- */
-Bool
-XmuLookupCloseDisplayHook(Display *dpy, CloseHook handle,
- XmuCloseHookProc func, XPointer arg)
-{
- DisplayEntry *de = _FindDisplayEntry (dpy, NULL);
- register CallbackRec *h;
-
- if (!de) return False;
-
- for (h = de->start; h; h = h->next) {
- if (handle) {
- if (h == (CallbackRec *) handle) break;
- } else {
- if (h->func == func && h->arg == arg) break;
- }
- }
- return (h ? True : False);
-}
-
-
-/*
- *****************************************************************************
- * internal routines *
- *****************************************************************************
- */
-
-
-/*
- * Find the specified display on the linked list of displays. Also return
- * the preceeding link so that the display can be unlinked without having
- * back pointers.
- */
-static DisplayEntry *
-_FindDisplayEntry(register Display *dpy, DisplayEntry **prevp)
-{
- register DisplayEntry *d, *prev;
-
- for (d = elist, prev = NULL; d; d = d->next) {
- if (d->dpy == dpy) {
- if (prevp) *prevp = prev;
- return d;
- }
- prev = d;
- }
- return NULL;
-}
-
-
-
-/*
- * _DoCallbacks - process all of the callbacks for this display and free
- * the associated callback data (callback records and display entries).
- */
-/* ARGSUSED */
-static int
-_DoCallbacks(Display *dpy, XExtCodes *codes)
-{
- register CallbackRec *h;
- DisplayEntry *prev;
- DisplayEntry *de = _FindDisplayEntry (dpy, &prev);
-
- if (!de) return 0;
-
- /* walk the list doing the callbacks and freeing callback record */
- for (h = de->start; h;) {
- register CallbackRec *nexth = h->next;
- de->calling = h; /* let remove know we'll free it */
- (*(h->func)) (dpy, h->arg);
- de->calling = NULL;
- free ((char *) h);
- h = nexth;
- }
-
- /* unlink this display from chain */
- if (elist == de) {
- elist = de->next;
- } else {
- prev->next = de->next;
- }
- free ((char *) de);
- return 1;
-}
-
-
-/*
- * _MakeExtension - create an extension for this display; done once per display
- */
-static Bool
-_MakeExtension(Display *dpy, int *extensionp)
-{
- XExtCodes *codes;
-
- codes = XAddExtension (dpy);
- if (!codes) return False;
-
- (void) XESetCloseDisplay (dpy, codes->extension, _DoCallbacks);
-
- *extensionp = codes->extension;
- return True;
-}
diff --git a/xc/lib/Xmu/CloseHook.h b/xc/lib/Xmu/CloseHook.h
deleted file mode 100644
index 7684e9918..000000000
--- a/xc/lib/Xmu/CloseHook.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $TOG: CloseHook.h /main/8 1998/02/06 15:41:32 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CloseHook.h,v 1.5 1998/10/03 09:06:22 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_CLOSEHOOK_H_
-#define _XMU_CLOSEHOOK_H_
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xlibint.h>
-
-typedef XPointer CloseHook;
-
-typedef int (*XmuCloseHookProc)(Display *dpy, XPointer data);
-
-_XFUNCPROTOBEGIN
-
-CloseHook XmuAddCloseDisplayHook
-(
- Display *dpy,
- XmuCloseHookProc proc,
- XPointer arg
- );
-
-Bool XmuLookupCloseDisplayHook
-(
- Display *dpy,
- CloseHook handle,
- XmuCloseHookProc proc,
- XPointer arg
- );
-
-Bool XmuRemoveCloseDisplayHook
-(
- Display *dpy,
- CloseHook handle,
- XmuCloseHookProc proc,
- XPointer arg
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_CLOSEHOOK_H_ */
diff --git a/xc/lib/Xmu/CmapAlloc.c b/xc/lib/Xmu/CmapAlloc.c
deleted file mode 100644
index dab0b770b..000000000
--- a/xc/lib/Xmu/CmapAlloc.c
+++ /dev/null
@@ -1,339 +0,0 @@
-/* $TOG: CmapAlloc.c /main/10 1998/02/06 15:41:38 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CmapAlloc.c,v 1.5 1998/10/03 09:06:22 dawes Exp $ */
-
-/*
- * Author: Donna Converse, MIT X Consortium
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-#include <stdio.h>
-
-#define lowbit(x) ((x) & (~(x) + 1))
-
-/*
- * Prototypes
- */
-static void best_allocation(XVisualInfo*, unsigned long*, unsigned long*,
- unsigned long*);
-static int default_allocation(XVisualInfo*, unsigned long*,
- unsigned long*, unsigned long*);
-static void gray_allocation(int, unsigned long*, unsigned long*,
- unsigned long*);
-static int icbrt(int);
-static int icbrt_with_bits(int, int);
-static int icbrt_with_guess(int, int);
-
-/* To determine the best allocation of reds, greens, and blues in a
- * standard colormap, use XmuGetColormapAllocation.
- * vinfo specifies visual information for a chosen visual
- * property specifies one of the standard colormap property names
- * red_max returns maximum red value
- * green_max returns maximum green value
- * blue_max returns maximum blue value
- *
- * XmuGetColormapAllocation returns 0 on failure, non-zero on success.
- * It is assumed that the visual is appropriate for the colormap property.
- */
-
-Status
-XmuGetColormapAllocation(XVisualInfo *vinfo, Atom property,
- unsigned long *red_max,
- unsigned long *green_max,
- unsigned long *blue_max)
-{
- Status status = 1;
-
- if (vinfo->colormap_size <= 2)
- return 0;
-
- switch (property)
- {
- case XA_RGB_DEFAULT_MAP:
- status = default_allocation(vinfo, red_max, green_max, blue_max);
- break;
- case XA_RGB_BEST_MAP:
- best_allocation(vinfo, red_max, green_max, blue_max);
- break;
- case XA_RGB_GRAY_MAP:
- gray_allocation(vinfo->colormap_size, red_max, green_max, blue_max);
- break;
- case XA_RGB_RED_MAP:
- *red_max = vinfo->colormap_size - 1;
- *green_max = *blue_max = 0;
- break;
- case XA_RGB_GREEN_MAP:
- *green_max = vinfo->colormap_size - 1;
- *red_max = *blue_max = 0;
- break;
- case XA_RGB_BLUE_MAP:
- *blue_max = vinfo->colormap_size - 1;
- *red_max = *green_max = 0;
- break;
- default:
- status = 0;
- }
- return status;
-}
-
-/****************************************************************************/
-/* Determine the appropriate color allocations of a gray scale.
- *
- * Keith Packard, MIT X Consortium
- */
-
-static void
-gray_allocation(int n, unsigned long *red_max, unsigned long *green_max,
- unsigned long *blue_max)
-{
- *red_max = (n * 30) / 100;
- *green_max = (n * 59) / 100;
- *blue_max = (n * 11) / 100;
- *green_max += ((n - 1) - (*red_max + *green_max + *blue_max));
-}
-
-/****************************************************************************/
-/* Determine an appropriate color allocation for the RGB_DEFAULT_MAP.
- * If a map has less than a minimum number of definable entries, we do not
- * produce an allocation for an RGB_DEFAULT_MAP.
- *
- * For 16 planes, the default colormap will have 27 each RGB; for 12 planes,
- * 12 each. For 8 planes, let n = the number of colormap entries, which may
- * be 256 or 254. Then, maximum red value = floor(cube_root(n - 125)) - 1.
- * Maximum green and maximum blue values are identical to maximum red.
- * This leaves at least 125 cells which clients can allocate.
- *
- * Return 0 if an allocation has been determined, non-zero otherwise.
- */
-
-static int
-default_allocation(XVisualInfo *vinfo, unsigned long *red,
- unsigned long *green, unsigned long *blue)
-{
- int ngrays; /* number of gray cells */
-
- switch (vinfo->class) {
- case PseudoColor:
-
- if (vinfo->colormap_size > 65000)
- /* intended for displays with 16 planes */
- *red = *green = *blue = (unsigned long) 27;
- else if (vinfo->colormap_size > 4000)
- /* intended for displays with 12 planes */
- *red = *green = *blue = (unsigned long) 12;
- else if (vinfo->colormap_size < 250)
- return 0;
- else
- /* intended for displays with 8 planes */
- *red = *green = *blue = (unsigned long)
- (icbrt(vinfo->colormap_size - 125) - 1);
- break;
-
- case DirectColor:
-
- if (vinfo->colormap_size < 10)
- return 0;
- *red = *green = *blue = vinfo->colormap_size / 2 - 1;
- break;
-
- case TrueColor:
-
- *red = vinfo->red_mask / lowbit(vinfo->red_mask);
- *green = vinfo->green_mask / lowbit(vinfo->green_mask);
- *blue = vinfo->blue_mask / lowbit(vinfo->blue_mask);
- break;
-
- case GrayScale:
-
- if (vinfo->colormap_size > 65000)
- ngrays = 4096;
- else if (vinfo->colormap_size > 4000)
- ngrays = 512;
- else if (vinfo->colormap_size < 250)
- return 0;
- else
- ngrays = 12;
- gray_allocation(ngrays, red, green, blue);
- break;
-
- default:
- return 0;
- }
- return 1;
-}
-
-/****************************************************************************/
-/* Determine an appropriate color allocation for the RGB_BEST_MAP.
- *
- * For a DirectColor or TrueColor visual, the allocation is determined
- * by the red_mask, green_mask, and blue_mask members of the visual info.
- *
- * Otherwise, if the colormap size is an integral power of 2, determine
- * the allocation according to the number of bits given to each color,
- * with green getting more than red, and red more than blue, if there
- * are to be inequities in the distribution. If the colormap size is
- * not an integral power of 2, let n = the number of colormap entries.
- * Then maximum red value = floor(cube_root(n)) - 1;
- * maximum blue value = floor(cube_root(n)) - 1;
- * maximum green value = n / ((# red values) * (# blue values)) - 1;
- * Which, on a GPX, allows for 252 entries in the best map, out of 254
- * defineable colormap entries.
- */
-
-static void
-best_allocation(XVisualInfo *vinfo, unsigned long *red, unsigned long *green,
- unsigned long *blue)
-{
-
- if (vinfo->class == DirectColor || vinfo->class == TrueColor)
- {
- *red = vinfo->red_mask;
- while ((*red & 01) == 0)
- *red >>= 1;
- *green = vinfo->green_mask;
- while ((*green & 01) == 0)
- *green >>=1;
- *blue = vinfo->blue_mask;
- while ((*blue & 01) == 0)
- *blue >>= 1;
- }
- else
- {
- register int bits, n;
-
- /* Determine n such that n is the least integral power of 2 which is
- * greater than or equal to the number of entries in the colormap.
- */
- n = 1;
- bits = 0;
- while (vinfo->colormap_size > n)
- {
- n = n << 1;
- bits++;
- }
-
- /* If the number of entries in the colormap is a power of 2, determine
- * the allocation by "dealing" the bits, first to green, then red, then
- * blue. If not, find the maximum integral red, green, and blue values
- * which, when multiplied together, do not exceed the number of
-
- * colormap entries.
- */
- if (n == vinfo->colormap_size)
- {
- register int r, g, b;
- b = bits / 3;
- g = b + ((bits % 3) ? 1 : 0);
- r = b + (((bits % 3) == 2) ? 1 : 0);
- *red = 1 << r;
- *green = 1 << g;
- *blue = 1 << b;
- }
- else
- {
- *red = icbrt_with_bits(vinfo->colormap_size, bits);
- *blue = *red;
- *green = (vinfo->colormap_size / ((*red) * (*blue)));
- }
- (*red)--;
- (*green)--;
- (*blue)--;
- }
- return;
-}
-
-/*
- * integer cube roots by Newton's method
- *
- * Stephen Gildea, MIT X Consortium, July 1991
- */
-
-static int
-icbrt(int a)
-{
- register int bits = 0;
- register unsigned n = a;
-
- while (n)
- {
- bits++;
- n >>= 1;
- }
- return icbrt_with_bits(a, bits);
-}
-
-
-static int
-icbrt_with_bits(int a, int bits)
- /* bits - log 2 of a */
-{
- return icbrt_with_guess(a, a>>2*bits/3);
-}
-
-#ifdef _X_ROOT_STATS
-int icbrt_loopcount;
-#endif
-
-/* 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) */
-
-/*
- * Quick and dirty cube roots. Nothing fancy here, just Newton's method.
- * Only works for positive integers (since that's all we need).
- * We actually return floor(cbrt(a)) because that's what we need here, too.
- */
-
-static int
-icbrt_with_guess(int a, int guess)
-{
- register int delta;
-
-#ifdef _X_ROOT_STATS
- icbrt_loopcount = 0;
-#endif
- if (a <= 0)
- return 0;
- if (guess < 1)
- guess = 1;
-
- do {
-#ifdef _X_ROOT_STATS
- icbrt_loopcount++;
-#endif
- delta = (guess - a/(guess*guess))/3;
-#ifdef DEBUG
- printf("pass %d: guess=%d, delta=%d\n", icbrt_loopcount, guess, delta);
-#endif
- guess -= delta;
- } while (delta != 0);
-
- if (guess*guess*guess > a)
- guess--;
-
- return guess;
-}
diff --git a/xc/lib/Xmu/Converters.h b/xc/lib/Xmu/Converters.h
deleted file mode 100644
index 3604ad3c6..000000000
--- a/xc/lib/Xmu/Converters.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/* $TOG: Converters.h /main/17 1998/02/06 15:41:45 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.
-
-*/
-
-/* $XFree86: xc/lib/Xmu/Converters.h,v 1.4 1998/10/03 09:06:22 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_STRCONVERT_H_
-#define _XMU_STRCONVERT_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-void XmuCvtFunctionToCallback
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-#define XtNbackingStore "backingStore"
-#define XtCBackingStore "BackingStore"
-#define XtRBackingStore "BackingStore"
-#define XtEnotUseful "notUseful"
-#define XtEwhenMapped "whenMapped"
-#define XtEalways "always"
-#define XtEdefault "default"
-void XmuCvtStringToBackingStore
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-Boolean XmuCvtBackingStoreToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-void XmuCvtStringToCursor
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-#define XtRColorCursor "ColorCursor"
-#define XtNpointerColor "pointerColor"
-#define XtNpointerColorBackground "pointerColorBackground"
-Boolean XmuCvtStringToColorCursor
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-typedef int XtGravity;
-
-#ifndef XtRGravity
-#define XtRGravity "Gravity"
-#endif
-#define XtEForget "forget"
-#define XtENorthWest "northwest"
-#define XtENorth "north"
-#define XtENorthEast "northeast"
-#define XtEWest "west"
-#define XtECenter "center"
-#define XtEEast "east"
-#define XtESouthWest "southwest"
-#define XtESouth "south"
-#define XtESouthEast "southeast"
-#define XtEStatic "static"
-#define XtEUnmap "unmap"
-void XmuCvtStringToGravity
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-Boolean XmuCvtGravityToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-typedef enum {
- XtJustifyLeft, /* justify text to left side of button */
- XtJustifyCenter, /* justify text in center of button */
- XtJustifyRight /* justify text to right side of button */
-} XtJustify;
-#ifndef XtRJustify
-#define XtRJustify "Justify"
-#endif
-#define XtEleft "left"
-#define XtEcenter "center"
-#define XtEright "right"
-#define XtEtop "top"
-#define XtEbottom "bottom"
-void XmuCvtStringToJustify
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-Boolean XmuCvtJustifyToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-#define XtRLong "Long"
-void XmuCvtStringToLong
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-Boolean XmuCvtLongToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-typedef enum {
- XtorientHorizontal,
- XtorientVertical
-} XtOrientation;
-void XmuCvtStringToOrientation
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-Boolean XmuCvtOrientationToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-void XmuCvtStringToBitmap
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-#define XtRShapeStyle "ShapeStyle"
-#define XtERectangle "Rectangle"
-#define XtEOval "Oval"
-#define XtEEllipse "Ellipse"
-#define XtERoundedRectangle "RoundedRectangle"
-
-#define XmuShapeRectangle 1
-#define XmuShapeOval 2
-#define XmuShapeEllipse 3
-#define XmuShapeRoundedRectangle 4
-
-Boolean XmuCvtStringToShapeStyle
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-Boolean XmuCvtShapeStyleToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal,
- XtPointer *converter_data
- );
-
-Boolean XmuReshapeWidget
-(
- Widget w,
- int shape_style,
- int corner_width,
- int corner_height
- );
-
-void XmuCvtStringToWidget
-(
- XrmValue *args,
- Cardinal *num_args,
- XrmValuePtr fromVal,
- XrmValuePtr toVal
- );
-
-Boolean XmuNewCvtStringToWidget
-(
- Display *display,
- XrmValue *args,
- Cardinal *num_args,
- XrmValue *fromVal,
- XrmValue *toVal,
- XtPointer *converter_data
- );
-
-Boolean XmuCvtWidgetToString
-(
- Display *dpy,
- XrmValue *args,
- Cardinal *num_args,
- XrmValue *fromVal,
- XrmValue *toVal,
- XtPointer *converter_data
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_STRCONVERT_H_ */
diff --git a/xc/lib/Xmu/CrCmap.c b/xc/lib/Xmu/CrCmap.c
deleted file mode 100644
index bd571018a..000000000
--- a/xc/lib/Xmu/CrCmap.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/* $TOG: CrCmap.c /main/7 1998/02/06 15:41:49 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/lib/Xmu/CrCmap.c,v 3.5 1999/03/21 07:34:35 dawes Exp $ */
-
-/*
- * Author: Donna Converse, MIT X Consortium
- */
-
-/*
- * CreateCmap.c - given a standard colormap description, make the map.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-/*
- * Prototypes
- */
-/* allocate entire map Read Only */
-static int ROmap(Display*, Colormap, unsigned long[], int, int);
-
-/* allocate a cell, prefer Read Only */
-static Status ROorRWcell(Display*, Colormap, unsigned long[], int,
- XColor*, unsigned long);
-
-/* allocate a cell Read Write */
-static Status RWcell(Display*, Colormap, XColor*, XColor*, unsigned long*);
-
-/* for quicksort */
-static int compare(_Xconst void*, _Xconst void*);
-
-/* find contiguous sequence of cells */
-static Status contiguous(unsigned long[], int, int, unsigned long, int*, int*);
-
-/* frees resources before quitting */
-static void free_cells(Display*, Colormap, unsigned long[], int, int);
-
-/* create a map in a RO visual type */
-static Status readonly_map(Display*, XVisualInfo*, XStandardColormap*);
-
-/* create a map in a RW visual type */
-static Status readwrite_map(Display*, XVisualInfo*, XStandardColormap*);
-
-#define lowbit(x) ((x) & (~(x) + 1))
-#define TRUEMATCH(mult,max,mask) \
- (colormap->max * colormap->mult <= vinfo->mask && \
- lowbit(vinfo->mask) == colormap->mult)
-
-/*
- * To create any one colormap which is described by an XStandardColormap
- * structure, use XmuCreateColormap().
- *
- * Return 0 on failure, non-zero on success.
- * Resources created by this function are not made permanent.
- * No argument error checking is provided. Use at your own risk.
- *
- * All colormaps are created with read only allocations, with the exception
- * of read only allocations of colors in the default map or otherwise
- * which fail to return the expected pixel value, and these are individually
- * defined as read/write allocations. This is done so that all the cells
- * defined in the default map are contiguous, for use in image processing.
- * This typically happens with White and Black in the default map.
- *
- * Colormaps of static visuals are considered to be successfully created if
- * the map of the static visual matches the definition given in the
- * standard colormap structure.
- */
-
-Status
-XmuCreateColormap(Display *dpy, XStandardColormap *colormap)
- /* dpy - specifies the connection under which the map is created
- * colormap - specifies the map to be created, and returns, particularly
- * if the map is created as a subset of the default colormap
- * of the screen, the base_pixel of the map.
- */
-{
- XVisualInfo vinfo_template; /* template visual information */
- XVisualInfo *vinfo; /* matching visual information */
- XVisualInfo *vpointer; /* for freeing the entire list */
- long vinfo_mask; /* specifies the visual mask value */
- int n; /* number of matching visuals */
- int status;
-
- vinfo_template.visualid = colormap->visualid;
- vinfo_mask = VisualIDMask;
- if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
- return 0;
-
- /* A visual id may be valid on multiple screens. Also, there may
- * be multiple visuals with identical visual ids at different depths.
- * If the colormap is the Default Colormap, use the Default Visual.
- * Otherwise, arbitrarily, use the deepest visual.
- */
- vpointer = vinfo;
- if (n > 1)
- {
- register int i;
- register int screen_number;
- Bool def_cmap;
-
- def_cmap = False;
- for (screen_number = ScreenCount(dpy); --screen_number >= 0; )
- if (colormap->colormap == DefaultColormap(dpy, screen_number)) {
- def_cmap = True;
- break;
- }
-
- if (def_cmap) {
- for (i=0; i < n; i++, vinfo++) {
- if (vinfo->visual == DefaultVisual(dpy, screen_number))
- break;
- }
- } else {
- int maxdepth = 0;
- XVisualInfo *v = NULL;
-
- for (i=0; i < n; i++, vinfo++)
- if (vinfo->depth > maxdepth) {
- maxdepth = vinfo->depth;
- v = vinfo;
- }
- vinfo = v;
- }
- }
-
- if (vinfo->class == PseudoColor || vinfo->class == DirectColor ||
- vinfo->class == GrayScale)
- status = readwrite_map(dpy, vinfo, colormap);
- else if (vinfo->class == TrueColor)
- status = TRUEMATCH(red_mult, red_max, red_mask) &&
- TRUEMATCH(green_mult, green_max, green_mask) &&
- TRUEMATCH(blue_mult, blue_max, blue_mask);
- else
- status = readonly_map(dpy, vinfo, colormap);
-
- XFree((char *) vpointer);
- return status;
-}
-
-/****************************************************************************/
-static Status
-readwrite_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
-{
- register unsigned long i, n; /* index counters */
- unsigned long ncolors; /* number of colors to be defined */
- int npixels; /* number of pixels allocated R/W */
- int first_index; /* first index of pixels to use */
- int remainder; /* first index of remainder */
- XColor color; /* the definition of a color */
- unsigned long *pixels; /* array of colormap pixels */
- unsigned long delta;
-
-
- /* Determine ncolors, the number of colors to be defined.
- * Insure that 1 < ncolors <= the colormap size.
- */
- if (vinfo->class == DirectColor) {
- ncolors = colormap->red_max;
- if (colormap->green_max > ncolors)
- ncolors = colormap->green_max;
- if (colormap->blue_max > ncolors)
- ncolors = colormap->blue_max;
- ncolors++;
- delta = lowbit(vinfo->red_mask) +
- lowbit(vinfo->green_mask) +
- lowbit(vinfo->blue_mask);
- } else {
- ncolors = colormap->red_max * colormap->red_mult +
- colormap->green_max * colormap->green_mult +
- colormap->blue_max * colormap->blue_mult + 1;
- delta = 1;
- }
- if (ncolors <= 1 || (int) ncolors > vinfo->colormap_size) return 0;
-
- /* Allocate Read/Write as much of the colormap as we can possibly get.
- * Then insure that the pixels we were allocated are given in
- * monotonically increasing order, using a quicksort. Next, insure
- * that our allocation includes a subset of contiguous pixels at least
- * as long as the number of colors to be defined. Now we know that
- * these conditions are met:
- * 1) There are no free cells in the colormap.
- * 2) We have a contiguous sequence of pixels, monotonically
- * increasing, of length >= the number of colors requested.
- *
- * One cell at a time, we will free, compute the next color value,
- * then allocate read only. This takes a long time.
- * This is done to insure that cells are allocated read only in the
- * contiguous order which we prefer. If the server has a choice of
- * cells to grant to an allocation request, the server may give us any
- * cell, so that is why we do these slow gymnastics.
- */
-
- if ((pixels = (unsigned long *) calloc((unsigned) vinfo->colormap_size,
- sizeof(unsigned long))) == NULL)
- return 0;
-
- if ((npixels = ROmap(dpy, colormap->colormap, pixels,
- vinfo->colormap_size, ncolors)) == 0) {
- free((char *) pixels);
- return 0;
- }
-
- qsort((char *) pixels, npixels, sizeof(unsigned long), compare);
-
- if (!contiguous(pixels, npixels, ncolors, delta, &first_index, &remainder))
- {
- /* can't find enough contiguous cells, give up */
- XFreeColors(dpy, colormap->colormap, pixels, npixels,
- (unsigned long) 0);
- free((char *) pixels);
- return 0;
- }
- colormap->base_pixel = pixels[first_index];
-
- /* construct a gray map */
- if (colormap->red_mult == 1 && colormap->green_mult == 1 &&
- colormap->blue_mult == 1)
- for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
- {
- color.pixel = n;
- color.blue = color.green = color.red =
- (unsigned short) ((i * 65535) / (colormap->red_max +
- colormap->green_max +
- colormap->blue_max));
-
- if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
- first_index + i))
- return 0;
- }
-
- /* construct a red ramp map */
- else if (colormap->green_max == 0 && colormap->blue_max == 0)
- for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
- {
- color.pixel = n;
- color.red = (unsigned short) ((i * 65535) / colormap->red_max);
- color.green = color.blue = 0;
-
- if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
- first_index + i))
- return 0;
- }
-
- /* construct a green ramp map */
- else if (colormap->red_max == 0 && colormap->blue_max == 0)
- for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
- {
- color.pixel = n;
- color.green = (unsigned short) ((i * 65535) / colormap->green_max);
- color.red = color.blue = 0;
-
- if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
- first_index + i))
- return 0;
- }
-
- /* construct a blue ramp map */
- else if (colormap->red_max == 0 && colormap->green_max == 0)
- for (n=colormap->base_pixel, i=0; i < ncolors; i++, n += delta)
- {
- color.pixel = n;
- color.blue = (unsigned short) ((i * 65535) / colormap->blue_max);
- color.red = color.green = 0;
-
- if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
- first_index + i))
- return 0;
- }
-
- /* construct a standard red green blue cube map */
- else
- {
-#define calc(max,mult) (((n / colormap->mult) % \
- (colormap->max + 1)) * 65535) / colormap->max
-
- for (n=0, i=0; i < ncolors; i++, n += delta)
- {
- color.pixel = n + colormap->base_pixel;
- color.red = calc(red_max, red_mult);
- color.green = calc(green_max, green_mult);
- color.blue = calc(blue_max, blue_mult);
- if (! ROorRWcell(dpy, colormap->colormap, pixels, npixels, &color,
- first_index + i))
- return 0;
- }
-#undef calc
- }
- /* We have a read-only map defined. Now free unused cells,
- * first those occuring before the contiguous sequence begins,
- * then any following the contiguous sequence.
- */
-
- if (first_index)
- XFreeColors(dpy, colormap->colormap, pixels, first_index,
- (unsigned long) 0);
- if (remainder)
- XFreeColors(dpy, colormap->colormap,
- &(pixels[first_index + ncolors]), remainder,
- (unsigned long) 0);
-
- free((char *) pixels);
- return 1;
-}
-
-
-/****************************************************************************/
-static int
-ROmap(Display *dpy, Colormap cmap, unsigned long pixels[], int m, int n)
- /*
- * dpy - the X server connection
- * cmap - specifies colormap ID
- * pixels - returns pixel allocations
- * m - specifies colormap size
- * n - specifies number of colors
- */
-{
- register int p;
-
- /* first try to allocate the entire colormap */
- if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
- (unsigned) 0, pixels, (unsigned) m))
- return m;
-
- /* Allocate all available cells in the colormap, using a binary
- * algorithm to discover how many cells we can allocate in the colormap.
- */
- m--;
- while (n <= m) {
- p = n + ((m - n + 1) / 2);
- if (XAllocColorCells(dpy, cmap, 1, (unsigned long *) NULL,
- (unsigned) 0, pixels, (unsigned) p)) {
- if (p == m)
- return p;
- else {
- XFreeColors(dpy, cmap, pixels, p, (unsigned long) 0);
- n = p;
- }
- }
- else
- m = p - 1;
- }
- return 0;
-}
-
-
-/****************************************************************************/
-static Status
-contiguous(unsigned long pixels[], int npixels, int ncolors,
- unsigned long delta, int *first, int *rem)
- /* pixels - specifies allocated pixels
- * npixels - specifies count of alloc'd pixels
- * ncolors - specifies needed sequence length
- * delta - between pixels
- * first - returns first index of sequence
- * rem - returns first index after sequence, or 0, if none follow
- */
-{
- register int i = 1; /* walking index into the pixel array */
- register int count = 1; /* length of sequence discovered so far */
-
- *first = 0;
- if (npixels == ncolors) {
- *rem = 0;
- return 1;
- }
- *rem = npixels - 1;
- while (count < ncolors && ncolors - count <= *rem)
- {
- if (pixels[i-1] + delta == pixels[i])
- count++;
- else {
- count = 1;
- *first = i;
- }
- i++;
- (*rem)--;
- }
- if (count != ncolors)
- return 0;
- return 1;
-}
-
-
-/****************************************************************************/
-static Status
-ROorRWcell(Display *dpy, Colormap cmap, unsigned long pixels[],
- int npixels, XColor *color, unsigned long p)
-{
- unsigned long pixel;
- XColor request;
-
- /* Free the read/write allocation of one cell in the colormap.
- * Request a read only allocation of one cell in the colormap.
- * If the read only allocation cannot be granted, give up, because
- * there must be no free cells in the colormap.
- * If the read only allocation is granted, but gives us a cell which
- * is not the one that we just freed, it is probably the case that
- * we are trying allocate White or Black or some other color which
- * already has a read-only allocation in the map. So we try to
- * allocate the previously freed cell with a read/write allocation,
- * because we want contiguous cells for image processing algorithms.
- */
-
- pixel = color->pixel;
- request.red = color->red;
- request.green = color->green;
- request.blue = color->blue;
-
- XFreeColors(dpy, cmap, &pixel, 1, (unsigned long) 0);
- if (! XAllocColor(dpy, cmap, color)
- || (color->pixel != pixel &&
- (!RWcell(dpy, cmap, color, &request, &pixel))))
- {
- free_cells(dpy, cmap, pixels, npixels, (int)p);
- return 0;
- }
- return 1;
-}
-
-
-/****************************************************************************/
-static void
-free_cells(Display *dpy, Colormap cmap, unsigned long pixels[],
- int npixels, int p)
- /*
- * pixels - to be freed
- * npixels - original number allocated
- */
-{
- /* One of the npixels allocated has already been freed.
- * p is the index of the freed pixel.
- * First free the pixels preceeding p, and there are p of them;
- * then free the pixels following p, there are npixels - p - 1 of them.
- */
- XFreeColors(dpy, cmap, pixels, p, (unsigned long) 0);
- XFreeColors(dpy, cmap, &(pixels[p+1]), npixels - p - 1, (unsigned long) 0);
- free((char *) pixels);
-}
-
-
-/****************************************************************************/
-static Status
-RWcell(Display *dpy, Colormap cmap, XColor *color, XColor *request,
- unsigned long *pixel)
-{
- unsigned long n = *pixel;
-
- XFreeColors(dpy, cmap, &(color->pixel), 1, (unsigned long)0);
- if (! XAllocColorCells(dpy, cmap, (Bool) 0, (unsigned long *) NULL,
- (unsigned) 0, pixel, (unsigned) 1))
- return 0;
- if (*pixel != n)
- {
- XFreeColors(dpy, cmap, pixel, 1, (unsigned long) 0);
- return 0;
- }
- color->pixel = *pixel;
- color->flags = DoRed | DoGreen | DoBlue;
- color->red = request->red;
- color->green = request->green;
- color->blue = request->blue;
- XStoreColors(dpy, cmap, color, 1);
- return 1;
-}
-
-
-/****************************************************************************/
-static int
-compare(_Xconst void *e1, _Xconst void *e2)
-{
- return ((int)(*(long *)e1 - *(long *)e2));
-}
-
-
-/****************************************************************************/
-static Status
-readonly_map(Display *dpy, XVisualInfo *vinfo, XStandardColormap *colormap)
-{
- int i, last_pixel;
- XColor color;
-
- last_pixel = (colormap->red_max + 1) * (colormap->green_max + 1) *
- (colormap->blue_max + 1) + colormap->base_pixel - 1;
-
- for(i=colormap->base_pixel; i <= last_pixel; i++) {
-
- color.pixel = (unsigned long) i;
- color.red = (unsigned short)
- (((i/colormap->red_mult) * 65535) / colormap->red_max);
-
- if (vinfo->class == StaticColor) {
- color.green = (unsigned short)
- ((((i/colormap->green_mult) % (colormap->green_max + 1)) *
- 65535) / colormap->green_max);
- color.blue = (unsigned short)
- (((i%colormap->green_mult) * 65535) / colormap->blue_max);
- }
- else /* vinfo->class == GrayScale, old style allocation XXX */
- color.green = color.blue = color.red;
-
- XAllocColor(dpy, colormap->colormap, &color);
- if (color.pixel != (unsigned long) i)
- return 0;
- }
- return 1;
-}
diff --git a/xc/lib/Xmu/CrPixFBit.c b/xc/lib/Xmu/CrPixFBit.c
deleted file mode 100644
index a5121f389..000000000
--- a/xc/lib/Xmu/CrPixFBit.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* $TOG: CrPixFBit.c /main/5 1998/02/06 15:41:55 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CrPixFBit.c,v 1.5 1998/10/03 09:06:23 dawes Exp $ */
-
-/*
- * This file contains miscellaneous utility routines and is not part of the
- * Xlib standard.
- */
-
-/*
- * Public entry points:
- *
- * XmuCreatePixmapFromBitmap make a pixmap from a bitmap
- */
-
-#include <X11/Xos.h>
-#include <X11/Xlib.h>
-#include <X11/Xmu/Drawing.h>
-
-Pixmap
-XmuCreatePixmapFromBitmap(Display *dpy, Drawable d, Pixmap bitmap,
- unsigned int width, unsigned int height,
- unsigned int depth,
- unsigned long fore, unsigned long back)
- /*
- * dpy - connection to X server
- * d - drawable indicating screen
- * bitmap - single plane pixmap
- * width, height - dimensions of bitmap and pixmap
- * depth - depth of pixmap to create
- * fore, back - colors to use
- */
-{
- Pixmap pixmap;
-
- pixmap = XCreatePixmap (dpy, d, width, height, depth);
- if (pixmap != None) {
- GC gc;
- XGCValues xgcv;
-
- xgcv.foreground = fore;
- xgcv.background = back;
- xgcv.graphics_exposures = False;
-
- gc = XCreateGC (dpy, d,
- (GCForeground | GCBackground | GCGraphicsExposures),
- &xgcv);
- if (gc) {
- XCopyPlane (dpy, bitmap, pixmap, gc, 0, 0, width, height, 0, 0, 1);
- XFreeGC (dpy, gc);
- } else {
- XFreePixmap (dpy, pixmap);
- pixmap = None;
- }
- }
- return pixmap;
-}
diff --git a/xc/lib/Xmu/CurUtil.h b/xc/lib/Xmu/CurUtil.h
deleted file mode 100644
index b8291ce18..000000000
--- a/xc/lib/Xmu/CurUtil.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $TOG: CurUtil.h /main/5 1998/02/06 15:42:08 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CurUtil.h,v 1.4 1998/10/03 09:06:23 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_CURUTIL_H_
-#define _XMU_CURUTIL_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-int XmuCursorNameToIndex
-(
- _Xconst char *name
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_CURUTIL_H_ */
diff --git a/xc/lib/Xmu/CursorName.c b/xc/lib/Xmu/CursorName.c
deleted file mode 100644
index 3724b0f95..000000000
--- a/xc/lib/Xmu/CursorName.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $TOG: CursorName.c /main/10 1998/02/06 15:42: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CursorName.c,v 3.4 1999/03/21 07:34:35 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/CurUtil.h>
-#include <X11/cursorfont.h>
-
-int
-XmuCursorNameToIndex(_Xconst char *name)
-{
- static _Xconst struct _CursorName {
- _Xconst char *name;
- unsigned int shape;
- } cursor_names[] = {
- {"x_cursor", XC_X_cursor},
- {"arrow", XC_arrow},
- {"based_arrow_down", XC_based_arrow_down},
- {"based_arrow_up", XC_based_arrow_up},
- {"boat", XC_boat},
- {"bogosity", XC_bogosity},
- {"bottom_left_corner", XC_bottom_left_corner},
- {"bottom_right_corner", XC_bottom_right_corner},
- {"bottom_side", XC_bottom_side},
- {"bottom_tee", XC_bottom_tee},
- {"box_spiral", XC_box_spiral},
- {"center_ptr", XC_center_ptr},
- {"circle", XC_circle},
- {"clock", XC_clock},
- {"coffee_mug", XC_coffee_mug},
- {"cross", XC_cross},
- {"cross_reverse", XC_cross_reverse},
- {"crosshair", XC_crosshair},
- {"diamond_cross", XC_diamond_cross},
- {"dot", XC_dot},
- {"dotbox", XC_dotbox},
- {"double_arrow", XC_double_arrow},
- {"draft_large", XC_draft_large},
- {"draft_small", XC_draft_small},
- {"draped_box", XC_draped_box},
- {"exchange", XC_exchange},
- {"fleur", XC_fleur},
- {"gobbler", XC_gobbler},
- {"gumby", XC_gumby},
- {"hand1", XC_hand1},
- {"hand2", XC_hand2},
- {"heart", XC_heart},
- {"icon", XC_icon},
- {"iron_cross", XC_iron_cross},
- {"left_ptr", XC_left_ptr},
- {"left_side", XC_left_side},
- {"left_tee", XC_left_tee},
- {"leftbutton", XC_leftbutton},
- {"ll_angle", XC_ll_angle},
- {"lr_angle", XC_lr_angle},
- {"man", XC_man},
- {"middlebutton", XC_middlebutton},
- {"mouse", XC_mouse},
- {"pencil", XC_pencil},
- {"pirate", XC_pirate},
- {"plus", XC_plus},
- {"question_arrow", XC_question_arrow},
- {"right_ptr", XC_right_ptr},
- {"right_side", XC_right_side},
- {"right_tee", XC_right_tee},
- {"rightbutton", XC_rightbutton},
- {"rtl_logo", XC_rtl_logo},
- {"sailboat", XC_sailboat},
- {"sb_down_arrow", XC_sb_down_arrow},
- {"sb_h_double_arrow", XC_sb_h_double_arrow},
- {"sb_left_arrow", XC_sb_left_arrow},
- {"sb_right_arrow", XC_sb_right_arrow},
- {"sb_up_arrow", XC_sb_up_arrow},
- {"sb_v_double_arrow", XC_sb_v_double_arrow},
- {"shuttle", XC_shuttle},
- {"sizing", XC_sizing},
- {"spider", XC_spider},
- {"spraycan", XC_spraycan},
- {"star", XC_star},
- {"target", XC_target},
- {"tcross", XC_tcross},
- {"top_left_arrow", XC_top_left_arrow},
- {"top_left_corner", XC_top_left_corner},
- {"top_right_corner", XC_top_right_corner},
- {"top_side", XC_top_side},
- {"top_tee", XC_top_tee},
- {"trek", XC_trek},
- {"ul_angle", XC_ul_angle},
- {"umbrella", XC_umbrella},
- {"ur_angle", XC_ur_angle},
- {"watch", XC_watch},
- {"xterm", XC_xterm},
- };
- register _Xconst struct _CursorName *table;
- register Cardinal i;
- char tmp[40];
-
- if (strlen (name) >= sizeof tmp) return -1;
- XmuCopyISOLatin1Lowered (tmp, name);
-
- for (i=0, table=cursor_names; i < XtNumber(cursor_names); i++, table++ ) {
- if (strcmp(tmp, table->name) == 0) return table->shape;
- }
-
- return -1;
-}
-
-
-
-
-
diff --git a/xc/lib/Xmu/CvtCache.c b/xc/lib/Xmu/CvtCache.c
deleted file mode 100644
index 15206230b..000000000
--- a/xc/lib/Xmu/CvtCache.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* $TOG: CvtCache.c /main/9 1998/02/06 15:42: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CvtCache.c,v 3.3 1998/10/03 09:06:24 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xos.h>
-#include <X11/Xmu/CvtCache.h>
-
-#ifdef X_NOT_STDC_ENV
-extern char *malloc();
-#else
-#include <stdlib.h>
-#endif
-
-/*
- * Prototypes
- */
-static int _CloseDisplay(XmuDisplayQueue*, XmuDisplayQueueEntry*);
-static int _FreeCCDQ(XmuDisplayQueue*);
-static void _InitializeCvtCache(XmuCvtCache*);
-
-/*
- * From LocBitmap.c
- */
-void _XmuStringToBitmapFreeCache(register XmuCvtCache*);
-void _XmuStringToBitmapInitCache(register XmuCvtCache*);
-
-/*
- * Initialization
- */
-static XmuDisplayQueue *dq = NULL;
-
-
-/*
- * internal utility callbacks
- */
-
-static int
-_FreeCCDQ(XmuDisplayQueue *q)
-{
- XmuDQDestroy (dq, False);
- dq = NULL;
- return (0);
-}
-
-
-static int
-_CloseDisplay(XmuDisplayQueue *q, XmuDisplayQueueEntry *e)
-{
- XmuCvtCache *c;
-
- if (e && (c = (XmuCvtCache *)(e->data))) {
- _XmuStringToBitmapFreeCache (c);
- /* insert calls to free any cached memory */
-
- }
- return 0;
-}
-
-static void
-_InitializeCvtCache(register XmuCvtCache *c)
-{
- _XmuStringToBitmapInitCache (c);
- /* insert calls to init any cached memory */
-}
-
-
-/*
- * XmuCCLookupDisplay - return the cache entry for the indicated display;
- * initialize the cache if necessary
- */
-XmuCvtCache *
-_XmuCCLookupDisplay(Display *dpy)
-{
- XmuDisplayQueueEntry *e;
-
- /*
- * If no displays have been added before this, create the display queue.
- */
- if (!dq) {
- dq = XmuDQCreate (_CloseDisplay, _FreeCCDQ, NULL);
- if (!dq) return NULL;
- }
-
- /*
- * See if the display is already there
- */
- e = XmuDQLookupDisplay (dq, dpy); /* see if it's there */
- if (!e) { /* else create it */
- XmuCvtCache *c = (XmuCvtCache *) malloc (sizeof (XmuCvtCache));
- if (!c) return NULL;
-
- /*
- * Add the display to the queue
- */
- e = XmuDQAddDisplay (dq, dpy, (XPointer) c);
- if (!e) {
- free ((char *) c);
- return NULL;
- }
-
- /*
- * initialize fields in cache
- */
- _InitializeCvtCache (c);
- }
-
- /*
- * got it
- */
- return (XmuCvtCache *)(e->data);
-}
-
-
diff --git a/xc/lib/Xmu/CvtCache.h b/xc/lib/Xmu/CvtCache.h
deleted file mode 100644
index e239beee2..000000000
--- a/xc/lib/Xmu/CvtCache.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $TOG: CvtCache.h /main/8 1998/02/06 15:42:17 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/lib/Xmu/CvtCache.h,v 1.5 1999/03/21 07:34:36 dawes Exp $ */
-
-/*
- * Public Interfaces
- *
- * XmuCvtCache *XmuCvtCacheLookupDisplay (dpy)
- * Display *dpy;
- */
-
-#ifndef _XMU_CVTCACHE_H_
-#define _XMU_CVTCACHE_H_
-
-#include <X11/Xmu/DisplayQue.h>
-#include <X11/Xfuncproto.h>
-
-typedef struct _XmuCvtCache {
- struct {
- char **bitmapFilePath;
- } string_to_bitmap;
- /* add other per-display data that needs to be cached */
-} XmuCvtCache;
-
-_XFUNCPROTOBEGIN
-
-XmuCvtCache *_XmuCCLookupDisplay
-(
- Display *dpy
- );
-
-extern void _XmuStringToBitmapInitCache(XmuCvtCache *c);
-extern void _XmuStringToBitmapFreeCache(XmuCvtCache *c);
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_CVTCACHE_H_ */
diff --git a/xc/lib/Xmu/CvtStdSel.c b/xc/lib/Xmu/CvtStdSel.c
deleted file mode 100644
index 7b282d527..000000000
--- a/xc/lib/Xmu/CvtStdSel.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/* $TOG: CvtStdSel.c /main/43 1998/02/06 15:42:23 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/CvtStdSel.c,v 3.13 1999/03/21 07:34:36 dawes Exp $ */
-
-/*
- * This file contains routines to handle common selection targets.
- *
- * Public entry points:
- *
- * XmuConvertStandardSelection() return a known selection
- */
-
-#ifdef SYSVNET
-#include <interlan/il_types.h>
-#define __TYPES__ /* prevent #include <sys/types.h> in Xlib.h */
-#include <interlan/netdb.h>
-#include <interlan/socket.h>
-#endif /* SYSVNET */
-
-#include <X11/IntrinsicP.h>
-#include <X11/Xatom.h>
-#include <X11/ShellP.h>
-#ifdef XTHREADS
-#include <X11/Xthreads.h>
-#endif
-#include <stdio.h>
-
-#ifndef SYSVNET
-#ifdef WIN32
-#include <X11/Xwinsock.h>
-#define XOS_USE_MTSAFE_NETDBAPI
-#else
-#ifndef Lynx
-#include <sys/socket.h>
-#else
-#include <sys/types.h>
-#include <socket.h>
-#endif
-#define XOS_USE_XT_LOCKING
-#endif
-#define X_INCLUDE_NETDB_H
-#include <X11/Xos_r.h>
-#endif
-
-#include <X11/Xos.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#endif
-#include "Atoms.h"
-#include "StdSel.h"
-#include "SysUtil.h"
-#include <X11/Xfuncs.h>
-
-#ifndef OS_NAME
-#ifndef X_OS_FILE
-#ifdef SYSV /* keep separate until makedepend fixed */
-#define USE_UNAME
-#endif
-#ifdef SVR4
-#define USE_UNAME
-#endif
-#ifdef ultrix
-#define USE_UNAME
-#endif
-#endif /*X_OS_FILE*/
-#ifdef USE_UNAME
-#ifdef ultrix
-#ifndef __STDC__
-#include <limits.h> /* fixed in Ultrix 3.0 */
-#endif
-#endif
-#include <sys/utsname.h>
-#endif
-#endif
-
-/*
- * Prototypes
- */
-static char *get_os_name(void);
-static Bool isApplicationShell(Widget);
-
-/*
- * Implementation
- */
-static char *
-get_os_name(void)
-{
-#ifdef OS_NAME
- return XtNewString(OS_NAME);
-#else
- FILE *f = NULL;
-
-#ifdef USE_UNAME
- struct utsname utss;
-
- if (uname (&utss) == 0) {
- char *os_name;
- int len = strlen(utss.sysname) + 1;
-#ifndef hpux /* because of hostname length crock */
- len += 2 + strlen(utss.release);
-#endif
- os_name = XtMalloc (len);
- strcpy (os_name, utss.sysname);
-#ifndef hpux
- strcat (os_name, " ");
- strcat (os_name, utss.release);
-#endif
- return os_name;
- }
-#endif
-
-#ifdef X_OS_FILE
- f = fopen(X_OS_FILE, "r");
- if (!f)
-#endif
-#ifdef MOTD_FILE
- f = fopen(MOTD_FILE, "r");
-#endif
- if (f) {
- char motd[512];
- motd[0] = '\0';
- (void) fgets(motd, 511, f);
- fclose(f);
- motd[511] = '\0';
- if (motd[0] != '\0') {
- int len = strlen(motd);
- if (motd[len - 1] == '\n')
- motd[len - 1] = '\0';
- return XtNewString(motd);
- }
- }
-
-#ifdef sun
- return XtNewString("SunOS");
-#else
-# if !defined(SYSV) && defined(unix)
- return XtNewString("BSD");
-# else
- return NULL;
-# endif
-#endif
-
-#endif /*OS_NAME*/
-}
-
-/* This is a trick/kludge. To make shared libraries happier (linking
- * against Xmu but not linking against Xt, and apparently even work
- * as we desire on SVR4, we need to avoid an explicit data reference
- * to applicationShellWidgetClass. XtIsTopLevelShell is known
- * (implementation dependent assumption!) to use a bit flag. So we
- * go that far. Then, we test whether it is an applicationShellWidget
- * class by looking for an explicit class name. Seems pretty safe.
- */
-static Bool
-isApplicationShell(Widget w)
-{
- register WidgetClass c;
-
- if (!XtIsTopLevelShell(w))
- return False;
- for (c = XtClass(w); c; c = c->core_class.superclass) {
- if (!strcmp(c->core_class.class_name, "ApplicationShell"))
- return True;
- }
- return False;
-}
-
-Boolean
-XmuConvertStandardSelection(Widget w, Time time, Atom *selection, Atom *target,
- Atom *type, XPointer *value,
- unsigned long *length, int *format)
-{
- Display *d = XtDisplay(w);
- if (*target == XA_TIMESTAMP(d)) {
- *value = XtMalloc(4);
- if (sizeof(long) == 4)
- *(long*)*value = time;
- else {
- long temp = time;
- (void) memmove((char*)*value, ((char*)&temp)+sizeof(long)-4, 4);
- }
- *type = XA_INTEGER;
- *length = 1;
- *format = 32;
- return True;
- }
- if (*target == XA_HOSTNAME(d)) {
- char hostname[1024];
- hostname[0] = '\0';
- *length = XmuGetHostname (hostname, sizeof hostname);
- *value = XtNewString(hostname);
- *type = XA_STRING;
- *format = 8;
- return True;
- }
-#if defined(TCPCONN) || defined(MNX_TCPCONN)
- if (*target == XA_IP_ADDRESS(d)) {
- char hostname[1024];
- _Xgethostbynameparams hparams;
- struct hostent *hostp;
-
- hostname[0] = '\0';
- (void) XmuGetHostname (hostname, sizeof hostname);
-
- if ((hostp = _XGethostbyname (hostname,hparams)) == NULL)
- return False;
-
- if (hostp->h_addrtype != AF_INET) return False;
- *length = hostp->h_length;
- *value = XtMalloc(*length);
- (void) memmove (*value, hostp->h_addr, *length);
- *type = XA_NET_ADDRESS(d);
- *format = 8;
- return True;
- }
-#endif
-#ifdef DNETCONN
- if (*target == XA_DECNET_ADDRESS(d)) {
- return False; /* XXX niy */
- }
-#endif
- if (*target == XA_USER(d)) {
- char *name = (char*)getenv("USER");
- if (name == NULL) return False;
- *value = XtNewString(name);
- *type = XA_STRING;
- *length = strlen(name);
- *format = 8;
- return True;
- }
- if (*target == XA_CLASS(d)) {
- Widget parent = XtParent(w);
- char *class;
- int len;
- while (parent != NULL && !isApplicationShell(w)) {
- w = parent;
- parent = XtParent(w);
- }
- if (isApplicationShell(w))
- class = ((ApplicationShellWidget) w)->application.class;
- else
- class = XtClass(w)->core_class.class_name;
- *length = (len=strlen(w->core.name)) + strlen(class) + 2;
- *value = XtMalloc(*length);
- strcpy( (char*)*value, w->core.name );
- strcpy( (char*)*value+len+1, class );
- *type = XA_STRING;
- *format = 8;
- return True;
- }
- if (*target == XA_NAME(d)) {
- Widget parent = XtParent(w);
-
- while (parent != NULL && !XtIsWMShell(w)) {
- w = parent;
- parent = XtParent(w);
- }
- if (!XtIsWMShell(w)) return False;
- *value = XtNewString( ((WMShellWidget) w)->wm.title );
- *length = strlen(*value);
- *type = XA_STRING;
- *format = 8;
- return True;
- }
- if (*target == XA_CLIENT_WINDOW(d)) {
- Widget parent = XtParent(w);
- while (parent != NULL) {
- w = parent;
- parent = XtParent(w);
- }
- *value = XtMalloc(sizeof(Window));
- *(Window*)*value = w->core.window;
- *type = XA_WINDOW;
- *length = 1;
- *format = 32;
- return True;
- }
- if (*target == XA_OWNER_OS(d)) {
- *value = get_os_name();
- if (*value == NULL) return False;
- *type = XA_STRING;
- *length = strlen(*value);
- *format = 8;
- return True;
- }
- if (*target == XA_TARGETS(d)) {
-#if defined(unix) && defined(DNETCONN)
-# define NUM_TARGETS 9
-#else
-# if defined(unix) || defined(DNETCONN)
-# define NUM_TARGETS 8
-# else
-# define NUM_TARGETS 7
-# endif
-#endif
- Atom* std_targets = (Atom*)XtMalloc(NUM_TARGETS*sizeof(Atom));
- int i = 0;
- std_targets[i++] = XA_TIMESTAMP(d);
- std_targets[i++] = XA_HOSTNAME(d);
- std_targets[i++] = XA_IP_ADDRESS(d);
- std_targets[i++] = XA_USER(d);
- std_targets[i++] = XA_CLASS(d);
- std_targets[i++] = XA_NAME(d);
- std_targets[i++] = XA_CLIENT_WINDOW(d);
-#ifdef unix
- std_targets[i++] = XA_OWNER_OS(d);
-#endif
-#ifdef DNETCONN
- std_targets[i++] = XA_DECNET_ADDRESS(d);
-#endif
- *value = (XPointer)std_targets;
- *type = XA_ATOM;
- *length = NUM_TARGETS;
- *format = 32;
- return True;
- }
- /* else */
- return False;
-}
diff --git a/xc/lib/Xmu/DefErrMsg.c b/xc/lib/Xmu/DefErrMsg.c
deleted file mode 100644
index 1ff23ebdf..000000000
--- a/xc/lib/Xmu/DefErrMsg.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $TOG: DefErrMsg.c /main/11 1998/02/06 15:42: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/DefErrMsg.c,v 1.6 1998/10/03 09:06:25 dawes Exp $ */
-
-#include <stdio.h>
-#define NEED_EVENTS
-#include <X11/Xlibint.h>
-#include <X11/Xproto.h>
-#include <X11/Xmu/Error.h>
-#include <X11/Xmu/SysUtil.h>
-
-/*
- * XmuPrintDefaultErrorMessage - print a nice error that looks like the usual
- * message. Returns 1 if the caller should consider exitting else 0.
- */
-int
-XmuPrintDefaultErrorMessage(Display *dpy, XErrorEvent *event, FILE *fp)
-{
- char buffer[BUFSIZ];
- char mesg[BUFSIZ];
- char number[32];
- char *mtype = "XlibMessage";
- register _XExtension *ext = (_XExtension *)NULL;
- _XExtension *bext = (_XExtension *)NULL;
- XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
- XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
- (void) fprintf(fp, "%s: %s\n ", mesg, buffer);
- XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->request_code);
- if (event->request_code < 128) {
- XmuSnprintf(number, sizeof(number), "%d", event->request_code);
- XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
- } else {
- /* XXX this is non-portable */
- for (ext = dpy->ext_procs;
- ext && (ext->codes.major_opcode != event->request_code);
- ext = ext->next)
- ;
- if (ext)
- XmuSnprintf(buffer, sizeof(buffer), "%s", ext->name);
- else
- buffer[0] = '\0';
- }
- (void) fprintf(fp, " (%s)", buffer);
- fputs("\n ", fp);
- if (event->request_code >= 128) {
- XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->minor_code);
- if (ext) {
- XmuSnprintf(mesg, sizeof(mesg),
- "%s.%d", ext->name, event->minor_code);
- XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
- (void) fprintf(fp, " (%s)", buffer);
- }
- fputs("\n ", fp);
- }
- if (event->error_code >= 128) {
- /* kludge, try to find the extension that caused it */
- buffer[0] = '\0';
- for (ext = dpy->ext_procs; ext; ext = ext->next) {
- if (ext->error_string)
- (*ext->error_string)(dpy, event->error_code, &ext->codes,
- buffer, BUFSIZ);
- if (buffer[0]) {
- bext = ext;
- break;
- }
- if (ext->codes.first_error &&
- ext->codes.first_error < event->error_code &&
- (!bext || ext->codes.first_error > bext->codes.first_error))
- bext = ext;
- }
- if (bext)
- XmuSnprintf(buffer, sizeof(buffer), "%s.%d", bext->name,
- event->error_code - bext->codes.first_error);
- else
- strcpy(buffer, "Value");
- XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
- if (mesg[0]) {
- fputs(" ", fp);
- (void) fprintf(fp, mesg, event->resourceid);
- fputs("\n", fp);
- }
- /* let extensions try to print the values */
- for (ext = dpy->ext_procs; ext; ext = ext->next) {
- if (ext->error_values)
- (*ext->error_values)(dpy, event, fp);
- }
- } else if ((event->error_code == BadWindow) ||
- (event->error_code == BadPixmap) ||
- (event->error_code == BadCursor) ||
- (event->error_code == BadFont) ||
- (event->error_code == BadDrawable) ||
- (event->error_code == BadColor) ||
- (event->error_code == BadGC) ||
- (event->error_code == BadIDChoice) ||
- (event->error_code == BadValue) ||
- (event->error_code == BadAtom)) {
- if (event->error_code == BadValue)
- XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
- mesg, BUFSIZ);
- else if (event->error_code == BadAtom)
- XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
- mesg, BUFSIZ);
- else
- XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->resourceid);
- fputs("\n ", fp);
- }
- XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->serial);
- fputs("\n ", fp);
- XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, NextRequest(dpy)-1);
- fputs("\n", fp);
- if (event->error_code == BadImplementation) return 0;
- return 1;
-}
-
-
-/*
- * XmuSimpleErrorHandler - ignore errors for XQueryTree, XGetWindowAttributes,
- * and XGetGeometry; print a message for everything else. In all case, do
- * not exit.
- */
-int
-XmuSimpleErrorHandler(Display *dpy, XErrorEvent *errorp)
-{
- switch (errorp->request_code) {
- case X_QueryTree:
- case X_GetWindowAttributes:
- if (errorp->error_code == BadWindow) return 0;
- break;
- case X_GetGeometry:
- if (errorp->error_code == BadDrawable) return 0;
- break;
- }
- /* got a "real" X error */
- return XmuPrintDefaultErrorMessage (dpy, errorp, stderr);
-}
diff --git a/xc/lib/Xmu/DelCmap.c b/xc/lib/Xmu/DelCmap.c
deleted file mode 100644
index f3432c056..000000000
--- a/xc/lib/Xmu/DelCmap.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $TOG: DelCmap.c /main/3 1998/02/06 15:42: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/DelCmap.c,v 1.5 1998/10/03 09:06:25 dawes Exp $ */
-
-/*
- * Author: Donna Converse, MIT X Consortium
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-/* To remove any standard colormap property, use XmuDeleteStandardColormap().
- * XmuDeleteStandardColormap() will remove the specified property from the
- * specified screen, releasing any resources used by the colormap(s) of the
- * property if possible.
- */
-
-void
-XmuDeleteStandardColormap(Display *dpy, int screen, Atom property)
- /* dpy; - specifies the X server to connect to
- * screen - specifies the screen of the display
- * property - specifies the standard colormap property
- */
-{
- XStandardColormap *stdcmaps, *s;
- int count = 0;
-
- if (XGetRGBColormaps(dpy, RootWindow(dpy, screen), &stdcmaps, &count,
- property))
- {
- for (s=stdcmaps; count > 0; count--, s++) {
- if ((s->killid == ReleaseByFreeingColormap) &&
- (s->colormap != None) &&
- (s->colormap != DefaultColormap(dpy, screen)))
- XFreeColormap(dpy, s->colormap);
- else if (s->killid != None)
- XKillClient(dpy, s->killid);
- }
- XDeleteProperty(dpy, RootWindow(dpy, screen), property);
- XFree((char *) stdcmaps);
- XSync(dpy, False);
- }
-}
-
diff --git a/xc/lib/Xmu/DisplayQue.c b/xc/lib/Xmu/DisplayQue.c
deleted file mode 100644
index 80bf56a10..000000000
--- a/xc/lib/Xmu/DisplayQue.c
+++ /dev/null
@@ -1,189 +0,0 @@
-/* $TOG: DisplayQue.c /main/7 1998/02/06 15:42: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/DisplayQue.c,v 3.2 1998/10/03 09:06:25 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#endif
-#include <X11/Xmu/DisplayQue.h>
-
-/*
- * Prototypes
- */
-static int _DQCloseDisplay(Display*, XPointer);
-
-#define CallCloseCallback(q,e) (void) (*((q)->closefunc)) ((q), (e))
-#define CallFreeCallback(q) (void) (*((q)->freefunc)) ((q))
-
-/*
- * XmuDQCreate - create a display queue
- */
-XmuDisplayQueue *
-XmuDQCreate(XmuCloseDisplayQueueProc closefunc,
- XmuFreeDisplayQueueProc freefunc,
- XPointer data)
-{
- XmuDisplayQueue *q = (XmuDisplayQueue *) malloc (sizeof (XmuDisplayQueue));
- if (q) {
- q->nentries = 0;
- q->head = q->tail = NULL;
- q->closefunc = closefunc;
- q->freefunc = freefunc;
- q->data = data;
- }
- return q;
-}
-
-
-/*
- * XmuDQDestroy - free all storage associated with this display queue,
- * optionally invoking the close callbacks.
- */
-
-Bool
-XmuDQDestroy(XmuDisplayQueue *q, Bool docallbacks)
-{
- XmuDisplayQueueEntry *e = q->head;
-
- while (e) {
- XmuDisplayQueueEntry *nexte = e->next;
- if (docallbacks && q->closefunc) CallCloseCallback (q, e);
- free ((char *) e);
- e = nexte;
- }
- free ((char *) q);
- return True;
-}
-
-
-/*
- * XmuDQLookupDisplay - finds the indicated display on the given queue
- */
-XmuDisplayQueueEntry *
-XmuDQLookupDisplay(XmuDisplayQueue *q, Display *dpy)
-{
- XmuDisplayQueueEntry *e;
-
- for (e = q->head; e; e = e->next) {
- if (e->display == dpy) return e;
- }
- return NULL;
-}
-
-
-/*
- * XmuDQAddDisplay - add the specified display to the queue; set data as a
- * convenience. Does not ensure that dpy hasn't already been added.
- */
-XmuDisplayQueueEntry *
-XmuDQAddDisplay(XmuDisplayQueue *q, Display *dpy, XPointer data)
-{
- XmuDisplayQueueEntry *e;
-
- if (!(e = (XmuDisplayQueueEntry *) malloc (sizeof (XmuDisplayQueueEntry)))) {
- return NULL;
- }
- if (!(e->closehook = XmuAddCloseDisplayHook (dpy, _DQCloseDisplay,
- (XPointer) q))) {
- free ((char *) e);
- return NULL;
- }
-
- e->display = dpy;
- e->next = NULL;
- e->data = data;
-
- if (q->tail) {
- q->tail->next = e;
- e->prev = q->tail;
- } else {
- q->head = e;
- e->prev = NULL;
- }
- q->tail = e;
- q->nentries++;
- return e;
-}
-
-
-/*
- * XmuDQRemoveDisplay - remove the specified display from the queue
- */
-Bool
-XmuDQRemoveDisplay(XmuDisplayQueue *q, Display *dpy)
-{
- XmuDisplayQueueEntry *e;
-
- for (e = q->head; e; e = e->next) {
- if (e->display == dpy) {
- if (q->head == e)
- q->head = e->next; /* if at head, then bump head */
- else
- e->prev->next = e->next; /* else splice out */
- if (q->tail == e)
- q->tail = e->prev; /* if at tail, then bump tail */
- else
- e->next->prev = e->prev; /* else splice out */
- (void) XmuRemoveCloseDisplayHook (dpy, e->closehook,
- _DQCloseDisplay, (XPointer) q);
- free ((char *) e);
- q->nentries--;
- return True;
- }
- }
- return False;
-}
-
-
-/*****************************************************************************
- * private functions *
- *****************************************************************************/
-
-/*
- * _DQCloseDisplay - upcalled from CloseHook to notify this queue; remove the
- * display when finished
- */
-static int
-_DQCloseDisplay(Display *dpy, XPointer arg)
-{
- XmuDisplayQueue *q = (XmuDisplayQueue *) arg;
- XmuDisplayQueueEntry *e;
-
- for (e = q->head; e; e = e->next) {
- if (e->display == dpy) {
- if (q->closefunc) CallCloseCallback (q, e);
- (void) XmuDQRemoveDisplay (q, dpy);
- if (q->nentries == 0 && q->freefunc) CallFreeCallback (q);
- return 1;
- }
- }
-
- return 0;
-}
diff --git a/xc/lib/Xmu/DisplayQue.h b/xc/lib/Xmu/DisplayQue.h
deleted file mode 100644
index 714e5392d..000000000
--- a/xc/lib/Xmu/DisplayQue.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $TOG: DisplayQue.h /main/8 1998/02/06 15:42:45 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/DisplayQue.h,v 1.4 1998/10/03 09:06:26 dawes Exp $ */
-
-#ifndef _XMU_DISPLAYQUE_H_
-#define _XMU_DISPLAYQUE_H_
-
-#include <X11/Xmu/CloseHook.h>
-#include <X11/Xfuncproto.h>
-
-/*
- * Public Entry Points
- *
- *
- * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
- * XmuCloseDisplayQueueProc closefunc;
- * XmuFreeDisplayQueueProc freefunc;
- * XPointer data;
- *
- * Creates and returns a queue into which displays may be placed. When
- * the display is closed, the closefunc (if non-NULL) is upcalled with
- * as follows:
- *
- * (*closefunc) (queue, entry)
- *
- * The freeproc, if non-NULL, is called whenever the last display is
- * closed, notifying the creator that display queue may be released
- * using XmuDQDestroy.
- *
- *
- * Bool XmuDQDestroy (q, docallbacks)
- * XmuDisplayQueue *q;
- * Bool docallbacks;
- *
- * Releases all memory for the indicated display queue. If docallbacks
- * is true, then the closefunc (if non-NULL) is called for each
- * display.
- *
- *
- * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
- * XmuDisplayQueue *q;
- * Display *dpy;
- *
- * Returns the queue entry for the specified display or NULL if the
- * display is not in the queue.
- *
- *
- * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
- * XmuDisplayQueue *q;
- * Display *dpy;
- * XPointer data;
- *
- * Adds the indicated display to the end of the queue or NULL if it
- * is unable to allocate memory. The data field may be used by the
- * caller to attach arbitrary data to this display in this queue. The
- * caller should use XmuDQLookupDisplay to make sure that the display
- * hasn't already been added.
- *
- *
- * Bool XmuDQRemoveDisplay (q, dpy)
- * XmuDisplayQueue *q;
- * Display *dpy;
- *
- * Removes the specified display from the given queue. If the
- * indicated display is not found on this queue, False is returned,
- * otherwise True is returned.
- */
-
-typedef struct _XmuDisplayQueue XmuDisplayQueue;
-typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry;
-
-typedef int (*XmuCloseDisplayQueueProc)(XmuDisplayQueue *queue,
- XmuDisplayQueueEntry *entry);
-
-typedef int (*XmuFreeDisplayQueueProc)(XmuDisplayQueue *queue);
-
-struct _XmuDisplayQueueEntry {
- struct _XmuDisplayQueueEntry *prev, *next;
- Display *display;
- CloseHook closehook;
- XPointer data;
-};
-
-struct _XmuDisplayQueue {
- int nentries;
- XmuDisplayQueueEntry *head, *tail;
- XmuCloseDisplayQueueProc closefunc;
- XmuFreeDisplayQueueProc freefunc;
- XPointer data;
-};
-
-_XFUNCPROTOBEGIN
-
-XmuDisplayQueue *XmuDQCreate
-(
- XmuCloseDisplayQueueProc closefunc,
- XmuFreeDisplayQueueProc freefunc,
- XPointer data
- );
-
-Bool XmuDQDestroy
-(
- XmuDisplayQueue *q,
- Bool docallbacks
- );
-
-XmuDisplayQueueEntry *XmuDQLookupDisplay
-(
- XmuDisplayQueue *q,
- Display *dpy
- );
-
-XmuDisplayQueueEntry *XmuDQAddDisplay
-(
- XmuDisplayQueue *q,
- Display *dpy,
- XPointer data
- );
-
-Bool XmuDQRemoveDisplay
-(
- XmuDisplayQueue *q,
- Display *dpy
- );
-
-_XFUNCPROTOEND
-
-#define XmuDQNDisplays(q) ((q)->nentries)
-
-#endif /* _XMU_DISPLAYQUE_H_ */
diff --git a/xc/lib/Xmu/Distinct.c b/xc/lib/Xmu/Distinct.c
deleted file mode 100644
index 17544107e..000000000
--- a/xc/lib/Xmu/Distinct.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $TOG: Distinct.c /main/6 1998/02/06 15:42:50 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Distinct.c,v 3.3 1998/10/03 09:06:26 dawes Exp $ */
-
-/*
- * Author: Keith Packard, MIT X Consortium
- */
-
-# include <X11/Xlib.h>
-# ifndef X_NOT_STDC_ENV
-# include <stdlib.h>
-# endif
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-/*
- * Distinguishable colors routine. Determines if two colors are
- * distinguishable or not. Somewhat arbitrary meaning.
- */
-
-#define MIN_DISTINGUISH 10000.0
-
-Bool
-XmuDistinguishableColors(XColor *colors, int count)
-{
- double deltaRed, deltaGreen, deltaBlue;
- double dist;
- int i, j;
-
- for (i = 0; i < count - 1; i++)
- for (j = i + 1; j < count; j++)
- {
- deltaRed = (double)colors[i].red - (double)colors[j].red;
- deltaGreen = (double)colors[i].green - (double)colors[j].green;
- deltaBlue = (double)colors[i].blue - (double)colors[j].blue;
- dist = deltaRed * deltaRed +
- deltaGreen * deltaGreen +
- deltaBlue * deltaBlue;
- if (dist <= MIN_DISTINGUISH * MIN_DISTINGUISH)
- return False;
- }
- return True;
-}
-
-Bool
-XmuDistinguishablePixels(Display *dpy, Colormap cmap,
- unsigned long *pixels, int count)
-{
- XColor *defs;
- int i, j;
- Bool ret;
-
- for (i = 0; i < count - 1; i++)
- for (j = i + 1; j < count; j++)
- if (pixels[i] == pixels[j])
- return False;
- defs = (XColor *) malloc (count * sizeof (XColor));
- if (!defs)
- return False;
- for (i = 0; i < count; i++)
- defs[i].pixel = pixels[i];
- XQueryColors (dpy, cmap, defs, count);
- ret = XmuDistinguishableColors (defs, count);
- free ((char *) defs);
- return ret;
-}
diff --git a/xc/lib/Xmu/DrRndRect.c b/xc/lib/Xmu/DrRndRect.c
deleted file mode 100644
index 8ac43337e..000000000
--- a/xc/lib/Xmu/DrRndRect.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* $TOG: DrRndRect.c /main/5 1998/02/06 15:43:08 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/DrRndRect.c,v 1.5 1998/10/03 09:06:26 dawes Exp $ */
-
-/*
- * XmuDrawRoundedRectangle, XmuFillRoundedRectangle
- *
- * Draw/Fill a rounded rectangle, where x, y, w, h are the dimensions of
- * the overall rectangle, and ew and eh are the sizes of a bounding box
- * that the corners are drawn inside of.
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xmu/Drawing.h>
-
-void
-XmuDrawRoundedRectangle(Display *dpy, Drawable draw, GC gc,
- int x, int y, int w, int h, int ew, int eh)
-{
- XArc arcs[8];
- int ew2, eh2;
-
- if ((ew2 = (ew << 1)) > w)
- ew2 = ew = 0;
- if ((eh2 = (eh << 1)) > h)
- eh2 = eh = 0;
-
- arcs[0].x = x;
- arcs[0].y = y;
- arcs[0].width = ew2;
- arcs[0].height = eh2;
- arcs[0].angle1 = 180 * 64;
- arcs[0].angle2 = -90 * 64;
-
- arcs[1].x = x + ew;
- arcs[1].y = y;
- arcs[1].width = w - ew2;
- arcs[1].height = 0;
- arcs[1].angle1 = 180 * 64;
- arcs[1].angle2 = -180 * 64;
-
- arcs[2].x = x + w - ew2;
- arcs[2].y = y;
- arcs[2].width = ew2;
- arcs[2].height = eh2;
- arcs[2].angle1 = 90 * 64;
- arcs[2].angle2 = -90 * 64;
-
- arcs[3].x = x + w;
- arcs[3].y = y + eh;
- arcs[3].width = 0;
- arcs[3].height = h - eh2;
- arcs[3].angle1 = 90 * 64;
- arcs[3].angle2 = -180 * 64;
-
- arcs[4].x = x + w - ew2;
- arcs[4].y = y + h - eh2;
- arcs[4].width = ew2;
- arcs[4].height = eh2;
- arcs[4].angle1 = 0;
- arcs[4].angle2 = -90 * 64;
-
- arcs[5].x = x + ew;
- arcs[5].y = y + h;
- arcs[5].width = w - ew2;
- arcs[5].height = 0;
- arcs[5].angle1 = 0;
- arcs[5].angle2 = -180 * 64;
-
- arcs[6].x = x;
- arcs[6].y = y + h - eh2;
- arcs[6].width = ew2;
- arcs[6].height = eh2;
- arcs[6].angle1 = 270 * 64;
- arcs[6].angle2 = -90 * 64;
-
- arcs[7].x = x;
- arcs[7].y = y + eh;
- arcs[7].width = 0;
- arcs[7].height = h - eh2;
- arcs[7].angle1 = 270 * 64;
- arcs[7].angle2 = -180 * 64;
-
- XDrawArcs(dpy, draw, gc, arcs, 8);
-}
-
-void
-XmuFillRoundedRectangle(Display *dpy, Drawable draw, GC gc,
- int x, int y, int w, int h, int ew, int eh)
-{
- XArc arcs[4];
- XRectangle rects[3];
- XGCValues vals;
- int ew2, eh2;
-
- XGetGCValues(dpy, gc, GCArcMode, &vals);
- if (vals.arc_mode != ArcPieSlice)
- XSetArcMode(dpy, gc, ArcPieSlice);
-
- if ((ew2 = (ew << 1)) > w)
- ew2 = ew = 0;
- if ((eh2 = (eh << 1)) > h)
- eh2 = eh = 0;
-
- arcs[0].x = x;
- arcs[0].y = y;
- arcs[0].width = ew2;
- arcs[0].height = eh2;
- arcs[0].angle1 = 180 * 64;
- arcs[0].angle2 = -90 * 64;
-
- arcs[1].x = x + w - ew2 - 1;
- arcs[1].y = y;
- arcs[1].width = ew2;
- arcs[1].height = eh2;
- arcs[1].angle1 = 90 * 64;
- arcs[1].angle2 = -90 * 64;
-
- arcs[2].x = x + w - ew2 - 1;
- arcs[2].y = y + h - eh2 - 1;
- arcs[2].width = ew2;
- arcs[2].height = eh2;
- arcs[2].angle1 = 0;
- arcs[2].angle2 = -90 * 64;
-
- arcs[3].x = x;
- arcs[3].y = y + h - eh2 - 1;
- arcs[3].width = ew2;
- arcs[3].height = eh2;
- arcs[3].angle1 = 270 * 64;
- arcs[3].angle2 = -90 * 64;
-
- XFillArcs(dpy, draw, gc, arcs, 4);
-
- rects[0].x = x + ew;
- rects[0].y = y;
- rects[0].width = w - ew2;
- rects[0].height = h;
-
- rects[1].x = x;
- rects[1].y = y + eh;
- rects[1].width = ew;
- rects[1].height = h - eh2;
-
- rects[2].x = x + w - ew;
- rects[2].y = y + eh;
- rects[2].width = ew;
- rects[2].height = h - eh2;
-
- XFillRectangles(dpy, draw, gc, rects, 3);
-
- if (vals.arc_mode != ArcPieSlice)
- XSetArcMode(dpy, gc, vals.arc_mode);
-}
diff --git a/xc/lib/Xmu/DrawLogo.c b/xc/lib/Xmu/DrawLogo.c
deleted file mode 100644
index f99c0d258..000000000
--- a/xc/lib/Xmu/DrawLogo.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $TOG: DrawLogo.c /main/6 1998/02/06 15:43:02 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/DrawLogo.c,v 1.6 1998/10/03 09:06:27 dawes Exp $ */
-
-#include <X11/Xlib.h>
-#include <X11/Xmu/Drawing.h>
-
-/*
- * Draw the "official" X Window System Logo, designed by Danny Chong
- *
- * Written by Ollie Jones, Apollo Computer
- *
- * Does some fancy stuff to make the logo look acceptable even
- * if it is tiny. Also makes the various linear elements of
- * the logo line up as well as possible considering rasterization.
- */
-void
-XmuDrawLogo(Display *dpy, Drawable drawable, GC gcFore, GC gcBack,
- int x, int y, unsigned int width, unsigned int height)
-{
- unsigned int size;
- int thin, gap, d31;
- XPoint poly[4];
-
- XFillRectangle(dpy, drawable, gcBack, x, y, width, height);
-
- /* for now, do a centered even-sized square, at least for now */
- size = width;
- if (height < width)
- size = height;
- size &= ~1;
- x += (width - size) >> 1;
- y += (height - size) >> 1;
-
-/*
- * 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;
- XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
-
-/*
- * 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;
- XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
-
-/*
- * 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;
- XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
-
-/*
- * 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;
- XFillPolygon(dpy, drawable, gcFore, poly, 4, Convex, CoordModeOrigin);
-
-/*
- * 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;
- XFillPolygon(dpy, drawable, gcBack, poly, 4, Convex, CoordModeOrigin);
-}
diff --git a/xc/lib/Xmu/Drawing.h b/xc/lib/Xmu/Drawing.h
deleted file mode 100644
index 1e5b6837a..000000000
--- a/xc/lib/Xmu/Drawing.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* $TOG: Drawing.h /main/12 1998/02/06 15:42:56 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Drawing.h,v 1.4 1998/10/03 09:06:27 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_DRAWING_H_
-#define _XMU_DRAWING_H_
-
-#include <X11/Xfuncproto.h>
-
-#if NeedFunctionPrototypes
-#include <stdio.h>
-#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
-typedef unsigned long Pixel;
-#endif
-#endif
-
-_XFUNCPROTOBEGIN
-
-void XmuDrawRoundedRectangle
-(
- Display *dpy,
- Drawable draw,
- GC gc,
- int x,
- int y,
- int w,
- int h,
- int ew,
- int eh
- );
-
-void XmuFillRoundedRectangle
-(
- Display *dpy,
- Drawable draw,
- GC gc,
- int x,
- int y,
- int w,
- int h,
- int ew,
- int eh
- );
-
-void XmuDrawLogo
-(
- Display *dpy,
- Drawable drawable,
- GC gcFore,
- GC gcBack,
- int x,
- int y,
- unsigned int width,
- unsigned int height
- );
-
-Pixmap XmuCreatePixmapFromBitmap
-(
- Display *dpy,
- Drawable d,
- Pixmap bitmap,
- unsigned int width,
- unsigned int height,
- unsigned int depth,
- unsigned long fore,
- unsigned long back
-);
-
-Pixmap XmuCreateStippledPixmap
-(
- Screen *screen,
- Pixel fore,
- Pixel back,
- unsigned int depth
- );
-
-void XmuReleaseStippledPixmap
-(
- Screen *screen,
- Pixmap pixmap
- );
-
-Pixmap XmuLocateBitmapFile
-(
- Screen *screen,
- _Xconst char *name,
- char *srcname_return,
- int srcnamelen,
- int *width_return,
- int *height_return,
- int *xhot_return,
- int *yhot_return
- );
-
-Pixmap XmuLocatePixmapFile
-(
- Screen *screen,
- _Xconst char *name,
- unsigned long fore,
- unsigned long back,
- unsigned int depth,
- char *srcname_return,
- int srcnamelen,
- int *width_return,
- int *height_return,
- int *xhot_return,
- int *yhot_return
- );
-
-int XmuReadBitmapData
-(
- FILE *fstream,
- unsigned int *width_return,
- unsigned int *height_return,
- unsigned char **datap_return,
- int *xhot_return,
- int *yhot_return
-);
-
-int XmuReadBitmapDataFromFile
-(
- _Xconst char *filename,
- unsigned int *width_return,
- unsigned int *height_return,
- unsigned char **datap_return,
- int *xhot_return,
- int *yhot_return
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_DRAWING_H_ */
diff --git a/xc/lib/Xmu/Editres.h b/xc/lib/Xmu/Editres.h
deleted file mode 100644
index a28cfa013..000000000
--- a/xc/lib/Xmu/Editres.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $TOG: Editres.h /main/4 1998/02/06 15:43:27 kaleb $ */
-
-/*
-
-Copyright 1991, 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/lib/Xmu/Editres.h,v 1.4 1998/10/03 09:06:27 dawes Exp $ */
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-void _XEditResCheckMessages
-(
- Widget w,
- XtPointer data,
- XEvent *event,
- Boolean *cont
-);
-
-_XFUNCPROTOEND
diff --git a/xc/lib/Xmu/EditresCom.c b/xc/lib/Xmu/EditresCom.c
deleted file mode 100644
index f5a995396..000000000
--- a/xc/lib/Xmu/EditresCom.c
+++ /dev/null
@@ -1,2205 +0,0 @@
-/* $TOG: EditresCom.c /main/37 1998/06/23 11:50:49 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/lib/Xmu/EditresCom.c,v 1.11 1999/03/21 07:34:36 dawes Exp $ */
-
-/*
- * Author: Chris D. Peterson, Dave Sternlicht, MIT X Consortium
- */
-
-#include <X11/IntrinsicP.h> /* To get into the composite and core widget
- structures. */
-#include <X11/ObjectP.h> /* For XtIs<Classname> macros. */
-#include <X11/StringDefs.h> /* for XtRString. */
-#include <X11/ShellP.h> /* for Application Shell Widget class. */
-
-#include <X11/Xatom.h>
-#include <X11/Xos.h> /* for strcpy declaration */
-#include <X11/Xfuncs.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xmu/EditresP.h>
-#include <X11/Xmd.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/SysUtil.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#define _XEditResPutBool _XEditResPut8
-#define _XEditResPutResourceType _XEditResPut8
-
-/*
- * Types
- */
-typedef enum {
- BlockNone,
- BlockSetValues,
- BlockAll
-} EditresBlock;
-
-typedef struct _SetValuesEvent {
- EditresCommand type; /* first field must be type */
- WidgetInfo *widgets;
- unsigned short num_entries; /* number of set values requests */
- char *name;
- char *res_type;
- XtPointer value;
- unsigned short value_len;
-} SetValuesEvent;
-
-typedef struct _SVErrorInfo {
- SetValuesEvent *event;
- ProtocolStream *stream;
- unsigned short *count;
- WidgetInfo *entry;
-} SVErrorInfo;
-
-typedef struct _GetValuesEvent {
- EditresCommand type; /* first field must be type */
- WidgetInfo *widgets;
- unsigned short num_entries; /* number of get values requests */
- char *name;
-} GetValuesEvent;
-
-typedef struct _FindChildEvent {
- EditresCommand type; /* first field must be type */
- WidgetInfo *widgets;
- short x, y;
-} FindChildEvent;
-
-typedef struct _GenericGetEvent {
- EditresCommand type; /* first field must be type */
- WidgetInfo *widgets;
- unsigned short num_entries; /* number of set values requests */
-} GenericGetEvent, GetResEvent, GetGeomEvent;
-
-/*
- * Common to all events
- */
-typedef struct _AnyEvent {
- EditresCommand type; /* first field must be type */
- WidgetInfo *widgets;
-} AnyEvent;
-
-/*
- * The event union
- */
-typedef union _EditresEvent {
- AnyEvent any_event;
- SetValuesEvent set_values_event;
- GetResEvent get_resources_event;
- GetGeomEvent get_geometry_event;
- FindChildEvent find_child_event;
-} EditresEvent;
-
-typedef struct _Globals {
- EditresBlock block;
- SVErrorInfo error_info;
- ProtocolStream stream;
- ProtocolStream *command_stream; /* command stream */
-#if defined(LONG64) || defined(WORD64)
- unsigned long base_address;
-#endif
-} Globals;
-
-#define CURRENT_PROTOCOL_VERSION 5L
-
-#define streq(a,b) (strcmp((a), (b)) == 0)
-
-/*
- * Prototypes
- */
-static Widget _FindChild(Widget, int, int);
-static void _XEditresGetStringValues(Widget, Arg*, int);
-static XtPointer BuildReturnPacket(ResIdent, EditresCommand, ProtocolStream*);
-static void CommandDone(Widget, Atom*, Atom*);
-static Boolean ConvertReturnCommand(Widget, Atom*, Atom*, Atom*, XtPointer*,
- unsigned long*, int*);
-static Boolean CvtStringToBlock(Display*, XrmValue*, Cardinal*,
- XrmValue*, XrmValue*, XtPointer*);
-static EditresEvent *BuildEvent(Widget, Atom, XtPointer, ResIdent,
- unsigned long);
-static char *DoFindChild(Widget, EditresEvent*, ProtocolStream*);
-static char *DoGetGeometry(Widget, EditresEvent*, ProtocolStream*);
-static char *DoGetResources(Widget, EditresEvent*, ProtocolStream*);
-static char *DoSetValues(Widget, EditresEvent*, ProtocolStream*);
-static void DumpChildren(Widget, ProtocolStream*, unsigned short*);
-static char *DumpValues(Widget, EditresEvent*, ProtocolStream*);
-static char *DumpWidgets(Widget, EditresEvent*, ProtocolStream*);
-static void ExecuteCommand(Widget, Atom, ResIdent, EditresEvent*);
-static void ExecuteGetGeometry(Widget, ProtocolStream*);
-static void ExecuteGetResources(Widget w, ProtocolStream *stream);
-static void ExecuteSetValues(Widget, SetValuesEvent*, WidgetInfo*,
- ProtocolStream*, unsigned short*);
-static void FreeEvent(EditresEvent*);
-static void GetCommand(Widget w, XtPointer, Atom*, Atom*, XtPointer,
- unsigned long*, int*);
-static void HandleToolkitErrors(String, String, String, String,
- String*, Cardinal*);
-static void InsertWidget(ProtocolStream*, Widget);
-static Bool IsChild(Widget, Widget, Widget);
-static Bool isApplicationShell(Widget);
-static void LoadResources(Widget);
-static Bool PositionInChild(Widget, int, int);
-static int qcmp_widget_list(register _Xconst void*, register _Xconst void*);
-static void SendCommand(Widget, Atom, ResIdent, EditresCommand,
- ProtocolStream*);
-static void SendFailure(Widget, Atom, ResIdent, char*);
-static char *VerifyWidget(Widget, WidgetInfo*);
-
-/*
- * External
- */
-void _XEditResCheckMessages(Widget, XtPointer, XEvent*, Boolean*);
-
-/*
- * Initialization
- */
-static Atom res_editor_command, res_editor_protocol, client_value;
-static Globals globals;
-
-/************************************************************
- * Resource Editor Communication Code
- ************************************************************/
-/*
- * Function:
- * _XEditResCheckMessages
- *
- * Parameters:
- * data - unused
- * event - The X Event that triggered this handler
- * cont - unused
- *
- * Description:
- * This callback routine is set on all shell widgets, and checks to
- * see if a client message event has come from the resource editor.
- */
-/*ARGSUSED*/
-void
-_XEditResCheckMessages(Widget w, XtPointer data, XEvent *event, Boolean *cont)
-{
- Time time;
- ResIdent ident;
- static Boolean first_time = False;
- static Atom res_editor, res_comm;
- Display *dpy;
-
- if (event->type == ClientMessage)
- {
- XClientMessageEvent * c_event = (XClientMessageEvent *)event;
- dpy = XtDisplay(w);
-
- if (!first_time)
- {
- Atom atoms[4];
- static char *names[] = {
- EDITRES_NAME, EDITRES_COMMAND_ATOM,
- EDITRES_PROTOCOL_ATOM, EDITRES_CLIENT_VALUE
- };
-
- first_time = True;
- XInternAtoms(dpy, names, 4, False, atoms);
- res_editor = atoms[0];
- res_editor_command = atoms[1];
- res_editor_protocol = atoms[2];
- /* Used in later procedures */
- client_value = atoms[3];
- LoadResources(w);
- }
-
- if ((c_event->message_type != res_editor)
- || (c_event->format != EDITRES_SEND_EVENT_FORMAT))
- return;
-
- time = c_event->data.l[0];
- res_comm = c_event->data.l[1];
- ident = (ResIdent) c_event->data.l[2];
- if (c_event->data.l[3] != CURRENT_PROTOCOL_VERSION)
- {
- _XEditResResetStream(&globals.stream);
- _XEditResPut8(&globals.stream, CURRENT_PROTOCOL_VERSION);
- SendCommand(w, res_comm, ident, ProtocolMismatch, &globals.stream);
- return;
- }
-
- XtGetSelectionValue(w, res_comm, res_editor_command,
- GetCommand, (XtPointer)(long)ident, time);
- }
-}
-
-/*
- * Function:
- * BuildEvent
- *
- * Parameters:
- * w - widget to own selection, in case of error
- * sel - selection to send error message beck in
- * data - the data for the request
- * ident - the id number we are looking for
- * length - length of request
- *
- * Description:
- * Takes the info out the protocol stream an constructs
- * the proper event structure.
- *
- * Returns:
- * the event, or NULL
- */
-#if defined(ERROR_MESSAGE)
-#undef ERROR_MESSAGE
-#endif
-#define ERROR_MESSAGE "Client: Improperly formatted protocol request"
-static EditresEvent *
-BuildEvent(Widget w, Atom sel, XtPointer data, ResIdent ident,
- unsigned long length)
-{
- EditresEvent *event;
- ProtocolStream alloc_stream, *stream;
- unsigned char temp;
- register unsigned int i;
-
- stream = &alloc_stream;
- stream->current = stream->top = (unsigned char *)data;
- stream->size = HEADER_SIZE; /* size of header */
-
- /*
- * Retrieve the Header
- */
- if (length < HEADER_SIZE)
- {
- SendFailure(w, sel, ident, ERROR_MESSAGE);
- return (NULL);
- }
-
- (void)_XEditResGet8(stream, &temp);
- if (temp != ident) /* Id's don't match, ignore request */
- return (NULL);
-
- event = (EditresEvent *)XtCalloc(sizeof(EditresEvent), 1);
-
- (void)_XEditResGet8(stream, &temp);
- event->any_event.type = (EditresCommand)temp;
- (void)_XEditResGet32(stream, &stream->size);
- stream->top = stream->current; /* reset stream to top of value */
-
- /*
- * Now retrieve the data segment
- */
- switch(event->any_event.type)
- {
- case SendWidgetTree:
- break; /* no additional info */
- case SetValues:
- {
- SetValuesEvent *sv_event = (SetValuesEvent *)event;
-
- if (!(_XEditResGetString8(stream, &sv_event->name)
- && _XEditResGetString8(stream, &sv_event->res_type)))
- goto done;
-
- /*
- * Since we need the value length, we have to pull the
- * value out by hand
- */
- if (!_XEditResGet16(stream, &sv_event->value_len))
- goto done;
-
- sv_event->value = XtMalloc(sizeof(char) * (sv_event->value_len + 1));
-
- for (i = 0; i < sv_event->value_len; i++)
- if (!_XEditResGet8(stream, (unsigned char *)sv_event->value + i))
- goto done;
-
- ((char*)sv_event->value)[i] = '\0';
-
- if (!_XEditResGet16(stream, &sv_event->num_entries))
- goto done;
-
- sv_event->widgets = (WidgetInfo *)
- XtCalloc(sizeof(WidgetInfo), sv_event->num_entries);
-
- for (i = 0; i < sv_event->num_entries; i++)
- if (!_XEditResGetWidgetInfo(stream, sv_event->widgets + i))
- goto done;
- }
- break;
- case FindChild:
- {
- FindChildEvent *find_event = (FindChildEvent *)event;
-
- find_event->widgets = (WidgetInfo *)XtCalloc(sizeof(WidgetInfo), 1);
-
- if (!(_XEditResGetWidgetInfo(stream, find_event->widgets)
- && _XEditResGetSigned16(stream, &find_event->x)
- && _XEditResGetSigned16(stream, &find_event->y)))
- goto done;
- }
- break;
- case GetGeometry:
- case GetResources:
- {
- GenericGetEvent *get_event = (GenericGetEvent *)event;
-
- if (!_XEditResGet16(stream, &get_event->num_entries))
- goto done;
-
- get_event->widgets = (WidgetInfo *)
- XtCalloc(sizeof(WidgetInfo), get_event->num_entries);
-
- for (i = 0; i < get_event->num_entries; i++)
- if (!_XEditResGetWidgetInfo(stream, get_event->widgets + i))
- goto done;
- }
- break;
- case GetValues:
- {
- GetValuesEvent *gv_event = (GetValuesEvent *)event;
-
- _XEditResGetString8(stream, &gv_event->name);
- _XEditResGet16(stream, &gv_event->num_entries);
- gv_event->widgets = (WidgetInfo *)
- XtCalloc(sizeof(WidgetInfo), gv_event->num_entries);
- _XEditResGetWidgetInfo(stream, gv_event->widgets);
- }
- break;
- default:
- {
- char buf[BUFSIZ];
-
- XmuSnprintf(buf, sizeof(buf),
- "Unknown Protocol request %d.", event->any_event.type);
- SendFailure(w, sel, ident, buf);
- FreeEvent(event);
- return (NULL);
- }
- }
-
- return (event);
-
- done:
- SendFailure(w, sel, ident, ERROR_MESSAGE);
- FreeEvent(event);
- return (NULL);
-}
-
-/*
- * Function:
- * FreeEvent
- *
- * Parameters:
- * event - event to free
- *
- * Description:
- * Frees the event structure and any other pieces in it that need freeing.
- */
-static void
-FreeEvent(EditresEvent *event)
-{
- if (event->any_event.widgets != NULL)
- {
- XtFree((char *)event->any_event.widgets->ids);
- XtFree((char *)event->any_event.widgets);
- }
-
- if (event->any_event.type == SetValues)
- {
- XtFree(event->set_values_event.name);
- XtFree(event->set_values_event.res_type);
- }
-
- XtFree((char *)event);
-}
-
-/*
- * Function:
- * GetCommand
- *
- * Parameters:
- * (See Xt XtConvertSelectionProc)
- * data - contains the ident number for the command
- *
- * Description:
- * Gets the Command out of the selection asserted by the resource manager.
- */
-/*ARGSUSED*/
-static void
-GetCommand(Widget w, XtPointer data, Atom *selection, Atom *type,
- XtPointer value, unsigned long *length, int *format)
-{
- ResIdent ident = (ResIdent)(long)data;
- EditresEvent *event;
-
- if (*type != res_editor_protocol || *format != EDITRES_FORMAT)
- return;
-
- if ((event = BuildEvent(w, *selection, value, ident, *length)) != NULL)
- {
- ExecuteCommand(w, *selection, ident, event);
- FreeEvent(event);
- }
-}
-
-/*
- * Function:
- * ExecuteCommand
- *
- * Parameters:
- * w - widget
- * command - the command to execute
- * value - the associated with the command
- *
- * Description:
- * Executes a command string received from the resource editor.
- */
-/*ARGSUSED*/
-static void
-ExecuteCommand(Widget w, Atom sel, ResIdent ident, EditresEvent *event)
-{
- char *(*func)(Widget, EditresEvent*, ProtocolStream*);
- char *str;
-
- if (globals.block == BlockAll)
- {
- SendFailure(w, sel, ident,
- "This client has blocked all Editres commands.");
- return;
- }
- else if (globals.block == BlockSetValues
- && event->any_event.type == SetValues)
- {
- SendFailure(w, sel, ident,
- "This client has blocked all SetValues requests.");
- return;
- }
-
- switch(event->any_event.type)
- {
- case SendWidgetTree:
-#if defined(LONG64) || defined(WORD64)
- globals.base_address = (unsigned long)w & 0xFFFFFFFF00000000;
-#endif
- func = DumpWidgets;
- break;
- case SetValues:
- func = DoSetValues;
- break;
- case FindChild:
- func = DoFindChild;
- break;
- case GetGeometry:
- func = DoGetGeometry;
- break;
- case GetResources:
- func = DoGetResources;
- break;
- case GetValues:
- func = DumpValues;
- break;
- default:
- {
- char buf[BUFSIZ];
-
- XmuSnprintf(buf, sizeof(buf),
- "Unknown Protocol request %d.",event->any_event.type);
- SendFailure(w, sel, ident, buf);
- return;
- }
- }
-
- _XEditResResetStream(&globals.stream);
- if ((str = (*func)(w, event, &globals.stream)) == NULL)
- SendCommand(w, sel, ident, PartialSuccess, &globals.stream);
- else
- SendFailure(w, sel, ident, str);
-}
-
-/*
- * Function:
- * ConvertReturnCommand
- *
- * Parameters:
- * w - the widget that owns the selection
- * selection - selection to convert
- * target - target type for this selection
- * type_ret - type of the selection
- * value_ret - selection value
- * length_ret - lenght of this selection
- * format_ret - the format the selection is in
- *
- * Description:
- * Converts a selection
- *
- * Returns:
- * True if conversion was sucessful
- */
-/*ARGSUSED*/
-static Boolean
-ConvertReturnCommand(Widget w, Atom *selection, Atom *target, Atom *type_ret,
- XtPointer *value_ret, unsigned long *length_ret,
- int *format_ret)
-{
- /*
- * I assume the intrinsics give me the correct selection back
- */
- if ((*target != client_value))
- return (False);
-
- *type_ret = res_editor_protocol;
- *value_ret = (XtPointer)globals.command_stream->real_top;
- *length_ret = globals.command_stream->size + HEADER_SIZE;
- *format_ret = EDITRES_FORMAT;
-
- return (True);
-}
-
-/*
- * Function:
- * CommandDone
- *
- * Parameters:
- * widget - unused
- * selection - unused
- * target - unused
- *
- * Description:
- * done with the selection
- */
-/*ARGSUSED*/
-static void
-CommandDone(Widget widget, Atom *selection, Atom *target)
-{
- /* Keep the toolkit from automaticaly freeing the selection value */
-}
-
-/*
- * Function:
- * SendFailure
- *
- * Paramters:
- * w - widget to own the selection
- * sel - selection to assert
- * ident - identifier
- * str - error message
- *
- * Description:
- * Sends a failure message
- */
-static void
-SendFailure(Widget w, Atom sel, ResIdent ident, char *str)
-{
- _XEditResResetStream(&globals.stream);
- _XEditResPutString8(&globals.stream, str);
- SendCommand(w, sel, ident, Failure, &globals.stream);
-}
-
-/*
- * Function:
- * BuildReturnPacket
- *
- * Parameters:
- * ident - identifier
- * command - command code
- * stream - protocol stream
- * Description:
- * Builds a return packet, given the data to send
- *
- * Returns:
- * packet to send
- */
-static XtPointer
-BuildReturnPacket(ResIdent ident, EditresCommand command,
- ProtocolStream *stream)
-{
- long old_alloc, old_size;
- unsigned char *old_current;
-
- /*
- * We have cleverly keep enough space at the top of the header
- * for the return protocol stream, so all we have to do is
- * fill in the space
- */
- /*
- * Fool the insert routines into putting the header in the right
- * place while being damn sure not to realloc (that would be very bad.)
- */
- old_current = stream->current;
- old_alloc = stream->alloc;
- old_size = stream->size;
-
- stream->current = stream->real_top;
- stream->alloc = stream->size + (2 * HEADER_SIZE);
-
- _XEditResPut8(stream, ident);
- _XEditResPut8(stream, (unsigned char)command);
- _XEditResPut32(stream, old_size);
-
- stream->alloc = old_alloc;
- stream->current = old_current;
- stream->size = old_size;
-
- return ((XtPointer)stream->real_top);
-}
-
-/*
- * Function:
- * SendCommand
- * Parameters:
- * w - widget to own the selection
- * sel - selection to assert
- * ident - identifier
- * command - command code
- * stream - protocol stream
- *
- * Description:
- * Builds a return command line
- */
-static void
-SendCommand(Widget w, Atom sel, ResIdent ident, EditresCommand command,
- ProtocolStream *stream)
-{
- BuildReturnPacket(ident, command, stream);
- globals.command_stream = stream;
-
- /*
- * I REALLY want to own the selection. Since this was not triggered
- * by a user action, and I am the only one using this atom it is safe to
- * use CurrentTime
- */
- XtOwnSelection(w, sel, CurrentTime, ConvertReturnCommand, NULL, CommandDone);
-}
-
-/************************************************************
- * Generic Utility Functions
- ************************************************************/
-static int
-qcmp_widget_list(register _Xconst void *left, register _Xconst void *right)
-{
- return ((int)*(Widget **)left - (int)*(Widget **)right);
-}
-
-/*
- * Function:
- * FindChildren
- *
- * Parameters:
- * parent - parent widget
- * children - list of children
- * normal - return normal children
- * popup - return popup children
- * extra - return extra children
- *
- * Description:
- * Retuns all children (popup, normal and otherwise) of this widget
- *
- * Returns:
- * number of children
- */
-static int
-FindChildren(Widget parent, Widget **children, Bool normal, Bool popup,
- Bool extra)
-{
- CompositeWidget cw = (CompositeWidget)parent;
- Cardinal i, num_children, current = 0;
- Widget *extra_widgets = NULL;
- Cardinal num_extra = 0;
-
- num_children = 0;
-
- if (XtIsWidget(parent) && popup)
- num_children += parent->core.num_popups;
-
- if (XtIsComposite(parent) && normal)
- num_children += cw->composite.num_children;
-
- if (XtIsWidget(parent) && extra)
- {
- XtResourceList norm_list, cons_list;
- Cardinal num_norm, num_cons;
- Arg args[1];
- Widget widget;
-
- XtGetResourceList(XtClass(parent), &norm_list, &num_norm);
-
- if (XtParent(parent) != NULL)
- XtGetConstraintResourceList(XtClass(XtParent(parent)),
- &cons_list, &num_cons);
- else
- num_cons = 0;
-
- extra_widgets = (Widget *)XtMalloc(sizeof(Widget));
- for (i = 0; i < num_norm; i++)
- if (strcmp(norm_list[i].resource_type, XtRWidget) == 0)
- {
- XtSetArg(args[0], norm_list[i].resource_name, &widget);
- XtGetValues(parent, args, 1);
- if (widget && XtParent(widget) == parent)
- {
- ++num_extra;
- extra_widgets = (Widget *)
- XtRealloc((char *)extra_widgets, num_extra * sizeof(Widget));
- extra_widgets[num_extra - 1] = widget;
- }
- }
- for (i = 0; i < num_cons; i++)
- if (strcmp(cons_list[i].resource_type, XtRWidget) == 0)
- {
- XtSetArg(args[0], cons_list[i].resource_name, &widget);
- XtGetValues(parent, args, 1);
- if (widget && XtParent(widget) == parent)
- {
- ++num_extra;
- extra_widgets = (Widget *)
- XtRealloc((char *)extra_widgets, num_extra * sizeof(Widget));
- extra_widgets[num_extra - 1] = widget;
- }
- }
- if (num_norm)
- XtFree((char *)norm_list);
- if (num_cons)
- XtFree((char *)cons_list);
- }
-
- if ((num_children + num_extra) == 0)
- {
- *children = NULL;
- return (0);
- }
-
- *children = (Widget *)XtMalloc(sizeof(Widget) * (num_children + num_extra));
-
- if (XtIsComposite(parent) && normal)
- for (i = 0; i < cw->composite.num_children; i++, current++)
- (*children)[current] = cw->composite.children[i];
-
- if (XtIsWidget(parent) && popup)
- for (i = 0; i < parent->core.num_popups; i++, current++)
- (*children)[current] = parent->core.popup_list[i];
-
- if (num_extra)
- /* Check for dups */
- {
- Cardinal j, old_num_extra = num_extra;
-
- qsort(extra_widgets, num_extra, sizeof(Widget), qcmp_widget_list);
- for (i = 0; i < num_extra - 1; i++)
- while (i < num_extra - 1 && extra_widgets[i] == extra_widgets[i + 1])
- {
- memmove(&extra_widgets[i], &extra_widgets[i + 1],
- (num_extra - i) * sizeof(Widget));
- --num_extra;
- }
-
- for (i = 0; i < num_children; i++)
- for (j = 0; j < num_extra; j++)
- if ((*children)[i] == extra_widgets[j])
- {
- memmove(&extra_widgets[i], &extra_widgets[i + 1],
- (num_extra - j) * sizeof(Widget));
- --num_extra;
- }
-
- if (old_num_extra != num_extra)
- *children = (Widget *)XtRealloc((char *)*children, sizeof(Widget)
- * (num_children + num_extra));
-
- if (num_extra)
- memcpy(&(*children)[num_children], extra_widgets,
- sizeof(Widget) * num_extra);
- }
- if (extra_widgets)
- XtFree((char *)extra_widgets);
- if (num_children + num_extra == 0)
- {
- XtFree((char *)*children);
- *children = NULL;
- }
-
- return (num_children + num_extra);
-}
-
-/*
- * Function:
- * IsChild
- *
- * parameters:
- * top - top of the tree
- * parent - parent widget
- * child - child widget
- *
- * Description:
- * Check to see of child is a child of parent
- */
-static Bool
-IsChild(Widget top, Widget parent, Widget child)
-{
- int i, num_children;
- Widget *children;
-
- if (parent == NULL)
- return (top == child);
-
- num_children = FindChildren(parent, &children, True, True, True);
-
- for (i = 0; i < num_children; i++)
- if (children[i] == child)
- {
- XtFree((char *)children);
- return (True);
- }
-
- XtFree((char *)children);
- return (False);
-}
-
-/*
- * Function:
- * VerifyWidget
- *
- * Parameters:
- * w - any widget in the tree
- * info - info about the widget to verify
- *
- * Description:
- * Makes sure all the widgets still exist
- */
-static char *
-VerifyWidget(Widget w, WidgetInfo *info)
-{
- Widget top;
- register int count;
- register Widget parent;
- register unsigned long *child;
-
- for (top = w; XtParent(top) != NULL; top = XtParent(top))
- ;
-
- parent = NULL;
- child = info->ids;
- count = 0;
-
- while (True)
- {
- if (!IsChild(top, parent, (Widget) *child))
- return ("This widget no longer exists in the client.");
-
- if (++count == info->num_widgets)
- break;
-
- parent = (Widget)*child++;
- }
-
- info->real_widget = (Widget)*child;
-
- return (NULL);
-}
-
-/************************************************************
- * Code to Perform SetValues operations
- ************************************************************/
-/*
- * Function:
- * DoSetValues
- *
- * Parameters:
- * w - a widget in the tree
- * event - event that caused this action
- * stream - protocol stream to add
- *
- * Description:
- * Performs the setvalues requested
- *
- * Returns:
- * NULL
- */
-static char *
-DoSetValues(Widget w, EditresEvent *event, ProtocolStream *stream)
-{
- char *str;
- register unsigned i;
- unsigned short count = 0;
- SetValuesEvent *sv_event = (SetValuesEvent *)event;
-
- _XEditResPut16(stream, count); /* insert 0, will be overwritten later */
-
- for (i = 0; i < sv_event->num_entries; i++)
- {
- if ((str = VerifyWidget(w, &sv_event->widgets[i])) != NULL)
- {
- _XEditResPutWidgetInfo(stream, &sv_event->widgets[i]);
- _XEditResPutString8(stream, str);
- count++;
- }
- else
- ExecuteSetValues(sv_event->widgets[i].real_widget,
- sv_event, sv_event->widgets + i, stream, &count);
- }
-
- /*
- * Overwrite the first 2 bytes with the real count.
- */
- *(stream->top) = count >> XER_NBBY;
- *(stream->top + 1) = count;
-
- return (NULL);
-}
-
-/*
- * Function:
- * HandleToolkitErrors
- *
- * Parameters:
- * name - name of the error
- * type - type of the error
- * class - class of the error
- * msg - the default message
- * params - the extra parameters for this message
- * num_params - ""
- *
- * Description: Handles X Toolkit Errors.
- */
-/* ARGSUSED */
-static void
-HandleToolkitErrors(String name, String type, String class, String msg,
- String *params, Cardinal *num_params)
-{
- SVErrorInfo *info = &globals.error_info;
- char buf[BUFSIZ];
-
- if (streq(name, "unknownType"))
- XmuSnprintf(buf, sizeof(buf),
- "The `%s' resource is not used by this widget.",
- info->event->name);
- else if (streq(name, "noColormap"))
- XmuSnprintf(buf, sizeof(buf), msg, params[0]);
- else if (streq(name, "conversionFailed") || streq(name, "conversionError"))
- {
- if (streq(info->event->value, XtRString))
- XmuSnprintf(buf, sizeof(buf),
- "Could not convert the string '%s' for the `%s' "
- "resource.", info->event->value, info->event->name);
- else
- XmuSnprintf(buf, sizeof(buf),
- "Could not convert the `%s' resource.",
- info->event->name);
- }
- else
- XmuSnprintf(buf, sizeof(buf),
- "Name: %s, Type: %s, Class: %s, Msg: %s",
- name, type, class, msg);
-
- /*
- * Insert this info into the protocol stream, and update the count
- */
- (*(info->count))++;
- _XEditResPutWidgetInfo(info->stream, info->entry);
- _XEditResPutString8(info->stream, buf);
-}
-
-/*
- * Function:
- * ExecuteSetValues
- *
- * Parameters:
- * w - widget to perform the set_values on
- * sv_event - set values event
- * sv_info - set_value info
- *.
- * Description:
- * Performs a setvalues for a given command
- */
-static void
-ExecuteSetValues(Widget w, SetValuesEvent *sv_event, WidgetInfo *entry,
- ProtocolStream *stream, unsigned short *count)
-{
- XtErrorMsgHandler old;
- SVErrorInfo *info = &globals.error_info;
-
- info->event = sv_event; /* No data can be passed to */
- info->stream = stream; /* an error handler, so we */
- info->count = count; /* have to use a global */
- info->entry = entry;
-
- old = XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w),
- HandleToolkitErrors);
-
- XtVaSetValues(w, XtVaTypedArg,
- sv_event->name, sv_event->res_type,
- sv_event->value, sv_event->value_len,
- NULL);
-
- (void)XtAppSetWarningMsgHandler(XtWidgetToApplicationContext(w), old);
-}
-
-/************************************************************
- * Code for Creating and dumping widget tree.
- ************************************************************/
-/* Function:
- * DumpWidgets
- *
- * Parameters:
- * w - a widget in the tree
- * event - event that caused this action
- * stream - protocol stream to add
- *
- * Description:
- * Given a widget it builds a protocol packet containing the entire
- * widget heirarchy.
- *
- * Returns:
- * NULL
- */
-#define TOOLKIT_TYPE ("Xt")
-/*ARGSUSED*/
-static char *
-DumpWidgets(Widget w, EditresEvent *event, ProtocolStream *stream)
-{
- unsigned short count = 0;
-
- /* Find Tree's root */
- for (; XtParent(w) != NULL; w = XtParent(w))
- ;
-
- /*
- * hold space for count, overwritten later
- */
- _XEditResPut16(stream, (unsigned int)0);
-
- DumpChildren(w, stream, &count);
-
- /*
- * write out toolkit type
- */
- _XEditResPutString8(stream, TOOLKIT_TYPE);
-
- /*
- * Overwrite the first 2 bytes with the real count
- */
- *(stream->top) = count >> XER_NBBY;
- *(stream->top + 1) = count;
-
- return (NULL);
-}
-
-/*
- * Function:
- * DumpChildren
- *
- * Parameters:
- * w - widget to dump
- * stream - stream to dump to
- * count - number of dumps we have performed
- *
- * Description:
- * Adds a child's name to the list.
- */
-/* This is a trick/kludge. To make shared libraries happier (linking
- * against Xmu but not linking against Xt, and apparently even work
- * as we desire on SVR4, we need to avoid an explicit data reference
- * to applicationShellWidgetClass. XtIsTopLevelShell is known
- * (implementation dependent assumption!) to use a bit flag. So we
- * go that far. Then, we test whether it is an applicationShellWidget
- * class by looking for an explicit class name. Seems pretty safe.
- */
-static Bool
-isApplicationShell(Widget w)
-{
- register WidgetClass c;
-
- if (!XtIsTopLevelShell(w))
- return (False);
- for (c = XtClass(w); c; c = c->core_class.superclass)
- if (strcmp(c->core_class.class_name, "ApplicationShell") == 0)
- return (True);
-
- return (False);
-}
-
-static void
-DumpChildren(Widget w, ProtocolStream *stream, unsigned short *count)
-{
- int i, num_children;
- Widget *children;
- unsigned long window;
- char *c_class;
-
- (*count)++;
-
- InsertWidget(stream, w); /* Insert the widget into the stream */
-
- _XEditResPutString8(stream, XtName(w)); /* Insert name */
-
- if (isApplicationShell(w))
- c_class = ((ApplicationShellWidget)w)->application.class;
- else
- c_class = XtClass(w)->core_class.class_name;
-
- _XEditResPutString8(stream, c_class); /* Insert class */
-
- if (XtIsWidget(w))
- if (XtIsRealized(w))
- window = XtWindow(w);
- else
- window = EDITRES_IS_UNREALIZED;
- else
- window = EDITRES_IS_OBJECT;
-
- _XEditResPut32(stream, window); /* Insert window id */
-
- /*
- * Find children and recurse
- */
- num_children = FindChildren(w, &children, True, True, True);
- for (i = 0; i < num_children; i++)
- DumpChildren(children[i], stream, count);
-
- XtFree((char *)children);
-}
-
-/************************************************************
- * Code for getting the geometry of widgets
- ************************************************************/
-/*
- * Function:
- * DoGetGeometry
- *
- * Parameters:
- * w - widget in the tree
- * event - event that caused this action
- * stream - protocol stream to add
- *
- * Description:
- * Retrieves the Geometry of each specified widget.
- *
- * Returns:
- * NULL
- */
-static char *
-DoGetGeometry(Widget w, EditresEvent *event, ProtocolStream *stream)
-{
- unsigned i;
- char *str;
- GetGeomEvent *geom_event = (GetGeomEvent *)event;
-
- _XEditResPut16(stream, geom_event->num_entries);
-
- for (i = 0; i < geom_event->num_entries; i++)
- {
- /*
- * Send out the widget id
- */
- _XEditResPutWidgetInfo(stream, &geom_event->widgets[i]);
-
- if ((str = VerifyWidget(w, &geom_event->widgets[i])) != NULL)
- {
- _XEditResPutBool(stream, True); /* an error occured */
- _XEditResPutString8(stream, str); /* set message */
- }
- else
- ExecuteGetGeometry(geom_event->widgets[i].real_widget, stream);
- }
-
- return (NULL);
-}
-
-/*
- * Function:
- * ExecuteGetGeometry
- *
- * Parameters:
- * w - widget to get geometry
- * stream - stream to append to
- *
- * Description:
- * Gets the geometry for each widget specified.
- *
- * Returns:
- * True if no error occured.
- */
-static void
-ExecuteGetGeometry(Widget w, ProtocolStream *stream)
-{
- int i;
- Boolean mapped_when_man;
- Dimension width, height, border_width;
- Arg args[8];
- Cardinal num_args = 0;
- Position x, y;
-
- if (!XtIsRectObj(w) || (XtIsWidget(w) && !XtIsRealized(w)))
- {
- _XEditResPutBool(stream, False); /* no error */
- _XEditResPutBool(stream, False); /* not visable */
- for (i = 0; i < 5; i++) /* fill in extra space with 0's */
- _XEditResPut16(stream, 0);
- return;
- }
-
- XtSetArg(args[num_args], XtNwidth, &width); num_args++;
- XtSetArg(args[num_args], XtNheight, &height); num_args++;
- XtSetArg(args[num_args], XtNborderWidth, &border_width); num_args++;
- XtSetArg(args[num_args], XtNmappedWhenManaged, &mapped_when_man);
- num_args++;
- XtGetValues(w, args, num_args);
-
- if (!(XtIsManaged(w) && mapped_when_man) && XtIsWidget(w))
- {
- XWindowAttributes attrs;
-
- /*
- * The toolkit does not maintain mapping state, we have
- * to go to the server
- */
- if (XGetWindowAttributes(XtDisplay(w), XtWindow(w), &attrs) != 0)
- {
- if (attrs.map_state != IsViewable)
- {
- _XEditResPutBool(stream, False); /* no error */
- _XEditResPutBool(stream, False); /* not visable */
- for (i = 0; i < 5; i++) /* fill in extra space with 0's */
- _XEditResPut16(stream, 0);
- return;
- }
- }
- else
- {
- _XEditResPut8(stream, True); /* Error occured. */
- _XEditResPutString8(stream, "XGetWindowAttributes failed.");
- return;
- }
- }
-
- XtTranslateCoords(w, -((int) border_width), -((int) border_width), &x, &y);
-
- _XEditResPutBool(stream, False); /* no error */
- _XEditResPutBool(stream, True); /* Visable */
- _XEditResPut16(stream, x);
- _XEditResPut16(stream, y);
- _XEditResPut16(stream, width);
- _XEditResPut16(stream, height);
- _XEditResPut16(stream, border_width);
-}
-
-/************************************************************
- * Code for executing FindChild
- ************************************************************/
-/*
- * Function:
- * PositionInChild
- *
- * Parameters:
- * child - child widget to check
- * x - location of point to check in the parent's coord space
- * y - ""
- *
- * Description:
- * Returns true if this location is in the child.
- */
-static Bool
-PositionInChild(Widget child, int x, int y)
-{
- Arg args[6];
- Cardinal num;
- Dimension width, height, border_width;
- Position child_x, child_y;
- Boolean mapped_when_managed;
-
- if (!XtIsRectObj(child)) /* we must at least be a rect obj */
- return (False);
-
- num = 0;
- XtSetArg(args[num], XtNmappedWhenManaged, &mapped_when_managed); num++;
- XtSetArg(args[num], XtNwidth, &width); num++;
- XtSetArg(args[num], XtNheight, &height); num++;
- XtSetArg(args[num], XtNx, &child_x); num++;
- XtSetArg(args[num], XtNy, &child_y); num++;
- XtSetArg(args[num], XtNborderWidth, &border_width); num++;
- XtGetValues(child, args, num);
-
- /*
- * The only way we will know of the widget is mapped is to see if
- * mapped when managed is True and this is a managed child. Otherwise
- * we will have to ask the server if this window is mapped
- */
- if (XtIsWidget(child) && !(mapped_when_managed && XtIsManaged(child)))
- {
- XWindowAttributes attrs;
-
- if (XGetWindowAttributes(XtDisplay(child), XtWindow(child), &attrs)
- && attrs.map_state != IsViewable)
- return (False);
- }
-
- return ((x >= child_x)
- && (x <= (child_x + (Position)width + 2 * (Position)border_width))
- && (y >= child_y)
- && (y <= (child_y + (Position)height + 2 * (Position)border_width)));
-}
-
-/*
- * Function:
- * _FindChild
- *
- * Parameters:
- * parent - widget that is known to contain the point specified
- * x - point in coordinates relative to the widget specified
- * y - ""
- *
- * Description:
- * Finds the child that actually contains the point shown.
- */
-static Widget
-_FindChild(Widget parent, int x, int y)
-{
- Widget *children;
- int i = FindChildren(parent, &children, True, False, True);
-
- while (i > 0)
- {
- i--;
-
- if (PositionInChild(children[i], x, y))
- {
- Widget child = children[i];
-
- XtFree((char *)children);
- return (_FindChild(child, x - child->core.x, y - child->core.y));
- }
- }
-
- XtFree((char *)children);
-
- return (parent);
-}
-
-/*
- * Function:
- * DoFindChild
- *
- * Parameters:
- * w - widget in the tree
- * event - event that caused this action
- * stream - protocol stream to add
- * Description:
- * Finds the child that contains the location specified.
- *
- * Returns:
- * An allocated error message if something went horribly wrong and
- * no set values were performed, else NULL.
- */
-static char *
-DoFindChild(Widget w, EditresEvent *event, ProtocolStream *stream)
-{
- char *str;
- Widget parent, child;
- Position parent_x, parent_y;
- FindChildEvent *find_event = (FindChildEvent *)event;
-
- if ((str = VerifyWidget(w, find_event->widgets)) != NULL)
- return (str);
-
- parent = find_event->widgets->real_widget;
-
- XtTranslateCoords(parent, (Position) 0, (Position) 0,
- &parent_x, &parent_y);
-
- child = _FindChild(parent, find_event->x - (int) parent_x,
- find_event->y - (int) parent_y);
-
- InsertWidget(stream, child);
-
- return (NULL);
-}
-
-/************************************************************
- * Procedures for performing GetResources
- ************************************************************/
-/*
- * Function:
- * DoGetResources
- *
- * Parameters:
- * w - widget in the tree
- * event - event that caused this action
- * stream - protocol stream to add
- *
- * Description:
- * Gets the Resources associated with the widgets passed.
- *
- * Returns:
- * NULL
- */
-static char *
-DoGetResources(Widget w, EditresEvent *event, ProtocolStream *stream)
-{
- unsigned int i;
- char *str;
- GetResEvent *res_event = (GetResEvent *)event;
-
- _XEditResPut16(stream, res_event->num_entries); /* number of replys */
-
- for (i = 0; i < res_event->num_entries; i++)
- {
- /*
- * Send out the widget id
- */
- _XEditResPutWidgetInfo(stream, &res_event->widgets[i]);
- if ((str = VerifyWidget(w, &res_event->widgets[i])) != NULL)
- {
- _XEditResPutBool(stream, True); /* an error occured */
- _XEditResPutString8(stream, str); /* set message */
- }
- else
- {
- _XEditResPutBool(stream, False); /* no error occured */
- ExecuteGetResources(res_event->widgets[i].real_widget, stream);
- }
- }
-
- return (NULL);
-}
-
-/* Function:
- * ExecuteGetResources
- *
- * Parameters:
- * w - widget to get resources on
- * stream - protocol stream
- *
- * Description:
- * Gets the resources for any individual widget
- */
-static void
-ExecuteGetResources(Widget w, ProtocolStream *stream)
-{
- XtResourceList norm_list, cons_list;
- Cardinal num_norm, num_cons;
- register Cardinal i;
-
- /*
- * Get Normal Resources
- */
- XtGetResourceList(XtClass(w), &norm_list, &num_norm);
-
- if (XtParent(w) != NULL)
- XtGetConstraintResourceList(XtClass(XtParent(w)), &cons_list,&num_cons);
- else
- num_cons = 0;
-
- _XEditResPut16(stream, num_norm + num_cons); /* how many resources */
-
- /*
- * Insert all the normal resources
- */
- for (i = 0; i < num_norm; i++)
- {
- _XEditResPutResourceType(stream, NormalResource);
- _XEditResPutString8(stream, norm_list[i].resource_name);
- _XEditResPutString8(stream, norm_list[i].resource_class);
- _XEditResPutString8(stream, norm_list[i].resource_type);
- }
- XtFree((char *)norm_list);
-
- /*
- * Insert all the constraint resources
- */
- if (num_cons > 0)
- {
- for (i = 0; i < num_cons; i++)
- {
- _XEditResPutResourceType(stream, ConstraintResource);
- _XEditResPutString8(stream, cons_list[i].resource_name);
- _XEditResPutString8(stream, cons_list[i].resource_class);
- _XEditResPutString8(stream, cons_list[i].resource_type);
- }
- XtFree((char *)cons_list);
- }
-}
-
-/*
- * Function:
- * DumpValues
- *
- * Parameters:
- * event - event that caused this action
- * stream - protocol stream to add
- *
- * Description:
- * Returns resource values to the resource editor.
- *
- * Returns:
- * NULL
- */
-/*ARGSUSED*/
-static char *
-DumpValues(Widget w, EditresEvent* event, ProtocolStream* stream)
-{
- char *str;
- Arg warg[1];
- String res_value = NULL;
- GetValuesEvent *gv_event = (GetValuesEvent *)event;
-
- /* put the count in the stream */
- _XEditResPut16(stream, (unsigned int)1);
-
- /*
- * Get the resource of the widget asked for by the
- * resource editor and insert it into the stream
- */
- XtSetArg(warg[0], gv_event->name, &res_value);
-
- if ((str = VerifyWidget(w, &gv_event->widgets[0])) != NULL)
- _XEditResPutString8(stream, str);
- else
- {
- _XEditresGetStringValues(gv_event->widgets[0].real_widget, warg, 1);
- if (!res_value)
- res_value = "NoValue";
- _XEditResPutString8(stream, res_value);
- }
-
- return (NULL);
-}
-
-/************************************************************
- * Code for inserting values into the protocol stream
- ************************************************************/
-/*
- * Function:
- * InsertWidget
- *
- * Parameters:
- * stream - protocol stream
- * w - widget to insert
- *
- * Description:
- * Inserts the full parent hierarchy of this widget into the protocol
- * stream as a widget list.
- */
-static void
-InsertWidget(ProtocolStream *stream, Widget w)
-{
- Widget temp;
- unsigned long *widget_list;
- register int i, num_widgets;
-
- for (temp = w, i = 0; temp != 0; temp = XtParent(temp), i++)
- ;
-
- num_widgets = i;
- widget_list = (unsigned long *)XtMalloc(sizeof(unsigned long) * num_widgets);
-
- /*
- * Put the widgets into the list
- * make sure that they are inserted in the list from parent -> child
- */
- for (i--, temp = w; temp != NULL; temp = XtParent(temp), i--)
- widget_list[i] = (unsigned long)temp;
-
- _XEditResPut16(stream, num_widgets); /* insert number of widgets */
- for (i = 0; i < num_widgets; i++) /* insert Widgets themselves */
- _XEditResPut32(stream, widget_list[i]);
-
- XtFree((char *)widget_list);
-}
-
-/************************************************************
- * All of the following routines are public
- ************************************************************/
-/*
- * Function:
- * _XEditResPutString8
- *
- * Parameters:
- * stream - stream to insert string into
- * str - string to insert
- *
- * Description:
- * Inserts a string into the protocol stream.
- */
-void
-_XEditResPutString8(ProtocolStream *stream, char *str)
-{
- int i, len = strlen(str);
-
- _XEditResPut16(stream, len);
- for (i = 0; i < len; i++, str++)
- _XEditResPut8(stream, *str);
-}
-
-/*
- * Function:
- * _XEditResPut8
- *
- * Parameters:
- * stream - stream to insert string into
- * value - value to insert
- *
- * Description:
- * Inserts an 8 bit integer into the protocol stream.
- */
-void
-_XEditResPut8(ProtocolStream *stream, unsigned int value)
-{
- unsigned char temp;
-
- if (stream->size >= stream->alloc)
- {
- stream->alloc += 100;
- stream->real_top = (unsigned char *)
- XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
- stream->top = stream->real_top + HEADER_SIZE;
- stream->current = stream->top + stream->size;
- }
-
- temp = (unsigned char) (value & BYTE_MASK);
- *((stream->current)++) = temp;
- (stream->size)++;
-}
-
-/*
- * Function:
- * _XEditResPut16
- *
- * Arguments:
- * stream - stream to insert string into
- * value - value to insert
- *
- * Description:
- * Inserts a 16 bit integer into the protocol stream.
- */
-void
-_XEditResPut16(ProtocolStream *stream, unsigned int value)
-{
- _XEditResPut8(stream, (value >> XER_NBBY) & BYTE_MASK);
- _XEditResPut8(stream, value & BYTE_MASK);
-}
-
-/*
- * Function:
- * _XEditResPut32
- *
- * Arguments:
- * stream - stream to insert string into
- * value - value to insert
- *
- * Description:
- * Inserts a 32 bit integer into the protocol stream.
- */
-void
-_XEditResPut32(ProtocolStream *stream, unsigned long value)
-{
- int i;
-
- for (i = 3; i >= 0; i--)
- _XEditResPut8(stream, (value >> (XER_NBBY * i)) & BYTE_MASK);
-}
-
-/*
- * Function:
- * _XEditResPutWidgetInfo
- *
- * Parameters:
- * stream - stream to insert widget info into
- * info - info to insert
- *
- * Description:
- * Inserts the widget info into the protocol stream.
- */
-void
-_XEditResPutWidgetInfo(ProtocolStream *stream, WidgetInfo *info)
-{
- unsigned int i;
-
- _XEditResPut16(stream, info->num_widgets);
- for (i = 0; i < info->num_widgets; i++)
- _XEditResPut32(stream, info->ids[i]);
-}
-
-/************************************************************
- * Code for retrieving values from the protocol stream
- ************************************************************/
-/*
- * Function:
- * _XEditResResetStream
- *
- * Parameters:
- * stream - stream to reset
- *
- * Description:
- * Resets the protocol stream.
- */
-void
-_XEditResResetStream(ProtocolStream *stream)
-{
- stream->current = stream->top;
- stream->size = 0;
- if (stream->real_top == NULL)
- {
- stream->real_top = (unsigned char *)
- XtRealloc((char *)stream->real_top, stream->alloc + HEADER_SIZE);
- stream->top = stream->real_top + HEADER_SIZE;
- stream->current = stream->top + stream->size;
- }
-}
-
-/*
- * NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
- *
- * The only modified field if the "current" field
- *
- * The only fields that must be set correctly are the "current", "top"
- * and "size" fields.
- */
-/*
- * Function:
- * _XEditResGetg8
- *
- * Parameters:
- * stream - protocol stream
- * value - a pointer to value to return
- *
- * Description:
- * Retrieves an unsigned 8 bit value from the protocol stream.
- *
- * Returns:
- * True if sucessful
- */
-Bool
-_XEditResGet8(ProtocolStream *stream, unsigned char *value)
-{
- if (stream->size < (unsigned long)(stream->current - stream->top))
- return (False);
-
- *value = *((stream->current)++);
- return (True);
-}
-
-/*
- * Function:
- * _XEditResGet16
- *
- * Parameters:
- * stream - protocol stream
- * value - pointer to return value
- *
- * Description:
- * Retrieves an unsigned 16 bit value from the protocol stream.
- *
- * Returns:
- * True if sucessful
- */
-Bool
-_XEditResGet16(ProtocolStream *stream, unsigned short *value)
-{
- unsigned char temp1, temp2;
-
- if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
- return (False);
-
- *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
- return (True);
-}
-
-/*
- * Function:
- * _XEditResGetSigned16
- *
- * Parameters:
- * stream - protocol stream
- * value - pointer to return value
- *
- * Description:
- * Retrieves an signed 16 bit value from the protocol stream.
- *
- * Returns:
- * True if sucessful
- */
-Bool
-_XEditResGetSigned16(ProtocolStream *stream, short *value)
-{
- unsigned char temp1, temp2;
-
- if (!(_XEditResGet8(stream, &temp1) && _XEditResGet8(stream, &temp2)))
- return (False);
-
- if (temp1 & (1 << (XER_NBBY - 1))) /* If the sign bit is active */
- {
- *value = -1; /* store all 1's */
- *value &= (temp1 << XER_NBBY); /* Now and in the MSB */
- *value &= temp2; /* and LSB */
- }
- else
- *value = ((unsigned short)temp1 << XER_NBBY) + (unsigned short)temp2;
-
- return (True);
-}
-
-/*
- * Function:
- * _XEditResGet32
- *
- * Parameters:
- * stream - protocol stream
- * value - pointer to return value
- *
- * Description:
- * Retrieves an unsigned 32 bit value from the protocol stream.
- *
- * Returns:
- * True if sucessful
- */
-Bool
-_XEditResGet32(ProtocolStream *stream, unsigned long *value)
-{
- unsigned short temp1, temp2;
-
- if (!(_XEditResGet16(stream, &temp1) && _XEditResGet16(stream, &temp2)))
- return (False);
-
- *value = ((unsigned short)temp1 << (XER_NBBY * 2)) + (unsigned short)temp2;
- return (True);
-}
-
-/* Function:
- * _XEditResGetString8
- *
- * Parameters:
- * stream - protocol stream
- * str - string to retrieve
- *
- * Description:
- * Retrieves an 8 bit string value from the protocol stream.
- *
- * Returns:
- * True if retrieval was successful
- */
-Bool
-_XEditResGetString8(ProtocolStream *stream, char **str)
-{
- unsigned short len;
- register unsigned i;
-
- if (!_XEditResGet16(stream, &len))
- return (False);
-
- *str = XtMalloc(sizeof(char) * (len + 1));
-
- for (i = 0; i < len; i++)
- {
- if (!_XEditResGet8(stream, (unsigned char *)*str + i))
- {
- XtFree(*str);
- *str = NULL;
- return (False);
- }
- }
- (*str)[i] = '\0';
-
- return (True);
-}
-
-/*
- * Function:
- * _XEditResGetWidgetInfo
- *
- * Parameters:
- * stream - protocol stream
- * info - widget info struct to store into
- *
- * Description:
- * Retrieves the list of widgets that follow and stores them in the
- * widget info structure provided.
- *
- * Returns:
- * True if retrieval was successful
- */
-Bool
-_XEditResGetWidgetInfo(ProtocolStream *stream, WidgetInfo *info)
-{
- unsigned int i;
-
- if (!_XEditResGet16(stream, &info->num_widgets))
- return (False);
-
- info->ids = (unsigned long *)XtMalloc(sizeof(long) * info->num_widgets);
-
- for (i = 0; i < info->num_widgets; i++)
- {
- if (!_XEditResGet32(stream, info->ids + i))
- {
- XtFree((char *)info->ids);
- info->ids = NULL;
- return (False);
- }
-#if defined(LONG64) || defined(WORD64)
- info->ids[i] |= globals.base_address;
-#endif
- }
- return (True);
-}
-
-/************************************************************
- * Code for Loading the EditresBlock resource
- ************************************************************/
-/*
- * Function:
- * CvStringToBlock
- *
- * Parameters:
- * dpy - display
- * args - unused
- * num_args - unused
- * from_val - value to convert
- * to_val - where to store
- * converter_data - unused
- *
- * Description:
- * Converts a string to an editres block value.
- *
- * Returns:
- * True if conversion was sucessful
- */
-/*ARGSUSED*/
-static Boolean
-CvtStringToBlock(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *from_val, XrmValue *to_val,
- XtPointer *converter_data)
-{
- char ptr[16];
- static EditresBlock block;
-
- XmuNCopyISOLatin1Lowered(ptr, from_val->addr, sizeof(ptr));
-
- if (streq(ptr, "none"))
- block = BlockNone;
- else if (streq(ptr, "setvalues"))
- block = BlockSetValues;
- else if (streq(ptr, "all"))
- block = BlockAll;
- else
- {
- Cardinal num_params = 1;
- String params[1];
-
- params[0] = from_val->addr;
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "CvtStringToBlock", "unknownValue", "EditresError",
- "Could not convert string \"%s\" to EditresBlock.",
- params, &num_params);
- return FALSE;
- }
-
- if (to_val->addr != NULL)
- {
- if (to_val->size < sizeof(EditresBlock))
- {
- to_val->size = sizeof(EditresBlock);
- return FALSE;
- }
- *(EditresBlock *)(to_val->addr) = block;
- }
- else
- to_val->addr = (XtPointer)block;
-
- to_val->size = sizeof(EditresBlock);
- return TRUE;
-}
-
-#define XtREditresBlock "EditresBlock"
-/*
- * Function:
- * LoadResources
- *
- * Parameters:
- * w - any widget in the tree
- *
- * Description:
- * Loads a global resource the determines of this application should
- * allow Editres requests.
- */
-static void
-LoadResources(Widget w)
-{
- static XtResource resources[] = {
- {"editresBlock", "EditresBlock", XtREditresBlock, sizeof(EditresBlock),
- XtOffsetOf(Globals, block), XtRImmediate, (XtPointer)BlockNone}
- };
-
- for (; XtParent(w) != NULL; w = XtParent(w))
- ;
-
- XtAppSetTypeConverter(XtWidgetToApplicationContext(w),
- XtRString, XtREditresBlock, CvtStringToBlock,
- NULL, 0, XtCacheAll, NULL);
-
- XtGetApplicationResources(w, (XtPointer)&globals, resources,
- XtNumber(resources), NULL, 0);
-}
-
-/*
- * Function:
- * _XEditresGetStringValues
- *
- * Parameters:
- * w - widget
- * warg - where to store result
- * numargs - unused
- */
-/*ARGSUSED*/
-static void
-_XEditresGetStringValues(Widget w, Arg *warg, int numargs)
-{
- static char buffer[32];
- XtResourceList res_list;
- Cardinal num_res;
- XtResource *res = NULL;
- long value;
- Cardinal i;
- char *string = "";
- Arg args[1];
- XrmValue to, from;
-
- /*
- * Look for the resource
- */
- XtGetResourceList(XtClass(w), &res_list, &num_res);
- for (i = 0; i < num_res; i++)
- if (strcmp(res_list[i].resource_name, warg->name) == 0)
- {
- res = &res_list[i];
- break;
- }
-
- if (res == NULL && XtParent(w) != NULL)
- {
- XtFree((char *)res_list);
- XtGetConstraintResourceList(XtClass(XtParent(w)), &res_list, &num_res);
- for (i = 0; i < num_res; i++)
- if (strcmp(res_list[i].resource_name, warg->name) == 0)
- {
- res = &res_list[i];
- break;
- }
- }
-
- if (res == NULL)
- {
- /* Couldn't find resource */
-
- XtFree((char *)res_list);
- *(XtPointer *)warg->value = NULL;
- return;
- }
-
- /* try to get the value in the proper size */
- switch (res->resource_size)
- {
-#ifdef LONG_64
- long v8;
-#endif
- int v4;
- short v2;
- char v1;
-
- case 1:
- XtSetArg(args[0], res->resource_name, &v1);
- XtGetValues(w, args, 1);
- value = (int)v1;
- break;
- case 2:
- XtSetArg(args[0], res->resource_name, &v2);
- XtGetValues(w, args, 1);
- value = (int)v2;
- break;
- case 4:
- XtSetArg(args[0], res->resource_name, &v4);
- XtGetValues(w, args, 1);
- value = (int)v4;
- break;
-#ifdef LONG_64
- case 8:
- XtSetArg(args[0], res->resource_name, &v8);
- XtGetValues(w, args, 1);
- value = (long)v8;
- break;
-#endif
- default:
- fprintf(stderr, "_XEditresGetStringValues: bad size %d\n",
- res->resource_size);
- string = "bad size";
- *(char **)(warg->value) = string;
- XtFree((char *)res_list);
- return;
- }
-
- /*
- * If the resource is already String, no conversion needed
- */
- if (strcmp(XtRString, res->resource_type) == 0)
- {
- if (value == 0)
- string = "(null)";
- else
- string = (char *)value;
- }
- else
- {
- from.size = res->resource_size;
- from.addr = (XPointer)&value;
- to.addr = NULL;
- to.size = 0;
-
- if (XtConvertAndStore(w,res->resource_type, &from, XtRString, &to))
- string = to.addr;
- else
- {
- string = buffer;
- /*
- * Conversion failed, fall back to representing it as integer
- */
- switch (res->resource_size)
- {
- case sizeof(char):
- XmuSnprintf(buffer, sizeof(buffer), "%d", (int)(value & 0xff));
- break;
- case sizeof(short):
- XmuSnprintf(buffer, sizeof(buffer), "%d", (int)(value & 0xffff));
- break;
- case sizeof(int):
- XmuSnprintf(buffer, sizeof(buffer), "0x%08hx", (int)value);
- break;
-#ifdef LONG_64
- case sizeof(long):
- XmuSnprintf(buffer, sizeof(buffer), "0x%016hx", value);
- break;
-#endif
- }
- }
- }
-
- if (string == NULL)
- string = "";
-
- *(char **)(warg->value) = string;
- XtFree((char *)res_list);
-}
diff --git a/xc/lib/Xmu/EditresP.h b/xc/lib/Xmu/EditresP.h
deleted file mode 100644
index b5c811d59..000000000
--- a/xc/lib/Xmu/EditresP.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/* $TOG: EditresP.h /main/14 1998/02/06 15:43: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/EditresP.h,v 1.4 1998/10/03 09:06:28 dawes Exp $ */
-
-/*
- * Author: Chris D. Peterson, MIT X Consortium
- */
-
-/************************************************************
-
- The Editres Protocol
-
-
- The Client message sent to the application is:
-
- ATOM = "ResEditor" --- RES_EDITOR_NAME
-
- FORMAT = 32 --- RES_EDIT_SEND_EVENT_FORMAT
-
- l[0] = timestamp
- l[1] = command atom name
- l[2] = ident of command
- l[3] = protocol version number to use
-
-
-
- The binary protocol has the following format:
-
- Card8: 8-bit unsingned integer
- Card16: 16-bit unsingned integer
- Card32: 32-bit unsingned integer
- Int16: 16-bit signed integer
- Window: 32-bit value
- Widget: 32-bit value
- String8: ListOfCard8
-
- [a][b][c] represent an exclusive list of choices.
-
- All widgets are passed as a list of widgets, containing the
- full instance heirarch of this widget. The hierarchy is ordered
- from parent to child. Thus the first element of each list is
- the root of the widget tree (this makes verifying that the widget
- still exists, MUCH faster).
-
- ListOfFoo comprises a list of things in the following format:
-
- number: Card16
- <number> things: ????
-
- This is a synchronous protocol, every request MUST be followed by a
- reply.
-
- Request:
-
- Serial Number: Card8
- Op Code: Card8 - { SendWidgetTree = 0,
- SetValues = 1,
- GetResources = 2,
- GetGeometry = 3,
- FindChild = 4,
- GetValues = 5 }
- Length: Card32
- Data:
-
- Reply:
-
- Serial Number: Card8
- Type: Card8 - { Formatted = 0,
- Unformatted = 1,
- ProtocolMismatch = 2
- }
- Length: Card32
-
-
- Byte Order:
-
- All Fields are MSB -> LSB
-
- Data:
-
- Formatted:
-
- The data contains the reply information for the request as
- specified below if the reply type is "Formatted". The return
- values for the other reply types are shown below.
-
- Unformatted:
-
- Message: String8
-
- ProtocolMismatch:
-
- RequestedVersion: Card8
-
-------------------------------------------------------------
-
- SendWidgetTree:
-
- --->
-
- Number of Entries: Card16
- Entry:
- widget: ListOfWidgets
- name: String8
- class: String8
- window: Card32
- toolkit: String8
-
- Send Widget Tree returns the toolkit type, and a fuly specified list
- of widgets for each widget in the tree. This is enough information
- to completely reconstruct the entire widget heirarchy.
-
- The window return value contains the Xid of the window currently
- used by this widget. If the widget is unrealized then 0 is returned,
- and if widget is a non-windowed object a value of 2 is returned.
-
- SetValues:
-
- name: String8
- type: String8
- value: String8
- Number of Entries: Card16
- Entry:
- widget: ListOfWidgets
-
- --->
-
- Number of Entries: Card16
- Entry:
- widget: ListOfWidgets
- message: String8
-
- SetValues will allow the same resource to be set on a number of
- widgets. This function will return an error message if the SetValues
- request caused an Xt error.
-
- GetValues:
-
- names: ListOfString8
- widget: Widget
-
- --->
- novalues: ListOfCard16
- values: ListOfString8
-
- GetValues will allow a number of resource values to be read
- on a particular widget. The request specifies the names of
- the resources wanted and the widget id these resources are
- from. The reply returns a list of indices from the requests
- name list of resources for which a value can not be returned.
- It also returns a list of returned values, in the order of the
- requests names list, skipping those indices present in novalues.
-
- GetResources:
-
- Number of Entries: Card16
- Entry
- widget: ListOfWidgets:
-
- ---->
-
- Number of Entries: Card16
- Entry
- Widget: ListOfWidgets:
- Error: Bool
-
- [ Message: String 8 ]
- [ Number of Resources: Card16
- Resource:
- Kind: {normal, constraint}
- Name: String8
- Class: String8
- Type: String8 ]
-
- GetResource retrieves the kind, name, class and type for every
- widget passed to it. If an error occured with the resource fetch
- Error will be set to True for the given widget and a message
- is returned rather than the resource info.
-
- GetGeometry:
-
- Number of Entries: Card16
- Entry
- Widget: ListOfWidgets:
-
- ---->
-
- Number of Entries: Card16
- Entry
- Widget: ListOfWidgets:
- Error: Bool
-
- [ message: String 8 ]
- [ mapped: Boolean
- X: Int16
- Y: Int16
- Width: Card16
- Height: Card16
- BorderWidth: Card16 ]
-
- GetGeometry retreives the mapping state, x, y, width, height
- and border width for each widget specified. If an error occured
- with the geometry fetch "Error" will be set to True for the given
- widget and a message is returned rather than the geometry info.
- X an Y corrospond to the root coordinates of the upper left corner
- of the widget (outside the window border).
-
- FindChild:
-
- Widget: ListOfWidgets
- X: Int16
- Y: Int16
-
- --->
-
- Widget: ListOfWidgets
-
- Find Child returns a descendent of the widget specified that
- is at the root coordinates specified.
-
- NOTE:
-
- The returned widget is undefined if the point is contained in
- two or more mapped widgets, or in two overlapping Rect objs.
-
- GetValues:
-
- names: ListOfString8
- widget: Widget
-
- --->
-
- values: ListOfString8
-
- GetValues will allow a number of resource values to be read
- on a particular widget. Currently only InterViews 3.0.1 Styles
- and their attributes are supported. In addition, the current
- user interface only supports the return of 1 resource. The ability
- to specify and return multiple resources is defined for future editres
- interfaces where some or all of a widgets resource values are returned
- and displayed at once.
-
-
-************************************************************/
-
-#include <X11/Intrinsic.h>
-#include <X11/Xfuncproto.h>
-
-#define XER_NBBY 8 /* number of bits in a byte */
-#define BYTE_MASK 255
-
-#define HEADER_SIZE 6
-
-#define EDITRES_IS_OBJECT 2
-#define EDITRES_IS_UNREALIZED 0
-
-/*
- * Format for atoms
- */
-#define EDITRES_FORMAT 8
-#define EDITRES_SEND_EVENT_FORMAT 32
-
-/*
- * Atoms
- */
-#define EDITRES_NAME "Editres"
-#define EDITRES_COMMAND_ATOM "EditresCommand"
-#define EDITRES_COMM_ATOM "EditresComm"
-#define EDITRES_CLIENT_VALUE "EditresClientVal"
-#define EDITRES_PROTOCOL_ATOM "EditresProtocol"
-
-typedef enum {
- SendWidgetTree = 0,
- SetValues = 1,
- GetResources = 2,
- GetGeometry = 3,
- FindChild = 4,
- GetValues = 5
-} EditresCommand;
-
-typedef enum {
- NormalResource = 0,
- ConstraintResource = 1
-} ResourceType;
-
-/*
- * The type of a resource identifier
- */
-typedef unsigned char ResIdent;
-
-typedef enum {
- PartialSuccess = 0,
- Failure = 1,
- ProtocolMismatch = 2
-} EditResError;
-
-typedef struct _WidgetInfo {
- unsigned short num_widgets;
- unsigned long *ids;
- Widget real_widget;
-} WidgetInfo;
-
-typedef struct _ProtocolStream {
- unsigned long size, alloc;
- unsigned char *real_top, *top, *current;
-} ProtocolStream;
-
-/************************************************************
- * Function definitions for reading and writing protocol requests
- ************************************************************/
-_XFUNCPROTOBEGIN
-
-void _XEditResPutString8
-(
- ProtocolStream *stream,
- char *str
- );
-
-void _XEditResPut8
-(
- ProtocolStream *stream,
- unsigned int value
- );
-
-void _XEditResPut16
-(
- ProtocolStream *stream,
- unsigned int value
- );
-
-void _XEditResPut32
-(
- ProtocolStream *stream,
- unsigned long value
- );
-
-void _XEditResPutWidgetInfo
-(
- ProtocolStream *stream,
- WidgetInfo *info
- );
-
-void _XEditResResetStream
-(
- ProtocolStream *stream
- );
-
-Bool _XEditResGet8
-(
- ProtocolStream *stream,
- unsigned char *value
- );
-
-Bool _XEditResGet16
-(
- ProtocolStream *stream,
- unsigned short *value
- );
-
-Bool _XEditResGetSigned16
-(
- ProtocolStream *stream,
- short *value
- );
-
-Bool _XEditResGet32
-(
- ProtocolStream *stream,
- unsigned long *value
- );
-
-Bool _XEditResGetString8
-(
- ProtocolStream *stream,
- char **str
- );
-
-Bool _XEditResGetWidgetInfo
-(
- ProtocolStream *stream,
- WidgetInfo *info
- );
-
-_XFUNCPROTOEND
diff --git a/xc/lib/Xmu/Error.h b/xc/lib/Xmu/Error.h
deleted file mode 100644
index d857ad498..000000000
--- a/xc/lib/Xmu/Error.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $TOG: Error.h /main/6 1998/02/06 15:43:33 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Error.h,v 1.4 1998/10/03 09:06:28 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_ERROR_H_
-#define _XMU_ERROR_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-int XmuPrintDefaultErrorMessage
-(
- Display *dpy,
- XErrorEvent *event,
- FILE *fp
- );
-
-int XmuSimpleErrorHandler
-(
- Display *dpy,
- XErrorEvent *errorp
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_ERROR_H_ */
diff --git a/xc/lib/Xmu/ExtAgent.c b/xc/lib/Xmu/ExtAgent.c
deleted file mode 100644
index ce3f9568e..000000000
--- a/xc/lib/Xmu/ExtAgent.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $TOG: ExtAgent.c /main/2 1998/02/06 15:43:39 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/ExtAgent.c,v 1.5 1998/10/03 09:06:29 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/ExtAgent.h>
-
-/* ARGSUSED */
-void
-XmuRegisterExternalAgent(Widget w, XtPointer data,
- XEvent *event, Boolean *cont)
-{
-/*
-* This is a stub. Writers of protocol libraries
-* that want to add protocol to Xaw, such as RAP, will reimplement this
-* procedure in their own libraries.
-*/
-}
diff --git a/xc/lib/Xmu/ExtAgent.h b/xc/lib/Xmu/ExtAgent.h
deleted file mode 100644
index 3e7767581..000000000
--- a/xc/lib/Xmu/ExtAgent.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $TOG: ExtAgent.h /main/2 1998/02/06 15:43:44 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/ExtAgent.h,v 1.4 1998/10/03 09:06:29 dawes Exp $ */
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-extern void XmuRegisterExternalAgent
-(
- Widget w,
- XtPointer data,
- XEvent *event,
- Boolean *cont
- );
-
-_XFUNCPROTOEND
-
diff --git a/xc/lib/Xmu/FToCback.c b/xc/lib/Xmu/FToCback.c
deleted file mode 100644
index 2db2db1b8..000000000
--- a/xc/lib/Xmu/FToCback.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $TOG: FToCback.c /main/6 1998/02/06 15:43:49 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/FToCback.c,v 1.5 1998/10/03 09:06:29 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/Converters.h>
-
-/* ARGSUSED */
-void
-XmuCvtFunctionToCallback(XrmValue *args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XtCallbackRec callback[2]; /* K&R: initialized to NULL */
- static XtCallbackList callback_list = callback;
-
- callback[0].callback = *(XtCallbackProc *)fromVal->addr;
-
- toVal->size = sizeof(XtCallbackList);
- toVal->addr = (XPointer)&callback_list;
-}
diff --git a/xc/lib/Xmu/GetHost.c b/xc/lib/Xmu/GetHost.c
deleted file mode 100644
index f129669fe..000000000
--- a/xc/lib/Xmu/GetHost.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* $TOG: GetHost.c /main/9 1998/02/06 15:43: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/GetHost.c,v 3.5 1998/10/03 09:06:29 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- *
- * _XGetHostname - similar to gethostname but allows special processing.
- */
-
-#include <X11/Xosdefs.h>
-#ifndef X_NOT_STDC_ENV
-#include <string.h>
-#include <unistd.h>
-#endif
-
-#ifdef WIN32
-#include <X11/Xwinsock.h>
-#endif
-
-#ifdef USG
-#define NEED_UTSNAME
-#endif
-
-#ifdef NEED_UTSNAME
-#include <sys/utsname.h>
-#endif
-
-#include <X11/Xmu/SysUtil.h>
-
-int
-XmuGetHostname(char *buf, int maxlen)
-{
- int len;
-#ifdef WIN32
- static WSADATA wsadata;
-
- if (!wsadata.wVersion && WSAStartup(MAKEWORD(1,1), &wsadata))
- return -1;
-#endif
-
-#ifdef NEED_UTSNAME
- /*
- * same host name crock as in server and xinit.
- */
- struct utsname name;
-
- uname (&name);
- len = strlen (name.nodename);
- if (len >= maxlen) len = maxlen - 1;
- strncpy (buf, name.nodename, len);
- buf[len] = '\0';
-#else
- buf[0] = '\0';
- (void) gethostname (buf, maxlen);
- buf [maxlen - 1] = '\0';
- len = strlen(buf);
-#endif /* hpux */
- return len;
-}
diff --git a/xc/lib/Xmu/GrayPixmap.c b/xc/lib/Xmu/GrayPixmap.c
deleted file mode 100644
index e6d0c081f..000000000
--- a/xc/lib/Xmu/GrayPixmap.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $TOG: GrayPixmap.c /main/9 1998/02/06 15:43:59 kaleb $ */
-
-/*
-
-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 1987, 1988 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/lib/Xmu/GrayPixmap.c,v 1.4 1998/10/03 09:06:30 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/Drawing.h>
-
-typedef struct _PixmapCache {
- Screen *screen;
- Pixmap pixmap;
- Pixel foreground, background;
- unsigned int depth;
- int ref_count;
- struct _PixmapCache *next;
- } CacheEntry;
-
-static CacheEntry *pixmapCache = NULL;
-
-
-
-Pixmap
-XmuCreateStippledPixmap(Screen *screen, Pixel fore, Pixel back,
- unsigned int depth)
-/*
- * Creates a stippled pixmap of specified depth
- * caches these so that multiple requests share the pixmap
- */
-{
- register Display *display = DisplayOfScreen(screen);
- CacheEntry *cachePtr;
- Pixmap stippled_pixmap;
- static unsigned char pixmap_bits[] = {
- 0x02, 0x01,
- };
-
-/*
- * Creates a stippled pixmap of depth DefaultDepth(screen)
- * caches these so that multiple requests share the pixmap
- */
-
-#define pixmap_width 2
-#define pixmap_height 2
-
- /* see if we already have a pixmap suitable for this screen */
- for (cachePtr = pixmapCache; cachePtr; cachePtr = cachePtr->next) {
- if (cachePtr->screen == screen && cachePtr->foreground == fore &&
- cachePtr->background == back && cachePtr->depth == depth)
- return( cachePtr->ref_count++, cachePtr->pixmap );
- }
-
- stippled_pixmap = XCreatePixmapFromBitmapData (display,
- RootWindowOfScreen(screen), (char *)pixmap_bits,
- pixmap_width, pixmap_height, fore, back, depth);
-
- /* and insert it at the head of the cache */
- cachePtr = XtNew(CacheEntry);
- cachePtr->screen = screen;
- cachePtr->foreground = fore;
- cachePtr->background = back;
- cachePtr->depth = depth;
- cachePtr->pixmap = stippled_pixmap;
- cachePtr->ref_count = 1;
- cachePtr->next = pixmapCache;
- pixmapCache = cachePtr;
-
- return( stippled_pixmap );
-}
-
-void
-XmuReleaseStippledPixmap(Screen *screen, Pixmap pixmap)
-{
- register Display *display = DisplayOfScreen(screen);
- CacheEntry *cachePtr, **prevP;
- for (prevP = &pixmapCache, cachePtr = pixmapCache; cachePtr;) {
- if (cachePtr->screen == screen && cachePtr->pixmap == pixmap) {
- if (--cachePtr->ref_count == 0) {
- XFreePixmap( display, pixmap );
- *prevP = cachePtr->next;
- XtFree( (char*)cachePtr );
- break;
- }
- }
- prevP = &cachePtr->next;
- cachePtr = *prevP;
- }
-}
diff --git a/xc/lib/Xmu/Imakefile b/xc/lib/Xmu/Imakefile
deleted file mode 100644
index af1d83bb6..000000000
--- a/xc/lib/Xmu/Imakefile
+++ /dev/null
@@ -1,172 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/82 1996/09/28 16:43:59 rws $
-XCOMM $XFree86: xc/lib/Xmu/Imakefile,v 1.7 1999/04/28 15:04:50 dawes Exp $
-
-#define DoNormalLib NormalLibXmu
-#define DoSharedLib SharedLibXmu
-#define DoExtraLib SharedLibXmu
-#define DoDebugLib DebugLibXmu
-#define DoProfileLib ProfileLibXmu
-#define HasSharedData YES
-#define LibName Xmu
-#define SoRev SOXMUREV
-#define IncSubdir X11
-#define IncSubSubdir Xmu
-
-#include <Threads.tmpl>
-
-#ifdef SharedXmuReqs
-REQUIREDLIBS = SharedXmuReqs
-#endif
-
-/* Since people link in Xmu without Xt, we avoid references to string data. */
-#if HasSharedLibraries
- SHAREDCODEDEF = SharedCodeDef -DXTSTRINGDEFINES
-#endif
- LINTLIBS = $(LINTXLIB)
-
-#if HasSnprintf
- MISC_DEFINES = -DHAS_SNPRINTF
-#else
- MISC_INCLUDES = -I$(LIBSRC)/misc
-#endif
-
- DEFINES = $(MISC_DEFINES)
- INCLUDES = $(MISC_INCLUDES)
-
-#ifdef OsNameDefines
-OS_NAME_DEFINES = OsNameDefines
-#endif
- CSSDEFS = $(OS_NAME_DEFINES) $(CONNECTION_FLAGS)
- BITDEFS = -DBITMAPDIR=\"$(INCDIR)/X11/bitmaps\"
-
-HEADERS = \
- Xmu.h \
- Atoms.h \
- CharSet.h \
- CloseHook.h \
- Converters.h \
- CurUtil.h \
- CvtCache.h \
- DisplayQue.h \
- Drawing.h \
- Editres.h \
- EditresP.h \
- Error.h \
- ExtAgent.h \
- Initer.h \
- Lookup.h \
- Misc.h \
- StdSel.h \
- StdCmap.h \
- SysUtil.h \
- WidgetNode.h \
- WinUtil.h \
- Xct.h
-
-
-SRCS = \
- AllCmap.c \
- Atoms.c \
- ClientWin.c \
- Clip.c \
- CloseHook.c \
- CmapAlloc.c \
- CrCmap.c \
- CrPixFBit.c \
- CursorName.c \
- CvtCache.c \
- CvtStdSel.c \
- DefErrMsg.c \
- DelCmap.c \
- DisplayQue.c \
- Distinct.c \
- DrawLogo.c \
- DrRndRect.c \
- EditresCom.c \
- ExtAgent.c \
- FToCback.c \
- GetHost.c \
- GrayPixmap.c \
- Initer.c \
- LocBitmap.c \
- Lookup.c \
- LookupCmap.c \
- Lower.c \
- RdBitF.c \
- ScrOfWin.c \
- ShapeWidg.c \
- StdCmap.c \
- StrToBS.c \
- StrToBmap.c \
- StrToCurs.c \
- StrToGrav.c \
- StrToJust.c \
- StrToLong.c \
- StrToOrnt.c \
- StrToShap.c \
- StrToWidg.c \
- UpdMapHint.c \
- VisCmap.c \
- WidgetNode.c \
- Xct.c \
- sharedlib.c
-
-#if SharedDataSeparation
-UNSHAREDOBJS = sharedlib.o
-#endif
-
-OBJS = \
- AllCmap.o \
- Atoms.o \
- ClientWin.o \
- Clip.o \
- CloseHook.o \
- CmapAlloc.o \
- CrCmap.o \
- CrPixFBit.o \
- CursorName.o \
- CvtCache.o \
- CvtStdSel.o \
- DefErrMsg.o \
- DelCmap.o \
- DisplayQue.o \
- Distinct.o \
- DrawLogo.o \
- DrRndRect.o \
- EditresCom.o \
- ExtAgent.o \
- FToCback.o \
- GetHost.o \
- GrayPixmap.o \
- Initer.o \
- LocBitmap.o \
- Lookup.o \
- LookupCmap.o \
- Lower.o \
- RdBitF.o \
- ScrOfWin.o \
- ShapeWidg.o \
- StdCmap.o \
- StrToBS.o \
- StrToBmap.o \
- StrToCurs.o \
- StrToGrav.o \
- StrToJust.o \
- StrToLong.o \
- StrToOrnt.o \
- StrToShap.o \
- StrToWidg.o \
- UpdMapHint.o \
- VisCmap.o \
- WidgetNode.o \
- Xct.o
-
-#include <Library.tmpl>
-
-SpecialCLibObjectRule(CvtStdSel,$(ICONFIGFILES),$(CSSDEFS))
-SpecialCLibObjectRule(LocBitmap,$(ICONFIGFILES),$(BITDEFS))
-#if DoSharedLib && SharedDataSeparation
-SpecialCObjectRule(sharedlib,$(_NOOP_),$(SHLIBDEF))
-#endif
-
-DependTarget()
diff --git a/xc/lib/Xmu/Initer.c b/xc/lib/Xmu/Initer.c
deleted file mode 100644
index c68070ab2..000000000
--- a/xc/lib/Xmu/Initer.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* $TOG: Initer.c /main/10 1998/02/06 15:44:04 kaleb $ */
-
-/*
-
-Copyright 1988, 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/lib/Xmu/Initer.c,v 1.5 1999/03/21 07:34:37 dawes Exp $ */
-
-/* Created By: Chris D. Peterson
- * MIT X Consortium
- * Date: May 8, 1989
- */
-
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/Initer.h>
-
-struct InitializerList {
- XmuInitializerProc function; /* function to call */
- XPointer data; /* Data to pass the function. */
- XtAppContext * app_con_list; /* a null terminated list of app_contexts. */
-};
-
-/*
- * Prototypes
- */
-static Bool AddToAppconList(XtAppContext**, XtAppContext);
-
-static struct InitializerList * init_list = NULL;
-static Cardinal init_list_length = 0;
-
-void
-XmuAddInitializer(XmuInitializerProc func, XPointer data)
-{
- init_list_length++;
- init_list = (struct InitializerList *) XtRealloc( (char *) init_list,
- (sizeof(struct InitializerList) *
- init_list_length) );
-
- init_list[init_list_length - 1].function = func;
- init_list[init_list_length - 1].data = data;
- init_list[init_list_length - 1].app_con_list = NULL;
-}
-
-void
-XmuCallInitializers(XtAppContext app_con)
-{
- unsigned i;
-
- for (i = 0 ; i < init_list_length ; i++) {
- if (AddToAppconList(&(init_list[i].app_con_list), app_con))
- (init_list[i].function) (app_con, init_list[i].data);
- }
-}
-
-/*
- * Function:
- * AddToAppconList
- *
- * Parameters:
- * app_list - NULL terminated list of application contexts
- * app_con - application context to test
- *
- * Description:
- * Adds an action to the application context list and
- * returns True, if this app_con is already on the list then
- * it is NOT added and False is returned.
- *
- * Returns:
- * True if not found, False if found
- */
-static Bool
-AddToAppconList(XtAppContext **app_list, XtAppContext app_con)
-{
- int i;
- XtAppContext *local_list;
-
- i = 0;
- local_list = *app_list;
- if (*app_list != NULL) {
- for ( ; *local_list != NULL ; i++, local_list++) {
- if (*local_list == app_con)
- return (False);
- }
- }
-
- *app_list = (XtAppContext *) XtRealloc((char *)(*app_list),
- sizeof(XtAppContext *) * (i + 2) );
- (*app_list)[i++] = app_con;
- (*app_list)[i] = NULL;
-
- return (True);
-}
-
diff --git a/xc/lib/Xmu/Initer.h b/xc/lib/Xmu/Initer.h
deleted file mode 100644
index a7d521228..000000000
--- a/xc/lib/Xmu/Initer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $TOG: Initer.h /main/7 1998/02/06 15:44:09 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Initer.h,v 1.4 1998/10/03 09:06:30 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_INITER_H_
-#define _XMU_INITER_H_
-
-#include <X11/Xfuncproto.h>
-
-typedef void (*XmuInitializerProc)(XtAppContext app_context, XPointer data);
-
-_XFUNCPROTOBEGIN
-
-void XmuCallInitializers
-(
- XtAppContext app_context
- );
-
-void XmuAddInitializer
-(
- XmuInitializerProc func,
- XPointer data
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_INITER_H_ */
diff --git a/xc/lib/Xmu/LocBitmap.c b/xc/lib/Xmu/LocBitmap.c
deleted file mode 100644
index ee040bb3d..000000000
--- a/xc/lib/Xmu/LocBitmap.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $TOG: LocBitmap.c /main/22 1998/06/24 10:18: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/LocBitmap.c,v 3.5 1998/10/03 09:06:31 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-#include <X11/Xlib.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#include <string.h>
-#endif
-#include <X11/Xresource.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/CvtCache.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xmu/SysUtil.h>
-
-#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 */
-
-/*
- * Prototypes
- */
-static char **split_path_string(char*);
-
-/*
- * XmuLocateBitmapFile - read a bitmap file using the normal defaults
- */
-
-Pixmap
-XmuLocateBitmapFile(Screen *screen, _Xconst char *name, char *srcname,
- int srcnamelen, int *widthp, int *heightp,
- int *xhotp, int *yhotp)
-{
- return XmuLocatePixmapFile (screen, name,
- (unsigned long) 1, (unsigned long) 0,
- (unsigned int) 1, srcname, srcnamelen,
- widthp, heightp, xhotp, yhotp);
-}
-
-
-/*
- * version that reads pixmap data as well as bitmap data
- */
-Pixmap
-XmuLocatePixmapFile(Screen *screen, _Xconst char *name,
- unsigned long fore, unsigned long back,
- unsigned int depth,
- char *srcname, int srcnamelen,
- int *widthp, int *heightp, int *xhotp, int *yhotp)
-{
-
-#ifndef BITMAPDIR
-#define BITMAPDIR "/usr/include/X11/bitmaps"
-#endif
-
- Display *dpy = DisplayOfScreen (screen);
- Window root = RootWindowOfScreen (screen);
- Bool try_plain_name = True;
- XmuCvtCache *cache = _XmuCCLookupDisplay (dpy);
- char **file_paths = (char **) NULL;
- char filename[PATH_MAX];
- char* bitmapdir = BITMAPDIR;
- unsigned int width, height;
- int xhot, yhot;
- int i;
-
- /*
- * look in cache for bitmap path
- */
- if (cache) {
- if (!cache->string_to_bitmap.bitmapFilePath) {
- XrmName xrm_name[2];
- XrmClass xrm_class[2];
- XrmRepresentation rep_type;
- XrmValue value;
-
- xrm_name[0] = XrmPermStringToQuark ("bitmapFilePath");
- xrm_name[1] = NULLQUARK;
- xrm_class[0] = XrmPermStringToQuark ("BitmapFilePath");
- xrm_class[1] = NULLQUARK;
- if (!XrmGetDatabase(dpy)) {
- /* what a hack; need to initialize it */
- (void) XGetDefault (dpy, "", "");
- }
- if (XrmQGetResource (XrmGetDatabase(dpy), xrm_name, xrm_class,
- &rep_type, &value) &&
- rep_type == XrmPermStringToQuark("String")) {
- cache->string_to_bitmap.bitmapFilePath =
- split_path_string (value.addr);
- }
- }
- file_paths = cache->string_to_bitmap.bitmapFilePath;
- }
-
- /*
- * Search order:
- * 1. name if it begins with / or ./
- * 2. "each prefix in file_paths"/name
- * 3. BITMAPDIR/name
- * 4. name if didn't begin with / or .
- */
-
- for (i = 1; i <= 4; i++) {
- char *fn = filename;
- Pixmap pixmap;
- unsigned char *data;
-
- switch (i) {
- case 1:
-#ifndef __EMX__
- if (!(name[0] == '/' || ((name[0] == '.') && name[1] == '/')))
-#else
- if (!(name[0] == '/' || (name[0] == '.' && name[1] == '/') ||
- (isalpha(name[0]) && name[1] == ':')))
-#endif
- continue;
- fn = (char *) name;
- try_plain_name = False;
- break;
- case 2:
- if (file_paths && *file_paths) {
- XmuSnprintf(filename, sizeof(filename),
- "%s/%s", *file_paths, name);
- file_paths++;
- i--;
- break;
- }
- continue;
- case 3:
- XmuSnprintf(filename, sizeof(filename), "%s/%s", BITMAPDIR, name);
- break;
- case 4:
- if (!try_plain_name) continue;
- fn = (char *) name;
- break;
- }
-
- data = NULL;
- pixmap = None;
-#ifdef __EMX__
- fn = (char*)__XOS2RedirRoot(fn);
-#endif
- if (XmuReadBitmapDataFromFile (fn, &width, &height, &data,
- &xhot, &yhot) == BitmapSuccess) {
- pixmap = XCreatePixmapFromBitmapData (dpy, root, (char *) data,
- width, height,
- fore, back, depth);
- XFree ((char *)data);
- }
-
- if (pixmap) {
- if (widthp) *widthp = (int)width;
- if (heightp) *heightp = (int)height;
- if (xhotp) *xhotp = xhot;
- if (yhotp) *yhotp = yhot;
- if (srcname && srcnamelen > 0) {
- strncpy (srcname, fn, srcnamelen - 1);
- srcname[srcnamelen - 1] = '\0';
- }
- return pixmap;
- }
- }
-
- return None;
-}
-
-
-/*
- * split_path_string - split a colon-separated list into its constituent
- * parts; to release, free list[0] and list.
- */
-static char **
-split_path_string(register char *src)
-{
- int nelems = 1;
- register char *dst;
- char **elemlist, **elem;
-
- /* count the number of elements */
- for (dst = src; *dst; dst++) if (*dst == ':') nelems++;
-
- /* get memory for everything */
- dst = (char *) malloc (dst - src + 1);
- if (!dst) return NULL;
- elemlist = (char **) calloc ((nelems + 1), sizeof (char *));
- if (!elemlist) {
- free (dst);
- return NULL;
- }
-
- /* copy to new list and walk up nulling colons and setting list pointers */
- strcpy (dst, src);
- for (elem = elemlist, src = dst; *src; src++) {
- if (*src == ':') {
- *elem++ = dst;
- *src = '\0';
- dst = src + 1;
- }
- }
- *elem = dst;
-
- return elemlist;
-}
-
-
-void
-_XmuStringToBitmapInitCache(register XmuCvtCache *c)
-{
- c->string_to_bitmap.bitmapFilePath = NULL;
-}
-
-void
-_XmuStringToBitmapFreeCache(register XmuCvtCache *c)
-{
- if (c->string_to_bitmap.bitmapFilePath) {
- if (c->string_to_bitmap.bitmapFilePath[0])
- free (c->string_to_bitmap.bitmapFilePath[0]);
- free ((char *) (c->string_to_bitmap.bitmapFilePath));
- }
-}
diff --git a/xc/lib/Xmu/Lookup.c b/xc/lib/Xmu/Lookup.c
deleted file mode 100644
index a20e848d5..000000000
--- a/xc/lib/Xmu/Lookup.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* $TOG: Lookup.c /main/17 1998/02/06 15:44:26 kaleb $ */
-
-/*
-
-Copyright 1988, 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/lib/Xmu/Lookup.c,v 3.6 1999/03/21 07:34:37 dawes Exp $ */
-
-#include <X11/Xmu/Lookup.h>
-
-#define XK_LATIN1
-#define XK_PUBLISHING
-#include <X11/keysymdef.h>
-
-/* bit (1<<i) means character is in codeset i */
-static unsigned short _Xconst latin1[128] =
- {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x10ee, 0x0000, 0x1000, 0x1084, 0x102e, 0x1000, 0x1080, 0x108e, /* 10 */
- 0x108e, 0x1080, 0x0000, 0x1080, 0x1080, 0x10ee, 0x1000, 0x1008,
- 0x108e, 0x1080, 0x1084, 0x1084, 0x108e, 0x1004, 0x1000, 0x1084, /* 11 */
- 0x100e, 0x1000, 0x0000, 0x1080, 0x1000, 0x1084, 0x1000, 0x0000,
- 0x0004, 0x000e, 0x000e, 0x0008, 0x000e, 0x0008, 0x0008, 0x0006, /* 12 */
- 0x0004, 0x000e, 0x0004, 0x000e, 0x0004, 0x000e, 0x000e, 0x0004,
- 0x0000, 0x0004, 0x0004, 0x0006, 0x000e, 0x0008, 0x000e, 0x000e, /* 13 */
- 0x0008, 0x0004, 0x000e, 0x000c, 0x000e, 0x0002, 0x0000, 0x000e,
- 0x0004, 0x000e, 0x000e, 0x0008, 0x000e, 0x0008, 0x0008, 0x0006, /* 14 */
- 0x0004, 0x000e, 0x0004, 0x000e, 0x0004, 0x000e, 0x000e, 0x0004,
- 0x0000, 0x0004, 0x0004, 0x0006, 0x000e, 0x0008, 0x000e, 0x000e, /* 15 */
- 0x0008, 0x0004, 0x000e, 0x000c, 0x000e, 0x0002, 0x0000, 0x0000};
-
-/* bit (1<<i) means character is in codeset i */
-static unsigned short _Xconst latin2[128] =
- {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0008, 0x0004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 10 */
- 0x0000, 0x0008, 0x0004, 0x0000, 0x0000, 0x0000, 0x0008, 0x0004,
- 0x0000, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, /* 11 */
- 0x0000, 0x0008, 0x0004, 0x0000, 0x0000, 0x0000, 0x0008, 0x0004,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 12 */
- 0x0008, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 13 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 14 */
- 0x0008, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 15 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x000c};
-
-/* maps Cyrillic keysyms to 8859-5 */
-static unsigned char _Xconst cyrillic[128] =
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xf2, 0xf3, 0xf1, 0xf4, 0xf5, 0xf6, 0xf7, /* 10 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff,
- 0xf0, 0xa2, 0xa3, 0xa1, 0xa4, 0xa5, 0xa6, 0xa7, /* 11 */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf,
- 0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3, /* 12 */
- 0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
- 0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2, /* 13 */
- 0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
- 0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3, /* 14 */
- 0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
- 0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2, /* 15 */
- 0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca};
-
-/* maps Greek keysyms to 8859-7 */
-static unsigned char _Xconst greek[128] =
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xb6, 0xb8, 0xb9, 0xba, 0xda, 0x00, 0xbc, /* 10 */
- 0xbe, 0xdb, 0x00, 0xbf, 0x00, 0x00, 0xb5, 0xaf,
- 0x00, 0xdc, 0xdd, 0xde, 0xdf, 0xfa, 0xc0, 0xfc, /* 11 */
- 0xfd, 0xfb, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 12 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd3, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 13 */
- 0xd8, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 14 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf3, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7, /* 15 */
- 0xf8, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-
-#define sLatin1 (unsigned long)0
-#define sLatin2 (unsigned long)1
-#define sLatin3 (unsigned long)2
-#define sLatin4 (unsigned long)3
-#define sKana (unsigned long)4
-#define sX0201 (unsigned long)0x01000004
-#define sArabic (unsigned long)5
-#define sCyrillic (unsigned long)6
-#define sGreek (unsigned long)7
-#define sAPL (unsigned long)11
-#define sHebrew (unsigned long)12
-
-int
-XmuLookupString(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status,
- unsigned long keysymSet)
-{
- int count;
- KeySym symbol;
- unsigned long kset;
-
- kset = keysymSet & 0xffffff;
- count = XLookupString(event, (char *)buffer, nbytes, &symbol, status);
- if (keysym) *keysym = symbol;
- if ((nbytes == 0) || (symbol == NoSymbol)) {
- /* nothing */
- } else if ((count == 0) && ((symbol >> 8) == kset)) {
- count = 1;
- switch (keysymSet) {
- case sKana:
- buffer[0] = (symbol & 0xff);
- if (buffer[0] == 0x7e)
- count = 0;
- break;
- case sCyrillic:
- buffer[0] = cyrillic[symbol & 0x7f];
- break;
- case sGreek:
- buffer[0] = greek[symbol & 0x7f];
- if (!buffer[0])
- count = 0;
- break;
- default:
- buffer[0] = (symbol & 0xff);
- break;
- }
- } else if ((keysymSet != 0) && (count == 1) &&
- (((unsigned char *)buffer)[0] == symbol) &&
- (symbol & 0x80) &&
- !(latin1[symbol & 0x7f] & (1 << kset))) {
- if ((keysymSet == sHebrew) && (symbol == XK_multiply))
- buffer[0] = 0xaa;
- else if ((keysymSet == sHebrew) && (symbol == XK_division))
- buffer[0] = 0xba;
- else if ((keysymSet == sCyrillic) && (symbol == XK_section))
- buffer[0] = 0xfd;
- else if ((keysymSet == sX0201) && (symbol == XK_yen))
- buffer[0] = 0x5c;
- else
- count = 0;
- } else if (count != 0) {
- if ((keysymSet == sX0201) &&
- ((symbol == XK_backslash) || (symbol == XK_asciitilde)))
- count = 0;
- } else if (((symbol >> 8) == sLatin2) &&
- (symbol & 0x80) && (latin2[symbol & 0x7f] & (1 << kset))) {
- buffer[0] = (symbol & 0xff);
- count = 1;
- } else if ((keysymSet == sGreek) &&
- ((symbol == XK_leftsinglequotemark) ||
- (symbol == XK_rightsinglequotemark))) {
- buffer[0] = symbol - (XK_leftsinglequotemark - 0xa1);
- count = 1;
- }
- return count;
-}
-
-/* produces ISO 8859-1 encoding plus ASCII control */
-int
-XmuLookupLatin1(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XLookupString(event, (char *)buffer, nbytes, keysym, status);
-}
-
-/* produces ISO 8859-2 encoding plus ASCII control */
-int
-XmuLookupLatin2(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin2);
-}
-
-/* produces ISO 8859-3 encoding plus ASCII control */
-int
-XmuLookupLatin3(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin3);
-}
-
-/* produces ISO 8859-4 encoding plus ASCII control */
-int
-XmuLookupLatin4(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sLatin4);
-}
-
-/* produces ISO 8859-1 GL plus Katakana plus ASCII control */
-int
-XmuLookupKana(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sKana);
-}
-
-/* produces JIS X0201-1976 (8-bit) */
-int
-XmuLookupJISX0201(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sX0201);
-}
-
-/* produces ISO 8859-6 encoding plus ASCII control */
-int
-XmuLookupArabic(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sArabic);
-}
-
-/* produces ISO/IEC 8859-5 encoding plus ASCII control */
-int
-XmuLookupCyrillic(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sCyrillic);
-}
-
-/* produces ISO 8859-7 encoding plus ASCII control */
-int
-XmuLookupGreek(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sGreek);
-}
-
-/* XXX this character set needs work */
-
-int
-XmuLookupAPL(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sAPL);
-}
-
-/* produces ISO 8859-8 encoding plus ASCII control */
-int
-XmuLookupHebrew(register XKeyEvent *event, unsigned char *buffer, int nbytes,
- KeySym *keysym, XComposeStatus *status)
-{
- return XmuLookupString(event, buffer, nbytes, keysym, status, sHebrew);
-}
diff --git a/xc/lib/Xmu/Lookup.h b/xc/lib/Xmu/Lookup.h
deleted file mode 100644
index 88ca4d40d..000000000
--- a/xc/lib/Xmu/Lookup.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * $XFree86: xc/lib/Xmu/Lookup.h,v 1.1 1999/03/21 07:34:38 dawes Exp $
- */
-
-/************************************************************
-
-Copyright 1999 by Thomas E. Dickey <dickey@clark.net>
-
- 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 ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name(s) of the above 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.
-
-********************************************************/
-
-#ifndef included_xmu_lookup_h
-#define included_xmu_lookup_h 1
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-extern int XmuLookupString(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status,
- unsigned long keysymSet);
-
-extern int XmuLookupLatin1(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupLatin2(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupLatin3(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupLatin4(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupKana(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupJISX0201(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupArabic(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupCyrillic(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupGreek(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupAPL(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-extern int XmuLookupHebrew(
- XKeyEvent *event,
- unsigned char *buffer,
- int nbytes,
- KeySym *keysym,
- XComposeStatus *status);
-
-#endif /* included_xmu_lookup_h */
diff --git a/xc/lib/Xmu/LookupCmap.c b/xc/lib/Xmu/LookupCmap.c
deleted file mode 100644
index ccdfc3937..000000000
--- a/xc/lib/Xmu/LookupCmap.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* $TOG: LookupCmap.c /main/11 1998/02/06 15:44: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/LookupCmap.c,v 1.5 1998/10/03 09:06:31 dawes Exp $ */
-
-/*
- * Author: Donna Converse, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern char *malloc();
-#endif
-
-/*
- * Prototypes
- */
-static Status lookup(Display*, int, VisualID, Atom, XStandardColormap*, Bool);
-
-/*
- * To create a standard colormap if one does not currently exist, or
- * replace the currently existing standard colormap, use
- * XmuLookupStandardColormap().
- *
- * Given a screen, a visual, and a property, XmuLookupStandardColormap()
- * will determine the best allocation for the property under the specified
- * visual, and determine the whether to create a new colormap or to use
- * the default colormap of the screen. It will call XmuStandardColormap()
- * to create the standard colormap.
- *
- * If replace is true, any previous definition of the property will be
- * replaced. If retain is true, the property and the colormap will be
- * made permanent for the duration of the server session. However,
- * pre-existing property definitions which are not replaced cannot be made
- * permanent by a call to XmuLookupStandardColormap(); a request to retain
- * resources pertains to newly created resources.
- *
- * Returns 0 on failure, non-zero on success. A request to create a
- * standard colormap upon a visual which cannot support such a map is
- * considered a failure. An example of this would be requesting any
- * standard colormap property on a monochrome visual, or, requesting an
- * RGB_BEST_MAP on a display whose colormap size is 16.
- */
-
-Status
-XmuLookupStandardColormap(Display *dpy, int screen, VisualID visualid,
- unsigned int depth, Atom property,
- Bool replace, Bool retain)
- /*
- * dpy - specifies X server connection
- * screen - specifies screen of display
- * visualid - specifies the visual type
- * depth - specifies the visual type
- * property - a standard colormap property
- * replace - specifies whether to replace
- * retain - specifies whether to retain
- */
-{
- Display *odpy; /* original display connection */
- XStandardColormap *colormap;
- XVisualInfo vinfo_template, *vinfo; /* visual */
- long vinfo_mask;
- unsigned long r_max, g_max, b_max; /* allocation */
- int count;
- Colormap cmap; /* colormap ID */
- Status status = 0;
-
-
- /* Match the requested visual */
-
- vinfo_template.visualid = visualid;
- vinfo_template.screen = screen;
- vinfo_template.depth = depth;
- vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
- if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &count)) ==
- NULL)
- return 0;
-
- /* Monochrome visuals have no standard maps */
-
- if (vinfo->colormap_size <= 2) {
- XFree((char *) vinfo);
- return 0;
- }
-
- /* If the requested property already exists on this screen, and,
- * if the replace flag has not been set to true, return success.
- * lookup() will remove a pre-existing map if replace is true.
- */
-
- if (lookup(dpy, screen, visualid, property, (XStandardColormap *) NULL,
- replace) && !replace) {
- XFree((char *) vinfo);
- return 1;
- }
-
- /* Determine the best allocation for this property under the requested
- * visualid and depth, and determine whether or not to use the default
- * colormap of the screen.
- */
-
- if (!XmuGetColormapAllocation(vinfo, property, &r_max, &g_max, &b_max)) {
- XFree((char *) vinfo);
- return 0;
- }
-
- cmap = (property == XA_RGB_DEFAULT_MAP &&
- visualid == XVisualIDFromVisual(DefaultVisual(dpy, screen)))
- ? DefaultColormap(dpy, screen) : None;
-
- /* If retaining resources, open a new connection to the same server */
-
- if (retain) {
- odpy = dpy;
- if ((dpy = XOpenDisplay(XDisplayString(odpy))) == NULL) {
- XFree((char *) vinfo);
- return 0;
- }
- }
-
- /* Create the standard colormap */
-
- colormap = XmuStandardColormap(dpy, screen, visualid, depth, property,
- cmap, r_max, g_max, b_max);
-
- /* Set the standard colormap property */
-
- if (colormap) {
- XGrabServer(dpy);
-
- if (lookup(dpy, screen, visualid, property, colormap, replace) &&
- !replace) {
- /* Someone has defined the property since we last looked.
- * Since we will not replace it, release our own resources.
- * If this is the default map, our allocations will be freed
- * when this connection closes.
- */
- if (colormap->killid == ReleaseByFreeingColormap)
- XFreeColormap(dpy, colormap->colormap);
- }
- else if (retain) {
- XSetCloseDownMode(dpy, RetainPermanent);
- }
- XUngrabServer(dpy);
- XFree((char *) colormap);
- status = 1;
- }
-
- if (retain)
- XCloseDisplay(dpy);
- XFree((char *) vinfo);
- return status;
-}
-
-/***************************************************************************/
-
-/* Lookup a standard colormap property. If the property is RGB_DEFAULT_MAP,
- * the visualid is used to determine whether the indicated standard colormap
- * exists. If the map exists and replace is true, delete the resources used
- * by the map and remove the property. Return true if the map exists,
- * or did exist and was deleted; return false if the map was not found.
- *
- * Note that this is not the way that a Status return is normally used.
- *
- * If new is not NULL, new points to an XStandardColormap structure which
- * describes a standard colormap of the specified property. It will be made
- * a standard colormap of the screen if none already exists, or if replace
- * is true.
- */
-
-static Status
-lookup(Display *dpy, int screen, VisualID visualid, Atom property,
- XStandardColormap *cnew, Bool replace)
- /*
- * dpy - specifies display connection
- * screen - specifies screen number
- * visualid - specifies visualid for std map
- * property - specifies colormap property name
- * cnew - specifies a standard colormap
- * replace - specifies whether to replace
- */
-{
- register int i;
- int count;
- XStandardColormap *stdcmaps, *s;
- Window win = RootWindow(dpy, screen);
-
- /* The property does not already exist */
-
- if (! XGetRGBColormaps(dpy, win, &stdcmaps, &count, property)) {
- if (cnew)
- XSetRGBColormaps(dpy, win, cnew, 1, property);
- return 0;
- }
-
- /* The property exists and is not describing the RGB_DEFAULT_MAP */
-
- if (property != XA_RGB_DEFAULT_MAP) {
- if (replace) {
- XmuDeleteStandardColormap(dpy, screen, property);
- if (cnew)
- XSetRGBColormaps(dpy, win, cnew, 1, property);
- }
- XFree((char *)stdcmaps);
- return 1;
- }
-
- /* The property exists and is RGB_DEFAULT_MAP */
-
- for (i=0, s=stdcmaps; (i < count) && (s->visualid != visualid); i++, s++)
- ;
-
- /* No RGB_DEFAULT_MAP property matches the given visualid */
-
- if (i == count) {
- if (cnew) {
- XStandardColormap *m, *maps;
-
- s = (XStandardColormap *) malloc((unsigned) ((count+1) * sizeof
- (XStandardColormap)));
-
- for (i = 0, m = s, maps = stdcmaps; i < count; i++, m++, maps++) {
- m->colormap = maps->colormap;
- m->red_max = maps->red_max;
- m->red_mult = maps->red_mult;
- m->green_max = maps->green_max;
- m->green_mult = maps->green_mult;
- m->blue_max = maps->blue_max;
- m->blue_mult = maps->blue_mult;
- m->base_pixel = maps->base_pixel;
- m->visualid = maps->visualid;
- m->killid = maps->killid;
- }
- m->colormap = cnew->colormap;
- m->red_max = cnew->red_max;
- m->red_mult = cnew->red_mult;
- m->green_max = cnew->green_max;
- m->green_mult = cnew->green_mult;
- m->blue_max = cnew->blue_max;
- m->blue_mult = cnew->blue_mult;
- m->base_pixel = cnew->base_pixel;
- m->visualid = cnew->visualid;
- m->killid = cnew->killid;
-
- XSetRGBColormaps(dpy, win, s, ++count, property);
- free((char *) s);
- }
- XFree((char *) stdcmaps);
- return 0;
- }
-
- /* Found an RGB_DEFAULT_MAP property with a matching visualid */
-
- if (replace) {
- /* Free old resources first - we may need them, particularly in
- * the default colormap of the screen. However, because of this,
- * it is possible that we will destroy the old resource and fail
- * to create a new one if XmuStandardColormap() fails.
- */
-
- if (count == 1) {
- XmuDeleteStandardColormap(dpy, screen, property);
- if (cnew)
- XSetRGBColormaps(dpy, win, cnew, 1, property);
- }
- else {
- XStandardColormap *map;
-
- /* s still points to the matching standard colormap */
-
- if (s->killid == ReleaseByFreeingColormap) {
- if ((s->colormap != None) &&
- (s->colormap != DefaultColormap(dpy, screen)))
- XFreeColormap(dpy, s->colormap);
- }
- else if (s->killid != None)
- XKillClient(dpy, s->killid);
-
- map = (cnew) ? cnew : stdcmaps + --count;
-
- s->colormap = map->colormap;
- s->red_max = map->red_max;
- s->red_mult = map->red_mult;
- s->green_max = map->green_max;
- s->green_mult = map->green_mult;
- s->blue_max = map->blue_max;
- s->blue_mult = map->blue_mult;
- s->visualid = map->visualid;
- s->killid = map->killid;
-
- XSetRGBColormaps(dpy, win, stdcmaps, count, property);
- }
- }
- XFree((char *) stdcmaps);
- return 1;
-}
diff --git a/xc/lib/Xmu/Lower.c b/xc/lib/Xmu/Lower.c
deleted file mode 100644
index 50cf73ef0..000000000
--- a/xc/lib/Xmu/Lower.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $TOG: Lower.c /main/9 1998/02/06 15:44:31 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.
-
-*/
-
-/* $XFree86: xc/lib/Xmu/Lower.c,v 1.9 1999/07/11 08:49:17 dawes Exp $ */
-
-#define XK_LATIN1
-#include <X11/keysymdef.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/SysUtil.h>
-
-#include <stdio.h>
-
-#ifndef HAS_SNPRINTF
-#undef SCOPE
-#define SCOPE static
-#include "snprintf.c"
-#endif
-
-#if NeedVarargsPrototypes
-#include <stdarg.h>
-#define Va_start(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define Va_start(a,b) va_start(a)
-#endif
-
-/*
- * ISO Latin-1 case conversion routine
- */
-#define XmuTolower(c) \
-((c) >= XK_a && (c) <= XK_z ? \
- (c) : (c) >= XK_A && (c) <= XK_Z ? \
- (c) + (XK_a - XK_A) : (c) >= XK_Agrave && (c) <= XK_Odiaeresis ? \
- (c) + (XK_agrave - XK_Agrave) : (c) >= XK_Ooblique && (c) <= XK_Thorn ? \
- (c) + (XK_oslash - XK_Ooblique) : \
- (c))
-
-#define XmuToupper(c) \
-((c) >= XK_A && (c) <= XK_Z ? \
- (c) : (c) >= XK_a && (c) <= XK_z ? \
- (c) - (XK_a - XK_A) : (c) >= XK_agrave && (c) <= XK_odiaeresis ? \
- (c) - (XK_agrave - XK_Agrave) : (c) >= XK_oslash && (c) <= XK_thorn ? \
- (c) - (XK_oslash - XK_Ooblique) : \
- (c))
-
-/*
- * Implementation
- */
-void
-XmuCopyISOLatin1Lowered(char *dst, _Xconst char *src)
-{
- register unsigned char *dest, *source;
-
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
- *source;
- source++, dest++)
- *dest = XmuTolower(*source);
- *dest = '\0';
-}
-
-void
-XmuCopyISOLatin1Uppered(char *dst, _Xconst char *src)
-{
- register unsigned char *dest, *source;
-
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
- *source;
- source++, dest++)
- *dest = XmuToupper(*source);
- *dest = '\0';
-}
-
-int
-XmuCompareISOLatin1(_Xconst char *first, _Xconst char *second)
-{
- register unsigned char *ap, *bp;
-
- for (ap = (unsigned char *)first, bp = (unsigned char *)second;
- *ap && *bp && XmuTolower(*ap) == XmuTolower(*bp);
- ap++, bp++)
- ;
-
- return ((int)XmuTolower(*ap) - (int)XmuTolower(*bp));
-}
-
-void
-XmuNCopyISOLatin1Lowered(char *dst, _Xconst char *src, register int size)
-{
- register unsigned char *dest, *source;
-
- if (size > 0)
- {
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
- *source && size > 1;
- source++, dest++, size--)
- *dest = XmuTolower(*source);
- *dest = '\0';
- }
-}
-
-void
-XmuNCopyISOLatin1Uppered(char *dst, _Xconst char *src, register int size)
-{
- register unsigned char *dest, *source;
-
- if (size > 0)
- {
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
- *source && size > 1;
- source++, dest++, size--)
- *dest = XmuToupper(*source);
- *dest = '\0';
- }
-}
-
-int
-XmuSnprintf(char *str, int size, _Xconst char *fmt, ...)
-{
- va_list ap;
- int retval;
-
- if (size <= 0)
- return (size);
-
- Va_start(ap, fmt);
-
-#if 0
- retval = vsprintf(str, fmt, ap);
- if (retval >= size)
- {
- fprintf(stderr, "WARNING: buffer overflow detected!\n");
- fflush(stderr);
- abort();
- }
-#else
- retval = vsnprintf(str, size, fmt, ap);
-#endif
-
- va_end(ap);
-
- return (retval);
-}
diff --git a/xc/lib/Xmu/Misc.h b/xc/lib/Xmu/Misc.h
deleted file mode 100644
index 1a0ad5b6b..000000000
--- a/xc/lib/Xmu/Misc.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $TOG: Misc.h /main/3 1998/02/06 15:44:36 kaleb $ */
-
-/*
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-/* Various useful constant and macro definitions */
-
-#ifndef _Xmu_Misc_h
-#define _Xmu_Misc_h
-
-#define MAXDIMENSION ((1 << 31)-1)
-
-#define Max(x, y) (((x) > (y)) ? (x) : (y))
-#define Min(x, y) (((x) < (y)) ? (x) : (y))
-#define AssignMax(x, y) {if ((y) > (x)) x = (y);}
-#define AssignMin(x, y) {if ((y) < (x)) x = (y);}
-
-#endif /*_Xmu_Misc_h*/
diff --git a/xc/lib/Xmu/README b/xc/lib/Xmu/README
deleted file mode 100644
index d618e2a71..000000000
--- a/xc/lib/Xmu/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This library contains miscellaneous utilities and is not part of the Xlib
-standard. It contains routines which only use public interfaces so that it
-may be layered on top of any proprietary implementation of Xlib or Xt.
-
-It is intended to support clients in the MIT distribution; vendors
-may choose not to distribute this library if they wish. Therefore,
-applications developers who depend on this library should be prepared to
-treat it as part of their software base when porting.
diff --git a/xc/lib/Xmu/RdBitF.c b/xc/lib/Xmu/RdBitF.c
deleted file mode 100644
index 9c969f0bc..000000000
--- a/xc/lib/Xmu/RdBitF.c
+++ /dev/null
@@ -1,394 +0,0 @@
-/* $TOG: RdBitF.c /main/13 1998/02/06 15:44:42 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/RdBitF.c,v 3.10 1999/01/31 12:21:20 dawes Exp $ */
-
-/*
- * This file contains miscellaneous utility routines and is not part of the
- * Xlib standard.
- *
- * Public entry points:
- *
- * XmuReadBitmapData read data from FILE descriptor
- * XmuReadBitmapDataFromFile read X10 or X11 format bitmap files
- * and return data
- *
- * Note that this file and ../X/XRdBitF.c look very similar.... Keep them
- * that way (but don't use common source code so that people can have one
- * without the other).
- */
-
-
-/*
- * Based on an optimized version provided by Jim Becker, Auguest 5, 1988.
- */
-
-#include <X11/Xos.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xlibint.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/Xmu/Drawing.h>
-
-#define MAX_SIZE 255
-
-/*
- * Prototypes
- */
-static void initHexTable(void);
-static int NextInt(FILE*);
-
-/* shared data for the image read/parse logic */
-static short hexTable[256]; /* conversion value */
-static Bool initialized = False; /* easier to fill in at run time */
-
-
-/*
- * Table index for the hex values. Initialized once, first time.
- * Used for translation value or delimiter significance lookup.
- */
-static void
-initHexTable(void)
-{
- /*
- * We build the table at run time for several reasons:
- *
- * 1. portable to non-ASCII machines.
- * 2. still reentrant since we set the init flag after setting table.
- * 3. easier to extend.
- * 4. less prone to bugs.
- */
- hexTable['0'] = 0; hexTable['1'] = 1;
- hexTable['2'] = 2; hexTable['3'] = 3;
- hexTable['4'] = 4; hexTable['5'] = 5;
- hexTable['6'] = 6; hexTable['7'] = 7;
- hexTable['8'] = 8; hexTable['9'] = 9;
- hexTable['A'] = 10; hexTable['B'] = 11;
- hexTable['C'] = 12; hexTable['D'] = 13;
- hexTable['E'] = 14; hexTable['F'] = 15;
- hexTable['a'] = 10; hexTable['b'] = 11;
- hexTable['c'] = 12; hexTable['d'] = 13;
- hexTable['e'] = 14; hexTable['f'] = 15;
-
- /* delimiters of significance are flagged w/ negative value */
- hexTable[' '] = -1; hexTable[','] = -1;
- hexTable['}'] = -1; hexTable['\n'] = -1;
- hexTable['\t'] = -1;
-
- initialized = True;
-}
-
-/*
- * read next hex value in the input stream, return -1 if EOF
- */
-static int
-NextInt(FILE *fstream)
-{
- int ch;
- int value = 0;
- int gotone = 0;
- int done = 0;
-
- /* loop, accumulate hex value until find delimiter */
- /* skip any initial delimiters found in read stream */
-
- while (!done) {
- ch = getc(fstream);
- if (ch == EOF) {
- value = -1;
- done++;
- } else {
- /* trim high bits, check type and accumulate */
- ch &= 0xff;
- if (isascii(ch) && isxdigit(ch)) {
- value = (value << 4) + hexTable[ch];
- gotone++;
- } else if ((hexTable[ch]) < 0 && gotone)
- done++;
- }
- }
- return value;
-}
-
-
-/*
- * The data returned by the following routine is always in left-most byte
- * first and left-most bit first. If it doesn't return BitmapSuccess then
- * its arguments won't have been touched. This routine should look as much
- * like the Xlib routine XReadBitmapfile as possible.
- */
-int
-XmuReadBitmapData(FILE *fstream, unsigned int *width, unsigned int *height,
- unsigned char **datap, int *x_hot, int *y_hot)
-{
- unsigned char *data = NULL; /* working variable */
- char line[MAX_SIZE]; /* input line from file */
- int size; /* number of bytes of data */
- char name_and_type[MAX_SIZE]; /* an input line */
- char *type; /* for parsing */
- int value; /* from an input line */
- int version10p; /* boolean, old format */
- int padding; /* to handle alignment */
- int bytes_per_line; /* per scanline of data */
- unsigned int ww = 0; /* width */
- unsigned int hh = 0; /* height */
- int hx = -1; /* x hotspot */
- int hy = -1; /* y hotspot */
-
-#undef Xmalloc /* see MALLOC_0_RETURNS_NULL in Xlibint.h */
-#define Xmalloc(size) malloc(size)
-
- /* first time initialization */
- if (initialized == False) initHexTable();
-
- /* error cleanup and return macro */
-#define RETURN(code) { if (data) free (data); return code; }
-
- while (fgets(line, MAX_SIZE, fstream)) {
- if (strlen(line) == MAX_SIZE-1) {
- RETURN (BitmapFileInvalid);
- }
- if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) {
- if (!(type = strrchr(name_and_type, '_')))
- type = name_and_type;
- else
- type++;
-
- if (!strcmp("width", type))
- ww = (unsigned int) value;
- if (!strcmp("height", type))
- hh = (unsigned int) value;
- if (!strcmp("hot", type)) {
- if (type-- == name_and_type || type-- == name_and_type)
- continue;
- if (!strcmp("x_hot", type))
- hx = value;
- if (!strcmp("y_hot", type))
- hy = value;
- }
- continue;
- }
-
- if (sscanf(line, "static short %s = {", name_and_type) == 1)
- version10p = 1;
- else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1)
- version10p = 0;
- else if (sscanf(line, "static char %s = {", name_and_type) == 1)
- version10p = 0;
- else
- continue;
-
- if (!(type = strrchr(name_and_type, '_')))
- type = name_and_type;
- else
- type++;
-
- if (strcmp("bits[]", type))
- continue;
-
- if (!ww || !hh)
- RETURN (BitmapFileInvalid);
-
- if ((ww % 16) && ((ww % 16) < 9) && version10p)
- padding = 1;
- else
- padding = 0;
-
- bytes_per_line = (ww+7)/8 + padding;
-
- size = bytes_per_line * hh;
- data = (unsigned char *) Xmalloc ((unsigned int) size);
- if (!data)
- RETURN (BitmapNoMemory);
-
- if (version10p) {
- unsigned char *ptr;
- int bytes;
-
- for (bytes=0, ptr=data; bytes<size; (bytes += 2)) {
- if ((value = NextInt(fstream)) < 0)
- RETURN (BitmapFileInvalid);
- *(ptr++) = value;
- if (!padding || ((bytes+2) % bytes_per_line))
- *(ptr++) = value >> 8;
- }
- } else {
- unsigned char *ptr;
- int bytes;
-
- for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) {
- if ((value = NextInt(fstream)) < 0)
- RETURN (BitmapFileInvalid);
- *ptr=value;
- }
- }
- break;
- } /* end while */
-
- if (data == NULL) {
- RETURN (BitmapFileInvalid);
- }
-
- *datap = data;
- data = NULL;
- *width = ww;
- *height = hh;
- if (x_hot) *x_hot = hx;
- if (y_hot) *y_hot = hy;
-
- RETURN (BitmapSuccess);
-}
-
-#if defined(WIN32)
-static int
-access_file(char *path, char *pathbuf, int len_pathbuf, char **pathret)
-{
- if (access (path, F_OK) == 0) {
- if (strlen (path) < len_pathbuf)
- *pathret = pathbuf;
- else
- *pathret = malloc (strlen (path) + 1);
- if (*pathret) {
- strcpy (*pathret, path);
- return 1;
- }
- }
- return 0;
-}
-
-static int
-AccessFile(char *path, char *pathbuf, int len_pathbuf, char **pathret)
-{
-#ifndef MAX_PATH
-#define MAX_PATH 512
-#endif
-
- unsigned long drives;
- int i, len;
- char* drive;
- char buf[MAX_PATH];
- char* bufp;
-
- /* just try the "raw" name first and see if it works */
- if (access_file (path, pathbuf, len_pathbuf, pathret))
- return 1;
-
- /* try the places set in the environment */
- drive = getenv ("_XBASEDRIVE");
-#ifdef __EMX__
- if (!drive)
- drive = getenv ("X11ROOT");
-#endif
- if (!drive)
- drive = "C:";
- len = strlen (drive) + strlen (path);
- if (len < MAX_PATH) bufp = buf;
- else bufp = malloc (len + 1);
- strcpy (bufp, drive);
- strcat (bufp, path);
- if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
- if (bufp != buf) free (bufp);
- return 1;
- }
-
-#ifndef __EMX__
- /* one last place to look */
- drive = getenv ("HOMEDRIVE");
- if (drive) {
- len = strlen (drive) + strlen (path);
- if (len < MAX_PATH) bufp = buf;
- else bufp = malloc (len + 1);
- strcpy (bufp, drive);
- strcat (bufp, path);
- if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
- if (bufp != buf) free (bufp);
- return 1;
- }
- }
-
- /* does OS/2 (with or with gcc-emx) have getdrives? */
- /* tried everywhere else, go fishing */
-#define C_DRIVE ('C' - 'A')
-#define Z_DRIVE ('Z' - 'A')
- drives = _getdrives ();
- for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */
- if ((1 << i) & drives) {
- len = 2 + strlen (path);
- if (len < MAX_PATH) bufp = buf;
- else bufp = malloc (len + 1);
- *bufp = 'A' + i;
- *(bufp + 1) = ':';
- *(bufp + 2) = '\0';
- strcat (bufp, path);
- if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
- if (bufp != buf) free (bufp);
- return 1;
- }
- }
- }
-#endif
- return 0;
-}
-
-FILE *
-fopen_file(char *path, char *mode)
-{
- char buf[MAX_PATH];
- char* bufp;
- void* ret = NULL;
- UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS);
-
- if (AccessFile (path, buf, MAX_PATH, &bufp))
- ret = fopen (bufp, mode);
-
- (void) SetErrorMode (olderror);
-
- if (bufp != buf) free (bufp);
-
- return ret;
-}
-
-#else
-#define fopen_file fopen
-#endif
-
-
-int
-XmuReadBitmapDataFromFile(_Xconst char *filename, unsigned int *width,
- unsigned int *height, unsigned char **datap,
- int *x_hot, int *y_hot)
-{
- FILE *fstream;
- int status;
-
-#ifdef __EMX__
- filename = __XOS2RedirRoot(filename);
-#endif
- if ((fstream = fopen_file (filename, "r")) == NULL) {
- return BitmapOpenFailed;
- }
- status = XmuReadBitmapData(fstream, width, height, datap, x_hot, y_hot);
- fclose (fstream);
- return status;
-}
diff --git a/xc/lib/Xmu/ScrOfWin.c b/xc/lib/Xmu/ScrOfWin.c
deleted file mode 100644
index 3629d5555..000000000
--- a/xc/lib/Xmu/ScrOfWin.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $TOG: ScrOfWin.c /main/4 1998/02/06 15:44:48 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/lib/Xmu/ScrOfWin.c,v 1.5 1998/10/03 09:06:32 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xmu/WinUtil.h>
-
-Screen *
-XmuScreenOfWindow(Display *dpy, Window w)
-{
- register int i;
- Window root;
- int x, y; /* dummy variables */
- unsigned int width, height, bw, depth; /* dummy variables */
-
- if (!XGetGeometry (dpy, w, &root, &x, &y, &width, &height,
- &bw, &depth)) {
- return NULL;
- }
- for (i = 0; i < ScreenCount (dpy); i++) { /* find root from list */
- if (root == RootWindow (dpy, i)) {
- return ScreenOfDisplay (dpy, i);
- }
- }
- return NULL;
-}
-
diff --git a/xc/lib/Xmu/ShapeWidg.c b/xc/lib/Xmu/ShapeWidg.c
deleted file mode 100644
index cd1a2aac7..000000000
--- a/xc/lib/Xmu/ShapeWidg.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/* $TOG: ShapeWidg.c /main/7 1998/02/06 15:44:53 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/ShapeWidg.c,v 1.6 1998/10/03 09:06:32 dawes Exp $ */
-
-#include <X11/IntrinsicP.h>
-#include <X11/extensions/shape.h>
-#include "Converters.h"
-#include "Drawing.h"
-#include "Misc.h"
-
-/*
- * Prototypes
- */
-static void ShapeEllipseOrRoundedRectangle(Widget, Bool, int, int);
-static void ShapeError(Widget);
-static void ShapeOval(Widget);
-static void ShapeRectangle(Widget);
-
-/*
- * Implementation
- */
-Boolean
-XmuReshapeWidget(Widget w, int shape_style,
- int corner_width, int corner_height)
-{
- switch (shape_style)
- {
- case XmuShapeRectangle:
- ShapeRectangle(w);
- break;
- case XmuShapeOval:
- ShapeOval(w);
- break;
- case XmuShapeEllipse:
- case XmuShapeRoundedRectangle:
- ShapeEllipseOrRoundedRectangle(w, shape_style == XmuShapeEllipse,
- corner_width, corner_height);
- break;
- default:
- ShapeError(w);
- return (False);
- }
- return (True);
-}
-
-static void
-ShapeError(Widget w)
-{
- String params[1];
- Cardinal num_params = 1;
-
- params[0] = XtName(w);
- XtAppWarningMsg(XtWidgetToApplicationContext(w),
- "shapeUnknown", "xmuReshapeWidget", "XmuLibrary",
- "Unsupported shape style for Command widget \"%s\"",
- params, &num_params);
-}
-
-static void
-ShapeRectangle(Widget w)
-{
- XShapeCombineMask(XtDisplay(w), XtWindow(w),
- ShapeBounding, 0, 0, None, ShapeSet);
- XShapeCombineMask(XtDisplay(w), XtWindow(w),
- ShapeClip, 0, 0, None, ShapeSet);
-}
-
-/*
- * Function:
- * ShapeOval
- *
- * Parameters:
- * w - widget to be reshaped
- *
- * Description:
- * Reshapes a widget to a oval format.
- *
- * Notes:
- * X11R6.3 behaviour changed. Now if the height is larger than the
- * width, this function inverts the sense of the oval, instead of
- * fallbacking to ellipse.
- */
-static void
-ShapeOval(Widget w)
-{
- Display *dpy = XtDisplay(w);
- int width = w->core.width;
- int height = w->core.height;
- Pixmap p;
- XGCValues values;
- GC gc;
- int rad;
-
- if (width < 3 || height < 3)
- return;
- width += w->core.border_width << 1;
- height += w->core.border_width << 1;
-
- p = XCreatePixmap(dpy, XtWindow(w), width, height, 1);
- values.foreground = 0;
- values.background = 1;
- values.cap_style = CapRound;
- values.line_width = Min(width, height);
- gc = XCreateGC(dpy, p,
- GCForeground | GCBackground | GCLineWidth | GCCapStyle,
- &values);
- XFillRectangle(dpy, p, gc, 0, 0, width, height);
- XSetForeground(dpy, gc, 1);
-
- if (width < height)
- {
- rad = width >> 1;
- XDrawLine(dpy, p, gc, rad, rad, rad, height - rad - 1);
- }
- else
- {
- rad = height >> 1;
- XDrawLine(dpy, p, gc, rad, rad, width - rad - 1, rad);
- }
- XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
- -(int)w->core.border_width, -(int)w->core.border_width,
- p, ShapeSet);
- if (w->core.border_width)
- {
- XSetForeground(dpy, gc, 0);
- XFillRectangle(dpy, p, gc, 0, 0, width, height);
- values.line_width = Min(w->core.width, w->core.height);
- values.foreground = 1;
- XChangeGC(dpy, gc, GCLineWidth | GCForeground, &values);
- if (w->core.width < w->core.height)
- {
- rad = w->core.width >> 1;
- XDrawLine(dpy, p, gc, rad, rad, rad, w->core.height - rad - 1);
- }
- else
- {
- rad = w->core.height >> 1;
- XDrawLine(dpy, p, gc, rad, rad, w->core.width - rad - 1, rad);
- }
- XShapeCombineMask(dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet);
- }
- else
- XShapeCombineMask(XtDisplay(w), XtWindow(w),
- ShapeClip, 0, 0, None, ShapeSet);
-
- XFreePixmap(dpy, p);
- XFreeGC(dpy, gc);
-}
-
-/*
- * Function:
- * ShapeEllipseOrRoundedRectangle
- *
- * Parameters:
- * w - widget to be reshaped
- * ellipse - True if shape to ellise, rounded rectangle otherwise
- * ew - horizontal radius of rounded rectangle
- * eh - vertical radius of rouded rectangle
- *
- * Description:
- * Based on the ellipse parameter, gives the widget a elliptical
- * shape, or rounded rectangle shape.
- *
- * Notes:
- * The GC is created with a line width of 2, what seens to draw the
- * widget border correctly, if the width - height is not proportional.
- */
-static void
-ShapeEllipseOrRoundedRectangle(Widget w, Bool ellipse, int ew, int eh)
-{
- Display *dpy = XtDisplay(w);
- unsigned width = w->core.width;
- unsigned height = w->core.height;
- Pixmap p;
- XGCValues values;
- GC gc;
- unsigned long mask;
-
- if (width < 3 || width < 3)
- return;
- width += w->core.border_width << 1;
- height += w->core.border_width << 1;
-
- mask = GCForeground | GCLineWidth;
- p = XCreatePixmap(dpy, XtWindow(w), width, height, 1);
-
- values.foreground = 0;
- values.line_width = 2;
-
- gc = XCreateGC(dpy, p, mask, &values);
- XFillRectangle(dpy, p, gc, 0, 0, width, height);
- XSetForeground(dpy, gc, 1);
- if (!ellipse)
- XmuFillRoundedRectangle(dpy, p, gc, 1, 1, width - 2, height - 2, ew, eh);
- else
- {
- XDrawArc(dpy, p, gc, 1, 1, width - 2, height - 2, 0, 360 * 64);
- XFillArc(dpy, p, gc, 2, 2, width - 4, height - 4, 0, 360 * 64);
- }
- XShapeCombineMask(dpy, XtWindow(w), ShapeBounding,
- -(int)w->core.border_width, -(int)w->core.border_width,
- p, ShapeSet);
- if (w->core.border_width)
- {
- XSetForeground(dpy, gc, 0);
- XFillRectangle(dpy, p, gc, 0, 0, width, height);
- XSetForeground(dpy, gc, 1);
- if (!ellipse)
- XmuFillRoundedRectangle(dpy, p, gc, 1, 1,
- w->core.width - 2, w->core.height - 2,
- ew, eh);
- else
- XFillArc(dpy, p, gc, 0, 0, w->core.width, w->core.height,
- 0, 360 * 64);
- XShapeCombineMask(dpy, XtWindow(w), ShapeClip, 0, 0, p, ShapeSet);
- }
- else
- XShapeCombineMask(XtDisplay(w), XtWindow(w),
- ShapeClip, 0, 0, None, ShapeSet);
-
- XFreePixmap(dpy, p);
- XFreeGC(dpy, gc);
-}
diff --git a/xc/lib/Xmu/StdCmap.c b/xc/lib/Xmu/StdCmap.c
deleted file mode 100644
index 6f232e663..000000000
--- a/xc/lib/Xmu/StdCmap.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/* $TOG: StdCmap.c /main/15 1998/02/06 15:45:04 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/lib/Xmu/StdCmap.c,v 1.4 1998/10/03 09:06:33 dawes Exp $ */
-
-/*
- * Author: Donna Converse, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-#define lowbit(x) ((x) & (~(x) + 1))
-
-/*
- * Prototypes
- */
-/* argument restrictions */
-static Status valid_args(XVisualInfo*, unsigned long, unsigned long,
- unsigned long, Atom);
-
-/*
- * To create any one standard colormap, use XmuStandardColormap().
- *
- * Create a standard colormap for the given screen, visualid, and visual
- * depth, with the given red, green, and blue maximum values, with the
- * given standard property name. Return a pointer to an XStandardColormap
- * structure which describes the newly created colormap, upon success.
- * Upon failure, return NULL.
- *
- * XmuStandardColormap() calls XmuCreateColormap() to create the map.
- *
- * Resources created by this function are not made permanent; that is the
- * caller's responsibility.
- */
-
-XStandardColormap *
-XmuStandardColormap(Display *dpy, int screen, VisualID visualid,
- unsigned int depth, Atom property, Colormap cmap,
- unsigned long red_max, unsigned long green_max,
- unsigned long blue_max)
- /*
- * dpy - specifies X server connection
- * screen - specifies display screen
- * visualid - identifies the visual type
- * depth - identifies the visual type
- * property - a standard colormap property
- * cmap - specifies colormap ID or None
- * red_max, green_max, blue_max - allocations
- */
-{
- XStandardColormap *stdcmap;
- Status status;
- XVisualInfo vinfo_template, *vinfo;
- long vinfo_mask;
- int n;
-
- /* Match the required visual information to an actual visual */
- vinfo_template.visualid = visualid;
- vinfo_template.screen = screen;
- vinfo_template.depth = depth;
- vinfo_mask = VisualIDMask | VisualScreenMask | VisualDepthMask;
- if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
- return 0;
-
- /* Check the validity of the combination of visual characteristics,
- * allocation, and colormap property. Create an XStandardColormap
- * structure.
- */
-
- if (! valid_args(vinfo, red_max, green_max, blue_max, property)
- || ((stdcmap = XAllocStandardColormap()) == NULL)) {
- XFree((char *) vinfo);
- return 0;
- }
-
- /* Fill in the XStandardColormap structure */
-
- if (cmap == DefaultColormap(dpy, screen)) {
- /* Allocating out of the default map, cannot use XFreeColormap() */
- Window win = XCreateWindow(dpy, RootWindow(dpy, screen), 1, 1, 1, 1,
- 0, 0, InputOnly, vinfo->visual,
- (unsigned long) 0,
- (XSetWindowAttributes *)NULL);
- stdcmap->killid = (XID) XCreatePixmap(dpy, win, 1, 1, depth);
- XDestroyWindow(dpy, win);
- stdcmap->colormap = cmap;
- } else {
- stdcmap->killid = ReleaseByFreeingColormap;
- stdcmap->colormap = XCreateColormap(dpy, RootWindow(dpy, screen),
- vinfo->visual, AllocNone);
- }
- stdcmap->red_max = red_max;
- stdcmap->green_max = green_max;
- stdcmap->blue_max = blue_max;
- if (property == XA_RGB_GRAY_MAP)
- stdcmap->red_mult = stdcmap->green_mult = stdcmap->blue_mult = 1;
- else if (vinfo->class == TrueColor || vinfo->class == DirectColor) {
- stdcmap->red_mult = lowbit(vinfo->red_mask);
- stdcmap->green_mult = lowbit(vinfo->green_mask);
- stdcmap->blue_mult = lowbit(vinfo->blue_mask);
- } else {
- stdcmap->red_mult = (red_max > 0)
- ? (green_max + 1) * (blue_max + 1) : 0;
- stdcmap->green_mult = (green_max > 0) ? blue_max + 1 : 0;
- stdcmap->blue_mult = (blue_max > 0) ? 1 : 0;
- }
- stdcmap->base_pixel = 0; /* base pixel may change */
- stdcmap->visualid = vinfo->visualid;
-
- /* Make the colormap */
-
- status = XmuCreateColormap(dpy, stdcmap);
-
- /* Clean up */
-
- XFree((char *) vinfo);
- if (!status) {
-
- /* Free the colormap or the pixmap, if we created one */
- if (stdcmap->killid == ReleaseByFreeingColormap)
- XFreeColormap(dpy, stdcmap->colormap);
- else if (stdcmap->killid != None)
- XFreePixmap(dpy, stdcmap->killid);
-
- XFree((char *) stdcmap);
- return (XStandardColormap *) NULL;
- }
- return stdcmap;
-}
-
-/****************************************************************************/
-static Status
-valid_args(XVisualInfo *vinfo, unsigned long red_max, unsigned long green_max,
- unsigned long blue_max, Atom property)
- /*
- * vinfo - specifies visual
- * red_max, green_max, blue_max - specifies alloc
- * property - specifies property name
- */
-{
- unsigned long ncolors; /* number of colors requested */
-
- /* Determine that the number of colors requested is <= map size */
-
- if ((vinfo->class == DirectColor) || (vinfo->class == TrueColor)) {
- unsigned long mask;
-
- mask = vinfo->red_mask;
- while (!(mask & 1))
- mask >>= 1;
- if (red_max > mask)
- return 0;
- mask = vinfo->green_mask;
- while (!(mask & 1))
- mask >>= 1;
- if (green_max > mask)
- return 0;
- mask = vinfo->blue_mask;
- while (!(mask & 1))
- mask >>= 1;
- if (blue_max > mask)
- return 0;
- } else if (property == XA_RGB_GRAY_MAP) {
- ncolors = red_max + green_max + blue_max + 1;
- if (ncolors > vinfo->colormap_size)
- return 0;
- } else {
- ncolors = (red_max + 1) * (green_max + 1) * (blue_max + 1);
- if (ncolors > vinfo->colormap_size)
- return 0;
- }
-
- /* Determine that the allocation and visual make sense for the property */
-
- switch (property)
- {
- case XA_RGB_DEFAULT_MAP:
- if (red_max == 0 || green_max == 0 || blue_max == 0)
- return 0;
- break;
- case XA_RGB_RED_MAP:
- if (red_max == 0)
- return 0;
- break;
- case XA_RGB_GREEN_MAP:
- if (green_max == 0)
- return 0;
- break;
- case XA_RGB_BLUE_MAP:
- if (blue_max == 0)
- return 0;
- break;
- case XA_RGB_BEST_MAP:
- if (red_max == 0 || green_max == 0 || blue_max == 0)
- return 0;
- break;
- case XA_RGB_GRAY_MAP:
- if (red_max == 0 || blue_max == 0 || green_max == 0)
- return 0;
- break;
- default:
- return 0;
- }
- return 1;
-}
diff --git a/xc/lib/Xmu/StdCmap.h b/xc/lib/Xmu/StdCmap.h
deleted file mode 100644
index bc5825372..000000000
--- a/xc/lib/Xmu/StdCmap.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $TOG: StdCmap.h /main/5 1998/02/06 15:45:10 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/StdCmap.h,v 1.6 1999/03/21 07:34:38 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_STDCMAP_H_
-#define _XMU_STDCMAP_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-Status XmuAllStandardColormaps
-(
- Display *dpy
- );
-
-Status XmuCreateColormap
-(
- Display *dpy,
- XStandardColormap *colormap
- );
-
-void XmuDeleteStandardColormap
-(
- Display *dpy,
- int screen,
- Atom property
- );
-
-Status XmuGetColormapAllocation
-(
- XVisualInfo *vinfo,
- Atom property,
- unsigned long *red_max_return,
- unsigned long *green_max_return,
- unsigned long *blue_max_return
- );
-
-Status XmuLookupStandardColormap
-(
- Display *dpy,
- int screen,
- VisualID visualid,
- unsigned int depth,
- Atom property,
- Bool replace,
- Bool retain
- );
-
-XStandardColormap *XmuStandardColormap
-(
- Display *dpy,
- int screen,
- VisualID visualid,
- unsigned int depth,
- Atom property,
- Colormap cmap,
- unsigned long red_max,
- unsigned long green_max,
- unsigned long blue_max
- );
-
-Status XmuVisualStandardColormaps
-(
- Display *dpy,
- int screen,
- VisualID visualid,
- unsigned int depth,
- Bool replace,
- Bool retain
- );
-
-Bool XmuDistinguishableColors
-(
- XColor *colors,
- int count
- );
-
-Bool XmuDistinguishablePixels
-(
- Display *dpy,
- Colormap cmap,
- unsigned long *pixels,
- int count
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_STDCMAP_H_ */
diff --git a/xc/lib/Xmu/StdSel.h b/xc/lib/Xmu/StdSel.h
deleted file mode 100644
index 42a7ac5bc..000000000
--- a/xc/lib/Xmu/StdSel.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* $TOG: StdSel.h /main/6 1998/02/06 15:45:15 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/StdSel.h,v 1.6 1999/06/06 08:48:36 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_SELECTION_H_
-#define _XMU_SELECTION_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-Boolean XmuConvertStandardSelection
-(
- Widget w,
- Time timev,
- Atom *selection,
- Atom *target,
- Atom *type_return,
- XPointer *value_return,
- unsigned long *length_return,
- int *format_return
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_SELECTION_H_ */
diff --git a/xc/lib/Xmu/StrToBS.c b/xc/lib/Xmu/StrToBS.c
deleted file mode 100644
index 4d9c601d3..000000000
--- a/xc/lib/Xmu/StrToBS.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $TOG: StrToBS.c /main/7 1998/05/14 14:56:19 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.
-
-*/
-
-/* $XFree86: xc/lib/Xmu/StrToBS.c,v 1.5 1998/10/03 09:06:34 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include "Converters.h"
-#include "CharSet.h"
-
-/*
- * Prototypes
- */
-static void InitializeQuarks(void);
-
-/*
- * Initialization
- */
-static XrmQuark QnotUseful, QwhenMapped, Qalways, Qdefault;
-static Boolean haveQuarks;
-
-/*
- * Implementation
- */
-static void
-InitializeQuarks(void)
-{
- if (!haveQuarks)
- {
- char name[11];
-
- XmuNCopyISOLatin1Lowered(name, XtEnotUseful, sizeof(name));
- QnotUseful = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtEwhenMapped, sizeof(name));
- QwhenMapped = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtEalways, sizeof(name));
- Qalways = XrmStringToQuark(name);
- XmuNCopyISOLatin1Lowered(name, XtEdefault, sizeof(name));
- Qdefault = XrmStringToQuark(name);
- haveQuarks = True;
- }
-}
-
-/*ARGSUSED*/
-void
-XmuCvtStringToBackingStore(XrmValue *args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- XrmQuark q;
- char name[11];
- static int backingStoreType;
-
- if (*num_args != 0)
- XtWarning("String to BackingStore conversion needs no extra arguments");
-
- InitializeQuarks();
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
-
- q = XrmStringToQuark (name);
- if (q == QnotUseful)
- backingStoreType = NotUseful;
- else if (q == QwhenMapped)
- backingStoreType = WhenMapped;
- else if (q == Qalways)
- backingStoreType = Always;
- else if (q == Qdefault)
- backingStoreType = Always + WhenMapped + NotUseful;
- else
- {
- XtStringConversionWarning((char *)fromVal->addr, XtRBackingStore);
- return;
- }
- toVal->size = sizeof(int);
- toVal->addr = (XPointer)&backingStoreType;
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtBackingStoreToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(int *)fromVal->addr)
- {
- case NotUseful:
- buffer = XtEnotUseful;
- break;
- case WhenMapped:
- buffer = XtEwhenMapped;
- break;
- case Always:
- buffer = XtEalways;
- break;
- case (Always + WhenMapped + NotUseful):
- buffer = XtEdefault;
- break;
- default:
- XtWarning("Cannot convert BackingStore to String");
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size < size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
diff --git a/xc/lib/Xmu/StrToBmap.c b/xc/lib/Xmu/StrToBmap.c
deleted file mode 100644
index 262c02b63..000000000
--- a/xc/lib/Xmu/StrToBmap.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* $TOG: StrToBmap.c /main/14 1998/02/06 15:45:20 kaleb $ */
-
-/*
-
-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 1987, 1988 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/lib/Xmu/StrToBmap.c,v 1.4 1998/10/03 09:06:34 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Drawing.h>
-
-
-/*
- * XmuConvertStringToBitmap:
- *
- * creates a depth-1 Pixmap suitable for window manager icons.
- * "string" represents a bitmap(1) filename which may be absolute,
- * or relative to the global resource bitmapFilePath, class
- * BitmapFilePath. If the resource is not defined, the default
- * value is the build symbol BITMAPDIR.
- *
- * shares lots of code with XmuConvertStringToCursor.
- *
- * To use, include the following in your ClassInitialize procedure:
-
-static XtConvertArgRec screenConvertArg[] = {
- {XtBaseOffset, (XtPointer) XtOffset(Widget, core.screen), sizeof(Screen *)}
-};
-
- XtAddConverter("String", "Bitmap", XmuCvtStringToBitmap,
- screenConvertArg, XtNumber(screenConvertArg));
- *
- */
-
-#define done(address, type) \
- { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
-
-
-/*ARGSUSED*/
-void
-XmuCvtStringToBitmap(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static Pixmap pixmap; /* static for cvt magic */
- char *name = (char *)fromVal->addr;
- Screen *screen;
- Display *dpy;
- XrmDatabase db;
- String fn;
- unsigned int width, height;
- int xhot, yhot;
- unsigned char *data;
-
- if (*num_args != 1)
- XtErrorMsg("wrongParameters","cvtStringToBitmap","XtToolkitError",
- "String to pixmap conversion needs screen argument",
- (String *)NULL, (Cardinal *)NULL);
-
- if (strcmp(name, "None") == 0) {
- pixmap = None;
- done(&pixmap, Pixmap);
- return;
- }
-
- if (strcmp(name, "ParentRelative") == 0) {
- pixmap = ParentRelative;
- done(&pixmap, Pixmap);
- return;
- }
-
- screen = *((Screen **) args[0].addr);
- pixmap = XmuLocateBitmapFile (screen, name,
- NULL, 0, NULL, NULL, NULL, NULL);
- if (pixmap == None) {
- dpy = DisplayOfScreen(screen);
- db = XrmGetDatabase(dpy);
- XrmSetDatabase(dpy, XtScreenDatabase(screen));
- fn = XtResolvePathname(dpy, "bitmaps", name, "", NULL, NULL, 0, NULL);
- if (!fn)
- fn = XtResolvePathname(dpy, "", name, ".xbm", NULL, NULL, 0, NULL);
- XrmSetDatabase(dpy, db);
- if (fn &&
- XmuReadBitmapDataFromFile (fn, &width, &height, &data,
- &xhot, &yhot) == BitmapSuccess) {
- pixmap = XCreatePixmapFromBitmapData (dpy,
- RootWindowOfScreen(screen),
- (char *) data, width, height,
- 1, 0, 1);
- XFree ((char *)data);
- }
- }
-
- if (pixmap != None) {
- done (&pixmap, Pixmap);
- } else {
- XtStringConversionWarning (name, "Pixmap");
- return;
- }
-}
-
diff --git a/xc/lib/Xmu/StrToCurs.c b/xc/lib/Xmu/StrToCurs.c
deleted file mode 100644
index 4aa55c7d6..000000000
--- a/xc/lib/Xmu/StrToCurs.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* $TOG: StrToCurs.c /main/23 1998/06/24 15:07:36 kaleb $ */
-
-/*
-
-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 1987, 1988 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/lib/Xmu/StrToCurs.c,v 1.6 1998/10/03 09:06:34 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/Drawing.h>
-#include <X11/Xmu/CurUtil.h>
-#include <X11/Xmu/CharSet.h>
-
-#ifndef X_NOT_POSIX
-#include <stdlib.h>
-#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 */
-
-/* Kludge source to avoid encountering broken shared library linkers
- which insist on resolving references unused by the application,
- and broken object file formats that don't correctly distinguish
- references to procedures from references to data.
- */
-#if defined(SUNSHLIB) || defined(SVR4)
-#define XMU_KLUDGE
-#endif
-
-/*
- * XmuConvertStringToCursor:
- *
- * allows String to specify a standard cursor name (from cursorfont.h), a
- * font name and glyph index of the form "FONT fontname index [[font] index]",
- * or a bitmap file name (absolute, or relative to the global resource
- * bitmapFilePath, class BitmapFilePath). If the resource is not
- * defined, the default value is the build symbol BITMAPDIR.
- *
- * shares lots of code with XmuCvtStringToPixmap, but unfortunately
- * can't use it as the hotspot info is lost.
- *
- * To use, include the following in your ClassInitialize procedure:
-
-static XtConvertArgRec screenConvertArg[] = {
- {XtBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)}
-};
-
- XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
- screenConvertArg, XtNumber(screenConvertArg));
- *
- */
-
-#define done(address, type) \
- { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
-
-#define FONTSPECIFIER "FONT "
-
-/*ARGSUSED*/
-void
-XmuCvtStringToCursor(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static Cursor cursor; /* static for cvt magic */
- char *name = (char *)fromVal->addr;
- Screen *screen;
- register int i;
- char maskname[PATH_MAX];
- Pixmap source, mask;
- /* XXX - make fg/bg resources */
- static XColor bgColor = {0, 0xffff, 0xffff, 0xffff};
- static XColor fgColor = {0, 0, 0, 0};
- int xhot, yhot;
- int len;
-
-
- if (*num_args != 1)
- XtErrorMsg("wrongParameters","cvtStringToCursor","XtToolkitError",
- "String to cursor conversion needs screen argument",
- (String *)NULL, (Cardinal *)NULL);
-
- if (XmuCompareISOLatin1(name, "None") == 0)
- {
- cursor = None;
- done(&cursor, Cursor);
- return;
- }
-
- screen = *((Screen **) args[0].addr);
-
- if (0 == strncmp(FONTSPECIFIER, name, strlen(FONTSPECIFIER))) {
- char source_name[PATH_MAX], mask_name[PATH_MAX];
- int source_char, mask_char, fields;
- Font source_font, mask_font;
- XrmValue fromString, toFont;
- XrmValue cvtArg;
- Boolean success;
- Display *dpy = DisplayOfScreen(screen);
- char *strspec = NULL;
-#ifdef XMU_KLUDGE
- Cardinal num;
-#endif
-
- strspec = XtMalloc(strlen("FONT %s %d %s %d") + 21);
- sprintf(strspec, "FONT %%%ds %%d %%%ds %%d", sizeof(source_name) - 1,
- sizeof(mask_name) - 1);
- fields = sscanf(name, strspec,
- source_name, &source_char,
- mask_name, &mask_char);
- XtFree(strspec);
- if (fields < 2) {
- XtStringConversionWarning(name, XtRCursor);
- return;
- }
-
- fromString.addr = source_name;
- fromString.size = strlen(source_name) + 1;
- toFont.addr = (XPointer) &source_font;
- toFont.size = sizeof(Font);
- cvtArg.addr = (XPointer) &dpy;
- cvtArg.size = sizeof(Display *);
- /* XXX using display of screen argument as message display */
-#ifdef XMU_KLUDGE
- /* XXX Sacrifice caching */
- num = 1;
- success = XtCvtStringToFont(dpy, &cvtArg, &num, &fromString, &toFont,
- NULL);
-#else
- success = XtCallConverter(dpy, XtCvtStringToFont, &cvtArg,
- (Cardinal)1, &fromString, &toFont, NULL);
-#endif
- if (!success) {
- XtStringConversionWarning(name, XtRCursor);
- return;
- }
-
- switch (fields) {
- case 2: /* defaulted mask font & char */
- mask_font = source_font;
- mask_char = source_char;
- break;
-
- case 3: /* defaulted mask font */
- mask_font = source_font;
- mask_char = atoi(mask_name);
- break;
-
- case 4: /* specified mask font & char */
- fromString.addr = mask_name;
- fromString.size = strlen(mask_name) + 1;
- toFont.addr = (XPointer) &mask_font;
- toFont.size = sizeof(Font);
- /* XXX using display of screen argument as message display */
-#ifdef XMU_KLUDGE
- /* XXX Sacrifice caching */
- num = 1;
- success = XtCvtStringToFont(dpy, &cvtArg, &num, &fromString,
- &toFont, NULL);
-#else
- success = XtCallConverter(dpy, XtCvtStringToFont, &cvtArg,
- (Cardinal)1, &fromString, &toFont, NULL);
-#endif
- if (!success) {
- XtStringConversionWarning(name, XtRCursor);
- return;
- }
- }
-
- cursor = XCreateGlyphCursor( DisplayOfScreen(screen), source_font,
- mask_font, source_char, mask_char,
- &fgColor, &bgColor );
- done(&cursor, Cursor);
- return;
- }
-
- i = XmuCursorNameToIndex (name);
- if (i != -1) {
- cursor = XCreateFontCursor (DisplayOfScreen(screen), i);
- done(&cursor, Cursor);
- return;
- }
-
- if ((source = XmuLocateBitmapFile (screen, name,
- maskname, (sizeof maskname) - 4,
- NULL, NULL, &xhot, &yhot)) == None) {
- XtStringConversionWarning (name, XtRCursor);
- cursor = None;
- done(&cursor, Cursor);
- return;
- }
- len = strlen (maskname);
- for (i = 0; i < 2; i++) {
- strcpy (maskname + len, i == 0 ? "Mask" : "msk");
- if ((mask = XmuLocateBitmapFile (screen, maskname, NULL, 0,
- NULL, NULL, NULL, NULL)) != None)
- break;
- }
-
- cursor = XCreatePixmapCursor( DisplayOfScreen(screen), source, mask,
- &fgColor, &bgColor, xhot, yhot );
- XFreePixmap( DisplayOfScreen(screen), source );
- if (mask != None) XFreePixmap( DisplayOfScreen(screen), mask );
-
- done(&cursor, Cursor);
-}
-
-#define new_done(type, value) \
- { \
- if (toVal->addr != NULL) { \
- if (toVal->size < sizeof(type)) { \
- toVal->size = sizeof(type); \
- return False; \
- } \
- *(type*)(toVal->addr) = (value); \
- } \
- else { \
- static type static_val; \
- static_val = (value); \
- toVal->addr = (XPointer)&static_val; \
- } \
- toVal->size = sizeof(type); \
- return True; \
- }
-
-/* Function Name: XmuCvtStringToColorCursor
- * Description: Converts a string into a colored cursor.
- * Arguments: dpy
- * args - an argument list (see below).
- * num_args - number of elements in the argument list.
- * fromVal - value to convert from.
- * toVal - value to convert to.
- * data
- * Returns: True or False
- */
-
-/*ARGSUSED*/
-Boolean
-XmuCvtStringToColorCursor(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *converter_data)
-{
- Cursor cursor;
- Screen *screen;
- Pixel fg, bg;
- Colormap c_map;
- XColor colors[2];
- Cardinal number;
- XrmValue ret_val;
-
- if (*num_args != 4) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "wrongParameters","cvtStringToColorCursor","XmuError",
- "String to color cursor conversion needs four arguments",
- (String *)NULL, (Cardinal *)NULL);
- return False;
- }
-
- screen = *((Screen **) args[0].addr);
- fg = *((Pixel *) args[1].addr);
- bg = *((Pixel *) args[2].addr);
- c_map = *((Colormap *) args[3].addr);
-
- number = 1;
- XmuCvtStringToCursor(args, &number, fromVal, &ret_val);
-
- cursor = *((Cursor *) ret_val.addr);
-
- if (cursor == None || (fg == BlackPixelOfScreen(screen)
- && bg == WhitePixelOfScreen(screen)))
- new_done(Cursor, cursor);
-
- colors[0].pixel = fg;
- colors[1].pixel = bg;
-
- XQueryColors (dpy, c_map, colors, 2);
- XRecolorCursor(dpy, cursor, colors, colors + 1);
- new_done(Cursor, cursor);
-}
-
-
-
diff --git a/xc/lib/Xmu/StrToGrav.c b/xc/lib/Xmu/StrToGrav.c
deleted file mode 100644
index cc6ebd6f6..000000000
--- a/xc/lib/Xmu/StrToGrav.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* $TOG: StrToGrav.c /main/7 1998/02/06 15:45: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/StrToGrav.c,v 1.5 1998/10/03 09:06:35 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/Converters.h>
-#include <X11/Xmu/CharSet.h>
-
-#define done(address, type) \
-{ (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }
-
-/*
- * Initialization
- */
-static struct _namepair {
- XrmQuark quark;
- char *name;
- XtGravity gravity;
-} names[] = {
- { NULLQUARK, XtEForget, ForgetGravity },
- { NULLQUARK, XtENorthWest, NorthWestGravity },
- { NULLQUARK, XtENorth, NorthGravity },
- { NULLQUARK, XtENorthEast, NorthEastGravity },
- { NULLQUARK, XtEWest, WestGravity },
- { NULLQUARK, XtECenter, CenterGravity },
- { NULLQUARK, XtEEast, EastGravity },
- { NULLQUARK, XtESouthWest, SouthWestGravity },
- { NULLQUARK, XtESouth, SouthGravity },
- { NULLQUARK, XtESouthEast, SouthEastGravity },
- { NULLQUARK, XtEStatic, StaticGravity },
- { NULLQUARK, XtEUnmap, UnmapGravity },
- { NULLQUARK, XtEleft, WestGravity },
- { NULLQUARK, XtEtop, NorthGravity },
- { NULLQUARK, XtEright, EastGravity },
- { NULLQUARK, XtEbottom, SouthGravity },
- { NULLQUARK, NULL, ForgetGravity }
-};
-
-/*
- * This function is deprecated as of the addition of
- * XtCvtStringToGravity in R6
- */
-void
-XmuCvtStringToGravity(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static Boolean haveQuarks = False;
- char name[10];
- XrmQuark q;
- struct _namepair *np;
-
- if (*num_args != 0)
- XtWarningMsg("wrongParameters","cvtStringToGravity","XtToolkitError",
- "String to Gravity conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- if (!haveQuarks)
- {
- for (np = names; np->name; np++)
- np->quark = XrmPermStringToQuark(np->name);
- haveQuarks = True;
- }
-
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- for (np = names; np->name; np++)
- {
- if (np->quark == q)
- {
- done(&np->gravity, XtGravity);
- return;
- }
- }
-
- XtStringConversionWarning((char *)fromVal->addr, XtRGravity);
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtGravityToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- static char *buffer;
- Cardinal size;
- struct _namepair *np;
- XtGravity gravity;
-
- gravity = *(XtGravity *)fromVal->addr;
- buffer = NULL;
- for (np = names; np->name; np++)
- if (np->gravity == gravity)
- {
- buffer = np->name;
- break;
- }
-
- if (!buffer)
- {
- XtAppWarning(XtDisplayToApplicationContext(dpy),
- "Cannot convert Gravity to String");
- toVal->addr = NULL;
- toVal->size = 0;
-
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size <= size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = size;
-
- return (True);
-}
diff --git a/xc/lib/Xmu/StrToJust.c b/xc/lib/Xmu/StrToJust.c
deleted file mode 100644
index c23d682ff..000000000
--- a/xc/lib/Xmu/StrToJust.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $TOG: StrToJust.c /main/11 1998/05/14 14:56:23 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.
-
-*/
-
-/* $XFree86: xc/lib/Xmu/StrToJust.c,v 1.5 1998/10/03 09:06:35 dawes Exp $ */
-
-#include <string.h>
-#include <X11/Intrinsic.h>
-#include "Converters.h"
-#include "CharSet.h"
-
-/*
- * Prototypes
- */
-static void InitializeQuarks(void);
-
-/*
- * Initialization
- */
-static XrmQuark Qleft, Qcenter, Qright;
-static Boolean haveQuarks;
-
-/*
- * Implementation
- */
-static void
-InitializeQuarks(void)
-{
- if (!haveQuarks)
- {
- Qleft = XrmPermStringToQuark(XtEleft);
- Qcenter = XrmPermStringToQuark(XtEcenter);
- Qright = XrmPermStringToQuark(XtEright);
- haveQuarks = True;
- }
-}
-
-/*ARGSUSED*/
-void
-XmuCvtStringToJustify(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XtJustify e;
- XrmQuark q;
- char *s = (char *)fromVal->addr;
- char name[7];
-
- if (s == NULL)
- return;
-
- InitializeQuarks();
- XmuNCopyISOLatin1Lowered(name, s, sizeof(name));
-
- q = XrmStringToQuark(name);
-
- toVal->size = sizeof(XtJustify);
- toVal->addr = (XPointer)&e;
-
- if (q == Qleft)
- e = XtJustifyLeft;
- else if (q == Qcenter)
- e = XtJustifyCenter;
- else if (q == Qright)
- e = XtJustifyRight;
- else
- {
- toVal->addr = NULL;
- XtStringConversionWarning((char *)fromVal->addr, XtRJustify);
- }
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtJustifyToString(Display *dpy, XrmValue* args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(XtJustify *)fromVal->addr)
- {
- case XtJustifyLeft:
- buffer = XtEleft;
- break;
- case XtJustifyCenter:
- buffer = XtEcenter;
- break;
- case XtJustifyRight:
- buffer = XtEright;
- break;
- default:
- XtWarning("Cannot convert Justify to String");
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size < size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
diff --git a/xc/lib/Xmu/StrToLong.c b/xc/lib/Xmu/StrToLong.c
deleted file mode 100644
index 9bf6fb17b..000000000
--- a/xc/lib/Xmu/StrToLong.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $TOG: StrToLong.c /main/6 1998/02/06 15:45:51 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/lib/Xmu/StrToLong.c,v 1.6 1999/03/21 07:34:38 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/Intrinsic.h>
-#include "SysUtil.h"
-#include "Converters.h"
-
-void
-XmuCvtStringToLong(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static long l;
-
- if (*num_args != 0)
- XtWarning("String to Long conversion needs no extra arguments");
- if (sscanf((char *)fromVal->addr, "%ld", &l) == 1)
- {
- toVal->size = sizeof(long);
- toVal->addr = (XPointer)&l;
- }
- else
- XtStringConversionWarning((char *)fromVal->addr, XtRLong);
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtLongToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal, XtPointer *data)
-{
- static char buffer[32];
- size_t size;
-
- if (*num_args != 0)
- XtWarning("Long to String conversion needs no extra arguments");
-
- XmuSnprintf(buffer, sizeof(buffer), "%ld", *(long *)fromVal->addr);
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size < size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
diff --git a/xc/lib/Xmu/StrToOrnt.c b/xc/lib/Xmu/StrToOrnt.c
deleted file mode 100644
index ae01968b8..000000000
--- a/xc/lib/Xmu/StrToOrnt.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $TOG: StrToOrnt.c /main/11 1998/05/14 14:56:27 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.
-
-*/
-
-/* $XFree86: xc/lib/Xmu/StrToOrnt.c,v 1.5 1998/10/03 09:06:35 dawes Exp $ */
-
-#include <X11/Intrinsic.h>
-#include <X11/StringDefs.h>
-#include "Converters.h"
-#include "CharSet.h"
-
-/*
- * Prototypes
- */
-static void InitializeQuarks(void);
-
-/*
- * Initialization
- */
-static XrmQuark Qhorizontal, Qvertical;
-static Boolean haveQuarks;
-
-/*
- * Implementation
- */
-static void
-InitializeQuarks(void)
-{
- if (!haveQuarks)
- {
- Qhorizontal = XrmPermStringToQuark(XtEhorizontal);
- Qvertical = XrmPermStringToQuark(XtEvertical);
- haveQuarks = True;
- }
-}
-
-/*ARGSUSED*/
-void
-XmuCvtStringToOrientation(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static XtOrientation orient;
- XrmQuark q;
- char name[11];
-
- InitializeQuarks();
- XmuNCopyISOLatin1Lowered(name, (char *)fromVal->addr, sizeof(name));
- q = XrmStringToQuark(name);
-
- toVal->size = sizeof(XtJustify);
- toVal->addr = (XPointer)&orient;
-
- if (q == Qhorizontal)
- orient = XtorientHorizontal;
- else if (q == Qvertical)
- orient = XtorientVertical;
- else
- {
- toVal->addr = NULL;
- XtStringConversionWarning((char *)fromVal->addr, XtROrientation);
- }
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtOrientationToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
-{
- static String buffer;
- Cardinal size;
-
- switch (*(XtOrientation *)fromVal->addr)
- {
- case XtorientVertical:
- buffer = XtEvertical;
- break;
- case XtorientHorizontal:
- buffer = XtEhorizontal;
- break;
- default:
- XtWarning("Cannot convert Orientation to String");
- toVal->addr = NULL;
- toVal->size = 0;
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size < size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
diff --git a/xc/lib/Xmu/StrToShap.c b/xc/lib/Xmu/StrToShap.c
deleted file mode 100644
index 2accd46e7..000000000
--- a/xc/lib/Xmu/StrToShap.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/* $TOG: StrToShap.c /main/6 1998/02/06 15:46:01 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/StrToShap.c,v 1.5 1998/10/03 09:06:36 dawes Exp $ */
-
-#include <string.h>
-#include <X11/Intrinsic.h>
-#include "Converters.h"
-#include "CharSet.h"
-
-/* ARGSUSED */
-#define done(type, value) \
- { \
- if (toVal->addr != NULL) { \
- if (toVal->size < sizeof(type)) { \
- toVal->size = sizeof(type); \
- return False; \
- } \
- *(type*)(toVal->addr) = (value); \
- } \
- else { \
- static type static_val; \
- static_val = (value); \
- toVal->addr = (XtPointer)&static_val; \
- } \
- toVal->size = sizeof(type); \
- return True; \
- }
-
-
-/*ARGSUSED*/
-Boolean
-XmuCvtStringToShapeStyle(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *from, XrmValue *toVal, XtPointer *data)
-{
- String name = (String)from->addr;
-
- if (XmuCompareISOLatin1(name, XtERectangle) == 0)
- done(int, XmuShapeRectangle);
- if (XmuCompareISOLatin1(name, XtEOval) == 0)
- done(int, XmuShapeOval);
- if (XmuCompareISOLatin1(name, XtEEllipse) == 0)
- done(int, XmuShapeEllipse);
- if (XmuCompareISOLatin1(name, XtERoundedRectangle) == 0)
- done(int, XmuShapeRoundedRectangle);
-
- XtDisplayStringConversionWarning(dpy, name, XtRShapeStyle);
-
- return (False);
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtShapeStyleToString(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal, XtPointer *data)
-{
- static char *buffer;
- Cardinal size;
-
- switch (*(int *)fromVal->addr)
- {
- case XmuShapeRectangle:
- buffer = XtERectangle;
- break;
- case XmuShapeOval:
- buffer = XtEOval;
- break;
- case XmuShapeEllipse:
- buffer = XtEEllipse;
- break;
- case XmuShapeRoundedRectangle:
- buffer = XtERoundedRectangle;
- break;
- default:
- XtAppWarning(XtDisplayToApplicationContext(dpy),
- "Cannot convert ShapeStyle to String");
- toVal->addr = NULL;
- toVal->size = 0;
-
- return (False);
- }
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size <= size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = size;
-
- return (True);
-}
diff --git a/xc/lib/Xmu/StrToWidg.c b/xc/lib/Xmu/StrToWidg.c
deleted file mode 100644
index b63736523..000000000
--- a/xc/lib/Xmu/StrToWidg.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $TOG: StrToWidg.c /main/11 1998/02/06 15:46:07 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/StrToWidg.c,v 1.5 1998/10/03 09:06:36 dawes Exp $ */
-
-/*
- * XmuCvtStringToWidget
- *
- * static XtConvertArgRec parentCvtArgs[] = {
- * {XtBaseOffset, (XtPointer)XtOffset(Widget, core.parent), sizeof(Widget)},
- * };
- *
- * matches the string against the name of the immediate children (normal
- * or popup) of the parent. If none match, compares string to classname
- * & returns first match. Case is significant.
- */
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/ObjectP.h>
-#include <X11/Xmu/Converters.h>
-
-#define done(address, type) \
-{ \
- toVal->size = sizeof(type); \
- toVal->addr = (XPointer)address; \
- return; \
-}
-
-/*ARGSUSED*/
-void
-XmuCvtStringToWidget(XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal)
-{
- static Widget widget, *widgetP, parent;
- XrmName name = XrmStringToName(fromVal->addr);
- int i;
-
- if (*num_args != 1)
- XtErrorMsg("wrongParameters", "cvtStringToWidget", "xtToolkitError",
- "StringToWidget conversion needs parent arg", NULL, 0);
-
- parent = *(Widget*)args[0].addr;
- /* try to match names of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- {
- widget = *widgetP;
- done(&widget, Widget);
- }
- }
-
- /* try to match names of popup children */
- i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- {
- widget = *widgetP;
- done(&widget, Widget);
- }
-
- /* try to match classes of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- {
- widget = *widgetP;
- done(&widget, Widget);
- }
- }
-
- /* try to match classes of popup children */
- i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- {
- widget = *widgetP;
- done(&widget, Widget);
- }
-
- XtStringConversionWarning(fromVal->addr, XtRWidget);
- toVal->addr = NULL;
- toVal->size = 0;
-}
-
-#undef done
-
-#define newDone(type, value) \
- { \
- if (toVal->addr != NULL) { \
- if (toVal->size < sizeof(type)) { \
- toVal->size = sizeof(type); \
- return False; \
- } \
- *(type*)(toVal->addr) = (value); \
- } \
- else { \
- static type static_val; \
- static_val = (value); \
- toVal->addr = (XtPointer)&static_val; \
- } \
- toVal->size = sizeof(type); \
- return True; \
- }
-
-
-/*ARGSUSED*/
-Boolean
-XmuNewCvtStringToWidget(Display *dpy, XrmValue *args, Cardinal *num_args,
- XrmValue *fromVal, XrmValue *toVal,
- XtPointer *converter_data)
-{
- Widget *widgetP, parent;
- XrmName name = XrmStringToName(fromVal->addr);
- int i;
-
- if (*num_args != 1)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "wrongParameters","cvtStringToWidget","xtToolkitError",
- "String To Widget conversion needs parent argument",
- (String *)NULL, (Cardinal *)NULL);
-
- parent = *(Widget*)args[0].addr;
- /* try to match names of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- newDone(Widget, *widgetP);
- }
-
- /* try to match names of popup children */
- i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.xrm_name == name)
- newDone(Widget, *widgetP);
-
- /* try to match classes of normal children */
- if (XtIsComposite(parent))
- {
- i = ((CompositeWidget)parent)->composite.num_children;
- for (widgetP = ((CompositeWidget)parent)->composite.children;
- i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- newDone(Widget, *widgetP);
- }
-
- /* try to match classes of popup children */
- i = parent->core.num_popups;
- for (widgetP = parent->core.popup_list; i; i--, widgetP++)
- if ((*widgetP)->core.widget_class->core_class.xrm_class == name)
- newDone(Widget, *widgetP);
-
- XtDisplayStringConversionWarning(dpy, (String)fromVal->addr, XtRWidget);
- return (False);
-}
-
-/*ARGSUSED*/
-Boolean
-XmuCvtWidgetToString(Display *dpy, XrmValuePtr args, Cardinal *num_args,
- XrmValuePtr fromVal, XrmValuePtr toVal,
- XtPointer *data)
-{
- static String buffer;
- Cardinal size;
- Widget widget;
-
- widget = *(Widget *)fromVal->addr;
-
- if (widget)
- buffer = XrmQuarkToString(widget->core.xrm_name);
- else
- buffer = "(null)";
-
- size = strlen(buffer) + 1;
- if (toVal->addr != NULL)
- {
- if (toVal->size < size)
- {
- toVal->size = size;
- return (False);
- }
- strcpy((char *)toVal->addr, buffer);
- }
- else
- toVal->addr = (XPointer)buffer;
- toVal->size = sizeof(String);
-
- return (True);
-}
diff --git a/xc/lib/Xmu/SysUtil.h b/xc/lib/Xmu/SysUtil.h
deleted file mode 100644
index 85cacf287..000000000
--- a/xc/lib/Xmu/SysUtil.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* $TOG: SysUtil.h /main/5 1998/02/06 15:46: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/SysUtil.h,v 1.6 1998/10/03 09:06:36 dawes Exp $ */
-
-#ifndef _SYSUTIL_H_
-#define _SYSUTIL_H_
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-int XmuGetHostname
-(
- char *buf_return,
- int maxlen
-);
-
-int XmuSnprintf
-(
- char *str,
- int size,
- _Xconst char *fmt,
- ...
- );
-
-_XFUNCPROTOEND
-
-#endif /* _SYSUTIL_H_ */
diff --git a/xc/lib/Xmu/UpdMapHint.c b/xc/lib/Xmu/UpdMapHint.c
deleted file mode 100644
index dc2b0f7b8..000000000
--- a/xc/lib/Xmu/UpdMapHint.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $TOG: UpdMapHint.c /main/3 1998/02/06 15:46: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/UpdMapHint.c,v 1.5 1998/10/03 09:06:37 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/WinUtil.h>
-
-Bool
-XmuUpdateMapHints(Display *dpy, Window w, XSizeHints *hints)
-{
- static XSizeHints *shp = NULL;
-
- if (!hints) { /* get them first */
- long supp;
-
- if (!shp) {
- shp = XAllocSizeHints();
- if (!shp) return False;
- }
- if (!XGetWMNormalHints (dpy, w, shp, &supp)) return False;
- hints = shp;
- }
- hints->flags &= ~(PPosition|PSize);
- hints->flags |= (USPosition|USSize);
- XSetWMNormalHints (dpy, w, hints);
- return True;
-}
-
diff --git a/xc/lib/Xmu/VisCmap.c b/xc/lib/Xmu/VisCmap.c
deleted file mode 100644
index 5b1ddc5ca..000000000
--- a/xc/lib/Xmu/VisCmap.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* $TOG: VisCmap.c /main/12 1998/02/06 15:46:23 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/lib/Xmu/VisCmap.c,v 1.5 1998/10/03 09:06:37 dawes Exp $ */
-
-/*
- * Author: Donna Converse, MIT X Consortium
- */
-
-#include <stdio.h>
-#include <math.h>
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include <X11/Xmu/StdCmap.h>
-
-/*
- * To create all of the appropriate standard colormaps for a given visual on
- * a given screen, use XmuVisualStandardColormaps.
- *
- * Define all appropriate standard colormap properties for the given visual.
- * If replace is true, any previous definition will be removed.
- * If retain is true, new properties will be retained for the duration of
- * the server session. Return 0 on failure, non-zero on success.
- * On failure, no new properties will be defined, and, old ones may have
- * been removed if replace was True.
- *
- * Not all standard colormaps are meaningful to all visual classes. This
- * routine will check and define the following properties for the following
- * classes, provided that the size of the colormap is not too small.
- *
- * DirectColor and PseudoColor
- * RGB_DEFAULT_MAP
- * RGB_BEST_MAP
- * RGB_RED_MAP
- * RGB_GREEN_MAP
- * RGB_BLUE_MAP
- * RGB_GRAY_MAP
- *
- * TrueColor and StaticColor
- * RGB_BEST_MAP
- *
- * GrayScale and StaticGray
- * RGB_GRAY_MAP
- */
-
-Status
-XmuVisualStandardColormaps(Display *dpy, int screen, VisualID visualid,
- unsigned int depth, Bool replace, Bool retain)
- /*
- * dpy - specifies server connection
- * screen - specifies screen number
- * visualid - specifies the visual
- * depth - specifies the visual
- * replace specifies - whether to replace
- * retain - specifies whether to retain
- */
-{
- Status status;
- int n;
- long vinfo_mask;
- XVisualInfo vinfo_template, *vinfo;
-
- status = 0;
- vinfo_template.screen = screen;
- vinfo_template.visualid = visualid;
- vinfo_template.depth = depth;
- vinfo_mask = VisualScreenMask | VisualIDMask | VisualDepthMask;
- if ((vinfo = XGetVisualInfo(dpy, vinfo_mask, &vinfo_template, &n)) == NULL)
- return 0;
-
- if (vinfo->colormap_size <= 2) {
- /* Monochrome visuals have no standard maps; considered successful */
- XFree((char *) vinfo);
- return 1;
- }
-
- switch (vinfo->class)
- {
- case PseudoColor:
- case DirectColor:
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_DEFAULT_MAP, replace,retain);
- if (!status) break;
-
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_GRAY_MAP, replace, retain);
- if (!status) {
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
- break;
- }
-
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_RED_MAP, replace, retain);
- if (!status) {
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
- break;
- }
-
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_GREEN_MAP, replace, retain);
- if (!status) {
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
- break;
- }
-
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_BLUE_MAP, replace, retain);
- if (!status) {
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
- break;
- }
- /* fall through */
-
- case StaticColor:
- case TrueColor:
-
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_BEST_MAP, replace, retain);
- if (!status && (vinfo->class == PseudoColor ||
- vinfo->class == DirectColor)) {
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_GRAY_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_RED_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_GREEN_MAP);
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_BLUE_MAP);
- }
- break;
- /* the end for PseudoColor, DirectColor, StaticColor, and TrueColor */
-
- case GrayScale:
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_DEFAULT_MAP, replace,
- retain);
- if (! status) break;
- /*FALLTHROUGH*/
-
- case StaticGray:
-
- status = XmuLookupStandardColormap(dpy, screen, visualid, depth,
- XA_RGB_GRAY_MAP, replace, retain);
- if (! status && vinfo->class == GrayScale) {
- XmuDeleteStandardColormap(dpy, screen, XA_RGB_DEFAULT_MAP);
- break;
- }
- }
-
- XFree((char *) vinfo);
- return status;
-}
diff --git a/xc/lib/Xmu/WhitePoint.h b/xc/lib/Xmu/WhitePoint.h
deleted file mode 100644
index 0e9764c26..000000000
--- a/xc/lib/Xmu/WhitePoint.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $TOG: WhitePoint.h /main/5 1998/02/06 15:46:29 kaleb $ */
-
-/*
-
-Copyright 1991, 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.
-
-*/
-
-
-/*
- *
- * DESCRIPTION
- * This file contains a series of standard white point values.
- */
-#define CIE_A_u 0.2560
-#define CIE_A_v 0.5243
-#define CIE_A_Y 1.0000
-
-#define CIE_B_u 0.2137
-#define CIE_B_v 0.4852
-#define CIE_B_Y 1.0000
-
-#define CIE_C_u 0.2009
-#define CIE_C_v 0.4609
-#define CIE_C_Y 1.0000
-
-#define CIE_D55_u 0.2044
-#define CIE_D55_v 0.4808
-#define CIE_D55_Y 1.0000
-
-#define CIE_D65_u 0.1978
-#define CIE_D65_v 0.4684
-#define CIE_D65_Y 1.0000
-
-#define CIE_D75_u 0.1935
-#define CIE_D75_v 0.4586
-#define CIE_D75_Y 1.0000
-
-#define ASTM_D50_u 0.2092
-#define ASTM_D50_v 0.4881
-#define ASTM_D50_Y 1.0000
-
-#define WP_9300K_u 0.1884
-#define WP_9300K_v 0.4463
-#define WP_9300K_Y 1.0000
diff --git a/xc/lib/Xmu/WidgetNode.c b/xc/lib/Xmu/WidgetNode.c
deleted file mode 100644
index b04f6d624..000000000
--- a/xc/lib/Xmu/WidgetNode.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* $TOG: WidgetNode.c /main/7 1998/06/23 11:51:04 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/lib/Xmu/WidgetNode.c,v 1.6 1999/03/21 07:34:39 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-
-
-#include <stdio.h>
-#include <X11/Xos.h>
-#include <X11/IntrinsicP.h>
-#include <X11/Xaw/Cardinals.h>
-#include <X11/Xmu/CharSet.h>
-#include <X11/Xmu/WidgetNode.h>
-
-/*
- * Prototypes
- */
-static char *binsearch(char*, char*, int, int,
- int(_Xconst void*, _Xconst void*));
-static int compare_resource_entries(_Xconst void *a, _Xconst void *b);
-static XmuWidgetNode *find_resource(XmuWidgetNode*, char*, Bool);
-static void mark_resource_owner(XmuWidgetNode*);
-/*
- * Implementation
- */
-static char *
-binsearch(char *key, char *base, int nelems, int elemsize,
- int compar(_Xconst void*, _Xconst void*))
- /*
- * key - template of object to find
- * base - beginning of array
- * nelems - number of elements in array
- * elemsize - sizeof an element
- * compar - qsort-style compare function
- */
-{
- int lower = 0, upper = nelems - 1;
-
- while (lower <= upper) {
- int middle = (lower + upper) / 2;
- char *p = base + middle * elemsize;
- int res = (*compar) (p, key);
-
- if (res < 0) {
- lower = middle + 1;
- } else if (res == 0) {
- return p;
- } else {
- upper = middle - 1;
- }
- }
-
- return NULL;
-}
-
-
-static int
-compare_resource_entries(register _Xconst void *a,
- register _Xconst void *b)
-{
- return strcmp (((XtResourceList)a)->resource_name,
- ((XtResourceList)b)->resource_name);
-}
-
-
-static XmuWidgetNode *
-find_resource(XmuWidgetNode *node, char *name, Bool cons)
-{
- register XmuWidgetNode *sup;
- XtResource res;
-
-#define reslist ((char *) (cons ? sup->constraints : sup->resources))
-#define nreslist (int) (cons ? sup->nconstraints : sup->nresources)
-
- res.resource_name = name;
- for (sup = node->superclass;
- sup && (XtResourceList) binsearch ((char *) &res,
- reslist, nreslist,
- sizeof(XtResource),
- compare_resource_entries);
- node = sup, sup = sup->superclass) ;
-
-#undef reslist
-#undef nreslist
-
- return node;
-}
-
-
-static void
-mark_resource_owner(register XmuWidgetNode *node)
-{
- register Cardinal i;
- XtResourceList childres;
-
- childres = node->resources;
- for (i = 0; i < node->nresources; i++, childres++) {
- node->resourcewn[i] = find_resource (node, childres->resource_name,
- False);
- }
-
- childres = node->constraints;
- for (i = 0; i < node->nconstraints; i++, childres++) {
- node->constraintwn[i] = find_resource (node, childres->resource_name,
- True);
- }
-}
-
-
-/*
- * Public Interfaces
- */
-
-void
-XmuWnInitializeNodes(XmuWidgetNode *nodearray, int nnodes)
-{
- int i;
- XmuWidgetNode *wn;
-
- /*
- * Assume that the node array is in alphabetic order, so we need to
- * search backwards to make sure that the children are listed forward.
- */
- for (i = nnodes - 1, wn = nodearray + (nnodes - 1); i >= 0; i--, wn--) {
- WidgetClass superclass = XmuWnSuperclass(wn);
- int j;
- XmuWidgetNode *swn;
- int lablen = strlen (wn->label);
- int namelen = strlen (XmuWnClassname(wn));
-
- wn->lowered_label = XtMalloc (lablen + namelen + 2);
-#if 0
- /* XtMalloc exits if failed */
- if (!wn->lowered_label) {
- fprintf (stderr,
- "%s: unable to allocate %d bytes for widget name\n",
- "XmuWnInitializeNodes", lablen + namelen + 2);
- exit (1);
- }
-#endif
- wn->lowered_classname = wn->lowered_label + (lablen + 1);
- XmuCopyISOLatin1Lowered (wn->lowered_label, wn->label);
- XmuCopyISOLatin1Lowered (wn->lowered_classname, XmuWnClassname(wn));
- wn->superclass = NULL;
- wn->have_resources = False;
- wn->resources = NULL;
- wn->resourcewn = NULL;
- wn->nresources = 0;
- wn->constraints = NULL;
- wn->constraintwn = NULL;
- wn->nconstraints = 0;
- wn->data = (XtPointer) NULL;
-
- /*
- * walk up the superclass chain
- */
- while (superclass) {
- for (j = 0, swn = nodearray; j < nnodes; j++, swn++) {
- if (superclass == XmuWnClass(swn)) {
- wn->superclass = swn;
- goto done; /* stupid C language */
- }
- }
- /*
- * Hmm, we have a hidden superclass (such as in core in R4); just
- * ignore it and keep on walking
- */
- superclass = superclass->core_class.superclass;
- }
- done:
- if (wn->superclass) {
- wn->siblings = wn->superclass->children;
- wn->superclass->children = wn;
- }
- }
-
- return;
-}
-
-
-void
-XmuWnFetchResources(XmuWidgetNode *node, Widget toplevel,
- XmuWidgetNode *topnode)
-{
- Widget dummy;
- XmuWidgetNode *wn;
-
- if (node->have_resources) return;
-
- dummy = XtCreateWidget (node->label, XmuWnClass(node), toplevel,
- NULL, ZERO);
- if (dummy) XtDestroyWidget (dummy);
-
-
- /*
- * walk up tree geting resources; since we've instantiated the widget,
- * we know that all of our superclasses have been initialized
- */
- for (wn = node; wn && !wn->have_resources; wn = wn->superclass) {
- XtGetResourceList (XmuWnClass(wn), &wn->resources, &wn->nresources);
- if (wn->resources) {
- qsort ((char *) wn->resources, wn->nresources,
- sizeof(XtResource), compare_resource_entries);
- }
- wn->resourcewn = (XmuWidgetNode **) XtCalloc (wn->nresources,
- sizeof (XmuWidgetNode *));
- if (!wn->resourcewn) {
- fprintf (stderr,
- "%s: unable to calloc %d %d byte widget node ptrs\n",
- "XmuWnFetchResources",wn->nresources,
- sizeof (XmuWidgetNode *));
- exit (1);
- }
-
- XtGetConstraintResourceList (XmuWnClass(wn), &wn->constraints,
- &wn->nconstraints);
- if (wn->constraints) {
- qsort ((char *) wn->constraints, wn->nconstraints,
- sizeof(XtResource), compare_resource_entries);
- }
- wn->constraintwn = (XmuWidgetNode **)
- XtCalloc (wn->nconstraints, sizeof (XmuWidgetNode *));
- if (!wn->constraintwn) {
- fprintf (stderr,
- "%s: unable to calloc %d %d byte widget node ptrs\n",
- "XmuWnFetchResources", wn->nconstraints,
- sizeof (XmuWidgetNode *));
- exit (1);
- }
-
- wn->have_resources = True;
- if (wn == topnode) break;
- }
-
-
- /*
- * Walk up tree removing all resources that appear in superclass; we can
- * mash the resource list in place since it was copied out of widget.
- */
- for (wn = node; wn; wn = wn->superclass) {
- mark_resource_owner (wn);
- if (wn == topnode) break;
- }
-
- return;
-}
-
-
-int
-XmuWnCountOwnedResources(XmuWidgetNode *node, XmuWidgetNode *ownernode,
- Bool cons)
-{
- register int i;
- XmuWidgetNode **wn = (cons ? node->constraintwn : node->resourcewn);
- int nmatches = 0;
-
- for (i = (cons ? node->nconstraints : node->nresources); i > 0; i--, wn++)
- if (*wn == ownernode) nmatches++;
- return nmatches;
-}
-
-
-XmuWidgetNode *
-XmuWnNameToNode(XmuWidgetNode *nodelist, int nnodes, _Xconst char *name)
-{
- int i;
- XmuWidgetNode *wn;
- char tmp[1024];
-
- XmuNCopyISOLatin1Lowered(tmp, name, sizeof(tmp));
- for (i = 0, wn = nodelist; i < nnodes; i++, wn++) {
- if (strcmp (tmp, wn->lowered_label) == 0 ||
- strcmp (tmp, wn->lowered_classname) == 0) {
- return wn;
- }
- }
- return NULL;
-}
diff --git a/xc/lib/Xmu/WidgetNode.h b/xc/lib/Xmu/WidgetNode.h
deleted file mode 100644
index 232b2025b..000000000
--- a/xc/lib/Xmu/WidgetNode.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $TOG: WidgetNode.h /main/9 1998/02/06 15:46:39 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/WidgetNode.h,v 1.4 1998/10/03 09:06:37 dawes Exp $ */
-
-/*
- * Author: Jim Fulton, MIT X Consortium
- */
-
-#ifndef _XmuWidgetNode_h
-#define _XmuWidgetNode_h
-
-#include <X11/Xfuncproto.h>
-
-/*
- * This is usually initialized by setting the first two fields and letting
- * rest be implicitly nulled (by genlist.sh, for example)
- */
-typedef struct _XmuWidgetNode {
- char *label; /* mixed case name */
- WidgetClass *widget_class_ptr; /* addr of widget class */
- struct _XmuWidgetNode *superclass; /* superclass of widget_class */
- struct _XmuWidgetNode *children, *siblings; /* subclass links */
- char *lowered_label; /* lowercase version of label */
- char *lowered_classname; /* lowercase version of class_name */
- Bool have_resources; /* resources have been fetched */
- XtResourceList resources; /* extracted resource database */
- struct _XmuWidgetNode **resourcewn; /* where resources come from */
- Cardinal nresources; /* number of resources */
- XtResourceList constraints; /* extracted constraint resources */
- struct _XmuWidgetNode **constraintwn; /* where constraints come from */
- Cardinal nconstraints; /* number of constraint resources */
- XtPointer data; /* extra data */
-} XmuWidgetNode;
-
-#define XmuWnClass(wn) ((wn)->widget_class_ptr[0])
-#define XmuWnClassname(wn) (XmuWnClass(wn)->core_class.class_name)
-#define XmuWnSuperclass(wn) ((XmuWnClass(wn))->core_class.superclass)
-
- /* external interfaces */
-_XFUNCPROTOBEGIN
-
-void XmuWnInitializeNodes
-(
- XmuWidgetNode *nodearray,
- int nnodes
- );
-
-void XmuWnFetchResources
-(
- XmuWidgetNode *node,
- Widget toplevel,
- XmuWidgetNode *topnode
- );
-
-int XmuWnCountOwnedResources
-(
- XmuWidgetNode *node,
- XmuWidgetNode *ownernode,
- Bool constraints
- );
-
-XmuWidgetNode *XmuWnNameToNode
-(
- XmuWidgetNode *nodelist,
- int nnodes,
- _Xconst char *name
- );
-
-_XFUNCPROTOEND
-
-#endif /* _XmuWidgetNode_h */
-
diff --git a/xc/lib/Xmu/WinUtil.h b/xc/lib/Xmu/WinUtil.h
deleted file mode 100644
index 5ea10e66d..000000000
--- a/xc/lib/Xmu/WinUtil.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $TOG: WinUtil.h /main/8 1998/02/06 15:46: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/WinUtil.h,v 1.5 1998/10/03 09:06:38 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_WINDOWUTIL_H_
-#define _XMU_WINDOWUTIL_H_
-
-#include <X11/Xutil.h>
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-Window XmuClientWindow
-(
- Display *dpy,
- Window win
- );
-
-Bool XmuUpdateMapHints
-(
- Display *dpy,
- Window win,
- XSizeHints *hints
- );
-
-Screen *XmuScreenOfWindow
-(
- Display *dpy,
- Window w
-);
-
-_XFUNCPROTOEND
-
-#endif /* _XMU_WINDOWUTIL_H_ */
diff --git a/xc/lib/Xmu/Xct.c b/xc/lib/Xmu/Xct.c
deleted file mode 100644
index 6cec0db2e..000000000
--- a/xc/lib/Xmu/Xct.c
+++ /dev/null
@@ -1,685 +0,0 @@
-/* $TOG: Xct.c /main/21 1998/02/06 15:46: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Xct.c,v 1.6 1999/03/21 07:34:39 dawes Exp $ */
-
-#include <X11/Xfuncs.h>
-#include "Xct.h"
-#include <stdio.h>
-
-#define UsedGraphic 0x0001
-#define UsedDirection 0x0002
-
-typedef struct _XctPriv {
- XctString ptr;
- XctString ptrend;
- unsigned flags;
- XctHDirection *dirstack;
- unsigned dirsize;
- char **encodings;
- unsigned enc_count;
- XctString itembuf;
- unsigned buf_count;
-} *XctPriv;
-
-#define IsMore(priv) ((priv)->ptr != (priv)->ptrend)
-#define AmountLeft(priv) ((priv)->ptrend - (priv)->ptr)
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern char *malloc();
-extern char *realloc();
-#endif
-
-#define HT 0x09
-#define NL 0x0a
-#define ESC 0x1b
-#define CSI 0x9b
-
-#define IsLegalC0(data, c) (((c) == HT) || ((c) == NL) || \
- (((data)->version > XctVersion) && \
- ((data)->flags & XctAcceptC0Extensions)))
-
-#define IsLegalC1(priv, c) (((data)->version > XctVersion) && \
- ((data)->flags & XctAcceptC1Extensions))
-
-#define IsI2(c) (((c) >= 0x20) && ((c) <= 0x2f))
-#define IsI3(c) (((c) >= 0x30) && ((c) <= 0x3f))
-#define IsESCF(c) (((c) >= 0x30) && ((c) <= 0x7e))
-#define IsCSIF(c) (((c) >= 0x40) && ((c) <= 0x7e))
-#define IsC0(c) ((c) <= 0x1f)
-#define IsGL(c) (((c) >= 0x20) && ((c) <= 0x7f))
-#define IsC1(c) (((c) >= 0x80) && ((c) <= 0x9f))
-#define IsGR(c) ((c) >= 0xa0)
-
-#define HasC 1
-#define HasGL 2
-#define HasGR 4
-#define ToGL 8
-
-/*
- * Prototypes
- */
-static void ComputeGLGR(XctData);
-static int Handle94GR(XctData, int);
-static int Handle96GR(XctData, int);
-static int HandleExtended(XctData data, int);
-static int HandleGL(XctData, int);
-static int HandleMultiGL(XctData, int);
-static int HandleMultiGR(XctData data, int);
-static void ShiftGRToGL(XctData, int);
-
-/*
- * Implementation
- */
-static void
-ComputeGLGR(register XctData data)
-{
- /* XXX this will need more work if more sets are registered */
- if ((data->GL_set_size == 94) && (data->GL_char_size == 1) &&
- (data->GL[0] == '\102') &&
- (data->GR_set_size == 96) && (data->GR_char_size == 1))
- data->GLGR_encoding = data->GR_encoding;
- else if ((data->GL_set_size == 94) && (data->GL_char_size == 1) &&
- (data->GL[0] == '\112') &&
- (data->GR_set_size == 94) && (data->GR_char_size == 1))
- data->GLGR_encoding = data->GR_encoding;
- else
- data->GLGR_encoding = (char *)NULL;
-}
-
-static int
-HandleGL(register XctData data, int c)
-{
- switch (c) {
- case 0x42:
- data->GL = "\102";
- data->GL_encoding = "ISO8859-1";
- break;
- case 0x4a:
- data->GL = "\112";
- data->GL_encoding = "JISX0201.1976-0";
- break;
- default:
- return 0;
- }
- data->GL_set_size = 94;
- data->GL_char_size = 1;
- ComputeGLGR(data);
- return 1;
-}
-
-static int
-HandleMultiGL(register XctData data, int c)
-{
- switch (c) {
- case 0x41:
- data->GL = "\101";
- data->GL_encoding = "GB2312.1980-0";
- break;
- case 0x42:
- data->GL = "\102";
- data->GL_encoding = "JISX0208.1983-0";
- break;
- case 0x43:
- data->GL = "\103";
- data->GL_encoding = "KSC5601.1987-0";
- break;
- default:
- return 0;
- }
- data->GL_set_size = 94;
- data->GL_char_size = 2;
-#ifdef notdef
- if (c < 0x60)
- data->GL_char_size = 2;
- else if (c < 0x70)
- data->GL_char_size = 3;
- else
- data->GL_char_size = 4;
-#endif
- data->GLGR_encoding = (char *)NULL;
- return 1;
-}
-
-static int
-Handle94GR(register XctData data, int c)
-{
- switch (c) {
- case 0x49:
- data->GR = "\111";
- data->GR_encoding = "JISX0201.1976-0";
- break;
- default:
- return 0;
- }
- data->priv->flags &= ~ToGL;
- data->GR_set_size = 94;
- data->GR_char_size = 1;
- data->GLGR_encoding = (char *)NULL;
- return 1;
-}
-
-static int
-Handle96GR(register XctData data, int c)
-{
- switch (c) {
- case 0x41:
- data->GR = "\101";
- data->GR_encoding = "ISO8859-1";
- break;
- case 0x42:
- data->GR = "\102";
- data->GR_encoding = "ISO8859-2";
- break;
- case 0x43:
- data->GR = "\103";
- data->GR_encoding = "ISO8859-3";
- break;
- case 0x44:
- data->GR = "\104";
- data->GR_encoding = "ISO8859-4";
- break;
- case 0x46:
- data->GR = "\106";
- data->GR_encoding = "ISO8859-7";
- break;
- case 0x47:
- data->GR = "\107";
- data->GR_encoding = "ISO8859-6";
- break;
- case 0x48:
- data->GR = "\110";
- data->GR_encoding = "ISO8859-8";
- break;
- case 0x4c:
- data->GR = "\114";
- data->GR_encoding = "ISO8859-5";
- break;
- case 0x4d:
- data->GR = "\115";
- data->GR_encoding = "ISO8859-9";
- break;
- default:
- return 0;
- }
- data->priv->flags &= ~ToGL;
- data->GR_set_size = 96;
- data->GR_char_size = 1;
- ComputeGLGR(data);
- return 1;
-}
-
-static int
-HandleMultiGR(register XctData data, int c)
-{
- switch (c) {
- case 0x41:
- data->GR = "\101";
- if (data->flags & XctShiftMultiGRToGL)
- data->GR_encoding = "GB2312.1980-0";
- else
- data->GR_encoding = "GB2312.1980-1";
- break;
- case 0x42:
- data->GR = "\102";
- if (data->flags & XctShiftMultiGRToGL)
- data->GR_encoding = "JISX0208.1983-0";
- else
- data->GR_encoding = "JISX0208.1983-1";
- break;
- case 0x43:
- data->GR = "\103";
- if (data->flags & XctShiftMultiGRToGL)
- data->GR_encoding = "KSC5601.1987-0";
- else
- data->GR_encoding = "KSC5601.1987-1";
- break;
- default:
- return 0;
- }
- if (data->flags & XctShiftMultiGRToGL)
- data->priv->flags |= ToGL;
- else
- data->priv->flags &= ~ToGL;
- data->GR_set_size = 94;
- data->GR_char_size = 2;
-#ifdef notdef
- if (c < 0x60)
- data->GR_char_size = 2;
- else if (c < 0x70)
- data->GR_char_size = 3;
- else
- data->GR_char_size = 4;
-#endif
- data->GLGR_encoding = (char *)NULL;
- return 1;
-}
-
-static int
-HandleExtended(register XctData data, int c)
-{
- register XctPriv priv = data->priv;
- XctString enc = data->item + 6;
- register XctString ptr = enc;
- unsigned i, len;
-
- while (*ptr != 0x02) {
- if (!*ptr || (++ptr == priv->ptr))
- return 0;
- }
- data->item = ptr + 1;
- data->item_length = priv->ptr - data->item;
- len = ptr - enc;
- for (i = 0;
- (i < priv->enc_count) &&
- strncmp(priv->encodings[i], (char *)enc, len);
- i++)
- ;
- if (i == priv->enc_count) {
- XctString cp;
-
- for (cp = enc; cp != ptr; cp++) {
- if ((!IsGL(*cp) && !IsGR(*cp)) || (*cp == 0x2a) || (*cp == 0x3f))
- return 0;
- }
- ptr = (XctString)malloc((unsigned)len + 1);
- (void) memmove((char *)ptr, (char *)enc, len);
- ptr[len] = 0x00;
- priv->enc_count++;
- if (priv->encodings)
- priv->encodings = (char **)realloc(
- (char *)priv->encodings,
- priv->enc_count * sizeof(char *));
- else
- priv->encodings = (char **)malloc(sizeof(char *));
- priv->encodings[i] = (char *)ptr;
- }
- data->encoding = priv->encodings[i];
- data->char_size = c - 0x30;
- return 1;
-}
-
-static void
-ShiftGRToGL(register XctData data, int hasCdata)
-{
- register XctPriv priv = data->priv;
- register int i;
-
- if (data->item_length > priv->buf_count) {
- priv->buf_count = data->item_length;
- if (priv->itembuf)
- priv->itembuf = (XctString)realloc((char *)priv->itembuf,
- priv->buf_count);
- else
- priv->itembuf = (XctString)malloc(priv->buf_count);
- }
- (void) memmove((char *)priv->itembuf, (char *)data->item,
- data->item_length);
- data->item = priv->itembuf;
- if (hasCdata) {
- for (i = data->item_length; --i >= 0; ) {
- if (IsGR(data->item[i]))
- data->item[i] &= 0x7f;
- }
- } else {
- for (i = data->item_length; --i >= 0; )
- data->item[i] &= 0x7f;
- }
-}
-
-/* Create an XctData structure for parsing a Compound Text string. */
-XctData
-XctCreate(_Xconst unsigned char *string, int length, XctFlags flags)
-{
- register XctData data;
- register XctPriv priv;
-
- data = (XctData)malloc(sizeof(struct _XctRec) + sizeof(struct _XctPriv));
- if (!data)
- return data;
- data->priv = priv = (XctPriv)(data + 1);
- data->total_string = (XctString)string;
- data->total_length = length;
- data->flags = flags;
- priv->dirstack = (XctHDirection *)NULL;
- priv->dirsize = 0;
- priv->encodings = (char **)NULL;
- priv->enc_count = 0;
- priv->itembuf = (XctString)NULL;
- priv->buf_count = 0;
- XctReset(data);
- return data;
-}
-
-/* Reset the XctData structure to re-parse the string from the beginning. */
-void
-XctReset(register XctData data)
-{
- register XctPriv priv = data->priv;
-
- priv->ptr = data->total_string;
- priv->ptrend = data->total_string + data->total_length;
- data->item = (XctString)NULL;
- data->item_length = 0;
- data->encoding = (char *)NULL;
- data->char_size = 1;
- data->horizontal = XctUnspecified;
- data->horz_depth = 0;
- priv->flags = 0;
- data->GL_set_size = data->GR_set_size = 0; /* XXX */
- (void)HandleGL(data, (unsigned char)0x42);
- (void)Handle96GR(data, (unsigned char)0x41);
- data->version = 1;
- data->can_ignore_exts = 0;
- /* parse version, if present */
- if ((data->total_length >= 4) &&
- (priv->ptr[0] == ESC) && (priv->ptr[1] == 0x23) &&
- IsI2(priv->ptr[2]) &&
- ((priv->ptr[3] == 0x30) || (priv->ptr[3] == 0x31))) {
- data->version = priv->ptr[2] - 0x1f;
- if (priv->ptr[3] == 0x30)
- data->can_ignore_exts = 1;
- priv->ptr += 4;
- }
-}
-
-/* Parse the next "item" from the Compound Text string. The return value
- * indicates what kind of item is returned. The item itself, and the current
- * contextual state, are reported as components of the XctData structure.
- */
-XctResult
-XctNextItem(register XctData data)
-{
- register XctPriv priv = data->priv;
- unsigned char c;
- int len, bits;
-
-#define NEXT data->item_length++; priv->ptr++
-
- while (IsMore(priv)) {
- data->item = priv->ptr;
- data->item_length = 0;
- c = *priv->ptr;
- if (c == ESC) {
- NEXT;
- while (IsMore(priv) && IsI2(*priv->ptr)) {
- NEXT;
- }
- if (!IsMore(priv))
- return XctError;
- c = *priv->ptr;
- NEXT;
- if (!IsESCF(c))
- return XctError;
- switch (data->item[1]) {
- case 0x24:
- if (data->item_length > 3) {
- if (data->item[2] == 0x28) {
- if (HandleMultiGL(data, c))
- continue;
- } else if (data->item[2] == 0x29) {
- if (HandleMultiGR(data, c))
- continue;
- }
- }
- break;
- case 0x25:
- if ((data->item_length == 4) && (data->item[2] == 0x2f) &&
- (c <= 0x3f)) {
- if ((AmountLeft(priv) < 2) ||
- (priv->ptr[0] < 0x80) || (priv->ptr[1] < 0x80))
- return XctError;
- len = *priv->ptr - 0x80;
- NEXT;
- len = (len << 7) + (*priv->ptr - 0x80);
- NEXT;
- if (AmountLeft(priv) < len)
- return XctError;
- data->item_length += len;
- priv->ptr += len;
- if (c <= 0x34) {
- if (!HandleExtended(data, c) ||
- ((data->horz_depth == 0) &&
- (priv->flags & UsedDirection)))
- return XctError;
- priv->flags |= UsedGraphic;
- return XctExtendedSegment;
- }
- }
- break;
- case 0x28:
- if (HandleGL(data, c))
- continue;
- break;
- case 0x29:
- if (Handle94GR(data, c))
- continue;
- break;
- case 0x2d:
- if (Handle96GR(data, c))
- continue;
- break;
- }
- } else if (c == CSI) {
- NEXT;
- while (IsMore(priv) && IsI3(*priv->ptr)) {
- NEXT;
- }
- while (IsMore(priv) && IsI2(*priv->ptr)) {
- NEXT;
- }
- if (!IsMore(priv))
- return XctError;
- c = *priv->ptr;
- NEXT;
- if (!IsCSIF(c))
- return XctError;
- if (c == 0x5d) {
- if ((data->item_length == 3) &&
- ((data->item[1] == 0x31) || (data->item[1] == 0x32))) {
- data->horz_depth++;
- if (priv->dirsize < data->horz_depth) {
- priv->dirsize += 10;
- if (priv->dirstack)
- priv->dirstack = (XctHDirection *)
- realloc((char *)priv->dirstack,
- priv->dirsize *
- sizeof(XctHDirection));
- else
- priv->dirstack = (XctHDirection *)
- malloc(priv->dirsize *
- sizeof(XctHDirection));
- }
- priv->dirstack[data->horz_depth - 1] = data->horizontal;
- if (data->item[1] == 0x31)
- data->horizontal = XctLeftToRight;
- else
- data->horizontal = XctRightToLeft;
- if ((priv->flags & UsedGraphic) &&
- !(priv->flags & UsedDirection))
- return XctError;
- priv->flags |= UsedDirection;
- if (data->flags & XctHideDirection)
- continue;
- return XctHorizontal;
- } else if (data->item_length == 2) {
- if (!data->horz_depth)
- return XctError;
- data->horz_depth--;
- data->horizontal = priv->dirstack[data->horz_depth];
- if (data->flags & XctHideDirection)
- continue;
- return XctHorizontal;
- }
- }
- } else if (data->flags & XctSingleSetSegments) {
- NEXT;
- if IsC0(c) {
- data->encoding = (char *)NULL;
- data->char_size = 1;
- if (IsLegalC0(data, c))
- return XctC0Segment;
- } else if (IsGL(c)) {
- data->encoding = data->GL_encoding;
- data->char_size = data->GL_char_size;
- while (IsMore(priv) && IsGL(*priv->ptr)) {
- NEXT;
- }
- if (((data->char_size > 1) &&
- (data->item_length % data->char_size)) ||
- ((data->horz_depth == 0) &&
- (priv->flags & UsedDirection)))
- return XctError;
- priv->flags |= UsedGraphic;
- return XctGLSegment;
- } else if (IsC1(c)) {
- data->encoding = (char *)NULL;
- data->char_size = 1;
- if (IsLegalC1(data, c))
- return XctC1Segment;
- } else {
- data->encoding = data->GR_encoding;
- data->char_size = data->GR_char_size;
- while (IsMore(priv) && IsGR(*priv->ptr)) {
- NEXT;
- }
- if (((data->char_size > 1) &&
- (data->item_length % data->char_size)) ||
- ((data->horz_depth == 0) &&
- (priv->flags & UsedDirection)))
- return XctError;
- priv->flags |= UsedGraphic;
- if (!(priv->flags & ToGL))
- return XctGRSegment;
- ShiftGRToGL(data, 0);
- return XctGLSegment;
- }
- } else {
- bits = 0;
- while (1) {
- if (IsC0(c) || IsC1(c)) {
- if ((c == ESC) || (c == CSI))
- break;
- if (IsC0(c) ? !IsLegalC0(data, c) : !IsLegalC1(data, c))
- break;
- bits |= HasC;
- NEXT;
- } else {
- len = data->item_length;
- if (IsGL(c)) {
- if ((data->flags & XctShiftMultiGRToGL) &&
- (bits & HasGR))
- break;
- NEXT;
- bits |= HasGL;
- while (IsMore(priv) && IsGL(*priv->ptr)) {
- NEXT;
- }
- if ((data->GL_char_size > 1) &&
- ((data->item_length - len) % data->GL_char_size))
- return XctError;
- } else {
- if ((data->flags & XctShiftMultiGRToGL) &&
- (bits & HasGL))
- break;
- NEXT;
- bits |= HasGR;
- while (IsMore(priv) && IsGR(*priv->ptr)) {
- NEXT;
- }
- if ((data->GR_char_size > 1) &&
- ((data->item_length - len) % data->GR_char_size))
- return XctError;
- }
- }
- if (!IsMore(priv))
- break;
- c = *priv->ptr;
- }
- if (data->item_length) {
- if (bits & (HasGL|HasGR)) {
- priv->flags |= UsedGraphic;
- if ((data->horz_depth == 0) &&
- (priv->flags & UsedDirection))
- return XctError;
- if ((data->flags & XctShiftMultiGRToGL) && (bits & HasGR))
- ShiftGRToGL(data, bits & HasC);
- }
- if ((bits == (HasGL|HasGR)) ||
- (data->GLGR_encoding && !(bits & HasC))) {
- data->encoding = data->GLGR_encoding;
- if (data->GL_char_size == data->GR_char_size)
- data->char_size = data->GL_char_size;
- else
- data->char_size = 0;
- } else if (bits == HasGL) {
- data->encoding = data->GL_encoding;
- data->char_size = data->GL_char_size;
- } else if (bits == HasGR) {
- data->encoding = data->GR_encoding;
- data->char_size = data->GR_char_size;
- } else {
- data->encoding = (char *)NULL;
- data->char_size = 1;
- if ((bits & HasGL) &&
- (data->GL_char_size != data->char_size))
- data->char_size = 0;
- if ((bits & HasGR) &&
- (data->GR_char_size != data->char_size))
- data->char_size = 0;
- }
- return XctSegment;
- }
- NEXT;
- }
- if (data->version <= XctVersion)
- return XctError;
- if (data->flags & XctProvideExtensions)
- return XctExtension;
- if (!data->can_ignore_exts)
- return XctError;
- }
- return XctEndOfText;
-}
-
-/* Free all data associated with an XctDataStructure. */
-void
-XctFree(register XctData data)
-{
- unsigned i;
- register XctPriv priv = data->priv;
-
- if (priv->dirstack)
- free((char *)priv->dirstack);
- if (data->flags & XctFreeString)
- free((char *)data->total_string);
- for (i = 0; i < priv->enc_count; i++)
- free(priv->encodings[i]);
- if (priv->encodings)
- free((char *)priv->encodings);
- if (priv->itembuf)
- free((char *)priv->itembuf);
- free((char *)data);
-}
diff --git a/xc/lib/Xmu/Xct.h b/xc/lib/Xmu/Xct.h
deleted file mode 100644
index 8e22db01e..000000000
--- a/xc/lib/Xmu/Xct.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $TOG: Xct.h /main/9 1998/02/06 15:46: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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Xct.h,v 1.5 1999/03/21 07:34:39 dawes Exp $ */
-
-#ifndef _Xct_h
-#define _Xct_h
-
-#include <X11/Xfuncproto.h>
-
-#define XctVersion 1
-
-typedef unsigned char *XctString;
-
-typedef enum {
- XctUnspecified,
- XctLeftToRight,
- XctRightToLeft
-} XctHDirection;
-
-typedef unsigned long XctFlags;
-
-/* These are bits in XctFlags. */
-
-#define XctSingleSetSegments 0x0001
- /* This means that returned segments should contain characters from only
- * one set (C0, C1, GL, GR). When this is requested, XctSegment is never
- * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
- * XctGRSegment are returned. C0 and C1 segments are always returned as
- * singleton characters.
- */
-
-#define XctProvideExtensions 0x0002
- /* This means that if the Compound Text string is from a higher version
- * than this code is implemented to, then syntactically correct but unknown
- * control sequences should be returned as XctExtension items. If this
- * flag is not set, and the Compound Text string version indicates that
- * extensions cannot be ignored, then each unknown control sequence will be
- * reported as an XctError.
- */
-
-#define XctAcceptC0Extensions 0x0004
- /* This means that if the Compound Text string is from a higher version
- * than this code is implemented to, then unknown C0 characters should be
- * treated as if they were legal, and returned as C0 characters (regardless
- * of how XctProvideExtensions is set). If this flag is not set, then all
- * unknown C0 characters are treated according to XctProvideExtensions.
- */
-
-#define XctAcceptC1Extensions 0x0008
- /* This means that if the Compound Text string is from a higher version
- * than this code is implemented to, then unknown C0 characters should be
- * treated as if they were legal, and returned as C0 characters (regardless
- * of how XctProvideExtensions is set). If this flag is not set, then all
- * unknown C0 characters are treated according to XctProvideExtensions.
- */
-
-#define XctHideDirection 0x0010
- /* This means that horizontal direction changes should be reported as
- * XctHorizontal items. If this flag is not set, then direction changes are
- * not returned as items, but the current direction is still maintained and
- * reported for other items.
- */
-
-#define XctFreeString 0x0020
- /* This means that XctFree should free the Compound Text string (that was
- * passed to XctCreate. If this flag is not set, the string is not freed.
- */
-
-#define XctShiftMultiGRToGL 0x0040
- /* Translate GR segments on-the-fly into GL segments for the GR sets:
- * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
- */
-
-/* This is the return type for XctNextItem. */
-typedef enum {
- XctSegment, /* used when XctSingleSetSegments is not requested */
- XctC0Segment, /* used when XctSingleSetSegments is requested */
- XctGLSegment, /* used when XctSingleSetSegments is requested */
- XctC1Segment, /* used when XctSingleSetSegments is requested */
- XctGRSegment, /* used when XctSingleSetSegments is requested */
- XctExtendedSegment, /* an extended segment */
- XctExtension, /* used when XctProvideExtensions is requested */
- XctHorizontal, /* horizontal direction or depth change */
- XctEndOfText, /* end of text string */
- XctError /* syntactic or semantic error */
-} XctResult;
-
-typedef struct _XctRec {
- XctString total_string; /* as given to XctCreate */
- int total_length; /* as given to XctCreate */
- XctFlags flags; /* as given to XctCreate */
- int version; /* indicates the version of the CT spec
- * the string was produced from */
- int can_ignore_exts;/* non-zero if ignoring extensions is
- * acceptable, else zero */
- XctString item; /* item returned from XctNextItem */
- unsigned item_length; /* length of item in bytes */
- int char_size; /* number of bytes per character in
- * item, with zero meaning variable */
- char *encoding; /* Encoding name for item */
- XctHDirection horizontal; /* direction of item */
- unsigned horz_depth; /* current direction nesting depth */
- char *GL; /* "{I} F" string for current GL */
- char *GL_encoding; /* Encoding name for current GL */
- int GL_set_size; /* 94 or 96 */
- int GL_char_size; /* number of bytes per GL character */
- char *GR; /* "{I} F" string for current GR */
- char *GR_encoding; /* Encoding name for current GR */
- int GR_set_size; /* 94 or 96 */
- int GR_char_size; /* number of bytes per GR character */
- char *GLGR_encoding; /* Encoding name for current GL+GR,
- * if known */
- struct _XctPriv *priv; /* private to parser, don't peek */
-} *XctData;
-
-/* these are the external routines */
-_XFUNCPROTOBEGIN
-
-XctData XctCreate
-(
- _Xconst unsigned char *string,
- int length,
- XctFlags flags
-);
-
-XctResult XctNextItem
-(
- XctData data
-);
-
-void XctFree
-(
- XctData data
- );
-
-void XctReset
-(
- XctData data
- );
-
-_XFUNCPROTOEND
-
-#endif /* _Xct_h */
diff --git a/xc/lib/Xmu/Xmu-def.cpp b/xc/lib/Xmu/Xmu-def.cpp
deleted file mode 100644
index 9e2c9d177..000000000
--- a/xc/lib/Xmu/Xmu-def.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-LIBRARY libXmu
-VERSION LIBRARY_VERSION
-EXPORTS
-XmuAllStandardColormaps
-XmuGetAtomName
-XmuInternAtom
-XmuInternStrings
-XmuMakeAtom
-XmuNameOfAtom
-XmuClientWindow
-XmuAddCloseDisplayHook
-XmuLookupCloseDisplayHook
-XmuRemoveCloseDisplayHook
-XmuGetColormapAllocation
-XmuCreateColormap
-XmuCreatePixmapFromBitmap
-XmuCursorNameToIndex
-_XmuCCLookupDisplay
-XmuConvertStandardSelection
-XmuPrintDefaultErrorMessage
-XmuSimpleErrorHandler
-XmuDeleteStandardColormap
-XmuDQAddDisplay
-XmuDQCreate
-XmuDQDestroy
-XmuDQLookupDisplay
-XmuDQRemoveDisplay
-XmuDistinguishableColors
-XmuDistinguishablePixels
-XmuDrawLogo
-XmuDrawRoundedRectangle
-XmuFillRoundedRectangle
-_XEditResCheckMessages
-_XEditResGet16
-_XEditResGet32
-_XEditResGet8
-_XEditResGetSigned16
-_XEditResGetString8
-_XEditResGetWidgetInfo
-_XEditResPut16
-_XEditResPut32
-_XEditResPut8
-_XEditResPutString8
-_XEditResPutWidgetInfo
-_XEditResResetStream
-XmuRegisterExternalAgent
-XmuCvtFunctionToCallback
-XmuGetHostname
-XmuCreateStippledPixmap
-XmuReleaseStippledPixmap
-XmuAddInitializer
-XmuCallInitializers
-XmuLocateBitmapFile
-XmuLocatePixmapFile
-_XmuStringToBitmapFreeCache
-_XmuStringToBitmapInitCache
-XmuLookupAPL
-XmuLookupArabic
-XmuLookupCyrillic
-XmuLookupGreek
-XmuLookupHebrew
-XmuLookupJISX0201
-XmuLookupKana
-XmuLookupLatin1
-XmuLookupLatin2
-XmuLookupLatin3
-XmuLookupLatin4
-XmuLookupString
-XmuLookupStandardColormap
-XmuCompareISOLatin1
-XmuCopyISOLatin1Lowered
-XmuCopyISOLatin1Uppered
-XmuReadBitmapData
-XmuReadBitmapDataFromFile
-XmuScreenOfWindow
-XmuReshapeWidget
-XmuStandardColormap
-XmuCvtStringToBackingStore
-XmuCvtStringToBitmap
-XmuCvtStringToColorCursor
-XmuCvtStringToCursor
-XmuCvtStringToGravity
-XmuCvtStringToJustify
-XmuCvtStringToLong
-XmuCvtStringToOrientation
-XmuCvtStringToShapeStyle
-XmuCvtStringToWidget
-XmuNewCvtStringToWidget
-XmuUpdateMapHints
-XmuVisualStandardColormaps
-XmuWnCountOwnedResources
-XmuWnFetchResources
-XmuWnInitializeNodes
-XmuWnNameToNode
-XctCreate
-XctFree
-XctNextItem
-XctReset
-
-/* $XFree86: xc/lib/Xmu/Xmu-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */
diff --git a/xc/lib/Xmu/Xmu.h b/xc/lib/Xmu/Xmu.h
deleted file mode 100644
index 8fe0764df..000000000
--- a/xc/lib/Xmu/Xmu.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* $TOG: Xmu.h /main/28 1998/02/06 15:47:00 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.
-
-*/
-/* $XFree86: xc/lib/Xmu/Xmu.h,v 1.5 1998/10/03 09:06:39 dawes Exp $ */
-
-/*
- * The interfaces described by this header file are for miscellaneous utilities
- * and are not part of the Xlib standard.
- */
-
-#ifndef _XMU_H_
-#define _XMU_H_
-
-#include <X11/Intrinsic.h>
-#include <X11/Xmu/Atoms.h> /* _XA_... */
-#include <X11/Xmu/CharSet.h> /* CopyISOLatin1Lowered */
-#include <X11/Xmu/Converters.h> /* CvtStringTo... */
-#include <X11/Xmu/Drawing.h> /* DrawRoundedRect, DrawLogo */
-#include <X11/Xmu/Error.h> /* PrintDefaultError */
-#include <X11/Xmu/StdSel.h> /* ConvertStandardSelection */
-
-/*
- * clip lists
- */
-typedef struct _XmuSegment {
- int x1, x2;
- struct _XmuSegment *next;
-} XmuSegment;
-
-typedef struct _XmuScanline {
- int y;
- XmuSegment *segment;
- struct _XmuScanline *next;
-} XmuScanline;
-
-typedef struct _XmuArea {
- XmuScanline *scanline;
-} XmuArea;
-
-#define XmuCreateArea() XmuNewArea(0, 0, 0, 0)
-#define XmuAreaOr(dst, src) XmuAreaOrXor((dst), (src), True)
-#define XmuAreaXor(dst, src) XmuAreaOrXor((dst), (src), False)
-
-#define XmuDestroyArea(a) \
- do { \
- XmuDestroyScanlineList((a)->scanline); \
- XtFree((char *)(a)); \
- } while (0)
-
-#define FreeArea(a) \
- do { \
- XmuDestroyScanlineList((a)->scanline); \
- a->scanline = (Scanline *)0; \
- } while (0)
-
-#define XmuValidSegment(s) ((s)->x1 < (s)->x2)
-#define XmuSegmentEqu(s1, s2) ((s1)->x1 == (s2)->x1 && (s1)->x2 == (s2)->x2)
-#define XmuDestroySegment(s) XtFree((char *)(s))
-
-#define XmuDestroyScanline(s) \
- do { \
- XmuDestroySegmentList((s)->segment); \
- XtFree((char*)(s)); \
- } while (0)
-
-XmuArea *XmuNewArea(int, int, int, int);
-XmuArea *XmuAreaDup(XmuArea*);
-XmuArea *XmuAreaCopy(XmuArea*, XmuArea*);
-XmuArea *XmuAreaNot(XmuArea*, int, int, int, int);
-XmuArea *XmuAreaOrXor(XmuArea*, XmuArea*, Bool);
-XmuArea *XmuAreaAnd(XmuArea*, XmuArea*);
-Bool XmuValidArea(XmuArea*);
-Bool XmuValidScanline(XmuScanline*);
-Bool XmuScanlineEqu(XmuScanline*, XmuScanline*);
-XmuSegment *XmuNewSegment(int, int);
-void XmuDestroySegmentList(XmuSegment*);
-XmuScanline *XmuScanlineCopy(XmuScanline*, XmuScanline*);
-Bool XmuAppendSegment(XmuSegment*, XmuSegment*);
-XmuScanline *XmuOptimizeScanline(XmuScanline*);
-XmuScanline *XmuScanlineNot(XmuScanline *scanline, int, int);
-XmuScanline *XmuScanlineOr(XmuScanline*, XmuScanline*);
-XmuScanline *XmuScanlineAnd(XmuScanline*, XmuScanline*);
-XmuScanline *XmuScanlineXor(XmuScanline*, XmuScanline*);
-XmuScanline *XmuNewScanline(int, int, int);
-void XmuDestroyScanlineList(XmuScanline*);
-XmuArea *XmuOptimizeArea(XmuArea *area);
-
-#ifndef notdef
-XmuScanline *XmuScanlineOrSegment(XmuScanline*, XmuSegment*);
-XmuScanline *XmuScanlineAndSegment(XmuScanline*, XmuSegment*);
-XmuScanline *XmuScanlineXorSegment(XmuScanline*, XmuSegment*);
-#endif /* notdef */
-
-#endif /* _XMU_H_ */
-
diff --git a/xc/lib/Xmu/Xmuos2.def b/xc/lib/Xmu/Xmuos2.def
deleted file mode 100644
index 0c74dc1ee..000000000
--- a/xc/lib/Xmu/Xmuos2.def
+++ /dev/null
@@ -1,128 +0,0 @@
-LIBRARY Xmu
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xmu/Xmuos2.def,v 3.6 1999/04/29 09:13:32 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- XmuGetAtomName @ 1
- XmuInternAtom @ 2
- XmuInternStrings @ 3
- XmuMakeAtom @ 4
- XmuNameOfAtom @ 5
- XmuCopyISOLatin1Lowered @ 6
- XmuCopyISOLatin1Uppered @ 7
- XmuCompareISOLatin1 @ 8
- XmuAddCloseDisplayHook @ 9
- XmuLookupCloseDisplayHook @ 10
- XmuRemoveCloseDisplayHook @ 11
- XmuCvtFunctionToCallback @ 12
- XmuCvtStringToBackingStore @ 13
- XmuCvtStringToCursor @ 14
- XmuCvtStringToColorCursor @ 15
- XmuCvtStringToGravity @ 16
- XmuCvtStringToJustify @ 17
- XmuCvtStringToLong @ 18
- XmuCvtStringToOrientation @ 19
- XmuCvtStringToBitmap @ 20
- XmuCvtStringToShapeStyle @ 21
- XmuReshapeWidget @ 22
- XmuCvtStringToWidget @ 23
- XmuNewCvtStringToWidget @ 24
- XmuCursorNameToIndex @ 25
- XmuDQCreate @ 26
- XmuDQDestroy @ 27
- XmuDQLookupDisplay @ 28
- XmuDQAddDisplay @ 29
- XmuDQRemoveDisplay @ 30
- XmuDrawRoundedRectangle @ 31
- XmuFillRoundedRectangle @ 32
- XmuDrawLogo @ 33
- XmuCreatePixmapFromBitmap @ 34
- XmuCreateStippledPixmap @ 35
- XmuReleaseStippledPixmap @ 36
- XmuLocateBitmapFile @ 37
- XmuLocatePixmapFile @ 38
- XmuReadBitmapData @ 39
- XmuReadBitmapDataFromFile @ 40
- XmuPrintDefaultErrorMessage @ 41
- XmuSimpleErrorHandler @ 42
- XmuRegisterExternalAgent @ 43
- XmuCallInitializers @ 44
- XmuAddInitializer @ 45
- XmuAllStandardColormaps @ 46
- XmuCreateColormap @ 47
- XmuDeleteStandardColormap @ 48
- XmuGetColormapAllocation @ 49
- XmuLookupStandardColormap @ 50
- XmuStandardColormap @ 51
- XmuVisualStandardColormaps @ 52
- XmuConvertStandardSelection @ 53
- XmuGetHostname @ 54
- XmuWnInitializeNodes @ 55
- XmuWnFetchResources @ 56
- XmuWnCountOwnedResources @ 57
- XmuWnNameToNode @ 58
- XmuClientWindow @ 59
- XmuUpdateMapHints @ 60
- XmuScreenOfWindow @ 61
- XctCreate @ 62
- XctNextItem @ 63
- XctFree @ 64
- XctReset @ 65
- _XmuCCLookupDisplay @ 66
- _XEditResCheckMessages @ 67
- _XEditResPutString8 @ 68
- _XEditResPut8 @ 69
- _XEditResPut16 @ 70
- _XEditResPut32 @ 71
- _XEditResPutWidgetInfo @ 72
- _XEditResResetStream @ 74
- _XEditResGet8 @ 75
- _XEditResGet16 @ 76
- _XEditResGetSigned16 @ 77
- _XEditResGet32 @ 78
- _XEditResGetString8 @ 79
- _XEditResGetWidgetInfo @ 80
- _XA_ATOM_PAIR @ 81
- _XA_CHARACTER_POSITION @ 82
- _XA_CLASS @ 83
- _XA_CLIENT_WINDOW @ 84
- _XA_CLIPBOARD @ 85
- _XA_COMPOUND_TEXT @ 86
- _XA_DECNET_ADDRESS @ 87
- _XA_DELETE @ 88
- _XA_FILENAME @ 89
- _XA_HOSTNAME @ 90
- _XA_IP_ADDRESS @ 91
- _XA_LENGTH @ 92
- _XA_LIST_LENGTH @ 93
- _XA_NAME @ 94
- _XA_NET_ADDRESS @ 95
- _XA_NULL @ 96
- _XA_OWNER_OS @ 97
- _XA_SPAN @ 98
- _XA_TARGETS @ 99
- _XA_TEXT @ 100
- _XA_TIMESTAMP @ 101
- _XA_USER @ 102
- XmuDistinguishableColors @ 103
- XmuDistinguishablePixels @ 104
- XmuCvtWidgetToString @ 105
- XmuCvtGravityToString @ 106
- XmuDestroySegmentList @ 107
- XmuCvtJustifyToString @ 108
- XmuSnprintf @ 109
- XmuAreaOrXor @ 110
- XmuDestroyScanlineList @ 111
- XmuScanlineXor @ 112
- XmuNewScanline @ 113
- XmuNCopyISOLatin1Lowered @ 114
- XmuNCopyISOLatin1Uppered @ 115
- XmuCvtShapeStyleToString @ 116
- XmuCvtOrientationToString @ 117
- XmuCvtBackingStoreToString @ 118
- XmuNewArea @ 119
- XmuScanlineOrSegment @ 120
- XmuOptimizeScanline @ 121
diff --git a/xc/lib/Xmu/Xmuos2.rsp b/xc/lib/Xmu/Xmuos2.rsp
deleted file mode 100644
index 69ef180c8..000000000
--- a/xc/lib/Xmu/Xmuos2.rsp
+++ /dev/null
@@ -1,11 +0,0 @@
-AllCmap.obj Atoms.obj ClientWin.obj Clip.obj CloseHook.obj CmapAlloc.obj +
-CrCmap.obj CrPixFBit.obj CursorName.obj CvtCache.obj CvtStdSel.obj +
-DefErrMsg.obj DelCmap.obj DisplayQue.obj Distinct.obj DrRndRect.obj +
-DrawLogo.obj EditresCom.obj ExtAgent.obj FToCback.obj GetHost.obj +
-GrayPixmap.obj Initer.obj LocBitmap.obj Lookup.obj LookupCmap.obj Lower.obj +
-RdBitF.obj ScrOfWin.obj ShapeWidg.obj StdCmap.obj StrToBS.obj StrToBmap.obj +
-StrToCurs.obj StrToGrav.obj StrToJust.obj StrToLong.obj StrToOrnt.obj +
-StrToShap.obj StrToWidg.obj UpdMapHint.obj VisCmap.obj WidgetNode.obj+
-Xct.obj /NOI /NOL /NOD /BAT
-Xmu.dll
-Xmu.map
diff --git a/xc/lib/Xmu/sharedlib.c b/xc/lib/Xmu/sharedlib.c
deleted file mode 100644
index f6603ba54..000000000
--- a/xc/lib/Xmu/sharedlib.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $TOG: sharedlib.c /main/10 1998/02/06 15:44:59 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.
-
-*/
-
-#if defined(SUNSHLIB) && !defined(SHAREDCODE)
-
-#include "Atoms.h"
-
-struct _AtomRec {
- char *name;
- struct _DisplayRec* head;
-};
-
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define DeclareAtom(atom) \
-extern struct _AtomRec __##atom; \
-AtomPtr _##atom = &__##atom;
-#else
-#define DeclareAtom(atom) \
-extern struct _AtomRec __/**/atom; \
-AtomPtr _/**/atom = &__/**/atom;
-#endif
-
-DeclareAtom(XA_ATOM_PAIR)
-DeclareAtom(XA_CHARACTER_POSITION)
-DeclareAtom(XA_CLASS)
-DeclareAtom(XA_CLIENT_WINDOW)
-DeclareAtom(XA_CLIPBOARD)
-DeclareAtom(XA_COMPOUND_TEXT)
-DeclareAtom(XA_DECNET_ADDRESS)
-DeclareAtom(XA_DELETE)
-DeclareAtom(XA_FILENAME)
-DeclareAtom(XA_HOSTNAME)
-DeclareAtom(XA_IP_ADDRESS)
-DeclareAtom(XA_LENGTH)
-DeclareAtom(XA_LIST_LENGTH)
-DeclareAtom(XA_NAME)
-DeclareAtom(XA_NET_ADDRESS)
-DeclareAtom(XA_NULL)
-DeclareAtom(XA_OWNER_OS)
-DeclareAtom(XA_SPAN)
-DeclareAtom(XA_TARGETS)
-DeclareAtom(XA_TEXT)
-DeclareAtom(XA_TIMESTAMP)
-DeclareAtom(XA_USER)
-
-#endif /* SUNSHLIB */
diff --git a/xc/lib/Xmuu/Imakefile b/xc/lib/Xmuu/Imakefile
deleted file mode 100644
index 32a564b0d..000000000
--- a/xc/lib/Xmuu/Imakefile
+++ /dev/null
@@ -1,64 +0,0 @@
-XCOMM $XFree86: xc/lib/Xmuu/Imakefile,v 1.1 2001/03/30 02:18:41 keithp Exp $
-XCOMM Mini Xmu library: pull out just those things that are used by apps
-XCOMM that do not use Xt and Xaw in the core applications
-XCOMM
-XCOMM Feel free to include additional code into this library, please
-XCOMM be careful not to use anything which requires libraries other
-XCOMM other than Xlib and the system C library
-
-#define DoNormalLib NormalLibXmuu
-#define DoSharedLib SharedLibXmuu
-#define DoExtraLib SharedLibXmuuc
-#define DoDebugLib DebugLibXmuu
-#define DoProfileLib ProfileLibXmuu
-#define LibName Xmuu
-#define SoRev SOXMUUREV
-#define LibHeaders NO
-
-#ifdef SharedXmuuReqs
-REQUIREDLIBS = SharedXmuuReqs
-#endif
- LINTLIBS = $(LINTXLIB)
-
-#if HasSnprintf
- MISC_DEFINES = -DHAS_SNPRINTF
-#else
- MISC_INCLUDES = -I$(LIBSRC)/misc
-#endif
-
- DEFINES = $(MISC_DEFINES)
- INCLUDES = $(MISC_INCLUDES)
-
-#ifdef OsNameDefines
-OS_NAME_DEFINES = OsNameDefines
-#endif
- CSSDEFS = $(OS_NAME_DEFINES) $(CONNECTION_FLAGS)
-
-
-SRCS = ClientWin.c\
- CursorName.c\
- DefErrMsg.c\
- GetHost.c\
- Lower.c
-
-OBJS = ClientWin.o\
- CursorName.o\
- DefErrMsg.o\
- GetHost.o\
- Lower.o
-
-INCLUDES = -I$(XMUSRC)
-
-#include <Library.tmpl>
-
-#if DoSharedLib
-SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF))
-#endif
-
-LinkSourceFile(ClientWin.c,$(XMUSRC))
-LinkSourceFile(CursorName.c,$(XMUSRC))
-LinkSourceFile(DefErrMsg.c,$(XMUSRC))
-LinkSourceFile(GetHost.c,$(XMUSRC))
-LinkSourceFile(Lower.c,$(XMUSRC))
-
-DependTarget()
diff --git a/xc/lib/Xmuu/Xmuu-def.cpp b/xc/lib/Xmuu/Xmuu-def.cpp
deleted file mode 100644
index 607e5402f..000000000
--- a/xc/lib/Xmuu/Xmuu-def.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-LIBRARY libXmuu
-VERSION LIBRARY_VERSION
-EXPORTS
-
- XmuClientWindow
- XmuCursorNameToIndex
- XmuPrintDefaultErrorMessage
- XmuSimpleErrorHandler
- XmuGetHostname
- XmuCompareISOLatin1
- XmuCopyISOLatin1Lowered
- XmuCopyISOLatin1Uppered
- XmuNCopyISOLatin1Lowered
- XmuNCopyISOLatin1Uppered
- XmuSnprintf
- _cygwin_dll_entry@12
- _cygwin_noncygwin_dll_entry@12
- dll_main@12
-
-/* $XFree86: xc/lib/Xmuu/Xmuu-def.cpp,v 1.1 2001/04/18 17:14:00 dawes Exp $ */
diff --git a/xc/lib/Xp/Imakefile b/xc/lib/Xp/Imakefile
deleted file mode 100644
index d50466175..000000000
--- a/xc/lib/Xp/Imakefile
+++ /dev/null
@@ -1,108 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/2 1996/11/16 15:20:42 rws $
-/******************************************************************************
- ******************************************************************************
- **
- ** Description: Imakefile for the DtPrint extension library.
- **
- ** (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.
- **
- ******************************************************************************
- *****************************************************************************/
-XCOMM $XFree86: xc/lib/Xp/Imakefile,v 1.2 1998/12/20 11:57:06 dawes Exp $
-
-
-#define DoNormalLib NormalLibXp
-#define DoSharedLib SharedLibXp
-#define DoExtraLib SharedLibXp
-#define DoDebugLib DebugLibXp
-#define DoProfileLib ProfileLibXp
-#define LibName Xp
-#define SoRev SOXPREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXpReqs
-REQUIREDLIBS = SharedXpReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
-DEFINES = $(ALLOC_DEFINES)
-INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
-
-/*
- * NOTE: libDtPrint.a has a dependency on extutil.o found in
- * libXext.a
- */
-SRCS = \
- XpAttr.c \
- XpContext.c \
- XpDoc.c \
- XpExtUtil.c \
- XpExtVer.c \
- XpGetData.c \
- XpInput.c \
- XpJob.c \
- XpLocale.c \
- XpPage.c \
- XpNotifyPdm.c \
- XpPrinter.c \
- XpPutData.c \
- XpScreens.c \
- XpPageDim.c \
- XpImageRes.c
-
-OBJS = \
- XpAttr.o \
- XpContext.o \
- XpDoc.o \
- XpExtUtil.o \
- XpExtVer.o \
- XpGetData.o \
- XpInput.o \
- XpJob.o \
- XpLocale.o \
- XpPage.o \
- XpNotifyPdm.o \
- XpPrinter.o \
- XpPutData.o \
- XpScreens.o \
- XpPageDim.o \
- XpImageRes.o
-
-LINTLIBS = $(LINTXLIB) $(LINTXEXT)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xp/Xp-def.cpp b/xc/lib/Xp/Xp-def.cpp
deleted file mode 100644
index 0a13b1580..000000000
--- a/xc/lib/Xp/Xp-def.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-LIBRARY Xp
-VERSION LIBRARY_VERSION
-EXPORTS
- XpCancelDoc
- XpCancelJob
- XpCancelPage
- XpCreateContext
- XpDestroyContext
- XpEndDoc
- XpEndJob
- XpEndPage
- XpFreePrinterList
- XpGetAttributes
- XpGetAuthParams
- XpGetContext
- XpGetDocumentData
- XpGetLocaleHinter
- XpGetLocaleNetString
- XpGetOneAttribute
- XpGetPageDimensions
- XpGetPdmStartParams
- XpGetPrinterList
- XpGetScreenOfContext
- XpInputSelected
- XpNotifyPdm
- XpPutDocumentData
- XpQueryExtension
- XpQueryScreens
- XpQueryVersion
- XpRehashPrinterList
- XpSelectInput
- XpSendAuth
- XpSendOneTicket
- XpSetAttributes
- XpSetContext
- XpSetLocaleHinter
- XpStartDoc
- XpStartJob
- XpStartPage
-/* $XConsortium: Xp-def.cpp /main/1 1996/11/13 14:44:46 lehors $ */
diff --git a/xc/lib/Xp/XpAttr.c b/xc/lib/Xp/XpAttr.c
deleted file mode 100644
index d02d8f09b..000000000
--- a/xc/lib/Xp/XpAttr.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* $XConsortium: XpAttr.c /main/3 1996/12/27 16:21:50 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/lib/Xp/XpAttr.c,v 1.3 1996/12/29 13:43:18 dawes Exp $ */
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-#define _XpPadOut(len) (((len) + 3) & ~3)
-
-
-#include <stdio.h>
-#include <sys/stat.h>
-
-char *
-XpGetAttributes (
- Display *dpy,
- XPContext print_context,
- XPAttributes type
-)
-{
- char *buf;
-
- xPrintGetAttributesReq *req;
- xPrintGetAttributesReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return( (char *) NULL ); /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintGetAttributes,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetAttributes;
- req->printContext = print_context;
- req->type = type;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( (char *) NULL ); /* No such extension */
- }
-
- /*
- * Read pool and return to caller.
- */
- buf = Xmalloc( (unsigned) rep.stringLen + 1 );
-
- if (!buf) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( (char *) NULL ); /* malloc error */
- }
-
- _XReadPad (dpy, (char *) buf, (long) rep.stringLen );
-
- buf[rep.stringLen] = 0;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return( buf );
-}
-
-
-char *
-XpGetOneAttribute (
- Display *dpy,
- XPContext print_context,
- XPAttributes type,
- char *attribute_name
-)
-{
- int buflen = 0;
- char *buf;
-
- xPrintGetOneAttributeReq *req;
- xPrintGetOneAttributeReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return( (char *) NULL ); /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintGetOneAttribute,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetOneAttribute;
- req->type = type;
- req->printContext = print_context;
- req->nameLen = strlen( attribute_name );
-
- /*
- * Attach variable data and adjust request length.
- */
- req->length += _XpPadOut(req->nameLen) >> 2 ;
- Data( dpy, (char *) attribute_name, req->nameLen ); /* n bytes + pad */
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( (char *) NULL ); /* No such extension */
- }
-
- /*
- * Read variable answer.
- */
- buf = Xmalloc( (unsigned) rep.valueLen + 1 );
-
- if (!buf) {
- UnlockDisplay(dpy);
- SyncHandle();
- return( (char *) NULL ); /* malloc error */
- }
-
- buf[rep.valueLen] = 0;
-
- _XReadPad (dpy, (char *) buf, (long) rep.valueLen );
- buf[rep.valueLen] = 0;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return( buf );
-}
-
-
-void
-XpSetAttributes (
- Display *dpy,
- XPContext print_context,
- XPAttributes type,
- char *pool,
- XPAttrReplacement replacement_rule
-)
-{
- int i;
-
- xPrintSetAttributesReq *req;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return; /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintSetAttributes,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintSetAttributes;
-
- req->printContext = print_context;
- req->type = type;
- req->rule = replacement_rule;
-
- /*
- * Attach variable data and adjust request length.
- */
- req->stringLen = (CARD32) strlen( (char *) pool );
- req->length += _XpPadOut(req->stringLen) >> 2 ;
-
- Data( dpy, (char *) pool, req->stringLen ); /* n bytes + pad */
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return;
-}
-
diff --git a/xc/lib/Xp/XpContext.c b/xc/lib/Xp/XpContext.c
deleted file mode 100644
index 8d95c13c5..000000000
--- a/xc/lib/Xp/XpContext.c
+++ /dev/null
@@ -1,252 +0,0 @@
-/* $TOG: XpContext.c /main/3 1997/05/28 11:41:13 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-#define _XpPadOut(len) (((len) + 3) & ~3)
-
-XPContext
-XpCreateContext (
- Display *dpy,
- char *printer_name
-)
-{
- xPrintCreateContextReq *req;
- XExtensionVersion *ext;
- char *locale;
- int locale_len;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return ( (XPContext) None ); /* No such extension */
-
- /*
- * Fetch locale information. Note: XpGetLocaleNetString has
- * a thread-safe mutex on _Xglobal_lock.
- */
- locale = XpGetLocaleNetString();
-
- LockDisplay (dpy);
-
- GetReq(PrintCreateContext,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintCreateContext;
-
- req->contextID = XAllocID(dpy);
- req->printerNameLen = strlen(printer_name);
-
- if ( locale == (char *) NULL )
- req->localeLen = 0;
- else if ( *locale == (char) NULL )
- req->localeLen = 0;
- else {
- locale_len = strlen( locale );
- req->length += _XpPadOut(locale_len) >> 2;
- req->localeLen = (unsigned long) locale_len;
- }
-
- /*
- * Attach variable data
- */
- req->length += _XpPadOut(req->printerNameLen) >> 2;
- Data( dpy, (char *) printer_name, (long) req->printerNameLen );
-
- if (req->localeLen)
- Data( dpy, (char *) locale, (long) req->localeLen );
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- XFree(locale);
-
- return ( (XPContext) req->contextID );
-}
-
-
-void
-XpSetContext (
- Display *dpy,
- XPContext print_context
-)
-{
- xPrintSetContextReq *req;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return; /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintSetContext,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintSetContext;
-
- req->printContext = print_context;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return;
-}
-
-
-XPContext
-XpGetContext (
- Display *dpy
-)
-{
- xPrintGetContextReq *req;
- xPrintGetContextReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return ( (XPContext) None ); /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintGetContext,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetContext;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (XPContext) None ); /* No such extension */
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ( (XPContext) rep.printContext );
-}
-
-
-void
-XpDestroyContext (
- Display *dpy,
- XPContext print_context
-)
-{
- xPrintDestroyContextReq *req;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return; /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintDestroyContext,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintDestroyContext;
- req->printContext = print_context;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return;
-}
-
-
-
-Screen *
-XpGetScreenOfContext (
- Display *dpy,
- XPContext print_context
-)
-{
- xPrintGetContextScreenReq *req;
- xPrintGetContextScreenReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- int i;
- Screen *checkScr;
- Screen *screen;
- int ok;
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return ( (Screen *) NULL ); /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintGetContextScreen,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetContextScreen;
-
- req->printContext = print_context;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (Screen *) NULL ); /* No such extension */
- }
-
- /*
- * Pull rootWindow ID and convert to the corresponding
- * Screen rec.
- */
- ok = False;
-
- for ( i = 0; i < XScreenCount(dpy); i++ ) {
- checkScr = XScreenOfDisplay(dpy, i);
- if ( XRootWindowOfScreen( checkScr ) == (Window) rep.rootWindow ) {
- ok = True;
- break;
- }
- }
-
- if (!ok)
- checkScr = (Screen *) NULL;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ( (Screen *) checkScr );
-}
-
diff --git a/xc/lib/Xp/XpDoc.c b/xc/lib/Xp/XpDoc.c
deleted file mode 100644
index 0c4379e14..000000000
--- a/xc/lib/Xp/XpDoc.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $XConsortium: XpDoc.c /main/2 1996/11/16 15:20:59 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 "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-typedef struct {
- int event_base_return;
- XPContext context;
-} _XpDiscardDocRec;
-
-static Bool _XpDiscardDoc(Display *dpy, XEvent *event, XPointer arg)
-{
- _XpDiscardDocRec *disrec = (_XpDiscardDocRec *) arg;
-
- if (event->type != disrec->event_base_return + XPPrintNotify)
- return False;
-
- if (disrec->context != ((XPPrintEvent *) event)->context)
- return False;
-
- if ((((XPPrintEvent *) event)->detail == XPEndDocNotify) ||
- (((XPPrintEvent *) event)->detail == XPEndPageNotify)) {
- return False;
- }
-
- return True;
-}
-
-
-void
-XpStartDoc (
- Display *dpy,
- XPDocumentType type
-)
-{
- xPrintStartDocReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension NULL */
-
- LockDisplay (dpy);
-
- GetReq(PrintStartDoc,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintStartDoc;
- req->type = (unsigned char ) type;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-void
-XpEndDoc (
- Display *dpy
-)
-{
- xPrintEndDocReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension NULL */
-
- LockDisplay (dpy);
-
- GetReq(PrintEndDoc,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintEndDoc;
- req->cancel = False;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-void
-XpCancelDoc (
- Display *dpy,
- Bool discard
-)
-{
- xPrintEndDocReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- _XpDiscardDocRec disrec;
- XEvent event;
-
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension NULL */
-
- LockDisplay (dpy);
-
- GetReq(PrintEndDoc,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintEndDoc;
- req->cancel = True;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-
- if (discard) {
- /*
- * get context and effectively do a sync of events.
- */
- disrec.event_base_return = info->codes->first_event;
- disrec.context = XpGetContext(dpy);
-
- /*
- * discard doc, and also page XPPrintNotify events.
- */
- while (XCheckIfEvent(dpy, &event, _XpDiscardDoc, (XPointer) &disrec))
- {
- /*EMPTY*/
- }
- }
-}
-
diff --git a/xc/lib/Xp/XpExtUtil.c b/xc/lib/Xp/XpExtUtil.c
deleted file mode 100644
index 521df40ac..000000000
--- a/xc/lib/Xp/XpExtUtil.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* $XConsortium: XpExtUtil.c /main/3 1996/11/16 15:21: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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <stdio.h>
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-#include <X11/Xos.h>
-
-#define ENQUEUE_EVENT True
-#define DONT_ENQUEUE False
-
-static XExtensionInfo xp_info_data;
-static XExtensionInfo *xp_info = &xp_info_data;
-static /* const */ char *xp_extension_name = XP_PRINTNAME;
-static /* const */ XEvent emptyevent;
-
-static int XpClose();
-static char *XpError();
-static Bool XpWireToEvent();
-static Status XpEventToWire();
-
-#define XpCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xp_extension_name, val)
-
-static /* const */ XExtensionHooks xpprint_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- XpClose, /* close_display */
- XpWireToEvent, /* wire_to_event */
- XpEventToWire, /* event_to_wire */
- NULL, /* error */
- XpError, /* error_string */
-};
-
-typedef struct _xpPrintData {
- XEvent data;
- XExtensionVersion *vers;
-} xpPrintData;
-
-static char *XpErrorList[ /* XP_ERRORS */ ] = {
- "XPBadContext",
- "XPBadSequence",
- "XPBadResourceID"
-};
-
-XEXT_GENERATE_FIND_DISPLAY (xp_find_display, xp_info,
- xp_extension_name, &xpprint_extension_hooks, XP_EVENTS, NULL)
-
-static XEXT_GENERATE_ERROR_STRING (XpError, xp_extension_name,
- XP_ERRORS, XpErrorList)
-
-/*******************************************************************
- *
- * XP Print extension versions.
- */
-
-static XExtensionVersion xpprintversions[] = {{XP_ABSENT,0,0},
- {XP_PRESENT, XP_PROTO_MAJOR, XP_PROTO_MINOR}};
-
-
-/***********************************************************************
- *
- * Check to see if the Xp Print extension is installed in the server.
- * Also check to see if the version is >= the requested version.
- *
- * xpprintversions[] shows all revisions of this library, past to present.
- * xpprintversions[version_index] shows which version *this* library is.
- */
-
-int XpCheckExtInit(dpy, version_index)
- register Display *dpy;
- register int version_index;
-{
- XExtDisplayInfo *info = xp_find_display (dpy);
-
- XpCheckExtension (dpy, info, -1);
-
-
- /*
- * Check for broken condition - a partial info world.
- */
- if (info->data) {
- if (!(((xpPrintData *) info->data)->vers)) {
- return (-1);
- }
- }
-
- _XLockMutex(_Xglobal_lock);
- if (info->data == NULL) {
- /*
- * Hang a Xp private data struct. Use it for version
- * information.
- */
- info->data = (caddr_t) Xmalloc (sizeof (xpPrintData));
- if (!info->data) {
- _XUnlockMutex(_Xglobal_lock);
- return (-1);
- }
-
- ((xpPrintData *) info->data)->vers =
- (XExtensionVersion *) Xmalloc(sizeof(XExtensionVersion));
- if (!(((xpPrintData *) info->data)->vers)) {
- _XUnlockMutex(_Xglobal_lock);
- return (-1);
- }
-
- /*
- * Set present to false so that XpQueryVersion will fill
- * it in vs using its own cache which now contains garbage.
- */
- ((xpPrintData *) info->data)->vers->present = False;
-
- ((xpPrintData *) info->data)->vers->present = XpQueryVersion(dpy,
- &(((xpPrintData *) info->data)->vers->major_version),
- &(((xpPrintData *) info->data)->vers->minor_version) );
- }
- if (xpprintversions[version_index].major_version > XP_DONT_CHECK) {
- if ( ( ((xpPrintData *) info->data)->vers->major_version
- < xpprintversions[version_index].major_version) ||
- ( (((xpPrintData *) info->data)->vers->major_version
- == xpprintversions[version_index].major_version) &&
- (((xpPrintData *) info->data)->vers->minor_version
- < xpprintversions[version_index].minor_version))) {
- _XUnlockMutex(_Xglobal_lock);
- return (-1);
- }
- }
- _XUnlockMutex(_Xglobal_lock);
- return (0);
-}
-
-/***********************************************************************
- *
- * Close display routine.
- *
- */
-
-static int
-XpClose (dpy, codes)
- Display *dpy;
- XExtCodes *codes;
- {
- XExtDisplayInfo *info = xp_find_display (dpy);
-
- _XLockMutex(_Xglobal_lock);
- if ( ((xpPrintData *) info->data)) {
- if (((xpPrintData *) info->data)->vers) {
- XFree((char *)((xpPrintData *) info->data)->vers);
- }
- XFree((char *)info->data);
- info->data = (char *) NULL; /* NULL since tests are run on */
- }
- _XUnlockMutex(_Xglobal_lock);
-
- return XextRemoveDisplay (xp_info, dpy);
- }
-
-
-/******************************************************************************
- *
- * Handle extension events.
- */
-
-/********************************************************************
- *
- * Reformat a wire event into an XEvent structure of the right type.
- */
-static Bool
-XpWireToEvent (dpy, re, event)
- Display *dpy;
- XEvent *re;
- xEvent *event;
-{
- XExtDisplayInfo *info = xp_find_display (dpy);
-
-
- /*
- * type, serial, send_event, display are common to all events.
- */
- re->type = event->u.u.type & 0x7f;
- ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *)event);
- ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0);
- ((XAnyEvent *)re)->display = dpy;
-
-
- switch (re->type - info->codes->first_event)
- {
-
- case XPPrintNotify:
- {
- register XPPrintEvent *ev = (XPPrintEvent *) re;
- xPrintPrintEvent *ev2 = (xPrintPrintEvent *) event;
-
- /* type, serial, send_event, *display */
-
- ev->context = (XPContext) ev2->printContext;
- ev->cancel = (Bool) ev2->cancel;
- ev->detail = (int) ev2->detail;
-
- return (ENQUEUE_EVENT);
- break;
- }
-
- case XPAttributeNotify:
- {
- register XPAttributeEvent *ev = (XPAttributeEvent *) re;
- xPrintAttributeEvent *ev2 = (xPrintAttributeEvent *) event;
-
- /* type, serial, send_event, *display */
-
- ev->context = (XPContext) ev2->printContext;
- ev->detail = (int) ev2->detail;
-
- return (ENQUEUE_EVENT);
- break;
- }
-
- default:
- printf ("XpWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",re->type);
- break;
- }
-
- return (DONT_ENQUEUE);
-}
-
-/********************************************************************
- *
- * Reformat an XEvent into a wire event.
- */
-static Status
-XpEventToWire(dpy, re, event, count)
- register Display *dpy; /* pointer to display structure */
- register XEvent *re; /* pointer to client event */
- register xEvent **event; /* wire protocol event */
- register int *count;
-{
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
- int i;
-
- switch ((re->type & 0x7f) - info->codes->first_event)
- {
-#ifdef PRINT_SomeEventExample2
- case PRINT_SomeEventExample:
- {
- register XDeviceKeyEvent *ev = (XDeviceKeyEvent*) re;
- register deviceKeyButtonPointer *kev;
- register deviceValuator *vev;
-
- *count = 2;
- kev = (deviceKeyButtonPointer *) Xmalloc (*count * sizeof (xEvent));
- if (!kev)
- return(_XUnknownNativeEvent(dpy, re, event));
- *event = (xEvent *) kev;
-
- kev->type = ev->type;
- kev->root = ev->root;
- kev->event = ev->window;
- kev->child = ev->subwindow;
- kev->time = ev->time;
- kev->event_x = ev->x ;
- kev->event_y = ev->y ;
- kev->root_x = ev->x_root;
- kev->root_y = ev->y_root;
- kev->state = ev->state;
- kev->same_screen = ev->same_screen;
- kev->detail = ev->keycode;
- kev->deviceid = ev->deviceid | MORE_EVENTS;
-
- vev = (deviceValuator *) ++kev;
- vev->type = info->codes->first_event + XI_DeviceValuator;
- vev->deviceid = ev->deviceid;
- vev->device_state = ev->device_state;
- vev->first_valuator = ev->first_axis;
- vev->num_valuators = ev->axes_count;
- i = vev->num_valuators;
- if (i > 6) i = 6;
- switch (i)
- {
- case 6: vev->valuator5 = ev->axis_data[5];
- case 5: vev->valuator4 = ev->axis_data[4];
- case 4: vev->valuator3 = ev->axis_data[3];
- case 3: vev->valuator2 = ev->axis_data[2];
- case 2: vev->valuator1 = ev->axis_data[1];
- case 1: vev->valuator0 = ev->axis_data[0];
- }
- break;
- }
-#endif /* PRINT_SomeEventExample2 */
-
- default:
- return(_XUnknownNativeEvent(dpy, re, event));
- }
-}
-
diff --git a/xc/lib/Xp/XpExtUtil.h b/xc/lib/Xp/XpExtUtil.h
deleted file mode 100644
index d7ae0f630..000000000
--- a/xc/lib/Xp/XpExtUtil.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $XFree86: xc/lib/Xp/XpExtUtil.h,v 1.1 2000/09/26 15:56:57 tsi Exp $ */
-/*
- * Copyright (C) 2000 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 _XPEXTUTIL_H
-#define _XPEXTUTIL_H 1
-
-#include "extutil.h"
-
-extern XEXT_FIND_DISPLAY_PROTO(xp_find_display);
-
-#endif /* _XPEXTUTIL_H */
diff --git a/xc/lib/Xp/XpExtVer.c b/xc/lib/Xp/XpExtVer.c
deleted file mode 100644
index 8cc787df4..000000000
--- a/xc/lib/Xp/XpExtVer.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $XConsortium: XpExtVer.c /main/2 1996/11/16 15:21:11 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-
-Bool
-XpQueryExtension (
- Display *dpy,
- int *event_base_return, /* return value */
- int *error_base_return /* return value */
-)
-{
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XextHasExtension (info)) {
- *event_base_return = info->codes->first_event;
- *error_base_return = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status
-XpQueryVersion (
- Display *dpy,
- short *major_version,
- short *minor_version
-)
-{
- xPrintQueryVersionReq *req;
- xPrintQueryVersionReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- /*
- * Note: many extensions treat major and minor as "ints", but
- * protocol wise and internal wise, they're shorts.
- */
- *major_version = 0;
- *minor_version = 0;
-
-#ifdef Would_Need_xpPrintData_Struct_Def
- /*
- * We may already have the answer cached from a previous query.
- */
- if (( info->data ) && ( ((xpPrintData *) info->data)->vers->present )) {
- *major_version = ((xpPrintData *) info->data)->vers->major_version ;
- *minor_version = ((xpPrintData *) info->data)->vers->minor_version ;
- return (/* non-zero indicates extension present */ True);
- }
-#endif /* Would_Need_xpPrintData_Struct_Def */
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return (/* No such extension */ False);
-
- LockDisplay (dpy);
-
- GetReq(PrintQueryVersion,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintQueryVersion;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return(/* No such extension */ False);
- }
-
- *major_version = rep.majorVersion;
- *minor_version = rep.minorVersion;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return (/* non-zero indicates extension present */ True);
-}
-
diff --git a/xc/lib/Xp/XpGetData.c b/xc/lib/Xp/XpGetData.c
deleted file mode 100644
index b5cedfcea..000000000
--- a/xc/lib/Xp/XpGetData.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* $XConsortium: XpGetData.c /main/2 1996/11/16 15:21:15 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-#define MAX_XP_BUFFER_SIZE 32768
-
-/*
- * At the tail of every async struct of ours is attached the
- * following "dev private" information needed by our async handler.
- */
-typedef struct {
- XPContext context;
- XPSaveProc save_proc;
- XPFinishProc finish_proc;
- XPointer client_data;
- _XAsyncHandler *async;
- unsigned long seq; /* sequence # that will trigger handler */
-} _XpState;
-
-
-/*
- * The following is the handler for async replies from
- * XpGetDocumentData().
- */
-static Bool
-_XpGetDocDataHandler(dpy, rep, buf, len, adata)
- register Display *dpy;
- register xReply *rep;
- char *buf;
- int len;
- XPointer adata;
-{
- register _XpState *state;
- xPrintGetDocumentDataReply replbuf;
- xPrintGetDocumentDataReply *repl;
- int dataLen;
- char *data;
-
- state = (_XpState *)adata;
-
- /*
- * Bypass this handler if the reply is NOT the one we're looking for.
- */
- if (dpy->last_request_read != state->seq) {
- return False;
- }
-
- /*
- * When an error occurs, call the finish_proc and then de-queue
- * this event handler. Once an error occurs, all bets are off.
- * The error XPGetDocError is *not* the most descriptive, so the
- * caller will be encouraged to dig around for the corresponding
- * generated error.
- *
- * Note - Do not confuse the "generated" errors here with
- * XPGetDocSecondConsumer which is returned in a protocol reply.
- */
- if (rep->generic.type == X_Error) {
- (*state->finish_proc)( (Display *) dpy,
- (XPContext) state->context,
- XPGetDocError,
- (XPointer) state->client_data );
- DeqAsyncHandler(dpy, state->async);
- Xfree(state->async);
- return False;
- }
-
- repl = (xPrintGetDocumentDataReply *)
- _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, 0, False);
-
- if (repl->dataLen) {
- /*
- * Call save_proc in cases where there was document data
- */
-
- dataLen = repl->length << 2; /*with pad len*/
-
- data = (char *) _XAllocTemp( dpy, dataLen );
-
- _XGetAsyncData( dpy, (char *) data, buf, len,
- SIZEOF(xPrintGetDocumentDataReply), dataLen, 0);
-
- (*state->save_proc)( (Display *) dpy,
- (XPContext) state->context,
- (unsigned char *) data,
- (unsigned int) repl->dataLen, /* actual len */
- (XPointer) state->client_data );
-
- _XFreeTemp( dpy, (char *) data, dataLen );
- }
-
- if (repl->finishedFlag) {
- /*
- * Call finish_proc
- */
- (*state->finish_proc)( (Display *) dpy,
- (XPContext) state->context,
- (XPGetDocStatus) repl->statusCode,
- (XPointer) state->client_data );
- /*
- * De-queue this async handler - we're done.
- */
- DeqAsyncHandler( dpy, state->async );
- Xfree(state->async);
- }
-
- return True; /* the reply WAS consumed by this handler */
-}
-
-/******************************************************************************
- *
- * XpGetDocumentData()
- *
- * ...registers callbacks to be triggered when async protocol replies
- * come back in response to the origial request.
- *
- * Returned Status indicate whether the callbacks will be used
- * (finish_proc and possibly save_proc), or whether they will
- * never be used.
- *
- */
-Status
-XpGetDocumentData (
- Display *dpy,
- XPContext context,
- XPSaveProc save_proc,
- XPFinishProc finish_proc,
- XPointer client_data
-)
-{
- xPrintGetDocumentDataReq *req;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
- _XAsyncHandler *async;
- _XpState *async_state;
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return(0); /* No such extension */
-
- async = (_XAsyncHandler *)Xmalloc(sizeof(_XAsyncHandler) +
- sizeof(_XpState));
- if (!async)
- return(0); /* malloc error */
- async_state = (_XpState *)(async + 1);
-
- LockDisplay (dpy);
-
- GetReq(PrintGetDocumentData,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetDocumentData;
- req->printContext = context;
- req->maxBufferSize = MAX_XP_BUFFER_SIZE; /* use as a hint to X server */
-
- async_state->context = context;
- async_state->save_proc = save_proc;
- async_state->finish_proc = finish_proc;
- async_state->client_data = client_data;
- async_state->seq = dpy->request;
- async_state->async = async;
-
- async->next = dpy->async_handlers;
- async->handler = _XpGetDocDataHandler;
- async->data = (XPointer)async_state;
-
- dpy->async_handlers = async;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return(1); /* success at registering a handler */
-}
-
diff --git a/xc/lib/Xp/XpImageRes.c b/xc/lib/Xp/XpImageRes.c
deleted file mode 100644
index 007531f89..000000000
--- a/xc/lib/Xp/XpImageRes.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/* $XConsortium: XpImageRes.c /main/1 1996/11/16 15:21: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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-
-Bool
-XpSetImageResolution (
- Display *dpy,
- XPContext print_context,
- int image_res,
- int *prev_res
-)
-{
- xPrintSetImageResolutionReq *req;
- xPrintSetImageResolutionReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (image_res < 0 || image_res > 65535)
- return (False);
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return (False);
-
- LockDisplay (dpy);
-
- GetReq(PrintSetImageResolution,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintSetImageResolution;
- req->printContext = print_context;
- req->imageRes = image_res;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return(False);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- if (rep.status && prev_res)
- *prev_res = rep.prevRes;
- return ( rep.status );
-}
-
-int
-XpGetImageResolution (
- Display *dpy,
- XPContext print_context
-)
-{
- xPrintGetImageResolutionReq *req;
- xPrintGetImageResolutionReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return (-1);
-
- LockDisplay (dpy);
-
- GetReq(PrintGetImageResolution,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetImageResolution;
- req->printContext = print_context;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return(-1);
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return ( rep.imageRes );
-}
diff --git a/xc/lib/Xp/XpInput.c b/xc/lib/Xp/XpInput.c
deleted file mode 100644
index 2680fe870..000000000
--- a/xc/lib/Xp/XpInput.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $XConsortium: XpInput.c /main/2 1996/11/16 15:21:25 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-
-void
-XpSelectInput (
- Display *dpy,
- XPContext print_context,
- unsigned long event_mask
-)
-{
- xPrintSelectInputReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension NULL */
-
- LockDisplay (dpy);
-
- GetReq(PrintSelectInput,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintSelectInput;
- req->printContext = print_context;
- req->eventMask = event_mask;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-unsigned long
-XpInputSelected (
- Display *dpy,
- XPContext print_context,
- unsigned long *all_events_mask
-)
-{
- xPrintInputSelectedReq *req;
- xPrintInputSelectedReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return (/* No such extension */ 0L );
-
- LockDisplay (dpy);
-
- GetReq(PrintInputSelected,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintInputSelected;
- req->printContext = print_context;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return(/* No such extension */ 0L);
- }
-
- *all_events_mask = rep.allEventsMask;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return ( rep.eventMask );
-}
-
diff --git a/xc/lib/Xp/XpJob.c b/xc/lib/Xp/XpJob.c
deleted file mode 100644
index b1a5d130e..000000000
--- a/xc/lib/Xp/XpJob.c
+++ /dev/null
@@ -1,201 +0,0 @@
-/* $XConsortium: XpJob.c /main/4 1996/12/04 10:24:31 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/lib/Xp/XpJob.c,v 1.2 1997/01/12 10:39:56 dawes Exp $ */
-
-#if defined(sun) && defined(i386) && defined(SVR4)
-#define __EXTENSIONS__
-#endif
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "X11/Xos.h"
-#include "extutil.h"
-#include <limits.h>
-#ifndef WIN32
-#define X_INCLUDE_PWD_H
-#define XOS_USE_XLIB_LOCKING
-#include <X11/Xos_r.h>
-#endif
-#include <limits.h>
-
-
-typedef struct {
- int event_base_return;
- XPContext context;
-} _XpDiscardJobRec;
-
-static Bool _XpDiscardJob(Display *dpy, XEvent *event, XPointer arg)
-{
- _XpDiscardJobRec *disrec = (_XpDiscardJobRec *) arg;
-
- if (event->type != disrec->event_base_return + XPPrintNotify)
- return False;
-
- if (disrec->context != ((XPPrintEvent *) event)->context)
- return False;
-
- if ((((XPPrintEvent *) event)->detail == XPEndJobNotify) ||
- (((XPPrintEvent *) event)->detail == XPEndDocNotify) ||
- (((XPPrintEvent *) event)->detail == XPEndPageNotify)) {
- return False;
- }
-
- return True;
-}
-
-
-void
-XpStartJob (
- Display *dpy,
- XPSaveData save_data
-)
-{
- xPrintStartJobReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- XPContext context;
-
-
- /****************************************************************
- *
- * PRIOR TO XPSTARTJOB, set the job attribute "job-owner"
- * which will be used by the X-Server when it spools the
- * output. When XpStartJob completes, the job attribute
- * pool is frozen, disallowing "job-owner" to be modified.
- */
- {
- char *joa; /* job owner attribute */
- char *PwName;
-#ifndef WIN32
- _Xgetpwparams pwparams;
- struct passwd *pw;
- pw = _XGetpwuid(getuid(),pwparams);
-
- if (pw && (PwName = pw->pw_name)) {
-#else
- if ((PwName = getenv("USERNAME"))) {
-#endif
- joa = (char *) Xmalloc( strlen( PwName ) + 20 );
- sprintf( joa, "job-owner: %s", PwName );
- context = XpGetContext( dpy );
- XpSetAttributes( dpy, context, XPJobAttr, joa, XPAttrMerge );
-
- Xfree( joa );
- }
- }
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintStartJob,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintStartJob;
- req->saveData = (CARD8) save_data;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-void
-XpEndJob (
- Display *dpy
-)
-{
- xPrintEndJobReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintEndJob,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintEndJob;
- req->cancel = False;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-void
-XpCancelJob (
- Display *dpy,
- Bool discard
-)
-{
- xPrintEndJobReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- _XpDiscardJobRec disrec;
- XEvent event;
-
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintEndJob,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintEndJob;
- req->cancel = True;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-
- if (discard) {
- /*
- * get context and effectively do a sync of events.
- */
- disrec.event_base_return = info->codes->first_event;
- disrec.context = XpGetContext(dpy);
-
- /*
- * discard job, and also doc and page XPPrintNotify events.
- */
- while (XCheckIfEvent(dpy, &event, _XpDiscardJob, (XPointer) &disrec))
- {
- /*EMPTY*/
- }
- }
-}
-
diff --git a/xc/lib/Xp/XpLocale.c b/xc/lib/Xp/XpLocale.c
deleted file mode 100644
index ad9412572..000000000
--- a/xc/lib/Xp/XpLocale.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* $TOG: XpLocale.c /main/3 1997/05/28 11:41:34 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-#include <X11/Xlocale.h>
-
-
-/*
- * Global hangers for locale hint machinery.
- */
-XPHinterProc _xp_hinter_proc = NULL;
-char *_xp_hinter_desc = NULL;
-int _xp_hinter_init = 1; /* need to init */
-
-
-extern char *_xpstrdup();
-
-
-/******************************************************************************
- *
- * THE DEFAULT LOCALE HINTER
- *
- * Make changes here only.
- */
-static char *_XpLocaleHinter()
-{
-#ifdef hpux
- char lbuf[ LC_BUFSIZ ];
-
- if ( setlocale_r( LC_CTYPE, (char *) NULL, lbuf, LC_BUFSIZ ) ) {
-#else
- char *lbuf;
-
- if ((lbuf = setlocale(LC_CTYPE, (char *) NULL)) == NULL) {
-#endif
- return( _xpstrdup( "" ) );
- }
- else {
- return( _xpstrdup( lbuf ) );
- }
-}
-
-#define _XPLOCALEHINTERDESC NULL
-
-
-/******************************************************************************
- *
- * XpSetLocaleHinter
- */
-void
-XpSetLocaleHinter (
- XPHinterProc hinter_proc,
- char *hinter_desc
-)
-{
-
- _XLockMutex(_Xglobal_lock);
-
- /*
- * Free up existing hinter description.
- */
- if (_xp_hinter_desc)
- XFree( _xp_hinter_desc );
-
- /*
- * Either install the default hinter, or install the
- * one provided by the caller.
- */
- if (!hinter_proc) {
- _xp_hinter_proc = _XpLocaleHinter;
- _xp_hinter_desc = _xpstrdup( _XPLOCALEHINTERDESC );
- _xp_hinter_init = 0;
- }
- else {
- _xp_hinter_proc = hinter_proc;
- _xp_hinter_desc = _xpstrdup( hinter_desc );
- _xp_hinter_init = 0;
- }
-
- _XUnlockMutex(_Xglobal_lock);
-}
-
-
-/******************************************************************************
- *
- * XpGetLocaleHinter
- */
-char *
-XpGetLocaleHinter (
- XPHinterProc *hinter_proc
-)
-{
- char *tmpstr;
-
- _XLockMutex(_Xglobal_lock);
-
- if (_xp_hinter_init) {
- _xp_hinter_proc = _XpLocaleHinter;
- _xp_hinter_desc = _xpstrdup( _XPLOCALEHINTERDESC );
- _xp_hinter_init = 0;
- }
-
- *hinter_proc = _xp_hinter_proc;
- tmpstr = _xpstrdup( _xp_hinter_desc );
-
- _XUnlockMutex(_Xglobal_lock);
-
- return( tmpstr );
-}
-
-
-/******************************************************************************
- *
- * XpGetLocaleNetString
- *
- * this is the routine that uses the locale hint machinery
- * to construct the actual "locale_hint" that is passed in
- * the various protocols and ICCCM-selection requests.
- *
- * A "Locale Net String" is made up of two components, a "locale hint"
- * that is the locale, and a "locale description" that is a description
- * of how the locale was derived.
- *
- * If a locale hint and description are available, then the net string
- * will be the description, and if the description contains the
- * keyword "%locale%", that keyword will be replaced with the locale
- * hint. For example:
- *
- * locale_desc = XOPEN;%locale%;01_00;XFN-001001
- * locale_hint = de_DE
- *
- * result is = XOPEN;de_DE;01_00;XFN-001001
- *
- * If only a locale description is available, then it becomes the
- * entire net string.
- *
- * If only a locale hint is available, then it becomes the
- * entire net string.
- *
- * If neither a hint or description exists, a NULL is returned.
- */
-char *XpGetLocaleNetString()
-{
- XPHinterProc locale_hinter;
-
- char *locale_desc;
- char *locale_hint;
- char *tptr1;
- char *locale_net_string;
-
-
- /*
- * Fetch the current locale hinter machinery.
- */
- locale_desc = XpGetLocaleHinter( &locale_hinter );
-
- /*
- * Run it.
- */
- locale_hint = (locale_hinter)();
-
- /*
- * Use locale_desc and locale_hint to build a full
- * locale net string.
- */
- if (locale_desc && locale_hint) {
- /*
- * Combine the two portions to form locale_net_string.
- *
- * For example:
- */
-
- tptr1 = strstr( locale_desc, "%locale%" );
-
- if (tptr1) {
- /*
- * Insert locale_hint into locale_desc.
- *
- * Note: strlen("%locale%") = 8
- */
- locale_net_string = Xmalloc( strlen(locale_desc) - 8 +
- strlen(locale_hint) + 1 );
-
- /*
- * Copy first portion of locale_desc.
- */
- *tptr1 = '\0';
- strcpy( locale_net_string, locale_desc );
-
- /*
- * Copy middle portion consisting of locale_hint.
- */
- strcat( locale_net_string, locale_hint );
-
- /*
- * Copy first portion of locale_desc.
- */
- tptr1 = tptr1 + 8; /* skip by %Locale% keyword */
-
- strcat( locale_net_string, tptr1 );
-
- /*
- * Free up and return.
- */
- XFree( locale_hint );
- XFree( locale_desc );
- return( locale_net_string );
- }
- else {
- /*
- * Since a locale_desc was given WITHOUT a place to insert
- * the locale_hint, the locale_desc wins out.
- */
- XFree( locale_hint );
- return( locale_desc );
- }
- }
- else if (locale_desc) {
- return( locale_desc );
- }
- else if (locale_hint) {
- return( locale_hint );
- }
- else {
- return( (char *) NULL );
- }
-}
-
diff --git a/xc/lib/Xp/XpNotifyPdm.c b/xc/lib/Xp/XpNotifyPdm.c
deleted file mode 100644
index aa9d28791..000000000
--- a/xc/lib/Xp/XpNotifyPdm.c
+++ /dev/null
@@ -1,893 +0,0 @@
-/* $TOG: XpNotifyPdm.c /main/5 1997/07/24 15:47:13 kaleb $ */
-/******************************************************************************
- ******************************************************************************
- **
- ** Description: XpNotifyPdm is used to engage a Page Dialog Manager
- ** (PDM). Though the PDM is not a formal part of the
- ** Print Extension, the concept and likely usage of
- ** PDM's is strong enough that this routine is being
- ** provided as a sample standard mechanism for engaging
- ** PDM's from the Print Extension.
- **
- ** (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 "Print.h"
-#include "X11/Xlibint.h"
-#include "X11/Xutil.h"
-#include "X11/Xatom.h"
-#include "X11/Xauth.h"
-#include <stdlib.h>
-#include <X11/Xos.h>
-
-/*
- * Alternate selection environment variables.
- */
-#define ALT_PDM_SELECTION_ENV_VAR "XPDMSELECTION"
-#define ALT_PMD_DISPLAY_ENV_VAR "XPDMDISPLAY"
-
-/*
- * X-Authority file for authorization tickets.
- */
-#define PDM_XAUTHORITY_ENV_VAR "XPDMXAUTHORITY"
-
-/*
- * str_dup using Xmalloc
- */
-char *_xpstrdup(char * str)
-{
- int len;
- char *newstr;
-
- if (!str)
- return( (char *) NULL );
-
- len = strlen(str) + 1;
- newstr = (char *) Xmalloc( len );
- memcpy( newstr, str, len );
- return( newstr );
-}
-
-/******************************************************************************
- *
- * _XpGetSelectionServer
- *
- * Routine that considers print_display, video_display, and alt
- * environment variables, and figures out the selection_display
- * and selection_atom.
- *
- * selection_display can be one of print_display, video_display,
- * or a brand new display connection that the caller will later
- * have to close.
- */
-static Display *
-_XpGetSelectionServer (
- Display *print_display,
- Display *video_display,
- Atom *sel_atom /* return value */
-)
-{
- char *tstr1, *tstr2, *tstr3, *tstrptr;
- char *sel_displaystr;
- Display *sel_display;
- char *selectionstr;
-
-
- /*
- * Possibly tickle a selection on an alternate display.
- */
- if ( (sel_displaystr = getenv( ALT_PMD_DISPLAY_ENV_VAR )) != NULL ) {
- if ( !strcmp(sel_displaystr, "print") ) {
- /*
- * Explicitly use the Print display.
- */
- sel_display = print_display;
- }
- else if ( !strcmp(sel_displaystr, "video") ) {
- /*
- * Explicitly use the Video display.
- */
- sel_display = video_display;
- }
- else {
- /*
- * Do more work to determine the selection server connection.
- * The following is not clever enough to handle host aliases.
- */
- tstr1 = _xpstrdup( sel_displaystr );
- tstr2 = _xpstrdup( XDisplayString(print_display) );
- tstr3 = _xpstrdup( XDisplayString(video_display) );
-
- /*
- * remove ".scr" portion from "host:disp.scr" strings.
- */
- if ( tstrptr = strchr( tstr1, ':' ) )
- if ( tstrptr = strchr( tstrptr, '.' ) )
- *tstrptr = '\0';
-
- if ( tstrptr = strchr( tstr2, ':' ) )
- if ( tstrptr = strchr( tstrptr, '.' ) )
- *tstrptr = '\0';
-
- if ( tstrptr = strchr( tstr3, ':' ) )
- if ( tstrptr = strchr( tstrptr, '.' ) )
- *tstrptr = '\0';
-
- if ( !strcmp( tstr1, tstr2 ) ) {
- /*
- * Explicitly use the Print display.
- */
- sel_display = print_display;
- }
- else if ( !strcmp( tstr1, tstr3 ) ) {
- /*
- * Explicitly use the Print display.
- */
- sel_display = video_display;
- }
- else {
- /*
- * Create a new display connection to a server
- * never previously contacted. The caller will
- * have to realize this is a new display handle
- * (ie, its not equal to print_display or
- * video_display) when done.
- */
- sel_display = XOpenDisplay(sel_displaystr);
- }
-
- XFree( tstr3 );
- XFree( tstr2 );
- XFree( tstr1 );
- }
- }
- else {
- /*
- * If no alt selection server, use the print server.
- */
- sel_display = print_display;
- }
-
- if (sel_display) {
- /*
- * Tickle (possibly alternate) PDM_MANAGER selection
- */
- if ( (selectionstr = getenv( ALT_PDM_SELECTION_ENV_VAR )) == NULL )
- selectionstr = "PDM_MANAGER";
-
- *sel_atom = XInternAtom( sel_display, selectionstr, False );
- }
-
- return( sel_display );
-}
-
-
-
-/******************************************************************************
- *
- * XpGetPdmStartParams
- */
-Status
-XpGetPdmStartParams (
- Display *print_display,
- Window print_window,
- XPContext print_context,
- Display *video_display,
- Window video_window,
- Display **selection_display, /* return value */
- Atom *selection, /* return value */
- Atom *type, /* return value */
- int *format, /* return value */
- unsigned char **data, /* return value */
- int *nelements /* return value */
-)
-{
- Display *sel_display;
- XTextProperty text_prop;
- int status;
- char str1[128], str2[128], str3[128];
- char *list[6];
-
-
- *selection_display = _XpGetSelectionServer( print_display, video_display,
- selection );
-
- if (*selection_display == NULL) {
- /*
- * Error - cannot determine or establish a selection_display.
- */
- return( (Status) NULL );
- }
-
- /*
- * Create a property that can be included in the PDM_MANAGER
- * selection to communicate information.
- *
- * video_display host:display[.anyScreen]
- * video_window
- * print_display host:display[.anyScreen]
- * print_window
- * print_context use to derive host:display.properScreen and other
- * locale_hint
- */
- list[0] = XDisplayString( video_display );
- sprintf( str1, "0x%x", video_window );
- list[1] = str1;
-
- list[2] = XDisplayString( print_display );
- sprintf( str2, "0x%x", print_window );
- list[3] = str2;
-
- sprintf( str3, "0x%x", print_context );
- list[4] = str3;
-
- list[5] = XpGetLocaleNetString();
-
- status = XSupportsLocale();
- if ( ! status ) {
- /*
- * Error.
- */
- if ( (*selection_display != print_display) &&
- (*selection_display != video_display) ) {
- XCloseDisplay( *selection_display );
- *selection_display = (Display *) NULL;
- }
- return( (Status) NULL );
- }
-
- status = XmbTextListToTextProperty( *selection_display, list, 6,
- XStdICCTextStyle, &text_prop );
-
- if ( status < 0 ) {
- /*
- * Error.
- */
- if ( (*selection_display != print_display) &&
- (*selection_display != video_display) ) {
- XCloseDisplay( *selection_display );
- *selection_display = (Display *) NULL;
- }
- return( (Status) NULL );
- }
-
- *type = text_prop.encoding;
- *format = text_prop.format;
- *data = text_prop.value;
- *nelements = text_prop.nitems;
-
- XFree(list[5]);
-
- return( (Status) 1 );
-}
-
-/******************************************************************************
- *
- * XpSendOneTicket
- *
- * The ticket transfer protocol is as follows:
- * unsigned short ticket_state;
- * - 0 means NULL ticket, terminating ticket
- * - 1 means non-NULL ticket, terminating ticket
- * - 2 means non-NULL ticket, and more tickets to send
- * unsigned short address_length;
- * unsigned short number_length;
- * unsigned short name_length;
- * unsigned short data_length;
- * unsigned short family;
- *
- * char *address;
- * char *number;
- * char *name;
- * char *data;
- *
- */
-
-Status XpSendOneTicket(
- Display *display,
- Window window,
- Xauth *ticket,
- Bool more )
-{
- XClientMessageEvent ev;
- int bigstrlen, left, gofor;
- char *bigstr, *tptr;
- Status status;
-
- /*
- * Fixed portion of event.
- */
- ev.type = ClientMessage;
- ev.display = display;
- ev.window = window;
- ev.message_type = XInternAtom( display, "PDM_MAIL", False );
-
- /*
- * Special build the first ClientMessage to carry the
- * ticket transfer header.
- */
- ev.format = 16;
-
- if (!ticket) {
- ev.data.s[0] = 0;
- }
- else {
- if (more)
- ev.data.s[0] = 2;
- else
- ev.data.s[0] = 1;
- ev.data.s[1] = (short) ticket->address_length;
- ev.data.s[2] = (short) ticket->number_length;
- ev.data.s[3] = (short) ticket->name_length;
- ev.data.s[4] = (short) ticket->data_length;
- ev.data.s[5] = (short) ticket->family;
- }
-
- status = XSendEvent( display, window, False, 0L, (XEvent *) &ev );
- if (!status)
- return( (Status) 0 );
-
- if (!ticket)
- return( (Status) 1 );;
-
- /*
- * Break down the remaining ticket data and build the
- * second thru N ClientMessages.
- */
- ev.format = 8;
- bigstrlen = (int) ticket->address_length +
- (int) ticket->number_length +
- (int) ticket->name_length +
- (int) ticket->data_length;
-
- bigstr = Xmalloc( bigstrlen );
-
- tptr = bigstr;
- memcpy( tptr, ticket->address, ticket->address_length );
- tptr += ticket->address_length;
- memcpy( tptr, ticket->number, ticket->number_length );
- tptr += ticket->number_length;
- memcpy( tptr, ticket->name, ticket->name_length );
- tptr += ticket->name_length;
- memcpy( tptr, ticket->data, ticket->data_length );
-
- left = bigstrlen;
- tptr = bigstr;
-
- while ( left ) {
- if (left > 20)
- gofor = 20;
- else
- gofor = left;
-
- memcpy( ev.data.b, tptr, gofor );
-
- tptr += gofor;
- left -= gofor;
-
- status = XSendEvent( display, window, False, 0L, (XEvent *) &ev );
- if (!status) {
- Xfree( bigstr );
- return( (Status) 0 );
- }
- }
-
- Xfree( bigstr );
-
- return( (Status) 1 );
-}
-
-Status XpSendAuth( Display *display, Window window )
-{
-
- FILE *auth_file;
- char *auth_name;
- Xauth *entry;
-
- if ( !(auth_name = getenv( PDM_XAUTHORITY_ENV_VAR )) ) {
- return( (Status) 0 );
- /* auth_name = XauFileName (); */
- }
-
- if (access (auth_name, R_OK) != 0) /* checks REAL id */
- return( (Status) 0 );
-
- auth_file = fopen (auth_name, "r");
- if (!auth_file)
- return( (Status) 0 );
-
- for (;;) {
- entry = XauReadAuth (auth_file);
- if (!entry)
- break;
-
- /*
- * NOTE: in and around this area, an optimization can
- * be made. Rather than sending all the tickets in
- * .Xauthority, just pull out the *one* that is needed
- * by the PDM.
- */
- XpSendOneTicket( display, window, entry, True );
-
- XauDisposeAuth (entry);
- }
-
- XpSendOneTicket( display, window, (Xauth *) NULL, False );
-
- (void) fclose (auth_file);
-
- return( (Status) 1 );
-}
-
-/******************************************************************************
- *
- *
- */
-Status
-XpGetAuthParams (
- Display *print_display,
- Display *video_display,
- Display **sel_display, /* return value */
- Atom *sel_atom, /* return value */
- Atom *sel_target_atom /* return value */
-)
-{
- *sel_display = _XpGetSelectionServer( print_display, video_display,
- sel_atom );
-
- if (*sel_display == NULL) {
- /*
- * Error - cannot determine or establish a selection_display.
- */
- return( (Status) NULL );
- }
-
- /*
- * Create property and transfer data to.
- */
- *sel_target_atom = XInternAtom( *sel_display, "PDM_MBOX", False );
-}
-
-
-/******************************************************************************
- ******************************************************************************
- **
- ** UNSUPPORTED ROUTINES used for testing and debugging.
- **
- **/
-
-
-/******************************************************************************
- *
- * Predicate routines to dig out events from the users event queue.
- */
-
-/*
- * client_data structures to use with XIfEvent()
- */
-typedef struct {
- Window requestor;
- Atom selection;
- Atom target;
-} Dosnrec;
-
-typedef struct {
- Window window;
- Atom atom;
-} Dopnrec, Docmrec;
-
-
-/*
- * Dig out a selection notify from the users event
- * queue.
- */
-static Bool digOutSelectionNotify(
- Display *display,
- XEvent *event,
- char *arg
-)
-
-{
- Dosnrec *t;
-
- if (event->type == SelectionNotify) {
- t = (Dosnrec *) arg;
-
- /*
- * Selection complete because of good reply.
- */
- if ( ( t->requestor == event->xselection.requestor ) &&
- ( t->selection == event->xselection.selection ) &&
- ( t->target == event->xselection.target ) ) {
- return( True );
- }
-
- /*
- * Selection complete because of problem, and X-Server
- * had to generate the event.
- */
- if ( ( t->requestor == event->xselection.requestor ) &&
- ( t->selection == event->xselection.selection ) &&
- ( None == event->xselection.property ) ) {
- return( True );
- }
- }
- return( False );
-}
-
-/*
- * Dig out a property notify event for the XpNotifyPdm
- * selection mechanism from the users event queue.
- */
-static Bool digOutPropertyNotify(
- Display *display,
- XEvent *event,
- char *arg
-)
-{
- Dopnrec *t;
-
- if (event->type == PropertyNotify) {
- t = (Dopnrec *) arg;
- if ( ( t->window == event->xproperty.window ) &&
- ( t->atom == event->xproperty.atom ) ) {
- return( True );
- }
- }
- return( False );
-}
-
-/*
- * Dig out a ClientMessage of type PDM_REPLY.
- */
-static Bool digOutClientMessage(
- Display *display,
- XEvent *event,
- char *arg
-)
-{
- Docmrec *t;
-
- if (event->type == ClientMessage) {
- t = (Docmrec *) arg;
- if ( ( t->window == event->xclient.window ) &&
- ( t->atom == event->xclient.message_type ) ) {
- return( True );
- }
- }
- return( False );
-}
-
-
-
-/******************************************************************************
- *
- * XpCookieToPdm
- */
-static char *
-XpCookieToPdm (
- Display *print_display,
- Display *video_display,
- Window sel_window
-)
-{
- Display *sel_display;
- Atom prop_atom, sel_atom, pdm_mbox_atom, ttype;
- Dosnrec dosnrec;
- Dopnrec dopnrec;
- XEvent tevent;
- int tformat;
- unsigned long nitems, bytes_after;
- unsigned char *return_data;
- char *sel_str;
- char cdata[2048];
- Window tmpw;
-
-
- if ( !getenv(PDM_XAUTHORITY_ENV_VAR) ) {
- /*
- * short cut for lack of cookie file.
- */
- return( (char *) NULL );
- }
-
- if (! XpGetAuthParams( print_display, video_display,
- &sel_display, &sel_atom, &pdm_mbox_atom ) ) {
- sprintf(cdata,
- "XpCookieToPdm: XpGetAuthParams failed");
- return( _xpstrdup( cdata ) );
- }
-
- prop_atom = XInternAtom( sel_display, "PDM_MBOX_PROP", False );
-
- XConvertSelection( sel_display, sel_atom, pdm_mbox_atom,
- prop_atom, sel_window, CurrentTime );
-
- /*
- * Hang out waiting for a SelectionNotify. Dig out from
- * event queue when it arrives.
- */
- dosnrec.requestor = sel_window;
- dosnrec.selection = sel_atom;
- dosnrec.target = pdm_mbox_atom;
-
- XIfEvent( sel_display, &tevent, digOutSelectionNotify, (char *) &dosnrec );
-
- /*
- * See if selection was successful.
- */
- if ( tevent.xselection.property == None ) {
- /*
- * The selection failed.
- */
- sel_str = XGetAtomName( sel_display, sel_atom );
- sprintf(cdata,
- "XpCookieToPdm: Unable to make selection on %s", sel_str);
- XFree(sel_str);
-
- XDeleteProperty( sel_display, sel_window, prop_atom );
- if ((sel_display != print_display) && (sel_display != video_display))
- XCloseDisplay( sel_display );
- return( _xpstrdup( cdata ) );
- }
-
- /*
- * Read property content for status.
- */
- XGetWindowProperty( sel_display, sel_window,
- prop_atom, 0, 100000, True, AnyPropertyType,
- &ttype, &tformat, &nitems, &bytes_after,
- &return_data );
-
- /*
- * So that the client won't see how XpCookieToPdm is implemented,
- * run through the event queue, dig out, and destroy all
- * PropertyNotify events related to this call.
- */
- dopnrec.window = sel_window;
- dopnrec.atom = prop_atom;
- while ( XCheckIfEvent( sel_display, &tevent, digOutPropertyNotify,
- (char *) &dopnrec ) );
-
- if ((sel_display != print_display) && (sel_display != video_display))
- XCloseDisplay( sel_display );
-
- if ((ttype != XA_WINDOW) && (tformat != 32) && (nitems != 1)) {
- /*
- * Unable to read SelectionNotify property.
- */
- sprintf(cdata,
- "XpCookieToPdm: Unable to read SelectionNotify property" );
- return( _xpstrdup( cdata ) );
- }
-
- tmpw = *((Window *) return_data);
- Xfree( return_data );
-
- /*
- * Now send cookie information.
- */
- XpSendAuth( sel_display, tmpw );
-
- return( (char *) NULL );
-}
-
-
-/******************************************************************************
- *
- * XpNotifyPdm
- */
-char *
-XpNotifyPdm (
- Display *print_display,
- Window print_window,
- XPContext print_context,
- Display *video_display,
- Window video_window,
- Bool auth_flag
-)
-{
- enum { XA_PDM_CLIENT_PROP, XA_PDM_START, XA_PDM_START_OK,
- XA_PDM_START_VXAUTH, XA_PDM_START_PXAUTH, XA_PDM_START_ERROR,
- NUM_ATOMS };
- static char *atom_names[] = {
- "PDM_CLIENT_PROP", "PDM_START", "PDM_START_OK",
- "PDM_START_VXAUTH", "PDM_START_PXAUTH", "PDM_START_ERROR" };
-
- char cdata[2048];
- char *tptr;
- Dosnrec dosnrec;
- Dopnrec dopnrec;
- XEvent tevent;
-
- Display *sel_display;
- int sel_screen;
- Atom sel_atom;
- char *sel_str;
-
- Window sel_window;
- Atom prop_type;
- int prop_format;
- unsigned char *prop_data;
- int prop_nelements;
-
- Atom ttype;
- int tformat;
- unsigned long nitems, bytes_after;
- unsigned char *return_data;
-
- int tmpi;
- Atom atoms[NUM_ATOMS];
-
-
-
- if ( ! XpGetPdmStartParams( print_display, print_window, print_context,
- video_display, video_window,
- &sel_display,
- &sel_atom,
- &prop_type,
- &prop_format,
- &prop_data,
- &prop_nelements ) ) {
-
- sprintf(cdata, "XpNotifyPdm: XpGetPdmStartParams failed" );
- return( _xpstrdup( cdata ) );
- }
-
-
- sel_screen = DefaultScreen( sel_display );
- sel_window = XCreateSimpleWindow( sel_display,
- DefaultRootWindow( sel_display ),
- 0, 0, 1, 1, 1,
- BlackPixel(sel_display, sel_screen),
- WhitePixel(sel_display, sel_screen) );
-
- /*
- * Possibly send over authorization cookies first.
- */
- if (auth_flag) {
- tptr = XpCookieToPdm ( print_display, video_display, sel_window );
- if (tptr)
- return( tptr );
- }
-
- /*
- * Create property and transfer data to.
- */
- XInternAtoms( sel_display, atom_names, NUM_ATOMS, False, atoms );
-
- XChangeProperty( sel_display,
- sel_window, atoms[XA_PDM_CLIENT_PROP],
- prop_type,
- prop_format,
- PropModeReplace,
- prop_data,
- prop_nelements );
-
- XFree( prop_data );
-
- /*
- * Tickle PDM_MANAGER selection with PDM_START target
- */
- XConvertSelection( sel_display, sel_atom, atoms[XA_PDM_START],
- atoms[XA_PDM_CLIENT_PROP], sel_window, CurrentTime );
-
- /*
- * Hang out waiting for a SelectionNotify. Dig out from
- * event queue when it arrives.
- */
- dosnrec.requestor = sel_window;
- dosnrec.selection = sel_atom;
- dosnrec.target = atoms[XA_PDM_START];
-
- XIfEvent( sel_display, &tevent, digOutSelectionNotify, (char *) &dosnrec );
-
- /*
- * See if selection was successful.
- */
- if ( tevent.xselection.property == None ) {
- /*
- * The selection failed.
- */
- sel_str = XGetAtomName( sel_display, sel_atom );
- sprintf(cdata,
- "XpNotifyPdm: Unable to make selection on %s", sel_str);
- XFree(sel_str);
-
- XDeleteProperty( sel_display, sel_window, atoms[XA_PDM_CLIENT_PROP] );
- XDestroyWindow( sel_display, sel_window );
- if ((sel_display != print_display) && (sel_display != video_display))
- XCloseDisplay( sel_display );
- return( _xpstrdup( cdata ) );
- }
-
- /*
- * Read property content for status.
- */
- XGetWindowProperty( sel_display, sel_window,
- atoms[XA_PDM_CLIENT_PROP],
- 0, 100000, True, AnyPropertyType,
- &ttype, &tformat, &nitems, &bytes_after,
- &return_data );
-
- /*
- * So that the client won't see how XpNotifyPdm is implemented,
- * run through the event queue, dig out, and destroy all
- * PropertyNotify events related to this call.
- */
- dopnrec.window = sel_window;
- dopnrec.atom = atoms[XA_PDM_CLIENT_PROP];
- while ( XCheckIfEvent( sel_display, &tevent, digOutPropertyNotify,
- (char *) &dopnrec ) );
-
- XDestroyWindow( sel_display, sel_window );
- if ((sel_display != print_display) && (sel_display != video_display))
- XCloseDisplay( sel_display );
-
- if ((ttype != XA_ATOM) && (tformat != 32) && (nitems != 1)) {
- /*
- * Unable to read SelectionNotify property.
- */
- sprintf(cdata,
- "XpNotifyPdm: Unable to read SelectionNotify property" );
- return( _xpstrdup( cdata ) );
- }
-
- tmpi = *((Atom *) return_data);
- Xfree( return_data );
-
- if ( tmpi == atoms[XA_PDM_START_OK] ) {
- return( (char *) NULL );
- }
- else if ( tmpi == atoms[XA_PDM_START_VXAUTH] ) {
- sprintf(cdata,
- "XpNotifyPdm: PDM not authorized to connect to video display." );
- return( _xpstrdup( cdata ) );
- }
- else if ( tmpi == atoms[XA_PDM_START_PXAUTH] ) {
- sprintf(cdata,
- "XpNotifyPdm: PDM not authorized to connect to print display." );
- return( _xpstrdup( cdata ) );
- }
- else if ( tmpi == atoms[XA_PDM_START_ERROR] ) {
- sprintf(cdata,
- "XpNotifyPdm: PDM encountered an error. See PDM log file." );
- return( _xpstrdup( cdata ) );
- }
- else {
- sprintf(cdata,
- "XpNotifyPdm: unknown PDM error." );
- return( _xpstrdup( cdata ) );
- }
-}
-
diff --git a/xc/lib/Xp/XpPage.c b/xc/lib/Xp/XpPage.c
deleted file mode 100644
index 073b5875a..000000000
--- a/xc/lib/Xp/XpPage.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* $XConsortium: XpPage.c /main/2 1996/11/16 15:21:49 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 "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-
-typedef struct {
- int event_base_return;
- XPContext context;
-} _XpDiscardPageRec;
-
-static Bool _XpDiscardPage(Display *dpy, XEvent *event, XPointer arg)
-{
- _XpDiscardPageRec *disrec = (_XpDiscardPageRec *) arg;
-
- if (event->type != disrec->event_base_return + XPPrintNotify)
- return False;
-
- if (disrec->context != ((XPPrintEvent *) event)->context)
- return False;
-
- if (((XPPrintEvent *) event)->detail == XPEndPageNotify) {
- return False;
- }
-
- return True;
-}
-
-
-void
-XpStartPage (
- Display *dpy,
- Window window
-)
-{
- xPrintStartPageReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintStartPage,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintStartPage;
- req->window = window;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-void
-XpEndPage (
- Display *dpy
-)
-{
- xPrintEndPageReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintEndPage,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintEndPage;
- req->cancel = False;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-void
-XpCancelPage (
- Display *dpy,
- Bool discard
-)
-{
- xPrintEndPageReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- _XpDiscardPageRec disrec;
- XEvent event;
-
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintEndPage,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintEndPage;
- req->cancel = True;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-
- if (discard) {
- /*
- * get context and effectively do a sync of events.
- */
- disrec.event_base_return = info->codes->first_event;
- disrec.context = XpGetContext(dpy);
-
- /*
- * discard page XPPrintNotify events.
- */
- while (XCheckIfEvent(dpy, &event, _XpDiscardPage, (XPointer) &disrec))
- {
- /*EMPTY*/
- }
- }
-}
-
diff --git a/xc/lib/Xp/XpPageDim.c b/xc/lib/Xp/XpPageDim.c
deleted file mode 100644
index cbc79dd30..000000000
--- a/xc/lib/Xp/XpPageDim.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $XConsortium: XpPageDim.c /main/2 1996/11/16 15:21:53 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-
-Status
-XpGetPageDimensions (
- Display *dpy,
- XPContext print_context,
- unsigned short *width,
- unsigned short *height,
- XRectangle *reproducible_area
-)
-{
- xPrintGetPageDimensionsReq *req;
- xPrintGetPageDimensionsReply rep;
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return (/* No such extension */ 0L );
-
- LockDisplay (dpy);
-
- GetReq(PrintGetPageDimensions,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetPageDimensions;
- req->printContext = print_context;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return(/* No such extension */ 0L);
- }
-
- *width = rep.width;
- *height = rep.height;
- reproducible_area-> x = rep.rx;
- reproducible_area-> y = rep.ry;
- reproducible_area-> width = rep.rwidth;
- reproducible_area-> height = rep.rheight;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return ( 1L );
-}
-
diff --git a/xc/lib/Xp/XpPrinter.c b/xc/lib/Xp/XpPrinter.c
deleted file mode 100644
index a7464bda7..000000000
--- a/xc/lib/Xp/XpPrinter.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* $TOG: XpPrinter.c /main/4 1997/05/28 11:41:47 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/lib/Xp/XpPrinter.c,v 1.4 1997/05/31 13:51:17 dawes Exp $ */
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-#define _XpPadOut(len) (((len) + 3) & ~3)
-
-XPPrinterList
-XpGetPrinterList (
- Display *dpy,
- char *printer_name,
- int *list_count /* return value */
-)
-{
- xPrintGetPrinterListReq *req;
- xPrintGetPrinterListReply rep;
-
- int printer_name_len, locale_len;
- char *locale;
-
- /* For decoding the variable portion of Reply */
- CARD32 dataLenVR;
- CARD8 *dataVR; /* aka STRING8 */
-
- XPPrinterList ptr_list;
-
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
- /* For converting root winID to corresponding ScreenPtr */
- Screen *checkScr;
- int i,j;
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return ( (XPPrinterList) NULL ); /* No such extension */
-
- /*
- * Fetch locale information. Note: XpGetLocaleNetString has
- * a thread-safe mutex on _Xglobal_lock.
- */
- locale = XpGetLocaleNetString();
-
- LockDisplay (dpy);
-
- GetReq(PrintGetPrinterList,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintGetPrinterList;
-
- /*
- * Compute lengths of variable portions.
- */
- if ( printer_name == (char *) NULL )
- req->printerNameLen = 0;
- else if ( *printer_name == (char) NULL )
- req->printerNameLen = 0;
- else {
- printer_name_len = strlen( printer_name );
- req->length += _XpPadOut(printer_name_len) >> 2;
- req->printerNameLen = (unsigned long) printer_name_len;
- }
-
- if ( locale == (char *) NULL )
- req->localeLen = 0;
- else if ( *locale == (char) NULL )
- req->localeLen = 0;
- else {
- locale_len = strlen( locale );
- req->length += _XpPadOut(locale_len) >> 2;
- req->localeLen = (unsigned long) locale_len;
- }
-
- /*
- * Attach variable data.
- */
- if (req->printerNameLen)
- Data( dpy, (char *) printer_name, (long) req->printerNameLen );
-
- if (req->localeLen)
- Data( dpy, (char *) locale, (long) req->localeLen );
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (XPPrinterList) NULL ); /* error */
- }
-
- XFree(locale);
-
- *list_count = rep.listCount;
-
- if (*list_count) {
- ptr_list = (XPPrinterList)
- Xmalloc( (unsigned) (sizeof(XPPrinterRec) * (*list_count + 1)));
-
- if (!ptr_list) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (XPPrinterList) NULL ); /* malloc error */
- }
-
- /*
- * NULL last entry so XpFreePrinterList can work without a list_count
- */
- ptr_list[*list_count].name = (char *) NULL;
- ptr_list[*list_count].desc = (char *) NULL;
-
- for ( i = 0; i < *list_count; i++ ) {
- /*
- * Pull printer length and then name.
- */
- _XRead32 (dpy, (char *) &dataLenVR, (long) sizeof(dataLenVR) );
-
- if (dataLenVR) {
- dataVR = (CARD8 *) Xmalloc( (unsigned) dataLenVR + 1 );
-
- if (!dataVR) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (XPPrinterList) NULL ); /* malloc error */
- }
-
- _XReadPad (dpy, (char *) dataVR, (long) dataLenVR);
- dataVR[dataLenVR] = 0;
- ptr_list[i].name = (char *) dataVR;
- }
- else {
- ptr_list[i].name = (char *) NULL;
- }
-
- /*
- * Pull localized description length and then description.
- */
- _XRead32 (dpy, (char *) &dataLenVR, (long) sizeof(dataLenVR) );
-
- if (dataLenVR) {
- dataVR = (CARD8 *) Xmalloc( (unsigned) dataLenVR + 1 );
-
- if (!dataVR) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (XPPrinterList) NULL ); /* malloc error */
- }
-
- _XReadPad (dpy, (char *) dataVR, (long) dataLenVR);
- dataVR[dataLenVR] = 0;
- ptr_list[i].desc = (char *) dataVR;
- }
- else {
- ptr_list[i].desc = (char *) NULL;
- }
- }
- }
- else {
- ptr_list = (XPPrinterList) NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ( ptr_list );
-}
-
-
-void
-XpFreePrinterList (
- XPPrinterList printer_list
-)
-{
- int i;
-
-
- if ( printer_list == NULL )
- return;
-
- i = 0;
- while (printer_list[i].name != NULL) {
- Xfree( (char *) printer_list[i].name );
- Xfree( (char *) printer_list[i].desc );
- i++;
- }
-
- Xfree( (char *) printer_list );
-}
-
-
-void
-XpRehashPrinterList (
- Display *dpy
-)
-{
- xPrintRehashPrinterListReq *req;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- LockDisplay (dpy);
-
- GetReq(PrintRehashPrinterList,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintRehashPrinterList;
-
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
diff --git a/xc/lib/Xp/XpPutData.c b/xc/lib/Xp/XpPutData.c
deleted file mode 100644
index 9eabd9391..000000000
--- a/xc/lib/Xp/XpPutData.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $XConsortium: XpPutData.c /main/2 1996/11/16 15:22:03 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 "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-#define _XpPadOut(len) (((len) + 3) & ~3)
-
-void
-XpPutDocumentData (
- Display *dpy,
- Drawable drawable,
- unsigned char *data,
- int data_len,
- char *doc_fmt,
- char *options
-)
-{
- xPrintPutDocumentDataReq *req;
- long maxcando, varlen;
- int doc_fmt_len, options_len;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
- return; /* NoSuchExtension */
-
- doc_fmt_len = strlen( doc_fmt );
- options_len = strlen( options );
-
- maxcando = XExtendedMaxRequestSize(dpy);
- if (!maxcando)
- maxcando = XMaxRequestSize(dpy);
- varlen = (_XpPadOut(data_len) +
- _XpPadOut(doc_fmt_len) + _XpPadOut(options_len)) >> 2;
- if (maxcando < ((sz_xPrintPutDocumentDataReq >> 2) + varlen))
- return;
-
- LockDisplay (dpy);
-
- GetReq(PrintPutDocumentData,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintPutDocumentData;
- req->drawable = drawable;
- req->len_data = data_len;
- req->len_fmt = doc_fmt_len;
- req->len_options = options_len;
- SetReqLen(req, varlen, varlen);
-
- /*
- * Send strings, each with padding provided by Data()
- */
- Data( dpy, (char *) data, data_len );
- Data( dpy, doc_fmt, doc_fmt_len );
- Data( dpy, options, options_len );
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return; /* Success */
-}
-
diff --git a/xc/lib/Xp/XpScreens.c b/xc/lib/Xp/XpScreens.c
deleted file mode 100644
index 1bbfa6725..000000000
--- a/xc/lib/Xp/XpScreens.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* $XConsortium: XpScreens.c /main/2 1996/11/16 15:22:09 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.
- **
- ******************************************************************************
- *****************************************************************************/
-
-#define NEED_REPLIES
-
-#include "Printstr.h"
-#include "Xlibint.h"
-#include "extutil.h"
-
-
-Screen **
-XpQueryScreens (
- Display *dpy,
- int *list_count /* return value */
-)
-{
- xPrintQueryScreensReq *req;
- xPrintQueryScreensReply rep;
-
- /* For decoding the variable portion of Reply */
- CARD32 rootWindow;
-
- /* For converting root winID to corresponding ScreenPtr */
- Screen **scr_list;
- Screen *checkScr;
- int i,j;
-
- XExtensionVersion *ext;
- XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
-
-
- if (XpCheckExtInit(dpy, XP_DONT_CHECK) == -1)
- return ( (Screen **) NULL ); /* No such extension */
-
- LockDisplay (dpy);
-
- GetReq(PrintQueryScreens,req);
- req->reqType = info->codes->major_opcode;
- req->printReqType = X_PrintQueryScreens;
-
- if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (Screen **) NULL ); /* error */
- }
-
- *list_count = rep.listCount;
-
- if (*list_count) {
- scr_list = (Screen **)
- Xmalloc( (unsigned) (sizeof(Screen *) * *list_count) );
-
- if (!scr_list) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ( (Screen **) NULL ); /* malloc error */
- }
-
- for ( i = 0; i < *list_count; i++ ) {
- /*
- * Pull printer length and then name.
- */
- _XRead32 (dpy, (char *) &rootWindow, (long) sizeof(rootWindow) );
-
- for ( j = 0; j < XScreenCount(dpy); j++ ) {
- checkScr = XScreenOfDisplay(dpy, j);
- if ( XRootWindowOfScreen(checkScr) == (Window) rootWindow ) {
- scr_list[i] = checkScr;
- break;
- }
- }
- }
- }
- else {
- scr_list = (Screen **) NULL;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return ( scr_list );
-}
-
diff --git a/xc/lib/Xp/Xpos2.def b/xc/lib/Xp/Xpos2.def
deleted file mode 100644
index fb3334efc..000000000
--- a/xc/lib/Xp/Xpos2.def
+++ /dev/null
@@ -1,45 +0,0 @@
-LIBRARY XP
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xp/Xpos2.def,v 1.2 1999/04/29 09:13:33 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE
- 32768
-EXPORTS
- XpCancelDoc @ 1
- XpCancelJob @ 2
- XpCancelPage @ 3
- XpCreateContext @ 4
- XpDestroyContext @ 5
- XpEndDoc @ 6
- XpEndJob @ 7
- XpEndPage @ 8
- XpFreePrinterList @ 9
- XpGetAttributes @ 10
- XpGetAuthParams @ 11
- XpGetContext @ 12
- XpGetDocumentData @ 13
- XpGetLocaleHinter @ 14
- XpGetLocaleNetString @ 15
- XpGetOneAttribute @ 16
- XpGetPageDimensions @ 17
- XpGetPdmStartParams @ 18
- XpGetPrinterList @ 19
- XpGetScreenOfContext @ 20
- XpInputSelected @ 21
- XpNotifyPdm @ 22
- XpPutDocumentData @ 23
- XpQueryExtension @ 24
- XpQueryScreens @ 25
- XpQueryVersion @ 26
- XpRehashPrinterList @ 27
- XpSelectInput @ 28
- XpSendAuth @ 29
- XpSendOneTicket @ 30
- XpSetAttributes @ 31
- XpSetContext @ 32
- XpSetLocaleHinter @ 33
- XpStartDoc @ 34
- XpStartJob @ 35
- XpStartPage @ 36
diff --git a/xc/lib/Xp/Xpos2.rsp b/xc/lib/Xp/Xpos2.rsp
deleted file mode 100644
index 49987371d..000000000
--- a/xc/lib/Xp/Xpos2.rsp
+++ /dev/null
@@ -1,5 +0,0 @@
-XpAttr.obj XpContext.obj XpDoc.obj XpExtUtil.obj XpExtVer.obj XpGetData.obj+
-XpImageRes.obj XpInput.obj XpJob.obj XpLocale.obj XpNotifyPdm.obj XpPage.obj+
-XpPageDim.obj XpPrinter.obj XpPutData.obj XpScreens.obj /NOI /NOL /NOD /BAT
-Xp.dll
-Xp.map
diff --git a/xc/lib/Xpm/Imakefile b/xc/lib/Xpm/Imakefile
deleted file mode 100644
index 3c4c47bf8..000000000
--- a/xc/lib/Xpm/Imakefile
+++ /dev/null
@@ -1,98 +0,0 @@
-XCOMM $XFree86: xc/lib/Xpm/Imakefile,v 1.2 1999/01/31 12:21:22 dawes Exp $
-
-/* This is a simplified version of the standard Xpm Imakefile */
-
-#define DoNormalLib NormalLibXpm
-#define DoSharedLib SharedLibXpm
-#define DoExtraLib SharedLibXpm
-#define DoDebugLib DebugLibXpm
-#define DoProfileLib ProfileLibXpm
-#define HasSharedData NO
-#define LibName Xpm
-#define SoRev SOXPMREV
-#define IncSubdir X11
-
-#ifdef SharedXpmReqs
-REQUIREDLIBS = SharedXpmReqs
-#endif
-
-/*
- * if your system doesn't provide strcasecmp add -DNEED_STRCASECMP
- * if your system doesn't provide strdup add -DNEED_STRDUP
- * if your system doesn't provide pipe add -DNO_ZPIPE
- * if on your system sprintf doesn't return the number of bytes transmitted
- * add -DVOID_SPRINTF
- */
-
-#if defined(UltrixArchitecture) || \
- (defined(MipsArchitecture) && !defined(SGIArchitecture))
-STRDUPDEF = -DNEED_STRDUP
-#endif
-
-#if !HasStrcasecmp
-STRCASECMPDEF = -DNEED_STRCASECMP
-#endif
-
-#if defined(SunArchitecture) && !defined(SVR4Architecture)
-SPRINTFDEF = -DVOID_SPRINTF
-#endif
-
-#if defined(Win32Architecture)
-ZPIPEDEF = -DNO_ZPIPE
-#endif
-
-DEFINES = $(STRDUPDEF) $(STRCASECMPDEF) $(SPRINTFDEF) $(ZPIPEDEF)
-
-HEADERS = xpm.h
-
- SRCS = data.c create.c misc.c rgb.c scan.c parse.c hashtab.c \
- CrBufFrI.c CrDatFrP.c CrPFrBuf.c RdFToI.c WrFFrI.c \
- CrBufFrP.c CrIFrBuf.c CrPFrDat.c RdFToP.c WrFFrP.c \
- CrDatFrI.c CrIFrDat.c RdFToDat.c WrFFrDat.c \
- Attrib.c CrIFrP.c CrPFrI.c Image.c Info.c RdFToBuf.c WrFFrBuf.c
-
- OBJS = data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \
- CrBufFrI.o CrDatFrP.o CrPFrBuf.o RdFToI.o WrFFrI.o \
- CrBufFrP.o CrIFrBuf.o CrPFrDat.o RdFToP.o WrFFrP.o \
- CrDatFrI.o CrIFrDat.o RdFToDat.o WrFFrDat.o \
- Attrib.o CrIFrP.o CrPFrI.o Image.o Info.o RdFToBuf.o WrFFrBuf.o
-
- XPMDIR = $(TOP)/extras/Xpm
- XPMLIBDIR = $(TOP)/extras/Xpm/lib
-
- INCLUDES = -I$(XPMLIBDIR)
- LINTLIBS = $(LINTXTOLL) $(LINTXLIB)
-
-#include <Library.tmpl>
-
-LinkSourceFile(data.c,$(XPMLIBDIR))
-LinkSourceFile(create.c,$(XPMLIBDIR))
-LinkSourceFile(misc.c,$(XPMLIBDIR))
-LinkSourceFile(rgb.c,$(XPMLIBDIR))
-LinkSourceFile(scan.c,$(XPMLIBDIR))
-LinkSourceFile(parse.c,$(XPMLIBDIR))
-LinkSourceFile(hashtab.c,$(XPMLIBDIR))
-LinkSourceFile(CrBufFrI.c,$(XPMLIBDIR))
-LinkSourceFile(CrDatFrP.c,$(XPMLIBDIR))
-LinkSourceFile(CrPFrBuf.c,$(XPMLIBDIR))
-LinkSourceFile(RdFToI.c,$(XPMLIBDIR))
-LinkSourceFile(WrFFrI.c,$(XPMLIBDIR))
-LinkSourceFile(CrBufFrP.c,$(XPMLIBDIR))
-LinkSourceFile(CrIFrBuf.c,$(XPMLIBDIR))
-LinkSourceFile(CrPFrDat.c,$(XPMLIBDIR))
-LinkSourceFile(RdFToP.c,$(XPMLIBDIR))
-LinkSourceFile(WrFFrP.c,$(XPMLIBDIR))
-LinkSourceFile(CrDatFrI.c,$(XPMLIBDIR))
-LinkSourceFile(CrIFrDat.c,$(XPMLIBDIR))
-LinkSourceFile(RdFToDat.c,$(XPMLIBDIR))
-LinkSourceFile(WrFFrDat.c,$(XPMLIBDIR))
-LinkSourceFile(Attrib.c,$(XPMLIBDIR))
-LinkSourceFile(CrIFrP.c,$(XPMLIBDIR))
-LinkSourceFile(CrPFrI.c,$(XPMLIBDIR))
-LinkSourceFile(Image.c,$(XPMLIBDIR))
-LinkSourceFile(Info.c,$(XPMLIBDIR))
-LinkSourceFile(RdFToBuf.c,$(XPMLIBDIR))
-LinkSourceFile(WrFFrBuf.c,$(XPMLIBDIR))
-LinkSourceFile(xpm.h,$(XPMLIBDIR))
-
-DependTarget()
diff --git a/xc/lib/Xpm/Xpm-def.cpp b/xc/lib/Xpm/Xpm-def.cpp
deleted file mode 100644
index 12b86d63e..000000000
--- a/xc/lib/Xpm/Xpm-def.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-LIBRARY Xpm
-VERSION LIBRARY_VERSION
-EXPORTS
- XpmAttributesSize
- XpmCreateBufferFromImage
- XpmCreateBufferFromPixmap
- XpmCreateBufferFromXpmImage
- XpmCreateDataFromImage
- XpmCreateDataFromPixmap
- XpmCreateDataFromXpmImage
- XpmCreateImageFromBuffer
- XpmCreateImageFromData
- XpmCreateImageFromXpmImage
- XpmCreatePixmapFromBuffer
- XpmCreatePixmapFromData
- XpmCreatePixmapFromXpmImage
- XpmCreateXpmImageFromBuffer
- XpmCreateXpmImageFromData
- XpmCreateXpmImageFromImage
- XpmCreateXpmImageFromPixmap
- XpmFree
- XpmFreeAttributes
- XpmFreeExtensions
- XpmFreeXpmImage
- XpmFreeXpmInfo
- XpmGetErrorString
- XpmLibraryVersion
- XpmReadFileToBuffer
- XpmReadFileToData
- XpmReadFileToImage
- XpmReadFileToPixmap
- XpmReadFileToXpmImage
- XpmWriteFileFromBuffer
- XpmWriteFileFromData
- XpmWriteFileFromImage
- XpmWriteFileFromPixmap
- XpmWriteFileFromXpmImage
-
-/* $XFree86: xc/lib/Xpm/Xpm-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */
diff --git a/xc/lib/Xpm/Xpmos2.def b/xc/lib/Xpm/Xpmos2.def
deleted file mode 100644
index 9ff1ca080..000000000
--- a/xc/lib/Xpm/Xpmos2.def
+++ /dev/null
@@ -1,41 +0,0 @@
-LIBRARY XPM
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xpm/Xpmos2.def,v 1.1 1999/04/29 09:26:37 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 16384
-EXPORTS
- XpmCreatePixmapFromData @ 1
- XpmCreateDataFromPixmap @ 2
- XpmReadFileToPixmap @ 3
- XpmWriteFileFromPixmap @ 4
- XpmCreateImageFromData @ 5
- XpmCreateDataFromImage @ 6
- XpmReadFileToImage @ 7
- XpmWriteFileFromImage @ 8
- XpmCreateImageFromBuffer @ 9
- XpmCreatePixmapFromBuffer @ 10
- XpmCreateBufferFromImage @ 11
- XpmCreateBufferFromPixmap @ 12
- XpmReadFileToBuffer @ 13
- XpmWriteFileFromBuffer @ 14
- XpmReadFileToData @ 15
- XpmWriteFileFromData @ 16
- XpmAttributesSize @ 17
- XpmFreeAttributes @ 18
- XpmFreeExtensions @ 19
- XpmFreeXpmImage @ 20
- XpmFreeXpmInfo @ 21
- XpmGetErrorString @ 22
- XpmLibraryVersion @ 23
- XpmReadFileToXpmImage @ 24
- XpmWriteFileFromXpmImage @ 25
- XpmCreatePixmapFromXpmImage @ 26
- XpmCreateImageFromXpmImage @ 27
- XpmCreateXpmImageFromImage @ 28
- XpmCreateXpmImageFromPixmap @ 29
- XpmCreateDataFromXpmImage @ 30
- XpmCreateXpmImageFromData @ 31
- XpmCreateXpmImageFromBuffer @ 32
- XpmCreateBufferFromXpmImage @ 33
diff --git a/xc/lib/Xpm/Xpmos2.rsp b/xc/lib/Xpm/Xpmos2.rsp
deleted file mode 100644
index f57cbaa2e..000000000
--- a/xc/lib/Xpm/Xpmos2.rsp
+++ /dev/null
@@ -1,7 +0,0 @@
-Attrib.obj CrBufFrI.obj CrBufFrP.obj CrDatFrI.obj CrDatFrP.obj CrIFrBuf.obj+
-CrIFrDat.obj CrIFrP.obj CrPFrBuf.obj CrPFrDat.obj CrPFrI.obj Image.obj+
-Info.obj RdFToBuf.obj RdFToDat.obj RdFToI.obj RdFToP.obj WrFFrBuf.obj+
-WrFFrDat.obj WrFFrI.obj WrFFrP.obj create.obj data.obj hashtab.obj misc.obj+
-parse.obj rgb.obj scan.obj /NOI /NOL /NOD /BAT
-Xpm.dll
-Xpm.map
diff --git a/xc/lib/Xrandr/Imakefile b/xc/lib/Xrandr/Imakefile
deleted file mode 100644
index b429281dd..000000000
--- a/xc/lib/Xrandr/Imakefile
+++ /dev/null
@@ -1,33 +0,0 @@
-XCOMM $XFree86: xc/lib/Xrandr/Imakefile,v 1.1 2001/05/23 03:29:44 keithp Exp $
-
-
-#define DoNormalLib NormalLibXrandr
-#define DoSharedLib SharedLibXrandr
-#define DoDebugLib DebugLibXrandr
-#define DoProfileLib ProfileLibXrandr
-#define LibName Xrandr
-#define SoRev SOXRANDRREV
-#define IncSubdir X11
-#define IncSubSubdir extensions
-
-#include <Threads.tmpl>
-
-#ifdef SharedXrandrReqs
-REQUIREDLIBS = SharedXrandrReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = Xrandr.c
- OBJS = Xrandr.o
- LINTLIBS = $(LINTXLIB)
-
-HEADERS = Xrandr.h
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xrandr/Xrandr-def.cpp b/xc/lib/Xrandr/Xrandr-def.cpp
deleted file mode 100644
index 1c94e08a1..000000000
--- a/xc/lib/Xrandr/Xrandr-def.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-LIBRARY Xrandr
-VERSION LIBRARY_VERSION
-EXPORTS
- XRRCurrentConfig
- XRRFindDisplay
- XRRFreeScreenInfo
- XRRGetScreenInfo
- XRRQueryExtension
- XRRQueryVersion
- XRRRootToScreen
- XRRRotations
- XRRScreenChangeSelectInput
- XRRSetScreenConfig
- XRRSizes
- XRRTimes
- XRRVisualIDToVisual
- XRRVisualToDepth
-/* $XFree86: xc/lib/Xrandr/Xrandr-def.cpp,v 1.1 2001/08/19 15:22:58 alanh Exp $ */
diff --git a/xc/lib/Xrandr/Xrandr.c b/xc/lib/Xrandr/Xrandr.c
deleted file mode 100644
index 84dba2183..000000000
--- a/xc/lib/Xrandr/Xrandr.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- * $XFree86: xc/lib/Xrandr/Xrandr.c,v 1.6 2001/06/11 01:37:53 keithp Exp $
- *
- * Copyright © 2000 Compaq Computer Corporation, Inc.
- *
- * 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 Compaq not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Jim Gettys, Compaq Computer Corporation, Inc.
- */
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include "Xrandrint.h"
-
-XExtensionInfo XRRExtensionInfo;
-char XRRExtensionName[] = RANDR_NAME;
-
-static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire);
-static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire);
-
-static int
-XRRCloseDisplay (Display *dpy, XExtCodes *codes);
-
-static /* const */ XExtensionHooks rr_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- XRRCloseDisplay, /* close_display */
- XRRWireToEvent, /* wire_to_event */
- XRREventToWire, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static Bool XRRWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = XRRFindDisplay(dpy);
- XRRScreenChangeNotifyEvent *aevent;
- xRRScreenChangeNotifyEvent *awire;
-
- RRCheckExtension(dpy, info, False);
-
- switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
- {
- case RRScreenChangeNotify:
- awire = (xRRScreenChangeNotifyEvent *) wire;
- aevent = (XRRScreenChangeNotifyEvent *) event;
- aevent->type = awire->type & 0x7F;
- aevent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *) wire);
- aevent->send_event = (awire->type & 0x80) != 0;
- aevent->display = dpy;
- aevent->window = awire->window;
- aevent->root = awire->root;
- aevent->timestamp = awire->timestamp;
- aevent->config_timestamp = awire->configTimestamp;
- aevent->size_index = awire->sizeID;
- aevent->visual_group_index = awire->visualGroupID;
- aevent->rotation = awire->rotation;
- aevent->width = awire->widthInPixels;
- aevent->height = awire->heightInPixels;
- aevent->mwidth = awire->widthInMillimeters;
- aevent->mheight = awire->heightInMillimeters;
- return True;
- }
-
- return False;
-}
-
-static Status XRREventToWire(Display *dpy, XEvent *event, xEvent *wire)
-{
- XExtDisplayInfo *info = XRRFindDisplay(dpy);
- XRRScreenChangeNotifyEvent *aevent;
- xRRScreenChangeNotifyEvent *awire;
-
- RRCheckExtension(dpy, info, False);
-
- switch ((event->type & 0x7F) - info->codes->first_event)
- {
- case RRScreenChangeNotify:
- awire = (xRRScreenChangeNotifyEvent *) wire;
- aevent = (XRRScreenChangeNotifyEvent *) event;
- awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
- awire->rotation = (CARD8) aevent->rotation;
- awire->sequenceNumber = aevent->serial & 0xFFFF;
- awire->timestamp = aevent->timestamp;
- awire->configTimestamp = aevent->config_timestamp;
- awire->root = aevent->root;
- awire->window = aevent->window;
- awire->sizeID = aevent->size_index;
- awire->visualGroupID = aevent->visual_group_index;
- awire->widthInPixels = aevent->width;
- awire->heightInPixels = aevent->height;
- awire->widthInMillimeters = aevent->mwidth;
- awire->heightInMillimeters = aevent->mheight;
- return True;
- }
- return False;
-}
-
-XExtDisplayInfo *
-XRRFindDisplay (Display *dpy)
-{
- XExtDisplayInfo *dpyinfo;
-
- dpyinfo = XextFindDisplay (&XRRExtensionInfo, dpy);
- if (!dpyinfo)
- dpyinfo = XextAddDisplay (&XRRExtensionInfo, dpy,
- XRRExtensionName,
- &rr_extension_hooks,
- RRNumberEvents, 0);
- return dpyinfo;
-}
-
-static int
-XRRCloseDisplay (Display *dpy, XExtCodes *codes)
-{
- XExtDisplayInfo *info = XRRFindDisplay (dpy);
- if (info->data) XFree (info->data);
-
- return XextRemoveDisplay (&XRRExtensionInfo, dpy);
-}
-
-/****************************************************************************
- * *
- * RandR public interfaces *
- * *
- ****************************************************************************/
-int XRRVisualToDepth(Display *dpy, Visual *visual)
-{
- int s;
- for (s = 0; s < ScreenCount(dpy); s++) {
- Screen *sp = ScreenOfDisplay(dpy, s);
- int d;
- for (d = 0; d < sp->ndepths; d++) {
- int v;
- for (v = 0; v < sp->depths[s].nvisuals; v++) {
- if ( &sp->depths[s].visuals[v] == visual ) return d;
- }
- }
- }
- return -1; /* should not ever happen */
-}
-
-Visual *XRRVisualIDToVisual(Display *dpy, int screen, VisualID id)
-{
- int d, v;
- Screen *sp = ScreenOfDisplay(dpy, screen);
- for (d = 0; d < sp->ndepths; d++) {
- for (v = 0; v < sp->depths[d].nvisuals; v++) {
- if ( sp->depths[d].visuals[v].visualid == id )
- return (&sp->depths[d].visuals[v]);
- }
- }
- return NULL;
-}
-
-Rotation XRRRotations(XRRScreenConfiguration *config, Rotation *current_rotation)
-{
- *current_rotation = config->current_rotation;
- return config->rotations;
-}
-
-XRRScreenSize *XRRSizes(XRRScreenConfiguration *config, int *nsizes)
-{
- *nsizes = config->nsizes;
- return config->sizes;
-}
-
-Time XRRTimes (XRRScreenConfiguration *config, Time *config_timestamp)
-{
- *config_timestamp = config->config_timestamp;
- return config->timestamp;
-}
-
-SizeID XRRCurrentConfig (XRRScreenConfiguration *config, VisualGroupID *visual_group, Rotation *rotation)
-{
- *visual_group = (VisualGroupID) config->current_visual_group;
- *rotation = (Rotation) config->current_rotation;
- return (SizeID) config->current_size;
-}
-
-int XRRRootToScreen(Display *dpy, Window root)
-{
- int snum;
- for (snum = 0; snum < ScreenCount(dpy); snum++) {
- if (RootWindow(dpy, snum) == root) return snum;
- }
- return -1;
-}
-
-
-Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = XRRFindDisplay (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XRRQueryVersion (Display *dpy,
- int *major_versionp,
- int *minor_versionp)
-{
- XExtDisplayInfo *info = XRRFindDisplay (dpy);
- xRRQueryVersionReply rep;
- xRRQueryVersionReq *req;
-
- RRCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (RRQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->randrReqType = X_RRQueryVersion;
- req->majorVersion = RANDR_MAJOR;
- req->minorVersion = RANDR_MINOR;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy, Window window)
-{
- XExtDisplayInfo *info = XRRFindDisplay(dpy);
- xRRGetScreenInfoReply rep;
- xRRGetScreenInfoReq *req;
- int nbytes, rbytes;
- int i, j;
- int nvisuals, ngroups;
- int snum;
- xScreenSizes *psize;
- char *data;
- struct _XRRScreenConfiguration *scp;
- XRRVisualGroup *vgp;
- XRRGroupOfVisualGroup *gvgp;
- XRRVisualGroup **gp;
- XRRScreenSize *ssp;
- Visual **vgpp;
- CARD32 *data32;
- CARD16 *data16;
-
- RRCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (RRGetScreenInfo, req);
- req->reqType = info->codes->major_opcode;
- req->randrReqType = X_RRGetScreenInfo;
- req->window = window;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
- {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
- nbytes = (long) rep.length << 2;
- data = (char *) Xmalloc ((unsigned) nbytes);
- if (!data)
- {
- _XEatData (dpy, (unsigned long) nbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
- _XReadPad (dpy, data, nbytes);
- UnlockDisplay (dpy);
- SyncHandle ();
-
- /*
- * first we must compute how much space to allocate for
- * randr library's use; we'll allocate the structures in a single
- * allocation, on cleanlyness grounds.
- */
-
- /* pick up in the protocol buffer after the protocol size information */
- psize = (xScreenSizes *) data;
- data32 = (CARD32 *) &psize[rep.nSizes];
- vgp = (XRRVisualGroup *) ssp; /* visual groups after size structures */
- /* and groups of visual groups structures after the array of visual groups */
- gvgp = (XRRGroupOfVisualGroup *) &vgp[rep.nVisualGroups];
-
- /*
- * first we count up the number of groups
- */
- nvisuals = 0;
- for (i = 0; i < rep.nVisualGroups; i++) {
- j = *data32;
- data32 += j + 1;
- nvisuals += j;
- }
-
- /*
- * Next comes the groups of visual groups
- */
-
- data16 = (CARD16 *) data32;
- /*
- * We count up the number of groups
- */
- ngroups = 0;
- for (i = 0; i < rep.nGroupsOfVisualGroups; i++) {
- j = *data16;
- data16 += j + 1;
- ngroups += j;
- }
-
- rbytes = sizeof (XRRScreenConfiguration) +
- (rep.nVisualGroups * sizeof (XRRVisualGroup)) +
- (rep.nGroupsOfVisualGroups * sizeof (XRRGroupOfVisualGroup)) +
- (rep.nSizes * sizeof (XRRScreenSize)) +
- (nvisuals * sizeof (Visual *)) +
- (ngroups * sizeof (XRRGroupOfVisualGroup *));
-
- scp = (struct _XRRScreenConfiguration *) Xmalloc(rbytes);
- if (scp == NULL) return NULL;
-
-
- ssp = (XRRScreenSize *)(scp + 1);
- vgp = (XRRVisualGroup *) (&ssp[rep.nSizes]);
- gvgp = (XRRGroupOfVisualGroup *) (&vgp[rep.nVisualGroups]);
- vgpp = (Visual **) (&gvgp[rep.nGroupsOfVisualGroups]);
- gp = (XRRVisualGroup **) (&vgpp[ngroups]);
- /* set up the screen configuration structure */
- scp->screen = ScreenOfDisplay (dpy, (snum = XRRRootToScreen(dpy, rep.root)));
-
- scp->visual_group = vgp;
- scp->groups_of_visual_groups = gvgp;
- scp->sizes = ssp;
- scp->rotations = rep.setOfRotations;
- scp->current_size = rep.sizeID;
- scp->current_visual_group = rep.visualGroupID;
- scp->current_rotation = rep.rotation;
- scp->timestamp = rep.timestamp;
- scp->config_timestamp = rep.configTimestamp;
- scp->nsizes = rep.nSizes;
-
- /*
- * Time to unpack the data from the server.
- */
-
- /*
- * First comes the size information
- */
- psize = (xScreenSizes *) data;
- for (i = 0; i < rep.nSizes; i++) {
- ssp[i].width = psize[i].widthInPixels;
- ssp[i].height = psize[i].heightInPixels;
- ssp[i].mwidth = psize[i].widthInMillimeters;
- ssp[i].mheight = psize[i].heightInMillimeters;
- ssp[i].group = psize[i].visualGroup;
- }
- /*
- * Next comes the visual groups
- */
-
- data32 = (CARD32 *) &psize[i];
-
- for (i = 0; i < rep.nVisualGroups; i++) {
- vgp[i].visuals = vgpp;
- vgp[i].nvisuals = (int) *data32++;
- for (j = 0; j < vgp->nvisuals; j++) {
- *vgpp = XRRVisualIDToVisual(dpy, snum, (VisualID) *data32++);
- vgpp += 1;
- }
- }
-
-
- data16 = (CARD16 *) data32;
-
- for (i = 0; i < rep.nGroupsOfVisualGroups; i++) {
- gvgp[i].groups = gp;
- gvgp[i].ngroups = (int) *data16++;
- for (j = 0; j < gvgp[i].ngroups; j++) {
- gvgp[i].groups[j] = &vgp[*data16++];
- gp += 1;
- }
- }
-
- return (XRRScreenConfiguration *)(scp);
-}
-
-void XRRFreeScreenInfo (XRRScreenConfiguration *config)
-{
- Xfree (config);
-}
-
-void XRRScreenChangeSelectInput (Display *dpy, Window window, Bool enable)
-{
- XExtDisplayInfo *info = XRRFindDisplay (dpy);
- xRRScreenChangeSelectInputReq *req;
-
- RRSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- GetReq (RRScreenChangeSelectInput, req);
- req->reqType = info->codes->major_opcode;
- req->randrReqType = X_RRScreenChangeSelectInput;
- req->window = window;
- req->enable = xFalse;
- if (enable) req->enable = xTrue;
- UnlockDisplay (dpy);
- SyncHandle ();
- return;
-}
-
-Status XRRSetScreenConfig (Display *dpy,
- XRRScreenConfiguration *config,
- Drawable draw,
- int size_index,
- int visual_group_index,
- Rotation rotation, Time timestamp)
-{
- XExtDisplayInfo *info = XRRFindDisplay (dpy);
- xRRSetScreenConfigReply rep;
- xRRSetScreenConfigReq *req;
-
- RRCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (RRSetScreenConfig, req);
- req->reqType = info->codes->major_opcode;
- req->randrReqType = X_RRSetScreenConfig;
- req->drawable = draw;
- req->sizeID = size_index;
- req->visualGroupID = visual_group_index;
- req->rotation = rotation;
- req->timestamp = timestamp;
- req->configTimestamp = config->config_timestamp;
- (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
-
- if (rep.status == RRSetConfigSuccess) {
- /* if we succeed, set our view of reality to what we set it to */
- config->config_timestamp = rep.newConfigTimestamp;
- config->timestamp = rep.newTimestamp;
- config->screen = ScreenOfDisplay (dpy, XRRRootToScreen(dpy, rep.root));
- config->current_size = size_index;
- config->current_rotation = rotation;
- config->current_visual_group = visual_group_index;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- return(rep.status);
-}
diff --git a/xc/lib/Xrandr/Xrandr.h b/xc/lib/Xrandr/Xrandr.h
deleted file mode 100644
index c7b5dc3ac..000000000
--- a/xc/lib/Xrandr/Xrandr.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.7 2001/08/01 00:44:40 tsi Exp $
- *
- * Copyright © 2000 Compaq Computer Corporation, Inc.
- *
- * 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 Compaq not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Jim Gettys, Compaq Computer Corporation
- */
-
-#ifndef _XRANDR_H_
-#define _XRANDR_H_
-
-#include <X11/extensions/randr.h>
-
-typedef struct {
- int nvisuals;
- Visual **visuals;
-} XRRVisualGroup;
-
-typedef struct {
- int ngroups;
- XRRVisualGroup **groups;
-} XRRGroupOfVisualGroup;
-
-typedef struct {
- int width, height;
- int mwidth, mheight;
- int group;
-} XRRScreenSize;
-
-/*
- * Events
- */
-
-typedef struct {
- int type; /* event base */
- 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 which selected for this event */
- Window root; /* Root window for changed screen */
- Time timestamp;
- Time config_timestamp;
- SizeID size_index;
- VisualGroupID visual_group_index;
- Rotation rotation;
- int width;
- int height;
- int mwidth;
- int mheight;
-} XRRScreenChangeNotifyEvent;
-
-/* internal representation is private to the library */
-typedef struct _XRRScreenConfiguration XRRScreenConfiguration;
-
-Bool XRRQueryExtension (Display *dpy, int *event_basep, int *error_basep);
-
-Status XRRQueryVersion (Display *dpy,
- int *major_versionp,
- int *minor_versionp);
-
-XRRScreenConfiguration *XRRGetScreenInfo (Display *dpy,
- Drawable draw);
-
-void XRRFreeScreenInfo (XRRScreenConfiguration *config);
-
-Status XRRSetScreenConfig (Display *dpy,
- XRRScreenConfiguration *config,
- Drawable draw,
- int size_index,
- int visual_group_index,
- Rotation rotation,
- Time timestamp);
-
-XRRScreenSize *XRRSizes(XRRScreenConfiguration *config, int *nsizes);
-
-void XRRScreenChangeSelectInput (Display *dpy, Window window, Bool enable);
-
-Visual *XRRVisualIDToVisual(Display *dpy, int screen, VisualID id);
-
-int XRRVisualToDepth(Display *dpy, Visual *visual);
-
-Rotation XRRRotations(XRRScreenConfiguration *config, Rotation *current_rotation);
-
-Time XRRTimes (XRRScreenConfiguration *config, Time *config_timestamp);
-
-SizeID XRRCurrentConfig (XRRScreenConfiguration *config, VisualGroupID *visual_group, Rotation *rotation);
-
-int XRRRootToScreen(Display *dpy, Window root);
-
-#endif /* _XRANDR_H_ */
diff --git a/xc/lib/Xrandr/Xrandrint.h b/xc/lib/Xrandr/Xrandrint.h
deleted file mode 100644
index dd7f08b97..000000000
--- a/xc/lib/Xrandr/Xrandrint.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * $XFree86: xc/lib/Xrandr/Xrandrint.h,v 1.2 2001/06/07 15:33:43 keithp Exp $
- *
- * Copyright © 2000 Compaq Computer Corporation, Inc.
- *
- * 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 Compaq not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Compaq makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * COMPAQ DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Jim Gettys, Compaq Computer Corporation, Inc.
- */
-
-#ifndef _XRANDRINT_H_
-#define _XRANDRINT_H_
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include "Xext.h" /* in ../include */
-#include "extutil.h" /* in ../include */
-#include "Xrandr.h"
-#include "randr.h"
-#include "randrproto.h"
-
-extern XExtensionInfo XrandrExtensionInfo;
-extern char XrandrExtensionName[];
-
-#define RRCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, XRRExtensionName, val)
-
-#define RRSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, XRRExtensionName)
-
-XExtDisplayInfo *
-XRRFindDisplay (Display *dpy);
-
-/* deliberately opaque internal data structure; can be extended,
- but not reordered */
-struct _XRRScreenConfiguration {
- Screen *screen; /* the root window in GetScreenInfo */
- XRRVisualGroup *visual_group;
- XRRGroupOfVisualGroup *groups_of_visual_groups;
- XRRScreenSize *sizes;
- Rotation rotations;
- Rotation current_rotation;
- int nsizes;
- int current_size;
- int current_visual_group;
- Time timestamp;
- Time config_timestamp;
-};
-
-#endif /* _XRANDRINT_H_ */
diff --git a/xc/lib/Xrandr/test.c b/xc/lib/Xrandr/test.c
deleted file mode 100644
index 333d2a6ab..000000000
--- a/xc/lib/Xrandr/test.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* $XFree86: xc/lib/Xrandr/test.c,v 1.2 2001/08/06 21:46:03 dawes Exp $ */
-
-#include <stdio.h>
-#include <X11/Xlib.h>
-#include "Xrandr.h"
-
-main (int argc, char **argv)
-
-{
- char *display_name = ":0";
- Display *display;
- int major, minor, status;
-
- if ((display = XOpenDisplay (display_name)) == NULL) {
- fprintf(stderr, "Can't open display!\n");
- }
- status = XRRQueryVersion (display, &major, &minor);
- fprintf(stderr, "status = %d, major = %d, minor = %d\n,
- status, major, minor");
-
-}
diff --git a/xc/lib/Xrender/Composite.c b/xc/lib/Xrender/Composite.c
deleted file mode 100644
index b2c65db50..000000000
--- a/xc/lib/Xrender/Composite.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * $XFree86$
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#include "Xrenderint.h"
-
-void
-XRenderComposite (Display *dpy,
- int op,
- Picture src,
- Picture mask,
- Picture dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderCompositeReq *req;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReq(RenderComposite, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderComposite;
- req->op = (CARD8) op;
- req->src = src;
- req->mask = mask;
- req->dst = dst;
- req->xSrc = src_x;
- req->ySrc = src_y;
- req->xMask = mask_x;
- req->yMask = mask_y;
- req->xDst = dst_x;
- req->yDst = dst_y;
- req->width = width;
- req->height = height;
- UnlockDisplay(dpy);
- SyncHandle();
-}
diff --git a/xc/lib/Xrender/FillRect.c b/xc/lib/Xrender/FillRect.c
deleted file mode 100644
index f7c65f307..000000000
--- a/xc/lib/Xrender/FillRect.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * $XFree86: xc/lib/Xrender/FillRect.c,v 1.1 2000/11/20 07:13:09 keithp Exp $
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#include "Xrenderint.h"
-
-/* precompute the maximum size of batching request allowed */
-
-#define size (SIZEOF(xRenderFillRectanglesReq) + FRCTSPERBATCH * SIZEOF(xRectangle))
-
-void
-XRenderFillRectangle (Display *dpy,
- int op,
- Picture dst,
- XRenderColor *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRectangle *rect;
- xRenderFillRectanglesReq *req;
-#ifdef MUSTCOPY
- xRectangle rectdata;
- long len = SIZEOF(xRectangle);
-
- rect = &rectdata;
-#endif /* MUSTCOPY */
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
-
- req = (xRenderFillRectanglesReq *) dpy->last_req;
- /* if same as previous request, with same drawable, batch requests */
- if (req->reqType == info->codes->major_opcode &&
- req->renderReqType == X_RenderFillRectangles &&
- req->op == op &&
- req->dst == dst &&
- req->color.red == color->red &&
- req->color.green == color->green &&
- req->color.blue == color->blue &&
- req->color.alpha == color->alpha &&
- dpy->bufptr + SIZEOF(xRectangle) <= dpy->bufmax &&
- (char *)dpy->bufptr - (char *)req < size)
- {
- req->length += SIZEOF(xRectangle) >> 2;
-#ifndef MUSTCOPY
- rect = (xRectangle *) dpy->bufptr;
- dpy->bufptr += SIZEOF(xRectangle);
-#endif /* not MUSTCOPY */
- }
- else
- {
- GetReqExtra(RenderFillRectangles, SIZEOF(xRectangle), req);
-
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderFillRectangles;
- req->op = op;
- req->dst = dst;
- req->color.red = color->red;
- req->color.green = color->green;
- req->color.blue = color->blue;
- req->color.alpha = color->alpha;
-
-#ifdef MUSTCOPY
- dpy->bufptr -= SIZEOF(xRectangle);
-#else
- rect = (xRectangle *) NEXTPTR(req,xRenderFillRectanglesReq);
-#endif /* MUSTCOPY */
- }
- rect->x = x;
- rect->y = y;
- rect->width = width;
- rect->height = height;
-
-#ifdef MUSTCOPY
- Data (dpy, (char *) rect, len);
-#endif /* MUSTCOPY */
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
diff --git a/xc/lib/Xrender/FillRects.c b/xc/lib/Xrender/FillRects.c
deleted file mode 100644
index 7c6448312..000000000
--- a/xc/lib/Xrender/FillRects.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * $XFree86: xc/lib/Xrender/FillRects.c,v 1.1 2000/11/20 07:13:10 keithp Exp $
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#include "Xrenderint.h"
-
-/* precompute the maximum size of batching request allowed */
-
-#define size (SIZEOF(xRenderFillRectanglesReq) + FRCTSPERBATCH * SIZEOF(xRectangle))
-
-void
-XRenderFillRectangles (Display *dpy,
- int op,
- Picture dst,
- XRenderColor *color,
- XRectangle *rectangles,
- int n_rects)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderFillRectanglesReq *req;
- long len;
- int n;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
-
- while (n_rects)
- {
- GetReq(RenderFillRectangles, req);
-
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderFillRectangles;
- req->op = op;
- req->dst = dst;
- req->color.red = color->red;
- req->color.green = color->green;
- req->color.blue = color->blue;
- req->color.alpha = color->alpha;
-
- n = n_rects;
- len = ((long)n) << 1;
- if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length))
- {
- n = (dpy->max_request_size - req->length) >> 1;
- len = ((long)n) << 1;
- }
- SetReqLen(req, len, len);
- len <<= 2; /* watch out for macros... */
- Data16 (dpy, (short *) rectangles, len);
- n_rects -= n;
- rectangles += n;
- }
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
diff --git a/xc/lib/Xrender/Glyph.c b/xc/lib/Xrender/Glyph.c
deleted file mode 100644
index 217a3bb6c..000000000
--- a/xc/lib/Xrender/Glyph.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * $XFree86$
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#include "Xrenderint.h"
-
-GlyphSet
-XRenderCreateGlyphSet (Display *dpy, XRenderPictFormat *format)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- GlyphSet gsid;
- xRenderCreateGlyphSetReq *req;
-
- RenderCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RenderCreateGlyphSet, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderCreateGlyphSet;
- req->gsid = gsid = _XAllocID(dpy);
- req->format = format->id;
- UnlockDisplay(dpy);
- SyncHandle();
- return gsid;
-}
-
-GlyphSet
-XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- GlyphSet gsid;
- xRenderReferenceGlyphSetReq *req;
-
- RenderCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RenderReferenceGlyphSet, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderReferenceGlyphSet;
- req->gsid = gsid = _XAllocID(dpy);
- req->existing = existing;
- UnlockDisplay(dpy);
- SyncHandle();
- return gsid;
-}
-
-void
-XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderFreeGlyphSetReq *req;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReq(RenderFreeGlyphSet, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderFreeGlyphSet;
- req->glyphset = glyphset;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void
-XRenderAddGlyphs (Display *dpy,
- GlyphSet glyphset,
- Glyph *gids,
- XGlyphInfo *glyphs,
- int nglyphs,
- char *images,
- int nbyte_images)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderAddGlyphsReq *req;
- long len;
-
- if (nbyte_images & 3)
- nbyte_images += 4 - (nbyte_images & 3);
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReq(RenderAddGlyphs, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderAddGlyphs;
- req->glyphset = glyphset;
- req->nglyphs = nglyphs;
- len = (nglyphs * (SIZEOF (xGlyphInfo) + 4) + nbyte_images) >> 2;
- SetReqLen(req, len, len);
- Data32 (dpy, (long *) gids, nglyphs * 4);
- Data16 (dpy, (short *) glyphs, nglyphs * SIZEOF (xGlyphInfo));
- Data (dpy, images, nbyte_images);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void
-XRenderFreeGlyphs (Display *dpy,
- GlyphSet glyphset,
- Glyph *gids,
- int nglyphs)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderFreeGlyphsReq *req;
- long len;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReq(RenderFreeGlyphs, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderFreeGlyphs;
- len = nglyphs;
- SetReqLen(req, len, len);
- len <<= 2;
- Data32 (dpy, (long *) gids, len);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void
-XRenderCompositeString8 (Display *dpy,
- int op,
- Picture src,
- Picture dst,
- XRenderPictFormat *maskFormat,
- GlyphSet glyphset,
- int xSrc,
- int ySrc,
- int xDst,
- int yDst,
- char *string,
- int nchar)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderCompositeGlyphs8Req *req;
- long len;
- xGlyphElt *elt;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReqExtra(RenderCompositeGlyphs8, SIZEOF (xGlyphElt), req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderCompositeGlyphs8;
- req->op = op;
- req->src = src;
- req->dst = dst;
- req->maskFormat = maskFormat ? maskFormat->id : None;
- req->glyphset = glyphset;
- req->xSrc = xSrc;
- req->ySrc = ySrc;
- elt = (xGlyphElt *) (req + 1);
- elt->len = nchar;
- elt->deltax = xDst;
- elt->deltay = yDst;
- len = (nchar + 3) >> 2;
- SetReqLen(req, len, len);
- Data(dpy, string, nchar);
- UnlockDisplay(dpy);
- SyncHandle();
-}
diff --git a/xc/lib/Xrender/Imakefile b/xc/lib/Xrender/Imakefile
deleted file mode 100644
index b18b1cfb1..000000000
--- a/xc/lib/Xrender/Imakefile
+++ /dev/null
@@ -1,39 +0,0 @@
-XCOMM $XFree86: xc/lib/Xrender/Imakefile,v 1.1 2000/08/26 00:38:36 keithp Exp $
-
-
-#define DoNormalLib NormalLibXrender
-#define DoSharedLib SharedLibXrender
-#define DoDebugLib DebugLibXrender
-#define DoProfileLib ProfileLibXrender
-#define LibName Xrender
-#define SoRev SOXRENDERREV
-#define IncSubdir X11
-#define IncSubSubdir extensions
-
-#include <Threads.tmpl>
-
-#ifdef SharedXrenderReqs
-REQUIREDLIBS = SharedXrenderReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = Xrender.c \
- Composite.c \
- Glyph.c \
- Picture.c
- OBJS = Xrender.o \
- Composite.o \
- Glyph.o \
- Picture.o
- LINTLIBS = $(LINTXLIB)
-
-HEADERS = Xrender.h
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xrender/Picture.c b/xc/lib/Xrender/Picture.c
deleted file mode 100644
index 59b9aaa1d..000000000
--- a/xc/lib/Xrender/Picture.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * $XFree86$
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#include "Xrenderint.h"
-
-void
-_XRenderProcessPictureAttributes (Display *dpy,
- xRenderChangePictureReq *req,
- unsigned long valuemask,
- XRenderPictureAttributes *attributes)
-{
- unsigned long values[32];
- register unsigned long *value = values;
- unsigned int nvalues;
-
- if (valuemask & CPRepeat)
- *value++ = attributes->repeat;
- if (valuemask & CPAlphaMap)
- *value++ = attributes->alpha_map;
- if (valuemask & CPAlphaXOrigin)
- *value++ = attributes->alpha_x_origin;
- if (valuemask & CPAlphaYOrigin)
- *value++ = attributes->alpha_y_origin;
- if (valuemask & CPClipXOrigin)
- *value++ = attributes->clip_x_origin;
- if (valuemask & CPClipYOrigin)
- *value++ = attributes->clip_y_origin;
- if (valuemask & CPClipMask)
- *value++ = attributes->clip_mask;
- if (valuemask & CPGraphicsExposure)
- *value++ = attributes->graphics_exposures;
- if (valuemask & CPSubwindowMode)
- *value++ = attributes->subwindow_mode;
- if (valuemask & CPPolyEdge)
- *value++ = attributes->poly_edge;
- if (valuemask & CPPolyMode)
- *value++ = attributes->poly_mode;
- if (valuemask & CPDither)
- *value++ = attributes->dither;
-
- req->length += (nvalues = value - values);
-
- nvalues <<= 2; /* watch out for macros... */
- Data32 (dpy, (long *) values, (long)nvalues);
-}
-
-Picture
-XRenderCreatePicture (Display *dpy,
- Drawable drawable,
- XRenderPictFormat *format,
- unsigned long valuemask,
- XRenderPictureAttributes *attributes)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- Picture pid;
- xRenderCreatePictureReq *req;
-
- RenderCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RenderCreatePicture, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderCreatePicture;
- req->pid = pid = _XAllocID(dpy);
- req->drawable = drawable;
- req->format = format->id;
- if ((req->mask = valuemask))
- _XRenderProcessPictureAttributes (dpy,
- (xRenderChangePictureReq *) req,
- valuemask,
- attributes);
- UnlockDisplay(dpy);
- SyncHandle();
- return pid;
-}
-
-void
-XRenderChangePicture (Display *dpy,
- Picture picture,
- unsigned long valuemask,
- XRenderPictureAttributes *attributes)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderChangePictureReq *req;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReq(RenderChangePicture, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderChangePicture;
- req->picture = picture;
- _XRenderProcessPictureAttributes (dpy,
- req,
- valuemask,
- attributes);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void
-XRenderFreePicture (Display *dpy,
- Picture picture)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderFreePictureReq *req;
-
- RenderSimpleCheckExtension (dpy, info);
- LockDisplay(dpy);
- GetReq(RenderFreePicture, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderFreePicture;
- req->picture = picture;
- UnlockDisplay(dpy);
- SyncHandle();
-}
diff --git a/xc/lib/Xrender/Xrender-def.cpp b/xc/lib/Xrender/Xrender-def.cpp
deleted file mode 100644
index 34740970d..000000000
--- a/xc/lib/Xrender/Xrender-def.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-LIBRARY Xrender
-VERSION LIBRARY_VERSION
-EXPORTS
- XRenderComposite
- XRenderFillRectangle
- XRenderFillRectangles
- XRenderAddGlyphs
- XRenderCompositeString16
- XRenderCompositeString32
- XRenderCompositeString8
- XRenderCreateGlyphSet
- XRenderFreeGlyphSet
- XRenderFreeGlyphs
- XRenderReferenceGlyphSet
- XRenderChangePicture
- XRenderCreatePicture
- XRenderFreePicture
- _XRenderProcessPictureAttributes
- XRenderFindDisplay
- XRenderFindFormat
- XRenderFindVisualFormat
- XRenderQueryExtension
- XRenderQueryFormats
- XRenderQueryVersion
- _XRenderFindFormat
- _XRenderFindVisual
-
-/* $XFree86: xc/lib/Xrender/Xrender-def.cpp,v 1.2 2000/12/04 21:01:00 dawes Exp $ */
diff --git a/xc/lib/Xrender/Xrender.c b/xc/lib/Xrender/Xrender.c
deleted file mode 100644
index 6294012fd..000000000
--- a/xc/lib/Xrender/Xrender.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * $XFree86$
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#include "Xrenderint.h"
-
-XExtensionInfo XRenderExtensionInfo;
-char XRenderExtensionName[] = RENDER_NAME;
-
-static int XRenderCloseDisplay();
-
-static /* const */ XExtensionHooks render_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- XRenderCloseDisplay, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-XExtDisplayInfo *
-XRenderFindDisplay (Display *dpy)
-{
- XExtDisplayInfo *dpyinfo;
-
- dpyinfo = XextFindDisplay (&XRenderExtensionInfo, dpy);
- if (!dpyinfo)
- dpyinfo = XextAddDisplay (&XRenderExtensionInfo, dpy,
- XRenderExtensionName,
- &render_extension_hooks,
- 0, 0);
- return dpyinfo;
-}
-
-static int
-XRenderCloseDisplay (Display *dpy, XExtCodes *codes)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- if (info->data) XFree (info->data);
-
- return XextRemoveDisplay (&XRenderExtensionInfo, dpy);
-}
-
-/****************************************************************************
- * *
- * Render public interfaces *
- * *
- ****************************************************************************/
-
-Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XRenderQueryVersion (Display *dpy,
- int *major_versionp,
- int *minor_versionp)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderQueryVersionReply rep;
- xRenderQueryVersionReq *req;
-
- RenderCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (RenderQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderQueryVersion;
- req->majorVersion = RENDER_MAJOR;
- req->minorVersion = RENDER_MINOR;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-XRenderPictFormat *
-_XRenderFindFormat (XRenderInfo *xri, PictFormat format)
-{
- int nf;
-
- for (nf = 0; nf < xri->nformat; nf++)
- if (xri->format[nf].id == format)
- return &xri->format[nf];
- return 0;
-}
-
-Visual *
-_XRenderFindVisual (Display *dpy, VisualID vid)
-{
- XVisualInfo temp, *vi;
- Visual *v;
- int nvi;
-
- temp.visualid = vid;
- vi = XGetVisualInfo (dpy, VisualIDMask, &temp, &nvi);
- if (vi)
- {
- v = vi->visual;
- XFree (vi);
- }
- else
- v = 0;
- return v;
-}
-
-Status
-XRenderQueryFormats (Display *dpy)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- xRenderQueryPictFormatsReply rep;
- xRenderQueryPictFormatsReq *req;
- XRenderInfo *xri;
- XRenderPictFormat *format;
- XRenderScreen *screen;
- XRenderDepth *depth;
- XRenderVisual *visual;
- xPictFormInfo *xFormat;
- xPictScreen *xScreen;
- xPictDepth *xDepth;
- xPictVisual *xVisual;
- int nf, ns, nd, nv;
- int rlength;
-
- RenderCheckExtension (dpy, info, 0);
- LockDisplay (dpy);
- GetReq (RenderQueryPictFormats, req);
- req->reqType = info->codes->major_opcode;
- req->renderReqType = X_RenderQueryPictFormats;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- xri = (XRenderInfo *) Xmalloc (sizeof (XRenderInfo) +
- rep.numFormats * sizeof (XRenderPictFormat) +
- rep.numScreens * sizeof (XRenderScreen) +
- rep.numDepths * sizeof (XRenderDepth) +
- rep.numVisuals * sizeof (XRenderVisual));
- xri->format = (XRenderPictFormat *) (xri + 1);
- xri->nformat = rep.numFormats;
- xri->screen = (XRenderScreen *) (xri->format + rep.numFormats);
- xri->nscreen = rep.numScreens;
- xri->depth = (XRenderDepth *) (xri->screen + rep.numScreens);
- xri->ndepth = rep.numDepths;
- xri->visual = (XRenderVisual *) (xri->depth + rep.numDepths);
- xri->nvisual = rep.numVisuals;
- rlength = (rep.numFormats * sizeof (xPictFormInfo) +
- rep.numScreens * sizeof (xPictScreen) +
- rep.numDepths * sizeof (xPictDepth) +
- rep.numVisuals * sizeof (xPictVisual));
- xFormat = (xPictFormInfo *) Xmalloc (rlength);
-
- if (!xri || !xFormat)
- {
- if (xri) Xfree (xri);
- if (xFormat) Xfree (xFormat);
- _XEatData (dpy, rlength);
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- _XRead (dpy, (char *) xFormat, rlength);
- format = xri->format;
- for (nf = 0; nf < rep.numFormats; nf++)
- {
- format->id = xFormat->id;
- format->type = xFormat->type;
- format->depth = xFormat->depth;
- format->direct.red = xFormat->direct.red;
- format->direct.redMask = xFormat->direct.redMask;
- format->direct.green = xFormat->direct.green;
- format->direct.greenMask = xFormat->direct.greenMask;
- format->direct.blue = xFormat->direct.blue;
- format->direct.blueMask = xFormat->direct.blueMask;
- format->direct.alpha = xFormat->direct.alpha;
- format->direct.alphaMask = xFormat->direct.alphaMask;
- format->colormap = xFormat->colormap;
- format++;
- xFormat++;
- }
- xScreen = (xPictScreen *) xFormat;
- screen = xri->screen;
- depth = xri->depth;
- visual = xri->visual;
- for (ns = 0; ns < xri->nscreen; ns++)
- {
- screen->depths = depth;
- screen->ndepths = xScreen->nDepth;
- screen->fallback = _XRenderFindFormat (xri, xScreen->fallback);
- xDepth = (xPictDepth *) (xScreen + 1);
- for (nd = 0; nd < screen->ndepths; nd++)
- {
- depth->depth = xDepth->depth;
- depth->nvisuals = xDepth->nPictVisuals;
- depth->visuals = visual;
- xVisual = (xPictVisual *) (xDepth + 1);
- for (nv = 0; nv < depth->nvisuals; nv++)
- {
- visual->visual = _XRenderFindVisual (dpy, xVisual->visual);
- visual->format = _XRenderFindFormat (xri, xVisual->format);
- visual++;
- xVisual++;
- }
- depth++;
- xDepth = (xPictDepth *) xVisual;
- }
- xScreen = (xPictScreen *) xDepth;
- }
- info->data = (XPointer) xri;
- return 1;
-}
-
-XRenderPictFormat *
-XRenderFindVisualFormat (Display *dpy, Visual *visual)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- int nv;
- XRenderInfo *xri;
- XRenderVisual *xrv;
-
- RenderCheckExtension (dpy, info, 0);
- if (!info->data)
- {
- if (!XRenderQueryFormats (dpy))
- return 0;
- }
- xri = (XRenderInfo *) info->data;
- for (nv = 0, xrv = xri->visual; nv < xri->nvisual; nv++, xrv++)
- if (xrv->visual == visual)
- return xrv->format;
- return 0;
-}
-
-XRenderPictFormat *
-XRenderFindFormat (Display *dpy,
- unsigned long mask,
- XRenderPictFormat *template,
- int count)
-{
- XExtDisplayInfo *info = XRenderFindDisplay (dpy);
- int nf;
- XRenderInfo *xri;
-
- RenderCheckExtension (dpy, info, 0);
- if (!info->data)
- {
- if (!XRenderQueryFormats (dpy))
- return 0;
- }
- xri = (XRenderInfo *) info->data;
- for (nf = 0; nf < xri->nformat; nf++)
- {
- if (mask & PictFormatID)
- if (template->id != xri->format[nf].id)
- continue;
- if (mask & PictFormatType)
- if (template->type != xri->format[nf].type)
- continue;
- if (mask & PictFormatDepth)
- if (template->depth != xri->format[nf].depth)
- continue;
- if (mask & PictFormatRed)
- if (template->direct.red != xri->format[nf].direct.red)
- continue;
- if (mask & PictFormatRedMask)
- if (template->direct.redMask != xri->format[nf].direct.redMask)
- continue;
- if (mask & PictFormatGreen)
- if (template->direct.green != xri->format[nf].direct.green)
- continue;
- if (mask & PictFormatGreenMask)
- if (template->direct.greenMask != xri->format[nf].direct.greenMask)
- continue;
- if (mask & PictFormatBlue)
- if (template->direct.blue != xri->format[nf].direct.blue)
- continue;
- if (mask & PictFormatBlueMask)
- if (template->direct.blueMask != xri->format[nf].direct.blueMask)
- continue;
- if (mask & PictFormatAlpha)
- if (template->direct.alpha != xri->format[nf].direct.alpha)
- continue;
- if (mask & PictFormatAlphaMask)
- if (template->direct.alphaMask != xri->format[nf].direct.alphaMask)
- continue;
- if (mask & PictFormatColormap)
- if (template->colormap != xri->format[nf].colormap)
- continue;
- if (count-- == 0)
- return &xri->format[nf];
- }
- return 0;
-}
-
diff --git a/xc/lib/Xrender/Xrender.h b/xc/lib/Xrender/Xrender.h
deleted file mode 100644
index c65b9d46a..000000000
--- a/xc/lib/Xrender/Xrender.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * $XFree86$
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifndef _XRENDER_H_
-#define _XRENDER_H_
-
-#include "render.h"
-
-typedef struct {
- short red;
- short redMask;
- short green;
- short greenMask;
- short blue;
- short blueMask;
- short alpha;
- short alphaMask;
-} XRenderDirectFormat;
-
-typedef struct {
- PictFormat id;
- int type;
- int depth;
- XRenderDirectFormat direct;
- Colormap colormap;
-} XRenderPictFormat;
-
-#define PictFormatID (1 << 0)
-#define PictFormatType (1 << 1)
-#define PictFormatDepth (1 << 2)
-#define PictFormatRed (1 << 3)
-#define PictFormatRedMask (1 << 4)
-#define PictFormatGreen (1 << 5)
-#define PictFormatGreenMask (1 << 6)
-#define PictFormatBlue (1 << 7)
-#define PictFormatBlueMask (1 << 8)
-#define PictFormatAlpha (1 << 9)
-#define PictFormatAlphaMask (1 << 10)
-#define PictFormatColormap (1 << 11)
-
-typedef struct {
- Visual *visual;
- XRenderPictFormat *format;
-} XRenderVisual;
-
-typedef struct {
- int depth;
- int nvisuals;
- XRenderVisual *visuals;
-} XRenderDepth;
-
-typedef struct {
- XRenderDepth *depths;
- int ndepths;
- XRenderPictFormat *fallback;
-} XRenderScreen;
-
-typedef struct _XRenderInfo {
- XRenderPictFormat *format;
- int nformat;
- XRenderScreen *screen;
- int nscreen;
- XRenderDepth *depth;
- int ndepth;
- XRenderVisual *visual;
- int nvisual;
-} XRenderInfo;
-
-typedef struct _XRenderPictureAttributes {
- Bool repeat;
- Picture alpha_map;
- int alpha_x_origin;
- int alpha_y_origin;
- int clip_x_origin;
- int clip_y_origin;
- Pixmap clip_mask;
- Bool graphics_exposures;
- int subwindow_mode;
- int poly_edge;
- int poly_mode;
- Atom dither;
-} XRenderPictureAttributes;
-
-typedef struct _XGlyphInfo {
- unsigned short width;
- unsigned short height;
- short x;
- short y;
- short xOff;
- short yOff;
-} XGlyphInfo;
-
-Bool XRenderQueryExtension (Display *dpy, int *event_basep, int *error_basep);
-
-Status XRenderQueryVersion (Display *dpy,
- int *major_versionp,
- int *minor_versionp);
-
-Status XRenderQueryFormats (Display *dpy);
-
-XRenderPictFormat *
-XRenderFindVisualFormat (Display *dpy, Visual *visual);
-
-XRenderPictFormat *
-XRenderFindFormat (Display *dpy,
- unsigned long mask,
- XRenderPictFormat *template,
- int count);
-
-Picture
-XRenderCreatePicture (Display *dpy,
- Drawable drawable,
- XRenderPictFormat *format,
- unsigned long valuemask,
- XRenderPictureAttributes *attributes);
-
-void
-XRenderChangePicture (Display *dpy,
- Picture picture,
- unsigned long valuemask,
- XRenderPictureAttributes *attributes);
-
-void
-XRenderFreePicture (Display *dpy,
- Picture picture);
-
-void
-XRenderComposite (Display *dpy,
- int op,
- Picture src,
- Picture mask,
- Picture dst,
- int src_x,
- int src_y,
- int mask_x,
- int mask_y,
- int dst_x,
- int dst_y,
- unsigned int width,
- unsigned int height);
-
-GlyphSet
-XRenderCreateGlyphSet (Display *dpy, XRenderPictFormat *format);
-
-GlyphSet
-XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing);
-
-void
-XRenderFreeGlyphSet (Display *dpy, GlyphSet glyphset);
-
-void
-XRenderAddGlyphs (Display *dpy,
- GlyphSet glyphset,
- Glyph *gids,
- XGlyphInfo *glyphs,
- int nglyphs,
- char *images,
- int nbyte_images);
-
-void
-XRenderFreeGlyphs (Display *dpy,
- GlyphSet glyphset,
- Glyph *gids,
- int nglyphs);
-
-void
-XRenderCompositeString8 (Display *dpy,
- int op,
- Picture src,
- Picture dst,
- XRenderPictFormat *maskFormat,
- GlyphSet glyphset,
- int xSrc,
- int ySrc,
- int xDst,
- int yDst,
- char *string,
- int nchar);
-
-
-#endif /* _XRENDER_H_ */
diff --git a/xc/lib/Xrender/Xrenderint.h b/xc/lib/Xrender/Xrenderint.h
deleted file mode 100644
index e366c8c07..000000000
--- a/xc/lib/Xrender/Xrenderint.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * $XFree86$
- *
- * Copyright © 2000 SuSE, Inc.
- *
- * 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 SuSE not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. SuSE makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Keith Packard, SuSE, Inc.
- */
-
-#ifndef _XRENDERINT_H_
-#define _XRENDERINT_H_
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include "Xext.h" /* in ../include */
-#include "extutil.h" /* in ../include */
-#include "Xrender.h"
-#include "renderproto.h"
-
-extern XExtensionInfo XRenderExtensionInfo;
-extern char XRenderExtensionName[];
-
-#define RenderCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, XRenderExtensionName, val)
-
-#define RenderSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, XRenderExtensionName)
-
-XExtDisplayInfo *
-XRenderFindDisplay (Display *dpy);
-
-#endif /* _XRENDERINT_H_ */
diff --git a/xc/lib/Xss/Imakefile b/xc/lib/Xss/Imakefile
deleted file mode 100644
index 17c11b05c..000000000
--- a/xc/lib/Xss/Imakefile
+++ /dev/null
@@ -1,32 +0,0 @@
-XCOMM $XFree86: xc/lib/Xss/Imakefile,v 3.1 1998/12/20 11:57:06 dawes Exp $
-#define DoNormalLib NormalLibXss
-#define DoSharedLib SharedLibXss
-#define DoExtraLib SharedLibXss
-#define DoDebugLib DebugLibXss
-#define DoProfileLib ProfileLibXss
-#define LibName Xss
-#define SoRev SOSSREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXssReqs
-REQUIREDLIBS = SharedXssReqs
-#endif
-
-SCRNSAVSRC = XScrnSaver.c
-SCRNSAVOBJ = XScrnSaver.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = $(SCRNSAVSRC)
- OBJS = $(SCRNSAVOBJ)
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xss/XScrnSaver.c b/xc/lib/Xss/XScrnSaver.c
deleted file mode 100644
index 67ef5073d..000000000
--- a/xc/lib/Xss/XScrnSaver.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * $XConsortium: XScrnSaver.c,v 1.5 94/04/17 20:59:35 rws 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_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include "Xext.h" /* in ../include */
-#include "extutil.h" /* in ../include */
-#include "saverproto.h" /* in ../include */
-#include "scrnsaver.h"
-
-
-static XExtensionInfo _screen_saver_info_data;
-static XExtensionInfo *screen_saver_info = &_screen_saver_info_data;
-static /* const */ char *screen_saver_extension_name = ScreenSaverName;
-
-#define ScreenSaverCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, screen_saver_extension_name, val)
-#define ScreenSaverSimpleCheckExtension(dpy,i) \
- XextSimpleCheckExtension (dpy, i, screen_saver_extension_name)
-
-static int close_display();
-static Bool wire_to_event();
-static Status event_to_wire();
-static /* const */ XExtensionHooks screen_saver_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- wire_to_event, /* wire_to_event */
- event_to_wire, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, screen_saver_info,
- screen_saver_extension_name,
- &screen_saver_extension_hooks,
- ScreenSaverNumberEvents, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, screen_saver_info)
-
-
-static Bool wire_to_event (dpy, re, event)
- Display *dpy;
- XEvent *re;
- xEvent *event;
-{
- XExtDisplayInfo *info = find_display (dpy);
- XScreenSaverNotifyEvent *se;
- xScreenSaverNotifyEvent *sevent;
-
- ScreenSaverCheckExtension (dpy, info, False);
-
- switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
- case ScreenSaverNotify:
- se = (XScreenSaverNotifyEvent *) re;
- sevent = (xScreenSaverNotifyEvent *) event;
- se->type = sevent->type & 0x7f;
- se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
- se->send_event = (sevent->type & 0x80) != 0;
- se->display = dpy;
- se->window = sevent->window;
- se->window = sevent->root;
- se->state = sevent->state;
- se->kind = sevent->kind;
- se->forced = True;
- if (sevent->forced == xFalse)
- se->forced = False;
- se->time = sevent->timestamp;
- return True;
- }
- return False;
-}
-
-static Status event_to_wire (dpy, re, event)
- Display *dpy;
- XEvent *re;
- xEvent *event;
-{
- XExtDisplayInfo *info = find_display (dpy);
- XScreenSaverNotifyEvent *se;
- xScreenSaverNotifyEvent *sevent;
-
- ScreenSaverCheckExtension (dpy, info, 0);
-
- switch ((re->type & 0x7f) - info->codes->first_event) {
- case ScreenSaverNotify:
- se = (XScreenSaverNotifyEvent *) re;
- sevent = (xScreenSaverNotifyEvent *) event;
- sevent->type = se->type | (se->send_event ? 0x80 : 0);
- sevent->sequenceNumber = se->serial & 0xffff;
- sevent->root = se->root;
- sevent->window = se->window;
- sevent->state = se->state;
- sevent->kind = se->kind;
- sevent->forced = xFalse;
- if (se->forced == True)
- sevent->forced = xTrue;
- sevent->timestamp = se->time;
- return 1;
- }
- return 0;
-}
-
-/****************************************************************************
- * *
- * ScreenSaver public interfaces *
- * *
- ****************************************************************************/
-
-Bool XScreenSaverQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Status XScreenSaverQueryVersion(dpy, major_versionp, minor_versionp)
- Display *dpy;
- int *major_versionp, *minor_versionp;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xScreenSaverQueryVersionReply rep;
- register xScreenSaverQueryVersionReq *req;
-
- ScreenSaverCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (ScreenSaverQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->saverReqType = X_ScreenSaverQueryVersion;
- req->clientMajor = ScreenSaverMajorVersion;
- req->clientMinor = ScreenSaverMinorVersion;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- *major_versionp = rep.majorVersion;
- *minor_versionp = rep.minorVersion;
- UnlockDisplay (dpy);
- SyncHandle ();
- return 1;
-}
-
-XScreenSaverInfo *XScreenSaverAllocInfo ()
-{
- return (XScreenSaverInfo *) Xmalloc (sizeof (XScreenSaverInfo));
-}
-
-Status XScreenSaverQueryInfo (dpy, drawable, saver_info)
- Display *dpy;
- Drawable drawable;
- XScreenSaverInfo *saver_info;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xScreenSaverQueryInfoReply rep;
- register xScreenSaverQueryInfoReq *req;
-
- ScreenSaverCheckExtension (dpy, info, 0);
-
- LockDisplay (dpy);
- GetReq (ScreenSaverQueryInfo, req);
- req->reqType = info->codes->major_opcode;
- req->saverReqType = X_ScreenSaverQueryInfo;
- req->drawable = drawable;
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return 0;
- }
- UnlockDisplay (dpy);
- SyncHandle ();
- saver_info->window = rep.window;
- saver_info->state = rep.state;
- saver_info->kind = rep.kind;
- saver_info->til_or_since = rep.tilOrSince;
- saver_info->idle = rep.idle;
- saver_info->eventMask = rep.eventMask;
- return 1;
-}
-
-void XScreenSaverSelectInput (dpy, drawable, mask)
- register Display *dpy;
- Drawable drawable;
- unsigned long mask;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xScreenSaverSelectInputReq *req;
-
- ScreenSaverSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- GetReq (ScreenSaverSelectInput, req);
- req->reqType = info->codes->major_opcode;
- req->saverReqType = X_ScreenSaverSelectInput;
- req->drawable = drawable;
- req->eventMask = mask;
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-static void
-XScreenSaverProcessWindowAttributes (dpy, req, valuemask, attributes)
- register Display *dpy;
- xChangeWindowAttributesReq *req;
- register unsigned long valuemask;
- register XSetWindowAttributes *attributes;
- {
- unsigned long values[32];
- register unsigned long *value = values;
- unsigned int nvalues;
-
- if (valuemask & CWBackPixmap)
- *value++ = attributes->background_pixmap;
-
- if (valuemask & CWBackPixel)
- *value++ = attributes->background_pixel;
-
- if (valuemask & CWBorderPixmap)
- *value++ = attributes->border_pixmap;
-
- if (valuemask & CWBorderPixel)
- *value++ = attributes->border_pixel;
-
- if (valuemask & CWBitGravity)
- *value++ = attributes->bit_gravity;
-
- if (valuemask & CWWinGravity)
- *value++ = attributes->win_gravity;
-
- if (valuemask & CWBackingStore)
- *value++ = attributes->backing_store;
-
- if (valuemask & CWBackingPlanes)
- *value++ = attributes->backing_planes;
-
- if (valuemask & CWBackingPixel)
- *value++ = attributes->backing_pixel;
-
- if (valuemask & CWOverrideRedirect)
- *value++ = attributes->override_redirect;
-
- if (valuemask & CWSaveUnder)
- *value++ = attributes->save_under;
-
- if (valuemask & CWEventMask)
- *value++ = attributes->event_mask;
-
- if (valuemask & CWDontPropagate)
- *value++ = attributes->do_not_propagate_mask;
-
- if (valuemask & CWColormap)
- *value++ = attributes->colormap;
-
- if (valuemask & CWCursor)
- *value++ = attributes->cursor;
-
- req->length += (nvalues = value - values);
-
- nvalues <<= 2; /* watch out for macros... */
- Data32 (dpy, (long *) values, (long)nvalues);
-
- }
-
-void XScreenSaverSetAttributes (dpy, drawable, x, y, width, height,
- border_width, depth, class, visual,
- valuemask, attributes)
- Display* dpy;
- Drawable drawable;
- int x;
- int y;
- unsigned int width;
- unsigned int height;
- unsigned int border_width;
- int depth;
- unsigned int class;
- Visual * visual;
- unsigned long valuemask;
- XSetWindowAttributes *attributes;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xScreenSaverSetAttributesReq *req;
-
- ScreenSaverSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- GetReq (ScreenSaverSetAttributes, req);
- req->reqType = info->codes->major_opcode;
- req->saverReqType = X_ScreenSaverSetAttributes;
- req->drawable = drawable;
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
- req->borderWidth = border_width;
- req->c_class = class;
- req->depth = depth;
- if (visual == CopyFromParent)
- req->visualID = CopyFromParent;
- else
- req->visualID = visual->visualid;
- /* abuse an Xlib internal interface - is this legal for us? */
- if (req->mask = valuemask)
- XScreenSaverProcessWindowAttributes (dpy,
- (xChangeWindowAttributesReq *)req,
- valuemask, attributes);
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-void XScreenSaverUnsetAttributes (dpy, drawable)
- register Display *dpy;
- Drawable drawable;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xScreenSaverUnsetAttributesReq *req;
-
- ScreenSaverSimpleCheckExtension (dpy, info);
-
- LockDisplay (dpy);
- GetReq (ScreenSaverUnsetAttributes, req);
- req->reqType = info->codes->major_opcode;
- req->saverReqType = X_ScreenSaverUnsetAttributes;
- req->drawable = drawable;
- UnlockDisplay (dpy);
- SyncHandle ();
-}
-
-
-Status XScreenSaverRegister (dpy, screen, xid, type)
- Display *dpy;
- int screen;
- XID xid;
- Atom type;
-{
- Atom prop;
- unsigned long ul;
-
- prop = XInternAtom (dpy, ScreenSaverPropertyName, False);
- if (!prop)
- return 0;
-
- ul = (unsigned long) xid;
- XChangeProperty (dpy, RootWindow(dpy,screen), prop, type, 32,
- PropModeReplace, (unsigned char *) &ul, 1);
- return 1;
-}
-
-
-
-Status XScreenSaverUnregister (dpy, screen)
- Display *dpy;
- int screen;
-{
- Atom prop;
-
- prop = XInternAtom (dpy, ScreenSaverPropertyName, False);
- if (!prop)
- return 0;
-
- XDeleteProperty (dpy, RootWindow(dpy,screen), prop);
- return 1;
-}
-
-
-
-Status XScreenSaverGetRegistered (dpy, screen, xid, type)
- Display *dpy;
- int screen;
- XID *xid;
- Atom *type;
-{
- Atom actual_type = None;
- int actual_format;
- unsigned long nitems, bytesafter;
- unsigned long *ulp = (unsigned long *) 0;
- Atom prop;
- int retval = 0;
-
- prop = XInternAtom (dpy, ScreenSaverPropertyName, False);
- if (!prop)
- return retval;
-
- if (XGetWindowProperty (dpy, RootWindow(dpy,screen), prop, 0L, 1L, False,
- AnyPropertyType, &actual_type, &actual_format,
- &nitems, &bytesafter, (unsigned char **) &ulp)
- != Success)
- return retval;
-
- if (ulp) {
- if (actual_format == 32) {
- *xid = (XID) ulp[0];
- *type = actual_type;
- retval = 1;
- }
- XFree ((char *) ulp);
- }
- return retval;
-}
diff --git a/xc/lib/Xss/Xss-def.cpp b/xc/lib/Xss/Xss-def.cpp
deleted file mode 100644
index 3aa6839d7..000000000
--- a/xc/lib/Xss/Xss-def.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-LIBRARY XSS
-EXPORTS
- XScreenSaverQueryExtension
- XScreenSaverQueryVersion
- XScreenSaverAllocInfo
- XScreenSaverQueryInfo
- XScreenSaverSelectInput
- XScreenSaverSetAttributes
- XScreenSaverUnsetAttributes
- XScreenSaverRegister
- XScreenSaverUnregister
- XScreenSaverGetRegistered
-
-/* $XFree86: xc/lib/Xss/Xss-def.cpp,v 1.1 2000/08/09 23:40:13 dawes Exp $ */
diff --git a/xc/lib/Xss/Xssos2.def b/xc/lib/Xss/Xssos2.def
deleted file mode 100644
index 88b95ec2e..000000000
--- a/xc/lib/Xss/Xssos2.def
+++ /dev/null
@@ -1,19 +0,0 @@
-LIBRARY XSS
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xss/Xssos2.def,v 3.2 1999/04/29 09:13:33 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- XScreenSaverQueryExtension @ 1
- XScreenSaverQueryVersion @ 2
- XScreenSaverAllocInfo @ 3
- XScreenSaverQueryInfo @ 4
- XScreenSaverSelectInput @ 5
- XScreenSaverSetAttributes @ 6
- XScreenSaverUnsetAttributes @ 7
- XScreenSaverRegister @ 8
- XScreenSaverUnregister @ 9
- XScreenSaverGetRegistered @ 10
-
diff --git a/xc/lib/Xss/Xssos2.rsp b/xc/lib/Xss/Xssos2.rsp
deleted file mode 100644
index 13ffe194d..000000000
--- a/xc/lib/Xss/Xssos2.rsp
+++ /dev/null
@@ -1,3 +0,0 @@
-XScrnSaver.obj /NOL /NOD /BAT
-Xss.dll
-
diff --git a/xc/lib/Xt/ActionHook.c b/xc/lib/Xt/ActionHook.c
deleted file mode 100644
index 0b13213fe..000000000
--- a/xc/lib/Xt/ActionHook.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $TOG: ActionHook.c /main/10 1998/02/06 13:19:33 kaleb $ */
-
-/*LINTLIBRARY*/
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-/*
- * Contains XtAppAddActionHook, XtRemoveActionHook
- */
-
-#include "IntrinsicI.h"
-
-
-/*ARGSUSED*/
-static void FreeActionHookList( widget, closure, call_data )
- Widget widget; /* unused (and invalid) */
- XtPointer closure; /* ActionHook* */
- XtPointer call_data; /* unused */
-{
- ActionHook list = *(ActionHook*)closure;
- while (list != NULL) {
- ActionHook next = list->next;
- XtFree( (XtPointer)list );
- list = next;
- }
-}
-
-
-XtActionHookId XtAppAddActionHook( app, proc, closure )
- XtAppContext app;
- XtActionHookProc proc;
- XtPointer closure;
-{
- ActionHook hook = XtNew(ActionHookRec);
- LOCK_APP(app);
- hook->next = app->action_hook_list;
- hook->app = app;
- hook->proc = proc;
- hook->closure = closure;
- if (app->action_hook_list == NULL) {
- _XtAddCallback( &app->destroy_callbacks,
- FreeActionHookList,
- (XtPointer)&app->action_hook_list
- );
- }
- app->action_hook_list = hook;
- UNLOCK_APP(app);
- return (XtActionHookId)hook;
-}
-
-
-void XtRemoveActionHook( id )
- XtActionHookId id;
-{
- ActionHook *p, hook = (ActionHook)id;
- XtAppContext app = hook->app;
- LOCK_APP(app);
- for (p = &app->action_hook_list; p != NULL && *p != hook; p = &(*p)->next);
- if (p) {
- *p = hook->next;
- XtFree( (XtPointer)hook );
- if (app->action_hook_list == NULL)
- _XtRemoveCallback(&app->destroy_callbacks, FreeActionHookList,
- (XtPointer) &app->action_hook_list);
- }
-#ifdef DEBUG
- else {
- XtAppWarningMsg(app, "badId", "xtRemoveActionHook", XtCXtToolkitError,
- "XtRemoveActionHook called with bad or old hook id",
- (String*)NULL, (Cardinal*)NULL);
- }
-#endif /*DEBUG*/
- UNLOCK_APP(app);
-}
diff --git a/xc/lib/Xt/Alloc.c b/xc/lib/Xt/Alloc.c
deleted file mode 100644
index 01e4f945a..000000000
--- a/xc/lib/Xt/Alloc.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/* $TOG: Alloc.c /main/48 1998/02/06 13:19:39 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-/*
- * X Toolkit Memory Allocation Routines
- *
- * Uses Xlib memory management, which is spec'd to be re-entrant.
- */
-
-#include "IntrinsicI.h"
-#undef _XBCOPYFUNC
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-char *malloc(), *realloc(), *calloc();
-#endif
-
-#define Xmalloc(size) malloc((size))
-#define Xrealloc(ptr, size) realloc((ptr), (size))
-#define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
-#define Xfree(ptr) free(ptr)
-
-#ifdef _XNEEDBCOPYFUNC
-void _XtBcopy(src, dst, length)
- char *src, *dst;
- int length;
-{
- if (src < dst) {
- dst += length;
- src += length;
- while (length--)
- *--dst = *--src;
- } else {
- while (length--)
- *dst++ = *src++;
- }
-}
-#endif
-
-void _XtAllocError(type)
- String type;
-{
- Cardinal num_params = 1;
- if (type == NULL) type = "local memory allocation";
- XtErrorMsg("allocError", type, XtCXtToolkitError,
- "Cannot perform %s", &type, &num_params);
-}
-
-void _XtHeapInit(heap)
- Heap* heap;
-{
- heap->start = NULL;
- heap->bytes_remaining = 0;
-}
-
-#ifndef XTTRACEMEMORY
-
-char *XtMalloc(size)
- unsigned size;
-{
- char *ptr;
-
-#if defined (MALLOC_0_RETURNS_NULL) && defined(XTMALLOC_BC)
- /* preserve this (broken) behavior until everyone fixes their apps */
- if (!size) size = 1;
-#endif
- if ((ptr = Xmalloc(size)) == NULL)
- _XtAllocError("malloc");
-
- return(ptr);
-}
-
-char *XtRealloc(ptr, size)
- char *ptr;
- unsigned size;
-{
- if (ptr == NULL) {
-#if MALLOC_0_RETURNS_NULL
- if (!size) size = 1;
-#endif
- return(XtMalloc(size));
- } else if ((ptr = Xrealloc(ptr, size)) == NULL
-#if MALLOC_0_RETURNS_NULL
- && size
-#endif
- )
- _XtAllocError("realloc");
-
- return(ptr);
-}
-
-char *XtCalloc(num, size)
- unsigned num, size;
-{
- char *ptr;
-
-#if defined (MALLOC_0_RETURNS_NULL) && defined(XTMALLOC_BC)
- /* preserve this (broken) behavior until everyone fixes their apps */
- if (!size) num = size = 1;
-#endif
- if ((ptr = Xcalloc(num, size)) == NULL)
- _XtAllocError("calloc");
-
- return(ptr);
-}
-
-void XtFree(ptr)
- char *ptr;
-{
- if (ptr != NULL) Xfree(ptr);
-}
-
-char* __XtMalloc(size)
- unsigned size;
-{
-#ifdef MALLOC_0_RETURNS_NULL
- if (!size) size = 1;
-#endif
- return XtMalloc (size);
-}
-
-char* __XtCalloc(num, size)
- unsigned num, size;
-{
-#ifdef MALLOC_0_RETURNS_NULL
- if (!size) num = size = 1;
-#endif
- return XtCalloc(num, size);
-}
-
-#ifndef HEAP_SEGMENT_SIZE
-#define HEAP_SEGMENT_SIZE 1492
-#endif
-
-char* _XtHeapAlloc(heap, bytes)
- Heap* heap;
- Cardinal bytes;
-{
- register char* heap_loc;
- if (heap == NULL) return XtMalloc(bytes);
- if (heap->bytes_remaining < (int)bytes) {
- if ((bytes + sizeof(char*)) >= (HEAP_SEGMENT_SIZE>>1)) {
- /* preserve current segment; insert this one in front */
-#ifdef _TRACE_HEAP
- printf( "allocating large segment (%d bytes) on heap %#x\n",
- bytes, heap );
-#endif
- heap_loc = XtMalloc(bytes + sizeof(char*));
- if (heap->start) {
- *(char**)heap_loc = *(char**)heap->start;
- *(char**)heap->start = heap_loc;
- }
- else {
- *(char**)heap_loc = NULL;
- heap->start = heap_loc;
- }
- return heap_loc + sizeof(char*);
- }
- /* else discard remainder of this segment */
-#ifdef _TRACE_HEAP
- printf( "allocating new segment on heap %#x\n", heap );
-#endif
- heap_loc = XtMalloc((unsigned)HEAP_SEGMENT_SIZE);
- *(char**)heap_loc = heap->start;
- heap->start = heap_loc;
- heap->current = heap_loc + sizeof(char*);
- heap->bytes_remaining = HEAP_SEGMENT_SIZE - sizeof(char*);
- }
- bytes = (bytes + (sizeof(long) - 1)) & (~(sizeof(long) - 1));
- heap_loc = heap->current;
- heap->current += bytes;
- heap->bytes_remaining -= bytes; /* can be negative, if rounded */
- return heap_loc;
-}
-
-void _XtHeapFree(heap)
- Heap* heap;
-{
- char* segment = heap->start;
- while (segment != NULL) {
- char* next_segment = *(char**)segment;
- XtFree(segment);
- segment = next_segment;
- }
- heap->start = NULL;
- heap->bytes_remaining = 0;
-}
-
-#else
-
-/*
- * X Toolkit Memory Trace Allocation Routines
- */
-
-#undef XtMalloc
-#undef XtRealloc
-#undef XtCalloc
-#undef XtFree
-
-typedef struct _Stats *StatsPtr;
-typedef struct _Stats {
- StatsPtr prev, next;
- char *file;
- int line;
- unsigned size;
- unsigned long seq;
- XtPointer heap;
-} Stats;
-
-static StatsPtr XtMemory = (StatsPtr)NULL;
-static unsigned long ActiveXtMemory = 0;
-static unsigned long XtSeqId = 0;
-static unsigned long XtSeqBreakpoint = ~0;
-
-#define StatsSize(n) ((((n) + (sizeof(long) - 1)) & ~(sizeof(long) - 1)) + sizeof(Stats))
-#define ToStats(ptr) ((StatsPtr)(ptr - sizeof(Stats)))
-#define ToMem(ptr) (((char *)ptr) + sizeof(Stats))
-
-#define CHAIN(ptr,len,hp) \
- ptr->next = XtMemory; \
- if (XtMemory) \
- XtMemory->prev = ptr; \
- XtMemory = ptr; \
- ptr->prev = (StatsPtr)NULL; \
- ptr->file = file; \
- ptr->line = line; \
- ptr->size = len; \
- ptr->heap = hp; \
- if (file) \
- ActiveXtMemory += len; \
- ptr->seq = XtSeqId; \
- if (XtSeqId == XtSeqBreakpoint) \
- _XtBreakpoint(ptr); \
- XtSeqId++
-
-/*ARGUSED*/
-static void _XtBreakpoint(mem)
- StatsPtr mem;
-{
- mem->seq = XtSeqId; /* avoid being optimized out of existence */
-}
-
-char *_XtMalloc(size, file, line)
- unsigned size;
- char *file;
- int line;
-{
- StatsPtr ptr;
- unsigned newsize;
- char* retval = NULL;
-
- LOCK_PROCESS;
- newsize = StatsSize(size);
- if ((ptr = (StatsPtr)Xmalloc(newsize)) == NULL)
- _XtAllocError("malloc");
- CHAIN(ptr, size, NULL);
- retval = (ToMem(ptr));
- UNLOCK_PROCESS;
- return retval;
-}
-
-char *XtMalloc(size)
- unsigned size;
-{
- return _XtMalloc(size, (char *)NULL, 0);
-}
-
-char *_XtRealloc(ptr, size, file, line)
- char *ptr;
- unsigned size;
- char *file;
- int line;
-{
- char *newptr;
-
- LOCK_PROCESS;
- newptr = _XtMalloc(size, file, line);
- if (ptr) {
- unsigned copysize = ToStats(ptr)->size;
- if (copysize > size) copysize = size;
- memmove(newptr, ptr, copysize);
- _XtFree(ptr);
- }
- UNLOCK_PROCESS;
- return(newptr);
-}
-
-char *XtRealloc(ptr, size)
- char *ptr;
- unsigned size;
-{
- return _XtRealloc(ptr, size, (char *)NULL, 0);
-}
-
-char *_XtCalloc(num, size, file, line)
- unsigned num, size;
- char *file;
- int line;
-{
- StatsPtr ptr;
- unsigned total, newsize;
- char* retval = NULL;
-
- LOCK_PROCESS;
- total = num * size;
- newsize = StatsSize(total);
- if ((ptr = (StatsPtr)Xcalloc(newsize, 1)) == NULL)
- _XtAllocError("calloc");
- CHAIN(ptr, total, NULL);
- retval = (ToMem(ptr));
- UNLOCK_PROCESS;
- return retval;
-}
-
-char *XtCalloc(num, size)
- unsigned num, size;
-{
- return _XtCalloc(num, size, (char *)NULL, 0);
-}
-
-Boolean _XtIsValidPointer(ptr)
- char *ptr;
-{
- register StatsPtr mem;
- register StatsPtr stp = ToStats(ptr);
-
- LOCK_PROCESS;
- for (mem = XtMemory; mem; mem = mem->next) {
- if (mem == stp) {
- UNLOCK_PROCESS;
- return True;
- }
- }
- UNLOCK_PROCESS;
- return False;
-}
-
-Boolean _XtValidateMemory = False;
-
-void _XtFree(ptr)
- char *ptr;
-{
- register StatsPtr stp;
-
- LOCK_PROCESS;
- if (ptr) {
- if (_XtValidateMemory && !_XtIsValidPointer(ptr))
- abort();
- stp = ToStats(ptr);
- if (stp->file)
- ActiveXtMemory -= stp->size;
- if (stp->prev)
- stp->prev->next = stp->next;
- else
- XtMemory = stp->next;
- if (stp->next)
- stp->next->prev = stp->prev;
- Xfree((char *)stp);
- }
- UNLOCK_PROCESS;
-}
-
-void XtFree(ptr)
- char *ptr;
-{
- _XtFree(ptr);
-}
-
-char *_XtHeapMalloc(heap, size, file, line)
- Heap *heap;
- Cardinal size;
- char *file;
- int line;
-{
- StatsPtr ptr;
- unsigned newsize;
- XtPointer hp = (XtPointer) heap;
- char* retval = NULL;
-
- LOCK_PROCESS;
- newsize = StatsSize(size);
- if ((ptr = (StatsPtr)Xmalloc(newsize)) == NULL)
- _XtAllocError("malloc");
- CHAIN(ptr, size, hp);
- retval = (ToMem(ptr));
- UNLOCK_PROCESS;
- return retval;
-}
-
-void _XtHeapFree(heap)
- register XtPointer heap;
-{
- register StatsPtr mem, next;
-
- LOCK_PROCESS;
- for (mem = XtMemory; mem; mem = next) {
- next = mem->next;
- if (mem->heap == heap) {
- if (mem->file)
- ActiveXtMemory -= mem->size;
- if (mem->prev)
- mem->prev->next = next;
- else
- XtMemory = next;
- if (next)
- next->prev = mem->prev;
- Xfree((char *)mem);
- }
- }
- UNLOCK_PROCESS;
-}
-
-#include <stdio.h>
-
-void _XtPrintMemory(filename)
-char * filename;
-{
- register StatsPtr mem;
- FILE *f;
-
- if (filename == NULL)
- f = stderr;
- else
- f = fopen(filename, "w");
- LOCK_PROCESS;
- fprintf(f, "total size: %d\n", ActiveXtMemory);
- for (mem = XtMemory; mem; mem = mem->next) {
- if (mem->file)
- fprintf(f, "size: %6d seq: %5d %12s(%4d) %s\n",
- mem->size, mem->seq,
- mem->file, mem->line, mem->heap ? "heap" : "");
- }
- UNLOCK_PROCESS;
- if (filename) fclose(f);
-}
-
-#endif /* XTTRACEMEMORY */
diff --git a/xc/lib/Xt/ArgList.c b/xc/lib/Xt/ArgList.c
deleted file mode 100644
index f984b3103..000000000
--- a/xc/lib/Xt/ArgList.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $TOG: ArgList.c /main/18 1998/02/06 13:19:45 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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 "IntrinsicI.h"
-#include <stdio.h>
-
-/*
- * This routine merges two arglists. It does NOT check for duplicate entries.
- */
-
-ArgList XtMergeArgLists(args1, num_args1, args2, num_args2)
- ArgList args1;
- Cardinal num_args1;
- ArgList args2;
- Cardinal num_args2;
-{
- ArgList result, args;
-
- result = (ArgList) __XtCalloc((unsigned) num_args1 + num_args2,
- (unsigned) sizeof(Arg));
-
- for (args = result; num_args1 != 0; num_args1--)
- *args++ = *args1++;
- for ( ; num_args2 != 0; num_args2--)
- *args++ = *args2++;
-
- return result;
-}
-
-
diff --git a/xc/lib/Xt/Callback.c b/xc/lib/Xt/Callback.c
deleted file mode 100644
index d0d0e8ba3..000000000
--- a/xc/lib/Xt/Callback.c
+++ /dev/null
@@ -1,735 +0,0 @@
-/* $TOG: Callback.c /main/47 1998/02/06 13:19:54 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-/* $XFree86: xc/lib/Xt/Callback.c,v 1.5 1998/12/20 22:18:57 dawes Exp $ */
-
-#include "IntrinsicI.h"
-
-static String XtNinvalidCallbackList = "invalidCallbackList";
-static String XtNxtAddCallback = "xtAddCallback";
-static String XtNxtRemoveCallback = "xtRemoveCallback";
-static String XtNxtRemoveAllCallback = "xtRemoveAllCallback";
-static String XtNxtCallCallback = "xtCallCallback";
-
-/* However it doesn't contain a final NULL record */
-#define ToList(p) ((XtCallbackList) ((p)+1))
-
-static InternalCallbackList* FetchInternalList(widget, name)
- Widget widget;
- String name;
-{
- XrmQuark quark;
- int n;
- CallbackTable offsets;
- InternalCallbackList* retval = NULL;
-
- quark = StringToQuark(name);
- LOCK_PROCESS;
- offsets = (CallbackTable)
- widget->core.widget_class->core_class.callback_private;
-
- for (n = (int)(long) *(offsets++); --n >= 0; offsets++)
- if (quark == (*offsets)->xrm_name) {
- retval = (InternalCallbackList *)
- ((char *) widget - (*offsets)->xrm_offset - 1);
- break;
- }
- UNLOCK_PROCESS;
- return retval;
-}
-
-
-void _XtAddCallback(callbacks, callback, closure)
- InternalCallbackList* callbacks;
- XtCallbackProc callback;
- XtPointer closure;
-{
- register InternalCallbackList icl;
- register XtCallbackList cl;
- register int count;
-
- icl = *callbacks;
- count = icl ? icl->count : 0;
-
- if (icl && icl->call_state) {
- icl->call_state |= _XtCBFreeAfterCalling;
- icl = (InternalCallbackList)
- __XtMalloc(sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (count + 1));
- (void) memmove((char *)ToList(icl), (char *)ToList(*callbacks),
- sizeof(XtCallbackRec) * count);
- } else {
- icl = (InternalCallbackList)
- XtRealloc((char *) icl, sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (count + 1));
- }
- *callbacks = icl;
- icl->count = count + 1;
- icl->is_padded = 0;
- icl->call_state = 0;
- cl = ToList(icl) + count;
- cl->callback = callback;
- cl->closure = closure;
-} /* _XtAddCallback */
-
-void _XtAddCallbackOnce(callbacks, callback, closure)
- register InternalCallbackList*callbacks;
- XtCallbackProc callback;
- XtPointer closure;
-{
- register XtCallbackList cl = ToList(*callbacks);
- register int i;
-
- for (i=(*callbacks)->count; --i >= 0; cl++)
- if (cl->callback == callback && cl->closure == closure)
- return;
-
- _XtAddCallback(callbacks, callback, closure);
-} /* _XtAddCallbackOnce */
-
-#if NeedFunctionPrototypes
-void XtAddCallback(
- Widget widget,
- _Xconst char* name,
- XtCallbackProc callback,
- XtPointer closure
- )
-#else
-void XtAddCallback(widget, name, callback, closure)
- Widget widget;
- String name;
- XtCallbackProc callback;
- XtPointer closure;
-#endif
-{
- InternalCallbackList *callbacks;
- Widget hookobj;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, name);
- if (!callbacks) {
- XtAppWarningMsg(app,
- XtNinvalidCallbackList,XtNxtAddCallback,XtCXtToolkitError,
- "Cannot find callback list in XtAddCallback",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
- _XtAddCallback(callbacks, callback, closure);
- if (!_XtIsHookObject(widget)) {
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHaddCallback;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) name;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- }
- UNLOCK_APP(app);
-} /* XtAddCallback */
-
-/* ARGSUSED */
-static void AddCallbacks(widget, callbacks, newcallbacks)
- Widget widget;
- InternalCallbackList *callbacks;
- XtCallbackList newcallbacks;
-{
- register InternalCallbackList icl;
- register int i, j;
- register XtCallbackList cl;
-
- icl = *callbacks;
- i = icl ? icl->count : 0;
- for (j=0, cl = newcallbacks; cl->callback; cl++, j++);
- if (icl && icl->call_state) {
- icl->call_state |= _XtCBFreeAfterCalling;
- icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (i+j));
- (void) memmove((char *)ToList(*callbacks), (char *)ToList(icl),
- sizeof(XtCallbackRec) * i);
- } else {
- icl = (InternalCallbackList) XtRealloc((char *) icl,
- sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (i+j));
- }
- *callbacks = icl;
- icl->count = i+j;
- icl->is_padded = 0;
- icl->call_state = 0;
- for (cl = ToList(icl) + i; --j >= 0; )
- *cl++ = *newcallbacks++;
-} /* AddCallbacks */
-
-#if NeedFunctionPrototypes
-void XtAddCallbacks(
- Widget widget,
- _Xconst char* name,
- XtCallbackList xtcallbacks
- )
-#else
-void XtAddCallbacks(widget, name, xtcallbacks)
- Widget widget;
- String name;
- XtCallbackList xtcallbacks;
-#endif
-{
- InternalCallbackList* callbacks;
- Widget hookobj;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, name);
- if (!callbacks) {
- XtAppWarningMsg(app,
- XtNinvalidCallbackList,XtNxtAddCallback,XtCXtToolkitError,
- "Cannot find callback list in XtAddCallbacks",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
- AddCallbacks(widget, callbacks, xtcallbacks);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHaddCallbacks;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) name;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtAddCallbacks */
-
-void _XtRemoveCallback (callbacks, callback, closure)
- InternalCallbackList *callbacks;
- XtCallbackProc callback;
- XtPointer closure;
-
-{
- register InternalCallbackList icl;
- register int i, j;
- register XtCallbackList cl, ncl, ocl;
-
- icl = *callbacks;
- if (!icl) return;
-
- cl = ToList(icl);
- for (i=icl->count; --i >= 0; cl++) {
- if (cl->callback == callback && cl->closure == closure) {
- if (icl->call_state) {
- icl->call_state |= _XtCBFreeAfterCalling;
- if (icl->count == 1) {
- *callbacks = NULL;
- } else {
- j = icl->count - i - 1;
- ocl = ToList(icl);
- icl = (InternalCallbackList)
- __XtMalloc(sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (i + j));
- icl->count = i + j;
- icl->is_padded = 0;
- icl->call_state = 0;
- ncl = ToList(icl);
- while (--j >= 0)
- *ncl++ = *ocl++;
- while (--i >= 0)
- *ncl++ = *++cl;
- *callbacks = icl;
- }
- } else {
- if (--icl->count) {
- ncl = cl + 1;
- while (--i >= 0)
- *cl++ = *ncl++;
- icl = (InternalCallbackList)
- XtRealloc((char *) icl, sizeof(InternalCallbackRec)
- + sizeof(XtCallbackRec) * icl->count);
- icl->is_padded = 0;
- *callbacks = icl;
- } else {
- XtFree((char *) icl);
- *callbacks = NULL;
- }
- }
- return;
- }
- }
-} /* _XtRemoveCallback */
-
-#if NeedFunctionPrototypes
-void XtRemoveCallback (
- Widget widget,
- _Xconst char* name,
- XtCallbackProc callback,
- XtPointer closure
- )
-#else
-void XtRemoveCallback (widget, name, callback, closure)
- Widget widget;
- String name;
- XtCallbackProc callback;
- XtPointer closure;
-#endif
-{
- InternalCallbackList *callbacks;
- Widget hookobj;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, name);
- if (!callbacks) {
- XtAppWarningMsg(app,
- XtNinvalidCallbackList,XtNxtRemoveCallback,XtCXtToolkitError,
- "Cannot find callback list in XtRemoveCallback",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
- _XtRemoveCallback(callbacks, callback, closure);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHremoveCallback;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) name;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtRemoveCallback */
-
-
-#if NeedFunctionPrototypes
-void XtRemoveCallbacks (widget, name, xtcallbacks)
- Widget widget;
- _Xconst char* name;
- XtCallbackList xtcallbacks;
-#else
-void XtRemoveCallbacks (widget, name, xtcallbacks)
- Widget widget;
- String name;
- XtCallbackList xtcallbacks;
-#endif
-{
- InternalCallbackList *callbacks;
- Widget hookobj;
- int i;
- InternalCallbackList icl;
- XtCallbackList cl, ccl, rcl;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, name);
- if (!callbacks) {
- XtAppWarningMsg(app,
- XtNinvalidCallbackList,XtNxtRemoveCallback,XtCXtToolkitError,
- "Cannot find callback list in XtRemoveCallbacks",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
-
- icl = *callbacks;
- if (!icl) {
- UNLOCK_APP(app);
- return;
- }
-
- i = icl->count;
- cl = ToList(icl);
- if (icl->call_state) {
- icl->call_state |= _XtCBFreeAfterCalling;
- icl = (InternalCallbackList)__XtMalloc(sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * i);
- icl->count = i;
- icl->call_state = 0;
- }
- ccl = ToList(icl);
- while (--i >= 0) {
- *ccl++ = *cl;
- for (rcl=xtcallbacks; rcl->callback; rcl++) {
- if (cl->callback == rcl->callback && cl->closure == rcl->closure) {
- ccl--;
- icl->count--;
- break;
- }
- }
- cl++;
- }
- if (icl->count) {
- icl = (InternalCallbackList)
- XtRealloc((char *)icl, (sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * icl->count));
- icl->is_padded = 0;
- *callbacks = icl;
- } else {
- XtFree((char *)icl);
- *callbacks = NULL;
- }
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHremoveCallbacks;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) name;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtRemoveCallbacks */
-
-
-void _XtRemoveAllCallbacks (callbacks)
- InternalCallbackList *callbacks;
-{
- register InternalCallbackList icl = *callbacks;
-
- if (icl) {
- if (icl->call_state)
- icl->call_state |= _XtCBFreeAfterCalling;
- else
- XtFree((char *) icl);
- *callbacks = NULL;
- }
-} /* _XtRemoveAllCallbacks */
-
-#if NeedFunctionPrototypes
-void XtRemoveAllCallbacks(widget, name)
- Widget widget;
- _Xconst char* name;
-#else
-void XtRemoveAllCallbacks(widget, name)
- Widget widget;
- String name;
-#endif
-{
- InternalCallbackList *callbacks;
- Widget hookobj;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, name);
- if (!callbacks) {
- XtAppWarningMsg(app,
- XtNinvalidCallbackList,XtNxtRemoveAllCallback,XtCXtToolkitError,
- "Cannot find callback list in XtRemoveAllCallbacks",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
- _XtRemoveAllCallbacks(callbacks);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHremoveAllCallbacks;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) name;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtRemoveAllCallbacks */
-
-InternalCallbackList _XtCompileCallbackList(xtcallbacks)
- XtCallbackList xtcallbacks;
-{
- register int n;
- register XtCallbackList xtcl, cl;
- register InternalCallbackList callbacks;
-
- for (n=0, xtcl=xtcallbacks; xtcl->callback; n++, xtcl++) {};
- if (n == 0) return (InternalCallbackList) NULL;
-
- callbacks = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * n);
- callbacks->count = n;
- callbacks->is_padded = 0;
- callbacks->call_state = 0;
- cl = ToList(callbacks);
- while (--n >= 0)
- *cl++ = *xtcallbacks++;
- return(callbacks);
-} /* _XtCompileCallbackList */
-
-
-XtCallbackList _XtGetCallbackList(callbacks)
- InternalCallbackList *callbacks;
-{
- register int i;
- register InternalCallbackList icl;
- register XtCallbackList cl, ocl;
-
- icl = *callbacks;
- if (!icl) {
- static XtCallbackRec emptyList[1] = { {NULL, NULL} };
- return (XtCallbackList)emptyList;
- }
- if (icl->is_padded)
- return ToList(icl);
- i = icl->count;
- if (icl->call_state) {
- icl->call_state |= _XtCBFreeAfterCalling;
- ocl = ToList(icl);
- icl = (InternalCallbackList) __XtMalloc(sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (i+1));
- icl->count = i;
- icl->call_state = 0;
- cl = ToList(icl);
- while (--i >= 0)
- *cl++ = *ocl++;
- } else {
- icl = (InternalCallbackList) XtRealloc((char *)icl,
- sizeof(InternalCallbackRec) +
- sizeof(XtCallbackRec) * (i+1));
- cl = ToList(icl) + i;
- }
- icl->is_padded = 1;
- cl->callback = (XtCallbackProc) NULL;
- cl->closure = NULL;
- *callbacks = icl;
- return ToList(icl);
-}
-
-#if NeedFunctionPrototypes
-void XtCallCallbacks(
- Widget widget,
- _Xconst char* name,
- XtPointer call_data
- )
-#else
-void XtCallCallbacks(widget, name, call_data)
- Widget widget;
- String name;
- XtPointer call_data;
-#endif
-{
- InternalCallbackList *callbacks;
- InternalCallbackList icl;
- XtCallbackList cl;
- int i;
- char ostate;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, name);
- if (!callbacks) {
- XtAppWarningMsg(app,
- XtNinvalidCallbackList,XtNxtCallCallback,XtCXtToolkitError,
- "Cannot find callback list in XtCallCallbacks",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
-
- icl = *callbacks;
- if (!icl) {
- UNLOCK_APP(app);
- return;
- }
- cl = ToList(icl);
- if (icl->count == 1) {
- (*cl->callback) (widget, cl->closure, call_data);
- UNLOCK_APP(app);
- return;
- }
- ostate = icl->call_state;
- icl->call_state = _XtCBCalling;
- for (i = icl->count; --i >= 0; cl++)
- (*cl->callback) (widget, cl->closure, call_data);
- if (ostate)
- icl->call_state |= ostate;
- else if (icl->call_state & _XtCBFreeAfterCalling)
- XtFree((char *)icl);
- else
- icl->call_state = ostate;
- UNLOCK_APP(app);
-} /* XtCallCallbacks */
-
-
-#if NeedFunctionPrototypes
-XtCallbackStatus XtHasCallbacks(
- Widget widget,
- _Xconst char* callback_name
- )
-#else
-XtCallbackStatus XtHasCallbacks(widget, callback_name)
- Widget widget;
- String callback_name;
-#endif
-{
- InternalCallbackList *callbacks;
- XtCallbackStatus retval = XtCallbackHasSome;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- callbacks = FetchInternalList(widget, callback_name);
- if (!callbacks)
- retval = XtCallbackNoList;
- else if (!*callbacks)
- retval = XtCallbackHasNone;
- UNLOCK_APP(app);
- return retval;
-} /* XtHasCallbacks */
-
-
-void XtCallCallbackList(widget, callbacks, call_data)
- Widget widget;
- XtCallbackList callbacks;
- XtPointer call_data;
-{
- register InternalCallbackList icl;
- register XtCallbackList cl;
- register int i;
- char ostate;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (!callbacks) {
- UNLOCK_APP(app);
- return;
- }
- icl = (InternalCallbackList)callbacks;
- cl = ToList(icl);
- if (icl->count == 1) {
- (*cl->callback) (widget, cl->closure, call_data);
- UNLOCK_APP(app);
- return;
- }
- ostate = icl->call_state;
- icl->call_state = _XtCBCalling;
- for (i = icl->count; --i >= 0; cl++)
- (*cl->callback) (widget, cl->closure, call_data);
- if (ostate)
- icl->call_state |= ostate;
- else if (icl->call_state & _XtCBFreeAfterCalling)
- XtFree((char *)icl);
- else
- icl->call_state = 0;
- UNLOCK_APP(app);
-} /* XtCallCallbackList */
-
-void _XtPeekCallback(widget, callbacks, callback, closure)
- Widget widget;
- XtCallbackList callbacks;
- XtCallbackProc *callback;
- XtPointer *closure;
-{
- register InternalCallbackList icl = (InternalCallbackList) callbacks;
- register XtCallbackList cl;
-
- if (!callbacks) {
- *callback = (XtCallbackProc) NULL;
- return;
- }
- cl = ToList(icl);
- *callback = cl->callback;
- *closure = cl->closure;
- return;
-}
-
-void _XtCallConditionalCallbackList(widget, callbacks, call_data, cond_proc)
- Widget widget;
- XtCallbackList callbacks;
- XtPointer call_data;
- _XtConditionProc cond_proc;
-{
- register InternalCallbackList icl;
- register XtCallbackList cl;
- register int i;
- char ostate;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (!callbacks) {
- UNLOCK_APP(app);
- return;
- }
- icl = (InternalCallbackList)callbacks;
- cl = ToList(icl);
- if (icl->count == 1) {
- (*cl->callback) (widget, cl->closure, call_data);
- (void) (*cond_proc)(call_data);
- UNLOCK_APP(app);
- return;
- }
- ostate = icl->call_state;
- icl->call_state = _XtCBCalling;
- for (i = icl->count; --i >= 0; cl++) {
- (*cl->callback) (widget, cl->closure, call_data);
- if (! (*cond_proc)(call_data))
- break;
- }
- if (ostate)
- icl->call_state |= ostate;
- else if (icl->call_state & _XtCBFreeAfterCalling)
- XtFree((char *)icl);
- else
- icl->call_state = 0;
- UNLOCK_APP(app);
-}
diff --git a/xc/lib/Xt/CallbackI.h b/xc/lib/Xt/CallbackI.h
deleted file mode 100644
index 91a1b7198..000000000
--- a/xc/lib/Xt/CallbackI.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $TOG: CallbackI.h /main/19 1998/02/06 13:19:49 kaleb $ */
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-/****************************************************************
- *
- * Callbacks
- *
- ****************************************************************/
-
-typedef XrmResource **CallbackTable;
-
-#define _XtCBCalling 1
-#define _XtCBFreeAfterCalling 2
-
-typedef struct internalCallbackRec {
- unsigned short count;
- char is_padded; /* contains NULL padding for external form */
- char call_state; /* combination of _XtCB{FreeAfter}Calling */
-#ifdef LONG64
- unsigned int align_pad; /* padding to align callback list */
-#endif
- /* XtCallbackList */
-} InternalCallbackRec, *InternalCallbackList;
-
-typedef Boolean (*_XtConditionProc)(
-#if NeedFunctionPrototypes
- XtPointer /* data */
-#endif
-);
-
-extern void _XtAddCallback(
-#if NeedFunctionPrototypes
- InternalCallbackList* /* callbacks */,
- XtCallbackProc /* callback */,
- XtPointer /* closure */
-#endif
-);
-
-extern void _XtAddCallbackOnce(
-#if NeedFunctionPrototypes
- InternalCallbackList* /* callbacks */,
- XtCallbackProc /* callback */,
- XtPointer /* closure */
-#endif
-);
-
-extern InternalCallbackList _XtCompileCallbackList(
-#if NeedFunctionPrototypes
- XtCallbackList /* xtcallbacks */
-#endif
-);
-
-extern XtCallbackList _XtGetCallbackList(
-#if NeedFunctionPrototypes
- InternalCallbackList* /* callbacks */
-#endif
-);
-
-extern void _XtRemoveAllCallbacks(
-#if NeedFunctionPrototypes
- InternalCallbackList* /* callbacks */
-#endif
-);
-
-extern void _XtRemoveCallback(
-#if NeedFunctionPrototypes
- InternalCallbackList* /* callbacks */,
- XtCallbackProc /* callback */,
- XtPointer /* closure */
-#endif
-);
-
-extern void _XtPeekCallback(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtCallbackList /* callbacks */,
- XtCallbackProc * /* callback */,
- XtPointer * /* closure */
-#endif
-);
-
-extern void _XtCallConditionalCallbackList(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtCallbackList /* callbacks */,
- XtPointer /* call_data */,
- _XtConditionProc /* cond_proc */
-#endif
-);
diff --git a/xc/lib/Xt/ClickTime.c b/xc/lib/Xt/ClickTime.c
deleted file mode 100644
index 7a15c4462..000000000
--- a/xc/lib/Xt/ClickTime.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* $TOG: ClickTime.c /main/6 1998/02/06 13:19:59 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-/*
- * Contains XtSetMultiClickTime, XtGetMultiClickTime
- */
-
-#include "IntrinsicI.h"
-
-void XtSetMultiClickTime( dpy, time )
- Display *dpy;
- int time;
-{
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- _XtGetPerDisplay(dpy)->multi_click_time = time;
- UNLOCK_APP(app);
-}
-
-
-int XtGetMultiClickTime( dpy )
- Display *dpy;
-{
- int retval;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- retval = _XtGetPerDisplay(dpy)->multi_click_time;
- UNLOCK_APP(app);
- return retval;
-}
diff --git a/xc/lib/Xt/Composite.c b/xc/lib/Xt/Composite.c
deleted file mode 100644
index 163281768..000000000
--- a/xc/lib/Xt/Composite.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/* $TOG: Composite.c /main/25 1998/02/06 13:20:09 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-#define COMPOSITE
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-
-static XtResource resources[] = {
- {XtNchildren, XtCReadOnly, XtRWidgetList, sizeof(WidgetList),
- XtOffsetOf(CompositeRec, composite.children), XtRImmediate, NULL},
- {XtNnumChildren, XtCReadOnly, XtRCardinal, sizeof(Cardinal),
- XtOffsetOf(CompositeRec, composite.num_children), XtRImmediate, 0},
- {XtNinsertPosition, XtCInsertPosition, XtRFunction, sizeof(XtOrderProc),
- XtOffsetOf(CompositeRec, composite.insert_position), XtRImmediate, NULL},
-};
-
-static void CompositeClassPartInitialize();
-static void CompositeInitialize();
-static void CompositeInsertChild();
-static void CompositeDeleteChild();
-static void CompositeDestroy();
-
-externaldef(compositeclassrec) CompositeClassRec compositeClassRec = {
- { /******* CorePart *******/
- /* superclass */ &widgetClassRec,
- /* class_name */ "Composite",
- /* widget_size */ sizeof(CompositeRec),
- /* class_initialize */ NULL,
- /* class_part_initialize*/ CompositeClassPartInitialize,
- /* class_inited */ FALSE,
- /* initialize */ CompositeInitialize,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave */ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ CompositeDestroy,
- /* resize */ NULL,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },
- { /**** CompositePart *****/
- /* geometry_handler */ NULL,
- /* change_managed */ NULL,
- /* insert_child */ CompositeInsertChild,
- /* delete_child */ CompositeDeleteChild,
- /* extension */ NULL
- }
-};
-
-externaldef(compositewidgetclass) WidgetClass compositeWidgetClass = (WidgetClass) &compositeClassRec;
-
-static void InheritAllowsChangeManagedSet(widget_class)
- WidgetClass widget_class;
-{
- CompositeWidgetClass cc = (CompositeWidgetClass) widget_class;
- CompositeClassExtension ext, super_ext, new_ext;
-
- ext = (CompositeClassExtension)
- XtGetClassExtension(widget_class,
- XtOffsetOf(CompositeClassRec, composite_class.extension),
- NULLQUARK, 1L, 0);
-
- if (ext && ext->version == XtCompositeExtensionVersion)
- return;
-
- super_ext = (CompositeClassExtension)
- XtGetClassExtension(cc->core_class.superclass,
- XtOffsetOf(CompositeClassRec, composite_class.extension),
- NULLQUARK, 1L, 0);
-
- LOCK_PROCESS;
- if (super_ext && super_ext->version == XtCompositeExtensionVersion &&
- super_ext->record_size == sizeof(CompositeClassExtensionRec) &&
- super_ext->allows_change_managed_set) {
-
- new_ext = (CompositeClassExtension)
- __XtCalloc(1, sizeof(CompositeClassExtensionRec));
-
- /* Be careful to inherit only what is appropriate */
- new_ext->next_extension = cc->composite_class.extension;
- new_ext->record_type = NULLQUARK;
- new_ext->version = XtCompositeExtensionVersion;
- new_ext->record_size = sizeof(CompositeClassExtensionRec);
- new_ext->accepts_objects = (ext ? ext->accepts_objects : False);
- new_ext->allows_change_managed_set = True;
- cc->composite_class.extension = (XtPointer) new_ext;
- }
- UNLOCK_PROCESS;
-}
-
-static void CompositeClassPartInitialize(widgetClass)
- WidgetClass widgetClass;
-{
- register CompositePartPtr wcPtr;
- register CompositePartPtr superPtr;
-
- wcPtr = (CompositePartPtr)
- &(((CompositeWidgetClass)widgetClass)->composite_class);
-
- if (widgetClass != compositeWidgetClass)
- /* don't compute possible bogus pointer */
- superPtr = (CompositePartPtr)&(((CompositeWidgetClass)widgetClass
- ->core_class.superclass)->composite_class);
-#ifdef lint
- else
- superPtr = NULL;
-#endif
-
- /* We don't need to check for null super since we'll get to composite
- eventually, and it had better define them! */
-
- LOCK_PROCESS;
- if (wcPtr->geometry_manager == XtInheritGeometryManager) {
- wcPtr->geometry_manager =
- superPtr->geometry_manager;
- }
-
- if (wcPtr->change_managed == XtInheritChangeManaged) {
- wcPtr->change_managed =
- superPtr->change_managed;
- InheritAllowsChangeManagedSet(widgetClass);
- }
-
- if (wcPtr->insert_child == XtInheritInsertChild) {
- wcPtr->insert_child = superPtr->insert_child;
- }
-
- if (wcPtr->delete_child == XtInheritDeleteChild) {
- wcPtr->delete_child = superPtr->delete_child;
- }
- UNLOCK_PROCESS;
-}
-
-static void CompositeDestroy(w)
- Widget w;
-{
- register CompositeWidget cw = (CompositeWidget) w;
-
- XtFree((char *) cw->composite.children);
-}
-
-static void CompositeInsertChild(w)
- Widget w;
-{
- register Cardinal position;
- register Cardinal i;
- register CompositeWidget cw;
- register WidgetList children;
-
- cw = (CompositeWidget) w->core.parent;
- children = cw->composite.children;
-
- if (cw->composite.insert_position != NULL)
- position = (*(cw->composite.insert_position))(w);
- else
- position = cw->composite.num_children;
-
- if (cw->composite.num_children == cw->composite.num_slots) {
- /* Allocate more space */
- cw->composite.num_slots += (cw->composite.num_slots / 2) + 2;
- cw->composite.children = children =
- (WidgetList) XtRealloc((XtPointer) children,
- (unsigned) (cw->composite.num_slots) * sizeof(Widget));
- }
- /* Ripple children up one space from "position" */
- for (i = cw->composite.num_children; i > position; i--) {
- children[i] = children[i-1];
- }
- children[position] = w;
- cw->composite.num_children++;
-}
-
-static void CompositeDeleteChild(w)
- Widget w;
-{
- register Cardinal position;
- register Cardinal i;
- register CompositeWidget cw;
-
- cw = (CompositeWidget) w->core.parent;
-
- for (position = 0; position < cw->composite.num_children; position++) {
- if (cw->composite.children[position] == w) {
- break;
- }
- }
- if (position == cw->composite.num_children) return;
-
- /* Ripple children down one space from "position" */
- cw->composite.num_children--;
- for (i = position; i < cw->composite.num_children; i++) {
- cw->composite.children[i] = cw->composite.children[i+1];
- }
-}
-
-/* ARGSUSED */
-static void CompositeInitialize(requested_widget, new_widget, args, num_args)
- Widget new_widget, requested_widget;
- ArgList args;
- Cardinal *num_args;
-{
- register CompositeWidget cw;
-
- cw = (CompositeWidget) new_widget;
- cw->composite.num_children = 0;
- cw->composite.children = NULL;
- cw->composite.num_slots = 0;
-}
diff --git a/xc/lib/Xt/Composite.h b/xc/lib/Xt/Composite.h
deleted file mode 100644
index 331c0cd37..000000000
--- a/xc/lib/Xt/Composite.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $TOG: Composite.h /main/17 1998/02/06 13:20:14 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtComposite_h
-#define _XtComposite_h
-
-typedef struct _CompositeClassRec *CompositeWidgetClass;
-
-typedef Cardinal (*XtOrderProc)(
-#if NeedFunctionPrototypes
- Widget /* child */
-#endif
-);
-
-_XFUNCPROTOBEGIN
-
-extern void XtManageChildren(
-#if NeedFunctionPrototypes
- WidgetList /* children */,
- Cardinal /* num_children */
-#endif
-);
-
-extern void XtManageChild(
-#if NeedFunctionPrototypes
- Widget /* child */
-#endif
-);
-
-extern void XtUnmanageChildren(
-#if NeedFunctionPrototypes
- WidgetList /* children */,
- Cardinal /* num_children */
-#endif
-);
-
-extern void XtUnmanageChild(
-#if NeedFunctionPrototypes
- Widget /* child */
-#endif
-);
-
-typedef void (*XtDoChangeProc)(
-#if NeedFunctionPrototypes
- Widget /* composite_parent */,
- WidgetList /* unmanage_children */,
- Cardinal * /* num_unmanage_children */,
- WidgetList /* manage_children */,
- Cardinal * /* num_manage_children */,
- XtPointer /* client_data */
-#endif
-);
-
-extern void XtChangeManagedSet(
-#if NeedFunctionPrototypes
- WidgetList /* unmanage_children */,
- Cardinal /* num_unmanage_children */,
- XtDoChangeProc /* do_change_proc */,
- XtPointer /* client_data */,
- WidgetList /* manage_children */,
- Cardinal /* num_manage_children */
-#endif
-);
-
-_XFUNCPROTOEND
-
-#ifndef COMPOSITE
-externalref WidgetClass compositeWidgetClass;
-#endif
-
-#endif /* _XtComposite_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/CompositeP.h b/xc/lib/Xt/CompositeP.h
deleted file mode 100644
index df99322e0..000000000
--- a/xc/lib/Xt/CompositeP.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* $TOG: CompositeP.h /main/18 1998/02/06 13:20:04 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtCompositeP_h
-#define _XtCompositeP_h
-
-#include <X11/Composite.h>
-
-/************************************************************************
- *
- * Additional instance fields for widgets of (sub)class 'Composite'
- *
- ************************************************************************/
-
-typedef struct _CompositePart {
- WidgetList children; /* array of ALL widget children */
- Cardinal num_children; /* total number of widget children */
- Cardinal num_slots; /* number of slots in children array */
- XtOrderProc insert_position; /* compute position of new child */
-} CompositePart,*CompositePtr;
-
-typedef struct _CompositeRec {
- CorePart core;
- CompositePart composite;
-} CompositeRec;
-
-/*********************************************************************
- *
- * Additional class fields for widgets of (sub)class 'Composite'
- *
- ********************************************************************/
-
-typedef struct _CompositeClassPart {
- XtGeometryHandler geometry_manager; /* geometry manager for children */
- XtWidgetProc change_managed; /* change managed state of child */
- XtWidgetProc insert_child; /* physically add child to parent */
- XtWidgetProc delete_child; /* physically remove child */
- XtPointer extension; /* pointer to extension record */
-} CompositeClassPart,*CompositePartPtr;
-
-typedef struct {
- XtPointer next_extension; /* 1st 4 mandated for all extension records */
- XrmQuark record_type; /* NULLQUARK; on CompositeClassPart */
- long version; /* must be XtCompositeExtensionVersion */
- Cardinal record_size; /* sizeof(CompositeClassExtensionRec) */
- Boolean accepts_objects;
- Boolean allows_change_managed_set;
-} CompositeClassExtensionRec, *CompositeClassExtension;
-
-
-typedef struct _CompositeClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
-} CompositeClassRec;
-
-externalref CompositeClassRec compositeClassRec;
-
-#define XtCompositeExtensionVersion 2L
-#define XtInheritGeometryManager ((XtGeometryHandler) _XtInherit)
-#define XtInheritChangeManaged ((XtWidgetProc) _XtInherit)
-#define XtInheritInsertChild ((XtWidgetProc) _XtInherit)
-#define XtInheritDeleteChild ((XtWidgetProc) _XtInherit)
-
-#endif /* _XtCompositeP_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/ConstrainP.h b/xc/lib/Xt/ConstrainP.h
deleted file mode 100644
index 3d6927a49..000000000
--- a/xc/lib/Xt/ConstrainP.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* $TOG: ConstrainP.h /main/16 1998/02/06 13:20:19 kaleb $ */
-/* $oHeader: ConstrainP.h,v 1.2 88/08/18 15:54:15 asente Exp $ */
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtConstraintP_h
-#define _XtConstraintP_h
-
-#include <X11/Constraint.h>
-
-typedef struct _ConstraintPart {
- XtPointer mumble; /* No new fields, keep C compiler happy */
-} ConstraintPart;
-
-typedef struct _ConstraintRec {
- CorePart core;
- CompositePart composite;
- ConstraintPart constraint;
-} ConstraintRec, *ConstraintWidget;
-
-typedef struct _ConstraintClassPart {
- XtResourceList resources; /* constraint resource list */
- Cardinal num_resources; /* number of constraints in list */
- Cardinal constraint_size; /* size of constraint record */
- XtInitProc initialize; /* constraint initialization */
- XtWidgetProc destroy; /* constraint destroy proc */
- XtSetValuesFunc set_values; /* constraint set_values proc */
- XtPointer extension; /* pointer to extension record */
-} ConstraintClassPart;
-
-typedef struct {
- XtPointer next_extension; /* 1st 4 mandated for all extension records */
- XrmQuark record_type; /* NULLQUARK; on ConstraintClassPart */
- long version; /* must be XtConstraintExtensionVersion */
- Cardinal record_size; /* sizeof(ConstraintClassExtensionRec) */
- XtArgsProc get_values_hook;
-} ConstraintClassExtensionRec, *ConstraintClassExtension;
-
-typedef struct _ConstraintClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ConstraintClassPart constraint_class;
-} ConstraintClassRec;
-
-externalref ConstraintClassRec constraintClassRec;
-
-#define XtConstraintExtensionVersion 1L
-
-#endif /* _XtConstraintP_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/Constraint.c b/xc/lib/Xt/Constraint.c
deleted file mode 100644
index e54a61f9a..000000000
--- a/xc/lib/Xt/Constraint.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $TOG: Constraint.c /main/16 1998/02/06 13:20:24 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-#define CONSTRAINT
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-
-static void ConstraintPartInitialize();
-externaldef(constraintclassrec) ConstraintClassRec constraintClassRec = {
- { /******* CorePart *******/
- /* superclass */ (WidgetClass) &compositeClassRec,
- /* class_name */ "Constraint",
- /* widget_size */ sizeof(ConstraintRec),
- /* class_initialize */ NULL,
- /* class_part_initialize*/ ConstraintPartInitialize,
- /* class_inited */ FALSE,
- /* initialize */ NULL,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ NULL,
- /* num_resources */ 0,
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave */ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ NULL,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },{ /**** CompositePart *****/
- /* geometry_handler */ NULL,
- /* change_managed */ NULL,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{ /**** ConstraintPart ****/
- /* resources */ NULL,
- /* num_resources */ 0,
- /* constraint_size */ 0,
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ NULL,
- /* extension */ NULL
- }
-};
-
-externaldef(constraintwidgetclass) WidgetClass constraintWidgetClass =
- (WidgetClass) &constraintClassRec;
-
-
-static void ConstraintPartInitialize(wc)
- WidgetClass wc;
-{
- ConstraintWidgetClass cwc = (ConstraintWidgetClass)wc;
- if (cwc->constraint_class.resources)
- _XtCompileResourceList(cwc->constraint_class.resources,
- cwc->constraint_class.num_resources);
-
- _XtConstraintResDependencies((ConstraintWidgetClass)wc);
-}
diff --git a/xc/lib/Xt/Constraint.h b/xc/lib/Xt/Constraint.h
deleted file mode 100644
index 10e926ca0..000000000
--- a/xc/lib/Xt/Constraint.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $TOG: Constraint.h /main/11 1998/02/06 13:20:29 kaleb $ */
-/* $oHeader: Constraint.h,v 1.2 88/08/18 15:54:18 asente Exp $ */
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtConstraint_h
-#define _XtConstraint_h
-
-typedef struct _ConstraintClassRec *ConstraintWidgetClass;
-
-#ifndef CONSTRAINT
-externalref WidgetClass constraintWidgetClass;
-#endif
-
-#endif /* _XtConstraint_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/Convert.c b/xc/lib/Xt/Convert.c
deleted file mode 100644
index b2c0cbc07..000000000
--- a/xc/lib/Xt/Convert.c
+++ /dev/null
@@ -1,1168 +0,0 @@
-/* $TOG: Convert.c /main/77 1998/02/06 13:20:48 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Convert.c,v 3.4 1998/12/20 11:57:07 dawes Exp $ */
-
-/*
-
-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 "IntrinsicI.h"
-#include "StringDefs.h"
-#include "Intrinsic.h"
-
-/* Conversion procedure hash table */
-
-#define CONVERTHASHSIZE ((unsigned)256)
-#define CONVERTHASHMASK 255
-#define ProcHash(from_type, to_type) (2 * (from_type) + to_type)
-
-typedef struct _ConverterRec *ConverterPtr;
-typedef struct _ConverterRec {
- ConverterPtr next;
- XrmRepresentation from, to;
- XtTypeConverter converter;
- XtDestructor destructor;
- unsigned short num_args;
- unsigned int do_ref_count:1;
- unsigned int new_style:1;
- unsigned int global:1;
- char cache_type;
-} ConverterRec;
-
-#define ConvertArgs(p) ((XtConvertArgList)((p)+1))
-
-/* used for old-style type converter cache only */
-static Heap globalHeap = {NULL, NULL, 0};
-
-void _XtSetDefaultConverterTable(table)
- ConverterTable *table;
-{
- register ConverterTable globalConverterTable;
-
- LOCK_PROCESS;
- globalConverterTable = _XtGetProcessContext()->globalConverterTable;
-
- *table = (ConverterTable)
- __XtCalloc(CONVERTHASHSIZE, (unsigned)sizeof(ConverterPtr));
- _XtAddDefaultConverters(*table);
-
- if (globalConverterTable) {
- ConverterPtr rec;
- int i;
- XtCacheType cache_type;
- for (i = CONVERTHASHSIZE; --i >= 0; ) {
- for (rec = *globalConverterTable++; rec; rec = rec->next) {
- cache_type = rec->cache_type;
- if (rec->do_ref_count)
- cache_type |= XtCacheRefCount;
- _XtTableAddConverter(*table, rec->from, rec->to, rec->converter,
- ConvertArgs(rec), rec->num_args,
- rec->new_style, cache_type,
- rec->destructor, True);
- }
- }
- }
- UNLOCK_PROCESS;
-}
-
-void _XtFreeConverterTable(table)
- ConverterTable table;
-{
- register int i;
- register ConverterPtr p;
-
- for (i = 0; i < CONVERTHASHSIZE; i++) {
- for (p = table[i]; p; ) {
- register ConverterPtr next = p->next;
- XtFree((char*)p);
- p = next;
- }
- }
- XtFree((char*)table);
-}
-
-/* Data cache hash table */
-
-typedef struct _CacheRec *CachePtr;
-
-typedef struct _CacheRec {
- CachePtr next;
- XtPointer tag;
- int hash;
- XtTypeConverter converter;
- unsigned short num_args;
- unsigned int conversion_succeeded:1;
- unsigned int has_ext:1;
- unsigned int is_refcounted:1;
- unsigned int must_be_freed:1;
- unsigned int from_is_value:1;
- unsigned int to_is_value:1;
- XrmValue from;
- XrmValue to;
-} CacheRec;
-
-typedef struct _CacheRecExt {
- CachePtr *prev;
- XtDestructor destructor;
- XtPointer closure;
- long ref_count;
-} CacheRecExt;
-
-#define CEXT(p) ((CacheRecExt *)((p)+1))
-#define CARGS(p) ((p)->has_ext ? (XrmValue *)(CEXT(p)+1) : (XrmValue *)((p)+1))
-
-#define CACHEHASHSIZE 256
-#define CACHEHASHMASK 255
-typedef CachePtr CacheHashTable[CACHEHASHSIZE];
-
-static CacheHashTable cacheHashTable;
-
-#if NeedFunctionPrototypes
-void _XtTableAddConverter(
- ConverterTable table,
- XrmRepresentation from_type,
- XrmRepresentation to_type,
- XtTypeConverter converter,
- XtConvertArgList convert_args,
- Cardinal num_args,
- _XtBoolean new_style,
- XtCacheType cache_type,
- XtDestructor destructor,
- _XtBoolean global)
-#else
-void _XtTableAddConverter(table, from_type, to_type, converter, convert_args,
- num_args, new_style, cache_type, destructor, global)
- ConverterTable table;
- XrmRepresentation from_type, to_type;
- XtTypeConverter converter;
- XtConvertArgList convert_args;
- Cardinal num_args;
- Boolean new_style;
- XtCacheType cache_type;
- XtDestructor destructor;
- Boolean global;
-#endif
-{
- register ConverterPtr *pp;
- register ConverterPtr p;
- XtConvertArgList args;
-
- pp= &table[ProcHash(from_type, to_type) & CONVERTHASHMASK];
- while ((p = *pp) && (p->from != from_type || p->to != to_type))
- pp = &p->next;
-
- if (p) {
- *pp = p->next;
- XtFree((char *)p);
- }
-
- p = (ConverterPtr) __XtMalloc(sizeof(ConverterRec) +
- sizeof(XtConvertArgRec) * num_args);
- p->next = *pp;
- *pp = p;
- p->from = from_type;
- p->to = to_type;
- p->converter = converter;
- p->destructor = destructor;
- p->num_args = num_args;
- p->global = global;
- args = ConvertArgs(p);
- while (num_args--)
- *args++ = *convert_args++;
- p->new_style = new_style;
- p->do_ref_count = False;
- if (destructor || (cache_type & 0xff)) {
- p->cache_type = cache_type & 0xff;
- if (cache_type & XtCacheRefCount)
- p->do_ref_count = True;
- } else {
- p->cache_type = XtCacheNone;
- }
-}
-
-#if NeedFunctionPrototypes
-void XtSetTypeConverter(
- register _Xconst char* from_type,
- register _Xconst char* to_type,
- XtTypeConverter converter,
- XtConvertArgList convert_args,
- Cardinal num_args,
- XtCacheType cache_type,
- XtDestructor destructor
- )
-#else
-void XtSetTypeConverter(from_type, to_type, converter, convert_args, num_args, cache_type, destructor)
- register String from_type, to_type;
- XtTypeConverter converter;
- XtConvertArgList convert_args;
- Cardinal num_args;
- XtCacheType cache_type;
- XtDestructor destructor;
-#endif
-{
- ProcessContext process;
- XtAppContext app;
- XrmRepresentation from;
- XrmRepresentation to;
-
- LOCK_PROCESS;
- process = _XtGetProcessContext();
- app = process->appContextList;
- from = XrmStringToRepresentation(from_type);
- to = XrmStringToRepresentation(to_type);
-
- if (!process->globalConverterTable) {
- process->globalConverterTable = (ConverterTable)
- __XtCalloc(CONVERTHASHSIZE, (unsigned)sizeof(ConverterPtr));
- }
- _XtTableAddConverter(process->globalConverterTable, from, to,
- converter, convert_args,
- num_args, True, cache_type, destructor, True);
- while (app) {
- _XtTableAddConverter(app->converterTable, from, to,
- converter, convert_args,
- num_args, True, cache_type, destructor, True);
- app = app->next;
- }
- UNLOCK_PROCESS;
-}
-
-#if NeedFunctionPrototypes
-void XtAppSetTypeConverter(
- XtAppContext app,
- register _Xconst char* from_type,
- register _Xconst char* to_type,
- XtTypeConverter converter,
- XtConvertArgList convert_args,
- Cardinal num_args,
- XtCacheType cache_type,
- XtDestructor destructor
- )
-#else
-void XtAppSetTypeConverter(app, from_type, to_type, converter, convert_args, num_args, cache_type, destructor)
- XtAppContext app;
- register String from_type, to_type;
- XtTypeConverter converter;
- XtConvertArgList convert_args;
- Cardinal num_args;
- XtCacheType cache_type;
- XtDestructor destructor;
-#endif
-{
- LOCK_PROCESS;
- _XtTableAddConverter(app->converterTable,
- XrmStringToRepresentation(from_type),
- XrmStringToRepresentation(to_type),
- converter, convert_args, num_args,
- True, cache_type, destructor, False);
- UNLOCK_PROCESS;
-}
-
-/* old interface */
-#if NeedFunctionPrototypes
-void XtAddConverter(
- register _Xconst char* from_type,
- register _Xconst char* to_type,
- XtConverter converter,
- XtConvertArgList convert_args,
- Cardinal num_args
- )
-#else
-void XtAddConverter(from_type, to_type, converter, convert_args, num_args)
- register String from_type, to_type;
- XtConverter converter;
- XtConvertArgList convert_args;
- Cardinal num_args;
-#endif
-{
- ProcessContext process;
- XtAppContext app;
- XrmRepresentation from;
- XrmRepresentation to;
-
- LOCK_PROCESS;
- process = _XtGetProcessContext();
- app = process->appContextList;
- from = XrmStringToRepresentation(from_type);
- to = XrmStringToRepresentation(to_type);
-
- if (!process->globalConverterTable) {
- process->globalConverterTable = (ConverterTable)
- __XtCalloc(CONVERTHASHSIZE, (unsigned)sizeof(ConverterPtr));
- }
- _XtTableAddConverter(process->globalConverterTable, from, to,
- (XtTypeConverter)converter, convert_args, num_args,
- False, XtCacheAll, (XtDestructor)NULL, True);
- while (app) {
- _XtTableAddConverter(app->converterTable, from, to,
- (XtTypeConverter)converter, convert_args,
- num_args, False, XtCacheAll, (XtDestructor)NULL,
- True);
- app = app->next;
- }
- UNLOCK_PROCESS;
-}
-
-/* old interface */
-#if NeedFunctionPrototypes
-void XtAppAddConverter(
- XtAppContext app,
- register _Xconst char* from_type,
- register _Xconst char* to_type,
- XtConverter converter,
- XtConvertArgList convert_args,
- Cardinal num_args
- )
-#else
-void XtAppAddConverter(app, from_type, to_type, converter, convert_args, num_args)
- XtAppContext app;
- register String from_type, to_type;
- XtConverter converter;
- XtConvertArgList convert_args;
- Cardinal num_args;
-#endif
-{
- LOCK_PROCESS;
- _XtTableAddConverter(app->converterTable,
- XrmStringToRepresentation(from_type),
- XrmStringToRepresentation(to_type),
- (XtTypeConverter)converter, convert_args, num_args,
- False, XtCacheAll, (XtDestructor)NULL, False);
- UNLOCK_PROCESS;
-}
-
-static CachePtr
-CacheEnter(heap, converter, args, num_args, from, to, succeeded, hash,
- do_ref, do_free, destructor, closure)
- Heap* heap;
- register XtTypeConverter converter;
- register XrmValuePtr args;
- Cardinal num_args;
- XrmValuePtr from;
- XrmValuePtr to;
- Boolean succeeded;
- register int hash;
- Boolean do_ref;
- Boolean do_free;
- XtDestructor destructor;
- XtPointer closure;
-{
- register CachePtr *pHashEntry;
- register CachePtr p;
- register Cardinal i;
-
- LOCK_PROCESS;
- pHashEntry = &cacheHashTable[hash & CACHEHASHMASK];
-
- if ((succeeded && destructor) || do_ref) {
- p = (CachePtr) _XtHeapAlloc(heap, (sizeof(CacheRec) +
- sizeof(CacheRecExt) +
- num_args * sizeof(XrmValue)));
- CEXT(p)->prev = pHashEntry;
- CEXT(p)->destructor = succeeded ? destructor : NULL;
- CEXT(p)->closure = closure;
- CEXT(p)->ref_count = 1;
- p->has_ext = True;
- }
- else {
- p = (CachePtr)_XtHeapAlloc(heap, (sizeof(CacheRec) +
- num_args * sizeof(XrmValue)));
- p->has_ext = False;
- }
- if (!to->addr)
- succeeded = False;
- p->conversion_succeeded = succeeded;
- p->is_refcounted = do_ref;
- p->must_be_freed = do_free;
- p->next = *pHashEntry;
- if (p->next && p->next->has_ext)
- CEXT(p->next)->prev = &p->next;
-
- *pHashEntry = p;
- p->tag = (XtPointer)heap;
- p->hash = hash;
- p->converter = converter;
- p->from.size = from->size;
- if (from->size <= sizeof(p->from.addr)) {
- p->from_is_value = True;
- XtMemmove(&p->from.addr, from->addr, from->size);
- } else {
- p->from_is_value = False;
- p->from.addr = (XPointer)_XtHeapAlloc(heap, from->size);
- (void) memmove((char *)p->from.addr, (char *)from->addr, from->size);
- }
- p->num_args = num_args;
- if (num_args) {
- XrmValue *pargs = CARGS(p);
- for (i = 0; i < num_args; i++) {
- pargs[i].size = args[i].size;
- pargs[i].addr = (XPointer)_XtHeapAlloc(heap, args[i].size);
- XtMemmove(pargs[i].addr, args[i].addr, args[i].size);
- }
- }
- p->to.size = to->size;
- if (!succeeded) {
- p->to_is_value = False;
- p->to.addr = NULL;
- } else if (to->size <= sizeof(p->to.addr)) {
- p->to_is_value = True;
- XtMemmove(&p->to.addr, to->addr, to->size);
- } else {
- p->to_is_value = False;
- p->to.addr = (XPointer)_XtHeapAlloc(heap, to->size);
- (void) memmove((char *)p->to.addr, (char *)to->addr, to->size);
- }
- UNLOCK_PROCESS;
- return p;
-}
-
-static void FreeCacheRec(app, p, prev)
- XtAppContext app;
- CachePtr p;
- CachePtr *prev;
-{
- LOCK_PROCESS;
- if (p->has_ext) {
- if (CEXT(p)->destructor) {
- Cardinal num_args = p->num_args;
- XrmValue *args = NULL;
- XrmValue toc;
- if (num_args)
- args = CARGS(p);
- toc.size = p->to.size;
- if (p->to_is_value)
- toc.addr = (XPointer)&p->to.addr;
- else
- toc.addr = p->to.addr;
- (*CEXT(p)->destructor) (app, &toc, CEXT(p)->closure, args,
- &num_args);
- }
- *(CEXT(p)->prev) = p->next;
- if (p->next && p->next->has_ext)
- CEXT(p->next)->prev = CEXT(p)->prev;
- } else {
- *prev = p->next;
- if (p->next && p->next->has_ext)
- CEXT(p->next)->prev = prev;
- }
- if (p->must_be_freed) {
- register int i;
- if (!p->from_is_value)
- XtFree(p->from.addr);
- if (i = p->num_args) {
- XrmValue *pargs = CARGS(p);
- while (i--)
- XtFree(pargs[i].addr);
- }
- if (!p->to_is_value)
- XtFree(p->to.addr);
- XtFree((char*)p);
- }
- /* else on private heap; will free entire heap later */
- UNLOCK_PROCESS;
-}
-
-
-void _XtCacheFlushTag(app, tag)
- XtAppContext app;
- XtPointer tag;
-{
- int i;
- register CachePtr *prev;
- register CachePtr rec;
-
- LOCK_PROCESS;
- for (i = CACHEHASHSIZE; --i >= 0;) {
- prev = &cacheHashTable[i];
- while (rec = *prev) {
- if (rec->tag == tag)
- FreeCacheRec(app, rec, prev);
- else
- prev = &rec->next;
- }
- }
- UNLOCK_PROCESS;
-}
-
-#ifdef DEBUG
-#include <stdio.h>
-
-void _XtConverterCacheStats()
-{
- register Cardinal i;
- register CachePtr p;
- register Cardinal entries;
-
- LOCK_PROCESS;
- for (i = 0; i < CACHEHASHSIZE; i++) {
- p = cacheHashTable[i];
- if (p) {
- for (entries = 0; p; p = p->next) {
- entries++;
- }
- (void) fprintf(stdout, "Index: %4d Entries: %d\n", i, entries);
- for (p = cacheHashTable[i]; p; p = p->next) {
- (void) fprintf(stdout, " Size: %3d Refs: %3d '",
- p->from.size,
- p->has_ext ? CEXT(p)->ref_count : 0);
- (void) fprintf(stdout, "'\n");
- }
- (void) fprintf(stdout, "\n");
- }
- }
- UNLOCK_PROCESS;
-}
-#endif /*DEBUG*/
-
-static Boolean ResourceQuarkToOffset(widget_class, name, offset)
- WidgetClass widget_class;
- XrmName name;
- Cardinal *offset;
-{
- register WidgetClass wc;
- register Cardinal i;
- register XrmResourceList res, *resources;
-
- for (wc = widget_class; wc; wc = wc->core_class.superclass) {
- resources = (XrmResourceList*) wc->core_class.resources;
- for (i = 0; i < wc->core_class.num_resources; i++, resources++) {
- res = *resources;
- if (res->xrm_name == name) {
- *offset = -res->xrm_offset - 1;
- return True;
- }
- } /* for i in resources */
- } /* for wc in widget classes */
- (*offset) = 0;
- return False;
-}
-
-
-static void ComputeArgs(widget, convert_args, num_args, args)
- Widget widget;
- XtConvertArgList convert_args;
- Cardinal num_args;
- XrmValuePtr args;
-{
- register Cardinal i;
- Cardinal offset;
- String params[1];
- Cardinal num_params = 1;
- Widget ancestor = NULL;
-
- for (i = 0; i < num_args; i++) {
- args[i].size = convert_args[i].size;
- switch (convert_args[i].address_mode) {
- case XtAddress:
- args[i].addr = convert_args[i].address_id;
- break;
-
- case XtBaseOffset:
-#if defined(CRAY1) && !defined(__STDC__)
- args[i].addr =
- (XPointer)((int)widget + (int)convert_args[i].address_id);
-#else
- args[i].addr =
- (XPointer)((char *)widget + (long)convert_args[i].address_id);
-#endif
- break;
-
- case XtWidgetBaseOffset:
- if (!ancestor) {
- if (XtIsWidget(widget))
- ancestor = widget;
- else
- ancestor = _XtWindowedAncestor(widget);
- }
-
-#if defined(CRAY1) && !defined(__STDC__)
- args[i].addr =
- (XPointer)((int)ancestor + (int)convert_args[i].address_id);
-#else
- args[i].addr =
- (XPointer)((char *)ancestor + (long)convert_args[i].address_id);
-#endif
- break;
-
- case XtImmediate:
- args[i].addr = (XPointer) &(convert_args[i].address_id);
- break;
-
- case XtProcedureArg:
- (*(XtConvertArgProc)convert_args[i].address_id)
- (widget, &convert_args[i].size, &args[i]);
- break;
-
- case XtResourceString:
- /* Convert in place for next usage */
- convert_args[i].address_mode = XtResourceQuark;
- convert_args[i].address_id =
- (XtPointer)(long)XrmStringToQuark((String)convert_args[i].address_id);
- /* Fall through */
-
- case XtResourceQuark:
- if (! ResourceQuarkToOffset(widget->core.widget_class,
- (XrmQuark)(long) convert_args[i].address_id, &offset)) {
- params[0]=
- XrmQuarkToString((XrmQuark)(long) convert_args[i].address_id);
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidResourceName","computeArgs",XtCXtToolkitError,
- "Cannot find resource name %s as argument to conversion",
- params,&num_params);
- offset = 0;
- }
-#if defined(CRAY1) && !defined(__STDC__)
- args[i].addr = (XPointer)((int)widget + offset);
-#else
- args[i].addr = (XPointer)((char *)widget + offset);
-#endif
- break;
- default:
- params[0] = XtName(widget);
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidAddressMode", "computeArgs", XtCXtToolkitError,
- "Conversion arguments for widget '%s' contain an unsupported address mode",
- params,&num_params);
- args[i].addr = NULL;
- args[i].size = 0;
- } /* switch */
- } /* for */
-} /* ComputeArgs */
-
-void XtDirectConvert(converter, args, num_args, from, to)
- XtConverter converter;
- XrmValuePtr args;
- Cardinal num_args;
- register XrmValuePtr from;
- XrmValuePtr to;
-{
- register CachePtr p;
- register int hash;
- register Cardinal i;
-
- LOCK_PROCESS;
- /* Try to find cache entry for conversion */
- hash = ((long) converter >> 2) + from->size + *((char *) from->addr);
- if (from->size > 1) hash += ((char *) from->addr)[1];
-
- for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next) {
- if ((p->hash == hash)
- && (p->converter == (XtTypeConverter)converter)
- && (p->from.size == from->size)
- && !(p->from_is_value ?
- XtMemcmp(&p->from.addr, from->addr, from->size) :
- memcmp((char *)p->from.addr, (char *)from->addr, from->size))
- && (p->num_args == num_args)) {
- if (i = num_args) {
- XrmValue *pargs = CARGS(p);
- /* Are all args the same data ? */
- while (i) {
- i--; /* do not move to while test, broken compilers */
- if (pargs[i].size != args[i].size ||
- XtMemcmp(pargs[i].addr, args[i].addr, args[i].size)) {
- i++;
- break;
- }
- }
- }
- if (!i) {
- /* Perfect match */
- to->size = p->to.size;
- if (p->to_is_value)
- to->addr = (XPointer)&p->to.addr;
- else
- to->addr = p->to.addr;
- UNLOCK_PROCESS;
- return;
- }
- }
- }
-
- /* Didn't find it, call converter procedure and entry result in cache */
- (*to).size = 0;
- (*to).addr = NULL;
- (*converter)(args, &num_args, from, to);
- /* This memory can never be freed since we don't know the Display
- * or app context from which to compute the persistance */
- {
- CacheEnter(&globalHeap, (XtTypeConverter)converter, args, num_args,
- from, to, (to->addr != NULL), hash, False, False,
- (XtDestructor)NULL, NULL);
- }
- UNLOCK_PROCESS;
-}
-
-
-static ConverterPtr GetConverterEntry( app, converter )
- XtAppContext app;
- XtTypeConverter converter;
-{
- int entry;
- register ConverterPtr cP;
- ConverterTable converterTable;
-
- LOCK_PROCESS;
- converterTable = app->converterTable;
- cP = NULL;
- for (entry = 0; (entry < CONVERTHASHSIZE) && !cP; entry++) {
- cP = converterTable[entry];
- while (cP && (cP->converter != converter)) cP = cP->next;
- }
- UNLOCK_PROCESS;
- return cP;
-}
-
-
-static Boolean
-CallConverter(dpy, converter,
- args, num_args, from, to, cache_ref_return, cP)
- Display* dpy;
- XtTypeConverter converter;
- XrmValuePtr args;
- Cardinal num_args;
- register XrmValuePtr from;
- XrmValuePtr to;
- XtCacheRef *cache_ref_return;
- register ConverterPtr cP;
-{
- CachePtr p;
- int hash;
- Cardinal i;
- Boolean retval;
-
- if (!cP || ((cP->cache_type == XtCacheNone) && !cP->destructor)) {
- XtPointer closure;
- if (cache_ref_return) *cache_ref_return = NULL;
- retval = (*(XtTypeConverter)converter)
- (dpy, args, &num_args, from, to, &closure);
- return retval;
- }
-
- LOCK_PROCESS;
- /* Try to find cache entry for conversion */
- hash = ((long)(converter) >> 2) + from->size + *((char *) from->addr);
- if (from->size > 1) hash += ((char *) from->addr)[1];
-
- if (cP->cache_type != XtCacheNone) {
- for (p = cacheHashTable[hash & CACHEHASHMASK]; p; p = p->next){
- if ((p->hash == hash)
- && (p->converter == converter)
- && (p->from.size == from->size)
- && !(p->from_is_value ?
- XtMemcmp(&p->from.addr, from->addr, from->size) :
- memcmp((char *)p->from.addr, (char *)from->addr, from->size))
- && (p->num_args == num_args)) {
- if (i = num_args) {
- XrmValue *pargs = CARGS(p);
- /* Are all args the same data ? */
- while (i) {
- i--; /* do not move to while test, broken compilers */
- if (pargs[i].size != args[i].size ||
- XtMemcmp(pargs[i].addr, args[i].addr, args[i].size)){
- i++;
- break;
- }
- }
- }
- if (!i) {
- /* Perfect match */
- if (p->conversion_succeeded) {
- if (to->addr) { /* new-style call */
- if (to->size < p->to.size) {
- to->size = p->to.size;
- UNLOCK_PROCESS;
- return False;
- }
- to->size = p->to.size;
- if (p->to_is_value) {
- XtMemmove(to->addr, &p->to.addr,
- to->size);
- } else {
- (void) memmove((char *)to->addr,
- (char *)p->to.addr, to->size);
- }
- } else { /* old-style call */
- to->size = p->to.size;
- if (p->to_is_value)
- to->addr = (XPointer)&p->to.addr;
- else
- to->addr = p->to.addr;
- }
- }
- if (p->is_refcounted) {
- CEXT(p)->ref_count++;
- if (cache_ref_return)
- *cache_ref_return = (XtCacheRef)p;
- else
- p->is_refcounted = False;
- }
- else {
- if (cache_ref_return)
- *cache_ref_return = NULL;
- }
- retval = (p->conversion_succeeded);
- UNLOCK_PROCESS;
- return retval;
- }
- }
- }
- }
-
- /* No cache entry, call converter procedure and enter result in cache */
- {
- Heap *heap;
- XtPointer closure = NULL;
- unsigned int supplied_size = to->size;
- Boolean do_ref = cP->do_ref_count && cache_ref_return;
- Boolean do_free = False;
- Boolean retval =
- (*(XtTypeConverter)converter)(dpy, args, &num_args, from, to, &closure);
-
- if (retval == False && supplied_size < to->size) {
- /* programmer error: caller must allocate sufficient storage */
- if (cache_ref_return)
- *cache_ref_return = NULL;
- UNLOCK_PROCESS;
- return False;
- }
-
- if ((cP->cache_type == XtCacheNone) || do_ref) {
- heap = NULL;
- do_free = True;
- }
- else if (cP->cache_type == XtCacheByDisplay)
- heap = &_XtGetPerDisplay(dpy)->heap;
- else if (cP->global)
- heap = &globalHeap;
- else
- heap = &XtDisplayToApplicationContext(dpy)->heap;
-
- p = CacheEnter(heap, converter, args, num_args, from, to, retval,
- hash, do_ref, do_free, cP->destructor, closure);
- if (do_ref)
- *cache_ref_return = (XtCacheRef)p;
- else if (cache_ref_return)
- *cache_ref_return = NULL;
- UNLOCK_PROCESS;
- return retval;
- }
-}
-
-Boolean
-XtCallConverter(dpy, converter, args, num_args, from, to, cache_ref_return)
- Display* dpy;
- XtTypeConverter converter;
- XrmValuePtr args;
- Cardinal num_args;
- register XrmValuePtr from;
- XrmValuePtr to;
- XtCacheRef *cache_ref_return;
-{
- ConverterPtr cP;
- Boolean retval;
- XtAppContext app = XtDisplayToApplicationContext(dpy);
-
- LOCK_APP(app);
- if ((cP = GetConverterEntry(app, converter)) == NULL) {
- XtAppSetTypeConverter(XtDisplayToApplicationContext(dpy),
- "_XtUnk1", "_XtUnk2",
- converter, NULL, 0,
- XtCacheAll, NULL);
- cP = GetConverterEntry(app, converter);
- }
- retval = CallConverter(dpy, converter, args, num_args, from, to,
- cache_ref_return, cP);
- UNLOCK_APP(app);
- return retval;
-}
-
-Boolean _XtConvert(widget, from_type, from, to_type, to, cache_ref_return)
- Widget widget;
- register XrmRepresentation from_type;
- XrmValuePtr from;
- register XrmRepresentation to_type;
- register XrmValuePtr to;
- XtCacheRef *cache_ref_return;
-{
- XtAppContext app = XtWidgetToApplicationContext(widget);
- register ConverterPtr p;
- Cardinal num_args;
- XrmValue *args;
-
- /* Look for type converter */
- LOCK_PROCESS;
- p = app->converterTable[ProcHash(from_type, to_type) & CONVERTHASHMASK];
- for (; p; p = p->next) {
- if (from_type == p->from && to_type == p->to) {
- Boolean retval = False;
- /* Compute actual arguments from widget and arg descriptor */
- num_args = p->num_args;
- if (num_args != 0) {
- args = (XrmValue*)
- ALLOCATE_LOCAL( num_args * sizeof (XrmValue) );
- if (!args) _XtAllocError("alloca");
- ComputeArgs(widget, ConvertArgs(p), num_args, args);
- } else args = NULL;
- if (p->new_style) {
- retval =
- CallConverter(XtDisplayOfObject(widget),
- p->converter, args, num_args,
- from, to, cache_ref_return, p);
- }
- else { /* is old-style (non-display) converter */
- XrmValue tempTo;
- XtDirectConvert((XtConverter)p->converter, args, num_args,
- from, &tempTo);
- if (cache_ref_return)
- *cache_ref_return = NULL;
- if (tempTo.addr) {
- if (to->addr) { /* new-style caller */
- if (to->size >= tempTo.size) {
- if (to_type == _XtQString)
- *(String*)(to->addr) = tempTo.addr;
- else {
- XtMemmove(to->addr, tempTo.addr,
- tempTo.size);
- }
- retval = True;
- }
- to->size = tempTo.size;
- } else { /* old-style caller */
- *to = tempTo;
- retval = True;
- }
- }
- }
- if (args) DEALLOCATE_LOCAL( (XtPointer)args );
- UNLOCK_PROCESS;
- return retval;
- }
- }
-
- {
- String params[2];
- Cardinal num_params = 2;
- params[0] = XrmRepresentationToString(from_type);
- params[1] = XrmRepresentationToString(to_type);
- XtAppWarningMsg(app, "typeConversionError", "noConverter", XtCXtToolkitError,
- "No type converter registered for '%s' to '%s' conversion.",
- params, &num_params);
- }
- UNLOCK_PROCESS;
- return False;
-}
-
-#if NeedFunctionPrototypes
-void XtConvert(
- Widget widget,
- _Xconst char* from_type_str,
- XrmValuePtr from,
- _Xconst char* to_type_str,
- XrmValuePtr to
- )
-#else
-void XtConvert(widget, from_type_str, from, to_type_str, to)
- Widget widget;
- String from_type_str;
- XrmValuePtr from;
- String to_type_str;
- XrmValuePtr to;
-#endif
-{
- XrmQuark from_type, to_type;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- from_type = XrmStringToRepresentation(from_type_str);
- to_type = XrmStringToRepresentation(to_type_str);
- if (from_type != to_type) {
- /* It's not safe to ref count these resources, 'cause we
- don't know what older clients may have assumed about
- the resource lifetimes.
- XtCacheRef ref;
- */
- to->addr = NULL;
- to->size = 0;
- _XtConvert(widget, from_type, from, to_type, to, /*&ref*/ NULL);
- /*
- if (ref) {
- XtAddCallback( widget, XtNdestroyCallback,
- XtCallbackReleaseCacheRef, (XtPointer)ref );
- }
- */
- }
- else
- (*to) = *from;
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-Boolean XtConvertAndStore(
- Widget object,
- _Xconst char* from_type_str,
- XrmValuePtr from,
- _Xconst char* to_type_str,
- XrmValuePtr to
- )
-#else
-Boolean XtConvertAndStore(object, from_type_str, from, to_type_str, to)
- Widget object;
- String from_type_str;
- XrmValuePtr from;
- String to_type_str;
- XrmValuePtr to;
-#endif
-{
- XrmQuark from_type, to_type;
- WIDGET_TO_APPCON(object);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- from_type = XrmStringToRepresentation(from_type_str);
- to_type = XrmStringToRepresentation(to_type_str);
- if (from_type != to_type) {
- static XtPointer local_valueP = NULL;
- static Cardinal local_valueS = 128;
- XtCacheRef ref;
- Boolean local = False;
- do {
- if (!to->addr) {
- if (!local_valueP)
- local_valueP = _XtHeapAlloc(&globalHeap, local_valueS);
- to->addr = local_valueP;
- to->size = local_valueS;
- local = True;
- }
- if (!_XtConvert(object, from_type, from, to_type, to, &ref)) {
- if (local && (to->size > local_valueS)) {
- to->addr =
- local_valueP = _XtHeapAlloc(&globalHeap, to->size);
- local_valueS = to->size;
- continue;
- } else {
- if (local) {
- to->addr = NULL;
- to->size = 0;
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return False;
- }
- }
- if (ref) {
- XtAddCallback( object, XtNdestroyCallback,
- XtCallbackReleaseCacheRef, (XtPointer)ref );
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return True;
- } while (local /* && local_valueS < to->size */);
- }
- if (to->addr) {
- if (to->size < from->size) {
- to->size = from->size;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return False;
- }
- (void) memmove(to->addr, from->addr, from->size );
- to->size = from->size;
- } else /* from_type == to_type */
- *to = *from;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return True;
-}
-
-void XtAppReleaseCacheRefs(app, refs)
- XtAppContext app;
- XtCacheRef *refs;
-{
- register CachePtr *r;
- register CachePtr p;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- for (r = (CachePtr*)refs; p = *r; r++) {
- if (p->is_refcounted && --(CEXT(p)->ref_count) == 0) {
- FreeCacheRec(app, p, NULL);
- }
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-
-/* ARGSUSED */
-void XtCallbackReleaseCacheRefList(widget, closure, call_data)
- Widget widget; /* unused */
- XtPointer closure;
- XtPointer call_data; /* unused */
-{
- XtAppReleaseCacheRefs( XtWidgetToApplicationContext(widget),
- (XtCacheRef*)closure );
- XtFree(closure);
-}
-
-
-/* ARGSUSED */
-void XtCallbackReleaseCacheRef(widget, closure, call_data)
- Widget widget; /* unused */
- XtPointer closure;
- XtPointer call_data; /* unused */
-{
- XtCacheRef cache_refs[2];
- cache_refs[0] = (XtCacheRef)closure;
- cache_refs[1] = NULL;
- XtAppReleaseCacheRefs( XtWidgetToApplicationContext(widget), cache_refs );
-}
diff --git a/xc/lib/Xt/ConvertI.h b/xc/lib/Xt/ConvertI.h
deleted file mode 100644
index 2a6ddb2a5..000000000
--- a/xc/lib/Xt/ConvertI.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $TOG: ConvertI.h /main/18 1998/02/06 13:20:44 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-/* Representation types */
-
-extern XrmQuark _XtQString;
-
-/*
- * Resource conversions
- */
-
-typedef struct _ConverterRec **ConverterTable;
-
-extern void _XtAddDefaultConverters(
-#if NeedFunctionPrototypes
- ConverterTable /* table */
-#endif
-);
-
-extern void _XtSetDefaultConverterTable(
-#if NeedFunctionPrototypes
- ConverterTable* /* table */
-#endif
-);
-
-extern void _XtFreeConverterTable(
-#if NeedFunctionPrototypes
- ConverterTable /* table */
-#endif
-);
-
-extern void _XtTableAddConverter(
-#if NeedFunctionPrototypes
- ConverterTable /* table */,
- XrmRepresentation /* from_type */,
- XrmRepresentation /* to_type */,
- XtTypeConverter /* converter */,
- XtConvertArgList /* convert_args */,
- Cardinal /* num_args */,
- _XtBoolean /* new_style */,
- XtCacheType /* cache_type */,
- XtDestructor /* destructor */,
- _XtBoolean /* global */
-#endif
-);
-
-extern Boolean _XtConvert(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XrmRepresentation /* from_type */,
- XrmValuePtr /* from */,
- XrmRepresentation /* to_type */,
- XrmValuePtr /* to */,
- XtCacheRef* /* cache_ref_return */
-#endif
-);
-
diff --git a/xc/lib/Xt/Converters.c b/xc/lib/Xt/Converters.c
deleted file mode 100644
index b4c70233d..000000000
--- a/xc/lib/Xt/Converters.c
+++ /dev/null
@@ -1,1883 +0,0 @@
-/* $TOG: Converters.c /main/107 1998/02/06 13:20:35 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Converters.c,v 3.7 1999/03/28 15:31:34 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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.
-
-*/
-
-/*LINTLIBRARY*/
-/* Conversion.c - implementations of resource type conversion procs */
-
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-#include "Shell.h"
-#include <stdio.h>
-#include <X11/cursorfont.h>
-#include <X11/keysym.h>
-#include <X11/Xlocale.h>
-#include <errno.h> /* for StringToDirectoryString */
-
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-#ifdef __EMX__
-#define IsNewline(str) ((str) == '\n' || (str) == '\r')
-#define IsWhitespace(str) ((str)== ' ' || (str) == '\t' || (str) == '\r')
-#else
-#define IsNewline(str) ((str) == '\n')
-#define IsWhitespace(str) ((str)== ' ' || (str) == '\t')
-#endif
-
-static Const String XtNwrongParameters = "wrongParameters";
-static Const String XtNconversionError = "conversionError";
-static Const String XtNmissingCharsetList = "missingCharsetList";
-
-/* Representation types */
-
-#define XtQAtom XrmPermStringToQuark(XtRAtom)
-#define XtQCommandArgArray XrmPermStringToQuark(XtRCommandArgArray)
-#define XtQCursor XrmPermStringToQuark(XtRCursor)
-#define XtQDirectoryString XrmPermStringToQuark(XtRDirectoryString)
-#define XtQDisplay XrmPermStringToQuark(XtRDisplay)
-#define XtQFile XrmPermStringToQuark(XtRFile)
-#define XtQFloat XrmPermStringToQuark(XtRFloat)
-#define XtQInitialState XrmPermStringToQuark(XtRInitialState)
-#define XtQPixmap XrmPermStringToQuark(XtRPixmap)
-#define XtQRestartStyle XrmPermStringToQuark(XtRRestartStyle)
-#define XtQShort XrmPermStringToQuark(XtRShort)
-#define XtQUnsignedChar XrmPermStringToQuark(XtRUnsignedChar)
-#define XtQVisual XrmPermStringToQuark(XtRVisual)
-
-static XrmQuark XtQBool;
-static XrmQuark XtQBoolean;
-static XrmQuark XtQColor;
-static XrmQuark XtQDimension;
-static XrmQuark XtQFont;
-static XrmQuark XtQFontSet;
-static XrmQuark XtQFontStruct;
-static XrmQuark XtQGravity;
-static XrmQuark XtQInt;
-static XrmQuark XtQPixel;
-static XrmQuark XtQPosition;
-#ifdef __EMX__
-XrmQuark _XtQString = 0;
-#else
-XrmQuark _XtQString;
-#endif
-
-void _XtConvertInitialize()
-{
- XtQBool = XrmPermStringToQuark(XtRBool);
- XtQBoolean = XrmPermStringToQuark(XtRBoolean);
- XtQColor = XrmPermStringToQuark(XtRColor);
- XtQDimension = XrmPermStringToQuark(XtRDimension);
- XtQFont = XrmPermStringToQuark(XtRFont);
- XtQFontSet = XrmPermStringToQuark(XtRFontSet);
- XtQFontStruct = XrmPermStringToQuark(XtRFontStruct);
- XtQGravity = XrmPermStringToQuark(XtRGravity);
- XtQInt = XrmPermStringToQuark(XtRInt);
- XtQPixel = XrmPermStringToQuark(XtRPixel);
- XtQPosition = XrmPermStringToQuark(XtRPosition);
- _XtQString = XrmPermStringToQuark(XtRString);
-}
-
-#define donestr(type, value, tstr) \
- { \
- if (toVal->addr != NULL) { \
- if (toVal->size < sizeof(type)) { \
- toVal->size = sizeof(type); \
- XtDisplayStringConversionWarning(dpy, \
- (char*) fromVal->addr, tstr); \
- return False; \
- } \
- *(type*)(toVal->addr) = (value); \
- } \
- else { \
- static type static_val; \
- static_val = (value); \
- toVal->addr = (XPointer)&static_val; \
- } \
- toVal->size = sizeof(type); \
- return True; \
- }
-
-#define done(type, value) \
- { \
- if (toVal->addr != NULL) { \
- if (toVal->size < sizeof(type)) { \
- toVal->size = sizeof(type); \
- return False; \
- } \
- *(type*)(toVal->addr) = (value); \
- } \
- else { \
- static type static_val; \
- static_val = (value); \
- toVal->addr = (XPointer)&static_val; \
- } \
- toVal->size = sizeof(type); \
- return True; \
- }
-
-#if NeedFunctionPrototypes
-void XtDisplayStringConversionWarning(
- Display* dpy,
- _Xconst char* from,
- _Xconst char* toType
- )
-#else
-void XtDisplayStringConversionWarning(dpy, from, toType)
- Display* dpy;
- String from, toType;
-#endif
-{
-#ifndef NO_MIT_HACKS
- /* Allow suppression of conversion warnings. %%% Not specified. */
-
- static enum {Check, Report, Ignore} report_it = Check;
- XtAppContext app = XtDisplayToApplicationContext(dpy);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- if (report_it == Check) {
- XrmDatabase rdb = XtDatabase(dpy);
- XrmName xrm_name[2];
- XrmClass xrm_class[2];
- XrmRepresentation rep_type;
- XrmValue value;
- xrm_name[0] = XrmPermStringToQuark( "stringConversionWarnings" );
- xrm_name[1] = 0;
- xrm_class[0] = XrmPermStringToQuark( "StringConversionWarnings" );
- xrm_class[1] = 0;
- if (XrmQGetResource( rdb, xrm_name, xrm_class,
- &rep_type, &value ))
- {
- if (rep_type == XtQBoolean)
- report_it = *(Boolean*)value.addr ? Report : Ignore;
- else if (rep_type == _XtQString) {
- XrmValue toVal;
- Boolean report;
- toVal.addr = (XPointer)&report;
- toVal.size = sizeof(Boolean);
- if (XtCallConverter(dpy, XtCvtStringToBoolean, (XrmValuePtr)NULL,
- (Cardinal)0, &value, &toVal,
- (XtCacheRef*)NULL))
- report_it = report ? Report : Ignore;
- }
- else report_it = Report;
- }
- else report_it = Report;
- }
-
- if (report_it == Report) {
-#endif /* ifndef NO_MIT_HACKS */
- String params[2];
- Cardinal num_params = 2;
- params[0] = (String)from;
- params[1] = (String)toType;
- XtAppWarningMsg(app,
- XtNconversionError,"string",XtCXtToolkitError,
- "Cannot convert string \"%s\" to type %s",
- params,&num_params);
-#ifndef NO_MIT_HACKS
- }
-#endif /* ifndef NO_MIT_HACKS */
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtStringConversionWarning(
- _Xconst char* from,
- _Xconst char* toType
- )
-#else
-void XtStringConversionWarning(from, toType)
- String from, toType;
-#endif
-{
- String params[2];
- Cardinal num_params = 2;
- params[0] = (String)from;
- params[1] = (String)toType;
- XtWarningMsg(XtNconversionError,"string",XtCXtToolkitError,
- "Cannot convert string \"%s\" to type %s",
- params,&num_params);
-}
-
-static int CompareISOLatin1();
-
-
-static Boolean IsInteger(string, value)
- String string;
- int *value;
-{
- Boolean foundDigit = False;
- Boolean isNegative = False;
- Boolean isPositive = False;
- int val = 0;
- char ch;
- /* skip leading whitespace */
-#ifndef __EMX__
- while ((ch = *string) == ' ' || ch == '\t') string++;
-#else
- while ((ch = *string) == ' ' || ch == '\t' || ch == '\r') string++;
-#endif
- while (ch = *string++) {
- if (ch >= '0' && ch <= '9') {
- val *= 10;
- val += ch - '0';
- foundDigit = True;
- continue;
- }
- if (IsWhitespace(ch)) {
- if (!foundDigit) return False;
- /* make sure only trailing whitespace */
- while (ch = *string++) {
- if (!IsWhitespace(ch))
- return False;
- }
- break;
- }
- if (ch == '-' && !foundDigit && !isNegative && !isPositive) {
- isNegative = True;
- continue;
- }
- if (ch == '+' && !foundDigit && !isNegative && !isPositive) {
- isPositive = True;
- continue;
- }
- return False;
- }
- if (ch == '\0') {
- if (isNegative)
- *value = -val;
- else
- *value = val;
- return True;
- }
- return False;
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtIntToBoolean(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToBoolean",XtCXtToolkitError,
- "Integer to Boolean conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- done(Boolean, (*(int *)fromVal->addr != 0));
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtIntToShort(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToShort",XtCXtToolkitError,
- "Integer to Short conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- done(short, (*(int *)fromVal->addr));
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtStringToBoolean(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String str = (String)fromVal->addr;
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToBoolean",XtCXtToolkitError,
- "String to Boolean conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- if ( (CompareISOLatin1(str, "true") == 0)
- || (CompareISOLatin1(str, "yes") == 0)
- || (CompareISOLatin1(str, "on") == 0)
- || (CompareISOLatin1(str, "1") == 0)) donestr( Boolean, True, XtRBoolean );
-
- if ( (CompareISOLatin1(str, "false") == 0)
- || (CompareISOLatin1(str, "no") == 0)
- || (CompareISOLatin1(str, "off") == 0)
- || (CompareISOLatin1(str, "0") == 0)) donestr( Boolean, False, XtRBoolean );
-
- XtDisplayStringConversionWarning(dpy, str, XtRBoolean);
- return False;
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtIntToBool(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToBool",XtCXtToolkitError,
- "Integer to Bool conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- done(Bool, (*(int *)fromVal->addr != 0));
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtStringToBool(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String str = (String)fromVal->addr;
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToBool",
- XtCXtToolkitError,
- "String to Bool conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- if ( (CompareISOLatin1(str, "true") == 0)
- || (CompareISOLatin1(str, "yes") == 0)
- || (CompareISOLatin1(str, "on") == 0)
- || (CompareISOLatin1(str, "1") == 0)) donestr( Bool, True, XtRBool );
-
- if ( (CompareISOLatin1(str, "false") == 0)
- || (CompareISOLatin1(str, "no") == 0)
- || (CompareISOLatin1(str, "off") == 0)
- || (CompareISOLatin1(str, "0") == 0)) donestr( Bool, False, XtRBool );
-
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRBool);
- return False;
-}
-
-XtConvertArgRec Const colorConvertArgs[] = {
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)},
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.colormap),
- sizeof(Colormap)}
-};
-
-
-/* ARGSUSED */
-Boolean XtCvtIntToColor(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- XColor c;
- Screen *screen;
- Colormap colormap;
-
- if (*num_args != 2) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntOrPixelToXColor",XtCXtToolkitError,
- "Pixel to color conversion needs screen and colormap arguments",
- (String *)NULL, (Cardinal *)NULL);
- return False;
- }
- screen = *((Screen **) args[0].addr);
- colormap = *((Colormap *) args[1].addr);
- c.pixel = *(int *)fromVal->addr;
-
- XQueryColor(DisplayOfScreen(screen), colormap, &c);
- done(XColor, c);
-}
-
-
-Boolean XtCvtStringToPixel(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String str = (String)fromVal->addr;
- XColor screenColor;
- XColor exactColor;
- Screen *screen;
- XtPerDisplay pd = _XtGetPerDisplay(dpy);
- Colormap colormap;
- Status status;
- String params[1];
- Cardinal num_params=1;
-
- if (*num_args != 2) {
- XtAppWarningMsg(pd->appContext, XtNwrongParameters, "cvtStringToPixel",
- XtCXtToolkitError,
- "String to pixel conversion needs screen and colormap arguments",
- (String *)NULL, (Cardinal *)NULL);
- return False;
- }
-
- screen = *((Screen **) args[0].addr);
- colormap = *((Colormap *) args[1].addr);
-
- if (CompareISOLatin1(str, XtDefaultBackground) == 0) {
- *closure_ret = False;
- if (pd->rv) donestr(Pixel, BlackPixelOfScreen(screen), XtRPixel)
- else donestr(Pixel, WhitePixelOfScreen(screen), XtRPixel);
- }
- if (CompareISOLatin1(str, XtDefaultForeground) == 0) {
- *closure_ret = False;
- if (pd->rv) donestr(Pixel, WhitePixelOfScreen(screen), XtRPixel)
- else donestr(Pixel, BlackPixelOfScreen(screen), XtRPixel);
- }
-
- status = XAllocNamedColor(DisplayOfScreen(screen), colormap,
- (char*)str, &screenColor, &exactColor);
- if (status == 0) {
- String msg, type;
- params[0] = str;
- /* Server returns a specific error code but Xlib discards it. Ugh */
- if (XLookupColor(DisplayOfScreen(screen), colormap, (char*)str,
- &exactColor, &screenColor)) {
- type = "noColormap";
- msg = "Cannot allocate colormap entry for \"%s\"";
- }
- else {
- type = "badValue";
- msg = "Color name \"%s\" is not defined";
- }
-
- XtAppWarningMsg(pd->appContext, type, "cvtStringToPixel",
- XtCXtToolkitError, msg, params, &num_params);
- *closure_ret = False;
- return False;
- } else {
- *closure_ret = (char*)True;
- donestr(Pixel, screenColor.pixel, XtRPixel);
- }
-}
-
-/* ARGSUSED */
-static void FreePixel(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure;
- XrmValuePtr args;
- Cardinal *num_args;
-{
- Screen *screen;
- Colormap colormap;
-
- if (*num_args != 2) {
- XtAppWarningMsg(app, XtNwrongParameters,"freePixel",XtCXtToolkitError,
- "Freeing a pixel requires screen and colormap arguments",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
-
- screen = *((Screen **) args[0].addr);
- colormap = *((Colormap *) args[1].addr);
-
- if (closure) {
- XFreeColors( DisplayOfScreen(screen), colormap,
- (unsigned long*)toVal->addr, 1, (unsigned long)0
- );
- }
-}
-
-
-/* no longer used by Xt, but it's in the spec */
-XtConvertArgRec Const screenConvertArg[] = {
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)}
-};
-
-/*ARGSUSED*/
-static void FetchDisplayArg(widget, size, value)
- Widget widget;
- Cardinal *size;
- XrmValue* value;
-{
- if (widget == NULL)
- XtErrorMsg("missingWidget", "fetchDisplayArg", XtCXtToolkitError,
- "FetchDisplayArg called without a widget to reference",
- (String*)NULL, (Cardinal*)NULL);
- /* can't return any useful Display and caller will de-ref NULL,
- so aborting is the only useful option */
-
- value->size = sizeof(Display*);
- value->addr = (XPointer)&DisplayOfScreen(XtScreenOfObject(widget));
-}
-
-static XtConvertArgRec Const displayConvertArg[] = {
- {XtProcedureArg, (XtPointer)FetchDisplayArg, 0},
-};
-
-/*ARGSUSED*/
-Boolean XtCvtStringToCursor(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
-
- XtPointer *closure_ret;
-{
- static Const struct _CursorName {
- Const char *name;
- unsigned int shape;
- } cursor_names[] = {
- {"X_cursor", XC_X_cursor},
- {"arrow", XC_arrow},
- {"based_arrow_down", XC_based_arrow_down},
- {"based_arrow_up", XC_based_arrow_up},
- {"boat", XC_boat},
- {"bogosity", XC_bogosity},
- {"bottom_left_corner", XC_bottom_left_corner},
- {"bottom_right_corner", XC_bottom_right_corner},
- {"bottom_side", XC_bottom_side},
- {"bottom_tee", XC_bottom_tee},
- {"box_spiral", XC_box_spiral},
- {"center_ptr", XC_center_ptr},
- {"circle", XC_circle},
- {"clock", XC_clock},
- {"coffee_mug", XC_coffee_mug},
- {"cross", XC_cross},
- {"cross_reverse", XC_cross_reverse},
- {"crosshair", XC_crosshair},
- {"diamond_cross", XC_diamond_cross},
- {"dot", XC_dot},
- {"dotbox", XC_dotbox},
- {"double_arrow", XC_double_arrow},
- {"draft_large", XC_draft_large},
- {"draft_small", XC_draft_small},
- {"draped_box", XC_draped_box},
- {"exchange", XC_exchange},
- {"fleur", XC_fleur},
- {"gobbler", XC_gobbler},
- {"gumby", XC_gumby},
- {"hand1", XC_hand1},
- {"hand2", XC_hand2},
- {"heart", XC_heart},
- {"icon", XC_icon},
- {"iron_cross", XC_iron_cross},
- {"left_ptr", XC_left_ptr},
- {"left_side", XC_left_side},
- {"left_tee", XC_left_tee},
- {"leftbutton", XC_leftbutton},
- {"ll_angle", XC_ll_angle},
- {"lr_angle", XC_lr_angle},
- {"man", XC_man},
- {"middlebutton", XC_middlebutton},
- {"mouse", XC_mouse},
- {"pencil", XC_pencil},
- {"pirate", XC_pirate},
- {"plus", XC_plus},
- {"question_arrow", XC_question_arrow},
- {"right_ptr", XC_right_ptr},
- {"right_side", XC_right_side},
- {"right_tee", XC_right_tee},
- {"rightbutton", XC_rightbutton},
- {"rtl_logo", XC_rtl_logo},
- {"sailboat", XC_sailboat},
- {"sb_down_arrow", XC_sb_down_arrow},
- {"sb_h_double_arrow", XC_sb_h_double_arrow},
- {"sb_left_arrow", XC_sb_left_arrow},
- {"sb_right_arrow", XC_sb_right_arrow},
- {"sb_up_arrow", XC_sb_up_arrow},
- {"sb_v_double_arrow", XC_sb_v_double_arrow},
- {"shuttle", XC_shuttle},
- {"sizing", XC_sizing},
- {"spider", XC_spider},
- {"spraycan", XC_spraycan},
- {"star", XC_star},
- {"target", XC_target},
- {"tcross", XC_tcross},
- {"top_left_arrow", XC_top_left_arrow},
- {"top_left_corner", XC_top_left_corner},
- {"top_right_corner", XC_top_right_corner},
- {"top_side", XC_top_side},
- {"top_tee", XC_top_tee},
- {"trek", XC_trek},
- {"ul_angle", XC_ul_angle},
- {"umbrella", XC_umbrella},
- {"ur_angle", XC_ur_angle},
- {"watch", XC_watch},
- {"xterm", XC_xterm},
- };
- Const struct _CursorName *nP;
- char *name = (char *)fromVal->addr;
- register int i;
-
- if (*num_args != 1) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToCursor",XtCXtToolkitError,
- "String to cursor conversion needs display argument",
- (String *)NULL, (Cardinal *)NULL);
- return False;
- }
-
- for (i=0, nP=cursor_names; i < XtNumber(cursor_names); i++, nP++ ) {
- if (strcmp(name, nP->name) == 0) {
- Display *display = *(Display**)args[0].addr;
- Cursor cursor = XCreateFontCursor(display, nP->shape );
- donestr(Cursor, cursor, XtRCursor);
- }
- }
- XtDisplayStringConversionWarning(dpy, name, XtRCursor);
- return False;
-}
-
-/* ARGSUSED */
-static void FreeCursor(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure; /* unused */
- XrmValuePtr args;
- Cardinal *num_args;
-{
- Display* display;
-
- if (*num_args != 1) {
- XtAppWarningMsg(app,
- XtNwrongParameters,"freeCursor",XtCXtToolkitError,
- "Free Cursor requires display argument",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
-
- display = *(Display**)args[0].addr;
- XFreeCursor( display, *(Cursor*)toVal->addr );
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToDisplay(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- Display *d;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToDisplay",XtCXtToolkitError,
- "String to Display conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- d = XOpenDisplay((char *)fromVal->addr);
- if (d != NULL)
- donestr(Display*, d, XtRDisplay);
-
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRDisplay);
- return False;
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtStringToFile(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- FILE *f;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToFile",XtCXtToolkitError,
- "String to File conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
-
- f = fopen((char *)fromVal->addr, "r");
- if (f != NULL)
- donestr(FILE*, f, XtRFile);
-
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRFile);
- return False;
-}
-
-/* ARGSUSED */
-static void FreeFile(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure; /* unused */
- XrmValuePtr args; /* unused */
- Cardinal *num_args;
-{
- if (*num_args != 0)
- XtAppWarningMsg(app,
- XtNwrongParameters,"freeFile",XtCXtToolkitError,
- "Free File requires no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
-
- fclose( *(FILE**)toVal->addr );
-}
-
-/*ARGSUSED*/
-Boolean XtCvtIntToFloat(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToFloat",XtCXtToolkitError,
- "Integer to Float conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- done(float, (*(int *)fromVal->addr));
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToFloat(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- int ret;
- float f, nan;
-
-#ifndef ISC /* On ISC this generates a core dump :-( at least with gs */
- /* depending on the system this may or may not do anything useful */
- (void) sscanf ("NaNS", "%g",
- toVal->addr != NULL ? (float*) toVal->addr : &nan);
-#endif
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToFloat",XtCXtToolkitError,
- "String to Float conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
-
- ret = sscanf (fromVal->addr, "%g", &f);
- if (ret == 0) {
- if (toVal->addr != NULL && toVal->size == sizeof nan)
- *(float*)toVal->addr = nan;
- XtDisplayStringConversionWarning (dpy, (char*) fromVal->addr, XtRFloat);
- return False;
- }
- donestr(float, f, XtRFloat);
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToFont(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- Font f;
- Display* display;
-
- if (*num_args != 1) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToFont",XtCXtToolkitError,
- "String to font conversion needs display argument",
- (String *) NULL, (Cardinal *)NULL);
- return False;
- }
-
- display = *(Display**)args[0].addr;
-
- if (CompareISOLatin1((String)fromVal->addr, XtDefaultFont) != 0) {
- f = XLoadFont(display, (char *)fromVal->addr);
- if (f != 0) {
- Done: donestr( Font, f, XtRFont );
- }
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRFont);
- }
- /* try and get the default font */
-
- {
- XrmName xrm_name[2];
- XrmClass xrm_class[2];
- XrmRepresentation rep_type;
- XrmValue value;
-
- xrm_name[0] = XrmPermStringToQuark ("xtDefaultFont");
- xrm_name[1] = 0;
- xrm_class[0] = XrmPermStringToQuark ("XtDefaultFont");
- xrm_class[1] = 0;
- if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class,
- &rep_type, &value)) {
- if (rep_type == _XtQString) {
- f = XLoadFont(display, (char *)value.addr);
- if (f != 0)
- goto Done;
- else
- XtDisplayStringConversionWarning(dpy, (char *)value.addr,
- XtRFont);
- } else if (rep_type == XtQFont) {
- f = *(Font*)value.addr;
- goto Done;
- } else if (rep_type == XtQFontStruct) {
- f = ((XFontStruct*)value.addr)->fid;
- goto Done;
- }
- }
- }
- /* Should really do XListFonts, but most servers support this */
- f = XLoadFont(display, "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1");
- if (f != 0)
- goto Done;
-
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "noFont","cvtStringToFont",XtCXtToolkitError,
- "Unable to load any usable ISO8859-1 font",
- (String *) NULL, (Cardinal *)NULL);
-
- return False;
-}
-
-/* ARGSUSED */
-static void FreeFont(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure; /* unused */
- XrmValuePtr args;
- Cardinal *num_args;
-{
- Display *display;
- if (*num_args != 1) {
- XtAppWarningMsg(app,
- XtNwrongParameters,"freeFont",XtCXtToolkitError,
- "Free Font needs display argument",
- (String *) NULL, (Cardinal *)NULL);
- return;
- }
-
- display = *(Display**)args[0].addr;
- XUnloadFont( display, *(Font*)toVal->addr );
-}
-
-/*ARGSUSED*/
-Boolean XtCvtIntToFont(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToFont",XtCXtToolkitError,
- "Integer to Font conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- done(Font, *(int*)fromVal->addr);
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToFontSet(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- XFontSet f;
- Display* display;
- char** missing_charset_list;
- int missing_charset_count;
- char* def_string;
-
- if (*num_args != 2) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToFontSet",XtCXtToolkitError,
- "String to FontSet conversion needs display and locale arguments",
- (String *) NULL, (Cardinal *)NULL);
- return False;
- }
-
- display = *(Display**)args[0].addr;
-
- if (CompareISOLatin1((String)fromVal->addr, XtDefaultFontSet) != 0) {
- f = XCreateFontSet(display, (char *)fromVal->addr,
- &missing_charset_list, &missing_charset_count, &def_string);
- /* Free any returned missing charset list */
- if (missing_charset_count) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNmissingCharsetList,"cvtStringToFontSet",XtCXtToolkitError,
- "Missing charsets in String to FontSet conversion",
- (String *) NULL, (Cardinal *)NULL);
- XFreeStringList(missing_charset_list);
- }
- if (f != NULL) {
- Done: donestr( XFontSet, f, XtRFontSet );
- }
- XtDisplayStringConversionWarning(dpy, (char *)fromVal->addr, XtRFontSet);
- }
- /* try and get the default fontset */
-
- {
- XrmName xrm_name[2];
- XrmClass xrm_class[2];
- XrmRepresentation rep_type;
- XrmValue value;
-
- xrm_name[0] = XrmPermStringToQuark ("xtDefaultFontSet");
- xrm_name[1] = 0;
- xrm_class[0] = XrmPermStringToQuark ("XtDefaultFontSet");
- xrm_class[1] = 0;
- if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class,
- &rep_type, &value)) {
- if (rep_type == _XtQString) {
- f = XCreateFontSet(display, (char *)value.addr,
- &missing_charset_list, &missing_charset_count,
- &def_string);
- /* Free any returned missing charset list */
- if (missing_charset_count) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNmissingCharsetList,"cvtStringToFontSet",
- XtCXtToolkitError,
- "Missing charsets in String to FontSet conversion",
- (String *) NULL, (Cardinal *)NULL);
- XFreeStringList(missing_charset_list);
- }
- if (f != NULL)
- goto Done;
- else
- XtDisplayStringConversionWarning(dpy, (char *)value.addr,
- XtRFontSet);
- } else if (rep_type == XtQFontSet) {
- f = *(XFontSet*)value.addr;
- goto Done;
- }
- }
- }
-
- /* Should really do XListFonts, but most servers support this */
- f = XCreateFontSet(display, "-*-*-*-R-*-*-*-120-*-*-*-*",
- &missing_charset_list, &missing_charset_count, &def_string);
- /* Free any returned missing charset list */
- if (missing_charset_count) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNmissingCharsetList,"cvtStringToFontSet",XtCXtToolkitError,
- "Missing charsets in String to FontSet conversion",
- (String *) NULL, (Cardinal *)NULL);
- XFreeStringList(missing_charset_list);
- }
- if (f != NULL)
- goto Done;
-
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "noFont","cvtStringToFontSet",XtCXtToolkitError,
- "Unable to load any usable fontset",
- (String *) NULL, (Cardinal *)NULL);
-
- return False;
-}
-
-/*ARGSUSED*/
-static void FreeFontSet(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure; /* unused */
- XrmValuePtr args;
- Cardinal *num_args;
-{
- Display *display;
- if (*num_args != 2) {
- XtAppWarningMsg(app,
- XtNwrongParameters,"freeFontSet",XtCXtToolkitError,
- "FreeFontSet needs display and locale arguments",
- (String *) NULL, (Cardinal *)NULL);
- return;
- }
-
- display = *(Display**)args[0].addr;
- XFreeFontSet( display, *(XFontSet*)toVal->addr );
-}
-
-/*ARGSUSED*/
-static void FetchLocaleArg(widget, size, value )
- Widget widget; /* unused */
- Cardinal *size; /* unused */
- XrmValue *value;
-{
- static XrmString locale;
-
- locale = XrmQuarkToString(XrmStringToQuark
- (setlocale(LC_CTYPE, (char*)NULL)));
- value->size = sizeof(XrmString);
- value->addr = (XPointer)&locale;
-}
-
-static XtConvertArgRec Const localeDisplayConvertArgs[] = {
- {XtProcedureArg, (XtPointer)FetchDisplayArg, 0},
- {XtProcedureArg, (XtPointer)FetchLocaleArg, 0},
-};
-
-
-/*ARGSUSED*/
-Boolean
-XtCvtStringToFontStruct(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- XFontStruct *f;
- Display* display;
-
- if (*num_args != 1) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToFontStruct",XtCXtToolkitError,
- "String to font conversion needs display argument",
- (String *) NULL, (Cardinal *)NULL);
- return False;
- }
-
- display = *(Display**)args[0].addr;
-
- if (CompareISOLatin1((String)fromVal->addr, XtDefaultFont) != 0) {
- f = XLoadQueryFont(display, (char *)fromVal->addr);
- if (f != NULL) {
- Done: donestr( XFontStruct*, f, XtRFontStruct);
- }
-
- XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr,
- XtRFontStruct);
- }
-
- /* try and get the default font */
-
- {
- XrmName xrm_name[2];
- XrmClass xrm_class[2];
- XrmRepresentation rep_type;
- XrmValue value;
-
- xrm_name[0] = XrmPermStringToQuark ("xtDefaultFont");
- xrm_name[1] = 0;
- xrm_class[0] = XrmPermStringToQuark ("XtDefaultFont");
- xrm_class[1] = 0;
- if (XrmQGetResource(XtDatabase(display), xrm_name, xrm_class,
- &rep_type, &value)) {
- if (rep_type == _XtQString) {
- f = XLoadQueryFont(display, (char*)value.addr);
- if (f != NULL)
- goto Done;
- else
- XtDisplayStringConversionWarning(dpy, (char*)value.addr,
- XtRFontStruct);
- } else if (rep_type == XtQFont) {
- f = XQueryFont(display, *(Font*)value.addr );
- if (f != NULL) goto Done;
- } else if (rep_type == XtQFontStruct) {
- f = (XFontStruct*)value.addr;
- goto Done;
- }
- }
- }
- /* Should really do XListFonts, but most servers support this */
- f = XLoadQueryFont(display, "-*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1");
- if (f != NULL)
- goto Done;
-
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "noFont","cvtStringToFontStruct",XtCXtToolkitError,
- "Unable to load any usable ISO8859-1 font",
- (String *) NULL, (Cardinal *)NULL);
-
- return False;
-}
-
-/* ARGSUSED */
-static void FreeFontStruct(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure; /* unused */
- XrmValuePtr args;
- Cardinal *num_args;
-{
- Display *display;
- if (*num_args != 1) {
- XtAppWarningMsg(app,
- XtNwrongParameters,"freeFontStruct",XtCXtToolkitError,
- "Free FontStruct requires display argument",
- (String *) NULL, (Cardinal *)NULL);
- return;
- }
-
- display = *(Display**)args[0].addr;
- XFreeFont( display, *(XFontStruct**)toVal->addr );
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToInt(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- int i;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToInt",XtCXtToolkitError,
- "String to Integer conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- if (IsInteger((String)fromVal->addr, &i))
- donestr(int, i, XtRInt);
-
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRInt);
- return False;
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToShort(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- int i;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToShort",XtCXtToolkitError,
- "String to Integer conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- if (IsInteger((String)fromVal->addr, &i))
- donestr(short, (short)i, XtRShort);
-
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRShort);
- return False;
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToDimension(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- int i;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToDimension",XtCXtToolkitError,
- "String to Dimension conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- if (IsInteger((String)fromVal->addr, &i)) {
- if ( i < 0 )
- XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr,
- XtRDimension);
- donestr(Dimension, (Dimension)i, XtRDimension);
- }
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr, XtRDimension);
- return False;
-}
-
-/*ARGSUSED*/
-Boolean XtCvtIntToUnsignedChar(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToUnsignedChar",XtCXtToolkitError,
- "Integer to UnsignedChar conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- done(unsigned char, (*(int *)fromVal->addr));
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtStringToUnsignedChar(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- int i;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToUnsignedChar",XtCXtToolkitError,
- "String to Integer conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- if (IsInteger((String)fromVal->addr, &i)) {
- if ( i < 0 || i > 255 )
- XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr,
- XtRUnsignedChar);
- donestr(unsigned char, i, XtRUnsignedChar);
- }
- XtDisplayStringConversionWarning(dpy, (char*)fromVal->addr,
- XtRUnsignedChar);
- return False;
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtColorToPixel(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtXColorToPixel",XtCXtToolkitError,
- "Color to Pixel conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- done(Pixel, ((XColor *)fromVal->addr)->pixel);
-}
-
-/*ARGSUSED*/
-Boolean XtCvtIntToPixel(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToPixel",XtCXtToolkitError,
- "Integer to Pixel conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- done(Pixel, *(int*)fromVal->addr);
-}
-
-/*ARGSUSED*/
-Boolean XtCvtIntToPixmap(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtIntToPixmap",XtCXtToolkitError,
- "Integer to Pixmap conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- done(Pixmap, *(Pixmap*)fromVal->addr);
-}
-
-#ifdef MOTIFBC
-void LowerCase(source, dest)
- register char *source, *dest;
-{
- register char ch;
- int i;
-
- for (i = 0; (ch = *source) != 0 && i < 999; source++, dest++, i++) {
- if ('A' <= ch && ch <= 'Z')
- *dest = ch - 'A' + 'a';
- else
- *dest = ch;
- }
- *dest = 0;
-}
-#endif
-
-static int CompareISOLatin1 (first, second)
- char *first, *second;
-{
- register unsigned char *ap, *bp;
-
- for (ap = (unsigned char *) first, bp = (unsigned char *) second;
- *ap && *bp; ap++, bp++) {
- register unsigned char a, b;
-
- if ((a = *ap) != (b = *bp)) {
- /* try lowercasing and try again */
-
- if ((a >= XK_A) && (a <= XK_Z))
- a += (XK_a - XK_A);
- else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
- a += (XK_agrave - XK_Agrave);
- else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
- a += (XK_oslash - XK_Ooblique);
-
- if ((b >= XK_A) && (b <= XK_Z))
- b += (XK_a - XK_A);
- else if ((b >= XK_Agrave) && (b <= XK_Odiaeresis))
- b += (XK_agrave - XK_Agrave);
- else if ((b >= XK_Ooblique) && (b <= XK_Thorn))
- b += (XK_oslash - XK_Ooblique);
-
- if (a != b) break;
- }
- }
- return (((int) *bp) - ((int) *ap));
-}
-
-static void CopyISOLatin1Lowered(dst, src)
- char *dst, *src;
-{
- unsigned char *dest, *source;
-
- dest = (unsigned char *) dst; source = (unsigned char *) src;
-
- for ( ; *source; 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';
-}
-
-/*ARGSUSED*/
-Boolean
-XtCvtStringToInitialState(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String str = (String)fromVal->addr;
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToInitialState",XtCXtToolkitError,
- "String to InitialState conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
-
- if (CompareISOLatin1(str, "NormalState") == 0) donestr(int, NormalState, XtRInitialState);
- if (CompareISOLatin1(str, "IconicState") == 0) donestr(int, IconicState, XtRInitialState);
- {
- int val;
- if (IsInteger(str, &val)) donestr( int, val, XtRInitialState );
- }
- XtDisplayStringConversionWarning(dpy, str, XtRInitialState);
- return False;
-}
-
-static XtConvertArgRec Const visualConvertArgs[] = {
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.screen),
- sizeof(Screen *)},
- {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec, core.depth),
- sizeof(Cardinal)}
-};
-
-/*ARGSUSED*/
-Boolean XtCvtStringToVisual(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args; /* Screen, depth */
- Cardinal *num_args; /* 2 */
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret; /* unused */
-{
- String str = (String)fromVal->addr;
- int vc;
- XVisualInfo vinfo;
- if (*num_args != 2) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToVisual",XtCXtToolkitError,
- "String to Visual conversion needs screen and depth arguments",
- (String *) NULL, (Cardinal *)NULL);
- return False;
- }
-
- if (CompareISOLatin1(str, "StaticGray") == 0) vc = StaticGray;
- else if (CompareISOLatin1(str, "StaticColor") == 0) vc = StaticColor;
- else if (CompareISOLatin1(str, "TrueColor") == 0) vc = TrueColor;
- else if (CompareISOLatin1(str, "GrayScale") == 0) vc = GrayScale;
- else if (CompareISOLatin1(str, "PseudoColor") == 0) vc = PseudoColor;
- else if (CompareISOLatin1(str, "DirectColor") == 0) vc = DirectColor;
- else if (!IsInteger(str, &vc)) {
- XtDisplayStringConversionWarning(dpy, str, "Visual class name");
- return False;
- }
-
- if (XMatchVisualInfo( XDisplayOfScreen((Screen*)*(Screen**)args[0].addr),
- XScreenNumberOfScreen((Screen*)*(Screen**)args[0].addr),
- (int)*(int*)args[1].addr,
- vc,
- &vinfo) ) {
- donestr( Visual*, vinfo.visual, XtRVisual );
- }
- else {
- String params[2];
- Cardinal num_params = 2;
- params[0] = str;
- params[1] =
- DisplayString(XDisplayOfScreen((Screen*)*(Screen**)args[0].addr));
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNconversionError, "stringToVisual", XtCXtToolkitError,
- "Cannot find Visual of class %s for display %s",
- params, &num_params );
- return False;
- }
-}
-
-
-/*ARGSUSED*/
-Boolean XtCvtStringToAtom(dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- Atom atom;
- if (*num_args != 1) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToAtom",XtCXtToolkitError,
- "String to Atom conversion needs Display argument",
- (String *) NULL, (Cardinal *)NULL);
- return False;
- }
-
- atom = XInternAtom( *(Display**)args->addr, (char*)fromVal->addr, False );
- donestr(Atom, atom, XtRAtom);
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToDirectoryString(dpy, args, num_args, fromVal, toVal,
- closure_ret)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String str;
- char directory[PATH_MAX+1];
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToDirectoryString",XtCXtToolkitError,
- "String to DirectoryString conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- str = (String)fromVal->addr;
- if (CompareISOLatin1(str, "XtCurrentDirectory") == 0) {
- /* uglier, but does not depend on compiler knowing return type */
-#if !defined(X_NOT_POSIX) || defined(SYSV) || defined(WIN32)
- if (getcwd(directory, PATH_MAX + 1))
- str = directory;
-#else
- if (getwd(directory))
- str = directory;
-#endif
- if (!str) {
- if (errno == EACCES)
- errno = 0; /* reset errno */
- XtDisplayStringConversionWarning(dpy, (char *) fromVal->addr,
- XtRDirectoryString);
- return False;
- }
- }
-
- /* Since memory from the resource database or from static buffers of
- * system libraries may be freed or overwritten, allocate memory.
- * The memory is freed when all cache references are released.
- */
- str = XtNewString(str);
- donestr(String, str, XtRDirectoryString);
-}
-
-/*ARGSUSED*/
-static void FreeDirectoryString(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure; /* unused */
- XrmValuePtr args;
- Cardinal *num_args;
-{
- if (*num_args != 0)
- XtAppWarningMsg(app,
- XtNwrongParameters,"freeDirectoryString",XtCXtToolkitError,
- "Free Directory String requires no extra arguments",
- (String *) NULL, (Cardinal *) NULL);
-
- XtFree((char *) toVal->addr);
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToRestartStyle(dpy, args, num_args, fromVal, toVal,
- closure_ret)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String str = (String)fromVal->addr;
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToRestartStyle",XtCXtToolkitError,
- "String to RestartStyle conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- if (CompareISOLatin1(str, "RestartIfRunning") == 0)
- donestr(unsigned char, SmRestartIfRunning, XtRRestartStyle);
- if (CompareISOLatin1(str, "RestartAnyway") == 0)
- donestr(unsigned char, SmRestartAnyway, XtRRestartStyle);
- if (CompareISOLatin1(str, "RestartImmediately") == 0)
- donestr(unsigned char, SmRestartImmediately, XtRRestartStyle);
- if (CompareISOLatin1(str, "RestartNever") == 0)
- donestr(unsigned char, SmRestartNever, XtRRestartStyle);
- XtDisplayStringConversionWarning(dpy, str, XtRRestartStyle);
- return False;
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToCommandArgArray(dpy, args, num_args, fromVal, toVal,
- closure_ret)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- String *strarray, *ptr;
- char *src, *src_str;
- char *dst, *dst_str;
- char *start;
- int tokens, len;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- XtNwrongParameters,"cvtStringToCommandArgArray",XtCXtToolkitError,
- "String to CommandArgArray conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- src = src_str = fromVal->addr;
- dst = dst_str = __XtMalloc((unsigned) strlen(src) + 1);
- tokens = 0;
-
- while (*src != '\0') {
- /* skip whitespace */
- while (IsWhitespace(*src) || IsNewline(*src))
- src++;
- /* test for end of string */
- if (*src == '\0')
- break;
-
- /* start new token */
- tokens++;
- start = src;
- while (*src != '\0' && !IsWhitespace(*src) && !IsNewline(*src)) {
- if (*src == '\\' &&
- (IsWhitespace(*(src+1)) || IsNewline(*(src+1)))) {
- len = src - start;
- if (len) {
- /* copy preceeding part of token */
- memcpy(dst, start, len);
- dst += len;
- }
- /* skip backslash */
- src++;
- /* next part of token starts at whitespace */
- start = src;
- }
- src++;
- }
- len = src - start;
- if (len) {
- /* copy last part of token */
- memcpy(dst, start, len);
- dst += len;
- }
- *dst = '\0';
- if (*src != '\0')
- dst++;
- }
-
- ptr = strarray = (String*) __XtMalloc((Cardinal)(tokens+1) * sizeof(String));
- src = dst_str;
- while (--tokens >= 0) {
- *ptr = src;
- ptr++;
- if (tokens) {
- len = strlen(src);
- src = src + len + 1;
- }
- }
- *ptr = NULL;
-
- *closure_ret = (XtPointer) strarray;
- donestr(char**, strarray, XtRCommandArgArray)
-}
-
-/*ARGSUSED*/
-static void ArgArrayDestructor(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure;
- XrmValuePtr args;
- Cardinal *num_args;
-{
- String *strarray;
-
- if (closure) {
- strarray = (String*) closure;
- XtFree(*strarray);
- XtFree((char *) strarray);
- }
-}
-
-/*ARGSUSED*/
-Boolean XtCvtStringToGravity (dpy, args, num_args, fromVal, toVal, closure_ret)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr fromVal;
- XrmValuePtr toVal;
- XtPointer *closure_ret;
-{
- static struct _namepair {
- XrmQuark quark;
- char *name;
- int gravity;
- } names[] = {
- { NULLQUARK, "forget", ForgetGravity },
- { NULLQUARK, "northwest", NorthWestGravity },
- { NULLQUARK, "north", NorthGravity },
- { NULLQUARK, "northeast", NorthEastGravity },
- { NULLQUARK, "west", WestGravity },
- { NULLQUARK, "center", CenterGravity },
- { NULLQUARK, "east", EastGravity },
- { NULLQUARK, "southwest", SouthWestGravity },
- { NULLQUARK, "south", SouthGravity },
- { NULLQUARK, "southeast", SouthEastGravity },
- { NULLQUARK, "static", StaticGravity },
- { NULLQUARK, "unmap", UnmapGravity },
- { NULLQUARK, "0", ForgetGravity },
- { NULLQUARK, "1", NorthWestGravity },
- { NULLQUARK, "2", NorthGravity },
- { NULLQUARK, "3", NorthEastGravity },
- { NULLQUARK, "4", WestGravity },
- { NULLQUARK, "5", CenterGravity },
- { NULLQUARK, "6", EastGravity },
- { NULLQUARK, "7", SouthWestGravity },
- { NULLQUARK, "8", SouthGravity },
- { NULLQUARK, "9", SouthEastGravity },
- { NULLQUARK, "10", StaticGravity },
- { NULLQUARK, NULL, ForgetGravity }
- };
- static Boolean haveQuarks = FALSE;
- char lowerName[40];
- XrmQuark q;
- char *s;
- struct _namepair *np;
-
- if (*num_args != 0) {
- XtAppWarningMsg(XtDisplayToApplicationContext (dpy),
- "wrongParameters","cvtStringToGravity","XtToolkitError",
- "String to Gravity conversion needs no extra arguments",
- (String *) NULL, (Cardinal *)NULL);
- return False;
- }
- if (!haveQuarks) {
- for (np = names; np->name; np++) {
- np->quark = XrmPermStringToQuark (np->name);
- }
- haveQuarks = TRUE;
- }
- s = (char *) fromVal->addr;
- if (strlen(s) < sizeof lowerName) {
- CopyISOLatin1Lowered (lowerName, s);
- q = XrmStringToQuark (lowerName);
- for (np = names; np->name; np++)
- if (np->quark == q) donestr(int, np->gravity, XtRGravity);
- }
- XtDisplayStringConversionWarning(dpy, (char *)fromVal->addr, XtRGravity);
- return False;
-}
-
-void _XtAddDefaultConverters(table)
- ConverterTable table;
-{
-#define Add(from, to, proc, convert_args, num_args, cache) \
- _XtTableAddConverter(table, from, to, proc, \
- (XtConvertArgList) convert_args, (Cardinal)num_args, \
- True, cache, (XtDestructor)NULL, True)
-
-#define Add2(from, to, proc, convert_args, num_args, cache, destructor) \
- _XtTableAddConverter(table, from, to, proc, \
- (XtConvertArgList) convert_args, (Cardinal)num_args, \
- True, cache, destructor, True)
-
- Add(XtQColor, XtQPixel, XtCvtColorToPixel, NULL, 0, XtCacheNone);
-
- Add(XtQInt, XtQBool, XtCvtIntToBool, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQBoolean, XtCvtIntToBoolean, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQColor, XtCvtIntToColor,
- colorConvertArgs, XtNumber(colorConvertArgs), XtCacheByDisplay);
- Add(XtQInt, XtQDimension, XtCvtIntToShort, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQFloat, XtCvtIntToFloat, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQFont, XtCvtIntToFont, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQPixel, XtCvtIntToPixel, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQPixmap, XtCvtIntToPixmap, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQPosition, XtCvtIntToShort, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQShort, XtCvtIntToShort, NULL, 0, XtCacheNone);
- Add(XtQInt, XtQUnsignedChar,XtCvtIntToUnsignedChar,NULL, 0, XtCacheNone);
-
- Add(XtQPixel, XtQColor, XtCvtIntToColor,
- colorConvertArgs, XtNumber(colorConvertArgs), XtCacheByDisplay);
-
- Add(_XtQString, XtQAtom, XtCvtStringToAtom,
- displayConvertArg, XtNumber(displayConvertArg), XtCacheNone);
- Add(_XtQString, XtQBool, XtCvtStringToBool, NULL, 0, XtCacheNone);
- Add(_XtQString, XtQBoolean, XtCvtStringToBoolean, NULL, 0, XtCacheNone);
- Add2(_XtQString, XtQCommandArgArray, XtCvtStringToCommandArgArray,
- NULL, 0, XtCacheNone | XtCacheRefCount, ArgArrayDestructor);
- Add2(_XtQString, XtQCursor, XtCvtStringToCursor,
- displayConvertArg, XtNumber(displayConvertArg),
- XtCacheByDisplay, FreeCursor);
- Add(_XtQString, XtQDimension, XtCvtStringToDimension,NULL, 0, XtCacheNone);
- Add2(_XtQString, XtQDirectoryString, XtCvtStringToDirectoryString, NULL, 0,
- XtCacheNone | XtCacheRefCount, FreeDirectoryString);
- Add(_XtQString, XtQDisplay, XtCvtStringToDisplay, NULL, 0, XtCacheAll);
- Add2(_XtQString, XtQFile, XtCvtStringToFile, NULL, 0,
- XtCacheAll | XtCacheRefCount, FreeFile);
- Add(_XtQString, XtQFloat, XtCvtStringToFloat, NULL, 0, XtCacheNone);
-
- Add2(_XtQString, XtQFont, XtCvtStringToFont,
- displayConvertArg, XtNumber(displayConvertArg),
- XtCacheByDisplay, FreeFont);
- Add2(_XtQString, XtQFontSet, XtCvtStringToFontSet,
- localeDisplayConvertArgs, XtNumber(localeDisplayConvertArgs),
- XtCacheByDisplay, FreeFontSet);
- Add2(_XtQString, XtQFontStruct,XtCvtStringToFontStruct,
- displayConvertArg, XtNumber(displayConvertArg),
- XtCacheByDisplay, FreeFontStruct);
-
- Add(_XtQString, XtQGravity, XtCvtStringToGravity, NULL, 0, XtCacheNone);
- Add(_XtQString, XtQInitialState, XtCvtStringToInitialState, NULL, 0,
- XtCacheNone);
- Add(_XtQString, XtQInt, XtCvtStringToInt, NULL, 0, XtCacheAll);
- Add2(_XtQString, XtQPixel, XtCvtStringToPixel,
- colorConvertArgs, XtNumber(colorConvertArgs),
- XtCacheByDisplay, FreePixel);
- Add(_XtQString, XtQPosition, XtCvtStringToShort, NULL, 0, XtCacheAll);
- Add(_XtQString, XtQRestartStyle, XtCvtStringToRestartStyle, NULL, 0,
- XtCacheNone);
- Add(_XtQString, XtQShort, XtCvtStringToShort, NULL, 0, XtCacheAll);
- Add(_XtQString, XtQUnsignedChar, XtCvtStringToUnsignedChar,
- NULL, 0, XtCacheAll);
- Add2(_XtQString, XtQVisual, XtCvtStringToVisual,
- visualConvertArgs, XtNumber(visualConvertArgs),
- XtCacheByDisplay, NULL);
-
- _XtAddTMConverters(table);
-}
diff --git a/xc/lib/Xt/Core.c b/xc/lib/Xt/Core.c
deleted file mode 100644
index b094927ea..000000000
--- a/xc/lib/Xt/Core.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/* $TOG: Core.c /main/63 1998/02/06 13:21:00 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-#define _XT_CORE_C
-
-#include "IntrinsicP.h"
-#include "EventI.h"
-#include "ConvertI.h"
-#include "TranslateI.h"
-#include "ResourceI.h"
-#include "RectObj.h"
-#include "RectObjP.h"
-#include "ThreadsI.h"
-#include "StringDefs.h"
-
-/******************************************************************
- *
- * CoreWidget Resources
- *
- ******************************************************************/
-
-externaldef(xtinherittranslations) int _XtInheritTranslations = 0;
-extern String XtCXtToolkitError; /* from IntrinsicI.h */
-static void XtCopyScreen();
-
-static XtResource resources[] = {
- {XtNscreen, XtCScreen, XtRScreen, sizeof(Screen*),
- XtOffsetOf(CoreRec,core.screen), XtRCallProc, (XtPointer)XtCopyScreen},
-/*_XtCopyFromParent does not work for screen because the Display
-parameter is not passed through to the XtRCallProc routines */
- {XtNdepth, XtCDepth, XtRInt,sizeof(int),
- XtOffsetOf(CoreRec,core.depth),
- XtRCallProc, (XtPointer)_XtCopyFromParent},
- {XtNcolormap, XtCColormap, XtRColormap, sizeof(Colormap),
- XtOffsetOf(CoreRec,core.colormap),
- XtRCallProc,(XtPointer)_XtCopyFromParent},
- {XtNbackground, XtCBackground, XtRPixel,sizeof(Pixel),
- XtOffsetOf(CoreRec,core.background_pixel),
- XtRString, (XtPointer)"XtDefaultBackground"},
- {XtNbackgroundPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
- XtOffsetOf(CoreRec,core.background_pixmap),
- XtRImmediate, (XtPointer)XtUnspecifiedPixmap},
- {XtNborderColor, XtCBorderColor, XtRPixel,sizeof(Pixel),
- XtOffsetOf(CoreRec,core.border_pixel),
- XtRString,(XtPointer)"XtDefaultForeground"},
- {XtNborderPixmap, XtCPixmap, XtRPixmap, sizeof(Pixmap),
- XtOffsetOf(CoreRec,core.border_pixmap),
- XtRImmediate, (XtPointer)XtUnspecifiedPixmap},
- {XtNmappedWhenManaged, XtCMappedWhenManaged, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(CoreRec,core.mapped_when_managed),
- XtRImmediate, (XtPointer)True},
- {XtNtranslations, XtCTranslations, XtRTranslationTable,
- sizeof(XtTranslations), XtOffsetOf(CoreRec,core.tm.translations),
- XtRTranslationTable, (XtPointer)NULL},
- {XtNaccelerators, XtCAccelerators, XtRAcceleratorTable,
- sizeof(XtTranslations), XtOffsetOf(CoreRec,core.accelerators),
- XtRTranslationTable, (XtPointer)NULL}
- };
-
-static void CoreInitialize();
-static void CoreClassPartInitialize();
-static void CoreDestroy();
-static void CoreRealize();
-static Boolean CoreSetValues();
-static void CoreSetValuesAlmost();
-
-static RectObjClassRec unNamedObjClassRec = {
- {
- /* superclass */ (WidgetClass)&rectObjClassRec,
- /* class_name */ "UnNamedObj",
- /* widget_size */ 0,
- /* class_initialize */ NULL,
- /* class_part_initialize*/ NULL,
- /* class_inited */ FALSE,
- /* initialize */ NULL,
- /* initialize_hook */ NULL,
- /* realize */ (XtProc)XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ NULL,
- /* num_resources */ 0,
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ FALSE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ NULL,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- }
-};
-
-
-externaldef(widgetclassrec) WidgetClassRec widgetClassRec = {
-{
- /* superclass */ (WidgetClass)&unNamedObjClassRec,
- /* class_name */ "Core",
- /* widget_size */ sizeof(WidgetRec),
- /* class_initialize */ NULL,
- /* class_part_initialize*/ CoreClassPartInitialize,
- /* class_inited */ FALSE,
- /* initialize */ CoreInitialize,
- /* initialize_hook */ NULL,
- /* realize */ CoreRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ CoreDestroy,
- /* resize */ NULL,
- /* expose */ NULL,
- /* set_values */ CoreSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ CoreSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- }
-};
-externaldef (WidgetClass) WidgetClass widgetClass = &widgetClassRec;
-
-externaldef (WidgetClass) WidgetClass coreWidgetClass = &widgetClassRec;
-
-
-/*ARGSUSED*/
-static void XtCopyScreen(widget, offset, value)
- Widget widget;
- int offset;
- XrmValue *value;
-{
- value->addr = (XPointer)(&widget->core.screen);
-}
-
-/*
- * Start of Core methods
- */
-
-static void CoreClassPartInitialize(wc)
- register WidgetClass wc;
-{
- /* We don't need to check for null super since we'll get to object
- eventually, and it had better define them! */
-
- register WidgetClass super = wc->core_class.superclass;
-
- LOCK_PROCESS;
- if (wc->core_class.realize == XtInheritRealize) {
- wc->core_class.realize = super->core_class.realize;
- }
-
- if (wc->core_class.accept_focus == XtInheritAcceptFocus) {
- wc->core_class.accept_focus = super->core_class.accept_focus;
- }
-
- if (wc->core_class.display_accelerator == XtInheritDisplayAccelerator) {
- wc->core_class.display_accelerator =
- super->core_class.display_accelerator;
- }
-
- if (wc->core_class.tm_table == (char *) XtInheritTranslations) {
- wc->core_class.tm_table =
- wc->core_class.superclass->core_class.tm_table;
- } else if (wc->core_class.tm_table != NULL) {
- wc->core_class.tm_table =
- (String)XtParseTranslationTable(wc->core_class.tm_table);
- }
-
- if (wc->core_class.actions != NULL) {
- Boolean inPlace;
-
- if (wc->core_class.version == XtVersionDontCheck)
- inPlace = True;
- else
- inPlace = (wc->core_class.version < XtVersion) ? False : True;
-
- /* Compile the action table into a more efficient form */
- wc->core_class.actions = (XtActionList) _XtInitializeActionData(
- wc->core_class.actions, wc->core_class.num_actions, inPlace);
- }
- UNLOCK_PROCESS;
-}
-/* ARGSUSED */
-static void CoreInitialize(requested_widget, new_widget, args, num_args)
- Widget requested_widget;
- register Widget new_widget;
- ArgList args;
- Cardinal *num_args;
-{
- XtTranslations save1, save2;
- new_widget->core.event_table = NULL;
- new_widget->core.tm.proc_table = NULL;
- new_widget->core.tm.lastEventTime = 0;
- /* magic semi-resource fetched by GetResources */
- save1 = (XtTranslations)new_widget->core.tm.current_state;
- new_widget->core.tm.current_state = NULL;
- save2 = new_widget->core.tm.translations;
- LOCK_PROCESS;
- new_widget->core.tm.translations =
- (XtTranslations)new_widget->core.widget_class->core_class.tm_table;
- UNLOCK_PROCESS;
- if (save1)
- _XtMergeTranslations(new_widget, save1, save1->operation);
- if (save2)
- _XtMergeTranslations(new_widget, save2, save2->operation);
-}
-
-static void CoreRealize(widget, value_mask, attributes)
- Widget widget;
- XtValueMask *value_mask;
- XSetWindowAttributes *attributes;
-{
- XtCreateWindow(widget, (unsigned int) InputOutput,
- (Visual *) CopyFromParent, *value_mask, attributes);
-} /* CoreRealize */
-
-static void CoreDestroy (widget)
- Widget widget;
-{
- _XtFreeEventTable(&widget->core.event_table);
- _XtDestroyTMData(widget);
- XtUnregisterDrawable(XtDisplay(widget), widget->core.window);
-
- if (widget->core.popup_list != NULL)
- XtFree((char *)widget->core.popup_list);
-
-} /* CoreDestroy */
-
-/* ARGSUSED */
-static Boolean CoreSetValues(old, reference, new, args, num_args)
- Widget old, reference, new;
- ArgList args;
- Cardinal *num_args;
-{
- Boolean redisplay;
- Mask window_mask;
- XSetWindowAttributes attributes;
- XtTranslations save;
-
- redisplay = FALSE;
- if (old->core.tm.translations != new->core.tm.translations) {
- save = new->core.tm.translations;
- new->core.tm.translations = old->core.tm.translations;
- _XtMergeTranslations(new, save, XtTableReplace);
- }
-
- /* Check everything that depends upon window being realized */
- if (XtIsRealized(old)) {
- window_mask = 0;
- /* Check window attributes */
- if (old->core.background_pixel != new->core.background_pixel
- && new->core.background_pixmap == XtUnspecifiedPixmap) {
- attributes.background_pixel = new->core.background_pixel;
- window_mask |= CWBackPixel;
- redisplay = TRUE;
- }
- if (old->core.background_pixmap != new->core.background_pixmap) {
- if (new->core.background_pixmap == XtUnspecifiedPixmap) {
- window_mask |= CWBackPixel;
- attributes.background_pixel = new->core.background_pixel;
- }
- else {
- attributes.background_pixmap = new->core.background_pixmap;
- window_mask &= ~CWBackPixel;
- window_mask |= CWBackPixmap;
- }
- redisplay = TRUE;
- }
- if (old->core.border_pixel != new->core.border_pixel
- && new->core.border_pixmap == XtUnspecifiedPixmap) {
- attributes.border_pixel = new->core.border_pixel;
- window_mask |= CWBorderPixel;
- }
- if (old->core.border_pixmap != new->core.border_pixmap) {
- if (new->core.border_pixmap == XtUnspecifiedPixmap) {
- window_mask |= CWBorderPixel;
- attributes.border_pixel = new->core.border_pixel;
- }
- else {
- attributes.border_pixmap = new->core.border_pixmap;
- window_mask &= ~CWBorderPixel;
- window_mask |= CWBorderPixmap;
- }
- }
- if (old->core.depth != new->core.depth) {
- XtAppWarningMsg(XtWidgetToApplicationContext(old),
- "invalidDepth","setValues",XtCXtToolkitError,
- "Can't change widget depth", (String *)NULL, (Cardinal *)NULL);
- new->core.depth = old->core.depth;
- }
- if (old->core.colormap != new->core.colormap) {
- window_mask |= CWColormap;
- attributes.colormap = new->core.colormap;
- }
- if (window_mask != 0) {
- /* Actually change X window attributes */
- XChangeWindowAttributes(
- XtDisplay(new), XtWindow(new), window_mask, &attributes);
- }
-
- if (old->core.mapped_when_managed != new->core.mapped_when_managed) {
- Boolean mapped_when_managed = new->core.mapped_when_managed;
- new->core.mapped_when_managed = !mapped_when_managed;
- XtSetMappedWhenManaged(new, mapped_when_managed);
- }
- } /* if realized */
-
- return redisplay;
-} /* CoreSetValues */
-
-/*ARGSUSED*/
-static void CoreSetValuesAlmost(old, new, request, reply)
- Widget old;
- Widget new;
- XtWidgetGeometry *request;
- XtWidgetGeometry *reply;
-{
- *request = *reply;
-}
diff --git a/xc/lib/Xt/Core.h b/xc/lib/Xt/Core.h
deleted file mode 100644
index 16a041e9c..000000000
--- a/xc/lib/Xt/Core.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* $TOG: Core.h /main/12 1998/02/06 13:21:07 kaleb $
-* $oHeader: Core.h,v 1.2 88/08/18 15:54:32 asente Exp $
-*/
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtCore_h
-#define _XtCore_h
-
-typedef struct _WidgetClassRec *CoreWidgetClass;
-typedef struct _WidgetRec *CoreWidget;
-externalref WidgetClass coreWidgetClass;
-
-#ifndef _XT_CORE_C
-externalref WidgetClass widgetClass;
-
-#endif
-
-#endif /* _XtCore_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/CoreP.h b/xc/lib/Xt/CoreP.h
deleted file mode 100644
index 0773a9650..000000000
--- a/xc/lib/Xt/CoreP.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-* $TOG: CoreP.h /main/18 1998/02/06 13:20:55 kaleb $
-* $oHeader: CoreP.h,v 1.2 88/08/18 15:54:37 asente Exp $
-*/
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef XtCoreP_h
-#define XtCoreP_h
-
-#include <X11/Core.h>
-
-externalref int _XtInheritTranslations;
-
-#define XtInheritTranslations ((String) &_XtInheritTranslations)
-#define XtInheritRealize ((XtRealizeProc) _XtInherit)
-#define XtInheritResize ((XtWidgetProc) _XtInherit)
-#define XtInheritExpose ((XtExposeProc) _XtInherit)
-#define XtInheritSetValuesAlmost ((XtAlmostProc) _XtInherit)
-#define XtInheritAcceptFocus ((XtAcceptFocusProc) _XtInherit)
-#define XtInheritQueryGeometry ((XtGeometryHandler) _XtInherit)
-#define XtInheritDisplayAccelerator ((XtStringProc) _XtInherit)
-
-/***************************************************************
- * Widget Core Data Structures
- *
- *
- **************************************************************/
-
-typedef struct _CorePart {
- Widget self; /* pointer to widget itself */
- WidgetClass widget_class; /* pointer to Widget's ClassRec */
- Widget parent; /* parent widget */
- XrmName xrm_name; /* widget resource name quarkified */
- Boolean being_destroyed; /* marked for destroy */
- XtCallbackList destroy_callbacks; /* who to call when widget destroyed */
- XtPointer constraints; /* constraint record */
- Position x, y; /* window position */
- Dimension width, height; /* window dimensions */
- Dimension border_width; /* window border width */
- Boolean managed; /* is widget geometry managed? */
- Boolean sensitive; /* is widget sensitive to user events*/
- Boolean ancestor_sensitive; /* are all ancestors sensitive? */
- XtEventTable event_table; /* private to event dispatcher */
- XtTMRec tm; /* translation management */
- XtTranslations accelerators; /* accelerator translations */
- Pixel border_pixel; /* window border pixel */
- Pixmap border_pixmap; /* window border pixmap or NULL */
- WidgetList popup_list; /* list of popups */
- Cardinal num_popups; /* how many popups */
- String name; /* widget resource name */
- Screen *screen; /* window's screen */
- Colormap colormap; /* colormap */
- Window window; /* window ID */
- Cardinal depth; /* number of planes in window */
- Pixel background_pixel; /* window background pixel */
- Pixmap background_pixmap; /* window background pixmap or NULL */
- Boolean visible; /* is window mapped and not occluded?*/
- Boolean mapped_when_managed;/* map window if it's managed? */
-} CorePart;
-
-typedef struct _WidgetRec {
- CorePart core;
- } WidgetRec, CoreRec;
-
-
-
-/******************************************************************
- *
- * Core Class Structure. Widgets, regardless of their class, will have
- * these fields. All widgets of a given class will have the same values
- * for these fields. Widgets of a given class may also have additional
- * common fields. These additional fields are included in incremental
- * class structures, such as CommandClass.
- *
- * The fields that are specific to this subclass, as opposed to fields that
- * are part of the superclass, are called "subclass fields" below. Many
- * procedures are responsible only for the subclass fields, and not for
- * any superclass fields.
- *
- ********************************************************************/
-
-typedef struct _CoreClassPart {
- WidgetClass superclass; /* pointer to superclass ClassRec */
- String class_name; /* widget resource class name */
- Cardinal widget_size; /* size in bytes of widget record */
- XtProc class_initialize; /* class initialization proc */
- XtWidgetClassProc class_part_initialize; /* dynamic initialization */
- XtEnum class_inited; /* has class been initialized? */
- XtInitProc initialize; /* initialize subclass fields */
- XtArgsProc initialize_hook; /* notify that initialize called */
- XtRealizeProc realize; /* XCreateWindow for widget */
- XtActionList actions; /* widget semantics name to proc map */
- Cardinal num_actions; /* number of entries in actions */
- XtResourceList resources; /* resources for subclass fields */
- Cardinal num_resources; /* number of entries in resources */
- XrmClass xrm_class; /* resource class quarkified */
- Boolean compress_motion; /* compress MotionNotify for widget */
- XtEnum compress_exposure; /* compress Expose events for widget*/
- Boolean compress_enterleave;/* compress enter and leave events */
- Boolean visible_interest; /* select for VisibilityNotify */
- XtWidgetProc destroy; /* free data for subclass pointers */
- XtWidgetProc resize; /* geom manager changed widget size */
- XtExposeProc expose; /* rediplay window */
- XtSetValuesFunc set_values; /* set subclass resource values */
- XtArgsFunc set_values_hook; /* notify that set_values called */
- XtAlmostProc set_values_almost; /* set_values got "Almost" geo reply */
- XtArgsProc get_values_hook; /* notify that get_values called */
- XtAcceptFocusProc accept_focus; /* assign input focus to widget */
- XtVersionType version; /* version of intrinsics used */
- XtPointer callback_private; /* list of callback offsets */
- String tm_table; /* state machine */
- XtGeometryHandler query_geometry; /* return preferred geometry */
- XtStringProc display_accelerator;/* display your accelerator */
- XtPointer extension; /* pointer to extension record */
- } CoreClassPart;
-
-typedef struct _WidgetClassRec {
- CoreClassPart core_class;
-} WidgetClassRec, CoreClassRec;
-
-externalref WidgetClassRec widgetClassRec;
-#define coreClassRec widgetClassRec
-
-#endif /* _XtCoreP_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/Create.c b/xc/lib/Xt/Create.c
deleted file mode 100644
index 3885d8df0..000000000
--- a/xc/lib/Xt/Create.c
+++ /dev/null
@@ -1,824 +0,0 @@
-/* $TOG: Create.c /main/83 1998/02/06 13:21:11 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Create.c,v 3.6 1998/12/20 11:57:08 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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 "IntrinsicI.h"
-#include "VarargsI.h"
-#include "ShellP.h"
-#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
-#include "ResConfigP.h"
-#endif
-#include <stdio.h>
-
-static String XtNxtCreateWidget = "xtCreateWidget";
-static String XtNxtCreatePopupShell = "xtCreatePopupShell";
-
-static void
-CallClassPartInit(ancestor, wc)
- WidgetClass ancestor, wc;
-{
- if (ancestor->core_class.superclass != NULL) {
- CallClassPartInit(ancestor->core_class.superclass, wc);
- }
- if (ancestor->core_class.class_part_initialize != NULL) {
- (*(ancestor->core_class.class_part_initialize)) (wc);
- }
-}
-
-void
-XtInitializeWidgetClass(wc)
- WidgetClass wc;
-{
- XtEnum inited;
- LOCK_PROCESS;
- if (wc->core_class.class_inited) {
- UNLOCK_PROCESS;
- return;
- }
- inited = 0x01;
- {
- WidgetClass pc;
-#define LeaveIfClass(c, d) if (pc == c) { inited = d; break; }
- for (pc = wc; pc; pc = pc->core_class.superclass) {
- LeaveIfClass(rectObjClass, 0x01 |
- RectObjClassFlag);
- LeaveIfClass(coreWidgetClass, 0x01 |
- RectObjClassFlag |
- WidgetClassFlag);
- LeaveIfClass(compositeWidgetClass, 0x01 |
- RectObjClassFlag |
- WidgetClassFlag |
- CompositeClassFlag);
- LeaveIfClass(constraintWidgetClass, 0x01 |
- RectObjClassFlag |
- WidgetClassFlag |
- CompositeClassFlag |
- ConstraintClassFlag);
- LeaveIfClass(shellWidgetClass, 0x01 |
- RectObjClassFlag |
- WidgetClassFlag |
- CompositeClassFlag |
- ShellClassFlag);
- LeaveIfClass(wmShellWidgetClass, 0x01 |
- RectObjClassFlag |
- WidgetClassFlag |
- CompositeClassFlag |
- ShellClassFlag |
- WMShellClassFlag);
- LeaveIfClass(topLevelShellWidgetClass, 0x01 |
- RectObjClassFlag |
- WidgetClassFlag |
- CompositeClassFlag |
- ShellClassFlag |
- WMShellClassFlag |
- TopLevelClassFlag);
- }
-#undef LeaveIfClass
- }
- if (wc->core_class.version != XtVersion &&
- wc->core_class.version != XtVersionDontCheck) {
- String param[3];
- String mismatch = "Widget class %s version mismatch (recompilation needed):\n widget %d vs. intrinsics %d.";
- String recompile = "Widget class %s must be re-compiled.";
- Cardinal num_params;
-
- param[0] = wc->core_class.class_name;
- param[1] = (String) wc->core_class.version;
- param[2] = (String) XtVersion;
-
- if (wc->core_class.version == (11 * 1000 + 5) || /* MIT X11R5 */
- wc->core_class.version == (11 * 1000 + 4)) { /* MIT X11R4 */
- if ((inited & WMShellClassFlag) &&
- (sizeof(Boolean) != sizeof(char) ||
- sizeof(Atom) != sizeof(Widget) ||
- sizeof(Atom) != sizeof(String))) {
- num_params=3;
- XtWarningMsg("versionMismatch","widget",XtCXtToolkitError,
- mismatch, param, &num_params);
- num_params=1;
- XtErrorMsg("R4orR5versionMismatch","widget",XtCXtToolkitError,
- recompile, param, &num_params);
-
- }
- }
- else if (wc->core_class.version == (11 * 1000 + 3)) { /* MIT X11R3 */
- if (inited & ShellClassFlag) {
- num_params=1;
- XtWarningMsg("r3versionMismatch","widget",XtCXtToolkitError,
- "Shell Widget class %s binary compiled for R3",
- param,&num_params);
- XtErrorMsg("R3versionMismatch","widget",XtCXtToolkitError,
- recompile, param, &num_params);
- }
- }
- else {
- num_params=3;
- XtWarningMsg("versionMismatch","widget",XtCXtToolkitError,
- mismatch, param, &num_params);
- if (wc->core_class.version == (2 * 1000 + 2)) /* MIT X11R2 */ {
- num_params=1;
- XtErrorMsg("r2versionMismatch","widget",XtCXtToolkitError,
- recompile, param, &num_params);
- }
- }
- }
-
- if ((wc->core_class.superclass != NULL)
- && (!(wc->core_class.superclass->core_class.class_inited)))
- XtInitializeWidgetClass(wc->core_class.superclass);
-
- if (wc->core_class.class_initialize != NULL)
- (*(wc->core_class.class_initialize))();
- CallClassPartInit(wc, wc);
- wc->core_class.class_inited = inited;
- UNLOCK_PROCESS;
-}
-
-static void
-CallInitialize (class, req_widget, new_widget, args, num_args)
- WidgetClass class;
- Widget req_widget;
- Widget new_widget;
- ArgList args;
- Cardinal num_args;
-{
- WidgetClass superclass;
- XtInitProc initialize;
- XtArgsProc initialize_hook;
-
- LOCK_PROCESS;
- superclass = class->core_class.superclass;
- UNLOCK_PROCESS;
- if (superclass)
- CallInitialize (superclass, req_widget, new_widget, args, num_args);
- LOCK_PROCESS;
- initialize = class->core_class.initialize;
- UNLOCK_PROCESS;
- if (initialize)
- (*initialize) (req_widget, new_widget, args, &num_args);
- LOCK_PROCESS;
- initialize_hook = class->core_class.initialize_hook;
- UNLOCK_PROCESS;
- if (initialize_hook)
- (*initialize_hook) (new_widget, args, &num_args);
-}
-
-static void
-CallConstraintInitialize (class, req_widget, new_widget, args, num_args)
- ConstraintWidgetClass class;
- Widget req_widget, new_widget;
- ArgList args;
- Cardinal num_args;
-{
- WidgetClass superclass;
- XtInitProc initialize;
-
- LOCK_PROCESS;
- superclass = class->core_class.superclass;
- UNLOCK_PROCESS;
- if (superclass != constraintWidgetClass)
- CallConstraintInitialize((ConstraintWidgetClass) superclass,
- req_widget, new_widget, args, num_args);
- LOCK_PROCESS;
- initialize = class->constraint_class.initialize;
- UNLOCK_PROCESS;
- if (initialize)
- (*initialize) (req_widget, new_widget, args, &num_args);
-}
-
-static Widget
-xtWidgetAlloc(widget_class, parent_constraint_class, parent, name,
- args, num_args, typed_args, num_typed_args)
- WidgetClass widget_class;
- ConstraintWidgetClass parent_constraint_class;
- Widget parent;
- String name;
- ArgList args; /* must be NULL if typed_args is non-NULL */
- Cardinal num_args;
- XtTypedArgList typed_args; /* must be NULL if args is non-NULL */
- Cardinal num_typed_args;
-{
- Widget widget;
- Cardinal wsize, csize = 0;
- ObjectClassExtension ext;
-
- LOCK_PROCESS;
- if (! (widget_class->core_class.class_inited))
- XtInitializeWidgetClass(widget_class);
- ext = (ObjectClassExtension)
- XtGetClassExtension(widget_class,
- XtOffsetOf(ObjectClassRec, object_class.extension),
- NULLQUARK, XtObjectExtensionVersion,
- sizeof(ObjectClassExtensionRec));
- if (parent_constraint_class)
- csize = parent_constraint_class->constraint_class.constraint_size;
- if (ext && ext->allocate) {
- XtAllocateProc allocate;
- Cardinal extra = 0;
- Cardinal nargs = num_args;
- Cardinal ntyped = num_typed_args;
- allocate = ext->allocate;
- UNLOCK_PROCESS;
- (*allocate)(widget_class, &csize, &extra, args, &nargs,
- typed_args, &ntyped, &widget, NULL);
- } else {
- wsize = widget_class->core_class.widget_size;
- UNLOCK_PROCESS;
- if (csize) {
- if (sizeof(struct {char a; double b;}) !=
- (sizeof(struct {char a; unsigned long b;}) -
- sizeof(unsigned long) + sizeof(double))) {
- if (csize && !(csize & (sizeof(double) - 1)))
- wsize = (wsize + sizeof(double) - 1) & ~(sizeof(double)-1);
- }
- }
- widget = (Widget) __XtMalloc((unsigned)(wsize + csize));
- widget->core.constraints =
- (csize ? (XtPointer)((char *)widget + wsize) : NULL);
- }
- widget->core.self = widget;
- widget->core.parent = parent;
- widget->core.widget_class = widget_class;
- widget->core.xrm_name = StringToName((name != NULL) ? name : "");
- widget->core.being_destroyed =
- (parent != NULL ? parent->core.being_destroyed : FALSE);
- return widget;
-}
-
-static void
-CompileCallbacks(widget)
- Widget widget;
-{
- CallbackTable offsets;
- InternalCallbackList* cl;
- int i;
-
- LOCK_PROCESS;
- offsets = (CallbackTable)
- widget->core.widget_class->core_class.callback_private;
-
- for (i = (int)(long) *(offsets++); --i >= 0; offsets++) {
- cl = (InternalCallbackList *)
- ((char *) widget - (*offsets)->xrm_offset - 1);
- if (*cl)
- *cl = _XtCompileCallbackList((XtCallbackList) *cl);
- }
- UNLOCK_PROCESS;
-}
-
-static Widget
-xtCreate(name, class, widget_class, parent, default_screen,
- args, num_args, typed_args, num_typed_args, parent_constraint_class,
- post_proc)
- char *name, *class;
- WidgetClass widget_class;
- Widget parent;
- Screen* default_screen; /* undefined when creating a nonwidget */
- ArgList args; /* must be NULL if typed_args is non-NULL */
- Cardinal num_args;
- XtTypedArgList typed_args; /* must be NULL if args is non-NULL */
- Cardinal num_typed_args;
- ConstraintWidgetClass parent_constraint_class;
- /* NULL if not a subclass of Constraint or if child is popup shell */
- XtWidgetProc post_proc;
-{
- /* need to use strictest alignment rules possible in next two decls. */
- double widget_cache[100];
- double constraint_cache[20];
- Widget req_widget;
- XtPointer req_constraints;
- Cardinal wsize, csize;
- Widget widget;
- XtCacheRef *cache_refs;
- int i;
- XtCreateHookDataRec call_data;
-
- widget = xtWidgetAlloc(widget_class, parent_constraint_class, parent,
- name, args, num_args, typed_args, num_typed_args);
-
- if (XtIsRectObj(widget)) {
- widget->core.managed = FALSE;
- }
- if (XtIsWidget(widget)) {
- widget->core.name = XrmNameToString(widget->core.xrm_name);
- widget->core.screen = default_screen;
- widget->core.tm.translations = NULL;
- widget->core.window = (Window) 0;
- widget->core.visible = TRUE;
- widget->core.popup_list = NULL;
- widget->core.num_popups = 0;
- };
- LOCK_PROCESS;
- if (XtIsApplicationShell(widget)) {
- ApplicationShellWidget a = (ApplicationShellWidget) widget;
- if (class != NULL)
- a->application.xrm_class = StringToClass(class);
- else
- a->application.xrm_class = widget_class->core_class.xrm_class;
- a->application.class = XrmQuarkToString(a->application.xrm_class);
- }
- UNLOCK_PROCESS;
-
- /* fetch resources */
- cache_refs = _XtGetResources(widget, args, num_args,
- typed_args, &num_typed_args);
-
- /* Convert typed arg list to arg list */
- if (typed_args != NULL && num_typed_args > 0) {
- args = (ArgList)ALLOCATE_LOCAL(sizeof(Arg) * num_typed_args);
- if (args == NULL) _XtAllocError(NULL);
- for (i = 0; i < num_typed_args; i++) {
- args[i].name = typed_args[i].name;
- args[i].value = typed_args[i].value;
- }
- num_args = num_typed_args;
- }
-
- CompileCallbacks(widget);
-
- if (cache_refs != NULL) {
- XtAddCallback(widget, XtNdestroyCallback,
- XtCallbackReleaseCacheRefList, (XtPointer)cache_refs );
- }
-
- wsize = widget_class->core_class.widget_size;
- csize = 0;
- req_widget = (Widget) XtStackAlloc(wsize, widget_cache);
- (void) memmove ((char *) req_widget, (char *) widget, (int) wsize);
- CallInitialize (XtClass(widget), req_widget, widget, args, num_args);
- if (parent_constraint_class != NULL) {
- csize = parent_constraint_class->constraint_class.constraint_size;
- if (csize) {
- req_constraints = XtStackAlloc(csize, constraint_cache);
- (void) memmove((char*)req_constraints, widget->core.constraints,
- (int)csize);
- req_widget->core.constraints = req_constraints;
- } else req_widget->core.constraints = NULL;
- CallConstraintInitialize(parent_constraint_class, req_widget, widget,
- args, num_args);
- if (csize) XtStackFree(req_constraints, constraint_cache);
- }
- XtStackFree((XtPointer)req_widget, widget_cache);
- if (post_proc != (XtWidgetProc) NULL) {
- Widget hookobj;
- (*post_proc)(widget);
- hookobj = XtHooksOfDisplay((default_screen != (Screen*) NULL) ?
- default_screen->display :
- XtDisplayOfObject(parent));
- if (XtHasCallbacks(hookobj, XtNcreateHook) == XtCallbackHasSome) {
-
- call_data.type = XtHcreate;
- call_data.widget = widget;
- call_data.args = args;
- call_data.num_args = num_args;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.createhook_callbacks,
- (XtPointer)&call_data);
- }
- }
- if (typed_args != NULL) {
- while (num_typed_args-- > 0) {
-
- /* In GetResources we may have dynamically alloc'd store to hold */
- /* a copy of a resource which was larger then sizeof(XtArgVal). */
- /* We must free this store now in order to prevent a memory leak */
- /* A typed arg that has a converted value in dynamic store has a */
- /* negated size field. */
-
- if (typed_args->type != NULL && typed_args->size < 0) {
- XtFree((char*)typed_args->value);
- typed_args->size = -(typed_args->size);
- }
- typed_args++;
- }
- DEALLOCATE_LOCAL((char*)args);
- }
- return (widget);
-}
-
-static void
-widgetPostProc(w)
- Widget w;
-{
- XtWidgetProc insert_child;
- Widget parent = XtParent(w);
- String param = XtName(w);
- Cardinal num_params = 1;
-
- if (XtIsComposite(parent)) {
- LOCK_PROCESS;
- insert_child = ((CompositeWidgetClass) parent->core.widget_class)->
- composite_class.insert_child;
- UNLOCK_PROCESS;
- } else {
- return;
- }
- if (insert_child == NULL) {
- XtAppErrorMsg(XtWidgetToApplicationContext(parent),
- "nullProc","insertChild",XtCXtToolkitError,
- "\"%s\" parent has NULL insert_child method",
- &param, &num_params);
- } else {
- (*insert_child) (w);
- }
-}
-
-Widget
-_XtCreateWidget(name, widget_class, parent,
- args, num_args, typed_args, num_typed_args)
- String name;
- WidgetClass widget_class;
- Widget parent;
- ArgList args;
- Cardinal num_args;
- XtTypedArgList typed_args;
- Cardinal num_typed_args;
-{
- register Widget widget;
- ConstraintWidgetClass cwc;
- Screen* default_screen;
- XtEnum class_inited;
- String params[3];
- Cardinal num_params;
-
- params[0] = name;
- num_params = 1;
-
- if (parent == NULL) {
- XtErrorMsg("invalidParent", XtNxtCreateWidget, XtCXtToolkitError,
- "XtCreateWidget \"%s\" requires non-NULL parent",
- params, &num_params);
- } else if (widget_class == NULL) {
- XtAppErrorMsg(XtWidgetToApplicationContext(parent),
- "invalidClass", XtNxtCreateWidget, XtCXtToolkitError,
- "XtCreateWidget \"%s\" requires non-NULL widget class",
- params, &num_params);
- }
- LOCK_PROCESS;
- if (!widget_class->core_class.class_inited)
- XtInitializeWidgetClass(widget_class);
- class_inited = widget_class->core_class.class_inited;
- UNLOCK_PROCESS;
- if ((class_inited & WidgetClassFlag) == 0) {
- /* not a widget */
- default_screen = NULL;
- if (XtIsComposite(parent)) {
- CompositeClassExtension ext;
- ext = (CompositeClassExtension)
- XtGetClassExtension(XtClass(parent),
- XtOffsetOf(CompositeClassRec, composite_class.extension),
- NULLQUARK, 1L, (Cardinal) 0);
- LOCK_PROCESS;
- if (ext &&
- (ext->version > XtCompositeExtensionVersion ||
- ext->record_size > sizeof(CompositeClassExtensionRec))) {
- params[1] = XtClass(parent)->core_class.class_name;
- num_params = 2;
- XtAppWarningMsg(XtWidgetToApplicationContext(parent),
- "invalidExtension", XtNxtCreateWidget,
- XtCXtToolkitError,
- "widget \"%s\" class %s has invalid CompositeClassExtension record",
- params, &num_params);
- }
- if (!ext || !ext->accepts_objects) {
- params[1] = XtName(parent);
- num_params = 2;
- XtAppErrorMsg(XtWidgetToApplicationContext(parent),
- "nonWidget", XtNxtCreateWidget,XtCXtToolkitError,
-"attempt to add non-widget child \"%s\" to parent \"%s\" which supports only widgets",
- params, &num_params);
- }
- UNLOCK_PROCESS;
- }
- } else {
- default_screen = parent->core.screen;
- }
-
- if (XtIsConstraint(parent)) {
- cwc = (ConstraintWidgetClass) parent->core.widget_class;
- } else {
- cwc = NULL;
- }
- widget = xtCreate(name, (char *)NULL, widget_class, parent,
- default_screen, args, num_args,
- typed_args, num_typed_args, cwc, widgetPostProc);
- return (widget);
-}
-
-#if NeedFunctionPrototypes
-Widget
-XtCreateWidget(
- _Xconst char* name,
- WidgetClass widget_class,
- Widget parent,
- ArgList args,
- Cardinal num_args
- )
-#else
-Widget
-XtCreateWidget(name, widget_class, parent, args, num_args)
- String name;
- WidgetClass widget_class;
- Widget parent;
- ArgList args;
- Cardinal num_args;
-#endif
-{
- Widget retval;
- WIDGET_TO_APPCON(parent);
-
- LOCK_APP(app);
- retval = _XtCreateWidget(name, widget_class, parent, args, num_args,
- (XtTypedArgList)NULL, (Cardinal)0);
- UNLOCK_APP(app);
- return retval;
-}
-
-
-#if NeedFunctionPrototypes
-Widget
-XtCreateManagedWidget(
- _Xconst char* name,
- WidgetClass widget_class,
- Widget parent,
- ArgList args,
- Cardinal num_args
- )
-#else
-Widget
-XtCreateManagedWidget(name, widget_class, parent, args, num_args)
- String name;
- WidgetClass widget_class;
- Widget parent;
- ArgList args;
- Cardinal num_args;
-#endif
-{
- register Widget widget;
- WIDGET_TO_APPCON(parent);
-
- LOCK_APP(app);
- XtCheckSubclass(parent, compositeWidgetClass, "in XtCreateManagedWidget");
- widget = _XtCreateWidget(name, widget_class, parent, args, num_args,
- (XtTypedArgList)NULL, (Cardinal) 0);
- XtManageChild(widget);
- UNLOCK_APP(app);
- return widget;
-}
-
-static void
-popupPostProc(w)
- Widget w;
-{
- Widget parent = XtParent(w);
-
- parent->core.popup_list =
- (WidgetList) XtRealloc((char*) parent->core.popup_list,
- (unsigned) (parent->core.num_popups+1) * sizeof(Widget));
- parent->core.popup_list[parent->core.num_popups++] = w;
-}
-
-Widget
-_XtCreatePopupShell(name, widget_class, parent, args, num_args,
- typed_args, num_typed_args)
- String name;
- WidgetClass widget_class;
- Widget parent;
- ArgList args;
- Cardinal num_args;
- XtTypedArgList typed_args;
- Cardinal num_typed_args;
-{
- register Widget widget;
- Screen* default_screen;
-
- if (parent == NULL) {
- XtErrorMsg("invalidParent",XtNxtCreatePopupShell,XtCXtToolkitError,
- "XtCreatePopupShell requires non-NULL parent",
- (String *)NULL, (Cardinal *)NULL);
- } else if (widget_class == NULL) {
- XtAppErrorMsg(XtWidgetToApplicationContext(parent),
- "invalidClass",XtNxtCreatePopupShell,XtCXtToolkitError,
- "XtCreatePopupShell requires non-NULL widget class",
- (String *)NULL, (Cardinal *)NULL);
- }
- XtCheckSubclass(parent, coreWidgetClass, "in XtCreatePopupShell");
- default_screen = parent->core.screen;
- widget = xtCreate(name, (char *)NULL, widget_class, parent,
- default_screen, args, num_args, typed_args,
- num_typed_args, (ConstraintWidgetClass)NULL,
- popupPostProc);
-
-#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
- XtAddEventHandler (widget, (EventMask) PropertyChangeMask, FALSE,
- (XtEventHandler) _XtResourceConfigurationEH, NULL);
-#endif
- return(widget);
-}
-
-#if NeedFunctionPrototypes
-Widget
-XtCreatePopupShell(
- _Xconst char* name,
- WidgetClass widget_class,
- Widget parent,
- ArgList args,
- Cardinal num_args
- )
-#else
-Widget
-XtCreatePopupShell(name, widget_class, parent, args, num_args)
- String name;
- WidgetClass widget_class;
- Widget parent;
- ArgList args;
- Cardinal num_args;
-#endif
-{
- Widget retval;
- WIDGET_TO_APPCON(parent);
-
- LOCK_APP(app);
- retval = _XtCreatePopupShell(name, widget_class, parent, args, num_args,
- (XtTypedArgList)NULL, (Cardinal)0);
- UNLOCK_APP(app);
- return retval;
-}
-
-Widget
-_XtAppCreateShell(name, class, widget_class, display, args, num_args,
- typed_args, num_typed_args)
- String name, class;
- WidgetClass widget_class;
- Display* display;
- ArgList args;
- Cardinal num_args;
- XtTypedArgList typed_args;
- Cardinal num_typed_args;
-{
- Widget shell;
-
- if (widget_class == NULL) {
- XtAppErrorMsg(XtDisplayToApplicationContext(display),
- "invalidClass","xtAppCreateShell",XtCXtToolkitError,
- "XtAppCreateShell requires non-NULL widget class",
- (String *)NULL, (Cardinal *)NULL);
- }
- if (name == NULL)
- name = XrmNameToString(_XtGetPerDisplay(display)->name);
- shell = xtCreate(name, class, widget_class, (Widget)NULL,
- (Screen*)DefaultScreenOfDisplay(display),
- args, num_args, typed_args, num_typed_args,
- (ConstraintWidgetClass) NULL, _XtAddShellToHookObj);
-
-#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
- XtAddEventHandler (shell, (EventMask) PropertyChangeMask, FALSE,
- (XtEventHandler) _XtResourceConfigurationEH, NULL);
-#endif
-
- return shell;
-}
-
-#if NeedFunctionPrototypes
-Widget
-XtAppCreateShell(
- _Xconst char* name,
- _Xconst char* class,
- WidgetClass widget_class,
- Display *display,
- ArgList args,
- Cardinal num_args
- )
-#else
-Widget
-XtAppCreateShell(name, class, widget_class, display, args, num_args)
- String name, class;
- WidgetClass widget_class;
- Display *display;
- ArgList args;
- Cardinal num_args;
-#endif
-{
- Widget retval;
- DPY_TO_APPCON(display);
-
- LOCK_APP(app);
- retval = _XtAppCreateShell(name, class, widget_class, display, args,
- num_args, (XtTypedArgList)NULL, (Cardinal)0);
- UNLOCK_APP(app);
- return retval;
-}
-
-/* ARGSUSED */
-#if NeedFunctionPrototypes
-Widget
-XtCreateApplicationShell(
- _Xconst char* name, /* unused in R3 and later */
- WidgetClass widget_class,
- ArgList args,
- Cardinal num_args
- )
-#else
-Widget
-XtCreateApplicationShell(name, widget_class, args, num_args)
- String name; /* unused in R3 and later */
- WidgetClass widget_class;
- ArgList args;
- Cardinal num_args;
-#endif
-{
- Widget retval;
- Display* dpy;
- XrmClass class;
- XtAppContext app = _XtDefaultAppContext();
-
- LOCK_APP(app);
- dpy = app->list[0];
- class = _XtGetPerDisplay(dpy)->class;
-
- retval = _XtAppCreateShell((String)NULL, XrmQuarkToString((XrmQuark)class),
- widget_class, dpy, args, num_args,
- (XtTypedArgList)NULL, (Cardinal)0);
- UNLOCK_APP(app);
- return retval;
-}
-
-Widget
-_XtCreateHookObj(screen)
- Screen* screen;
-{
- Widget req_widget;
- double widget_cache[100];
- Cardinal wsize = 0;
- Widget hookobj = xtWidgetAlloc(hookObjectClass,
- (ConstraintWidgetClass)NULL,
- (Widget)NULL, "hooks",
- (ArgList)NULL, (Cardinal)0,
- (XtTypedArgList)NULL, (Cardinal)0);
-
- ((HookObject)hookobj)->hooks.screen = screen;
- (void) _XtGetResources(hookobj, (ArgList)NULL, 0,
- (XtTypedArgList)NULL, &wsize);
- CompileCallbacks(hookobj);
- wsize = hookObjectClass->core_class.widget_size;
- req_widget = (Widget) XtStackAlloc(wsize, widget_cache);
- (void) memmove ((char *) req_widget, (char *) hookobj, (int) wsize);
- CallInitialize (hookObjectClass, req_widget, hookobj,
- (ArgList)NULL, (Cardinal) 0);
- XtStackFree((XtPointer)req_widget, widget_cache);
- return hookobj;
-}
diff --git a/xc/lib/Xt/Destroy.c b/xc/lib/Xt/Destroy.c
deleted file mode 100644
index a7633600f..000000000
--- a/xc/lib/Xt/Destroy.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/* $TOG: Destroy.c /main/49 1998/02/06 13:21:18 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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 "IntrinsicI.h"
-
-struct _DestroyRec {
- int dispatch_level;
- Widget widget;
-};
-
-static void Recursive(widget, proc)
- Widget widget;
- XtWidgetProc proc;
-{
- register int i;
- CompositePart *cwp;
-
- /* Recurse down normal children */
- if (XtIsComposite(widget)) {
- cwp = &(((CompositeWidget) widget)->composite);
- for (i = 0; i < cwp->num_children; i++) {
- Recursive(cwp->children[i], proc);
- }
- }
-
- /* Recurse down popup children */
- if (XtIsWidget(widget)) {
- for (i = 0; i < widget->core.num_popups; i++) {
- Recursive(widget->core.popup_list[i], proc);
- }
- }
-
- /* Finally, apply procedure to this widget */
- (*proc) (widget);
-} /* Recursive */
-
-static void Phase1Destroy (widget)
- Widget widget;
-{
- Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
-
- widget->core.being_destroyed = TRUE;
- if (XtHasCallbacks(hookobj, XtNdestroyHook) == XtCallbackHasSome) {
- XtDestroyHookDataRec call_data;
-
- call_data.type = XtHdestroy;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.destroyhook_callbacks,
- (XtPointer) &call_data);
- }
-} /* Phase1Destroy */
-
-static void Phase2Callbacks(widget)
- Widget widget;
-{
- if (widget->core.destroy_callbacks != NULL) {
- XtCallCallbackList(widget,
- widget->core.destroy_callbacks, (XtPointer) NULL);
- }
-} /* Phase2Callbacks */
-
-static void Phase2Destroy(widget)
- register Widget widget;
-{
- register WidgetClass class;
- register ConstraintWidgetClass cwClass;
- ObjectClassExtension ext;
-
- /* Call constraint destroy procedures */
- if (XtParent(widget) != NULL && !XtIsShell(widget) && XtIsConstraint(XtParent(widget))) {
- LOCK_PROCESS;
- cwClass = (ConstraintWidgetClass)XtParent(widget)->core.widget_class;
- UNLOCK_PROCESS;
- for (;;) {
- XtWidgetProc destroy;
-
- LOCK_PROCESS;
- destroy = cwClass->constraint_class.destroy;
- UNLOCK_PROCESS;
- if (destroy)
- (*destroy) (widget);
- if (cwClass == (ConstraintWidgetClass)constraintWidgetClass) break;
- LOCK_PROCESS;
- cwClass = (ConstraintWidgetClass) cwClass->core_class.superclass;
- UNLOCK_PROCESS;
- }
- }
-
- /* Call widget destroy procedures */
- LOCK_PROCESS;
- for (class = widget->core.widget_class;
- class != NULL;
- class = class->core_class.superclass) {
- XtWidgetProc destroy;
-
- destroy = class->core_class.destroy;
- UNLOCK_PROCESS;
- if (destroy)
- (*destroy) (widget);
- LOCK_PROCESS;
- }
-
- /* Call widget deallocate procedure */
- ext = (ObjectClassExtension)
- XtGetClassExtension(widget->core.widget_class,
- XtOffsetOf(CoreClassPart, extension),
- NULLQUARK, XtObjectExtensionVersion,
- sizeof(ObjectClassExtensionRec));
- if (ext && ext->deallocate) {
- XtDeallocateProc deallocate;
- deallocate = ext->deallocate;
- UNLOCK_PROCESS;
- (*deallocate)(widget, NULL);
- } else {
- UNLOCK_PROCESS;
- XtFree((char *)widget);
- }
-} /* Phase2Destroy */
-
-static Boolean IsDescendant(widget, root)
- register Widget widget, root;
-{
- while ((widget = XtParent(widget)) != root) {
- if (widget == NULL) return False;
- }
- return True;
-}
-
-static void XtPhase2Destroy (widget)
- register Widget widget;
-{
- Display *display;
- Window window;
- Widget parent;
- XtAppContext app = XtWidgetToApplicationContext(widget);
- Widget outerInPhase2Destroy = app->in_phase2_destroy;
- int starting_count = app->destroy_count;
- Boolean isPopup = False;
-
- /* invalidate focus trace cache for this display */
- _XtGetPerDisplay(XtDisplayOfObject(widget))->pdi.traceDepth = 0;
-
- parent = widget->core.parent;
-
- if (parent && XtIsWidget(parent) && parent->core.num_popups) {
- int i;
- for (i = 0; i < parent->core.num_popups; i++) {
- if (parent->core.popup_list[i] == widget) {
- isPopup = True;
- break;
- }
- }
- }
-
- if (!isPopup && parent && XtIsComposite(parent)) {
- XtWidgetProc delete_child;
-
- LOCK_PROCESS;
- delete_child =
- ((CompositeWidgetClass) parent->core.widget_class)->
- composite_class.delete_child;
- UNLOCK_PROCESS;
- if (XtIsRectObj(widget)) {
- XtUnmanageChild(widget);
- }
- if (delete_child == NULL) {
- String param;
- Cardinal num_params = 1;
-
- LOCK_PROCESS;
- param = parent->core.widget_class->core_class.class_name;
- UNLOCK_PROCESS;
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidProcedure","deleteChild",XtCXtToolkitError,
- "null delete_child procedure for class %s in XtDestroy",
- &param, &num_params);
- } else {
- (*delete_child) (widget);
- }
- }
-
- /* widget is freed in Phase2Destroy, so retrieve window now.
- * Shells destroy their own windows, to prevent window leaks in
- * popups; this test is practical only when XtIsShell() is cheap.
- */
- if (XtIsShell(widget) || !XtIsWidget(widget)) {
- window = 0;
-#ifdef lint
- display = 0;
-#endif
- }
- else {
- display = XtDisplay(widget);
- window = widget->core.window;
- }
-
- Recursive(widget, Phase2Callbacks);
- if (app->destroy_count > starting_count) {
- int i = starting_count;
- while (i < app->destroy_count) {
-
- DestroyRec * dr = app->destroy_list + i;
- if (IsDescendant(dr->widget, widget)) {
- Widget descendant = dr->widget;
- register int j;
- app->destroy_count--;
- for (j = app->destroy_count - i; --j >= 0; dr++)
- *dr = *(dr + 1);
- XtPhase2Destroy(descendant);
- }
- else i++;
- }
- }
-
- app->in_phase2_destroy = widget;
- Recursive(widget, Phase2Destroy);
- app->in_phase2_destroy = outerInPhase2Destroy;
-
- if (isPopup) {
- int i;
- for (i = 0; i < parent->core.num_popups; i++)
- if (parent->core.popup_list[i] == widget) {
- parent->core.num_popups--;
- while (i < parent->core.num_popups) {
- parent->core.popup_list[i] = parent->core.popup_list[i+1];
- i++;
- }
- break;
- }
- }
-
- /* %%% the following parent test hides a more serious problem,
- but it avoids breaking those who depended on the old bug
- until we have time to fix it properly. */
-
- if (window && (parent == NULL || !parent->core.being_destroyed))
- XDestroyWindow(display, window);
-} /* XtPhase2Destroy */
-
-
-void _XtDoPhase2Destroy(app, dispatch_level)
- XtAppContext app;
- int dispatch_level;
-{
- /* Phase 2 must occur in fifo order. List is not necessarily
- * contiguous in dispatch_level.
- */
-
- int i = 0;
- while (i < app->destroy_count) {
-
- /* XtPhase2Destroy can result in calls to XtDestroyWidget,
- * and these could cause app->destroy_list to be reallocated.
- */
-
- DestroyRec* dr = app->destroy_list + i;
- if (dr->dispatch_level >= dispatch_level) {
- Widget w = dr->widget;
- register int j;
- app->destroy_count--;
- for (j = app->destroy_count - i; --j >=0; dr++)
- *dr = *(dr + 1);
- XtPhase2Destroy(w);
- }
- else i++;
- }
-}
-
-
-void XtDestroyWidget (widget)
- Widget widget;
-{
- XtAppContext app;
- DestroyRec *dr, *dr2;
-
- app = XtWidgetToApplicationContext(widget);
- LOCK_APP(app);
- if (widget->core.being_destroyed) {
- UNLOCK_APP(app);
- return;
- }
- Recursive(widget, Phase1Destroy);
-
- if (app->in_phase2_destroy &&
- IsDescendant(widget, app->in_phase2_destroy))
- {
- XtPhase2Destroy(widget);
- UNLOCK_APP(app);
- return;
- }
-
- if (app->destroy_count == app->destroy_list_size) {
- app->destroy_list_size += 10;
- app->destroy_list = (DestroyRec*)
- XtRealloc( (char*)app->destroy_list,
- (unsigned)sizeof(DestroyRec)*app->destroy_list_size
- );
- }
- dr = app->destroy_list + app->destroy_count++;
- dr->dispatch_level = app->dispatch_level;
- dr->widget = widget;
-
- if (app->dispatch_level > 1) {
- int i;
- for (i = app->destroy_count - 1; i;) {
- /* this handles only one case of nesting difficulties */
- dr = app->destroy_list + (--i);
- if (dr->dispatch_level < app->dispatch_level &&
- IsDescendant(dr->widget, widget)) {
- dr2 = app->destroy_list + (app->destroy_count-1);
- dr2->dispatch_level = dr->dispatch_level;
- break;
- }
- }
- }
-
- if (_XtSafeToDestroy(app)) {
- app->dispatch_level = 1; /* avoid nested _XtDoPhase2Destroy */
- _XtDoPhase2Destroy(app, 0);
- app->dispatch_level = 0;
- }
- UNLOCK_APP(app);
-
-} /* XtDestroyWidget */
diff --git a/xc/lib/Xt/Display.c b/xc/lib/Xt/Display.c
deleted file mode 100644
index f83817e8b..000000000
--- a/xc/lib/Xt/Display.c
+++ /dev/null
@@ -1,831 +0,0 @@
-/* $TOG: Display.c /main/116 1998/02/06 13:21:23 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Display.c,v 3.8 1998/10/03 09:06:51 dawes Exp $ */
-
-/*
-
-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 "IntrinsicI.h"
-#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
-#include "ResConfigP.h"
-#endif
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern char* getenv();
-#endif
-
-#ifdef XTHREADS
-void (*_XtProcessLock)() = NULL;
-void (*_XtProcessUnlock)() = NULL;
-void (*_XtInitAppLock)() = NULL;
-#endif
-
-static String XtNnoPerDisplay = "noPerDisplay";
-
-extern void _XtHeapInit();
-extern void _XtHeapFree();
-extern XrmDatabase _XtPreparseCommandLine();
-
-ProcessContext _XtGetProcessContext()
-{
- static ProcessContextRec processContextRec = {
- (XtAppContext)NULL,
- (XtAppContext)NULL,
- (ConverterTable)NULL,
- {(XtLanguageProc)NULL, (XtPointer)NULL}
- };
-
- return &processContextRec;
-}
-
-
-XtAppContext _XtDefaultAppContext()
-{
- ProcessContext process = _XtGetProcessContext();
- XtAppContext app;
-
- LOCK_PROCESS;
- if (process->defaultAppContext == NULL) {
- process->defaultAppContext = XtCreateApplicationContext();
- }
- app = process->defaultAppContext;
- UNLOCK_PROCESS;
- return app;
-}
-
-static void AddToAppContext(d, app)
- Display *d;
- XtAppContext app;
-{
-#define DISPLAYS_TO_ADD 4
-
- if (app->count >= app->max) {
- app->max += DISPLAYS_TO_ADD;
- app->list = (Display **) XtRealloc((char *)app->list,
- (unsigned) app->max * sizeof(Display *));
- }
-
- app->list[app->count++] = d;
- app->rebuild_fdlist = TRUE;
-#ifndef USE_POLL
- if (ConnectionNumber(d) + 1 > app->fds.nfds) {
- app->fds.nfds = ConnectionNumber(d) + 1;
- }
-#else
- app->fds.nfds++;
-#endif
-#undef DISPLAYS_TO_ADD
-}
-
-static void XtDeleteFromAppContext(d, app)
- Display *d;
- register XtAppContext app;
-{
- register int i;
-
- for (i = 0; i < app->count; i++) if (app->list[i] == d) break;
-
- if (i < app->count) {
- if (i <= app->last && app->last > 0) app->last--;
- for (i++; i < app->count; i++) app->list[i-1] = app->list[i];
- app->count--;
- }
- app->rebuild_fdlist = TRUE;
- app->fds.nfds--;
-}
-
-static XtPerDisplay NewPerDisplay(dpy)
- Display *dpy;
-{
- PerDisplayTablePtr pd;
-
- pd = XtNew(PerDisplayTable);
- LOCK_PROCESS;
- pd->dpy = dpy;
- pd->next = _XtperDisplayList;
- _XtperDisplayList = pd;
- UNLOCK_PROCESS;
- return &(pd->perDpy);
-}
-
-static XtPerDisplay InitPerDisplay(dpy, app, name, classname)
- Display *dpy;
- XtAppContext app;
- String name;
- String classname;
-{
- extern void _XtAllocTMContext();
- XtPerDisplay pd;
-
- AddToAppContext(dpy, app);
-
- pd = NewPerDisplay(dpy);
- _XtHeapInit(&pd->heap);
- pd->destroy_callbacks = NULL;
- pd->region = XCreateRegion();
- pd->case_cvt = NULL;
- pd->defaultKeycodeTranslator = XtTranslateKey;
- pd->keysyms_serial = 0;
- pd->keysyms = NULL;
- XDisplayKeycodes(dpy, &pd->min_keycode, &pd->max_keycode);
- pd->modKeysyms = NULL;
- pd->modsToKeysyms = NULL;
- pd->appContext = app;
- pd->name = XrmStringToName(name);
- pd->class = XrmStringToClass(classname);
- pd->being_destroyed = False;
- pd->GClist = NULL;
- pd->pixmap_tab = NULL;
- pd->language = NULL;
- pd->rv = False;
- pd->last_event.xany.serial = 0;
- pd->last_timestamp = 0;
- _XtAllocTMContext(pd);
- pd->mapping_callbacks = NULL;
-
- pd->pdi.grabList = NULL;
- pd->pdi.trace = NULL;
- pd->pdi.traceDepth = 0;
- pd->pdi.traceMax = 0;
- pd->pdi.focusWidget = NULL;
- pd->pdi.activatingKey = 0;
- pd->pdi.keyboard.grabType = XtNoServerGrab;
- pd->pdi.pointer.grabType = XtNoServerGrab;
- _XtAllocWWTable(pd);
- pd->per_screen_db = (XrmDatabase *)__XtCalloc(ScreenCount(dpy),
- sizeof(XrmDatabase));
- pd->cmd_db = (XrmDatabase)NULL;
- pd->server_db = (XrmDatabase)NULL;
- pd->dispatcher_list = NULL;
- pd->ext_select_list = NULL;
- pd->ext_select_count = 0;
- pd->hook_object = NULL;
-#if 0
- pd->hook_object = _XtCreate("hooks", "Hooks", hookObjectClass,
- (Widget)NULL, (Screen*)DefaultScreenOfDisplay(dpy),
- (ArgList)NULL, 0, (XtTypedArgList)NULL, 0,
- (ConstraintWidgetClass)NULL);
-#endif
-
-#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
- pd->rcm_init = XInternAtom (dpy, RCM_INIT, 0);
- pd->rcm_data = XInternAtom (dpy, RCM_DATA, 0);
-#endif
-
- return pd;
-}
-
-#if NeedFunctionPrototypes
-Display *XtOpenDisplay(
- XtAppContext app,
- _Xconst char* displayName,
- _Xconst char* applName,
- _Xconst char* className,
- XrmOptionDescRec *urlist,
- Cardinal num_urs,
- int *argc,
- String *argv
- )
-#else
-Display *XtOpenDisplay(app, displayName, applName, className,
- urlist, num_urs, argc, argv)
- XtAppContext app;
- String displayName, applName, className;
- XrmOptionDescRec *urlist;
- Cardinal num_urs;
- int *argc;
- String *argv;
-#endif
-{
- Display *d;
- XrmDatabase db = 0;
- XtPerDisplay pd;
- String language = NULL;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- /* parse the command line for name, display, and/or language */
- db = _XtPreparseCommandLine(urlist, num_urs, *argc, argv, &applName,
- (displayName ? NULL : &displayName),
- (app->process->globalLangProcRec.proc ?
- &language : NULL));
- UNLOCK_PROCESS;
- d = XOpenDisplay(displayName);
-
- if (! applName && !(applName = getenv("RESOURCE_NAME"))) {
- if (*argc > 0 && argv[0] && *argv[0]) {
-#ifdef WIN32
- char *ptr = strrchr(argv[0], '\\');
-#else
- char *ptr = strrchr(argv[0], '/');
-#endif
-#ifdef __EMX__
- char *dot_ptr,*ptr2;
- ptr2 = strrchr(argv[0],'\\');
- if (ptr2 > ptr) ptr = ptr2;
- dot_ptr = strrchr(argv[0],'.');
- if (dot_ptr && (dot_ptr > ptr)) *dot_ptr='\0';
-#endif /* This will remove the .exe suffix under OS/2 */
-
- if (ptr) applName = ++ptr;
- else applName = argv[0];
- } else
- applName = "main";
- }
-
- if (d) {
- pd = InitPerDisplay(d, app, applName, className);
- pd->language = language;
- _XtDisplayInitialize(d, pd, applName, urlist, num_urs, argc, argv);
- } else {
- int len;
- displayName = XDisplayName(displayName);
- len = strlen (displayName);
- app->display_name_tried = (String) __XtMalloc (len + 1);
- strncpy ((char*) app->display_name_tried, displayName, len + 1);
- app->display_name_tried[len] = '\0';
- }
- if (db) XrmDestroyDatabase(db);
- UNLOCK_APP(app);
- return d;
-}
-
-Display *
-_XtAppInit(app_context_return, application_class, options, num_options,
- argc_in_out, argv_in_out, fallback_resources)
-XtAppContext * app_context_return;
-String application_class;
-XrmOptionDescRec *options;
-Cardinal num_options;
-int *argc_in_out;
-String **argv_in_out, * fallback_resources;
-{
- String *saved_argv;
- int i;
- Display *dpy;
-
-/*
- * Save away argv and argc so we can set the properties later
- */
-
- saved_argv = (String *)
- __XtMalloc( (Cardinal)((*argc_in_out + 1) * sizeof(String)) );
-
- for (i = 0 ; i < *argc_in_out ; i++) saved_argv[i] = (*argv_in_out)[i];
- saved_argv[i] = NULL; /* NULL terminate that sucker. */
-
-
- *app_context_return = XtCreateApplicationContext();
-
- LOCK_APP((*app_context_return));
- if (fallback_resources) /* save a procedure call */
- XtAppSetFallbackResources(*app_context_return, fallback_resources);
-
- dpy = XtOpenDisplay(*app_context_return, (String) NULL, NULL,
- application_class,
- options, num_options, argc_in_out, *argv_in_out);
-
- if (!dpy) {
- String param = (*app_context_return)->display_name_tried;
- Cardinal param_count = 1;
- XtErrorMsg("invalidDisplay","xtInitialize",XtCXtToolkitError,
- "Can't open display: %s", &param, &param_count);
- XtFree((char *) (*app_context_return)->display_name_tried);
- }
- *argv_in_out = saved_argv;
- UNLOCK_APP((*app_context_return));
- return dpy;
-}
-
-#if NeedFunctionPrototypes
-void
-XtDisplayInitialize(
- XtAppContext app,
- Display *dpy,
- _Xconst char* name,
- _Xconst char* classname,
- XrmOptionDescRec *urlist,
- Cardinal num_urs,
- int *argc,
- String *argv
- )
-#else
-void
-XtDisplayInitialize(app, dpy, name, classname, urlist, num_urs, argc, argv)
- XtAppContext app;
- Display *dpy;
- String name, classname;
- XrmOptionDescRec *urlist;
- Cardinal num_urs;
- int *argc;
- String *argv;
-#endif
-{
- XtPerDisplay pd;
- XrmDatabase db = 0;
-
- LOCK_APP(app);
- pd = InitPerDisplay(dpy, app, name, classname);
- LOCK_PROCESS;
- if (app->process->globalLangProcRec.proc)
- /* pre-parse the command line for the language resource */
- db = _XtPreparseCommandLine(urlist, num_urs, *argc, argv, NULL, NULL,
- &pd->language);
- UNLOCK_PROCESS;
- _XtDisplayInitialize(dpy, pd, name, urlist, num_urs, argc, argv);
- if (db) XrmDestroyDatabase(db);
- UNLOCK_APP(app);
-}
-
-XtAppContext XtCreateApplicationContext()
-{
- XtAppContext app = XtNew(XtAppStruct);
-#ifdef XTHREADS
- app->lock_info = NULL;
- app->lock = NULL;
- app->unlock = NULL;
- app->yield_lock = NULL;
- app->restore_lock = NULL;
- app->free_lock = NULL;
-#endif
- INIT_APP_LOCK(app);
- LOCK_APP(app);
- LOCK_PROCESS;
- app->process = _XtGetProcessContext();
- app->next = app->process->appContextList;
- app->process->appContextList = app;
- app->langProcRec.proc = app->process->globalLangProcRec.proc;
- app->langProcRec.closure = app->process->globalLangProcRec.closure;
- app->destroy_callbacks = NULL;
- app->list = NULL;
- app->count = app->max = app->last = 0;
- app->timerQueue = NULL;
- app->workQueue = NULL;
- app->signalQueue = NULL;
- app->input_list = NULL;
- app->outstandingQueue = NULL;
- app->errorDB = NULL;
- _XtSetDefaultErrorHandlers(&app->errorMsgHandler,
- &app->warningMsgHandler, &app->errorHandler,
- &app->warningHandler);
- app->action_table = NULL;
- _XtSetDefaultSelectionTimeout(&app->selectionTimeout);
- _XtSetDefaultConverterTable(&app->converterTable);
- app->sync = app->being_destroyed = app->error_inited = FALSE;
- app->in_phase2_destroy = NULL;
-#ifndef USE_POLL
- FD_ZERO(&app->fds.rmask);
- FD_ZERO(&app->fds.wmask);
- FD_ZERO(&app->fds.emask);
-#endif
- app->fds.nfds = 0;
- app->input_count = app->input_max = 0;
- _XtHeapInit(&app->heap);
- app->fallback_resources = NULL;
- _XtPopupInitialize(app);
- app->action_hook_list = NULL;
- app->block_hook_list = NULL;
- app->destroy_list_size = app->destroy_count = app->dispatch_level = 0;
- app->destroy_list = NULL;
-#ifndef NO_IDENTIFY_WINDOWS
- app->identify_windows = False;
-#endif
- app->free_bindings = NULL;
- app->display_name_tried = NULL;
- app->dpy_destroy_count = 0;
- app->dpy_destroy_list = NULL;
- app->exit_flag = FALSE;
- app->rebuild_fdlist = TRUE;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return app;
-}
-
-#if NeedFunctionPrototypes
-void XtAppSetExitFlag (
- XtAppContext app)
-#else
-void XtAppSetExitFlag (app)
- XtAppContext app;
-#endif
-{
- LOCK_APP(app);
- app->exit_flag = TRUE;
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-Boolean XtAppGetExitFlag (
- XtAppContext app)
-#else
-Boolean XtAppGetExitFlag (app)
- XtAppContext app;
-#endif
-{
- Boolean retval;
- LOCK_APP(app);
- retval = app->exit_flag;
- UNLOCK_APP(app);
- return retval;
-}
-
-static void DestroyAppContext(app)
- XtAppContext app;
-{
- XtAppContext* prev_app;
-
- prev_app = &app->process->appContextList;
- while (app->count-- > 0) XtCloseDisplay(app->list[app->count]);
- if (app->list != NULL) XtFree((char *)app->list);
- _XtFreeConverterTable(app->converterTable);
- _XtCacheFlushTag(app, (XtPointer)&app->heap);
- _XtFreeActions(app->action_table);
- if (app->destroy_callbacks != NULL) {
- XtCallCallbackList((Widget) NULL,
- (XtCallbackList)app->destroy_callbacks,
- (XtPointer)app);
- _XtRemoveAllCallbacks(&app->destroy_callbacks);
- }
- while (app->timerQueue) XtRemoveTimeOut((XtIntervalId)app->timerQueue);
- while (app->workQueue) XtRemoveWorkProc((XtWorkProcId)app->workQueue);
- while (app->signalQueue) XtRemoveSignal((XtSignalId)app->signalQueue);
- if (app->input_list) _XtRemoveAllInputs(app);
- XtFree((char*)app->destroy_list);
- _XtHeapFree(&app->heap);
- while (*prev_app != app) prev_app = &(*prev_app)->next;
- *prev_app = app->next;
- if (app->process->defaultAppContext == app)
- app->process->defaultAppContext = NULL;
- if (app->free_bindings) _XtDoFreeBindings (app);
- FREE_APP_LOCK(app);
- XtFree((char *)app);
-}
-
-static XtAppContext* appDestroyList = NULL;
-int _XtAppDestroyCount = 0;
-
-void XtDestroyApplicationContext(app)
- XtAppContext app;
-{
- LOCK_APP(app);
- if (app->being_destroyed) {
- UNLOCK_APP(app);
- return;
- }
-
- if (_XtSafeToDestroy(app)) {
- LOCK_PROCESS;
- DestroyAppContext(app);
- UNLOCK_PROCESS;
- } else {
- app->being_destroyed = TRUE;
- LOCK_PROCESS;
- _XtAppDestroyCount++;
- appDestroyList =
- (XtAppContext *) XtRealloc((char *) appDestroyList,
- (unsigned) (_XtAppDestroyCount * sizeof(XtAppContext)));
- appDestroyList[_XtAppDestroyCount-1] = app;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- }
-}
-
-void _XtDestroyAppContexts()
-{
- int i,ii;
- XtAppContext apps[8];
- XtAppContext* pApps;
-
- pApps = XtStackAlloc (sizeof (XtAppContext) * _XtAppDestroyCount, apps);
-
- for (i = ii = 0; i < _XtAppDestroyCount; i++) {
- if (_XtSafeToDestroy(appDestroyList[i]))
- DestroyAppContext(appDestroyList[i]);
- else
- pApps[ii++] = appDestroyList[i];
- }
- _XtAppDestroyCount = ii;
- if (_XtAppDestroyCount == 0) {
- XtFree((char *) appDestroyList);
- appDestroyList = NULL;
- } else {
- for (i = 0; i < ii; i++)
- appDestroyList[i] = pApps[i];
- }
- XtStackFree ((XtPointer) pApps, apps);
-}
-
-XrmDatabase XtDatabase(dpy)
- Display *dpy;
-{
- XrmDatabase retval;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- retval = XrmGetDatabase(dpy);
- UNLOCK_APP(app);
- return retval;
-}
-
-PerDisplayTablePtr _XtperDisplayList = NULL;
-
-XtPerDisplay _XtSortPerDisplayList(dpy)
- Display *dpy;
-{
- register PerDisplayTablePtr pd, opd;
-
-#ifdef lint
- opd = NULL;
-#endif
- LOCK_PROCESS;
- for (pd = _XtperDisplayList;
- pd != NULL && pd->dpy != dpy;
- pd = pd->next) {
- opd = pd;
- }
-
- if (pd == NULL) {
- XtErrorMsg(XtNnoPerDisplay, "getPerDisplay", XtCXtToolkitError,
- "Couldn't find per display information",
- (String *) NULL, (Cardinal *)NULL);
- }
-
- if (pd != _XtperDisplayList) { /* move it to the front */
- /* opd points to the previous one... */
-
- opd->next = pd->next;
- pd->next = _XtperDisplayList;
- _XtperDisplayList = pd;
- }
- UNLOCK_PROCESS;
- return &(pd->perDpy);
-}
-
-XtAppContext XtDisplayToApplicationContext(dpy)
- Display *dpy;
-{
- XtAppContext retval;
-
- retval = _XtGetPerDisplay(dpy)->appContext;
- return retval;
-}
-
-static void CloseDisplay(dpy)
- Display *dpy;
-{
- register XtPerDisplay xtpd;
- register PerDisplayTablePtr pd, opd;
- XrmDatabase db;
- int i;
-
-#ifdef lint
- opd = NULL;
-#endif
- XtDestroyWidget(XtHooksOfDisplay(dpy));
-
- LOCK_PROCESS;
- for (pd = _XtperDisplayList;
- pd != NULL && pd->dpy != dpy;
- pd = pd->next){
- opd = pd;
- }
-
- if (pd == NULL) {
- XtErrorMsg(XtNnoPerDisplay, "closeDisplay", XtCXtToolkitError,
- "Couldn't find per display information",
- (String *) NULL, (Cardinal *)NULL);
- }
-
- if (pd == _XtperDisplayList) _XtperDisplayList = pd->next;
- else opd->next = pd->next;
-
- xtpd = &(pd->perDpy);
-
- if (xtpd != NULL) {
- extern void _XtGClistFree();
- if (xtpd->destroy_callbacks != NULL) {
- XtCallCallbackList((Widget) NULL,
- (XtCallbackList)xtpd->destroy_callbacks,
- (XtPointer)xtpd);
- _XtRemoveAllCallbacks(&xtpd->destroy_callbacks);
- }
- if (xtpd->mapping_callbacks != NULL)
- _XtRemoveAllCallbacks(&xtpd->mapping_callbacks);
- XtDeleteFromAppContext(dpy, xtpd->appContext);
- if (xtpd->keysyms)
- XFree((char *) xtpd->keysyms);
- XtFree((char *) xtpd->modKeysyms);
- XtFree((char *) xtpd->modsToKeysyms);
- xtpd->keysyms_per_keycode = 0;
- xtpd->being_destroyed = FALSE;
- xtpd->keysyms = NULL;
- xtpd->modKeysyms = NULL;
- xtpd->modsToKeysyms = NULL;
- XDestroyRegion(xtpd->region);
- _XtCacheFlushTag(xtpd->appContext, (XtPointer)&xtpd->heap);
- _XtGClistFree(dpy, xtpd);
- XtFree((char*)xtpd->pdi.trace);
- _XtHeapFree(&xtpd->heap);
- _XtFreeWWTable(xtpd);
- xtpd->per_screen_db[DefaultScreen(dpy)] = (XrmDatabase)NULL;
- for (i = ScreenCount(dpy); --i >= 0; ) {
- db = xtpd->per_screen_db[i];
- if (db)
- XrmDestroyDatabase(db);
- }
- XtFree((char *)xtpd->per_screen_db);
- if (db = XrmGetDatabase(dpy))
- XrmDestroyDatabase(db);
- if (xtpd->cmd_db)
- XrmDestroyDatabase(xtpd->cmd_db);
- if (xtpd->server_db)
- XrmDestroyDatabase(xtpd->server_db);
- XtFree(xtpd->language);
- if (xtpd->dispatcher_list != NULL)
- XtFree((char *) xtpd->dispatcher_list);
- if (xtpd->ext_select_list != NULL)
- XtFree((char *) xtpd->ext_select_list);
- }
- XtFree((char*)pd);
- XrmSetDatabase(dpy, (XrmDatabase)NULL);
- XCloseDisplay(dpy);
- UNLOCK_PROCESS;
-}
-
-void XtCloseDisplay(dpy)
- Display *dpy;
-{
- XtPerDisplay pd;
- XtAppContext app = XtDisplayToApplicationContext(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
- if (pd->being_destroyed) {
- UNLOCK_APP(app);
- return;
- }
-
- if (_XtSafeToDestroy(app)) CloseDisplay(dpy);
- else {
- pd->being_destroyed = TRUE;
- app->dpy_destroy_count++;
- app->dpy_destroy_list = (Display **)
- XtRealloc((char *) app->dpy_destroy_list,
- (unsigned) (app->dpy_destroy_count * sizeof(Display *)));
- app->dpy_destroy_list[app->dpy_destroy_count-1] = dpy;
- }
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void _XtCloseDisplays(
- XtAppContext app)
-#else
-void _XtCloseDisplays(app)
- XtAppContext app;
-#endif
-{
- int i;
-
- LOCK_APP(app);
- for (i = 0; i < app->dpy_destroy_count; i++) {
- CloseDisplay(app->dpy_destroy_list[i]);
- }
- app->dpy_destroy_count = 0;
- XtFree((char *) app->dpy_destroy_list);
- app->dpy_destroy_list = NULL;
- UNLOCK_APP(app);
-}
-
-XtAppContext XtWidgetToApplicationContext(w)
- Widget w;
-{
- XtAppContext retval;
-
- retval = _XtGetPerDisplay(XtDisplayOfObject(w))->appContext;
- return retval;
-}
-
-
-void XtGetApplicationNameAndClass(dpy, name_return, class_return)
- Display *dpy;
- String *name_return;
- String *class_return;
-{
- XtPerDisplay pd;
-
- pd = _XtGetPerDisplay(dpy);
- *name_return = XrmQuarkToString(pd->name);
- *class_return = XrmQuarkToString(pd->class);
-}
-
-#if NeedFunctionPrototypes
-XtPerDisplay _XtGetPerDisplay (
- Display* display)
-#else
-XtPerDisplay _XtGetPerDisplay (display)
- Display* display;
-#endif
-{
- XtPerDisplay retval;
-
- LOCK_PROCESS;
- retval = ((_XtperDisplayList != NULL &&
- _XtperDisplayList->dpy == display)
- ? &_XtperDisplayList->perDpy
- : _XtSortPerDisplayList(display));
- UNLOCK_PROCESS;
- return retval;
-}
-
-#if NeedFunctionPrototypes
-XtPerDisplayInputRec* _XtGetPerDisplayInput(
- Display* display)
-#else
-XtPerDisplayInputRec* _XtGetPerDisplayInput(display)
- Display* display;
-#endif
-{
- XtPerDisplayInputRec* retval;
- LOCK_PROCESS;
- retval = ((_XtperDisplayList != NULL &&
- _XtperDisplayList->dpy == display)
- ? &_XtperDisplayList->perDpy.pdi
- : &_XtSortPerDisplayList(display)->pdi);
- UNLOCK_PROCESS;
- return retval;
-}
-
-#if NeedFunctionPrototypes
-void XtGetDisplays(
- XtAppContext app_context,
- Display*** dpy_return,
- Cardinal* num_dpy_return)
-#else
-void XtGetDisplays(app_context, dpy_return, num_dpy_return)
- XtAppContext app_context;
- Display*** dpy_return;
- Cardinal* num_dpy_return;
-#endif
-{
- int ii;
- LOCK_APP(app_context);
- *num_dpy_return = app_context->count;
- *dpy_return = (Display**)__XtMalloc(app_context->count * sizeof(Display*));
- for (ii = 0; ii < app_context->count; ii++)
- *dpy_return[ii] = app_context->list[ii];
- UNLOCK_APP(app_context);
-}
diff --git a/xc/lib/Xt/Error.c b/xc/lib/Xt/Error.c
deleted file mode 100644
index 93796f486..000000000
--- a/xc/lib/Xt/Error.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/* $TOG: Error.c /main/43 1998/02/06 13:21:30 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Error.c,v 3.9 1998/10/03 09:06:51 dawes Exp $ */
-
-/*
-
-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 "IntrinsicI.h"
-#include <stdio.h>
-
-/* The error handlers in the application context aren't used since we can't
- come up with a uniform way of using them. If you can, define
- GLOBALERRORS to be FALSE (or 0). */
-
-#ifndef GLOBALERRORS
-#define GLOBALERRORS 1
-#endif
-
-static void InitErrorHandling();
-#if GLOBALERRORS
-static XrmDatabase errorDB = NULL;
-static Boolean error_inited = FALSE;
-void _XtDefaultErrorMsg(), _XtDefaultWarningMsg(),
- _XtDefaultError(), _XtDefaultWarning();
-static XtErrorMsgHandler errorMsgHandler = _XtDefaultErrorMsg;
-static XtErrorMsgHandler warningMsgHandler = _XtDefaultWarningMsg;
-static XtErrorHandler errorHandler = _XtDefaultError;
-static XtErrorHandler warningHandler = _XtDefaultWarning;
-#endif /* GLOBALERRORS */
-
-XrmDatabase *XtGetErrorDatabase()
-{
- XrmDatabase* retval;
-#if GLOBALERRORS
- LOCK_PROCESS;
- retval = &errorDB;
- UNLOCK_PROCESS;
-#else
- retval = XtAppGetErrorDatabase(_XtDefaultAppContext());
-#endif /* GLOBALERRORS */
- return retval;
-}
-
-XrmDatabase *XtAppGetErrorDatabase(app)
- XtAppContext app;
-{
- XrmDatabase* retval;
-#if GLOBALERRORS
- LOCK_PROCESS;
- retval = &errorDB;
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- retval= &app->errorDB;
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
- return retval;
-}
-
-#if NeedFunctionPrototypes
-void XtGetErrorDatabaseText(
- register _Xconst char* name,
- register _Xconst char* type,
- register _Xconst char* class,
- _Xconst char* defaultp,
- String buffer,
- int nbytes
- )
-#else
-void XtGetErrorDatabaseText(name,type,class,defaultp, buffer, nbytes)
- register String name, type, class;
- String defaultp;
- String buffer;
- int nbytes;
-#endif
-{
-#if GLOBALERRORS
- XtAppGetErrorDatabaseText(NULL,
- name,type,class,defaultp, buffer, nbytes, NULL);
-#else
- XtAppGetErrorDatabaseText(_XtDefaultAppContext(),
- name,type,class,defaultp, buffer, nbytes, NULL);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtAppGetErrorDatabaseText(
- XtAppContext app,
- register _Xconst char* name,
- register _Xconst char* type,
- register _Xconst char* class,
- _Xconst char* defaultp,
- String buffer,
- int nbytes,
- XrmDatabase db
- )
-#else
-void XtAppGetErrorDatabaseText(app, name,type,class,defaultp,
- buffer, nbytes, db)
- XtAppContext app;
- register String name, type, class;
- String defaultp;
- String buffer;
- int nbytes;
- XrmDatabase db;
-#endif
-{
- String str_class;
- String type_str;
- XrmValue result;
- char *str_name = NULL;
- char *temp = NULL;
-
-#if GLOBALERRORS
- LOCK_PROCESS;
- if (error_inited == FALSE) {
- InitErrorHandling (&errorDB);
- error_inited = TRUE;
- }
-#else
- LOCK_APP(app);
- if (app->error_inited == FALSE) {
- InitErrorHandling (&app->errorDB);
- app->error_inited = TRUE;
- }
-#endif /* GLOBALERRORS */
- if (!(str_name = ALLOCATE_LOCAL(strlen(name) + strlen(type) + 2)))
- _XtAllocError(NULL);
- (void) sprintf(str_name, "%s.%s", name, type);
- /* XrmGetResource requires the name and class to be fully qualified
- * and to have the same number of components. */
- str_class = (char *)class;
- if (! strchr(class, '.')) {
- if (!(temp = ALLOCATE_LOCAL(2 * strlen(class) + 2)))
- _XtAllocError(NULL);
- (void) sprintf(temp, "%s.%s", class, class);
- str_class = temp;
- }
- if (db == NULL) {
-#if GLOBALERRORS
- (void) XrmGetResource(errorDB, str_name, str_class, &type_str,
- &result);
-#else
- (void) XrmGetResource(app->errorDB, str_name, str_class, &type_str,
- &result);
-#endif /* GLOBALERRORS */
- } else (void) XrmGetResource(db, str_name, str_class, &type_str, &result);
- if (result.addr) {
- (void) strncpy (buffer, result.addr, nbytes);
- if (result.size > nbytes) buffer[nbytes-1] = 0;
- } else {
- int len = strlen(defaultp);
- if (len >= nbytes) len = nbytes-1;
- (void) memmove(buffer, defaultp, len);
- buffer[len] = '\0';
- }
- if (str_name)
- DEALLOCATE_LOCAL(str_name);
- if (temp)
- DEALLOCATE_LOCAL(temp);
-#if GLOBALERRORS
- UNLOCK_PROCESS;
-#else
- UNLOCK_APP(app);
-#endif
-}
-
-static void InitErrorHandling (db)
- XrmDatabase *db;
-{
- XrmDatabase errordb;
-
- errordb = XrmGetFileDatabase(ERRORDB);
- XrmMergeDatabases(errordb, db);
-}
-
-static void DefaultMsg (name,type,class,defaultp,params,num_params,error,fn)
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
- Bool error;
- void (*fn)(String);
-{
-#define BIGBUF 1024
-#ifdef notyet /* older versions don't, might want to wait until more do */
-#if defined(__linux__) || defined(CSRG_BASED) /* everyone else needs to get with the program */
-#define USE_SNPRINTF
-#endif
-#endif
- char buffer[BIGBUF];
- char* message;
- XtGetErrorDatabaseText(name,type,class,defaultp, buffer, BIGBUF);
-/*need better solution here, perhaps use lower level printf primitives? */
- if (params == NULL || num_params == NULL || *num_params == 0)
- (*fn)(buffer);
-#ifndef WIN32 /* and OS/2 */
- else if ((getuid () != geteuid ()) || getuid() == 0) {
- if ((error && errorHandler == _XtDefaultError) ||
- (!error && warningHandler == _XtDefaultWarning)) {
- /*
- * if it's just going to go to stderr anyway, then we'll
- * fprintf to stderr ourselves and skip the insecure sprintf.
- */
- int i = *num_params;
- String par[10];
- if (i > 10) i = 10;
- (void) memmove((char*)par, (char*)params, i * sizeof(String) );
- bzero( &par[i], (10-i) * sizeof(String) );
- (void) fprintf (stderr, "%s%s",
- error ? XTERROR_PREFIX : XTWARNING_PREFIX,
- error ? "Error: " : "Warning: ");
- (void) fprintf (stderr, buffer,
- par[0], par[1], par[2], par[3], par[4],
- par[5], par[6], par[7], par[8], par[9]);
- (void) fprintf (stderr, "%c", '\n');
- if (i != *num_params)
- (*fn) ( "Some arguments in previous message were lost" );
- else if (error) exit (1);
- } else {
- /*
- * can't tell what it might do, so we'll play it safe
- */
- XtWarning ("\
-This program is an suid-root program or is being run by the root user.\n\
-The full text of the error or warning message cannot be safely formatted\n\
-in this environment. You may get a more descriptive message by running the\n\
-program as a non-root user or by removing the suid bit on the executable.");
- (*fn)(buffer); /* if *fn is an ErrorHandler it should exit */
- }
- }
-#endif
- else {
- /*
- * If you have snprintf the worst thing that could happen is you'd
- * lose some information. Without snprintf you're probably going to
- * scramble your heap and perhaps SEGV -- sooner or later.
- * If it hurts when you go like this then don't go like this! :-)
- */
- int i = *num_params;
- String par[10];
- if (i > 10) i = 10;
- (void) memmove((char*)par, (char*)params, i * sizeof(String) );
- bzero( &par[i], (10-i) * sizeof(String) );
- if (i != *num_params)
- XtWarning( "Some arguments in following message were lost" );
- /*
- * resist any temptation you might have to make `message' a
- * local buffer on the stack. Doing so is a security hole
- * in programs executing as root. Error and Warning
- * messages shouldn't be called frequently enough for this
- * to be a performance issue.
- */
- if ((message = __XtMalloc (BIGBUF))) {
-#ifndef USE_SNPRINTF
- message[BIGBUF-1] = 0;
- (void) sprintf (message, buffer,
-#else
- (void) snprintf (message, BIGBUF, buffer,
-#endif
- par[0], par[1], par[2], par[3], par[4],
- par[5], par[6], par[7], par[8], par[9]);
-#ifndef USE_SNPRINTF
- if (message[BIGBUF-1] != '\0')
- XtWarning ("Possible heap corruption in Xt{Error,Warning}MsgHandler");
-#endif
- (*fn)(message);
- XtFree(message);
- } else {
- XtWarning ("Memory allocation failed, arguments in the following message were lost");
- (*fn)(buffer);
- }
- }
-}
-
-void _XtDefaultErrorMsg (name,type,class,defaultp,params,num_params)
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
-{
- DefaultMsg (name,type,class,defaultp,params,num_params,True,XtError);
-}
-
-void _XtDefaultWarningMsg (name,type,class,defaultp,params,num_params)
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
-{
- DefaultMsg (name,type,class,defaultp,params,num_params,False,XtWarning);
-}
-
-#if NeedFunctionPrototypes
-void XtErrorMsg(
- _Xconst char* name,
- _Xconst char* type,
- _Xconst char* class,
- _Xconst char* defaultp,
- String* params,
- Cardinal* num_params
- )
-#else
-void XtErrorMsg(name,type,class,defaultp,params,num_params)
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*errorMsgHandler)((String)name,(String)type,(String)class,
- (String)defaultp,params,num_params);
- UNLOCK_PROCESS;
-#else
- XtAppErrorMsg(_XtDefaultAppContext(),name,type,class,
- defaultp,params,num_params);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtAppErrorMsg(
- XtAppContext app,
- _Xconst char* name,
- _Xconst char* type,
- _Xconst char* class,
- _Xconst char* defaultp,
- String* params,
- Cardinal* num_params
- )
-#else
-void XtAppErrorMsg(app, name,type,class,defaultp,params,num_params)
- XtAppContext app;
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*errorMsgHandler)((String)name,(String)type,(String)class,
- (String)defaultp,params,num_params);
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- (*app->errorMsgHandler)(name,type,class,defaultp,params,num_params);
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtWarningMsg(
- _Xconst char* name,
- _Xconst char* type,
- _Xconst char* class,
- _Xconst char* defaultp,
- String* params,
- Cardinal* num_params
- )
-#else
-void XtWarningMsg(name,type,class,defaultp,params,num_params)
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*warningMsgHandler)((String)name,(String)type,(String)class,
- (String)defaultp,params,num_params);
- UNLOCK_PROCESS;
-#else
- XtAppWarningMsg(_XtDefaultAppContext(),name,type,class,
- defaultp,params,num_params);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtAppWarningMsg(
- XtAppContext app,
- _Xconst char* name,
- _Xconst char* type,
- _Xconst char* class,
- _Xconst char* defaultp,
- String* params,
- Cardinal* num_params
- )
-#else
-void XtAppWarningMsg(app,name,type,class,defaultp,params,num_params)
- XtAppContext app;
- String name,type,class,defaultp;
- String* params;
- Cardinal* num_params;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*warningMsgHandler)((String)name,(String)type,(String)class,
- (String)defaultp,params,num_params);
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- (*app->warningMsgHandler)(name,type,class,defaultp,params,num_params);
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
-}
-
-void XtSetErrorMsgHandler(handler)
- XtErrorMsgHandler handler;
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- if (handler != NULL) errorMsgHandler = handler;
- else errorMsgHandler = _XtDefaultErrorMsg;
- UNLOCK_PROCESS;
-#else
- XtAppSetErrorMsgHandler(_XtDefaultAppContext(), handler);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-XtErrorMsgHandler XtAppSetErrorMsgHandler(
- XtAppContext app,
- XtErrorMsgHandler handler)
-#else
-XtErrorMsgHandler XtAppSetErrorMsgHandler(app,handler)
- XtAppContext app;
- XtErrorMsgHandler handler;
-#endif
-{
- XtErrorMsgHandler old;
-#if GLOBALERRORS
- LOCK_PROCESS;
- old = errorMsgHandler;
- if (handler != NULL) errorMsgHandler = handler;
- else errorMsgHandler = _XtDefaultErrorMsg;
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- old = app->errorMsgHandler;
- if (handler != NULL) app->errorMsgHandler = handler;
- else app->errorMsgHandler = _XtDefaultErrorMsg;
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
- return old;
-}
-
-void XtSetWarningMsgHandler(handler)
- XtErrorMsgHandler handler;
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- if (handler != NULL) warningMsgHandler = handler;
- else warningMsgHandler = _XtDefaultWarningMsg;
- UNLOCK_PROCESS;
-#else
- XtAppSetWarningMsgHandler(_XtDefaultAppContext(),handler);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-XtErrorMsgHandler XtAppSetWarningMsgHandler(
- XtAppContext app,
- XtErrorMsgHandler handler)
-#else
-XtErrorMsgHandler XtAppSetWarningMsgHandler(app,handler)
- XtAppContext app;
- XtErrorMsgHandler handler;
-#endif
-{
- XtErrorMsgHandler old;
-#if GLOBALERRORS
- LOCK_PROCESS;
- old = warningMsgHandler;
- if (handler != NULL) warningMsgHandler = handler;
- else warningMsgHandler = _XtDefaultWarningMsg;
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- old = app->warningMsgHandler;
- if (handler != NULL) app->warningMsgHandler = handler;
- else app->warningMsgHandler = _XtDefaultWarningMsg;
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
- return old;
-}
-
-void _XtDefaultError(message)
- String message;
-{
- if (message && *message)
- (void)fprintf(stderr, "%sError: %s\n", XTERROR_PREFIX, message);
- exit(1);
-}
-
-void _XtDefaultWarning(message)
- String message;
-{
- if (message && *message)
- (void)fprintf(stderr, "%sWarning: %s\n", XTWARNING_PREFIX, message);
- return;
-}
-
-#if NeedFunctionPrototypes
-void XtError(
- _Xconst char* message
- )
-#else
-void XtError(message)
- String message;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*errorHandler)((String)message);
- UNLOCK_PROCESS;
-#else
- XtAppError(_XtDefaultAppContext(),message);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtAppError(
- XtAppContext app,
- _Xconst char* message
- )
-#else
-void XtAppError(app,message)
- XtAppContext app;
- String message;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*errorHandler)((String)message);
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- (*app->errorHandler)(message);
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtWarning(
- _Xconst char* message
- )
-#else
-void XtWarning(message)
- String message;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*warningHandler)((String)message);
- UNLOCK_PROCESS;
-#else
- XtAppWarning(_XtDefaultAppContext(),message);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtAppWarning(
- XtAppContext app,
- _Xconst char* message
- )
-#else
-void XtAppWarning(app,message)
- XtAppContext app;
- String message;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- (*warningHandler)((String)message);
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- (*app->warningHandler)(message);
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-void XtSetErrorHandler(XtErrorHandler handler)
-#else
-void XtSetErrorHandler(handler)
- XtErrorHandler handler;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- if (handler != NULL) errorHandler = handler;
- else errorHandler = _XtDefaultError;
- UNLOCK_PROCESS;
-#else
- XtAppSetErrorHandler(_XtDefaultAppContext(),handler);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-XtErrorHandler XtAppSetErrorHandler(
- XtAppContext app,
- XtErrorHandler handler)
-#else
-XtErrorHandler XtAppSetErrorHandler(app,handler)
- XtAppContext app;
- XtErrorHandler handler;
-#endif
-{
- XtErrorHandler old;
-#if GLOBALERRORS
- LOCK_PROCESS;
- old = errorHandler;
- if (handler != NULL) errorHandler = handler;
- else errorHandler = _XtDefaultError;
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- old = app->errorHandler;
- if (handler != NULL) app->errorHandler = handler;
- else app->errorHandler = _XtDefaultError;
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
- return old;
-}
-
-#if NeedFunctionPrototypes
-void XtSetWarningHandler(XtErrorHandler handler)
-#else
-void XtSetWarningHandler(handler)
- XtErrorHandler handler;
-#endif
-{
-#if GLOBALERRORS
- LOCK_PROCESS;
- if (handler != NULL) warningHandler = handler;
- else warningHandler = _XtDefaultWarning;
- UNLOCK_PROCESS;
-#else
- XtAppSetWarningHandler(_XtDefaultAppContext(),handler);
-#endif /* GLOBALERRORS */
-}
-
-#if NeedFunctionPrototypes
-XtErrorHandler XtAppSetWarningHandler(
- XtAppContext app,
- XtErrorHandler handler)
-#else
-XtErrorHandler XtAppSetWarningHandler(app,handler)
- XtAppContext app;
- XtErrorHandler handler;
-#endif
-{
- XtErrorHandler old;
-#if GLOBALERRORS
- LOCK_PROCESS;
- old = warningHandler;
- if (handler != NULL) warningHandler = handler;
- else warningHandler = _XtDefaultWarning;
- UNLOCK_PROCESS;
-#else
- LOCK_APP(app);
- old = app->warningHandler;
- if (handler != NULL) app->warningHandler = handler;
- else app->warningHandler = _XtDefaultWarning;
- UNLOCK_APP(app);
-#endif /* GLOBALERRORS */
- return old;
-}
-
-void _XtSetDefaultErrorHandlers(errMsg, warnMsg, err, warn)
- XtErrorMsgHandler *errMsg, *warnMsg;
- XtErrorHandler *err, *warn;
-{
-#ifndef GLOBALERRORS
- LOCK_PROCESS;
- *errMsg = _XtDefaultErrorMsg;
- *warnMsg = _XtDefaultWarningMsg;
- *err = _XtDefaultError;
- *warn = _XtDefaultWarning;
- UNLOCK_PROCESS;
-#endif /* GLOBALERRORS */
-}
diff --git a/xc/lib/Xt/Event.c b/xc/lib/Xt/Event.c
deleted file mode 100644
index e0210f487..000000000
--- a/xc/lib/Xt/Event.c
+++ /dev/null
@@ -1,1842 +0,0 @@
-/* $TOG: Event.c /main/153 1998/02/06 13:21:46 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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 "IntrinsicI.h"
-#include "Shell.h"
-#include "StringDefs.h"
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-typedef struct _XtEventRecExt {
- int type;
- XtPointer select_data[1]; /* actual dimension is [mask] */
-} XtEventRecExt;
-
-#define EXT_TYPE(p) (((XtEventRecExt*) ((p)+1))->type)
-#define EXT_SELECT_DATA(p,n) (((XtEventRecExt*) ((p)+1))->select_data[n])
-
-#define NonMaskableMask ((EventMask)0x80000000L)
-
-/*
- * These are definitions to make the code that handles exposure compresssion
- * easier to read.
- *
- * COMP_EXPOSE - The compression exposure field of "widget"
- * COMP_EXPOSE_TYPE - The type of compression (lower 4 bits of COMP_EXPOSE.
- * GRAPHICS_EXPOSE - TRUE if the widget wants graphics expose events
- * dispatched.
- * NO_EXPOSE - TRUE if the widget wants No expose events dispatched.
- */
-
-#define COMP_EXPOSE (widget->core.widget_class->core_class.compress_exposure)
-#define COMP_EXPOSE_TYPE (COMP_EXPOSE & 0x0f)
-#define GRAPHICS_EXPOSE ((XtExposeGraphicsExpose & COMP_EXPOSE) || \
- (XtExposeGraphicsExposeMerged & COMP_EXPOSE))
-#define NO_EXPOSE (XtExposeNoExpose & COMP_EXPOSE)
-
-EventMask XtBuildEventMask(widget)
- Widget widget;
-{
- XtEventTable ev;
- EventMask mask = 0L;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- for (ev = widget->core.event_table; ev != NULL; ev = ev->next)
- if (ev->select) {
- if (!ev->has_type_specifier)
- mask |= ev->mask;
- else {
- if (EXT_TYPE(ev) < LASTEvent) {
- int i;
- for (i = 0; i < ev->mask; i++)
- if (EXT_SELECT_DATA(ev, i))
- mask |= *(EventMask*)EXT_SELECT_DATA(ev, i);
- }
- }
- }
- LOCK_PROCESS;
- if (widget->core.widget_class->core_class.expose != NULL)
- mask |= ExposureMask;
- if (widget->core.widget_class->core_class.visible_interest)
- mask |= VisibilityChangeMask;
- UNLOCK_PROCESS;
- if (widget->core.tm.translations)
- mask |= widget->core.tm.translations->eventMask;
-
- mask = mask & ~NonMaskableMask;
- UNLOCK_APP(app);
- return mask;
-}
-
-static void CallExtensionSelector(widget, rec, forceCall)
- Widget widget;
- ExtSelectRec* rec;
- Boolean forceCall;
-{
- XtEventRec* p;
- XtPointer* data;
- int* types;
- int i, count = 0;
-
- for (p = widget->core.event_table; p != NULL; p = p->next)
- if (p->has_type_specifier &&
- EXT_TYPE(p) >= rec->min && EXT_TYPE(p) <= rec->max)
- count += p->mask;
-
- if (count == 0 && !forceCall) return;
-
- data = (XtPointer *) ALLOCATE_LOCAL(count * sizeof (XtPointer));
- types = (int *) ALLOCATE_LOCAL(count * sizeof (int));
- count = 0;
-
- for (p = widget->core.event_table; p != NULL; p = p->next)
- if (p->has_type_specifier &&
- EXT_TYPE(p) >= rec->min && EXT_TYPE(p) <= rec->max)
- for (i =0; i < p->mask; i++) {
- types[count] = EXT_TYPE(p);
- data[count++] = EXT_SELECT_DATA(p, i);
- }
-
- (*rec->proc)(widget, types, data, count, rec->client_data);
- DEALLOCATE_LOCAL((char*) types);
- DEALLOCATE_LOCAL((char*) data);
-}
-
-static void
-RemoveEventHandler(widget, select_data, type, has_type_specifier, other,
- proc, closure, raw)
- Widget widget;
- XtPointer select_data;
- int type;
- Boolean has_type_specifier, other;
- XtEventHandler proc;
- XtPointer closure;
- Boolean raw;
-{
- XtEventRec *p, **pp;
- EventMask eventMask, oldMask = XtBuildEventMask(widget);
-
- if (raw) raw = 1;
- pp = &widget->core.event_table;
- while ((p = *pp) &&
- (p->proc != proc || p->closure != closure || p->select == raw ||
- has_type_specifier != p->has_type_specifier ||
- (has_type_specifier && EXT_TYPE(p) != type)))
- pp = &p->next;
- if (!p) return;
-
- /* un-register it */
- if (!has_type_specifier) {
- eventMask = *(EventMask*)select_data;
- eventMask &= ~NonMaskableMask;
- if (other)
- eventMask |= NonMaskableMask;
- p->mask &= ~eventMask;
- } else {
- int i;
- /* p->mask specifies count of EXT_SELECT_DATA(p,i)
- * search through the list of selection data, if not found
- * dont remove this handler
- */
- for (i = 0; i < p->mask && select_data != EXT_SELECT_DATA(p,i);) i++;
- if (i == p->mask) return;
- if (p->mask == 1) p->mask = 0;
- else {
- p->mask--;
- while (i < p->mask) {
- EXT_SELECT_DATA(p,i) = EXT_SELECT_DATA(p, i+1);
- i++;
- }
- }
- }
-
- if (!p->mask) { /* delete it entirely */
- *pp = p->next;
- XtFree((char *)p);
- }
-
- /* Reset select mask if realized and not raw. */
- if ( !raw && XtIsRealized(widget) && !widget->core.being_destroyed) {
- EventMask mask = XtBuildEventMask(widget);
- Display* dpy = XtDisplay (widget);
-
- if (oldMask != mask)
- XSelectInput(dpy, XtWindow(widget), mask);
-
- if (has_type_specifier) {
- XtPerDisplay pd = _XtGetPerDisplay(dpy);
- int i;
- for (i = 0; i < pd->ext_select_count; i++) {
- if (type >= pd->ext_select_list[i].min &&
- type <= pd->ext_select_list[i].max) {
- CallExtensionSelector(widget, pd->ext_select_list+i, TRUE);
- break;
- }
- if (type < pd->ext_select_list[i].min) break;
- }
- }
- }
-}
-
-/* Function Name: AddEventHandler
- * Description: An Internal routine that does the actual work of
- * adding the event handlers.
- * Arguments: widget - widget to register an event handler for.
- * eventMask - events to mask for.
- * other - pass non maskable events to this proceedure.
- * proc - proceedure to register.
- * closure - data to pass to the event hander.
- * position - where to add this event handler.
- * force_new_position - If the element is already in the
- * list, this will force it to the
- * beginning or end depending on position.
- * raw - If FALSE call XSelectInput for events in mask.
- * Returns: none
- */
-
-static void
-AddEventHandler(widget, select_data, type, has_type_specifier, other, proc,
- closure, position, force_new_position, raw)
- Widget widget;
- XtPointer select_data;
- int type;
- Boolean has_type_specifier, other, force_new_position, raw;
- XtEventHandler proc;
- XtPointer closure;
- XtListPosition position;
-{
- register XtEventRec *p, **pp;
- EventMask oldMask, eventMask;
-
- if (!has_type_specifier) {
- eventMask = *(EventMask*)select_data & ~NonMaskableMask;
- if (other) eventMask |= NonMaskableMask;
- if (!eventMask) return;
- } else if (!type) return;
-
- if (XtIsRealized(widget) && !raw) oldMask = XtBuildEventMask(widget);
-
- if (raw) raw = 1;
- pp = &widget->core.event_table;
- while ((p = *pp) &&
- (p->proc != proc || p->closure != closure || p->select == raw ||
- has_type_specifier != p->has_type_specifier ||
- (has_type_specifier && EXT_TYPE(p) != type)))
- pp = &p->next;
-
- if (!p) { /* New proc to add to list */
- if (has_type_specifier) {
- p = (XtEventRec*) __XtMalloc(sizeof(XtEventRec) +
- sizeof(XtEventRecExt));
- EXT_TYPE(p) = type;
- EXT_SELECT_DATA(p,0) = select_data;
- p->mask = 1;
- p->has_type_specifier = True;
- } else {
- p = (XtEventRec*) __XtMalloc(sizeof(XtEventRec));
- p->mask = eventMask;
- p->has_type_specifier = False;
- }
- p->proc = proc;
- p->closure = closure;
- p->select = ! raw;
-
- if (position == XtListHead) {
- p->next = widget->core.event_table;
- widget->core.event_table = p;
- pp = &widget->core.event_table;
- } else {
- *pp = p;
- p->next = NULL;
- }
- }
- else {
- if (force_new_position) {
- *pp = p->next;
-
- if (position == XtListHead) {
- p->next = widget->core.event_table;
- widget->core.event_table = p;
- } else {
- /*
- * Find the last element in the list.
- */
- while (*pp)
- pp = &(*pp)->next;
- *pp = p;
- p->next = NULL;
- }
- }
-
- if (!has_type_specifier)
- p->mask |= eventMask;
- else {
- int i;
- /* p->mask specifies count of EXT_SELECT_DATA(p,i) */
- for (i = 0; i < p->mask && select_data != EXT_SELECT_DATA(p,i); )
- i++;
- if (i == p->mask) {
- p = (XtEventRec*) XtRealloc((char*)p,
- sizeof(XtEventRec) +
- sizeof(XtEventRecExt) +
- p->mask * sizeof(XtPointer));
- EXT_SELECT_DATA(p,i) = select_data;
- p->mask++;
- *pp = p;
- }
- }
- }
-
- if (XtIsRealized(widget) && !raw) {
- EventMask mask = XtBuildEventMask(widget);
- Display* dpy = XtDisplay (widget);
-
- if (oldMask != mask)
- XSelectInput(dpy, XtWindow(widget), mask);
-
- if (has_type_specifier) {
- XtPerDisplay pd = _XtGetPerDisplay (dpy);
- int i;
- for (i = 0; i < pd->ext_select_count; i++) {
- if (type >= pd->ext_select_list[i].min &&
- type <= pd->ext_select_list[i].max) {
- CallExtensionSelector(widget, pd->ext_select_list+i, FALSE);
- break;
- }
- if (type < pd->ext_select_list[i].min) break;
- }
- }
- }
-}
-
-#if NeedFunctionPrototypes
-void XtRemoveEventHandler(
- Widget widget,
- EventMask eventMask,
- _XtBoolean other,
- XtEventHandler proc,
- XtPointer closure
- )
-#else
-void XtRemoveEventHandler(widget, eventMask, other, proc, closure)
- Widget widget;
- EventMask eventMask;
- Boolean other;
- XtEventHandler proc;
- XtPointer closure;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- RemoveEventHandler(widget, (XtPointer) &eventMask, 0, FALSE,
- other, proc, closure, FALSE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtAddEventHandler(
- Widget widget,
- EventMask eventMask,
- _XtBoolean other,
- XtEventHandler proc,
- XtPointer closure
- )
-#else
-void XtAddEventHandler(widget, eventMask, other, proc, closure)
- Widget widget;
- EventMask eventMask;
- Boolean other;
- XtEventHandler proc;
- XtPointer closure;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other,
- proc, closure, XtListTail, FALSE, FALSE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtInsertEventHandler(
- Widget widget,
- EventMask eventMask,
- _XtBoolean other,
- XtEventHandler proc,
- XtPointer closure,
- XtListPosition position
- )
-#else
-void XtInsertEventHandler(widget, eventMask, other, proc, closure, position)
- Widget widget;
- EventMask eventMask;
- Boolean other;
- XtEventHandler proc;
- XtPointer closure;
- XtListPosition position;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other,
- proc, closure, position, TRUE, FALSE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtRemoveRawEventHandler(
- Widget widget,
- EventMask eventMask,
- _XtBoolean other,
- XtEventHandler proc,
- XtPointer closure
- )
-#else
-void XtRemoveRawEventHandler(widget, eventMask, other, proc, closure)
- Widget widget;
- EventMask eventMask;
- Boolean other;
- XtEventHandler proc;
- XtPointer closure;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- RemoveEventHandler(widget, (XtPointer) &eventMask, 0, FALSE,
- other, proc, closure, TRUE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtInsertRawEventHandler(
- Widget widget,
- EventMask eventMask,
- _XtBoolean other,
- XtEventHandler proc,
- XtPointer closure,
- XtListPosition position
- )
-#else
-void XtInsertRawEventHandler(widget, eventMask, other, proc, closure, position)
- Widget widget;
- EventMask eventMask;
- Boolean other;
- XtEventHandler proc;
- XtPointer closure;
- XtListPosition position;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other,
- proc, closure, position, TRUE, TRUE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtAddRawEventHandler(
- Widget widget,
- EventMask eventMask,
- _XtBoolean other,
- XtEventHandler proc,
- XtPointer closure
- )
-#else
-void XtAddRawEventHandler(widget, eventMask, other, proc, closure)
- Widget widget;
- EventMask eventMask;
- Boolean other;
- XtEventHandler proc;
- XtPointer closure;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- AddEventHandler(widget, (XtPointer) &eventMask, 0, FALSE, other,
- proc, closure, XtListTail, FALSE, TRUE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtRemoveEventTypeHandler(
- Widget widget,
- int type,
- XtPointer select_data,
- XtEventHandler proc,
- XtPointer closure)
-#else
-void XtRemoveEventTypeHandler(widget, type, select_data, proc, closure)
- Widget widget;
- int type;
- XtPointer select_data;
- XtEventHandler proc;
- XtPointer closure;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- RemoveEventHandler(widget, select_data, type, TRUE,
- FALSE, proc, closure, FALSE);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtInsertEventTypeHandler(
- Widget widget,
- int type,
- XtPointer select_data,
- XtEventHandler proc,
- XtPointer closure,
- XtListPosition position)
-#else
-void XtInsertEventTypeHandler(widget, type, select_data, proc, closure, position)
- Widget widget;
- int type;
- XtPointer select_data;
- XtEventHandler proc;
- XtPointer closure;
- XtListPosition position;
-#endif
-{
- WIDGET_TO_APPCON(widget);
- LOCK_APP(app);
- AddEventHandler(widget, select_data, type, TRUE, FALSE,
- proc, closure, position, TRUE, FALSE);
- UNLOCK_APP(app);
-}
-
-typedef struct _WWPair {
- struct _WWPair *next;
- Window window;
- Widget widget;
-} *WWPair;
-
-typedef struct _WWTable {
- unsigned int mask; /* size of hash table - 1 */
- unsigned int rehash; /* mask - 2 */
- unsigned int occupied; /* number of occupied entries */
- unsigned int fakes; /* number occupied by WWfake */
- Widget *entries; /* the entries */
- WWPair pairs; /* bogus entries */
-} *WWTable;
-
-static Const WidgetRec WWfake; /* placeholder for deletions */
-
-#define WWHASH(tab,win) ((win) & tab->mask)
-#define WWREHASHVAL(tab,win) ((((win) % tab->rehash) + 2) | 1)
-#define WWREHASH(tab,idx,rehash) ((idx + rehash) & tab->mask)
-#define WWTABLE(display) (_XtGetPerDisplay(display)->WWtable)
-
-static void ExpandWWTable();
-
-void XtRegisterDrawable(display, drawable, widget)
- Display* display;
- Drawable drawable;
- Widget widget;
-{
- WWTable tab;
- int idx, rehash;
- Widget entry;
- Window window = (Window) drawable;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- tab = WWTABLE(display);
- if (window != XtWindow(widget)) {
- WWPair pair;
- pair = XtNew(struct _WWPair);
- pair->next = tab->pairs;
- pair->window = window;
- pair->widget = widget;
- tab->pairs = pair;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
- if ((tab->occupied + (tab->occupied >> 2)) > tab->mask)
- ExpandWWTable(tab);
-
- idx = WWHASH(tab, window);
- if ((entry = tab->entries[idx]) && entry != &WWfake) {
- rehash = WWREHASHVAL(tab, window);
- do {
- idx = WWREHASH(tab, idx, rehash);
- } while ((entry = tab->entries[idx]) && entry != &WWfake);
- }
- if (!entry)
- tab->occupied++;
- else if (entry == &WWfake)
- tab->fakes--;
- tab->entries[idx] = widget;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void XtUnregisterDrawable(display, drawable)
- Display* display;
- Drawable drawable;
-{
- WWTable tab;
- int idx, rehash;
- Widget entry;
- Window window = (Window) drawable;
- Widget widget = XtWindowToWidget (display, window);
- DPY_TO_APPCON(display);
-
- if (widget == NULL) return;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- tab = WWTABLE(display);
- if (window != XtWindow(widget)) {
- WWPair *prev, pair;
-
- prev = &tab->pairs;
- while ((pair = *prev) && pair->window != window)
- prev = &pair->next;
- if (pair) {
- *prev = pair->next;
- XtFree((char *)pair);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
- idx = WWHASH(tab, window);
- if (entry = tab->entries[idx]) {
- if (entry != widget) {
- rehash = WWREHASHVAL(tab, window);
- do {
- idx = WWREHASH(tab, idx, rehash);
- if (!(entry = tab->entries[idx])) {
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
- } while (entry != widget);
- }
- tab->entries[idx] = (Widget)&WWfake;
- tab->fakes++;
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-static void ExpandWWTable(tab)
- register WWTable tab;
-{
- unsigned int oldmask;
- register Widget *oldentries, *entries;
- register int oldidx, newidx, rehash;
- register Widget entry;
-
- LOCK_PROCESS;
- oldmask = tab->mask;
- oldentries = tab->entries;
- tab->occupied -= tab->fakes;
- tab->fakes = 0;
- if ((tab->occupied + (tab->occupied >> 2)) > tab->mask) {
- tab->mask = (tab->mask << 1) + 1;
- tab->rehash = tab->mask - 2;
- }
- entries = tab->entries = (Widget *) __XtCalloc(tab->mask+1, sizeof(Widget));
- for (oldidx = 0; oldidx <= oldmask; oldidx++) {
- if ((entry = oldentries[oldidx]) && entry != &WWfake) {
- newidx = WWHASH(tab, XtWindow(entry));
- if (entries[newidx]) {
- rehash = WWREHASHVAL(tab, XtWindow(entry));
- do {
- newidx = WWREHASH(tab, newidx, rehash);
- } while (entries[newidx]);
- }
- entries[newidx] = entry;
- }
- }
- XtFree((char *)oldentries);
- UNLOCK_PROCESS;
-}
-
-Widget XtWindowToWidget(display, window)
- register Display *display;
- register Window window;
-{
- register WWTable tab;
- register int idx, rehash;
- register Widget entry;
- WWPair pair;
- DPY_TO_APPCON(display);
-
- if (!window) return NULL;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- tab = WWTABLE(display);
- idx = WWHASH(tab, window);
- if ((entry = tab->entries[idx]) && XtWindow(entry) != window) {
- rehash = WWREHASHVAL(tab, window);
- do {
- idx = WWREHASH(tab, idx, rehash);
- } while ((entry = tab->entries[idx]) && XtWindow(entry) != window);
- }
- if (entry) {
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return entry;
- }
- for (pair = tab->pairs; pair; pair = pair->next) {
- if (pair->window == window) {
- entry = pair->widget;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return entry;
- }
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return NULL;
-}
-
-void _XtAllocWWTable(pd)
- XtPerDisplay pd;
-{
- register WWTable tab;
-
- tab = (WWTable) __XtMalloc(sizeof(struct _WWTable));
- tab->mask = 0x7f;
- tab->rehash = tab->mask - 2;
- tab->entries = (Widget *) __XtCalloc(tab->mask+1, sizeof(Widget));
- tab->occupied = 0;
- tab->fakes = 0;
- tab->pairs = NULL;
- pd->WWtable = tab;
-}
-
-void _XtFreeWWTable(pd)
- register XtPerDisplay pd;
-{
- register WWPair pair, next;
-
- for (pair = pd->WWtable->pairs; pair; pair = next) {
- next = pair->next;
- XtFree((char *)pair);
- }
- XtFree((char *)pd->WWtable->entries);
- XtFree((char *)pd->WWtable);
-}
-
-#define EHMAXSIZE 25 /* do not make whopping big */
-
-static Boolean CallEventHandlers(widget, event, mask)
- Widget widget;
- XEvent *event;
- EventMask mask;
-{
- register XtEventRec *p;
- XtEventHandler *proc;
- XtPointer *closure;
- XtEventHandler procs[EHMAXSIZE];
- XtPointer closures[EHMAXSIZE];
- Boolean cont_to_disp = True;
- int i, numprocs;
-
- /* Have to copy the procs into an array, because one of them might
- * call XtRemoveEventHandler, which would break our linked list. */
-
- numprocs = 0;
- for (p=widget->core.event_table; p; p = p->next) {
- if ((!p->has_type_specifier && (mask & p->mask)) ||
- (p->has_type_specifier && event->type == EXT_TYPE(p)))
- numprocs++;
- }
- if (numprocs > EHMAXSIZE) {
- proc = (XtEventHandler *)__XtMalloc(numprocs * (sizeof(XtEventHandler) +
- sizeof(XtPointer)));
- closure = (XtPointer *)(proc + numprocs);
- } else {
- proc = procs;
- closure = closures;
- }
- numprocs = 0;
- for (p=widget->core.event_table; p; p = p->next) {
- if ((!p->has_type_specifier && (mask & p->mask)) ||
- (p->has_type_specifier && event->type == EXT_TYPE(p))) {
- proc[numprocs] = p->proc;
- closure[numprocs] = p->closure;
- numprocs++;
- }
- }
-/* FUNCTIONS CALLED THROUGH POINTER proc:
- Selection.c:ReqCleanup,
- "Shell.c":EventHandler,
- PassivGrab.c:ActiveHandler,
- PassivGrab.c:RealizeHandler,
- Keyboard.c:QueryEventMask,
- _XtHandleFocus,
- Selection.c:HandleSelectionReplies,
- Selection.c:HandleGetIncrement,
- Selection.c:HandleIncremental,
- Selection.c:HandlePropertyGone,
- Selection.c:HandleSelectionEvents
- */
- for (i = 0; i < numprocs && cont_to_disp; i++)
- (*(proc[i]))(widget, closure[i], event, &cont_to_disp);
- if (numprocs > EHMAXSIZE)
- XtFree((char *)proc);
- return cont_to_disp;
-}
-
-static void CompressExposures();
-
-#define KnownButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\
- Button4MotionMask|Button5MotionMask)
-
-/* keep this SMALL to avoid blowing stack cache! */
-/* because some compilers allocate all local locals on procedure entry */
-#define EHSIZE 4
-
-#if NeedFunctionPrototypes
-Boolean XtDispatchEventToWidget(
- Widget widget,
- XEvent* event)
-#else
-Boolean XtDispatchEventToWidget(widget, event)
- Widget widget;
- XEvent* event;
-#endif
-{
- register XtEventRec *p;
- Boolean was_dispatched = False;
- Boolean call_tm = False;
- Boolean cont_to_disp;
- EventMask mask;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
-
- mask = _XtConvertTypeToMask(event->type);
- if (event->type == MotionNotify)
- mask |= (event->xmotion.state & KnownButtons);
-
- LOCK_PROCESS;
- if ( (mask == ExposureMask) ||
- ((event->type == NoExpose) && NO_EXPOSE) ||
- ((event->type == GraphicsExpose) && GRAPHICS_EXPOSE) ) {
-
- if (widget->core.widget_class->core_class.expose != NULL ) {
-
- /* We need to mask off the bits that could contain the information
- * about whether or not we desire Graphics and NoExpose events. */
-
- if ( (COMP_EXPOSE_TYPE == XtExposeNoCompress) ||
- (event->type == NoExpose) )
-
- (*widget->core.widget_class->core_class.expose)
- (widget, event, (Region)NULL);
- else {
- CompressExposures(event, widget);
- }
- was_dispatched = True;
- }
- }
-
- if ((mask == VisibilityChangeMask) &&
- XtClass(widget)->core_class.visible_interest) {
- was_dispatched = True;
- /* our visibility just changed... */
- switch (((XVisibilityEvent *)event)->state) {
- case VisibilityUnobscured:
- widget->core.visible = TRUE;
- break;
-
- case VisibilityPartiallyObscured:
- /* what do we want to say here? */
- /* well... some of us is visible */
- widget->core.visible = TRUE;
- break;
-
- case VisibilityFullyObscured:
- widget->core.visible = FALSE;
- /* do we want to mark our children obscured? */
- break;
- }
- }
- UNLOCK_PROCESS;
-
- /* to maintain "copy" semantics we check TM now but call later */
- if (widget->core.tm.translations &&
- (mask & widget->core.tm.translations->eventMask))
- call_tm = True;
-
- cont_to_disp = True;
- p=widget->core.event_table;
- if (p) {
- if (p->next) {
- XtEventHandler proc[EHSIZE];
- XtPointer closure[EHSIZE];
- int numprocs = 0;
-
- /* Have to copy the procs into an array, because one of them might
- * call XtRemoveEventHandler, which would break our linked list. */
-
- for (; p; p = p->next) {
- if ((!p->has_type_specifier && (mask & p->mask)) ||
- (p->has_type_specifier && event->type == EXT_TYPE(p))) {
- if (numprocs >= EHSIZE)
- break;
- proc[numprocs] = p->proc;
- closure[numprocs] = p->closure;
- numprocs++;
- }
- }
- if (numprocs) {
- if (p) {
- cont_to_disp = CallEventHandlers(widget, event, mask);
- } else {
- int i;
- for (i = 0; i < numprocs && cont_to_disp; i++)
- (*(proc[i]))(widget, closure[i], event, &cont_to_disp);
-/* FUNCTIONS CALLED THROUGH POINTER proc:
- Selection.c:ReqCleanup,
- "Shell.c":EventHandler,
- PassivGrab.c:ActiveHandler,
- PassivGrab.c:RealizeHandler,
- Keyboard.c:QueryEventMask,
- _XtHandleFocus,
- Selection.c:HandleSelectionReplies,
- Selection.c:HandleGetIncrement,
- Selection.c:HandleIncremental,
- Selection.c:HandlePropertyGone,
- Selection.c:HandleSelectionEvents
- */
- }
- was_dispatched = True;
- }
- } else if ((!p->has_type_specifier && (mask & p->mask)) ||
- (p->has_type_specifier && event->type == EXT_TYPE(p))) {
- (*p->proc)(widget, p->closure, event, &cont_to_disp);
- was_dispatched = True;
- }
- }
- if (call_tm && cont_to_disp)
- _XtTranslateEvent(widget, event);
- UNLOCK_APP(app);
- return (was_dispatched|call_tm);
-}
-
-/*
- * This structure is passed into the check exposure proc.
- */
-
-typedef struct _CheckExposeInfo {
- int type1, type2; /* Types of events to check for. */
- Boolean maximal; /* Ignore non-exposure events? */
- Boolean non_matching; /* Was there an event that did not
- match either type? */
- Window window; /* Window to match. */
-} CheckExposeInfo;
-
-#define GetCount(ev) (((XExposeEvent *)(ev))->count)
-
-static void SendExposureEvent();
-static Bool CheckExposureEvent();
-static void AddExposureToRectangularRegion();
-
-/* Function Name: CompressExposures
- * Description: Handles all exposure compression
- * Arguments: event - the xevent that is to be dispatched
- * widget - the widget that this event occured in.
- * Returns: none.
- *
- * NOTE: Event must be of type Expose or GraphicsExpose.
- */
-
-static void
-CompressExposures(event, widget)
-Widget widget;
-XEvent * event;
-{
- CheckExposeInfo info;
- int count;
- Display* dpy = XtDisplay (widget);
- XtPerDisplay pd = _XtGetPerDisplay(dpy);
- XtEnum comp_expose;
- XtEnum comp_expose_type;
- Boolean no_region;
-
- LOCK_PROCESS;
- comp_expose = COMP_EXPOSE;
- UNLOCK_PROCESS;
- comp_expose_type = comp_expose & 0x0f;
- no_region = ((comp_expose & XtExposeNoRegion) ? True : False);
-
- if (no_region)
- AddExposureToRectangularRegion(event, pd->region);
- else
- XtAddExposureToRegion(event, pd->region);
-
- if ( GetCount(event) != 0 )
- return;
-
- if ((comp_expose_type == XtExposeCompressSeries) ||
- (XEventsQueued(dpy, QueuedAfterReading) == 0)) {
- SendExposureEvent(event, widget, pd);
- return;
- }
-
- if (comp_expose & XtExposeGraphicsExposeMerged) {
- info.type1 = Expose;
- info.type2 = GraphicsExpose;
- }
- else {
- info.type1 = event->type;
- info.type2 = 0;
- }
- info.maximal = (comp_expose_type == XtExposeCompressMaximal);
- info.non_matching = FALSE;
- info.window = XtWindow(widget);
-
-/*
- * We have to be very careful here not to hose down the processor
- * when blocking until count gets to zero.
- *
- * First, check to see if there are any events in the queue for this
- * widget, and of the correct type.
- *
- * Once we cannot find any more events, check to see that count is zero.
- * If it is not then block until we get another exposure event.
- *
- * If we find no more events, and count on the last one we saw was zero we
- * we can be sure that all events have been processed.
- *
- * Unfortunately, we wind up having to look at the entire queue
- * event if we're not doing Maximal compression, due to the
- * semantics of XCheckIfEvent (we can't abort without re-ordering
- * the event queue as a side-effect).
- */
-
- count = 0;
- while (TRUE) {
- XEvent event_return;
-
- if (XCheckIfEvent(dpy, &event_return,
- CheckExposureEvent, (char *) &info)) {
-
- count = GetCount(&event_return);
- if (no_region)
- AddExposureToRectangularRegion(&event_return, pd->region);
- else
- XtAddExposureToRegion(&event_return, pd->region);
- }
- else if (count != 0) {
- XIfEvent(dpy, &event_return,
- CheckExposureEvent, (char *) &info);
- count = GetCount(&event_return);
- if (no_region)
- AddExposureToRectangularRegion(&event_return, pd->region);
- else
- XtAddExposureToRegion(&event_return, pd->region);
- }
- else /* count == 0 && XCheckIfEvent Failed. */
- break;
- }
-
- SendExposureEvent(event, widget, pd);
-}
-
-void XtAddExposureToRegion(event, region)
- XEvent *event;
- Region region;
-{
- XRectangle rect;
- XExposeEvent *ev = (XExposeEvent *) event;
- /* These Expose and GraphicsExpose fields are at identical offsets */
-
- if (event->type == Expose || event->type == GraphicsExpose) {
- rect.x = ev->x;
- rect.y = ev->y;
- rect.width = ev->width;
- rect.height = ev->height;
- XUnionRectWithRegion(&rect, region, region);
- }
-}
-
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
-static void AddExposureToRectangularRegion(event, region)
- XEvent *event; /* when called internally, type is always appropriate */
- Region region;
-{
- XRectangle rect;
- XExposeEvent *ev = (XExposeEvent *) event;
- /* These Expose and GraphicsExpose fields are at identical offsets */
-
- rect.x = ev->x;
- rect.y = ev->y;
- rect.width = ev->width;
- rect.height = ev->height;
-
- if (XEmptyRegion(region)) {
- XUnionRectWithRegion(&rect, region, region);
- } else {
- XRectangle merged, bbox;
-
- XClipBox(region, &bbox);
- merged.x = MIN(rect.x, bbox.x);
- merged.y = MIN(rect.y, bbox.y);
- merged.width = MAX(rect.x + rect.width,
- bbox.x + bbox.width) - merged.x;
- merged.height = MAX(rect.y + rect.height,
- bbox.y + bbox.height) - merged.y;
- XUnionRectWithRegion(&merged, region, region);
- }
-}
-
-static Region nullRegion;
-/* READ-ONLY VARIABLES: nullRegion */
-
-void _XtEventInitialize()
-{
-#ifndef __lock_lint
- nullRegion = XCreateRegion();
-#endif
-}
-
-/* Function Name: SendExposureEvent
- * Description: Sets the x, y, width, and height of the event
- * to be the clip box of Expose Region.
- * Arguments: event - the X Event to mangle; Expose or GraphicsExpose.
- * widget - the widget that this event occured in.
- * pd - the per display information for this widget.
- * Returns: none.
- */
-
-static void
-SendExposureEvent(event, widget, pd)
-XEvent * event;
-Widget widget;
-XtPerDisplay pd;
-{
- XtExposeProc expose;
- XRectangle rect;
- XtEnum comp_expose;
- XExposeEvent *ev = (XExposeEvent *) event;
-
- XClipBox(pd->region, &rect);
- ev->x = rect.x;
- ev->y = rect.y;
- ev->width = rect.width;
- ev->height = rect.height;
-
- LOCK_PROCESS;
- comp_expose = COMP_EXPOSE;
- expose = widget->core.widget_class->core_class.expose;
- UNLOCK_PROCESS;
- if (comp_expose & XtExposeNoRegion)
- (*expose)(widget, event, NULL);
- else
- (*expose)(widget, event, pd->region);
- (void) XIntersectRegion(nullRegion, pd->region, pd->region);
-}
-
-/* Function Name: CheckExposureEvent
- * Description: Checks the event queue for an expose event
- * Arguments: display - the display connection.
- * event - the event to check.
- * arg - a pointer to the exposure info structure.
- * Returns: TRUE if we found an event of the correct type
- * with the right window.
- *
- * NOTE: The only valid types (info.type1 and info.type2) are Expose
- * and GraphicsExpose.
- */
-
-/* ARGSUSED */
-static Bool
-CheckExposureEvent(disp, event, arg)
-Display * disp;
-XEvent * event;
-char * arg;
-{
- CheckExposeInfo * info = ((CheckExposeInfo *) arg);
-
- if ( (info->type1 == event->type) || (info->type2 == event->type)) {
- if (!info->maximal && info->non_matching) return FALSE;
- if (event->type == GraphicsExpose)
- return(event->xgraphicsexpose.drawable == info->window);
- return(event->xexpose.window == info->window);
- }
- info->non_matching = TRUE;
- return(FALSE);
-}
-
-static EventMask Const masks[] = {
- 0, /* Error, should never see */
- 0, /* Reply, should never see */
- KeyPressMask, /* KeyPress */
- KeyReleaseMask, /* KeyRelease */
- ButtonPressMask, /* ButtonPress */
- ButtonReleaseMask, /* ButtonRelease */
- PointerMotionMask /* MotionNotify */
- | ButtonMotionMask,
- EnterWindowMask, /* EnterNotify */
- LeaveWindowMask, /* LeaveNotify */
- FocusChangeMask, /* FocusIn */
- FocusChangeMask, /* FocusOut */
- KeymapStateMask, /* KeymapNotify */
- ExposureMask, /* Expose */
- NonMaskableMask, /* GraphicsExpose, in GC */
- NonMaskableMask, /* NoExpose, in GC */
- VisibilityChangeMask, /* VisibilityNotify */
- SubstructureNotifyMask, /* CreateNotify */
- StructureNotifyMask /* DestroyNotify */
- | SubstructureNotifyMask,
- StructureNotifyMask /* UnmapNotify */
- | SubstructureNotifyMask,
- StructureNotifyMask /* MapNotify */
- | SubstructureNotifyMask,
- SubstructureRedirectMask, /* MapRequest */
- StructureNotifyMask /* ReparentNotify */
- | SubstructureNotifyMask,
- StructureNotifyMask /* ConfigureNotify */
- | SubstructureNotifyMask,
- SubstructureRedirectMask, /* ConfigureRequest */
- StructureNotifyMask /* GravityNotify */
- | SubstructureNotifyMask,
- ResizeRedirectMask, /* ResizeRequest */
- StructureNotifyMask /* CirculateNotify */
- | SubstructureNotifyMask,
- SubstructureRedirectMask, /* CirculateRequest */
- PropertyChangeMask, /* PropertyNotify */
- NonMaskableMask, /* SelectionClear */
- NonMaskableMask, /* SelectionRequest */
- NonMaskableMask, /* SelectionNotify */
- ColormapChangeMask, /* ColormapNotify */
- NonMaskableMask, /* ClientMessage */
- NonMaskableMask /* MappingNotify */
-};
-
-EventMask _XtConvertTypeToMask (eventType)
- int eventType;
-{
- if (eventType < XtNumber(masks))
- return masks[eventType];
- else
- return NoEventMask;
-}
-
-Boolean _XtOnGrabList(widget, grabList)
- register Widget widget;
- XtGrabRec *grabList;
-{
- register XtGrabRec* gl;
- for (; widget != NULL; widget = (Widget)widget->core.parent) {
- for (gl = grabList; gl != NULL; gl = gl->next) {
- if (gl->widget == widget) return TRUE;
- if (gl->exclusive) break;
- }
- }
- return FALSE;
-}
-
-static Widget LookupSpringLoaded(grabList)
- XtGrabList grabList;
-{
- XtGrabList gl;
-
- for (gl = grabList; gl != NULL; gl = gl->next) {
- if (gl->spring_loaded)
- if (XtIsSensitive(gl->widget))
- return gl->widget;
- else
- return NULL;
- if (gl->exclusive) break;
- }
- return NULL;
-}
-
-static Boolean DispatchEvent(event, widget)
- XEvent* event;
- Widget widget;
-{
-
- if (event->type == EnterNotify &&
- event->xcrossing.mode == NotifyNormal &&
- widget->core.widget_class->core_class.compress_enterleave) {
- if (XPending(event->xcrossing.display)) {
- XEvent nextEvent;
- XPeekEvent(event->xcrossing.display, &nextEvent);
- if (nextEvent.type == LeaveNotify &&
- event->xcrossing.window == nextEvent.xcrossing.window &&
- nextEvent.xcrossing.mode == NotifyNormal &&
- (event->xcrossing.detail != NotifyInferior &&
- nextEvent.xcrossing.detail != NotifyInferior ||
- event->xcrossing.detail == NotifyInferior &&
- nextEvent.xcrossing.detail == NotifyInferior)) {
- /* skip the enter/leave pair */
- XNextEvent(event->xcrossing.display, &nextEvent);
- return False;
- }
- }
- }
-
- if (event->type == MotionNotify &&
- widget->core.widget_class->core_class.compress_motion) {
- while (XPending(event->xmotion.display)) {
- XEvent nextEvent;
- XPeekEvent(event->xmotion.display, &nextEvent);
- if (nextEvent.type == MotionNotify &&
- event->xmotion.window == nextEvent.xmotion.window &&
- event->xmotion.subwindow == nextEvent.xmotion.subwindow) {
- /* replace the current event with the next one */
- XNextEvent(event->xmotion.display, event);
- } else break;
- }
- }
-
- return XtDispatchEventToWidget(widget, event);
-}
-
-typedef enum _GrabType {pass, ignore, remap} GrabType;
-
-#if !defined(AIXV3) || !defined(AIXSHLIB)
-static /* AIX shared libraries are broken */
-#endif
-Boolean _XtDefaultDispatcher(event)
- XEvent *event;
-{
- register Widget widget;
- GrabType grabType;
- XtPerDisplayInput pdi;
- XtGrabList grabList;
- Boolean was_dispatched = False;
- DPY_TO_APPCON(event->xany.display);
-
- /* the default dispatcher discards all extension events */
- if (event->type >= LASTEvent)
- return False;
-
- LOCK_APP(app);
-
- switch (event->type) {
- case KeyPress:
- case KeyRelease:
- case ButtonPress:
- case ButtonRelease: grabType = remap; break;
- case MotionNotify:
- case EnterNotify: grabType = ignore; break;
- default: grabType = pass; break;
- }
-
- widget = XtWindowToWidget (event->xany.display, event->xany.window);
- pdi = _XtGetPerDisplayInput(event->xany.display);
- grabList = *_XtGetGrabList(pdi);
-
- if (widget == NULL) {
- if (grabType == remap
- && (widget = LookupSpringLoaded(grabList)) != NULL) {
- /* event occurred in a non-widget window, but we've promised also
- to dispatch it to the nearest accessible spring_loaded widget */
- was_dispatched = (XFilterEvent(event, XtWindow(widget))
- || XtDispatchEventToWidget(widget, event));
- }
- else was_dispatched = XFilterEvent(event, None);
- }
- else if (grabType == pass) {
- if (event->type == LeaveNotify ||
- event->type == FocusIn ||
- event->type == FocusOut) {
- if (XtIsSensitive (widget))
- was_dispatched = (XFilterEvent(event, XtWindow(widget)) ||
- XtDispatchEventToWidget(widget, event));
- } else was_dispatched = (XFilterEvent(event, XtWindow(widget)) ||
- XtDispatchEventToWidget(widget, event));
- }
- else if (grabType == ignore) {
- if ((grabList == NULL || _XtOnGrabList(widget, grabList))
- && XtIsSensitive(widget)) {
- was_dispatched = (XFilterEvent(event, XtWindow(widget))
- || DispatchEvent(event, widget));
- }
- }
- else if (grabType == remap) {
- EventMask mask = _XtConvertTypeToMask(event->type);
- Widget dspWidget;
- Boolean was_filtered = False;
- extern Widget _XtFindRemapWidget();
- extern void _XtUngrabBadGrabs();
-
- dspWidget = _XtFindRemapWidget(event, widget, mask, pdi);
-
- if ((grabList == NULL ||_XtOnGrabList(dspWidget, grabList))
- && XtIsSensitive(dspWidget)) {
- if (was_filtered = XFilterEvent(event, XtWindow(dspWidget))) {
- /* If this event activated a device grab, release it. */
- _XtUngrabBadGrabs(event, widget, mask, pdi);
- was_dispatched = True;
- } else
- was_dispatched = XtDispatchEventToWidget(dspWidget, event);
- }
- else _XtUngrabBadGrabs(event, widget, mask, pdi);
-
- if (!was_filtered) {
- /* Also dispatch to nearest accessible spring_loaded. */
- /* Fetch this afterward to reflect modal list changes */
- grabList = *_XtGetGrabList(pdi);
- widget = LookupSpringLoaded(grabList);
- if (widget != NULL && widget != dspWidget) {
- was_dispatched = (XFilterEvent(event, XtWindow(widget))
- || XtDispatchEventToWidget(widget, event)
- || was_dispatched);
- }
- }
- }
- UNLOCK_APP(app);
- return was_dispatched;
-}
-
-Boolean XtDispatchEvent (event)
- XEvent *event;
-{
- Boolean was_dispatched, safe;
- int dispatch_level;
- int starting_count;
- XtPerDisplay pd;
- Time time = 0;
- XtEventDispatchProc dispatch = _XtDefaultDispatcher;
- XtAppContext app = XtDisplayToApplicationContext(event->xany.display);
-
- LOCK_APP(app);
- dispatch_level = ++app->dispatch_level;
- starting_count = app->destroy_count;
-
- switch (event->type) {
- case KeyPress:
- case KeyRelease: time = event->xkey.time; break;
- case ButtonPress:
- case ButtonRelease: time = event->xbutton.time; break;
- case MotionNotify: time = event->xmotion.time; break;
- case EnterNotify:
- case LeaveNotify: time = event->xcrossing.time; break;
- case PropertyNotify: time = event->xproperty.time; break;
- case SelectionClear: time = event->xselectionclear.time; break;
-
- case MappingNotify: _XtRefreshMapping(event, True); break;
- }
- pd = _XtGetPerDisplay(event->xany.display);
- if (time) pd->last_timestamp = time;
- pd->last_event = *event;
-
- if (pd->dispatcher_list) {
- dispatch = pd->dispatcher_list[event->type];
- if (dispatch == NULL) dispatch = _XtDefaultDispatcher;
- }
- was_dispatched = (*dispatch)(event);
-
- /*
- * To make recursive XtDispatchEvent work, we need to do phase 2 destroys
- * only on those widgets destroyed by this particular dispatch.
- *
- */
-
- if (app->destroy_count > starting_count)
- _XtDoPhase2Destroy(app, dispatch_level);
-
- app->dispatch_level = dispatch_level - 1;
-
- if ((safe = _XtSafeToDestroy(app))) {
- if (app->dpy_destroy_count != 0) _XtCloseDisplays(app);
- if (app->free_bindings) _XtDoFreeBindings(app);
- }
- UNLOCK_APP(app);
- LOCK_PROCESS;
- if (_XtAppDestroyCount != 0 && safe) _XtDestroyAppContexts();
- UNLOCK_PROCESS;
- return was_dispatched;
-}
-
-/* ARGSUSED */
-static void GrabDestroyCallback(widget, closure, call_data)
- Widget widget;
- XtPointer closure;
- XtPointer call_data;
-{
- /* Remove widget from grab list if it destroyed */
- XtRemoveGrab(widget);
-}
-
-static XtGrabRec *NewGrabRec(widget, exclusive, spring_loaded)
- Widget widget;
- Boolean exclusive;
- Boolean spring_loaded;
-{
- register XtGrabList gl;
-
- gl = XtNew(XtGrabRec);
- gl->next = NULL;
- gl->widget = widget;
- gl->exclusive = exclusive;
- gl->spring_loaded = spring_loaded;
-
- return gl;
-}
-
-#if NeedFunctionPrototypes
-void XtAddGrab(
- Widget widget,
- _XtBoolean exclusive,
- _XtBoolean spring_loaded
- )
-#else
-void XtAddGrab(widget, exclusive, spring_loaded)
- Widget widget;
- Boolean exclusive;
- Boolean spring_loaded;
-#endif
-{
- register XtGrabList gl;
- XtGrabList *grabListPtr;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- grabListPtr = _XtGetGrabList(_XtGetPerDisplayInput(XtDisplay(widget)));
-
- if (spring_loaded && !exclusive) {
- XtAppWarningMsg(app,
- "grabError", "xtAddGrab", XtCXtToolkitError,
- "XtAddGrab requires exclusive grab if spring_loaded is TRUE",
- (String *) NULL, (Cardinal *) NULL);
- exclusive = TRUE;
- }
-
- gl = NewGrabRec(widget, exclusive, spring_loaded);
- gl->next = *grabListPtr;
- *grabListPtr = gl;
-
- XtAddCallback (widget, XtNdestroyCallback,
- GrabDestroyCallback, (XtPointer) NULL);
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void XtRemoveGrab(widget)
- Widget widget;
-{
- register XtGrabList gl;
- register Boolean done;
- XtGrabList *grabListPtr;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
-
- grabListPtr = _XtGetGrabList(_XtGetPerDisplayInput(XtDisplay(widget)));
-
- for (gl = *grabListPtr; gl != NULL; gl = gl->next) {
- if (gl->widget == widget) break;
- }
-
- if (gl == NULL) {
- XtAppWarningMsg(app,
- "grabError","xtRemoveGrab",XtCXtToolkitError,
- "XtRemoveGrab asked to remove a widget not on the list",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
-
- do {
- gl = *grabListPtr;
- done = (gl->widget == widget);
- *grabListPtr = gl->next;
- XtRemoveCallback(gl->widget, XtNdestroyCallback,
- GrabDestroyCallback, (XtPointer)NULL);
- XtFree((char *)gl);
- } while (! done);
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
-}
-
-void XtMainLoop()
-{
- XtAppMainLoop(_XtDefaultAppContext());
-}
-
-void XtAppMainLoop(app)
- XtAppContext app;
-{
- XEvent event;
-
- LOCK_APP(app);
- do {
- XtAppNextEvent(app, &event);
-#ifdef XTHREADS
- /* assert(app == XtDisplayToApplicationContext(event.xany.display)); */
-#endif
- XtDispatchEvent(&event);
- } while(app->exit_flag == FALSE);
- UNLOCK_APP(app);
-}
-
-void _XtFreeEventTable(event_table)
- XtEventTable *event_table;
-{
- register XtEventTable event;
-
- event = *event_table;
- while (event != NULL) {
- register XtEventTable next = event->next;
- XtFree((char *) event);
- event = next;
- }
-}
-
-Time XtLastTimestampProcessed(dpy)
- Display *dpy;
-{
- Time time;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- time = _XtGetPerDisplay(dpy)->last_timestamp;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return(time);
-}
-
-XEvent* XtLastEventProcessed(dpy)
- Display* dpy;
-{
- XEvent* le = NULL;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- le = &_XtGetPerDisplay(dpy)->last_event;
- if (!le->xany.serial)
- le = NULL;
- UNLOCK_APP(app);
- return le;
-}
-
-void _XtSendFocusEvent(child, type)
- Widget child;
- int type;
-{
- child = XtIsWidget(child) ? child : _XtWindowedAncestor(child);
- if (XtIsSensitive(child) && !child->core.being_destroyed
- && XtIsRealized(child)
- && (XtBuildEventMask(child) & FocusChangeMask))
- {
- XFocusChangeEvent event;
- Display* dpy = XtDisplay (child);
-
- event.type = type;
- event.serial = LastKnownRequestProcessed(dpy);
- event.send_event = True;
- event.display = dpy;
- event.window = XtWindow(child);
- event.mode = NotifyNormal;
- event.detail = NotifyAncestor;
- if (XFilterEvent((XEvent*)&event, XtWindow(child)))
- return;
- XtDispatchEventToWidget(child, (XEvent*)&event);
- }
-}
-
-static XtEventDispatchProc* NewDispatcherList()
-{
- XtEventDispatchProc* l =
- (XtEventDispatchProc*) __XtCalloc((Cardinal) 128,
- (Cardinal)sizeof(XtEventDispatchProc));
- return l;
-}
-
-#if NeedFunctionPrototypes
-XtEventDispatchProc XtSetEventDispatcher(
- Display *dpy,
- int event_type,
- XtEventDispatchProc proc
- )
-#else
-XtEventDispatchProc XtSetEventDispatcher(dpy, event_type, proc)
- Display *dpy;
- int event_type;
- XtEventDispatchProc proc;
-#endif
-{
- XtEventDispatchProc *list;
- XtEventDispatchProc old_proc;
- register XtPerDisplay pd;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- pd = _XtGetPerDisplay(dpy);
-
- list = pd->dispatcher_list;
- if (!list) {
- if (proc) list = pd->dispatcher_list = NewDispatcherList();
- else return _XtDefaultDispatcher;
- }
- old_proc = list[event_type];
- list[event_type] = proc;
- if (old_proc == NULL) old_proc = _XtDefaultDispatcher;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return old_proc;
-}
-
-#if NeedFunctionPrototypes
-void XtRegisterExtensionSelector(
- Display *dpy,
- int min_event_type,
- int max_event_type,
- XtExtensionSelectProc proc,
- XtPointer client_data
- )
-#else
-void XtRegisterExtensionSelector(dpy, min_event_type, max_event_type,
- proc, client_data)
- Display *dpy;
- int min_event_type;
- int max_event_type;
- XtExtensionSelectProc proc;
- XtPointer client_data;
-#endif
-{
- ExtSelectRec *e;
- XtPerDisplay pd;
- int i;
- DPY_TO_APPCON(dpy);
-
- if (dpy == NULL) XtErrorMsg("nullDisplay",
- "xtRegisterExtensionSelector", XtCXtToolkitError,
- "XtRegisterExtensionSelector requires a non-NULL display",
- (String *) NULL, (Cardinal *) NULL);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- pd = _XtGetPerDisplay(dpy);
-
- for (i = 0; i < pd->ext_select_count; i++) {
- e = &pd->ext_select_list[i];
- if (e->min == min_event_type && e->max == max_event_type) {
- e->proc = proc;
- e->client_data = client_data;
- return;
- }
- if ((min_event_type >= e->min && min_event_type <= e->max) ||
- (max_event_type >= e->min && max_event_type <= e->max)) {
- XtErrorMsg("rangeError", "xtRegisterExtensionSelector",
- XtCXtToolkitError,
- "Attempt to register multiple selectors for one extension event type",
- (String *) NULL, (Cardinal *) NULL);
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
- }
- pd->ext_select_count++;
- pd->ext_select_list =
- (ExtSelectRec *) XtRealloc((char *) pd->ext_select_list,
- pd->ext_select_count * sizeof(ExtSelectRec));
- for (i = pd->ext_select_count - 1; i > 0; i--) {
- if (pd->ext_select_list[i-1].min > min_event_type) {
- pd->ext_select_list[i] = pd->ext_select_list[i-1];
- } else break;
- }
- pd->ext_select_list[i].min = min_event_type;
- pd->ext_select_list[i].max = max_event_type;
- pd->ext_select_list[i].proc = proc;
- pd->ext_select_list[i].client_data = client_data;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void _XtExtensionSelect(widget)
- Widget widget;
-{
- int i;
- XtPerDisplay pd;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
-
- pd = _XtGetPerDisplay(XtDisplay(widget));
-
- for (i = 0; i < pd->ext_select_count; i++) {
- CallExtensionSelector(widget, pd->ext_select_list+i, FALSE);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
diff --git a/xc/lib/Xt/EventI.h b/xc/lib/Xt/EventI.h
deleted file mode 100644
index 5e2debfc0..000000000
--- a/xc/lib/Xt/EventI.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $TOG: EventI.h /main/23 1998/02/06 13:21:35 kaleb $ */
-/* $oHeader: EventI.h,v 1.3 88/08/24 09:21:11 asente Exp $ */
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-/*
- * Event.h - exported types and functions for toolkit event handler
- *
- * Author: Charles Haynes
- * Digital Equipment Corporation
- * Western Software Laboratory
- * Date: Sun Dec 6 1987
- */
-
-#ifndef _Event_h_
-#define _Event_h_
-
-typedef struct _XtGrabRec *XtGrabList;
-
-extern void _XtEventInitialize(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-typedef struct _XtEventRec {
- XtEventTable next;
- EventMask mask; /* also select_data count for RecExt */
- XtEventHandler proc;
- XtPointer closure;
- unsigned int select:1;
- unsigned int has_type_specifier:1;
- unsigned int async:1; /* not used, here for Digital extension? */
-} XtEventRec;
-
-typedef struct _XtGrabRec {
- XtGrabList next;
- Widget widget;
- unsigned int exclusive:1;
- unsigned int spring_loaded:1;
-}XtGrabRec;
-
-typedef struct _BlockHookRec {
- struct _BlockHookRec* next;
- XtAppContext app;
- XtBlockHookProc proc;
- XtPointer closure;
-} BlockHookRec, *BlockHook;
-
-extern void _XtFreeEventTable(
-#if NeedFunctionPrototypes
- XtEventTable* /* event_table */
-#endif
-);
-
-extern Boolean _XtOnGrabList(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtGrabRec* /* grabList */
-#endif
-);
-
-extern void _XtRemoveAllInputs(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-extern void _XtRefreshMapping(
-#if NeedFunctionPrototypes
- XEvent* /* event */,
- _XtBoolean /* dispatch */
-#endif
-);
-
-extern EventMask _XtConvertTypeToMask(
-#if NeedFunctionPrototypes
- int /* eventType */
-#endif
-);
-
-#endif /* _Event_h_ */
diff --git a/xc/lib/Xt/EventUtil.c b/xc/lib/Xt/EventUtil.c
deleted file mode 100644
index 7e6122298..000000000
--- a/xc/lib/Xt/EventUtil.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/* $TOG: EventUtil.c /main/14 1998/02/06 13:21:41 kaleb $ */
-
-/********************************************************
-
-Copyright 1988 by Hewlett-Packard Company
-Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the 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, Digital, or Sun 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.
-
-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, 1988, 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.
-
-*/
-
-#include "IntrinsicI.h"
-#include "PassivGraI.h"
-#include "StringDefs.h"
-
-static XContext perWidgetInputContext = 0;
-
-void _XtFreePerWidgetInput(w, pwi)
- Widget w;
- XtPerWidgetInput pwi;
-{
- LOCK_PROCESS;
- XDeleteContext(XtDisplay(w),
- (Window)w,
- perWidgetInputContext);
-
- XtFree((char *)pwi);
- UNLOCK_PROCESS;
-}
-
-/*
- * This routine gets the passive list associated with the widget
- * from the context manager.
- */
-#if NeedFunctionPrototypes
-XtPerWidgetInput _XtGetPerWidgetInput(
- Widget widget,
- _XtBoolean create
- )
-#else
-XtPerWidgetInput _XtGetPerWidgetInput(widget, create)
- Widget widget;
- Boolean create;
-#endif
-{
- XtPerWidgetInput pwi = NULL;
- Display *dpy = widget->core.screen->display;
-
- LOCK_PROCESS;
- if (! perWidgetInputContext)
- perWidgetInputContext = XUniqueContext();
-
- if (XFindContext(dpy,
- (Window)widget,
- perWidgetInputContext,
- (XPointer *)&pwi) &&
- create)
- {
- pwi = (XtPerWidgetInput)
- __XtMalloc((unsigned) sizeof(XtPerWidgetInputRec));
-
- pwi->focusKid = NULL;
- pwi->queryEventDescendant = NULL;
- pwi->focalPoint = XtUnrelated;
- pwi->keyList =
- pwi->ptrList = NULL;
-
- pwi->haveFocus =
- pwi->map_handler_added =
- pwi->realize_handler_added =
- pwi->active_handler_added = FALSE;
-
- XtAddCallback(widget, XtNdestroyCallback,
- _XtDestroyServerGrabs, (XtPointer)pwi);
-
- (void) XSaveContext(dpy,
- (Window)widget,
- perWidgetInputContext,
- (char *) pwi);
- }
- UNLOCK_PROCESS;
- return pwi;
-}
-
-
-void _XtFillAncestorList(listPtr, maxElemsPtr, numElemsPtr, start, breakWidget)
- Widget **listPtr;
- int *maxElemsPtr, *numElemsPtr;
- Widget start, breakWidget;
-{
-#define CACHESIZE 16
- Cardinal i;
- Widget w;
- Widget *trace = *listPtr;
-
- /* First time in, allocate the ancestor list */
- if (trace == NULL)
- {
- trace = (Widget *) __XtMalloc(CACHESIZE * sizeof(Widget));
- *maxElemsPtr = CACHESIZE;
- }
- /* First fill in the ancestor list */
-
- trace[0] = start;
-
- for (i = 1, w = XtParent(start);
- w != NULL && !XtIsShell(trace[i-1]) && trace[i-1] != breakWidget;
- w = XtParent(w), i++) {
- if (i == *maxElemsPtr) {
- /* This should rarely happen, but if it does it'll probably
- happen again, so grow the ancestor list */
- *maxElemsPtr += CACHESIZE;
- trace = (Widget *) XtRealloc((char*)trace,
- sizeof(Widget) * (*maxElemsPtr));
- }
- trace[i] = w;
- }
- *listPtr = trace;
- *numElemsPtr = i;
-#undef CACHESIZE
-}
-
-
-Widget _XtFindRemapWidget(event, widget, mask, pdi)
- XEvent *event;
- Widget widget;
- EventMask mask;
- XtPerDisplayInput pdi;
-{
- Widget dspWidget = widget;
-
- if (!pdi->traceDepth || !(widget == pdi->trace[0]))
- {
- _XtFillAncestorList(&pdi->trace, &pdi->traceMax,
- &pdi->traceDepth, widget, NULL);
- pdi->focusWidget = NULL; /* invalidate the focus
- cache */
- }
- if (mask & (KeyPressMask | KeyReleaseMask))
- dspWidget = _XtProcessKeyboardEvent((XKeyEvent*)event, widget, pdi);
- else if (mask &(ButtonPressMask | ButtonReleaseMask))
- dspWidget = _XtProcessPointerEvent((XButtonEvent*)event, widget,pdi);
-
- return dspWidget;
-}
-
-void _XtUngrabBadGrabs(event, widget, mask, pdi)
- XEvent *event;
- Widget widget;
- EventMask mask;
- XtPerDisplayInput pdi;
-{
- XKeyEvent * ke = (XKeyEvent *) event;
-
- if (mask & (KeyPressMask | KeyReleaseMask))
- {
- if (IsServerGrab(pdi->keyboard.grabType) &&
- !_XtOnGrabList(pdi->keyboard.grab.widget,
- pdi->grabList))
- XtUngrabKeyboard(widget, ke->time);
-
- }
- else
- {
- if (IsServerGrab(pdi->pointer.grabType) &&
- !_XtOnGrabList(pdi->pointer.grab.widget,
- pdi->grabList))
- XtUngrabPointer(widget, ke->time);
- }
-}
diff --git a/xc/lib/Xt/Functions.c b/xc/lib/Xt/Functions.c
deleted file mode 100644
index 423cb4d2a..000000000
--- a/xc/lib/Xt/Functions.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* $TOG: Functions.c /main/14 1998/02/06 13:21:55 kaleb $ */
-
-/*
-
-Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above 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 not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-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 1985, 1986, 1987, 1988, 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.
-
-*/
-
-#include "IntrinsicI.h"
-#include <X11/Shell.h>
-#include <X11/Vendor.h>
-
-/*
- * This file defines functional equivalents to all macros defined
- * in Intrinsic.h
- *
- */
-
-#undef XtIsRectObj
-Boolean XtIsRectObj(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x02);
-}
-
-
-#undef XtIsWidget
-Boolean XtIsWidget(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x04);
-}
-
-
-#undef XtIsComposite
-Boolean XtIsComposite(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x08);
-}
-
-
-#undef XtIsConstraint
-Boolean XtIsConstraint(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x10);
-}
-
-
-#undef XtIsShell
-Boolean XtIsShell(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x20);
-}
-
-
-#undef XtIsOverrideShell
-Boolean XtIsOverrideShell(object)
- Widget object;
-{
- return _XtIsSubclassOf(object, (WidgetClass)overrideShellWidgetClass,
- (WidgetClass)shellWidgetClass, 0x20);
-}
-
-
-#undef XtIsWMShell
-Boolean XtIsWMShell(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x40);
-}
-
-
-#undef XtIsVendorShell
-Boolean XtIsVendorShell(object)
- Widget object;
-{
- Boolean retval;
-
- LOCK_PROCESS;
- retval = _XtIsSubclassOf(object,
-#ifdef notdef
-/*
- * We don't refer to vendorShell directly, because some shared libraries
- * bind local references tightly.
- */
- (WidgetClass)vendorShellWidgetClass,
-#endif
- transientShellWidgetClass->core_class.superclass,
- (WidgetClass)wmShellWidgetClass, 0x40);
- UNLOCK_PROCESS;
- return retval;
-}
-
-
-#undef XtIsTransientShell
-Boolean XtIsTransientShell(object)
- Widget object;
-{
- return _XtIsSubclassOf(object, (WidgetClass)transientShellWidgetClass,
- (WidgetClass)wmShellWidgetClass, 0x40);
-}
-
-
-#undef XtIsTopLevelShell
-Boolean XtIsTopLevelShell(object)
- Widget object;
-{
- return _XtCheckSubclassFlag(object, 0x80);
-}
-
-
-#undef XtIsApplicationShell
-Boolean XtIsApplicationShell(object)
- Widget object;
-{
- return _XtIsSubclassOf(object, (WidgetClass)applicationShellWidgetClass,
- (WidgetClass)topLevelShellWidgetClass, 0x80);
-}
-
-#undef XtIsSessionShell
-Boolean XtIsSessionShell(object)
- Widget object;
-{
- return _XtIsSubclassOf(object, (WidgetClass)sessionShellWidgetClass,
- (WidgetClass)topLevelShellWidgetClass, 0x80);
-}
-
-#undef XtMapWidget
-void XtMapWidget(w)
- Widget w;
-{
- Widget hookobj;
- WIDGET_TO_APPCON(w);
-
- LOCK_APP(app);
- XMapWindow(XtDisplay(w), XtWindow(w));
- hookobj = XtHooksOfDisplay(XtDisplay(w));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHmapWidget;
- call_data.widget = w;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-}
-
-
-#undef XtUnmapWidget
-void XtUnmapWidget(w)
- Widget w;
-{
- Widget hookobj;
- WIDGET_TO_APPCON(w);
-
- LOCK_APP(app);
- XUnmapWindow(XtDisplay(w), XtWindow(w));
- hookobj = XtHooksOfDisplay(XtDisplay(w));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHunmapWidget;
- call_data.widget = w;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-}
-
-
-#undef XtNewString
-String XtNewString(str)
- String str;
-{
- if (str == NULL)
- return NULL;
- else
- return strcpy(__XtMalloc((unsigned)strlen(str) + 1), str);
-}
diff --git a/xc/lib/Xt/GCManager.c b/xc/lib/Xt/GCManager.c
deleted file mode 100644
index 16511618b..000000000
--- a/xc/lib/Xt/GCManager.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* $TOG: GCManager.c /main/40 1998/02/06 13:22:01 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 1990, 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 "IntrinsicI.h"
-
-
-typedef struct _GCrec {
- unsigned char screen; /* Screen for GC */
- unsigned char depth; /* Depth for GC */
- char dashes; /* Dashes value */
- Pixmap clip_mask; /* Clip_mask value */
- Cardinal ref_count; /* # of shareholders */
- GC gc; /* The GC itself. */
- XtGCMask dynamic_mask; /* Writable values */
- XtGCMask unused_mask; /* Unused values */
- struct _GCrec *next; /* Next GC for this widgetkind. */
-} GCrec, *GCptr;
-
-#define GCVAL(bit,mask,val,default) ((bit&mask) ? val : default)
-
-#define CHECK(bit,comp,default) \
- if ((checkMask & bit) && \
- (GCVAL(bit,valueMask,v->comp,default) != gcv.comp)) return False
-
-#define ALLGCVALS (GCFunction | GCPlaneMask | GCForeground | \
- GCBackground | GCLineWidth | GCLineStyle | \
- GCCapStyle | GCJoinStyle | GCFillStyle | \
- GCFillRule | GCTile | GCStipple | \
- GCTileStipXOrigin | GCTileStipYOrigin | \
- GCFont | GCSubwindowMode | GCGraphicsExposures | \
- GCClipXOrigin | GCClipYOrigin | GCDashOffset | \
- GCArcMode)
-
-static Bool Matches(dpy, ptr, valueMask, v, readOnlyMask, dynamicMask)
- Display *dpy;
- GCptr ptr;
- register XtGCMask valueMask;
- register XGCValues *v;
- XtGCMask readOnlyMask;
- XtGCMask dynamicMask;
-{
- XGCValues gcv;
- register XtGCMask checkMask;
-
- if (readOnlyMask & ptr->dynamic_mask)
- return False;
- if (((ptr->dynamic_mask|ptr->unused_mask) & dynamicMask) != dynamicMask)
- return False;
- if (!XGetGCValues(dpy, ptr->gc, ALLGCVALS, &gcv))
- return False;
- checkMask = readOnlyMask & ~ptr->unused_mask;
- CHECK(GCForeground, foreground, 0);
- CHECK(GCBackground, background, 1);
- CHECK(GCFont, font, ~0L);
- CHECK(GCFillStyle, fill_style, FillSolid);
- CHECK(GCLineWidth, line_width, 0);
- CHECK(GCFunction, function, GXcopy);
- CHECK(GCGraphicsExposures, graphics_exposures, True);
- CHECK(GCTile, tile, ~0L);
- CHECK(GCSubwindowMode, subwindow_mode, ClipByChildren);
- CHECK(GCPlaneMask, plane_mask, AllPlanes);
- CHECK(GCLineStyle, line_style, LineSolid);
- CHECK(GCCapStyle, cap_style, CapButt);
- CHECK(GCJoinStyle, join_style, JoinMiter);
- CHECK(GCFillRule, fill_rule, EvenOddRule);
- CHECK(GCArcMode, arc_mode, ArcPieSlice);
- CHECK(GCStipple, stipple, ~0L);
- CHECK(GCTileStipXOrigin, ts_x_origin, 0);
- CHECK(GCTileStipYOrigin, ts_y_origin, 0);
- CHECK(GCClipXOrigin, clip_x_origin, 0);
- CHECK(GCClipYOrigin, clip_y_origin, 0);
- CHECK(GCDashOffset, dash_offset, 0);
- gcv.clip_mask = ptr->clip_mask;
- CHECK(GCClipMask, clip_mask, None);
- gcv.dashes = ptr->dashes;
- CHECK(GCDashList, dashes, 4);
- valueMask &= ptr->unused_mask | dynamicMask;
- if (valueMask) {
- XChangeGC(dpy, ptr->gc, valueMask, v);
- if (valueMask & GCDashList)
- ptr->dashes = v->dashes;
- if (valueMask & GCClipMask)
- ptr->clip_mask = v->clip_mask;
- }
- ptr->unused_mask &= ~(dynamicMask | readOnlyMask);
- ptr->dynamic_mask |= dynamicMask;
- return True;
-} /* Matches */
-
-/* Called by CloseDisplay to free the per-display GC list */
-void _XtGClistFree(dpy, pd)
- Display *dpy;
- register XtPerDisplay pd;
-{
- register GCptr GClist, next;
- register int i;
-
- GClist = pd->GClist;
- while (GClist) {
- next = GClist->next;
- XtFree((char*)GClist);
- GClist = next;
- }
- if (pd->pixmap_tab) {
- for (i = ScreenCount(dpy); --i >= 0; ) {
- if (pd->pixmap_tab[i])
- XtFree((char *)pd->pixmap_tab[i]);
- }
- XtFree((char *)pd->pixmap_tab);
- }
-}
-
-
-/*
- * Return a GC with the given values and characteristics.
- */
-
-GC XtAllocateGC(widget, depth, valueMask, values, dynamicMask, unusedMask)
- register Widget widget;
- Cardinal depth;
- XtGCMask valueMask;
- XGCValues *values;
- XtGCMask dynamicMask;
- XtGCMask unusedMask;
-{
- register GCptr *prev;
- register GCptr cur;
- Screen *screen;
- register Display *dpy;
- register XtPerDisplay pd;
- Drawable drawable;
- Drawable *pixmaps;
- XtGCMask readOnlyMask;
- GC retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- if (!XtIsWidget(widget))
- widget = _XtWindowedAncestor(widget);
- if (!depth)
- depth = widget->core.depth;
- screen = XtScreen(widget);
- dpy = DisplayOfScreen(screen);
- pd = _XtGetPerDisplay(dpy);
- unusedMask &= ~valueMask;
- readOnlyMask = ~(dynamicMask | unusedMask);
-
- /* Search for existing GC that matches exactly */
- for (prev = &pd->GClist; cur = *prev; prev = &cur->next) {
- if (cur->depth == depth &&
- ScreenOfDisplay(dpy, cur->screen) == screen &&
- Matches(dpy, cur, valueMask, values, readOnlyMask, dynamicMask)) {
- cur->ref_count++;
- /* Move this GC to front of list */
- *prev = cur->next;
- cur->next = pd->GClist;
- pd->GClist = cur;
- retval = cur->gc;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return retval;
- }
- }
-
- /* No matches, have to create a new one */
- cur = XtNew(GCrec);
- cur->screen = XScreenNumberOfScreen(screen);
- cur->depth = depth;
- cur->ref_count = 1;
- cur->dynamic_mask = dynamicMask;
- cur->unused_mask = (unusedMask & ~dynamicMask);
- cur->dashes = GCVAL(GCDashList, valueMask, values->dashes, 4);
- cur->clip_mask = GCVAL(GCClipMask, valueMask, values->clip_mask, None);
- drawable = 0;
- if (depth == widget->core.depth)
- drawable = XtWindow(widget);
- if (!drawable && depth == DefaultDepthOfScreen(screen))
- drawable = RootWindowOfScreen(screen);
- if (!drawable) {
- if (!pd->pixmap_tab) {
- int n;
- pd->pixmap_tab = (Drawable **)__XtMalloc((unsigned)ScreenCount(dpy) *
- sizeof(Drawable *));
- for (n = 0; n < ScreenCount(dpy); n++)
- pd->pixmap_tab[n] = NULL;
- }
- pixmaps = pd->pixmap_tab[cur->screen];
- if (!pixmaps) {
- int max, n, *depths;
- depths = XListDepths(dpy, cur->screen, &n);
- n--;
- max = depths[n];
- while (n--) {
- if (depths[n] > max)
- max = depths[n];
- }
- XFree((char *)depths);
- pixmaps = (Drawable *)__XtCalloc((unsigned)max, sizeof(Drawable));
- pd->pixmap_tab[cur->screen] = pixmaps;
- }
- drawable = pixmaps[cur->depth - 1];
- if (!drawable) {
- drawable = XCreatePixmap(dpy, RootWindowOfScreen(screen), 1, 1,
- cur->depth);
- pixmaps[cur->depth - 1] = drawable;
- }
- }
- cur->gc = XCreateGC(dpy, drawable, valueMask, values);
- cur->next = pd->GClist;
- pd->GClist = cur;
- retval = cur->gc;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return retval;
-} /* XtAllocateGC */
-
-/*
- * Return a read-only GC with the given values.
- */
-
-GC XtGetGC(widget, valueMask, values)
- register Widget widget;
- XtGCMask valueMask;
- XGCValues *values;
-{
- return XtAllocateGC(widget, 0, valueMask, values, 0, 0);
-} /* XtGetGC */
-
-void XtReleaseGC(widget, gc)
- Widget widget;
- register GC gc;
-{
- register GCptr cur, *prev;
- Display* dpy;
- XtPerDisplay pd;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- dpy = XtDisplayOfObject(widget);
- pd = _XtGetPerDisplay(dpy);
-
- for (prev = &pd->GClist; cur = *prev; prev = &cur->next) {
- if (cur->gc == gc) {
- if (--(cur->ref_count) == 0) {
- *prev = cur->next;
- XFreeGC(dpy, gc);
- XtFree((char *) cur);
- }
- break;
- }
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-} /* XtReleaseGC */
-
-/* The following interface is broken and supplied only for backwards
- * compatibility. It will work properly in all cases only if there
- * is exactly 1 Display created by the application.
- */
-
-void XtDestroyGC(gc)
- register GC gc;
-{
- GCptr cur, *prev;
- XtAppContext app;
-
- LOCK_PROCESS;
- app = _XtGetProcessContext()->appContextList;
- /* This is awful; we have to search through all the lists
- to find the GC. */
- for (; app; app = app->next) {
- int i;
- for (i = app->count; i ;) {
- Display *dpy = app->list[--i];
- XtPerDisplay pd = _XtGetPerDisplay(dpy);
- for (prev = &pd->GClist; cur = *prev; prev = &cur->next) {
- if (cur->gc == gc) {
- if (--(cur->ref_count) == 0) {
- *prev = cur->next;
- XFreeGC(dpy, gc);
- XtFree((char *) cur);
- }
- UNLOCK_PROCESS;
- return;
- }
- }
- }
- }
- UNLOCK_PROCESS;
-} /* XtDestroyGC */
diff --git a/xc/lib/Xt/Geometry.c b/xc/lib/Xt/Geometry.c
deleted file mode 100644
index 5d9828508..000000000
--- a/xc/lib/Xt/Geometry.c
+++ /dev/null
@@ -1,823 +0,0 @@
-/* $TOG: Geometry.c /main/69 1998/02/06 13:22:07 kaleb $ CHECKEDOUT */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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 "IntrinsicI.h"
-#include "ShellP.h"
-
-static void ClearRectObjAreas(r, old)
- RectObj r;
- XWindowChanges* old;
-{
- Widget pw = _XtWindowedAncestor((Widget)r);
- int bw2;
-
- bw2 = old->border_width << 1;
- XClearArea( XtDisplay(pw), XtWindow(pw),
- old->x, old->y,
- old->width + bw2, old->height + bw2,
- TRUE );
-
- bw2 = r->rectangle.border_width << 1;
- XClearArea( XtDisplay(pw), XtWindow(pw),
- (int)r->rectangle.x, (int)r->rectangle.y,
- (unsigned int)(r->rectangle.width + bw2),
- (unsigned int)(r->rectangle.height + bw2),
- TRUE );
-}
-
-/*
- * Internal function used by XtMakeGeometryRequest and XtSetValues.
- * Returns more data than the public interface. Does not convert
- * XtGeometryDone to XtGeometryYes.
- *
- * clear_rect_obj - *** RETURNED ***
- * TRUE if the rect obj has been cleared, false otherwise.
- */
-
-XtGeometryResult
-_XtMakeGeometryRequest (widget, request, reply, clear_rect_obj)
- Widget widget;
- XtWidgetGeometry *request, *reply;
- Boolean * clear_rect_obj;
-{
- XtWidgetGeometry junk;
- XtGeometryHandler manager;
- XtGeometryResult returnCode;
- Widget parent = widget->core.parent;
- Boolean managed, parentRealized, rgm = False;
- XtConfigureHookDataRec req;
- Widget hookobj;
-
- *clear_rect_obj = FALSE;
-
- CALLGEOTAT(_XtGeoTrace(widget,
- "\"%s\" is making a %sgeometry request to its parent \"%s\".\n",
- XtName(widget),
- ((request->request_mode & XtCWQueryOnly))? "query only ":"",
- (XtParent(widget))?XtName(XtParent(widget)):"Root"));
- CALLGEOTAT(_XtGeoTab(1));
-
- if (XtIsShell(widget)) {
- ShellClassExtension ext;
- LOCK_PROCESS;
- for (ext = (ShellClassExtension)((ShellWidgetClass)XtClass(widget))
- ->shell_class.extension;
- ext != NULL && ext->record_type != NULLQUARK;
- ext = (ShellClassExtension)ext->next_extension);
-
- if (ext != NULL) {
- if ( ext->version == XtShellExtensionVersion
- && ext->record_size == sizeof(ShellClassExtensionRec)) {
- manager = ext->root_geometry_manager;
- rgm = True;
- } else {
- String params[1];
- Cardinal num_params = 1;
- params[0] = XtClass(widget)->core_class.class_name;
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "invalidExtension", "xtMakeGeometryRequest",
- XtCXtToolkitError,
- "widget class %s has invalid ShellClassExtension record",
- params, &num_params);
- }
- } else {
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "internalError", "xtMakeGeometryRequest",
- XtCXtToolkitError,
- "internal error; ShellClassExtension is NULL",
- NULL, NULL);
- }
- managed = True;
- parentRealized = TRUE;
- UNLOCK_PROCESS;
- } else /* not shell */ {
- if (parent == NULL)
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "invalidParent","xtMakeGeometryRequest",
- XtCXtToolkitError,
- "non-shell has no parent in XtMakeGeometryRequest",
- (String *)NULL, (Cardinal *)NULL);
-
- /*
- * This shouldn't ever happen, we only test for this to pass VSW5.
- * Normally managing the widget will catch this, but VSW5 does
- * some really screwy stuff to get here.
- */
- if (!XtIsComposite(parent))
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "invalidParent", "xtMakeGeometryRequest",
- XtCXtToolkitError,
- "XtMakeGeometryRequest - parent not composite",
- (String *)NULL, (Cardinal *)NULL);
-
- managed = XtIsManaged(widget);
- parentRealized = XtIsRealized(parent);
- LOCK_PROCESS;
- manager = ((CompositeWidgetClass) (parent->core.widget_class))
- ->composite_class.geometry_manager;
- UNLOCK_PROCESS;
- }
-
- if (managed && manager == (XtGeometryHandler) NULL) {
- XtErrorMsg("invalidGeometryManager","xtMakeGeometryRequest",
- XtCXtToolkitError,
- "XtMakeGeometryRequest - parent has no geometry manager",
- (String *)NULL, (Cardinal *)NULL);
- }
-
- if (widget->core.being_destroyed) {
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,
- "It is being destroyed, just return XtGeometryNo.\n"));
- return XtGeometryNo;
- }
-
- /* see if requesting anything to change */
- req.changeMask = 0;
- if (request->request_mode & CWStackMode
- && request->stack_mode != XtSMDontChange) {
- req.changeMask |= CWStackMode;
- CALLGEOTAT(_XtGeoTrace(widget,
- "Asking for a change in StackMode!\n"));
- if (request->request_mode & CWSibling) {
- XtCheckSubclass(request->sibling, rectObjClass,
- "XtMakeGeometryRequest");
- req.changeMask |= CWSibling;
- }
- }
- if (request->request_mode & CWX
- && widget->core.x != request->x) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "Asking for a change in x: from %d to %d.\n",
- widget->core.x, request->x));
- req.changeMask |= CWX;
- }
- if (request->request_mode & CWY
- && widget->core.y != request->y) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "Asking for a change in y: from %d to %d.\n",
- widget->core.y, request->y));
- req.changeMask |= CWY;
- }
- if (request->request_mode & CWWidth
- && widget->core.width != request->width) {
- CALLGEOTAT(_XtGeoTrace(widget,"Asking for a change in width: from %d to %d.\n",
- widget->core.width, request->width));
- req.changeMask |= CWWidth;
- }
- if (request->request_mode & CWHeight
- && widget->core.height != request->height) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "Asking for a change in height: from %d to %d.\n",
- widget->core.height, request->height));
- req.changeMask |= CWHeight;
- }
- if (request->request_mode & CWBorderWidth
- && widget->core.border_width != request->border_width){
- CALLGEOTAT(_XtGeoTrace(widget,
- "Asking for a change in border_width: from %d to %d.\n",
- widget->core.border_width, request->border_width));
- req.changeMask |= CWBorderWidth;
- }
- if (! req.changeMask) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "Asking for nothing new,\n"));
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,
- "just return XtGeometryYes.\n"));
- return XtGeometryYes;
- }
- req.changeMask |= (request->request_mode & XtCWQueryOnly);
-
- if ( !(req.changeMask & XtCWQueryOnly) && XtIsRealized(widget) ) {
- /* keep record of the current geometry so we know what's changed */
- req.changes.x = widget->core.x ;
- req.changes.y = widget->core.y ;
- req.changes.width = widget->core.width ;
- req.changes.height = widget->core.height ;
- req.changes.border_width = widget->core.border_width ;
- }
-
- if (!managed || !parentRealized) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "Not Managed or Parent not realized.\n"));
- /* Don't get parent's manager involved--assume the answer is yes */
- if (req.changeMask & XtCWQueryOnly) {
- /* He was just asking, don't change anything, just tell him yes */
- CALLGEOTAT(_XtGeoTrace(widget,"QueryOnly request\n"));
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"just return XtGeometryYes.\n"));
- return XtGeometryYes;
- } else {
- CALLGEOTAT(_XtGeoTrace(widget,
- "Copy values from request to widget.\n"));
- /* copy values from request to widget */
- if (request->request_mode & CWX)
- widget->core.x = request->x;
- if (request->request_mode & CWY)
- widget->core.y = request->y;
- if (request->request_mode & CWWidth)
- widget->core.width = request->width;
- if (request->request_mode & CWHeight)
- widget->core.height = request->height;
- if (request->request_mode & CWBorderWidth)
- widget->core.border_width = request->border_width;
- if (!parentRealized) {
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"and return XtGeometryYes.\n"));
- return XtGeometryYes;
- }
- else returnCode = XtGeometryYes;
- }
- } else {
- /* go ask the widget's geometry manager */
- CALLGEOTAT(_XtGeoTrace(widget,
- "Go ask the parent geometry manager.\n"));
- if (reply == (XtWidgetGeometry *) NULL) {
- returnCode = (*manager)(widget, request, &junk);
- } else {
- returnCode = (*manager)(widget, request, reply);
- }
- }
-
- /*
- * If Unrealized, not a XtGeometryYes, or a query-only then we are done.
- */
-
- if ((returnCode != XtGeometryYes) ||
- (req.changeMask & XtCWQueryOnly) || !XtIsRealized(widget)) {
-
-#ifdef XT_GEO_TATTLER
- switch(returnCode){
- case XtGeometryNo:
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryNo.\n",
- (XtParent(widget))?XtName(XtParent(widget)):"Root"));
- /* check for no change */
- break ;
- case XtGeometryDone:
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryDone.\n",
- (XtParent(widget))?XtName(XtParent(widget)):"Root"));
- /* check for no change in queryonly */
- break ;
- case XtGeometryAlmost:
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryAlmost.\n",
- (XtParent(widget))?XtName(XtParent(widget)):"Root"));
- CALLGEOTAT(_XtGeoTab(1));
- CALLGEOTAT(_XtGeoTrace(widget,"Proposal: width %d height %d.\n",
- (reply)?reply->width:junk.width,
- (reply)?reply->height:junk.height));
- CALLGEOTAT(_XtGeoTab(-1));
-
- /* check for no change */
- break ;
- case XtGeometryYes:
- if (req.changeMask & XtCWQueryOnly) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "QueryOnly specified, no configuration.\n"));
- }
- if (!XtIsRealized(widget)) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "\"%s\" not realized, no configuration.\n",
- XtName(widget)));
- }
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryYes.\n",
- (XtParent(widget))?XtName(XtParent(widget)):"Root"));
- break ;
- }
-#endif
- return returnCode;
- }
-
- CALLGEOTAT(_XtGeoTab(-1));
- CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" returns XtGeometryYes.\n",
- (XtParent(widget))?XtName(XtParent(widget)):"Root"));
-
- if (XtIsWidget(widget)) { /* reconfigure the window (if needed) */
-
- if (rgm) return returnCode;
-
- if (req.changes.x != widget->core.x) {
- req.changeMask |= CWX;
- req.changes.x = widget->core.x;
- CALLGEOTAT(_XtGeoTrace(widget,
- "x changing to %d\n",widget->core.x));
- }
- if (req.changes.y != widget->core.y) {
- req.changeMask |= CWY;
- req.changes.y = widget->core.y;
- CALLGEOTAT(_XtGeoTrace(widget,
- "y changing to %d\n",widget->core.y));
- }
- if (req.changes.width != widget->core.width) {
- req.changeMask |= CWWidth;
- req.changes.width = widget->core.width;
- CALLGEOTAT(_XtGeoTrace(widget,
- "width changing to %d\n",widget->core.width));
- }
- if (req.changes.height != widget->core.height) {
- req.changeMask |= CWHeight;
- req.changes.height = widget->core.height;
- CALLGEOTAT(_XtGeoTrace(widget,
- "height changing to %d\n",widget->core.height));
- }
- if (req.changes.border_width != widget->core.border_width) {
- req.changeMask |= CWBorderWidth;
- req.changes.border_width = widget->core.border_width;
- CALLGEOTAT(_XtGeoTrace(widget,
- "border_width changing to %d\n",
- widget->core.border_width));
- }
- if (req.changeMask & CWStackMode) {
- req.changes.stack_mode = request->stack_mode;
- CALLGEOTAT(_XtGeoTrace(widget,"stack_mode changing\n"));
- if (req.changeMask & CWSibling)
- if (XtIsWidget(request->sibling))
- req.changes.sibling = XtWindow(request->sibling);
- else
- req.changeMask &= ~(CWStackMode | CWSibling);
- }
-
-#ifdef XT_GEO_TATTLER
- if (req.changeMask) {
- CALLGEOTAT(_XtGeoTrace(widget,
- "XConfigure \"%s\"'s window.\n",
- XtName(widget)));
- } else {
- CALLGEOTAT(_XtGeoTrace(widget,
- "No window configuration needed for \"%s\".\n",
- XtName(widget)));
- }
-#endif
-
- XConfigureWindow(XtDisplay(widget), XtWindow(widget),
- req.changeMask, &req.changes);
- }
- else { /* RectObj child of realized Widget */
- *clear_rect_obj = TRUE;
- CALLGEOTAT(_XtGeoTrace(widget,
- "ClearRectObj on \"%s\".\n",XtName(widget)));
-
- ClearRectObjAreas((RectObj)widget, &req.changes);
- }
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));;
- if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) {
- req.type = XtHconfigure;
- req.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.confighook_callbacks,
- (XtPointer)&req);
- }
-
- return returnCode;
-} /* _XtMakeGeometryRequest */
-
-
-/* Public routines */
-
-XtGeometryResult XtMakeGeometryRequest (widget, request, reply)
- Widget widget;
- XtWidgetGeometry *request, *reply;
-{
- Boolean junk;
- XtGeometryResult r;
- XtGeometryHookDataRec call_data;
- Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (XtHasCallbacks(hookobj, XtNgeometryHook) == XtCallbackHasSome) {
- call_data.type = XtHpreGeometry;
- call_data.widget = widget;
- call_data.request = request;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.geometryhook_callbacks,
- (XtPointer)&call_data);
- call_data.result = r =
- _XtMakeGeometryRequest(widget, request, reply, &junk);
- call_data.type = XtHpostGeometry;
- call_data.reply = reply;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.geometryhook_callbacks,
- (XtPointer)&call_data);
- } else {
- r = _XtMakeGeometryRequest(widget, request, reply, &junk);
- }
- UNLOCK_APP(app);
-
- return ((r == XtGeometryDone) ? XtGeometryYes : r);
-}
-
-#if NeedFunctionPrototypes
-XtGeometryResult
-XtMakeResizeRequest(
- Widget widget,
- _XtDimension width,
- _XtDimension height,
- Dimension *replyWidth,
- Dimension *replyHeight)
-#else
-XtGeometryResult
-XtMakeResizeRequest (widget, width, height, replyWidth, replyHeight)
- Widget widget;
- Dimension width, height;
- Dimension *replyWidth, *replyHeight;
-#endif
-{
- XtWidgetGeometry request, reply;
- XtGeometryResult r;
- XtGeometryHookDataRec call_data;
- Boolean junk;
- Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- request.request_mode = CWWidth | CWHeight;
- request.width = width;
- request.height = height;
-
- if (XtHasCallbacks(hookobj, XtNgeometryHook) == XtCallbackHasSome) {
- call_data.type = XtHpreGeometry;
- call_data.widget = widget;
- call_data.request = &request;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.geometryhook_callbacks,
- (XtPointer)&call_data);
- call_data.result = r =
- _XtMakeGeometryRequest(widget, &request, &reply, &junk);
- call_data.type = XtHpostGeometry;
- call_data.reply = &reply;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.geometryhook_callbacks,
- (XtPointer)&call_data);
- } else {
- r = _XtMakeGeometryRequest(widget, &request, &reply, &junk);
- }
- if (replyWidth != NULL)
- if (r == XtGeometryAlmost && reply.request_mode & CWWidth)
- *replyWidth = reply.width;
- else
- *replyWidth = width;
- if (replyHeight != NULL)
- if (r == XtGeometryAlmost && reply.request_mode & CWHeight)
- *replyHeight = reply.height;
- else
- *replyHeight = height;
- UNLOCK_APP(app);
- return ((r == XtGeometryDone) ? XtGeometryYes : r);
-} /* XtMakeResizeRequest */
-
-void XtResizeWindow(w)
- Widget w;
-{
- XtConfigureHookDataRec req;
- Widget hookobj;
- WIDGET_TO_APPCON(w);
-
- LOCK_APP(app);
- if (XtIsRealized(w)) {
- XWindowChanges changes;
- req.changes.width = w->core.width;
- req.changes.height = w->core.height;
- req.changes.border_width = w->core.border_width;
- req.changeMask = CWWidth | CWHeight | CWBorderWidth;
- XConfigureWindow(XtDisplay(w), XtWindow(w),
- (unsigned) req.changeMask, &req.changes);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));;
- if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) {
- req.type = XtHconfigure;
- req.widget = w;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.confighook_callbacks,
- (XtPointer)&req);
- }
- }
- UNLOCK_APP(app);
-} /* XtResizeWindow */
-
-#if NeedFunctionPrototypes
-void XtResizeWidget(
- Widget w,
- _XtDimension width,
- _XtDimension height,
- _XtDimension borderWidth
- )
-#else
-void XtResizeWidget(w, width, height, borderWidth)
- Widget w;
- Dimension width, height, borderWidth;
-#endif
-{
- XtConfigureWidget(w, w->core.x, w->core.y, width, height, borderWidth);
-} /* XtResizeWidget */
-
-#if NeedFunctionPrototypes
-void XtConfigureWidget(
- Widget w,
- _XtPosition x,
- _XtPosition y,
- _XtDimension width,
- _XtDimension height,
- _XtDimension borderWidth
- )
-#else
-void XtConfigureWidget(w, x, y, width, height, borderWidth)
- Widget w;
- Position x, y;
- Dimension width, height, borderWidth;
-#endif
-{
- XtConfigureHookDataRec req;
- Widget hookobj;
- XWindowChanges old;
- WIDGET_TO_APPCON(w);
-
- CALLGEOTAT(_XtGeoTrace(w,
- "\"%s\" is being configured by its parent \"%s\"\n",
- XtName(w),
- (XtParent(w))?XtName(XtParent(w)):"Root"));
- CALLGEOTAT(_XtGeoTab(1));
-
- LOCK_APP(app);
- req.changeMask = 0;
- if ((old.x = w->core.x) != x) {
- CALLGEOTAT(_XtGeoTrace(w,"x move from %d to %d\n",w->core.x, x));
- req.changes.x = w->core.x = x;
- req.changeMask |= CWX;
- }
-
- if ((old.y = w->core.y) != y) {
- CALLGEOTAT(_XtGeoTrace(w,"y move from %d to %d\n",w->core.y, y));
- req.changes.y = w->core.y = y;
- req.changeMask |= CWY;
- }
-
- if ((old.width = w->core.width) != width) {
- CALLGEOTAT(_XtGeoTrace(w,
- "width move from %d to %d\n",w->core.width, width));
- req.changes.width = w->core.width = width;
- req.changeMask |= CWWidth;
- }
-
- if ((old.height = w->core.height) != height) {
- CALLGEOTAT(_XtGeoTrace(w,
- "height move from %d to %d\n",w->core.height, height));
- req.changes.height = w->core.height = height;
- req.changeMask |= CWHeight;
- }
-
- if ((old.border_width = w->core.border_width) != borderWidth) {
- CALLGEOTAT(_XtGeoTrace(w,"border_width move from %d to %d\n",
- w->core.border_width,borderWidth ));
- req.changes.border_width = w->core.border_width = borderWidth;
- req.changeMask |= CWBorderWidth;
- }
-
- if (req.changeMask != 0) {
- if (XtIsRealized(w)) {
- if (XtIsWidget(w)) {
- CALLGEOTAT(_XtGeoTrace(w,
- "XConfigure \"%s\"'s window\n",XtName(w)));
- XConfigureWindow(XtDisplay(w), XtWindow(w),
- req.changeMask, &req.changes);
- } else {
- CALLGEOTAT(_XtGeoTrace(w,
- "ClearRectObj called on \"%s\"\n",XtName(w)));
- ClearRectObjAreas((RectObj)w, &old);
- }
- }
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));;
- if (XtHasCallbacks(hookobj, XtNconfigureHook) == XtCallbackHasSome) {
- req.type = XtHconfigure;
- req.widget = w;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.confighook_callbacks,
- (XtPointer)&req);
- }
- {
- XtWidgetProc resize;
-
- LOCK_PROCESS;
- resize = XtClass(w)->core_class.resize;
- UNLOCK_PROCESS;
- if ((req.changeMask & (CWWidth | CWHeight)) &&
- resize != (XtWidgetProc) NULL) {
- CALLGEOTAT(_XtGeoTrace(w,"Resize proc is called.\n"));
- (*resize)(w);
- }
- }
- } else {
- CALLGEOTAT(_XtGeoTrace(w,"No change in configuration\n"));
- }
-
- CALLGEOTAT(_XtGeoTab(-1));
- UNLOCK_APP(app);
-} /* XtConfigureWidget */
-
-#if NeedFunctionPrototypes
-void XtMoveWidget(
- Widget w,
- _XtPosition x,
- _XtPosition y
- )
-#else
-void XtMoveWidget(w, x, y)
- Widget w;
- Position x, y;
-#endif
-{
- XtConfigureWidget(w, x, y, w->core.width, w->core.height,
- w->core.border_width);
-} /* XtMoveWidget */
-
-#if NeedFunctionPrototypes
-void XtTranslateCoords(
- register Widget w,
- _XtPosition x,
- _XtPosition y,
- register Position *rootx, /* return */
- register Position *rooty /* return */
- )
-#else
-void XtTranslateCoords(w, x, y, rootx, rooty)
- register Widget w;
- Position x, y;
- register Position *rootx, *rooty; /* return */
-#endif
-{
- Position garbagex, garbagey;
- XtAppContext app = XtWidgetToApplicationContext(w);
-
- LOCK_APP(app);
- if (rootx == NULL) rootx = &garbagex;
- if (rooty == NULL) rooty = &garbagey;
-
- *rootx = x;
- *rooty = y;
-
- for (; w != NULL && ! XtIsShell(w); w = w->core.parent) {
- *rootx += w->core.x + w->core.border_width;
- *rooty += w->core.y + w->core.border_width;
- }
-
- if (w == NULL)
- XtAppWarningMsg(app,
- "invalidShell","xtTranslateCoords",XtCXtToolkitError,
- "Widget has no shell ancestor",
- (String *)NULL, (Cardinal *)NULL);
- else {
- Position x, y;
- extern void _XtShellGetCoordinates();
- _XtShellGetCoordinates( w, &x, &y );
- *rootx += x + w->core.border_width;
- *rooty += y + w->core.border_width;
- }
- UNLOCK_APP(app);
-}
-
-XtGeometryResult XtQueryGeometry(widget, intended, reply)
- Widget widget;
- register XtWidgetGeometry *intended; /* parent's changes; may be NULL */
- XtWidgetGeometry *reply; /* child's preferred geometry; never NULL */
-{
- XtWidgetGeometry null_intended;
- XtGeometryHandler query;
- XtGeometryResult result;
- WIDGET_TO_APPCON(widget);
-
- CALLGEOTAT(_XtGeoTrace(widget,
- "\"%s\" is asking its preferred geometry to \"%s\".\n",
- (XtParent(widget))?XtName(XtParent(widget)):"Root",
- XtName(widget)));
- CALLGEOTAT(_XtGeoTab(1));
-
- LOCK_APP(app);
- LOCK_PROCESS;
- query = XtClass(widget)->core_class.query_geometry;
- UNLOCK_PROCESS;
- reply->request_mode = 0;
- if (query != NULL) {
- if (intended == NULL) {
- null_intended.request_mode = 0;
- intended = &null_intended;
-#ifdef XT_GEO_TATTLER
- CALLGEOTAT(_XtGeoTrace(widget,"without any constraint.\n"));
- } else {
- CALLGEOTAT(_XtGeoTrace(widget,
- "with the following constraints:\n"));
-
- if (intended->request_mode & CWX) {
- CALLGEOTAT(_XtGeoTrace(widget," x = %d\n",intended->x));
- }
- if (intended->request_mode & CWY) {
- CALLGEOTAT(_XtGeoTrace(widget," y = %d\n",intended->y));
- }
- if (intended->request_mode & CWWidth) {
- CALLGEOTAT(_XtGeoTrace(widget,
- " width = %d\n",intended->width));
- }
- if (intended->request_mode & CWHeight) {
- CALLGEOTAT(_XtGeoTrace(widget,
- " height = %d\n",intended->height));
- }
- if (intended->request_mode & CWBorderWidth) {
- CALLGEOTAT(_XtGeoTrace(widget,
- " border_width = %d\n",intended->border_width));
- }
-#endif
- }
-
- result = (*query) (widget, intended, reply);
- }
- else {
- CALLGEOTAT(_XtGeoTrace(widget,"\"%s\" has no QueryGeometry proc, return the current state\n",XtName(widget)));
-
- result = XtGeometryYes;
- }
-
-#ifdef XT_GEO_TATTLER
-#define FillIn(mask, field) \
- if (!(reply->request_mode & mask)) {\
- reply->field = widget->core.field;\
- _XtGeoTrace(widget," using core %s = %d.\n","field",\
- widget->core.field);\
- } else {\
- _XtGeoTrace(widget," replied %s = %d\n","field",\
- reply->field);\
- }
-#else
-#define FillIn(mask, field) \
- if (!(reply->request_mode & mask)) reply->field = widget->core.field;
-#endif
-
- FillIn(CWX, x);
- FillIn(CWY, y);
- FillIn(CWWidth, width);
- FillIn(CWHeight, height);
- FillIn(CWBorderWidth, border_width);
-
- CALLGEOTAT(_XtGeoTab(-1));
-#undef FillIn
-
- if (!(reply->request_mode & CWStackMode))
- reply->stack_mode = XtSMDontChange;
- UNLOCK_APP(app);
- return result;
-}
diff --git a/xc/lib/Xt/GetActKey.c b/xc/lib/Xt/GetActKey.c
deleted file mode 100644
index 77cf68d47..000000000
--- a/xc/lib/Xt/GetActKey.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $TOG: GetActKey.c /main/8 1998/02/06 13:22:14 kaleb $ */
-
-/*LINTLIBRARY*/
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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 "IntrinsicI.h"
-
-KeySym XtGetActionKeysym(event, modifiers_return)
- XEvent *event;
- Modifiers *modifiers_return;
-{
- TMKeyContext tm_context;
- Modifiers modifiers;
- KeySym keysym, retval;
-
- LOCK_PROCESS;
- tm_context= _XtGetPerDisplay(event->xany.display)->tm_context;
- if (event->xany.type != KeyPress && event->xany.type != KeyRelease) {
- UNLOCK_PROCESS;
- return NoSymbol;
- }
- if (tm_context != NULL
- && event == tm_context->event
- && event->xany.serial == tm_context->serial ) {
-
- if (modifiers_return != NULL)
- *modifiers_return = tm_context->modifiers;
- retval = tm_context->keysym;
- UNLOCK_PROCESS;
- return retval;
- }
-
- XtTranslateKeycode( event->xany.display, (KeyCode)event->xkey.keycode,
- event->xkey.state, &modifiers, &keysym );
-
- if (modifiers_return != NULL)
- *modifiers_return = event->xkey.state & modifiers;
-
- UNLOCK_PROCESS;
- return keysym;
-}
diff --git a/xc/lib/Xt/GetResList.c b/xc/lib/Xt/GetResList.c
deleted file mode 100644
index c31263e29..000000000
--- a/xc/lib/Xt/GetResList.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* $TOG: GetResList.c /main/9 1998/02/06 13:22:18 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/GetResList.c,v 3.3 1998/12/20 11:57:08 dawes Exp $ */
-
-/*
-
-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 "IntrinsicI.h"
-#include "Intrinsic.h"
-
-/*
- * XtGetResourceList(), XtGetConstraintResourceList()
- */
-
-#define TOXRMQUARK(p) ((XrmQuark)(long)(p)) /* avoid LP64 warnings */
-
-void XtGetResourceList(widget_class, resources, num_resources)
- WidgetClass widget_class;
- XtResourceList *resources;
- Cardinal *num_resources;
-{
- int size;
- register int i, dest = 0;
- register XtResourceList *list, dlist;
-
- LOCK_PROCESS;
- size = widget_class->core_class.num_resources * sizeof(XtResource);
- *resources = (XtResourceList) __XtMalloc((unsigned) size);
-
- if (!widget_class->core_class.class_inited) {
- /* Easy case */
-
- (void) memmove((char *) *resources,
- (char *)widget_class->core_class.resources, size);
- *num_resources = widget_class->core_class.num_resources;
- UNLOCK_PROCESS;
- return;
- }
-
- /* Nope, it's the hard case */
-
- list = (XtResourceList *) widget_class->core_class.resources;
- dlist = *resources;
- for (i = 0; i < widget_class->core_class.num_resources; i++) {
- if (list[i] != NULL) {
- dlist[dest].resource_name = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->resource_name));
- dlist[dest].resource_class = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->resource_class));
- dlist[dest].resource_type = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->resource_type));
- dlist[dest].resource_size = list[i]->resource_size;
- /* trust that resource_offset isn't that big */
- dlist[dest].resource_offset = (Cardinal)
- -((int)(list[i]->resource_offset + 1));
- dlist[dest].default_type = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->default_type));
- dlist[dest].default_addr = list[i]->default_addr;
- dest++;
- }
- }
- *num_resources = dest;
- UNLOCK_PROCESS;
-}
-
-
-static Boolean ClassIsSubclassOf(class, superclass)
- WidgetClass class, superclass;
-{
- for (; class != NULL; class = class->core_class.superclass) {
- if (class == superclass) return True;
- }
- return False;
-}
-
-void XtGetConstraintResourceList(widget_class, resources, num_resources)
- WidgetClass widget_class;
- XtResourceList *resources;
- Cardinal *num_resources;
-{
- int size;
- register int i, dest = 0;
- register XtResourceList *list, dlist;
- ConstraintWidgetClass class = (ConstraintWidgetClass)widget_class;
-
- LOCK_PROCESS;
- if ( (class->core_class.class_inited &&
- !(class->core_class.class_inited & ConstraintClassFlag))
- || (!class->core_class.class_inited &&
- !ClassIsSubclassOf(widget_class, constraintWidgetClass))
- || class->constraint_class.num_resources == 0) {
-
- *resources = NULL;
- *num_resources = 0;
- UNLOCK_PROCESS;
- return;
- }
-
- size = class->constraint_class.num_resources * sizeof(XtResource);
- *resources = (XtResourceList) __XtMalloc((unsigned) size);
-
- if (!class->core_class.class_inited) {
- /* Easy case */
-
- (void) memmove((char *) *resources,
- (char *)class->constraint_class.resources, size);
- *num_resources = class->constraint_class.num_resources;
- UNLOCK_PROCESS;
- return;
- }
-
- /* Nope, it's the hard case */
-
- list = (XtResourceList *) class->constraint_class.resources;
- dlist = *resources;
- for (i = 0; i < class->constraint_class.num_resources; i++) {
- if (list[i] != NULL) {
- dlist[dest].resource_name = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->resource_name));
- dlist[dest].resource_class = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->resource_class));
- dlist[dest].resource_type = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->resource_type));
- dlist[dest].resource_size = list[i]->resource_size;
- /* trust that resource_offset isn't that big */
- dlist[dest].resource_offset = (Cardinal)
- -((int)(list[i]->resource_offset + 1));
- dlist[dest].default_type = (String)
- XrmQuarkToString(TOXRMQUARK(list[i]->default_type));
- dlist[dest].default_addr = list[i]->default_addr;
- dest++;
- }
- }
- *num_resources = dest;
- UNLOCK_PROCESS;
-}
diff --git a/xc/lib/Xt/GetValues.c b/xc/lib/Xt/GetValues.c
deleted file mode 100644
index 6717a6ed5..000000000
--- a/xc/lib/Xt/GetValues.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* $TOG: GetValues.c /main/15 1998/02/06 13:22:23 kaleb $ */
-/*LINTLIBRARY*/
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 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 "IntrinsicI.h"
-#include "StringDefs.h"
-
-extern void _XtCopyToArg();
-extern XrmResourceList* _XtCreateIndirectionTable();
-
-static int GetValues(base, res, num_resources, args, num_args)
- char* base; /* Base address to fetch values from */
- XrmResourceList* res; /* The current resource values. */
- register Cardinal num_resources; /* number of items in resources */
- ArgList args; /* The resource values requested */
- Cardinal num_args; /* number of items in arg list */
-{
- register ArgList arg;
- register int i;
- register XrmName argName;
- register XrmResourceList* xrmres;
- int translation_arg_num = -1;
- static XrmQuark QCallback = NULLQUARK;
- static XrmQuark QTranslationTable = NULLQUARK;
-
- LOCK_PROCESS;
- if (QCallback == NULLQUARK) {
- QCallback = XrmPermStringToQuark(XtRCallback);
- QTranslationTable = XrmPermStringToQuark(XtRTranslationTable);
- }
- UNLOCK_PROCESS;
-
- /* Resource lists should be in compiled form already */
-
- for (arg = args ; num_args != 0; num_args--, arg++) {
- argName = StringToName(arg->name);
- for (xrmres = res, i = 0; i < num_resources; i++, xrmres++) {
- if (argName == (*xrmres)->xrm_name) {
- /* hack; do special cases here instead of a get_values_hook
- * because get_values_hook looses info as to
- * whether arg->value == NULL for ancient compatibility
- * mode in _XtCopyToArg. It helps performance, too...
- */
- if ((*xrmres)->xrm_type == QCallback) {
- XtCallbackList callback = _XtGetCallbackList(
- (InternalCallbackList *)
- (base - (*xrmres)->xrm_offset - 1));
- _XtCopyToArg(
- (char*)&callback, &arg->value,
- (*xrmres)->xrm_size);
- }
- else if ((*xrmres)->xrm_type == QTranslationTable)
- translation_arg_num = (int) (arg - args);
- else {
- _XtCopyToArg(
- base - (*xrmres)->xrm_offset - 1,
- &arg->value,
- (*xrmres)->xrm_size);
- }
- break;
- }
- }
- }
- return translation_arg_num;
-} /* GetValues */
-
-static void CallGetValuesHook(widget_class, w, args, num_args)
- WidgetClass widget_class;
- Widget w;
- ArgList args;
- Cardinal num_args;
-{
- WidgetClass superclass;
- XtArgsProc get_values_hook;
-
- LOCK_PROCESS;
- superclass = widget_class->core_class.superclass;
- UNLOCK_PROCESS;
- if (superclass != NULL)
- CallGetValuesHook (superclass, w, args, num_args);
-
- LOCK_PROCESS;
- get_values_hook = widget_class->core_class.get_values_hook;
- UNLOCK_PROCESS;
- if (get_values_hook != NULL)
- (*get_values_hook) (w, args, &num_args);
-}
-
-
-
-static void CallConstraintGetValuesHook(widget_class, w, args, num_args)
- WidgetClass widget_class;
- Widget w;
- ArgList args;
- Cardinal num_args;
-{
- ConstraintClassExtension ext;
-
- LOCK_PROCESS;
- if (widget_class->core_class.superclass
- ->core_class.class_inited & ConstraintClassFlag) {
- CallConstraintGetValuesHook
- (widget_class->core_class.superclass, w, args, num_args);
- }
-
- for (ext = (ConstraintClassExtension)((ConstraintWidgetClass)widget_class)
- ->constraint_class.extension;
- ext != NULL && ext->record_type != NULLQUARK;
- ext = (ConstraintClassExtension)ext->next_extension);
-
- if (ext != NULL) {
- if ( ext->version == XtConstraintExtensionVersion
- && ext->record_size == sizeof(ConstraintClassExtensionRec)) {
- if (ext->get_values_hook != NULL)
- (*(ext->get_values_hook)) (w, args, &num_args);
- } else {
- String params[1];
- Cardinal num_params = 1;
- params[0] = widget_class->core_class.class_name;
- XtAppWarningMsg(XtWidgetToApplicationContext(w),
- "invalidExtension", "xtCreateWidget", XtCXtToolkitError,
- "widget class %s has invalid ConstraintClassExtension record",
- params, &num_params);
- }
- }
- UNLOCK_PROCESS;
-}
-
-
-void XtGetValues(w, args, num_args)
- register Widget w;
- register ArgList args;
- register Cardinal num_args;
-{
- WidgetClass wc;
- int targ;
- XtAppContext app = XtWidgetToApplicationContext(w);
-
- if (num_args == 0) return;
- if ((args == NULL) && (num_args != 0)) {
- XtAppErrorMsg(app,
- "invalidArgCount","xtGetValues",XtCXtToolkitError,
- "Argument count > 0 on NULL argument list in XtGetValues",
- (String *)NULL, (Cardinal *)NULL);
- }
-
- LOCK_APP(app);
- wc = XtClass(w);
- LOCK_PROCESS;
- /* Get widget values */
- targ = GetValues((char*)w, (XrmResourceList *) wc->core_class.resources,
- wc->core_class.num_resources, args, num_args);
- UNLOCK_PROCESS;
- if (targ != -1 && XtIsWidget(w)) {
- XtTranslations translations = _XtGetTranslationValue(w);
- _XtCopyToArg((char*)&translations, &args[targ].value,
- sizeof(XtTranslations));
- }
-
- /* Get constraint values if necessary */
- /* constraints may be NULL if constraint_size==0 */
- if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)) &&
- w->core.constraints) {
- ConstraintWidgetClass cwc
- = (ConstraintWidgetClass) XtClass(XtParent(w));
- LOCK_PROCESS;
- GetValues((char*)w->core.constraints,
- (XrmResourceList *)(cwc->constraint_class.resources),
- cwc->constraint_class.num_resources, args, num_args);
- UNLOCK_PROCESS;
- }
- /* Notify any class procedures that we have performed get_values */
- CallGetValuesHook(wc, w, args, num_args);
-
- /* Notify constraint get_values if necessary */
- if (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)))
- CallConstraintGetValuesHook(XtClass(XtParent(w)), w, args,num_args);
- UNLOCK_APP(app);
-} /* XtGetValues */
-
-void XtGetSubvalues(base, resources, num_resources, args, num_args)
- XtPointer base; /* Base address to fetch values from */
- XtResourceList resources; /* The current resource values. */
- Cardinal num_resources; /* number of items in resources */
- ArgList args; /* The resource values requested */
- Cardinal num_args; /* number of items in arg list */
-{
- XrmResourceList* xrmres;
- xrmres = _XtCreateIndirectionTable(resources, num_resources);
- GetValues((char*)base, xrmres, num_resources, args, num_args);
- XtFree((char *)xrmres);
-}
diff --git a/xc/lib/Xt/HookObj.c b/xc/lib/Xt/HookObj.c
deleted file mode 100644
index 50673920f..000000000
--- a/xc/lib/Xt/HookObj.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* $TOG: HookObj.c /main/4 1998/02/06 13:22:33 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 "IntrinsicI.h"
-#include "StringDefs.h"
-/******************************************************************
- *
- * Hook Object Resources
- *
- ******************************************************************/
-
-static XtResource resources[] = {
- { XtNcreateHook, XtCCallback, XtRCallback, sizeof(XtPointer),
- XtOffsetOf(HookObjRec, hooks.createhook_callbacks),
- XtRCallback, (XtPointer)NULL},
- { XtNchangeHook, XtCCallback, XtRCallback, sizeof(XtPointer),
- XtOffsetOf(HookObjRec, hooks.changehook_callbacks),
- XtRCallback, (XtPointer)NULL},
- { XtNconfigureHook, XtCCallback, XtRCallback, sizeof(XtPointer),
- XtOffsetOf(HookObjRec, hooks.confighook_callbacks),
- XtRCallback, (XtPointer)NULL},
- { XtNgeometryHook, XtCCallback, XtRCallback, sizeof(XtPointer),
- XtOffsetOf(HookObjRec, hooks.geometryhook_callbacks),
- XtRCallback, (XtPointer)NULL},
- { XtNdestroyHook, XtCCallback, XtRCallback, sizeof(XtPointer),
- XtOffsetOf(HookObjRec, hooks.destroyhook_callbacks),
- XtRCallback, (XtPointer)NULL},
- { XtNshells, XtCReadOnly, XtRWidgetList, sizeof(WidgetList),
- XtOffsetOf(HookObjRec, hooks.shells), XtRImmediate, (XtPointer) NULL },
- { XtNnumShells, XtCReadOnly, XtRCardinal, sizeof(Cardinal),
- XtOffsetOf(HookObjRec, hooks.num_shells), XtRImmediate, (XtPointer) 0 }
-};
-
-static void GetValuesHook(), Initialize();
-
-externaldef(hookobjclassrec) HookObjClassRec hookObjClassRec = {
- { /* Object Class Part */
- /* superclass */ (WidgetClass)&objectClassRec,
- /* class_name */ "Hook",
- /* widget_size */ sizeof(HookObjRec),
- /* class_initialize */ NULL,
- /* class_part_initialize*/ NULL,
- /* class_inited */ FALSE,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ NULL,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ NULL,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ NULL,
- /* get_values_hook */ GetValuesHook,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },
- { /* HookObj Class Part */
- /* unused */ 0
- }
-};
-
-externaldef(hookObjectClass) WidgetClass hookObjectClass =
- (WidgetClass)&hookObjClassRec;
-
-static void FreeShellList(w, closure, call_data)
- Widget w;
- XtPointer closure, call_data;
-{
- HookObject h = (HookObject)w;
- if (h->hooks.shells != NULL)
- XtFree((char*)h->hooks.shells);
-}
-
-static void Initialize(req, new, args, num_args)
- Widget req, new;
- ArgList args;
- Cardinal* num_args;
-{
- HookObject w = (HookObject) new;
- w->hooks.max_shells = 0;
- XtAddCallback (new, XtNdestroyCallback, FreeShellList, (XtPointer) NULL);
-}
-
-static void GetValuesHook(widget, args, num_args)
- Widget widget;
- ArgList args;
- Cardinal* num_args;
-{
- /* get the XtNshells and XtNnumShells pseudo-resources */
-}
-
diff --git a/xc/lib/Xt/HookObjI.h b/xc/lib/Xt/HookObjI.h
deleted file mode 100644
index 8d1e38b33..000000000
--- a/xc/lib/Xt/HookObjI.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $TOG: HookObjI.h /main/3 1998/02/06 13:22:28 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.
-
-*/
-
-#ifndef _XtHookObjI_h
-#define _XtHookObjI_h
-
-/* This object is implementation-dependent and private to the library. */
-
-typedef struct _HookObjRec *HookObject;
-typedef struct _HookObjClassRec *HookObjectClass;
-
-externalref WidgetClass hookObjectClass;
-
-typedef struct _HookObjPart {
- /* resources */
- XtCallbackList createhook_callbacks;
- XtCallbackList changehook_callbacks;
- XtCallbackList confighook_callbacks;
- XtCallbackList geometryhook_callbacks;
- XtCallbackList destroyhook_callbacks;
- WidgetList shells;
- Cardinal num_shells;
- /* private data */
- Cardinal max_shells;
- Screen* screen;
-}HookObjPart;
-
-typedef struct _HookObjRec {
- ObjectPart object;
- HookObjPart hooks;
-} HookObjRec;
-
-typedef struct _HookObjClassPart {
- int unused;
-} HookObjClassPart;
-
-typedef struct _HookObjClassRec {
- ObjectClassPart object_class;
- HookObjClassPart hook_class;
-} HookObjClassRec;
-
-externalref HookObjClassRec hookObjClassRec;
-
-#endif /* ifndef _Xt_HookObjI_h */
-
-
diff --git a/xc/lib/Xt/Hooks.c b/xc/lib/Xt/Hooks.c
deleted file mode 100644
index 934bef4f3..000000000
--- a/xc/lib/Xt/Hooks.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* $TOG: Hooks.c /main/9 1998/02/06 13:22:38 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.
-
-*/
-
-/*LINTLIBRARY*/
-
-#include "IntrinsicI.h"
-
-static void FreeBlockHookList( widget, closure, call_data )
- Widget widget; /* unused (and invalid) */
- XtPointer closure; /* ActionHook* */
- XtPointer call_data; /* unused */
-{
- BlockHook list = *(BlockHook*)closure;
- while (list != NULL) {
- BlockHook next = list->next;
- XtFree( (XtPointer)list );
- list = next;
- }
-}
-
-
-XtBlockHookId XtAppAddBlockHook( app, proc, closure )
- XtAppContext app;
- XtBlockHookProc proc;
- XtPointer closure;
-{
- BlockHook hook = XtNew(BlockHookRec);
- LOCK_APP(app);
- hook->next = app->block_hook_list;
- hook->app = app;
- hook->proc = proc;
- hook->closure = closure;
- if (app->block_hook_list == NULL) {
- _XtAddCallback( &app->destroy_callbacks,
- FreeBlockHookList,
- (XtPointer)&app->block_hook_list
- );
- }
- app->block_hook_list = hook;
- UNLOCK_APP(app);
- return (XtBlockHookId)hook;
-}
-
-
-void XtRemoveBlockHook( id )
- XtBlockHookId id;
-{
- BlockHook *p, hook = (BlockHook)id;
- XtAppContext app = hook->app;
- LOCK_APP(app);
- for (p = &app->block_hook_list; p != NULL && *p != hook; p = &(*p)->next);
- if (p == NULL) {
-#ifdef DEBUG
- XtAppWarningMsg(app, "badId", "xtRemoveBlockHook", XtCXtToolkitError,
- "XtRemoveBlockHook called with bad or old hook id",
- (String*)NULL, (Cardinal*)NULL);
-#endif /*DEBUG*/
- UNLOCK_APP(app);
- return;
- }
- *p = hook->next;
- XtFree( (XtPointer)hook );
- UNLOCK_APP(app);
-}
-
-static void DeleteShellFromHookObj(shell, closure, call_data)
- Widget shell;
- XtPointer closure, call_data;
-{
- /* app_con is locked when this function is called */
- int ii, jj;
- HookObject ho = (HookObject) closure;
-
- for (ii = 0; ii < ho->hooks.num_shells; ii++)
- if (ho->hooks.shells[ii] == shell) {
- /* collapse the list */
- for (jj = ii; jj < ho->hooks.num_shells; jj++) {
- if ((jj+1) < ho->hooks.num_shells)
- ho->hooks.shells[jj] = ho->hooks.shells[jj+1];
- }
- break;
- }
- ho->hooks.num_shells--;
-}
-
-#define SHELL_INCR 4
-
-#if NeedFunctionPrototypes
-void _XtAddShellToHookObj(
- Widget shell)
-#else
-void _XtAddShellToHookObj(shell)
- Widget shell;
-#endif
-{
- /* app_con is locked when this function is called */
- HookObject ho = (HookObject) XtHooksOfDisplay(XtDisplay(shell));
-
- if (ho->hooks.num_shells == ho->hooks.max_shells) {
- ho->hooks.max_shells += SHELL_INCR;
- ho->hooks.shells =
- (WidgetList)XtRealloc((char*)ho->hooks.shells,
- ho->hooks.max_shells * sizeof (Widget));
- }
- ho->hooks.shells[ho->hooks.num_shells++] = shell;
-
- XtAddCallback(shell, XtNdestroyCallback, DeleteShellFromHookObj,
- (XtPointer)ho);
-}
-
-#if NeedFunctionPrototypes
-Boolean _XtIsHookObject(
- Widget widget)
-#else
-Boolean _XtIsHookObject(widget)
- Widget widget;
-#endif
-{
- return (widget->core.widget_class == hookObjectClass);
-}
-
-Widget XtHooksOfDisplay(dpy)
- Display* dpy;
-{
- extern Widget _XtCreateHookObj();
- Widget retval;
- XtPerDisplay pd;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
- if (pd->hook_object == NULL)
- pd->hook_object =
- _XtCreateHookObj((Screen*)DefaultScreenOfDisplay(dpy));
- retval = pd->hook_object;
- UNLOCK_APP(app);
- return retval;
-}
diff --git a/xc/lib/Xt/Imakefile b/xc/lib/Xt/Imakefile
deleted file mode 100644
index 05bc642fe..000000000
--- a/xc/lib/Xt/Imakefile
+++ /dev/null
@@ -1,259 +0,0 @@
-XCOMM $TOG: Imakefile /main/121 1998/05/11 14:35:32 barstow $
-
-
-
-
-XCOMM $XFree86: xc/lib/Xt/Imakefile,v 3.13 1998/12/20 11:57:09 dawes Exp $
-#define DoNormalLib NormalLibXt
-#define DoSharedLib SharedLibXt
-#define DoExtraLib SharedLibXt
-#define DoDebugLib DebugLibXt
-#define DoProfileLib ProfileLibXt
-#define HasSharedData YES
-#define LibName Xt
-#define SoRev SOXTREV
-#define IncSubdir X11
-
-#include <Threads.tmpl>
-
-#if ResourceConfigurationManagement
-RCMOBJS = ResConfig.o
-RCMSRCS = ResConfig.c
-#else
-RCM_DEFINES = -DX_NO_RESOURCE_CONFIGURATION_MANAGEMENT
-#endif
-
-#if XtPopdownConformance
-POPDOWN_DEFINES =
-#else
-POPDOWN_DEFINES = -DX_NO_XT_POPDOWN_CONFORMANCE
-#endif
-
-#ifndef MotifBC
-#define MotifBC NO
-#endif
-
-/* "YES" allows illegal XtGetValues requests with NULL ArgVal to
- usually succeed, as R5 did. Some applications erroneously rely on
- this behavior. Support for this will be removed in a future release. */
-#ifndef GetValuesBC
-#define GetValuesBC NO
-#endif
-
-#ifdef SharedXtReqs
-REQUIREDLIBS = SharedXtReqs
-#endif
-
-/* config options */
-
-XFILESEARCHPATHDEFAULT = XFileSearchPathDefault
-
-XTERRORPREFIX = XtErrorPrefix
-XTWARNINGPREFIX = XtWarningPrefix
-
-#if UnalignedReferencesAllowed
- ALIGN_DEFINES = -DUNALIGNED
-#endif
-#if DoSharedLib && defined(SharedAllocateLocalDefines)
-#undef AllocateLocalDefines
-#define AllocateLocalDefines SharedAllocateLocalDefines
-#endif
-#if HasPoll
- POLL_DEFINES = -DUSE_POLL
-#endif
-#if HasSnprintf
- MISC_DEFINES = -DUSE_SNPRINTF -DLIBXT
-#endif
- DEFINES = AllocateLocalDefines $(ALIGN_DEFINES) $(POLL_DEFINES) $(MISC_DEFINES) XtExtraDefines $(RCM_DEFINES) $(POPDOWN_DEFINES)
-
- DB_DEFINES = -DERRORDB=\"$(LIBDIR)/XtErrorDB\" \
- -DXTERROR_PREFIX=\"$(XTERRORPREFIX)\" \
- -DXTWARNING_PREFIX=\"$(XTWARNINGPREFIX)\"
-
- SRCH_DEFINES = -DXFILESEARCHPATHDEFAULT=\"$(XFILESEARCHPATHDEFAULT)\"
-#if Malloc0ReturnsNull
- ALLOC_DEFINES = XtMalloc0ReturnsNullDefines
-#endif
-#if MotifBC
- BC_DEFINES = -DMOTIFBC
-#endif
-#if GetValuesBC
- GETVALUES_DEFINES = -DGETVALUES_BUG
-#endif
-#if NoRConst
- RCONST_DEFINES = -DNORCONST
-#endif
-STRINGSABIOPTIONS = ToolkitStringsABIOptions
-
- LINTLIBS = $(LINTXLIB)
-
-HEADERS = \
- Composite.h \
- CompositeP.h \
- Constraint.h \
- ConstrainP.h \
- Core.h \
- CoreP.h \
- Intrinsic.h \
- IntrinsicP.h \
- Object.h \
- ObjectP.h \
- RectObj.h \
- RectObjP.h \
- Shell.h \
- ShellP.h \
- StringDefs.h \
- Vendor.h \
- VendorP.h
-
-SRCS = \
- $(MISCSRCS) \
- ActionHook.c \
- Alloc.c \
- ArgList.c \
- Callback.c \
- ClickTime.c \
- Composite.c \
- Constraint.c \
- Convert.c \
- Converters.c \
- Core.c \
- Create.c \
- Destroy.c \
- Display.c \
- Error.c \
- Event.c \
- EventUtil.c \
- Functions.c \
- GCManager.c \
- Geometry.c \
- GetActKey.c \
- GetResList.c \
- GetValues.c \
- HookObj.c \
- Hooks.c \
- Initialize.c \
- Intrinsic.c \
- Keyboard.c \
- Manage.c \
- NextEvent.c \
- Object.c \
- PassivGrab.c \
- Pointer.c \
- Popup.c \
- PopupCB.c \
- RectObj.c \
- Resources.c \
- Selection.c \
- SetSens.c \
- SetValues.c \
- SetWMCW.c \
- Shell.c \
- StringDefs.c \
- Threads.c \
- TMaction.c \
- TMgrab.c \
- TMkey.c \
- TMparse.c \
- TMprint.c \
- TMstate.c \
- VarCreate.c \
- VarGet.c \
- Varargs.c \
- Vendor.c \
- sharedlib.c \
- $(RCMSRCS)
-
-OBJS = \
- $(MISCOBJS) \
- ActionHook.o \
- Alloc.o \
- ArgList.o \
- Callback.o \
- ClickTime.o \
- Composite.o \
- Constraint.o \
- Convert.o \
- Converters.o \
- Core.o \
- Create.o \
- Destroy.o \
- Display.o \
- Error.o \
- Event.o \
- EventUtil.o \
- Functions.o \
- GCManager.o \
- Geometry.o \
- GetActKey.o \
- GetResList.o \
- GetValues.o \
- HookObj.o \
- Hooks.o \
- Initialize.o \
- Intrinsic.o \
- Keyboard.o \
- Manage.o \
- NextEvent.o \
- Object.o \
- PassivGrab.o \
- Pointer.o \
- Popup.o \
- PopupCB.o \
- RectObj.o \
- Resources.o \
- Selection.o \
- SetSens.o \
- SetValues.o \
- SetWMCW.o \
- Shell.o \
- StringDefs.o \
- Threads.o \
- TMaction.o \
- TMgrab.o \
- TMkey.o \
- TMparse.o \
- TMprint.o \
- TMstate.o \
- VarCreate.o \
- VarGet.o \
- Varargs.o \
- Vendor.o \
- $(RCMOBJS)
-
-#if SharedDataSeparation
-UNSHAREDOBJS = StringDefs.o sharedlib.o
-#else
-UNSHAREDOBJS = sharedlib.o
-#endif
-
-#include <Library.tmpl>
-
-SpecialCLibObjectRule(Intrinsic,$(ICONFIGFILES),$(SRCH_DEFINES))
-SpecialCLibObjectRule(Error,$(ICONFIGFILES),$(DB_DEFINES))
-SpecialCLibObjectRule(Alloc,$(_NOOP_),$(ALLOC_DEFINES))
-SpecialCLibObjectRule(Converters,$(ICONFIGFILES),$(BC_DEFINES))
-SpecialCLibObjectRule(Resources,$(ICONFIGFILES),$(GETVALUES_DEFINES))
-SpecialCLibObjectRule(TMaction,$(_NOOP_),$(RCONST_DEFINES))
-#if BuildXKBlib
-SpecialCLibObjectRule(TMkey,$(_NOOP_),-DXKB)
-#endif
-#if DoSharedLib
-SpecialCObjectRule(sharedlib,$(_NOOP_),$(SHLIBDEF))
-#endif
-
-#ifdef MinixArchitecture
-SpecialCLibObjectRule(Shell,$(ICONFIGFILES),-DXT_NO_SM)
-#endif
-
-STRINGS_FILES = StringDefs.c StringDefs.h Shell.h
-STRINGS_TMPLS = util/StrDefs.ct util/StrDefs.ht util/Shell.ht
-#ifdef OS2Architecture
-STRING_LIST = util\string.list
-#else
-STRING_LIST = util/string.list
-#endif
-
-ToolkitMakeStrings($(STRINGS_FILES),$(STRING_LIST),$(STRINGSABIOPTIONS),$(STRINGS_TMPLS),StringDefs.c)
-
-DependTarget()
diff --git a/xc/lib/Xt/InitialI.h b/xc/lib/Xt/InitialI.h
deleted file mode 100644
index f704c44f9..000000000
--- a/xc/lib/Xt/InitialI.h
+++ /dev/null
@@ -1,456 +0,0 @@
-/* $TOG: InitialI.h /main/87 1998/02/06 13:22:56 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtinitialI_h
-#define _XtinitialI_h
-
-/****************************************************************
- *
- * Displays
- *
- ****************************************************************/
-
-#ifndef X_NOT_POSIX
-#ifdef _POSIX_SOURCE
-#include <limits.h>
-#else
-#define _POSIX_SOURCE
-#include <limits.h>
-#undef _POSIX_SOURCE
-#endif
-#endif
-#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
-
-#include <X11/Xpoll.h>
-
-typedef struct _TimerEventRec {
- struct timeval te_timer_value;
- struct _TimerEventRec *te_next;
- XtTimerCallbackProc te_proc;
- XtAppContext app;
- XtPointer te_closure;
-} TimerEventRec;
-
-typedef struct _InputEvent {
- XtInputCallbackProc ie_proc;
- XtPointer ie_closure;
- struct _InputEvent *ie_next;
- struct _InputEvent *ie_oq;
- XtAppContext app;
- int ie_source;
- XtInputMask ie_condition;
-} InputEvent;
-
-typedef struct _SignalEventRec {
- XtSignalCallbackProc se_proc;
- XtPointer se_closure;
- struct _SignalEventRec *se_next;
- XtAppContext app;
- Boolean se_notice;
-} SignalEventRec;
-
-typedef struct _WorkProcRec {
- XtWorkProc proc;
- XtPointer closure;
- struct _WorkProcRec *next;
- XtAppContext app;
-} WorkProcRec;
-
-
-typedef struct
-{
-#ifndef USE_POLL
- fd_set rmask;
- fd_set wmask;
- fd_set emask;
-#endif
- int nfds;
-} FdStruct;
-
-typedef struct _LangProcRec {
- XtLanguageProc proc;
- XtPointer closure;
-} LangProcRec;
-
-typedef struct _ProcessContextRec {
- XtAppContext defaultAppContext;
- XtAppContext appContextList;
- ConverterTable globalConverterTable;
- LangProcRec globalLangProcRec;
-} ProcessContextRec, *ProcessContext;
-
-typedef struct {
- char* start;
- char* current;
- int bytes_remaining;
-} Heap;
-
-typedef struct _DestroyRec DestroyRec;
-
-
-typedef struct _XtAppStruct {
- XtAppContext next; /* link to next app in process context */
- ProcessContext process; /* back pointer to our process context */
- InternalCallbackList destroy_callbacks;
- Display **list;
- TimerEventRec *timerQueue;
- WorkProcRec *workQueue;
- InputEvent **input_list;
- InputEvent *outstandingQueue;
- SignalEventRec *signalQueue;
- XrmDatabase errorDB;
- XtErrorMsgHandler errorMsgHandler, warningMsgHandler;
- XtErrorHandler errorHandler, warningHandler;
- struct _ActionListRec *action_table;
- ConverterTable converterTable;
- unsigned long selectionTimeout;
- FdStruct fds;
- short count; /* num of assigned entries in list */
- short max; /* allocate size of list */
- short last;
- short input_count;
- short input_max; /* elts input_list init'd with */
- Boolean sync, being_destroyed, error_inited;
-#ifndef NO_IDENTIFY_WINDOWS
- Boolean identify_windows; /* debugging hack */
-#endif
- Heap heap;
- String * fallback_resources; /* Set by XtAppSetFallbackResources. */
- struct _ActionHookRec* action_hook_list;
- struct _BlockHookRec* block_hook_list;
- int destroy_list_size; /* state data for 2-phase destroy */
- int destroy_count;
- int dispatch_level;
- DestroyRec* destroy_list;
- Widget in_phase2_destroy;
- LangProcRec langProcRec;
- struct _TMBindCacheRec * free_bindings;
- String display_name_tried;
- Display **dpy_destroy_list;
- int dpy_destroy_count;
- Boolean exit_flag;
- Boolean rebuild_fdlist;
-#ifdef XTHREADS
- LockPtr lock_info;
- ThreadAppProc lock;
- ThreadAppProc unlock;
- ThreadAppYieldLockProc yield_lock;
- ThreadAppRestoreLockProc restore_lock;
- ThreadAppProc free_lock;
-#endif
-} XtAppStruct;
-
-#ifdef XTTRACEMEMORY
-
-
-extern char *_XtHeapMalloc(
-#if NeedFunctionPrototypes
- Heap* /* heap */,
- Cardinal /* size */,
- char * /* file */,
- int /* line */
-#endif
-);
-
-#define _XtHeapAlloc(heap,bytes) _XtHeapMalloc(heap, bytes, __FILE__, __LINE__)
-
-#else /* XTTRACEMEMORY */
-
-extern char* _XtHeapAlloc(
-#if NeedFunctionPrototypes
- Heap* /* heap */,
- Cardinal /* size */
-#endif
-);
-
-#endif /* XTTRACEMEMORY */
-
-extern void _XtSetDefaultErrorHandlers(
-#if NeedFunctionPrototypes
- XtErrorMsgHandler* /* errMsg */,
- XtErrorMsgHandler* /* warnMsg */,
- XtErrorHandler* /* err */,
- XtErrorHandler* /* warn */
-#endif
-);
-
-extern void _XtSetDefaultSelectionTimeout(
-#if NeedFunctionPrototypes
- unsigned long* /* timeout */
-#endif
-);
-
-extern XtAppContext _XtDefaultAppContext(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern ProcessContext _XtGetProcessContext(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-Display *
-_XtAppInit(
-#if NeedFunctionPrototypes
- XtAppContext* /* app_context_return */,
- String /* application_class */,
- XrmOptionDescRec* /* options */,
- Cardinal /* num_options */,
- int* /* argc_in_out */,
- String** /* argv_in_out */,
- String* /* fallback_resources */
-#endif
-);
-
-extern void _XtDestroyAppContexts(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void _XtCloseDisplays(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-extern int _XtAppDestroyCount;
-
-extern int _XtWaitForSomething(
-#if NeedFunctionPrototypes
- XtAppContext /* app */,
- _XtBoolean /* ignoreEvents */,
- _XtBoolean /* ignoreTimers */,
- _XtBoolean /* ignoreInputs */,
- _XtBoolean /* ignoreSignals */,
- _XtBoolean /* block */,
-#ifdef XTHREADS
- _XtBoolean /* drop_lock */,
-#endif
- unsigned long* /* howlong */
-#endif
-);
-
-typedef struct _CaseConverterRec *CaseConverterPtr;
-typedef struct _CaseConverterRec {
- KeySym start; /* first KeySym valid in converter */
- KeySym stop; /* last KeySym valid in converter */
- XtCaseProc proc; /* case converter function */
- CaseConverterPtr next; /* next converter record */
-} CaseConverterRec;
-
-typedef struct _ExtensionSelectorRec {
- XtExtensionSelectProc proc;
- int min, max;
- XtPointer client_data;
-} ExtSelectRec;
-
-typedef struct _XtPerDisplayStruct {
- InternalCallbackList destroy_callbacks;
- Region region;
- CaseConverterPtr case_cvt; /* user-registered case converters */
- XtKeyProc defaultKeycodeTranslator;
- XtAppContext appContext;
- unsigned long keysyms_serial; /* for tracking MappingNotify events */
- KeySym *keysyms; /* keycode to keysym table */
- int keysyms_per_keycode; /* number of keysyms for each keycode*/
- int min_keycode, max_keycode; /* range of keycodes */
- KeySym *modKeysyms; /* keysym values for modToKeysysm */
- ModToKeysymTable *modsToKeysyms; /* modifiers to Keysysms index table*/
- unsigned char isModifier[32]; /* key-is-modifier-p bit table */
- KeySym lock_meaning; /* Lock modifier meaning */
- Modifiers mode_switch; /* keyboard group modifiers */
- Modifiers num_lock; /* keyboard numlock modifiers */
- Boolean being_destroyed;
- Boolean rv; /* reverse_video resource */
- XrmName name; /* resolved app name */
- XrmClass class; /* application class */
- Heap heap;
- struct _GCrec *GClist; /* support for XtGetGC */
- Drawable **pixmap_tab; /* ditto for XtGetGC */
- String language; /* XPG language string */
- XEvent last_event; /* last event dispatched */
- Time last_timestamp; /* from last event dispatched */
- int multi_click_time; /* for XtSetMultiClickTime */
- struct _TMKeyContextRec* tm_context; /* for XtGetActionKeysym */
- InternalCallbackList mapping_callbacks; /* special case for TM */
- XtPerDisplayInputRec pdi; /* state for modal grabs & kbd focus */
- struct _WWTable *WWtable; /* window to widget table */
- XrmDatabase *per_screen_db; /* per screen resource databases */
- XrmDatabase cmd_db; /* db from command line, if needed */
- XrmDatabase server_db; /* resource property else .Xdefaults */
- XtEventDispatchProc* dispatcher_list;
- ExtSelectRec* ext_select_list;
- int ext_select_count;
- Widget hook_object;
-#ifndef X_NO_RESOURCE_CONFIGURATION_MANAGEMENT
- Atom rcm_init; /* ResConfig - initialize */
- Atom rcm_data; /* ResConfig - data atom */
-#endif
-} XtPerDisplayStruct, *XtPerDisplay;
-
-typedef struct _PerDisplayTable {
- Display *dpy;
- XtPerDisplayStruct perDpy;
- struct _PerDisplayTable *next;
-} PerDisplayTable, *PerDisplayTablePtr;
-
-extern PerDisplayTablePtr _XtperDisplayList;
-
-extern XtPerDisplay _XtSortPerDisplayList(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern XtPerDisplay _XtGetPerDisplay(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern XtPerDisplayInputRec* _XtGetPerDisplayInput(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-#if 0
-#ifdef DEBUG
-#define _XtGetPerDisplay(display) \
- ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
- ? &_XtperDisplayList->perDpy \
- : _XtSortPerDisplayList(display))
-#define _XtGetPerDisplayInput(display) \
- ((_XtperDisplayList != NULL && (_XtperDisplayList->dpy == (display))) \
- ? &_XtperDisplayList->perDpy.pdi \
- : &_XtSortPerDisplayList(display)->pdi)
-#else
-#define _XtGetPerDisplay(display) \
- ((_XtperDisplayList->dpy == (display)) \
- ? &_XtperDisplayList->perDpy \
- : _XtSortPerDisplayList(display))
-#define _XtGetPerDisplayInput(display) \
- ((_XtperDisplayList->dpy == (display)) \
- ? &_XtperDisplayList->perDpy.pdi \
- : &_XtSortPerDisplayList(display)->pdi)
-#endif /*DEBUG*/
-#endif
-
-extern void _XtDisplayInitialize(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XtPerDisplay /* pd */,
- _Xconst char* /* name */,
- XrmOptionDescRec* /* urlist */,
- Cardinal /* num_urs */,
- int* /* argc */,
- char** /* argv */
-#endif
-);
-
-extern void _XtCacheFlushTag(
-#if NeedFunctionPrototypes
- XtAppContext /* app */,
- XtPointer /* tag */
-#endif
-);
-
-extern void _XtFreeActions(
-#if NeedFunctionPrototypes
- struct _ActionListRec* /* action_table */
-#endif
-);
-
-extern void _XtDoPhase2Destroy(
-#if NeedFunctionPrototypes
- XtAppContext /* app */,
- int /* dispatch_level */
-#endif
-);
-
-extern void _XtDoFreeBindings(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-extern void _XtExtensionSelect(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-#define _XtSafeToDestroy(app) ((app)->dispatch_level == 0)
-
-extern void _XtAllocWWTable(
-#if NeedFunctionPrototypes
- XtPerDisplay pd
-#endif
-);
-
-extern void _XtFreeWWTable(
-#if NeedFunctionPrototypes
- XtPerDisplay pd
-#endif
-);
-
-#endif /* _XtinitialI_h */
diff --git a/xc/lib/Xt/Initialize.c b/xc/lib/Xt/Initialize.c
deleted file mode 100644
index e95d308b7..000000000
--- a/xc/lib/Xt/Initialize.c
+++ /dev/null
@@ -1,1041 +0,0 @@
-/* $TOG: Initialize.c /main/214 1998/06/19 14:27:36 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Initialize.c,v 3.15 1998/10/03 09:06:54 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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.
-
-*/
-
-/* Make sure all wm properties can make it out of the resource manager */
-
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-#include "CoreP.h"
-#include "ShellP.h"
-#include <stdio.h>
-#include <X11/Xlocale.h>
-#ifdef XTHREADS
-#include <X11/Xthreads.h>
-#endif
-#ifndef WIN32
-#define X_INCLUDE_PWD_H
-#define XOS_USE_XT_LOCKING
-#include <X11/Xos_r.h>
-#endif
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern char *getenv();
-#endif
-
-extern void _XtConvertInitialize();
-
-#if (defined(SUNSHLIB) || defined(AIXSHLIB)) && defined(SHAREDCODE)
-/*
- * If used as a shared library, generate code under a different name so that
- * the stub routines in sharedlib.c get loaded into the application binary.
- */
-#define XtToolkitInitialize _XtToolkitInitialize
-#define XtOpenApplication _XtOpenApplication
-#define XtAppInitialize _XtAppInitialize
-#define XtInitialize _XtInitialize
-#endif /* (SUNSHLIB || AIXSHLIB) && SHAREDCODE */
-
-/*
- * hpux
- * Hand-patched versions of HP-UX prior to version 7.0 can usefully add
- * -DUSE_UNAME in the appropriate config file to get long hostnames.
- */
-
-#ifdef USG
-#define USE_UNAME
-#endif
-
-#ifdef USE_UNAME
-#include <sys/utsname.h>
-#endif
-
-/* some unspecified magic number of expected search levels for Xrm */
-#define SEARCH_LIST_SIZE 1000
-
-/*
- This is a set of default records describing the command line arguments that
- Xlib will parse and set into the resource data base.
-
- This list is applied before the users list to enforce these defaults. This is
- policy, which the toolkit avoids but I hate differing programs at this level.
-*/
-
-static XrmOptionDescRec Const opTable[] = {
-{"+rv", "*reverseVideo", XrmoptionNoArg, (XtPointer) "off"},
-{"+synchronous","*synchronous", XrmoptionNoArg, (XtPointer) "off"},
-{"-background", "*background", XrmoptionSepArg, (XtPointer) NULL},
-{"-bd", "*borderColor", XrmoptionSepArg, (XtPointer) NULL},
-{"-bg", "*background", XrmoptionSepArg, (XtPointer) NULL},
-{"-bordercolor","*borderColor", XrmoptionSepArg, (XtPointer) NULL},
-{"-borderwidth",".borderWidth", XrmoptionSepArg, (XtPointer) NULL},
-{"-bw", ".borderWidth", XrmoptionSepArg, (XtPointer) NULL},
-{"-display", ".display", XrmoptionSepArg, (XtPointer) NULL},
-{"-fg", "*foreground", XrmoptionSepArg, (XtPointer) NULL},
-{"-fn", "*font", XrmoptionSepArg, (XtPointer) NULL},
-{"-font", "*font", XrmoptionSepArg, (XtPointer) NULL},
-{"-foreground", "*foreground", XrmoptionSepArg, (XtPointer) NULL},
-{"-geometry", ".geometry", XrmoptionSepArg, (XtPointer) NULL},
-{"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "on"},
-{"-name", ".name", XrmoptionSepArg, (XtPointer) NULL},
-{"-reverse", "*reverseVideo", XrmoptionNoArg, (XtPointer) "on"},
-{"-rv", "*reverseVideo", XrmoptionNoArg, (XtPointer) "on"},
-{"-selectionTimeout",
- ".selectionTimeout", XrmoptionSepArg, (XtPointer) NULL},
-{"-synchronous","*synchronous", XrmoptionNoArg, (XtPointer) "on"},
-{"-title", ".title", XrmoptionSepArg, (XtPointer) NULL},
-{"-xnllanguage",".xnlLanguage", XrmoptionSepArg, (XtPointer) NULL},
-{"-xrm", NULL, XrmoptionResArg, (XtPointer) NULL},
-{"-xtsessionID",".sessionID", XrmoptionSepArg, (XtPointer) NULL},
-};
-
-
-/*
- * GetHostname - emulates gethostname() on non-bsd systems.
- */
-
-static void GetHostname (buf, maxlen)
- char *buf;
- int maxlen;
-{
- int len;
-
-#ifdef USE_UNAME
- struct utsname name;
-
- if (maxlen <= 0 || buf == NULL)
- return;
-
- uname (&name);
- len = strlen (name.nodename);
- if (len >= maxlen) len = maxlen;
- (void) strncpy (buf, name.nodename, len-1);
- buf[len-1] = '\0';
-#else
- if (maxlen <= 0 || buf == NULL)
- return;
-
- buf[0] = '\0';
- (void) gethostname (buf, maxlen);
- buf [maxlen - 1] = '\0';
-#endif
-}
-
-
-#ifdef SUNSHLIB
-void _XtInherit()
-{
- extern void __XtInherit();
- __XtInherit();
-}
-#define _XtInherit __XtInherit
-#endif
-
-void _XtInherit()
-{
- XtErrorMsg("invalidProcedure","inheritanceProc",XtCXtToolkitError,
- "Unresolved inheritance operation",
- (String *)NULL, (Cardinal *)NULL);
-}
-
-
-void XtToolkitInitialize()
-{
- extern void _XtResourceListInitialize();
- static Boolean initialized = False;
-
- LOCK_PROCESS;
- if (initialized) {
- UNLOCK_PROCESS;
- return;
- }
- initialized = True;
- UNLOCK_PROCESS;
- /* Resource management initialization */
- XrmInitialize();
- _XtResourceListInitialize();
-
- /* Other intrinsic intialization */
- _XtConvertInitialize();
- _XtEventInitialize();
- _XtTranslateInitialize();
-}
-
-
-String _XtGetUserName(dest, len)
- String dest;
- int len;
-{
-#ifdef WIN32
- String ptr = NULL;
-
- if ((ptr = getenv("USERNAME"))) {
- (void) strncpy (dest, ptr, len-1);
- dest[len-1] = '\0';
- } else
- *dest = '\0';
-#else
- _Xgetpwparams pwparams;
- struct passwd *pw;
- char* ptr;
-
- if ((ptr = getenv("USER"))) {
- (void) strncpy (dest, ptr, len-1);
- dest[len-1] = '\0';
- } else {
- if ((pw = _XGetpwuid(getuid(),pwparams)) != NULL) {
- (void) strncpy (dest, pw->pw_name, len-1);
- dest[len-1] = '\0';
- } else
- *dest = '\0';
- }
-#endif
- return dest;
-}
-
-
-static String GetRootDirName(dest, len)
- String dest;
- int len;
-{
-#ifdef WIN32
- register char *ptr1;
- register char *ptr2;
- int len1 = 0, len2 = 0;
-
- if (ptr1 = getenv("HOME")) { /* old, deprecated */
- len1 = strlen (ptr1);
- } else if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) {
- len1 = strlen (ptr1);
- len2 = strlen (ptr2);
- } else if (ptr2 = getenv("USERNAME")) {
- len1 = strlen (ptr1 = "/users/");
- len2 = strlen (ptr2);
- }
- if ((len1 + len2 + 1) < len)
- sprintf (dest, "%s%s", ptr1, (ptr2) ? ptr2 : "");
- else
- *dest = '\0';
-#else
- _Xgetpwparams pwparams;
- struct passwd *pw;
- static char *ptr;
-
- if (len <= 0 || dest == NULL)
- return NULL;
-
- if ((ptr = getenv("HOME"))) {
- (void) strncpy (dest, ptr, len-1);
- dest[len-1] = '\0';
- } else {
- if (ptr = getenv("USER"))
- pw = _XGetpwnam(ptr,pwparams);
- else
- pw = _XGetpwuid(getuid(),pwparams);
- if (pw != NULL) {
- (void) strncpy (dest, pw->pw_dir, len-1);
- dest[len-1] = '\0';
- } else
- *dest = '\0';
- }
-#endif
- return dest;
-}
-
-static void CombineAppUserDefaults(dpy, pdb)
- Display *dpy;
- XrmDatabase *pdb;
-{
- char* filename;
- char* path;
- Boolean deallocate = False;
-
- if (!(path = getenv("XUSERFILESEARCHPATH"))) {
- char *old_path;
- char homedir[PATH_MAX];
- GetRootDirName(homedir, PATH_MAX);
- if (!(old_path = getenv("XAPPLRESDIR"))) {
- char *path_default = "%s/%%L/%%N%%C:%s/%%l/%%N%%C:%s/%%N%%C:%s/%%L/%%N:%s/%%l/%%N:%s/%%N";
- if (!(path =
- ALLOCATE_LOCAL(6*strlen(homedir) + strlen(path_default))))
- _XtAllocError(NULL);
- sprintf( path, path_default,
- homedir, homedir, homedir, homedir, homedir, homedir );
- } else {
- char *path_default = "%s/%%L/%%N%%C:%s/%%l/%%N%%C:%s/%%N%%C:%s/%%N%%C:%s/%%L/%%N:%s/%%l/%%N:%s/%%N:%s/%%N";
- if (!(path =
- ALLOCATE_LOCAL( 6*strlen(old_path) + 2*strlen(homedir)
- + strlen(path_default))))
- _XtAllocError(NULL);
- sprintf(path, path_default, old_path, old_path, old_path, homedir,
- old_path, old_path, old_path, homedir );
- }
- deallocate = True;
- }
-
- filename = XtResolvePathname(dpy, NULL, NULL, NULL, path, NULL, 0, NULL);
- if (filename) {
- (void)XrmCombineFileDatabase(filename, pdb, False);
- XtFree(filename);
- }
-
- if (deallocate) DEALLOCATE_LOCAL(path);
-}
-
-static void CombineUserDefaults(dpy, pdb)
- Display *dpy;
- XrmDatabase *pdb;
-{
- char *slashDotXdefaults = "/.Xdefaults";
- char *dpy_defaults = XResourceManagerString(dpy);
-
- if (dpy_defaults) {
- XrmCombineDatabase(XrmGetStringDatabase(dpy_defaults), pdb, False);
- } else {
- char filename[PATH_MAX];
- (void) GetRootDirName(filename,
- PATH_MAX - strlen (slashDotXdefaults) - 1);
- (void) strcat(filename, slashDotXdefaults);
- (void)XrmCombineFileDatabase(filename, pdb, False);
- }
-}
-
-/*ARGSUSED*/
-static Bool StoreDBEntry(db, bindings, quarks, type, value, data)
- XrmDatabase *db;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValuePtr value;
- XPointer data;
-{
- XrmQPutResource((XrmDatabase *)data, bindings, quarks, *type, value);
- return False;
-}
-
-static XrmDatabase CopyDB(db)
- XrmDatabase db;
-{
- XrmDatabase copy = NULL;
- XrmQuark empty = NULLQUARK;
-
- XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels,
- StoreDBEntry, (XPointer)&copy);
- return copy;
-}
-
-/*ARGSUSED*/
-static String _XtDefaultLanguageProc(dpy, xnl, closure)
- Display *dpy; /* unused */
- String xnl;
- XtPointer closure; /* unused */
-{
- if (! setlocale(LC_ALL, xnl))
- XtWarning("locale not supported by C library, locale unchanged");
-
- if (! XSupportsLocale()) {
- XtWarning("locale not supported by Xlib, locale set to C");
- setlocale(LC_ALL, "C");
- }
- if (! XSetLocaleModifiers(""))
- XtWarning("X locale modifiers not supported, using default");
-
- return setlocale(LC_ALL, NULL); /* re-query in case overwritten */
-}
-
-#if NeedFunctionPrototypes
-XtLanguageProc XtSetLanguageProc(
- XtAppContext app,
- XtLanguageProc proc,
- XtPointer closure
- )
-#else
-XtLanguageProc XtSetLanguageProc(app, proc, closure)
- XtAppContext app;
- XtLanguageProc proc;
- XtPointer closure;
-#endif
-{
- XtLanguageProc old;
-
- if (!proc) {
- proc = _XtDefaultLanguageProc;
- closure = NULL;
- }
-
- if (app) {
- LOCK_APP(app);
- LOCK_PROCESS;
- /* set langProcRec only for this application context */
- old = app->langProcRec.proc;
- app->langProcRec.proc = proc;
- app->langProcRec.closure = closure;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- } else {
- /* set langProcRec for all application contexts */
- ProcessContext process;
-
- LOCK_PROCESS;
- process = _XtGetProcessContext();
- old = process->globalLangProcRec.proc;
- process->globalLangProcRec.proc = proc;
- process->globalLangProcRec.closure = closure;
- app = process->appContextList;
- while (app) {
- app->langProcRec.proc = proc;
- app->langProcRec.closure = closure;
- app = app->next;
- }
- UNLOCK_PROCESS;
- }
- return (old ? old : _XtDefaultLanguageProc);
-}
-
-XrmDatabase XtScreenDatabase(screen)
- Screen *screen;
-{
- int scrno;
- Bool doing_def;
- XrmDatabase db, olddb;
- XtPerDisplay pd;
- Status do_fallback;
- char *scr_resources;
- Display *dpy = DisplayOfScreen(screen);
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- if (screen == DefaultScreenOfDisplay(dpy)) {
- scrno = DefaultScreen(dpy);
- doing_def = True;
- } else {
- scrno = XScreenNumberOfScreen(screen);
- doing_def = False;
- }
- pd = _XtGetPerDisplay(dpy);
- if (db = pd->per_screen_db[scrno]) {
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return (doing_def ? XrmGetDatabase(dpy) : db);
- }
- scr_resources = XScreenResourceString(screen);
-
- if (ScreenCount(dpy) == 1) {
- db = pd->cmd_db;
- pd->cmd_db = NULL;
- } else {
- db = CopyDB(pd->cmd_db);
- }
- { /* Environment defaults */
- char filenamebuf[PATH_MAX];
- char *filename;
-
- if (!(filename = getenv("XENVIRONMENT"))) {
- int len;
- char *slashDotXdefaultsDash = "/.Xdefaults-";
-
- (void) GetRootDirName(filename = filenamebuf,
- PATH_MAX - strlen (slashDotXdefaultsDash) - 1);
- (void) strcat(filename, slashDotXdefaultsDash);
- len = strlen(filename);
- GetHostname (filename+len, PATH_MAX-len);
- }
- (void)XrmCombineFileDatabase(filename, &db, False);
- }
- if (scr_resources)
- { /* Screen defaults */
- XrmCombineDatabase(XrmGetStringDatabase(scr_resources), &db, False);
- XFree(scr_resources);
- }
- /* Server or host defaults */
- if (!pd->server_db)
- CombineUserDefaults(dpy, &db);
- else {
- (void) XrmCombineDatabase(pd->server_db, &db, False);
- pd->server_db = NULL;
- }
-
- if (!db)
- db = XrmGetStringDatabase("");
- pd->per_screen_db[scrno] = db;
- olddb = XrmGetDatabase(dpy);
- /* set database now, for XtResolvePathname to use */
- XrmSetDatabase(dpy, db);
- CombineAppUserDefaults(dpy, &db);
- do_fallback = 1;
- { /* System app-defaults */
- char *filename;
-
- if (filename = XtResolvePathname(dpy, "app-defaults",
- NULL, NULL, NULL, NULL, 0, NULL)) {
- do_fallback = !XrmCombineFileDatabase(filename, &db, False);
- XtFree(filename);
- }
- }
- /* now restore old database, if need be */
- if (!doing_def)
- XrmSetDatabase(dpy, olddb);
- if (do_fallback && pd->appContext->fallback_resources)
- { /* Fallback defaults */
- XrmDatabase fdb = NULL;
- String *res;
-
- for (res = pd->appContext->fallback_resources; *res; res++)
- XrmPutLineResource(&fdb, *res);
- (void)XrmCombineDatabase(fdb, &db, False);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return db;
-}
-
-/*
- * Merge two option tables, allowing the second to over-ride the first,
- * so that ambiguous abbreviations can be noticed. The merge attempts
- * to make the resulting table lexicographically sorted, but succeeds
- * only if the first source table is sorted. Though it _is_ recommended
- * (for optimizations later in XrmParseCommand), it is not required
- * that either source table be sorted.
- *
- * Caller is responsible for freeing the returned option table.
- */
-
-static void _MergeOptionTables(src1, num_src1, src2, num_src2, dst, num_dst)
- XrmOptionDescRec *src1, *src2;
- Cardinal num_src1, num_src2;
- XrmOptionDescRec **dst;
- Cardinal *num_dst;
-{
- XrmOptionDescRec *table, *endP;
- register XrmOptionDescRec *opt1, *opt2, *whereP, *dstP;
- int i1, i2, dst_len, order;
- Boolean found;
- enum {Check, NotSorted, IsSorted} sort_order = Check;
-
- *dst = table = (XrmOptionDescRec*)
- __XtMalloc( sizeof(XrmOptionDescRec) * (num_src1 + num_src2) );
-
- (void) memmove(table, src1, sizeof(XrmOptionDescRec) * num_src1 );
- if (num_src2 == 0) {
- *num_dst = num_src1;
- return;
- }
- endP = &table[dst_len = num_src1];
- for (opt2 = src2, i2= 0; i2 < num_src2; opt2++, i2++) {
- found = False;
- whereP = endP-1; /* assume new option goes at the end */
- for (opt1 = table, i1 = 0; i1 < dst_len; opt1++, i1++) {
- /* have to walk the entire new table so new list is ordered
- (if src1 was ordered) */
- if (sort_order == Check && i1 > 0
- && strcmp(opt1->option, (opt1-1)->option) < 0)
- sort_order = NotSorted;
- if ((order = strcmp(opt1->option, opt2->option)) == 0) {
- /* same option names; just overwrite opt1 with opt2 */
- *opt1 = *opt2;
- found = True;
- break;
- }
- /* else */
- if (sort_order == IsSorted && order > 0) {
- /* insert before opt1 to preserve order */
- /* shift rest of table forward to make room for new entry */
- for (dstP = endP++; dstP > opt1; dstP--)
- *dstP = *(dstP-1);
- *opt1 = *opt2;
- dst_len++;
- found = True;
- break;
- }
- /* else */
- if (order < 0)
- /* opt2 sorts after opt1, so remember this position */
- whereP = opt1;
- }
- if (sort_order == Check && i1 == dst_len)
- sort_order = IsSorted;
- if (!found) {
- /* when we get here, whereP points to the last entry in the
- destination that sorts before "opt2". Shift rest of table
- forward and insert "opt2" after whereP. */
- whereP++;
- for (dstP = endP++; dstP > whereP; dstP--)
- *dstP = *(dstP-1);
- *whereP = *opt2;
- dst_len++;
- }
- }
- *num_dst = dst_len;
-}
-
-
-/* NOTE: name, class, and type must be permanent strings */
-static Boolean _GetResource(dpy, list, name, class, type, value)
- Display *dpy;
- XrmSearchList list;
- String name, class, type;
- XrmValue* value;
-{
- XrmRepresentation db_type;
- XrmValue db_value;
- XrmName Qname = XrmPermStringToQuark(name);
- XrmClass Qclass = XrmPermStringToQuark(class);
- XrmRepresentation Qtype = XrmPermStringToQuark(type);
-
- if (XrmQGetSearchResource(list, Qname, Qclass, &db_type, &db_value)) {
- if (db_type == Qtype) {
- if (Qtype == _XtQString)
- *(String*)value->addr = db_value.addr;
- else
- (void) memmove(value->addr, db_value.addr, value->size );
- return True;
- } else {
- WidgetRec widget; /* hack, hack */
- bzero( &widget, sizeof(widget) );
- widget.core.self = &widget;
- widget.core.widget_class = coreWidgetClass;
- widget.core.screen = (Screen*)DefaultScreenOfDisplay(dpy);
- XtInitializeWidgetClass(coreWidgetClass);
- if (_XtConvert(&widget,db_type,&db_value,Qtype,value,NULL)) {
- return True;
- }
- }
- }
- return False;
-}
-
-XrmDatabase _XtPreparseCommandLine(urlist, num_urs, argc, argv, applName,
- displayName, language)
- XrmOptionDescRec *urlist;
- Cardinal num_urs;
- int argc;
- String *argv;
- String *applName, *displayName, *language; /* return */
-{
- XrmDatabase db = 0;
- XrmOptionDescRec *options;
- Cardinal num_options;
- XrmName name_list[3];
- XrmName class_list[3];
- XrmRepresentation type;
- XrmValue val;
- String *targv;
- int targc = argc;
-
- targv = (String *) __XtMalloc(sizeof(char *) * argc);
- (void) memmove(targv, argv, sizeof(char *) * argc);
- _MergeOptionTables(opTable, XtNumber(opTable), urlist, num_urs,
- &options, &num_options);
- name_list[0] = class_list[0] = XrmPermStringToQuark(".");
- name_list[2] = class_list[2] = NULLQUARK;
- XrmParseCommand(&db, options, num_options, ".", &targc, targv);
- if (applName) {
- name_list[1] = XrmPermStringToQuark("name");
- if (XrmQGetResource(db, name_list, name_list, &type, &val) &&
- type == _XtQString)
- *applName = val.addr;
- }
- if (displayName) {
- name_list[1] = XrmPermStringToQuark("display");
- if (XrmQGetResource(db, name_list, name_list, &type, &val) &&
- type == _XtQString)
- *displayName = val.addr;
- }
- if (language) {
- name_list[1] = XrmPermStringToQuark("xnlLanguage");
- class_list[1] = XrmPermStringToQuark("XnlLanguage");
- if (XrmQGetResource(db, name_list, class_list, &type, &val) &&
- type == _XtQString)
- *language = val.addr;
- }
-
- XtFree((char *)targv);
- XtFree((char *)options);
- return db;
-}
-
-
-static void GetLanguage(dpy, pd)
- Display *dpy;
- XtPerDisplay pd;
-{
- XrmRepresentation type;
- XrmValue value;
- XrmName name_list[3];
- XrmName class_list[3];
-
- LOCK_PROCESS;
- if (! pd->language) {
- name_list[0] = pd->name;
- name_list[1] = XrmPermStringToQuark("xnlLanguage");
- class_list[0] = pd->class;
- class_list[1] = XrmPermStringToQuark("XnlLanguage");
- name_list[2] = class_list[2] = NULLQUARK;
- if (!pd->server_db)
- CombineUserDefaults(dpy, &pd->server_db);
- if (pd->server_db &&
- XrmQGetResource(pd->server_db,name_list,class_list, &type, &value)
- && type == _XtQString)
- pd->language = (char *) value.addr;
- }
-
- if (pd->appContext->langProcRec.proc) {
- if (! pd->language) pd->language = "";
- pd->language = (*pd->appContext->langProcRec.proc)
- (dpy, pd->language, pd->appContext->langProcRec.closure);
- }
- else if (! pd->language || pd->language[0] == '\0') /* R4 compatibility */
- pd->language = getenv("LANG");
-
- if (pd->language) pd->language = XtNewString(pd->language);
- UNLOCK_PROCESS;
-}
-
-static void ProcessInternalConnection (client_data, fd, id)
- XtPointer client_data;
- int* fd;
- XtInputId* id;
-{
- XProcessInternalConnection ((Display *) client_data, *fd);
-}
-
-static void ConnectionWatch (dpy, client_data, fd, opening, watch_data)
- Display* dpy;
- XPointer client_data;
- int fd;
- Bool opening;
- XPointer* watch_data;
-{
- XtInputId* iptr;
- XtAppContext app = XtDisplayToApplicationContext(dpy);
-
- if (opening) {
- iptr = (XtInputId *) __XtMalloc(sizeof(XtInputId));
- *iptr = XtAppAddInput(app, fd, (XtPointer) XtInputReadMask,
- ProcessInternalConnection, client_data);
- *watch_data = (XPointer) iptr;
- } else {
- iptr = (XtInputId *) *watch_data;
- XtRemoveInput(*iptr);
- (void) XtFree(*watch_data);
- }
-}
-
-#if NeedFunctionPrototypes
-void _XtDisplayInitialize(
- Display *dpy,
- XtPerDisplay pd,
- _Xconst char* name,
- XrmOptionDescRec *urlist,
- Cardinal num_urs,
- int *argc,
- char **argv)
-#else
-void _XtDisplayInitialize(dpy, pd, name, urlist, num_urs, argc, argv)
- Display *dpy;
- XtPerDisplay pd;
- String name;
- XrmOptionDescRec *urlist;
- Cardinal num_urs;
- int *argc;
- char **argv;
-#endif
-{
- Boolean tmp_bool;
- XrmValue value;
- XrmOptionDescRec *options;
- Cardinal num_options;
- XrmDatabase db;
- XrmName name_list[2];
- XrmClass class_list[2];
- XrmHashTable* search_list;
- int search_list_size = SEARCH_LIST_SIZE;
-
- GetLanguage(dpy, pd);
-
- /* Parse the command line and remove Xt arguments from argv */
- _MergeOptionTables( opTable, XtNumber(opTable), urlist, num_urs,
- &options, &num_options );
- XrmParseCommand(&pd->cmd_db, options, num_options, name, argc, argv);
-
- db = XtScreenDatabase(DefaultScreenOfDisplay(dpy));
-
- if (!(search_list = (XrmHashTable*)
- ALLOCATE_LOCAL( SEARCH_LIST_SIZE*sizeof(XrmHashTable))))
- _XtAllocError(NULL);
- name_list[0] = pd->name;
- class_list[0] = pd->class;
- name_list[1] = NULLQUARK;
- class_list[1] = NULLQUARK;
-
- while (!XrmQGetSearchList(db, name_list, class_list,
- search_list, search_list_size)) {
- XrmHashTable* old = search_list;
- Cardinal size = (search_list_size*=2)*sizeof(XrmHashTable);
- if (!(search_list = (XrmHashTable*)ALLOCATE_LOCAL(size)))
- _XtAllocError(NULL);
- (void) memmove((char*)search_list, (char*)old, (size>>1) );
- DEALLOCATE_LOCAL(old);
- }
-
- value.size = sizeof(tmp_bool);
- value.addr = (XtPointer)&tmp_bool;
- if (_GetResource(dpy, search_list, "synchronous", "Synchronous",
- XtRBoolean, &value)) {
- int i;
- Display **dpyP = pd->appContext->list;
- pd->appContext->sync = tmp_bool;
- for (i = pd->appContext->count; i; dpyP++, i--) {
- (void) XSynchronize(*dpyP, (Bool)tmp_bool);
- }
- } else {
- (void) XSynchronize(dpy, (Bool)pd->appContext->sync);
- }
-
- if (_GetResource(dpy, search_list, "reverseVideo", "ReverseVideo",
- XtRBoolean, &value)
- && tmp_bool) {
- pd->rv = True;
- }
-
- value.size = sizeof(pd->multi_click_time);
- value.addr = (XtPointer)&pd->multi_click_time;
- if (!_GetResource(dpy, search_list,
- "multiClickTime", "MultiClickTime",
- XtRInt, &value)) {
- pd->multi_click_time = 200;
- }
-
- value.size = sizeof(pd->appContext->selectionTimeout);
- value.addr = (XtPointer)&pd->appContext->selectionTimeout;
- (void)_GetResource(dpy, search_list,
- "selectionTimeout", "SelectionTimeout",
- XtRInt, &value);
-
-#ifndef NO_IDENTIFY_WINDOWS
- value.size = sizeof(pd->appContext->identify_windows);
- value.addr = (XtPointer)&pd->appContext->identify_windows;
- (void)_GetResource(dpy, search_list,
- "xtIdentifyWindows", "XtDebug",
- XtRBoolean, &value);
-#endif
-
- XAddConnectionWatch(dpy, ConnectionWatch, (XPointer) dpy);
-
- XtFree( (XtPointer)options );
- DEALLOCATE_LOCAL( search_list );
-}
-
-/* Function Name: XtAppSetFallbackResources
- * Description: Sets the fallback resource list that will be loaded
- * at display initialization time.
- * Arguments: app_context - the app context.
- * specification_list - the resource specification list.
- * Returns: none.
- */
-
-#if NeedFunctionPrototypes
-void
-XtAppSetFallbackResources(
-XtAppContext app_context,
-String *specification_list
-)
-#else
-void
-XtAppSetFallbackResources(app_context, specification_list)
-XtAppContext app_context;
-String *specification_list;
-#endif
-{
- LOCK_APP(app_context);
- app_context->fallback_resources = specification_list;
- UNLOCK_APP(app_context);
-}
-
-
-#if NeedFunctionPrototypes
-Widget XtOpenApplication(XtAppContext *app_context_return,
- _Xconst char *application_class,
- XrmOptionDescRec *options, Cardinal num_options,
- int *argc_in_out, String *argv_in_out,
- String *fallback_resources, WidgetClass widget_class,
- ArgList args_in, Cardinal num_args_in)
-#else
-Widget XtOpenApplication(app_context_return, application_class,
- options, num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class,
- args_in, num_args_in)
- XtAppContext *app_context_return;
- String application_class;
- XrmOptionDescRec *options;
- Cardinal num_options, num_args_in;
- int *argc_in_out;
- String *argv_in_out, *fallback_resources;
- WidgetClass widget_class;
- ArgList args_in;
-#endif
-{
- XtAppContext app_con;
- Display * dpy;
- register int saved_argc = *argc_in_out;
- Widget root;
- Arg args[3], *merged_args;
- Cardinal num = 0;
-
- XtToolkitInitialize(); /* cannot be moved into _XtAppInit */
-
- dpy = _XtAppInit(&app_con, (String)application_class, options, num_options,
- argc_in_out, &argv_in_out, fallback_resources);
-
- LOCK_APP(app_con);
- XtSetArg(args[num], XtNscreen, DefaultScreenOfDisplay(dpy)); num++;
- XtSetArg(args[num], XtNargc, saved_argc); num++;
- XtSetArg(args[num], XtNargv, argv_in_out); num++;
-
- merged_args = XtMergeArgLists(args_in, num_args_in, args, num);
- num += num_args_in;
-
- root = XtAppCreateShell(NULL, application_class, widget_class, dpy,
- merged_args, num);
-
- if (app_context_return)
- *app_context_return = app_con;
-
- XtFree((XtPointer)merged_args);
- XtFree((XtPointer)argv_in_out);
- UNLOCK_APP(app_con);
- return root;
-}
-
-
-#if NeedFunctionPrototypes
-Widget
-XtAppInitialize(
-XtAppContext * app_context_return,
-_Xconst char* application_class,
-XrmOptionDescRec *options,
-Cardinal num_options,
-int *argc_in_out,
-String *argv_in_out,
-String *fallback_resources,
-ArgList args_in,
-Cardinal num_args_in
-)
-#else
-Widget
-XtAppInitialize(app_context_return, application_class, options, num_options,
- argc_in_out, argv_in_out, fallback_resources,
- args_in, num_args_in)
-XtAppContext * app_context_return;
-String application_class;
-XrmOptionDescRec *options;
-Cardinal num_options, num_args_in;
-int *argc_in_out;
-String *argv_in_out, * fallback_resources;
-ArgList args_in;
-#endif
-{
- return XtOpenApplication(app_context_return, application_class,
- options, num_options,
- argc_in_out, argv_in_out, fallback_resources,
- applicationShellWidgetClass,
- args_in, num_args_in);
-}
-
-
-/*ARGSUSED*/
-#if NeedFunctionPrototypes
-Widget
-XtInitialize(
-_Xconst char* name,
-_Xconst char* classname,
-XrmOptionDescRec *options,
-Cardinal num_options,
-int *argc,
-String *argv
-)
-#else
-Widget
-XtInitialize(name, classname, options, num_options, argc, argv)
-String name, classname;
-XrmOptionDescRec *options;
-Cardinal num_options;
-String *argv;
-int *argc;
-#endif
-{
- Widget root;
- XtAppContext app_con;
- register ProcessContext process = _XtGetProcessContext();
-
- root = XtAppInitialize(&app_con, classname, options, num_options,
- argc, argv, NULL, NULL, (Cardinal) 0);
-
- LOCK_PROCESS;
- process->defaultAppContext = app_con;
- UNLOCK_PROCESS;
- return root;
-}
diff --git a/xc/lib/Xt/Intrinsic.c b/xc/lib/Xt/Intrinsic.c
deleted file mode 100644
index a00b3930c..000000000
--- a/xc/lib/Xt/Intrinsic.c
+++ /dev/null
@@ -1,1648 +0,0 @@
-/* $TOG: Intrinsic.c /main/158 1998/06/17 13:26:39 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Intrinsic.c,v 3.13 1998/10/03 09:06:54 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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.
-
-*/
-
-#define INTRINSIC_C
-
-#include "IntrinsicI.h"
-#include "VarargsI.h" /* for geoTattler */
-#ifndef NO_IDENTIFY_WINDOWS
-#include <X11/Xatom.h>
-#endif
-#ifndef VMS
-#include <sys/stat.h>
-#endif /* VMS */
-
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-extern char *getenv();
-#endif
-
-String XtCXtToolkitError = "XtToolkitError";
-
-Boolean XtIsSubclass(widget, widgetClass)
- Widget widget;
- WidgetClass widgetClass;
-{
- register WidgetClass w;
- Boolean retval = FALSE;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- for (w = widget->core.widget_class; w != NULL; w = w->core_class.superclass)
- if (w == widgetClass) {
- retval = TRUE;
- break;
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return retval;
-} /* XtIsSubclass */
-
-
-#if NeedFunctionPrototypes
-Boolean _XtCheckSubclassFlag(
- Widget object,
- _XtXtEnum flag
- )
-#else
-Boolean _XtCheckSubclassFlag(object, flag)
- Widget object;
- XtEnum flag;
-#endif
-{
- Boolean retval;
-
- LOCK_PROCESS;
- if (object->core.widget_class->core_class.class_inited & flag)
- retval = TRUE;
- else
- retval = FALSE;
- UNLOCK_PROCESS;
- return retval;
-} /*_XtVerifySubclass */
-
-
-#if NeedFunctionPrototypes
-Boolean _XtIsSubclassOf(
- Widget object,
- WidgetClass widgetClass,
- WidgetClass superClass,
- _XtXtEnum flag
- )
-#else
-Boolean _XtIsSubclassOf(object, widgetClass, superClass, flag)
- Widget object;
- WidgetClass widgetClass, superClass;
- XtEnum flag;
-#endif
-{
- LOCK_PROCESS;
- if (!(object->core.widget_class->core_class.class_inited & flag)) {
- UNLOCK_PROCESS;
- return False;
- } else {
- register WidgetClass c = object->core.widget_class;
- while (c != superClass) {
- if (c == widgetClass) {
- UNLOCK_PROCESS;
- return True;
- }
- c = c->core_class.superclass;
- }
- UNLOCK_PROCESS;
- return False;
- }
-} /*_XtIsSubclassOf */
-
-
-#if NeedFunctionPrototypes
-XtPointer XtGetClassExtension(
- WidgetClass object_class,
- Cardinal byte_offset,
- XrmQuark type,
- long version,
- Cardinal record_size
- )
-#else
-XtPointer XtGetClassExtension(object_class, byte_offset, type, version,
- record_size)
- WidgetClass object_class;
- Cardinal byte_offset;
- XrmQuark type;
- long version;
- Cardinal record_size;
-#endif
-{
- ObjectClassExtension ext;
- LOCK_PROCESS;
-
- ext = *(ObjectClassExtension *)((char *)object_class + byte_offset);
- while (ext && (ext->record_type != type || ext->version < version
- || ext->record_size < record_size)) {
- ext = (ObjectClassExtension) ext->next_extension;
- }
-
- UNLOCK_PROCESS;
- return (XtPointer) ext;
-}
-
-
-static void ComputeWindowAttributes(widget,value_mask,values)
- Widget widget;
- XtValueMask *value_mask;
- XSetWindowAttributes *values;
-{
- XtExposeProc expose;
-
- *value_mask = CWEventMask | CWColormap;
- (*values).event_mask = XtBuildEventMask(widget);
- (*values).colormap = widget->core.colormap;
- if (widget->core.background_pixmap != XtUnspecifiedPixmap) {
- *value_mask |= CWBackPixmap;
- (*values).background_pixmap = widget->core.background_pixmap;
- } else {
- *value_mask |= CWBackPixel;
- (*values).background_pixel = widget->core.background_pixel;
- }
- if (widget->core.border_pixmap != XtUnspecifiedPixmap) {
- *value_mask |= CWBorderPixmap;
- (*values).border_pixmap = widget->core.border_pixmap;
- } else {
- *value_mask |= CWBorderPixel;
- (*values).border_pixel = widget->core.border_pixel;
- }
- LOCK_PROCESS;
- expose = widget->core.widget_class->core_class.expose;
- UNLOCK_PROCESS;
- if (expose == (XtExposeProc) NULL) {
- /* Try to avoid redisplay upon resize by making bit_gravity the same
- as the default win_gravity */
- *value_mask |= CWBitGravity;
- (*values).bit_gravity = NorthWestGravity;
- }
-} /* ComputeWindowAttributes */
-
-static void CallChangeManaged(widget)
- register Widget widget;
-{
- register Cardinal i;
- XtWidgetProc change_managed;
- register WidgetList children;
- int managed_children = 0;
-
- register CompositePtr cpPtr;
- register CompositePartPtr clPtr;
-
- if (XtIsComposite (widget)) {
- cpPtr = (CompositePtr)&((CompositeWidget) widget)->composite;
- clPtr = (CompositePartPtr)&((CompositeWidgetClass)
- widget->core.widget_class)->composite_class;
- } else return;
-
- children = cpPtr->children;
- LOCK_PROCESS;
- change_managed = clPtr->change_managed;
- UNLOCK_PROCESS;
-
- /* CallChangeManaged for all children */
- for (i = cpPtr->num_children; i != 0; --i) {
- CallChangeManaged (children[i-1]);
- if (XtIsManaged(children[i-1])) managed_children++;
- }
-
- if (change_managed != NULL && managed_children != 0) {
- CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s changemanaged\n",
- XtName(widget),
- widget->core.width, widget->core.height));
- (*change_managed) (widget);
- }
-} /* CallChangeManaged */
-
-
-static void MapChildren(cwp)
- CompositePart *cwp;
-{
- Cardinal i;
- WidgetList children;
- register Widget child;
-
- children = cwp->children;
- for (i = 0; i < cwp->num_children; i++) {
- child = children[i];
- if (XtIsWidget (child)){
- if (child->core.managed && child->core.mapped_when_managed) {
- XtMapWidget (children[i]);
- }
- }
- }
-} /* MapChildren */
-
-
-static Boolean ShouldMapAllChildren(cwp)
- CompositePart *cwp;
-{
- Cardinal i;
- WidgetList children;
- register Widget child;
-
- children = cwp->children;
- for (i = 0; i < cwp->num_children; i++) {
- child = children[i];
- if (XtIsWidget(child)) {
- if (XtIsRealized(child) && (! (child->core.managed
- && child->core.mapped_when_managed))){
- return False;
- }
- }
- }
-
- return True;
-} /* ShouldMapAllChildren */
-
-
-static void RealizeWidget(widget)
- Widget widget;
-{
- XtValueMask value_mask;
- XSetWindowAttributes values;
- XtRealizeProc realize;
- Window window;
- Display* display;
- String class_name;
- Widget hookobj;
-
- if (!XtIsWidget(widget) || XtIsRealized(widget)) return;
- display = XtDisplay(widget);
- _XtInstallTranslations(widget);
-
- ComputeWindowAttributes (widget, &value_mask, &values);
- LOCK_PROCESS;
- realize = widget->core.widget_class->core_class.realize;
- class_name = widget->core.widget_class->core_class.class_name;
- UNLOCK_PROCESS;
- if (realize == NULL)
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "invalidProcedure","realizeProc",XtCXtToolkitError,
- "No realize class procedure defined",
- (String *)NULL, (Cardinal *)NULL);
- else {
- CALLGEOTAT(_XtGeoTrace(widget,"Call \"%s\"[%d,%d]'s realize proc\n",
- XtName(widget),
- widget->core.width, widget->core.height));
- (*realize) (widget, &value_mask, &values);
- }
- window = XtWindow(widget);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj,XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHrealizeWidget;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-#ifndef NO_IDENTIFY_WINDOWS
- if (_XtGetPerDisplay(display)->appContext->identify_windows) {
- int len_nm, len_cl;
- char *s;
-
- len_nm = widget->core.name ? strlen(widget->core.name) : 0;
- len_cl = strlen(class_name);
- s = __XtMalloc((unsigned) (len_nm + len_cl + 2));
- s[0] = '\0';
- if (len_nm)
- strcpy(s, widget->core.name);
- strcpy(s + len_nm + 1, class_name);
- XChangeProperty(display, window,
- XInternAtom(display, "_MIT_OBJ_CLASS",
- False),
- XA_STRING, 8, PropModeReplace, (unsigned char *) s,
- len_nm + len_cl + 2);
- XtFree(s);
- }
-#endif
-#ifdef notdef
- _XtRegisterAsyncHandlers(widget);
-#endif
- /* (re)register any grabs extant in the translations */
- _XtRegisterGrabs(widget);
- /* reregister any grabs added with XtGrab{Button,Key} */
- _XtRegisterPassiveGrabs(widget);
- XtRegisterDrawable (display, window, widget);
- _XtExtensionSelect(widget);
-
- if (XtIsComposite (widget)) {
- Cardinal i;
- CompositePart *cwp = &(((CompositeWidget)widget)->composite);
- WidgetList children = cwp->children;
- /* Realize all children */
- for (i = cwp->num_children; i != 0; --i) {
- RealizeWidget (children[i-1]);
- }
- /* Map children that are managed and mapped_when_managed */
-
- if (cwp->num_children != 0) {
- if (ShouldMapAllChildren(cwp)) {
- XMapSubwindows (display, window);
- } else {
- MapChildren(cwp);
- }
- }
- }
-
- /* If this is the application's popup shell, map it */
- if (widget->core.parent == NULL && widget->core.mapped_when_managed) {
- XtMapWidget (widget);
- }
-} /* RealizeWidget */
-
-void XtRealizeWidget (widget)
- Widget widget;
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (XtIsRealized (widget)) {
- UNLOCK_APP(app);
- return;
- }
- CallChangeManaged(widget);
- RealizeWidget(widget);
- UNLOCK_APP(app);
-} /* XtRealizeWidget */
-
-
-static void UnrealizeWidget(widget)
- Widget widget;
-{
- CompositeWidget cw;
- Cardinal i;
- WidgetList children;
-
- if (!XtIsWidget(widget) || !XtIsRealized(widget)) return;
-
- /* If this is the application's popup shell, unmap it? */
- /* no, the window is being destroyed */
-
- /* Recurse on children */
- if (XtIsComposite (widget)) {
- cw = (CompositeWidget) widget;
- children = cw->composite.children;
- /* Unrealize all children */
- for (i = cw->composite.num_children; i != 0; --i) {
- UnrealizeWidget (children[i-1]);
- }
- /* Unmap children that are managed and mapped_when_managed? */
- /* No, it's ok to be managed and unrealized as long as your parent */
- /* is unrealized. XtUnrealize widget makes sure the "top" widget */
- /* is unmanaged, we can ignore all descendents */
- }
-
- if (XtHasCallbacks(widget, XtNunrealizeCallback) == XtCallbackHasSome)
- XtCallCallbacks(widget, XtNunrealizeCallback, NULL);
-
- /* Unregister window */
- XtUnregisterDrawable(XtDisplay(widget), XtWindow(widget));
-
- /* Remove Event Handlers */
- /* remove grabs. Happens automatically when window is destroyed. */
-
- /* Destroy X Window, done at outer level with one request */
- widget->core.window = None;
-
- /* Removing the event handler here saves having to keep track if
- * the translation table is changed while the widget is unrealized.
- */
- _XtRemoveTranslations(widget);
-} /* UnrealizeWidget */
-
-
-void XtUnrealizeWidget (widget)
- Widget widget;
-{
- Window window;
- Widget hookobj;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- window = XtWindow(widget);
- if (! XtIsRealized (widget)) {
- UNLOCK_APP(app);
- return;
- }
- if (widget->core.managed && widget->core.parent != NULL)
- XtUnmanageChild(widget);
- UnrealizeWidget(widget);
- if (window != None)
- XDestroyWindow(XtDisplay(widget), window);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHunrealizeWidget;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtUnrealizeWidget */
-
-
-void XtCreateWindow(widget, window_class, visual, value_mask, attributes)
- Widget widget;
- unsigned int window_class;
- Visual *visual;
- XtValueMask value_mask;
- XSetWindowAttributes *attributes;
-{
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- if (widget->core.window == None) {
- if (widget->core.width == 0 || widget->core.height == 0) {
- Cardinal count = 1;
- XtAppErrorMsg(app,
- "invalidDimension", "xtCreateWindow", XtCXtToolkitError,
- "Widget %s has zero width and/or height",
- &widget->core.name, &count);
- }
- widget->core.window =
- XCreateWindow (
- XtDisplay (widget),
- (widget->core.parent ?
- widget->core.parent->core.window :
- widget->core.screen->root),
- (int)widget->core.x, (int)widget->core.y,
- (unsigned)widget->core.width, (unsigned)widget->core.height,
- (unsigned)widget->core.border_width, (int) widget->core.depth,
- window_class, visual, value_mask, attributes);
- }
- UNLOCK_APP(app);
-} /* XtCreateWindow */
-
-
-/* ---------------- XtNameToWidget ----------------- */
-
-static Widget NameListToWidget();
-
-typedef Widget (*NameMatchProc)();
-
-static Widget MatchExactChildren(names, bindings, children, num,
- in_depth, out_depth, found_depth)
- XrmNameList names;
- XrmBindingList bindings;
- register WidgetList children;
- register int num;
- int in_depth, *out_depth, *found_depth;
-{
- register Cardinal i;
- register XrmName name = *names;
- Widget w, result = NULL;
- int d, min = 10000;
-
- for (i = 0; i < num; i++) {
- if (name == children[i]->core.xrm_name) {
- w = NameListToWidget(children[i], &names[1], &bindings[1],
- in_depth+1, &d, found_depth);
- if (w != NULL && d < min) {result = w; min = d;}
- }
- }
- *out_depth = min;
- return result;
-}
-
-static Widget MatchWildChildren(names, bindings, children, num,
- in_depth, out_depth, found_depth)
- XrmNameList names;
- XrmBindingList bindings;
- register WidgetList children;
- register int num;
- int in_depth, *out_depth, *found_depth;
-{
- register Cardinal i;
- Widget w, result = NULL;
- int d, min = 10000;
-
- for (i = 0; i < num; i++) {
- w = NameListToWidget(children[i], names, bindings,
- in_depth+1, &d, found_depth);
- if (w != NULL && d < min) {result = w; min = d;}
- }
- *out_depth = min;
- return result;
-}
-
-static Widget SearchChildren(root, names, bindings, matchproc,
- in_depth, out_depth, found_depth)
- Widget root;
- XrmNameList names;
- XrmBindingList bindings;
- NameMatchProc matchproc;
- int in_depth, *out_depth, *found_depth;
-{
- Widget w1, w2;
- int d1, d2;
-
- if (XtIsComposite(root)) {
- w1 = (*matchproc)(names, bindings,
- ((CompositeWidget) root)->composite.children,
- ((CompositeWidget) root)->composite.num_children,
- in_depth, &d1, found_depth);
- } else d1 = 10000;
- w2 = (*matchproc)(names, bindings, root->core.popup_list,
- root->core.num_popups, in_depth, &d2, found_depth);
- *out_depth = (d1 < d2 ? d1 : d2);
- return (d1 < d2 ? w1 : w2);
-}
-
-static Widget NameListToWidget(root, names, bindings,
- in_depth, out_depth, found_depth)
- register Widget root;
- XrmNameList names;
- XrmBindingList bindings;
- int in_depth, *out_depth, *found_depth;
-{
- Widget w1, w2;
- int d1, d2;
-
- if (in_depth >= *found_depth) {
- *out_depth = 10000;
- return NULL;
- }
-
- if (names[0] == NULLQUARK) {
- *out_depth = *found_depth = in_depth;
- return root;
- }
-
- if (! XtIsWidget(root)) {
- *out_depth = 10000;
- return NULL;
- }
-
- if (*bindings == XrmBindTightly) {
- return SearchChildren(root, names, bindings, MatchExactChildren,
- in_depth, out_depth, found_depth);
-
- } else { /* XrmBindLoosely */
- w1 = SearchChildren(root, names, bindings, MatchExactChildren,
- in_depth, &d1, found_depth);
- w2 = SearchChildren(root, names, bindings, MatchWildChildren,
- in_depth, &d2, found_depth);
- *out_depth = (d1 < d2 ? d1 : d2);
- return (d1 < d2 ? w1 : w2);
- }
-} /* NameListToWidget */
-
-#if NeedFunctionPrototypes
-Widget XtNameToWidget(
- Widget root,
- _Xconst char* name
- )
-#else
-Widget XtNameToWidget(root, name)
- Widget root;
- String name;
-#endif
-{
- XrmName *names;
- XrmBinding *bindings;
- int len, depth, found = 10000;
- Widget result;
- WIDGET_TO_APPCON(root);
-
- len = strlen(name);
- if (len == 0) return NULL;
-
- LOCK_APP(app);
- names = (XrmName *) ALLOCATE_LOCAL((unsigned) (len+1) * sizeof(XrmName));
- bindings = (XrmBinding *)
- ALLOCATE_LOCAL((unsigned) (len+1) * sizeof(XrmBinding));
- if (names == NULL || bindings == NULL) _XtAllocError(NULL);
-
- XrmStringToBindingQuarkList(name, bindings, names);
- if (names[0] == NULLQUARK) {
- DEALLOCATE_LOCAL((char *) bindings);
- DEALLOCATE_LOCAL((char *) names);
- UNLOCK_APP(app);
- return NULL;
- }
-
- result = NameListToWidget(root, names, bindings, 0, &depth, &found);
-
- DEALLOCATE_LOCAL((char *) bindings);
- DEALLOCATE_LOCAL((char *) names);
- UNLOCK_APP(app);
- return result;
-} /* XtNameToWidget */
-
-/* Define user versions of intrinsics macros */
-
-#undef XtDisplayOfObject
-Display *XtDisplayOfObject(object)
- Widget object;
-{
- /* Attempts to LockApp() here will generate endless recursive loops */
- if (XtIsSubclass(object, hookObjectClass))
- return DisplayOfScreen(((HookObject)object)->hooks.screen);
- return XtDisplay(XtIsWidget(object) ? object : _XtWindowedAncestor(object));
-}
-
-#undef XtDisplay
-Display *XtDisplay(widget)
- Widget widget;
-{
- /* Attempts to LockApp() here will generate endless recursive loops */
- return DisplayOfScreen(widget->core.screen);
-}
-
-#undef XtScreenOfObject
-Screen *XtScreenOfObject(object)
- Widget object;
-{
- /* Attempts to LockApp() here will generate endless recursive loops */
- if (XtIsSubclass(object, hookObjectClass))
- return ((HookObject)object)->hooks.screen;
- return XtScreen(XtIsWidget(object) ? object : _XtWindowedAncestor(object));
-}
-
-#undef XtScreen
-Screen *XtScreen(widget)
- Widget widget;
-{
- /* Attempts to LockApp() here will generate endless recursive loops */
- return widget->core.screen;
-}
-
-#undef XtWindowOfObject
-Window XtWindowOfObject(object)
- Widget object;
-{
- return XtWindow(XtIsWidget(object) ? object : _XtWindowedAncestor(object));
-}
-
-
-#undef XtWindow
-Window XtWindow(widget)
- Widget widget;
-{
- return widget->core.window;
-}
-
-#undef XtSuperclass
-WidgetClass XtSuperclass(widget)
- Widget widget;
-{
- WidgetClass retval;
-
- LOCK_PROCESS;
- retval = XtClass(widget)->core_class.superclass;
- UNLOCK_PROCESS;
- return retval;
-}
-
-#undef XtClass
-WidgetClass XtClass(widget)
- Widget widget;
-{
- WidgetClass retval;
-
- LOCK_PROCESS;
- retval = widget->core.widget_class;
- UNLOCK_PROCESS;
- return retval;
-}
-
-#undef XtIsManaged
-Boolean XtIsManaged(object)
- Widget object;
-{
- Boolean retval;
- WIDGET_TO_APPCON(object);
-
- LOCK_APP(app);
- if (XtIsRectObj(object))
- retval = object->core.managed;
- else
- retval = False;
- UNLOCK_APP(app);
- return retval;
-}
-
-#undef XtIsRealized
-Boolean XtIsRealized (object)
- Widget object;
-{
- Boolean retval;
- WIDGET_TO_APPCON(object);
-
- LOCK_APP(app);
- retval = XtWindowOfObject(object) != None;
- UNLOCK_APP(app);
- return retval;
-} /* XtIsRealized */
-
-#undef XtIsSensitive
-Boolean XtIsSensitive(object)
- Widget object;
-{
- Boolean retval;
- WIDGET_TO_APPCON(object);
-
- LOCK_APP(app);
- if (XtIsRectObj(object))
- retval = object->core.sensitive && object->core.ancestor_sensitive;
- else
- retval = False;
- UNLOCK_APP(app);
- return retval;
-}
-
-/*
- * Internal routine; must be called only after XtIsWidget returns false
- */
-Widget _XtWindowedAncestor(object)
- register Widget object;
-{
- Widget obj = object;
- for (object = XtParent(object); object && !XtIsWidget(object);)
- object = XtParent(object);
-
- if (object == NULL) {
- String params = XtName(obj);
- Cardinal num_params = 1;
- XtErrorMsg("noWidgetAncestor", "windowedAncestor", XtCXtToolkitError,
- "Object \"%s\" does not have windowed ancestor",
- &params, &num_params);
- }
-
- return object;
-}
-
-#undef XtParent
-Widget XtParent(widget)
- Widget widget;
-{
- /* Attempts to LockApp() here will generate endless recursive loops */
- return widget->core.parent;
-}
-
-#undef XtName
-String XtName(object)
- Widget object;
-{
- /* Attempts to LockApp() here will generate endless recursive loops */
- return XrmQuarkToString(object->core.xrm_name);
-}
-
-
-Boolean XtIsObject(object)
- Widget object;
-{
- WidgetClass wc;
- String class_name;
-
- /* perform basic sanity checks */
- if (object->core.self != object || object->core.xrm_name == NULLQUARK)
- return False;
-
- LOCK_PROCESS;
- wc = object->core.widget_class;
- if (wc->core_class.class_name == NULL ||
- wc->core_class.xrm_class == NULLQUARK ||
- (class_name = XrmClassToString(wc->core_class.xrm_class)) == NULL ||
- strcmp(wc->core_class.class_name, class_name) != 0) {
- UNLOCK_PROCESS;
- return False;
- }
- UNLOCK_PROCESS;
-
- if (XtIsWidget(object)) {
- if (object->core.name == NULL ||
- (class_name = XrmNameToString(object->core.xrm_name)) == NULL ||
- strcmp(object->core.name, class_name) != 0)
- return False;
- }
- return True;
-}
-
-#if defined(WIN32)
-static int access_file (path, pathbuf, len_pathbuf, pathret)
- char* path;
- char* pathbuf;
- int len_pathbuf;
- char** pathret;
-{
- if (access (path, F_OK) == 0) {
- if (strlen (path) < len_pathbuf)
- *pathret = pathbuf;
- else
- *pathret = XtMalloc (strlen (path));
- if (*pathret) {
- strcpy (*pathret, path);
- return 1;
- }
- }
- return 0;
-}
-
-static int AccessFile (path, pathbuf, len_pathbuf, pathret)
- char* path;
- char* pathbuf;
- int len_pathbuf;
- char** pathret;
-{
- unsigned long drives;
- int i, len;
- char* drive;
- char buf[MAX_PATH];
- char* bufp;
-
- /* just try the "raw" name first and see if it works */
- if (access_file (path, pathbuf, len_pathbuf, pathret))
- return 1;
-
- /* try the places set in the environment */
- drive = getenv ("_XBASEDRIVE");
-#ifdef __EMX__
- if (!drive)
- drive = getenv ("X11ROOT");
-#endif
- if (!drive)
- drive = "C:";
- len = strlen (drive) + strlen (path);
- bufp = XtStackAlloc (len + 1, buf);
- strcpy (bufp, drive);
- strcat (bufp, path);
- if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
- XtStackFree (bufp, buf);
- return 1;
- }
-
-#ifndef __EMX__
- /* one last place to look */
- drive = getenv ("HOMEDRIVE");
- if (drive) {
- len = strlen (drive) + strlen (path);
- bufp = XtStackAlloc (len + 1, buf);
- strcpy (bufp, drive);
- strcat (bufp, path);
- if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
- XtStackFree (bufp, buf);
- return 1;
- }
- }
-
- /* does OS/2 (with or with gcc-emx) have getdrives()? */
- /* tried everywhere else, go fishing */
- drives = _getdrives ();
-#define C_DRIVE ('C' - 'A')
-#define Z_DRIVE ('Z' - 'A')
- for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */
- if ((1 << i) & drives) {
- len = 2 + strlen (path);
- bufp = XtStackAlloc (len + 1, buf);
- *bufp = 'A' + i;
- *(bufp + 1) = ':';
- *(bufp + 2) = '\0';
- strcat (bufp, path);
- if (access_file (bufp, pathbuf, len_pathbuf, pathret)) {
- XtStackFree (bufp, buf);
- return 1;
- }
- }
- }
-#endif
- return 0;
-}
-#endif
-
-static Boolean TestFile(path)
- String path;
-{
-#ifndef VMS
- int ret = 0;
- struct stat status;
-#if defined(WIN32)
- char buf[MAX_PATH];
- char* bufp;
- int len;
- UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS);
-
- if (AccessFile (path, buf, MAX_PATH, &bufp))
- path = bufp;
-
- (void) SetErrorMode (olderror);
-#endif
- ret = (access(path, R_OK) == 0 && /* exists and is readable */
- stat(path, &status) == 0 && /* get the status */
-#ifndef X_NOT_POSIX
- S_ISDIR(status.st_mode) == 0); /* not a directory */
-#else
- (status.st_mode & S_IFDIR) == 0); /* not a directory */
-#endif /* X_NOT_POSIX else */
-#if defined(WIN32)
- XtStackFree ((XtPointer)bufp, buf);
-#endif
- return ret;
-#else /* VMS */
- return TRUE; /* Who knows what to do here? */
-#endif /* VMS */
-}
-
-/* return of TRUE = resolved string fit, FALSE = didn't fit. Not
- null-terminated and not collapsed if it didn't fit */
-
-static Boolean Resolve(source, len, sub, num, buf, collapse)
- register char *source; /* The source string */
- register int len; /* The length in bytes of *source */
- Substitution sub; /* Array of string values to substitute */
- Cardinal num; /* Number of substitution entries */
- char *buf; /* Where to put the resolved string; */
- char collapse; /* Character to collapse */
-{
- register int bytesLeft = PATH_MAX;
- register char* bp = buf;
-#ifndef DONT_COLLAPSE
- Boolean atBeginning = TRUE;
- Boolean prevIsCollapse = FALSE;
-
-#define PUT(ch) \
- { \
- if (--bytesLeft == 0) return FALSE; \
- if (prevIsCollapse) \
- if ((*bp = ch) != collapse) { \
- prevIsCollapse = FALSE; \
- bp++; \
- } \
- else bytesLeft++; \
- else if ((*bp++ = ch) == collapse && !atBeginning) \
- prevIsCollapse = TRUE; \
- }
-#else /* DONT_COLLAPSE */
-
-#define PUT(ch) \
- { \
- if (--bytesLeft == 0) return FALSE; \
- *bp++ = ch; \
- }
-#endif /* DONT_COLLAPSE */
-#define escape '%'
-
- while (len--) {
-#ifndef DONT_COLLAPSE
- if (*source == collapse) {
- PUT(*source);
- source++;
- continue;
- }
- else
-#endif /* DONT_COLLAPSE */
- if (*source != escape) {
- PUT(*source);
- }
- else {
- source++;
- if (len-- == 0) {
- PUT(escape);
- break;
- }
-
- if (*source == ':' || *source == escape)
- PUT(*source)
- else {
- /* Match the character against the match array */
- register int j;
-
- for (j = 0; j < num && sub[j].match != *source; j++) {}
-
- /* Substitute the substitution string */
-
- if (j >= num) PUT(*source)
- else if (sub[j].substitution != NULL) {
- char *sp = sub[j].substitution;
- while (*sp) {
- PUT(*sp);
- sp++;
- }
- }
- }
- }
- source++;
-#ifndef DONT_COLLAPSE
- atBeginning = FALSE;
-#endif /* DONT_COLLAPSE */
- }
- PUT('\0');
-
- return TRUE;
-#undef PUT
-#undef escape
-}
-
-
-#if NeedFunctionPrototypes
-String XtFindFile(
- _Xconst char* path,
- Substitution substitutions,
- Cardinal num_substitutions,
- XtFilePredicate predicate
- )
-#else
-String XtFindFile(path, substitutions, num_substitutions, predicate)
- String path;
- Substitution substitutions;
- Cardinal num_substitutions;
- XtFilePredicate predicate;
-#endif
-{
- char *buf, *buf1, *buf2, *colon;
- int len;
- Boolean firstTime = TRUE;
-
- buf = buf1 = __XtMalloc((unsigned)PATH_MAX);
- buf2 = __XtMalloc((unsigned)PATH_MAX);
-
- if (predicate == NULL) predicate = TestFile;
-
- while (1) {
- colon = (String)path;
- /* skip leading colons */
- while (*colon) {
- if (*colon != ':') break;
- colon++;
- path++;
- }
- /* now look for an un-escaped colon */
- for ( ; *colon ; colon++) {
- if (*colon == '%' && *(path+1)) {
- colon++; /* bump it an extra time to skip %. */
- continue;
- }
- if (*colon == ':')
-#ifdef __EMX__
- if (colon > (path+1))
-#endif
- break;
- }
- len = colon - path;
- if (Resolve(path, len, substitutions, num_substitutions,
- buf, '/')) {
- if (firstTime || strcmp(buf1,buf2) != 0) {
-#ifdef __EMX__
- {
- char *bufx = (char*)__XOS2RedirRoot(buf);
- strcpy(buf,bufx);
- }
-#endif
-#ifdef XNL_DEBUG
- printf("Testing file %s\n", buf);
-#endif /* XNL_DEBUG */
- /* Check out the file */
- if ((*predicate) (buf)) {
- /* We've found it, return it */
-#ifdef XNL_DEBUG
- printf("File found.\n");
-#endif /* XNL_DEBUG */
- if (buf == buf1) XtFree(buf2);
- else XtFree(buf1);
- return buf;
- }
- if (buf == buf1)
- buf = buf2;
- else
- buf = buf1;
- firstTime = FALSE;
- }
- }
-
- /* Nope...any more paths? */
-
- if (*colon == '\0') break;
- path = colon+1;
- }
-
- /* No file found */
-
- XtFree(buf1);
- XtFree(buf2);
- return NULL;
-}
-
-
-/* The implementation of this routine is operating system dependent */
-/* Should match the code in Xlib _XlcMapOSLocaleName */
-
-static char *ExtractLocaleName(lang)
- String lang;
-{
-
-#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(__osf__) || defined(AIXV3) || defined(ultrix) || defined(WIN32) || defined(__EMX__)
-#ifdef hpux
-/*
- * We need to discriminated between HPUX 9 and HPUX 10. The equivalent
- * code in Xlib in SetLocale.c does include locale.h via X11/Xlocale.h.
- */
-#include <locale.h>
-#ifndef _LastCategory
-/* HPUX 9 and earlier */
-#define SKIPCOUNT 2
-#define STARTCHAR ':'
-#define ENDCHAR ';'
-#else
-/* HPUX 10 */
-#define ENDCHAR ' '
-#endif
-#else
-#ifdef ultrix
-#define SKIPCOUNT 2
-#define STARTCHAR '\001'
-#define ENDCHAR '\001'
-#else
-#if defined(WIN32) || defined(__EMX__)
-#define SKIPCOUNT 1
-#define STARTCHAR '='
-#define ENDCHAR ';'
-#define WHITEFILL
-#else
-#if defined(__osf__) || (defined(AIXV3) && !defined(AIXV4))
-#define STARTCHAR ' '
-#define ENDCHAR ' '
-#else
-#if !defined(sun) || defined(SVR4)
-#define STARTCHAR '/'
-#endif
-#define ENDCHAR '/'
-#endif
-#endif
-#endif
-#endif
-
- char *start;
- char *end;
- int len;
-#ifdef SKIPCOUNT
- int n;
-#endif
- static char* buf = NULL;
-
- start = lang;
-#ifdef SKIPCOUNT
- for (n = SKIPCOUNT;
- --n >= 0 && start && (start = strchr (start, STARTCHAR));
- start++)
- ;
- if (!start)
- start = lang;
-#endif
-#ifdef STARTCHAR
- if (start && (start = strchr (start, STARTCHAR))) {
- start++;
-#endif
- if (end = strchr (start, ENDCHAR)) {
- len = end - start;
- if (buf != NULL) XtFree (buf);
- buf = XtMalloc (len + 1);
- if (buf == NULL) return NULL;
- strncpy(buf, start, len);
- *(buf + len) = '\0';
-#ifdef WHITEFILL
- for (start = buf; start = strchr(start, ' '); )
- *start++ = '-';
-#endif
- return buf;
- }
-#ifdef STARTCHAR
- }
-#endif
-#ifdef WHITEFILL
- if (strchr(lang, ' ')) {
- if (buf != NULL) XtFree (buf);
- else buf = XtMalloc (strlen (lang) + 1);
- if (buf == NULL) return NULL;
- strcpy(buf, lang);
- for (start = buf; start = strchr(start, ' '); )
- *start++ = '-';
- return buf;
- }
-#endif
-#undef STARTCHAR
-#undef ENDCHAR
-#undef WHITEFILL
-#endif
-
- return lang;
-}
-
-static void FillInLangSubs(subs, pd)
- Substitution subs;
- XtPerDisplay pd;
-{
- int len;
- char *string, *p1, *p2, *p3;
- char **rest;
- char *ch;
-
- if (pd->language == NULL ||
- (pd->language != NULL && pd->language[0] == '\0')) {
- subs[0].substitution = subs[1].substitution =
- subs[2].substitution = subs[3].substitution = NULL;
- return;
- }
-
- string = ExtractLocaleName(pd->language);
-
- if (string == NULL ||
- (string != NULL && string[0] == '\0')) {
- subs[0].substitution = subs[1].substitution =
- subs[2].substitution = subs[3].substitution = NULL;
- return;
- }
-
- len = strlen(string) + 1;
- subs[0].substitution = string;
- p1 = subs[1].substitution = __XtMalloc((Cardinal) 3*len);
- p2 = subs[2].substitution = subs[1].substitution + len;
- p3 = subs[3].substitution = subs[2].substitution + len;
-
- /* Everything up to the first "_" goes into p1. From "_" to "." in
- p2. The rest in p3. If no delimiters, all goes into p1. We
- assume p1, p2, and p3 are large enough. */
-
- *p1 = *p2 = *p3 = '\0';
-
- ch = strchr(string, '_');
- if (ch != NULL) {
- len = ch - string;
- (void) strncpy(p1, string, len);
- p1[len] = '\0';
- string = ch + 1;
- rest = &p2;
- } else rest = &p1;
-
- /* Rest points to where we put the first part */
-
- ch = strchr(string, '.');
- if (ch != NULL) {
- len = ch - string;
- strncpy(*rest, string, len);
- (*rest)[len] = '\0';
- (void) strcpy(p3, ch+1);
- } else (void) strcpy(*rest, string);
-}
-
-/*
- * default path used if environment variable XFILESEARCHPATH
- * is not defined. Also substitued for %D.
- * The exact value should be documented in the implementation
- * notes for any Xt implementation.
- */
-#if NeedFunctionPrototypes
-static char *implementation_default_path(void)
-#else
-static char *implementation_default_path()
-#endif
-{
-#ifdef WIN32
- /* if you know how to pass % thru the compiler let me know */
- static char xfilesearchpath[] = XFILESEARCHPATHDEFAULT;
- static Bool fixed;
- char *ch;
-
- if (!fixed) {
- for (ch = xfilesearchpath; ch = strchr(ch, ';'); ch++)
- *ch = '%';
- fixed = True;
- }
- return xfilesearchpath;
-#else
- return XFILESEARCHPATHDEFAULT;
-#endif
-}
-
-
-static SubstitutionRec defaultSubs[] = {
- {'N', NULL},
- {'T', NULL},
- {'S', NULL},
- {'C', NULL},
- {'L', NULL},
- {'l', NULL},
- {'t', NULL},
- {'c', NULL}
-};
-
-
-#if NeedFunctionPrototypes
-String XtResolvePathname(
- Display *dpy,
- _Xconst char* type,
- _Xconst char* filename,
- _Xconst char* suffix,
- _Xconst char* path,
- Substitution substitutions,
- Cardinal num_substitutions,
- XtFilePredicate predicate
- )
-#else
-String XtResolvePathname(dpy, type, filename, suffix, path, substitutions,
- num_substitutions, predicate)
- Display *dpy;
- String type, filename, suffix, path;
- Substitution substitutions;
- Cardinal num_substitutions;
- XtFilePredicate predicate;
-#endif
-{
- XtPerDisplay pd;
- static char *defaultPath = NULL;
- char *impl_default = implementation_default_path();
- int idef_len = strlen(impl_default);
- char *massagedPath;
- int bytesAllocd, bytesLeft;
- char *ch, *result;
- Substitution merged_substitutions;
- XrmRepresentation db_type;
- XrmValue value;
- XrmName name_list[3];
- XrmClass class_list[3];
- Boolean pathMallocd = False;
-
- LOCK_PROCESS;
- pd = _XtGetPerDisplay(dpy);
- if (path == NULL) {
-#ifndef VMS
- if (defaultPath == NULL) {
- defaultPath = getenv("XFILESEARCHPATH");
- if (defaultPath == NULL)
- defaultPath = impl_default;
- }
- path = defaultPath;
-#else
- path = ""; /* NULL would kill us later */
-#endif /* VMS */
- }
-
- if (filename == NULL) {
- filename = XrmClassToString(pd->class);
- }
-
- bytesAllocd = bytesLeft = 1000;
- massagedPath = ALLOCATE_LOCAL(bytesAllocd);
- if (massagedPath == NULL) _XtAllocError(NULL);
-
- if (path[0] == ':') {
- strcpy(massagedPath, "%N%S");
- ch = &massagedPath[4];
- bytesLeft -= 4;
- } else ch = massagedPath;
-
- /* Insert %N%S between adjacent colons
- * and default path for %D.
- * Default path should not have any adjacent colons of its own.
- */
-
- while (*path != '\0') {
- if (bytesLeft < idef_len) {
- int bytesUsed = bytesAllocd - bytesLeft;
- char *new;
- bytesAllocd +=1000;
- new = __XtMalloc((Cardinal) bytesAllocd);
- strncpy( new, massagedPath, bytesUsed );
- ch = new + bytesUsed;
- if (pathMallocd)
- XtFree(massagedPath);
- else
- DEALLOCATE_LOCAL(massagedPath);
- pathMallocd = True;
- massagedPath = new;
- bytesLeft = bytesAllocd - bytesUsed;
- }
- if (*path == '%' && *(path+1) == ':') {
- *ch++ = '%';
- *ch++ = ':';
- path += 2;
- bytesLeft -= 2;
- continue;
- }
- if (*path == ':' && *(path+1) == ':') {
- strcpy(ch, ":%N%S:");
- ch += 6;
- bytesLeft -= 6;
- while (*path == ':') path++;
- continue;
- }
- if (*path == '%' && *(path+1) == 'D') {
- strcpy(ch, impl_default);
- ch += idef_len;
- bytesLeft -= idef_len;
- path += 2;
- continue;
- }
- *ch++ = *path++;
- bytesLeft--;
- }
- *ch = '\0';
-#ifdef XNL_DEBUG
- printf("Massaged path: %s\n", massagedPath);
-#endif /* XNL_DEBUG */
-
- if (num_substitutions == 0)
- merged_substitutions = defaultSubs;
- else {
- int i = XtNumber(defaultSubs);
- Substitution sub, def;
- merged_substitutions = sub = (Substitution)
- ALLOCATE_LOCAL((unsigned)(num_substitutions+i)*sizeof(SubstitutionRec));
- if (sub == NULL) _XtAllocError(NULL);
- for (def = defaultSubs; i--; sub++, def++) sub->match = def->match;
- for (i = num_substitutions; i--; ) *sub++ = *substitutions++;
- }
- merged_substitutions[0].substitution = (String)filename;
- merged_substitutions[1].substitution = (String)type;
- merged_substitutions[2].substitution = (String)suffix;
- name_list[0] = pd->name;
- name_list[1] = XrmPermStringToQuark("customization");
- name_list[2] = NULLQUARK;
- class_list[0] = pd->class;
- class_list[1] = XrmPermStringToQuark("Customization");
- class_list[2] = NULLQUARK;
- if (XrmQGetResource(XrmGetDatabase(dpy), name_list, class_list,
- &db_type, &value) &&
- db_type == _XtQString)
- merged_substitutions[3].substitution = (char *)value.addr;
- else
- merged_substitutions[3].substitution = NULL;
- FillInLangSubs(&merged_substitutions[4], pd);
-
- result = XtFindFile(massagedPath, merged_substitutions,
- num_substitutions + XtNumber(defaultSubs),
- predicate);
-
- if (merged_substitutions[5].substitution != NULL)
- XtFree( (XtPointer)merged_substitutions[5].substitution );
-
- if (merged_substitutions != defaultSubs)
- DEALLOCATE_LOCAL(merged_substitutions);
-
- if (pathMallocd)
- XtFree(massagedPath);
- else
- DEALLOCATE_LOCAL(massagedPath);
-
- UNLOCK_PROCESS;
- return result;
-}
-
-
-Boolean XtCallAcceptFocus(widget, time)
- Widget widget;
- Time *time;
-{
- XtAcceptFocusProc ac;
- Boolean retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- ac = XtClass(widget)->core_class.accept_focus;
- UNLOCK_PROCESS;
-
- if (ac != NULL)
- retval = (*ac) (widget, time);
- else
- retval = FALSE;
- UNLOCK_APP(app);
- return retval;
-}
-
-#ifdef XT_GEO_TATTLER
-/**************************************************************************
- GeoTattler: This is used to debug Geometry management in Xt.
-
- It uses a pseudo resource XtNgeotattler.
-
- E.G. if those lines are found in the resource database:
-
- myapp*draw.XmScale.geoTattler: ON
- *XmScrollBar.geoTattler:ON
- *XmRowColumn.exit_button.geoTattler:ON
-
- then:
-
- all the XmScale children of the widget named draw,
- all the XmScrollBars,
- the widget named exit_button in any XmRowColumn
-
- will return True to the function IsTattled(), and will generate
- outlined trace to stdout.
-
-*************************************************************************/
-
-#define XtNgeoTattler "geoTattler"
-#define XtCGeoTattler "GeoTattler"
-
-typedef struct { Boolean geo_tattler ;} GeoDataRec ;
-
-static XtResource geo_resources[] = {
- { XtNgeoTattler, XtCGeoTattler, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(GeoDataRec, geo_tattler),
- XtRImmediate, (XtPointer) False }
-};
-
-/************************************************************************
- This function uses XtGetSubresources to find out if a widget
- needs to be geo-spied by the caller. */
-#if NeedFunctionPrototypes
-static Boolean IsTattled (Widget widget)
-#else
-static Boolean IsTattled (widget) Widget widget ;
-#endif
-{
- GeoDataRec geo_data ;
-
- XtGetSubresources(widget, (XtPointer)&geo_data,
- (String)NULL, (String)NULL,
- geo_resources, XtNumber(geo_resources),
- NULL, 0);
-
- return geo_data.geo_tattler;
-
-} /* IsTattled */
-
-static int n_tab = 0 ; /* not MT for now */
-
-void
-#if NeedFunctionPrototypes
-_XtGeoTab (int direction) /* +1 or -1 */
-#else
-_XtGeoTab (direction)
-int direction ;
-#endif
-{
- n_tab += direction ;
-}
-
-
-void
-#if NeedVarargsPrototypes
-_XtGeoTrace (Widget widget, ...)
-#else
-_XtGeoTrace (widget, va_alist)
-Widget widget;
-va_dcl
-#endif
-{
- va_list args;
- char *fmt;
- int i ;
- if (IsTattled(widget)) {
- Va_start(args, widget);
- fmt = va_arg(args, char *);
- for (i=0; i<n_tab; i++) printf(" ");
- (void) vprintf(fmt, args);
- va_end(args);
- }
-}
-
-#endif /* XT_GEO_TATTLER */
-
diff --git a/xc/lib/Xt/Intrinsic.h b/xc/lib/Xt/Intrinsic.h
deleted file mode 100644
index ff3deb187..000000000
--- a/xc/lib/Xt/Intrinsic.h
+++ /dev/null
@@ -1,3210 +0,0 @@
-/* $TOG: Intrinsic.h /main/178 1998/02/06 13:23:20 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 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 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, 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/lib/Xt/Intrinsic.h,v 3.4 1998/10/03 09:06:55 dawes Exp $ */
-
-#ifndef _XtIntrinsic_h
-#define _XtIntrinsic_h
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xresource.h>
-#include <X11/Xfuncproto.h>
-#ifdef XT_BC
-#include <X11/Xos.h> /* for R4 compatibility */
-#else
-#include <X11/Xosdefs.h>
-#ifndef X_NOT_STDC_ENV
-#include <string.h> /* for XtNewString */
-#else
-#ifdef SYSV
-#include <string.h>
-#else
-#include <strings.h>
-#endif /* SYSV else */
-#endif /* !X_NOT_STDC_ENV else */
-#endif /* XT_BC else */
-
-#define XtSpecificationRelease 6
-
-typedef char *String;
-
-#if NeedFunctionPrototypes
-
-/* We do this in order to get "const" declarations to work right. We
- * use _XtString instead of String so that C++ applications can
- * #define String to something else if they choose, to avoid conflicts
- * with other C++ libraries.
- */
-#define _XtString char*
-
-/* _Xt names are private to Xt implementation, do not use in client code */
-#if NeedWidePrototypes
-#define _XtBoolean int
-#define _XtDimension unsigned int
-#define _XtKeyCode unsigned int
-#define _XtPosition int
-#define _XtXtEnum unsigned int
-#else
-#define _XtBoolean Boolean
-#define _XtDimension Dimension
-#define _XtKeyCode KeyCode
-#define _XtPosition Position
-#define _XtXtEnum XtEnum
-#endif /* NeedWidePrototypes */
-
-#endif /* NeedFunctionPrototypes */
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifdef VMS
-#define externalref globalref
-#define externaldef(psect) globaldef {"psect"} noshare
-#else
-#define externalref extern
-#define externaldef(psect)
-#endif /* VMS */
-
-#ifndef FALSE
-#define FALSE 0
-#define TRUE 1
-#endif
-
-#define XtNumber(arr) ((Cardinal) (sizeof(arr) / sizeof(arr[0])))
-
-typedef struct _WidgetRec *Widget;
-typedef Widget *WidgetList;
-typedef struct _WidgetClassRec *WidgetClass;
-typedef struct _CompositeRec *CompositeWidget;
-typedef struct _XtActionsRec *XtActionList;
-typedef struct _XtEventRec *XtEventTable;
-
-typedef struct _XtAppStruct *XtAppContext;
-typedef unsigned long XtValueMask;
-typedef unsigned long XtIntervalId;
-typedef unsigned long XtInputId;
-typedef unsigned long XtWorkProcId;
-typedef unsigned long XtSignalId;
-typedef unsigned int XtGeometryMask;
-typedef unsigned long XtGCMask; /* Mask of values that are used by widget*/
-typedef unsigned long Pixel; /* Index into colormap */
-typedef int XtCacheType;
-#define XtCacheNone 0x001
-#define XtCacheAll 0x002
-#define XtCacheByDisplay 0x003
-#define XtCacheRefCount 0x100
-
-/****************************************************************
- *
- * System Dependent Definitions; see spec for specific range
- * requirements. Do not assume every implementation uses the
- * same base types!
- *
- *
- * XtArgVal ought to be a union of XtPointer, char *, long, int *, and proc *
- * but casting to union types is not really supported.
- *
- * So the typedef for XtArgVal should be chosen such that
- *
- * sizeof (XtArgVal) >= sizeof(XtPointer)
- * sizeof(char *)
- * sizeof(long)
- * sizeof(int *)
- * sizeof(proc *)
- *
- * ArgLists rely heavily on the above typedef.
- *
- ****************************************************************/
-#ifdef CRAY
-typedef long Boolean;
-typedef char* XtArgVal;
-typedef long XtEnum;
-#else
-typedef char Boolean;
-typedef long XtArgVal;
-typedef unsigned char XtEnum;
-#endif
-
-typedef unsigned int Cardinal;
-typedef unsigned short Dimension; /* Size in pixels */
-typedef short Position; /* Offset from 0 coordinate */
-
-#if NeedFunctionPrototypes
-typedef void* XtPointer;
-#else
-typedef char* XtPointer;
-#endif
-
-/* The type Opaque is NOT part of the Xt standard, do NOT use it. */
-/* (It remains here only for backward compatibility.) */
-typedef XtPointer Opaque;
-
-#include <X11/Core.h>
-#include <X11/Composite.h>
-#include <X11/Constraint.h>
-#include <X11/Object.h>
-#include <X11/RectObj.h>
-
-typedef struct _TranslationData *XtTranslations;
-typedef struct _TranslationData *XtAccelerators;
-typedef unsigned int Modifiers;
-
-typedef void (*XtActionProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-typedef XtActionProc* XtBoundActions;
-
-typedef struct _XtActionsRec{
- String string;
- XtActionProc proc;
-} XtActionsRec;
-
-typedef enum {
-/* address mode parameter representation */
-/* ------------ ------------------------ */
- XtAddress, /* address */
- XtBaseOffset, /* offset */
- XtImmediate, /* constant */
- XtResourceString, /* resource name string */
- XtResourceQuark, /* resource name quark */
- XtWidgetBaseOffset, /* offset from ancestor */
- XtProcedureArg /* procedure to invoke */
-} XtAddressMode;
-
-typedef struct {
- XtAddressMode address_mode;
- XtPointer address_id;
- Cardinal size;
-} XtConvertArgRec, *XtConvertArgList;
-
-typedef void (*XtConvertArgProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Cardinal* /* size */,
- XrmValue* /* value */
-#endif
-);
-
-typedef struct {
- XtGeometryMask request_mode;
- Position x, y;
- Dimension width, height, border_width;
- Widget sibling;
- int stack_mode; /* Above, Below, TopIf, BottomIf, Opposite, DontChange */
-} XtWidgetGeometry;
-
-/* Additions to Xlib geometry requests: ask what would happen, don't do it */
-#define XtCWQueryOnly (1 << 7)
-
-/* Additions to Xlib stack modes: don't change stack order */
-#define XtSMDontChange 5
-
-typedef void (*XtConverter)( /* obsolete */
-#if NeedFunctionPrototypes
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValue* /* from */,
- XrmValue* /* to */
-#endif
-);
-
-typedef Boolean (*XtTypeConverter)(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValue* /* args */,
- Cardinal* /* num_args */,
- XrmValue* /* from */,
- XrmValue* /* to */,
- XtPointer* /* converter_data */
-#endif
-);
-
-typedef void (*XtDestructor)(
-#if NeedFunctionPrototypes
- XtAppContext /* app */,
- XrmValue* /* to */,
- XtPointer /* converter_data */,
- XrmValue* /* args */,
- Cardinal* /* num_args */
-#endif
-);
-
-typedef Opaque XtCacheRef;
-
-typedef Opaque XtActionHookId;
-
-typedef void (*XtActionHookProc)(
-#if NeedFunctionPrototypes
- Widget /* w */,
- XtPointer /* client_data */,
- String /* action_name */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-typedef unsigned long XtBlockHookId;
-
-typedef void (*XtBlockHookProc)(
-#if NeedFunctionPrototypes
- XtPointer /* client_data */
-#endif
-);
-
-typedef void (*XtKeyProc)(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- _XtKeyCode /* keycode */,
- Modifiers /* modifiers */,
- Modifiers* /* modifiers_return */,
- KeySym* /* keysym_return */
-#endif
-);
-
-typedef void (*XtCaseProc)(
-#if NeedFunctionPrototypes
- Display* /* display */,
- KeySym /* keysym */,
- KeySym* /* lower_return */,
- KeySym* /* upper_return */
-#endif
-);
-
-typedef void (*XtEventHandler)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */,
- XEvent* /* event */,
- Boolean* /* continue_to_dispatch */
-#endif
-);
-typedef unsigned long EventMask;
-
-typedef enum {XtListHead, XtListTail } XtListPosition;
-
-typedef unsigned long XtInputMask;
-#define XtInputNoneMask 0L
-#define XtInputReadMask (1L<<0)
-#define XtInputWriteMask (1L<<1)
-#define XtInputExceptMask (1L<<2)
-
-typedef void (*XtTimerCallbackProc)(
-#if NeedFunctionPrototypes
- XtPointer /* closure */,
- XtIntervalId* /* id */
-#endif
-);
-
-typedef void (*XtInputCallbackProc)(
-#if NeedFunctionPrototypes
- XtPointer /* closure */,
- int* /* source */,
- XtInputId* /* id */
-#endif
-);
-
-typedef void (*XtSignalCallbackProc)(
-#if NeedFunctionPrototypes
- XtPointer /* closure */,
- XtSignalId* /* id */
-#endif
-);
-
-typedef struct {
- String name;
- XtArgVal value;
-} Arg, *ArgList;
-
-typedef XtPointer XtVarArgsList;
-
-typedef void (*XtCallbackProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */, /* data the application registered */
- XtPointer /* call_data */ /* callback specific data */
-#endif
-);
-
-typedef struct _XtCallbackRec {
- XtCallbackProc callback;
- XtPointer closure;
-} XtCallbackRec, *XtCallbackList;
-
-typedef enum {
- XtCallbackNoList,
- XtCallbackHasNone,
- XtCallbackHasSome
-} XtCallbackStatus;
-
-typedef enum {
- XtGeometryYes, /* Request accepted. */
- XtGeometryNo, /* Request denied. */
- XtGeometryAlmost, /* Request denied, but willing to take replyBox. */
- XtGeometryDone /* Request accepted and done. */
-} XtGeometryResult;
-
-typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;
-
-typedef struct {
- Widget shell_widget;
- Widget enable_widget;
-} XtPopdownIDRec, *XtPopdownID;
-
-typedef struct _XtResource {
- String resource_name; /* Resource name */
- String resource_class; /* Resource class */
- String resource_type; /* Representation type desired */
- Cardinal resource_size; /* Size in bytes of representation */
- Cardinal resource_offset;/* Offset from base to put resource value */
- String default_type; /* representation type of specified default */
- XtPointer default_addr; /* Address of default resource */
-} XtResource, *XtResourceList;
-
-typedef void (*XtResourceDefaultProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- int /* offset */,
- XrmValue* /* value */
-#endif
-);
-
-typedef String (*XtLanguageProc)(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- String /* xnl */,
- XtPointer /* client_data */
-#endif
-);
-
-typedef void (*XtErrorMsgHandler)(
-#if NeedFunctionPrototypes
- String /* name */,
- String /* type */,
- String /* class */,
- String /* default */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-typedef void (*XtErrorHandler)(
-#if NeedFunctionPrototypes
- String /* msg */
-#endif
-);
-
-typedef void (*XtCreatePopupChildProc)(
-#if NeedFunctionPrototypes
- Widget /* shell */
-#endif
-);
-
-typedef Boolean (*XtWorkProc)(
-#if NeedFunctionPrototypes
- XtPointer /* closure */ /* data the application registered */
-#endif
-);
-
-typedef struct {
- char match;
- String substitution;
-} SubstitutionRec, *Substitution;
-
-typedef Boolean (*XtFilePredicate)(
-#if NeedFunctionPrototypes
- String /* filename */
-#endif
-);
-
-typedef XtPointer XtRequestId;
-
-typedef Boolean (*XtConvertSelectionProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */,
- Atom* /* target */,
- Atom* /* type_return */,
- XtPointer* /* value_return */,
- unsigned long* /* length_return */,
- int* /* format_return */
-#endif
-);
-
-typedef void (*XtLoseSelectionProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */
-#endif
-);
-
-typedef void (*XtSelectionDoneProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */,
- Atom* /* target */
-#endif
-);
-
-typedef void (*XtSelectionCallbackProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */,
- Atom* /* selection */,
- Atom* /* type */,
- XtPointer /* value */,
- unsigned long* /* length */,
- int* /* format */
-#endif
-);
-
-typedef void (*XtLoseSelectionIncrProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */,
- XtPointer /* client_data */
-#endif
-);
-
-typedef void (*XtSelectionDoneIncrProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */,
- Atom* /* target */,
- XtRequestId* /* receiver_id */,
- XtPointer /* client_data */
-#endif
-);
-
-typedef Boolean (*XtConvertSelectionIncrProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */,
- Atom* /* target */,
- Atom* /* type */,
- XtPointer* /* value */,
- unsigned long* /* length */,
- int* /* format */,
- unsigned long* /* max_length */,
- XtPointer /* client_data */,
- XtRequestId* /* receiver_id */
-#endif
-);
-
-typedef void (*XtCancelConvertSelectionProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom* /* selection */,
- Atom* /* target */,
- XtRequestId* /* receiver_id */,
- XtPointer /* client_data */
-#endif
-);
-
-typedef Boolean (*XtEventDispatchProc)(
-#if NeedFunctionPrototypes
- XEvent* /* event */
-#endif
-);
-
-typedef void (*XtExtensionSelectProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- int* /* event_types */,
- XtPointer* /* select_data */,
- int /* count */,
- XtPointer /* client_data */
-#endif
-);
-
-/***************************************************************
- *
- * Exported Interfaces
- *
- ****************************************************************/
-
-_XFUNCPROTOBEGIN
-
-extern Boolean XtConvertAndStore(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* from_type */,
- XrmValue* /* from */,
- _Xconst _XtString /* to_type */,
- XrmValue* /* to_in_out */
-#endif
-);
-
-extern Boolean XtCallConverter(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XtTypeConverter /* converter */,
- XrmValuePtr /* args */,
- Cardinal /* num_args */,
- XrmValuePtr /* from */,
- XrmValue* /* to_in_out */,
- XtCacheRef* /* cache_ref_return */
-#endif
-);
-
-extern Boolean XtDispatchEvent(
-#if NeedFunctionPrototypes
- XEvent* /* event */
-#endif
-);
-
-extern Boolean XtCallAcceptFocus(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Time* /* time */
-#endif
-);
-
-extern Boolean XtPeekEvent( /* obsolete */
-#if NeedFunctionPrototypes
- XEvent* /* event_return */
-#endif
-);
-
-extern Boolean XtAppPeekEvent(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XEvent* /* event_return */
-#endif
-);
-
-extern Boolean XtIsSubclass(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- WidgetClass /* widgetClass */
-#endif
-);
-
-extern Boolean XtIsObject(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern Boolean _XtCheckSubclassFlag( /* implementation-private */
-#if NeedFunctionPrototypes
- Widget /* object */,
- _XtXtEnum /* type_flag */
-#endif
-);
-
-extern Boolean _XtIsSubclassOf( /* implementation-private */
-#if NeedFunctionPrototypes
- Widget /* object */,
- WidgetClass /* widget_class */,
- WidgetClass /* flag_class */,
- _XtXtEnum /* type_flag */
-#endif
-);
-
-extern Boolean XtIsManaged(
-#if NeedFunctionPrototypes
- Widget /* rectobj */
-#endif
-);
-
-extern Boolean XtIsRealized(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern Boolean XtIsSensitive(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern Boolean XtOwnSelection(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Time /* time */,
- XtConvertSelectionProc /* convert */,
- XtLoseSelectionProc /* lose */,
- XtSelectionDoneProc /* done */
-#endif
-);
-
-extern Boolean XtOwnSelectionIncremental(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Time /* time */,
- XtConvertSelectionIncrProc /* convert_callback */,
- XtLoseSelectionIncrProc /* lose_callback */,
- XtSelectionDoneIncrProc /* done_callback */,
- XtCancelConvertSelectionProc /* cancel_callback */,
- XtPointer /* client_data */
-#endif
-);
-
-extern XtGeometryResult XtMakeResizeRequest(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtDimension /* width */,
- _XtDimension /* height */,
- Dimension* /* width_return */,
- Dimension* /* height_return */
-#endif
-);
-
-extern void XtTranslateCoords(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtPosition /* x */,
- _XtPosition /* y */,
- Position* /* rootx_return */,
- Position* /* rooty_return */
-#endif
-);
-
-extern KeySym* XtGetKeysymTable(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- KeyCode* /* min_keycode_return */,
- int* /* keysyms_per_keycode_return */
-#endif
-);
-
-extern void XtKeysymToKeycodeList(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- KeySym /* keysym */,
- KeyCode** /* keycodes_return */,
- Cardinal* /* keycount_return */
-#endif
-);
-
-extern void XtStringConversionWarning( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* from_value */,
- _Xconst _XtString /* to_type */
-#endif
-);
-
-extern void XtDisplayStringConversionWarning(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- _Xconst _XtString /* from_value */,
- _Xconst _XtString /* to_type */
-#endif
-);
-
-#ifdef __STDC__
-externalref XtConvertArgRec const colorConvertArgs[];
-externalref XtConvertArgRec const screenConvertArg[];
-#else
-externalref XtConvertArgRec colorConvertArgs[];
-externalref XtConvertArgRec screenConvertArg[];
-#endif
-
-extern void XtAppAddConverter( /* obsolete */
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* from_type */,
- _Xconst _XtString /* to_type */,
- XtConverter /* converter */,
- XtConvertArgList /* convert_args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtAddConverter( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* from_type */,
- _Xconst _XtString /* to_type */,
- XtConverter /* converter */,
- XtConvertArgList /* convert_args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtSetTypeConverter(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* from_type */,
- _Xconst _XtString /* to_type */,
- XtTypeConverter /* converter */,
- XtConvertArgList /* convert_args */,
- Cardinal /* num_args */,
- XtCacheType /* cache_type */,
- XtDestructor /* destructor */
-#endif
-);
-
-extern void XtAppSetTypeConverter(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* from_type */,
- _Xconst _XtString /* to_type */,
- XtTypeConverter /* converter */,
- XtConvertArgList /* convert_args */,
- Cardinal /* num_args */,
- XtCacheType /* cache_type */,
- XtDestructor /* destructor */
-#endif
-);
-
-extern void XtConvert( /* obsolete */
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* from_type */,
- XrmValue* /* from */,
- _Xconst _XtString /* to_type */,
- XrmValue* /* to_return */
-#endif
-);
-
-extern void XtDirectConvert( /* obsolete */
-#if NeedFunctionPrototypes
- XtConverter /* converter */,
- XrmValuePtr /* args */,
- Cardinal /* num_args */,
- XrmValuePtr /* from */,
- XrmValue* /* to_return */
-#endif
-);
-
-/****************************************************************
- *
- * Translation Management
- *
- ****************************************************************/
-
-extern XtTranslations XtParseTranslationTable(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* table */
-#endif
-);
-
-extern XtAccelerators XtParseAcceleratorTable(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* source */
-#endif
-);
-
-extern void XtOverrideTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtTranslations /* translations */
-#endif
-);
-
-extern void XtAugmentTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtTranslations /* translations */
-#endif
-);
-
-extern void XtInstallAccelerators(
-#if NeedFunctionPrototypes
- Widget /* destination */,
- Widget /* source */
-#endif
-);
-
-extern void XtInstallAllAccelerators(
-#if NeedFunctionPrototypes
- Widget /* destination */,
- Widget /* source */
-#endif
-);
-
-extern void XtUninstallTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtAppAddActions(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtActionList /* actions */,
- Cardinal /* num_actions */
-#endif
-);
-
-extern void XtAddActions( /* obsolete */
-#if NeedFunctionPrototypes
- XtActionList /* actions */,
- Cardinal /* num_actions */
-#endif
-);
-
-extern XtActionHookId XtAppAddActionHook(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtActionHookProc /* proc */,
- XtPointer /* client_data */
-#endif
-);
-
-extern void XtRemoveActionHook(
-#if NeedFunctionPrototypes
- XtActionHookId /* id */
-#endif
-);
-
-extern void XtGetActionList(
-#if NeedFunctionPrototypes
- WidgetClass /* widget_class */,
- XtActionList* /* actions_return */,
- Cardinal* /* num_actions_return */
-#endif
-);
-
-extern void XtCallActionProc(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* action */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal /* num_params */
-#endif
-);
-
-extern void XtRegisterGrabAction(
-#if NeedFunctionPrototypes
- XtActionProc /* action_proc */,
- _XtBoolean /* owner_events */,
- unsigned int /* event_mask */,
- int /* pointer_mode */,
- int /* keyboard_mode */
-#endif
-);
-
-extern void XtSetMultiClickTime(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* milliseconds */
-#endif
-);
-
-extern int XtGetMultiClickTime(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern KeySym XtGetActionKeysym(
-#if NeedFunctionPrototypes
- XEvent* /* event */,
- Modifiers* /* modifiers_return */
-#endif
-);
-
-/***************************************************************
- *
- * Keycode and Keysym procedures for translation management
- *
- ****************************************************************/
-
-extern void XtTranslateKeycode(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- _XtKeyCode /* keycode */,
- Modifiers /* modifiers */,
- Modifiers* /* modifiers_return */,
- KeySym* /* keysym_return */
-#endif
-);
-
-extern void XtTranslateKey(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- _XtKeyCode /* keycode */,
- Modifiers /* modifiers */,
- Modifiers* /* modifiers_return */,
- KeySym* /* keysym_return */
-#endif
-);
-
-extern void XtSetKeyTranslator(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XtKeyProc /* proc */
-#endif
-);
-
-extern void XtRegisterCaseConverter(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XtCaseProc /* proc */,
- KeySym /* start */,
- KeySym /* stop */
-#endif
-);
-
-extern void XtConvertCase(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- KeySym /* keysym */,
- KeySym* /* lower_return */,
- KeySym* /* upper_return */
-#endif
-);
-
-/****************************************************************
- *
- * Event Management
- *
- ****************************************************************/
-
-/* XtAllEvents is valid only for XtRemoveEventHandler and
- * XtRemoveRawEventHandler; don't use it to select events!
- */
-#define XtAllEvents ((EventMask) -1L)
-
-extern void XtAddEventHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- EventMask /* event_mask */,
- _XtBoolean /* nonmaskable */,
- XtEventHandler /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveEventHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- EventMask /* event_mask */,
- _XtBoolean /* nonmaskable */,
- XtEventHandler /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtAddRawEventHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- EventMask /* event_mask */,
- _XtBoolean /* nonmaskable */,
- XtEventHandler /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveRawEventHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- EventMask /* event_mask */,
- _XtBoolean /* nonmaskable */,
- XtEventHandler /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtInsertEventHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- EventMask /* event_mask */,
- _XtBoolean /* nonmaskable */,
- XtEventHandler /* proc */,
- XtPointer /* closure */,
- XtListPosition /* position */
-#endif
-);
-
-extern void XtInsertRawEventHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- EventMask /* event_mask */,
- _XtBoolean /* nonmaskable */,
- XtEventHandler /* proc */,
- XtPointer /* closure */,
- XtListPosition /* position */
-#endif
-);
-
-extern XtEventDispatchProc XtSetEventDispatcher(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* event_type */,
- XtEventDispatchProc /* proc */
-#endif
-);
-
-extern Boolean XtDispatchEventToWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */
-#endif
-);
-
-extern void XtInsertEventTypeHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- int /* type */,
- XtPointer /* select_data */,
- XtEventHandler /* proc */,
- XtPointer /* closure */,
- XtListPosition /* position */
-#endif
-);
-
-extern void XtRemoveEventTypeHandler(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- int /* type */,
- XtPointer /* select_data */,
- XtEventHandler /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern EventMask XtBuildEventMask(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtRegisterExtensionSelector(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- int /* min_event_type */,
- int /* max_event_type */,
- XtExtensionSelectProc /* proc */,
- XtPointer /* client_data */
-#endif
-);
-
-extern void XtAddGrab(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtBoolean /* exclusive */,
- _XtBoolean /* spring_loaded */
-#endif
-);
-
-extern void XtRemoveGrab(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtProcessEvent( /* obsolete */
-#if NeedFunctionPrototypes
- XtInputMask /* mask */
-#endif
-);
-
-extern void XtAppProcessEvent(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtInputMask /* mask */
-#endif
-);
-
-extern void XtMainLoop( /* obsolete */
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void XtAppMainLoop(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern void XtAddExposureToRegion(
-#if NeedFunctionPrototypes
- XEvent* /* event */,
- Region /* region */
-#endif
-);
-
-extern void XtSetKeyboardFocus(
-#if NeedFunctionPrototypes
- Widget /* subtree */,
- Widget /* descendent */
-#endif
-);
-
-extern Widget XtGetKeyboardFocusWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern XEvent* XtLastEventProcessed(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern Time XtLastTimestampProcessed(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-/****************************************************************
- *
- * Event Gathering Routines
- *
- ****************************************************************/
-
-extern XtIntervalId XtAddTimeOut( /* obsolete */
-#if NeedFunctionPrototypes
- unsigned long /* interval */,
- XtTimerCallbackProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern XtIntervalId XtAppAddTimeOut(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- unsigned long /* interval */,
- XtTimerCallbackProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveTimeOut(
-#if NeedFunctionPrototypes
- XtIntervalId /* timer */
-#endif
-);
-
-extern XtInputId XtAddInput( /* obsolete */
-#if NeedFunctionPrototypes
- int /* source */,
- XtPointer /* condition */,
- XtInputCallbackProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern XtInputId XtAppAddInput(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- int /* source */,
- XtPointer /* condition */,
- XtInputCallbackProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveInput(
-#if NeedFunctionPrototypes
- XtInputId /* id */
-#endif
-);
-
-extern XtSignalId XtAppAddSignal(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtSignalCallbackProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveSignal(
-#if NeedFunctionPrototypes
- XtSignalId /* id */
-#endif
-);
-
-extern void XtNoticeSignal(
-#if NeedFunctionPrototypes
- XtSignalId /* id */
-#endif
-);
-
-extern void XtNextEvent( /* obsolete */
-#if NeedFunctionPrototypes
- XEvent* /* event */
-#endif
-);
-
-extern void XtAppNextEvent(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XEvent* /* event_return */
-#endif
-);
-
-#define XtIMXEvent 1
-#define XtIMTimer 2
-#define XtIMAlternateInput 4
-#define XtIMSignal 8
-#define XtIMAll (XtIMXEvent | XtIMTimer | XtIMAlternateInput | XtIMSignal)
-
-extern Boolean XtPending( /* obsolete */
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern XtInputMask XtAppPending(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern XtBlockHookId XtAppAddBlockHook(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtBlockHookProc /* proc */,
- XtPointer /* client_data */
-#endif
-);
-
-extern void XtRemoveBlockHook(
-#if NeedFunctionPrototypes
- XtBlockHookId /* id */
-#endif
-);
-
-/****************************************************************
- *
- * Random utility routines
- *
- ****************************************************************/
-
-#define XtIsRectObj(object) (_XtCheckSubclassFlag(object, (XtEnum)0x02))
-#define XtIsWidget(object) (_XtCheckSubclassFlag(object, (XtEnum)0x04))
-#define XtIsComposite(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x08))
-#define XtIsConstraint(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x10))
-#define XtIsShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x20))
-#define XtIsOverrideShell(widget) \
- (_XtIsSubclassOf(widget, (WidgetClass)overrideShellWidgetClass, \
- (WidgetClass)shellWidgetClass, (XtEnum)0x20))
-#define XtIsWMShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x40))
-#define XtIsVendorShell(widget) \
- (_XtIsSubclassOf(widget, (WidgetClass)vendorShellWidgetClass, \
- (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
-#define XtIsTransientShell(widget) \
- (_XtIsSubclassOf(widget, (WidgetClass)transientShellWidgetClass, \
- (WidgetClass)wmShellWidgetClass, (XtEnum)0x40))
-#define XtIsTopLevelShell(widget) (_XtCheckSubclassFlag(widget, (XtEnum)0x80))
-#define XtIsApplicationShell(widget) \
- (_XtIsSubclassOf(widget, (WidgetClass)applicationShellWidgetClass, \
- (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80))
-#define XtIsSessionShell(widget) \
- (_XtIsSubclassOf(widget, (WidgetClass)sessionShellWidgetClass, \
- (WidgetClass)topLevelShellWidgetClass, (XtEnum)0x80))
-
-extern void XtRealizeWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-void XtUnrealizeWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtDestroyWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtSetSensitive(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtBoolean /* sensitive */
-#endif
-);
-
-extern void XtSetMappedWhenManaged(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtBoolean /* mapped_when_managed */
-#endif
-);
-
-extern Widget XtNameToWidget(
-#if NeedFunctionPrototypes
- Widget /* reference */,
- _Xconst _XtString /* names */
-#endif
-);
-
-extern Widget XtWindowToWidget(
-#if NeedFunctionPrototypes
- Display* /* display */,
- Window /* window */
-#endif
-);
-
-extern XtPointer XtGetClassExtension(
-#if NeedFunctionPrototypes
- WidgetClass /* object_class */,
- Cardinal /* byte_offset */,
- XrmQuark /* type */,
- long /* version */,
- Cardinal /* record_size */
-#endif
-);
-
-/***************************************************************
- *
- * Arg lists
- *
- ****************************************************************/
-
-
-#define XtSetArg(arg, n, d) \
- ((void)( (arg).name = (n), (arg).value = (XtArgVal)(d) ))
-
-extern ArgList XtMergeArgLists(
-#if NeedFunctionPrototypes
- ArgList /* args1 */,
- Cardinal /* num_args1 */,
- ArgList /* args2 */,
- Cardinal /* num_args2 */
-#endif
-);
-
-/***************************************************************
- *
- * Vararg lists
- *
- ****************************************************************/
-
-#define XtVaNestedList "XtVaNestedList"
-#define XtVaTypedArg "XtVaTypedArg"
-
-extern XtVarArgsList XtVaCreateArgsList(
-#if NeedVarargsPrototypes
- XtPointer /*unused*/, ...
-#endif
-);
-
-/*************************************************************
- *
- * Information routines
- *
- ************************************************************/
-
-#ifndef _XtIntrinsicP_h
-
-/* We're not included from the private file, so define these */
-
-extern Display *XtDisplay(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern Display *XtDisplayOfObject(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern Screen *XtScreen(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern Screen *XtScreenOfObject(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern Window XtWindow(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern Window XtWindowOfObject(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern String XtName(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern WidgetClass XtSuperclass(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern WidgetClass XtClass(
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern Widget XtParent(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-#endif /*_XtIntrinsicP_h*/
-
-#define XtMapWidget(widget) XMapWindow(XtDisplay(widget), XtWindow(widget))
-#define XtUnmapWidget(widget) \
- XUnmapWindow(XtDisplay(widget), XtWindow(widget))
-
-extern void XtAddCallback(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */,
- XtCallbackProc /* callback */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveCallback(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */,
- XtCallbackProc /* callback */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtAddCallbacks(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */,
- XtCallbackList /* callbacks */
-#endif
-);
-
-extern void XtRemoveCallbacks(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */,
- XtCallbackList /* callbacks */
-#endif
-);
-
-extern void XtRemoveAllCallbacks(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */
-#endif
-);
-
-
-extern void XtCallCallbacks(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */,
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtCallCallbackList(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtCallbackList /* callbacks */,
- XtPointer /* call_data */
-#endif
-);
-
-extern XtCallbackStatus XtHasCallbacks(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _Xconst _XtString /* callback_name */
-#endif
-);
-
-/****************************************************************
- *
- * Geometry Management
- *
- ****************************************************************/
-
-
-extern XtGeometryResult XtMakeGeometryRequest(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtWidgetGeometry* /* request */,
- XtWidgetGeometry* /* reply_return */
-#endif
-);
-
-extern XtGeometryResult XtQueryGeometry(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtWidgetGeometry* /* intended */,
- XtWidgetGeometry* /* preferred_return */
-#endif
-);
-
-extern Widget XtCreatePopupShell(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widgetClass */,
- Widget /* parent */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtVaCreatePopupShell(
-#if NeedVarargsPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widgetClass */,
- Widget /* parent */,
- ...
-#endif
-);
-
-extern void XtPopup(
-#if NeedFunctionPrototypes
- Widget /* popup_shell */,
- XtGrabKind /* grab_kind */
-#endif
-);
-
-extern void XtPopupSpringLoaded(
-#if NeedFunctionPrototypes
- Widget /* popup_shell */
-#endif
-);
-
-extern void XtCallbackNone(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */,
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtCallbackNonexclusive(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */,
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtCallbackExclusive(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */,
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtPopdown(
-#if NeedFunctionPrototypes
- Widget /* popup_shell */
-#endif
-);
-
-extern void XtCallbackPopdown(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */,
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtMenuPopupAction(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern Widget XtCreateWidget(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widget_class */,
- Widget /* parent */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtCreateManagedWidget(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widget_class */,
- Widget /* parent */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtVaCreateWidget(
-#if NeedVarargsPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widget */,
- Widget /* parent */,
- ...
-#endif
-);
-
-extern Widget XtVaCreateManagedWidget(
-#if NeedVarargsPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widget_class */,
- Widget /* parent */,
- ...
-#endif
-);
-
-extern Widget XtCreateApplicationShell( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- WidgetClass /* widget_class */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtAppCreateShell(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* application_name */,
- _Xconst _XtString /* application_class */,
- WidgetClass /* widget_class */,
- Display* /* display */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtVaAppCreateShell(
-#if NeedVarargsPrototypes
- _Xconst _XtString /* application_name */,
- _Xconst _XtString /* application_class */,
- WidgetClass /* widget_class */,
- Display* /* display */,
- ...
-#endif
-);
-
-/****************************************************************
- *
- * Toolkit initialization
- *
- ****************************************************************/
-
-extern void XtToolkitInitialize(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern XtLanguageProc XtSetLanguageProc(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtLanguageProc /* proc */,
- XtPointer /* client_data */
-#endif
-);
-
-extern void XtDisplayInitialize(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- Display* /* dpy */,
- _Xconst _XtString /* application_name */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescRec* /* options */,
- Cardinal /* num_options */,
- int* /* argc */,
- char** /* argv */
-#endif
-);
-
-extern Widget XtOpenApplication(
-#if NeedFunctionPrototypes
- XtAppContext* /* app_context_return */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescList /* options */,
- Cardinal /* num_options */,
- int* /* argc_in_out */,
- String* /* argv_in_out */,
- String* /* fallback_resources */,
- WidgetClass /* widget_class */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtVaOpenApplication(
-#if NeedVarargsPrototypes
- XtAppContext* /* app_context_return */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescList /* options */,
- Cardinal /* num_options */,
- int* /* argc_in_out */,
- String* /* argv_in_out */,
- String* /* fallback_resources */,
- WidgetClass /* widget_class */,
- ...
-#endif
-);
-
-extern Widget XtAppInitialize( /* obsolete */
-#if NeedFunctionPrototypes
- XtAppContext* /* app_context_return */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescList /* options */,
- Cardinal /* num_options */,
- int* /* argc_in_out */,
- String* /* argv_in_out */,
- String* /* fallback_resources */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern Widget XtVaAppInitialize( /* obsolete */
-#if NeedVarargsPrototypes
- XtAppContext* /* app_context_return */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescList /* options */,
- Cardinal /* num_options */,
- int* /* argc_in_out */,
- String* /* argv_in_out */,
- String* /* fallback_resources */,
- ...
-#endif
-);
-
-extern Widget XtInitialize( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* shell_name */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescRec* /* options */,
- Cardinal /* num_options */,
- int* /* argc */,
- char** /* argv */
-#endif
-);
-
-extern Display *XtOpenDisplay(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* display_string */,
- _Xconst _XtString /* application_name */,
- _Xconst _XtString /* application_class */,
- XrmOptionDescRec* /* options */,
- Cardinal /* num_options */,
- int* /* argc */,
- char** /* argv */
-#endif
-);
-
-extern XtAppContext XtCreateApplicationContext(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void XtAppSetFallbackResources(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- String* /* specification_list */
-#endif
-);
-
-extern void XtDestroyApplicationContext(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern void XtInitializeWidgetClass(
-#if NeedFunctionPrototypes
- WidgetClass /* widget_class */
-#endif
-);
-
-extern XtAppContext XtWidgetToApplicationContext(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern XtAppContext XtDisplayToApplicationContext(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern XrmDatabase XtDatabase(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern XrmDatabase XtScreenDatabase(
-#if NeedFunctionPrototypes
- Screen* /* screen */
-#endif
-);
-
-extern void XtCloseDisplay(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-extern void XtGetApplicationResources(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* base */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtVaGetApplicationResources(
-#if NeedVarargsPrototypes
- Widget /* widget */,
- XtPointer /* base */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ...
-#endif
-);
-
-extern void XtGetSubresources(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* base */,
- _Xconst _XtString /* name */,
- _Xconst _XtString /* class */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtVaGetSubresources(
-#if NeedVarargsPrototypes
- Widget /* widget */,
- XtPointer /* base */,
- _Xconst _XtString /* name */,
- _Xconst _XtString /* class */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ...
-#endif
-);
-
-extern void XtSetValues(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtVaSetValues(
-#if NeedVarargsPrototypes
- Widget /* widget */,
- ...
-#endif
-);
-
-extern void XtGetValues(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtVaGetValues(
-#if NeedVarargsPrototypes
- Widget /* widget */,
- ...
-#endif
-);
-
-extern void XtSetSubvalues(
-#if NeedFunctionPrototypes
- XtPointer /* base */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtVaSetSubvalues(
-#if NeedVarargsPrototypes
- XtPointer /* base */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ...
-#endif
-);
-
-extern void XtGetSubvalues(
-#if NeedFunctionPrototypes
- XtPointer /* base */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ArgList /* args */,
- Cardinal /* num_args */
-#endif
-);
-
-extern void XtVaGetSubvalues(
-#if NeedVarargsPrototypes
- XtPointer /* base */,
- XtResourceList /* resources */,
- Cardinal /* num_resources */,
- ...
-#endif
-);
-
-extern void XtGetResourceList(
-#if NeedFunctionPrototypes
- WidgetClass /* widget_class */,
- XtResourceList* /* resources_return */,
- Cardinal* /* num_resources_return */
-#endif
-);
-
-extern void XtGetConstraintResourceList(
-#if NeedFunctionPrototypes
- WidgetClass /* widget_class */,
- XtResourceList* /* resources_return */,
- Cardinal* /* num_resources_return */
-#endif
-);
-
-#define XtUnspecifiedPixmap ((Pixmap)2)
-#define XtUnspecifiedShellInt (-1)
-#define XtUnspecifiedWindow ((Window)2)
-#define XtUnspecifiedWindowGroup ((Window)3)
-#define XtCurrentDirectory "XtCurrentDirectory"
-#define XtDefaultForeground "XtDefaultForeground"
-#define XtDefaultBackground "XtDefaultBackground"
-#define XtDefaultFont "XtDefaultFont"
-#define XtDefaultFontSet "XtDefaultFontSet"
-
-#if defined(CRAY) || defined(__arm) || defined(__ACK)
-#if __STDC__ && !defined(__ACK)
-#define XtOffset(p_type,field) _Offsetof(p_type,field)
-#else
-#ifdef CRAY2
-#define XtOffset(p_type,field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-#else /* !CRAY2 */
-
-#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
-
-#endif /* !CRAY2 */
-#endif /* __STDC__ */
-#else /* ! (CRAY || __arm || __ACK) */
-
-#define XtOffset(p_type,field) \
- ((Cardinal) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-#endif /* !CRAY */
-
-#ifdef offsetof
-#define XtOffsetOf(s_type,field) offsetof(s_type,field)
-#else
-#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
-#endif
-
-/*************************************************************
- *
- * Session Management
- *
- ************************************************************/
-
-typedef struct _XtCheckpointTokenRec {
- int save_type;
- int interact_style;
- Boolean shutdown;
- Boolean fast;
- Boolean cancel_shutdown;
- int phase;
- int interact_dialog_type; /* return */
- Boolean request_cancel; /* return */
- Boolean request_next_phase; /* return */
- Boolean save_success; /* return */
- int type; /* implementation private */
- Widget widget; /* implementation private */
-} XtCheckpointTokenRec, *XtCheckpointToken;
-
-XtCheckpointToken XtSessionGetToken(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-void XtSessionReturnToken(
-#if NeedFunctionPrototypes
- XtCheckpointToken /* token */
-#endif
-);
-
-/*************************************************************
- *
- * Error Handling
- *
- ************************************************************/
-
-extern XtErrorMsgHandler XtAppSetErrorMsgHandler(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtErrorMsgHandler /* handler */
-#endif
-);
-
-extern void XtSetErrorMsgHandler( /* obsolete */
-#if NeedFunctionPrototypes
- XtErrorMsgHandler /* handler */
-#endif
-);
-
-extern XtErrorMsgHandler XtAppSetWarningMsgHandler(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtErrorMsgHandler /* handler */
-#endif
-);
-
-extern void XtSetWarningMsgHandler( /* obsolete */
-#if NeedFunctionPrototypes
- XtErrorMsgHandler /* handler */
-#endif
-);
-
-extern void XtAppErrorMsg(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* name */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* class */,
- _Xconst _XtString /* default */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern void XtErrorMsg( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* class */,
- _Xconst _XtString /* default */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern void XtAppWarningMsg(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* name */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* class */,
- _Xconst _XtString /* default */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern void XtWarningMsg( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* class */,
- _Xconst _XtString /* default */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern XtErrorHandler XtAppSetErrorHandler(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtErrorHandler /* handler */
-#endif
-);
-
-extern void XtSetErrorHandler( /* obsolete */
-#if NeedFunctionPrototypes
- XtErrorHandler /* handler */
-#endif
-);
-
-extern XtErrorHandler XtAppSetWarningHandler(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtErrorHandler /* handler */
-#endif
-);
-
-extern void XtSetWarningHandler( /* obsolete */
-#if NeedFunctionPrototypes
- XtErrorHandler /* handler */
-#endif
-);
-
-extern void XtAppError(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* message */
-#endif
-);
-
-extern void XtError( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* message */
-#endif
-);
-
-extern void XtAppWarning(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* message */
-#endif
-);
-
-extern void XtWarning( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* message */
-#endif
-);
-
-extern XrmDatabase *XtAppGetErrorDatabase(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern XrmDatabase *XtGetErrorDatabase( /* obsolete */
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void XtAppGetErrorDatabaseText(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- _Xconst _XtString /* name */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* class */,
- _Xconst _XtString /* default */,
- String /* buffer_return */,
- int /* nbytes */,
- XrmDatabase /* database */
-#endif
-);
-
-extern void XtGetErrorDatabaseText( /* obsolete */
-#if NeedFunctionPrototypes
- _Xconst _XtString /* name */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* class */,
- _Xconst _XtString /* default */,
- String /* buffer_return */,
- int /* nbytes */
-#endif
-);
-
-/****************************************************************
- *
- * Memory Management
- *
- ****************************************************************/
-
-extern char *XtMalloc(
-#if NeedFunctionPrototypes
- Cardinal /* size */
-#endif
-);
-
-extern char *XtCalloc(
-#if NeedFunctionPrototypes
- Cardinal /* num */,
- Cardinal /* size */
-#endif
-);
-
-extern char *XtRealloc(
-#if NeedFunctionPrototypes
- char* /* ptr */,
- Cardinal /* num */
-#endif
-);
-
-extern void XtFree(
-#if NeedFunctionPrototypes
- char* /* ptr */
-#endif
-);
-
-#ifdef XTTRACEMEMORY
-
-extern char *_XtMalloc( /* implementation-private */
-#if NeedFunctionPrototypes
- Cardinal /* size */,
- char * /* file */,
- int /* line */
-#endif
-);
-
-extern char *_XtRealloc( /* implementation-private */
-#if NeedFunctionPrototypes
- char * /* ptr */,
- Cardinal /* size */,
- char * /* file */,
- int /* line */
-#endif
-);
-
-extern char *_XtCalloc( /* implementation-private */
-#if NeedFunctionPrototypes
- Cardinal /* num */,
- Cardinal /* size */,
- char * /* file */,
- int /* line */
-#endif
-);
-
-extern void _XtFree( /* implementation-private */
-#if NeedFunctionPrototypes
- char * /* ptr */
-#endif
-);
-
-#define XtMalloc(size) _XtMalloc(size, __FILE__, __LINE__)
-#define XtRealloc(ptr,size) _XtRealloc(ptr, size, __FILE__, __LINE__)
-#define XtCalloc(num,size) _XtCalloc(num, size, __FILE__, __LINE__)
-#define XtFree(ptr) _XtFree(ptr)
-
-#endif /* ifdef XTTRACEMEMORY */
-
-#define XtNew(type) ((type *) XtMalloc((unsigned) sizeof(type)))
-#define XtNewString(str) \
- ((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1), str)) : NULL)
-
-/*************************************************************
- *
- * Work procs
- *
- **************************************************************/
-
-extern XtWorkProcId XtAddWorkProc( /* obsolete */
-#if NeedFunctionPrototypes
- XtWorkProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern XtWorkProcId XtAppAddWorkProc(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtWorkProc /* proc */,
- XtPointer /* closure */
-#endif
-);
-
-extern void XtRemoveWorkProc(
-#if NeedFunctionPrototypes
- XtWorkProcId /* id */
-#endif
-);
-
-
-/****************************************************************
- *
- * Graphic Context Management
- *****************************************************************/
-
-extern GC XtGetGC(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtGCMask /* valueMask */,
- XGCValues* /* values */
-#endif
-);
-
-extern GC XtAllocateGC(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Cardinal /* depth */,
- XtGCMask /* valueMask */,
- XGCValues* /* values */,
- XtGCMask /* dynamicMask */,
- XtGCMask /* unusedMask */
-#endif
-);
-
-/* This implementation of XtDestroyGC differs from the formal specification
- * for historic backwards compatibility reasons. As other implementations
- * may conform to the spec, use of XtReleaseGC is strongly encouraged.
- */
-extern void XtDestroyGC( /* obsolete */
-#if NeedFunctionPrototypes
- GC /* gc */
-#endif
-);
-
-extern void XtReleaseGC(
-#if NeedFunctionPrototypes
- Widget /* object */,
- GC /* gc */
-#endif
-);
-
-
-
-extern void XtAppReleaseCacheRefs(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- XtCacheRef* /* cache_ref */
-#endif
-);
-
-extern void XtCallbackReleaseCacheRef(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */, /* XtCacheRef */
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtCallbackReleaseCacheRefList(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* closure */, /* XtCacheRef* */
- XtPointer /* call_data */
-#endif
-);
-
-extern void XtSetWMColormapWindows(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Widget* /* list */,
- Cardinal /* count */
-#endif
-);
-
-extern String XtFindFile(
-#if NeedFunctionPrototypes
- _Xconst _XtString /* path */,
- Substitution /* substitutions */,
- Cardinal /* num_substitutions */,
- XtFilePredicate /* predicate */
-#endif
-);
-
-extern String XtResolvePathname(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- _Xconst _XtString /* type */,
- _Xconst _XtString /* filename */,
- _Xconst _XtString /* suffix */,
- _Xconst _XtString /* path */,
- Substitution /* substitutions */,
- Cardinal /* num_substitutions */,
- XtFilePredicate /* predicate */
-#endif
-);
-
-/****************************************************************
- *
- * Selections
- *
- *****************************************************************/
-
-#define XT_CONVERT_FAIL (Atom)0x80000001
-
-extern void XtDisownSelection(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Time /* time */
-#endif
-);
-
-extern void XtGetSelectionValue(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Atom /* target */,
- XtSelectionCallbackProc /* callback */,
- XtPointer /* closure */,
- Time /* time */
-#endif
-);
-
-extern void XtGetSelectionValues(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Atom* /* targets */,
- int /* count */,
- XtSelectionCallbackProc /* callback */,
- XtPointer* /* closures */,
- Time /* time */
-#endif
-);
-
-extern void XtAppSetSelectionTimeout(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- unsigned long /* timeout */
-#endif
-);
-
-extern void XtSetSelectionTimeout( /* obsolete */
-#if NeedFunctionPrototypes
- unsigned long /* timeout */
-#endif
-);
-
-extern unsigned long XtAppGetSelectionTimeout(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern unsigned long XtGetSelectionTimeout( /* obsolete */
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern XSelectionRequestEvent *XtGetSelectionRequest(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- XtRequestId /* request_id */
-#endif
-);
-
-extern void XtGetSelectionValueIncremental(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Atom /* target */,
- XtSelectionCallbackProc /* selection_callback */,
- XtPointer /* client_data */,
- Time /* time */
-#endif
-);
-
-extern void XtGetSelectionValuesIncremental(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */,
- Atom* /* targets */,
- int /* count */,
- XtSelectionCallbackProc /* callback */,
- XtPointer* /* client_data */,
- Time /* time */
-#endif
-);
-
-extern void XtSetSelectionParameters(
-#if NeedFunctionPrototypes
- Widget /* requestor */,
- Atom /* selection */,
- Atom /* type */,
- XtPointer /* value */,
- unsigned long /* length */,
- int /* format */
-#endif
-);
-
-extern void XtGetSelectionParameters(
-#if NeedFunctionPrototypes
- Widget /* owner */,
- Atom /* selection */,
- XtRequestId /* request_id */,
- Atom* /* type_return */,
- XtPointer* /* value_return */,
- unsigned long* /* length_return */,
- int* /* format_return */
-#endif
-);
-
-extern void XtCreateSelectionRequest(
-#if NeedFunctionPrototypes
- Widget /* requestor */,
- Atom /* selection */
-#endif
-);
-
-extern void XtSendSelectionRequest(
-#if NeedFunctionPrototypes
- Widget /* requestor */,
- Atom /* selection */,
- Time /* time */
-#endif
-);
-
-extern void XtCancelSelectionRequest(
-#if NeedFunctionPrototypes
- Widget /* requestor */,
- Atom /* selection */
-#endif
-);
-
-extern Atom XtReservePropertyAtom(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtReleasePropertyAtom(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Atom /* selection */
-#endif
-);
-
-extern void XtGrabKey(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtKeyCode /* keycode */,
- Modifiers /* modifiers */,
- _XtBoolean /* owner_events */,
- int /* pointer_mode */,
- int /* keyboard_mode */
-#endif
-);
-
-extern void XtUngrabKey(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtKeyCode /* keycode */,
- Modifiers /* modifiers */
-#endif
-);
-
-extern int XtGrabKeyboard(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtBoolean /* owner_events */,
- int /* pointer_mode */,
- int /* keyboard_mode */,
- Time /* time */
-#endif
-);
-
-extern void XtUngrabKeyboard(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Time /* time */
-#endif
-);
-
-extern void XtGrabButton(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- int /* button */,
- Modifiers /* modifiers */,
- _XtBoolean /* owner_events */,
- unsigned int /* event_mask */,
- int /* pointer_mode */,
- int /* keyboard_mode */,
- Window /* confine_to */,
- Cursor /* cursor */
-#endif
-);
-
-extern void XtUngrabButton(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- unsigned int /* button */,
- Modifiers /* modifiers */
-#endif
-);
-
-extern int XtGrabPointer(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtBoolean /* owner_events */,
- unsigned int /* event_mask */,
- int /* pointer_mode */,
- int /* keyboard_mode */,
- Window /* confine_to */,
- Cursor /* cursor */,
- Time /* time */
-#endif
-);
-
-extern void XtUngrabPointer(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Time /* time */
-#endif
-);
-
-extern void XtGetApplicationNameAndClass(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- String* /* name_return */,
- String* /* class_return */
-#endif
-);
-
-extern void XtRegisterDrawable(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Drawable /* drawable */,
- Widget /* widget */
-#endif
-);
-
-extern void XtUnregisterDrawable(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- Drawable /* drawable */
-#endif
-);
-
-extern Widget XtHooksOfDisplay(
-#if NeedFunctionPrototypes
- Display* /* dpy */
-#endif
-);
-
-typedef struct {
- String type;
- Widget widget;
- ArgList args;
- Cardinal num_args;
-} XtCreateHookDataRec, *XtCreateHookData;
-
-typedef struct {
- String type;
- Widget widget;
- XtPointer event_data;
- Cardinal num_event_data;
-} XtChangeHookDataRec, *XtChangeHookData;
-
-typedef struct {
- Widget old, req;
- ArgList args;
- Cardinal num_args;
-} XtChangeHookSetValuesDataRec, *XtChangeHookSetValuesData;
-
-typedef struct {
- String type;
- Widget widget;
- XtGeometryMask changeMask;
- XWindowChanges changes;
-} XtConfigureHookDataRec, *XtConfigureHookData;
-
-typedef struct {
- String type;
- Widget widget;
- XtWidgetGeometry* request;
- XtWidgetGeometry* reply;
- XtGeometryResult result;
-} XtGeometryHookDataRec, *XtGeometryHookData;
-
-typedef struct {
- String type;
- Widget widget;
-} XtDestroyHookDataRec, *XtDestroyHookData;
-
-extern void XtGetDisplays(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */,
- Display*** /* dpy_return */,
- Cardinal* /* num_dpy_return */
-#endif
-);
-
-extern Boolean XtToolkitThreadInitialize(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void XtAppSetExitFlag(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern Boolean XtAppGetExitFlag(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern void XtAppLock(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern void XtAppUnlock(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-/*
- * Predefined Resource Converters
- */
-
-
-/* String converters */
-
-extern Boolean XtCvtStringToAcceleratorTable(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToAtom(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Display */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToBool(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToBoolean(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToCommandArgArray(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToCursor(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Display */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToDimension(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToDirectoryString(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToDisplay(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToFile(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToFloat(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToFont(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Display */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToFontSet(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Display, locale */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToFontStruct(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Display */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToGravity(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToInitialState(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToInt(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToPixel(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Screen, Colormap */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-#define XtCvtStringToPosition XtCvtStringToShort
-
-extern Boolean XtCvtStringToRestartStyle(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToShort(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToTranslationTable(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToUnsignedChar(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtStringToVisual(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Screen, depth */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-/* int converters */
-
-extern Boolean XtCvtIntToBool(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtIntToBoolean(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtIntToColor(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* Screen, Colormap */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-#define XtCvtIntToDimension XtCvtIntToShort
-
-extern Boolean XtCvtIntToFloat(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtIntToFont(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtIntToPixel(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtIntToPixmap(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-#define XtCvtIntToPosition XtCvtIntToShort
-
-extern Boolean XtCvtIntToShort(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-extern Boolean XtCvtIntToUnsignedChar(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-/* Color converter */
-
-extern Boolean XtCvtColorToPixel(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */, /* none */
- Cardinal* /* num_args */,
- XrmValuePtr /* fromVal */,
- XrmValuePtr /* toVal */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-/* Pixel converter */
-
-#define XtCvtPixelToColor XtCvtIntToColor
-
-
-_XFUNCPROTOEND
-
-#endif /*_XtIntrinsic_h*/
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/IntrinsicI.h b/xc/lib/Xt/IntrinsicI.h
deleted file mode 100644
index 71d3e9f42..000000000
--- a/xc/lib/Xt/IntrinsicI.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/* $TOG: IntrinsicI.h /main/48 1998/02/06 13:23:00 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xt/IntrinsicI.h,v 3.4 1998/10/03 09:06:55 dawes Exp $ */
-
-#ifndef _XtintrinsicI_h
-#define _XtintrinsicI_h
-
-#include "Xtos.h"
-#include "IntrinsicP.h"
-#ifdef WIN32
-#define _WILLWINSOCK_
-#endif
-#include <X11/Xos.h>
-
-#include "Object.h"
-#include "RectObj.h"
-#include "ObjectP.h"
-#include "RectObjP.h"
-
-#include "ConvertI.h"
-#include "TranslateI.h"
-#include "CallbackI.h"
-#include "EventI.h"
-#include "HookObjI.h"
-#include "PassivGraI.h"
-#include "ThreadsI.h"
-#include "InitialI.h"
-#include "ResourceI.h"
-#include "StringDefs.h"
-
-#define RectObjClassFlag 0x02
-#define WidgetClassFlag 0x04
-#define CompositeClassFlag 0x08
-#define ConstraintClassFlag 0x10
-#define ShellClassFlag 0x20
-#define WMShellClassFlag 0x40
-#define TopLevelClassFlag 0x80
-
-/*
- * The following macros, though very handy, are not suitable for
- * IntrinsicP.h as they violate the rule that arguments are to
- * be evaluated exactly once.
- */
-
-#define XtDisplayOfObject(object) \
- (XtIsWidget(object) ? (object)->core.screen->display : \
- _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \
- _XtWindowedAncestor(object)->core.screen->display)
-
-#define XtScreenOfObject(object) \
- (XtIsWidget(object) ? (object)->core.screen : \
- _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \
- _XtWindowedAncestor(object)->core.screen)
-
-#define XtWindowOfObject(object) \
- ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
- ->core.window)
-
-#define XtIsManaged(object) \
- (XtIsRectObj(object) ? (object)->core.managed : False)
-
-#define XtIsSensitive(object) \
- (XtIsRectObj(object) ? ((object)->core.sensitive && \
- (object)->core.ancestor_sensitive) : False)
-
-
-/****************************************************************
- *
- * Byte utilities
- *
- ****************************************************************/
-
-#define _XBCOPYFUNC _XtBcopy
-#include <X11/Xfuncs.h>
-
-/* If the alignment characteristics of your machine are right, these may be
- faster */
-
-#ifdef UNALIGNED
-
-#define XtMemmove(dst, src, size) \
- if (size == sizeof(int)) \
- *((int *) (dst)) = *((int *) (src)); \
- else if (size == sizeof(char)) \
- *((char *) (dst)) = *((char *) (src)); \
- else if (size == sizeof(short)) \
- *((short *) (dst)) = *((short *) (src)); \
- else \
- (void) memcpy((char *) (dst), (char *) (src), (int) (size))
-
-#define XtBZero(dst, size) \
- if (size == sizeof(int)) \
- *((int *) (dst)) = 0; \
- else \
- bzero((char *) (dst), (int) (size))
-
-#define XtMemcmp(b1, b2, size) \
- (size == sizeof(int) ? \
- *((int *) (b1)) != *((int *) (b2)) \
- : memcmp((char *) (b1), (char *) (b2), (int) (size)) \
- )
-
-#else
-
-#define XtMemmove(dst, src, size) \
- (void) memcpy((char *) (dst), (char *) (src), (int) (size))
-
-#define XtBZero(dst, size) \
- bzero((char *) (dst), (int) (size))
-
-#define XtMemcmp(b1, b2, size) \
- memcmp((char *) (b1), (char *) (b2), (int) (size))
-
-#endif
-
-
-/****************************************************************
- *
- * Stack cache allocation/free
- *
- ****************************************************************/
-
-#define XtStackAlloc(size, stack_cache_array) \
- ((size) <= sizeof(stack_cache_array) \
- ? (XtPointer)(stack_cache_array) \
- : XtMalloc((unsigned)(size)))
-
-#define XtStackFree(pointer, stack_cache_array) \
- if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); else
-
-/***************************************************************
- *
- * Filename defines
- *
- **************************************************************/
-
-/* used by XtResolvePathname */
-#ifndef XFILESEARCHPATHDEFAULT
-#define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
-#endif
-
-/* the following two were both "X Toolkit " prior to R4 */
-#ifndef XTERROR_PREFIX
-#define XTERROR_PREFIX ""
-#endif
-
-#ifndef XTWARNING_PREFIX
-#define XTWARNING_PREFIX ""
-#endif
-
-#ifndef ERRORDB
-#define ERRORDB "/usr/lib/X11/XtErrorDB"
-#endif
-
-extern String XtCXtToolkitError;
-
-extern void _XtAllocError(
-#if NeedFunctionPrototypes
- String /* alloc_type */
-#endif
-);
-
-extern void _XtCompileResourceList(
-#if NeedFunctionPrototypes
- XtResourceList /* resources */,
- Cardinal /* num_resources */
-#endif
-);
-
-extern XtGeometryResult _XtMakeGeometryRequest(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtWidgetGeometry* /* request */,
- XtWidgetGeometry* /* reply_return */,
- Boolean* /* clear_rect_obj */
-#endif
-);
-
-extern Boolean _XtIsHookObject(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void _XtAddShellToHookObj(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-/** GeoTattler stuff */
-
-#ifdef XT_GEO_TATTLER
-
-extern void _XtGeoTab ();
-extern void _XtGeoTrace (
-#if NeedVarargsPrototypes
- Widget widget,
- ...
-#endif
-);
-
-#define CALLGEOTAT(f) f
-
-#else /* XT_GEO_TATTLER */
-
-#define CALLGEOTAT(f)
-
-#endif /* XT_GEO_TATTLER */
-
-#ifndef XTTRACEMEMORY
-
-extern char* __XtMalloc (
-#if NeedFunctionPrototypes
- unsigned /* size */
-#endif
-);
-extern char* __XtCalloc (
-#if NeedFunctionPrototypes
- unsigned /* num */,
- unsigned /* size */
-#endif
-);
-
-#else
-
-#define __XtMalloc XtMalloc
-#define __XtCalloc XtCalloc
-#endif
-
-#endif /* _XtintrinsicI_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/IntrinsicP.h b/xc/lib/Xt/IntrinsicP.h
deleted file mode 100644
index 06b42dab0..000000000
--- a/xc/lib/Xt/IntrinsicP.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/* $TOG: IntrinsicP.h /main/52 1998/02/06 13:23:06 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtintrinsicP_h
-#define _XtintrinsicP_h
-
-#include <X11/Intrinsic.h>
-
-/*
- * Field sizes and offsets of XrmResource must match those of XtResource.
- * Type long is used instead of XrmQuark here because XrmQuark and String
- * are not the same size on all systems.
- */
-typedef struct {
- long xrm_name; /* Resource name quark */
- long xrm_class; /* Resource class quark */
- long xrm_type; /* Resource representation type quark */
- Cardinal xrm_size; /* Size in bytes of representation */
- int xrm_offset; /* -offset-1 */
- long xrm_default_type; /* Default representation type quark */
- XtPointer xrm_default_addr; /* Default resource address */
-} XrmResource, *XrmResourceList;
-
-typedef unsigned long XtVersionType;
-
-#define XT_VERSION 11
-#ifndef XT_REVISION
-#define XT_REVISION 6
-#endif
-#define XtVersion (XT_VERSION * 1000 + XT_REVISION)
-#define XtVersionDontCheck 0
-
-typedef void (*XtProc)(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-typedef void (*XtWidgetClassProc)(
-#if NeedFunctionPrototypes
- WidgetClass /* class */
-#endif
-);
-
-typedef void (*XtWidgetProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-typedef Boolean (*XtAcceptFocusProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- Time* /* time */
-#endif
-);
-
-typedef void (*XtArgsProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- ArgList /* args */,
- Cardinal* /* num_args */
-#endif
-);
-
-typedef void (*XtInitProc)(
-#if NeedFunctionPrototypes
- Widget /* request */,
- Widget /* new */,
- ArgList /* args */,
- Cardinal* /* num_args */
-#endif
-);
-
-typedef Boolean (*XtSetValuesFunc)(
-#if NeedFunctionPrototypes
- Widget /* old */,
- Widget /* request */,
- Widget /* new */,
- ArgList /* args */,
- Cardinal* /* num_args */
-#endif
-);
-
-typedef Boolean (*XtArgsFunc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- ArgList /* args */,
- Cardinal* /* num_args */
-#endif
-);
-
-typedef void (*XtAlmostProc)(
-#if NeedFunctionPrototypes
- Widget /* old */,
- Widget /* new */,
- XtWidgetGeometry* /* request */,
- XtWidgetGeometry* /* reply */
-#endif
-);
-
-typedef void (*XtExposeProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */,
- Region /* region */
-#endif
-);
-
-/* compress_exposure options*/
-#define XtExposeNoCompress ((XtEnum)False)
-#define XtExposeCompressSeries ((XtEnum)True)
-#define XtExposeCompressMultiple 2
-#define XtExposeCompressMaximal 3
-
-/* modifiers */
-#define XtExposeGraphicsExpose 0x10
-#define XtExposeGraphicsExposeMerged 0x20
-#define XtExposeNoExpose 0x40
-#define XtExposeNoRegion 0x80
-
-typedef void (*XtRealizeProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtValueMask* /* mask */,
- XSetWindowAttributes* /* attributes */
-#endif
-);
-
-typedef XtGeometryResult (*XtGeometryHandler)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtWidgetGeometry* /* request */,
- XtWidgetGeometry* /* reply */
-#endif
-);
-
-typedef void (*XtStringProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- String /* str */
-#endif
-);
-
-typedef struct {
- String name; /* resource name */
- String type; /* representation type name */
- XtArgVal value; /* representation */
- int size; /* size of representation */
-} XtTypedArg, *XtTypedArgList;
-
-typedef void (*XtAllocateProc)(
-#if NeedFunctionPrototypes
- WidgetClass /* widget_class */,
- Cardinal * /* constraint_size */,
- Cardinal * /* more_bytes */,
- ArgList /* args */,
- Cardinal * /* num_args */,
- XtTypedArgList /* typed_args */,
- Cardinal * /* num_typed_args */,
- Widget * /* widget_return */,
- XtPointer * /* more_bytes_return */
-#endif
-);
-
-typedef void (*XtDeallocateProc)(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtPointer /* more_bytes */
-#endif
-);
-
-struct _XtStateRec; /* Forward declare before use for C++ */
-
-typedef struct _XtTMRec {
- XtTranslations translations; /* private to Translation Manager */
- XtBoundActions proc_table; /* procedure bindings for actions */
- struct _XtStateRec *current_state; /* Translation Manager state ptr */
- unsigned long lastEventTime;
-} XtTMRec, *XtTM;
-
-#include <X11/CoreP.h>
-#include <X11/CompositeP.h>
-#include <X11/ConstrainP.h>
-#include <X11/ObjectP.h>
-#include <X11/RectObjP.h>
-
-#define XtDisplay(widget) DisplayOfScreen((widget)->core.screen)
-#define XtScreen(widget) ((widget)->core.screen)
-#define XtWindow(widget) ((widget)->core.window)
-
-#define XtClass(widget) ((widget)->core.widget_class)
-#define XtSuperclass(widget) (XtClass(widget)->core_class.superclass)
-#define XtIsRealized(object) (XtWindowOfObject(object) != None)
-#define XtParent(widget) ((widget)->core.parent)
-
-#undef XtIsRectObj
-#define XtIsRectObj(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x02)
-
-#undef XtIsWidget
-#define XtIsWidget(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x04)
-
-#undef XtIsComposite
-#define XtIsComposite(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x08)
-
-#undef XtIsConstraint
-#define XtIsConstraint(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x10)
-
-#undef XtIsShell
-#define XtIsShell(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x20)
-
-#undef XtIsWMShell
-#define XtIsWMShell(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x40)
-
-#undef XtIsTopLevelShell
-#define XtIsTopLevelShell(obj) \
- (((Object)(obj))->object.widget_class->core_class.class_inited & 0x80)
-
-#ifdef DEBUG
-#define XtCheckSubclass(w, widget_class_ptr, message) \
- if (!XtIsSubclass(((Widget)(w)), (widget_class_ptr))) { \
- String params[3]; \
- Cardinal num_params = 3; \
- params[0] = ((Widget)(w))->core.widget_class->core_class.class_name;\
- params[1] = (widget_class_ptr)->core_class.class_name; \
- params[2] = (message); \
- XtAppErrorMsg(XtWidgetToApplicationContext((Widget)(w)), \
- "subclassMismatch", "xtCheckSubclass", "XtToolkitError", \
- "Widget class %s found when subclass of %s expected: %s",\
- params, &num_params); \
- }
-#else
-#define XtCheckSubclass(w, widget_class, message) /* nothing */
-#endif
-
-_XFUNCPROTOBEGIN
-
-extern Widget _XtWindowedAncestor( /* internal; implementation-dependent */
-#if NeedFunctionPrototypes
- Widget /* object */
-#endif
-);
-
-extern void _XtInherit(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void XtCreateWindow(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- unsigned int /* window_class */,
- Visual* /* visual */,
- XtValueMask /* value_mask */,
- XSetWindowAttributes* /* attributes */
-#endif
-);
-
-extern void XtResizeWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtDimension /* width */,
- _XtDimension /* height */,
- _XtDimension /* border_width */
-#endif
-);
-
-extern void XtMoveWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtPosition /* x */,
- _XtPosition /* y */
-#endif
-);
-
-extern void XtConfigureWidget(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtPosition /* x */,
- _XtPosition /* y */,
- _XtDimension /* width */,
- _XtDimension /* height */,
- _XtDimension /* border_width */
-#endif
-);
-
-extern void XtResizeWindow(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void XtProcessLock(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void XtProcessUnlock(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-_XFUNCPROTOEND
-
-#endif /* _XtIntrinsicP_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/Keyboard.c b/xc/lib/Xt/Keyboard.c
deleted file mode 100644
index f57204d65..000000000
--- a/xc/lib/Xt/Keyboard.c
+++ /dev/null
@@ -1,850 +0,0 @@
-/* $TOG: Keyboard.c /main/37 1998/02/06 13:23:52 kaleb $ */
-
-/********************************************************
-
-Copyright 1988 by Hewlett-Packard Company
-Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the 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, Digital, or Sun 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.
-
-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, 1988, 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 "IntrinsicI.h"
-
-#include "PassivGraI.h"
-
-#define _GetWindowedAncestor(w) (XtIsWidget(w) ? w : _XtWindowedAncestor(w))
-extern void _XtFillAncestorList();
-extern void _XtSendFocusEvent();
-
-/* InActiveSubtree cache of the current focus source and its ancestors */
-static Widget *pathTrace = NULL;
-static int pathTraceDepth = 0;
-static int pathTraceMax = 0;
-
-/* FindKeyDestination cache of focus destination and ancestors up to source */
-static Widget *pseudoTrace = NULL;
-static int pseudoTraceDepth = 0;
-static int pseudoTraceMax = 0;
-
-void _XtClearAncestorCache(widget)
- Widget widget;
-{
- /* the caller must lock the process lock */
- if (pathTraceDepth && pathTrace[0] == widget)
- pathTraceDepth = 0;
-}
-
-static XtServerGrabPtr CheckServerGrabs(event, trace, traceDepth)
- XEvent *event;
- Widget *trace;
- Cardinal traceDepth;
-{
- XtServerGrabPtr grab;
- Cardinal i;
-
- for (i = traceDepth; i > 0; i--)
- {
- if (grab = _XtCheckServerGrabsOnWidget(event, trace[i-1], KEYBOARD))
- return (grab);
- }
- return (XtServerGrabPtr)0;
-}
-
-static Boolean IsParent(a, b)
- Widget a, b;
-{
- for (b = XtParent(b); b; b = XtParent(b)) {
- if (b == a) return TRUE;
- if (XtIsShell(b)) return FALSE;
- }
- return FALSE;
-}
-
-#define RelRtn(lca, type) {*relTypeRtn = type; return lca;}
-
-static Widget CommonAncestor(a, b, relTypeRtn)
- register Widget a, b;
- XtGeneology * relTypeRtn;
-{
- if (a == b)
- {
- RelRtn(a, XtMySelf)
- }
- else if (IsParent(a, b))
- {
- RelRtn(a, XtMyAncestor)
- }
- else if (IsParent(b, a))
- {
- RelRtn(b, XtMyDescendant)
- }
- else
- for (b = XtParent(b);
- b && !XtIsShell(b);
- b = XtParent(b))
- if (IsParent(b, a))
- {
- RelRtn(b, XtMyCousin)
- }
- RelRtn(NULL, XtUnrelated)
-}
-#undef RelRtn
-
-
-
-
-
-static Widget _FindFocusWidget(widget, trace, traceDepth, activeCheck, isTarget)
- Widget widget;
- Widget *trace;
- int traceDepth;
- Boolean activeCheck;
- Boolean *isTarget;
-{
- int src;
- Widget dst;
- XtPerWidgetInput pwi = NULL;
-
- /* For each ancestor, starting at the top, see if it's forwarded */
-
-
- /* first check the trace list till done or we go to branch */
- for (src = traceDepth-1, dst = widget; src > 0;)
- {
- if (pwi = _XtGetPerWidgetInput(trace[src], FALSE))
- {
- if (pwi->focusKid)
- {
- dst = pwi->focusKid;
- for (src--; src > 0 && trace[src] != dst; src--) {}
- }
- else dst = trace[--src];
- }
- else dst = trace[--src];
- }
-
- if (isTarget) {
- if (pwi && pwi->focusKid == widget)
- *isTarget = TRUE;
- else
- *isTarget = FALSE;
- }
-
- if (!activeCheck)
- while (XtIsWidget(dst)
- && (pwi = _XtGetPerWidgetInput(dst, FALSE))
- && pwi->focusKid)
- dst = pwi->focusKid;
-
- return dst;
-}
-
-
-static Widget FindFocusWidget(widget, pdi)
- Widget widget;
- XtPerDisplayInput pdi;
-{
- if (pdi->focusWidget)
- return pdi->focusWidget;
- else
- return _FindFocusWidget(widget, pdi->trace, pdi->traceDepth, FALSE, NULL);
-}
-
-Widget XtGetKeyboardFocusWidget(widget)
- Widget widget;
-{
- XtPerDisplayInput pdi;
- Widget retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- retval = FindFocusWidget(widget, pdi);
- UNLOCK_APP(app);
- return retval;
-}
-
-static Boolean IsOutside(e, w)
- XKeyEvent *e;
- Widget w;
-{
- Position left, right, top, bottom;
-
- /*
- * if the pointer is outside the shell or inside
- * the window try to see if it would recieve the
- * focus
- */
- XtTranslateCoords(w, 0, 0, &left, &top);
- /* We need to take borders into consideration */
- left = left - w->core.border_width;
- top = top - w->core.border_width;
- right = left + w->core.width + w->core.border_width;
- bottom = top + w->core.height + w->core.border_width;
-
- if (
- (e->x_root < left) || (e->y_root < top) ||
- (e->x_root > right) || (e->y_root > bottom))
- return TRUE;
- else
- return FALSE;
-}
-
-static Widget FindKeyDestination(widget, event,
- prevGrab, prevGrabType,
- devGrab, devGrabType,
- pdi)
- Widget widget;
- XKeyEvent *event;
- XtServerGrabPtr prevGrab;
- XtServerGrabType prevGrabType;
- XtServerGrabPtr devGrab;
- XtServerGrabType devGrabType;
- XtPerDisplayInput pdi;
-{
-
- Widget dspWidget;
- Widget focusWidget;
-
- LOCK_PROCESS;
- dspWidget =
- focusWidget =
- pdi->focusWidget =
- _GetWindowedAncestor(FindFocusWidget(widget, pdi));
-
-
- /*
- * If a grab is active from a previous activation then dispatch
- * based on owner_events ala protocol but with focus being
- * determined by XtSetKeyboardFocus.
- */
- if (IsAnyGrab(prevGrabType))
- {
- if (prevGrab->ownerEvents)
- dspWidget = focusWidget;
- else
- dspWidget = prevGrab->widget;
- }
- else
- {
- /*
- * If the focus widget is the event widget or a descendant
- * then we can avoid the rest of this. Else ugh...
- */
- if (focusWidget != widget)
- {
- XtGeneology ewRelFw; /* relationship of event widget to
- focusWidget */
- Widget lca;
-
- lca = CommonAncestor(widget, focusWidget, &ewRelFw);
-
- /*
- * if the event widget is an ancestor of focus due to the pointer
- * and/or the grab being in an ancestor and it's a passive grab
- * send to grab widget.
- * we are also dispatching to widget if ownerEvents and the event
- * is outside the client
- */
- if ((ewRelFw == XtMyAncestor) &&
- (devGrabType == XtPassiveServerGrab))
- {
- if (IsOutside(event, widget) ||
- event->type ==KeyPress
- )
- dspWidget = devGrab->widget;
- }
- else
- {
- /*
- * if the grab widget is not an ancestor of the focus
- * release the grab in order to avoid locking. There
- * is a possible case in that ownerEvents true will fall
- * through and if synch is set and the event widget
- * could turn it off we'll lock. check for it ? why not
- */
- if ((ewRelFw != XtMyAncestor)
- && (devGrabType == XtPassiveServerGrab)
- && (!IsAnyGrab(prevGrabType))
- )
- {
- XtUngrabKeyboard(devGrab->widget,
- event->time);
- devGrabType = XtNoServerGrab;
- }
- /*
- * if there isn't a grab with then check
- * for a logical grab that would have been activated
- * if the server was using Xt focus instead of server
- * focus
- */
- if (
- (event->type != KeyPress) ||
- (event->keycode == 0) /* Xlib XIM composed input */
- )
- dspWidget = focusWidget;
- else
- {
- XtServerGrabPtr grab;
-
- if (!pseudoTraceDepth ||
- !(focusWidget == pseudoTrace[0]) ||
- !(lca == pseudoTrace[pseudoTraceDepth]))
- {
- /*
- * fill ancestor list from lca
- * (non-inclusive)to focusWidget by
- * passing in lca as breakWidget
- */
- _XtFillAncestorList(&pseudoTrace,
- &pseudoTraceMax,
- &pseudoTraceDepth,
- focusWidget,
- lca);
- /* ignore lca */
- pseudoTraceDepth--;
- }
- if (grab = CheckServerGrabs((XEvent*)event,
- pseudoTrace,
- pseudoTraceDepth))
- {
- XtDevice device = &pdi->keyboard;
-
- device->grabType = XtPseudoPassiveServerGrab;
- pdi->activatingKey = event->keycode;
- device->grab = *grab;
-
- if (grab
- )
- dspWidget = grab->widget;
- else
- dspWidget = focusWidget;
- }
- }
- }
- }
- }
- UNLOCK_PROCESS;
- return dspWidget;
-}
-
-Widget _XtProcessKeyboardEvent(event, widget, pdi)
- XKeyEvent *event;
- Widget widget;
- XtPerDisplayInput pdi;
-{
- XtDevice device = &pdi->keyboard;
- XtServerGrabPtr newGrab, devGrab = &device->grab;
- XtServerGrabRec prevGrabRec;
- XtServerGrabType prevGrabType = device->grabType;
- Widget dspWidget = NULL;
- Boolean deactivateGrab = FALSE;
-
- prevGrabRec = *devGrab;
-
- switch (event->type)
- {
- case KeyPress:
- {
- if (event->keycode != 0 && /* Xlib XIM composed input */
- !IsServerGrab(device->grabType) &&
- (newGrab = CheckServerGrabs((XEvent*)event,
- pdi->trace,
- pdi->traceDepth)))
- {
- /*
- * honor pseudo-grab from prior event by X
- * unlocking keyboard. Not Xt Unlock !
- */
- if (IsPseudoGrab(prevGrabType))
- XUngrabKeyboard(XtDisplay(newGrab->widget),
- event->time);
- else
- {
- /* Activate the grab */
- device->grab = *newGrab;
- pdi->activatingKey = event->keycode;
- device->grabType = XtPassiveServerGrab;
- }
- }
- }
- break;
-
- case KeyRelease:
- {
- if (IsEitherPassiveGrab(device->grabType) &&
- (event->keycode == pdi->activatingKey))
- deactivateGrab = TRUE;
- }
- break;
- }
- dspWidget = FindKeyDestination(widget, event,
- &prevGrabRec, prevGrabType,
- devGrab, device->grabType,
- pdi);
- if (deactivateGrab)
- {
- /* Deactivate the grab */
- device->grabType = XtNoServerGrab;
- pdi->activatingKey = 0;
- }
- return dspWidget;
-}
-
-static Widget GetShell(widget)
- Widget widget;
-{
- Widget shell;
-
- for (shell = widget;
- shell && !XtIsShell(shell);
- shell = XtParent(shell)){}
- return shell;
-}
-
-
-/*
- * Check that widget really has Xt focus due to it having recieved an
- * event
- */
-typedef enum {NotActive = 0, IsActive, IsTarget} ActiveType;
-static ActiveType InActiveSubtree(widget)
- Widget widget;
-{
- Boolean isTarget;
- ActiveType retval;
-
- LOCK_PROCESS;
- if (!pathTraceDepth || widget != pathTrace[0]) {
- _XtFillAncestorList(&pathTrace,
- &pathTraceMax,
- &pathTraceDepth,
- widget,
- NULL);
- }
- if (widget == _FindFocusWidget(widget,
- pathTrace,
- pathTraceDepth,
- TRUE,
- &isTarget))
- retval = (isTarget ? IsTarget : IsActive);
- else
- retval = NotActive;
- UNLOCK_PROCESS;
- return retval;
-}
-
-
-
-
-/* ARGSUSED */
-void _XtHandleFocus(widget, client_data, event, cont)
- Widget widget;
- XtPointer client_data; /* child who wants focus */
- XEvent *event;
- Boolean *cont; /* unused */
-{
- XtPerDisplayInput pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- XtPerWidgetInput pwi = (XtPerWidgetInput)client_data;
- XtGeneology oldFocalPoint = pwi->focalPoint;
- XtGeneology newFocalPoint = pwi->focalPoint;
-
- switch( event->type ) {
-
- case KeyPress:
- case KeyRelease:
- /*
- * We're getting the keyevents used to guarantee propagating
- * child interest ala ForwardEvent in R3
- */
- return;
-
- case EnterNotify:
- case LeaveNotify:
-
- /*
- * If operating in a focus driven model, then enter and
- * leave events do not affect the keyboard focus.
- */
- if ((event->xcrossing.detail != NotifyInferior)
- && (event->xcrossing.focus))
- {
- switch (oldFocalPoint)
- {
- case XtMyAncestor:
- if (event->type == LeaveNotify)
- newFocalPoint = XtUnrelated;
- break;
- case XtUnrelated:
- if (event->type == EnterNotify)
- newFocalPoint = XtMyAncestor;
- break;
- case XtMySelf:
- break;
- case XtMyDescendant:
- break;
-
- }
- }
- break;
- case FocusIn:
- switch (event->xfocus.detail)
- {
- case NotifyNonlinear:
- case NotifyAncestor:
- case NotifyInferior:
- newFocalPoint = XtMySelf;
- break;
- case NotifyNonlinearVirtual:
- case NotifyVirtual:
- newFocalPoint = XtMyDescendant;
- break;
- case NotifyPointer:
- newFocalPoint = XtMyAncestor;
- break;
- }
- break;
- case FocusOut:
- switch (event->xfocus.detail)
- {
- case NotifyPointer:
- case NotifyNonlinear:
- case NotifyAncestor:
- case NotifyNonlinearVirtual:
- case NotifyVirtual:
- newFocalPoint = XtUnrelated;
- break;
- case NotifyInferior:
- newFocalPoint = XtMyDescendant;
- return;
- break;
- }
- break;
- }
-
- if (newFocalPoint != oldFocalPoint)
- {
- Boolean add;
- Widget descendant = pwi->focusKid;
-
- pwi->focalPoint = newFocalPoint;
-
- if ((oldFocalPoint == XtUnrelated) &&
- InActiveSubtree(widget) != NotActive)
- {
- pdi->focusWidget = NULL; /* invalidate the cache */
- pwi->haveFocus = TRUE;
- add = TRUE;
- }
- else if (newFocalPoint == XtUnrelated)
- {
- pdi->focusWidget = NULL; /* invalidate the cache */
- pwi->haveFocus = FALSE;
- add = FALSE;
- }
- else
- return;
-
- if (descendant)
- {
- if (add)
- {
- _XtSendFocusEvent(descendant, FocusIn);
- }
- else
- {
- _XtSendFocusEvent(descendant, FocusOut);
- }
- }
- }
-}
-
-
-static void AddFocusHandler(widget, descendant, pwi, psi, pdi, oldEventMask)
- Widget widget, descendant;
- XtPerWidgetInput pwi;
- XtPerWidgetInput psi;
- XtPerDisplayInput pdi;
- EventMask oldEventMask;
-{
- EventMask eventMask, targetEventMask;
- Widget target;
-
- /*
- * widget must now select for key events if the descendant is
- * interested in them.
- *
- * shell borders are not occluded by the child, they're occluded
- * by reparenting window managers. !!!
- */
- target = descendant ? _GetWindowedAncestor(descendant) : NULL;
- targetEventMask = XtBuildEventMask(target);
- eventMask = targetEventMask & (KeyPressMask | KeyReleaseMask);
- eventMask |= FocusChangeMask | EnterWindowMask | LeaveWindowMask;
-
- if (oldEventMask) {
- oldEventMask &= KeyPressMask | KeyReleaseMask;
- oldEventMask |= FocusChangeMask | EnterWindowMask | LeaveWindowMask;
-
- if (oldEventMask != eventMask)
- XtRemoveEventHandler(widget, (oldEventMask & ~eventMask),
- False, _XtHandleFocus, (XtPointer)pwi);
- }
-
- if (oldEventMask != eventMask)
- XtAddEventHandler(widget, eventMask, False,
- _XtHandleFocus, (XtPointer)pwi);
-
- /* What follows is too much grief to go through if the
- * target doesn't actually care about focus change events,
- * so just invalidate the focus cache & refill it when
- * the next input event actually arrives.
- */
-
- if (!(targetEventMask & FocusChangeMask)) {
- pdi->focusWidget = NULL;
- return;
- }
-
- if (XtIsRealized(widget) && !pwi->haveFocus) {
- if (psi->haveFocus) {
- Window root, child;
- int root_x, root_y, win_x, win_y;
- int left, right, top, bottom;
- unsigned int modMask;
- ActiveType act;
-
- /*
- * If the shell has the focus but the source widget
- * doesn't, it may only be because the source widget
- * wasn't previously tracking focus or crossing events.
- * If the target wants focus events, we have to
- * now determine whether the source has the focus.
- */
-
- if ((act = InActiveSubtree(widget)) == IsTarget)
- pwi->haveFocus = TRUE;
- else if (act == IsActive) {
- /*
- * An ancestor contains the focus, so if source
- * contains the pointer, then source has the focus.
- */
-
- if (XQueryPointer(XtDisplay(widget), XtWindow(widget),
- &root, &child,
- &root_x, &root_y, &win_x, &win_y, &modMask))
- {
- /* We need to take borders into consideration */
- left = top = -((int) widget->core.border_width);
- right = (int) (widget->core.width + (widget->core.border_width << 1));
- bottom = (int) (widget->core.height + (widget->core.border_width << 1));
-
- if (win_x >= left && win_x < right &&
- win_y >= top && win_y < bottom)
- pwi->haveFocus = TRUE;
- }
- }
- }
- }
- if (pwi->haveFocus) {
- pdi->focusWidget = NULL; /* invalidate the cache */
- _XtSendFocusEvent(target, FocusIn);
- }
-}
-
-
-/* ARGSUSED */
-static void QueryEventMask(widget, client_data, event, cont)
- Widget widget; /* child who gets focus */
- XtPointer client_data; /* ancestor giving it */
- XEvent *event;
- Boolean *cont; /* unused */
-{
- /* widget was once the target of an XtSetKeyboardFocus but
- * was unrealized at the time. Make sure ancestor still wants
- * focus set here then install the handler now that we know the
- * complete event mask.
- */
- Widget ancestor = (Widget)client_data;
- XtPerWidgetInput pwi = _XtGetPerWidgetInput(ancestor, FALSE);
- Widget target = pwi->queryEventDescendant;
-
- /* use of 'target' is non-standard hackery; allows focus to non-widget */
- if (pwi && (pwi->focusKid == target)) {
- AddFocusHandler(ancestor, target, pwi,
- _XtGetPerWidgetInput(GetShell(ancestor), TRUE),
- _XtGetPerDisplayInput(XtDisplay(ancestor)),
- (EventMask)0);
- }
- XtRemoveEventHandler(widget, XtAllEvents, True,
- QueryEventMask, client_data);
- pwi->map_handler_added = FALSE;
-}
-
-
-/* ARGSUSED */
-static void FocusDestroyCallback(widget, closure, call_data)
- Widget widget;
- XtPointer closure; /* Widget */
- XtPointer call_data;
-{
- XtSetKeyboardFocus((Widget)closure, None);
-}
-
-void XtSetKeyboardFocus(widget, descendant)
- Widget widget;
- Widget descendant;
-{
- XtPerDisplayInput pdi;
- XtPerWidgetInput pwi;
- Widget oldDesc, oldTarget, target, hookobj;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- pwi = _XtGetPerWidgetInput(widget, TRUE);
- oldDesc = pwi->focusKid;
-
- if (descendant == widget) descendant = (Widget)None;
-
- target = descendant ? _GetWindowedAncestor(descendant) : NULL;
- oldTarget = oldDesc ? _GetWindowedAncestor(oldDesc) : NULL;
-
- if (descendant != oldDesc) {
-
- /* update the forward path */
- pwi->focusKid = descendant;
-
-
- /* all the rest handles focus ins and focus outs and misc gunk */
-
- if (oldDesc) {
- /* invalidate FindKeyDestination's ancestor list */
- if (pseudoTraceDepth && oldTarget == pseudoTrace[0])
- pseudoTraceDepth = 0;
-
- XtRemoveCallback(oldDesc, XtNdestroyCallback,
- FocusDestroyCallback, (XtPointer)widget);
-
- if (!oldTarget->core.being_destroyed) {
- if (pwi->map_handler_added) {
- XtRemoveEventHandler(oldTarget, XtAllEvents, True,
- QueryEventMask, (XtPointer)widget);
- pwi->map_handler_added = FALSE;
- }
- if (pwi->haveFocus) {
- _XtSendFocusEvent( oldTarget, FocusOut);
- }
- }
- else if (pwi->map_handler_added) {
- pwi->map_handler_added = FALSE;
- }
-
- if (pwi->haveFocus)
- pdi->focusWidget = NULL; /* invalidate cache */
-
- /*
- * If there was a forward path then remove the handler if
- * the path is being set to null and it isn't a shell.
- * shells always have a handler for tracking focus for the
- * hierarchy.
- *
- * Keep the pwi record on the assumption that the client
- * will continue to dynamically assign focus for this widget.
- */
- if (!XtIsShell(widget) && !descendant) {
- XtRemoveEventHandler(widget, XtAllEvents, True,
- _XtHandleFocus, (XtPointer)pwi);
- pwi->haveFocus = FALSE;
- }
- }
-
- if (descendant) {
- Widget shell = GetShell(widget);
- XtPerWidgetInput psi = _XtGetPerWidgetInput(shell, TRUE);
- XtAddCallback (descendant, XtNdestroyCallback,
- FocusDestroyCallback, (XtPointer) widget);
-
- AddFocusHandler(widget, descendant, pwi, psi, pdi,
- oldTarget ? XtBuildEventMask(oldTarget) : 0);
-
- if (widget != shell)
- XtAddEventHandler(
- shell,
- FocusChangeMask | EnterWindowMask | LeaveWindowMask,
- False,
- _XtHandleFocus,
- (XtPointer)psi
- );
-
- if (! XtIsRealized(target)) {
- XtAddEventHandler(target, (EventMask)StructureNotifyMask,
- False, QueryEventMask, (XtPointer)widget);
- pwi->map_handler_added = TRUE;
- pwi->queryEventDescendant = descendant;
- }
- }
- }
- hookobj = XtHooksOfDisplay(XtDisplay(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHsetKeyboardFocus;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) descendant;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
diff --git a/xc/lib/Xt/Manage.c b/xc/lib/Xt/Manage.c
deleted file mode 100644
index 9ef494482..000000000
--- a/xc/lib/Xt/Manage.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/* $TOG: Manage.c /main/37 1998/02/06 13:24:03 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Manage.c,v 3.5 1998/10/03 09:06:56 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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 "IntrinsicI.h"
-
-static String XtNinvalidChild = "invalidChild";
-static String XtNxtUnmanageChildren = "xtUnmanageChildren";
-static String XtNxtManageChildren = "xtManageChildren";
-static String XtNxtChangeManagedSet = "xtChangeManagedSet";
-
-static void UnmanageChildren(children, num_children, parent, num_unique_children, call_change_managed, caller_func)
- WidgetList children;
- Cardinal num_children;
- Widget parent;
- Cardinal* num_unique_children;
- Boolean call_change_managed;
- String caller_func;
-{
- Widget child;
- Cardinal i;
- XtWidgetProc change_managed;
- Bool parent_realized;
-
- *num_unique_children = 0;
-
- if (XtIsComposite((Widget) parent)) {
- LOCK_PROCESS;
- change_managed = ((CompositeWidgetClass) parent->core.widget_class)
- ->composite_class.change_managed;
- UNLOCK_PROCESS;
- parent_realized = XtIsRealized((Widget)parent);
- } else {
- XtAppErrorMsg(XtWidgetToApplicationContext((Widget)parent),
- "invalidParent",caller_func, XtCXtToolkitError,
- "Attempt to unmanage a child when parent is not Composite",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- for (i = 0; i < num_children; i++) {
- child = children[i];
- if (child == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(parent),
- XtNinvalidChild,caller_func,XtCXtToolkitError,
- "Null child passed to XtUnmanageChildren",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
- if (child->core.parent != parent) {
- XtAppWarningMsg(XtWidgetToApplicationContext(parent),
- "ambiguousParent",caller_func,XtCXtToolkitError,
- "Not all children have same parent in UnmanageChildren",
- (String *)NULL, (Cardinal *)NULL);
- } else
- if (child->core.managed) {
- (*num_unique_children)++;
- CALLGEOTAT(_XtGeoTrace(child,"Child \"%s\" is marked unmanaged\n",
- XtName(child)));
- child->core.managed = FALSE;
- if (XtIsWidget(child)
- && XtIsRealized(child)
- && child->core.mapped_when_managed)
- XtUnmapWidget(child);
- else
- { /* RectObj child */
- Widget pw = child->core.parent;
- RectObj r = (RectObj) child;
- while ((pw!=NULL) && (!XtIsWidget(pw))) pw = pw->core.parent;
- if ((pw!=NULL) && XtIsRealized (pw))
- XClearArea (XtDisplay (pw), XtWindow (pw),
- r->rectangle.x, r->rectangle.y,
- r->rectangle.width + (r->rectangle.border_width << 1),
- r->rectangle.height + (r->rectangle.border_width << 1),
- TRUE);
- }
-
- }
- }
- if (call_change_managed && *num_unique_children != 0 &&
- change_managed != NULL && parent_realized) {
- CALLGEOTAT(_XtGeoTrace((Widget)parent,
- "Call parent: \"%s\"[%d,%d]'s changemanaged proc\n",
- XtName((Widget)parent),
- parent->core.width,parent->core.height));
- (*change_managed) (parent);
- }
-} /* UnmanageChildren */
-
-void XtUnmanageChildren (children, num_children)
- WidgetList children;
- Cardinal num_children;
-{
- Widget parent, hookobj;
- Cardinal ii;
- XtAppContext app;
-
- if (num_children == 0) return;
- if (children[0] == NULL) {
- XtWarningMsg(XtNinvalidChild,XtNxtUnmanageChildren,XtCXtToolkitError,
- "Null child found in argument list to unmanage",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
- app = XtWidgetToApplicationContext(children[0]);
- LOCK_APP(app);
- parent = children[0]->core.parent;
- if (parent->core.being_destroyed) {
- UNLOCK_APP(app);
- return;
- }
- UnmanageChildren(children, num_children, parent, &ii,
- (Boolean)True, XtNxtUnmanageChildren);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(children[0]));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHunmanageChildren;
- call_data.widget = parent;
- call_data.event_data = (XtPointer) children;
- call_data.num_event_data = num_children;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtUnmanageChildren */
-
-void XtUnmanageChild(child)
- Widget child;
-{
- XtUnmanageChildren(&child, (Cardinal)1);
-} /* XtUnmanageChild */
-
-
-static void ManageChildren(children, num_children, parent, call_change_managed, caller_func)
- WidgetList children;
- Cardinal num_children;
- Widget parent;
- Boolean call_change_managed;
- String caller_func;
-{
-#define MAXCHILDREN 100
- Widget child;
- Cardinal num_unique_children, i;
- XtWidgetProc change_managed;
- WidgetList unique_children;
- Widget cache[MAXCHILDREN];
- Bool parent_realized;
-
- if (XtIsComposite((Widget) parent)) {
- LOCK_PROCESS;
- change_managed = ((CompositeWidgetClass) parent->core.widget_class)
- ->composite_class.change_managed;
- UNLOCK_PROCESS;
- parent_realized = XtIsRealized((Widget)parent);
- } else {
- XtAppErrorMsg(XtWidgetToApplicationContext((Widget)parent),
- "invalidParent",caller_func, XtCXtToolkitError,
- "Attempt to manage a child when parent is not Composite",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- /* Construct new list of children that really need to be operated upon. */
- if (num_children <= MAXCHILDREN) {
- unique_children = cache;
- } else {
- unique_children = (WidgetList) __XtMalloc(num_children * sizeof(Widget));
- }
- num_unique_children = 0;
- for (i = 0; i < num_children; i++) {
- child = children[i];
- if (child == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget)parent),
- XtNinvalidChild,caller_func,XtCXtToolkitError,
- "null child passed to ManageChildren",
- (String *)NULL, (Cardinal *)NULL);
- if (unique_children != cache) XtFree((char *) unique_children);
- return;
- }
-#ifdef DEBUG
- if (!XtIsRectObj(child)) {
- String params[2];
- Cardinal num_params = 2;
- params[0] = XtName(child);
- params[1] = child->core.widget_class->core_class.class_name;
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget)parent),
- "notRectObj",caller_func,XtCXtToolkitError,
- "child \"%s\", class %s is not a RectObj",
- params, &num_params);
- continue;
- }
-#endif /*DEBUG*/
- if (child->core.parent != parent) {
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget)parent),
- "ambiguousParent",caller_func,XtCXtToolkitError,
- "Not all children have same parent in XtManageChildren",
- (String *)NULL, (Cardinal *)NULL);
- } else if (! child->core.managed && !child->core.being_destroyed) {
- unique_children[num_unique_children++] = child;
- CALLGEOTAT(_XtGeoTrace(child,
- "Child \"%s\"[%d,%d] is marked managed\n",
- XtName(child),
- child->core.width,child->core.height));
- child->core.managed = TRUE;
- }
- }
-
- if ((call_change_managed || num_unique_children != 0) && parent_realized) {
- /* Compute geometry of new managed set of children. */
- if (change_managed != NULL) {
- CALLGEOTAT(_XtGeoTrace((Widget)parent,
- "Call parent: \"%s\"[%d,%d]'s changemanaged\n",
- XtName((Widget)parent),
- parent->core.width,parent->core.height));
- (*change_managed) ((Widget)parent);
- }
-
- /* Realize each child if necessary, then map if necessary */
- for (i = 0; i < num_unique_children; i++) {
- child = unique_children[i];
- if (XtIsWidget(child)) {
- if (! XtIsRealized(child)) XtRealizeWidget(child);
- if (child->core.mapped_when_managed) XtMapWidget(child);
- } else { /* RectObj child */
- Widget pw = child->core.parent;
- RectObj r = (RectObj) child;
- while ((pw!=NULL) && (!XtIsWidget(pw)))
- pw = pw->core.parent;
- if (pw != NULL)
- XClearArea (XtDisplay (pw), XtWindow (pw),
- r->rectangle.x, r->rectangle.y,
- r->rectangle.width + (r->rectangle.border_width << 1),
- r->rectangle.height + (r->rectangle.border_width << 1),
- TRUE);
- }
- }
- }
-
- if (unique_children != cache) XtFree((char *) unique_children);
-} /* ManageChildren */
-
-void XtManageChildren(children, num_children)
- WidgetList children;
- Cardinal num_children;
-{
- Widget parent, hookobj;
- XtAppContext app;
-
- if (num_children == 0) return;
- if (children[0] == NULL) {
- XtWarningMsg(XtNinvalidChild, XtNxtManageChildren, XtCXtToolkitError,
- "null child passed to XtManageChildren",
- (String*)NULL, (Cardinal*)NULL);
- return;
- }
- app = XtWidgetToApplicationContext(children[0]);
- LOCK_APP(app);
- parent = children[0]->core.parent;
- if (parent->core.being_destroyed) {
- UNLOCK_APP(app);
- return;
- }
- ManageChildren(children, num_children, parent, (Boolean)False,
- XtNxtManageChildren);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(children[0]));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHmanageChildren;
- call_data.widget = parent;
- call_data.event_data = (XtPointer) children;
- call_data.num_event_data = num_children;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-} /* XtManageChildren */
-
-void XtManageChild(child)
- Widget child;
-{
- XtManageChildren(&child, (Cardinal) 1);
-} /* XtManageChild */
-
-
-#if NeedFunctionPrototypes
-void XtSetMappedWhenManaged(
- Widget widget,
- _XtBoolean mapped_when_managed
- )
-#else
-void XtSetMappedWhenManaged(widget, mapped_when_managed)
- Widget widget;
- Boolean mapped_when_managed;
-#endif
-{
- Widget hookobj;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (widget->core.mapped_when_managed == mapped_when_managed) {
- UNLOCK_APP(app);
- return;
- }
- widget->core.mapped_when_managed = mapped_when_managed;
-
- hookobj = XtHooksOfDisplay(XtDisplay(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHsetMappedWhenManaged;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) (unsigned long) mapped_when_managed;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-
- if (! XtIsManaged(widget)) {
- UNLOCK_APP(app);
- return;
- }
-
- if (mapped_when_managed) {
- /* Didn't used to be mapped when managed. */
- if (XtIsRealized(widget)) XtMapWidget(widget);
- } else {
- /* Used to be mapped when managed. */
- if (XtIsRealized(widget)) XtUnmapWidget(widget);
- }
- UNLOCK_APP(app);
-} /* XtSetMappedWhenManaged */
-
-
-#if NeedFunctionPrototypes
-void XtChangeManagedSet(
- WidgetList unmanage_children,
- Cardinal num_unmanage,
- XtDoChangeProc do_change_proc,
- XtPointer client_data,
- WidgetList manage_children,
- Cardinal num_manage
-)
-#else
-void XtChangeManagedSet(unmanage_children, num_unmanage, do_change_proc,
- client_data, manage_children, num_manage)
- WidgetList unmanage_children;
- Cardinal num_unmanage;
- XtDoChangeProc do_change_proc;
- XtPointer client_data;
- WidgetList manage_children;
- Cardinal num_manage;
-#endif
-{
- WidgetList childp;
- Widget parent;
- int i;
- Cardinal some_unmanaged;
- Boolean call_out;
- CompositeClassExtension ext;
- XtAppContext app;
- Widget hookobj;
- XtChangeHookDataRec call_data;
-
- if (num_unmanage == 0 && num_manage == 0)
- return;
-
- /* specification doesn't state that library will check for NULL in list */
-
- childp = num_unmanage ? unmanage_children : manage_children;
- app = XtWidgetToApplicationContext(*childp);
- LOCK_APP(app);
-
- parent = XtParent(*childp);
- childp = unmanage_children;
- for (i = num_unmanage; --i >= 0 && XtParent(*childp) == parent; childp++);
- call_out = (i >= 0);
- childp = manage_children;
- for (i = num_manage; --i >= 0 && XtParent(*childp) == parent; childp++);
- if (call_out || i >= 0) {
- XtAppWarningMsg(app, "ambiguousParent", XtNxtChangeManagedSet,
- XtCXtToolkitError, "Not all children have same parent",
- (String *)NULL, (Cardinal *)NULL);
- }
- if (! XtIsComposite(parent)) {
- UNLOCK_APP(app);
- XtAppErrorMsg(app, "invalidParent", XtNxtChangeManagedSet,
- XtCXtToolkitError,
- "Attempt to manage a child when parent is not Composite",
- (String *) NULL, (Cardinal *) NULL);
- }
- if (parent->core.being_destroyed) {
- UNLOCK_APP(app);
- return;
- }
-
- call_out = False;
- if (do_change_proc) {
- ext = (CompositeClassExtension)
- XtGetClassExtension(parent->core.widget_class,
- XtOffsetOf(CompositeClassRec,
- composite_class.extension),
- NULLQUARK, XtCompositeExtensionVersion,
- sizeof(CompositeClassExtensionRec));
- if (!ext || !ext->allows_change_managed_set)
- call_out = True;
- }
-
- UnmanageChildren(unmanage_children, num_unmanage, parent,
- &some_unmanaged, call_out, XtNxtChangeManagedSet);
-
- hookobj = XtHooksOfDisplay(XtDisplay(parent));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- call_data.type = XtHunmanageSet;
- call_data.widget = parent;
- call_data.event_data = (XtPointer) unmanage_children;
- call_data.num_event_data = num_unmanage;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer) &call_data);
- }
-
- if (do_change_proc)
- (*do_change_proc)(parent, unmanage_children, &num_unmanage,
- manage_children, &num_manage, client_data);
-
- call_out = (some_unmanaged && !call_out);
- ManageChildren(manage_children, num_manage, parent, call_out,
- XtNxtChangeManagedSet);
-
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- call_data.type = XtHmanageSet;
- call_data.event_data = (XtPointer) manage_children;
- call_data.num_event_data = num_manage;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer) &call_data);
- }
- UNLOCK_APP(app);
-} /* XtChangeManagedSet */
diff --git a/xc/lib/Xt/NextEvent.c b/xc/lib/Xt/NextEvent.c
deleted file mode 100644
index f7abccb07..000000000
--- a/xc/lib/Xt/NextEvent.c
+++ /dev/null
@@ -1,1648 +0,0 @@
-/* $TOG: NextEvent.c /main/138 1998/04/30 11:52:29 barstow $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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/lib/Xt/NextEvent.c,v 3.15 1999/03/14 03:21:15 dawes Exp $ */
-
-#include "IntrinsicI.h"
-#include <stdio.h>
-#include <errno.h>
-#ifdef X_NOT_STDC_ENV
-extern int errno;
-#endif
-
-#ifdef __EMX__
-#include <sys/time.h>
-#endif
-
-#ifdef MINIX
-#include <sys/nbio.h>
-#define select(n,r,w,x,t) nbio_select(n,r,w,x,t)
-#endif
-
-static TimerEventRec* freeTimerRecs;
-static WorkProcRec* freeWorkRecs;
-static SignalEventRec* freeSignalRecs;
-
-/* Some systems running NTP daemons are known to return strange usec
- * values from gettimeofday.
- */
-
-#ifndef NEEDS_NTPD_FIXUP
-# if defined(sun) || defined(MOTOROLA) || defined(sco324) || (defined(__osf__) && defined(__alpha))
-# define NEEDS_NTPD_FIXUP 1
-# else
-# define NEEDS_NTPD_FIXUP 0
-# endif
-#endif
-
-#if NEEDS_NTPD_FIXUP
-#define FIXUP_TIMEVAL(t) { \
- while ((t).tv_usec >= 1000000) { \
- (t).tv_usec -= 1000000; \
- (t).tv_sec++; \
- } \
- while ((t).tv_usec < 0) { \
- if ((t).tv_sec > 0) { \
- (t).tv_usec += 1000000; \
- (t).tv_sec--; \
- } else { \
- (t).tv_usec = 0; \
- break; \
- } \
- }}
-#else
-#define FIXUP_TIMEVAL(t)
-#endif /*NEEDS_NTPD_FIXUP*/
-
-/*
- * Private routines
- */
-#define ADD_TIME(dest, src1, src2) { \
- if(((dest).tv_usec = (src1).tv_usec + (src2).tv_usec) >= 1000000) {\
- (dest).tv_usec -= 1000000;\
- (dest).tv_sec = (src1).tv_sec + (src2).tv_sec + 1 ; \
- } else { (dest).tv_sec = (src1).tv_sec + (src2).tv_sec ; \
- if(((dest).tv_sec >= 1) && (((dest).tv_usec <0))) { \
- (dest).tv_sec --;(dest).tv_usec += 1000000; } } }
-
-
-#define TIMEDELTA(dest, src1, src2) { \
- if(((dest).tv_usec = (src1).tv_usec - (src2).tv_usec) < 0) {\
- (dest).tv_usec += 1000000;\
- (dest).tv_sec = (src1).tv_sec - (src2).tv_sec - 1;\
- } else (dest).tv_sec = (src1).tv_sec - (src2).tv_sec; }
-
-#define IS_AFTER(t1, t2) (((t2).tv_sec > (t1).tv_sec) \
- || (((t2).tv_sec == (t1).tv_sec)&& ((t2).tv_usec > (t1).tv_usec)))
-
-#define IS_AT_OR_AFTER(t1, t2) (((t2).tv_sec > (t1).tv_sec) \
- || (((t2).tv_sec == (t1).tv_sec)&& ((t2).tv_usec >= (t1).tv_usec)))
-
-#ifdef USE_POLL
-#ifndef XT_DEFAULT_FDLIST_SIZE
-#define XT_DEFAULT_FDLIST_SIZE 32
-#endif
-#endif
-
-static void AdjustHowLong (howlong, start_time)
- unsigned long *howlong;
- struct timeval *start_time;
-{
- struct timeval new_time, time_spent, lstart_time;
-
- lstart_time = *start_time;
- X_GETTIMEOFDAY (&new_time);
- FIXUP_TIMEVAL(new_time);
- TIMEDELTA(time_spent, new_time, lstart_time);
- if(*howlong <= (time_spent.tv_sec*1000+time_spent.tv_usec/1000))
- *howlong = (unsigned long)0; /* Timed out */
- else
- *howlong -= (time_spent.tv_sec*1000+time_spent.tv_usec/1000);
-}
-
-#ifdef AMOEBA
-/* For IoWait emulation: */
-static int DoIgnoreEvents;
-static int DoIgnoreInputs;
-#endif
-
-typedef struct {
- struct timeval cur_time;
- struct timeval start_time;
- struct timeval wait_time;
- struct timeval new_time;
- struct timeval time_spent;
- struct timeval max_wait_time;
-#ifndef USE_POLL
- struct timeval *wait_time_ptr;
-#else
- int poll_wait;
-#endif
-} wait_times_t, *wait_times_ptr_t;
-
-static struct timeval zero_time = { 0 , 0};
-#ifndef USE_POLL
-static fd_set zero_fd = { 0 };
-#else
-#define X_BLOCK -1
-#define X_DONT_BLOCK 0
-#endif
-
-static void InitTimes (block, howlong, wt)
- Boolean block;
- unsigned long* howlong;
- wait_times_ptr_t wt;
-{
- if (block) {
- X_GETTIMEOFDAY (&wt->cur_time);
- FIXUP_TIMEVAL(wt->cur_time);
- wt->start_time = wt->cur_time;
- if(howlong == NULL) { /* special case for ever */
-#ifndef USE_POLL
- wt->wait_time_ptr = NULL;
-#else
- wt->poll_wait = X_BLOCK;
-#endif
- } else { /* block until at most */
- wt->max_wait_time.tv_sec = *howlong/1000;
- wt->max_wait_time.tv_usec = (*howlong %1000)*1000;
-#ifndef USE_POLL
- wt->wait_time_ptr = &wt->max_wait_time;
-#else
- wt->poll_wait = *howlong;
-#endif
- }
- } else { /* don't block */
- wt->max_wait_time = zero_time;
-#ifndef USE_POLL
- wt->wait_time_ptr = &wt->max_wait_time;
-#else
- wt->poll_wait = X_DONT_BLOCK;
-#endif
- }
-}
-
-typedef struct {
-#ifndef USE_POLL
- fd_set rmask, wmask, emask;
- int nfds;
-#else
- struct pollfd* fdlist;
- struct pollfd* stack;
- int fdlistlen, num_dpys;
-#endif
-} wait_fds_t, *wait_fds_ptr_t;
-
-static void InitFds (app, ignoreEvents, ignoreInputs, wf)
- XtAppContext app;
- Boolean ignoreEvents;
- Boolean ignoreInputs;
- wait_fds_ptr_t wf;
-{
- int ii;
- app->rebuild_fdlist = FALSE;
-#ifndef AMOEBA
-#ifndef USE_POLL
- wf->nfds = app->fds.nfds;
- if( !ignoreInputs ) {
- wf->rmask = app->fds.rmask;
- wf->wmask = app->fds.wmask;
- wf->emask = app->fds.emask;
- } else
- wf->rmask = wf->wmask = wf->emask = zero_fd;
-
- if (!ignoreEvents)
- for (ii = 0; ii < app->count; ii++) {
- FD_SET (ConnectionNumber(app->list[ii]), &wf->rmask);
- }
-#else
-#ifdef POLLRDNORM
-#define XPOLL_READ POLLIN|POLLRDNORM
-#else
-#define XPOLL_READ POLLIN
-#endif
-#ifdef POLLWRNORM
-#if (POLLWRNORM == POLLOUT)
-#define XPOLL_WRITE POLLOUT
-#else
-#define XPOLL_WRITE POLLOUT|POLLWRNORM
-#endif
-#else
-#define XPOLL_WRITE POLLOUT
-#endif
-#ifdef POLLRDBAND
-#define XPOLL_EXCEPT POLLPRI|POLLRDBAND
-#else
-#define XPOLL_EXCEPT POLLPRI
-#endif
-
- if (!ignoreEvents)
- wf->fdlistlen = wf->num_dpys = app->count;
- else
- wf->fdlistlen = wf->num_dpys = 0;
-
- if (!ignoreInputs && app->input_list != NULL) {
- int ii;
- for (ii = 0; ii < (int) app->input_max; ii++)
- if (app->input_list[ii] != NULL)
- wf->fdlistlen++;
- }
-
- if (!wf->fdlist || wf->fdlist == wf->stack) {
- wf->fdlist = (struct pollfd*)
- XtStackAlloc (sizeof (struct pollfd) * wf->fdlistlen, wf->stack);
- } else {
- wf->fdlist = (struct pollfd*)
- XtRealloc ((char*) wf->fdlist,
- sizeof (struct pollfd) * wf->fdlistlen);
- }
-
- if (wf->fdlistlen) {
- struct pollfd* fdlp = wf->fdlist;
- InputEvent* iep;
-
- if (!ignoreEvents)
- for (ii = 0 ; ii < wf->num_dpys; ii++, fdlp++) {
- fdlp->fd = ConnectionNumber (app->list[ii]);
- fdlp->events = POLLIN;
- }
- if (!ignoreInputs && app->input_list != NULL)
- for (ii = 0; ii < app->input_max; ii++)
- if (app->input_list[ii] != NULL) {
- iep = app->input_list[ii];
- fdlp->fd = ii;
- fdlp->events = 0;
- for ( ; iep; iep = iep->ie_next) {
- if (iep->ie_condition & XtInputReadMask)
- fdlp->events |= XPOLL_READ;
- if (iep->ie_condition & XtInputWriteMask)
- fdlp->events |= XPOLL_WRITE;
- if (iep->ie_condition & XtInputExceptMask)
- fdlp->events |= XPOLL_EXCEPT;
- }
- fdlp++;
- }
- }
-#endif
-#else /* AMOEBA */
- DoIgnoreEvents = ignoreEvents;
- DoIgnoreInputs = ignoreInputs;
-#endif /* AMOEBA */
-}
-
-static void AdjustTimes (app, block, howlong, ignoreTimers, wt)
- XtAppContext app;
- Boolean block;
- unsigned long* howlong;
- Boolean ignoreTimers;
- wait_times_ptr_t wt;
-{
- if (app->timerQueue != NULL && !ignoreTimers && block) {
- if (IS_AFTER (wt->cur_time, app->timerQueue->te_timer_value)) {
- TIMEDELTA (wt->wait_time, app->timerQueue->te_timer_value, wt->cur_time);
- if (howlong == NULL || IS_AFTER (wt->wait_time, wt->max_wait_time))
-#ifndef USE_POLL
- wt->wait_time_ptr = &wt->wait_time;
- else
- wt->wait_time_ptr = &wt->max_wait_time;
- } else
- wt->wait_time_ptr = &zero_time;
- }
-#else
- wt->poll_wait = wt->wait_time.tv_sec * 1000 + wt->wait_time.tv_usec / 1000;
- else
- wt->poll_wait = wt->max_wait_time.tv_sec * 1000 + wt->max_wait_time.tv_usec / 1000;
- } else
- wt->poll_wait = X_DONT_BLOCK;
- }
-#endif
-}
-
-#ifndef AMOEBA
-
-static int IoWait (wt, wf)
- wait_times_ptr_t wt;
- wait_fds_ptr_t wf;
-{
-#ifndef USE_POLL
- return Select (wf->nfds, &wf->rmask, &wf->wmask, &wf->emask,
- wt->wait_time_ptr);
-#else
- return poll (wf->fdlist, wf->fdlistlen, wt->poll_wait);
-#endif
-}
-
-#else /* AMOEBA */
-
-static int AppIoWait (app, wt, wf)
- XtAppContext app;
- wait_times_ptr_t wt;
- wait_fds_ptr_t wf;
-{
- /* Unfortunately we cannot use select() under Amoeba. We call
- * _X11TransAmSelect to wait for the display to produce input
- * or until the timer runs out. This has two disadvantages:
- * - We cannot wait for multiple displays (we just wait for the
- * first display).
- * - We cannot wait for other file descriptors (there is no easy solution
- * for this, but it seems that not too many applications need it).
- * There is a workaround, however, in the form of XamSetSema and XamBlock,
- * which allow you to wait for X events or other things.
- */
- long timout;
- int nfound;
-
- if (wt->wait_time_ptr != NULL) {
- timout = wt->wait_time_ptr->tv_sec*1000 +
- (wt->wait_time_ptr->tv_usec+999)/1000;
- } else {
- timout = -1;
- }
- if ((DoIgnoreEvents || app->count == 0) && timout >= 0) {
- millisleep(timout);
- nfound = 0;
- } else {
- nfound = _X11TransAmSelect(ConnectionNumber(app->list[0]), timout);
- }
-
- return nfound;
-}
-
-#endif /* AMOEBA */
-
-static void FindInputs (app, wf, nfds, ignoreEvents, ignoreInputs, dpy_no, found_input)
- XtAppContext app;
- wait_fds_ptr_t wf;
- int nfds;
- Boolean ignoreEvents;
- Boolean ignoreInputs;
- int* dpy_no;
- int* found_input;
-{
- XtInputMask condition;
- InputEvent *ep;
- int ii;
-#ifndef AMOEBA
-#ifndef USE_POLL /* { check ready file descriptors block */
-#ifdef XTHREADS
- fd_set rmask;
-#endif
- int dd;
- *dpy_no = -1;
- *found_input = False;
-
-#ifdef XTHREADS
- rmask = app->fds.rmask;
- for (dd = app->count; dd-- > 0; )
- FD_SET (ConnectionNumber (app->list[dd]), &rmask);
-#endif
-
- for (ii = 0; ii < wf->nfds && nfds > 0; ii++) {
- condition = 0;
- if (FD_ISSET (ii, &wf->rmask)
-#ifdef XTHREADS
- && FD_ISSET (ii, &rmask)
-#endif
- ) {
- nfds--;
- if (!ignoreEvents) {
- for (dd = 0; dd < app->count; dd++) {
- if (ii == ConnectionNumber (app->list[dd])) {
- if (*dpy_no == -1) {
- if (XEventsQueued (app->list[dd], QueuedAfterReading ))
- *dpy_no = dd;
- /*
- * An error event could have arrived
- * without any real events, or events
- * could have been swallowed by Xlib,
- * or the connection may be broken.
- * We can't tell the difference, so
- * assume Xlib will eventually discover
- * a broken connection.
- */
- }
- goto ENDILOOP;
- }
- }
- }
- condition = XtInputReadMask;
- }
- if (FD_ISSET (ii, &wf->wmask)
-#ifdef XTHREADS
- && FD_ISSET (ii, &app->fds.wmask)
-#endif
- ) {
- condition |= XtInputWriteMask;
- nfds--;
- }
- if (FD_ISSET (ii, &wf->emask)
-#ifdef XTHREADS
- && FD_ISSET (ii, &app->fds.emask)
-#endif
- ) {
- condition |= XtInputExceptMask;
- nfds--;
- }
- if (condition) {
- for (ep = app->input_list[ii]; ep; ep = ep->ie_next)
- if (condition & ep->ie_condition) {
- ep->ie_oq = app->outstandingQueue;
- app->outstandingQueue = ep;
- }
- *found_input = True;
- }
-ENDILOOP: ;
- } /* endfor */
-#else /* }{ */
- struct pollfd* fdlp;
-
- *dpy_no = -1;
- *found_input = False;
-
- if (!ignoreEvents) {
- fdlp = wf->fdlist;
- for (ii = 0; ii < wf->num_dpys; ii++, fdlp++) {
- if (*dpy_no == -1 && fdlp->revents & (POLLIN|POLLHUP|POLLERR) &&
-#ifdef XTHREADS
- !(fdlp->revents & POLLNVAL) &&
-#endif
- XEventsQueued (app->list[ii], QueuedAfterReading)) {
- *dpy_no = ii;
- break;
- }
- }
- }
-
- if (!ignoreInputs) {
- fdlp = &wf->fdlist[wf->num_dpys];
- for (ii = wf->num_dpys; ii < wf->fdlistlen; ii++, fdlp++) {
- condition = 0;
- if (fdlp->revents) {
- if (fdlp->revents & (XPOLL_READ|POLLHUP|POLLERR)
-#ifdef XTHREADS
- && !(fdlp->revents & POLLNVAL)
-#endif
- )
- condition = XtInputReadMask;
- if (fdlp->revents & XPOLL_WRITE)
- condition |= XtInputWriteMask;
- if (fdlp->revents & XPOLL_EXCEPT)
- condition |= XtInputExceptMask;
- }
- if (condition) {
- *found_input = True;
- for (ep = app->input_list[fdlp->fd]; ep; ep = ep->ie_next)
- if (condition & ep->ie_condition) {
- ep->ie_oq = app->outstandingQueue;
- app->outstandingQueue = ep;
- }
- }
- }
- }
-#endif /* } */
-#else /* AMOEBA */
- int dd;
-
- *dpy_no = -1;
- *found_input = False;
-
- for (ii = 0; ii < app->fds.nfds && nfds > 0; ii++) {
- if (!ignoreEvents) {
- for (dd = 0; dd < app->count; dd++) {
- if (ii == ConnectionNumber (app->list[dd])) {
- if (*dpy_no == -1) {
- if (XEventsQueued (app->list[dd], QueuedAfterReading))
- *dpy_no = dd;
- }
- }
- }
- }
- /* Inputs not implemented */
- }
-#endif /* AMOEBA */
-}
-
-/*
- * Routine to block in the toolkit. This should be the only call to select.
- *
- * This routine returns when there is something to be done.
- *
- * Before calling this with ignoreInputs==False, app->outstandingQueue should
- * be checked; this routine will not verify that an alternate input source
- * has not already been enqueued.
- *
- *
- * _XtWaitForSomething( appContext,
- * ignoreEvent, ignoreTimers, ignoreInputs, ignoreSignals,
- * block, drop_lock, howlong)
- * XtAppContext app; (Displays to check wait on)
- *
- * Boolean ignoreEvents; (Don't return if XEvents are available
- * Also implies forget XEvents exist)
- *
- * Boolean ignoreTimers; (Ditto for timers)
- *
- * Boolean ignoreInputs; (Ditto for input callbacks )
- *
- * Boolean ignoreSignals; (Ditto for signals)
- *
- * Boolean block; (Okay to block)
- *
- * Boolean drop_lock (drop lock before going into select/poll)
- *
- * TimeVal howlong; (howlong to wait for if blocking and not
- * doing Timers... Null means forever.
- * Maybe should mean shortest of both)
- * Returns display for which input is available, if any
- * and if ignoreEvents==False, else returns -1
- *
- * if ignoring everything && block=True && howlong=NULL, you'll have
- * lots of time for coffee; better not try it! In fact, it probably
- * makes little sense to do this regardless of the value of howlong
- * (bottom line is, we don't bother checking here).
- *
- * If drop_lock is FALSE, the app->lock->mutex is not unlocked before
- * entering select/poll. It is illegal for drop_lock to be FALSE if
- * ignoreTimers, ignoreInputs, or ignoreSignals is FALSE.
- */
-#if NeedFunctionPrototypes
-int _XtWaitForSomething(
- XtAppContext app,
- _XtBoolean ignoreEvents,
- _XtBoolean ignoreTimers,
- _XtBoolean ignoreInputs,
- _XtBoolean ignoreSignals,
- _XtBoolean block,
-#ifdef XTHREADS
- _XtBoolean drop_lock,
-#endif
- unsigned long *howlong)
-#else
-int _XtWaitForSomething(app,
- ignoreEvents, ignoreTimers, ignoreInputs, ignoreSignals,
- block,
-#ifdef XTHREADS
- drop_lock,
-#endif
- howlong)
- XtAppContext app;
- Boolean ignoreEvents;
- Boolean ignoreTimers;
- Boolean ignoreInputs;
- Boolean ignoreSignals;
- Boolean block;
-#ifdef XTHREADS
- Boolean drop_lock;
-#endif
- unsigned long *howlong;
-#endif
-{
- wait_times_t wt;
- wait_fds_t wf;
- int nfds, dpy_no, found_input, dd;
-#ifdef XTHREADS
- Boolean push_thread = TRUE;
- Boolean pushed_thread = FALSE;
- int level = 0;
-#endif
-#ifdef USE_POLL
- struct pollfd fdlist[XT_DEFAULT_FDLIST_SIZE];
-#endif
-
-#ifdef XTHREADS
- /* assert ((ignoreTimers && ignoreInputs && ignoreSignals) || drop_lock); */
- /* If not multi-threaded, never drop lock */
- if (app->lock == (ThreadAppProc) NULL)
- drop_lock = FALSE;
-#endif
-
- InitTimes (block, howlong, &wt);
-
-#ifdef USE_POLL
- wf.fdlist = NULL;
- wf.stack = fdlist;
-#endif
-
- app->rebuild_fdlist = TRUE;
-
- while (1) {
-WaitLoop:
- AdjustTimes (app, block, howlong, ignoreTimers, &wt);
-
- if (block && app->block_hook_list) {
- BlockHook hook;
- for (hook = app->block_hook_list;
- hook != NULL;
- hook = hook->next)
- (*hook->proc) (hook->closure);
-
- if (!ignoreEvents)
- /* see if the hook(s) generated any protocol */
- for (dd = 0; dd < app->count; dd++)
- if (XEventsQueued(app->list[dd], QueuedAlready)) {
-#ifdef USE_POLL
- XtStackFree ((XtPointer) wf.fdlist, fdlist);
-#endif
- return dd;
- }
- }
-
- if (app->rebuild_fdlist)
- InitFds (app, ignoreEvents, ignoreInputs, &wf);
-
-#ifdef XTHREADS /* { */
- if (drop_lock) {
- YIELD_APP_LOCK(app, &push_thread, &pushed_thread, &level);
- nfds = IoWait (&wt, &wf);
- RESTORE_APP_LOCK(app, level, &pushed_thread);
- } else
-#endif /* } */
-#ifndef AMOEBA
- nfds = IoWait (&wt, &wf);
-#else
- nfds = AppIoWait (app, &wt, &wf);
-#endif
- if (nfds == -1) {
- /*
- * interrupt occured recalculate time value and wait again.
- */
- if (errno == EINTR || errno == EAGAIN) {
- if (errno == EAGAIN) {
- errno = 0; /* errno is not self reseting */
- continue;
- }
- errno = 0; /* errno is not self reseting */
-
- /* was it interrupted by a signal that we care about? */
- if (!ignoreSignals && app->signalQueue != NULL) {
- SignalEventRec *se_ptr = app->signalQueue;
- while (se_ptr != NULL) {
- if (se_ptr->se_notice) {
- if (block && howlong != NULL)
- AdjustHowLong (howlong, &wt.start_time);
-#ifdef USE_POLL
- XtStackFree ((XtPointer) wf.fdlist, fdlist);
-#endif
- return -1;
- }
- se_ptr = se_ptr->se_next;
- }
- }
-
- if (!ignoreEvents)
- /* get Xlib to detect a bad connection */
- for (dd = 0; dd < app->count; dd++)
- if (XEventsQueued(app->list[dd], QueuedAfterReading)) {
-#ifdef USE_POLL
- XtStackFree ((XtPointer) wf.fdlist, fdlist);
-#endif
- return dd;
- }
-
- if (block) {
-#ifndef USE_POLL
- if (wt.wait_time_ptr == NULL)
-#else
- if (wt.poll_wait == X_BLOCK)
-#endif
- continue;
- X_GETTIMEOFDAY (&wt.new_time);
- FIXUP_TIMEVAL (wt.new_time);
- TIMEDELTA (wt.time_spent, wt.new_time, wt.cur_time);
- wt.cur_time = wt.new_time;
-#ifndef USE_POLL
- if (IS_AFTER (wt.time_spent, *wt.wait_time_ptr)) {
- TIMEDELTA (wt.wait_time, *wt.wait_time_ptr, wt.time_spent);
- wt.wait_time_ptr = &wt.wait_time;
- continue;
- } else
-#else
- if ((wt.time_spent.tv_sec * 1000 + wt.time_spent.tv_usec / 1000) < wt.poll_wait) {
- wt.poll_wait -= (wt.time_spent.tv_sec * 1000 + wt.time_spent.tv_usec / 1000);
- continue;
- } else
-#endif
- nfds = 0;
- }
- } else {
- char Errno[12];
- String param = Errno;
- Cardinal param_count = 1;
-
- sprintf( Errno, "%d", errno);
- XtAppWarningMsg(app, "communicationError","select",
- XtCXtToolkitError,"Select failed; error code %s",
- &param, &param_count);
- continue;
- }
- } /* timed out or input available */
- break;
- }
-
- if (nfds == 0) {
- /* Timed out */
- if (howlong)
- *howlong = (unsigned long)0;
-#ifdef USE_POLL
- XtStackFree ((XtPointer) wf.fdlist, fdlist);
-#endif
- return -1;
- }
-
- if (block && howlong != NULL)
- AdjustHowLong (howlong, &wt.start_time);
-
- if (ignoreInputs && ignoreEvents) {
-#ifdef USE_POLL
- XtStackFree ((XtPointer) wf.fdlist, fdlist);
-#endif
- return -1;
- } else
- FindInputs (app, &wf, nfds,
- ignoreEvents, ignoreInputs,
- &dpy_no, &found_input);
-
- if (dpy_no >= 0 || found_input) {
-#ifdef USE_POLL
- XtStackFree ((XtPointer) wf.fdlist, fdlist);
-#endif
- return dpy_no;
- }
- goto WaitLoop;
-}
-
-#define IeCallProc(ptr) \
- (*ptr->ie_proc) (ptr->ie_closure, &ptr->ie_source, (XtInputId*)&ptr);
-
-#define TeCallProc(ptr) \
- (*ptr->te_proc) (ptr->te_closure, (XtIntervalId*)&ptr);
-
-#define SeCallProc(ptr) \
- (*ptr->se_proc) (ptr->se_closure, (XtSignalId*)&ptr);
-
-/*
- * Public Routines
- */
-
-XtIntervalId XtAddTimeOut(interval, proc, closure)
- unsigned long interval;
- XtTimerCallbackProc proc;
- XtPointer closure;
-{
- return XtAppAddTimeOut(_XtDefaultAppContext(),
- interval, proc, closure);
-}
-
-static void QueueTimerEvent(app, ptr)
- XtAppContext app;
- TimerEventRec *ptr;
-{
- TimerEventRec *t,**tt;
- tt = &app->timerQueue;
- t = *tt;
- while (t != NULL &&
- IS_AFTER(t->te_timer_value, ptr->te_timer_value)) {
- tt = &t->te_next;
- t = *tt;
- }
- ptr->te_next = t;
- *tt = ptr;
-}
-
-XtIntervalId XtAppAddTimeOut(app, interval, proc, closure)
- XtAppContext app;
- unsigned long interval;
- XtTimerCallbackProc proc;
- XtPointer closure;
-{
- TimerEventRec *tptr;
- struct timeval current_time;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- if (freeTimerRecs) {
- tptr = freeTimerRecs;
- freeTimerRecs = tptr->te_next;
- }
- else tptr = XtNew(TimerEventRec);
- UNLOCK_PROCESS;
-
- tptr->te_next = NULL;
- tptr->te_closure = closure;
- tptr->te_proc = proc;
- tptr->app = app;
- tptr->te_timer_value.tv_sec = interval/1000;
- tptr->te_timer_value.tv_usec = (interval%1000)*1000;
- X_GETTIMEOFDAY (&current_time);
- FIXUP_TIMEVAL(current_time);
- ADD_TIME(tptr->te_timer_value,tptr->te_timer_value,current_time);
- QueueTimerEvent(app, tptr);
- UNLOCK_APP(app);
- return( (XtIntervalId) tptr);
-}
-
-void XtRemoveTimeOut(id)
- XtIntervalId id;
-{
- TimerEventRec *t, *last, *tid = (TimerEventRec *) id;
- XtAppContext app = tid->app;
-
- /* find it */
- LOCK_APP(app);
- for(t = app->timerQueue, last = NULL;
- t != NULL && t != tid;
- t = t->te_next) last = t;
-
- if (t == NULL) {
- UNLOCK_APP(app);
- return; /* couldn't find it */
- }
- if(last == NULL) { /* first one on the list */
- app->timerQueue = t->te_next;
- } else last->te_next = t->te_next;
-
- LOCK_PROCESS;
- t->te_next = freeTimerRecs;
- freeTimerRecs = t;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-XtWorkProcId XtAddWorkProc(proc, closure)
- XtWorkProc proc;
- XtPointer closure;
-{
- return XtAppAddWorkProc(_XtDefaultAppContext(), proc, closure);
-}
-
-XtWorkProcId XtAppAddWorkProc(app, proc, closure)
- XtAppContext app;
- XtWorkProc proc;
- XtPointer closure;
-{
- WorkProcRec *wptr;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- if (freeWorkRecs) {
- wptr = freeWorkRecs;
- freeWorkRecs = wptr->next;
- } else wptr = XtNew(WorkProcRec);
- UNLOCK_PROCESS;
- wptr->next = app->workQueue;
- wptr->closure = closure;
- wptr->proc = proc;
- wptr->app = app;
- app->workQueue = wptr;
- UNLOCK_APP(app);
- return (XtWorkProcId) wptr;
-}
-
-void XtRemoveWorkProc(id)
- XtWorkProcId id;
-{
- WorkProcRec *wid= (WorkProcRec *) id, *w, *last;
- XtAppContext app = wid->app;
-
- LOCK_APP(app);
- /* find it */
- for(w = app->workQueue, last = NULL;
- w != NULL && w != wid; w = w->next) last = w;
-
- if (w == NULL) {
- UNLOCK_APP(app);
- return; /* couldn't find it */
- }
-
- if(last == NULL) app->workQueue = w->next;
- else last->next = w->next;
- LOCK_PROCESS;
- w->next = freeWorkRecs;
- freeWorkRecs = w;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-XtSignalId XtAddSignal(proc, closure)
- XtSignalCallbackProc proc;
- XtPointer closure;
-{
- return XtAppAddSignal(_XtDefaultAppContext(), proc, closure);
-}
-
-XtSignalId XtAppAddSignal(app, proc, closure)
- XtAppContext app;
- XtSignalCallbackProc proc;
- XtPointer closure;
-{
- SignalEventRec *sptr;
-
- LOCK_APP(app);
- LOCK_PROCESS;
- if (freeSignalRecs) {
- sptr = freeSignalRecs;
- freeSignalRecs = sptr->se_next;
- } else
- sptr = XtNew(SignalEventRec);
- UNLOCK_PROCESS;
- sptr->se_next = app->signalQueue;
- sptr->se_closure = closure;
- sptr->se_proc = proc;
- sptr->app = app;
- sptr->se_notice = FALSE;
- app->signalQueue = sptr;
- UNLOCK_APP(app);
- return (XtSignalId) sptr;
-}
-
-void XtRemoveSignal(id)
- XtSignalId id;
-{
- SignalEventRec *sid = (SignalEventRec*) id, *s, *last = NULL;
- XtAppContext app = sid->app;
-
- LOCK_APP(app);
- for (s = app->signalQueue; s != NULL && s != sid; s = s->se_next)
- last = s;
- if (s == NULL) {
- UNLOCK_APP(app);
- return;
- }
- if (last == NULL)
- app->signalQueue = s->se_next;
- else
- last->se_next = s->se_next;
- LOCK_PROCESS;
- s->se_next = freeSignalRecs;
- freeSignalRecs = s;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void XtNoticeSignal(id)
- XtSignalId id;
-{
- /*
- * It would be overkill to lock the app to set this flag.
- * In the worst case, 2..n threads would be modifying this
- * flag. The last one wins. Since signals occur asynchronously
- * anyway, this can occur with or without threads.
- *
- * The other issue is that thread t1 sets the flag in a
- * signalrec that has been deleted in thread t2. We rely
- * on a detail of the implementation, i.e. free'd signalrecs
- * aren't really free'd, they're just moved to a list of
- * free recs, so deref'ing one won't hurt anything.
- *
- * Lastly, and perhaps most importantly, since POSIX threads
- * says that the handling of asynchronous signals in a synchronous
- * threads environment is undefined. Therefor it would be an
- * error for both signals and threads to be in use in the same
- * program.
- */
- SignalEventRec *sid = (SignalEventRec*) id;
- sid->se_notice = TRUE;
-}
-
-XtInputId XtAddInput( source, Condition, proc, closure)
- int source;
- XtPointer Condition;
- XtInputCallbackProc proc;
- XtPointer closure;
-{
- return XtAppAddInput(_XtDefaultAppContext(),
- source, Condition, proc, closure);
-}
-
-XtInputId XtAppAddInput(app, source, Condition, proc, closure)
- XtAppContext app;
- int source;
- XtPointer Condition;
- XtInputCallbackProc proc;
- XtPointer closure;
-{
-#ifndef AMOEBA
- InputEvent* sptr;
- XtInputMask condition = (XtInputMask) Condition;
-
- LOCK_APP(app);
- if (!condition ||
- condition & ~(XtInputReadMask|XtInputWriteMask|XtInputExceptMask))
- XtAppErrorMsg(app,"invalidParameter","xtAddInput",XtCXtToolkitError,
- "invalid condition passed to XtAppAddInput",
- (String *)NULL, (Cardinal *)NULL);
-
- if (app->input_max <= source) {
- Cardinal n = source + 1;
- int ii;
- app->input_list = (InputEvent**)XtRealloc((char*) app->input_list,
- n * sizeof(InputEvent*));
- for (ii = app->input_max; ii < (int) n; ii++)
- app->input_list[ii] = (InputEvent*) NULL;
- app->input_max = n;
- }
- sptr = XtNew(InputEvent);
- sptr->ie_proc = proc;
- sptr->ie_closure = closure;
- sptr->app = app;
- sptr->ie_oq = NULL;
- sptr->ie_source = source;
- sptr->ie_condition = condition;
- sptr->ie_next = app->input_list[source];
- app->input_list[source] = sptr;
-
-#ifndef USE_POLL
- if (condition & XtInputReadMask) FD_SET(source, &app->fds.rmask);
- if (condition & XtInputWriteMask) FD_SET(source, &app->fds.wmask);
- if (condition & XtInputExceptMask) FD_SET(source, &app->fds.emask);
-
- if (app->fds.nfds < (source+1)) app->fds.nfds = source+1;
-#else
- if (sptr->ie_next == NULL)
- app->fds.nfds++;
-#endif
- app->input_count++;
- app->rebuild_fdlist = TRUE;
- UNLOCK_APP(app);
- return((XtInputId)sptr);
-#else /* AMOEBA */
- printf("XtAppAddInput not yet implemented\n");
- abort();
-#endif /* AMOEBA */
-}
-
-void XtRemoveInput( id )
- register XtInputId id;
-{
- register InputEvent *sptr, *lptr;
- XtAppContext app = ((InputEvent *)id)->app;
- register int source = ((InputEvent *)id)->ie_source;
- Boolean found = False;
-
- LOCK_APP(app);
- sptr = app->outstandingQueue;
- lptr = NULL;
- for (; sptr != NULL; sptr = sptr->ie_oq) {
- if (sptr == (InputEvent *)id) {
- if (lptr == NULL) app->outstandingQueue = sptr->ie_oq;
- else lptr->ie_oq = sptr->ie_oq;
- }
- lptr = sptr;
- }
-
- if(app->input_list && (sptr = app->input_list[source]) != NULL) {
- for( lptr = NULL ; sptr; sptr = sptr->ie_next ){
- if(sptr == (InputEvent *) id) {
-#ifndef USE_POLL
- XtInputMask condition = 0;
-#endif
- if(lptr == NULL) {
- app->input_list[source] = sptr->ie_next;
- } else {
- lptr->ie_next = sptr->ie_next;
- }
-#ifndef USE_POLL
- for (lptr = app->input_list[source];
- lptr; lptr = lptr->ie_next)
- condition |= lptr->ie_condition;
- if ((sptr->ie_condition & XtInputReadMask) &&
- !(condition & XtInputReadMask))
- FD_CLR(source, &app->fds.rmask);
- if ((sptr->ie_condition & XtInputWriteMask) &&
- !(condition & XtInputWriteMask))
- FD_CLR(source, &app->fds.wmask);
- if ((sptr->ie_condition & XtInputExceptMask) &&
- !(condition & XtInputExceptMask))
- FD_CLR(source, &app->fds.emask);
-#endif
- XtFree((char *) sptr);
- found = True;
- break;
- }
- lptr = sptr;
- }
- }
-
- if (found) {
- app->input_count--;
-#ifdef USE_POLL
- if (app->input_list[source] == NULL)
- app->fds.nfds--;
-#endif
- app->rebuild_fdlist = TRUE;
- } else
- XtAppWarningMsg(app, "invalidProcedure","inputHandler",
- XtCXtToolkitError,
- "XtRemoveInput: Input handler not found",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
-}
-
-void _XtRemoveAllInputs(app)
- XtAppContext app;
-{
- int i;
- for (i = 0; i < app->input_max; i++) {
- InputEvent* ep = app->input_list[i];
- while (ep) {
- InputEvent *next = ep->ie_next;
- XtFree( (char*)ep );
- ep = next;
- }
- }
- XtFree((char *) app->input_list);
-}
-
-/* Do alternate input and timer callbacks if there are any */
-
-static void DoOtherSources(app)
- XtAppContext app;
-{
- TimerEventRec *te_ptr;
- InputEvent *ie_ptr;
- struct timeval cur_time;
-
-#define DrainQueue() \
- for (ie_ptr = app->outstandingQueue; ie_ptr != NULL;) { \
- app->outstandingQueue = ie_ptr->ie_oq; \
- ie_ptr ->ie_oq = NULL; \
- IeCallProc(ie_ptr); \
- ie_ptr = app->outstandingQueue; \
- }
-/*enddef*/
- DrainQueue();
- if (app->input_count > 0) {
- /* Call _XtWaitForSomething to get input queued up */
- (void) _XtWaitForSomething (app,
- TRUE, TRUE, FALSE, TRUE,
- FALSE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *)NULL);
- DrainQueue();
- }
- if (app->timerQueue != NULL) { /* check timeout queue */
- X_GETTIMEOFDAY (&cur_time);
- FIXUP_TIMEVAL(cur_time);
- while(IS_AT_OR_AFTER (app->timerQueue->te_timer_value, cur_time)) {
- te_ptr = app->timerQueue;
- app->timerQueue = te_ptr->te_next;
- te_ptr->te_next = NULL;
- if (te_ptr->te_proc != NULL)
- TeCallProc(te_ptr);
- LOCK_PROCESS;
- te_ptr->te_next = freeTimerRecs;
- freeTimerRecs = te_ptr;
- UNLOCK_PROCESS;
- if (app->timerQueue == NULL) break;
- }
- }
- if (app->signalQueue != NULL) {
- SignalEventRec *se_ptr = app->signalQueue;
- while (se_ptr != NULL) {
- if (se_ptr->se_notice) {
- se_ptr->se_notice = FALSE;
- if (se_ptr->se_proc != NULL)
- SeCallProc(se_ptr);
- }
- se_ptr = se_ptr->se_next;
- }
- }
-#undef DrainQueue
-}
-
-/* If there are any work procs, call them. Return whether we did so */
-
-static Boolean CallWorkProc(app)
- XtAppContext app;
-{
- register WorkProcRec *w = app->workQueue;
- Boolean delete;
-
- if (w == NULL) return FALSE;
-
- app->workQueue = w->next;
-
- delete = (*(w->proc)) (w->closure);
-
- if (delete) {
- LOCK_PROCESS;
- w->next = freeWorkRecs;
- freeWorkRecs = w;
- UNLOCK_PROCESS;
- }
- else {
- w->next = app->workQueue;
- app->workQueue = w;
- }
- return TRUE;
-}
-
-/*
- * XtNextEvent()
- * return next event;
- */
-
-void XtNextEvent(event)
- XEvent *event;
-{
- XtAppNextEvent(_XtDefaultAppContext(), event);
-}
-
-#if NeedFunctionPrototypes
-void _XtRefreshMapping(
- XEvent* event,
- _XtBoolean dispatch)
-#else
-void _XtRefreshMapping(event, dispatch)
- XEvent *event;
- Boolean dispatch;
-#endif
-{
- XtPerDisplay pd;
-
- LOCK_PROCESS;
- pd = _XtGetPerDisplay(event->xmapping.display);
- if (event->xmapping.request != MappingPointer &&
- pd && pd->keysyms && (event->xmapping.serial >= pd->keysyms_serial))
- _XtBuildKeysymTables( event->xmapping.display, pd );
- XRefreshKeyboardMapping(&event->xmapping);
- if (dispatch && pd && pd->mapping_callbacks)
- XtCallCallbackList((Widget) NULL,
- (XtCallbackList)pd->mapping_callbacks,
- (XtPointer)event );
- UNLOCK_PROCESS;
-}
-
-void XtAppNextEvent(app, event)
- XtAppContext app;
- XEvent *event;
-{
- int i, d;
-
- LOCK_APP(app);
- for (;;) {
- if (app->count == 0)
- DoOtherSources(app);
- else {
- for (i = 1; i <= app->count; i++) {
- d = (i + app->last) % app->count;
- if (d == 0) DoOtherSources(app);
- if (XEventsQueued(app->list[d], QueuedAfterReading))
- goto GotEvent;
- }
- for (i = 1; i <= app->count; i++) {
- d = (i + app->last) % app->count;
- if (XEventsQueued(app->list[d], QueuedAfterFlush))
- goto GotEvent;
- }
- }
-
- /* We're ready to wait...if there is a work proc, call it */
- if (CallWorkProc(app)) continue;
-
- d = _XtWaitForSomething (app,
- FALSE, FALSE, FALSE, FALSE,
- TRUE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *) NULL);
-
- if (d != -1) {
- GotEvent:
- XNextEvent (app->list[d], event);
-#ifdef XTHREADS
- /* assert(app->list[d] == event->xany.display); */
-#endif
- app->last = d;
- if (event->xany.type == MappingNotify)
- _XtRefreshMapping(event, False);
- UNLOCK_APP(app);
- return;
- }
-
- } /* for */
-}
-
-void XtProcessEvent(mask)
- XtInputMask mask;
-{
- XtAppProcessEvent(_XtDefaultAppContext(), mask);
-}
-
-void XtAppProcessEvent(app, mask)
- XtAppContext app;
- XtInputMask mask;
-{
- int i, d;
- XEvent event;
- struct timeval cur_time;
-
- LOCK_APP(app);
- if (mask == 0) {
- UNLOCK_APP(app);
- return;
- }
-
- for (;;) {
-
- if (mask & XtIMSignal && app->signalQueue != NULL) {
- SignalEventRec *se_ptr = app->signalQueue;
- while (se_ptr != NULL) {
- if (se_ptr->se_notice) {
- se_ptr->se_notice = FALSE;
- SeCallProc(se_ptr);
- UNLOCK_APP(app);
- return;
- }
- se_ptr = se_ptr->se_next;
- }
- }
-
- if (mask & XtIMTimer && app->timerQueue != NULL) {
- X_GETTIMEOFDAY (&cur_time);
- FIXUP_TIMEVAL(cur_time);
- if (IS_AT_OR_AFTER(app->timerQueue->te_timer_value, cur_time)){
- TimerEventRec *te_ptr = app->timerQueue;
- app->timerQueue = app->timerQueue->te_next;
- te_ptr->te_next = NULL;
- if (te_ptr->te_proc != NULL)
- TeCallProc(te_ptr);
- LOCK_PROCESS;
- te_ptr->te_next = freeTimerRecs;
- freeTimerRecs = te_ptr;
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
- }
-
- if (mask & XtIMAlternateInput) {
- if (app->input_count > 0 && app->outstandingQueue == NULL) {
- /* Call _XtWaitForSomething to get input queued up */
- (void) _XtWaitForSomething (app,
- TRUE, TRUE, FALSE, TRUE,
- FALSE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *)NULL);
- }
- if (app->outstandingQueue != NULL) {
- InputEvent *ie_ptr = app->outstandingQueue;
- app->outstandingQueue = ie_ptr->ie_oq;
- ie_ptr->ie_oq = NULL;
- IeCallProc(ie_ptr);
- UNLOCK_APP(app);
- return;
- }
- }
-
- if (mask & XtIMXEvent) {
- for (i = 1; i <= app->count; i++) {
- d = (i + app->last) % app->count;
- if (XEventsQueued(app->list[d], QueuedAfterReading))
- goto GotEvent;
- }
- for (i = 1; i <= app->count; i++) {
- d = (i + app->last) % app->count;
- if (XEventsQueued(app->list[d], QueuedAfterFlush))
- goto GotEvent;
- }
- }
-
- /* Nothing to do...wait for something */
-
- if (CallWorkProc(app)) continue;
-
- d = _XtWaitForSomething (app,
- (mask & XtIMXEvent ? FALSE : TRUE),
- (mask & XtIMTimer ? FALSE : TRUE),
- (mask & XtIMAlternateInput ? FALSE : TRUE),
- (mask & XtIMSignal ? FALSE : TRUE),
- TRUE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *) NULL);
-
- if (mask & XtIMXEvent && d != -1) {
- GotEvent:
- XNextEvent(app->list[d], &event);
-#ifdef XTHREADS
- /* assert(app->list[d] == event.xany.display); */
-#endif
- app->last = d;
- if (event.xany.type == MappingNotify) {
- _XtRefreshMapping(&event, False);
- }
- XtDispatchEvent(&event);
- UNLOCK_APP(app);
- return;
- }
-
- }
-}
-
-Boolean XtPending()
-{
- return (XtAppPending(_XtDefaultAppContext()) != 0);
-}
-
-XtInputMask XtAppPending(app)
- XtAppContext app;
-{
- struct timeval cur_time;
- int d;
- XtInputMask ret = 0;
-
-/*
- * Check for pending X events
- */
- LOCK_APP(app);
- for (d = 0; d < app->count; d++) {
- if (XEventsQueued(app->list[d], QueuedAfterReading)) {
- ret = XtIMXEvent;
- break;
- }
- }
- if (ret == 0) {
- for (d = 0; d < app->count; d++) {
- if (XEventsQueued(app->list[d], QueuedAfterFlush)) {
- ret = XtIMXEvent;
- break;
- }
- }
- }
-
- if (app->signalQueue != NULL) {
- SignalEventRec *se_ptr = app->signalQueue;
- while (se_ptr != NULL) {
- if (se_ptr->se_notice) {
- ret |= XtIMSignal;
- break;
- }
- se_ptr = se_ptr->se_next;
- }
- }
-
-/*
- * Check for pending alternate input
- */
- if (app->timerQueue != NULL) { /* check timeout queue */
- X_GETTIMEOFDAY (&cur_time);
- FIXUP_TIMEVAL(cur_time);
- if ((IS_AT_OR_AFTER(app->timerQueue->te_timer_value, cur_time)) &&
- (app->timerQueue->te_proc != 0)) {
- ret |= XtIMTimer;
- }
- }
-
- if (app->outstandingQueue != NULL) ret |= XtIMAlternateInput;
- else {
- /* This won't cause a wait, but will enqueue any input */
-
- if(_XtWaitForSomething (app,
- FALSE, TRUE, FALSE, TRUE,
- FALSE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *) NULL) != -1)
- ret |= XtIMXEvent;
- if (app->outstandingQueue != NULL) ret |= XtIMAlternateInput;
- }
- UNLOCK_APP(app);
- return ret;
-}
-
-/* Peek at alternate input and timer callbacks if there are any */
-
-static Boolean PeekOtherSources(app)
- XtAppContext app;
-{
- struct timeval cur_time;
-
- if (app->outstandingQueue != NULL) return TRUE;
-
- if (app->signalQueue != NULL) {
- SignalEventRec *se_ptr = app->signalQueue;
- while (se_ptr != NULL) {
- if (se_ptr->se_notice)
- return TRUE;
- se_ptr = se_ptr->se_next;
- }
- }
-
- if (app->input_count > 0) {
- /* Call _XtWaitForSomething to get input queued up */
- (void) _XtWaitForSomething (app,
- TRUE, TRUE, FALSE, TRUE,
- FALSE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *)NULL);
- if (app->outstandingQueue != NULL) return TRUE;
- }
-
- if (app->timerQueue != NULL) { /* check timeout queue */
- X_GETTIMEOFDAY (&cur_time);
- FIXUP_TIMEVAL(cur_time);
- if (IS_AT_OR_AFTER (app->timerQueue->te_timer_value, cur_time))
- return TRUE;
- }
-
- return FALSE;
-}
-
-Boolean XtPeekEvent(event)
- XEvent *event;
-{
- return XtAppPeekEvent(_XtDefaultAppContext(), event);
-}
-
-Boolean XtAppPeekEvent(app, event)
- XtAppContext app;
- XEvent *event;
-{
- int i, d;
- Boolean foundCall = FALSE;
-
- LOCK_APP(app);
- for (i = 1; i <= app->count; i++) {
- d = (i + app->last) % app->count;
- if (d == 0) foundCall = PeekOtherSources(app);
- if (XEventsQueued(app->list[d], QueuedAfterReading))
- goto GotEvent;
- }
- for (i = 1; i <= app->count; i++) {
- d = (i + app->last) % app->count;
- if (XEventsQueued(app->list[d], QueuedAfterFlush))
- goto GotEvent;
- }
-
- if (foundCall) {
- event->xany.type = 0;
- event->xany.display = NULL;
- event->xany.window = 0;
- UNLOCK_APP(app);
- return FALSE;
- }
-
- d = _XtWaitForSomething (app,
- FALSE, FALSE, FALSE, FALSE,
- TRUE,
-#ifdef XTHREADS
- TRUE,
-#endif
- (unsigned long *) NULL);
-
- if (d != -1) {
- GotEvent:
- XPeekEvent(app->list[d], event);
- app->last = (d == 0 ? app->count : d) - 1;
- UNLOCK_APP(app);
- return TRUE;
- }
- event->xany.type = 0; /* Something else must be ready */
- event->xany.display = NULL;
- event->xany.window = 0;
- UNLOCK_APP(app);
- return FALSE;
-}
diff --git a/xc/lib/Xt/Object.c b/xc/lib/Xt/Object.c
deleted file mode 100644
index 6048a3085..000000000
--- a/xc/lib/Xt/Object.c
+++ /dev/null
@@ -1,290 +0,0 @@
-/* $TOG: Object.c /main/27 1998/02/06 13:24:22 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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/lib/Xt/Object.c,v 1.4 1998/12/20 11:57:09 dawes Exp $ */
-
-#define OBJECT
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-
-static XtResource resources[] = {
- {XtNdestroyCallback, XtCCallback, XtRCallback,sizeof(XtPointer),
- XtOffsetOf(ObjectRec,object.destroy_callbacks),
- XtRCallback, (XtPointer)NULL}
- };
-
-static void ObjectClassPartInitialize();
-static Boolean ObjectSetValues();
-static void ObjectDestroy();
-
-externaldef(objectclassrec) ObjectClassRec objectClassRec = {
- {
- /* superclass */ NULL,
- /* class_name */ "Object",
- /* widget_size */ sizeof(ObjectRec),
- /* class_initialize */ NULL,
- /* class_part_initialize*/ ObjectClassPartInitialize,
- /* class_inited */ FALSE,
- /* initialize */ NULL,
- /* initialize_hook */ NULL,
- /* pad */ NULL,
- /* pad */ NULL,
- /* pad */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* pad */ FALSE,
- /* pad */ FALSE,
- /* pad */ FALSE,
- /* pad */ FALSE,
- /* destroy */ ObjectDestroy,
- /* pad */ NULL,
- /* pad */ NULL,
- /* set_values */ ObjectSetValues,
- /* set_values_hook */ NULL,
- /* pad */ NULL,
- /* get_values_hook */ NULL,
- /* pad */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* pad */ NULL,
- /* pad */ NULL,
- /* pad */ NULL,
- /* extension */ NULL
-}
-};
-
-externaldef(objectClass) WidgetClass objectClass
- = (WidgetClass)&objectClassRec;
-
-/*
- * Start of object routines.
- */
-
-
-static void ConstructCallbackOffsets(widgetClass)
- WidgetClass widgetClass;
-{
- static XrmQuark QCallback = NULLQUARK;
- register int i;
- register int tableSize;
- register CallbackTable newTable;
- register CallbackTable superTable;
- register XrmResourceList resourceList;
- ObjectClass objectClass = (ObjectClass)widgetClass;
-
- /*
- This function builds an array of pointers to the resource
- structures which describe the callbacks for this widget class.
- This array is special in that the 0th entry is the number of
- callback pointers.
- */
-
- if (QCallback == NULLQUARK)
- QCallback = XrmPermStringToQuark(XtRCallback);
-
- if (objectClass->object_class.superclass != NULL) {
- superTable = (CallbackTable)
- ((ObjectClass) objectClass->object_class.superclass)->
- object_class.callback_private;
- tableSize = (int)(long) superTable[0];
- } else {
- superTable = (CallbackTable) NULL;
- tableSize = 0;
- }
-
- /* Count the number of callbacks */
- resourceList = (XrmResourceList) objectClass->object_class.resources;
- for (i = objectClass->object_class.num_resources; --i >= 0; resourceList++)
- if (resourceList->xrm_type == QCallback)
- tableSize++;
-
- /*
- * Allocate and load the table. Make sure that the new callback
- * offsets occur in the table ahead of the superclass callback
- * offsets so that resource overrides work.
- */
- newTable = (CallbackTable)
- __XtMalloc(sizeof(XrmResource *) * (tableSize + 1));
-
- newTable[0] = (XrmResource *)(long) tableSize;
-
- if (superTable)
- tableSize -= (int)(long) superTable[0];
- resourceList = (XrmResourceList) objectClass->object_class.resources;
- for (i=1; tableSize > 0; resourceList++)
- if (resourceList->xrm_type == QCallback) {
- newTable[i++] = resourceList;
- tableSize--;
- }
-
- if (superTable)
- for (tableSize = (int)(long) *superTable++;
- --tableSize >= 0; superTable++)
- newTable[i++] = *superTable;
-
- objectClass->object_class.callback_private = (XtPointer) newTable;
-}
-
-static void InheritObjectExtensionMethods(widget_class)
- WidgetClass widget_class;
-{
- ObjectClass oc = (ObjectClass) widget_class;
- ObjectClassExtension ext, super_ext = NULL;
-
- ext = (ObjectClassExtension)
- XtGetClassExtension(widget_class,
- XtOffsetOf(ObjectClassRec, object_class.extension),
- NULLQUARK, XtObjectExtensionVersion,
- sizeof(ObjectClassExtensionRec));
-
- if (oc->object_class.superclass)
- super_ext = (ObjectClassExtension)
- XtGetClassExtension(oc->object_class.superclass,
- XtOffsetOf(ObjectClassRec, object_class.extension),
- NULLQUARK, XtObjectExtensionVersion,
- sizeof(ObjectClassExtensionRec));
- LOCK_PROCESS;
- if (ext) {
- if (ext->allocate == XtInheritAllocate)
- ext->allocate = (super_ext ? super_ext->allocate : NULL);
- if (ext->deallocate == XtInheritDeallocate)
- ext->deallocate = (super_ext ? super_ext->deallocate : NULL);
- } else if (super_ext) {
- /* Be careful to inherit only what is appropriate */
- ext = (ObjectClassExtension)
- __XtCalloc(1, sizeof(ObjectClassExtensionRec));
- ext->next_extension = oc->object_class.extension;
- ext->record_type = NULLQUARK;
- ext->version = XtObjectExtensionVersion;
- ext->record_size = sizeof(ObjectClassExtensionRec);
- ext->allocate = super_ext->allocate;
- ext->deallocate = super_ext->deallocate;
- oc->object_class.extension = (XtPointer) ext;
- }
- UNLOCK_PROCESS;
-}
-
-static void ObjectClassPartInitialize(wc)
- register WidgetClass wc;
-{
- ObjectClass oc = (ObjectClass)wc;
-
- oc->object_class.xrm_class =
- XrmPermStringToQuark(oc->object_class.class_name);
-
- if (oc->object_class.resources)
- _XtCompileResourceList(oc->object_class.resources,
- oc->object_class.num_resources);
-
- ConstructCallbackOffsets(wc);
- _XtResourceDependencies(wc);
- InheritObjectExtensionMethods(wc);
-}
-
-
-/*ARGSUSED*/
-static Boolean ObjectSetValues(old, request, widget, args, num_args)
- Widget old, request, widget;
- ArgList args;
- Cardinal *num_args;
-{
- register CallbackTable offsets;
- register int i;
- register InternalCallbackList *ol, *nl;
-
- LOCK_PROCESS;
- /* Compile any callback lists into internal form */
- offsets = (CallbackTable) XtClass(widget)->core_class.callback_private;
-
- for (i= (int)(long) *(offsets++); --i >= 0; offsets++) {
- ol = (InternalCallbackList *)
- ((char *) old - (*offsets)->xrm_offset - 1);
- nl = (InternalCallbackList *)
- ((char *) widget - (*offsets)->xrm_offset - 1);
- if (*ol != *nl) {
- if (*ol != NULL)
- XtFree((char *) *ol);
- if (*nl != NULL)
- *nl = _XtCompileCallbackList((XtCallbackList) *nl);
- }
- }
- UNLOCK_PROCESS;
- return False;
-}
-
-
-static void ObjectDestroy (widget)
- register Widget widget;
-{
- register CallbackTable offsets;
- register int i;
- register InternalCallbackList cl;
-
- /* Remove all callbacks associated with widget */
- LOCK_PROCESS;
- offsets = (CallbackTable)
- widget->core.widget_class->core_class.callback_private;
-
- for (i = (int)(long) *(offsets++); --i >= 0; offsets++) {
- cl = *(InternalCallbackList *)
- ((char *) widget - (*offsets)->xrm_offset - 1);
- if (cl) XtFree((char *) cl);
- }
- UNLOCK_PROCESS;
-} /* ObjectDestroy */
-
-
diff --git a/xc/lib/Xt/Object.h b/xc/lib/Xt/Object.h
deleted file mode 100644
index 44c5d73fd..000000000
--- a/xc/lib/Xt/Object.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $TOG: Object.h /main/10 1998/02/06 13:24:28 kaleb $ */
-/* $oHeader: Object.h,v 1.2 88/08/18 15:55:32 asente Exp $ */
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtObject_h
-#define _XtObject_h
-
-typedef struct _ObjectRec *Object;
-typedef struct _ObjectClassRec *ObjectClass;
-
-#ifndef OBJECT
-externalref WidgetClass objectClass;
-#endif
-#endif /* _XtObject_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/ObjectP.h b/xc/lib/Xt/ObjectP.h
deleted file mode 100644
index d580f9d45..000000000
--- a/xc/lib/Xt/ObjectP.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* $TOG: ObjectP.h /main/15 1998/02/06 13:24:17 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _Xt_ObjectP_h_
-#define _Xt_ObjectP_h_
-
-#include <X11/Object.h>
-
-/**********************************************************
- * Object Instance Data Structures
- *
- **********************************************************/
-/* these fields match CorePart and can not be changed */
-
-typedef struct _ObjectPart {
- Widget self; /* pointer to widget itself */
- WidgetClass widget_class; /* pointer to Widget's ClassRec */
- Widget parent; /* parent widget */
- XrmName xrm_name; /* widget resource name quarkified */
- Boolean being_destroyed; /* marked for destroy */
- XtCallbackList destroy_callbacks; /* who to call when widget destroyed */
- XtPointer constraints; /* constraint record */
-} ObjectPart;
-
-typedef struct _ObjectRec {
- ObjectPart object;
-} ObjectRec;
-
-/********************************************************
- * Object Class Data Structures
- *
- ********************************************************/
-/* these fields match CoreClassPart and can not be changed */
-/* ideally these structures would only contain the fields required;
- but because the CoreClassPart cannot be changed at this late date
- extraneous fields are necessary to make the field offsets match */
-
-typedef struct _ObjectClassPart {
-
- WidgetClass superclass; /* pointer to superclass ClassRec */
- String class_name; /* widget resource class name */
- Cardinal widget_size; /* size in bytes of widget record */
- XtProc class_initialize; /* class initialization proc */
- XtWidgetClassProc class_part_initialize; /* dynamic initialization */
- XtEnum class_inited; /* has class been initialized? */
- XtInitProc initialize; /* initialize subclass fields */
- XtArgsProc initialize_hook; /* notify that initialize called */
- XtProc obj1; /* NULL */
- XtPointer obj2; /* NULL */
- Cardinal obj3; /* NULL */
- XtResourceList resources; /* resources for subclass fields */
- Cardinal num_resources; /* number of entries in resources */
- XrmClass xrm_class; /* resource class quarkified */
- Boolean obj4; /* NULL */
- XtEnum obj5; /* NULL */
- Boolean obj6; /* NULL */
- Boolean obj7; /* NULL */
- XtWidgetProc destroy; /* free data for subclass pointers */
- XtProc obj8; /* NULL */
- XtProc obj9; /* NULL */
- XtSetValuesFunc set_values; /* set subclass resource values */
- XtArgsFunc set_values_hook; /* notify that set_values called */
- XtProc obj10; /* NULL */
- XtArgsProc get_values_hook; /* notify that get_values called */
- XtProc obj11; /* NULL */
- XtVersionType version; /* version of intrinsics used */
- XtPointer callback_private; /* list of callback offsets */
- String obj12; /* NULL */
- XtProc obj13; /* NULL */
- XtProc obj14; /* NULL */
- XtPointer extension; /* pointer to extension record */
-}ObjectClassPart;
-
-typedef struct {
- XtPointer next_extension; /* 1st 4 required for all extension records */
- XrmQuark record_type; /* NULLQUARK; when on ObjectClassPart */
- long version; /* must be XtObjectExtensionVersion */
- Cardinal record_size; /* sizeof(ObjectClassExtensionRec) */
- XtAllocateProc allocate;
- XtDeallocateProc deallocate;
-} ObjectClassExtensionRec, *ObjectClassExtension;
-
-typedef struct _ObjectClassRec {
- ObjectClassPart object_class;
-} ObjectClassRec;
-
-externalref ObjectClassRec objectClassRec;
-
-#define XtObjectExtensionVersion 1L
-#define XtInheritAllocate ((XtAllocateProc) _XtInherit)
-#define XtInheritDeallocate ((XtDeallocateProc) _XtInherit)
-
-#endif /*_Xt_ObjectP_h_*/
diff --git a/xc/lib/Xt/PassivGraI.h b/xc/lib/Xt/PassivGraI.h
deleted file mode 100644
index b2071509b..000000000
--- a/xc/lib/Xt/PassivGraI.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
-* $TOG: PassivGraI.h /main/13 1998/02/06 13:24:39 kaleb $
-*/
-
-/********************************************************
-
-Copyright 1988 by Hewlett-Packard Company
-Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the 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, 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.
-
-*/
-
-#ifndef _PDI_h_
-#define _PDI_h_
-
-
-#define KEYBOARD TRUE
-#define POINTER FALSE
-
-typedef enum {
- XtNoServerGrab,
- XtPassiveServerGrab,
- XtActiveServerGrab,
- XtPseudoPassiveServerGrab,
- XtPseudoActiveServerGrab
-}XtServerGrabType;
-
-typedef struct _XtServerGrabRec {
- struct _XtServerGrabRec *next;
- Widget widget;
- unsigned int ownerEvents:1;
- unsigned int pointerMode:1;
- unsigned int keyboardMode:1;
- unsigned int hasExt:1;
- unsigned int confineToIsWidgetWin:1;
- KeyCode keybut;
- unsigned short modifiers;
- unsigned short eventMask;
-} XtServerGrabRec, *XtServerGrabPtr;
-
-typedef struct _XtGrabExtRec {
- Mask *pKeyButMask;
- Mask *pModifiersMask;
- Window confineTo;
- Cursor cursor;
-} XtServerGrabExtRec, *XtServerGrabExtPtr;
-
-#define GRABEXT(p) ((XtServerGrabExtPtr)((p)+1))
-
-typedef struct _XtDeviceRec{
- XtServerGrabRec grab; /* need copy in order to protect
- during grab */
- XtServerGrabType grabType;
-}XtDeviceRec, *XtDevice;
-
-#define XtMyAncestor 0
-#define XtMyDescendant 1
-#define XtMyCousin 2
-#define XtMySelf 3
-#define XtUnrelated 4
-typedef char XtGeneology; /* do not use an enum makes PerWidgetInput larger */
-
-typedef struct {
- Widget focusKid;
- XtServerGrabPtr keyList, ptrList;
- Widget queryEventDescendant;
- unsigned int map_handler_added:1;
- unsigned int realize_handler_added:1;
- unsigned int active_handler_added:1;
- unsigned int haveFocus:1;
- XtGeneology focalPoint;
-}XtPerWidgetInputRec, *XtPerWidgetInput;
-
-typedef struct XtPerDisplayInputRec{
- XtGrabList grabList;
- XtDeviceRec keyboard, pointer;
- KeyCode activatingKey;
- Widget *trace;
- int traceDepth, traceMax;
- Widget focusWidget;
-}XtPerDisplayInputRec, *XtPerDisplayInput;
-
-#define IsServerGrab(g) ((g == XtPassiveServerGrab) ||\
- (g == XtActiveServerGrab))
-
-#define IsAnyGrab(g) ((g == XtPassiveServerGrab) ||\
- (g == XtActiveServerGrab) ||\
- (g == XtPseudoPassiveServerGrab))
-
-#define IsEitherPassiveGrab(g) ((g == XtPassiveServerGrab) ||\
- (g == XtPseudoPassiveServerGrab))
-
-#define IsPseudoGrab(g) ((g == XtPseudoPassiveServerGrab))
-
-extern void _XtDestroyServerGrabs(
-#if NeedFunctionPrototypes
- Widget /* w */,
- XtPointer /* pwi */, /*XtPerWidgetInput*/
- XtPointer /* call_data */
-#endif
-);
-
-extern XtPerWidgetInput _XtGetPerWidgetInput(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- _XtBoolean /* create */
-#endif
-);
-
-extern XtServerGrabPtr _XtCheckServerGrabsOnWidget(
-#if NeedFunctionPrototypes
- XEvent* /* event */,
- Widget /* widget */,
- _XtBoolean /* isKeyboard */
-#endif
-);
-
-/*
-extern XtGrabList* _XtGetGrabList( XtPerDisplayInput );
-*/
-
-#define _XtGetGrabList(pdi) (&(pdi)->grabList)
-
-extern void _XtFreePerWidgetInput(
-#if NeedFunctionPrototypes
- Widget /* w */,
- XtPerWidgetInput /* pwi */
-#endif
-);
-
-extern Widget _XtProcessKeyboardEvent(
-#if NeedFunctionPrototypes
- XKeyEvent* /* event */,
- Widget /* widget */,
- XtPerDisplayInput /* pdi */
-#endif
-);
-
-extern Widget _XtProcessPointerEvent(
-#if NeedFunctionPrototypes
- XButtonEvent* /* event */,
- Widget /* widget */,
- XtPerDisplayInput /* pdi */
-#endif
-);
-
-extern void _XtRegisterPassiveGrabs(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-#endif /* _PDI_h_ */
diff --git a/xc/lib/Xt/PassivGrab.c b/xc/lib/Xt/PassivGrab.c
deleted file mode 100644
index 1391e5533..000000000
--- a/xc/lib/Xt/PassivGrab.c
+++ /dev/null
@@ -1,1115 +0,0 @@
-/* $TOG: PassivGrab.c /main/31 1998/02/06 13:24:33 kaleb $ */
-
-/********************************************************
-
-Copyright 1988 by Hewlett-Packard Company
-Copyright 1987, 1988, 1989,1990 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the 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, Digital, or Sun 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.
-
-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, 1988, 1989, 1990, 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 "IntrinsicI.h"
-#include "StringDefs.h"
-#include "PassivGraI.h"
-
-/* typedef unsigned long Mask; */
-#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))
-#define MasksPerDetailMask 8
-
-#define pDisplay(grabPtr) (((grabPtr)->widget)->core.screen->display)
-#define pWindow(grabPtr) (((grabPtr)->widget)->core.window)
-
-
-/***************************************************************************/
-/*********************** Internal Support Routines *************************/
-/***************************************************************************/
-
-/*
- * Turn off (clear) the bit in the specified detail mask which is associated
- * with the detail.
- */
-
-static void DeleteDetailFromMask(ppDetailMask, detail)
- Mask **ppDetailMask;
- unsigned short detail;
-{
- Mask *pDetailMask = *ppDetailMask;
-
- if (!pDetailMask) {
- int i;
- pDetailMask = (Mask *)__XtMalloc(sizeof(Mask) * MasksPerDetailMask);
- for (i = MasksPerDetailMask; --i >= 0; )
- pDetailMask[i] = ~0;
- *ppDetailMask = pDetailMask;
- }
- BITCLEAR((pDetailMask), detail);
-}
-
-
-/*
- * Make an exact copy of the specified detail mask.
- */
-
-static Mask *CopyDetailMask(pOriginalDetailMask)
- Mask *pOriginalDetailMask;
-{
- Mask *pTempMask;
- int i;
-
- if (!pOriginalDetailMask)
- return NULL;
-
- pTempMask = (Mask *)__XtMalloc(sizeof(Mask) * MasksPerDetailMask);
-
- for ( i = 0; i < MasksPerDetailMask; i++)
- pTempMask[i]= pOriginalDetailMask[i];
-
- return pTempMask;
-}
-
-
-/*
- * Allocate a new grab entry, and fill in all of the fields using the
- * specified parameters.
- */
-
-static XtServerGrabPtr CreateGrab(widget, ownerEvents, modifiers,
- keybut, pointer_mode, keyboard_mode,
- event_mask, confine_to, cursor, need_ext)
- Widget widget;
- Boolean ownerEvents;
- Modifiers modifiers;
- KeyCode keybut;
- int pointer_mode, keyboard_mode;
- Mask event_mask;
- Window confine_to;
- Cursor cursor;
- Boolean need_ext;
-{
- XtServerGrabPtr grab;
-
- if (confine_to || cursor)
- need_ext = True;
- grab = (XtServerGrabPtr)__XtMalloc(sizeof(XtServerGrabRec) +
- (need_ext ? sizeof(XtServerGrabExtRec)
- : 0));
- grab->next = NULL;
- grab->widget = widget;
- grab->ownerEvents = ownerEvents;
- grab->pointerMode = pointer_mode;
- grab->keyboardMode = keyboard_mode;
- grab->eventMask = event_mask;
- grab->hasExt = need_ext;
- grab->confineToIsWidgetWin = (XtWindow (widget) == confine_to);
- grab->modifiers = modifiers;
- grab->keybut = keybut;
- if (need_ext) {
- XtServerGrabExtPtr ext = GRABEXT(grab);
- ext->pModifiersMask = NULL;
- ext->pKeyButMask = NULL;
- ext->confineTo = confine_to;
- ext->cursor = cursor;
- }
- return grab;
-}
-
-
-/*
- * Free up the space occupied by a grab entry.
- */
-
-static void FreeGrab(pGrab)
- XtServerGrabPtr pGrab;
-{
- if (pGrab->hasExt) {
- XtServerGrabExtPtr ext = GRABEXT(pGrab);
- if (ext->pModifiersMask)
- XtFree((char *)ext->pModifiersMask);
- if (ext->pKeyButMask)
- XtFree((char *)ext->pKeyButMask);
- }
- XtFree((char *)pGrab);
-}
-
-typedef struct _DetailRec {
- unsigned short exact;
- Mask *pMask;
-} DetailRec, *DetailPtr;
-
-/*
- * If the first detail is set to 'exception' and the second detail
- * is contained in the mask of the first, then TRUE is returned.
- */
-
-static Bool IsInGrabMask(firstDetail, secondDetail, exception)
- register DetailPtr firstDetail, secondDetail;
- unsigned short exception;
-{
- if (firstDetail->exact == exception) {
- if (!firstDetail->pMask)
- 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;
-}
-
-
-/*
- * If neither of the details is set to 'exception', and they match
- * exactly, then TRUE is returned.
- */
-
-static Bool IdenticalExactDetails(firstExact, secondExact, exception)
- unsigned short firstExact, secondExact, exception;
-{
- if ((firstExact == exception) || (secondExact == exception))
- return FALSE;
-
- if (firstExact == secondExact)
- return TRUE;
-
- return FALSE;
-}
-
-
-/*
- * If the first detail is set to 'exception', and its mask has the bit
- * enabled which corresponds to the second detail, OR if neither of the
- * details is set to 'exception' and the details match exactly, then
- * TRUE is returned.
- */
-
-static Bool DetailSupersedesSecond(firstDetail, secondDetail, exception)
- register DetailPtr firstDetail, secondDetail;
- unsigned short exception;
-{
- if (IsInGrabMask(firstDetail, secondDetail, exception))
- return TRUE;
-
- if (IdenticalExactDetails(firstDetail->exact, secondDetail->exact,
- exception))
- return TRUE;
-
- return FALSE;
-}
-
-
-/*
- * If the two grab events match exactly, or if the first grab entry
- * 'encompasses' the second grab entry, then TRUE is returned.
- */
-
-static Bool GrabSupersedesSecond(pFirstGrab, pSecondGrab)
- register XtServerGrabPtr pFirstGrab, pSecondGrab;
-{
- DetailRec first, second;
-
- first.exact = pFirstGrab->modifiers;
- if (pFirstGrab->hasExt)
- first.pMask = GRABEXT(pFirstGrab)->pModifiersMask;
- else
- first.pMask = NULL;
- second.exact = pSecondGrab->modifiers;
- if (pSecondGrab->hasExt)
- second.pMask = GRABEXT(pSecondGrab)->pModifiersMask;
- else
- second.pMask = NULL;
- if (!DetailSupersedesSecond(&first, &second, (unsigned short)AnyModifier))
- return FALSE;
-
- first.exact = pFirstGrab->keybut;
- if (pFirstGrab->hasExt)
- first.pMask = GRABEXT(pFirstGrab)->pKeyButMask;
- else
- first.pMask = NULL;
- second.exact = pSecondGrab->keybut;
- if (pSecondGrab->hasExt)
- second.pMask = GRABEXT(pSecondGrab)->pKeyButMask;
- else
- second.pMask = NULL;
- if (DetailSupersedesSecond(&first, &second, (unsigned short)AnyKey))
- return TRUE;
-
- return FALSE;
-}
-
-
-/*
- * Two grabs are considered to be matching if either of the following are true:
- *
- * 1) The two grab entries match exactly, or the first grab entry
- * encompasses the second grab entry.
- * 2) The second grab entry encompasses the first grab entry.
- * 3) The keycodes match exactly, and one entry's modifiers encompasses
- * the others.
- * 4) The keycode for one entry encompasses the other, and the detail
- * for the other entry encompasses the first.
- */
-
-static Bool GrabMatchesSecond(pFirstGrab, pSecondGrab)
- register XtServerGrabPtr pFirstGrab, pSecondGrab;
-{
- DetailRec firstD, firstM, secondD, secondM;
-
- if (pDisplay(pFirstGrab) != pDisplay(pSecondGrab))
- return FALSE;
-
- if (GrabSupersedesSecond(pFirstGrab, pSecondGrab))
- return TRUE;
-
- if (GrabSupersedesSecond(pSecondGrab, pFirstGrab))
- return TRUE;
-
- firstD.exact = pFirstGrab->keybut;
- firstM.exact = pFirstGrab->modifiers;
- if (pFirstGrab->hasExt) {
- firstD.pMask = GRABEXT(pFirstGrab)->pKeyButMask;
- firstM.pMask = GRABEXT(pFirstGrab)->pModifiersMask;
- } else {
- firstD.pMask = NULL;
- firstM.pMask = NULL;
- }
- secondD.exact = pSecondGrab->keybut;
- secondM.exact = pSecondGrab->modifiers;
- if (pSecondGrab->hasExt) {
- secondD.pMask = GRABEXT(pSecondGrab)->pKeyButMask;
- secondM.pMask = GRABEXT(pSecondGrab)->pModifiersMask;
- } else {
- secondD.pMask = NULL;
- secondM.pMask = NULL;
- }
-
- if (DetailSupersedesSecond(&secondD, &firstD, (unsigned short)AnyKey) &&
- DetailSupersedesSecond(&firstM, &secondM, (unsigned short)AnyModifier))
- return TRUE;
-
- if (DetailSupersedesSecond(&firstD, &secondD, (unsigned short)AnyKey) &&
- DetailSupersedesSecond(&secondM, &firstM, (unsigned short)AnyModifier))
- return TRUE;
-
- return FALSE;
-}
-
-
-/*
- * Delete a grab combination from the passive grab list. Each entry will
- * be checked to see if it is affected by the grab being deleted. This
- * may result in multiple entries being modified/deleted.
- */
-
-static void DeleteServerGrabFromList(passiveListPtr, pMinuendGrab)
- XtServerGrabPtr *passiveListPtr;
- XtServerGrabPtr pMinuendGrab;
-{
- register XtServerGrabPtr *next;
- register XtServerGrabPtr grab;
- register XtServerGrabExtPtr ext;
-
- for (next = passiveListPtr; grab = *next; )
- {
- if (GrabMatchesSecond(grab, pMinuendGrab) &&
- (pDisplay(grab) == pDisplay(pMinuendGrab)))
- {
- if (GrabSupersedesSecond(pMinuendGrab, grab))
- {
- /*
- * The entry being deleted encompasses the list entry,
- * so delete the list entry.
- */
- *next = grab->next;
- FreeGrab(grab);
- continue;
- }
-
- if (!grab->hasExt) {
- grab = (XtServerGrabPtr)
- XtRealloc((char *)grab, (sizeof(XtServerGrabRec) +
- sizeof(XtServerGrabExtRec)));
- *next = grab;
- grab->hasExt = True;
- ext = GRABEXT(grab);
- ext->pKeyButMask = NULL;
- ext->pModifiersMask = NULL;
- ext->confineTo = None;
- ext->cursor = None;
- } else
- ext = GRABEXT(grab);
- if ((grab->keybut == AnyKey) && (grab->modifiers != AnyModifier))
- {
- /*
- * If the list entry has the key detail of AnyKey, and
- * a modifier detail not set to AnyModifier, then we
- * simply need to turn off the key detail bit in the
- * list entry's key detail mask.
- */
- DeleteDetailFromMask(&ext->pKeyButMask, pMinuendGrab->keybut);
- } else if ((grab->modifiers == AnyModifier) &&
- (grab->keybut != AnyKey)) {
- /*
- * The list entry has a specific key detail, but its
- * modifier detail is set to AnyModifier; so, we only
- * need to turn off the specified modifier combination
- * in the list entry's modifier mask.
- */
- DeleteDetailFromMask(&ext->pModifiersMask,
- pMinuendGrab->modifiers);
- } else if ((pMinuendGrab->keybut != AnyKey) &&
- (pMinuendGrab->modifiers != AnyModifier)) {
- /*
- * The list entry has a key detail of AnyKey and a
- * modifier detail of AnyModifier; the entry being
- * deleted has a specific key and a specific modifier
- * combination. Therefore, we need to mask off the
- * keycode from the list entry, and also create a
- * new entry for this keycode, which has a modifier
- * mask set to AnyModifier & ~(deleted modifiers).
- */
- XtServerGrabPtr pNewGrab;
-
- DeleteDetailFromMask(&ext->pKeyButMask, pMinuendGrab->keybut);
- pNewGrab = CreateGrab(grab->widget,
- (Boolean)grab->ownerEvents,
- (Modifiers)AnyModifier,
- pMinuendGrab->keybut,
- (int)grab->pointerMode,
- (int)grab->keyboardMode,
- (Mask)0, (Window)0, (Cursor)0, True);
- GRABEXT(pNewGrab)->pModifiersMask =
- CopyDetailMask(ext->pModifiersMask);
-
- DeleteDetailFromMask(&GRABEXT(pNewGrab)->pModifiersMask,
- pMinuendGrab->modifiers);
-
- pNewGrab->next = *passiveListPtr;
- *passiveListPtr = pNewGrab;
- } else if (pMinuendGrab->keybut == AnyKey) {
- /*
- * The list entry has keycode AnyKey and modifier
- * AnyModifier; the entry being deleted has
- * keycode AnyKey and specific modifiers. So we
- * simply need to mask off the specified modifier
- * combination.
- */
- DeleteDetailFromMask(&ext->pModifiersMask,
- pMinuendGrab->modifiers);
- } else {
- /*
- * The list entry has keycode AnyKey and modifier
- * AnyModifier; the entry being deleted has a
- * specific keycode and modifier AnyModifier. So
- * we simply need to mask off the specified
- * keycode.
- */
- DeleteDetailFromMask(&ext->pKeyButMask, pMinuendGrab->keybut);
- }
- }
- next = &(*next)->next;
- }
-}
-
-static void DestroyPassiveList(passiveListPtr)
- XtServerGrabPtr *passiveListPtr;
-{
- XtServerGrabPtr next, grab;
-
- for (next = *passiveListPtr; next; ) {
- grab = next;
- next = grab->next;
-
- /* not necessary to explicitly ungrab key or button;
- * window is being destroyed so server will take care of it.
- */
-
- FreeGrab(grab);
- }
-}
-
-
-/*
- * This function is called at widget destroy time to clean up
- */
-/*ARGSUSED*/
-void _XtDestroyServerGrabs(w, closure, call_data)
- Widget w;
- XtPointer closure;
- XtPointer call_data; /* unused */
-{
- XtPerWidgetInput pwi = (XtPerWidgetInput)closure;
- XtPerDisplayInput pdi;
-
- LOCK_PROCESS;
- pdi = _XtGetPerDisplayInput(XtDisplay(w));
- _XtClearAncestorCache(w);
- UNLOCK_PROCESS;
-
- /* Remove the active grab, if necessary */
- if ((pdi->keyboard.grabType != XtNoServerGrab) &&
- (pdi->keyboard.grab.widget == w)) {
- pdi->keyboard.grabType = XtNoServerGrab;
- pdi->activatingKey = (KeyCode)0;
- }
- if ((pdi->pointer.grabType != XtNoServerGrab) &&
- (pdi->pointer.grab.widget == w))
- pdi->pointer.grabType = XtNoServerGrab;
-
- DestroyPassiveList(&pwi->keyList);
- DestroyPassiveList(&pwi->ptrList);
-
- _XtFreePerWidgetInput(w, pwi);
-}
-
-/*
- * If the incoming event is on the passive grab list, then activate
- * the grab. The grab will remain in effect until the key is released.
- */
-
-#if NeedFunctionPrototypes
-XtServerGrabPtr _XtCheckServerGrabsOnWidget (
- XEvent *event,
- Widget widget,
- _XtBoolean isKeyboard
- )
-#else
-XtServerGrabPtr _XtCheckServerGrabsOnWidget (event, widget, isKeyboard)
- XEvent *event;
- Widget widget;
- Boolean isKeyboard;
-#endif
-{
- register XtServerGrabPtr grab;
- XtServerGrabRec tempGrab;
- XtServerGrabPtr *passiveListPtr;
- XtPerWidgetInput pwi;
-
- LOCK_PROCESS;
- pwi = _XtGetPerWidgetInput(widget, FALSE);
- UNLOCK_PROCESS;
- if (!pwi)
- return (XtServerGrabPtr)NULL;
- if (isKeyboard)
- passiveListPtr = &pwi->keyList;
- else
- passiveListPtr = &pwi->ptrList;
-
- /*
- * if either there is no entry in the context manager or the entry
- * is empty, or the keyboard is grabed, then no work to be done
- */
- if (!*passiveListPtr)
- return (XtServerGrabPtr)NULL;
-
- /* Take only the lower thirteen bits as modifier state. The X Keyboard
- * Extension may be representing keyboard group state in two upper bits.
- */
- tempGrab.widget = widget;
- tempGrab.keybut = event->xkey.keycode; /* also xbutton.button */
- tempGrab.modifiers = event->xkey.state & 0x1FFF; /*also xbutton.state*/
- tempGrab.hasExt = False;
-
- for (grab = *passiveListPtr; grab; grab = grab->next) {
- if (GrabMatchesSecond(&tempGrab, grab))
- return (grab);
- }
- return (XtServerGrabPtr)NULL;
-}
-
-/*
- * This handler is needed to guarantee that we see releases on passive
- * button grabs for widgets that haven't selected for button release.
- */
-
-/*ARGSUSED*/
-static void ActiveHandler (widget, pdi, event, cont)
- Widget widget;
- XtPointer pdi;
- XEvent *event;
- Boolean *cont;
-{
- /* nothing */
-}
-
-
-/*
- * MakeGrab
- */
-static void MakeGrab(grab, passiveListPtr, isKeyboard, pdi, pwi)
- XtServerGrabPtr grab;
- XtServerGrabPtr *passiveListPtr;
- Boolean isKeyboard;
- XtPerDisplayInput pdi;
- XtPerWidgetInput pwi;
-{
- if (!isKeyboard && !pwi->active_handler_added) {
- XtAddEventHandler(grab->widget, ButtonReleaseMask, FALSE,
- ActiveHandler, (XtPointer)pdi);
- pwi->active_handler_added = TRUE;
- }
-
- if (isKeyboard) {
- XGrabKey(pDisplay(grab),
- grab->keybut, grab->modifiers,
- pWindow(grab), grab->ownerEvents,
- grab->pointerMode, grab->keyboardMode);
- } else {
- Window confineTo = None;
- Cursor cursor = None;
-
- if (grab->hasExt) {
- if (grab->confineToIsWidgetWin)
- confineTo = XtWindow (grab->widget);
- else
- confineTo = GRABEXT(grab)->confineTo;
- cursor = GRABEXT(grab)->cursor;
- }
- XGrabButton(pDisplay(grab),
- grab->keybut, grab->modifiers,
- pWindow(grab), grab->ownerEvents, grab->eventMask,
- grab->pointerMode, grab->keyboardMode,
- confineTo, cursor);
- }
-
- /* Add the new grab entry to the passive key grab list */
- grab->next = *passiveListPtr;
- *passiveListPtr = grab;
-}
-
-static void MakeGrabs(passiveListPtr, isKeyboard, pdi)
- XtServerGrabPtr *passiveListPtr;
- Boolean isKeyboard;
- XtPerDisplayInput pdi;
-{
- XtServerGrabPtr next = *passiveListPtr;
- XtServerGrabPtr grab;
- XtPerWidgetInput pwi;
- /*
- * make MakeGrab build a new list that has had the merge
- * processing done on it. Start with an empty list
- * (passiveListPtr).
- */
- LOCK_PROCESS;
- *passiveListPtr = NULL;
- while (next)
- {
- grab = next;
- next = grab->next;
- pwi = _XtGetPerWidgetInput(grab->widget, FALSE);
- MakeGrab(grab, passiveListPtr, isKeyboard, pdi, pwi);
- }
- UNLOCK_PROCESS;
-}
-
-/*
- * This function is the event handler attached to the associated widget
- * when grabs need to be added, but the widget is not yet realized. When
- * it is first mapped, this handler will be invoked, and it will add all
- * needed grabs.
- */
-
-/*ARGSUSED*/
-static void RealizeHandler (widget, closure, event, cont)
- Widget widget;
- XtPointer closure;
- XEvent *event; /* unused */
- Boolean *cont; /* unused */
-{
- XtPerWidgetInput pwi = (XtPerWidgetInput)closure;
- XtPerDisplayInput pdi;
-
- LOCK_PROCESS;
- pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- UNLOCK_PROCESS;
- MakeGrabs(&pwi->keyList, KEYBOARD, pdi);
- MakeGrabs(&pwi->ptrList, POINTER, pdi);
-
- XtRemoveEventHandler(widget, XtAllEvents, True,
- RealizeHandler, (XtPointer)pwi);
- pwi->realize_handler_added = FALSE;
-}
-
-/***************************************************************************/
-/**************************** Global Routines ******************************/
-/***************************************************************************/
-
-
-/*
- * Routine used by an application to set up a passive grab for a key/modifier
- * combination.
- */
-
-static
-void GrabKeyOrButton (widget, keyOrButton, modifiers, owner_events,
- pointer_mode, keyboard_mode, event_mask,
- confine_to, cursor, isKeyboard)
- Widget widget;
- KeyCode keyOrButton;
- Modifiers modifiers;
- Boolean owner_events;
- int pointer_mode;
- int keyboard_mode;
- Mask event_mask;
- Window confine_to;
- Cursor cursor;
- Boolean isKeyboard;
-{
- XtServerGrabPtr *passiveListPtr;
- XtServerGrabPtr newGrab;
- XtPerWidgetInput pwi;
- XtPerDisplayInput pdi;
-
-
- XtCheckSubclass(widget, coreWidgetClass, "in XtGrabKey or XtGrabButton");
- LOCK_PROCESS;
- pwi = _XtGetPerWidgetInput(widget, TRUE);
- if (isKeyboard)
- passiveListPtr = &pwi->keyList;
- else
- passiveListPtr = &pwi->ptrList;
- pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- UNLOCK_PROCESS;
- newGrab = CreateGrab(widget, owner_events, modifiers,
- keyOrButton, pointer_mode, keyboard_mode,
- event_mask, confine_to, cursor, False);
- /*
- * if the widget is realized then process the entry into the grab
- * list. else if the list is empty (i.e. first time) then add the
- * event handler. then add the raw entry to the list for processing
- * in the handler at realize time.
- */
- if (XtIsRealized(widget))
- MakeGrab(newGrab, passiveListPtr, isKeyboard, pdi, pwi);
- else {
- if (!pwi->realize_handler_added)
- {
- XtAddEventHandler(widget, StructureNotifyMask, FALSE,
- RealizeHandler,
- (XtPointer)pwi);
- pwi->realize_handler_added = TRUE;
- }
-
- while (*passiveListPtr)
- passiveListPtr = &(*passiveListPtr)->next;
- *passiveListPtr = newGrab;
- }
-}
-
-
-static
-void UngrabKeyOrButton (widget, keyOrButton, modifiers, isKeyboard)
- Widget widget;
- int keyOrButton;
- Modifiers modifiers;
- Boolean isKeyboard;
-{
- XtServerGrabRec tempGrab;
- XtPerWidgetInput pwi;
-
- XtCheckSubclass(widget, coreWidgetClass,
- "in XtUngrabKey or XtUngrabButton");
-
- /* Build a temporary grab list entry */
- tempGrab.widget = widget;
- tempGrab.modifiers = modifiers;
- tempGrab.keybut = keyOrButton;
- tempGrab.hasExt = False;
-
- LOCK_PROCESS;
- pwi = _XtGetPerWidgetInput(widget, FALSE);
- UNLOCK_PROCESS;
- /*
- * if there is no entry in the context manager then somethings wrong
- */
- if (!pwi)
- {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidGrab", "ungrabKeyOrButton", XtCXtToolkitError,
- "Attempt to remove nonexistent passive grab",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
-
- if (XtIsRealized(widget))
- {
- if (isKeyboard)
- XUngrabKey(widget->core.screen->display,
- keyOrButton, (unsigned int)modifiers,
- widget->core.window);
- else
- XUngrabButton(widget->core.screen->display,
- keyOrButton, (unsigned int)modifiers,
- widget->core.window);
- }
-
-
- /* Delete all entries which are encompassed by the specified grab. */
- DeleteServerGrabFromList(isKeyboard ? &pwi->keyList : &pwi->ptrList,
- &tempGrab);
-}
-
-#if NeedFunctionPrototypes
-void XtGrabKey (
- Widget widget,
- _XtKeyCode keycode,
- Modifiers modifiers,
- _XtBoolean owner_events,
- int pointer_mode,
- int keyboard_mode
- )
-#else
-void XtGrabKey (widget, keycode, modifiers, owner_events,
- pointer_mode, keyboard_mode)
- Widget widget;
- KeyCode keycode;
- Modifiers modifiers;
- Boolean owner_events;
- int pointer_mode;
- int keyboard_mode;
-#endif
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- GrabKeyOrButton(widget, (KeyCode)keycode, modifiers, owner_events,
- pointer_mode, keyboard_mode,
- (Mask)0, (Window)None, (Cursor)None, KEYBOARD);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtGrabButton(
- Widget widget,
- int button,
- Modifiers modifiers,
- _XtBoolean owner_events,
- unsigned int event_mask,
- int pointer_mode,
- int keyboard_mode,
- Window confine_to,
- Cursor cursor
- )
-#else
-void XtGrabButton(widget, button, modifiers, owner_events,
- event_mask, pointer_mode, keyboard_mode,
- confine_to, cursor)
- Widget widget;
- int button;
- Modifiers modifiers;
- Boolean owner_events;
- unsigned int event_mask;
- int pointer_mode;
- int keyboard_mode;
- Window confine_to;
- Cursor cursor;
-#endif
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- GrabKeyOrButton(widget, (KeyCode)button, modifiers, owner_events,
- pointer_mode, keyboard_mode,
- (Mask)event_mask, confine_to, cursor, POINTER);
- UNLOCK_APP(app);
-}
-
-
-/*
- * Routine used by an application to clear a passive grab for a key/modifier
- * combination.
- */
-
-#if NeedFunctionPrototypes
-void XtUngrabKey (
- Widget widget,
- _XtKeyCode keycode,
- Modifiers modifiers
- )
-#else
-void XtUngrabKey (widget, keycode, modifiers)
- Widget widget;
- KeyCode keycode;
- Modifiers modifiers;
-#endif
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- UngrabKeyOrButton(widget, (int)keycode, modifiers, KEYBOARD);
- UNLOCK_APP(app);
-}
-
-void XtUngrabButton (widget, button, modifiers)
- Widget widget;
- unsigned int button;
- Modifiers modifiers;
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- UngrabKeyOrButton(widget, (KeyCode)button, modifiers, POINTER);
- UNLOCK_APP(app);
-}
-
-/*
- * Active grab of Device. clear any client side grabs so we dont lock
- */
-static int GrabDevice (widget, owner_events,
- pointer_mode, keyboard_mode,
- event_mask, confine_to, cursor, time, isKeyboard)
- Widget widget;
- Boolean owner_events;
- int pointer_mode;
- int keyboard_mode;
- Mask event_mask;
- Window confine_to;
- Cursor cursor;
- Time time;
- Boolean isKeyboard;
-{
- XtPerDisplayInput pdi;
- int returnVal;
-
- XtCheckSubclass(widget, coreWidgetClass,
- "in XtGrabKeyboard or XtGrabPointer");
- if (!XtIsRealized(widget))
- return GrabNotViewable;
- LOCK_PROCESS;
- pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- UNLOCK_PROCESS;
- if (!isKeyboard)
- returnVal = XGrabPointer(XtDisplay(widget), XtWindow(widget),
- owner_events, event_mask,
- pointer_mode, keyboard_mode,
- confine_to, cursor, time);
- else
- returnVal = XGrabKeyboard(XtDisplay(widget), XtWindow(widget),
- owner_events, pointer_mode,
- keyboard_mode, time);
-
- if (returnVal == GrabSuccess) {
- XtDevice device;
-
- device = isKeyboard ? &pdi->keyboard : &pdi->pointer;
- /* fill in the server grab rec */
- device->grab.widget = widget;
- device->grab.modifiers = 0;
- device->grab.keybut = 0;
- device->grab.ownerEvents = owner_events;
- device->grab.pointerMode = pointer_mode;
- device->grab.keyboardMode = keyboard_mode;
- device->grab.hasExt = False;
- device->grabType = XtActiveServerGrab;
- pdi->activatingKey = (KeyCode)0;
- }
- return returnVal;
-}
-
-static void UngrabDevice(widget, time, isKeyboard)
- Widget widget;
- Time time;
- Boolean isKeyboard;
-{
- XtPerDisplayInput pdi;
- XtDevice device;
-
- LOCK_PROCESS;
- pdi = _XtGetPerDisplayInput(XtDisplay(widget));
- UNLOCK_PROCESS;
- device = isKeyboard ? &pdi->keyboard : &pdi->pointer;
- XtCheckSubclass(widget, coreWidgetClass,
- "in XtUngrabKeyboard or XtUngrabPointer");
-
- if (device->grabType != XtNoServerGrab) {
-
- if (device->grabType != XtPseudoPassiveServerGrab
- && XtIsRealized(widget)) {
- if (isKeyboard)
- XUngrabKeyboard(XtDisplay(widget), time);
- else
- XUngrabPointer(XtDisplay(widget), time);
- }
- device->grabType = XtNoServerGrab;
- pdi->activatingKey = (KeyCode)0;
- }
-}
-
-
-/*
- * Active grab of keyboard. clear any client side grabs so we dont lock
- */
-#if NeedFunctionPrototypes
-int XtGrabKeyboard (
- Widget widget,
- _XtBoolean owner_events,
- int pointer_mode,
- int keyboard_mode,
- Time time
- )
-#else
-int XtGrabKeyboard (widget, owner_events,
- pointer_mode, keyboard_mode, time)
- Widget widget;
- Boolean owner_events;
- int pointer_mode;
- int keyboard_mode;
- Time time;
-#endif
-{
- int retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- retval = GrabDevice (widget, owner_events,
- pointer_mode, keyboard_mode,
- (Mask)0, (Window)None, (Cursor)None, time, KEYBOARD);
- UNLOCK_APP(app);
- return retval;
-}
-
-
-/*
- * Ungrab the keyboard
- */
-
-void XtUngrabKeyboard(widget, time)
- Widget widget;
- Time time;
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- UngrabDevice(widget, time, KEYBOARD);
- UNLOCK_APP(app);
-}
-
-
-
-
-/*
- * grab the pointer
- */
-#if NeedFunctionPrototypes
-int XtGrabPointer (
- Widget widget,
- _XtBoolean owner_events,
- unsigned int event_mask,
- int pointer_mode,
- int keyboard_mode,
- Window confine_to,
- Cursor cursor,
- Time time
- )
-#else
-int XtGrabPointer (widget, owner_events, event_mask,
- pointer_mode, keyboard_mode,
- confine_to, cursor, time)
- Widget widget;
- Boolean owner_events;
- unsigned int event_mask;
- int pointer_mode;
- int keyboard_mode;
- Window confine_to;
- Cursor cursor;
- Time time;
-#endif
-{
- int retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- retval = GrabDevice (widget, owner_events,
- pointer_mode, keyboard_mode,
- (Mask)event_mask, confine_to,
- cursor, time, POINTER);
- UNLOCK_APP(app);
- return retval;
-}
-
-
-/*
- * Ungrab the pointer
- */
-
-void XtUngrabPointer(widget, time)
- Widget widget;
- Time time;
-{
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- UngrabDevice(widget, time, POINTER);
- UNLOCK_APP(app);
-}
-
-
-void _XtRegisterPassiveGrabs (widget)
- Widget widget;
-{
- XtPerWidgetInput pwi = _XtGetPerWidgetInput (widget, FALSE);
-
- if (pwi != NULL && !pwi->realize_handler_added) {
- XtAddEventHandler(widget, StructureNotifyMask, FALSE,
- RealizeHandler,
- (XtPointer)pwi);
- pwi->realize_handler_added = TRUE;
- }
-}
-
diff --git a/xc/lib/Xt/Pointer.c b/xc/lib/Xt/Pointer.c
deleted file mode 100644
index 7ba9a30bb..000000000
--- a/xc/lib/Xt/Pointer.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* $TOG: Pointer.c /main/6 1998/02/06 13:24:44 kaleb $ */
-
-/********************************************************
-
-Copyright 1988 by Hewlett-Packard Company
-Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard
-
-Permission to use, copy, modify, and distribute this software
-and its documentation for any purpose and without fee is hereby
-granted, provided that the 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, 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.
-
-*/
-
-#include "IntrinsicI.h"
-#include "PassivGraI.h"
-
-
-#define AllButtonsMask (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask)
-
-Widget _XtProcessPointerEvent(event, widget, pdi)
- XButtonEvent *event;
- Widget widget;
- XtPerDisplayInput pdi;
-{
- XtDevice device = &pdi->pointer;
- XtServerGrabPtr newGrab = NULL, devGrab = &device->grab;
- Widget dspWidget = NULL;
- Boolean deactivateGrab = FALSE;
-
- switch (event->type)
- {
- case ButtonPress:
- {
- if (!IsServerGrab(device->grabType))
- {
- Cardinal i;
-
- for (i = pdi->traceDepth;
- i > 0 && !newGrab;
- i--)
- newGrab = _XtCheckServerGrabsOnWidget((XEvent*)event,
- pdi->trace[i-1],
- POINTER);
- }
- if (newGrab)
- {
- /* Activate the grab */
- device->grab = *newGrab;
- device->grabType = XtPassiveServerGrab;
- }
- }
- break;
-
- case ButtonRelease:
- {
- if ((device->grabType == XtPassiveServerGrab) &&
- !(event->state & ~(Button1Mask << (event->button - 1)) &
- AllButtonsMask))
- deactivateGrab = TRUE;
- }
- break;
- }
-
- if (IsServerGrab(device->grabType) && !(devGrab)->ownerEvents)
- dspWidget = (devGrab)->widget;
- else
- dspWidget = widget;
-
- if (deactivateGrab)
- device->grabType = XtNoServerGrab;
-
- return dspWidget;
-}
diff --git a/xc/lib/Xt/Popup.c b/xc/lib/Xt/Popup.c
deleted file mode 100644
index 896db6702..000000000
--- a/xc/lib/Xt/Popup.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/* $TOG: Popup.c /main/29 1998/05/11 14:35:39 barstow $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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 "IntrinsicI.h"
-#include "ShellP.h"
-
-#if NeedFunctionPrototypes
-void _XtPopup(
- Widget widget,
- XtGrabKind grab_kind,
- _XtBoolean spring_loaded
- )
-#else
-void _XtPopup(widget, grab_kind, spring_loaded)
- Widget widget;
- XtGrabKind grab_kind;
- Boolean spring_loaded;
-#endif
-{
- register ShellWidget shell_widget = (ShellWidget) widget;
-
- if (! XtIsShell(widget)) {
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "invalidClass","xtPopup",XtCXtToolkitError,
- "XtPopup requires a subclass of shellWidgetClass",
- (String *)NULL, (Cardinal *)NULL);
- }
-
- if (! shell_widget->shell.popped_up) {
- XtGrabKind call_data = grab_kind;
- XtCallCallbacks(widget, XtNpopupCallback, (XtPointer)&call_data);
- shell_widget->shell.popped_up = TRUE;
- shell_widget->shell.grab_kind = grab_kind;
- shell_widget->shell.spring_loaded = spring_loaded;
- if (shell_widget->shell.create_popup_child_proc != NULL) {
- (*(shell_widget->shell.create_popup_child_proc))(widget);
- }
- if (grab_kind == XtGrabExclusive) {
- XtAddGrab(widget, TRUE, spring_loaded);
- } else if (grab_kind == XtGrabNonexclusive) {
- XtAddGrab(widget, FALSE, spring_loaded);
- }
- XtRealizeWidget(widget);
- XMapRaised(XtDisplay(widget), XtWindow(widget));
- } else
- XRaiseWindow(XtDisplay(widget), XtWindow(widget));
-
-} /* _XtPopup */
-
-#if NeedFunctionPrototypes
-void XtPopup (Widget widget, XtGrabKind grab_kind)
-#else
-void XtPopup (widget, grab_kind)
- Widget widget;
- XtGrabKind grab_kind;
-#endif
-{
- Widget hookobj;
-
- switch (grab_kind) {
-
- case XtGrabNone:
- case XtGrabExclusive:
- case XtGrabNonexclusive:
- break;
-
- default:
- XtAppWarningMsg(
- XtWidgetToApplicationContext(widget),
- "invalidGrabKind","xtPopup",XtCXtToolkitError,
- "grab kind argument has invalid value; XtGrabNone assumed",
- (String *)NULL, (Cardinal *)NULL);
- grab_kind = XtGrabNone;
- }
-
- _XtPopup(widget, grab_kind, FALSE);
-
- hookobj = XtHooksOfDisplay(XtDisplay(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHpopup;
- call_data.widget = widget;
- call_data.event_data = (XtPointer)grab_kind;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-} /* XtPopup */
-
-void XtPopupSpringLoaded (widget)
- Widget widget;
-{
- Widget hookobj;
-
- _XtPopup(widget, XtGrabExclusive, True);
-
- hookobj = XtHooksOfDisplay(XtDisplay(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHpopupSpringLoaded;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-}
-
-void XtPopdown(widget)
- Widget widget;
-{
- /* Unmap a shell widget if it is mapped, and remove from grab list */
- Widget hookobj;
- ShellWidget shell_widget = (ShellWidget) widget;
- XtGrabKind grab_kind;
-
- if (! XtIsShell(widget)) {
- XtAppErrorMsg(XtWidgetToApplicationContext(widget),
- "invalidClass","xtPopdown",XtCXtToolkitError,
- "XtPopdown requires a subclass of shellWidgetClass",
- (String *)NULL, (Cardinal *)NULL);
- }
-
-#ifndef X_NO_XT_POPDOWN_CONFORMANCE
- if (!shell_widget->shell.popped_up)
- return;
-#endif
-
- grab_kind = shell_widget->shell.grab_kind;
- XWithdrawWindow(XtDisplay(widget), XtWindow(widget),
- XScreenNumberOfScreen(XtScreen(widget)));
- if (grab_kind != XtGrabNone)
- XtRemoveGrab(widget);
- shell_widget->shell.popped_up = FALSE;
- XtCallCallbacks(widget, XtNpopdownCallback, (XtPointer)&grab_kind);
-
- hookobj = XtHooksOfDisplay(XtDisplay(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHpopdown;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-} /* XtPopdown */
-
-/* ARGSUSED */
-void XtCallbackPopdown(widget, closure, call_data)
- Widget widget;
- XtPointer closure;
- XtPointer call_data;
-{
- register XtPopdownID id = (XtPopdownID) closure;
-
- XtPopdown(id->shell_widget);
- if (id->enable_widget != NULL) {
- XtSetSensitive(id->enable_widget, TRUE);
- }
-} /* XtCallbackPopdown */
-
-
-
diff --git a/xc/lib/Xt/PopupCB.c b/xc/lib/Xt/PopupCB.c
deleted file mode 100644
index cc3b527d8..000000000
--- a/xc/lib/Xt/PopupCB.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $TOG: PopupCB.c /main/4 1998/02/06 13:24:49 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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 "IntrinsicI.h"
-
-/* ARGSUSED */
-void XtCallbackNone(widget, closure, call_data)
- Widget widget;
- XtPointer closure;
- XtPointer call_data;
-{
- XtSetSensitive(widget, FALSE);
- _XtPopup((Widget) closure, XtGrabNone, FALSE);
-} /* XtCallbackNone */
-
-/* ARGSUSED */
-void XtCallbackNonexclusive(widget, closure, call_data)
- Widget widget;
- XtPointer closure;
- XtPointer call_data;
-{
-
- XtSetSensitive(widget, FALSE);
- _XtPopup((Widget) closure, XtGrabNonexclusive, FALSE);
-} /* XtCallbackNonexclusive */
-
-/* ARGSUSED */
-void XtCallbackExclusive(widget, closure, call_data)
- Widget widget;
- XtPointer closure;
- XtPointer call_data;
-{
- XtSetSensitive(widget, FALSE);
- _XtPopup((Widget) closure, XtGrabExclusive, FALSE);
-} /* XtCallbackExclusive */
diff --git a/xc/lib/Xt/RectObj.c b/xc/lib/Xt/RectObj.c
deleted file mode 100644
index dcb8b0dea..000000000
--- a/xc/lib/Xt/RectObj.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/* $TOG: RectObj.c /main/16 1998/02/06 13:25:04 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#define RECTOBJ
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-/******************************************************************
- *
- * Rectangle Object Resources
- *
- ******************************************************************/
-
-static void XtCopyAncestorSensitive();
-
-static XtResource resources[] = {
-
- {XtNancestorSensitive, XtCSensitive, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(RectObjRec,rectangle.ancestor_sensitive),XtRCallProc,
- (XtPointer)XtCopyAncestorSensitive},
- {XtNx, XtCPosition, XtRPosition, sizeof(Position),
- XtOffsetOf(RectObjRec,rectangle.x), XtRImmediate, (XtPointer)0},
- {XtNy, XtCPosition, XtRPosition, sizeof(Position),
- XtOffsetOf(RectObjRec,rectangle.y), XtRImmediate, (XtPointer)0},
- {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
- XtOffsetOf(RectObjRec,rectangle.width), XtRImmediate, (XtPointer)0},
- {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension),
- XtOffsetOf(RectObjRec,rectangle.height), XtRImmediate, (XtPointer)0},
- {XtNborderWidth, XtCBorderWidth, XtRDimension, sizeof(Dimension),
- XtOffsetOf(RectObjRec,rectangle.border_width), XtRImmediate,
- (XtPointer)1},
- {XtNsensitive, XtCSensitive, XtRBoolean, sizeof(Boolean),
- XtOffsetOf(RectObjRec,rectangle.sensitive), XtRImmediate,
- (XtPointer)True}
- };
-
-static void RectClassPartInitialize();
-static void RectSetValuesAlmost();
-
-externaldef(rectobjclassrec) RectObjClassRec rectObjClassRec = {
- {
- /* superclass */ (WidgetClass)&objectClassRec,
- /* class_name */ "Rect",
- /* widget_size */ sizeof(RectObjRec),
- /* class_initialize */ NULL,
- /* class_part_initialize*/ RectClassPartInitialize,
- /* class_inited */ FALSE,
- /* initialize */ NULL,
- /* initialize_hook */ NULL,
- /* realize */ NULL,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ NULL,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ RectSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback_offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- }
-};
-
-externaldef(rectObjClass)
-WidgetClass rectObjClass = (WidgetClass)&rectObjClassRec;
-
-/*ARGSUSED*/
-static void XtCopyAncestorSensitive(widget, offset, value)
- Widget widget;
- int offset;
- XrmValue *value;
-{
- static Boolean sensitive;
- Widget parent = widget->core.parent;
-
- sensitive = (parent->core.ancestor_sensitive & parent->core.sensitive);
- value->addr = (XPointer)(&sensitive);
-}
-
-
-/*
- * Start of rectangle object methods
- */
-
-
-static void RectClassPartInitialize(wc)
- register WidgetClass wc;
-{
- register RectObjClass roc = (RectObjClass)wc;
- register RectObjClass super = ((RectObjClass)roc->rect_class.superclass);
-
- /* We don't need to check for null super since we'll get to object
- eventually, and it had better define them! */
-
-
- if (roc->rect_class.resize == XtInheritResize) {
- roc->rect_class.resize = super->rect_class.resize;
- }
-
- if (roc->rect_class.expose == XtInheritExpose) {
- roc->rect_class.expose = super->rect_class.expose;
- }
-
- if (roc->rect_class.set_values_almost == XtInheritSetValuesAlmost) {
- roc->rect_class.set_values_almost = super->rect_class.set_values_almost;
- }
-
-
- if (roc->rect_class.query_geometry == XtInheritQueryGeometry) {
- roc->rect_class.query_geometry = super->rect_class.query_geometry;
- }
-}
-
-/*
- * Why there isn't an Initialize Method:
- *
- * Initialization of the RectObj non-Resource field is done by the
- * intrinsics in _XtCreateWidget in order that the field is initialized
- * for use by converters during instance resource resolution.
- */
-
-/*ARGSUSED*/
-static void RectSetValuesAlmost(old, new, request, reply)
- Widget old;
- Widget new;
- XtWidgetGeometry *request;
- XtWidgetGeometry *reply;
-{
- *request = *reply;
-}
diff --git a/xc/lib/Xt/RectObj.h b/xc/lib/Xt/RectObj.h
deleted file mode 100644
index af2bc631e..000000000
--- a/xc/lib/Xt/RectObj.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $TOG: RectObj.h /main/10 1998/02/06 13:25:09 kaleb $ */
-/* $oHeader: RectObj.h,v 1.2 88/08/18 17:39:17 asente Exp $ */
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtRect_h
-#define _XtRect_h
-
-typedef struct _RectObjRec *RectObj;
-typedef struct _RectObjClassRec *RectObjClass;
-
-#ifndef RECTOBJ
-externalref WidgetClass rectObjClass;
-#endif
-#endif /* _XtRect_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/RectObjP.h b/xc/lib/Xt/RectObjP.h
deleted file mode 100644
index 9a944dbfa..000000000
--- a/xc/lib/Xt/RectObjP.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* $TOG: RectObjP.h /main/14 1998/02/06 13:24:59 kaleb $ */
-/* $oHeader: RectObjP.h,v 1.2 88/08/18 15:55:52 asente Exp $ */
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _Xt_RectObjP_h_
-#define _Xt_RectObjP_h_
-
-#include <X11/RectObj.h>
-#include <X11/ObjectP.h>
-
-/**********************************************************
- * Rectangle Object Instance Data Structures
- *
- **********************************************************/
-/* these fields match CorePart and can not be changed */
-
-typedef struct _RectObjPart {
- Position x, y; /* rectangle position */
- Dimension width, height; /* rectangle dimensions */
- Dimension border_width; /* rectangle border width */
- Boolean managed; /* is widget geometry managed? */
- Boolean sensitive; /* is widget sensitive to user events*/
- Boolean ancestor_sensitive; /* are all ancestors sensitive? */
-}RectObjPart;
-
-typedef struct _RectObjRec {
- ObjectPart object;
- RectObjPart rectangle;
-} RectObjRec;
-
-
-
-/********************************************************
- * Rectangle Object Class Data Structures
- *
- ********************************************************/
-/* these fields match CoreClassPart and can not be changed */
-/* ideally these structures would only contain the fields required;
- but because the CoreClassPart cannot be changed at this late date
- extraneous fields are necessary to make the field offsets match */
-
-typedef struct _RectObjClassPart {
-
- WidgetClass superclass; /* pointer to superclass ClassRec */
- String class_name; /* widget resource class name */
- Cardinal widget_size; /* size in bytes of widget record */
- XtProc class_initialize; /* class initialization proc */
- XtWidgetClassProc class_part_initialize; /* dynamic initialization */
- XtEnum class_inited; /* has class been initialized? */
- XtInitProc initialize; /* initialize subclass fields */
- XtArgsProc initialize_hook; /* notify that initialize called */
- XtProc rect1; /* NULL */
- XtPointer rect2; /* NULL */
- Cardinal rect3; /* NULL */
- XtResourceList resources; /* resources for subclass fields */
- Cardinal num_resources; /* number of entries in resources */
- XrmClass xrm_class; /* resource class quarkified */
- Boolean rect4; /* NULL */
- XtEnum rect5; /* NULL */
- Boolean rect6; /* NULL */
- Boolean rect7; /* NULL */
- XtWidgetProc destroy; /* free data for subclass pointers */
- XtWidgetProc resize; /* geom manager changed widget size */
- XtExposeProc expose; /* rediplay rectangle */
- XtSetValuesFunc set_values; /* set subclass resource values */
- XtArgsFunc set_values_hook; /* notify that set_values called */
- XtAlmostProc set_values_almost; /* set values almost for geometry */
- XtArgsProc get_values_hook; /* notify that get_values called */
- XtProc rect9; /* NULL */
- XtVersionType version; /* version of intrinsics used */
- XtPointer callback_private; /* list of callback offsets */
- String rect10; /* NULL */
- XtGeometryHandler query_geometry; /* return preferred geometry */
- XtProc rect11; /* NULL */
- XtPointer extension; /* pointer to extension record */
-} RectObjClassPart;
-
-typedef struct _RectObjClassRec {
- RectObjClassPart rect_class;
-} RectObjClassRec;
-
-externalref RectObjClassRec rectObjClassRec;
-
-#endif /*_Xt_RectObjP_h_*/
diff --git a/xc/lib/Xt/ResConfig.c b/xc/lib/Xt/ResConfig.c
deleted file mode 100644
index 0d10439f6..000000000
--- a/xc/lib/Xt/ResConfig.c
+++ /dev/null
@@ -1,1010 +0,0 @@
-/* $TOG: ResConfig.c /main/5 1998/02/06 13:25:19 kaleb $ */
-/*
-
-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.
-
-*/
-/*
- * 1.1 src/gos/2d/XTOP/lib/Xt/custom_proto.c, xtoolkit, gos42G 6/2/92 11:17:42
- *
- * COMPONENT_NAME: XTOOLKIT
- *
- * FUNCTIONS:
- * _XtResourceConfiguationEH
- * _search_widget_tree, _search_child, _locate_children,
- * _get_part, _get_last_part, _match_resource_to_widget,
- * _set_and_search, _apply_values_to_children, _set_resource_values,
- *
- * ORIGINS: 27
- *
- * IBM CONFIDENTIAL -- (IBM Confidential Restricted when
- * combined with the aggregated modules for this product)
- * OBJECT CODE ONLY SOURCE MATERIALS
- * (C) COPYRIGHT International Business Machines Corp. 1992
- * All Rights Reserved
- *
- * US Government Users Restricted Rights - Use, duplication or
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
-
-#include "Intrinsic.h"
-#include "IntrinsicI.h"
-#include "Core.h"
-#include "CoreP.h"
-#include "ShellP.h"
-#include "StringDefs.h"
-#include "ResConfigP.h"
-#include <X11/Xatom.h>
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#define MAX_BUFFER 512
-
-static void _search_child();
-static void _set_and_search();
-static int _locate_children();
-
-#if defined(sun) && !defined(SVR4)
-# define Strtoul(a,b,c) (unsigned long)strtol(a,b,c)
-#else
-# define Strtoul(a,b,c) strtoul(a,b,c)
-#endif
-
-
-/*
- * NAME: _set_resource_values
- *
- * FUNCTION:
- * This function sets the value on the widget. It must first determine
- * if the last part is a valid resource for that widget. (eg.
- * labelString is a valid resource for label but not for bulletin board)
- * It must also add the resource to the application's resource database
- * and then query it out using specific resource strings that it builds
- * from the widget information. This ensures that a customizing tool
- * on-the-fly paradigm is followed: an application that is
- * instantaneously updated should look the same as one that is restarted
- * and uses the .Xdefaults file.
- *
- * PARAMETERS:
- * w the widget to match
- * resource the resource string to be matched
- * value the value to be set
- * last_part the last resource part (e.g. *background)
- *
- * RETURN VALUES: void
- *
- * ERRORS: none
- */
-static void
-_set_resource_values (w, resource, value, last_part)
- Widget w;
- char *resource;
- char *value;
- char *last_part;
-{
- XrmDatabase db = NULL;
- char *resource_name = NULL;
- char *resource_class = NULL;
- char *return_type;
- XrmValue return_value;
- char *resource_value;
- Widget cur = w;
- char *temp;
- XtResourceList resources_return = NULL;
- Cardinal num_resources_return = 0;
- int res_index;
- Boolean found_resource = False;
- Display *dpy;
- XrmDatabase tmp_db;
-
- if (!XtIsWidget (w))
- dpy = XtDisplay (w->core.parent);
- else
- dpy = XtDisplay (w);
- tmp_db = XtDatabase(dpy);
-
- /*
- * get a list of all the valid resources for this widget
- */
- XtGetResourceList (w->core.widget_class,
- &resources_return, &num_resources_return);
-
- /*
- * try to match the last_part of the resource string with
- * a resource in this resource list
- */
- for (res_index=0; res_index<num_resources_return; res_index++) {
- if ((strcmp (last_part,
- resources_return[res_index].resource_name) == 0) ||
- (strcmp (last_part,
- resources_return[res_index].resource_class) == 0)) {
- found_resource = True;
- break;
- }
- }
-
- /*
- * if resource is not a valid resource for this widget
- * or the resource name or class are NULL
- * then exit this function
- */
- if (!found_resource
- || !resources_return[res_index].resource_name
- || !resources_return[res_index].resource_class) {
- XtFree ((char *) resources_return);
- return;
- }
-
- /*
- * build the full resource name and class specifications so
- * that you can query the resource database
- * eg: .app.button1.foreground
- * .App.XmPushButton.Foreground
- */
- while (cur != NULL) {
- /*
- * create resource name string
- */
- if (resource_name) {
- temp = XtMalloc (sizeof(char) *
- (2 + strlen(cur->core.name)
- + strlen(resource_name)));
- sprintf (temp, ".%s%s", cur->core.name, resource_name);
- XtFree (resource_name);
- } else if (!XtIsWidget (cur) || !cur->core.name) {
- cur = XtParent(cur);
- continue;
- } else {
- temp = XtMalloc (sizeof(char) *
- (2 + strlen(cur->core.name)));
- sprintf (temp, ".%s", cur->core.name);
- }
- resource_name = temp;
-
- /*
- * create resource class string
- */
- if ((XtIsTopLevelShell (cur)) && (XtParent (cur) == NULL)) {
- ApplicationShellWidget top =
- (ApplicationShellWidget) (cur);
-
- if (resource_class) {
- temp = XtMalloc (sizeof(char) *
- (2 + strlen(top->application.class)
- + strlen(resource_class)));
- sprintf (temp, ".%s%s",
- top->application.class, resource_class);
- } else {
- temp = XtMalloc (sizeof(char) *
- (2 + strlen(top->application.class)));
- sprintf (temp, ".%s",
- top->application.class);
- }
- } else {
- if (resource_class) {
- temp = XtMalloc (sizeof(char) *
- (2 + strlen(
- cur->core.widget_class->core_class.class_name)
- + strlen(resource_class)));
- sprintf (temp, ".%s%s",
- cur->core.widget_class->core_class.class_name,
- resource_class);
- } else {
- temp = XtMalloc (sizeof(char) *
- (2 + strlen(
- cur->core.widget_class->core_class.class_name)));
- sprintf (temp, ".%s",
- cur->core.widget_class->core_class.class_name);
- }
- }
- if (resource_class != NULL)
- XtFree (resource_class);
- resource_class = temp;
-
- cur = XtParent(cur);
- }
-
- /*
- * add the resource name to the end of the resource name string
- */
- temp = XtMalloc (2 + strlen(resource_name) +
- strlen(resources_return[res_index].resource_name));
- sprintf (temp, "%s.%s", resource_name,
- resources_return[res_index].resource_name);
- if (resource_name != NULL)
- XtFree (resource_name);
- resource_name = temp;
-
- /*
- * add the resource class to the end of the resource class string
- */
- temp = XtMalloc (2 + strlen(resource_class) +
- strlen(resources_return[res_index].resource_class));
- sprintf (temp, "%s.%s", resource_class,
- resources_return[res_index].resource_class);
- if (resource_class != NULL)
- XtFree (resource_class);
- resource_class = temp;
-
-#ifdef DEBUG
- fprintf (stderr, "resource_name = %s\n", resource_name);
- fprintf (stderr, "resource_class = %s\n", resource_class);
-#endif
-
- /*
- * put the resource and its value in a resource database and
- * then query it back out again using the specific name and
- * class resource strings that were built above. This is
- * necessary to maintain a precedence similar to the .Xdefaults
- * file
- */
- XrmPutStringResource (&db, resource, value);
- XrmMergeDatabases (db, &tmp_db);
- XrmGetResource (tmp_db, resource_name, resource_class,
- &return_type, &return_value);
- if (return_type)
- resource_value = XtNewString (return_value.addr);
- else
- resource_value = XtNewString (value);
-
-#ifdef DEBUG
- fprintf (stderr,
- "Apply:\n\twidget = %s\n\tlast_part = %s\n\tvalue = %s\n",
- (w->core.name == NULL) ? "NULL" : w->core.name,
- resources_return[res_index].resource_name,
- resource_value);
-#endif
- /*
- * use XtVaSetValues with XtVaTypedArg to convert the value of
- * type String the the same type as the resource (last_part).
- * Then set the value.
- */
- XtVaSetValues (w,
- XtVaTypedArg, resources_return[res_index].resource_name,
- XtRString, resource_value,
- strlen (resource_value) + 1,
- NULL);
-
- XtFree ((char *) resources_return);
- XtFree (resource_name);
- XtFree (resource_class);
- XtFree (resource_value);
-}
-
-/*
- * NAME: _apply_values_to_children
- *
- * FUNCTION:
- * Once the resource string matches the value must be applied to
- * all children if applicable. (eg. App*Form.background must apply
- * background to all children of the Form widget)
- *
- * PARAMETERS:
- * w the widget to match
- * remainder the part of the resource string left over
- * resource the resource string to be matched
- * value the value to be set
- * last_token the last * or . before the final resoruce part
- * last_part the last resource part (e.g. *background)
- *
- * RETURN VALUES: void
- *
- * ERRORS: none
- */
-static void
-_apply_values_to_children (w, remainder, resource, value, last_token, last_part)
- Widget w;
- char *remainder;
- char *resource;
- char *value;
- char last_token;
- char *last_part;
-{
- int i;
- int num_children;
- Widget *children;
-
- /*
- * Recursively search through the children
- */
- num_children = _locate_children (w, &children);
-
- for (i=0; i<num_children; i++) {
-
-#ifdef DEBUG
- if (XtIsWidget (children[i]) && XtIsWidget (w))
- fprintf (stderr, "searching child %s of parent %s\n",
- children[i]->core.name, w->core.name);
- else
- fprintf (stderr,"searching child (NULL) of parent %s\n",
- w->core.name);
- if (!XtIsWidget (children[i]))
- fprintf (stderr, "children[%d] is NOT a widget\n", i);
- if (!XtIsWidget (w))
- fprintf (stderr, "w is NOT a widget\n");
-#endif
-
- _set_resource_values (children[i], resource, value, last_part);
- _apply_values_to_children (children[i], remainder,
- resource, value, last_token, last_part);
- }
-
- XtFree ((char *)children);
-}
-
-/*
- * NAME: _search_child
- *
- * FUNCTION:
- * descends through each child of the tree
- *
- * PARAMETERS:
- * w the widget whose children are to be searched
- * indx index into the resource string
- * remainder the remaining part of the resource string
- * resource the resource string to be matched
- * value the value to be applied
- * last_token the last * or . before the final resoruce part
- * last_part the last resource part (e.g. *background)
- *
- * RETURN VALUES: none
- *
- * ERRORS: none
- */
-static void
-_search_child (w, indx, remainder, resource, value, last_token, last_part)
- Widget w;
- char *indx;
- char *remainder;
- char *resource;
- char *value;
- char last_token;
- char *last_part;
-{
- int i;
- int num_children;
- Widget *children;
-
- /*
- * Recursively search through the children
- */
- num_children = _locate_children (w, &children);
- for (i=0; i<num_children; i++) {
- _set_and_search (children[i], indx, remainder, resource,
- value, last_token, last_part);
- }
-
- XtFree ((char *)children);
-}
-
-/*
- * NAME: _get_part
- *
- * FUNCTION:
- * This routine will return the token and following part of the resource
- * when given the current index it will update the index accordingly
- *
- * PARAMETERS:
- * remainder the part of the resource string left over
- * indx the index into the resource string
- * part the parsed off part of the resource string
- *
- * RETURN VALUES:
- * char the token (* or . or ?) preceding the resource part
- * indx the index into the resource string
- * part the parsed off part of the resource string
- *
- * ERRORS: none
- */
-/* ARGSUSED */
-static char
-_get_part (remainder, indx, part)
- char *remainder;
- char **indx;
- char **part;
-{
- char buffer[MAX_BUFFER];
- char *buf_ptr;
- char token = **indx;
- int i = 0;
-
- /*
- * copy the remainder part into the buffer
- */
- buf_ptr = buffer;
- (*indx)++; /* get rid of the token */
- while (**indx && (**indx != '.') && (**indx != '*')) {
- *buf_ptr++ = *(*indx)++;
- if (++i >= MAX_BUFFER - 1)
- break;
- }
- *buf_ptr = '\0';
-
- *part = XtNewString (buffer); /* return a new string to part */
-
- if (strcmp (*indx, "") == 0)
- *indx = NULL;
-
- return (token); /* return the token */
-}
-
-/*
- * NAME: _match_resource_to_widget
- *
- * FUNCTION:
- * This function matches the resource part to the widget name or class
- *
- * PARAMETERS:
- * w the widget to match
- * part the parsed off part of the resource string
- *
- * RETURN VALUES:
- * Boolean true if a match occurs
- *
- * ERRORS: none
- */
-static Boolean
-_match_resource_to_widget (w, part)
- Widget w;
- char *part;
-{
- /*
- * Match any widget at this level if the ? is used
- */
- if (strcmp (part, "?") == 0)
- return (True);
-
- /*
- * if the object is really a widget then its name can be matched
- * otherwise only use its class. Note that if you try to reference
- * a widget name when the object is not a widget, you may get a
- * core dump from an invalid pointer reference.
- */
- if (XtIsWidget (w)) {
- if ((strcmp (w->core.name, part) == 0) ||
- (strcmp (w->core.widget_class->core_class.class_name,
- part) == 0))
- return (True);
- else
- return (False);
- } else {
- if ((strcmp (w->core.widget_class->core_class.class_name,
- part) == 0))
- return (True);
- else
- return (False);
- }
-}
-
-/*
- * NAME: _set_and_search
- *
- * FUNCTION:
- * The algorithm to search the widget tree and apply a resource string
- *
- * PARAMETERS:
- * w the widget to match
- * indx the index into the resource string
- * remainder the part of the resource string left over
- * resource the resource string to be matched
- * value the value to be set
- * last_token the last * or . before the final resoruce part
- * last_part the last resource part (e.g. *background)
- *
- * RETURN VALUES: none
- *
- * ERRORS: none
- *
- * ALGORITHM:
- * loop (look at all children)
- * if (resource segment and current widget match)
- * if '.'
- * if at end of resource string
- * set values ( .=over all children
- * *=this widget only)
- * else
- * descend the widget tree
- * and parse off resource segment
- * exit the loop
- * if '*'
- * if at end of resource string
- * set values ( .=over all children
- * *=this widget only)
- * descend and parse
- * else
- * if '.'
- * continue looping
- * if '*'
- * descend but don't parse
- * continue looping
- * end loop
- *
- * NOTE: the _set_resource_values routine will not allow a value to be
- * set on a resource against the rules of the resource database manager
- */
-static void
-_set_and_search (w, indx, remainder, resource, value, last_token, last_part)
- Widget w;
- char *indx;
- char *remainder;
- char *resource;
- char *value;
- char last_token;
- char *last_part;
-{
- char *part;
- char *local_index = indx;
- char token;
-
- /*
- * parse off one part, return token and the new index
- */
- token = _get_part (remainder, &local_index, &part);
-
- if (_match_resource_to_widget (w, part)) {
- if (token == '.') {
- if (local_index == NULL) {
- if (last_token == '.') {
- _set_resource_values (w, resource,
- value, last_part);
- } else if (last_token == '*') {
- _set_resource_values (w, resource,
- value, last_part);
- _apply_values_to_children (w,
- remainder, resource, value,
- last_token, last_part);
- }
- } else
- _search_child (w, local_index, remainder,
- resource, value, last_token, last_part);
- return;
- }
- if (token == '*') {
- if (local_index == NULL) {
- if (last_token == '.') {
- _set_resource_values (w, resource,
- value, last_part);
- } else if (last_token == '*') {
- _set_resource_values (w, resource,
- value, last_part);
- _apply_values_to_children ( w,
- remainder, resource, value,
- last_token, last_part);
- }
- } else
- _search_child (w, local_index, remainder,
- resource, value, last_token, last_part);
- }
- } else {/* if the widget name and class don't match the part */
- /* if (token == '.') just continue looping */
-
- if (token == '*') {
- _search_child (w, indx, remainder, resource, value,
- last_token, last_part);
- }
- }
-
- XtFree (part);
-}
-
-/*
- * NAME: _get_last_part
- *
- * FUNCTION:
- * This routine will parse off the last segment of a resource string
- * and its token and return them. the remainder of resource is also
- * returned. strcoll is used to guarantee no problems with
- * international strings.
- *
- * PARAMETERS:
- * remainder the part of the resource string left over
- * part the parsed off part of the resource string
- *
- * RETURN VALUES:
- * char the token (* or . or ?) preceding the resource part
- * remainder the part of the resource string left over
- * part the parsed off part of the resource string
- *
- * ERRORS: none
- */
-static char
-_get_last_part (remainder, part)
- char *remainder;
- char **part;
-{
- char *loose, *tight;
-
- loose = strrchr (remainder, '*');
- tight = strrchr (remainder, '.');
-
- if ((loose == NULL) && (tight == NULL)) {
- *part = XtNewString (remainder);
- return ('.');
- }
- if ((loose == NULL) || (tight && (strcoll (loose, tight) < 0))) {
- *tight++ = '\0'; /* shorten the remainder string */
- *part = XtNewString (tight);
- return ('.');
- }
- if ((tight == NULL) || (loose && (strcoll (tight, loose) < 0))) {
- *loose++ = '\0';
- *part = XtNewString (loose);
- return ('*');
- }
-
- return ('0'); /* error - return 0 */
-}
-
-/*
- * NAME: _search_widget_tree
- *
- * FUNCTION:
- * This function tries to match a resource string to the widgets
- * it applies to. The functions it invokes to do this then set
- * the value for that resource to each widget.
- *
- * The resource string has to be parsed into the following format:
- * resource = App*Form*button1.background
- * remainder = *Form*button1
- * last_part = background last_token = .
- * As the widget tree is recursively descended, these variables are
- * passed. The remainder is parsed at each level in the widget
- * tree as the _set_and_search function attempts to match
- * the resource part (eg. part = Form token = *) to a widget. When
- * the entire resource string has been matched, the _set_resource_values
- * functions is called to apply the value to the widget or widgets.
- *
- * PARAMETERS:
- * w a widget from whose toplevel shell ancestor
- * the search will start
- * resource the resource string to match
- * value the value to apply
- *
- * RETURN VALUES: none
- *
- * ERRORS: none
- */
-static void
-_search_widget_tree (w, resource, value)
- Widget w;
- char *resource;
- char *value;
-{
- Widget parent = w;
- char *last_part;
- char *remainder;
- char last_token;
- char *indx, *copy;
- char *loose, *tight;
- int loose_len, tight_len;
-
- /*
- * Find the root of the tree given any widget
- */
- while (XtParent(parent) != NULL) {
- parent = XtParent(parent);
- }
-#ifdef DEBUG
- if (XtIsWidget (w) && XtIsWidget (parent))
- fprintf (stderr, "widget = %s parent = %s\n",
- w->core.name, parent->core.name);
- else
- fprintf (stderr, "widget = NULL parent = NULL\n");
-#endif
-
- /*
- * parse off the Class name that was prepended to this string in
- * a customizing tool
- */
- loose = strchr (resource, '*');
- tight = strchr (resource, '.');
- if ((loose == NULL) && (tight == NULL))
- return;
-
- loose_len = (loose) ? strlen (loose) : 0;
- tight_len = (tight) ? strlen (tight) : 0;
-
- if ((loose == NULL) || (tight_len > loose_len))
- remainder = XtNewString (tight);
- else if ((tight == NULL) || (loose_len > tight_len))
- remainder = XtNewString (loose);
-
- /*
- * Parse last segment off of resource string, (eg. background, font,
- * etc.)
- */
- last_token = _get_last_part (remainder, &last_part);
- /*
- * this case covers resources of only one level (eg. *background)
- */
- if (strcmp (remainder, "") == 0) {
- _set_resource_values (w, resource, value, last_part);
- if (last_token == '*')
- _apply_values_to_children (parent, remainder, resource,
- value, last_token, last_part);
- /*
- * all other resource strings are recursively applied to the widget tree.
- * Prepend a '.' to the remainder string if there is no leading token.
- */
- } else {
- if (remainder[0] != '*' && remainder[0] != '.') {
- copy = XtMalloc (strlen(remainder) + 2);
- sprintf (copy, ".%s", remainder);
- XtFree (remainder);
- remainder = copy;
- }
- indx = remainder;
- _set_and_search (parent, indx, remainder, resource, value,
- last_token, last_part);
- }
-
- XtFree (remainder);
- XtFree (last_part);
-}
-
-/*
- * NAME: _locate_children
- *
- * FUNCTION:
- * returns a list of all of a widget's children
- *
- * PARAMETERS:
- * w the parent to search for its children
- * children the list of children that is created
- * normal flag for normal children
- * popup flag for popup children
- *
- * RETURN VALUES:
- * int the number of children
- * children the list of children found
- *
- * ERRORS: none
- */
-static int
-_locate_children (parent, children)
- Widget parent;
- Widget **children;
-{
- CompositeWidget comp = (CompositeWidget) parent;
- int i;
- int num_children = 0;
- int current = 0;
-
- /*
- * count the number of children
- */
- if (XtIsWidget (parent))
- num_children += parent->core.num_popups;
- if (XtIsComposite (parent))
- num_children += comp->composite.num_children;
- if (num_children == 0) {
- *children = NULL;
- return (0);
- }
-
- *children = (Widget *)
- XtMalloc ((Cardinal) sizeof(Widget) * num_children);
-
- if (XtIsComposite (parent)) {
- for (i=0; i<comp->composite.num_children; i++) {
- (*children)[current] = comp->composite.children[i];
- current++;
- }
- }
-
- if (XtIsWidget (parent)) {
- for (i=0; i<parent->core.num_popups; i++) {
- (*children)[current] = comp->core.popup_list[i];
- current++;
- }
- }
-
- return (num_children);
-}
-
-#ifdef DEBUG
-/*
- * NAME: dump_widget_tree
- *
- * FUNCTION:
- * recursively printout entire widget tree
- *
- * PARAMETERS:
- * w the widget to match
- * indent the amount to indent each line
- *
- * RETURN VALUES: void
- *
- * ERRORS: none
- */
-static void
-dump_widget_tree (w, indent)
- Widget w;
- int indent;
-{
- int i,j;
- int num_children;
- Widget *children;
-
- /*
- * Recursively search through the children
- */
- num_children = _locate_children (w, &children);
- indent += 2;
- for (i=0; i<num_children; i++) {
- if (children[i] != NULL) {
- for (j=0; j<indent; j++)
- fprintf (stderr, " ");
- if (XtIsWidget (children[i])) {
- fprintf (stderr, "(%s)\t",children[i]->core.name);
- fprintf (stderr, "(%s)\n",
- children[i]->core.widget_class->core_class.class_name);
- } else {
- fprintf (stderr, "(NULL)\t");
- fprintf (stderr, "(%s)\n",
- children[i]->core.widget_class->core_class.class_name);
- }
- }
- dump_widget_tree (children[i], indent);
- }
-
- XtFree ((char *)children);
-}
-#endif
-
-/*
- * NAME: _XtResourceConfiguationEH
- *
- * FUNCTION:
- * This function is the event handler for the on-the-fly communication
- * with a resource customization tool. This event handler must be
- * registered for the toplevel shell of each app. This is best done
- * in the _XtCreatePopupShell and _XtAppCreateShell functions in Xt's
- * Create.c source file.
- *
- * The property used to communicate with a customizing tool is
- * placed on the toplevel shell window of the application. The
- * customizing tool places a property on this window which causes
- * this event handler to be invoked via the PropertyNotify event.
- * This event handler reads the property and then deletes it from
- * the server. The contents of the property are a resource string
- * and value. The event handler then calls functions to walk the
- * applications widget tree, determining which widgets are affected
- * by the resource string, and then applying the value with XtSetValues.
- *
- * PARAMETERS:
- * w the widget that invoked this event handler
- * client_data not used
- * event the event structure
- *
- * RETURN VALUES: none
- *
- * ERRORS: none
- */
-/* ARGSUSED */
-void
-_XtResourceConfigurationEH (w, client_data, event)
- Widget w;
- XtPointer client_data;
- XEvent *event;
-{
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long leftover;
- unsigned char *data = NULL;
- unsigned long resource_len;
- char *data_ptr;
- char *resource;
- char *value;
-#ifdef DEBUG
- int indent = 0;
-#endif
- XtPerDisplay pd;
-
-#ifdef DEBUG
- fprintf (stderr, "in _XtResourceConfiguationEH atom = %d\n",event->xproperty.atom);
- fprintf (stderr, " window = %x\n", XtWindow (w));
- if (XtIsWidget (w))
- fprintf (stderr, " widget = %x name = %s\n", w, w->core.name);
-#endif
-
- pd = _XtGetPerDisplay (XtDisplay (w));
-
- /*
- * The window on which a customizing tool places the property
- * is determined at this point. It should be the applications
- * toplevel shell window.
- *
- * A customizing tool sends a "ping" to the application on
- * the RCM_INIT property. The application answers the ping
- * by deleting the property.
- */
- if (event->xproperty.atom == pd->rcm_init) {
- XDeleteProperty (XtDisplay(w), XtWindow (w), pd->rcm_init);
-
-#ifdef DEBUG
- if (XtIsWidget (w))
- fprintf (stderr, "%s\n", w->core.name);
- else
- fprintf (stderr, "NULL name\n");
- dump_widget_tree(w, indent);
-
- fprintf (stderr, "answer ping\n");
-#endif
- }
-
- /*
- * This event handler ignores any property notify events that
- * are not RCM_INIT or RCM_DATA
- */
- if (event->xproperty.atom != pd->rcm_data)
- return;
-
- /*
- * Retrieve the data from the property
- */
-#ifdef DEBUG
- fprintf (stderr, "receiving RCM_DATA property\n");
-#endif
- if (XGetWindowProperty (XtDisplay(w),
- XtWindow (w),
- pd->rcm_data, 0L, 8192L,
- TRUE, XA_STRING,
- &actual_type, &actual_format, &nitems, &leftover,
- &data ) == Success && actual_type == XA_STRING
- && actual_format == 8) {
- /*
- * data format is:
- *
- * resource_length, resource, value
- *
- * convert the resource_length to a long, skip over it, put a
- * zero byte at the end of the resource, and pick off the
- * resource and value fields.
- */
- if (data) {
- resource_len = Strtoul (data, &data_ptr, 10);
- data_ptr++;
-
- data_ptr[resource_len] = '\0';
-
- resource = XtNewString (data_ptr);
- value = XtNewString (&data_ptr[resource_len + 1]);
-#ifdef DEBUG
- fprintf (stderr, "resource_len=%d\n",resource_len);
- fprintf (stderr, "resource = %s\t value = %s\n",
- resource, value);
-#endif
- /*
- * descend the application widget tree and
- * apply the value to the appropriate widgets
- */
- _search_widget_tree (w, resource, value);
-
- XtFree (resource);
- XtFree (value);
- }
- }
-
- if (data)
- XFree ((char *)data);
-}
diff --git a/xc/lib/Xt/ResConfigP.h b/xc/lib/Xt/ResConfigP.h
deleted file mode 100644
index c46db1559..000000000
--- a/xc/lib/Xt/ResConfigP.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $TOG: ResConfigP.h /main/2 1998/02/06 13:25:14 kaleb $ */
-/*
-
-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.
-
-*/
-/*
- * 1.2 src/gos/2d/XTOP/lib/Xt/custom_proto.h, xtoolkit, gos42G 8/12/93 10:35:50
- *
- * COMPONENT_NAME: XTOOLKIT
- *
- * FUNCTIONS:
- *
- * ORIGINS: 27
- *
- * IBM CONFIDENTIAL -- (IBM Confidential Restricted when
- * combined with the aggregated modules for this product)
- * OBJECT CODE ONLY SOURCE MATERIALS
- * (C) COPYRIGHT International Business Machines Corp. 1992
- * All Rights Reserved
- *
- * US Government Users Restricted Rights - Use, duplication or
- * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
-
-#ifndef _RESCONFIGP_H
-#define _RESCONFIGP_H
-
-/*
- * Atom names for resource configuration management customization tool.
- */
-#define RCM_DATA "Custom Data"
-#define RCM_INIT "Custom Init"
-
-extern void _XtResourceConfigurationEH(
-#if NeedFunctionPrototypes
- Widget /* w */,
- XtPointer /* client_data */,
- XEvent * /* event */
-#endif
-);
-
-#endif
diff --git a/xc/lib/Xt/ResourceI.h b/xc/lib/Xt/ResourceI.h
deleted file mode 100644
index 001fcb7ef..000000000
--- a/xc/lib/Xt/ResourceI.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $TOG: ResourceI.h /main/11 1998/02/06 13:25:25 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-/****************************************************************
- *
- * Resources
- *
- ****************************************************************/
-
-#define StringToQuark(string) XrmStringToQuark(string)
-#define StringToName(string) XrmStringToName(string)
-#define StringToClass(string) XrmStringToClass(string)
-
-extern void _XtResourceDependencies(
-#if NeedFunctionPrototypes
- WidgetClass /* wc */
-#endif
-);
-
-extern void _XtConstraintResDependencies(
-#if NeedFunctionPrototypes
- ConstraintWidgetClass /* wc */
-#endif
-);
-
-extern XtCacheRef* _XtGetResources(
-#if NeedFunctionPrototypes
- Widget /* w */,
- ArgList /* args */,
- Cardinal /* num_args */,
- XtTypedArgList /* typed_args */,
- Cardinal* /* num_typed_args */
-#endif
-);
-
-extern void _XtCopyFromParent(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- int /* offset */,
- XrmValue* /* value */
-#endif
-);
diff --git a/xc/lib/Xt/Resources.c b/xc/lib/Xt/Resources.c
deleted file mode 100644
index d10879d23..000000000
--- a/xc/lib/Xt/Resources.c
+++ /dev/null
@@ -1,1292 +0,0 @@
-/* $TOG: Resources.c /main/115 1998/06/19 11:08:11 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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/lib/Xt/Resources.c,v 1.6 1998/12/20 11:57:09 dawes Exp $ */
-
-/*LINTLIBRARY*/
-#include "IntrinsicI.h"
-#include "VarargsI.h"
-#include "Shell.h"
-#include "ShellP.h"
-#include "StringDefs.h"
-#include <stdio.h>
-
-static XrmClass QBoolean, QString, QCallProc, QImmediate;
-static XrmName QinitialResourcesPersistent, QInitialResourcesPersistent;
-static XrmClass QTranslations, QTranslationTable;
-static XrmName Qtranslations, QbaseTranslations;
-static XrmName Qscreen;
-static XrmClass QScreen;
-
-#ifdef CRAY
-void Cjump();
-char *Cjumpp = (char *) Cjump;
-void Cjump() {}
-#endif
-
-void _XtCopyFromParent(widget, offset, value)
- Widget widget;
- int offset;
- XrmValue *value;
-{
- if (widget->core.parent == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidParent","xtCopyFromParent",XtCXtToolkitError,
- "CopyFromParent must have non-NULL parent",
- (String *)NULL, (Cardinal *)NULL);
- value->addr = NULL;
- return;
- }
- value->addr = (XPointer)(((char *)widget->core.parent) + offset);
-} /* _XtCopyFromParent */
-
-
-/* If the alignment characteristics of your machine are right, these may be
- faster */
-
-#ifdef UNALIGNED
-
-void _XtCopyFromArg(src, dst, size)
- XtArgVal src;
- char* dst;
- register unsigned int size;
-{
- if (size == sizeof(long)) *(long *)dst = (long)src;
- else if (size == sizeof(short)) *(short *)dst = (short)src;
- else if (size == sizeof(char)) *(char *)dst = (char)src;
- else if (size == sizeof(XtPointer)) *(XtPointer *)dst = (XtPointer)src;
- else if (size == sizeof(char*)) *(char **)dst = (char*)src;
- else if (size == sizeof(XtArgVal)) *(XtArgVal *)dst = src;
- else if (size > sizeof(XtArgVal))
- (void) memmove((char *) dst, (char *) src, (int) size);
- else
- (void) memmove((char *) dst, (char *) &src, (int) size);
-} /* _XtCopyFromArg */
-
-void _XtCopyToArg(src, dst, size)
- char* src;
- XtArgVal *dst;
- register unsigned int size;
-{
- if (! (*dst)) {
-#ifdef GETVALUES_BUG
- /* old GetValues semantics (storing directly into arglists) are bad,
- * but preserve for compatibility as long as arglist contains NULL.
- */
- if (size == sizeof(long)) *dst = (XtArgVal)*(long*)src;
- else if (size == sizeof(short)) *dst = (XtArgVal)*(short*)src;
- else if (size == sizeof(char)) *dst = (XtArgVal)*(char*)src;
- else if (size == sizeof(XtPointer)) *dst = (XtArgVal)*(XtPointer*)src;
- else if (size == sizeof(char*)) *dst = (XtArgVal)*(char**)src;
- else if (size == sizeof(XtArgVal)) *dst = *(XtArgVal*)src;
- else (void) memmove((char*)dst, (char*)src, (int)size);
-#else
- XtErrorMsg("invalidGetValues", "xtGetValues", XtCXtToolkitError,
- "NULL ArgVal in XtGetValues", (String*) NULL, (Cardinal*) NULL);
-#endif
- }
- else {
- /* proper GetValues semantics: argval is pointer to destination */
- if (size == sizeof(long)) *((long*)*dst) = *(long*)src;
- else if (size == sizeof(short)) *((short*)*dst) = *(short*)src;
- else if (size == sizeof(char)) *((char*)*dst) = *(char*)src;
- else if (size == sizeof(XtPointer)) *((XtPointer*)*dst) = *(XtPointer*)src;
- else if (size == sizeof(char*)) *((char**)*dst) = *(char**)src;
- else if (size == sizeof(XtArgVal)) *((XtArgVal*)*dst)= *(XtArgVal*)src;
- else (void) memmove((char*)*dst, (char*)src, (int)size);
- }
-} /* _XtCopyToArg */
-
-static void CopyToArg(src, dst, size)
- char* src;
- XtArgVal *dst;
- register unsigned int size;
-{
- if (! (*dst)) {
- /* old GetValues semantics (storing directly into arglists) are bad,
- * but preserve for compatibility as long as arglist contains NULL.
- */
- if (size == sizeof(long)) *dst = (XtArgVal)*(long*)src;
- else if (size == sizeof(short)) *dst = (XtArgVal)*(short*)src;
- else if (size == sizeof(char)) *dst = (XtArgVal)*(char*)src;
- else if (size == sizeof(XtPointer)) *dst = (XtArgVal)*(XtPointer*)src;
- else if (size == sizeof(char*)) *dst = (XtArgVal)*(char**)src;
- else if (size == sizeof(XtArgVal)) *dst = *(XtArgVal*)src;
- else (void) memmove((char*)dst, (char*)src, (int)size);
- }
- else {
- /* proper GetValues semantics: argval is pointer to destination */
- if (size == sizeof(long)) *((long*)*dst) = *(long*)src;
- else if (size == sizeof(short)) *((short*)*dst) = *(short*)src;
- else if (size == sizeof(char)) *((char*)*dst) = *(char*)src;
- else if (size == sizeof(XtPointer)) *((XtPointer*)*dst) = *(XtPointer*)src;
- else if (size == sizeof(char*)) *((char**)*dst) = *(char**)src;
- else if (size == sizeof(XtArgVal)) *((XtArgVal*)*dst)= *(XtArgVal*)src;
- else (void) memmove((char*)*dst, (char*)src, (int)size);
- }
-} /* CopyToArg */
-
-#else
-void _XtCopyFromArg(src, dst, size)
- XtArgVal src;
- char* dst;
- register unsigned int size;
-{
- if (size > sizeof(XtArgVal))
- (void) memmove((char *) dst, (char *) src, (int) size);
- else {
- union {
- long longval;
-#ifdef LONG64
- int intval;
-#endif
- short shortval;
- char charval;
- char* charptr;
- XtPointer ptr;
- } u;
- char *p = (char*)&u;
- if (size == sizeof(long)) u.longval = (long)src;
-#ifdef LONG64
- else if (size == sizeof(int)) u.intval = (int)src;
-#endif
- else if (size == sizeof(short)) u.shortval = (short)src;
- else if (size == sizeof(char)) u.charval = (char)src;
- else if (size == sizeof(XtPointer)) u.ptr = (XtPointer)src;
- else if (size == sizeof(char*)) u.charptr = (char*)src;
- else p = (char*)&src;
-
- (void) memmove(dst, p, (int) size);
- }
-} /* _XtCopyFromArg */
-
-void _XtCopyToArg(src, dst, size)
- char* src;
- XtArgVal *dst;
- register unsigned int size;
-{
- if (!*dst) {
-#ifdef GETVALUES_BUG
- /* old GetValues semantics (storing directly into arglists) are bad,
- * but preserve for compatibility as long as arglist contains NULL.
- */
- union {
- long longval;
-#ifdef LONG64
- int intval;
-#endif
- short shortval;
- char charval;
- char* charptr;
- XtPointer ptr;
- } u;
- if (size <= sizeof(XtArgVal)) {
- (void) memmove((char*)&u, (char*)src, (int)size );
- if (size == sizeof(long)) *dst = (XtArgVal)u.longval;
-#ifdef LONG64
- else if (size == sizeof(int)) *dst = (XtArgVal)u.intval;
-#endif
- else if (size == sizeof(short)) *dst = (XtArgVal)u.shortval;
- else if (size == sizeof(char)) *dst = (XtArgVal)u.charval;
- else if (size == sizeof(char*)) *dst = (XtArgVal)u.charptr;
- else if (size == sizeof(XtPointer)) *dst = (XtArgVal)u.ptr;
- else (void) memmove((char*)dst, (char*)src, (int)size );
- }
- else
- (void) memmove((char*)dst, (char*)src, (int)size );
-#else
- XtErrorMsg("invalidGetValues", "xtGetValues", XtCXtToolkitError,
- "NULL ArgVal in XtGetValues", (String*) NULL, (Cardinal*) NULL);
-#endif
- }
- else {
- /* proper GetValues semantics: argval is pointer to destination */
- (void) memmove((char*)*dst, (char*)src, (int)size );
- }
-} /* _XtCopyToArg */
-
-static void CopyToArg(src, dst, size)
- char* src;
- XtArgVal *dst;
- register unsigned int size;
-{
- if (!*dst) {
- /* old GetValues semantics (storing directly into arglists) are bad,
- * but preserve for compatibility as long as arglist contains NULL.
- */
- union {
- long longval;
-#ifdef LONG64
- int intval;
-#endif
- short shortval;
- char charval;
- char* charptr;
- XtPointer ptr;
- } u;
- if (size <= sizeof(XtArgVal)) {
- (void) memmove((char*)&u, (char*)src, (int)size );
- if (size == sizeof(long)) *dst = (XtArgVal)u.longval;
-#ifdef LONG64
- else if (size == sizeof(int)) *dst = (XtArgVal)u.intval;
-#endif
- else if (size == sizeof(short)) *dst = (XtArgVal)u.shortval;
- else if (size == sizeof(char)) *dst = (XtArgVal)u.charval;
- else if (size == sizeof(char*)) *dst = (XtArgVal)u.charptr;
- else if (size == sizeof(XtPointer)) *dst = (XtArgVal)u.ptr;
- else (void) memmove((char*)dst, (char*)src, (int)size );
- }
- else
- (void) memmove((char*)dst, (char*)src, (int)size );
- }
- else {
- /* proper GetValues semantics: argval is pointer to destination */
- (void) memmove((char*)*dst, (char*)src, (int)size );
- }
-} /* CopyToArg */
-
-#endif
-
-static Cardinal CountTreeDepth(w)
- Widget w;
-{
- Cardinal count;
-
- for (count = 1; w != NULL; w = (Widget) w->core.parent)
- count++;
-
- return count;
-}
-
-static void GetNamesAndClasses(w, names, classes)
- register Widget w;
- register XrmNameList names;
- register XrmClassList classes;
-{
- register Cardinal length, j;
- register XrmQuark t;
- WidgetClass class;
-
- /* Return null-terminated quark arrays, with length the number of
- quarks (not including NULL) */
-
- LOCK_PROCESS;
- for (length = 0; w != NULL; w = (Widget) w->core.parent) {
- names[length] = w->core.xrm_name;
- class = XtClass(w);
- /* KLUDGE KLUDGE KLUDGE KLUDGE */
- if (w->core.parent == NULL && XtIsApplicationShell(w)) {
- classes[length] =
- ((ApplicationShellWidget) w)->application.xrm_class;
- } else classes[length] = class->core_class.xrm_class;
- length++;
- }
- UNLOCK_PROCESS;
- /* They're in backwards order, flop them around */
- for (j = 0; j < length/2; j++) {
- t = names[j];
- names[j] = names[length-j-1];
- names[length-j-1] = t;
- t = classes[j];
- classes[j] = classes[length-j-1];
- classes[length-j-1] = t;
- }
- names[length] = NULLQUARK;
- classes[length] = NULLQUARK;
-} /* GetNamesAndClasses */
-
-
-/* Spiffy fast compiled form of resource list. */
-/* XtResourceLists are compiled in-place into XrmResourceLists */
-/* All atoms are replaced by quarks, and offsets are -offset-1 to */
-/* indicate that this list has been compiled already */
-
-void _XtCompileResourceList(resources, num_resources)
- register XtResourceList resources;
- Cardinal num_resources;
-{
- register Cardinal count;
-
-#define xrmres ((XrmResourceList) resources)
-#define PSToQ XrmPermStringToQuark
-
- for (count = 0; count < num_resources; resources++, count++) {
- xrmres->xrm_name = PSToQ(resources->resource_name);
- xrmres->xrm_class = PSToQ(resources->resource_class);
- xrmres->xrm_type = PSToQ(resources->resource_type);
-#if defined(CRAY1) && !defined(__STDC__)
- xrmres->xrm_offset = -(resources->resource_offset * sizeof(long) + 1);
-#else
- xrmres->xrm_offset = (Cardinal)
- (-(int)resources->resource_offset - 1);
-#endif
- xrmres->xrm_default_type = PSToQ(resources->default_type);
- }
-#undef PSToQ
-#undef xrmres
-} /* _XtCompileResourceList */
-
-/* Like _XtCompileResourceList, but strings are not permanent */
-static void XrmCompileResourceListEphem(resources, num_resources)
- register XtResourceList resources;
- Cardinal num_resources;
-{
- register Cardinal count;
-
-#define xrmres ((XrmResourceList) resources)
-
- for (count = 0; count < num_resources; resources++, count++) {
- xrmres->xrm_name = StringToName(resources->resource_name);
- xrmres->xrm_class = StringToClass(resources->resource_class);
- xrmres->xrm_type = StringToQuark(resources->resource_type);
-#if defined(CRAY1) && !defined(__STDC__)
- xrmres->xrm_offset = -(resources->resource_offset * sizeof(long) + 1);
-#else
- xrmres->xrm_offset = (Cardinal)
- (-(int)resources->resource_offset - 1);
-#endif
- xrmres->xrm_default_type = StringToQuark(resources->default_type);
- }
-#undef xrmres
-} /* XrmCompileResourceListEphem */
-
-static void BadSize(size, name)
- Cardinal size;
- XrmQuark name;
-{
- String params[2];
- Cardinal num_params = 2;
-
- params[0] = (String)(long) size;
- params[1] = XrmQuarkToString(name);
- XtWarningMsg("invalidSizeOverride", "xtDependencies", XtCXtToolkitError,
- "Representation size %d must match superclass's to override %s",
- params, &num_params);
-} /* BadType */
-
-/*
- * Create a new resource list, with the class resources following the
- * superclass's resources. If a resource in the class list overrides
- * a superclass resource, then just replace the superclass entry in place.
- *
- * At the same time, add a level of indirection to the XtResourceList to
- * create and XrmResourceList.
- */
-void _XtDependencies(class_resp, class_num_resp, super_res, super_num_res,
- super_widget_size)
- XtResourceList *class_resp; /* VAR */
- Cardinal *class_num_resp; /* VAR */
- XrmResourceList *super_res;
- Cardinal super_num_res;
- Cardinal super_widget_size;
-{
- register XrmResourceList *new_res;
- Cardinal new_num_res;
- XrmResourceList class_res = (XrmResourceList) *class_resp;
- Cardinal class_num_res = *class_num_resp;
- register Cardinal i, j;
- Cardinal new_next;
-
- if (class_num_res == 0) {
- /* Just point to superclass resource list */
- *class_resp = (XtResourceList) super_res;
- *class_num_resp = super_num_res;
- return;
- }
-
- /* Allocate and initialize new_res with superclass resource pointers */
- new_num_res = super_num_res + class_num_res;
- new_res = (XrmResourceList *) __XtMalloc(new_num_res*sizeof(XrmResourceList));
- if (super_num_res > 0)
- XtMemmove(new_res, super_res, super_num_res * sizeof(XrmResourceList));
-
- /* Put pointers to class resource entries into new_res */
- new_next = super_num_res;
- for (i = 0; i < class_num_res; i++) {
- if (-class_res[i].xrm_offset-1 < super_widget_size) {
- /* Probably an override of superclass resources--look for overlap */
- for (j = 0; j < super_num_res; j++) {
- if (class_res[i].xrm_offset == new_res[j]->xrm_offset) {
- /* Spec is silent on what fields subclass can override.
- * The only two of real concern are type & size.
- * Although allowing type to be over-ridden introduces
- * the possibility of errors, it's at present the only
- * reasonable way to allow a subclass to force a private
- * converter to be invoked for a subset of fields.
- */
- /* We do insist that size be identical to superclass */
- if (class_res[i].xrm_size != new_res[j]->xrm_size) {
- BadSize(class_res[i].xrm_size,
- (XrmQuark) class_res[i].xrm_name);
- class_res[i].xrm_size = new_res[j]->xrm_size;
- }
- new_res[j] = &(class_res[i]);
- new_num_res--;
- goto NextResource;
- }
- } /* for j */
- }
- /* Not an overlap, add an entry to new_res */
- new_res[new_next++] = &(class_res[i]);
-NextResource:;
- } /* for i */
-
- /* Okay, stuff new resources back into class record */
- *class_resp = (XtResourceList) new_res;
- *class_num_resp = new_num_res;
-} /* _XtDependencies */
-
-
-void _XtResourceDependencies(wc)
- WidgetClass wc;
-{
- WidgetClass sc;
-
- sc = wc->core_class.superclass;
- if (sc == NULL) {
- _XtDependencies(&(wc->core_class.resources),
- &(wc->core_class.num_resources),
- (XrmResourceList *) NULL, (unsigned)0, (unsigned)0);
- } else {
- _XtDependencies(&(wc->core_class.resources),
- &(wc->core_class.num_resources),
- (XrmResourceList *) sc->core_class.resources,
- sc->core_class.num_resources,
- sc->core_class.widget_size);
- }
-} /* _XtResourceDependencies */
-
-void _XtConstraintResDependencies(wc)
- ConstraintWidgetClass wc;
-{
- ConstraintWidgetClass sc;
-
- if (wc == (ConstraintWidgetClass) constraintWidgetClass) {
- _XtDependencies(&(wc->constraint_class.resources),
- &(wc->constraint_class.num_resources),
- (XrmResourceList *)NULL, (unsigned)0, (unsigned)0);
- } else {
- sc = (ConstraintWidgetClass) wc->core_class.superclass;
- _XtDependencies(&(wc->constraint_class.resources),
- &(wc->constraint_class.num_resources),
- (XrmResourceList *) sc->constraint_class.resources,
- sc->constraint_class.num_resources,
- sc->constraint_class.constraint_size);
- }
-} /* _XtConstraintResDependencies */
-
-
-
-
-XrmResourceList* _XtCreateIndirectionTable (resources, num_resources)
- XtResourceList resources;
- Cardinal num_resources;
-{
- register int idx;
- XrmResourceList* table;
-
- table = (XrmResourceList*)__XtMalloc(num_resources * sizeof(XrmResourceList));
- for (idx = 0; idx < num_resources; idx++)
- table[idx] = (XrmResourceList)(&(resources[idx]));
- return table;
-}
-
-static XtCacheRef *GetResources(widget, base, names, classes,
- table, num_resources, quark_args, args, num_args,
- typed_args, pNumTypedArgs, tm_hack)
- Widget widget; /* Widget resources are associated with */
- char* base; /* Base address of memory to write to */
- XrmNameList names; /* Full inheritance name of widget */
- XrmClassList classes; /* Full inheritance class of widget */
- XrmResourceList* table; /* The list of resources required. */
- Cardinal num_resources; /* number of items in resource list */
- XrmQuarkList quark_args; /* Arg names quarkified */
- ArgList args; /* ArgList to override resources */
- Cardinal num_args; /* number of items in arg list */
- XtTypedArgList typed_args; /* Typed arg list to override resources */
- Cardinal* pNumTypedArgs; /* number of items in typed arg list */
- Boolean tm_hack; /* do baseTranslations */
-{
-/*
- * assert: *pNumTypedArgs == 0 if num_args > 0
- * assert: num_args == 0 if *pNumTypedArgs > 0
- */
-#define SEARCHLISTLEN 100
-#define MAXRESOURCES 400
-
- XrmValue value;
- XrmQuark rawType;
- XrmValue convValue;
- XrmHashTable stackSearchList[SEARCHLISTLEN];
- XrmHashTable *searchList = stackSearchList;
- unsigned int searchListSize = SEARCHLISTLEN;
- Boolean found[MAXRESOURCES];
- int typed[MAXRESOURCES];
- XtCacheRef cache_ref[MAXRESOURCES];
- XtCacheRef *cache_ptr, *cache_base;
- Boolean persistent_resources = True;
- Boolean found_persistence = False;
- int num_typed_args = *pNumTypedArgs;
- XrmDatabase db;
- Boolean do_tm_hack = False;
-
- if ((args == NULL) && (num_args != 0)) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidArgCount","getResources",XtCXtToolkitError,
- "argument count > 0 on NULL argument list",
- (String *)NULL, (Cardinal *)NULL);
- num_args = 0;
- }
- if (num_resources == 0) {
- return NULL;
- } else if (num_resources >= MAXRESOURCES) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidResourceCount","getResources",XtCXtToolkitError,
- "too many resources",
- (String *)NULL, (Cardinal *)NULL);
- return NULL;
- } else if (table == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidResourceCount","getResources",XtCXtToolkitError,
- "resource count > 0 on NULL resource list",
- (String *)NULL, (Cardinal *)NULL);
- return NULL;
- }
-
- /* Mark each resource as not found on arg list */
- bzero((char *) found, (int) (num_resources * sizeof(Boolean)));
- bzero((char *) typed, (int) (num_resources * sizeof(int)));
-
- /* Copy the args into the resources, mark each as found */
- {
- register ArgList arg;
- register XtTypedArgList typed_arg;
- register XrmName argName;
- register int j;
- register int i;
- register XrmResourceList rx;
- register XrmResourceList *res;
- for (arg = args, i = 0; i < num_args; i++, arg++) {
- argName = quark_args[i];
- if (argName == QinitialResourcesPersistent) {
- persistent_resources = (Boolean)arg->value;
- found_persistence = True;
- continue;
- }
- for (j = 0, res = table; j < num_resources; j++, res++) {
- rx = *res;
- if (argName == rx->xrm_name) {
- _XtCopyFromArg(
- arg->value,
- base - rx->xrm_offset - 1,
- rx->xrm_size);
- found[j] = TRUE;
- break;
- }
- }
- }
- for (typed_arg = typed_args, i = 0; i < num_typed_args;
- i++, typed_arg++) {
- register XrmRepresentation argType;
- argName = quark_args[i];
- argType = (typed_arg->type == NULL) ? NULLQUARK
- : XrmStringToRepresentation(typed_arg->type);
- if (argName == QinitialResourcesPersistent) {
- persistent_resources = (Boolean)typed_arg->value;
- found_persistence = True;
- break;
- }
- for (j = 0, res = table; j < num_resources; j++, res++) {
- rx = *res;
- if (argName == rx->xrm_name) {
- if (argType != NULLQUARK && argType != rx->xrm_type) {
- typed[j] = i + 1;
- } else {
- _XtCopyFromArg(
- typed_arg->value,
- base - rx->xrm_offset - 1,
- rx->xrm_size);
- }
- found[j] = TRUE;
- break;
- }
- }
- }
- }
-
- /* Ask resource manager for a list of database levels that we can
- do a single-level search on each resource */
-
- db = XtScreenDatabase(XtScreenOfObject(widget));
- while (!XrmQGetSearchList(db, names, classes,
- searchList, searchListSize)) {
- if (searchList == stackSearchList)
- searchList = NULL;
- searchList = (XrmHashTable*)XtRealloc((char*)searchList,
- sizeof(XrmHashTable) *
- (searchListSize *= 2));
- }
-
- if (persistent_resources)
- cache_base = NULL;
- else
- cache_base = cache_ref;
- /* geez, this is an ugly mess */
- if (XtIsShell(widget)) {
- register XrmResourceList *res;
- register int j;
- Screen *oldscreen = widget->core.screen;
-
- /* look up screen resource first, since real rdb depends on it */
- for (res = table, j = 0; j < num_resources; j++, res++) {
- if ((*res)->xrm_name != Qscreen)
- continue;
- if (typed[j]) {
- register XtTypedArg* arg = typed_args + typed[j] - 1;
- XrmQuark from_type;
- XrmValue from_val, to_val;
-
- from_type = StringToQuark(arg->type);
- from_val.size = arg->size;
- if ((from_type == QString) || (arg->size > sizeof(XtArgVal)))
- from_val.addr = (XPointer)arg->value;
- else
- from_val.addr = (XPointer)&arg->value;
- to_val.size = sizeof(Screen*);
- to_val.addr = (XPointer)&widget->core.screen;
- found[j] = _XtConvert(widget, from_type, &from_val,
- QScreen, &to_val, cache_base);
- if (cache_base && *cache_base)
- cache_base++;
- }
- if (!found[j]) {
- if (XrmQGetSearchResource(searchList, Qscreen, QScreen,
- &rawType, &value)) {
- if (rawType != QScreen) {
- convValue.size = sizeof(Screen*);
- convValue.addr = (XPointer)&widget->core.screen;
- (void)_XtConvert(widget, rawType, &value,
- QScreen, &convValue, cache_base);
- if (cache_base && *cache_base)
- cache_base++;
- } else {
- widget->core.screen = *((Screen **)value.addr);
- }
- }
- }
- break;
- }
- /* now get the database to use for the rest of the resources */
- if (widget->core.screen != oldscreen) {
- db = XtScreenDatabase(widget->core.screen);
- while (!XrmQGetSearchList(db, names, classes,
- searchList, searchListSize)) {
- if (searchList == stackSearchList)
- searchList = NULL;
- searchList = (XrmHashTable*)XtRealloc((char*)searchList,
- sizeof(XrmHashTable) *
- (searchListSize *= 2));
- }
- }
- }
-
- /* go to the resource manager for those resources not found yet */
- /* if it's not in the resource database use the default value */
-
- {
- register XrmResourceList rx;
- register XrmResourceList *res;
- register int j;
- register XrmRepresentation xrm_type;
- register XrmRepresentation xrm_default_type;
- char char_val;
- short short_val;
- int int_val;
- long long_val;
- char* char_ptr;
-
- if (!found_persistence) {
- if (XrmQGetSearchResource(searchList, QinitialResourcesPersistent,
- QInitialResourcesPersistent, &rawType, &value)) {
- if (rawType != QBoolean) {
- convValue.size = sizeof(Boolean);
- convValue.addr = (XPointer)&persistent_resources;
- (void)_XtConvert(widget, rawType, &value, QBoolean,
- &convValue, NULL);
- }
- else
- persistent_resources = *(Boolean*)value.addr;
- }
- }
- if (persistent_resources)
- cache_ptr = NULL;
- else if (cache_base)
- cache_ptr = cache_base;
- else
- cache_ptr = cache_ref;
-
- for (res = table, j = 0; j < num_resources; j++, res++) {
- rx = *res;
- xrm_type = rx->xrm_type;
- if (typed[j]) {
- register XtTypedArg* arg = typed_args + typed[j] - 1;
-
- /*
- * This resource value has been specified as a typed arg and
- * has to be converted. Typed arg conversions are done here
- * to correctly interpose them with normal resource conversions.
- */
- XrmQuark from_type;
- XrmValue from_val, to_val;
- Boolean converted;
-
- from_type = StringToQuark(arg->type);
- from_val.size = arg->size;
- if ((from_type == QString) || (arg->size > sizeof(XtArgVal)))
- from_val.addr = (XPointer)arg->value;
- else
- from_val.addr = (XPointer)&arg->value;
- to_val.size = rx->xrm_size;
- to_val.addr = base - rx->xrm_offset - 1;
- converted = _XtConvert(widget, from_type, &from_val,
- xrm_type, &to_val, cache_ptr);
- if (converted) {
-
- /* Copy the converted value back into the typed argument.
- * normally the data should be <= sizeof(XtArgVal) and
- * is stored directly into the 'value' field .... BUT
- * if the resource size is greater than sizeof(XtArgVal)
- * then we dynamically alloc a block of store to hold the
- * data and zap a copy in there !!! .... freeing it later
- * the size field in the typed arg is negated to indicate
- * that the store pointed to by the value field is
- * dynamic .......
- * "freeing" happens in the case of _XtCreate after the
- * CallInitialize ..... other clients of GetResources
- * using typed args should be aware of the need to free
- * this store .....
- */
-
- if(rx->xrm_size > sizeof(XtArgVal)) {
- arg->value = (XtArgVal) __XtMalloc(rx->xrm_size);
- arg->size = -(arg->size);
- } else { /* will fit - copy directly into value field */
- arg->value = (XtArgVal) NULL;
- }
- CopyToArg((char *)(base - rx->xrm_offset - 1),
- &arg->value, rx->xrm_size);
-
- } else {
- /* Conversion failed. Get default value. */
- found[j] = False;
- }
-
- if (cache_ptr && *cache_ptr)
- cache_ptr++;
- }
-
- if (!found[j]) {
- Boolean already_copied = False;
- Boolean have_value = False;
-
- if (XrmQGetSearchResource(searchList,
- rx->xrm_name, rx->xrm_class, &rawType, &value)) {
- if (rawType != xrm_type) {
- convValue.size = rx->xrm_size;
- convValue.addr = (XPointer)(base - rx->xrm_offset - 1);
- already_copied = have_value =
- _XtConvert(widget, rawType, &value,
- xrm_type, &convValue, cache_ptr);
- if (cache_ptr && *cache_ptr)
- cache_ptr++;
- } else have_value = True;
- if (have_value && rx->xrm_name == Qtranslations)
- do_tm_hack = True;
- }
- LOCK_PROCESS;
- if (!have_value
- && ((rx->xrm_default_type == QImmediate)
- || (rx->xrm_default_type == xrm_type)
- || (rx->xrm_default_addr != NULL))) {
- /* Convert default value to proper type */
- xrm_default_type = rx->xrm_default_type;
- if (xrm_default_type == QCallProc) {
-#ifdef CRAY
- if ( (int) Cjumpp != (int) Cjump)
- (*(XtResourceDefaultProc)
- (((int)(rx->xrm_default_addr))<<2))(
- widget,-(rx->xrm_offset+1), &value);
- else
-#endif
- (*(XtResourceDefaultProc)(rx->xrm_default_addr))(
- widget,-(rx->xrm_offset+1), &value);
-
- } else if (xrm_default_type == QImmediate) {
- /* XtRImmediate == XtRString for type XtRString */
- if (xrm_type == QString) {
- value.addr = rx->xrm_default_addr;
- } else if (rx->xrm_size == sizeof(int)) {
- int_val = (int)(long)rx->xrm_default_addr;
- value.addr = (XPointer) &int_val;
- } else if (rx->xrm_size == sizeof(short)) {
- short_val = (short)(long)rx->xrm_default_addr;
- value.addr = (XPointer) &short_val;
- } else if (rx->xrm_size == sizeof(char)) {
- char_val = (char)(long)rx->xrm_default_addr;
- value.addr = (XPointer) &char_val;
- } else if (rx->xrm_size == sizeof(long)) {
- long_val = (long)rx->xrm_default_addr;
- value.addr = (XPointer) &long_val;
- } else if (rx->xrm_size == sizeof(char*)) {
- char_ptr = (char*)rx->xrm_default_addr;
- value.addr = (XPointer) &char_ptr;
- } else {
- value.addr = (XPointer) &(rx->xrm_default_addr);
- }
- } else if (xrm_default_type == xrm_type) {
- value.addr = rx->xrm_default_addr;
- } else {
- value.addr = rx->xrm_default_addr;
- if (xrm_default_type == QString) {
- value.size = strlen((char *)value.addr) + 1;
- } else {
- value.size = sizeof(XtPointer);
- }
- convValue.size = rx->xrm_size;
- convValue.addr = (XPointer)(base - rx->xrm_offset - 1);
- already_copied =
- _XtConvert(widget, xrm_default_type, &value,
- xrm_type, &convValue, cache_ptr);
- if (!already_copied)
- value.addr = NULL;
- if (cache_ptr && *cache_ptr)
- cache_ptr++;
- }
- }
- if (!already_copied) {
- if (xrm_type == QString) {
- *((String*)(base - rx->xrm_offset - 1)) = value.addr;
- } else {
- if (value.addr != NULL) {
- XtMemmove(base - rx->xrm_offset - 1,
- value.addr, rx->xrm_size);
- } else {
- /* didn't get value, initialize to NULL... */
- XtBZero(base - rx->xrm_offset - 1, rx->xrm_size);
- }
- }
- }
- UNLOCK_PROCESS;
-
- if (typed[j]) {
- /*
- * This resource value was specified as a typed arg.
- * However, the default value is being used here since
- * type type conversion failed, so we compress the list.
- */
- register XtTypedArg* arg = typed_args + typed[j] - 1;
- register int i;
-
- for (i = num_typed_args - typed[j]; i; i--, arg++) {
- *arg = *(arg+1);
- }
- num_typed_args--;
- }
- }
- }
- if (tm_hack)
- widget->core.tm.current_state = NULL;
- if (tm_hack &&
- (!widget->core.tm.translations ||
- (do_tm_hack &&
- widget->core.tm.translations->operation != XtTableReplace)) &&
- XrmQGetSearchResource(searchList, QbaseTranslations,
- QTranslations, &rawType, &value)) {
- if (rawType != QTranslationTable) {
- convValue.size = sizeof(XtTranslations);
- convValue.addr = (XPointer)&widget->core.tm.current_state;
- (void)_XtConvert(widget, rawType, &value,
- QTranslationTable, &convValue, cache_ptr);
- if (cache_ptr && *cache_ptr)
- cache_ptr++;
- } else {
- *((XtTranslations *)&widget->core.tm.current_state) =
- *((XtTranslations *)value.addr);
- }
- }
- }
- if (num_typed_args != *pNumTypedArgs) *pNumTypedArgs = num_typed_args;
- if (searchList != stackSearchList) XtFree((char*)searchList);
- if (!cache_ptr)
- cache_ptr = cache_base;
- if (cache_ptr && cache_ptr != cache_ref) {
- int cache_ref_size = cache_ptr - cache_ref;
- XtCacheRef *refs = (XtCacheRef*)
- __XtMalloc((unsigned)sizeof(XtCacheRef)*(cache_ref_size + 1));
- (void) memmove(refs, cache_ref, sizeof(XtCacheRef)*cache_ref_size );
- refs[cache_ref_size] = NULL;
- return refs;
- }
- return (XtCacheRef*)NULL;
-}
-
-
-
-static void CacheArgs(args, num_args, typed_args, num_typed_args, quark_cache,
- num_quarks, pQuarks)
- ArgList args;
- Cardinal num_args;
- XtTypedArgList typed_args;
- Cardinal num_typed_args;
- XrmQuarkList quark_cache;
- Cardinal num_quarks;
- XrmQuarkList *pQuarks; /* RETURN */
-{
- register XrmQuarkList quarks;
- register Cardinal i;
- register Cardinal count;
-
- count = (args != NULL) ? num_args : num_typed_args;
-
- if (num_quarks < count) {
- quarks = (XrmQuarkList) __XtMalloc(count * sizeof(XrmQuark));
- } else {
- quarks = quark_cache;
- }
- *pQuarks = quarks;
-
- if (args != NULL) {
- for (i = count; i; i--)
- *quarks++ = StringToQuark((args++)->name);
- }
- else {
- for (i = count; i; i--)
- *quarks++ = StringToQuark((typed_args++)->name);
- }
-}
-
-#define FreeCache(cache, pointer) \
- if (cache != pointer) XtFree((char *)pointer)
-
-
-XtCacheRef *_XtGetResources(w, args, num_args, typed_args, num_typed_args)
- register Widget w;
- ArgList args;
- Cardinal num_args;
- XtTypedArgList typed_args;
- Cardinal* num_typed_args;
-{
- XrmName *names, names_s[50];
- XrmClass *classes, classes_s[50];
- XrmQuark quark_cache[100];
- XrmQuarkList quark_args;
- WidgetClass wc;
- ConstraintWidgetClass cwc;
- XtCacheRef *cache_refs;
- Cardinal count;
-
- wc = XtClass(w);
-
- count = CountTreeDepth(w);
- names = (XrmName*) XtStackAlloc (count * sizeof(XrmName), names_s);
- classes = (XrmClass*) XtStackAlloc (count * sizeof(XrmClass), classes_s);
- if (names == NULL || classes == NULL) _XtAllocError(NULL);
-
- /* Get names, classes for widget and ancestors */
- GetNamesAndClasses(w, names, classes);
-
- /* Compile arg list into quarks */
- CacheArgs(args, num_args, typed_args, *num_typed_args, quark_cache,
- XtNumber(quark_cache), &quark_args);
-
- /* Get normal resources */
- LOCK_PROCESS;
- cache_refs = GetResources(w, (char*)w, names, classes,
- (XrmResourceList *) wc->core_class.resources,
- wc->core_class.num_resources, quark_args, args, num_args,
- typed_args, num_typed_args, XtIsWidget(w));
-
- if (w->core.constraints != NULL) {
- cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
- (void) GetResources(w, (char*)w->core.constraints, names, classes,
- (XrmResourceList *) cwc->constraint_class.resources,
- cwc->constraint_class.num_resources,
- quark_args, args, num_args, typed_args, num_typed_args, False);
- }
- FreeCache(quark_cache, quark_args);
- UNLOCK_PROCESS;
- XtStackFree((XtPointer)names, names_s);
- XtStackFree((XtPointer)classes, classes_s);
- return cache_refs;
-} /* _XtGetResources */
-
-
-#if NeedFunctionPrototypes
-void _XtGetSubresources (
- Widget w,
- XtPointer base,
- const char* name,
- const char* class,
- XtResourceList resources,
- Cardinal num_resources,
- ArgList args,
- Cardinal num_args,
- XtTypedArgList typed_args,
- Cardinal num_typed_args
- )
-#else
-void _XtGetSubresources (w, base, name, class, resources, num_resources,
- args, num_args)
- Widget w; /* Widget "parent" of subobject */
- XtPointer base; /* Base address to write to */
- String name; /* name of subobject */
- String class; /* class of subobject */
- XtResourceList resources; /* resource list for subobject */
- Cardinal num_resources;
- ArgList args; /* arg list to override resources */
- Cardinal num_args;
- XtTypedArgsList typed_args;
- Cardinal num_typed_args;
-#endif
-{
- XrmName *names, names_s[50];
- XrmClass *classes, classes_s[50];
- XrmQuark quark_cache[100];
- XrmQuarkList quark_args;
- XrmResourceList* table;
- Cardinal count, ntyped_args = num_typed_args;
- WIDGET_TO_APPCON(w);
-
- if (num_resources == 0) return;
-
- LOCK_APP(app);
- count = CountTreeDepth(w);
- count++; /* make sure there's enough room for name and class */
- names = (XrmName*) XtStackAlloc(count * sizeof(XrmName), names_s);
- classes = (XrmClass*) XtStackAlloc(count * sizeof(XrmClass), classes_s);
- if (names == NULL || classes == NULL) _XtAllocError(NULL);
-
- /* Get full name, class of subobject */
- GetNamesAndClasses(w, names, classes);
- count -= 2;
- names[count] = StringToName(name);
- classes[count] = StringToClass(class);
- count++;
- names[count] = NULLQUARK;
- classes[count] = NULLQUARK;
-
- /* Compile arg list into quarks */
- CacheArgs(args, num_args, typed_args, num_typed_args,
- quark_cache, XtNumber(quark_cache), &quark_args);
-
- /* Compile resource list if needed */
- if (((int) resources->resource_offset) >= 0) {
- XrmCompileResourceListEphem(resources, num_resources);
- }
- table = _XtCreateIndirectionTable(resources, num_resources);
- (void) GetResources(w, (char*)base, names, classes, table, num_resources,
- quark_args, args, num_args,
- typed_args, &ntyped_args, False);
- FreeCache(quark_cache, quark_args);
- XtFree((char *)table);
- XtStackFree((XtPointer)names, names_s);
- XtStackFree((XtPointer)classes, classes_s);
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-void XtGetSubresources (
- Widget w,
- XtPointer base,
- _Xconst char* name,
- _Xconst char* class,
- XtResourceList resources,
- Cardinal num_resources,
- ArgList args,
- Cardinal num_args
- )
-#else
-void XtGetSubresources (w, base, name, class, resources, num_resources,
- args, num_args)
- Widget w; /* Widget "parent" of subobject */
- XtPointer base; /* Base address to write to */
- String name; /* name of subobject */
- String class; /* class of subobject */
- XtResourceList resources; /* resource list for subobject */
- Cardinal num_resources;
- ArgList args; /* arg list to override resources */
- Cardinal num_args;
-#endif
-{
- _XtGetSubresources (w, base, name, class, resources, num_resources, args, num_args, NULL, 0);
-}
-
-
-void _XtGetApplicationResources
- (w, base, resources, num_resources, args, num_args, typed_args, num_typed_args)
- Widget w; /* Application shell widget */
- XtPointer base; /* Base address to write to */
- XtResourceList resources; /* resource list for subobject */
- Cardinal num_resources;
- ArgList args; /* arg list to override resources */
- Cardinal num_args;
- XtTypedArgList typed_args;
- Cardinal num_typed_args;
-{
- XrmName *names, names_s[50];
- XrmClass *classes, classes_s[50];
- XrmQuark quark_cache[100];
- XrmQuarkList quark_args;
- XrmResourceList* table;
- Cardinal count, ntyped_args = num_typed_args;
- XtAppContext app;
-
- if (num_resources == 0) return;
-
- if (w == NULL) app = _XtDefaultAppContext();
- else app = XtWidgetToApplicationContext(w);
-
- LOCK_APP(app);
- /* Get full name, class of application */
- if (w == NULL) {
- /* hack for R2 compatibility */
- XtPerDisplay pd = _XtGetPerDisplay(_XtDefaultAppContext()->list[0]);
- names = (XrmName*) XtStackAlloc (2 * sizeof(XrmName), names_s);
- classes = (XrmClass*) XtStackAlloc (2 * sizeof(XrmClass), classes_s);
- names[0] = pd->name;
- names[1] = NULLQUARK;
- classes[0] = pd->class;
- classes[1] = NULLQUARK;
- }
- else {
- count = CountTreeDepth(w);
- names = (XrmName*) XtStackAlloc(count * sizeof(XrmName), names_s);
- classes = (XrmClass*) XtStackAlloc(count * sizeof(XrmClass), classes_s);
- if (names == NULL || classes == NULL) _XtAllocError(NULL);
- GetNamesAndClasses(w, names, classes);
- }
-
- /* Compile arg list into quarks */
- CacheArgs(args, num_args, typed_args, num_typed_args, quark_cache,
- XtNumber(quark_cache), &quark_args);
- /* Compile resource list if needed */
- if (((int) resources->resource_offset) >= 0) {
-#ifdef CRAY2
- if (base == 0) { /* this client is non-portable, but... */
- int count;
- XtResourceList res = resources;
- for (count = 0; count < num_resources; res++, count++) {
- res->resource_offset *= sizeof(long);
- }
- }
-#endif /* CRAY2 */
- XrmCompileResourceListEphem(resources, num_resources);
- }
- table = _XtCreateIndirectionTable(resources,num_resources);
-
- (void) GetResources(w, (char*)base, names, classes, table, num_resources,
- quark_args, args, num_args,
- typed_args, &ntyped_args, False);
- FreeCache(quark_cache, quark_args);
- XtFree((char *)table);
- if (w != NULL) {
- XtStackFree((XtPointer)names, names_s);
- XtStackFree((XtPointer)classes, classes_s);
- }
- UNLOCK_APP(app);
-}
-
-void XtGetApplicationResources
- (w, base, resources, num_resources, args, num_args)
- Widget w; /* Application shell widget */
- XtPointer base; /* Base address to write to */
- XtResourceList resources; /* resource list for subobject */
- Cardinal num_resources;
- ArgList args; /* arg list to override resources */
- Cardinal num_args;
-{
- _XtGetApplicationResources(w, base, resources, num_resources, args, num_args, NULL, 0);
-}
-
-static Boolean initialized = FALSE;
-
-void _XtResourceListInitialize()
-{
- LOCK_PROCESS;
- if (initialized) {
- XtWarningMsg("initializationError","xtInitialize",XtCXtToolkitError,
- "Initializing Resource Lists twice",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_PROCESS;
- return;
- }
- initialized = TRUE;
- UNLOCK_PROCESS;
-
- QBoolean = XrmPermStringToQuark(XtCBoolean);
- QString = XrmPermStringToQuark(XtCString);
- QCallProc = XrmPermStringToQuark(XtRCallProc);
- QImmediate = XrmPermStringToQuark(XtRImmediate);
- QinitialResourcesPersistent = XrmPermStringToQuark(XtNinitialResourcesPersistent);
- QInitialResourcesPersistent = XrmPermStringToQuark(XtCInitialResourcesPersistent);
- Qtranslations = XrmPermStringToQuark(XtNtranslations);
- QbaseTranslations = XrmPermStringToQuark("baseTranslations");
- QTranslations = XrmPermStringToQuark(XtCTranslations);
- QTranslationTable = XrmPermStringToQuark(XtRTranslationTable);
- Qscreen = XrmPermStringToQuark(XtNscreen);
- QScreen = XrmPermStringToQuark(XtCScreen);
-}
diff --git a/xc/lib/Xt/Selection.c b/xc/lib/Xt/Selection.c
deleted file mode 100644
index 5a329ef44..000000000
--- a/xc/lib/Xt/Selection.c
+++ /dev/null
@@ -1,2302 +0,0 @@
-/* $TOG: Selection.c /main/99 1998/02/06 13:25:43 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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 "IntrinsicI.h"
-#include "StringDefs.h"
-#include "SelectionI.h"
-#include <X11/Xatom.h>
-
-void _XtSetDefaultSelectionTimeout(timeout)
- unsigned long *timeout;
-{
- *timeout = 5000; /* default to 5 seconds */
-}
-
-void XtSetSelectionTimeout(timeout)
- unsigned long timeout;
-{
- XtAppSetSelectionTimeout(_XtDefaultAppContext(), timeout);
-}
-
-void XtAppSetSelectionTimeout(app, timeout)
- XtAppContext app;
- unsigned long timeout;
-{
- LOCK_APP(app);
- app->selectionTimeout = timeout;
- UNLOCK_APP(app);
-}
-
-unsigned long XtGetSelectionTimeout()
-{
- return XtAppGetSelectionTimeout(_XtDefaultAppContext());
-}
-
-unsigned long XtAppGetSelectionTimeout(app)
- XtAppContext app;
-{
- unsigned long retval;
-
- LOCK_APP(app);
- retval = app->selectionTimeout;
- UNLOCK_APP(app);
- return retval;
-}
-
-
-/* General utilities */
-
-static void HandleSelectionReplies();
-static void ReqTimedOut();
-static void HandlePropertyGone();
-static void HandleGetIncrement();
-static void HandleIncremental();
-
-static XContext selectPropertyContext = 0;
-static XContext paramPropertyContext = 0;
-static XContext multipleContext = 0;
-
-/* Multiple utilities */
-static void AddSelectionRequests();
-static Boolean IsGatheringRequest();
-
-#define PREALLOCED 32
-
-/* Parameter utilities */
-static void AddParamInfo();
-static void RemoveParamInfo();
-static Atom GetParamInfo();
-
-static int StorageSize[3] = {1, sizeof(short), sizeof(long)};
-#define BYTELENGTH(length, format) ((length) * StorageSize[(format)>>4])
-#define NUMELEM(bytelength, format) ((bytelength) / StorageSize[(format)>>4])
-
-/* Xlib and Xt are permitted to have different memory allocators, and in the
- * XtSelectionCallbackProc the client is instructed to free the selection
- * value with XtFree, so the selection value received from XGetWindowProperty
- * should be copied to memory allocated through Xt. But copying is
- * undesirable since the selection value may be large, and, under normal
- * library configuration copying is unnecessary.
- */
-#ifdef XTTRACEMEMORY
-#define XT_COPY_SELECTION 1
-#endif
-
-/*ARGSUSED*/
-static void FreePropList(w, closure, callData)
- Widget w; /* unused */
- XtPointer closure;
- XtPointer callData; /* unused */
-{
- PropList sarray = (PropList)closure;
- LOCK_PROCESS;
- XDeleteContext(sarray->dpy, DefaultRootWindow(sarray->dpy),
- selectPropertyContext);
- UNLOCK_PROCESS;
- XtFree((char*)sarray->list);
- XtFree((char*)closure);
-}
-
-
-static PropList GetPropList(dpy)
- Display *dpy;
-{
- PropList sarray;
- Atom atoms[4];
- static char* names[] = {
- "INCR",
- "MULTIPLE",
- "TIMESTAMP",
- "_XT_SELECTION_0" };
-
- LOCK_PROCESS;
- if (selectPropertyContext == 0)
- selectPropertyContext = XUniqueContext();
- if (XFindContext(dpy, DefaultRootWindow(dpy), selectPropertyContext,
- (XPointer *)&sarray)) {
- XtPerDisplay pd = _XtGetPerDisplay(dpy);
- sarray = (PropList) __XtMalloc((unsigned) sizeof(PropListRec));
- sarray->dpy = dpy;
- XInternAtoms(dpy, names, 4, FALSE, atoms);
- sarray->incr_atom = atoms[0];
- sarray->indirect_atom = atoms[1];
- sarray->timestamp_atom = atoms[2];
- sarray->propCount = 1;
- sarray->list =
- (SelectionProp)__XtMalloc((unsigned) sizeof(SelectionPropRec));
- sarray->list[0].prop = atoms[3];
- sarray->list[0].avail = TRUE;
- (void) XSaveContext(dpy, DefaultRootWindow(dpy), selectPropertyContext,
- (char *) sarray);
- _XtAddCallback( &pd->destroy_callbacks,
- FreePropList, (XtPointer)sarray );
- }
- UNLOCK_PROCESS;
- return sarray;
-}
-
-
-static Atom GetSelectionProperty(dpy)
-Display *dpy;
-{
- SelectionProp p;
- int propCount;
- char propname[80];
- PropList sarray = GetPropList(dpy);
-
- for (p = sarray->list, propCount=sarray->propCount;
- propCount;
- p++, propCount--) {
- if (p->avail) {
- p->avail = FALSE;
- return(p->prop);
- }
- }
- propCount = sarray->propCount++;
- sarray->list = (SelectionProp) XtRealloc((XtPointer)sarray->list,
- (unsigned)(sarray->propCount*sizeof(SelectionPropRec)));
- (void) sprintf(propname, "%s%d", "_XT_SELECTION_", propCount);
- sarray->list[propCount].prop = XInternAtom(dpy, propname, FALSE);
- sarray->list[propCount].avail = FALSE;
- return(sarray->list[propCount].prop);
-}
-
-static void FreeSelectionProperty(dpy, prop)
-Display *dpy;
-Atom prop;
-{
- SelectionProp p;
- PropList sarray;
- if (prop == None) return;
- LOCK_PROCESS;
- if (XFindContext(dpy, DefaultRootWindow(dpy), selectPropertyContext,
- (XPointer *)&sarray))
- XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
- "noSelectionProperties", "freeSelectionProperty", XtCXtToolkitError,
- "internal error: no selection property context for display",
- (String *)NULL, (Cardinal *)NULL );
- UNLOCK_PROCESS;
- for (p = sarray->list; p; p++)
- if (p->prop == prop) {
- p->avail = TRUE;
- return;
- }
-}
-
-static void FreeInfo(info)
- CallBackInfo info;
-{
- XtFree((char*)info->incremental);
- XtFree((char*)info->callbacks);
- XtFree((char*)info->req_closure);
- XtFree((char*)info->target);
- XtFree((char*)info);
-}
-
-static CallBackInfo MakeInfo(ctx, callbacks, closures, count,
- widget, time, incremental, properties)
-Select ctx;
-XtSelectionCallbackProc *callbacks;
-XtPointer *closures;
-int count;
-Widget widget;
-Time time;
-Boolean *incremental;
-Atom *properties;
-{
- CallBackInfo info = XtNew(CallBackInfoRec);
-
- info->ctx = ctx;
- info->callbacks = (XtSelectionCallbackProc *)
- __XtMalloc((unsigned) (count * sizeof(XtSelectionCallbackProc)));
- (void) memmove((char*)info->callbacks, (char*)callbacks,
- count * sizeof(XtSelectionCallbackProc));
- info->req_closure =
- (XtPointer*)__XtMalloc((unsigned) (count * sizeof(XtPointer)));
- (void) memmove((char*)info->req_closure, (char*)closures,
- count * sizeof(XtPointer));
- if (count == 1 && properties != NULL && properties[0] != None)
- info->property = properties[0];
- else {
- info->property = GetSelectionProperty(XtDisplay(widget));
- XDeleteProperty(XtDisplay(widget), XtWindow(widget),
- info->property);
- }
- info->proc = HandleSelectionReplies;
- info->widget = widget;
- info->time = time;
- info->incremental = (Boolean*) __XtMalloc(count * sizeof(Boolean));
- (void) memmove((char*)info->incremental, (char*) incremental,
- count * sizeof(Boolean));
- info->current = 0;
- info->value = NULL;
- return (info);
-}
-
-static void RequestSelectionValue(info, selection, target)
-CallBackInfo info;
-Atom selection;
-Atom target;
-{
-#ifndef DEBUG_WO_TIMERS
- XtAppContext app = XtWidgetToApplicationContext(info->widget);
- info->timeout = XtAppAddTimeOut(app,
- app->selectionTimeout, ReqTimedOut, (XtPointer)info);
-#endif
- XtAddEventHandler(info->widget, (EventMask)0, TRUE,
- HandleSelectionReplies, (XtPointer)info);
- XConvertSelection(info->ctx->dpy, selection, target,
- info->property, XtWindow(info->widget), info->time);
-}
-
-
-static XContext selectContext = 0;
-
-static Select NewContext(dpy, selection)
-Display *dpy;
-Atom selection;
-{
- /* assert(selectContext != 0) */
- Select ctx = XtNew(SelectRec);
- ctx->dpy = dpy;
- ctx->selection = selection;
- ctx->widget = NULL;
- ctx->prop_list = GetPropList(dpy);
- ctx->ref_count = 0;
- ctx->free_when_done = FALSE;
- ctx->was_disowned = FALSE;
- LOCK_PROCESS;
- (void)XSaveContext(dpy, (Window)selection, selectContext, (char *)ctx);
- UNLOCK_PROCESS;
- return ctx;
-}
-
-static Select FindCtx(dpy, selection)
-Display *dpy;
-Atom selection;
-{
- Select ctx;
-
- LOCK_PROCESS;
- if (selectContext == 0)
- selectContext = XUniqueContext();
- if (XFindContext(dpy, (Window)selection, selectContext, (XPointer *)&ctx))
- ctx = NewContext(dpy, selection);
- UNLOCK_PROCESS;
- return ctx;
-}
-
-/*ARGSUSED*/
-static void WidgetDestroyed(widget, closure, data)
-Widget widget;
-XtPointer closure, data;
-{
- Select ctx = (Select) closure;
- if (ctx->widget == widget) {
- if (ctx->free_when_done)
- XtFree((char*)ctx);
- else
- ctx->widget = NULL;
- }
-}
-
-/* Selection Owner code */
-
-static void HandleSelectionEvents();
-
-static Boolean LoseSelection(ctx, widget, selection, time)
-Select ctx;
-Widget widget;
-Atom selection;
-Time time;
-{
- if ((ctx->widget == widget) &&
- (ctx->selection == selection) && /* paranoia */
- !ctx->was_disowned &&
- ((time == CurrentTime) || (time >= ctx->time)))
- {
- XtRemoveEventHandler(widget, (EventMask)0, TRUE,
- HandleSelectionEvents, (XtPointer)ctx);
- XtRemoveCallback(widget, XtNdestroyCallback,
- WidgetDestroyed, (XtPointer)ctx);
- ctx->was_disowned = TRUE; /* widget officially loses ownership */
- /* now inform widget */
- if (ctx->loses) {
- if (ctx->incremental)
- (*(XtLoseSelectionIncrProc)ctx->loses)
- (widget, &ctx->selection, ctx->owner_closure);
- else (*ctx->loses)(widget, &ctx->selection);
- }
- return(TRUE);
- }
- else return(FALSE);
-}
-
-static XContext selectWindowContext = 0;
-
-/* %%% Xlib.h should make this public! */
-typedef int (*xErrorHandler)(
-#if NeedFunctionPrototypes
- Display*, XErrorEvent*
-#endif
- );
-
-static xErrorHandler oldErrorHandler = NULL;
-static unsigned long firstProtectRequest;
-static Window errorWindow;
-
-static int LocalErrorHandler (dpy, error)
-Display *dpy;
-XErrorEvent *error;
-{
- int retval;
-
- /* If BadWindow error on selection requestor, nothing to do but let
- * the transfer timeout. Otherwise, invoke saved error handler. */
-
- LOCK_PROCESS;
-
- if (error->error_code == BadWindow && error->resourceid == errorWindow &&
- error->serial >= firstProtectRequest) {
- UNLOCK_PROCESS;
- return 0;
- }
-
- if (oldErrorHandler == NULL) {
- UNLOCK_PROCESS;
- return 0; /* should never happen */
- }
-
- retval = (*oldErrorHandler)(dpy, error);
- UNLOCK_PROCESS;
- return retval;
-}
-
-static void StartProtectedSection(dpy, window)
- Display *dpy;
- Window window;
-{
- /* protect ourselves against request window being destroyed
- * before completion of transfer */
-
- LOCK_PROCESS;
- oldErrorHandler = XSetErrorHandler(LocalErrorHandler);
- firstProtectRequest = NextRequest(dpy);
- errorWindow = window;
- UNLOCK_PROCESS;
-}
-
-static void EndProtectedSection(dpy)
- Display *dpy;
-{
- /* flush any generated errors on requestor and
- * restore original error handler */
-
- XSync(dpy, False);
-
- LOCK_PROCESS;
- XSetErrorHandler(oldErrorHandler);
- oldErrorHandler = NULL;
- UNLOCK_PROCESS;
-}
-
-static void AddHandler(req, mask, proc, closure)
-Request req;
-EventMask mask;
-XtEventHandler proc;
-XtPointer closure;
-{
- Display *dpy = req->ctx->dpy;
- Window window = req->requestor;
- Widget widget = XtWindowToWidget(dpy, window);
-
- if (widget != NULL) req->widget = widget;
- else widget = req->widget;
-
- if (XtWindow(widget) == window)
- XtAddEventHandler(widget, mask, False, proc, closure);
- else {
- RequestWindowRec *requestWindowRec;
- LOCK_PROCESS;
- if (selectWindowContext == 0)
- selectWindowContext = XUniqueContext();
- if (XFindContext(dpy, window, selectWindowContext,
- (XPointer *)&requestWindowRec)) {
- requestWindowRec = XtNew(RequestWindowRec);
- requestWindowRec->active_transfer_count = 0;
- (void)XSaveContext(dpy, window, selectWindowContext,
- (char *)requestWindowRec);
- }
- UNLOCK_PROCESS;
- if (requestWindowRec->active_transfer_count++ == 0) {
- XtRegisterDrawable(dpy, window, widget);
- XSelectInput(dpy, window, mask);
- }
- XtAddRawEventHandler(widget, mask, FALSE, proc, closure);
- }
-}
-
-static void RemoveHandler(req, mask, proc, closure)
-Request req;
-EventMask mask;
-XtEventHandler proc;
-XtPointer closure;
-{
- Display *dpy = req->ctx->dpy;
- Window window = req->requestor;
- Widget widget = req->widget;
-
- if ((XtWindowToWidget(dpy, window) == widget) &&
- (XtWindow(widget) != window)) {
- /* we had to hang this window onto our widget; take it off */
- RequestWindowRec* requestWindowRec;
- XtRemoveRawEventHandler(widget, mask, TRUE, proc, closure);
- LOCK_PROCESS;
- (void)XFindContext(dpy, window, selectWindowContext,
- (XPointer *)&requestWindowRec);
- UNLOCK_PROCESS;
- if (--requestWindowRec->active_transfer_count == 0) {
- XtUnregisterDrawable(dpy, window);
- StartProtectedSection(dpy, window);
- XSelectInput(dpy, window, 0L);
- EndProtectedSection(dpy);
- LOCK_PROCESS;
- (void)XDeleteContext(dpy, window, selectWindowContext);
- UNLOCK_PROCESS;
- XtFree((char*)requestWindowRec);
- }
- } else {
- XtRemoveEventHandler(widget, mask, TRUE, proc, closure);
- }
-}
-
-/* ARGSUSED */
-static void OwnerTimedOut(closure, id)
-XtPointer closure;
-XtIntervalId *id;
-{
- Request req = (Request)closure;
- Select ctx = req->ctx;
-
- if (ctx->incremental && (ctx->owner_cancel != NULL)) {
- (*ctx->owner_cancel)(ctx->widget, &ctx->selection,
- &req->target, (XtRequestId*)&req,
- ctx->owner_closure);
- } else {
- if (ctx->notify == NULL)
- XtFree((char*)req->value);
- else {
- /* the requestor hasn't deleted the property, but
- * the owner needs to free the value.
- */
- if (ctx->incremental)
- (*(XtSelectionDoneIncrProc)ctx->notify)
- (ctx->widget, &ctx->selection, &req->target,
- (XtRequestId*)&req, ctx->owner_closure);
- else
- (*ctx->notify)(ctx->widget, &ctx->selection, &req->target);
- }
- }
-
- RemoveHandler(req, (EventMask)PropertyChangeMask,
- HandlePropertyGone, closure);
- XtFree((char*)req);
- if (--ctx->ref_count == 0 && ctx->free_when_done)
- XtFree((char*)ctx);
-}
-
-static void SendIncrement(incr)
- Request incr;
-{
- Display *dpy = incr->ctx->dpy;
-
- int incrSize = MAX_SELECTION_INCR(dpy);
- if (incrSize > incr->bytelength - incr->offset)
- incrSize = incr->bytelength - incr->offset;
- StartProtectedSection(dpy, incr->requestor);
- XChangeProperty(dpy, incr->requestor, incr->property,
- incr->type, incr->format, PropModeReplace,
- (unsigned char *)incr->value + incr->offset,
- NUMELEM(incrSize, incr->format));
- EndProtectedSection(dpy);
- incr->offset += incrSize;
-}
-
-static void AllSent(req)
-Request req;
-{
- Select ctx = req->ctx;
- StartProtectedSection(ctx->dpy, req->requestor);
- XChangeProperty(ctx->dpy, req->requestor,
- req->property, req->type, req->format,
- PropModeReplace, (unsigned char *) NULL, 0);
- EndProtectedSection(ctx->dpy);
- req->allSent = TRUE;
-
- if (ctx->notify == NULL) XtFree((char*)req->value);
-}
-
-/*ARGSUSED*/
-static void HandlePropertyGone(widget, closure, ev, cont)
-Widget widget;
-XtPointer closure;
-XEvent *ev;
-Boolean *cont;
-{
- XPropertyEvent *event = (XPropertyEvent *) ev;
- Request req = (Request)closure;
- Select ctx = req->ctx;
-
- if ((event->type != PropertyNotify) ||
- (event->state != PropertyDelete) ||
- (event->atom != req->property) ||
- (event->window != req->requestor))
- return;
-#ifndef DEBUG_WO_TIMERS
- XtRemoveTimeOut(req->timeout);
-#endif
- if (req->allSent) {
- if (ctx->notify)
- if (ctx->incremental) {
- (*(XtSelectionDoneIncrProc)ctx->notify)
- (ctx->widget, &ctx->selection, &req->target,
- (XtRequestId*)&req, ctx->owner_closure);
- }
- else (*ctx->notify)(ctx->widget, &ctx->selection, &req->target);
- RemoveHandler(req, (EventMask)PropertyChangeMask,
- HandlePropertyGone, closure);
- XtFree((char*)req);
- if (--ctx->ref_count == 0 && ctx->free_when_done)
- XtFree((char*)ctx);
- } else { /* is this part of an incremental transfer? */
- if (ctx->incremental) {
- if (req->bytelength == 0)
- AllSent(req);
- else {
- unsigned long size = MAX_SELECTION_INCR(ctx->dpy);
- SendIncrement(req);
- (*(XtConvertSelectionIncrProc)ctx->convert)
- (ctx->widget, &ctx->selection, &req->target,
- &req->type, &req->value,
- &req->bytelength, &req->format,
- &size, ctx->owner_closure, (XtPointer*)&req);
- if (req->bytelength)
- req->bytelength = BYTELENGTH(req->bytelength, req->format);
- req->offset = 0;
- }
- } else {
- if (req->offset < req->bytelength)
- SendIncrement(req);
- else AllSent(req);
- }
-#ifndef DEBUG_WO_TIMERS
- {
- XtAppContext app = XtWidgetToApplicationContext(req->widget);
- req->timeout = XtAppAddTimeOut(app,
- app->selectionTimeout, OwnerTimedOut, (XtPointer)req);
- }
-#endif
- }
-}
-
-static void PrepareIncremental(req, widget, window, property, target,
- targetType, value, length, format)
-Request req;
-Widget widget;
-Window window;
-Atom target;
-Atom property;
-Atom targetType;
-XtPointer value;
-unsigned long length;
-int format;
-{
- req->type = targetType;
- req->value = value;
- req->bytelength = BYTELENGTH(length,format);
- req->format = format;
- req->offset = 0;
- req->target = target;
- req->widget = widget;
- req->allSent = FALSE;
-#ifndef DEBUG_WO_TIMERS
- {
- XtAppContext app = XtWidgetToApplicationContext(widget);
- req->timeout = XtAppAddTimeOut(app,
- app->selectionTimeout, OwnerTimedOut, (XtPointer)req);
- }
-#endif
- AddHandler(req, (EventMask)PropertyChangeMask,
- HandlePropertyGone, (XtPointer)req);
-/* now send client INCR property */
- XChangeProperty(req->ctx->dpy, window, req->property,
- req->ctx->prop_list->incr_atom,
- 32, PropModeReplace,
- (unsigned char *)&req->bytelength, 1);
-}
-
-static Boolean GetConversion(ctx, event, target, property, widget)
-Select ctx; /* logical owner */
-XSelectionRequestEvent* event;
-Atom target;
-Atom property; /* requestor's property */
-Widget widget; /* physical owner (receives events) */
-{
- XtPointer value = NULL;
- unsigned long length;
- int format;
- Atom targetType;
- Request req = XtNew(RequestRec);
- Boolean timestamp_target = (target == ctx->prop_list->timestamp_atom);
-
- req->ctx = ctx;
- req->event = *event;
- req->property = property;
- req->requestor = event->requestor;
-
- if (timestamp_target) {
- value = __XtMalloc(sizeof(long));
- *(long*)value = ctx->time;
- targetType = XA_INTEGER;
- length = 1;
- format = 32;
- }
- else {
- ctx->ref_count++;
- if (ctx->incremental == TRUE) {
- unsigned long size = MAX_SELECTION_INCR(ctx->dpy);
- if ((*(XtConvertSelectionIncrProc)ctx->convert)
- (ctx->widget, &event->selection, &target,
- &targetType, &value, &length, &format,
- &size, ctx->owner_closure, (XtRequestId*)&req)
- == FALSE) {
- XtFree((char*)req);
- ctx->ref_count--;
- return(FALSE);
- }
- StartProtectedSection(ctx->dpy, event->requestor);
- PrepareIncremental(req, widget, event->requestor, property,
- target, targetType, value, length, format);
- return(TRUE);
- }
- ctx->req = req;
- if ((*ctx->convert)(ctx->widget, &event->selection, &target,
- &targetType, &value, &length, &format) == FALSE) {
- XtFree((char*)req);
- ctx->req = NULL;
- ctx->ref_count--;
- return(FALSE);
- }
- ctx->req = NULL;
- }
- StartProtectedSection(ctx->dpy, event->requestor);
- if (BYTELENGTH(length,format) <= MAX_SELECTION_INCR(ctx->dpy)) {
- if (! timestamp_target) {
- if (ctx->notify != NULL) {
- req->target = target;
- req->widget = widget;
- req->allSent = TRUE;
-#ifndef DEBUG_WO_TIMERS
- {
- XtAppContext app = XtWidgetToApplicationContext(req->widget);
- req->timeout = XtAppAddTimeOut(app,
- app->selectionTimeout, OwnerTimedOut, (XtPointer)req);
- }
-#endif
- AddHandler(req, (EventMask)PropertyChangeMask,
- HandlePropertyGone, (XtPointer)req);
- }
- else ctx->ref_count--;
- }
- XChangeProperty(ctx->dpy, event->requestor, property,
- targetType, format, PropModeReplace,
- (unsigned char *)value, (int)length);
- /* free storage for client if no notify proc */
- if (timestamp_target || ctx->notify == NULL) {
- XtFree((char*)value);
- XtFree((char*)req);
- }
- } else {
- PrepareIncremental(req, widget, event->requestor, property,
- target, targetType, value, length, format);
- }
- return(TRUE);
-}
-
-/*ARGSUSED*/
-static void HandleSelectionEvents(widget, closure, event, cont)
-Widget widget;
-XtPointer closure;
-XEvent *event;
-Boolean *cont;
-{
- Select ctx;
- XSelectionEvent ev;
- Atom target;
- int count;
- Boolean writeback = FALSE;
-
- ctx = (Select) closure;
- switch (event->type) {
- case SelectionClear:
- /* if this event is not for the selection we registered for,
- * don't do anything */
- if (ctx->selection != event->xselectionclear.selection ||
- ctx->serial > event->xselectionclear.serial)
- break;
- (void) LoseSelection(ctx, widget, event->xselectionclear.selection,
- event->xselectionclear.time);
- break;
- case SelectionRequest:
- /* if this event is not for the selection we registered for,
- * don't do anything */
- if (ctx->selection != event->xselectionrequest.selection)
- break;
- ev.type = SelectionNotify;
- ev.display = event->xselectionrequest.display;
- ev.requestor = event->xselectionrequest.requestor;
- ev.selection = event->xselectionrequest.selection;
- ev.time = event->xselectionrequest.time;
- ev.target = event->xselectionrequest.target;
- if (event->xselectionrequest.property == None) /* obsolete requestor */
- event->xselectionrequest.property = event->xselectionrequest.target;
- if (ctx->widget != widget || ctx->was_disowned
- || ((event->xselectionrequest.time != CurrentTime)
- && (event->xselectionrequest.time < ctx->time)))
- ev.property = None;
- else {
- if (ev.target == ctx->prop_list->indirect_atom) {
- IndirectPair *p;
- int format;
- unsigned long bytesafter, length;
- unsigned char *value;
- ev.property = event->xselectionrequest.property;
- StartProtectedSection(ev.display, ev.requestor);
- (void) XGetWindowProperty(ev.display, ev.requestor,
- event->xselectionrequest.property, 0L, 1000000,
- False,(Atom)AnyPropertyType, &target, &format, &length,
- &bytesafter, &value);
- count = BYTELENGTH(length, format) / sizeof(IndirectPair);
- for (p = (IndirectPair *)value; count; p++, count--) {
- EndProtectedSection(ctx->dpy);
- if (!GetConversion(ctx, (XSelectionRequestEvent*)event,
- p->target, p->property, widget)) {
-
- p->target = None;
- writeback = TRUE;
- StartProtectedSection(ctx->dpy, ev.requestor);
- }
- }
- if (writeback)
- XChangeProperty(ev.display, ev.requestor,
- event->xselectionrequest.property, target,
- format, PropModeReplace, value, (int)length);
- XFree((char *)value);
- } else /* not multiple */ {
- if (GetConversion(ctx, (XSelectionRequestEvent*)event,
- event->xselectionrequest.target,
- event->xselectionrequest.property,
- widget))
- ev.property = event->xselectionrequest.property;
- else {
- ev.property = None;
- StartProtectedSection(ctx->dpy, ev.requestor);
- }
- }
- }
- (void) XSendEvent(ctx->dpy, ev.requestor, False, (unsigned long)NULL,
- (XEvent *) &ev);
-
- EndProtectedSection(ctx->dpy);
-
- break;
- }
-}
-
-static Boolean OwnSelection(widget, selection, time, convert, lose, notify,
- cancel, closure, incremental)
-Widget widget;
-Atom selection;
-Time time;
-XtConvertSelectionProc convert;
-XtLoseSelectionProc lose;
-XtSelectionDoneProc notify;
-XtCancelConvertSelectionProc cancel;
-XtPointer closure;
-Boolean incremental;
-{
- Select ctx;
- Select oldctx = NULL;
-
- if (!XtIsRealized(widget)) return False;
-
- ctx = FindCtx(XtDisplay(widget), selection);
- if (ctx->widget != widget || ctx->time != time ||
- ctx->ref_count || ctx->was_disowned)
- {
- Boolean replacement = FALSE;
- Window window = XtWindow(widget);
- unsigned long serial = XNextRequest(ctx->dpy);
- XSetSelectionOwner(ctx->dpy, selection, window, time);
- if (XGetSelectionOwner(ctx->dpy, selection) != window)
- return FALSE;
- if (ctx->ref_count) { /* exchange is in-progress */
-#ifdef DEBUG_ACTIVE
- printf( "Active exchange for widget \"%s\"; selection=0x%lx, ref_count=%d\n",
- XtName(widget), (long)selection, ctx->ref_count );
-#endif
- if (ctx->widget != widget ||
- ctx->convert != convert ||
- ctx->loses != lose ||
- ctx->notify != notify ||
- ctx->owner_cancel != cancel ||
- ctx->incremental != incremental ||
- ctx->owner_closure != closure)
- {
- if (ctx->widget == widget) {
- XtRemoveEventHandler(widget, (EventMask)0, TRUE,
- HandleSelectionEvents, (XtPointer)ctx);
- XtRemoveCallback(widget, XtNdestroyCallback,
- WidgetDestroyed, (XtPointer)ctx);
- replacement = TRUE;
- }
- else if (!ctx->was_disowned) {
- oldctx = ctx;
- }
- ctx->free_when_done = TRUE;
- ctx = NewContext(XtDisplay(widget), selection);
- }
- else if (!ctx->was_disowned) { /* current owner is new owner */
- ctx->time = time;
- return TRUE;
- }
- }
- if (ctx->widget != widget || ctx->was_disowned || replacement) {
- if (ctx->widget && !ctx->was_disowned && !replacement) {
- oldctx = ctx;
- oldctx->free_when_done = TRUE;
- ctx = NewContext(XtDisplay(widget), selection);
- }
- XtAddEventHandler(widget, (EventMask)0, TRUE,
- HandleSelectionEvents, (XtPointer)ctx);
- XtAddCallback(widget, XtNdestroyCallback,
- WidgetDestroyed, (XtPointer)ctx);
- }
- ctx->widget = widget; /* Selection offically changes hands. */
- ctx->time = time;
- ctx->serial = serial;
- }
- ctx->convert = convert;
- ctx->loses = lose;
- ctx->notify = notify;
- ctx->owner_cancel = cancel;
- ctx->incremental = incremental;
- ctx->owner_closure = closure;
- ctx->was_disowned = FALSE;
-
- /* Defer calling the previous selection owner's lose selection procedure
- * until the new selection is established, to allow the previous
- * selection owner to ask for the new selection to be converted in
- * the lose selection procedure. The context pointer is the closure
- * of the event handler and the destroy callback, so the old context
- * pointer and the record contents must be preserved for LoseSelection.
- */
- if (oldctx) {
- (void) LoseSelection(oldctx, oldctx->widget, selection, oldctx->time);
- if (!oldctx->ref_count && oldctx->free_when_done)
- XtFree((char*)oldctx);
- }
- return TRUE;
-}
-
-
-Boolean XtOwnSelection(widget, selection, time, convert, lose, notify)
-Widget widget;
-Atom selection;
-Time time;
-XtConvertSelectionProc convert;
-XtLoseSelectionProc lose;
-XtSelectionDoneProc notify;
-{
- Boolean retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- retval = OwnSelection(widget, selection, time, convert, lose, notify,
- (XtCancelConvertSelectionProc)NULL,
- (XtPointer)NULL, FALSE);
- UNLOCK_APP(app);
- return retval;
-}
-
-
-Boolean XtOwnSelectionIncremental(widget, selection, time, convert,
- lose, notify, cancel, closure)
-Widget widget;
-Atom selection;
-Time time;
-XtConvertSelectionIncrProc convert;
-XtLoseSelectionIncrProc lose;
-XtSelectionDoneIncrProc notify;
-XtCancelConvertSelectionProc cancel;
-XtPointer closure;
-{
- Boolean retval;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- retval = OwnSelection(widget, selection, time,
- (XtConvertSelectionProc)convert,
- (XtLoseSelectionProc)lose,
- (XtSelectionDoneProc)notify,
- cancel, closure, TRUE);
- UNLOCK_APP(app);
- return retval;
-}
-
-
-void XtDisownSelection(widget, selection, time)
-Widget widget;
-Atom selection;
-Time time;
-{
- Select ctx;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- ctx = FindCtx(XtDisplay(widget), selection);
- if (LoseSelection(ctx, widget, selection, time))
- XSetSelectionOwner(XtDisplay(widget), selection, None, time);
- UNLOCK_APP(app);
-}
-
-/* Selection Requestor code */
-
-static Boolean IsINCRtype(info, window, prop)
- CallBackInfo info;
- Window window;
- Atom prop;
-{
- unsigned long bytesafter;
- unsigned long length;
- int format;
- Atom type;
- unsigned char *value;
-
- if (prop == None) return False;
-
- (void)XGetWindowProperty(XtDisplay(info->widget), window, prop, 0L, 0L,
- False, info->ctx->prop_list->incr_atom,
- &type, &format, &length, &bytesafter, &value);
-
- return (type == info->ctx->prop_list->incr_atom);
-}
-
-/*ARGSUSED*/
-static void ReqCleanup(widget, closure, ev, cont)
-Widget widget;
-XtPointer closure;
-XEvent *ev;
-Boolean *cont;
-{
- CallBackInfo info = (CallBackInfo)closure;
- unsigned long bytesafter, length;
- char *value;
- int format;
- Atom target;
-
- if (ev->type == SelectionNotify) {
- XSelectionEvent *event = (XSelectionEvent *) ev;
- if (!MATCH_SELECT(event, info)) return; /* not really for us */
- XtRemoveEventHandler(widget, (EventMask)0, TRUE,
- ReqCleanup, (XtPointer) info );
- if (IsINCRtype(info, XtWindow(widget), event->property)) {
- info->proc = HandleGetIncrement;
- XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask,
- FALSE, ReqCleanup, (XtPointer) info);
- } else {
- if (event->property != None)
- XDeleteProperty(event->display, XtWindow(widget),
- event->property);
- FreeSelectionProperty(XtDisplay(widget), info->property);
- FreeInfo(info);
- }
- } else if ((ev->type == PropertyNotify) &&
- (ev->xproperty.state == PropertyNewValue) &&
- (ev->xproperty.atom == info->property)) {
- XPropertyEvent *event = (XPropertyEvent *) ev;
- (void) XGetWindowProperty(event->display, XtWindow(widget),
- event->atom, 0L, 1000000, True, AnyPropertyType,
- &target, &format, &length, &bytesafter,
- (unsigned char **) &value);
- XFree(value);
- if (length == 0) {
- XtRemoveEventHandler(widget, (EventMask) PropertyChangeMask, FALSE,
- ReqCleanup, (XtPointer) info );
- FreeSelectionProperty(XtDisplay(widget), info->property);
- XtFree(info->value); /* requestor never got this, so free now */
- FreeInfo(info);
- }
- }
-}
-
-/* ARGSUSED */
-static void ReqTimedOut(closure, id)
-XtPointer closure;
-XtIntervalId *id;
-{
- XtPointer value = NULL;
- unsigned long length = 0;
- int format = 8;
- Atom resulttype = XT_CONVERT_FAIL;
- CallBackInfo info = (CallBackInfo)closure;
- unsigned long bytesafter;
- unsigned long proplength;
- Atom type;
- IndirectPair *pairs;
- XtPointer *c;
- int i;
-
- if (*info->target == info->ctx->prop_list->indirect_atom) {
- (void) XGetWindowProperty(XtDisplay(info->widget),
- XtWindow(info->widget), info->property, 0L,
- 10000000, True, AnyPropertyType, &type, &format,
- &proplength, &bytesafter, (unsigned char **) &pairs);
- XFree((char*)pairs);
- for (proplength = proplength / IndirectPairWordSize, i = 0, c = info->req_closure;
- proplength; proplength--, c++, i++)
- (*info->callbacks[i])(info->widget, *c,
- &info->ctx->selection, &resulttype, value, &length, &format);
- } else {
- (*info->callbacks[0])(info->widget, *info->req_closure,
- &info->ctx->selection, &resulttype, value, &length, &format);
- }
-
- /* change event handlers for straggler events */
- if (info->proc == (XtEventHandler)HandleSelectionReplies) {
- XtRemoveEventHandler(info->widget, (EventMask)0,
- TRUE, info->proc, (XtPointer) info);
- XtAddEventHandler(info->widget, (EventMask)0, TRUE,
- ReqCleanup, (XtPointer) info);
- } else {
- XtRemoveEventHandler(info->widget,(EventMask) PropertyChangeMask,
- FALSE, info->proc, (XtPointer) info);
- XtAddEventHandler(info->widget, (EventMask) PropertyChangeMask,
- FALSE, ReqCleanup, (XtPointer) info);
- }
-
-}
-
-/*ARGSUSED*/
-static void HandleGetIncrement(widget, closure, ev, cont)
-Widget widget;
-XtPointer closure;
-XEvent *ev;
-Boolean *cont;
-{
- XPropertyEvent *event = (XPropertyEvent *) ev;
- CallBackInfo info = (CallBackInfo) closure;
- Select ctx = info->ctx;
- char *value;
- unsigned long bytesafter;
- unsigned long length;
- int bad;
- int n = info->current;
-
- if ((event->state != PropertyNewValue) || (event->atom != info->property))
- return;
-
- bad = XGetWindowProperty(event->display, XtWindow(widget),
- event->atom, 0L,
- 10000000, True, AnyPropertyType, &info->type,
- &info->format, &length, &bytesafter,
- (unsigned char **) &value);
- if (bad)
- return;
-#ifndef DEBUG_WO_TIMERS
- XtRemoveTimeOut(info->timeout);
-#endif
- if (length == 0) {
- unsigned long u_offset = NUMELEM(info->offset, info->format);
- (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection,
- &info->type,
- (info->offset == 0 ? value : info->value),
- &u_offset, &info->format);
- /* assert ((info->offset != 0) == (info->incremental[n]) */
- if (info->offset != 0) XFree(value);
- XtRemoveEventHandler(widget, (EventMask) PropertyChangeMask, FALSE,
- HandleGetIncrement, (XtPointer) info);
- FreeSelectionProperty(event->display, info->property);
- FreeInfo(info);
- } else { /* add increment to collection */
- if (info->incremental[n]) {
-#ifdef XT_COPY_SELECTION
- int size = BYTELENGTH(length, info->format) + 1;
- char *tmp = __XtMalloc((Cardinal) size);
- (void) memmove(tmp, value, size);
- XFree(value);
- value = tmp;
-#endif
- (*info->callbacks[n])(widget, *info->req_closure, &ctx->selection,
- &info->type, value, &length, &info->format);
- } else {
- int size = BYTELENGTH(length, info->format);
- if (info->offset + size > info->bytelength) {
- /* allocate enough for this and the next increment */
- info->bytelength = info->offset + size * 2;
- info->value = XtRealloc(info->value,
- (Cardinal) info->bytelength);
- }
- (void) memmove(&info->value[info->offset], value, size);
- info->offset += size;
- XFree(value);
- }
- /* reset timer */
-#ifndef DEBUG_WO_TIMERS
- {
- XtAppContext app = XtWidgetToApplicationContext(info->widget);
- info->timeout = XtAppAddTimeOut(app,
- app->selectionTimeout, ReqTimedOut, (XtPointer) info);
- }
-#endif
- }
-}
-
-
-static void HandleNone(widget, callback, closure, selection)
-Widget widget;
-XtSelectionCallbackProc callback;
-XtPointer closure;
-Atom selection;
-{
- unsigned long length = 0;
- int format = 8;
- Atom type = None;
-
- (*callback)(widget, closure, &selection,
- &type, NULL, &length, &format);
-}
-
-
-static long IncrPropSize(widget, value, format, length)
- Widget widget;
- unsigned char* value;
- int format;
- unsigned long length;
-{
- unsigned long size;
- if (format == 32) {
- size = ((long*)value)[length-1]; /* %%% what order for longs? */
- return size;
- }
- else {
- XtAppWarningMsg( XtWidgetToApplicationContext(widget),
- "badFormat","xtGetSelectionValue",XtCXtToolkitError,
- "Selection owner returned type INCR property with format != 32",
- (String*)NULL, (Cardinal*)NULL );
- return 0;
- }
-}
-
-
-static
-Boolean HandleNormal(dpy, widget, property, info, closure, selection)
-Display *dpy;
-Widget widget;
-Atom property;
-CallBackInfo info;
-XtPointer closure;
-Atom selection;
-{
- unsigned long bytesafter;
- unsigned long length;
- int format;
- Atom type;
- unsigned char *value;
- int number = info->current;
-
- (void) XGetWindowProperty(dpy, XtWindow(widget), property, 0L,
- 10000000, False, AnyPropertyType,
- &type, &format, &length, &bytesafter, &value);
-
- if (type == info->ctx->prop_list->incr_atom) {
- unsigned long size = IncrPropSize(widget, value, format, length);
- XFree((char *)value);
- if (info->property != property) {
- /* within MULTIPLE */
- CallBackInfo ninfo;
- ninfo = MakeInfo(info->ctx, &info->callbacks[number],
- &info->req_closure[number], 1, widget,
- info->time, &info->incremental[number], &property);
- ninfo->target = (Atom *) __XtMalloc((unsigned) sizeof(Atom));
- *ninfo->target = info->target[number + 1];
- info = ninfo;
- }
- HandleIncremental(dpy, widget, property, info, size);
- return FALSE;
- }
-
- XDeleteProperty(dpy, XtWindow(widget), property);
-#ifdef XT_COPY_SELECTION
- if (value) { /* it could have been deleted after the SelectionNotify */
- int size = BYTELENGTH(length, info->format) + 1;
- char *tmp = __XtMalloc((Cardinal) size);
- (void) memmove(tmp, value, size);
- XFree(value);
- value = (unsigned char *) tmp;
- }
-#endif
- (*info->callbacks[number])(widget, closure, &selection,
- &type, (XtPointer)value, &length, &format);
-
- if (info->incremental[number]) {
- /* let requestor know the whole thing has been received */
- value = (unsigned char*)__XtMalloc((unsigned)1);
- length = 0;
- (*info->callbacks[number])(widget, closure, &selection,
- &type, (XtPointer)value, &length, &format);
- }
- return TRUE;
-}
-
-static void HandleIncremental(dpy, widget, property, info, size)
-Display *dpy;
-Widget widget;
-Atom property;
-CallBackInfo info;
-unsigned long size;
-{
- XtAddEventHandler(widget, (EventMask) PropertyChangeMask, FALSE,
- HandleGetIncrement, (XtPointer) info);
-
- /* now start the transfer */
- XDeleteProperty(dpy, XtWindow(widget), property);
- XFlush(dpy);
-
- info->bytelength = size;
- if (info->incremental[info->current]) /* requestor wants incremental too */
- info->value = NULL; /* so no need for buffer to assemble value */
- else
- info->value = (char *) __XtMalloc((unsigned) info->bytelength);
- info->offset = 0;
-
- /* reset the timer */
- info->proc = HandleGetIncrement;
-#ifndef DEBUG_WO_TIMERS
- {
- XtAppContext app = XtWidgetToApplicationContext(info->widget);
- info->timeout = XtAppAddTimeOut(app,
- app->selectionTimeout, ReqTimedOut, (XtPointer) info);
- }
-#endif
-}
-
-/*ARGSUSED*/
-static void HandleSelectionReplies(widget, closure, ev, cont)
-Widget widget;
-XtPointer closure;
-XEvent *ev;
-Boolean *cont;
-{
- XSelectionEvent *event = (XSelectionEvent *) ev;
- Display *dpy = event->display;
- CallBackInfo info = (CallBackInfo) closure;
- Select ctx = info->ctx;
- IndirectPair *pairs, *p;
- unsigned long bytesafter;
- unsigned long length;
- int format;
- Atom type;
- XtPointer *c;
-
- if (event->type != SelectionNotify) return;
- if (!MATCH_SELECT(event, info)) return; /* not really for us */
-#ifndef DEBUG_WO_TIMERS
- XtRemoveTimeOut(info->timeout);
-#endif
- XtRemoveEventHandler(widget, (EventMask)0, TRUE,
- HandleSelectionReplies, (XtPointer) info );
- if (event->target == ctx->prop_list->indirect_atom) {
- (void) XGetWindowProperty(dpy, XtWindow(widget), info->property, 0L,
- 10000000, True, AnyPropertyType, &type, &format,
- &length, &bytesafter, (unsigned char **) &pairs);
- for (length = length / IndirectPairWordSize, p = pairs,
- c = info->req_closure;
- length; length--, p++, c++, info->current++) {
- if (event->property == None || format != 32 || p->target == None
- || /* bug compatibility */ p->property == None) {
- HandleNone(widget, info->callbacks[info->current],
- *c, event->selection);
- if (p->property != None)
- FreeSelectionProperty(XtDisplay(widget), p->property);
- } else {
- if (HandleNormal(dpy, widget, p->property, info, *c,
- event->selection)) {
- FreeSelectionProperty(XtDisplay(widget), p->property);
- }
- }
- }
- XFree((char*)pairs);
- FreeSelectionProperty(dpy, info->property);
- FreeInfo(info);
- } else if (event->property == None) {
- HandleNone(widget, info->callbacks[0], *info->req_closure, event->selection);
- FreeSelectionProperty(XtDisplay(widget), info->property);
- FreeInfo(info);
- } else {
- if (HandleNormal(dpy, widget, event->property, info,
- *info->req_closure, event->selection)) {
- FreeSelectionProperty(XtDisplay(widget), info->property);
- FreeInfo(info);
- }
- }
-}
-
-static void DoLocalTransfer(req, selection, target, widget,
- callback, closure, incremental, property)
-Request req;
-Atom selection;
-Atom target;
-Widget widget; /* The widget requesting the value. */
-XtSelectionCallbackProc callback;
-XtPointer closure; /* the closure for the callback, not the conversion */
-Boolean incremental;
-Atom property;
-{
- Select ctx = req->ctx;
- XtPointer value = NULL, temp, total = NULL;
- unsigned long length;
- int format;
- Atom resulttype;
- unsigned long totallength = 0;
-
- req->event.type = 0;
- req->event.target = target;
- req->event.property = req->property = property;
- req->event.requestor = req->requestor = XtWindow(widget);
-
- if (ctx->incremental) {
- unsigned long size = MAX_SELECTION_INCR(ctx->dpy);
- if (!(*(XtConvertSelectionIncrProc)ctx->convert)
- (ctx->widget, &selection, &target,
- &resulttype, &value, &length, &format,
- &size, ctx->owner_closure, (XtRequestId*)&req)) {
- HandleNone(widget, callback, closure, selection);
- }
- else {
- if (incremental) {
- Boolean allSent = FALSE;
- while (!allSent) {
- if (ctx->notify && (value != NULL)) {
- int bytelength = BYTELENGTH(length,format);
- /* both sides think they own this storage */
- temp = __XtMalloc((unsigned)bytelength);
- (void) memmove(temp, value, bytelength);
- value = temp;
- }
- /* use care; older clients were never warned that
- * they must return a value even if length==0
- */
- if (value == NULL) value = __XtMalloc((unsigned)1);
- (*callback)(widget, closure, &selection,
- &resulttype, value, &length, &format);
- if (length) {
- /* should owner be notified on end-of-piece?
- * Spec is unclear, but non-local transfers don't.
- */
- (*(XtConvertSelectionIncrProc)ctx->convert)
- (ctx->widget, &selection, &target,
- &resulttype, &value, &length, &format,
- &size, ctx->owner_closure,
- (XtRequestId*)&req);
- }
- else allSent = TRUE;
- }
- } else {
- while (length) {
- int bytelength = BYTELENGTH(length, format);
- total = XtRealloc(total,
- (unsigned) (totallength += bytelength));
- (void) memmove((char*)total + totallength - bytelength,
- value,
- bytelength);
- (*(XtConvertSelectionIncrProc)ctx->convert)
- (ctx->widget, &selection, &target,
- &resulttype, &value, &length, &format,
- &size, ctx->owner_closure, (XtRequestId*)&req);
- }
- if (total == NULL) total = __XtMalloc(1);
- totallength = NUMELEM(totallength, format);
- (*callback)(widget, closure, &selection, &resulttype,
- total, &totallength, &format);
- }
- if (ctx->notify)
- (*(XtSelectionDoneIncrProc)ctx->notify)
- (ctx->widget, &selection, &target,
- (XtRequestId*)&req, ctx->owner_closure);
- else XtFree((char*)value);
- }
- } else { /* not incremental owner */
- if (!(*ctx->convert)(ctx->widget, &selection, &target,
- &resulttype, &value, &length, &format)) {
- HandleNone(widget, callback, closure, selection);
- } else {
- if (ctx->notify && (value != NULL)) {
- int bytelength = BYTELENGTH(length,format);
- /* both sides think they own this storage; better copy */
- temp = __XtMalloc((unsigned)bytelength);
- (void) memmove(temp, value, bytelength);
- value = temp;
- }
- if (value == NULL) value = __XtMalloc((unsigned)1);
- (*callback)(widget, closure, &selection, &resulttype,
- value, &length, &format);
- if (ctx->notify)
- (*ctx->notify)(ctx->widget, &selection, &target);
- }
- }
-}
-
-static void GetSelectionValue(widget, selection, target, callback,
- closure, time, incremental, property)
-Widget widget;
-Atom selection;
-Atom target;
-XtSelectionCallbackProc callback;
-XtPointer closure;
-Time time;
-Boolean incremental;
-Atom property;
-{
- Select ctx;
- CallBackInfo info;
- Atom properties[1];
-
- properties[0] = property;
-
- ctx = FindCtx(XtDisplay(widget), selection);
- if (ctx->widget && !ctx->was_disowned) {
- RequestRec req;
- ctx->req = &req;
- req.ctx = ctx;
- req.event.time = time;
- ctx->ref_count++;
- DoLocalTransfer(&req, selection, target, widget,
- callback, closure, incremental, property);
- if (--ctx->ref_count == 0 && ctx->free_when_done)
- XtFree((char*)ctx);
- else
- ctx->req = NULL;
- }
- else {
- info = MakeInfo(ctx, &callback, &closure, 1, widget,
- time, &incremental, properties);
- info->target = (Atom *)__XtMalloc((unsigned) sizeof(Atom));
- *(info->target) = target;
- RequestSelectionValue(info, selection, target);
- }
-}
-
-
-void XtGetSelectionValue(widget, selection, target, callback, closure, time)
-Widget widget;
-Atom selection;
-Atom target;
-XtSelectionCallbackProc callback;
-XtPointer closure;
-Time time;
-{
- Atom property;
- Boolean incr = False;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- property = GetParamInfo(widget, selection);
- RemoveParamInfo(widget, selection);
-
- if (IsGatheringRequest(widget, selection)) {
- AddSelectionRequests(widget, selection, 1, &target, &callback, 1,
- &closure, &incr, &property);
- } else {
- GetSelectionValue(widget, selection, target, callback,
- closure, time, FALSE, property);
- }
- UNLOCK_APP(app);
-}
-
-
-void XtGetSelectionValueIncremental(widget, selection, target, callback,
- closure, time)
-Widget widget;
-Atom selection;
-Atom target;
-XtSelectionCallbackProc callback;
-XtPointer closure;
-Time time;
-{
- Atom property;
- Boolean incr = TRUE;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- property = GetParamInfo(widget, selection);
- RemoveParamInfo(widget, selection);
-
- if (IsGatheringRequest(widget, selection)) {
- AddSelectionRequests(widget, selection, 1, &target, &callback, 1,
- &closure, &incr, &property);
- } else {
- GetSelectionValue(widget, selection, target, callback,
- closure, time, TRUE, property);
- }
-
- UNLOCK_APP(app);
-}
-
-
-static void GetSelectionValues(widget, selection, targets, count, callbacks,
- num_callbacks, closures, time, incremental,
- properties)
-Widget widget;
-Atom selection;
-Atom *targets;
-int count;
-XtSelectionCallbackProc *callbacks;
-int num_callbacks;
-XtPointer *closures;
-Time time;
-Boolean *incremental;
-Atom *properties;
-{
- Select ctx;
- CallBackInfo info;
- IndirectPair *pairs, *p;
- Atom *t;
-
- if (count == 0) return;
- ctx = FindCtx(XtDisplay(widget), selection);
- if (ctx->widget && !ctx->was_disowned) {
- int j, i;
- RequestRec req;
- ctx->req = &req;
- req.ctx = ctx;
- req.event.time = time;
- ctx->ref_count++;
- for (i = 0, j = 0; count; count--, i++, j++ ) {
- if (j >= num_callbacks) j = 0;
-
- DoLocalTransfer(&req, selection, targets[i], widget,
- callbacks[j], closures[i], incremental[i],
- properties ? properties[i] : None);
-
- }
- if (--ctx->ref_count == 0 && ctx->free_when_done)
- XtFree((char*)ctx);
- else
- ctx->req = NULL;
- } else {
- XtSelectionCallbackProc *passed_callbacks;
- XtSelectionCallbackProc stack_cbs[32];
- int i = 0, j = 0;
-
- passed_callbacks = (XtSelectionCallbackProc *)
- XtStackAlloc(sizeof(XtSelectionCallbackProc) * count, stack_cbs);
-
- /* To deal with the old calls from XtGetSelectionValues* we
- will repeat however many callbacks have been passed into
- the array */
- for(i = 0; i < count; i++) {
- if (j >= num_callbacks) j = 0;
- passed_callbacks[i] = callbacks[j];
- j++;
- }
- info = MakeInfo(ctx, passed_callbacks, closures, count, widget,
- time, incremental, properties);
- XtStackFree((XtPointer) passed_callbacks, stack_cbs);
-
- info->target = (Atom *)__XtMalloc((unsigned) ((count+1) * sizeof(Atom)));
- (*info->target) = ctx->prop_list->indirect_atom;
- (void) memmove((char *) info->target+sizeof(Atom), (char *) targets,
- count * sizeof(Atom));
- pairs = (IndirectPair*)__XtMalloc((unsigned)(count*sizeof(IndirectPair)));
- for (p = &pairs[count-1], t = &targets[count-1], i = count - 1;
- p >= pairs; p--, t--, i--) {
- p->target = *t;
- if (properties == NULL || properties[i] == None) {
- p->property = GetSelectionProperty(XtDisplay(widget));
- XDeleteProperty(XtDisplay(widget), XtWindow(widget),
- p->property);
- } else {
- p->property = properties[i];
- }
- }
- XChangeProperty(XtDisplay(widget), XtWindow(widget),
- info->property, info->property,
- 32, PropModeReplace, (unsigned char *) pairs,
- count * IndirectPairWordSize);
- XtFree((char*)pairs);
- RequestSelectionValue(info, selection, ctx->prop_list->indirect_atom);
- }
-}
-
-
-void XtGetSelectionValues(widget, selection, targets, count, callback,
- closures, time)
-Widget widget;
-Atom selection;
-Atom *targets;
-int count;
-XtSelectionCallbackProc callback;
-XtPointer *closures;
-Time time;
-{
- Boolean incremental_values[32];
- Boolean *incremental;
- int i;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- incremental = XtStackAlloc(count * sizeof(Boolean), incremental_values);
- for(i = 0; i < count; i++) incremental[i] = FALSE;
- if (IsGatheringRequest(widget, selection)) {
- AddSelectionRequests(widget, selection, count, targets, &callback,
- 1, closures, incremental, NULL);
- } else {
- GetSelectionValues(widget, selection, targets, count, &callback, 1,
- closures, time, incremental, NULL);
- }
- XtStackFree((XtPointer) incremental, incremental_values);
- UNLOCK_APP(app);
-}
-
-
-void XtGetSelectionValuesIncremental(widget, selection, targets, count,
- callback, closures, time)
-Widget widget;
-Atom selection;
-Atom *targets;
-int count;
-XtSelectionCallbackProc callback;
-XtPointer *closures;
-Time time;
-{
- Boolean incremental_values[32];
- Boolean *incremental;
- int i;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- incremental = XtStackAlloc(count * sizeof(Boolean), incremental_values);
- for(i = 0; i < count; i++) incremental[i] = TRUE;
- if (IsGatheringRequest(widget, selection)) {
- AddSelectionRequests(widget, selection, count, targets, &callback,
- 1, closures, incremental, NULL);
- } else {
- GetSelectionValues(widget, selection, targets, count,
- &callback, 1, closures, time, incremental, NULL);
- }
- XtStackFree((XtPointer) incremental, incremental_values);
- UNLOCK_APP(app);
-}
-
-
-static Request GetRequestRecord(widget, selection, id)
- Widget widget;
- Atom selection;
- XtRequestId id;
-{
- Request req = (Request)id;
- Select ctx = NULL;
-
- if ( (req == NULL
- && ((ctx = FindCtx( XtDisplay(widget), selection )) == NULL
- || ctx->req == NULL
- || ctx->selection != selection
- || ctx->widget == NULL))
- || (req != NULL
- && (req->ctx == NULL
- || req->ctx->selection != selection
- || req->ctx->widget != widget)))
- {
- String params = XtName(widget);
- Cardinal num_params = 1;
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "notInConvertSelection", "xtGetSelectionRequest",
- XtCXtToolkitError,
- "XtGetSelectionRequest or XtGetSelectionParameters called for widget \"%s\" outside of ConvertSelection proc",
- &params, &num_params
- );
- return NULL;
- }
-
- if (req == NULL) {
- /* non-incremental owner; only one request can be
- * outstanding at a time, so it's safe to keep ptr in ctx */
- req = ctx->req;
- }
- return req;
-}
-
-XSelectionRequestEvent *XtGetSelectionRequest(widget, selection, id)
- Widget widget;
- Atom selection;
- XtRequestId id;
-{
- Request req = (Request)id;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
-
- req = GetRequestRecord(widget, selection, id);
-
- if (! req) {
- UNLOCK_APP(app);
- return (XSelectionRequestEvent*) NULL;
- }
-
- if (req->event.type == 0) {
- /* owner is local; construct the remainder of the event */
- req->event.type = SelectionRequest;
- req->event.serial = LastKnownRequestProcessed(XtDisplay(widget));
- req->event.send_event = True;
- req->event.display = XtDisplay(widget);
- req->event.owner = XtWindow(req->ctx->widget);
- req->event.selection = selection;
- }
- UNLOCK_APP(app);
- return &req->event;
-}
-
-/* Property atom access */
-Atom XtReservePropertyAtom(w)
- Widget w;
-{
- return(GetSelectionProperty(XtDisplay(w)));
-}
-
-void XtReleasePropertyAtom(w, atom)
- Widget w;
- Atom atom;
-{
- FreeSelectionProperty(XtDisplay(w), atom);
-}
-
-
-/* Multiple utilities */
-
-/* All requests are put in a single list per widget. It is
- very unlikely anyone will be gathering multiple MULTIPLE
- requests at the same time, so the loss in efficiency for
- this case is acceptable */
-
-/* Queue one or more requests to the one we're gathering */
-static void AddSelectionRequests(wid, sel, count, targets, callbacks,
- num_cb, closures, incrementals, properties)
- Widget wid;
- Atom sel;
- int count;
- Atom *targets;
- XtSelectionCallbackProc *callbacks;
- int num_cb;
- XtPointer *closures;
- Boolean *incrementals;
- Atom *properties;
-{
- QueuedRequestInfo qi;
- Window window = XtWindow(wid);
- Display *dpy = XtDisplay(wid);
-
- LOCK_PROCESS;
- if (multipleContext == 0) multipleContext = XUniqueContext();
-
- qi = NULL;
- (void) XFindContext(dpy, window, multipleContext, (XPointer*) &qi);
-
- if (qi != NULL) {
- QueuedRequest *req = qi->requests;
- int start = qi->count;
- int i = 0;
- int j = 0;
-
- qi->count += count;
- req = (QueuedRequest*) XtRealloc((char*) req,
- (start + count) *
- sizeof(QueuedRequest));
- while(i < count) {
- QueuedRequest newreq = (QueuedRequest)
- __XtMalloc(sizeof(QueuedRequestRec));
- newreq->selection = sel;
- newreq->target = targets[i];
- if (properties != NULL)
- newreq->param = properties[i];
- else {
- newreq->param = GetSelectionProperty(dpy);
- XDeleteProperty(dpy, window, newreq->param);
- }
- newreq->callback = callbacks[j];
- newreq->closure = closures[i];
- newreq->incremental = incrementals[i];
-
- req[start] = newreq;
- start++;
- i++;
- j++;
- if (j > num_cb) j = 0;
- }
-
- qi->requests = req;
- } else {
- /* Impossible */
- }
-
- UNLOCK_PROCESS;
-}
-
-/* Only call IsGatheringRequest when we have a lock already */
-
-static Boolean IsGatheringRequest(wid, sel)
- Widget wid;
- Atom sel;
-{
- QueuedRequestInfo qi;
- Window window = XtWindow(wid);
- Display *dpy = XtDisplay(wid);
- Boolean found = False;
- int i;
-
- if (multipleContext == 0) multipleContext = XUniqueContext();
-
- qi = NULL;
- (void) XFindContext(dpy, window, multipleContext, (XPointer*) &qi);
-
- if (qi != NULL) {
- i = 0;
- while(qi->selections[i] != None) {
- if (qi->selections[i] == sel) {
- found = True;
- break;
- }
- i++;
- }
- }
-
- return(found);
-}
-
-/* Cleanup request scans the request queue and releases any
- properties queued, and removes any requests queued */
-static void CleanupRequest(dpy, qi, sel)
- Display *dpy;
- QueuedRequestInfo qi;
- Atom sel;
-{
- int i, j, n;
-
- i = 0;
-
- /* Remove this selection from the list */
- n = 0;
- while(qi->selections[n] != sel &&
- qi->selections[n] != None) n++;
- if (qi->selections[n] == sel) {
- while(qi->selections[n] != None) {
- qi->selections[n] = qi->selections[n + 1];
- n++;
- }
- }
-
- while(i < qi->count) {
- QueuedRequest req = qi->requests[i];
-
- if (req->selection == sel) {
- /* Match */
- if (req->param != None)
- FreeSelectionProperty(dpy, req->param);
- qi->count--;
-
- for(j = i; j < qi->count; j++)
- qi->requests[j] = qi->requests[j + 1];
-
- XtFree((char*) req);
- } else {
- i++;
- }
- }
-}
-
-extern void XtCreateSelectionRequest(widget, selection)
- Widget widget;
- Atom selection;
-{
- QueuedRequestInfo queueInfo;
- Window window = XtWindow(widget);
- Display *dpy = XtDisplay(widget);
- int n;
-
- LOCK_PROCESS;
- if (multipleContext == 0) multipleContext = XUniqueContext();
-
- queueInfo = NULL;
- (void) XFindContext(dpy, window, multipleContext, (XPointer*) &queueInfo);
-
- /* If there is one, then cancel it */
- if (queueInfo != 0)
- CleanupRequest(dpy, queueInfo, selection);
- else {
- /* Create it */
- queueInfo = (QueuedRequestInfo) __XtMalloc(sizeof(QueuedRequestInfoRec));
- queueInfo->count = 0;
- queueInfo->selections = (Atom*) __XtMalloc(sizeof(Atom) * 2);
- queueInfo->selections[0] = None;
- queueInfo->requests = (QueuedRequest *)
- __XtMalloc(sizeof(QueuedRequest));
- }
-
- /* Append this selection to list */
- n = 0;
- while(queueInfo->selections[n] != None) n++;
- queueInfo->selections =
- (Atom*) XtRealloc((char*) queueInfo->selections,
- (n + 2) * sizeof(Atom));
- queueInfo->selections[n] = selection;
- queueInfo->selections[n + 1] = None;
-
- (void) XSaveContext(dpy, window, multipleContext, (char*) queueInfo);
- UNLOCK_PROCESS;
-}
-
-extern void XtSendSelectionRequest(widget, selection, time)
- Widget widget;
- Atom selection;
- Time time;
-{
- QueuedRequestInfo queueInfo;
- Window window = XtWindow(widget);
- Display *dpy = XtDisplay(widget);
-
- LOCK_PROCESS;
- if (multipleContext == 0) multipleContext = XUniqueContext();
-
- queueInfo = NULL;
- (void) XFindContext(dpy, window, multipleContext, (XPointer*) &queueInfo);
- if (queueInfo != NULL) {
- int count = 0;
- int i;
- QueuedRequest *req = queueInfo->requests;
-
- /* Construct the requests and send it using
- GetSelectionValues */
- for(i = 0; i < queueInfo->count; i++)
- if (req[i]->selection == selection) count++;
-
- if (count > 0) {
- if (count == 1) {
- for(i = 0; i < queueInfo->count; i++)
- if (req[i]->selection == selection) break;
-
- /* special case a multiple which isn't needed */
- GetSelectionValue(widget, selection, req[i]->target,
- req[i]->callback, req[i]->closure, time,
- req[i]->incremental, req[i]->param);
- } else {
- Atom *targets;
- Atom t[PREALLOCED];
- XtSelectionCallbackProc *cbs;
- XtSelectionCallbackProc c[PREALLOCED];
- XtPointer *closures;
- XtPointer cs[PREALLOCED];
- Boolean *incrs;
- Boolean ins[PREALLOCED];
- Atom *props;
- Atom p[PREALLOCED];
- int i = 0;
- int j = 0;
-
- /* Allocate */
- targets = (Atom *) XtStackAlloc(count * sizeof(Atom), t);
- cbs = (XtSelectionCallbackProc *)
- XtStackAlloc(count * sizeof(XtSelectionCallbackProc), c);
- closures = (XtPointer *) XtStackAlloc(count * sizeof(XtPointer), cs);
- incrs = (Boolean *) XtStackAlloc(count * sizeof(Boolean), ins);
- props = (Atom *) XtStackAlloc(count * sizeof(Atom), p);
-
- /* Copy */
- for(i = 0; i < queueInfo->count; i++) {
- if (req[i]->selection == selection) {
- targets[j] = req[i]->target;
- cbs[j] = req[i]->callback;
- closures[j] = req[i]->closure;
- incrs[j] = req[i]->incremental;
- props[j] = req[i]->param;
- j++;
- }
- }
-
- /* Make the request */
- GetSelectionValues(widget, selection, targets, count,
- cbs, count, closures, time, incrs, props);
-
- /* Free */
- XtStackFree((XtPointer) targets, t);
- XtStackFree((XtPointer) cbs, c);
- XtStackFree((XtPointer) closures, cs);
- XtStackFree((XtPointer) incrs, ins);
- XtStackFree((XtPointer) props, p);
- }
- }
- }
-
- CleanupRequest(dpy, queueInfo, selection);
- UNLOCK_PROCESS;
-}
-
-extern void XtCancelSelectionRequest(widget, selection)
- Widget widget;
- Atom selection;
-{
- QueuedRequestInfo queueInfo;
- Window window = XtWindow(widget);
- Display *dpy = XtDisplay(widget);
-
- LOCK_PROCESS;
- if (multipleContext == 0) multipleContext = XUniqueContext();
-
- queueInfo = NULL;
- (void) XFindContext(dpy, window, multipleContext, (XPointer*) &queueInfo);
- /* If there is one, then cancel it */
- if (queueInfo != 0)
- CleanupRequest(dpy, queueInfo, selection);
- UNLOCK_PROCESS;
-}
-
-/* Parameter utilities */
-
-/* Parameters on a selection request */
-/* Places data on allocated parameter atom, then records the
- parameter atom data for use in the next call to one of
- the XtGetSelectionValue functions. */
-void XtSetSelectionParameters(requestor, selection, type, value, length, format)
- Widget requestor;
- Atom selection;
- Atom type;
- XtPointer value;
- unsigned long length;
- int format;
-{
- Display *dpy = XtDisplay(requestor);
- Window window = XtWindow(requestor);
- Atom property = GetParamInfo(requestor, selection);
-
- if (property == None) {
- property = GetSelectionProperty(dpy);
- AddParamInfo(requestor, selection, property);
- }
-
- XChangeProperty(dpy, window, property,
- type, format, PropModeReplace,
- (unsigned char *) value, length);
-}
-
-/* Retrieves data passed in a parameter. Data for this is stored
- on the originator's window */
-void XtGetSelectionParameters(owner, selection, request_id, type_return,
- value_return, length_return, format_return)
- Widget owner;
- Atom selection;
- XtRequestId request_id;
- Atom* type_return;
- XtPointer* value_return;
- unsigned long* length_return;
- int* format_return;
-{
- Request req;
- Display *dpy = XtDisplay(owner);
- WIDGET_TO_APPCON(owner);
-
- *value_return = NULL;
- *length_return = *format_return = 0;
- *type_return = None;
-
- LOCK_APP(app);
-
- req = GetRequestRecord(owner, selection, request_id);
-
- if (req && req->property) {
- unsigned long bytes_after; /* unused */
- StartProtectedSection(dpy, req->requestor);
- XGetWindowProperty(dpy, req->requestor, req->property, 0L, 10000000,
- False, AnyPropertyType, type_return, format_return,
- length_return, &bytes_after,
- (unsigned char**) value_return);
- EndProtectedSection(dpy);
-#ifdef XT_COPY_SELECTION
- if (*value_return) {
- int size = BYTELENGTH(*length_return, *format_return) + 1;
- char *tmp = __XtMalloc((Cardinal) size);
- (void) memmove(tmp, *value_return, size);
- XFree(*value_return);
- *value_return = tmp;
- }
-#endif
- }
- UNLOCK_APP(app);
-}
-
-/* Parameters are temporarily stashed in an XContext. A list is used because
- * there may be more than one selection request in progress. The context
- * data is deleted when the list is empty. In the future, the parameter
- * context could be merged with other contexts used during selections.
- */
-
-static void AddParamInfo(w, selection, param_atom)
- Widget w;
- Atom selection;
- Atom param_atom;
-{
- int n;
- Param p;
- ParamInfo pinfo;
-
- LOCK_PROCESS;
- if (paramPropertyContext == 0)
- paramPropertyContext = XUniqueContext();
-
- if (XFindContext(XtDisplay(w), XtWindow(w), paramPropertyContext,
- (XPointer *) &pinfo)) {
- pinfo = (ParamInfo) __XtMalloc(sizeof(ParamInfoRec));
- pinfo->count = 1;
- pinfo->paramlist = XtNew(ParamRec);
- p = pinfo->paramlist;
- (void) XSaveContext(XtDisplay(w), XtWindow(w), paramPropertyContext,
- (char *)pinfo);
- }
- else {
- for (n = pinfo->count, p = pinfo->paramlist; n; n--, p++) {
- if (p->selection == None || p->selection == selection)
- break;
- }
- if (n == 0) {
- pinfo->count++;
- pinfo->paramlist = (Param)
- XtRealloc((char*) pinfo->paramlist,
- pinfo->count * sizeof(ParamRec));
- p = &pinfo->paramlist[pinfo->count - 1];
- (void) XSaveContext(XtDisplay(w), XtWindow(w),
- paramPropertyContext, (char *)pinfo);
- }
- }
- p->selection = selection;
- p->param = param_atom;
- UNLOCK_PROCESS;
-}
-
-static void RemoveParamInfo(w, selection)
- Widget w;
- Atom selection;
-{
- int n;
- Param p;
- ParamInfo pinfo;
- Boolean retain = False;
-
- LOCK_PROCESS;
- if (paramPropertyContext
- && (XFindContext(XtDisplay(w), XtWindow(w), paramPropertyContext,
- (XPointer *) &pinfo) == 0)) {
-
- /* Find and invalidate the parameter data. */
- for (n = pinfo->count, p = pinfo->paramlist; n; n--, p++) {
- if (p->selection != None) {
- if (p->selection == selection)
- p->selection = None;
- else
- retain = True;
- }
- }
- /* If there's no valid data remaining, release the context entry. */
- if (! retain) {
- XtFree((char*) pinfo->paramlist);
- XtFree((char*) pinfo);
- XDeleteContext(XtDisplay(w), XtWindow(w), paramPropertyContext);
- }
- }
- UNLOCK_PROCESS;
-}
-
-static Atom GetParamInfo(w, selection)
- Widget w;
- Atom selection;
-{
- int n;
- Param p;
- ParamInfo pinfo;
- Atom atom = None;
-
- LOCK_PROCESS;
- if (paramPropertyContext
- && (XFindContext(XtDisplay(w), XtWindow(w), paramPropertyContext,
- (XPointer *) &pinfo) == 0)) {
-
- for (n = pinfo->count, p = pinfo->paramlist; n; n--, p++)
- if (p->selection == selection) {
- atom = p->param;
- break;
- }
- }
- UNLOCK_PROCESS;
- return atom;
-}
diff --git a/xc/lib/Xt/SelectionI.h b/xc/lib/Xt/SelectionI.h
deleted file mode 100644
index 5d8cff96b..000000000
--- a/xc/lib/Xt/SelectionI.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* $TOG: SelectionI.h /main/38 1998/02/06 13:25:38 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtselectionI_h
-#define _XtselectionI_h
-
-#include "Intrinsic.h"
-
-typedef struct _RequestRec *Request;
-typedef struct _SelectRec *Select;
-
-typedef struct _RequestRec {
- Select ctx; /* logical owner */
- Widget widget; /* widget actually receiving Selection events */
- Window requestor;
- Atom property;
- Atom target;
- Atom type;
- int format;
- XtPointer value;
- unsigned long bytelength;
- int offset;
- XtIntervalId timeout;
- XSelectionRequestEvent event; /* for XtGetSelectionRequest */
- Boolean allSent;
-} RequestRec;
-
-typedef struct {
- Atom prop;
- Boolean avail;
-} SelectionPropRec, *SelectionProp;
-
-typedef struct {
- Display *dpy;
- Atom incr_atom, indirect_atom, timestamp_atom;
- int propCount;
- SelectionProp list;
-} PropListRec, *PropList;
-
-typedef struct _SelectRec {
- Atom selection; /* constant */
- Display *dpy; /* constant */
- Widget widget;
- Time time;
- unsigned long serial;
- XtConvertSelectionProc convert;
- XtLoseSelectionProc loses;
- XtSelectionDoneProc notify;
- XtCancelConvertSelectionProc owner_cancel;
- XtPointer owner_closure;
- PropList prop_list;
- Request req; /* state for local non-incr xfer */
- int ref_count; /* of active transfers */
- unsigned int incremental:1;
- unsigned int free_when_done:1;
- unsigned int was_disowned:1;
-} SelectRec;
-
-typedef struct _ParamRec {
- Atom selection;
- Atom param;
-} ParamRec, *Param;
-
-typedef struct _ParamInfoRec {
- unsigned int count;
- Param paramlist;
-} ParamInfoRec, *ParamInfo;
-
-typedef struct _QueuedRequestRec {
- Atom selection;
- Atom target;
- Atom param;
- XtSelectionCallbackProc callback;
- XtPointer closure;
- Time time;
- Boolean incremental;
-} QueuedRequestRec, *QueuedRequest;
-
-typedef struct _QueuedRequestInfoRec {
- int count;
- Atom *selections;
- QueuedRequest *requests;
-} QueuedRequestInfoRec, *QueuedRequestInfo;
-
-typedef struct {
- XtSelectionCallbackProc *callbacks;
- XtPointer *req_closure;
- Atom property;
- Atom *target;
- Atom type;
- int format;
- char *value;
- int bytelength;
- int offset;
- XtIntervalId timeout;
- XtEventHandler proc;
- Widget widget;
- Time time;
- Select ctx;
- Boolean *incremental;
- int current;
-} CallBackInfoRec, *CallBackInfo;
-
-typedef struct {
- Atom target;
- Atom property;
-} IndirectPair;
-
-#define IndirectPairWordSize 2
-
-typedef struct {
- int active_transfer_count;
-} RequestWindowRec;
-
-#define MAX_SELECTION_INCR(dpy) (((65536 < XMaxRequestSize(dpy)) ? \
- (65536 << 2) : (XMaxRequestSize(dpy) << 2))-100)
-
-#define MATCH_SELECT(event, info) ((event->time == info->time) && \
- (event->requestor == XtWindow(info->widget)) && \
- (event->selection == info->ctx->selection) && \
- (event->target == *info->target))
-
-#endif /* _XtselectionI_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/SetSens.c b/xc/lib/Xt/SetSens.c
deleted file mode 100644
index 433119a85..000000000
--- a/xc/lib/Xt/SetSens.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* $TOG: SetSens.c /main/7 1998/02/06 13:25:53 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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 "IntrinsicI.h"
-#include "StringDefs.h"
-
-/*
- * XtSetSensitive()
- */
-
-static void SetAncestorSensitive(widget, ancestor_sensitive)
- register Widget widget;
- Boolean ancestor_sensitive;
-{
- Arg args[1];
- register Cardinal i;
- register WidgetList children;
-
- if (widget->core.ancestor_sensitive == ancestor_sensitive) return;
-
- XtSetArg(args[0], XtNancestorSensitive, ancestor_sensitive);
- XtSetValues(widget, args, XtNumber(args));
-
- /* If widget's sensitive is TRUE, propagate new ancestor_sensitive to
- children's ancestor_sensitive; else do nothing as children's
- ancestor_sensitive is already FALSE */
-
- if (widget->core.sensitive && XtIsComposite(widget)) {
- children = ((CompositeWidget) widget)->composite.children;
- for (i=0; i < ((CompositeWidget)widget)->composite.num_children; i++) {
- SetAncestorSensitive (children[i], ancestor_sensitive);
- }
- }
-} /* SetAncestorSensitive */
-
-
-#if NeedFunctionPrototypes
-void XtSetSensitive(
- register Widget widget,
- _XtBoolean sensitive
- )
-#else
-void XtSetSensitive(widget, sensitive)
- register Widget widget;
- Boolean sensitive;
-#endif
-{
- Arg args[1];
- register Cardinal i;
- register WidgetList children;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (widget->core.sensitive == sensitive) {
- UNLOCK_APP(app);
- return;
- }
-
- XtSetArg(args[0], XtNsensitive, sensitive);
- XtSetValues(widget, args, XtNumber(args));
-
- /* If widget's ancestor_sensitive is TRUE, propagate new sensitive to
- children's ancestor_sensitive; else do nothing as children's
- ancestor_sensitive is already FALSE */
-
- if (widget->core.ancestor_sensitive && XtIsComposite (widget)) {
- children = ((CompositeWidget) widget)->composite.children;
- for (i = 0; i < ((CompositeWidget)widget)->composite.num_children; i++){
- SetAncestorSensitive (children[i], sensitive);
- }
- }
- UNLOCK_APP(app);
-} /* XtSetSensitive */
diff --git a/xc/lib/Xt/SetValues.c b/xc/lib/Xt/SetValues.c
deleted file mode 100644
index 67c7f2966..000000000
--- a/xc/lib/Xt/SetValues.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/* $TOG: SetValues.c /main/24 1998/02/06 13:25:58 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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 "IntrinsicI.h"
-
-/*
- * XtSetValues(), XtSetSubvalues()
- */
-
-
-extern void _XtCopyFromArg();
-extern XrmResourceList* _XtCreateIndirectionTable();
-
-static void SetValues(base, res, num_resources, args, num_args)
- char* base; /* Base address to write values to */
- XrmResourceList* res; /* The current resource values. */
- register Cardinal num_resources; /* number of items in resources */
- ArgList args; /* The resource values to set */
- Cardinal num_args; /* number of items in arg list */
-{
- register ArgList arg;
- register int i;
- register XrmName argName;
- register XrmResourceList* xrmres;
-
- /* Resource lists are assumed to be in compiled form already via the
- initial XtGetResources, XtGetSubresources calls */
-
- for (arg = args ; num_args != 0; num_args--, arg++) {
- argName = StringToName(arg->name);
- for (xrmres = res, i = 0; i < num_resources; i++, xrmres++) {
- if (argName == (*xrmres)->xrm_name) {
- _XtCopyFromArg(arg->value,
- base - (*xrmres)->xrm_offset - 1,
- (*xrmres)->xrm_size);
- break;
- }
- }
- }
-} /* SetValues */
-
-static Boolean CallSetValues (class, current, request, new, args, num_args)
- WidgetClass class;
- Widget current, request, new;
- ArgList args;
- Cardinal num_args;
-{
- Boolean redisplay = FALSE;
- WidgetClass superclass;
- XtArgsFunc set_values_hook;
- XtSetValuesFunc set_values;
-
- LOCK_PROCESS;
- superclass = class->core_class.superclass;
- UNLOCK_PROCESS;
- if (superclass)
- redisplay =
- CallSetValues(superclass, current, request, new, args, num_args);
-
- LOCK_PROCESS;
- set_values = class->core_class.set_values;
- UNLOCK_PROCESS;
- if (set_values)
- redisplay |= (*set_values) (current, request, new, args, &num_args);
-
- LOCK_PROCESS;
- set_values_hook = class->core_class.set_values_hook;
- UNLOCK_PROCESS;
- if (set_values_hook)
- redisplay |= (*set_values_hook) (new, args, &num_args);
- return (redisplay);
-}
-
-static Boolean
-CallConstraintSetValues (class, current, request, new, args, num_args)
- ConstraintWidgetClass class;
- Widget current, request, new;
- ArgList args;
- Cardinal num_args;
-{
- Boolean redisplay = FALSE;
- XtSetValuesFunc set_values;
- ConstraintWidgetClass superclass;
-
- if ((WidgetClass)class != constraintWidgetClass) {
- if (class == NULL)
- XtAppErrorMsg(XtWidgetToApplicationContext(current),
- "invalidClass","constraintSetValue",XtCXtToolkitError,
- "Subclass of Constraint required in CallConstraintSetValues",
- (String *)NULL, (Cardinal *)NULL);
- LOCK_PROCESS;
- superclass = (ConstraintWidgetClass) class->core_class.superclass;
- UNLOCK_PROCESS;
- redisplay =
- CallConstraintSetValues(superclass,
- current, request, new, args, num_args);
- }
- LOCK_PROCESS;
- set_values = class->constraint_class.set_values;
- UNLOCK_PROCESS;
- if (set_values)
- redisplay |= (*set_values) (current, request, new, args, &num_args);
- return (redisplay);
-}
-
-void XtSetSubvalues(base, resources, num_resources, args, num_args)
- XtPointer base; /* Base address to write values to */
- register XtResourceList resources; /* The current resource values. */
- register Cardinal num_resources; /* number of items in resources */
- ArgList args; /* The resource values to set */
- Cardinal num_args; /* number of items in arg list */
-{
- register XrmResourceList* xrmres;
- xrmres = _XtCreateIndirectionTable (resources, num_resources);
- SetValues((char*)base,xrmres,num_resources, args, num_args);
- XtFree((char *)xrmres);
-}
-
-
-void XtSetValues(w, args, num_args)
- register Widget w;
- ArgList args;
- Cardinal num_args;
-{
- register Widget oldw, reqw;
- /* need to use strictest alignment rules possible in next two decls. */
- double oldwCache[100], reqwCache[100];
- double oldcCache[20], reqcCache[20];
- Cardinal widgetSize, constraintSize;
- Boolean redisplay, cleared_rect_obj = False;
- XtGeometryResult result;
- XtWidgetGeometry geoReq, geoReply;
- WidgetClass wc;
- ConstraintWidgetClass cwc;
- Boolean hasConstraints;
- XtAlmostProc set_values_almost;
- XtAppContext app = XtWidgetToApplicationContext(w);
- Widget hookobj = XtHooksOfDisplay(XtDisplayOfObject(w));
-
- LOCK_APP(app);
- wc = XtClass(w);
- if ((args == NULL) && (num_args != 0)) {
- XtAppErrorMsg(app,
- "invalidArgCount","xtSetValues",XtCXtToolkitError,
- "Argument count > 0 on NULL argument list in XtSetValues",
- (String *)NULL, (Cardinal *)NULL);
- }
-
- /* Allocate and copy current widget into old widget */
-
- LOCK_PROCESS;
- widgetSize = wc->core_class.widget_size;
- UNLOCK_PROCESS;
- oldw = (Widget) XtStackAlloc(widgetSize, oldwCache);
- reqw = (Widget) XtStackAlloc (widgetSize, reqwCache);
- (void) memmove((char *) oldw, (char *) w, (int) widgetSize);
-
- /* Set resource values */
-
- LOCK_PROCESS;
- SetValues((char*)w, (XrmResourceList *) wc->core_class.resources,
- wc->core_class.num_resources, args, num_args);
- UNLOCK_PROCESS;
-
- (void) memmove ((char *) reqw, (char *) w, (int) widgetSize);
-
- hasConstraints = (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)));
-
- /* Some widget sets apparently do ugly things by freeing the
- * constraints on some children, thus the extra test here */
- if (hasConstraints) {
- cwc = (ConstraintWidgetClass) XtClass(w->core.parent);
- if (w->core.constraints) {
- LOCK_PROCESS;
- constraintSize = cwc->constraint_class.constraint_size;
- UNLOCK_PROCESS;
- } else constraintSize = 0;
- } else constraintSize = 0;
-
- if (constraintSize) {
- /* Allocate and copy current constraints into oldw */
- oldw->core.constraints = XtStackAlloc(constraintSize, oldcCache);
- reqw->core.constraints = XtStackAlloc(constraintSize, reqcCache);
- (void) memmove((char *) oldw->core.constraints,
- (char *) w->core.constraints, (int) constraintSize);
-
- /* Set constraint values */
- LOCK_PROCESS;
- SetValues((char*)w->core.constraints,
- (XrmResourceList *)(cwc->constraint_class.resources),
- cwc->constraint_class.num_resources, args, num_args);
- UNLOCK_PROCESS;
- (void) memmove((char *) reqw->core.constraints,
- (char *) w->core.constraints, (int) constraintSize);
- }
-
- /* Inform widget of changes, then inform parent of changes */
- redisplay = CallSetValues (wc, oldw, reqw, w, args, num_args);
- if (hasConstraints) {
- redisplay |= CallConstraintSetValues(cwc, oldw, reqw, w, args, num_args);
- }
-
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
- XtChangeHookSetValuesDataRec set_val;
-
- set_val.old = oldw;
- set_val.req = reqw;
- set_val.args = args;
- set_val.num_args = num_args;
- call_data.type = XtHsetValues;
- call_data.widget = w;
- call_data.event_data = (XtPointer) &set_val;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-
- if (XtIsRectObj(w)) {
- /* Now perform geometry request if needed */
- geoReq.request_mode = 0;
- if (oldw->core.x != w->core.x) {
- geoReq.x = w->core.x;
- w->core.x = oldw->core.x;
- geoReq.request_mode |= CWX;
- }
- if (oldw->core.y != w->core.y) {
- geoReq.y = w->core.y;
- w->core.y = oldw->core.y;
- geoReq.request_mode |= CWY;
- }
- if (oldw->core.width != w->core.width) {
- geoReq.width = w->core.width;
- w->core.width = oldw->core.width;
- geoReq.request_mode |= CWWidth;
- }
- if (oldw->core.height != w->core.height) {
- geoReq.height = w->core.height;
- w->core.height = oldw->core.height;
- geoReq.request_mode |= CWHeight;
- }
- if (oldw->core.border_width != w->core.border_width) {
- geoReq.border_width = w->core.border_width;
- w->core.border_width = oldw->core.border_width;
- geoReq.request_mode |= CWBorderWidth;
- }
-
- if (geoReq.request_mode != 0) {
- /* Pass on any requests for unchanged geometry values */
- if (geoReq.request_mode !=
- (CWX | CWY | CWWidth | CWHeight | CWBorderWidth)) {
- for ( ; num_args != 0; num_args--, args++) {
- if (! (geoReq.request_mode & CWX) &&
- strcmp(XtNx, args->name) == 0) {
- geoReq.x = w->core.x;
- geoReq.request_mode |= CWX;
- } else if (! (geoReq.request_mode & CWY) &&
- strcmp(XtNy, args->name) == 0) {
- geoReq.y = w->core.y;
- geoReq.request_mode |= CWY;
- } else if (! (geoReq.request_mode & CWWidth) &&
- strcmp(XtNwidth, args->name) == 0) {
- geoReq.width = w->core.width;
- geoReq.request_mode |= CWWidth;
- } else if (! (geoReq.request_mode & CWHeight) &&
- strcmp(XtNheight, args->name) == 0) {
- geoReq.height = w->core.height;
- geoReq.request_mode |= CWHeight;
- } else if (! (geoReq.request_mode & CWBorderWidth) &&
- strcmp(XtNborderWidth, args->name) == 0) {
- geoReq.border_width = w->core.border_width;
- geoReq.request_mode |= CWBorderWidth;
- }
- }
- }
- CALLGEOTAT(_XtGeoTrace(w,
- "\nXtSetValues sees some geometry changes for \"%s\".\n",
- XtName(w)));
- CALLGEOTAT(_XtGeoTab(1));
- do {
- XtGeometryHookDataRec call_data;
-
- if (XtHasCallbacks(hookobj, XtNgeometryHook) == XtCallbackHasSome) {
- call_data.type = XtHpreGeometry;
- call_data.widget = w;
- call_data.request = &geoReq;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.geometryhook_callbacks,
- (XtPointer)&call_data);
- call_data.result = result =
- _XtMakeGeometryRequest(w, &geoReq, &geoReply,
- &cleared_rect_obj);
- call_data.type = XtHpostGeometry;
- call_data.reply = &geoReply;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.geometryhook_callbacks,
- (XtPointer)&call_data);
- } else {
- result = _XtMakeGeometryRequest(w, &geoReq, &geoReply,
- &cleared_rect_obj);
- }
- if (result == XtGeometryYes || result == XtGeometryDone)
- break;
-
- /* An Almost or No reply. Call widget and let it munge
- request, reply */
- LOCK_PROCESS;
- set_values_almost = wc->core_class.set_values_almost;
- UNLOCK_PROCESS;
- if (set_values_almost == NULL) {
- XtAppWarningMsg(app,
- "invalidProcedure","set_values_almost",
- XtCXtToolkitError,
- "set_values_almost procedure shouldn't be NULL",
- (String *)NULL, (Cardinal *)NULL);
- break;
- }
- if (result == XtGeometryNo) geoReply.request_mode = 0;
- CALLGEOTAT(_XtGeoTrace(w,"calling SetValuesAlmost.\n"));
- (*set_values_almost) (oldw, w, &geoReq, &geoReply);
- } while (geoReq.request_mode != 0);
- /* call resize proc if we changed size and parent
- * didn't already invoke resize */
- {
- XtWidgetProc resize;
- LOCK_PROCESS;
- resize = wc->core_class.resize;
- UNLOCK_PROCESS;
- if ((w->core.width != oldw->core.width ||
- w->core.height != oldw->core.height)
- && result != XtGeometryDone
- && resize != (XtWidgetProc) NULL) {
- CALLGEOTAT(_XtGeoTrace(w,
- "XtSetValues calls \"%s\"'s resize proc.\n",
- XtName(w)));
- (*resize)(w);
- }
- }
- CALLGEOTAT(_XtGeoTab(-1));
- }
- /* Redisplay if needed. No point in clearing if the window is
- * about to disappear, as the Expose event will just go straight
- * to the bit bucket. */
- if (XtIsWidget(w)) {
- /* widgets can distinguish between redisplay and resize, since
- the server will cause an expose on resize */
- if (redisplay && XtIsRealized(w) && !w->core.being_destroyed) {
- CALLGEOTAT(_XtGeoTrace(w,
- "XtSetValues calls ClearArea on \"%s\".\n",
- XtName(w)));
- XClearArea (XtDisplay(w), XtWindow(w), 0, 0, 0, 0, TRUE);
- }
- } else { /*non-window object */
- if (redisplay && ! cleared_rect_obj ) {
- Widget pw = _XtWindowedAncestor(w);
- if (XtIsRealized(pw) && !pw->core.being_destroyed) {
- RectObj r = (RectObj)w;
- int bw2 = r->rectangle.border_width << 1;
- CALLGEOTAT(_XtGeoTrace(w,
- "XtSetValues calls ClearArea on \"%s\"'s parent \"%s\".\n",
- XtName(w),XtName(pw)));
- XClearArea (XtDisplay (pw), XtWindow (pw),
- r->rectangle.x, r->rectangle.y,
- r->rectangle.width + bw2,
- r->rectangle.height + bw2,TRUE);
- }
- }
- }
- }
-
-
- /* Free dynamic storage */
- if (constraintSize) {
- XtStackFree(oldw->core.constraints, oldcCache);
- XtStackFree(reqw->core.constraints, reqcCache);
- }
- XtStackFree((XtPointer)oldw, oldwCache);
- XtStackFree((XtPointer)reqw, reqwCache);
- UNLOCK_APP(app);
-} /* XtSetValues */
diff --git a/xc/lib/Xt/SetWMCW.c b/xc/lib/Xt/SetWMCW.c
deleted file mode 100644
index d0b6bd841..000000000
--- a/xc/lib/Xt/SetWMCW.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* $TOG: SetWMCW.c /main/11 1998/02/06 13:26:04 kaleb $ */
-
-/*
- * Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
- *
- * 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.
- *
- * Author: Chris D. Peterson, MIT X Consortium
- */
-
-/*
-
-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.
-
-*/
-
-#include "IntrinsicI.h"
-#include <X11/Xatom.h>
-
-/* Function Name: XtSetWMColormapWindows
- *
- * Description: Sets the value of the WM_COLORMAP_WINDOWS
- * property on a widget's window.
- *
- * Arguments: widget - specifies the widget on whose window the
- * - WM_COLORMAP_WINDOWS property will be stored.
- *
- * list - Specifies a list of widgets whose windows are to be
- * listed in the WM_COLORMAP_WINDOWS property.
- * count - Specifies the number of widgets in list.
- *
- * Returns: none.
- */
-
-void
-XtSetWMColormapWindows(widget, list, count)
-Widget widget, *list;
-Cardinal count;
-{
- Window *data;
- Widget *checked, *top, *temp, hookobj;
- Cardinal i, j, checked_count;
- Boolean match;
- Atom xa_wm_colormap_windows;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if ( !XtIsRealized(widget) || (count == 0) ) {
- UNLOCK_APP(app);
- return;
- }
-
- top = checked = (Widget *) __XtMalloc( (Cardinal) sizeof(Widget) * count);
-
-
-/*
- * The specification calls for only adding the windows that have unique
- * colormaps to the property to this function, so we will make a pass through
- * the widget list removing all the widgets with non-unique colormaps.
- *
- * We will also remove any unrealized widgets from the list at this time.
- */
-
- for (checked_count = 0, i = 0; i < count; i++) {
- if (!XtIsRealized(list[i])) continue;
-
- *checked = list[i];
- match = FALSE;
-
-/*
- * Don't check first element for matching colormap since there is nothing
- * to check it against.
- */
-
- if (checked != top)
- for (j = 0, temp = top; j < checked_count ; j++, temp++)
- if ( (*temp)->core.colormap == (*checked)->core.colormap) {
- match = TRUE;
- break;
- }
-
-/*
- * If no colormap was found to match then add this widget to the linked list.
- */
-
- if (!match) {
- checked++;
- checked_count++;
- }
- }
-
-/*
- * Now that we have the list of widgets we need to convert it to a list of
- * windows and set the property.
- */
-
- data = (Window *) __XtMalloc( (Cardinal) sizeof(Window) * checked_count);
-
- for ( i = 0 ; i < checked_count ; i++)
- data[i] = XtWindow(top[i]);
-
- xa_wm_colormap_windows = XInternAtom(XtDisplay(widget),
- "WM_COLORMAP_WINDOWS", FALSE);
-
- XChangeProperty(XtDisplay(widget), XtWindow(widget),
- xa_wm_colormap_windows, XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) data, (int) i);
-
- hookobj = XtHooksOfDisplay(XtDisplay(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHsetWMColormapWindows;
- call_data.widget = widget;
- call_data.event_data = (XtPointer) list;
- call_data.num_event_data = count;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
-
- XtFree( (char *) data);
- XtFree( (char *) top);
- UNLOCK_APP(app);
-}
diff --git a/xc/lib/Xt/Shell.c b/xc/lib/Xt/Shell.c
deleted file mode 100644
index dfc0b1bea..000000000
--- a/xc/lib/Xt/Shell.c
+++ /dev/null
@@ -1,3432 +0,0 @@
-/* $TOG: Shell.c /main/178 1998/02/06 13:26:20 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/Shell.c,v 3.8 1998/10/03 09:06:58 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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.
-
-*/
-
-#define SHELL
-
-#ifndef DEFAULT_WM_TIMEOUT
-#define DEFAULT_WM_TIMEOUT 5000
-#endif
-
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-#include "Shell.h"
-#include "ShellP.h"
-#include "Vendor.h"
-#include "VendorP.h"
-#include <X11/Xatom.h>
-#include <X11/Xlocale.h>
-#include <X11/ICE/ICElib.h>
-#include <stdio.h>
-
-#ifdef EDITRES
-#include <X11/Xmu/Editres.h>
-#endif
-
-/***************************************************************************
- *
- * Note: per the Xt spec, the Shell geometry management assumes in
- * several places that there is only one managed child. This is
- * *not* a bug. Any subclass that assumes otherwise is broken.
- *
- ***************************************************************************/
-
-#define BIGSIZE ((Dimension)32767)
-
-/***************************************************************************
- *
- * Default values for resource lists
- *
- ***************************************************************************/
-
-#ifdef CRAY
-void _XtShellDepth();
-void _XtShellColormap();
-void _XtShellAncestorSensitive();
-void _XtTitleEncoding();
-#else
-static void _XtShellDepth();
-static void _XtShellColormap();
-static void _XtShellAncestorSensitive();
-static void _XtTitleEncoding();
-#endif
-
-/***************************************************************************
- *
- * Shell class record
- *
- ***************************************************************************/
-
-#define Offset(x) (XtOffsetOf(ShellRec, x))
-static XtResource shellResources[]=
-{
- {XtNx, XtCPosition, XtRPosition, sizeof(Position),
- Offset(core.x), XtRImmediate, (XtPointer)BIGSIZE},
- {XtNy, XtCPosition, XtRPosition, sizeof(Position),
- Offset(core.y), XtRImmediate, (XtPointer)BIGSIZE},
- { XtNdepth, XtCDepth, XtRInt, sizeof(int),
- Offset(core.depth), XtRCallProc, (XtPointer) _XtShellDepth},
- { XtNcolormap, XtCColormap, XtRColormap, sizeof(Colormap),
- Offset(core.colormap), XtRCallProc, (XtPointer) _XtShellColormap},
- { XtNancestorSensitive, XtCSensitive, XtRBoolean, sizeof(Boolean),
- Offset(core.ancestor_sensitive), XtRCallProc,
- (XtPointer) _XtShellAncestorSensitive},
- { XtNallowShellResize, XtCAllowShellResize, XtRBoolean,
- sizeof(Boolean), Offset(shell.allow_shell_resize),
- XtRImmediate, (XtPointer)False},
- { XtNgeometry, XtCGeometry, XtRString, sizeof(String),
- Offset(shell.geometry), XtRString, (XtPointer)NULL},
- { XtNcreatePopupChildProc, XtCCreatePopupChildProc, XtRFunction,
- sizeof(XtCreatePopupChildProc), Offset(shell.create_popup_child_proc),
- XtRFunction, NULL},
- { XtNsaveUnder, XtCSaveUnder, XtRBoolean, sizeof(Boolean),
- Offset(shell.save_under), XtRImmediate, (XtPointer)False},
- { XtNpopupCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(shell.popup_callback), XtRCallback, (XtPointer) NULL},
- { XtNpopdownCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(shell.popdown_callback), XtRCallback, (XtPointer) NULL},
- { XtNoverrideRedirect, XtCOverrideRedirect,
- XtRBoolean, sizeof(Boolean), Offset(shell.override_redirect),
- XtRImmediate, (XtPointer)False},
- { XtNvisual, XtCVisual, XtRVisual, sizeof(Visual*),
- Offset(shell.visual), XtRImmediate, CopyFromParent}
-};
-
-static void ClassPartInitialize(), Initialize();
-static void Realize();
-static void Resize();
-static Boolean SetValues();
-static void GetValuesHook();
-static void ChangeManaged(); /* XXX */
-static XtGeometryResult GeometryManager(), RootGeometryManager();
-static void Destroy();
-
-static ShellClassExtensionRec shellClassExtRec = {
- NULL,
- NULLQUARK,
- XtShellExtensionVersion,
- sizeof(ShellClassExtensionRec),
- RootGeometryManager
-};
-
-externaldef(shellclassrec) ShellClassRec shellClassRec = {
- { /* Core */
- /* superclass */ (WidgetClass) &compositeClassRec,
- /* class_name */ "Shell",
- /* size */ sizeof(ShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ ClassPartInitialize,
- /* Class init'ed ? */ FALSE,
- /* initialize */ Initialize,
- /* initialize_notify */ NULL,
- /* realize */ Realize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ shellResources,
- /* resource_count */ XtNumber(shellResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ Destroy,
- /* resize */ Resize,
- /* expose */ NULL,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ GetValuesHook,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator*/ NULL,
- /* extension */ NULL
- },{ /* Composite */
- /* geometry_manager */ GeometryManager,
- /* change_managed */ ChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{ /* Shell */
- /* extension */ (XtPointer)&shellClassExtRec
- }
-};
-
-externaldef(shellwidgetclass) WidgetClass shellWidgetClass = (WidgetClass) (&shellClassRec);
-
-/***************************************************************************
- *
- * OverrideShell class record
- *
- ***************************************************************************/
-
-static XtResource overrideResources[]=
-{
- { XtNoverrideRedirect, XtCOverrideRedirect,
- XtRBoolean, sizeof(Boolean), Offset(shell.override_redirect),
- XtRImmediate, (XtPointer)True},
- { XtNsaveUnder, XtCSaveUnder, XtRBoolean, sizeof(Boolean),
- Offset(shell.save_under), XtRImmediate, (XtPointer)True},
-};
-
-externaldef(overrideshellclassrec) OverrideShellClassRec overrideShellClassRec = {
- {
- /* superclass */ (WidgetClass) &shellClassRec,
- /* class_name */ "OverrideShell",
- /* size */ sizeof(OverrideShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ NULL,
- /* initialize_notify */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ overrideResources,
- /* resource_count */ XtNumber(overrideResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(overrideshellwidgetclass) WidgetClass overrideShellWidgetClass =
- (WidgetClass) (&overrideShellClassRec);
-
-/***************************************************************************
- *
- * WMShell class record
- *
- ***************************************************************************/
-
-#undef Offset
-#define Offset(x) (XtOffsetOf(WMShellRec, x))
-
-static int default_unspecified_shell_int = XtUnspecifiedShellInt;
-/*
- * Warning, casting XtUnspecifiedShellInt (which is -1) to an (XtPointer)
- * can result is loss of bits on some machines (i.e. crays)
- */
-
-static XtResource wmResources[]=
-{
- { XtNtitle, XtCTitle, XtRString, sizeof(String),
- Offset(wm.title), XtRString, NULL},
- { XtNtitleEncoding, XtCTitleEncoding, XtRAtom, sizeof(Atom),
- Offset(wm.title_encoding),
- XtRCallProc, (XtPointer) _XtTitleEncoding},
- { XtNwmTimeout, XtCWmTimeout, XtRInt, sizeof(int),
- Offset(wm.wm_timeout), XtRImmediate,(XtPointer)DEFAULT_WM_TIMEOUT},
- { XtNwaitForWm, XtCWaitForWm, XtRBoolean, sizeof(Boolean),
- Offset(wm.wait_for_wm), XtRImmediate, (XtPointer)True},
- { XtNtransient, XtCTransient, XtRBoolean, sizeof(Boolean),
- Offset(wm.transient), XtRImmediate, (XtPointer)False},
-/* size_hints minus things stored in core */
- { XtNbaseWidth, XtCBaseWidth, XtRInt, sizeof(int),
- Offset(wm.base_width),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNbaseHeight, XtCBaseHeight, XtRInt, sizeof(int),
- Offset(wm.base_height),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNwinGravity, XtCWinGravity, XtRGravity, sizeof(int),
- Offset(wm.win_gravity),
- XtRGravity, (XtPointer) &default_unspecified_shell_int},
- { XtNminWidth, XtCMinWidth, XtRInt, sizeof(int),
- Offset(wm.size_hints.min_width),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNminHeight, XtCMinHeight, XtRInt, sizeof(int),
- Offset(wm.size_hints.min_height),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNmaxWidth, XtCMaxWidth, XtRInt, sizeof(int),
- Offset(wm.size_hints.max_width),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNmaxHeight, XtCMaxHeight, XtRInt, sizeof(int),
- Offset(wm.size_hints.max_height),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNwidthInc, XtCWidthInc, XtRInt, sizeof(int),
- Offset(wm.size_hints.width_inc),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNheightInc, XtCHeightInc, XtRInt, sizeof(int),
- Offset(wm.size_hints.height_inc),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNminAspectX, XtCMinAspectX, XtRInt, sizeof(int),
- Offset(wm.size_hints.min_aspect.x),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNminAspectY, XtCMinAspectY, XtRInt, sizeof(int),
- Offset(wm.size_hints.min_aspect.y),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNmaxAspectX, XtCMaxAspectX, XtRInt, sizeof(int),
- Offset(wm.size_hints.max_aspect.x),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNmaxAspectY, XtCMaxAspectY, XtRInt, sizeof(int),
- Offset(wm.size_hints.max_aspect.y),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
-/* wm_hints */
- { XtNinput, XtCInput, XtRBool, sizeof(Bool),
- Offset(wm.wm_hints.input), XtRImmediate, (XtPointer)False},
- { XtNinitialState, XtCInitialState, XtRInitialState, sizeof(int),
- Offset(wm.wm_hints.initial_state),
- XtRImmediate, (XtPointer)NormalState},
- { XtNiconPixmap, XtCIconPixmap, XtRBitmap, sizeof(Pixmap),
- Offset(wm.wm_hints.icon_pixmap), XtRPixmap, NULL},
- { XtNiconWindow, XtCIconWindow, XtRWindow, sizeof(Window),
- Offset(wm.wm_hints.icon_window), XtRWindow, (XtPointer) NULL},
- { XtNiconX, XtCIconX, XtRInt, sizeof(int),
- Offset(wm.wm_hints.icon_x),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNiconY, XtCIconY, XtRInt, sizeof(int),
- Offset(wm.wm_hints.icon_y),
- XtRInt, (XtPointer) &default_unspecified_shell_int},
- { XtNiconMask, XtCIconMask, XtRBitmap, sizeof(Pixmap),
- Offset(wm.wm_hints.icon_mask), XtRPixmap, NULL},
- { XtNwindowGroup, XtCWindowGroup, XtRWindow, sizeof(Window),
- Offset(wm.wm_hints.window_group),
- XtRImmediate, (XtPointer)XtUnspecifiedWindow},
- { XtNclientLeader, XtCClientLeader, XtRWidget, sizeof(Widget),
- Offset(wm.client_leader), XtRWidget, NULL},
- { XtNwindowRole, XtCWindowRole, XtRString, sizeof(String),
- Offset(wm.window_role), XtRString, (XtPointer) NULL},
- { XtNurgency, XtCUrgency, XtRBoolean, sizeof(Boolean),
- Offset(wm.urgency), XtRImmediate, (XtPointer) False}
-};
-
-static void WMInitialize();
-static Boolean WMSetValues();
-static void WMDestroy();
-
-externaldef(wmshellclassrec) WMShellClassRec wmShellClassRec = {
- {
- /* superclass */ (WidgetClass) &shellClassRec,
- /* class_name */ "WMShell",
- /* size */ sizeof(WMShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ WMInitialize,
- /* initialize_notify */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ wmResources,
- /* resource_count */ XtNumber(wmResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ WMDestroy,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ WMSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(wmshellwidgetclass) WidgetClass wmShellWidgetClass = (WidgetClass) (&wmShellClassRec);
-
-/***************************************************************************
- *
- * TransientShell class record
- *
- ***************************************************************************/
-
-#undef Offset
-#define Offset(x) (XtOffsetOf(TransientShellRec, x))
-
-static XtResource transientResources[]=
-{
- { XtNtransient, XtCTransient, XtRBoolean, sizeof(Boolean),
- Offset(wm.transient), XtRImmediate, (XtPointer)True},
- { XtNtransientFor, XtCTransientFor, XtRWidget, sizeof(Widget),
- Offset(transient.transient_for), XtRWidget, NULL},
- { XtNsaveUnder, XtCSaveUnder, XtRBoolean, sizeof(Boolean),
- Offset(shell.save_under), XtRImmediate, (XtPointer)True},
-};
-
-static void TransientRealize();
-static Boolean TransientSetValues();
-
-externaldef(transientshellclassrec) TransientShellClassRec transientShellClassRec = {
- {
- /* superclass */ (WidgetClass) &vendorShellClassRec,
- /* class_name */ "TransientShell",
- /* size */ sizeof(TransientShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ NULL,
- /* initialize_notify */ NULL,
- /* realize */ TransientRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ transientResources,
- /* resource_count */ XtNumber(transientResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ TransientSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ XtInheritTranslations,
- /* query_geometry */ NULL,
- /* display_accelerator*/ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(transientshellwidgetclass) WidgetClass transientShellWidgetClass =
- (WidgetClass) (&transientShellClassRec);
-
-/***************************************************************************
- *
- * TopLevelShell class record
- *
- ***************************************************************************/
-
-#undef Offset
-#define Offset(x) (XtOffsetOf(TopLevelShellRec, x))
-
-static XtResource topLevelResources[]=
-{
- { XtNiconName, XtCIconName, XtRString, sizeof(String),
- Offset(topLevel.icon_name), XtRString, (XtPointer) NULL},
- { XtNiconNameEncoding, XtCIconNameEncoding, XtRAtom, sizeof(Atom),
- Offset(topLevel.icon_name_encoding),
- XtRCallProc, (XtPointer) _XtTitleEncoding},
- { XtNiconic, XtCIconic, XtRBoolean, sizeof(Boolean),
- Offset(topLevel.iconic), XtRImmediate, (XtPointer)False}
-};
-
-static void TopLevelInitialize();
-static Boolean TopLevelSetValues();
-static void TopLevelDestroy();
-
-externaldef(toplevelshellclassrec) TopLevelShellClassRec topLevelShellClassRec = {
- {
- /* superclass */ (WidgetClass) &vendorShellClassRec,
- /* class_name */ "TopLevelShell",
- /* size */ sizeof(TopLevelShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ TopLevelInitialize,
- /* initialize_notify */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ topLevelResources,
- /* resource_count */ XtNumber(topLevelResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ TopLevelDestroy,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ TopLevelSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ XtInheritTranslations,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(toplevelshellwidgetclass) WidgetClass topLevelShellWidgetClass =
- (WidgetClass) (&topLevelShellClassRec);
-
-/***************************************************************************
- *
- * ApplicationShell class record
- *
- ***************************************************************************/
-
-#undef Offset
-#define Offset(x) (XtOffsetOf(ApplicationShellRec, x))
-
-static XtResource applicationResources[]=
-{
- {XtNargc, XtCArgc, XtRInt, sizeof(int),
- Offset(application.argc), XtRImmediate, (XtPointer)0},
- {XtNargv, XtCArgv, XtRStringArray, sizeof(String*),
- Offset(application.argv), XtRPointer, (XtPointer) NULL}
-};
-#undef Offset
-
-static void ApplicationInitialize();
-static void ApplicationDestroy();
-static Boolean ApplicationSetValues();
-static void ApplicationShellInsertChild();
-
-static CompositeClassExtensionRec compositeClassExtension = {
- /* next_extension */ NULL,
- /* record_type */ NULLQUARK,
- /* version */ XtCompositeExtensionVersion,
- /* record_size */ sizeof(CompositeClassExtensionRec),
- /* accepts_objects */ TRUE,
- /* allows_change_managed_set */ FALSE
-};
-
-
-externaldef(applicationshellclassrec) ApplicationShellClassRec applicationShellClassRec = {
- {
- /* superclass */ (WidgetClass) &topLevelShellClassRec,
- /* class_name */ "ApplicationShell",
- /* size */ sizeof(ApplicationShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ ApplicationInitialize,
- /* initialize_notify */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ applicationResources,
- /* resource_count */ XtNumber(applicationResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ ApplicationDestroy,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ ApplicationSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ XtInheritTranslations,
- /* query_geometry */ NULL,
- /* display_accelerator*/ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ ApplicationShellInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ (XtPointer)&compositeClassExtension
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(applicationshellwidgetclass) WidgetClass applicationShellWidgetClass =
- (WidgetClass) (&applicationShellClassRec);
-
-/***************************************************************************
- *
- * SessionShell class record
- *
- ***************************************************************************/
-
-#undef Offset
-#define Offset(x) (XtOffsetOf(SessionShellRec, x))
-
-static XtResource sessionResources[]=
-{
-#ifndef XT_NO_SM
- {XtNconnection, XtCConnection, XtRSmcConn, sizeof(SmcConn),
- Offset(session.connection), XtRSmcConn, (XtPointer) NULL},
-#endif
- {XtNsessionID, XtCSessionID, XtRString, sizeof(String),
- Offset(session.session_id), XtRString, (XtPointer) NULL},
- {XtNrestartCommand, XtCRestartCommand, XtRCommandArgArray, sizeof(String*),
- Offset(session.restart_command), XtRPointer, (XtPointer) NULL},
- {XtNcloneCommand, XtCCloneCommand, XtRCommandArgArray, sizeof(String*),
- Offset(session.clone_command), XtRPointer, (XtPointer) NULL},
- {XtNdiscardCommand, XtCDiscardCommand, XtRCommandArgArray, sizeof(String*),
- Offset(session.discard_command), XtRPointer, (XtPointer) NULL},
- {XtNresignCommand, XtCResignCommand, XtRCommandArgArray, sizeof(String*),
- Offset(session.resign_command), XtRPointer, (XtPointer) NULL},
- {XtNshutdownCommand, XtCShutdownCommand, XtRCommandArgArray, sizeof(String*),
- Offset(session.shutdown_command), XtRPointer, (XtPointer) NULL},
- {XtNenvironment, XtCEnvironment, XtREnvironmentArray, sizeof(String*),
- Offset(session.environment), XtRPointer, (XtPointer) NULL},
- {XtNcurrentDirectory, XtCCurrentDirectory, XtRDirectoryString, sizeof(String),
- Offset(session.current_dir), XtRString, (XtPointer) NULL},
- {XtNprogramPath, XtCProgramPath, XtRString, sizeof(String),
- Offset(session.program_path), XtRString, (XtPointer) NULL},
- {XtNrestartStyle, XtCRestartStyle, XtRRestartStyle, sizeof(unsigned char),
- Offset(session.restart_style), XtRImmediate,
- (XtPointer) SmRestartIfRunning},
- {XtNjoinSession, XtCJoinSession, XtRBoolean, sizeof(Boolean),
- Offset(session.join_session), XtRImmediate, (XtPointer) True},
- {XtNsaveCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
- Offset(session.save_callbacks), XtRCallback, (XtPointer) NULL},
- {XtNinteractCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
- Offset(session.interact_callbacks), XtRCallback, (XtPointer)NULL},
- {XtNcancelCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
- Offset(session.cancel_callbacks), XtRCallback, (XtPointer) NULL},
- {XtNsaveCompleteCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
- Offset(session.save_complete_callbacks), XtRCallback, (XtPointer) NULL},
- {XtNdieCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
- Offset(session.die_callbacks), XtRCallback, (XtPointer) NULL},
- {XtNerrorCallback, XtCCallback, XtRCallback, sizeof(XtPointer),
- Offset(session.error_callbacks), XtRCallback, (XtPointer) NULL}
-};
-#undef Offset
-
-static void SessionInitialize();
-static void SessionDestroy();
-static Boolean SessionSetValues();
-
-static CompositeClassExtensionRec sessionCompositeClassExtension = {
- /* next_extension */ NULL,
- /* record_type */ NULLQUARK,
- /* version */ XtCompositeExtensionVersion,
- /* record_size */ sizeof(CompositeClassExtensionRec),
- /* accepts_objects */ TRUE,
- /* allows_change_managed_set */ FALSE
-};
-
-
-externaldef(sessionshellclassrec) SessionShellClassRec sessionShellClassRec = {
- {
- /* superclass */ (WidgetClass) &applicationShellClassRec,
- /* class_name */ "SessionShell",
- /* size */ sizeof(SessionShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ SessionInitialize,
- /* initialize_notify */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ sessionResources,
- /* resource_count */ XtNumber(sessionResources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ SessionDestroy,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ SessionSetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ XtInheritTranslations,
- /* query_geometry */ NULL,
- /* display_accelerator*/ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ (XtPointer)&sessionCompositeClassExtension
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-externaldef(sessionshellwidgetclass) WidgetClass sessionShellWidgetClass =
- (WidgetClass) (&sessionShellClassRec);
-
-/****************************************************************************
- * Whew!
- ****************************************************************************/
-
-static void ComputeWMSizeHints(w, hints)
- WMShellWidget w;
- XSizeHints *hints;
-{
- register long flags;
- hints->flags = flags = w->wm.size_hints.flags;
-#define copy(field) hints->field = w->wm.size_hints.field
- if (flags & (USPosition | PPosition)) {
- copy(x);
- copy(y);
- }
- if (flags & (USSize | PSize)) {
- copy(width);
- copy(height);
- }
- if (flags & PMinSize) {
- copy(min_width);
- copy(min_height);
- }
- if (flags & PMaxSize) {
- copy(max_width);
- copy(max_height);
- }
- if (flags & PResizeInc) {
- copy(width_inc);
- copy(height_inc);
- }
- if (flags & PAspect) {
- copy(min_aspect.x);
- copy(min_aspect.y);
- copy(max_aspect.x);
- copy(max_aspect.y);
- }
-#undef copy
-#define copy(field) hints->field = w->wm.field
- if (flags & PBaseSize) {
- copy(base_width);
- copy(base_height);
- }
- if (flags & PWinGravity)
- copy(win_gravity);
-#undef copy
-}
-
-static void _SetWMSizeHints(w)
- WMShellWidget w;
-{
- XSizeHints *size_hints = XAllocSizeHints();
-
- if (size_hints == NULL) _XtAllocError("XAllocSizeHints");
- ComputeWMSizeHints(w, size_hints);
- XSetWMNormalHints(XtDisplay((Widget)w), XtWindow((Widget)w), size_hints);
- XFree((char*)size_hints);
-}
-
-static ShellClassExtension _FindClassExtension(widget_class)
- WidgetClass widget_class;
-{
- ShellClassExtension ext;
- for (ext = (ShellClassExtension)((ShellWidgetClass)widget_class)
- ->shell_class.extension;
- ext != NULL && ext->record_type != NULLQUARK;
- ext = (ShellClassExtension)ext->next_extension);
-
- if (ext != NULL) {
- if ( ext->version == XtShellExtensionVersion
- && ext->record_size == sizeof(ShellClassExtensionRec)) {
- /* continue */
- } else {
- String params[1];
- Cardinal num_params = 1;
- params[0] = widget_class->core_class.class_name;
- XtErrorMsg( "invalidExtension", "shellClassPartInitialize",
- XtCXtToolkitError,
- "widget class %s has invalid ShellClassExtension record",
- params, &num_params);
- }
- }
- return ext;
-}
-
-static void ClassPartInitialize(widget_class)
- WidgetClass widget_class;
-{
- ShellClassExtension ext = _FindClassExtension(widget_class);
- if (ext != NULL) {
- if (ext->root_geometry_manager == XtInheritRootGeometryManager) {
- ext->root_geometry_manager =
- _FindClassExtension(widget_class->core_class.superclass)
- ->root_geometry_manager;
- }
- } else {
- /* if not found, spec requires XtInheritRootGeometryManager */
- XtPointer *extP
- = &((ShellWidgetClass)widget_class)->shell_class.extension;
- ext = XtNew(ShellClassExtensionRec);
- (void) memmove((char*)ext,
- (char*)_FindClassExtension(widget_class->core_class.superclass),
- sizeof(ShellClassExtensionRec));
- ext->next_extension = *extP;
- *extP = (XtPointer)ext;
- }
-}
-
-
-static void EventHandler();
-static void _popup_set_prop();
-
-
-/*ARGSUSED*/
-static void XtCopyDefaultDepth(widget, offset, value)
- Widget widget;
- int offset;
- XrmValue *value;
-{
- value->addr = (XPointer)(&DefaultDepthOfScreen(XtScreenOfObject(widget)));
-}
-
-#ifndef CRAY
-static
-#endif
-void _XtShellDepth(widget,closure,value)
- Widget widget;
- int closure;
- XrmValue *value;
-{
- if (widget->core.parent == NULL) XtCopyDefaultDepth(widget,closure,value);
- else _XtCopyFromParent (widget,closure,value);
-}
-
-/*ARGSUSED*/
-static void XtCopyDefaultColormap(widget, offset, value)
- Widget widget;
- int offset;
- XrmValue *value;
-{
- value->addr = (XPointer)(&DefaultColormapOfScreen(XtScreenOfObject(widget)));
-}
-
-#ifndef CRAY
-static
-#endif
-void _XtShellColormap(widget,closure,value)
- Widget widget;
- int closure;
- XrmValue *value;
-{
- if (widget->core.parent == NULL)
- XtCopyDefaultColormap(widget,closure,value);
- else _XtCopyFromParent (widget,closure,value);
-}
-
-#ifndef CRAY
-static
-#endif
-void _XtShellAncestorSensitive(widget,closure,value)
- Widget widget;
- int closure;
- XrmValue *value;
-{
- static Boolean true = True;
- if (widget->core.parent == NULL) value->addr = (XPointer)(&true);
- else _XtCopyFromParent (widget,closure,value);
-}
-
-/*ARGSUSED*/
-#ifndef CRAY
-static
-#endif
-void _XtTitleEncoding(widget, offset, value)
- Widget widget;
- int offset;
- XrmValue *value;
-{
- static Atom atom;
- if (XtWidgetToApplicationContext(widget)->langProcRec.proc) atom = None;
- else atom = XA_STRING;
- value->addr = (XPointer) &atom;
-}
-
-
-/* ARGSUSED */
-static void Initialize(req, new, args, num_args)
- Widget req, new;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- ShellWidget w = (ShellWidget) new;
-
- w->shell.popped_up = FALSE;
- w->shell.client_specified =
- _XtShellNotReparented | _XtShellPositionValid;
-
- if (w->core.x == BIGSIZE) {
- w->core.x = 0;
- if (w->core.y == BIGSIZE) w->core.y = 0;
- } else {
- if (w->core.y == BIGSIZE) w->core.y = 0;
- else w->shell.client_specified |= _XtShellPPositionOK;
- }
-
- XtAddEventHandler(new, (EventMask) StructureNotifyMask,
- TRUE, EventHandler, (XtPointer) NULL);
-
-#ifdef EDITRES
- XtAddEventHandler(new, (EventMask) 0, TRUE,
- _XEditResCheckMessages, NULL);
-#endif
-}
-
-/* ARGSUSED */
-static void WMInitialize(req, new, args, num_args)
- Widget req,new;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- WMShellWidget w = (WMShellWidget) new;
- TopLevelShellWidget tls = (TopLevelShellWidget) new; /* maybe */
-
- if(w->wm.title == NULL) {
- if (XtIsTopLevelShell(new) &&
- tls->topLevel.icon_name != NULL &&
- strlen(tls->topLevel.icon_name) != 0) {
- w->wm.title = XtNewString(tls->topLevel.icon_name);
- } else {
- w->wm.title = XtNewString(w->core.name);
- }
- } else {
- w->wm.title = XtNewString(w->wm.title);
- }
- w->wm.size_hints.flags = 0;
- w->wm.wm_hints.flags = 0;
- if (w->wm.window_role)
- w->wm.window_role = XtNewString(w->wm.window_role);
-}
-
-
-/* ARGSUSED */
-static void TopLevelInitialize(req, new, args, num_args)
- Widget req, new;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- TopLevelShellWidget w = (TopLevelShellWidget) new;
-
- if (w->topLevel.icon_name == NULL) {
- w->topLevel.icon_name = XtNewString(w->core.name);
- } else {
- w->topLevel.icon_name = XtNewString(w->topLevel.icon_name);
- }
-
- if (w->topLevel.iconic)
- w->wm.wm_hints.initial_state = IconicState;
-}
-
-static String *NewArgv();
-static String *NewStringArray();
-static void FreeStringArray();
-
-/* ARGSUSED */
-static void ApplicationInitialize(req, new, args, num_args)
- Widget req, new;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- ApplicationShellWidget w = (ApplicationShellWidget)new;
-
- if (w->application.argc > 0)
- w->application.argv = NewArgv(w->application.argc,
- w->application.argv);
-}
-
-#define XtSaveInactive 0
-#define XtSaveActive 1
-#define XtInteractPending 2
-#define XtInteractActive 3
-
-#define XtCloneCommandMask (1L<<0)
-#define XtCurrentDirectoryMask (1L<<1)
-#define XtDiscardCommandMask (1L<<2)
-#define XtEnvironmentMask (1L<<3)
-#define XtProgramMask (1L<<4)
-#define XtResignCommandMask (1L<<5)
-#define XtRestartCommandMask (1L<<6)
-#define XtRestartStyleHintMask (1L<<7)
-#define XtShutdownCommandMask (1L<<8)
-
-extern char *getenv();
-
-static void JoinSession();
-static void SetSessionProperties();
-static void StopManagingSession();
-
-typedef struct _XtSaveYourselfRec {
- XtSaveYourself next;
- int save_type;
- int interact_style;
- Boolean shutdown;
- Boolean fast;
- Boolean cancel_shutdown;
- int phase;
- int interact_dialog_type;
- Boolean request_cancel;
- Boolean request_next_phase;
- Boolean save_success;
- int save_tokens;
- int interact_tokens;
-} XtSaveYourselfRec;
-
-/* ARGSUSED */
-static void SessionInitialize(req, new, args, num_args)
- Widget req, new;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
-#ifndef XT_NO_SM
- SessionShellWidget w = (SessionShellWidget)new;
-
- if (w->session.session_id) w->session.session_id =
- XtNewString(w->session.session_id);
- if (w->session.restart_command) w->session.restart_command =
- NewStringArray(w->session.restart_command);
- if (w->session.clone_command) w->session.clone_command =
- NewStringArray(w->session.clone_command);
- if (w->session.discard_command) w->session.discard_command =
- NewStringArray(w->session.discard_command);
- if (w->session.resign_command) w->session.resign_command =
- NewStringArray(w->session.resign_command);
- if (w->session.shutdown_command) w->session.shutdown_command =
- NewStringArray(w->session.shutdown_command);
- if (w->session.environment) w->session.environment =
- NewStringArray(w->session.environment);
- if (w->session.current_dir) w->session.current_dir =
- XtNewString(w->session.current_dir);
- if (w->session.program_path) w->session.program_path =
- XtNewString(w->session.program_path);
-
- w->session.checkpoint_state = XtSaveInactive;
- w->session.input_id = 0;
- w->session.save = NULL;
-
- if ((w->session.join_session) &&
- (w->application.argv || w->session.restart_command))
- JoinSession(w);
-
- if (w->session.connection)
- SetSessionProperties(w, True, 0L, 0L);
-#endif /* !XT_NO_SM */
-}
-
-static void Resize(w)
- Widget w;
-{
- register ShellWidget sw = (ShellWidget)w;
- Widget childwid;
- int i;
- for(i = 0; i < sw->composite.num_children; i++) {
- if (XtIsManaged(sw->composite.children[i])) {
- childwid = sw->composite.children[i];
- XtResizeWidget(childwid, sw->core.width, sw->core.height,
- childwid->core.border_width);
- break; /* can only be one managed child */
- }
- }
-}
-
-static void GetGeometry();
-
-static void Realize(wid, vmask, attr)
- Widget wid;
- Mask *vmask;
- XSetWindowAttributes *attr;
-{
- ShellWidget w = (ShellWidget) wid;
- Mask mask = *vmask;
-
- if (! (w->shell.client_specified & _XtShellGeometryParsed)) {
- /* we'll get here only if there was no child the first
- time we were realized. If the shell was Unrealized
- and then re-Realized, we probably don't want to
- re-evaluate the defaults anyway.
- */
- GetGeometry(wid, (Widget)NULL);
- }
- else if (w->core.background_pixmap == XtUnspecifiedPixmap) {
- /* I attempt to inherit my child's background to avoid screen flash
- * if there is latency between when I get resized and when my child
- * is resized. Background=None is not satisfactory, as I want the
- * user to get immediate feedback on the new dimensions (most
- * particularly in the case of a non-reparenting wm). It is
- * especially important to have the server clear any old cruft
- * from the display when I am resized larger.
- */
- register Widget *childP = w->composite.children;
- int i;
- for (i = w->composite.num_children; i; i--, childP++) {
- if (XtIsWidget(*childP) && XtIsManaged(*childP)) {
- if ((*childP)->core.background_pixmap
- != XtUnspecifiedPixmap) {
- mask &= ~(CWBackPixel);
- mask |= CWBackPixmap;
- attr->background_pixmap =
- w->core.background_pixmap =
- (*childP)->core.background_pixmap;
- } else {
- attr->background_pixel =
- w->core.background_pixel =
- (*childP)->core.background_pixel;
- }
- break;
- }
- }
- }
-
- if(w->shell.save_under) {
- mask |= CWSaveUnder;
- attr->save_under = TRUE;
- }
- if(w->shell.override_redirect) {
- mask |= CWOverrideRedirect;
- attr->override_redirect = TRUE;
- }
- if (wid->core.width == 0 || wid->core.height == 0) {
- Cardinal count = 1;
- XtErrorMsg("invalidDimension", "shellRealize", XtCXtToolkitError,
- "Shell widget %s has zero width and/or height",
- &wid->core.name, &count);
- }
- wid->core.window = XCreateWindow(XtDisplay(wid),
- wid->core.screen->root, (int)wid->core.x, (int)wid->core.y,
- (unsigned int)wid->core.width, (unsigned int)wid->core.height,
- (unsigned int)wid->core.border_width, (int) wid->core.depth,
- (unsigned int) InputOutput, w->shell.visual,
- mask, attr);
-
- _popup_set_prop(w);
-}
-
-
-static void _SetTransientForHint(w, delete)
- TransientShellWidget w;
- Boolean delete;
-{
- Window window_group;
-
- if (w->wm.transient) {
- if (w->transient.transient_for != NULL
- && XtIsRealized(w->transient.transient_for))
- window_group = XtWindow(w->transient.transient_for);
- else if ((window_group = w->wm.wm_hints.window_group)
- == XtUnspecifiedWindowGroup) {
- if (delete)
- XDeleteProperty( XtDisplay((Widget)w),
- XtWindow((Widget)w),
- XA_WM_TRANSIENT_FOR
- );
- return;
- }
-
- XSetTransientForHint( XtDisplay((Widget)w),
- XtWindow((Widget)w),
- window_group
- );
- }
-}
-
-
-static void TransientRealize(w, vmask, attr)
- Widget w;
- Mask *vmask;
- XSetWindowAttributes *attr;
-{
- XtRealizeProc realize;
-
- LOCK_PROCESS;
- realize =
- transientShellWidgetClass->core_class.superclass->core_class.realize;
- UNLOCK_PROCESS;
- (*realize) (w, vmask, attr);
-
- _SetTransientForHint((TransientShellWidget)w, False);
-}
-
-static Widget GetClientLeader(w)
- Widget w;
-{
- while ((! XtIsWMShell(w) || ! ((WMShellWidget)w)->wm.client_leader)
- && w->core.parent)
- w = w->core.parent;
-
- /* ASSERT: w is a WMshell with client_leader set, or w has no parent */
-
- if (XtIsWMShell(w) && ((WMShellWidget)w)->wm.client_leader)
- w = ((WMShellWidget)w)->wm.client_leader;
- return w;
-}
-
-static void EvaluateWMHints(w)
- WMShellWidget w;
-{
- XWMHints *hintp = &w->wm.wm_hints;
-
- hintp->flags = StateHint | InputHint;
-
- if (hintp->icon_x == XtUnspecifiedShellInt)
- hintp->icon_x = -1;
- else
- hintp->flags |= IconPositionHint;
-
- if (hintp->icon_y == XtUnspecifiedShellInt)
- hintp->icon_y = -1;
- else
- hintp->flags |= IconPositionHint;
-
- if (hintp->icon_pixmap != None) hintp->flags |= IconPixmapHint;
- if (hintp->icon_mask != None) hintp->flags |= IconMaskHint;
- if (hintp->icon_window != None) hintp->flags |= IconWindowHint;
-
- if (hintp->window_group == XtUnspecifiedWindow) {
- if(w->core.parent) {
- Widget p;
- for (p = w->core.parent; p->core.parent; p = p->core.parent);
- if (XtIsRealized(p)) {
- hintp->window_group = XtWindow(p);
- hintp->flags |= WindowGroupHint;
- }
- }
- } else if (hintp->window_group != XtUnspecifiedWindowGroup)
- hintp->flags |= WindowGroupHint;
-
- if (w->wm.urgency) hintp->flags |= XUrgencyHint;
-}
-
-
-static void EvaluateSizeHints(w)
- WMShellWidget w;
-{
- struct _OldXSizeHints *sizep = &w->wm.size_hints;
-
- sizep->x = w->core.x;
- sizep->y = w->core.y;
- sizep->width = w->core.width;
- sizep->height = w->core.height;
-
- if (sizep->flags & USSize) {
- if (sizep->flags & PSize) sizep->flags &= ~PSize;
- } else
- sizep->flags |= PSize;
-
- if (sizep->flags & USPosition) {
- if (sizep->flags & PPosition) sizep->flags &= ~PPosition;
- } else if (w->shell.client_specified & _XtShellPPositionOK)
- sizep->flags |= PPosition;
-
- if (sizep->min_aspect.x != XtUnspecifiedShellInt
- || sizep->min_aspect.y != XtUnspecifiedShellInt
- || sizep->max_aspect.x != XtUnspecifiedShellInt
- || sizep->max_aspect.y != XtUnspecifiedShellInt) {
- sizep->flags |= PAspect;
- }
- if (sizep->flags & PBaseSize
- || w->wm.base_width != XtUnspecifiedShellInt
- || w->wm.base_height != XtUnspecifiedShellInt) {
- sizep->flags |= PBaseSize;
- if (w->wm.base_width == XtUnspecifiedShellInt)
- w->wm.base_width = 0;
- if (w->wm.base_height == XtUnspecifiedShellInt)
- w->wm.base_height = 0;
- }
- if (sizep->flags & PResizeInc
- || sizep->width_inc != XtUnspecifiedShellInt
- || sizep->height_inc != XtUnspecifiedShellInt) {
- if (sizep->width_inc < 1) sizep->width_inc = 1;
- if (sizep->height_inc < 1) sizep->height_inc = 1;
- sizep->flags |= PResizeInc;
- }
- if (sizep->flags & PMaxSize
- || sizep->max_width != XtUnspecifiedShellInt
- || sizep->max_height != XtUnspecifiedShellInt) {
- sizep->flags |= PMaxSize;
- if (sizep->max_width == XtUnspecifiedShellInt)
- sizep->max_width = BIGSIZE;
- if (sizep->max_height == XtUnspecifiedShellInt)
- sizep->max_height = BIGSIZE;
- }
- if (sizep->flags & PMinSize
- || sizep->min_width != XtUnspecifiedShellInt
- || sizep->min_height != XtUnspecifiedShellInt) {
- sizep->flags |= PMinSize;
- if (sizep->min_width == XtUnspecifiedShellInt)
- sizep->min_width = 1;
- if (sizep->min_height == XtUnspecifiedShellInt)
- sizep->min_height = 1;
- }
-}
-
-static void _popup_set_prop(w)
- ShellWidget w;
-{
- Widget p;
- WMShellWidget wmshell = (WMShellWidget) w;
- TopLevelShellWidget tlshell = (TopLevelShellWidget) w;
- ApplicationShellWidget appshell = (ApplicationShellWidget) w;
- XTextProperty icon_name;
- XTextProperty window_name;
- char **argv;
- int argc;
- XSizeHints *size_hints;
- Window window_group;
- XClassHint classhint;
- Boolean copied_iname, copied_wname;
-
- if (!XtIsWMShell((Widget)w) || w->shell.override_redirect) return;
-
- if ((size_hints = XAllocSizeHints()) == NULL)
- _XtAllocError("XAllocSizeHints");
-
- copied_iname = copied_wname = False;
- if (wmshell->wm.title_encoding == None &&
- XmbTextListToTextProperty(XtDisplay((Widget)w),
- (char**)&wmshell->wm.title,
- 1, XStdICCTextStyle,
- &window_name) >= Success) {
- copied_wname = True;
- } else {
- window_name.value = (unsigned char*)wmshell->wm.title;
- window_name.encoding = wmshell->wm.title_encoding ?
- wmshell->wm.title_encoding : XA_STRING;
- window_name.format = 8;
- window_name.nitems = strlen((char *)window_name.value);
- }
-
- if (XtIsTopLevelShell((Widget)w)) {
- if (tlshell->topLevel.icon_name_encoding == None &&
- XmbTextListToTextProperty(XtDisplay((Widget)w),
- (char**)&tlshell->topLevel.icon_name,
- 1, XStdICCTextStyle,
- &icon_name) >= Success) {
- copied_iname = True;
- } else {
- icon_name.value = (unsigned char*)tlshell->topLevel.icon_name;
- icon_name.encoding = tlshell->topLevel.icon_name_encoding ?
- tlshell->topLevel.icon_name_encoding : XA_STRING;
- icon_name.format = 8;
- icon_name.nitems = strlen((char *)icon_name.value);
- }
- }
-
- EvaluateWMHints(wmshell);
- EvaluateSizeHints(wmshell);
- ComputeWMSizeHints(wmshell, size_hints);
-
- if (wmshell->wm.transient
- && !XtIsTransientShell((Widget)w)
- && (window_group = wmshell->wm.wm_hints.window_group)
- != XtUnspecifiedWindowGroup) {
-
- XSetTransientForHint(XtDisplay((Widget)w),
- XtWindow((Widget)w),
- window_group
- );
- }
-
- classhint.res_name = w->core.name;
- /* For the class, look up to the top of the tree */
- for (p = (Widget)w; p->core.parent != NULL; p = p->core.parent);
- if (XtIsApplicationShell(p)) {
- classhint.res_class =
- ((ApplicationShellWidget)p)->application.class;
- } else {
- LOCK_PROCESS;
- classhint.res_class = XtClass(p)->core_class.class_name;
- UNLOCK_PROCESS;
- }
-
- if (XtIsApplicationShell((Widget)w)
- && (argc = appshell->application.argc) != -1)
- argv = (char**)appshell->application.argv;
- else {
- argv = NULL;
- argc = 0;
- }
-
- XSetWMProperties(XtDisplay((Widget)w), XtWindow((Widget)w),
- &window_name,
- (XtIsTopLevelShell((Widget)w)) ? &icon_name : NULL,
- argv, argc,
- size_hints,
- &wmshell->wm.wm_hints,
- &classhint);
- XFree((char*)size_hints);
- if (copied_wname)
- XFree((XPointer)window_name.value);
- if (copied_iname)
- XFree((XPointer)icon_name.value);
-
- LOCK_PROCESS;
- if (XtWidgetToApplicationContext((Widget)w)->langProcRec.proc) {
- char *locale = setlocale(LC_CTYPE, (char *)NULL);
- if (locale)
- XChangeProperty(XtDisplay((Widget)w), XtWindow((Widget)w),
- XInternAtom(XtDisplay((Widget)w),
- "WM_LOCALE_NAME", False),
- XA_STRING, 8, PropModeReplace,
- (unsigned char *)locale, strlen(locale));
- }
- UNLOCK_PROCESS;
-
- p = GetClientLeader((Widget)w);
- if (XtWindow(p))
- XChangeProperty(XtDisplay((Widget)w), XtWindow((Widget)w),
- XInternAtom(XtDisplay((Widget)w),
- "WM_CLIENT_LEADER", False),
- XA_WINDOW, 32, PropModeReplace,
- (unsigned char *)(&(p->core.window)), 1);
-#ifndef XT_NO_SM
- if (p == (Widget) w) {
- for ( ; p->core.parent != NULL; p = p->core.parent);
- if (XtIsSubclass(p, sessionShellWidgetClass)) {
- String sm_client_id =
- ((SessionShellWidget)p)->session.session_id;
- if (sm_client_id != NULL) {
- XChangeProperty(XtDisplay((Widget)w), XtWindow((Widget)w),
- XInternAtom(XtDisplay((Widget)w),
- "SM_CLIENT_ID", False),
- XA_STRING, 8, PropModeReplace,
- (unsigned char *) sm_client_id,
- strlen(sm_client_id));
- }
- }
- }
-#endif /* !XT_NO_SM */
-
- if (wmshell->wm.window_role)
- XChangeProperty(XtDisplay((Widget)w), XtWindow((Widget)w),
- XInternAtom(XtDisplay((Widget)w),
- "WM_WINDOW_ROLE", False),
- XA_STRING, 8, PropModeReplace,
- (unsigned char *)wmshell->wm.window_role,
- strlen(wmshell->wm.window_role));
-}
-
-/* ARGSUSED */
-static void EventHandler(wid, closure, event, continue_to_dispatch)
- Widget wid;
- XtPointer closure; /* unused */
- XEvent *event;
- Boolean *continue_to_dispatch; /* unused */
-{
- register ShellWidget w = (ShellWidget) wid;
- WMShellWidget wmshell = (WMShellWidget) w;
- Boolean sizechanged = FALSE;
-
- if(w->core.window != event->xany.window) {
- XtAppErrorMsg(XtWidgetToApplicationContext(wid),
- "invalidWindow","eventHandler",XtCXtToolkitError,
- "Event with wrong window",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
-
- switch(event->type) {
- case ConfigureNotify:
- if (w->core.window != event->xconfigure.window)
- return; /* in case of SubstructureNotify */
-#define NEQ(x) ( w->core.x != event->xconfigure.x )
- if( NEQ(width) || NEQ(height) || NEQ(border_width) ) {
- sizechanged = TRUE;
-#undef NEQ
- w->core.width = event->xconfigure.width;
- w->core.height = event->xconfigure.height;
- w->core.border_width = event->xconfigure.border_width;
- }
- if (event->xany.send_event /* ICCCM compliant synthetic ev */
- /* || w->shell.override_redirect */
- || w->shell.client_specified & _XtShellNotReparented)
- {
- w->core.x = event->xconfigure.x;
- w->core.y = event->xconfigure.y;
- w->shell.client_specified |= _XtShellPositionValid;
- }
- else w->shell.client_specified &= ~_XtShellPositionValid;
- if (XtIsWMShell(wid) && !wmshell->wm.wait_for_wm) {
- /* Consider trusting the wm again */
- register struct _OldXSizeHints *hintp
- = &wmshell->wm.size_hints;
-#define EQ(x) (hintp->x == w->core.x)
- if (EQ(x) && EQ(y) && EQ(width) && EQ(height)) {
- wmshell->wm.wait_for_wm = TRUE;
- }
-#undef EQ
- }
- break;
-
- case ReparentNotify:
- if (event->xreparent.window == XtWindow(w)) {
- if (event->xreparent.parent !=
- RootWindowOfScreen(XtScreen(w)))
- w->shell.client_specified &=
- ~(_XtShellNotReparented | _XtShellPositionValid);
- else {
- w->core.x = event->xreparent.x;
- w->core.y = event->xreparent.y;
- w->shell.client_specified |=
- (_XtShellNotReparented | _XtShellPositionValid);
- }
- }
- return;
-
- case MapNotify:
- if (XtIsTopLevelShell(wid)) {
- ((TopLevelShellWidget)wid)->topLevel.iconic = FALSE;
- }
- return;
-
- case UnmapNotify:
- {
- XtPerDisplayInput pdi;
- XtDevice device;
- Widget p;
-
- if (XtIsTopLevelShell(wid))
- ((TopLevelShellWidget)wid)->topLevel.iconic = TRUE;
-
- pdi = _XtGetPerDisplayInput(event->xunmap.display);
-
- device = &pdi->pointer;
- if (device->grabType == XtPassiveServerGrab) {
- p = device->grab.widget;
- while (p && !(XtIsShell(p)))
- p = p->core.parent;
- if (p == wid)
- device->grabType = XtNoServerGrab;
- }
-
- device = &pdi->keyboard;
- if (IsEitherPassiveGrab(device->grabType)) {
- p = device->grab.widget;
- while (p && !(XtIsShell(p)))
- p = p->core.parent;
- if (p == wid) {
- device->grabType = XtNoServerGrab;
- pdi->activatingKey = 0;
- }
- }
-
- return;
- }
- default:
- return;
- }
- {
- XtWidgetProc resize;
-
- LOCK_PROCESS;
- resize = XtClass(wid)->core_class.resize;
- UNLOCK_PROCESS;
-
- if (sizechanged && resize) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "Shell \"%s\" is being resized to %d %d.\n",
- XtName(wid), wid->core.width, wid->core.height ));
- (*resize)(wid);
- }
- }
-}
-
-static void Destroy(wid)
- Widget wid;
-{
- if (XtIsRealized(wid))
- XDestroyWindow( XtDisplay(wid), XtWindow(wid) );
-}
-
-static void WMDestroy(wid)
- Widget wid;
-{
- WMShellWidget w = (WMShellWidget) wid;
-
- XtFree((char *) w->wm.title);
- XtFree((char *) w->wm.window_role);
-}
-
-static void TopLevelDestroy(wid)
- Widget wid;
-{
- TopLevelShellWidget w = (TopLevelShellWidget) wid;
-
- XtFree((char *) w->topLevel.icon_name);
-}
-
-static void ApplicationDestroy(wid)
- Widget wid;
-{
- ApplicationShellWidget w = (ApplicationShellWidget) wid;
- if (w->application.argc > 0)
- FreeStringArray(w->application.argv);
-}
-
-static void SessionDestroy(wid)
- Widget wid;
-{
-#ifndef XT_NO_SM
- SessionShellWidget w = (SessionShellWidget) wid;
-
- StopManagingSession(w, w->session.connection);
- XtFree(w->session.session_id);
- FreeStringArray(w->session.restart_command);
- FreeStringArray(w->session.clone_command);
- FreeStringArray(w->session.discard_command);
- FreeStringArray(w->session.resign_command);
- FreeStringArray(w->session.shutdown_command);
- FreeStringArray(w->session.environment);
- XtFree(w->session.current_dir);
- XtFree(w->session.program_path);
-#endif /* !XT_NO_SM */
-}
-
-/*
- * If the Shell has a width and a height which are zero, and as such
- * suspect, and it has not yet been realized then it will grow to
- * match the child before parsing the geometry resource.
- *
- */
-static void GetGeometry(W, child)
- Widget W, child;
-{
- register ShellWidget w = (ShellWidget)W;
- Boolean is_wmshell = XtIsWMShell(W);
- int x, y, width, height, win_gravity = -1, flag;
- XSizeHints hints;
-
- if (child != NULL) {
- /* we default to our child's size */
- if (is_wmshell && (w->core.width == 0 || w->core.height == 0))
- ((WMShellWidget)W)->wm.size_hints.flags |= PSize;
- if (w->core.width == 0) w->core.width = child->core.width;
- if (w->core.height == 0) w->core.height = child->core.height;
- }
- if(w->shell.geometry != NULL) {
- char def_geom[64];
- x = w->core.x;
- y = w->core.y;
- width = w->core.width;
- height = w->core.height;
- if (is_wmshell) {
- WMShellPart* wm = &((WMShellWidget)w)->wm;
- EvaluateSizeHints((WMShellWidget)w);
- (void) memmove((char*)&hints, (char*)&wm->size_hints,
- sizeof(struct _OldXSizeHints));
- hints.win_gravity = wm->win_gravity;
- if (wm->size_hints.flags & PBaseSize) {
- width -= wm->base_width;
- height -= wm->base_height;
- hints.base_width = wm->base_width;
- hints.base_height = wm->base_height;
- }
- else if (wm->size_hints.flags & PMinSize) {
- width -= wm->size_hints.min_width;
- height -= wm->size_hints.min_height;
- }
- if (wm->size_hints.flags & PResizeInc) {
- width /= wm->size_hints.width_inc;
- height /= wm->size_hints.height_inc;
- }
- }
- else hints.flags = 0;
-
- sprintf( def_geom, "%dx%d+%d+%d", width, height, x, y );
- flag = XWMGeometry( XtDisplay(W),
- XScreenNumberOfScreen(XtScreen(W)),
- w->shell.geometry, def_geom,
- (unsigned int)w->core.border_width,
- &hints, &x, &y, &width, &height,
- &win_gravity
- );
- if (flag) {
- if (flag & XValue) w->core.x = (Position)x;
- if (flag & YValue) w->core.y = (Position)y;
- if (flag & WidthValue) w->core.width = (Dimension)width;
- if (flag & HeightValue) w->core.height = (Dimension)height;
- }
- else {
- String params[2];
- Cardinal num_params = 2;
- params[0] = XtName(W);
- params[1] = w->shell.geometry;
- XtAppWarningMsg(XtWidgetToApplicationContext(W),
- "badGeometry", "shellRealize", XtCXtToolkitError,
- "Shell widget \"%s\" has an invalid geometry specification: \"%s\"",
- params, &num_params);
- }
- }
- else
- flag = 0;
-
- if (is_wmshell) {
- WMShellWidget wmshell = (WMShellWidget) w;
- if (wmshell->wm.win_gravity == XtUnspecifiedShellInt) {
- if (win_gravity != -1)
- wmshell->wm.win_gravity = win_gravity;
- else
- wmshell->wm.win_gravity = NorthWestGravity;
- }
- wmshell->wm.size_hints.flags |= PWinGravity;
- if ((flag & (XValue|YValue)) == (XValue|YValue))
- wmshell->wm.size_hints.flags |= USPosition;
- if ((flag & (WidthValue|HeightValue)) == (WidthValue|HeightValue))
- wmshell->wm.size_hints.flags |= USSize;
- }
- w->shell.client_specified |= _XtShellGeometryParsed;
-}
-
-
-static void ChangeManaged(wid)
- Widget wid;
-{
- ShellWidget w = (ShellWidget) wid;
- Widget child = NULL;
- int i;
-
- for (i = 0; i < w->composite.num_children; i++) {
- if (XtIsManaged(w->composite.children[i])) {
- child = w->composite.children[i];
- break; /* there can only be one of them! */
- }
- }
-
- if (!XtIsRealized (wid)) /* then we're about to be realized... */
- GetGeometry(wid, child);
-
- if (child != NULL)
- XtConfigureWidget (child, (Position)0, (Position)0,
- w->core.width, w->core.height, (Dimension)0 );
-}
-
-/*
- * This is gross, I can't wait to see if the change happened so I will ask
- * the window manager to change my size and do the appropriate X work.
- * I will then tell the requester that he can. Care must be taken because
- * it is possible that some time in the future the request will be
- * asynchronusly denied and the window reverted to it's old size/shape.
- */
-
-/*ARGSUSED*/
-static XtGeometryResult GeometryManager( wid, request, reply )
- Widget wid;
- XtWidgetGeometry *request;
- XtWidgetGeometry *reply;
-{
- ShellWidget shell = (ShellWidget)(wid->core.parent);
- XtWidgetGeometry my_request;
-
- if(shell->shell.allow_shell_resize == FALSE && XtIsRealized(wid))
- return(XtGeometryNo);
-
- if (request->request_mode & (CWX | CWY))
- return(XtGeometryNo);
-
- my_request.request_mode = (request->request_mode & XtCWQueryOnly);
- if (request->request_mode & CWWidth) {
- my_request.width = request->width;
- my_request.request_mode |= CWWidth;
- }
- if (request->request_mode & CWHeight) {
- my_request.height = request->height;
- my_request.request_mode |= CWHeight;
- }
- if (request->request_mode & CWBorderWidth) {
- my_request.border_width = request->border_width;
- my_request.request_mode |= CWBorderWidth;
- }
- if (XtMakeGeometryRequest((Widget)shell, &my_request, NULL)
- == XtGeometryYes) {
- /* assert: if (request->request_mode & CWWidth) then
- * shell->core.width == request->width
- * assert: if (request->request_mode & CWHeight) then
- * shell->core.height == request->height
- *
- * so, whatever the WM sized us to (if the Shell requested
- * only one of the two) is now the correct child size
- */
-
- if (!(request->request_mode & XtCWQueryOnly)) {
- wid->core.width = shell->core.width;
- wid->core.height = shell->core.height;
- if (request->request_mode & CWBorderWidth) {
- wid->core.x = wid->core.y = -request->border_width;
- }
- }
- return XtGeometryYes;
- } else return XtGeometryNo;
-}
-
-typedef struct {
- Widget w;
- unsigned long request_num;
- Boolean done;
-} QueryStruct;
-
-static Bool isMine(dpy, event, arg)
- Display *dpy;
- register XEvent *event;
- char *arg;
-{
- QueryStruct *q = (QueryStruct *) arg;
- register Widget w = q->w;
-
- if ( (dpy != XtDisplay(w)) || (event->xany.window != XtWindow(w)) ) {
- return FALSE;
- }
- if (event->xany.serial >= q->request_num) {
- if (event->type == ConfigureNotify) {
- q->done = TRUE;
- return TRUE;
- }
- }
- else if (event->type == ConfigureNotify)
- return TRUE; /* flush old events */
- if (event->type == ReparentNotify
- && event->xreparent.window == XtWindow(w)) {
- /* we might get ahead of this event, so just in case someone
- * asks for coordinates before this event is dispatched...
- */
- register ShellWidget s = (ShellWidget)w;
- if (event->xreparent.parent != RootWindowOfScreen(XtScreen(w)))
- s->shell.client_specified &= ~_XtShellNotReparented;
- else
- s->shell.client_specified |= _XtShellNotReparented;
- }
- return FALSE;
-}
-
-static _wait_for_response(w, event, request_num)
- ShellWidget w;
- XEvent *event;
- unsigned long request_num;
-{
- XtAppContext app = XtWidgetToApplicationContext((Widget) w);
- QueryStruct q;
- unsigned long timeout;
-
- if (XtIsWMShell((Widget)w))
- timeout = ((WMShellWidget)w)->wm.wm_timeout;
- else
- timeout = DEFAULT_WM_TIMEOUT;
-
- XFlush(XtDisplay(w));
- q.w = (Widget) w;
- q.request_num = request_num;
- q.done = FALSE;
-
- /*
- * look for match event and discard all prior configures
- */
- while (XCheckIfEvent(XtDisplay(w),event,isMine,(char*)&q)) {
- if (q.done) return TRUE;
- }
-
- while (timeout > 0) {
- if (_XtWaitForSomething (app,
- FALSE, TRUE, TRUE, TRUE,
- TRUE,
-#ifdef XTHREADS
- FALSE,
-#endif
- &timeout) != -1) {
- while (XCheckIfEvent(XtDisplay(w),event,isMine,(char*)&q)) {
- if (q.done) return TRUE;
- }
- }
- }
- return FALSE;
-}
-
-/*ARGSUSED*/
-static XtGeometryResult RootGeometryManager(gw, request, reply)
- Widget gw;
- XtWidgetGeometry *request, *reply;
-{
- register ShellWidget w = (ShellWidget)gw;
- XWindowChanges values;
- unsigned int mask = request->request_mode;
- XEvent event;
- Boolean wm;
- register struct _OldXSizeHints *hintp;
- int oldx, oldy, oldwidth, oldheight, oldborder_width;
- unsigned long request_num;
-
- CALLGEOTAT(_XtGeoTab(1));
-
- if (XtIsWMShell(gw)) {
- wm = True;
- hintp = &((WMShellWidget)w)->wm.size_hints;
- /* for draft-ICCCM wm's, need to make sure hints reflect
- (current) reality so client can move and size separately. */
- hintp->x = w->core.x;
- hintp->y = w->core.y;
- hintp->width = w->core.width;
- hintp->height = w->core.height;
- } else
- wm = False;
-
- oldx = w->core.x;
- oldy = w->core.y;
- oldwidth = w->core.width;
- oldheight = w->core.height;
- oldborder_width = w->core.border_width;
-
-#define PutBackGeometry() \
- { w->core.x = oldx; \
- w->core.y = oldy; \
- w->core.width = oldwidth; \
- w->core.height = oldheight; \
- w->core.border_width = oldborder_width; }
-
- if (mask & CWX) {
- if (w->core.x == request->x) mask &= ~CWX;
- else {
- w->core.x = values.x = request->x;
- if (wm) {
- hintp->flags &= ~USPosition;
- hintp->flags |= PPosition;
- hintp->x = values.x;
- }
- }
- }
- if (mask & CWY) {
- if (w->core.y == request->y) mask &= ~CWY;
- else {
- w->core.y = values.y = request->y;
- if (wm) {
- hintp->flags &= ~USPosition;
- hintp->flags |= PPosition;
- hintp->y = values.y;
- }
- }
- }
- if (mask & CWBorderWidth) {
- if (w->core.border_width == request->border_width) {
- mask &= ~CWBorderWidth;
- } else
- w->core.border_width =
- values.border_width =
- request->border_width;
- }
- if (mask & CWWidth) {
- if (w->core.width == request->width) mask &= ~CWWidth;
- else {
- w->core.width = values.width = request->width;
- if (wm) {
- hintp->flags &= ~USSize;
- hintp->flags |= PSize;
- hintp->width = values.width;
- }
- }
- }
- if (mask & CWHeight) {
- if (w->core.height == request->height) mask &= ~CWHeight;
- else {
- w->core.height = values.height = request->height;
- if (wm) {
- hintp->flags &= ~USSize;
- hintp->flags |= PSize;
- hintp->height = values.height;
- }
- }
- }
- if (mask & CWStackMode) {
- values.stack_mode = request->stack_mode;
- if (mask & CWSibling)
- values.sibling = XtWindow(request->sibling);
- }
-
- if (!XtIsRealized((Widget)w)) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "Shell \"%s\" is not realized, return XtGeometryYes.\n",
- XtName((Widget)w)));
- CALLGEOTAT(_XtGeoTab(-1));
- return XtGeometryYes;
- }
-
- request_num = NextRequest(XtDisplay(w));
-
- CALLGEOTAT(_XtGeoTrace((Widget)w,"XConfiguring the Shell X window :\n"));
- CALLGEOTAT(_XtGeoTab(1));
-#ifdef XT_GEO_TATTLER
- if (mask & CWX) { CALLGEOTAT(_XtGeoTrace((Widget)w,"x = %d\n",values.x));}
- if (mask & CWY) { CALLGEOTAT(_XtGeoTrace((Widget)w,"y = %d\n",values.y));}
- if (mask & CWWidth) { CALLGEOTAT(_XtGeoTrace((Widget)w,
- "width = %d\n",values.width));}
- if (mask & CWHeight) { CALLGEOTAT(_XtGeoTrace((Widget)w,
- "height = %d\n",values.height));}
- if (mask & CWBorderWidth) { CALLGEOTAT(_XtGeoTrace((Widget)w,
- "border_width = %d\n",values.border_width));}
-#endif
- CALLGEOTAT(_XtGeoTab(-1));
-
- XConfigureWindow(XtDisplay((Widget)w), XtWindow((Widget)w), mask,&values);
-
- if (wm && !w->shell.override_redirect
- && mask & (CWX | CWY | CWWidth | CWHeight | CWBorderWidth)) {
- _SetWMSizeHints((WMShellWidget)w);
- }
-
- if (w->shell.override_redirect) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,"Shell \"%s\" is override redirect, return XtGeometryYes.\n", XtName((Widget)w)));
- CALLGEOTAT(_XtGeoTab(-1));
- return XtGeometryYes;
- }
-
-
- /* If no non-stacking bits are set, there's no way to tell whether
- or not this worked, so assume it did */
-
- if (!(mask & ~(CWStackMode | CWSibling))) return XtGeometryYes;
-
- if (wm && ((WMShellWidget)w)->wm.wait_for_wm == FALSE) {
- /* the window manager is sick
- * so I will do the work and
- * say no so if a new WM starts up,
- * or the current one recovers
- * my size requests will be visible
- */
- CALLGEOTAT(_XtGeoTrace((Widget)w,"Shell \"%s\" has wait_for_wm == FALSE, return XtGeometryNo.\n",
- XtName((Widget)w)));
- CALLGEOTAT(_XtGeoTab(-1));
-
- PutBackGeometry();
- return XtGeometryNo;
- }
-
- if (_wait_for_response(w, &event, request_num)) {
- /* got an event */
- if (event.type == ConfigureNotify) {
-
-#define NEQ(x, msk) ((mask & msk) && (values.x != event.xconfigure.x))
- if (NEQ(x, CWX) ||
- NEQ(y, CWY) ||
- NEQ(width, CWWidth) ||
- NEQ(height, CWHeight) ||
- NEQ(border_width, CWBorderWidth)) {
-#ifdef XT_GEO_TATTLER
- if (NEQ(x, CWX)) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "received Configure X %d\n",
- event.xconfigure.x));
- }
- if (NEQ(y, CWY)) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "received Configure Y %d\n",
- event.xconfigure.y));
- }
- if (NEQ(width, CWWidth)) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "received Configure Width %d\n",
- event.xconfigure.width));
- }
- if (NEQ(height, CWHeight)) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "received Configure Height %d\n",
- event.xconfigure.height));
- }
- if (NEQ(border_width, CWBorderWidth)) {
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "received Configure BorderWidth %d\n",
- event.xconfigure.border_width));
- }
-#endif
-#undef NEQ
- XPutBackEvent(XtDisplay(w), &event);
- PutBackGeometry();
- /*
- * We just potentially re-ordered the event queue
- * w.r.t. ConfigureNotifies with some trepidation.
- * But this is probably a Good Thing because we
- * will know the new true state of the world sooner
- * this way.
- */
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "ConfigureNotify failed, return XtGeometryNo.\n"));
- CALLGEOTAT(_XtGeoTab(-1));
-
- return XtGeometryNo;
- }
- else {
- w->core.width = event.xconfigure.width;
- w->core.height = event.xconfigure.height;
- w->core.border_width = event.xconfigure.border_width;
- if (event.xany.send_event || /* ICCCM compliant synth */
- w->shell.client_specified & _XtShellNotReparented) {
-
- w->core.x = event.xconfigure.x;
- w->core.y = event.xconfigure.y;
- w->shell.client_specified |= _XtShellPositionValid;
- }
- else w->shell.client_specified &= ~_XtShellPositionValid;
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "ConfigureNotify succeed, return XtGeometryYes.\n"));
- CALLGEOTAT(_XtGeoTab(-1));
- return XtGeometryYes;
- }
- } else if (!wm) {
- PutBackGeometry();
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "Not wm, return XtGeometryNo.\n"));
- CALLGEOTAT(_XtGeoTab(-1));
- return XtGeometryNo;
- } else XtAppWarningMsg(XtWidgetToApplicationContext((Widget)w),
- "internalError", "shell", XtCXtToolkitError,
- "Shell's window manager interaction is broken",
- (String *)NULL, (Cardinal *)NULL);
- } else if (wm) { /* no event */
- ((WMShellWidget)w)->wm.wait_for_wm = FALSE; /* timed out; must be broken */
- }
- PutBackGeometry();
-#undef PutBackGeometry
- CALLGEOTAT(_XtGeoTrace((Widget)w,
- "Timeout passed?, return XtGeometryNo.\n"));
- CALLGEOTAT(_XtGeoTab(-1));
- return XtGeometryNo;
- }
-
-/* ARGSUSED */
-static Boolean SetValues(old, ref, new, args, num_args)
- Widget old, ref, new;
- ArgList args;
- Cardinal *num_args;
-{
- ShellWidget nw = (ShellWidget) new;
- ShellWidget ow = (ShellWidget) old;
- Mask mask = 0;
- XSetWindowAttributes attr;
-
- if (!XtIsRealized(new))
- return False;
-
- if (ow->shell.save_under != nw->shell.save_under) {
- mask = CWSaveUnder;
- attr.save_under = nw->shell.save_under;
- }
-
- if (ow->shell.override_redirect != nw->shell.override_redirect) {
- mask |= CWOverrideRedirect;
- attr.override_redirect = nw->shell.override_redirect;
- }
-
- if (mask) {
- XChangeWindowAttributes(XtDisplay(new),XtWindow(new), mask, &attr);
- if ((mask & CWOverrideRedirect) && !nw->shell.override_redirect)
- _popup_set_prop(nw);
- }
-
- if (! (ow->shell.client_specified & _XtShellPositionValid)) {
- Cardinal n;
- void _XtShellGetCoordinates();
-
- for (n = *num_args; n; n--, args++) {
- if (strcmp(XtNx, args->name) == 0) {
- _XtShellGetCoordinates(ow, &ow->core.x, &ow->core.y);
- } else if (strcmp(XtNy, args->name) == 0) {
- _XtShellGetCoordinates(ow, &ow->core.x, &ow->core.y);
- }
- }
- }
- return FALSE;
-}
-
-/* ARGSUSED */
-static Boolean WMSetValues(old, ref, new, args, num_args)
- Widget old, ref, new;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- WMShellWidget nwmshell = (WMShellWidget) new;
- WMShellWidget owmshell = (WMShellWidget) old;
- Boolean set_prop
- = XtIsRealized(new) && !nwmshell->shell.override_redirect;
- Boolean title_changed;
-
- EvaluateSizeHints(nwmshell);
-
-#define NEQ(f) (nwmshell->wm.size_hints.f != owmshell->wm.size_hints.f)
-
- if (set_prop
- && (NEQ(flags) || NEQ(min_width) || NEQ(min_height)
- || NEQ(max_width) || NEQ(max_height)
- || NEQ(width_inc) || NEQ(height_inc)
- || NEQ(min_aspect.x) || NEQ(min_aspect.y)
- || NEQ(max_aspect.x) || NEQ(max_aspect.y)
-#undef NEQ
-#define NEQ(f) (nwmshell->wm.f != owmshell->wm.f)
-
- || NEQ(base_width) || NEQ(base_height) || NEQ(win_gravity))) {
- _SetWMSizeHints(nwmshell);
- }
-#undef NEQ
-
- if (nwmshell->wm.title != owmshell->wm.title) {
- XtFree(owmshell->wm.title);
- if (! nwmshell->wm.title) nwmshell->wm.title = "";
- nwmshell->wm.title = XtNewString(nwmshell->wm.title);
- title_changed = True;
- } else
- title_changed = False;
-
- if (set_prop
- && (title_changed ||
- nwmshell->wm.title_encoding != owmshell->wm.title_encoding)) {
-
- XTextProperty title;
- Boolean copied = False;
-
- if (nwmshell->wm.title_encoding == None &&
- XmbTextListToTextProperty(XtDisplay(new),
- (char**)&nwmshell->wm.title,
- 1, XStdICCTextStyle,
- &title) >= Success) {
- copied = True;
- } else {
- title.value = (unsigned char*)nwmshell->wm.title;
- title.encoding = nwmshell->wm.title_encoding ?
- nwmshell->wm.title_encoding : XA_STRING;
- title.format = 8;
- title.nitems = strlen(nwmshell->wm.title);
- }
- XSetWMName(XtDisplay(new), XtWindow(new), &title);
- if (copied)
- XFree((XPointer)title.value);
- }
-
- EvaluateWMHints(nwmshell);
-
-#define NEQ(f) (nwmshell->wm.wm_hints.f != owmshell->wm.wm_hints.f)
-
- if (set_prop
- && (NEQ(flags) || NEQ(input) || NEQ(initial_state)
- || NEQ(icon_x) || NEQ(icon_y)
- || NEQ(icon_pixmap) || NEQ(icon_mask) || NEQ(icon_window)
- || NEQ(window_group))) {
-
- XSetWMHints(XtDisplay(new), XtWindow(new), &nwmshell->wm.wm_hints);
- }
-#undef NEQ
-
- if (XtIsRealized(new) &&
- nwmshell->wm.transient != owmshell->wm.transient) {
- if (nwmshell->wm.transient) {
- if (!XtIsTransientShell(new) &&
- !nwmshell->shell.override_redirect &&
- nwmshell->wm.wm_hints.window_group !=
- XtUnspecifiedWindowGroup)
- XSetTransientForHint(XtDisplay(new), XtWindow(new),
- nwmshell->wm.wm_hints.window_group);
- }
- else XDeleteProperty(XtDisplay(new), XtWindow(new),
- XA_WM_TRANSIENT_FOR);
- }
-
- if (nwmshell->wm.client_leader != owmshell->wm.client_leader
- && XtWindow(new) && !nwmshell->shell.override_redirect) {
- Widget leader = GetClientLeader(new);
- if (XtWindow(leader))
- XChangeProperty(XtDisplay(new), XtWindow(new),
- XInternAtom(XtDisplay(new),
- "WM_CLIENT_LEADER", False),
- XA_WINDOW, 32, PropModeReplace,
- (unsigned char *) &(leader->core.window), 1);
- }
-
- if (nwmshell->wm.window_role != owmshell->wm.window_role) {
- XtFree(owmshell->wm.window_role);
- if (set_prop && nwmshell->wm.window_role) {
- XChangeProperty(XtDisplay(new), XtWindow(new),
- XInternAtom(XtDisplay(new), "WM_WINDOW_ROLE",
- False),
- XA_STRING, 8, PropModeReplace,
- (unsigned char *)nwmshell->wm.window_role,
- strlen(nwmshell->wm.window_role));
- } else if (XtIsRealized(new) && ! nwmshell->wm.window_role) {
- XDeleteProperty(XtDisplay(new), XtWindow(new),
- XInternAtom(XtDisplay(new), "WM_WINDOW_ROLE",
- False));
- }
- }
-
- return FALSE;
-}
-
-/*ARGSUSED*/
-static Boolean TransientSetValues(oldW, refW, newW, args, num_args)
- Widget oldW, refW, newW;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- TransientShellWidget old = (TransientShellWidget)oldW;
- TransientShellWidget new = (TransientShellWidget)newW;
-
- if (XtIsRealized(newW)
- && ((new->wm.transient && !old->wm.transient)
- || ((new->transient.transient_for != old->transient.transient_for)
- || (new->transient.transient_for == NULL
- && (new->wm.wm_hints.window_group
- != old->wm.wm_hints.window_group))))) {
-
- _SetTransientForHint(new, True);
- }
- return False;
-}
-
-
-/* ARGSUSED */
-static Boolean TopLevelSetValues(oldW, refW, newW, args, num_args)
- Widget oldW, refW, newW;
- ArgList args; /* unused */
- Cardinal *num_args; /* unused */
-{
- TopLevelShellWidget old = (TopLevelShellWidget)oldW;
- TopLevelShellWidget new = (TopLevelShellWidget)newW;
- Boolean name_changed;
-
- if (old->topLevel.icon_name != new->topLevel.icon_name) {
- XtFree((XtPointer)old->topLevel.icon_name);
- if (! new->topLevel.icon_name) new->topLevel.icon_name = "";
- new->topLevel.icon_name = XtNewString(new->topLevel.icon_name);
- name_changed = True;
- } else
- name_changed = False;
-
- if (XtIsRealized(newW)) {
- if (new->topLevel.iconic != old->topLevel.iconic) {
- if (new->topLevel.iconic)
- XIconifyWindow(XtDisplay(newW),
- XtWindow(newW),
- XScreenNumberOfScreen(XtScreen(newW))
- );
- else {
- Boolean map = new->shell.popped_up;
- XtPopup(newW, XtGrabNone);
- if (map) XMapWindow(XtDisplay(newW), XtWindow(newW));
- }
- }
-
- if (!new->shell.override_redirect &&
- (name_changed ||
- (old->topLevel.icon_name_encoding
- != new->topLevel.icon_name_encoding))) {
-
- XTextProperty icon_name;
- Boolean copied = False;
-
- if (new->topLevel.icon_name_encoding == None &&
- XmbTextListToTextProperty(XtDisplay(newW),
- (char**) &new->topLevel.icon_name,
- 1, XStdICCTextStyle,
- &icon_name) >= Success) {
- copied = True;
- } else {
- icon_name.value = (unsigned char *)new->topLevel.icon_name;
- icon_name.encoding = new->topLevel.icon_name_encoding ?
- new->topLevel.icon_name_encoding : XA_STRING;
- icon_name.format = 8;
- icon_name.nitems = strlen((char *)icon_name.value);
- }
- XSetWMIconName(XtDisplay(newW), XtWindow(newW), &icon_name);
- if (copied)
- XFree((XPointer)icon_name.value);
- }
- }
- return False;
-}
-
-static String * NewArgv(count, str)
- int count;
- String *str; /* do not assume it's terminated by a NULL element */
-{
- Cardinal nbytes = 0;
- Cardinal num = 0;
- String *newarray, *new;
- String *strarray = str;
- String sptr;
-
- if (count <= 0 || !str) return NULL;
-
- for (num = count; num--; str++) {
- nbytes += strlen(*str);
- nbytes++;
- }
- num = (count+1) * sizeof(String);
- new = newarray = (String *) __XtMalloc(num + nbytes);
- sptr = ((char *) new) + num;
-
- for (str = strarray; count--; str++) {
- *new = sptr;
- strcpy(*new, *str);
- new++;
- sptr = strchr(sptr, '\0');
- sptr++;
- }
- *new = NULL;
- return newarray;
-}
-
-
-/*ARGSUSED*/
-static Boolean ApplicationSetValues(current, request, new, args, num_args)
- Widget current, request, new;
- ArgList args;
- Cardinal *num_args;
-{
- ApplicationShellWidget nw = (ApplicationShellWidget) new;
- ApplicationShellWidget cw = (ApplicationShellWidget) current;
-
- if (cw->application.argc != nw->application.argc ||
- cw->application.argv != nw->application.argv) {
-
- if (nw->application.argc > 0)
- nw->application.argv = NewArgv(nw->application.argc,
- nw->application.argv);
- if (cw->application.argc > 0)
- FreeStringArray(cw->application.argv);
-
- if (XtIsRealized(new) && !nw->shell.override_redirect) {
- if (nw->application.argc >= 0 && nw->application.argv)
- XSetCommand(XtDisplay(new), XtWindow(new),
- nw->application.argv, nw->application.argc);
- else
- XDeleteProperty(XtDisplay(new), XtWindow(new), XA_WM_COMMAND);
- }
- }
- return False;
-}
-
-/*ARGSUSED*/
-static Boolean SessionSetValues(current, request, new, args, num_args)
- Widget current, request, new;
- ArgList args;
- Cardinal *num_args;
-{
-#ifndef XT_NO_SM
- SessionShellWidget nw = (SessionShellWidget) new;
- SessionShellWidget cw = (SessionShellWidget) current;
- unsigned long set_mask = 0L;
- unsigned long unset_mask = 0L;
- Boolean initialize = False;
-
- if (cw->session.session_id != nw->session.session_id) {
- nw->session.session_id = XtNewString(nw->session.session_id);
- XtFree(cw->session.session_id);
- }
-
- if (cw->session.clone_command != nw->session.clone_command) {
- if (nw->session.clone_command) {
- nw->session.clone_command =
- NewStringArray(nw->session.clone_command);
- set_mask |= XtCloneCommandMask;
- } else unset_mask |= XtCloneCommandMask;
- FreeStringArray(cw->session.clone_command);
- }
-
- if (cw->session.current_dir != nw->session.current_dir) {
- if (nw->session.current_dir) {
- nw->session.current_dir =
- XtNewString(nw->session.current_dir);
- set_mask |= XtCurrentDirectoryMask;
- } else unset_mask |= XtCurrentDirectoryMask;
- XtFree((char *) cw->session.current_dir);
- }
-
- if (cw->session.discard_command != nw->session.discard_command) {
- if (nw->session.discard_command) {
- nw->session.discard_command =
- NewStringArray(nw->session.discard_command);
- set_mask |= XtDiscardCommandMask;
- } else unset_mask |= XtDiscardCommandMask;
- FreeStringArray(cw->session.discard_command);
- }
-
- if (cw->session.environment != nw->session.environment) {
- if (nw->session.environment) {
- nw->session.environment =
- NewStringArray(nw->session.environment);
- set_mask |= XtEnvironmentMask;
- } else unset_mask |= XtEnvironmentMask;
- FreeStringArray(cw->session.environment);
- }
-
- if (cw->session.program_path != nw->session.program_path) {
- if (nw->session.program_path) {
- nw->session.program_path =
- XtNewString(nw->session.program_path);
- set_mask |= XtProgramMask;
- } else unset_mask |= XtProgramMask;
- XtFree((char *) cw->session.program_path);
- }
-
- if (cw->session.resign_command != nw->session.resign_command) {
- if (nw->session.resign_command) {
- nw->session.resign_command =
- NewStringArray(nw->session.resign_command);
- set_mask |= XtResignCommandMask;
- } else set_mask |= XtResignCommandMask;
- FreeStringArray(cw->session.resign_command);
- }
-
- if (cw->session.restart_command != nw->session.restart_command) {
- if (nw->session.restart_command) {
- nw->session.restart_command =
- NewStringArray(nw->session.restart_command);
- set_mask |= XtRestartCommandMask;
- } else unset_mask |= XtRestartCommandMask;
- FreeStringArray(cw->session.restart_command);
- }
-
- if (cw->session.restart_style != nw->session.restart_style)
- set_mask |= XtRestartStyleHintMask;
-
- if (cw->session.shutdown_command != nw->session.shutdown_command) {
- if (nw->session.shutdown_command) {
- nw->session.shutdown_command =
- NewStringArray(nw->session.shutdown_command);
- set_mask |= XtShutdownCommandMask;
- } else unset_mask |= XtShutdownCommandMask;
- FreeStringArray(cw->session.shutdown_command);
- }
-
- if ((!cw->session.join_session && nw->session.join_session) ||
- (!cw->session.connection && nw->session.connection)) {
- JoinSession(nw);
- initialize = True;
- }
-
- if (nw->session.connection && (set_mask || unset_mask || initialize))
- SetSessionProperties(new, initialize, set_mask, unset_mask);
-
- if ((cw->session.join_session && !nw->session.join_session) ||
- (cw->session.connection && !nw->session.connection))
- StopManagingSession(nw, nw->session.connection);
-#endif /* !XT_NO_SM */
-
- if (cw->wm.client_leader != nw->wm.client_leader ||
- cw->session.session_id != nw->session.session_id) {
- Widget leader;
- if (cw->session.session_id) {
- leader = GetClientLeader(current);
- if (XtWindow(leader))
- XDeleteProperty(XtDisplay(leader), XtWindow(leader),
- XInternAtom(XtDisplay(leader), "SM_CLIENT_ID",
- False));
- }
- if (nw->session.session_id) {
- leader = GetClientLeader(new);
- if (XtWindow(leader))
- XChangeProperty(XtDisplay(leader), XtWindow(leader),
- XInternAtom(XtDisplay(leader), "SM_CLIENT_ID",
- False),
- XA_STRING, 8, PropModeReplace,
- (unsigned char *) nw->session.session_id,
- strlen(nw->session.session_id));
- }
- }
- return False;
-}
-
-void _XtShellGetCoordinates( widget, x, y)
- Widget widget;
- Position* x;
- Position* y;
-{
- ShellWidget w = (ShellWidget)widget;
- if (XtIsRealized(widget) &&
- !(w->shell.client_specified & _XtShellPositionValid)) {
- int tmpx, tmpy;
- Window tmpchild;
- (void) XTranslateCoordinates(XtDisplay(w), XtWindow(w),
- RootWindowOfScreen(XtScreen(w)),
- (int) -w->core.border_width,
- (int) -w->core.border_width,
- &tmpx, &tmpy, &tmpchild);
- w->core.x = tmpx;
- w->core.y = tmpy;
- w->shell.client_specified |= _XtShellPositionValid;
- }
- *x = w->core.x;
- *y = w->core.y;
-}
-
-static void GetValuesHook(widget, args, num_args)
- Widget widget;
- ArgList args;
- Cardinal* num_args;
-{
- ShellWidget w = (ShellWidget) widget;
- extern void _XtCopyToArg();
-
- /* x and y resource values may be invalid after a shell resize */
- if (XtIsRealized(widget) &&
- !(w->shell.client_specified & _XtShellPositionValid)) {
- Cardinal n;
- Position x, y;
-
- for (n = *num_args; n; n--, args++) {
- if (strcmp(XtNx, args->name) == 0) {
- _XtShellGetCoordinates(widget, &x, &y);
- _XtCopyToArg((char *) &x, &args->value, sizeof(Position));
- } else if (strcmp(XtNy, args->name) == 0) {
- _XtShellGetCoordinates(widget, &x, &y);
- _XtCopyToArg((char *) &y, &args->value, sizeof(Position));
- }
- }
- }
-}
-
-static void ApplicationShellInsertChild(widget)
- Widget widget;
-{
- if (! XtIsWidget(widget) && XtIsRectObj(widget)) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidClass", "applicationShellInsertChild", XtCXtToolkitError,
- "ApplicationShell does not accept RectObj children; ignored",
- (String*)NULL, (Cardinal*)NULL);
- }
- else {
- XtWidgetProc insert_child;
-
- LOCK_PROCESS;
- insert_child =
- ((CompositeWidgetClass)applicationShellClassRec.core_class.
- superclass)->composite_class.insert_child;
- UNLOCK_PROCESS;
- (*insert_child) (widget);
- }
-}
-
-/**************************************************************************
-
- Session Protocol Participation
-
- *************************************************************************/
-
-#define XtSessionCheckpoint 0
-#define XtSessionInteract 1
-
-extern String _XtGetUserName(
-#if NeedFunctionPrototypes
- String /* dest_dir */,
- int /* len */
-#endif
-);
-
-static void CallSaveCallbacks();
-static String *EditCommand();
-static Boolean ExamineToken();
-static void GetIceEvent();
-static XtCheckpointToken GetToken();
-static void XtCallCancelCallbacks();
-static void XtCallDieCallbacks();
-static void XtCallSaveCallbacks();
-static void XtCallSaveCompleteCallbacks();
-
-#ifndef XT_NO_SM
-static void StopManagingSession(w, connection)
- SessionShellWidget w;
- SmcConn connection; /* connection to close, if any */
-{
- if (connection)
- SmcCloseConnection(connection, 0, NULL);
-
- if (w->session.input_id) {
- XtRemoveInput(w->session.input_id);
- w->session.input_id = 0;
- }
- w->session.connection = NULL;
-}
-
-#define XT_MSG_LENGTH 256
-static void JoinSession(w)
- SessionShellWidget w;
-{
- IceConn ice_conn;
- SmcCallbacks smcb;
- char * sm_client_id;
- unsigned long mask;
- static char context; /* used to guarantee the connection isn't shared */
-
- smcb.save_yourself.callback = XtCallSaveCallbacks;
- smcb.die.callback = XtCallDieCallbacks;
- smcb.save_complete.callback = XtCallSaveCompleteCallbacks;
- smcb.shutdown_cancelled.callback = XtCallCancelCallbacks;
- smcb.save_yourself.client_data = smcb.die.client_data =
- smcb.save_complete.client_data =
- smcb.shutdown_cancelled.client_data = (SmPointer) w;
- mask = SmcSaveYourselfProcMask | SmcDieProcMask |
- SmcSaveCompleteProcMask | SmcShutdownCancelledProcMask;
-
- if (w->session.connection) {
- SmcModifyCallbacks(w->session.connection, mask, &smcb);
- sm_client_id = SmcClientID(w->session.connection);
- } else if (getenv("SESSION_MANAGER")) {
- char error_msg[XT_MSG_LENGTH];
- error_msg[0] = '\0';
- w->session.connection =
- SmcOpenConnection(NULL, &context, SmProtoMajor, SmProtoMinor,
- mask, &smcb, w->session.session_id,
- &sm_client_id, XT_MSG_LENGTH, error_msg);
- if (error_msg[0]) {
- String params[1];
- Cardinal num_params = 1;
- params[0] = error_msg;
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget) w),
- "sessionManagement", "SmcOpenConnection",
- XtCXtToolkitError,
- "Tried to connect to session manager, %s",
- params, &num_params);
- }
- }
-
- if (w->session.connection) {
- if (w->session.session_id == NULL
- || (strcmp(w->session.session_id, sm_client_id) != 0)) {
- XtFree(w->session.session_id);
- w->session.session_id = XtNewString(sm_client_id);
- }
- free(sm_client_id);
- ice_conn = SmcGetIceConnection(w->session.connection);
- w->session.input_id =
- XtAppAddInput(XtWidgetToApplicationContext((Widget)w),
- IceConnectionNumber(ice_conn),
- (XtPointer) XtInputReadMask,
- GetIceEvent, (XtPointer) w);
-
- w->session.restart_command =
- EditCommand(w->session.session_id, w->session.restart_command,
- w->application.argv);
-
- if (! w->session.clone_command) w->session.clone_command =
- EditCommand(NULL, NULL, w->session.restart_command);
-
- if (! w->session.program_path)
- w->session.program_path = w->session.restart_command
- ? XtNewString(w->session.restart_command[0]) : NULL;
- }
-}
-#undef XT_MSG_LENGTH
-
-#endif /* !XT_NO_SM */
-
-static String * NewStringArray(str)
- String *str;
-{
- Cardinal nbytes = 0;
- Cardinal num = 0;
- String *newarray, *new;
- String *strarray = str;
- String sptr;
-
- if (!str) return NULL;
-
- for (num = 0; *str; num++, str++) {
- nbytes += strlen(*str);
- nbytes++;
- }
- num = (num + 1) * sizeof(String);
- new = newarray = (String *) __XtMalloc(num + nbytes);
- sptr = ((char *) new) + num;
-
- for (str = strarray; *str; str++) {
- *new = sptr;
- strcpy(*new, *str);
- new++;
- sptr = strchr(sptr, '\0');
- sptr++;
- }
- *new = NULL;
- return newarray;
-}
-
-static void FreeStringArray(str)
- String *str;
-{
- if (str)
- XtFree((char *) str);
-}
-
-
-#ifndef XT_NO_SM
-static SmProp * CardPack(name, closure)
- char *name;
- XtPointer closure;
-{
- unsigned char *prop = (unsigned char *) closure;
- SmProp *p;
-
- p = (SmProp *) __XtMalloc(sizeof(SmProp) + sizeof(SmPropValue));
- p->vals = (SmPropValue *) (((char *) p) + sizeof(SmProp));
- p->num_vals = 1;
- p->type = SmCARD8;
- p->name = name;
- p->vals->length = 1;
- p->vals->value = (SmPointer) prop;
- return p;
-}
-
-static SmProp * ArrayPack(name, closure)
- char *name;
- XtPointer closure;
-{
- String prop = *(String *) closure;
- SmProp *p;
-
- p = (SmProp *) __XtMalloc(sizeof(SmProp) + sizeof(SmPropValue));
- p->vals = (SmPropValue *) (((char *) p) + sizeof(SmProp));
- p->num_vals = 1;
- p->type = SmARRAY8;
- p->name = name;
- p->vals->length = strlen(prop) + 1;
- p->vals->value = prop;
- return p;
-}
-
-static SmProp * ListPack(name, closure)
- char *name;
- XtPointer closure;
-{
- String *prop = *(String **) closure;
- SmProp *p;
- String *ptr;
- SmPropValue *vals;
- int n = 0;
-
- for (ptr = prop; *ptr; ptr++)
- n++;
- p = (SmProp*) __XtMalloc(sizeof(SmProp) + (Cardinal)(n*sizeof(SmPropValue)));
- p->vals = (SmPropValue *) (((char *) p) + sizeof(SmProp));
- p->num_vals = n;
- p->type = SmLISTofARRAY8;
- p->name = name;
- for (ptr = prop, vals = p->vals; *ptr; ptr++, vals++) {
- vals->length = strlen(*ptr) + 1;
- vals->value = *ptr;
- }
- return p;
-}
-
-static void FreePacks(props, num_props)
- SmProp **props;
- int num_props;
-{
- while (--num_props >= 0)
- XtFree((char *) props[num_props]);
-}
-
-typedef SmProp* (*PackProc)();
-
-typedef struct PropertyRec {
- char * name;
- int offset;
- PackProc proc;
-} PropertyRec, *PropertyTable;
-
-#define Offset(x) (XtOffsetOf(SessionShellRec, x))
-static PropertyRec propertyTable[] = {
- {SmCloneCommand, Offset(session.clone_command), ListPack},
- {SmCurrentDirectory, Offset(session.current_dir), ArrayPack},
- {SmDiscardCommand, Offset(session.discard_command), ListPack},
- {SmEnvironment, Offset(session.environment), ListPack},
- {SmProgram, Offset(session.program_path), ArrayPack},
- {SmResignCommand, Offset(session.resign_command), ListPack},
- {SmRestartCommand, Offset(session.restart_command), ListPack},
- {SmRestartStyleHint, Offset(session.restart_style), CardPack},
- {SmShutdownCommand, Offset(session.shutdown_command), ListPack}
-};
-#undef Offset
-
-#define XT_NUM_SM_PROPS 11
-
-static void SetSessionProperties(w, initialize, set_mask, unset_mask)
- SessionShellWidget w;
- Boolean initialize;
- unsigned long set_mask;
- unsigned long unset_mask;
-{
- PropertyTable p = propertyTable;
- int n;
- int num_props = 0;
- XtPointer *addr;
- unsigned long mask;
- SmProp *props[XT_NUM_SM_PROPS];
- char *pnames[XT_NUM_SM_PROPS];
-
- if (w->session.connection == NULL)
- return;
-
- if (initialize) {
- char nam_buf[32];
- char pid[12];
- String user_name;
- String pidp = pid;
-
- /* set all non-NULL session properties, the UserID and the ProcessID */
- for (n = XtNumber(propertyTable); n; n--, p++) {
- addr = (XtPointer *) ((char *) w + p->offset);
- if (p->proc == CardPack) {
- if (*(unsigned char *)addr)
- props[num_props++] =(*(p->proc))(p->name, (XtPointer)addr);
- }
- else if (* addr)
- props[num_props++] = (*(p->proc))(p->name, (XtPointer)addr);
-
- }
- user_name = _XtGetUserName(nam_buf, sizeof nam_buf);
- if (user_name)
- props[num_props++] = ArrayPack(SmUserID, &user_name);
- sprintf(pid, "%d", getpid());
- props[num_props++] = ArrayPack(SmProcessID, &pidp);
-
- if (num_props) {
- SmcSetProperties(w->session.connection, num_props, props);
- FreePacks(props, num_props);
- }
- return;
- }
-
- if (set_mask) {
- mask = 1L;
- for (n = XtNumber(propertyTable); n; n--, p++, mask <<= 1)
- if (mask & set_mask) {
- addr = (XtPointer *) ((char *) w + p->offset);
- props[num_props++] = (*(p->proc))(p->name, (XtPointer)addr);
- }
- SmcSetProperties(w->session.connection, num_props, props);
- FreePacks(props, num_props);
- }
-
- if (unset_mask) {
- mask = 1L;
- num_props = 0;
- for (n = XtNumber(propertyTable); n; n--, p++, mask <<= 1)
- if (mask & unset_mask)
- pnames[num_props++] = p->name;
- SmcDeleteProperties(w->session.connection, num_props, pnames);
- }
-}
-
-/*ARGSUSED*/
-static void GetIceEvent(client_data, source, id)
- XtPointer client_data;
- int * source;
- XtInputId * id;
-{
- SessionShellWidget w = (SessionShellWidget) client_data;
- IceProcessMessagesStatus status;
-
-#ifdef MINIX
- if (!MNX_IceMessagesAvailable(SmcGetIceConnection(w->session.connection)))
- return;
-#endif
- status = IceProcessMessages(SmcGetIceConnection(w->session.connection),
- NULL, NULL);
-
- if (status == IceProcessMessagesIOError) {
- StopManagingSession(w, w->session.connection);
- XtCallCallbackList((Widget)w, w->session.error_callbacks,
- (XtPointer) NULL);
- }
-}
-
-static void CleanUpSave(w)
- SessionShellWidget w;
-{
- XtSaveYourself next = w->session.save->next;
- XtFree((char *)w->session.save);
- w->session.save = next;
- if (w->session.save)
- CallSaveCallbacks(w);
-}
-
-static void CallSaveCallbacks(w)
- SessionShellWidget w;
-{
- XtCheckpointToken token;
-
- if (XtHasCallbacks((Widget) w, XtNsaveCallback) != XtCallbackHasSome) {
- /* if the application makes no attempt to save state, report failure */
- SmcSaveYourselfDone(w->session.connection, False);
- CleanUpSave(w);
- } else {
- w->session.checkpoint_state = XtSaveActive;
- token = GetToken((Widget) w, XtSessionCheckpoint);
- _XtCallConditionalCallbackList((Widget)w, w->session.save_callbacks,
- (XtPointer)token, ExamineToken);
- XtSessionReturnToken(token);
- }
-}
-
-/*ARGSUSED*/
-static void XtCallSaveCallbacks(connection, client_data, save_type, shutdown,
- interact, fast)
- SmcConn connection; /* unused */
- SmPointer client_data;
- int save_type;
- Bool shutdown;
- int interact;
- Bool fast;
-{
- SessionShellWidget w = (SessionShellWidget) client_data;
- XtSaveYourself save;
- XtSaveYourself prev;
-
- save = XtNew(XtSaveYourselfRec);
- save->next = NULL;
- save->save_type = save_type;
- save->interact_style = interact;
- save->shutdown = shutdown;
- save->fast = fast;
- save->cancel_shutdown = False;
- save->phase = 1;
- save->interact_dialog_type = SmDialogNormal;
- save->request_cancel = save->request_next_phase = False;
- save->save_success = True;
- save->save_tokens = save->interact_tokens = 0;
-
- prev = (XtSaveYourself) &w->session.save;
- while (prev->next)
- prev = prev->next;
- prev->next = save;
-
- if (w->session.checkpoint_state == XtSaveInactive)
- CallSaveCallbacks(w);
-}
-
-static void XtInteractPermission(connection, data)
- SmcConn connection;
- SmPointer data;
-{
- Widget w = (Widget) data;
- SessionShellWidget sw = (SessionShellWidget) data;
- XtCheckpointToken token;
- XtCallbackProc callback;
- XtPointer client_data;
-
-
- _XtPeekCallback(w, sw->session.interact_callbacks, &callback,
- &client_data);
- if (callback) {
- sw->session.checkpoint_state = XtInteractActive;
- token = GetToken(w, XtSessionInteract);
- XtRemoveCallback(w, XtNinteractCallback, callback, client_data);
- (*callback)(w, client_data, (XtPointer) token);
- } else if (! sw->session.save->cancel_shutdown) {
- SmcInteractDone(connection, False);
- }
-}
-
-/*ARGSUSED*/
-static void XtCallSaveCompleteCallbacks(connection, client_data)
- SmcConn connection;
- SmPointer client_data;
-{
- SessionShellWidget w = (SessionShellWidget) client_data;
-
- XtCallCallbackList((Widget)w, w->session.save_complete_callbacks,
- (XtPointer) NULL);
-}
-
-/*ARGSUSED*/
-static void XtCallNextPhaseCallbacks(connection, client_data)
- SmcConn connection; /* unused */
- SmPointer client_data;
-{
- SessionShellWidget w = (SessionShellWidget) client_data;
- w->session.save->phase = 2;
- CallSaveCallbacks(w);
-}
-
-/*ARGSUSED*/
-static void XtCallDieCallbacks(connection, client_data)
- SmcConn connection; /* unused */
- SmPointer client_data;
-{
- SessionShellWidget w = (SessionShellWidget) client_data;
-
- StopManagingSession(w, w->session.connection);
- XtCallCallbackList((Widget)w, w->session.die_callbacks,
- (XtPointer) NULL);
-}
-
-/*ARGSUSED*/
-static void XtCallCancelCallbacks(connection, client_data)
- SmcConn connection; /* unused */
- SmPointer client_data;
-{
- SessionShellWidget w = (SessionShellWidget) client_data;
- Boolean call_interacts = False;
-
- if (w->session.checkpoint_state != XtSaveInactive) {
- w->session.save->cancel_shutdown = True;
- call_interacts = (w->session.save->interact_style !=
- SmInteractStyleNone);
- }
-
- XtCallCallbackList((Widget)w, w->session.cancel_callbacks,
- (XtPointer) NULL);
-
- if (call_interacts) {
- w->session.save->interact_style = SmInteractStyleNone;
- XtInteractPermission(w->session.connection, (SmPointer) w);
- }
-
- if (w->session.checkpoint_state != XtSaveInactive) {
- if (w->session.save->save_tokens == 0 &&
- w->session.checkpoint_state == XtSaveActive) {
- w->session.checkpoint_state = XtSaveInactive;
- SmcSaveYourselfDone(w->session.connection,
- w->session.save->save_success);
- CleanUpSave(w);
- }
- }
-}
-
-static XtCheckpointToken GetToken(widget, type)
- Widget widget;
- int type;
-{
- SessionShellWidget w = (SessionShellWidget) widget;
- XtCheckpointToken token;
- XtSaveYourself save = w->session.save;
-
- if (type == XtSessionCheckpoint)
- w->session.save->save_tokens++;
- else if (type == XtSessionInteract)
- w->session.save->interact_tokens++;
- else
- return (XtCheckpointToken) NULL;
-
- token = (XtCheckpointToken) __XtMalloc(sizeof(XtCheckpointTokenRec));
- token->save_type = save->save_type;
- token->interact_style = save->interact_style;
- token->shutdown = save->shutdown;
- token->fast = save->fast;
- token->cancel_shutdown = save->cancel_shutdown;
- token->phase = save->phase;
- token->interact_dialog_type = save->interact_dialog_type;
- token->request_cancel = save->request_cancel;
- token->request_next_phase = save->request_next_phase;
- token->save_success = save->save_success;
- token->type = type;
- token->widget = widget;
- return token;
-}
-
-#if NeedFunctionPrototypes
-XtCheckpointToken XtSessionGetToken(Widget widget)
-#else
-XtCheckpointToken XtSessionGetToken(widget)
- Widget widget;
-#endif
-{
- SessionShellWidget w = (SessionShellWidget) widget;
- XtCheckpointToken token = NULL;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (w->session.checkpoint_state)
- token = GetToken(widget, XtSessionCheckpoint);
-
- UNLOCK_APP(app);
- return token;
-}
-
-static Boolean ExamineToken(call_data)
- XtPointer call_data;
-{
- XtCheckpointToken token = (XtCheckpointToken) call_data;
- SessionShellWidget w = (SessionShellWidget) token->widget;
-
- if (token->interact_dialog_type == SmDialogError)
- w->session.save->interact_dialog_type = SmDialogError;
- if (token->request_next_phase)
- w->session.save->request_next_phase = True;
- if (! token->save_success)
- w->session.save->save_success = False;
-
- token->interact_dialog_type = w->session.save->interact_dialog_type;
- token->request_next_phase = w->session.save->request_next_phase;
- token->save_success = w->session.save->save_success;
- token->cancel_shutdown = w->session.save->cancel_shutdown;
-
- return True;
-}
-
-#if NeedFunctionPrototypes
-void XtSessionReturnToken(XtCheckpointToken token)
-#else
-void XtSessionReturnToken(token)
- XtCheckpointToken token;
-#endif
-{
- SessionShellWidget w = (SessionShellWidget) token->widget;
- Boolean has_some;
- Boolean phase_done;
- XtCallbackProc callback;
- XtPointer client_data;
- WIDGET_TO_APPCON((Widget)w);
-
- LOCK_APP(app);
-
- has_some = (XtHasCallbacks(token->widget, XtNinteractCallback)
- == XtCallbackHasSome);
-
- (void) ExamineToken((XtPointer) token);
-
- if (token->type == XtSessionCheckpoint) {
- w->session.save->save_tokens--;
- if (has_some && w->session.checkpoint_state == XtSaveActive) {
- w->session.checkpoint_state = XtInteractPending;
- SmcInteractRequest(w->session.connection,
- w->session.save->interact_dialog_type,
- XtInteractPermission, (SmPointer) w);
- }
- XtFree((char*) token);
- } else {
- if (token->request_cancel)
- w->session.save->request_cancel = True;
- token->request_cancel = w->session.save->request_cancel;
- if (has_some) {
- _XtPeekCallback((Widget)w, w->session.interact_callbacks,
- &callback, &client_data);
- XtRemoveCallback((Widget)w, XtNinteractCallback,
- callback, client_data);
- (*callback)((Widget)w, client_data, (XtPointer)token);
- } else {
- w->session.save->interact_tokens--;
- if (w->session.save->interact_tokens == 0) {
- w->session.checkpoint_state = XtSaveActive;
- if (! w->session.save->cancel_shutdown)
- SmcInteractDone(w->session.connection,
- w->session.save->request_cancel);
- }
- XtFree((char *) token);
- }
- }
-
- phase_done = (w->session.save->save_tokens == 0 &&
- w->session.checkpoint_state == XtSaveActive);
-
- if (phase_done) {
- if (w->session.save->request_next_phase &&
- w->session.save->phase == 1) {
- SmcRequestSaveYourselfPhase2(w->session.connection,
- XtCallNextPhaseCallbacks,
- (SmPointer)w);
- } else {
- w->session.checkpoint_state = XtSaveInactive;
- SmcSaveYourselfDone(w->session.connection,
- w->session.save->save_success);
- CleanUpSave(w);
- }
- }
-
- UNLOCK_APP(app);
-}
-
-static Boolean IsInArray(str, sarray)
- String str;
- String *sarray;
-{
- if (str == NULL || sarray == NULL)
- return False;
- for (; *sarray; sarray++) {
- if (strcmp(*sarray, str) == 0)
- return True;
- }
- return False;
-}
-
-static String* EditCommand(str, src1, src2)
- String str; /* if not NULL, the sm_client_id */
- String *src1; /* first choice */
- String *src2; /* alternate */
-{
- Boolean have;
- Boolean want;
- int count;
- String *sarray;
- String *s;
- String *new;
-
- want = (str != NULL);
- sarray = (src1 ? src1 : src2);
- if (! sarray) return NULL;
- have = IsInArray("-xtsessionID", sarray);
- if ((want && have) || (!want && !have)) {
- if (sarray == src1)
- return src1;
- else
- return NewStringArray(sarray);
- }
-
- count = 0;
- for (s = sarray; *s; s++)
- count++;
-
- if (want) {
- s = new = (String *) __XtMalloc((Cardinal)(count+3) * sizeof(String*));
- *s = *sarray; s++; sarray++;
- *s = "-xtsessionID"; s++;
- *s = str; s++;
- for (; --count > 0; s++, sarray++)
- *s = *sarray;
- *s = (String) NULL;
- } else {
- if (count < 3)
- return NewStringArray(sarray);
- s = new = (String *) __XtMalloc((Cardinal)(count-1) * sizeof(String*));
- for (; --count >= 0; sarray++) {
- if (strcmp(*sarray, "-xtsessionID") == 0) {
- sarray++;
- count--;
- } else {
- *s = *sarray;
- s++;
- }
- }
- *s = (String) NULL;
- }
- s = new;
- new = NewStringArray(new);
- XtFree((char *)s);
- return new;
-}
-
-#endif /* !XT_NO_SM */
diff --git a/xc/lib/Xt/ShellI.h b/xc/lib/Xt/ShellI.h
deleted file mode 100644
index 33d45dab4..000000000
--- a/xc/lib/Xt/ShellI.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* $XFree86: xc/lib/Xt/ShellI.h,v 1.1 2001/08/18 02:41:29 dawes Exp $ */
-
-#ifndef _XtShellInternal_h
-#define _XtShellInternal_h
-
-#include <X11/Xfuncproto.h>
-
-_XFUNCPROTOBEGIN
-
-extern void _XtShellGetCoordinates(Widget widget, Position *x, Position *y);
-
-#endif /* _XtShellInternal_h */
diff --git a/xc/lib/Xt/ShellP.h b/xc/lib/Xt/ShellP.h
deleted file mode 100644
index fccd15b7d..000000000
--- a/xc/lib/Xt/ShellP.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/* $TOG: ShellP.h /main/34 1998/02/06 13:26:15 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-/*
- * ShellP.h - Private definitions for Shell widget
- *
- * Author: Paul Asente
- * Digital Equipment Corporation
- * Western Software Laboratory
- * Date: Thu Dec 3, 1987
- */
-
-#ifndef _XtShellPrivate_h
-#define _XtShellPrivate_h
-
-#include <X11/Shell.h>
-
-/* *****
- * ***** VendorP.h is included later on; it needs fields defined in the first
- * ***** part of this header file
- * *****
- */
-
-/***********************************************************************
- *
- * Shell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the Shell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} ShellClassPart;
-
-typedef struct {
- XtPointer next_extension; /* 1st 4 mandated for all extension records */
- XrmQuark record_type; /* NULLQUARK; on ShellClassPart */
- long version; /* must be XtShellExtensionVersion */
- Cardinal record_size; /* sizeof(ShellClassExtensionRec) */
- XtGeometryHandler root_geometry_manager;
-} ShellClassExtensionRec, *ShellClassExtension;
-
-#define XtShellExtensionVersion 1L
-#define XtInheritRootGeometryManager ((XtGeometryHandler)_XtInherit)
-
-typedef struct _ShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
-} ShellClassRec;
-
-externalref ShellClassRec shellClassRec;
-
-/* New fields for the shell widget */
-
-typedef struct {
- char *geometry;
- XtCreatePopupChildProc create_popup_child_proc;
- XtGrabKind grab_kind;
- Boolean spring_loaded;
- Boolean popped_up;
- Boolean allow_shell_resize;
- Boolean client_specified; /* re-using old name */
-#define _XtShellPositionValid ((Boolean)(1<<0))
-#define _XtShellNotReparented ((Boolean)(1<<1))
-#define _XtShellPPositionOK ((Boolean)(1<<2))
-#define _XtShellGeometryParsed ((Boolean)(1<<3))
- Boolean save_under;
- Boolean override_redirect;
-
- XtCallbackList popup_callback;
- XtCallbackList popdown_callback;
- Visual* visual;
-} ShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
-} ShellRec, *ShellWidget;
-
-/***********************************************************************
- *
- * OverrideShell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the OverrideShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} OverrideShellClassPart;
-
-typedef struct _OverrideShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- OverrideShellClassPart override_shell_class;
-} OverrideShellClassRec;
-
-externalref OverrideShellClassRec overrideShellClassRec;
-
-/* No new fields for the override shell widget */
-
-typedef struct {int frabjous;} OverrideShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- OverrideShellPart override;
-} OverrideShellRec, *OverrideShellWidget;
-
-/***********************************************************************
- *
- * WMShell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the WMShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} WMShellClassPart;
-
-typedef struct _WMShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- WMShellClassPart wm_shell_class;
-} WMShellClassRec;
-
-externalref WMShellClassRec wmShellClassRec;
-
-/* New fields for the WM shell widget */
-
-typedef struct {
- char *title;
- int wm_timeout;
- Boolean wait_for_wm;
- Boolean transient;
- Boolean urgency;
- Widget client_leader;
- String window_role;
- struct _OldXSizeHints { /* pre-R4 Xlib structure */
- long flags;
- int x, y;
- int width, height;
- int min_width, min_height;
- int max_width, max_height;
- int width_inc, height_inc;
- struct {
- int x;
- int y;
- } min_aspect, max_aspect;
- } size_hints;
- XWMHints wm_hints;
- int base_width, base_height;
- int win_gravity;
- Atom title_encoding;
-} WMShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- WMShellPart wm;
-} WMShellRec, *WMShellWidget;
-
-#include <X11/VendorP.h>
-
-/***********************************************************************
- *
- * TransientShell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the TransientShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} TransientShellClassPart;
-
-typedef struct _TransientShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- WMShellClassPart wm_shell_class;
- VendorShellClassPart vendor_shell_class;
- TransientShellClassPart transient_shell_class;
-} TransientShellClassRec;
-
-externalref TransientShellClassRec transientShellClassRec;
-
-/* New fields for the transient shell widget */
-
-typedef struct {
- Widget transient_for;
-} TransientShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- WMShellPart wm;
- VendorShellPart vendor;
- TransientShellPart transient;
-} TransientShellRec, *TransientShellWidget;
-
-/***********************************************************************
- *
- * TopLevelShell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the TopLevelShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} TopLevelShellClassPart;
-
-typedef struct _TopLevelShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- WMShellClassPart wm_shell_class;
- VendorShellClassPart vendor_shell_class;
- TopLevelShellClassPart top_level_shell_class;
-} TopLevelShellClassRec;
-
-externalref TopLevelShellClassRec topLevelShellClassRec;
-
-/* New fields for the top level shell widget */
-
-typedef struct {
- char *icon_name;
- Boolean iconic;
- Atom icon_name_encoding;
-} TopLevelShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- WMShellPart wm;
- VendorShellPart vendor;
- TopLevelShellPart topLevel;
-} TopLevelShellRec, *TopLevelShellWidget;
-
-/***********************************************************************
- *
- * ApplicationShell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the ApplicationShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} ApplicationShellClassPart;
-
-typedef struct _ApplicationShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- WMShellClassPart wm_shell_class;
- VendorShellClassPart vendor_shell_class;
- TopLevelShellClassPart top_level_shell_class;
- ApplicationShellClassPart application_shell_class;
-} ApplicationShellClassRec;
-
-externalref ApplicationShellClassRec applicationShellClassRec;
-
-/* New fields for the application shell widget */
-
-typedef struct {
-#if defined(__cplusplus) || defined(c_plusplus)
- char *c_class;
-#else
- char *class;
-#endif
- XrmClass xrm_class;
- int argc;
- char **argv;
-} ApplicationShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- WMShellPart wm;
- VendorShellPart vendor;
- TopLevelShellPart topLevel;
- ApplicationShellPart application;
-} ApplicationShellRec, *ApplicationShellWidget;
-
-/***********************************************************************
- *
- * SessionShell Widget Private Data
- *
- ***********************************************************************/
-
-/* New fields for the SessionShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} SessionShellClassPart;
-
-typedef struct _SessionShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- WMShellClassPart wm_shell_class;
- VendorShellClassPart vendor_shell_class;
- TopLevelShellClassPart top_level_shell_class;
- ApplicationShellClassPart application_shell_class;
- SessionShellClassPart session_shell_class;
-} SessionShellClassRec;
-
-externalref SessionShellClassRec sessionShellClassRec;
-
-typedef struct _XtSaveYourselfRec *XtSaveYourself; /* implementation-private */
-
-/* New fields for the session shell widget */
-
-typedef struct {
- SmcConn connection;
- String session_id;
- String* restart_command;
- String* clone_command;
- String* discard_command;
- String* resign_command;
- String* shutdown_command;
- String* environment;
- String current_dir;
- String program_path;
- unsigned char restart_style;
- unsigned char checkpoint_state;
- Boolean join_session;
- XtCallbackList save_callbacks;
- XtCallbackList interact_callbacks;
- XtCallbackList cancel_callbacks;
- XtCallbackList save_complete_callbacks;
- XtCallbackList die_callbacks;
- XtCallbackList error_callbacks;
- XtSaveYourself save;
- XtInputId input_id;
- XtPointer ses20;
- XtPointer ses19;
- XtPointer ses18;
- XtPointer ses17;
- XtPointer ses16;
- XtPointer ses15;
- XtPointer ses14;
- XtPointer ses13;
- XtPointer ses12;
- XtPointer ses11;
- XtPointer ses10;
- XtPointer ses9;
- XtPointer ses8;
- XtPointer ses7;
- XtPointer ses6;
- XtPointer ses5;
- XtPointer ses4;
- XtPointer ses3;
- XtPointer ses2;
- XtPointer ses1;
-} SessionShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- WMShellPart wm;
- VendorShellPart vendor;
- TopLevelShellPart topLevel;
- ApplicationShellPart application;
- SessionShellPart session;
-} SessionShellRec, *SessionShellWidget;
-
-#endif /* _XtShellPrivate_h */
diff --git a/xc/lib/Xt/TMaction.c b/xc/lib/Xt/TMaction.c
deleted file mode 100644
index 915eb8821..000000000
--- a/xc/lib/Xt/TMaction.c
+++ /dev/null
@@ -1,1065 +0,0 @@
-/* $TOG: TMaction.c /main/30 1998/05/12 11:19:24 kaleb $ */
-/*LINTLIBRARY*/
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-/* TMaction.c -- maintains the state table of actions for the translation
- * manager.
- */
-
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-
-#if defined(__STDC__) && !defined(NORCONST)
-#define RConst const
-#else
-#define RConst /**/
-#endif
-
-static String XtNtranslationError = "translationError";
-
-typedef struct _CompiledAction{
- XrmQuark signature;
- XtActionProc proc;
-}CompiledAction, *CompiledActionTable;
-
-
-#define GetClassActions(wc) \
- ((wc->core_class.actions) \
-? (((TMClassCache)wc->core_class.actions)->actions) \
-: NULL)
-
-static CompiledActionTable CompileActionTable(actions, count, stat, perm)
- register struct _XtActionsRec *actions;
- register Cardinal count; /* may be 0 */
- Boolean stat; /* if False, copy before compiling in place */
- Boolean perm; /* if False, use XrmStringToQuark */
-{
- register CompiledActionTable cActions;
- register int i;
- CompiledAction hold;
- CompiledActionTable cTableHold;
- XrmQuark (*func)();
-
- if (!count)
- return (CompiledActionTable) NULL;
- func = (perm ? XrmPermStringToQuark : XrmStringToQuark);
-
- if (! stat) {
- cTableHold = cActions = (CompiledActionTable)
- __XtMalloc(count * sizeof(CompiledAction));
-
- for (i=count; --i >= 0; cActions++, actions++) {
- cActions->proc = actions->proc;
- cActions->signature = (*func)(actions->string);
- }
- } else {
- cTableHold = (CompiledActionTable) actions;
-
- for (i=count; --i >= 0; actions++)
- ((CompiledActionTable) actions)->signature =
- (*func)(actions->string);
- }
- cActions = cTableHold;
-
- /* Insertion sort. Whatever sort is used, it must be stable. */
- for (i=1; i <= count - 1; i++) {
- register int j;
- hold = cActions[i];
- j = i;
- while (j && cActions[j-1].signature > hold.signature) {
- cActions[j] = cActions[j-1];
- j--;
- }
- cActions[j] = hold;
- }
-
- return cActions;
-}
-
-
-typedef struct _ActionListRec *ActionList;
-typedef struct _ActionListRec {
- ActionList next;
- CompiledActionTable table;
- TMShortCard count;
-} ActionListRec;
-
-static void ReportUnboundActions(xlations, bindData)
- XtTranslations xlations;
- TMBindData bindData;
-{
- TMSimpleStateTree stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0];
- Cardinal num_unbound = 0;
- Cardinal num_params = 1;
- char* message;
- char messagebuf[1000];
- String params[1];
- register Cardinal num_chars = 0;
- register Cardinal i, j;
- XtActionProc *procs;
- char* msg_prefix = "Actions not found: ";
-
- for (i=0; i < xlations->numStateTrees; i++) {
- if (bindData->simple.isComplex)
- procs = TMGetComplexBindEntry(bindData, i)->procs;
- else
- procs = TMGetSimpleBindEntry(bindData, i)->procs;
-
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i];
- for (j=0; j < stateTree->numQuarks; j++) {
- if (procs[j] == NULL) {
- String s = XrmQuarkToString(stateTree->quarkTbl[j]);
- if (num_unbound != 0)
- num_chars += 2;
- num_chars += strlen(s);
- num_unbound++;
- }
- }
- }
- if (num_unbound == 0)
- return;
- message = XtStackAlloc (num_chars + 1, messagebuf);
- if (message != NULL) {
- *message = '\0';
- num_unbound = 0;
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0];
- for (i=0; i < xlations->numStateTrees; i++) {
- if (bindData->simple.isComplex)
- procs = TMGetComplexBindEntry(bindData, i)->procs;
- else
- procs = TMGetSimpleBindEntry(bindData, i)->procs;
-
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i];
- for (j=0; j < stateTree->numQuarks; j++) {
- if (procs[j] == NULL) {
- String s = XrmQuarkToString(stateTree->quarkTbl[j]);
- if (num_unbound != 0)
- (void) strcat(message, ", ");
- (void) strcat(message, s);
- num_unbound++;
- }
- }
- }
- message[num_chars] = '\0';
- params[0] = message;
- XtWarningMsg(XtNtranslationError,"unboundActions",XtCXtToolkitError,
- "Actions not found: %s",
- params, &num_params);
- XtStackFree (message, messagebuf);
- }
-}
-
-
-static CompiledAction *SearchActionTable(signature, actionTable, numActions)
- XrmQuark signature;
- CompiledActionTable actionTable;
- Cardinal numActions;
-{
- register int i, left, right;
-
- left = 0;
- right = numActions - 1;
- while (left <= right) {
- i = (left + right) >> 1;
- if (signature < actionTable[i].signature)
- right = i - 1;
- else if (signature > actionTable[i].signature)
- left = i + 1;
- else {
- while (i && actionTable[i - 1].signature == signature)
- i--;
- return &actionTable[i];
- }
- }
- return (CompiledAction *) NULL;
-}
-
-static int BindActions(stateTree, procs, compiledActionTable, numActions, ndxP)
- TMSimpleStateTree stateTree;
- XtActionProc *procs;
- CompiledActionTable compiledActionTable;
- TMShortCard numActions;
- Cardinal *ndxP;
-{
- register int unbound = stateTree->numQuarks - *ndxP;
- CompiledAction* action;
- register Cardinal ndx;
- register Boolean savedNdx = False;
-
- for (ndx = *ndxP; ndx < stateTree->numQuarks; ndx++) {
- if (procs[ndx] == NULL) {
- /* attempt to bind it */
- XrmQuark q = stateTree->quarkTbl[ndx];
-
- action = SearchActionTable(q, compiledActionTable, numActions);
- if (action) {
- procs[ndx] = action->proc;
- unbound--;
- } else if (!savedNdx) {
- *ndxP= ndx;
- savedNdx = True;
- }
- } else {
- /* already bound, leave it alone */
- unbound--;
- }
- }
- return unbound;
-}
-
-typedef struct _TMBindCacheStatusRec{
- unsigned int boundInClass:1;
- unsigned int boundInHierarchy:1;
- unsigned int boundInContext:1;
- unsigned int notFullyBound:1;
- unsigned int refCount:28;
-}TMBindCacheStatusRec, *TMBindCacheStatus;
-
-typedef struct _TMBindCacheRec{
- struct _TMBindCacheRec *next;
- TMBindCacheStatusRec status;
- TMStateTree stateTree;
-#ifdef TRACE_TM
- WidgetClass widgetClass;
-#endif /* TRACE_TM */
- XtActionProc procs[1]; /* variable length */
-}TMBindCacheRec, *TMBindCache;
-
-typedef struct _TMClassCacheRec {
- CompiledActionTable actions;
- TMBindCacheRec *bindCache;
-}TMClassCacheRec, *TMClassCache;
-
-#define IsPureClassBind(bc) \
- (bc->status.boundInClass && \
- !(bc->status.boundInHierarchy || \
- bc->status.boundInContext || \
- bc->status.notFullyBound))
-
-#define GetClassCache(w) \
- ((TMClassCache)w->core.widget_class->core_class.actions)
-
-
-static int BindProcs(widget, stateTree, procs, bindStatus)
- Widget widget;
- TMSimpleStateTree stateTree;
- XtActionProc *procs;
- TMBindCacheStatus bindStatus;
-{
- register WidgetClass class;
- register ActionList actionList;
- int unbound = -1, newUnbound = -1;
- Cardinal ndx = 0;
- Widget w = widget;
-
- LOCK_PROCESS;
- do {
- class = w->core.widget_class;
- do {
- if (class->core_class.actions != NULL)
- unbound =
- BindActions(stateTree,
- procs,
- GetClassActions(class),
- class->core_class.num_actions,
- &ndx);
- class = class->core_class.superclass;
- } while (unbound != 0 && class != NULL);
- if (unbound < (int)stateTree->numQuarks)
- bindStatus->boundInClass = True;
- else
- bindStatus->boundInClass = False;
- if (newUnbound == -1)
- newUnbound = unbound;
- w = XtParent(w);
- } while (unbound != 0 && w != NULL);
-
- if (newUnbound > unbound)
- bindStatus->boundInHierarchy = True;
- else
- bindStatus->boundInHierarchy = False;
-
- if (unbound) {
- XtAppContext app = XtWidgetToApplicationContext(widget);
- newUnbound = unbound;
- for (actionList = app->action_table;
- unbound != 0 && actionList != NULL;
- actionList = actionList->next) {
- unbound = BindActions(stateTree,
- procs,
- actionList->table,
- actionList->count,
- &ndx);
- }
- if (newUnbound > unbound)
- bindStatus->boundInContext = True;
- else
- bindStatus->boundInContext = False;
-
- }
- UNLOCK_PROCESS;
- return unbound;
-}
-
-static XtActionProc *TryBindCache(widget, stateTree)
- Widget widget;
- TMStateTree stateTree;
-{
- TMClassCache classCache;
-
- LOCK_PROCESS;
- classCache = GetClassCache(widget);
-
- if (classCache == NULL)
- {
- WidgetClass wc = XtClass(widget);
-
- wc->core_class.actions = (XtActionList)
- _XtInitializeActionData(NULL, 0, True);
- }
- else
- {
- TMBindCache bindCache =
- (TMBindCache)(classCache->bindCache);
- for (; bindCache; bindCache = bindCache->next)
- {
- if (IsPureClassBind(bindCache) &&
- (stateTree == bindCache->stateTree))
- {
- bindCache->status.refCount++;
- UNLOCK_PROCESS;
- return &bindCache->procs[0];
- }
- }
- }
- UNLOCK_PROCESS;
- return NULL;
-}
-
-
-
-/*
- * The class record actions field will point to the bind cache header
- * after this call is made out of coreClassPartInit.
- */
-#if NeedFunctionPrototypes
-XtPointer _XtInitializeActionData(
- register struct _XtActionsRec *actions,
- register Cardinal count,
- _XtBoolean inPlace
- )
-#else
-XtPointer _XtInitializeActionData(actions, count, inPlace)
- register struct _XtActionsRec *actions;
- register Cardinal count;
- Boolean inPlace;
-#endif
-{
- TMClassCache classCache;
-
- classCache = XtNew(TMClassCacheRec);
- classCache->actions = CompileActionTable(actions, count, inPlace, True);
- classCache->bindCache = NULL;
- return (XtPointer)classCache;
-}
-
-
-#define TM_BIND_CACHE_REALLOC 2
-
-static XtActionProc *EnterBindCache(w, stateTree, procs, bindStatus)
- Widget w;
- TMSimpleStateTree stateTree;
- XtActionProc *procs;
- TMBindCacheStatus bindStatus;
-{
- TMClassCache classCache;
- TMBindCache* bindCachePtr;
- TMShortCard procsSize;
- TMBindCache bindCache;
-
- LOCK_PROCESS;
- classCache = GetClassCache(w);
- bindCachePtr = &classCache->bindCache;
- procsSize = stateTree->numQuarks * sizeof(XtActionProc);
-
- for (bindCache = *bindCachePtr;
- (*bindCachePtr);
- bindCachePtr = &(*bindCachePtr)->next, bindCache = *bindCachePtr)
- {
- TMBindCacheStatus cacheStatus = &bindCache->status;
-
- if ((bindStatus->boundInClass == cacheStatus->boundInClass) &&
- (bindStatus->boundInHierarchy == cacheStatus->boundInHierarchy) &&
- (bindStatus->boundInContext == cacheStatus->boundInContext) &&
- (bindCache->stateTree == (TMStateTree)stateTree) &&
- !XtMemcmp(&bindCache->procs[0], procs, procsSize))
- {
- bindCache->status.refCount++;
- break;
- }
- }
- if (*bindCachePtr == NULL)
- {
- *bindCachePtr =
- bindCache = (TMBindCache)
- __XtMalloc(sizeof(TMBindCacheRec) +
- (procsSize - sizeof(XtActionProc)));
- bindCache->next = NULL;
- bindCache->status = *bindStatus;
- bindCache->status.refCount = 1;
- bindCache->stateTree = (TMStateTree)stateTree;
-#ifdef TRACE_TM
- bindCache->widgetClass = XtClass(w);
- if (_XtGlobalTM.numBindCache == _XtGlobalTM.bindCacheTblSize)
- {
- _XtGlobalTM.bindCacheTblSize += 16;
- _XtGlobalTM.bindCacheTbl = (TMBindCache *)
- XtRealloc((char *)_XtGlobalTM.bindCacheTbl,
- ((_XtGlobalTM.bindCacheTblSize) *
- sizeof(TMBindCache)));
- }
- _XtGlobalTM.bindCacheTbl[_XtGlobalTM.numBindCache++] = bindCache;
-#endif /* TRACE_TM */
- XtMemmove((XtPointer)&bindCache->procs[0],
- (XtPointer)procs, procsSize);
- }
- UNLOCK_PROCESS;
- return &bindCache->procs[0];
-}
-
-static void RemoveFromBindCache(w,procs)
- Widget w;
- XtActionProc *procs;
-{
- TMClassCache classCache;
- TMBindCache* bindCachePtr;
- TMBindCache bindCache;
- XtAppContext app = XtWidgetToApplicationContext (w);
-
- LOCK_PROCESS;
- classCache = GetClassCache(w);
- bindCachePtr = (TMBindCache *)&classCache->bindCache;
-
- for (bindCache = *bindCachePtr;
- *bindCachePtr;
- bindCachePtr = &(*bindCachePtr)->next, bindCache = *bindCachePtr)
- {
- if (&bindCache->procs[0] == procs)
- {
- if (--bindCache->status.refCount == 0)
- {
-#ifdef TRACE_TM
- TMShortCard j;
- Boolean found = False;
- TMBindCache *tbl = _XtGlobalTM.bindCacheTbl;
-
- for (j = 0; j < _XtGlobalTM.numBindCache; j++) {
- if (found)
- tbl[j-1] = tbl[j];
- if (tbl[j] == bindCache)
- found = True;
- }
- if (!found)
- XtWarning("where's the action ??? ");
- else
- _XtGlobalTM.numBindCache--;
-#endif /* TRACE_TM */
- *bindCachePtr = bindCache->next;
- bindCache->next = app->free_bindings;
- app->free_bindings = bindCache;
- }
- break;
- }
- }
- UNLOCK_PROCESS;
-}
-
-/* ARGSUSED */
-static void RemoveAccelerators(widget,closure,data)
- Widget widget;
- XtPointer closure, data;
-{
- Widget destination = (Widget)closure;
- TMComplexBindProcs bindProcs;
- XtTranslations stackXlations[16];
- XtTranslations *xlationsList, destXlations;
- TMShortCard i, numXlations = 0;
-
- if ((destXlations = destination->core.tm.translations) == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- XtNtranslationError,"nullTable",XtCXtToolkitError,
- "Can't remove accelerators from NULL table",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
-
- xlationsList = (XtTranslations *)
- XtStackAlloc((destXlations->numStateTrees * sizeof(XtTranslations)),
- stackXlations);
-
- for (i = 0, bindProcs = TMGetComplexBindEntry(destination->core.tm.proc_table, i);
- i < destXlations->numStateTrees;
- i++, bindProcs++) {
- if (bindProcs->widget == widget) {
- /*
- * if it's being destroyed don't do all the work
- */
- if (destination->core.being_destroyed) {
- bindProcs->procs = NULL;
- }
- else
- xlationsList[numXlations] = bindProcs->aXlations;
- numXlations++;
- }
- }
-
- if (numXlations == 0)
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- XtNtranslationError,"nullTable",XtCXtToolkitError,
- "Tried to remove nonexistent accelerators",
- (String *)NULL, (Cardinal *)NULL);
- else {
- if (!destination->core.being_destroyed)
- for (i = 0; i < numXlations; i++)
- _XtUnmergeTranslations(destination, xlationsList[i]);
- }
- XtStackFree((char *)xlationsList, stackXlations);
-}
-
-void _XtBindActions(widget, tm)
- Widget widget;
- XtTM tm;
-{
- XtTranslations xlations = tm->translations;
- TMSimpleStateTree stateTree;
- int globalUnbound = 0;
- Cardinal i;
- TMBindData bindData = (TMBindData)tm->proc_table;
- TMSimpleBindProcs simpleBindProcs;
- TMComplexBindProcs complexBindProcs;
- XtActionProc *newProcs;
- Widget bindWidget;
-
- if ((xlations == NULL) || widget->core.being_destroyed)
- return;
-
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0];
-
- for (i = 0; i < xlations->numStateTrees; i++)
- {
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i];
- if (bindData->simple.isComplex) {
- complexBindProcs = TMGetComplexBindEntry(bindData, i);
- if (complexBindProcs->widget) {
- bindWidget = complexBindProcs->widget;
-
- if (bindWidget->core.destroy_callbacks != NULL)
- _XtAddCallbackOnce((InternalCallbackList *)
- &bindWidget->core.destroy_callbacks,
- RemoveAccelerators,
- (XtPointer)widget);
- else
- _XtAddCallback((InternalCallbackList *)
- &bindWidget->core.destroy_callbacks,
- RemoveAccelerators,
- (XtPointer)widget);
- }
- else
- bindWidget = widget;
- }
- else {
- simpleBindProcs = TMGetSimpleBindEntry(bindData, i);
- bindWidget = widget;
- }
- if ((newProcs =
- TryBindCache(bindWidget,(TMStateTree)stateTree)) == NULL)
- {
- XtActionProc *procs, stackProcs[256];
- int localUnbound;
- TMBindCacheStatusRec bcStatusRec;
-
- procs = (XtActionProc *)
- XtStackAlloc(stateTree->numQuarks * sizeof(XtActionProc),
- stackProcs);
- XtBZero((XtPointer)procs,
- stateTree->numQuarks * sizeof(XtActionProc));
-
- localUnbound = BindProcs(bindWidget,
- stateTree,
- procs,
- &bcStatusRec);
-
- if (localUnbound)
- bcStatusRec.notFullyBound = True;
- else
- bcStatusRec.notFullyBound = False;
-
- newProcs =
- EnterBindCache(bindWidget,
- stateTree,
- procs,
- &bcStatusRec);
- XtStackFree((XtPointer)procs, (XtPointer)stackProcs);
- globalUnbound += localUnbound;
- }
- if (bindData->simple.isComplex)
- complexBindProcs->procs = newProcs;
- else
- simpleBindProcs->procs = newProcs;
- }
- if (globalUnbound)
- ReportUnboundActions(xlations,
- (TMBindData)tm->proc_table);
-}
-
-
-void _XtUnbindActions(widget, xlations, bindData)
- Widget widget;
- XtTranslations xlations;
- TMBindData bindData;
-{
- Cardinal i;
- Widget bindWidget;
- XtActionProc *procs;
-
- if ((xlations == NULL) || !XtIsRealized(widget)) return;
-
- for (i = 0; i < xlations->numStateTrees; i++) {
- if (bindData->simple.isComplex) {
- TMComplexBindProcs complexBindProcs;
-
- complexBindProcs = TMGetComplexBindEntry(bindData, i);
-
- if (complexBindProcs->widget) {
- /*
- * check for this being an accelerator binding whose
- * source is gone ( set by RemoveAccelerators)
- */
- if (complexBindProcs->procs == NULL)
- continue;
-
- XtRemoveCallback(complexBindProcs->widget,
- XtNdestroyCallback,
- RemoveAccelerators,
- (XtPointer)widget);
- bindWidget = complexBindProcs->widget;
- }
- else
- bindWidget = widget;
- procs = complexBindProcs->procs;
- complexBindProcs->procs = NULL;
- }
- else {
- TMSimpleBindProcs simpleBindProcs;
- simpleBindProcs = TMGetSimpleBindEntry(bindData,i);
- procs = simpleBindProcs->procs;
- simpleBindProcs->procs = NULL;
- bindWidget = widget;
- }
- RemoveFromBindCache(bindWidget, procs);
- }
-}
-
-#ifdef notdef
-void _XtRemoveBindProcsByIndex(w, bindData, ndx)
- Widget w;
- TMBindData bindData;
- TMShortCard ndx;
-{
- TMShortCard i = ndx;
- TMBindProcs bindProcs = (TMBindProcs)&bindData->bindTbl[0];
-
- RemoveFromBindCache(bindProcs->widget ? bindProcs->widget : w,
- bindProcs[i].procs);
-
- for (; i < bindData->bindTblSize; i++)
- bindProcs[i] = bindProcs[i+1];
-}
-#endif /* notdef */
-
-/*
- * used to free all copied action tables, called from DestroyAppContext
- */
-void _XtFreeActions(actions)
- ActionList actions;
-{
- ActionList curr, next;
-
- for (curr = actions; curr;) {
- next = curr->next;
- XtFree((char *)curr->table);
- XtFree((char *)curr);
- curr = next;
- }
-}
-
-void XtAddActions(actions, num_actions)
- XtActionList actions;
- Cardinal num_actions;
-{
- XtAppAddActions(_XtDefaultAppContext(), actions, num_actions);
-}
-
-void XtAppAddActions(app, actions, num_actions)
- XtAppContext app;
- XtActionList actions;
- Cardinal num_actions;
-{
- register ActionList rec;
-
- LOCK_APP(app);
- rec = XtNew(ActionListRec);
- rec->next = app->action_table;
- app->action_table = rec;
- rec->table = CompileActionTable(actions, num_actions, False, False);
- rec->count = num_actions;
- UNLOCK_APP(app);
-}
-
-void XtGetActionList(widget_class, actions_return, num_actions_return)
- WidgetClass widget_class;
- XtActionList* actions_return;
- Cardinal* num_actions_return;
-{
- XtActionList list;
- CompiledActionTable table;
- int i;
-
- *actions_return = NULL;
- *num_actions_return = 0;
-
- LOCK_PROCESS;
- if (! widget_class->core_class.class_inited) {
- UNLOCK_PROCESS;
- return;
- }
- if (! (widget_class->core_class.class_inited & WidgetClassFlag)) {
- UNLOCK_PROCESS;
- return;
- }
- *num_actions_return = widget_class->core_class.num_actions;
- if (*num_actions_return) {
- list = *actions_return = (XtActionList)
- __XtMalloc(*num_actions_return * sizeof(XtActionsRec));
- table = GetClassActions(widget_class);
- for (i= (*num_actions_return); --i >= 0; list++, table++) {
- list->string = XrmQuarkToString(table->signature);
- list->proc = table->proc;
- }
- }
- UNLOCK_PROCESS;
-}
-
-/***********************************************************************
- *
- * Pop-up and Grab stuff
- *
- ***********************************************************************/
-
-static Widget _XtFindPopup(widget, name)
- Widget widget;
- String name;
-{
- register Cardinal i;
- register XrmQuark q;
- register Widget w;
-
- q = XrmStringToQuark(name);
-
- for (w=widget; w != NULL; w=w->core.parent)
- for (i=0; i<w->core.num_popups; i++)
- if (w->core.popup_list[i]->core.xrm_name == q)
- return w->core.popup_list[i];
-
- return NULL;
-}
-
-void XtMenuPopupAction(widget, event, params, num_params)
- Widget widget;
- XEvent *event;
- String *params;
- Cardinal *num_params;
-{
- Boolean spring_loaded;
- register Widget popup_shell;
- XtAppContext app = XtWidgetToApplicationContext(widget);
-
- LOCK_APP(app);
- if (*num_params != 1) {
- XtAppWarningMsg(app,
- "invalidParameters","xtMenuPopupAction",XtCXtToolkitError,
- "MenuPopup wants exactly one argument",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
-
- if (event->type == ButtonPress)
- spring_loaded = True;
- else if (event->type == KeyPress || event->type == EnterNotify)
- spring_loaded = False;
- else {
- XtAppWarningMsg(app,
- "invalidPopup","unsupportedOperation",XtCXtToolkitError,
-"Pop-up menu creation is only supported on ButtonPress, KeyPress or EnterNotify events.",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_APP(app);
- return;
- }
-
- popup_shell = _XtFindPopup(widget, params[0]);
- if (popup_shell == NULL) {
- XtAppWarningMsg(app,
- "invalidPopup","xtMenuPopup",XtCXtToolkitError,
- "Can't find popup widget \"%s\" in XtMenuPopup",
- params, num_params);
- UNLOCK_APP(app);
- return;
- }
-
- if (spring_loaded) _XtPopup(popup_shell, XtGrabExclusive, TRUE);
- else _XtPopup(popup_shell, XtGrabNonexclusive, FALSE);
- UNLOCK_APP(app);
-}
-
-
-/*ARGSUSED*/
-static void _XtMenuPopdownAction(widget, event, params, num_params)
- Widget widget;
- XEvent *event;
- String *params;
- Cardinal *num_params;
-{
- Widget popup_shell;
-
- if (*num_params == 0) {
- XtPopdown(widget);
- } else if (*num_params == 1) {
- popup_shell = _XtFindPopup(widget, params[0]);
- if (popup_shell == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidPopup","xtMenuPopdown",XtCXtToolkitError,
- "Can't find popup widget \"%s\" in XtMenuPopdown",
- params, num_params);
- return;
- }
- XtPopdown(popup_shell);
- } else {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidParameters","xtMenuPopdown",XtCXtToolkitError,
- "XtMenuPopdown called with num_params != 0 or 1",
- (String *)NULL, (Cardinal *)NULL);
- }
-}
-
-static XtActionsRec RConst tmActions[] = {
- {"XtMenuPopup", XtMenuPopupAction},
- {"XtMenuPopdown", _XtMenuPopdownAction},
- {"MenuPopup", XtMenuPopupAction}, /* old & obsolete */
- {"MenuPopdown", _XtMenuPopdownAction}, /* ditto */
-#ifndef NO_MIT_HACKS
- {"XtDisplayTranslations", _XtDisplayTranslations},
- {"XtDisplayAccelerators", _XtDisplayAccelerators},
- {"XtDisplayInstalledAccelerators", _XtDisplayInstalledAccelerators},
-#endif
-};
-
-
-void _XtPopupInitialize(app)
- XtAppContext app;
-{
- register ActionList rec;
-
- /*
- * The _XtGlobalTM.newMatchSemantics flag determines whether
- * we support old or new matching
- * behavior. This is mainly an issue of whether subsequent lhs will
- * get pushed up in the match table if a lhs containing thier initial
- * sequence has already been encountered. Currently inited to False;
- */
-#ifdef NEW_TM
- _XtGlobalTM.newMatchSemantics = True;
-#else
- _XtGlobalTM.newMatchSemantics = False;
-#endif
-
- rec = XtNew(ActionListRec);
- rec->next = app->action_table;
- app->action_table = rec;
- LOCK_PROCESS;
- rec->table = CompileActionTable(tmActions, XtNumber(tmActions), False,
- True);
- rec->count = XtNumber(tmActions);
- UNLOCK_PROCESS;
- _XtGrabInitialize(app);
-}
-
-
-#if NeedFunctionPrototypes
-void XtCallActionProc(
- Widget widget,
- _Xconst char* action,
- XEvent *event,
- String *params,
- Cardinal num_params
- )
-#else
-void XtCallActionProc(widget, action, event, params, num_params)
- Widget widget;
- String action;
- XEvent *event;
- String *params;
- Cardinal num_params;
-#endif
-{
- CompiledAction* actionP;
- XrmQuark q = XrmStringToQuark(action);
- Widget w = widget;
- XtAppContext app = XtWidgetToApplicationContext(widget);
- ActionList actionList;
- Cardinal i;
-
- LOCK_APP(app);
- XtCheckSubclass(widget, coreWidgetClass,
- "XtCallActionProc first argument is not a subclass of Core");
- LOCK_PROCESS;
- do {
- WidgetClass class = XtClass(w);
- do {
- if ((actionP = GetClassActions(class)) != NULL)
- for (i = 0;
- i < class->core_class.num_actions;
- i++, actionP++) {
-
- if (actionP->signature == q) {
- ActionHook hook = app->action_hook_list;
- while (hook != NULL) {
- (*hook->proc)( widget,
- hook->closure,
- (String)action,
- event,
- params,
- &num_params
- );
- hook= hook->next;
- }
- (*(actionP->proc))
- (widget, event, params, &num_params);
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
- }
- class = class->core_class.superclass;
- } while (class != NULL);
- w = XtParent(w);
- } while (w != NULL);
- UNLOCK_PROCESS;
-
- for (actionList = app->action_table;
- actionList != NULL;
- actionList = actionList->next) {
-
- for (i = 0, actionP = actionList->table;
- i < actionList->count;
- i++, actionP++) {
- if (actionP->signature == q) {
- ActionHook hook = app->action_hook_list;
- while (hook != NULL) {
- (*hook->proc)( widget,
- hook->closure,
- (String)action,
- event,
- params,
- &num_params
- );
- hook= hook->next;
- }
- (*(actionP->proc))
- (widget, event, params, &num_params);
- UNLOCK_APP(app);
- return;
- }
- }
-
- }
-
- {
- String params[2];
- Cardinal num_params = 2;
- params[0] = (String)action;
- params[1] = XtName(widget);
- XtAppWarningMsg(app,
- "noActionProc", "xtCallActionProc", XtCXtToolkitError,
- "No action proc named \"%s\" is registered for widget \"%s\"",
- params, &num_params
- );
- }
- UNLOCK_APP(app);
-}
-
-void _XtDoFreeBindings(app)
- XtAppContext app;
-{
- TMBindCache bcp;
-
- while (app->free_bindings) {
- bcp = app->free_bindings->next;
- XtFree ((char *) app->free_bindings);
- app->free_bindings = bcp;
- }
-}
diff --git a/xc/lib/Xt/TMgrab.c b/xc/lib/Xt/TMgrab.c
deleted file mode 100644
index db918627b..000000000
--- a/xc/lib/Xt/TMgrab.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/* $TOG: TMgrab.c /main/13 1998/02/06 13:26:51 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-/*LINTLIBRARY*/
-#include "IntrinsicI.h"
-
-typedef struct _GrabActionRec {
- struct _GrabActionRec* next;
- XtActionProc action_proc;
- Boolean owner_events;
- unsigned int event_mask;
- int pointer_mode, keyboard_mode;
-} GrabActionRec;
-
-static GrabActionRec *grabActionList = NULL;
-
-static void GrabAllCorrectKeys(widget, typeMatch, modMatch, grabP)
- Widget widget;
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- GrabActionRec* grabP;
-{
- Display *dpy = XtDisplay(widget);
- KeyCode *keycodes, *keycodeP;
- Cardinal keycount;
- Modifiers careOn = 0;
- Modifiers careMask = 0;
-
- if (modMatch->lateModifiers) {
- Boolean resolved;
- resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers,
- &careOn, &careMask);
- if (!resolved) return;
- }
- careOn |= modMatch->modifiers;
- careMask |= modMatch->modifierMask;
-
- XtKeysymToKeycodeList(
- dpy,
- (KeySym)typeMatch->eventCode,
- &keycodes,
- &keycount
- );
- if (keycount == 0) return;
- for (keycodeP = keycodes; keycount--; keycodeP++) {
- if (modMatch->standard) {
- /* find standard modifiers that produce this keysym */
- KeySym keysym;
- int std_mods, least_mod;
- Modifiers modifiers_return;
- XtTranslateKeycode( dpy, *keycodeP, (Modifiers)0,
- &modifiers_return, &keysym );
- if (careOn & modifiers_return)
- return;
- if (keysym == typeMatch->eventCode) {
- XtGrabKey(widget, *keycodeP, careOn,
- grabP->owner_events,
- grabP->pointer_mode,
- grabP->keyboard_mode
- );
- /* continue; */ /* grab all modifier combinations */
- }
- least_mod = modifiers_return & (~modifiers_return + 1);
- for (std_mods = modifiers_return;
- std_mods >= least_mod; std_mods--) {
- Modifiers dummy;
- /* check all useful combinations of modifier bits */
- if (modifiers_return & std_mods &&
- !(~modifiers_return & std_mods)) {
- XtTranslateKeycode( dpy, *keycodeP,
- (Modifiers)std_mods,
- &dummy, &keysym );
- if (keysym == typeMatch->eventCode) {
- XtGrabKey(widget, *keycodeP,
- careOn | (Modifiers) std_mods,
- grabP->owner_events,
- grabP->pointer_mode,
- grabP->keyboard_mode
- );
- /* break; */ /* grab all modifier combinations */
- }
- }
- }
- } else /* !event->standard */ {
- XtGrabKey(widget, *keycodeP, careOn,
- grabP->owner_events,
- grabP->pointer_mode,
- grabP->keyboard_mode
- );
- }
- }
- XtFree((char *)keycodes);
-}
-
-typedef struct {
- TMShortCard count;
- Widget widget;
- GrabActionRec *grabP;
-}DoGrabRec;
-
-static Boolean DoGrab(state, data)
- StatePtr state;
- XtPointer data;
-{
- DoGrabRec *doGrabP = (DoGrabRec *)data;
- GrabActionRec* grabP = doGrabP->grabP;
- Widget widget = doGrabP->widget;
- TMShortCard count = doGrabP->count;
- TMShortCard typeIndex = state->typeIndex;
- TMShortCard modIndex = state->modIndex;
- ActionRec *action;
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- Modifiers careOn = 0;
- Modifiers careMask = 0;
- Boolean resolved;
-
- LOCK_PROCESS;
- typeMatch = TMGetTypeMatch(typeIndex);
- modMatch = TMGetModifierMatch(modIndex);
-
- for (action = state->actions; action; action = action->next)
- if (count == action->idx) break;
- if (!action) {
- UNLOCK_PROCESS;
- return False;
- }
-
- switch (typeMatch->eventType) {
- case ButtonPress:
- case ButtonRelease:
- if (modMatch->lateModifiers) {
- resolved = _XtComputeLateBindings(XtDisplay(widget),
- modMatch->lateModifiers,
- &careOn, &careMask);
- if (!resolved) break;
- }
- careOn |= modMatch->modifiers;
- XtGrabButton(
- widget,
- (unsigned) typeMatch->eventCode,
- careOn,
- grabP->owner_events,
- grabP->event_mask,
- grabP->pointer_mode,
- grabP->keyboard_mode,
- None,
- None
- );
- break;
-
- case KeyPress:
- case KeyRelease:
- GrabAllCorrectKeys(widget, typeMatch, modMatch, grabP);
- break;
-
- case EnterNotify:
- break;
-
- default:
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "invalidPopup","unsupportedOperation",XtCXtToolkitError,
- "Pop-up menu creation is only supported on Button, Key or EnterNotify events.",
- (String *)NULL, (Cardinal *)NULL);
- break;
- }
- UNLOCK_PROCESS;
- return False;
-}
-
-void _XtRegisterGrabs(widget)
- Widget widget;
-{
- XtTranslations xlations = widget->core.tm.translations;
- TMComplexStateTree *stateTreePtr;
- unsigned int count;
- TMShortCard i;
- TMBindData bindData = (TMBindData) widget->core.tm.proc_table;
- XtActionProc *procs;
-
- if (! XtIsRealized(widget) || widget->core.being_destroyed)
- return;
-
- /* walk the widget instance action bindings table looking for */
- /* actions registered as grab actions. */
- /* when you find one, do a grab on the triggering event */
-
- if (xlations == NULL) return;
- stateTreePtr = (TMComplexStateTree *) xlations->stateTreeTbl;
- if (*stateTreePtr == NULL) return;
- for (i = 0; i < xlations->numStateTrees; i++, stateTreePtr++) {
- if (bindData->simple.isComplex)
- procs = TMGetComplexBindEntry(bindData, i)->procs;
- else
- procs = TMGetSimpleBindEntry(bindData, i)->procs;
- for (count=0; count < (*stateTreePtr)->numQuarks; count++) {
- GrabActionRec* grabP;
- DoGrabRec doGrab;
-
- LOCK_PROCESS;
- for (grabP = grabActionList; grabP != NULL; grabP = grabP->next) {
- if (grabP->action_proc == procs[count]) {
- /* we've found a "grabber" in the action table. Find the
- * states that call this action. Note that if there is
- * more than one "grabber" in the action table, we end
- * up searching all of the states multiple times.
- */
- doGrab.widget = widget;
- doGrab.grabP = grabP;
- doGrab.count = count;
- _XtTraverseStateTree((TMStateTree)*stateTreePtr,
- DoGrab,
- (XtPointer)&doGrab);
- }
- }
- UNLOCK_PROCESS;
- }
- }
-}
-
-#if NeedFunctionPrototypes
-void XtRegisterGrabAction(
- XtActionProc action_proc,
- _XtBoolean owner_events,
- unsigned int event_mask,
- int pointer_mode,
- int keyboard_mode
- )
-#else
-void XtRegisterGrabAction(action_proc, owner_events, event_mask,
- pointer_mode, keyboard_mode)
- XtActionProc action_proc;
- Boolean owner_events;
- unsigned int event_mask;
- int pointer_mode, keyboard_mode;
-#endif
-{
- GrabActionRec* actionP;
-
- LOCK_PROCESS;
- for (actionP = grabActionList; actionP != NULL; actionP = actionP->next) {
- if (actionP->action_proc == action_proc) break;
- }
- if (actionP == NULL) {
- actionP = XtNew(GrabActionRec);
- actionP->action_proc = action_proc;
- actionP->next = grabActionList;
- grabActionList = actionP;
- }
-#ifdef DEBUG
- else
- if ( actionP->owner_events != owner_events
- || actionP->event_mask != event_mask
- || actionP->pointer_mode != pointer_mode
- || actionP->keyboard_mode != keyboard_mode) {
- Cardinal n = 0;
- XtWarningMsg(
- "argsReplaced", "xtRegisterGrabAction", XtCXtToolkitError,
- "XtRegisterGrabAction called on same proc with different args",
- NULL, &n);
- }
-#endif /*DEBUG*/
-
- actionP->owner_events = owner_events;
- actionP->event_mask = event_mask;
- actionP->pointer_mode = pointer_mode;
- actionP->keyboard_mode = keyboard_mode;
- UNLOCK_PROCESS;
-}
-
-/*ARGSUSED*/
-void _XtGrabInitialize(app)
- XtAppContext app;
-{
- LOCK_PROCESS;
- if (grabActionList == NULL)
- XtRegisterGrabAction( XtMenuPopupAction, True,
- (unsigned)(ButtonPressMask | ButtonReleaseMask),
- GrabModeAsync,
- GrabModeAsync
- );
- UNLOCK_PROCESS;
-
-}
diff --git a/xc/lib/Xt/TMkey.c b/xc/lib/Xt/TMkey.c
deleted file mode 100644
index 80f7c3064..000000000
--- a/xc/lib/Xt/TMkey.c
+++ /dev/null
@@ -1,740 +0,0 @@
-/* $TOG: TMkey.c /main/34 1998/02/06 13:26:56 kaleb $ */
-/*LINTLIBRARY*/
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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, 1988, 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.
-
-*/
-
-#define XK_MISCELLANY
-#define XK_LATIN1
-#define XK_LATIN2
-#define XK_LATIN3
-#define XK_LATIN4
-
-#include "IntrinsicI.h"
-#include <X11/keysymdef.h>
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-#define FLUSHKEYCACHE(ctx) \
- bzero((char *)&ctx->keycache, sizeof(TMKeyCache))
-
-/*
- * The following array reorders the modifier bits so that the most common ones
- * (used by a translator) are in the top-most bits with respect to the size of
- * the keycache. The array currently just reverses the bits as a good guess.
- * This might be more trouble than it is worth, but it seems to help.
- */
-
-#define FM(i) i >> (8 - TMKEYCACHELOG2)
-static Const unsigned char modmix[256] = {
-FM(0x0f), FM(0x8f), FM(0x4f), FM(0xcf), FM(0x2f), FM(0xaf), FM(0x6f), FM(0xef),
-FM(0x1f), FM(0x9f), FM(0x5f), FM(0xdf), FM(0x3f), FM(0xbf), FM(0x7f), FM(0xff),
-FM(0x07), FM(0x87), FM(0x47), FM(0xc7), FM(0x27), FM(0xa7), FM(0x67), FM(0xe7),
-FM(0x17), FM(0x97), FM(0x57), FM(0xd7), FM(0x37), FM(0xb7), FM(0x77), FM(0xf7),
-FM(0x0b), FM(0x8b), FM(0x4b), FM(0xcb), FM(0x2b), FM(0xab), FM(0x6b), FM(0xeb),
-FM(0x1b), FM(0x9b), FM(0x5b), FM(0xdb), FM(0x3b), FM(0xbb), FM(0x7b), FM(0xfb),
-FM(0x03), FM(0x83), FM(0x43), FM(0xc3), FM(0x23), FM(0xa3), FM(0x63), FM(0xe3),
-FM(0x13), FM(0x93), FM(0x53), FM(0xd3), FM(0x33), FM(0xb3), FM(0x73), FM(0xf3),
-FM(0x0d), FM(0x8d), FM(0x4d), FM(0xcd), FM(0x2d), FM(0xad), FM(0x6d), FM(0xed),
-FM(0x1d), FM(0x9d), FM(0x5d), FM(0xdd), FM(0x3d), FM(0xbd), FM(0x7d), FM(0xfd),
-FM(0x05), FM(0x85), FM(0x45), FM(0xc5), FM(0x25), FM(0xa5), FM(0x65), FM(0xe5),
-FM(0x15), FM(0x95), FM(0x55), FM(0xd5), FM(0x35), FM(0xb5), FM(0x75), FM(0xf5),
-FM(0x09), FM(0x89), FM(0x49), FM(0xc9), FM(0x29), FM(0xa9), FM(0x69), FM(0xe9),
-FM(0x19), FM(0x99), FM(0x59), FM(0xd9), FM(0x39), FM(0xb9), FM(0x79), FM(0xf9),
-FM(0x01), FM(0x81), FM(0x41), FM(0xc1), FM(0x21), FM(0xa1), FM(0x61), FM(0xe1),
-FM(0x11), FM(0x91), FM(0x51), FM(0xd1), FM(0x31), FM(0xb1), FM(0x71), FM(0xf1),
-FM(0x00), FM(0x8e), FM(0x4e), FM(0xce), FM(0x2e), FM(0xae), FM(0x6e), FM(0xee),
-FM(0x1e), FM(0x9e), FM(0x5e), FM(0xde), FM(0x3e), FM(0xbe), FM(0x7e), FM(0xfe),
-FM(0x08), FM(0x88), FM(0x48), FM(0xc8), FM(0x28), FM(0xa8), FM(0x68), FM(0xe8),
-FM(0x18), FM(0x98), FM(0x58), FM(0xd8), FM(0x38), FM(0xb8), FM(0x78), FM(0xf8),
-FM(0x04), FM(0x84), FM(0x44), FM(0xc4), FM(0x24), FM(0xa4), FM(0x64), FM(0xe4),
-FM(0x14), FM(0x94), FM(0x54), FM(0xd4), FM(0x34), FM(0xb4), FM(0x74), FM(0xf4),
-FM(0x0c), FM(0x8c), FM(0x4c), FM(0xcc), FM(0x2c), FM(0xac), FM(0x6c), FM(0xec),
-FM(0x1c), FM(0x9c), FM(0x5c), FM(0xdc), FM(0x3c), FM(0xbc), FM(0x7c), FM(0xfc),
-FM(0x02), FM(0x82), FM(0x42), FM(0xc2), FM(0x22), FM(0xa2), FM(0x62), FM(0xe2),
-FM(0x12), FM(0x92), FM(0x52), FM(0xd2), FM(0x32), FM(0xb2), FM(0x72), FM(0xf2),
-FM(0x0a), FM(0x8a), FM(0x4a), FM(0xca), FM(0x2a), FM(0xaa), FM(0x6a), FM(0xea),
-FM(0x1a), FM(0x9a), FM(0x5a), FM(0xda), FM(0x3a), FM(0xba), FM(0x7a), FM(0xfa),
-FM(0x06), FM(0x86), FM(0x46), FM(0xc6), FM(0x26), FM(0xa6), FM(0x66), FM(0xe6),
-FM(0x16), FM(0x96), FM(0x56), FM(0xd6), FM(0x36), FM(0xb6), FM(0x76), FM(0xf6),
-FM(0x0e), FM(0x8e), FM(0x4e), FM(0xce), FM(0x2e), FM(0xae), FM(0x6e), FM(0xee),
-FM(0x1e), FM(0x9e), FM(0x5e), FM(0xde), FM(0x3e), FM(0xbe), FM(0x7e), FM(0xfe)
-};
-#undef FM
-
-#define MOD_RETURN(ctx, key) (ctx)->keycache.modifiers_return[key]
-
-#define TRANSLATE(ctx,pd,dpy,key,mod,mod_ret,sym_ret) \
-{ \
- int _i_ = (((key) - (pd)->min_keycode + modmix[(mod) & 0xff]) & \
- (TMKEYCACHESIZE-1)); \
- if ((key) != 0 && /* Xlib XIM composed input */ \
- (ctx)->keycache.keycode[_i_] == (key) && \
- (ctx)->keycache.modifiers[_i_] == (mod)) { \
- mod_ret = MOD_RETURN(ctx, key); \
- sym_ret = (ctx)->keycache.keysym[_i_]; \
- } else { \
- XtTranslateKeycode(dpy, key, mod, &mod_ret, &sym_ret); \
- (ctx)->keycache.keycode[_i_] = key; \
- (ctx)->keycache.modifiers[_i_] = (unsigned char)(mod); \
- (ctx)->keycache.keysym[_i_] = sym_ret; \
- MOD_RETURN(ctx, key) = (unsigned char)mod_ret; \
- } \
-}
-
-#define UPDATE_CACHE(ctx, pd, key, mod, mod_ret, sym_ret) \
-{ \
- int _i_ = (((key) - (pd)->min_keycode + modmix[(mod) & 0xff]) & \
- (TMKEYCACHESIZE-1)); \
- (ctx)->keycache.keycode[_i_] = key; \
- (ctx)->keycache.modifiers[_i_] = (unsigned char)(mod); \
- (ctx)->keycache.keysym[_i_] = sym_ret; \
- MOD_RETURN(ctx, key) = (unsigned char)mod_ret; \
-}
-
-/* usual number of expected keycodes in XtKeysymToKeycodeList */
-#define KEYCODE_ARRAY_SIZE 10
-
-Boolean _XtComputeLateBindings(dpy, lateModifiers, computed, computedMask)
- Display *dpy;
- LateBindingsPtr lateModifiers;
- Modifiers *computed,*computedMask;
-{
- int i,j,ref;
- ModToKeysymTable* temp;
- XtPerDisplay perDisplay;
- Boolean found;
- KeySym tempKeysym = NoSymbol;
-
- perDisplay = _XtGetPerDisplay(dpy);
- if (perDisplay == NULL) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "displayError","invalidDisplay",XtCXtToolkitError,
- "Can't find display structure",
- (String *)NULL, (Cardinal *)NULL);
- return FALSE;
- }
- _InitializeKeysymTables(dpy, perDisplay);
- for (ref=0; lateModifiers[ref].keysym; ref++) {
- found = FALSE;
- for (i=0;i<8;i++) {
- temp = &(perDisplay->modsToKeysyms[i]);
- for (j=0;j<temp->count;j++){
- if (perDisplay->modKeysyms[temp->idx+j] ==
- lateModifiers[ref].keysym) {
- *computedMask = *computedMask | temp->mask;
- if (!lateModifiers[ref].knot)
- *computed |= temp->mask;
- tempKeysym = lateModifiers[ref].keysym;
- found = TRUE; break;
- }
- }
- if (found) break;
- }
- if (!found && !lateModifiers[ref].knot)
- if (!lateModifiers[ref].pair && (tempKeysym == NoSymbol))
- return FALSE;
- /* if you didn't find the modifier and the modifier must be
- asserted then return FALSE. If you didn't find the modifier
- and the modifier must be off, then it is OK . Don't
- return FALSE if this is the first member of a pair or if
- it is the second member of a pair when the first member
- was bound to a modifier */
- if (!lateModifiers[ref].pair) tempKeysym = NoSymbol;
- }
- return TRUE;
-}
-
-void _XtAllocTMContext(pd)
- XtPerDisplay pd;
-{
- TMKeyContext ctx;
- ctx = (TMKeyContext)_XtHeapAlloc(&pd->heap,
- sizeof(TMKeyContextRec));
- ctx->event = NULL;
- ctx->serial = 0;
- ctx->keysym = NoSymbol;
- ctx->modifiers = 0;
- FLUSHKEYCACHE(ctx);
- pd->tm_context = ctx;
-}
-
-static unsigned int num_bits(mask)
- unsigned long mask;
-{
- register unsigned long y;
-
- y = (mask >> 1) &033333333333;
- y = mask - y - ((y >>1) & 033333333333);
- return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077));
-}
-
-Boolean _XtMatchUsingDontCareMods(typeMatch, modMatch, eventSeq)
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- TMEventPtr eventSeq;
-{
- Modifiers modifiers_return;
- KeySym keysym_return;
- Modifiers useful_mods;
- int i, num_modbits;
- Modifiers computed = 0;
- Modifiers computedMask = 0;
- Boolean resolved = TRUE;
- Display *dpy = eventSeq->xev->xany.display;
- XtPerDisplay pd;
- TMKeyContext tm_context;
-
- if (modMatch->lateModifiers != NULL)
- resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers,
- &computed, &computedMask);
- if (!resolved) return FALSE;
- computed |= modMatch->modifiers;
- computedMask |= modMatch->modifierMask; /* gives do-care mask */
-
- if ( (computed & computedMask) ==
- (eventSeq->event.modifiers & computedMask) ) {
-
- pd = _XtGetPerDisplay(dpy);
- tm_context = pd->tm_context;
- TRANSLATE(tm_context, pd, dpy, (KeyCode)eventSeq->event.eventCode,
- (unsigned)0, modifiers_return, keysym_return);
-
- if ((keysym_return & typeMatch->eventCodeMask) == typeMatch->eventCode ) {
- tm_context->event = eventSeq->xev;
- tm_context->serial = eventSeq->xev->xany.serial;
- tm_context->keysym = keysym_return;
- tm_context->modifiers = (Modifiers)0;
- return TRUE;
- }
- useful_mods = ~computedMask & modifiers_return;
- if (useful_mods == 0) return FALSE;
-
- switch (num_modbits = num_bits(useful_mods)) {
- case 1:
- case 8:
- /*
- * one modbit should never happen, in fact the implementation
- * of XtTranslateKey and XmTranslateKey guarantee that it
- * won't, so don't care if the loop is set up for the case
- * when one modbit is set.
- * The performance implications of all eight modbits being
- * set is horrendous. This isn't a problem with Xt/Xaw based
- * applications. We can only hope that Motif's virtual
- * modifiers won't result in all eight modbits being set.
- */
- for (i = useful_mods; i > 0; i--) {
- TRANSLATE(tm_context, pd, dpy, eventSeq->event.eventCode,
- (Modifiers)i, modifiers_return, keysym_return);
- if (keysym_return ==
- (typeMatch->eventCode & typeMatch->eventCodeMask)) {
- tm_context->event = eventSeq->xev;
- tm_context->serial = eventSeq->xev->xany.serial;
- tm_context->keysym = keysym_return;
- tm_context->modifiers = (Modifiers)i;
- return TRUE;
- }
- }
- break;
- default: /* (2..7) */
- {
- /*
- * Only translate using combinations of the useful modifiers.
- * to minimize the chance of invalidating the cache.
- */
- static char pows[] = { 0, 1, 3, 7, 15, 31, 63, 127 };
- Modifiers tmod, mod_masks[8];
- int j;
- for (tmod = 1, i = 0; tmod <= (Mod5Mask<<1); tmod <<= 1)
- if (tmod & useful_mods) mod_masks[i++] = tmod;
- for (j = (int) pows[num_modbits]; j > 0; j--) {
- tmod = 0;
- for (i = 0; i < num_modbits; i++)
- if (j & (1<<i)) tmod |= mod_masks[i];
- TRANSLATE(tm_context, pd, dpy, eventSeq->event.eventCode,
- tmod, modifiers_return, keysym_return);
- if (keysym_return ==
- (typeMatch->eventCode & typeMatch->eventCodeMask)) {
- tm_context->event = eventSeq->xev;
- tm_context->serial = eventSeq->xev->xany.serial;
- tm_context->keysym = keysym_return;
- tm_context->modifiers = (Modifiers)i;
- return TRUE;
- }
- }
- }
- break;
- } /* switch (num_modbits) */
- }
- return FALSE;
-}
-
-void XtConvertCase(dpy,keysym,lower_return,upper_return)
- Display *dpy;
- KeySym keysym;
- KeySym *lower_return, *upper_return;
-{
- XtPerDisplay pd;
- CaseConverterPtr ptr;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
-
- *lower_return = *upper_return = keysym;
- for (ptr=pd->case_cvt; ptr; ptr = ptr->next)
- if (ptr->start <= keysym && keysym <= ptr->stop) {
- (*ptr->proc)(dpy, keysym, lower_return, upper_return);
- return;
- }
- XConvertCase(keysym, lower_return, upper_return);
- UNLOCK_APP(app);
-}
-
-Boolean _XtMatchUsingStandardMods (typeMatch, modMatch, eventSeq)
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- TMEventPtr eventSeq;
-{
- Modifiers modifiers_return;
- KeySym keysym_return;
- Modifiers computed= 0;
- Modifiers computedMask = 0;
- Boolean resolved = TRUE;
- Display *dpy = eventSeq->xev->xany.display;
- XtPerDisplay pd = _XtGetPerDisplay(dpy);
- TMKeyContext tm_context = pd->tm_context;
- Modifiers translateModifiers;
-
- /* To maximize cache utilization, we mask off nonstandard modifiers
- before cache lookup. For a given key translator, standard modifiers
- are constant per KeyCode. If a key translator uses no standard
- modifiers this implementation will never reference the cache.
- */
-
- modifiers_return = MOD_RETURN(tm_context, eventSeq->event.eventCode);
- if (!modifiers_return) {
- XtTranslateKeycode(dpy, (KeyCode)eventSeq->event.eventCode,
- eventSeq->event.modifiers, &modifiers_return,
- &keysym_return);
- translateModifiers = eventSeq->event.modifiers & modifiers_return;
- UPDATE_CACHE(tm_context, pd, eventSeq->event.eventCode,
- translateModifiers, modifiers_return, keysym_return);
- } else {
- translateModifiers = eventSeq->event.modifiers & modifiers_return;
- TRANSLATE(tm_context, pd, dpy, (KeyCode)eventSeq->event.eventCode,
- translateModifiers, modifiers_return, keysym_return);
- }
-
- if ((typeMatch->eventCode & typeMatch->eventCodeMask) ==
- (keysym_return & typeMatch->eventCodeMask)) {
- if (modMatch->lateModifiers != NULL)
- resolved = _XtComputeLateBindings(dpy, modMatch->lateModifiers,
- &computed, &computedMask);
- if (!resolved) return FALSE;
- computed |= modMatch->modifiers;
- computedMask |= modMatch->modifierMask;
-
- if ((computed & computedMask) ==
- (eventSeq->event.modifiers & ~modifiers_return & computedMask)) {
- tm_context->event = eventSeq->xev;
- tm_context->serial = eventSeq->xev->xany.serial;
- tm_context->keysym = keysym_return;
- tm_context->modifiers = translateModifiers;
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-void _XtBuildKeysymTables(dpy,pd)
- Display *dpy;
- register XtPerDisplay pd;
-{
- ModToKeysymTable *table;
- int maxCount,i,j,k,tempCount,idx;
- KeySym keysym,tempKeysym;
- XModifierKeymap* modKeymap;
- KeyCode keycode;
-#define KeysymTableSize 16
-
- FLUSHKEYCACHE(pd->tm_context);
- if (pd->keysyms)
- XFree( (char *)pd->keysyms );
- pd->keysyms_serial = NextRequest(dpy);
- pd->keysyms = XGetKeyboardMapping(dpy, pd->min_keycode,
- pd->max_keycode-pd->min_keycode+1,
- &pd->keysyms_per_keycode);
- if (pd->modKeysyms)
- XtFree((char *)pd->modKeysyms);
- if (pd->modsToKeysyms)
- XtFree((char *)pd->modsToKeysyms);
- pd->modKeysyms = (KeySym*)__XtMalloc((Cardinal)KeysymTableSize*sizeof(KeySym));
- maxCount = KeysymTableSize;
- tempCount = 0;
-
- table = (ModToKeysymTable*)__XtMalloc((Cardinal)8*sizeof(ModToKeysymTable));
- pd->modsToKeysyms = table;
-
- table[0].mask = ShiftMask;
- table[1].mask = LockMask;
- table[2].mask = ControlMask;
- table[3].mask = Mod1Mask;
- table[4].mask = Mod2Mask;
- table[5].mask = Mod3Mask;
- table[6].mask = Mod4Mask;
- table[7].mask = Mod5Mask;
- tempKeysym = 0;
-
- modKeymap = XGetModifierMapping(dpy);
- for (i=0;i<32;i++)
- pd->isModifier[i] = 0;
- pd->mode_switch = 0;
- pd->num_lock = 0;
- for (i=0;i<8;i++) {
- table[i].idx = tempCount;
- table[i].count = 0;
- for (j=0;j<modKeymap->max_keypermod;j++) {
- keycode = modKeymap->modifiermap[i*modKeymap->max_keypermod+j];
- if (keycode != 0) {
- pd->isModifier[keycode>>3] |= 1 << (keycode & 7);
- for (k=0; k<pd->keysyms_per_keycode;k++) {
- idx = ((keycode-pd->min_keycode)*
- pd->keysyms_per_keycode)+k;
- keysym = pd->keysyms[idx];
- if ((keysym == XK_Mode_switch) && (i > 2))
- pd->mode_switch |= 1 << i;
- if ((keysym == XK_Num_Lock) && (i > 2))
- pd->num_lock |= 1 << i;
- if (keysym != 0 && keysym != tempKeysym ){
- if (tempCount==maxCount) {
- maxCount += KeysymTableSize;
- pd->modKeysyms = (KeySym*)XtRealloc(
- (char*)pd->modKeysyms,
- (unsigned) (maxCount*sizeof(KeySym)) );
- }
- pd->modKeysyms[tempCount++] = keysym;
- table[i].count++;
- tempKeysym = keysym;
- }
- }
- }
- }
- }
- pd->lock_meaning = NoSymbol;
- for (i = 0; i < table[1].count; i++) {
- keysym = pd->modKeysyms[table[1].idx + i];
- if (keysym == XK_Caps_Lock) {
- pd->lock_meaning = XK_Caps_Lock;
- break;
- } else if (keysym == XK_Shift_Lock) {
- pd->lock_meaning = XK_Shift_Lock;
- }
- }
- XFreeModifiermap(modKeymap);
-}
-
-#if NeedFunctionPrototypes
-void XtTranslateKeycode (
- Display *dpy,
- _XtKeyCode keycode,
- Modifiers modifiers,
- Modifiers *modifiers_return,
- KeySym *keysym_return
- )
-#else
-void XtTranslateKeycode (dpy, keycode, modifiers,
- modifiers_return, keysym_return)
-
- Display *dpy;
- KeyCode keycode;
- Modifiers modifiers;
- Modifiers *modifiers_return;
- KeySym *keysym_return;
-#endif
-{
- XtPerDisplay pd;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
- _InitializeKeysymTables(dpy, pd);
- (*pd->defaultKeycodeTranslator)(
- dpy,keycode,modifiers,modifiers_return,keysym_return);
- UNLOCK_APP(app);
-}
-
-/* This code should match XTranslateKey (internal, sigh) in Xlib */
-#if NeedFunctionPrototypes
-void XtTranslateKey(
- register Display *dpy,
- _XtKeyCode keycode,
- Modifiers modifiers,
- Modifiers *modifiers_return,
- KeySym *keysym_return
- )
-#else
-void XtTranslateKey(dpy, keycode, modifiers,
- modifiers_return, keysym_return)
- register Display *dpy;
- KeyCode keycode;
- Modifiers modifiers;
- Modifiers *modifiers_return;
- KeySym *keysym_return;
-#endif
-#ifndef XKB
-{
- XtPerDisplay pd;
- int per;
- register KeySym *syms;
- KeySym sym, lsym, usym;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
- *modifiers_return = (ShiftMask|LockMask) | pd->mode_switch | pd->num_lock;
- if (((int)keycode < pd->min_keycode) || ((int)keycode > pd->max_keycode)) {
- *keysym_return = NoSymbol;
- UNLOCK_APP(app);
- return;
- }
- per = pd->keysyms_per_keycode;
- syms = &pd->keysyms[(keycode - pd->min_keycode) * per];
- while ((per > 2) && (syms[per - 1] == NoSymbol))
- per--;
- if ((per > 2) && (modifiers & pd->mode_switch)) {
- syms += 2;
- per -= 2;
- }
- if ((modifiers & pd->num_lock) &&
- (per > 1 && (IsKeypadKey(syms[1]) || IsPrivateKeypadKey(syms[1])))) {
- if ((modifiers & ShiftMask) ||
- ((modifiers & LockMask) && (pd->lock_meaning == XK_Shift_Lock)))
- *keysym_return = syms[0];
- else
- *keysym_return = syms[1];
- } else if (!(modifiers & ShiftMask) &&
- (!(modifiers & LockMask) || (pd->lock_meaning == NoSymbol))) {
- if ((per == 1) || (syms[1] == NoSymbol))
- XtConvertCase(dpy, syms[0], keysym_return, &usym);
- else
- *keysym_return = syms[0];
- } else if (!(modifiers & LockMask) ||
- (pd->lock_meaning != XK_Caps_Lock)) {
- if ((per == 1) || ((usym = syms[1]) == NoSymbol))
- XtConvertCase(dpy, syms[0], &lsym, &usym);
- *keysym_return = usym;
- } else {
- if ((per == 1) || ((sym = syms[1]) == NoSymbol))
- sym = syms[0];
- XtConvertCase(dpy, sym, &lsym, &usym);
- if (!(modifiers & ShiftMask) && (sym != syms[0]) &&
- ((sym != usym) || (lsym == usym)))
- XtConvertCase(dpy, syms[0], &lsym, &usym);
- *keysym_return = usym;
- }
-
- if (*keysym_return == XK_VoidSymbol)
- *keysym_return = NoSymbol;
- UNLOCK_APP(app);
-}
-#else
-{
- XkbLookupKeySym(dpy, keycode, modifiers, modifiers_return,
- keysym_return);
- return;
-}
-#endif
-
-void XtSetKeyTranslator(dpy, translator)
-
- Display *dpy;
- XtKeyProc translator;
-
-{
- XtPerDisplay pd;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
-
- pd->defaultKeycodeTranslator = translator;
- FLUSHKEYCACHE(pd->tm_context);
- /* XXX should now redo grabs */
- UNLOCK_APP(app);
-}
-
-void XtRegisterCaseConverter(dpy, proc, start, stop)
- Display *dpy;
- XtCaseProc proc;
- KeySym start;
- KeySym stop;
-{
- XtPerDisplay pd;
- CaseConverterPtr ptr, prev;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
-
- ptr = (CaseConverterPtr) __XtMalloc(sizeof(CaseConverterRec));
- ptr->start = start;
- ptr->stop = stop;
- ptr->proc = proc;
- ptr->next = pd->case_cvt;
- pd->case_cvt = ptr;
-
- /* Remove obsolete case converters from the list */
- prev = ptr;
- for (ptr=ptr->next; ptr; ptr=prev->next) {
- if (start <= ptr->start && stop >= ptr->stop) {
- prev->next = ptr->next;
- XtFree((char *)ptr);
- }
- else prev = ptr;
- }
- FLUSHKEYCACHE(pd->tm_context);
- /* XXX should now redo grabs */
- UNLOCK_APP(app);
-}
-
-KeySym *XtGetKeysymTable(dpy, min_keycode_return, keysyms_per_keycode_return)
- Display *dpy;
- KeyCode *min_keycode_return;
- int *keysyms_per_keycode_return;
-{
- XtPerDisplay pd;
- KeySym* retval;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
- _InitializeKeysymTables(dpy, pd);
- *min_keycode_return = pd->min_keycode; /* %%% */
- *keysyms_per_keycode_return = pd->keysyms_per_keycode;
- retval = pd->keysyms;
- UNLOCK_APP(app);
- return retval;
-}
-
-void XtKeysymToKeycodeList(dpy, keysym, keycodes_return, keycount_return)
- Display *dpy;
- KeySym keysym;
- KeyCode **keycodes_return;
- Cardinal *keycount_return;
-{
- XtPerDisplay pd;
- unsigned keycode;
- int per, match;
- register KeySym *syms;
- register int i, j;
- KeySym lsym, usym;
- unsigned maxcodes = 0;
- unsigned ncodes = 0;
- KeyCode *keycodes, *codeP;
- DPY_TO_APPCON(dpy);
-
- LOCK_APP(app);
- pd = _XtGetPerDisplay(dpy);
- _InitializeKeysymTables(dpy, pd);
- keycodes = NULL;
- per = pd->keysyms_per_keycode;
- for (syms = pd->keysyms, keycode = (unsigned) pd->min_keycode;
- (int)keycode <= pd->max_keycode;
- syms += per, keycode++) {
- match = 0;
- for (j = 0; j < per; j++) {
- if (syms[j] == keysym) {
- match = 1;
- break;
- }
- }
- if (!match)
- for (i = 1; i < 5; i += 2) {
- if ((per == i) || ((per > i) && (syms[i] == NoSymbol))) {
- XtConvertCase(dpy, syms[i-1], &lsym, &usym);
- if ((lsym == keysym) || (usym == keysym)) {
- match = 1;
- break;
- }
- }
- }
- if (match) {
- if (ncodes == maxcodes) {
- KeyCode *old = keycodes;
- maxcodes += KEYCODE_ARRAY_SIZE;
- keycodes = (KeyCode*)__XtMalloc(maxcodes*sizeof(KeyCode));
- if (ncodes) {
- (void) memmove((char *)keycodes, (char *)old,
- ncodes*sizeof(KeyCode) );
- XtFree((char *)old);
- }
- codeP = &keycodes[ncodes];
- }
- *codeP++ = (KeyCode) keycode;
- ncodes++;
- }
- }
- *keycodes_return = keycodes;
- *keycount_return = ncodes;
- UNLOCK_APP(app);
-}
-
-
diff --git a/xc/lib/Xt/TMparse.c b/xc/lib/Xt/TMparse.c
deleted file mode 100644
index bc30803e4..000000000
--- a/xc/lib/Xt/TMparse.c
+++ /dev/null
@@ -1,2140 +0,0 @@
-/* $TOG: TMparse.c /main/123 1998/05/12 11:19:31 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/TMparse.c,v 3.4 1998/10/03 09:07:00 dawes Exp $ */
-
-/*
-
-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 "IntrinsicI.h"
-#include "StringDefs.h"
-#include <ctype.h>
-#ifndef NOTASCII
-#define XK_LATIN1
-#endif
-#define XK_MISCELLANY
-#include <X11/keysymdef.h>
-
-#ifdef CACHE_TRANSLATIONS
-# ifdef REFCNT_TRANSLATIONS
-# define CACHED XtCacheAll | XtCacheRefCount
-# else
-# define CACHED XtCacheAll
-# endif
-#else
-# define CACHED XtCacheNone
-#endif
-
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
-static String XtNtranslationParseError = "translationParseError";
-
-typedef int EventType;
-
-typedef String (*ParseProc)(); /* str, closure, event ,error */
- /* String str; */
- /* Opaque closure; */
- /* EventPtr event; */
- /* Boolean* error */
-
-typedef void (*ModifierProc)();
-typedef TMShortCard Value;
-
-typedef struct _ModifierRec {
- char* name;
- XrmQuark signature;
- ModifierProc modifierParseProc;
- Value value;
-} ModifierRec, *ModifierKeys;
-
-typedef struct _EventKey {
- char *event;
- XrmQuark signature;
- EventType eventType;
- ParseProc parseDetail;
- Opaque closure;
-}EventKey, *EventKeys;
-
-typedef struct {
- char *name;
- XrmQuark signature;
- Value value;
-} NameValueRec, *NameValueTable;
-
-static void ParseModImmed();
-static void ParseModSym();
-static String PanicModeRecovery();
-static String CheckForPoundSign();
-static KeySym StringToKeySym();
-static ModifierRec modifiers[] = {
- {"Shift", 0, ParseModImmed,ShiftMask},
- {"Lock", 0, ParseModImmed,LockMask},
- {"Ctrl", 0, ParseModImmed,ControlMask},
- {"Mod1", 0, ParseModImmed,Mod1Mask},
- {"Mod2", 0, ParseModImmed,Mod2Mask},
- {"Mod3", 0, ParseModImmed,Mod3Mask},
- {"Mod4", 0, ParseModImmed,Mod4Mask},
- {"Mod5", 0, ParseModImmed,Mod5Mask},
- {"Meta", 0, ParseModSym, XK_Meta_L},
- {"m", 0, ParseModSym, XK_Meta_L},
- {"h", 0, ParseModSym, XK_Hyper_L},
- {"su", 0, ParseModSym, XK_Super_L},
- {"a", 0, ParseModSym, XK_Alt_L},
- {"Hyper", 0, ParseModSym, XK_Hyper_L},
- {"Super", 0, ParseModSym, XK_Super_L},
- {"Alt", 0, ParseModSym, XK_Alt_L},
- {"Button1", 0, ParseModImmed,Button1Mask},
- {"Button2", 0, ParseModImmed,Button2Mask},
- {"Button3", 0, ParseModImmed,Button3Mask},
- {"Button4", 0, ParseModImmed,Button4Mask},
- {"Button5", 0, ParseModImmed,Button5Mask},
- {"c", 0, ParseModImmed,ControlMask},
- {"s", 0, ParseModImmed,ShiftMask},
- {"l", 0, ParseModImmed,LockMask},
-};
-
-static NameValueRec buttonNames[] = {
- {"Button1", 0, Button1},
- {"Button2", 0, Button2},
- {"Button3", 0, Button3},
- {"Button4", 0, Button4},
- {"Button5", 0, Button5},
- {NULL, NULLQUARK, 0},
-};
-
-static NameValueRec motionDetails[] = {
- {"Normal", 0, NotifyNormal},
- {"Hint", 0, NotifyHint},
- {NULL, NULLQUARK, 0},
-};
-
-static NameValueRec notifyModes[] = {
- {"Normal", 0, NotifyNormal},
- {"Grab", 0, NotifyGrab},
- {"Ungrab", 0, NotifyUngrab},
- {"WhileGrabbed", 0, NotifyWhileGrabbed},
- {NULL, NULLQUARK, 0},
-};
-
-#if 0
-static NameValueRec notifyDetail[] = {
- {"Ancestor", 0, NotifyAncestor},
- {"Virtual", 0, NotifyVirtual},
- {"Inferior", 0, NotifyInferior},
- {"Nonlinear", 0, NotifyNonlinear},
- {"NonlinearVirtual", 0, NotifyNonlinearVirtual},
- {"Pointer", 0, NotifyPointer},
- {"PointerRoot", 0, NotifyPointerRoot},
- {"DetailNone", 0, NotifyDetailNone},
- {NULL, NULLQUARK, 0},
-};
-
-static NameValueRec visibilityNotify[] = {
- {"Unobscured", 0, VisibilityUnobscured},
- {"PartiallyObscured", 0, VisibilityPartiallyObscured},
- {"FullyObscured", 0, VisibilityFullyObscured},
- {NULL, NULLQUARK, 0},
-};
-
-static NameValueRec circulation[] = {
- {"OnTop", 0, PlaceOnTop},
- {"OnBottom", 0, PlaceOnBottom},
- {NULL, NULLQUARK, 0},
-};
-
-static NameValueRec propertyChanged[] = {
- {"NewValue", 0, PropertyNewValue},
- {"Delete", 0, PropertyDelete},
- {NULL, NULLQUARK, 0},
-};
-#endif /*0*/
-
-static NameValueRec mappingNotify[] = {
- {"Modifier", 0, MappingModifier},
- {"Keyboard", 0, MappingKeyboard},
- {"Pointer", 0, MappingPointer},
- {NULL, NULLQUARK, 0},
-};
-
-static String ParseKeySym();
-static String ParseKeyAndModifiers();
-static String ParseTable();
-static String ParseImmed();
-static String ParseAddModifier();
-static String ParseNone();
-static String ParseAtom();
-
-static EventKey events[] = {
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-{"KeyPress", NULLQUARK, KeyPress, ParseKeySym, NULL},
-{"Key", NULLQUARK, KeyPress, ParseKeySym, NULL},
-{"KeyDown", NULLQUARK, KeyPress, ParseKeySym, NULL},
-{"Ctrl", NULLQUARK, KeyPress, ParseKeyAndModifiers,(Opaque)ControlMask},
-{"Shift", NULLQUARK, KeyPress, ParseKeyAndModifiers,(Opaque)ShiftMask},
-{"Meta", NULLQUARK, KeyPress, ParseKeyAndModifiers,(Opaque)NULL},
-{"KeyUp", NULLQUARK, KeyRelease, ParseKeySym, NULL},
-{"KeyRelease", NULLQUARK, KeyRelease, ParseKeySym, NULL},
-
-{"ButtonPress", NULLQUARK, ButtonPress, ParseTable,(Opaque)buttonNames},
-{"BtnDown", NULLQUARK, ButtonPress, ParseTable,(Opaque)buttonNames},
-{"Btn1Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button1},
-{"Btn2Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button2},
-{"Btn3Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button3},
-{"Btn4Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button4},
-{"Btn5Down", NULLQUARK, ButtonPress, ParseImmed,(Opaque)Button5},
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-{"ButtonRelease", NULLQUARK, ButtonRelease, ParseTable,(Opaque)buttonNames},
-{"BtnUp", NULLQUARK, ButtonRelease, ParseTable,(Opaque)buttonNames},
-{"Btn1Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button1},
-{"Btn2Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button2},
-{"Btn3Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button3},
-{"Btn4Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button4},
-{"Btn5Up", NULLQUARK, ButtonRelease, ParseImmed,(Opaque)Button5},
-
-{"MotionNotify", NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
-{"PtrMoved", NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
-{"Motion", NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
-{"MouseMoved", NULLQUARK, MotionNotify, ParseTable, (Opaque)motionDetails},
-{"BtnMotion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)AnyButtonMask},
-{"Btn1Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button1Mask},
-{"Btn2Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button2Mask},
-{"Btn3Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button3Mask},
-{"Btn4Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button4Mask},
-{"Btn5Motion", NULLQUARK, MotionNotify, ParseAddModifier, (Opaque)Button5Mask},
-
-{"EnterNotify", NULLQUARK, EnterNotify, ParseTable,(Opaque)notifyModes},
-{"Enter", NULLQUARK, EnterNotify, ParseTable,(Opaque)notifyModes},
-{"EnterWindow", NULLQUARK, EnterNotify, ParseTable,(Opaque)notifyModes},
-
-{"LeaveNotify", NULLQUARK, LeaveNotify, ParseTable,(Opaque)notifyModes},
-{"LeaveWindow", NULLQUARK, LeaveNotify, ParseTable,(Opaque)notifyModes},
-{"Leave", NULLQUARK, LeaveNotify, ParseTable,(Opaque)notifyModes},
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-{"FocusIn", NULLQUARK, FocusIn, ParseTable,(Opaque)notifyModes},
-
-{"FocusOut", NULLQUARK, FocusOut, ParseTable,(Opaque)notifyModes},
-
-{"KeymapNotify", NULLQUARK, KeymapNotify, ParseNone, NULL},
-{"Keymap", NULLQUARK, KeymapNotify, ParseNone, NULL},
-
-{"Expose", NULLQUARK, Expose, ParseNone, NULL},
-
-{"GraphicsExpose", NULLQUARK, GraphicsExpose, ParseNone, NULL},
-{"GrExp", NULLQUARK, GraphicsExpose, ParseNone, NULL},
-
-{"NoExpose", NULLQUARK, NoExpose, ParseNone, NULL},
-{"NoExp", NULLQUARK, NoExpose, ParseNone, NULL},
-
-{"VisibilityNotify",NULLQUARK, VisibilityNotify,ParseNone, NULL},
-{"Visible", NULLQUARK, VisibilityNotify,ParseNone, NULL},
-
-{"CreateNotify", NULLQUARK, CreateNotify, ParseNone, NULL},
-{"Create", NULLQUARK, CreateNotify, ParseNone, NULL},
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-{"DestroyNotify", NULLQUARK, DestroyNotify, ParseNone, NULL},
-{"Destroy", NULLQUARK, DestroyNotify, ParseNone, NULL},
-
-{"UnmapNotify", NULLQUARK, UnmapNotify, ParseNone, NULL},
-{"Unmap", NULLQUARK, UnmapNotify, ParseNone, NULL},
-
-{"MapNotify", NULLQUARK, MapNotify, ParseNone, NULL},
-{"Map", NULLQUARK, MapNotify, ParseNone, NULL},
-
-{"MapRequest", NULLQUARK, MapRequest, ParseNone, NULL},
-{"MapReq", NULLQUARK, MapRequest, ParseNone, NULL},
-
-{"ReparentNotify", NULLQUARK, ReparentNotify, ParseNone, NULL},
-{"Reparent", NULLQUARK, ReparentNotify, ParseNone, NULL},
-
-{"ConfigureNotify", NULLQUARK, ConfigureNotify, ParseNone, NULL},
-{"Configure", NULLQUARK, ConfigureNotify, ParseNone, NULL},
-
-{"ConfigureRequest",NULLQUARK, ConfigureRequest,ParseNone, NULL},
-{"ConfigureReq", NULLQUARK, ConfigureRequest,ParseNone, NULL},
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-{"GravityNotify", NULLQUARK, GravityNotify, ParseNone, NULL},
-{"Grav", NULLQUARK, GravityNotify, ParseNone, NULL},
-
-{"ResizeRequest", NULLQUARK, ResizeRequest, ParseNone, NULL},
-{"ResReq", NULLQUARK, ResizeRequest, ParseNone, NULL},
-
-{"CirculateNotify", NULLQUARK, CirculateNotify, ParseNone, NULL},
-{"Circ", NULLQUARK, CirculateNotify, ParseNone, NULL},
-
-{"CirculateRequest",NULLQUARK, CirculateRequest,ParseNone, NULL},
-{"CircReq", NULLQUARK, CirculateRequest,ParseNone, NULL},
-
-{"PropertyNotify", NULLQUARK, PropertyNotify, ParseAtom, NULL},
-{"Prop", NULLQUARK, PropertyNotify, ParseAtom, NULL},
-
-{"SelectionClear", NULLQUARK, SelectionClear, ParseAtom, NULL},
-{"SelClr", NULLQUARK, SelectionClear, ParseAtom, NULL},
-
-{"SelectionRequest",NULLQUARK, SelectionRequest,ParseAtom, NULL},
-{"SelReq", NULLQUARK, SelectionRequest,ParseAtom, NULL},
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-{"SelectionNotify", NULLQUARK, SelectionNotify, ParseAtom, NULL},
-{"Select", NULLQUARK, SelectionNotify, ParseAtom, NULL},
-
-{"ColormapNotify", NULLQUARK, ColormapNotify, ParseNone, NULL},
-{"Clrmap", NULLQUARK, ColormapNotify, ParseNone, NULL},
-
-{"ClientMessage", NULLQUARK, ClientMessage, ParseAtom, NULL},
-{"Message", NULLQUARK, ClientMessage, ParseAtom, NULL},
-
-{"MappingNotify", NULLQUARK, MappingNotify, ParseTable, (Opaque)mappingNotify},
-{"Mapping", NULLQUARK, MappingNotify, ParseTable, (Opaque)mappingNotify},
-
-#ifdef DEBUG
-# ifdef notdef
-{"Timer", NULLQUARK, _XtTimerEventType,ParseNone, NULL},
-# endif /* notdef */
-{"EventTimer", NULLQUARK, _XtEventTimerEventType,ParseNone,NULL},
-#endif /* DEBUG */
-
-/* Event Name, Quark, Event Type, Detail Parser, Closure */
-
-};
-
-#ifndef __EMX__
-#define IsNewline(str) ((str) == '\n')
-#else
-#define IsNewline(str) ((str) == '\n' || (str) == '\r')
-#endif
-
-#define ScanFor(str, ch) \
- while ((*(str) != (ch)) && (*(str) != '\0') && !IsNewline(*(str))) (str)++
-
-#define ScanNumeric(str) while ('0' <= *(str) && *(str) <= '9') (str)++
-
-#define ScanAlphanumeric(str) \
- while (('A' <= *(str) && *(str) <= 'Z') || \
- ('a' <= *(str) && *(str) <= 'z') || \
- ('0' <= *(str) && *(str) <= '9')) (str)++
-
-#ifndef __EMX__
-#define ScanWhitespace(str) \
- while (*(str) == ' ' || *(str) == '\t') (str)++
-#else
-#define ScanWhitespace(str) \
- while (*(str) == ' ' || *(str) == '\t' || *(str) == '\r') (str)++
-#endif
-
-static Boolean initialized = FALSE;
-static XrmQuark QMeta;
-static XrmQuark QCtrl;
-static XrmQuark QNone;
-static XrmQuark QAny;
-
-static void FreeEventSeq(eventSeq)
- EventSeqPtr eventSeq;
-{
- register EventSeqPtr evs = eventSeq;
-
- while (evs != NULL) {
- evs->state = (StatePtr) evs;
- if (evs->next != NULL
- && evs->next->state == (StatePtr) evs->next)
- evs->next = NULL;
- evs = evs->next;
- }
-
- evs = eventSeq;
- while (evs != NULL) {
- register EventPtr event = evs;
- evs = evs->next;
- if (evs == event) evs = NULL;
- XtFree((char *)event);
- }
-}
-
-static void CompileNameValueTable(table)
- NameValueTable table;
-{
- register int i;
-
- for (i=0; table[i].name; i++)
- table[i].signature = XrmPermStringToQuark(table[i].name);
-}
-
-static int OrderEvents(a, b)
- EventKey *a, *b;
-{
- return ((a->signature < b->signature) ? -1 : 1);
-}
-
-static void Compile_XtEventTable(table, count)
- EventKeys table;
- Cardinal count;
-{
- register int i;
- register EventKeys entry = table;
-
- for (i=count; --i >= 0; entry++)
- entry->signature = XrmPermStringToQuark(entry->event);
- qsort(table, count, sizeof(EventKey), OrderEvents);
-}
-
-static int OrderModifiers(a, b)
- ModifierRec *a, *b;
-{
- return ((a->signature < b->signature) ? -1 : 1);
-}
-
-static void Compile_XtModifierTable(table, count)
- ModifierKeys table;
- Cardinal count;
-{
- register int i;
- register ModifierKeys entry = table;
-
- for (i=count; --i >= 0; entry++)
- entry->signature = XrmPermStringToQuark(entry->name);
- qsort(table, count, sizeof(ModifierRec), OrderModifiers);
-}
-
-static String PanicModeRecovery(str)
- String str;
-{
- ScanFor(str,'\n');
- if (*str == '\n') str++;
- return str;
-
-}
-
-
-static void Syntax(str0,str1)
- String str0,str1;
-{
- Cardinal numChars;
- Cardinal num_params = 2;
- String params[2];
-
- params[0] = str0;
- params[1] = str1;
- XtWarningMsg(XtNtranslationParseError,"parseError",XtCXtToolkitError,
- "translation table syntax error: %s %s",params,&num_params);
-}
-
-
-
-static Cardinal LookupTMEventType(eventStr,error)
- String eventStr;
- Boolean *error;
-{
- register int i, left, right;
- register XrmQuark signature;
- static int previous = 0;
-
- LOCK_PROCESS;
- if ((signature = StringToQuark(eventStr)) == events[previous].signature) {
- UNLOCK_PROCESS;
- return (Cardinal) previous;
- }
-
- left = 0;
- right = XtNumber(events) - 1;
- while (left <= right) {
- i = (left + right) >> 1;
- if (signature < events[i].signature)
- right = i - 1;
- else if (signature > events[i].signature)
- left = i + 1;
- else {
- previous = i;
- UNLOCK_PROCESS;
- return (Cardinal) i;
- }
- }
-
- Syntax("Unknown event type : ",eventStr);
- *error = TRUE;
- UNLOCK_PROCESS;
- return (Cardinal) i;
-}
-
-static void StoreLateBindings(keysymL,notL,keysymR,notR,lateBindings)
-
- KeySym keysymL;
- Boolean notL;
- KeySym keysymR;
- Boolean notR;
- LateBindingsPtr* lateBindings;
-{
- LateBindingsPtr temp;
- Boolean pair = FALSE;
- unsigned long count,number;
- if (lateBindings != NULL){
- temp = *lateBindings;
- if (temp != NULL) {
- for (count = 0; temp[count].keysym; count++){/*EMPTY*/}
- }
- else count = 0;
- if (! keysymR){
- number = 1;pair = FALSE;
- } else{
- number = 2;pair = TRUE;
- }
-
- temp = (LateBindingsPtr)XtRealloc((char *)temp,
- (unsigned)((count+number+1) * sizeof(LateBindings)) );
- *lateBindings = temp;
- temp[count].knot = notL;
- temp[count].pair = pair;
- if (count == 0)
- temp[count].ref_count = 1;
- temp[count++].keysym = keysymL;
- if (keysymR){
- temp[count].knot = notR;
- temp[count].pair = FALSE;
- temp[count].ref_count = 0;
- temp[count++].keysym = keysymR;
- }
- temp[count].knot = temp[count].pair = FALSE;
- temp[count].ref_count = 0;
- temp[count].keysym = 0;
- }
-}
-
-static void _XtParseKeysymMod(name,lateBindings,notFlag,valueP,error)
- String name;
- LateBindingsPtr* lateBindings;
- Boolean notFlag;
- Value *valueP;
- Boolean *error;
-{
- KeySym keySym;
- keySym = StringToKeySym(name, error);
- *valueP = 0;
- if (keySym != NoSymbol) {
- StoreLateBindings(keySym,notFlag,(KeySym) NULL,FALSE,lateBindings);
- }
-}
-
-static Boolean _XtLookupModifier(signature, lateBindings, notFlag, valueP,
- constMask)
- XrmQuark signature;
- LateBindingsPtr* lateBindings;
- Boolean notFlag;
- Value *valueP;
- Bool constMask;
-{
- register int i, left, right;
- static int previous = 0;
-
- LOCK_PROCESS;
- if (signature == modifiers[previous].signature) {
- if (constMask) *valueP = modifiers[previous].value;
- else /* if (modifiers[previous].modifierParseProc) always true */
- (*modifiers[previous].modifierParseProc)
- (modifiers[previous].value, lateBindings, notFlag, valueP);
- UNLOCK_PROCESS;
- return TRUE;
- }
-
- left = 0;
- right = XtNumber(modifiers) - 1;
- while (left <= right) {
- i = (left + right) >> 1;
- if (signature < modifiers[i].signature)
- right = i - 1;
- else if (signature > modifiers[i].signature)
- left = i + 1;
- else {
- previous = i;
- if (constMask) *valueP = modifiers[i].value;
- else /* if (modifiers[i].modifierParseProc) always true */
- (*modifiers[i].modifierParseProc)
- (modifiers[i].value, lateBindings, notFlag, valueP);
- UNLOCK_PROCESS;
- return TRUE;
- }
- }
- UNLOCK_PROCESS;
- return FALSE;
-}
-
-
-static String ScanIdent(str)
- register String str;
-{
- ScanAlphanumeric(str);
- while (
- ('A' <= *str && *str <= 'Z')
- || ('a' <= *str && *str <= 'z')
- || ('0' <= *str && *str <= '9')
- || (*str == '-')
- || (*str == '_')
- || (*str == '$')
- ) str++;
- return str;
-}
-
-static String FetchModifierToken(str, token_return)
- String str;
- XrmQuark *token_return;
-{
- String start = str;
-
- if (*str == '$') {
- *token_return = QMeta;
- str++;
- return str;
- }
- if (*str == '^') {
- *token_return = QCtrl;
- str++;
- return str;
- }
- str = ScanIdent(str);
- if (start != str) {
- char modStrbuf[100];
- char* modStr;
-
- modStr = XtStackAlloc (str - start + 1, modStrbuf);
- if (modStr == NULL) _XtAllocError (NULL);
- (void) memmove(modStr, start, str-start);
- modStr[str-start] = '\0';
- *token_return = XrmStringToQuark(modStr);
- XtStackFree (modStr, modStrbuf);
- return str;
- }
- return str;
-}
-
-static String ParseModifiers(str, event,error)
- register String str;
- EventPtr event;
- Boolean* error;
-{
- register String start;
- Boolean notFlag, exclusive, keysymAsMod;
- Value maskBit;
- XrmQuark Qmod;
-
- ScanWhitespace(str);
- start = str;
- str = FetchModifierToken(str, &Qmod);
- exclusive = FALSE;
- if (start != str) {
- if (Qmod == QNone) {
- event->event.modifierMask = ~0;
- event->event.modifiers = 0;
- ScanWhitespace(str);
- return str;
- } else if (Qmod == QAny) { /*backward compatability*/
- event->event.modifierMask = 0;
- event->event.modifiers = AnyModifier;
- ScanWhitespace(str);
- return str;
- }
- str = start; /*if plain modifier, reset to beginning */
- }
- else while (*str == '!' || *str == ':') {
- if (*str == '!') {
- exclusive = TRUE;
- str++;
- ScanWhitespace(str);
- }
- if (*str == ':') {
- event->event.standard = TRUE;
- str++;
- ScanWhitespace(str);
- }
- }
-
- while (*str != '<') {
- if (*str == '~') {
- notFlag = TRUE;
- str++;
- } else
- notFlag = FALSE;
- if (*str == '@') {
- keysymAsMod = TRUE;
- str++;
- }
- else keysymAsMod = FALSE;
- start = str;
- str = FetchModifierToken(str, &Qmod);
- if (start == str) {
- Syntax("Modifier or '<' expected","");
- *error = TRUE;
- return PanicModeRecovery(str);
- }
- if (keysymAsMod) {
- _XtParseKeysymMod(XrmQuarkToString(Qmod),
- &event->event.lateModifiers,
- notFlag,&maskBit, error);
- if (*error)
- return PanicModeRecovery(str);
-
- } else
- if (!_XtLookupModifier(Qmod, &event->event.lateModifiers,
- notFlag, &maskBit, FALSE)) {
- Syntax("Unknown modifier name: ", XrmQuarkToString(Qmod));
- *error = TRUE;
- return PanicModeRecovery(str);
- }
- event->event.modifierMask |= maskBit;
- if (notFlag) event->event.modifiers &= ~maskBit;
- else event->event.modifiers |= maskBit;
- ScanWhitespace(str);
- }
- if (exclusive) event->event.modifierMask = ~0;
- return str;
-}
-
-static String ParseXtEventType(str, event, tmEventP,error)
- register String str;
- EventPtr event;
- Cardinal *tmEventP;
- Boolean* error;
-{
- String start = str;
- char eventTypeStrbuf[100];
- char* eventTypeStr;
-
- ScanAlphanumeric(str);
- eventTypeStr = XtStackAlloc (str - start + 1, eventTypeStrbuf);
- if (eventTypeStr == NULL) _XtAllocError (NULL);
- (void) memmove(eventTypeStr, start, str-start);
- eventTypeStr[str-start] = '\0';
- *tmEventP = LookupTMEventType(eventTypeStr,error);
- XtStackFree (eventTypeStr, eventTypeStrbuf);
- if (*error)
- return PanicModeRecovery(str);
- event->event.eventType = events[*tmEventP].eventType;
- return str;
-}
-
-static unsigned long StrToHex(str)
- String str;
-{
- register char c;
- register unsigned long val = 0;
-
- while (c = *str) {
- if ('0' <= c && c <= '9') val = val*16+c-'0';
- else if ('a' <= c && c <= 'z') val = val*16+c-'a'+10;
- else if ('A' <= c && c <= 'Z') val = val*16+c-'A'+10;
- else return 0;
- str++;
- }
-
- return val;
-}
-
-static unsigned long StrToOct(str)
- String str;
-{
- register char c;
- register unsigned long val = 0;
-
- while (c = *str) {
- if ('0' <= c && c <= '7') val = val*8+c-'0'; else return 0;
- str++;
- }
-
- return val;
-}
-
-static unsigned long StrToNum(str)
- String str;
-{
- register char c;
- register unsigned long val = 0;
-
- if (*str == '0') {
- str++;
- if (*str == 'x' || *str == 'X') return StrToHex(++str);
- else return StrToOct(str);
- }
-
- while (c = *str) {
- if ('0' <= c && c <= '9') val = val*10+c-'0';
- else return 0;
- str++;
- }
-
- return val;
-}
-
-static KeySym StringToKeySym(str, error)
- String str;
- Boolean *error;
-{
- KeySym k;
-
- if (str == NULL || *str == '\0') return (KeySym) 0;
-
-#ifndef NOTASCII
- /* special case single character ASCII, for speed */
- if (*(str+1) == '\0') {
- if (' ' <= *str && *str <= '~') return XK_space + (*str - ' ');
- }
-#endif
-
- if ('0' <= *str && *str <= '9') return (KeySym) StrToNum(str);
- k = XStringToKeysym(str);
- if (k != NoSymbol) return k;
-
-#ifdef NOTASCII
- /* fall-back case to preserve backwards compatibility; no-one
- * should be relying upon this!
- */
- if (*(str+1) == '\0') return (KeySym) *str;
-#endif
-
- Syntax("Unknown keysym name: ", str);
- *error = TRUE;
- return NoSymbol;
-}
-/* ARGSUSED */
-static void ParseModImmed(value, lateBindings, notFlag, valueP)
- Value value;
- LateBindingsPtr* lateBindings;
- Boolean notFlag;
- Value* valueP;
-{
- *valueP = value;
-}
-
-static void ParseModSym(value, lateBindings, notFlag, valueP)
- /* is only valid with keysyms that have an _L and _R in their name;
- * and ignores keysym lookup errors (i.e. assumes only valid keysyms)
- */
- Value value;
- LateBindingsPtr* lateBindings;
- Boolean notFlag;
- Value* valueP;
-{
- register KeySym keysymL = (KeySym)value;
- register KeySym keysymR = keysymL + 1; /* valid for supported keysyms */
- StoreLateBindings(keysymL,notFlag,keysymR,notFlag,lateBindings);
- *valueP = 0;
-}
-
-#ifdef sparc
-/*
- * The stupid optimizer in SunOS 4.0.3 and below generates bogus code that
- * causes the value of the most recently used variable to be returned instead
- * of the value passed in.
- */
-static String stupid_optimizer_kludge;
-#define BROKEN_OPTIMIZER_HACK(val) stupid_optimizer_kludge = (val)
-#else
-#define BROKEN_OPTIMIZER_HACK(val) val
-#endif
-
-/* ARGSUSED */
-static String ParseImmed(str, closure, event,error)
- register String str;
- register Opaque closure;
- register EventPtr event;
- Boolean* error;
-{
- event->event.eventCode = (unsigned long)closure;
- event->event.eventCodeMask = (unsigned long)~0L;
-
- return BROKEN_OPTIMIZER_HACK(str);
-}
-
-/* ARGSUSED */
-static String ParseAddModifier(str, closure, event, error)
- register String str;
- register Opaque closure;
- register EventPtr event;
- Boolean* error;
-{
- register unsigned long modval = (unsigned long)closure;
- event->event.modifiers |= modval;
- if (modval != AnyButtonMask) /* AnyButtonMask is don't-care mask */
- event->event.modifierMask |= modval;
-
- return BROKEN_OPTIMIZER_HACK(str);
-}
-
-
-static String ParseKeyAndModifiers(str, closure, event,error)
- String str;
- Opaque closure;
- EventPtr event;
- Boolean* error;
-{
- str = ParseKeySym(str, closure, event,error);
- if ((unsigned long) closure == 0) {
- Value metaMask; /* unused */
- (void) _XtLookupModifier(QMeta, &event->event.lateModifiers, FALSE,
- &metaMask, FALSE);
- } else {
- event->event.modifiers |= (unsigned long) closure;
- event->event.modifierMask |= (unsigned long) closure;
- }
- return str;
-}
-
-/*ARGSUSED*/
-static String ParseKeySym(str, closure, event,error)
- register String str;
- Opaque closure;
- EventPtr event;
- Boolean* error;
-{
- char *start;
- char keySymNamebuf[100];
- char* keySymName;
-
- ScanWhitespace(str);
-
- if (*str == '\\') {
- keySymName = keySymNamebuf;
- str++;
- keySymName[0] = *str;
- if (*str != '\0' && !IsNewline(*str)) str++;
- keySymName[1] = '\0';
- event->event.eventCode = StringToKeySym(keySymName, error);
- event->event.eventCodeMask = ~0L;
- } else if (*str == ',' || *str == ':' ||
- /* allow leftparen to be single char symbol,
- * for backwards compatibility
- */
- (*str == '(' && *(str+1) >= '0' && *(str+1) <= '9')) {
- keySymName = keySymNamebuf; /* just so we can stackfree it later */
- /* no detail */
- event->event.eventCode = 0L;
- event->event.eventCodeMask = 0L;
- } else {
- start = str;
- while (
- *str != ','
- && *str != ':'
- && *str != ' '
- && *str != '\t'
- && !IsNewline(*str)
- && (*str != '(' || *(str+1) <= '0' || *(str+1) >= '9')
- && *str != '\0') str++;
- keySymName = XtStackAlloc (str - start + 1, keySymNamebuf);
- (void) memmove(keySymName, start, str-start);
- keySymName[str-start] = '\0';
- event->event.eventCode = StringToKeySym(keySymName, error);
- event->event.eventCodeMask = ~0L;
- }
- if (*error) {
- /* We never get here when keySymName hasn't been allocated */
- if (keySymName[0] == '<') {
- /* special case for common error */
- XtWarningMsg(XtNtranslationParseError, "missingComma",
- XtCXtToolkitError,
- "... possibly due to missing ',' in event sequence.",
- (String*)NULL, (Cardinal*)NULL);
- }
- XtStackFree (keySymName, keySymNamebuf);
- return PanicModeRecovery(str);
- }
- if (event->event.standard)
- event->event.matchEvent = _XtMatchUsingStandardMods;
- else
- event->event.matchEvent = _XtMatchUsingDontCareMods;
-
- XtStackFree (keySymName, keySymNamebuf);
-
- return str;
-}
-
-static String ParseTable(str, closure, event,error)
- register String str;
- Opaque closure;
- EventPtr event;
- Boolean* error;
-{
- register String start = str;
- register XrmQuark signature;
- NameValueTable table = (NameValueTable) closure;
- char tableSymName[100];
-
- event->event.eventCode = 0L;
- ScanAlphanumeric(str);
- if (str == start) {event->event.eventCodeMask = 0L; return str; }
- if (str-start >= 99) {
- Syntax("Invalid Detail Type (string is too long).", "");
- *error = TRUE;
- return str;
- }
- (void) memmove(tableSymName, start, str-start);
- tableSymName[str-start] = '\0';
- signature = StringToQuark(tableSymName);
- for (; table->signature != NULLQUARK; table++)
- if (table->signature == signature) {
- event->event.eventCode = table->value;
- event->event.eventCodeMask = ~0L;
- return str;
- }
-
- Syntax("Unknown Detail Type: ", tableSymName);
- *error = TRUE;
- return PanicModeRecovery(str);
-}
-
-/*ARGSUSED*/
-static String ParseNone(str, closure, event,error)
- String str;
- Opaque closure;
- EventPtr event;
- Boolean* error;
-{
- event->event.eventCode = 0;
- event->event.eventCodeMask = 0;
-
- return BROKEN_OPTIMIZER_HACK(str);
-}
-
-/*ARGSUSED*/
-static String ParseAtom(str, closure, event,error)
- String str;
- Opaque closure;
- EventPtr event;
- Boolean* error;
-{
- ScanWhitespace(str);
-
- if (*str == ',' || *str == ':') {
- /* no detail */
- event->event.eventCode = 0L;
- event->event.eventCodeMask = 0L;
- } else {
- char *start, atomName[1000];
- start = str;
- while (
- *str != ','
- && *str != ':'
- && *str != ' '
- && *str != '\t'
- && !IsNewline(*str)
- && *str != '\0') str++;
- if (str-start >= 999) {
- Syntax( "Atom name must be less than 1000 characters long.", "" );
- *error = TRUE;
- return str;
- }
- (void) memmove(atomName, start, str-start);
- atomName[str-start] = '\0';
- event->event.eventCode = XrmStringToQuark(atomName);
- event->event.matchEvent = _XtMatchAtom;
- }
- return str;
-}
-
-static ModifierMask buttonModifierMasks[] = {
- 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask
-};
-static String ParseRepeat();
-
-static String ParseEvent(str, event, reps, plus, error)
- register String str;
- EventPtr event;
- int* reps;
- Boolean* plus;
- Boolean* error;
-{
- Cardinal tmEvent;
-
- str = ParseModifiers(str, event,error);
- if (*error) return str;
- if (*str != '<') {
- Syntax("Missing '<' while parsing event type.","");
- *error = TRUE;
- return PanicModeRecovery(str);
- }
- else str++;
- str = ParseXtEventType(str, event, &tmEvent,error);
- if (*error) return str;
- if (*str != '>'){
- Syntax("Missing '>' while parsing event type","");
- *error = TRUE;
- return PanicModeRecovery(str);
- }
- else str++;
- if (*str == '(') {
- str = ParseRepeat(str, reps, plus, error);
- if (*error) return str;
- }
- str = (*(events[tmEvent].parseDetail))(
- str, events[tmEvent].closure, event,error);
- if (*error) return str;
-
-/* gross hack! ||| this kludge is related to the X11 protocol deficiency w.r.t.
- * modifiers in grabs.
- */
- if ((event->event.eventType == ButtonRelease)
- && (event->event.modifiers | event->event.modifierMask) /* any */
- && (event->event.modifiers != AnyModifier))
- {
- event->event.modifiers
- |= buttonModifierMasks[event->event.eventCode];
- /* the button that is going up will always be in the modifiers... */
- }
-
- return str;
-}
-
-static String ParseQuotedStringEvent(str, event,error)
- register String str;
- register EventPtr event;
- Boolean *error;
-{
- Value metaMask;
- char s[2];
-
- if (*str=='^') {
- str++;
- event->event.modifiers = ControlMask;
- } else if (*str == '$') {
- str++;
- (void) _XtLookupModifier(QMeta, &event->event.lateModifiers, FALSE,
- &metaMask, FALSE);
- }
- if (*str == '\\')
- str++;
- s[0] = *str;
- s[1] = '\0';
- if (*str != '\0' && !IsNewline(*str)) str++;
- event->event.eventType = KeyPress;
- event->event.eventCode = StringToKeySym(s, error);
- if (*error) return PanicModeRecovery(str);
- event->event.eventCodeMask = ~0L;
- event->event.matchEvent = _XtMatchUsingStandardMods;
- event->event.standard = TRUE;
-
- return str;
-}
-
-
-static EventSeqRec timerEventRec = {
- {0, 0, NULL, _XtEventTimerEventType, 0L, 0L, NULL},
- /* (StatePtr) -1 */ NULL,
- NULL,
- NULL
-};
-
-static void RepeatDown(eventP, reps, actionsP)
- EventPtr *eventP;
- int reps;
- ActionPtr **actionsP;
-{
- EventRec upEventRec;
- register EventPtr event, downEvent;
- EventPtr upEvent = &upEventRec;
- register int i;
-
- downEvent = event = *eventP;
- *upEvent = *downEvent;
- upEvent->event.eventType = ((event->event.eventType == ButtonPress) ?
- ButtonRelease : KeyRelease);
- if ((upEvent->event.eventType == ButtonRelease)
- && (upEvent->event.modifiers != AnyModifier)
- && (upEvent->event.modifiers | upEvent->event.modifierMask))
- upEvent->event.modifiers
- |= buttonModifierMasks[event->event.eventCode];
-
- if (event->event.lateModifiers)
- event->event.lateModifiers->ref_count += (reps - 1) * 2;
-
- for (i=1; i<reps; i++) {
-
- /* up */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *upEvent;
-
- /* timer */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = timerEventRec;
-
- /* down */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *downEvent;
-
- }
-
- event->next = NULL;
- *eventP = event;
- *actionsP = &event->actions;
-}
-
-static void RepeatDownPlus(eventP, reps, actionsP)
- EventPtr *eventP;
- int reps;
- ActionPtr **actionsP;
-{
- EventRec upEventRec;
- register EventPtr event, downEvent, lastDownEvent;
- EventPtr upEvent = &upEventRec;
- register int i;
-
- downEvent = event = *eventP;
- *upEvent = *downEvent;
- upEvent->event.eventType = ((event->event.eventType == ButtonPress) ?
- ButtonRelease : KeyRelease);
- if ((upEvent->event.eventType == ButtonRelease)
- && (upEvent->event.modifiers != AnyModifier)
- && (upEvent->event.modifiers | upEvent->event.modifierMask))
- upEvent->event.modifiers
- |= buttonModifierMasks[event->event.eventCode];
-
- if (event->event.lateModifiers)
- event->event.lateModifiers->ref_count += reps * 2 - 1;
-
- for (i=0; i<reps; i++) {
-
- if (i > 0) {
- /* down */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *downEvent;
- }
- lastDownEvent = event;
-
- /* up */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *upEvent;
-
- /* timer */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = timerEventRec;
-
- }
-
- event->next = lastDownEvent;
- *eventP = event;
- *actionsP = &lastDownEvent->actions;
-}
-
-static void RepeatUp(eventP, reps, actionsP)
- EventPtr *eventP;
- int reps;
- ActionPtr **actionsP;
-{
- EventRec upEventRec;
- register EventPtr event, downEvent;
- EventPtr upEvent = &upEventRec;
- register int i;
-
- /* the event currently sitting in *eventP is an "up" event */
- /* we want to make it a "down" event followed by an "up" event, */
- /* so that sequence matching on the "state" side works correctly. */
-
- downEvent = event = *eventP;
- *upEvent = *downEvent;
- downEvent->event.eventType = ((event->event.eventType == ButtonRelease) ?
- ButtonPress : KeyPress);
- if ((downEvent->event.eventType == ButtonPress)
- && (downEvent->event.modifiers != AnyModifier)
- && (downEvent->event.modifiers | downEvent->event.modifierMask))
- downEvent->event.modifiers
- &= ~buttonModifierMasks[event->event.eventCode];
-
- if (event->event.lateModifiers)
- event->event.lateModifiers->ref_count += reps * 2 - 1;
-
- /* up */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *upEvent;
-
- for (i=1; i<reps; i++) {
-
- /* timer */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = timerEventRec;
-
- /* down */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *downEvent;
-
- /* up */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *upEvent;
-
- }
-
- event->next = NULL;
- *eventP = event;
- *actionsP = &event->actions;
-}
-
-static void RepeatUpPlus(eventP, reps, actionsP)
- EventPtr *eventP;
- int reps;
- ActionPtr **actionsP;
-{
- EventRec upEventRec;
- register EventPtr event, downEvent, lastUpEvent;
- EventPtr upEvent = &upEventRec;
- register int i;
-
- /* the event currently sitting in *eventP is an "up" event */
- /* we want to make it a "down" event followed by an "up" event, */
- /* so that sequence matching on the "state" side works correctly. */
-
- downEvent = event = *eventP;
- *upEvent = *downEvent;
- downEvent->event.eventType = ((event->event.eventType == ButtonRelease) ?
- ButtonPress : KeyPress);
- if ((downEvent->event.eventType == ButtonPress)
- && (downEvent->event.modifiers != AnyModifier)
- && (downEvent->event.modifiers | downEvent->event.modifierMask))
- downEvent->event.modifiers
- &= ~buttonModifierMasks[event->event.eventCode];
-
- if (event->event.lateModifiers)
- event->event.lateModifiers->ref_count += reps * 2;
-
- for (i=0; i<reps; i++) {
-
- /* up */
- event->next = XtNew(EventSeqRec);
- lastUpEvent = event = event->next;
- *event = *upEvent;
-
- /* timer */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = timerEventRec;
-
- /* down */
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *downEvent;
-
- }
-
- event->next = lastUpEvent;
- *eventP = event;
- *actionsP = &lastUpEvent->actions;
-}
-
-static void RepeatOther(eventP, reps, actionsP)
- EventPtr *eventP;
- int reps;
- ActionPtr **actionsP;
-{
- register EventPtr event, tempEvent;
- register int i;
-
- tempEvent = event = *eventP;
-
- if (event->event.lateModifiers)
- event->event.lateModifiers->ref_count += reps - 1;
-
- for (i=1; i<reps; i++) {
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *tempEvent;
- }
-
- *eventP = event;
- *actionsP = &event->actions;
-}
-
-static void RepeatOtherPlus(eventP, reps, actionsP)
- EventPtr *eventP;
- int reps;
- ActionPtr **actionsP;
-{
- register EventPtr event, tempEvent;
- register int i;
-
- tempEvent = event = *eventP;
-
- if (event->event.lateModifiers)
- event->event.lateModifiers->ref_count += reps - 1;
-
- for (i=1; i<reps; i++) {
- event->next = XtNew(EventSeqRec);
- event = event->next;
- *event = *tempEvent;
- }
-
- event->next = event;
- *eventP = event;
- *actionsP = &event->actions;
-}
-
-static void RepeatEvent(eventP, reps, plus, actionsP)
- EventPtr *eventP;
- int reps;
- Boolean plus;
- ActionPtr **actionsP;
-{
- switch ((*eventP)->event.eventType) {
-
- case ButtonPress:
- case KeyPress:
- if (plus) RepeatDownPlus(eventP, reps, actionsP);
- else RepeatDown(eventP, reps, actionsP);
- break;
-
- case ButtonRelease:
- case KeyRelease:
- if (plus) RepeatUpPlus(eventP, reps, actionsP);
- else RepeatUp(eventP, reps, actionsP);
- break;
-
- default:
- if (plus) RepeatOtherPlus(eventP, reps, actionsP);
- else RepeatOther(eventP, reps, actionsP);
- }
-}
-
-static String ParseRepeat(str, reps, plus, error)
- register String str;
- int *reps;
- Boolean *plus, *error;
-{
-
- /*** Parse the repetitions, for double click etc... ***/
- if (*str != '(' || !(isdigit(str[1]) || str[1] == '+' || str[1] == ')'))
- return str;
- str++;
- if (isdigit(*str)) {
- String start = str;
- char repStr[7];
- int len;
-
- ScanNumeric(str);
- len = (str - start);
- if (len < sizeof repStr) {
- (void) memmove(repStr, start, len);
- repStr[len] = '\0';
- *reps = StrToNum(repStr);
- } else {
- Syntax("Repeat count too large.", "");
- *error = TRUE;
- return str;
- }
- }
- if (*reps == 0) {
- Syntax("Missing repeat count.","");
- *error = True;
- return str;
- }
-
- if (*str == '+') {
- *plus = TRUE;
- str++;
- }
- if (*str == ')')
- str++;
- else {
- Syntax("Missing ')'.","");
- *error = TRUE;
- }
-
- return str;
-}
-
-/***********************************************************************
- * ParseEventSeq
- * Parses the left hand side of a translation table production
- * up to, and consuming the ":".
- * Takes a pointer to a char* (where to start parsing) and returns an
- * event seq (in a passed in variable), having updated the String
- **********************************************************************/
-
-static String ParseEventSeq(str, eventSeqP, actionsP,error)
- register String str;
- EventSeqPtr *eventSeqP;
- ActionPtr **actionsP;
- Boolean *error;
-{
- EventSeqPtr *nextEvent = eventSeqP;
-
- *eventSeqP = NULL;
-
- while ( *str != '\0' && !IsNewline(*str)) {
- static Event nullEvent =
- {0, 0,0L, 0, 0L, 0L,_XtRegularMatch,FALSE};
- EventPtr event;
-
- ScanWhitespace(str);
-
- if (*str == '"') {
- str++;
- while (*str != '"' && *str != '\0' && !IsNewline(*str)) {
- event = XtNew(EventRec);
- event->event = nullEvent;
- event->state = /* (StatePtr) -1 */ NULL;
- event->next = NULL;
- event->actions = NULL;
- str = ParseQuotedStringEvent(str, event,error);
- if (*error) {
- XtWarningMsg(XtNtranslationParseError, "nonLatin1",
- XtCXtToolkitError,
- "... probably due to non-Latin1 character in quoted string",
- (String*)NULL, (Cardinal*)NULL);
- return PanicModeRecovery(str);
- }
- *nextEvent = event;
- *actionsP = &event->actions;
- nextEvent = &event->next;
- }
- if (*str != '"') {
- Syntax("Missing '\"'.","");
- *error = TRUE;
- return PanicModeRecovery(str);
- }
- else str++;
- } else {
- int reps = 0;
- Boolean plus = FALSE;
-
- event = XtNew(EventRec);
- event->event = nullEvent;
- event->state = /* (StatePtr) -1 */ NULL;
- event->next = NULL;
- event->actions = NULL;
-
- str = ParseEvent(str, event, &reps, &plus, error);
- if (*error) return str;
- *nextEvent = event;
- *actionsP = &event->actions;
- if (reps > 1 || plus)
- RepeatEvent(&event, reps, plus, actionsP);
- nextEvent = &event->next;
- }
- ScanWhitespace(str);
- if (*str == ':') break;
- else {
- if (*str != ',') {
- Syntax("',' or ':' expected while parsing event sequence.","");
- *error = TRUE;
- return PanicModeRecovery(str);
- } else str++;
- }
- }
-
- if (*str != ':') {
- Syntax("Missing ':'after event sequence.","");
- *error = TRUE;
- return PanicModeRecovery(str);
- } else str++;
-
- return str;
-}
-
-
-static String ParseActionProc(str, actionProcNameP, error)
- register String str;
- XrmQuark *actionProcNameP;
- Boolean *error;
-{
- register String start = str;
- char procName[200];
-
- str = ScanIdent(str);
- if (str-start >= 199) {
- Syntax("Action procedure name is longer than 199 chars","");
- *error = TRUE;
- return str;
- }
- (void) memmove(procName, start, str-start);
- procName[str-start] = '\0';
- *actionProcNameP = XrmStringToQuark( procName );
- return str;
-}
-
-
-static String ParseString(str, strP)
- register String str;
- String *strP;
-{
- register String start;
-
- if (*str == '"') {
- register unsigned prev_len, len;
- str++;
- start = str;
- *strP = NULL;
- prev_len = 0;
-
- while (*str != '"' && *str != '\0') {
- /* \" produces double quote embedded in a quoted parameter
- * \\" produces backslash as last character of a quoted parameter
- */
- if (*str == '\\' &&
- (*(str+1) == '"' || (*(str+1) == '\\' && *(str+2) == '"'))) {
- len = prev_len + (str-start+2);
- *strP = XtRealloc(*strP, len);
- (void) memmove(*strP + prev_len, start, str-start);
- prev_len = len-1;
- str++;
- (*strP)[prev_len-1] = *str;
- (*strP)[prev_len] = '\0';
- start = str+1;
- }
- str++;
- }
- len = prev_len + (str-start+1);
- *strP = XtRealloc(*strP, len);
- (void) memmove( *strP + prev_len, start, str-start);
- (*strP)[len-1] = '\0';
- if (*str == '"') str++; else
- XtWarningMsg(XtNtranslationParseError,"parseString",
- XtCXtToolkitError,"Missing '\"'.",
- (String *)NULL, (Cardinal *)NULL);
- } else {
- /* scan non-quoted string, stop on whitespace, ',' or ')' */
- start = str;
- while (*str != ' '
- && *str != '\t'
- && *str != ','
- && *str != ')'
- && !IsNewline(*str)
- && *str != '\0') str++;
- *strP = __XtMalloc((unsigned)(str-start+1));
- (void) memmove(*strP, start, str-start);
- (*strP)[str-start] = '\0';
- }
- return str;
-}
-
-
-static String ParseParamSeq(str, paramSeqP, paramNumP)
- register String str;
- String **paramSeqP;
- Cardinal *paramNumP;
-{
- typedef struct _ParamRec *ParamPtr;
- typedef struct _ParamRec {
- ParamPtr next;
- String param;
- } ParamRec;
-
- ParamPtr params = NULL;
- register Cardinal num_params = 0;
- register Cardinal i;
-
- ScanWhitespace(str);
- while (*str != ')' && *str != '\0' && !IsNewline(*str)) {
- String newStr;
- str = ParseString(str, &newStr);
- if (newStr != NULL) {
- ParamPtr temp = (ParamRec*)
- ALLOCATE_LOCAL( (unsigned)sizeof(ParamRec) );
- if (temp == NULL) _XtAllocError (NULL);
-
- num_params++;
- temp->next = params;
- params = temp;
- temp->param = newStr;
- ScanWhitespace(str);
- if (*str == ',') {
- str++;
- ScanWhitespace(str);
- }
- }
- }
-
- if (num_params != 0) {
- String *paramP = (String *)
- __XtMalloc( (unsigned)(num_params+1) * sizeof(String) );
- *paramSeqP = paramP;
- *paramNumP = num_params;
- paramP += num_params; /* list is LIFO right now */
- *paramP-- = NULL;
- for (i=0; i < num_params; i++) {
- ParamPtr next = params->next;
- *paramP-- = params->param;
- DEALLOCATE_LOCAL( (char *)params );
- params = next;
- }
- } else {
- *paramSeqP = NULL;
- *paramNumP = 0;
- }
-
- return str;
-}
-
-static String ParseAction(str, actionP, quarkP, error)
- String str;
- ActionPtr actionP;
- XrmQuark* quarkP;
- Boolean* error;
-{
- str = ParseActionProc(str, quarkP, error);
- if (*error) return str;
-
- if (*str == '(') {
- str++;
- str = ParseParamSeq(str, &actionP->params, &actionP->num_params);
- } else {
- Syntax("Missing '(' while parsing action sequence","");
- *error = TRUE;
- return str;
- }
- if (*str == ')') str++;
- else{
- Syntax("Missing ')' while parsing action sequence","");
- *error = TRUE;
- return str;
- }
- return str;
-}
-
-
-static String ParseActionSeq(parseTree, str, actionsP, error)
- TMParseStateTree parseTree;
- String str;
- ActionPtr *actionsP;
- Boolean *error;
-{
- ActionPtr *nextActionP = actionsP;
-
- *actionsP = NULL;
- while (*str != '\0' && !IsNewline(*str)) {
- register ActionPtr action;
- XrmQuark quark;
-
- action = XtNew(ActionRec);
- action->params = NULL;
- action->num_params = 0;
- action->next = NULL;
-
- str = ParseAction(str, action, &quark, error);
- if (*error) return PanicModeRecovery(str);
-
- action->idx = _XtGetQuarkIndex(parseTree, quark);
- ScanWhitespace(str);
- *nextActionP = action;
- nextActionP = &action->next;
- }
- if (IsNewline(*str)) str++;
- ScanWhitespace(str);
- return str;
-}
-
-
-static void ShowProduction(currentProduction)
- String currentProduction;
-{
- Cardinal num_params = 1;
- String params[1];
- int len;
- char *eol, *production, productionbuf[500];
-
-#ifdef __EMX__
- eol = strchr(currentProduction, '\r');
- if (!eol) /* try '\n' as well below */
-#endif
- eol = strchr(currentProduction, '\n');
- if (eol) len = eol - currentProduction;
- else len = strlen (currentProduction);
- production = XtStackAlloc (len + 1, productionbuf);
- if (production == NULL) _XtAllocError (NULL);
- (void) memmove(production, currentProduction, len);
- production[len] = '\0';
-
- params[0] = production;
- XtWarningMsg(XtNtranslationParseError, "showLine", XtCXtToolkitError,
- "... found while parsing '%s'", params, &num_params);
-
- XtStackFree (production, productionbuf);
-}
-
-/***********************************************************************
- * ParseTranslationTableProduction
- * Parses one line of event bindings.
- ***********************************************************************/
-
-static String ParseTranslationTableProduction(parseTree, str, error)
- TMParseStateTree parseTree;
- register String str;
- Boolean* error;
-{
- EventSeqPtr eventSeq = NULL;
- ActionPtr *actionsP;
- String production = str;
-
- str = ParseEventSeq(str, &eventSeq, &actionsP,error);
- if (*error == TRUE) {
- ShowProduction(production);
- FreeEventSeq(eventSeq);
- return (str);
- }
- ScanWhitespace(str);
- str = ParseActionSeq(parseTree, str, actionsP, error);
- if (*error == TRUE) {
- ShowProduction(production);
- FreeEventSeq(eventSeq);
- return (str);
- }
-
- _XtAddEventSeqToStateTree(eventSeq, parseTree);
- FreeEventSeq(eventSeq);
- return (str);
-}
-
-static String CheckForPoundSign(str, defaultOp, actualOpRtn)
- String str;
- _XtTranslateOp defaultOp;
- _XtTranslateOp *actualOpRtn;
-{
- String start;
- char operation[20];
- _XtTranslateOp opType;
-
- opType = defaultOp;
- ScanWhitespace(str);
- if (*str == '#') {
- int len;
- str++;
- start = str;
- str = ScanIdent(str);
- len = MIN(19, str-start);
- (void) memmove(operation, start, len);
- operation[len] = '\0';
- if (!strcmp(operation,"replace"))
- opType = XtTableReplace;
- else if (!strcmp(operation,"augment"))
- opType = XtTableAugment;
- else if (!strcmp(operation,"override"))
- opType = XtTableOverride;
- ScanWhitespace(str);
- if (IsNewline(*str)) {
- str++;
- ScanWhitespace(str);
- }
- }
- *actualOpRtn = opType;
- return str;
-}
-
-static XtTranslations ParseTranslationTable(source, isAccelerator, defaultOp, error)
- String source;
- Boolean isAccelerator;
- _XtTranslateOp defaultOp;
- Boolean* error;
-{
- XtTranslations xlations;
- TMStateTree stateTrees[8];
- TMParseStateTreeRec parseTreeRec, *parseTree = &parseTreeRec;
- XrmQuark stackQuarks[200];
- TMBranchHeadRec stackBranchHeads[200];
- StatePtr stackComplexBranchHeads[200];
- _XtTranslateOp actualOp;
-
- if (source == NULL)
- return (XtTranslations)NULL;
-
- source = CheckForPoundSign(source, defaultOp, &actualOp);
- if (isAccelerator && actualOp == XtTableReplace)
- actualOp = defaultOp;
-
- parseTree->isSimple = TRUE;
- parseTree->mappingNotifyInterest = FALSE;
- parseTree->isAccelerator = isAccelerator;
- parseTree->isStackBranchHeads =
- parseTree->isStackQuarks =
- parseTree->isStackComplexBranchHeads = TRUE;
-
- parseTree->numQuarks =
- parseTree->numBranchHeads =
- parseTree->numComplexBranchHeads = 0;
-
- parseTree->quarkTblSize =
- parseTree->branchHeadTblSize =
- parseTree->complexBranchHeadTblSize = 200;
-
- parseTree->quarkTbl = stackQuarks;
- parseTree->branchHeadTbl = stackBranchHeads;
- parseTree->complexBranchHeadTbl = stackComplexBranchHeads;
-
- while (source != NULL && *source != '\0') {
- source = ParseTranslationTableProduction(parseTree, source, error);
- if (*error == TRUE) break;
- }
- stateTrees[0] = _XtParseTreeToStateTree(parseTree);
-
- if (!parseTree->isStackQuarks)
- XtFree((char *)parseTree->quarkTbl);
- if (!parseTree->isStackBranchHeads)
- XtFree((char *)parseTree->branchHeadTbl);
- if (!parseTree->isStackComplexBranchHeads)
- XtFree((char *)parseTree->complexBranchHeadTbl);
-
- xlations = _XtCreateXlations(stateTrees, 1, NULL, NULL);
- xlations->operation = actualOp;
-
-#ifdef notdef
- XtFree(stateTrees);
-#endif /* notdef */
- return xlations;
-}
-
-/*** public procedures ***/
-
-/*ARGSUSED*/
-Boolean XtCvtStringToAcceleratorTable(dpy, args, num_args, from, to, closure)
- Display* dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr from,to;
- XtPointer *closure;
-{
- String str;
- Boolean error = FALSE;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "wrongParameters","cvtStringToAcceleratorTable",XtCXtToolkitError,
- "String to AcceleratorTable conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- str = (String)(from->addr);
- if (str == NULL) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "badParameters","cvtStringToAcceleratorTable",XtCXtToolkitError,
- "String to AcceleratorTable conversion needs string",
- (String *)NULL, (Cardinal *)NULL);
- return FALSE;
- }
- if (to->addr != NULL) {
- if (to->size < sizeof(XtAccelerators)) {
- to->size = sizeof(XtAccelerators);
- return FALSE;
- }
- *(XtAccelerators*)to->addr =
- (XtAccelerators) ParseTranslationTable(str, TRUE, XtTableAugment, &error);
- }
- else {
- static XtAccelerators staticStateTable;
- staticStateTable =
- (XtAccelerators) ParseTranslationTable(str, TRUE, XtTableAugment, &error);
- to->addr = (XPointer) &staticStateTable;
- to->size = sizeof(XtAccelerators);
- }
- if (error == TRUE)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "parseError","cvtStringToAcceleratorTable",XtCXtToolkitError,
- "String to AcceleratorTable conversion encountered errors",
- (String *)NULL, (Cardinal *)NULL);
- return (error != TRUE);
-}
-
-
-/*ARGSUSED*/
-Boolean
-XtCvtStringToTranslationTable(dpy, args, num_args, from, to, closure_ret)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr from,to;
- XtPointer *closure_ret;
-{
- String str;
- Boolean error = FALSE;
-
- if (*num_args != 0)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "wrongParameters","cvtStringToTranslationTable",XtCXtToolkitError,
- "String to TranslationTable conversion needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
- str = (String)(from->addr);
- if (str == NULL) {
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "badParameters","cvtStringToTranslation",XtCXtToolkitError,
- "String to TranslationTable conversion needs string",
- (String *)NULL, (Cardinal *)NULL);
- return FALSE;
- }
- if (to->addr != NULL) {
- if (to->size < sizeof(XtTranslations)) {
- to->size = sizeof(XtTranslations);
- return FALSE;
- }
- *(XtTranslations*)to->addr =
- ParseTranslationTable(str, FALSE, XtTableReplace, &error);
- }
- else {
- static XtTranslations staticStateTable;
- staticStateTable =
- ParseTranslationTable(str, FALSE, XtTableReplace, &error);
- to->addr = (XPointer) &staticStateTable;
- to->size = sizeof(XtTranslations);
- }
- if (error == TRUE)
- XtAppWarningMsg(XtDisplayToApplicationContext(dpy),
- "parseError","cvtStringToTranslationTable",XtCXtToolkitError,
- "String to TranslationTable conversion encountered errors",
- (String *)NULL, (Cardinal *)NULL);
- return (error != TRUE);
-}
-
-
-/*
- * Parses a user's or applications translation table
- */
-#if NeedFunctionPrototypes
-XtAccelerators XtParseAcceleratorTable(
- _Xconst char* source
- )
-#else
-XtAccelerators XtParseAcceleratorTable(source)
- String source;
-#endif
-{
- Boolean error = FALSE;
- XtAccelerators ret =
- (XtAccelerators) ParseTranslationTable (source, TRUE, XtTableAugment, &error);
- if (error == TRUE)
- XtWarningMsg ("parseError", "cvtStringToAcceleratorTable",
- XtCXtToolkitError,
- "String to AcceleratorTable conversion encountered errors",
- (String *)NULL, (Cardinal *)NULL);
- return ret;
-}
-
-#if NeedFunctionPrototypes
-XtTranslations XtParseTranslationTable(
- _Xconst char* source
- )
-#else
-XtTranslations XtParseTranslationTable(source)
- String source;
-#endif
-{
- Boolean error = FALSE;
- XtTranslations ret = ParseTranslationTable(source, FALSE, XtTableReplace, &error);
- if (error == TRUE)
- XtWarningMsg ("parseError",
- "cvtStringToTranslationTable", XtCXtToolkitError,
- "String to TranslationTable conversion encountered errors",
- (String *)NULL, (Cardinal *)NULL);
- return ret;
-}
-
-void _XtTranslateInitialize()
-{
- LOCK_PROCESS;
- if (initialized) {
- XtWarningMsg("translationError","xtTranslateInitialize",
- XtCXtToolkitError,"Initializing Translation manager twice.",
- (String *)NULL, (Cardinal *)NULL);
- UNLOCK_PROCESS;
- return;
- }
-
- initialized = TRUE;
- UNLOCK_PROCESS;
- QMeta = XrmPermStringToQuark("Meta");
- QCtrl = XrmPermStringToQuark("Ctrl");
- QNone = XrmPermStringToQuark("None");
- QAny = XrmPermStringToQuark("Any");
-
- Compile_XtEventTable( events, XtNumber(events) );
- Compile_XtModifierTable( modifiers, XtNumber(modifiers) );
- CompileNameValueTable( buttonNames );
- CompileNameValueTable( notifyModes );
- CompileNameValueTable( motionDetails );
-#if 0
- CompileNameValueTable( notifyDetail );
- CompileNameValueTable( visibilityNotify );
- CompileNameValueTable( circulation );
- CompileNameValueTable( propertyChanged );
-#endif
- CompileNameValueTable( mappingNotify );
-}
-
-void _XtAddTMConverters(table)
- ConverterTable table;
-{
- _XtTableAddConverter(table,
- _XtQString,
- XrmPermStringToQuark(XtRTranslationTable),
- XtCvtStringToTranslationTable, (XtConvertArgList) NULL,
- (Cardinal)0, True, CACHED, _XtFreeTranslations, True);
- _XtTableAddConverter(table, _XtQString,
- XrmPermStringToQuark(XtRAcceleratorTable),
- XtCvtStringToAcceleratorTable, (XtConvertArgList) NULL,
- (Cardinal)0, True, CACHED, _XtFreeTranslations, True);
- _XtTableAddConverter(table,
- XrmPermStringToQuark( _XtRStateTablePair ),
- XrmPermStringToQuark(XtRTranslationTable),
- _XtCvtMergeTranslations, (XtConvertArgList) NULL,
- (Cardinal)0, True, CACHED, _XtFreeTranslations, True);
-}
diff --git a/xc/lib/Xt/TMprint.c b/xc/lib/Xt/TMprint.c
deleted file mode 100644
index 279282df0..000000000
--- a/xc/lib/Xt/TMprint.c
+++ /dev/null
@@ -1,885 +0,0 @@
-/* $TOG: TMprint.c /main/16 1998/02/06 13:27:12 kaleb $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts
-Copyright 1993 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 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 Sun 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.
-
-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, 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.
-
-*/
-
-/*LINTLIBRARY*/
-#include "IntrinsicI.h"
-#include <stdio.h>
-
-typedef struct _TMStringBufRec{
- String start;
- String current;
- Cardinal max;
-}TMStringBufRec, *TMStringBuf;
-
-
-#define STR_THRESHOLD 25
-#define STR_INCAMOUNT 100
-#define CHECK_STR_OVERFLOW(sb) \
-if (sb->current - sb->start > (int)sb->max - STR_THRESHOLD) \
-{ String old = sb->start; \
- sb->start = XtRealloc(old, (Cardinal)(sb->max += STR_INCAMOUNT)); \
- sb->current = sb->current - old + sb->start; \
-}
-
-#define ExpandForChars(sb, nchars ) \
- if (sb->current - sb->start > sb->max - STR_THRESHOLD - nchars) { \
- String old = sb->start; \
- sb->start = XtRealloc(old, \
- (Cardinal)(sb->max += STR_INCAMOUNT + nchars)); \
- sb->current = sb->current - old + sb->start; \
- }
-
-#define ExpandToFit(sb, more) \
-{ \
- int l = strlen(more); \
- ExpandForChars(sb, l); \
- }
-
-static void PrintModifiers(sb, mask, mod)
- TMStringBuf sb;
- unsigned long mask, mod;
-{
- Boolean notfirst = False;
- CHECK_STR_OVERFLOW(sb);
-
- if (mask == ~0L && mod == 0) {
- *sb->current++ = '!';
- *sb->current = '\0';
- return;
- }
-
-#define PRINTMOD(modmask,modstring) \
- if (mask & modmask) { \
- if (! (mod & modmask)) { \
- *sb->current++ = '~'; \
- notfirst = True; \
- } \
- else if (notfirst) \
- *sb->current++ = ' '; \
- else notfirst = True; \
- strcpy(sb->current, modstring); \
- sb->current += strlen(sb->current); \
- }
-
- PRINTMOD(ShiftMask, "Shift");
- PRINTMOD(ControlMask, "Ctrl"); /* name is not CtrlMask... */
- PRINTMOD(LockMask, "Lock");
- PRINTMOD(Mod1Mask, "Mod1");
- CHECK_STR_OVERFLOW(sb);
- PRINTMOD(Mod2Mask, "Mod2");
- PRINTMOD(Mod3Mask, "Mod3");
- PRINTMOD(Mod4Mask, "Mod4");
- PRINTMOD(Mod5Mask, "Mod5");
- CHECK_STR_OVERFLOW(sb);
- PRINTMOD(Button1Mask, "Button1");
- PRINTMOD(Button2Mask, "Button2");
- PRINTMOD(Button3Mask, "Button3");
- CHECK_STR_OVERFLOW(sb);
- PRINTMOD(Button4Mask, "Button4");
- PRINTMOD(Button5Mask, "Button5");
-
-#undef PRINTMOD
-}
-
-static void PrintEventType(sb, event)
- TMStringBuf sb;
- unsigned long event;
-{
- CHECK_STR_OVERFLOW(sb);
- switch (event) {
-#define PRINTEVENT(event, name) case event: (void) strcpy(sb->current, name); break;
- PRINTEVENT(KeyPress, "<KeyPress>")
- PRINTEVENT(KeyRelease, "<KeyRelease>")
- PRINTEVENT(ButtonPress, "<ButtonPress>")
- PRINTEVENT(ButtonRelease, "<ButtonRelease>")
- PRINTEVENT(MotionNotify, "<MotionNotify>")
- PRINTEVENT(EnterNotify, "<EnterNotify>")
- PRINTEVENT(LeaveNotify, "<LeaveNotify>")
- PRINTEVENT(FocusIn, "<FocusIn>")
- PRINTEVENT(FocusOut, "<FocusOut>")
- PRINTEVENT(KeymapNotify, "<KeymapNotify>")
- PRINTEVENT(Expose, "<Expose>")
- PRINTEVENT(GraphicsExpose, "<GraphicsExpose>")
- PRINTEVENT(NoExpose, "<NoExpose>")
- PRINTEVENT(VisibilityNotify, "<VisibilityNotify>")
- PRINTEVENT(CreateNotify, "<CreateNotify>")
- PRINTEVENT(DestroyNotify, "<DestroyNotify>")
- PRINTEVENT(UnmapNotify, "<UnmapNotify>")
- PRINTEVENT(MapNotify, "<MapNotify>")
- PRINTEVENT(MapRequest, "<MapRequest>")
- PRINTEVENT(ReparentNotify, "<ReparentNotify>")
- PRINTEVENT(ConfigureNotify, "<ConfigureNotify>")
- PRINTEVENT(ConfigureRequest, "<ConfigureRequest>")
- PRINTEVENT(GravityNotify, "<GravityNotify>")
- PRINTEVENT(ResizeRequest, "<ResizeRequest>")
- PRINTEVENT(CirculateNotify, "<CirculateNotify>")
- PRINTEVENT(CirculateRequest, "<CirculateRequest>")
- PRINTEVENT(PropertyNotify, "<PropertyNotify>")
- PRINTEVENT(SelectionClear, "<SelectionClear>")
- PRINTEVENT(SelectionRequest, "<SelectionRequest>")
- PRINTEVENT(SelectionNotify, "<SelectionNotify>")
- PRINTEVENT(ColormapNotify, "<ColormapNotify>")
- PRINTEVENT(ClientMessage, "<ClientMessage>")
- case _XtEventTimerEventType:
- (void) strcpy(sb->current,"<EventTimer>");
- break;
- default:
- (void) sprintf(sb->current, "<0x%x>", (int) event);
-#undef PRINTEVENT
- }
- sb->current += strlen(sb->current);
-}
-
-static void PrintCode(sb, mask, code)
- TMStringBuf sb;
- unsigned long mask, code;
-{
- CHECK_STR_OVERFLOW(sb);
- if (mask != 0) {
- if (mask != (unsigned long)~0L)
- (void) sprintf(sb->current, "0x%lx:0x%lx", mask, code);
- else (void) sprintf(sb->current, /*"0x%lx"*/ "%d", code);
- sb->current += strlen(sb->current);
- }
-}
-
-static void PrintKeysym(sb, keysym)
- TMStringBuf sb;
- KeySym keysym;
-{
- String keysymName;
-
- if (keysym == 0) return;
-
- CHECK_STR_OVERFLOW(sb);
- keysymName = XKeysymToString(keysym);
- if (keysymName == NULL)
- PrintCode(sb,(unsigned long)~0L,(unsigned long)keysym);
- else {
- ExpandToFit(sb, keysymName);
- strcpy(sb->current, keysymName);
- sb->current += strlen(sb->current);
- }
-}
-
-static void PrintAtom(sb, dpy, atom)
- TMStringBuf sb;
- Display *dpy;
- Atom atom;
-{
- String atomName;
-
- if (atom == 0) return;
-
- atomName = (dpy ? XGetAtomName(dpy, atom) : NULL);
-
- if (! atomName)
- PrintCode(sb,(unsigned long)~0L,(unsigned long)atom);
- else {
- ExpandToFit( sb, atomName );
- strcpy(sb->current, atomName);
- sb->current += strlen(sb->current);
- XFree(atomName);
- }
-}
-
-static void PrintLateModifiers(sb, lateModifiers)
- TMStringBuf sb;
- LateBindingsPtr lateModifiers;
-{
- for (; lateModifiers->keysym; lateModifiers++) {
- CHECK_STR_OVERFLOW(sb);
- if (lateModifiers->knot) {
- *sb->current++ = '~';
- } else {
- *sb->current++ = ' ';
- }
- strcpy(sb->current, XKeysymToString(lateModifiers->keysym));
- sb->current += strlen(sb->current);
- if (lateModifiers->pair) {
- *(sb->current -= 2) = '\0'; /* strip "_L" */
- lateModifiers++; /* skip _R keysym */
- }
- }
-}
-
-static void PrintEvent(sb, typeMatch, modMatch, dpy)
- TMStringBuf sb;
- register TMTypeMatch typeMatch;
- register TMModifierMatch modMatch;
- Display *dpy;
-{
- if (modMatch->standard) *sb->current++ = ':';
-
- PrintModifiers(sb, modMatch->modifierMask, modMatch->modifiers);
- if (modMatch->lateModifiers != NULL)
- PrintLateModifiers(sb, modMatch->lateModifiers);
- PrintEventType(sb, typeMatch->eventType);
- switch (typeMatch->eventType) {
- case KeyPress:
- case KeyRelease:
- PrintKeysym(sb, (KeySym)typeMatch->eventCode);
- break;
-
- case PropertyNotify:
- case SelectionClear:
- case SelectionRequest:
- case SelectionNotify:
- case ClientMessage:
- PrintAtom(sb, dpy, (Atom)typeMatch->eventCode);
- break;
-
- default:
- PrintCode(sb, typeMatch->eventCodeMask, typeMatch->eventCode);
- }
-}
-
-static void PrintParams(sb, params, num_params)
- TMStringBuf sb;
- String *params;
- Cardinal num_params;
-{
- register Cardinal i;
- for (i = 0; i<num_params; i++) {
- ExpandToFit( sb, params[i] );
- if (i != 0) {
- *sb->current++ = ',';
- *sb->current++ = ' ';
- }
- *sb->current++ = '"';
- strcpy(sb->current, params[i]);
- sb->current += strlen(sb->current);
- *sb->current++ = '"';
- }
- *sb->current = '\0';
-}
-
-static void PrintActions(sb, actions, quarkTbl, accelWidget)
- TMStringBuf sb;
- register ActionPtr actions;
- XrmQuark *quarkTbl;
- Widget accelWidget;
-{
- while (actions != NULL) {
- String proc;
-
- *sb->current++ = ' ';
-
- if (accelWidget) {
- /* accelerator */
- String name = XtName(accelWidget);
- int nameLen = strlen(name);
- ExpandForChars(sb, nameLen );
- XtMemmove(sb->current, name, nameLen );
- sb->current += nameLen;
- *sb->current++ = '`';
- }
- proc = XrmQuarkToString(quarkTbl[actions->idx]);
- ExpandToFit( sb, proc );
- strcpy(sb->current, proc);
- sb->current += strlen(proc);
- *sb->current++ = '(';
- PrintParams(sb, actions->params, actions->num_params);
- *sb->current++ = ')';
- actions = actions->next;
- }
- *sb->current = '\0';
-}
-
-static Boolean LookAheadForCycleOrMulticlick(state, state_return, countP,
- nextLevelP)
- register StatePtr state;
- StatePtr *state_return; /* state to print, usually startState */
- int *countP;
- StatePtr *nextLevelP;
-{
- int repeatCount = 0;
- StatePtr startState = state;
- Boolean isCycle = startState->isCycleEnd;
- TMTypeMatch sTypeMatch;
- TMModifierMatch sModMatch;
-
- LOCK_PROCESS;
- sTypeMatch = TMGetTypeMatch(startState->typeIndex);
- sModMatch = TMGetModifierMatch(startState->modIndex);
-
- *state_return = startState;
-
- for (state = state->nextLevel; state != NULL; state = state->nextLevel) {
- TMTypeMatch typeMatch = TMGetTypeMatch(state->typeIndex);
- TMModifierMatch modMatch = TMGetModifierMatch(state->modIndex);
-
- /* try to pick up the correct state with actions, to be printed */
- /* This is to accommodate <ButtonUp>(2+), for example */
- if (state->isCycleStart)
- *state_return = state;
-
- if (state->isCycleEnd) {
- *countP = repeatCount;
- UNLOCK_PROCESS;
- return True;
- }
- if ((startState->typeIndex == state->typeIndex) &&
- (startState->modIndex == state->modIndex)) {
- repeatCount++;
- *nextLevelP = state;
- }
- else if (typeMatch->eventType == _XtEventTimerEventType)
- continue;
- else /* not same event as starting event and not timer */ {
- unsigned int type = sTypeMatch->eventType;
- unsigned int t = typeMatch->eventType;
- if ( (type == ButtonPress && t != ButtonRelease)
- || (type == ButtonRelease && t != ButtonPress)
- || (type == KeyPress && t != KeyRelease)
- || (type == KeyRelease && t != KeyPress)
- || typeMatch->eventCode != sTypeMatch->eventCode
- || modMatch->modifiers != sModMatch->modifiers
- || modMatch->modifierMask != sModMatch->modifierMask
- || modMatch->lateModifiers != sModMatch->lateModifiers
- || typeMatch->eventCodeMask != sTypeMatch->eventCodeMask
- || typeMatch->matchEvent != sTypeMatch->matchEvent
- || modMatch->standard != sModMatch->standard)
- /* not inverse of starting event, either */
- break;
- }
- }
- *countP = repeatCount;
- UNLOCK_PROCESS;
- return isCycle;
-}
-
-static void PrintComplexState(sb, includeRHS, state, stateTree, accelWidget, dpy)
- TMStringBuf sb;
- Boolean includeRHS;
- StatePtr state;
- TMStateTree stateTree;
- Widget accelWidget;
- Display *dpy;
-{
- int clickCount = 0;
- Boolean cycle;
- StatePtr nextLevel = NULL;
- StatePtr triggerState = NULL;
-
- /* print the current state */
- if (! state) return;
- LOCK_PROCESS;
- cycle = LookAheadForCycleOrMulticlick(state, &triggerState, &clickCount,
- &nextLevel);
-
- PrintEvent(sb, TMGetTypeMatch(triggerState->typeIndex),
- TMGetModifierMatch(triggerState->modIndex), dpy);
-
- if (cycle || clickCount) {
- if (clickCount)
- sprintf(sb->current, "(%d%s)", clickCount+1, cycle ? "+" : "");
- else
- (void) strncpy(sb->current, "(+)", 4);
- sb->current += strlen(sb->current);
- if (! state->actions && nextLevel)
- state = nextLevel;
- while (! state->actions && ! state->isCycleEnd)
- state = state->nextLevel; /* should be trigger state */
- }
-
- if (state->actions) {
- if (includeRHS) {
- CHECK_STR_OVERFLOW(sb);
- *sb->current++ = ':';
- PrintActions(sb,
- state->actions,
- ((TMSimpleStateTree)stateTree)->quarkTbl,
- accelWidget);
- *sb->current++ = '\n';
- }
- }
- else {
- if (state->nextLevel && !cycle && !clickCount)
- *sb->current++ = ',';
- else {
- /* no actions are attached to this production */
- *sb->current++ = ':';
- *sb->current++ = '\n';
- }
- }
- *sb->current = '\0';
-
- /* print succeeding states */
- if (state->nextLevel && !cycle && !clickCount)
- PrintComplexState(sb, includeRHS, state->nextLevel,
- stateTree, accelWidget, dpy);
- UNLOCK_PROCESS;
-}
-
-typedef struct{
- TMShortCard tIndex;
- TMShortCard bIndex;
-}PrintRec, *Print;
-
-static int FindNextMatch(printData, numPrints, xlations,
- branchHead, nextLevel, startIndex)
- PrintRec *printData;
- TMShortCard numPrints;
- XtTranslations xlations;
- TMBranchHead branchHead;
- StatePtr nextLevel;
- TMShortCard startIndex;
-{
- TMShortCard i;
- TMComplexStateTree stateTree;
- StatePtr currState, candState;
- Boolean noMatch = True;
- TMBranchHead prBranchHead;
-
- for (i = startIndex; noMatch && i < numPrints; i++) {
- stateTree = (TMComplexStateTree)
- xlations->stateTreeTbl[printData[i].tIndex];
- prBranchHead =
- &(stateTree->branchHeadTbl[printData[i].bIndex]);
-
- if ((prBranchHead->typeIndex == branchHead->typeIndex) &&
- (prBranchHead->modIndex == branchHead->modIndex)) {
- if (prBranchHead->isSimple) {
- if (!nextLevel)
- return i;
- }
- else {
- currState = TMComplexBranchHead(stateTree, prBranchHead);
- currState = currState->nextLevel;
- candState = nextLevel;
- for (;
- ((currState && !currState->isCycleEnd) &&
- (candState && !candState->isCycleEnd));
- currState = currState->nextLevel,
- candState = candState->nextLevel) {
- if ((currState->typeIndex != candState->typeIndex) ||
- (currState->modIndex != candState->modIndex))
- break;
- }
- if (candState == currState) {
- return i;
- }
- }
- }
- }
- return TM_NO_MATCH;
-}
-
-static void ProcessLaterMatches(printData,xlations,tIndex,bIndex,numPrintsRtn)
- PrintRec *printData;
- XtTranslations xlations;
- TMShortCard tIndex;
- int bIndex;
- TMShortCard *numPrintsRtn;
-{
- TMComplexStateTree stateTree;
- int i, j;
- TMBranchHead branchHead, matchBranch = NULL;
-
- for (i = tIndex; i < (int)xlations->numStateTrees; i++) {
- stateTree = (TMComplexStateTree)xlations->stateTreeTbl[i];
- if (i == tIndex) {
- matchBranch = &stateTree->branchHeadTbl[bIndex];
- j = bIndex+1;
- }
- else j = 0;
- for (branchHead = &stateTree->branchHeadTbl[j];
- j < (int)stateTree->numBranchHeads;
- j++, branchHead++) {
- if ((branchHead->typeIndex == matchBranch->typeIndex) &&
- (branchHead->modIndex == matchBranch->modIndex)) {
- StatePtr state;
- if (!branchHead->isSimple)
- state = TMComplexBranchHead(stateTree, branchHead);
- else
- state = NULL;
- if ((!branchHead->isSimple || branchHead->hasActions) &&
- (FindNextMatch(printData,
- *numPrintsRtn,
- xlations,
- branchHead,
- (state ? state->nextLevel : NULL),
- 0) == TM_NO_MATCH)) {
- printData[*numPrintsRtn].tIndex = i;
- printData[*numPrintsRtn].bIndex = j;
- (*numPrintsRtn)++;
- }
- }
- }
- }
-}
-
-static void ProcessStateTree(printData, xlations, tIndex, numPrintsRtn)
- PrintRec *printData;
- XtTranslations xlations;
- TMShortCard tIndex;
- TMShortCard *numPrintsRtn;
-{
- TMComplexStateTree stateTree;
- int i;
- TMBranchHead branchHead;
-
- stateTree = (TMComplexStateTree)xlations->stateTreeTbl[tIndex];
-
- for (i = 0, branchHead = stateTree->branchHeadTbl;
- i < (int)stateTree->numBranchHeads;
- i++, branchHead++) {
- StatePtr state;
- if (!branchHead->isSimple)
- state = TMComplexBranchHead(stateTree, branchHead);
- else
- state = NULL;
- if (FindNextMatch(printData, *numPrintsRtn, xlations, branchHead,
- (state ? state->nextLevel : NULL), 0)
- == TM_NO_MATCH) {
- if (!branchHead->isSimple || branchHead->hasActions) {
- printData[*numPrintsRtn].tIndex = tIndex;
- printData[*numPrintsRtn].bIndex = i;
- (*numPrintsRtn)++;
- }
- LOCK_PROCESS;
- if (_XtGlobalTM.newMatchSemantics == False)
- ProcessLaterMatches(printData,
- xlations,
- tIndex,
- i,
- numPrintsRtn);
- UNLOCK_PROCESS;
- }
- }
-}
-
-static void PrintState(sb, tree, branchHead, includeRHS, accelWidget, dpy)
- TMStringBuf sb;
- TMStateTree tree;
- TMBranchHead branchHead;
- Boolean includeRHS;
- Widget accelWidget;
- Display *dpy;
-{
- TMComplexStateTree stateTree = (TMComplexStateTree)tree;
- LOCK_PROCESS;
- if (branchHead->isSimple) {
- PrintEvent(sb,
- TMGetTypeMatch(branchHead->typeIndex),
- TMGetModifierMatch(branchHead->modIndex),
- dpy);
- if (includeRHS) {
- ActionRec actRec;
-
- CHECK_STR_OVERFLOW(sb);
- *sb->current++ = ':';
- actRec.idx = TMBranchMore(branchHead);
- actRec.num_params = 0;
- actRec.params = NULL;
- actRec.next = NULL;
- PrintActions(sb,
- &actRec,
- stateTree->quarkTbl,
- accelWidget);
- *sb->current++ = '\n';
- }
- else
- *sb->current++ = ',';
-#ifdef TRACE_TM
- if (!branchHead->hasActions)
- printf(" !! no actions !! ");
-#endif
- }
- else { /* it's a complex branchHead */
- StatePtr state = TMComplexBranchHead(stateTree, branchHead);
- PrintComplexState(sb,
- includeRHS,
- state,
- tree,
- accelWidget,
- (Display *)NULL);
- }
- *sb->current = '\0';
- UNLOCK_PROCESS;
-}
-
-#if NeedFunctionPrototypes
-String _XtPrintXlations(
- Widget w,
- XtTranslations xlations,
- Widget accelWidget,
- _XtBoolean includeRHS
- )
-#else
-String _XtPrintXlations(w, xlations, accelWidget, includeRHS)
- Widget w;
- XtTranslations xlations;
- Widget accelWidget;
- Boolean includeRHS;
-#endif
-{
- register Cardinal i;
-#define STACKPRINTSIZE 250
- PrintRec stackPrints[STACKPRINTSIZE];
- PrintRec *prints;
- TMStringBufRec sbRec, *sb = &sbRec;
- TMShortCard numPrints, maxPrints;
-#ifdef TRACE_TM
- TMBindData bindData = (TMBindData)w->core.tm.proc_table;
- Boolean hasAccel = (accelWidget ? True : False);
-#endif /* TRACE_TM */
- if (xlations == NULL) return NULL;
-
- sb->current = sb->start = __XtMalloc((Cardinal)1000);
- sb->max = 1000;
- maxPrints = 0;
- for (i = 0; i < xlations->numStateTrees; i++)
- maxPrints +=
- ((TMSimpleStateTree)(xlations->stateTreeTbl[i]))->numBranchHeads;
- prints = (PrintRec *)
- XtStackAlloc(maxPrints * sizeof(PrintRec), stackPrints);
-
- numPrints = 0;
- for (i = 0; i < xlations->numStateTrees; i++)
- ProcessStateTree(prints, xlations, i, &numPrints);
-
- for (i = 0; i < numPrints; i++) {
- TMSimpleStateTree stateTree = (TMSimpleStateTree)
- xlations->stateTreeTbl[prints[i].tIndex];
- TMBranchHead branchHead =
- &stateTree->branchHeadTbl[prints[i].bIndex];
-#ifdef TRACE_TM
- TMComplexBindProcs complexBindProcs;
-
- if (hasAccel == False) {
- accelWidget = NULL;
- if (bindData->simple.isComplex) {
- complexBindProcs = TMGetComplexBindEntry(bindData, 0);
- accelWidget = complexBindProcs[prints[i].tIndex].widget;
- }
- }
-#endif /* TRACE_TM */
- PrintState(sb, (TMStateTree)stateTree, branchHead,
- includeRHS, accelWidget, XtDisplay(w));
- }
- XtStackFree((XtPointer)prints, (XtPointer)stackPrints);
- return (sb->start);
-}
-
-
-#ifndef NO_MIT_HACKS
-/*ARGSUSED*/
-void _XtDisplayTranslations(widget, event, params, num_params)
- Widget widget;
- XEvent *event;
- String *params;
- Cardinal *num_params;
-{
- String xString;
-
- xString = _XtPrintXlations(widget,
- widget->core.tm.translations,
- NULL,
- True);
- printf("%s\n",xString);
- XtFree(xString);
-}
-
-/*ARGSUSED*/
-void _XtDisplayAccelerators(widget, event, params, num_params)
- Widget widget;
- XEvent *event;
- String *params;
- Cardinal *num_params;
-{
- String xString;
-
-
- xString = _XtPrintXlations(widget,
- widget->core.accelerators,
- NULL,
- True);
- printf("%s\n",xString);
- XtFree(xString);
-}
-
-/*ARGSUSED*/
-void _XtDisplayInstalledAccelerators(widget, event, params, num_params)
- Widget widget;
- XEvent *event;
- String *params;
- Cardinal *num_params;
-{
- Widget eventWidget
- = XtWindowToWidget(event->xany.display, event->xany.window);
- register Cardinal i;
- TMStringBufRec sbRec, *sb = &sbRec;
- XtTranslations xlations;
-#define STACKPRINTSIZE 250
- PrintRec stackPrints[STACKPRINTSIZE];
- PrintRec *prints;
- TMShortCard numPrints, maxPrints;
- TMBindData bindData = (TMBindData) eventWidget->core.tm.proc_table;
- TMComplexBindProcs complexBindProcs;
-
- if ((eventWidget == NULL) ||
- ((xlations = eventWidget->core.tm.translations) == NULL) ||
- (bindData->simple.isComplex == False))
- return;
-
- sb->current = sb->start = __XtMalloc((Cardinal)1000);
- sb->start[0] = '\0';
- sb->max = 1000;
- maxPrints = 0;
- for (i = 0; i < xlations->numStateTrees; i++)
- maxPrints +=
- ((TMSimpleStateTree)xlations->stateTreeTbl[i])->numBranchHeads;
- prints = (PrintRec *)
- XtStackAlloc(maxPrints * sizeof(PrintRec), stackPrints);
-
- numPrints = 0;
-
- complexBindProcs = TMGetComplexBindEntry(bindData, 0);
- for (i = 0;
- i < xlations->numStateTrees;
- i++, complexBindProcs++) {
- if (complexBindProcs->widget)
- {
- ProcessStateTree(prints, xlations, i, &numPrints);
- }
- }
- for (i = 0; i < numPrints; i++) {
- TMSimpleStateTree stateTree = (TMSimpleStateTree)
- xlations->stateTreeTbl[prints[i].tIndex];
- TMBranchHead branchHead =
- &stateTree->branchHeadTbl[prints[i].bIndex];
-
- complexBindProcs = TMGetComplexBindEntry(bindData, 0);
-
- PrintState(sb, (TMStateTree)stateTree, branchHead, True,
- complexBindProcs[prints[i].tIndex].widget,
- XtDisplay(widget));
- }
- XtStackFree((XtPointer)prints, (XtPointer)stackPrints);
- printf("%s\n", sb->start);
- XtFree(sb->start);
-}
-#endif /*NO_MIT_HACKS*/
-
-String _XtPrintActions(actions, quarkTbl)
- register ActionRec *actions;
- XrmQuark *quarkTbl;
-{
- TMStringBufRec sbRec, *sb = &sbRec;
-
- sb->max = 1000;
- sb->current = sb->start = __XtMalloc((Cardinal)1000);
- PrintActions(sb,
- actions,
- quarkTbl,
- (Widget)NULL);
- return sb->start;
-}
-
-String _XtPrintState(stateTree, branchHead)
- TMStateTree stateTree;
- TMBranchHead branchHead;
-{
- TMStringBufRec sbRec, *sb = &sbRec;
-
- sb->current = sb->start = __XtMalloc((Cardinal)1000);
- sb->max = 1000;
- PrintState(sb, stateTree, branchHead,
- True, (Widget)NULL, (Display *)NULL);
- return sb->start;
-}
-
-
-String _XtPrintEventSeq(eventSeq, dpy)
- register EventSeqPtr eventSeq;
- Display *dpy;
-{
- TMStringBufRec sbRec, *sb = &sbRec;
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
-#define MAXSEQS 100
- EventSeqPtr eventSeqs[MAXSEQS];
- TMShortCard i, j;
- Boolean cycle = False;
-
- sb->current = sb->start = __XtMalloc((Cardinal)1000);
- sb->max = 1000;
- for (i = 0;
- i < MAXSEQS && eventSeq != NULL && !cycle;
- eventSeq = eventSeq->next, i++)
- {
- eventSeqs[i] = eventSeq;
- for (j = 0; j < i && !cycle; j++)
- if (eventSeqs[j] == eventSeq)
- cycle = True;
- }
- LOCK_PROCESS;
- for (j = 0; j < i; j++) {
- typeMatch =
- TMGetTypeMatch(_XtGetTypeIndex(&eventSeqs[j]->event));
- modMatch =
- TMGetModifierMatch(_XtGetModifierIndex(&eventSeqs[j]->event));
- PrintEvent(sb, typeMatch, modMatch, dpy);
- if (j < i)
- *sb->current++ = ',';
- }
- UNLOCK_PROCESS;
- return sb->start;
-}
-
diff --git a/xc/lib/Xt/TMstate.c b/xc/lib/Xt/TMstate.c
deleted file mode 100644
index 9bb41830d..000000000
--- a/xc/lib/Xt/TMstate.c
+++ /dev/null
@@ -1,2335 +0,0 @@
-/* $TOG: TMstate.c /main/155 1998/04/23 10:49:36 barstow $ */
-
-/***********************************************************
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993 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 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 Sun 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.
-
-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/lib/Xt/TMstate.c,v 1.4 1998/12/20 11:57:10 dawes Exp $ */
-
-/*
-
-Copyright 1987, 1988, 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.
-
-*/
-
-/* TMstate.c -- maintains the state table of actions for the translation
- * manager.
- */
-/*LINTLIBRARY*/
-
-#include "IntrinsicI.h"
-
-#ifndef TM_NO_MATCH
-#define TM_NO_MATCH (-2)
-#endif /* TM_NO_MATCH */
-
-/* forward definitions */
-static StatePtr NewState();
-
-
-static String XtNtranslationError = "translationError";
-
-#ifndef __EMX__
-TMGlobalRec _XtGlobalTM; /* initialized to zero K&R */
-#else
-TMGlobalRec _XtGlobalTM = {0};
-#endif
-
-#define MatchIncomingEvent(tmEvent, typeMatch, modMatch) \
- (typeMatch->eventType == tmEvent->event.eventType && \
- (typeMatch->matchEvent != NULL) && \
- (*typeMatch->matchEvent)(typeMatch, modMatch, tmEvent))
-
-
-#define NumStateTrees(xlations) \
- ((translateData->isSimple) ? 1 : (TMComplexXlations(xlations))->numTrees)
-
-static TMShortCard GetBranchHead(parseTree, typeIndex, modIndex, isDummy)
- TMParseStateTree parseTree;
- TMShortCard typeIndex;
- TMShortCard modIndex;
- Boolean isDummy;
-{
-#define TM_BRANCH_HEAD_TBL_ALLOC 8
-#define TM_BRANCH_HEAD_TBL_REALLOC 8
-
- TMBranchHead branchHead = parseTree->branchHeadTbl;
- TMShortCard newSize, i;
-
- /*
- * dummy is used as a place holder for later matching in old-style
- * matching behavior. If there's already an entry we don't need
- * another dummy.
- */
- if (isDummy) {
- for (i = 0; i < parseTree->numBranchHeads; i++, branchHead++) {
- if ((branchHead->typeIndex == typeIndex) &&
- (branchHead->modIndex == modIndex))
- return i;
- }
- }
- if (parseTree->numBranchHeads == parseTree->branchHeadTblSize)
- {
- if (parseTree->branchHeadTblSize == 0)
- parseTree->branchHeadTblSize += TM_BRANCH_HEAD_TBL_ALLOC;
- else
- parseTree->branchHeadTblSize +=
- TM_BRANCH_HEAD_TBL_REALLOC;
- newSize = (parseTree->branchHeadTblSize * sizeof(TMBranchHeadRec));
- if (parseTree->isStackBranchHeads) {
- TMBranchHead oldBranchHeadTbl = parseTree->branchHeadTbl;
- parseTree->branchHeadTbl = (TMBranchHead) __XtMalloc(newSize);
- XtMemmove(parseTree->branchHeadTbl, oldBranchHeadTbl, newSize);
- parseTree->isStackBranchHeads = False;
- }
- else {
- parseTree->branchHeadTbl = (TMBranchHead)
- XtRealloc((char *)parseTree->branchHeadTbl,
- (parseTree->branchHeadTblSize *
- sizeof(TMBranchHeadRec)));
- }
- }
-#ifdef TRACE_TM
- LOCK_PROCESS;
- _XtGlobalTM.numBranchHeads++;
- UNLOCK_PROCESS;
-#endif /* TRACE_TM */
- branchHead =
- &parseTree->branchHeadTbl[parseTree->numBranchHeads++];
- branchHead->typeIndex = typeIndex;
- branchHead->modIndex = modIndex;
- branchHead->more = 0;
- branchHead->isSimple = True;
- branchHead->hasActions = False;
- branchHead->hasCycles = False;
- return parseTree->numBranchHeads-1;
-}
-
-TMShortCard _XtGetQuarkIndex(parseTree, quark)
- TMParseStateTree parseTree;
- XrmQuark quark;
-{
-#define TM_QUARK_TBL_ALLOC 16
-#define TM_QUARK_TBL_REALLOC 16
- TMShortCard i = parseTree->numQuarks;
-
- for (i=0; i < parseTree->numQuarks; i++)
- if (parseTree->quarkTbl[i] == quark)
- break;
-
- if (i == parseTree->numQuarks)
- {
- if (parseTree->numQuarks == parseTree->quarkTblSize)
- {
- TMShortCard newSize;
-
- if (parseTree->quarkTblSize == 0)
- parseTree->quarkTblSize += TM_QUARK_TBL_ALLOC;
- else
- parseTree->quarkTblSize += TM_QUARK_TBL_REALLOC;
- newSize = (parseTree->quarkTblSize * sizeof(XrmQuark));
-
- if (parseTree->isStackQuarks) {
- XrmQuark *oldquarkTbl = parseTree->quarkTbl;
- parseTree->quarkTbl = (XrmQuark *) __XtMalloc(newSize);
- XtMemmove(parseTree->quarkTbl, oldquarkTbl, newSize);
- parseTree->isStackQuarks = False;
- }
- else {
- parseTree->quarkTbl = (XrmQuark *)
- XtRealloc((char *)parseTree->quarkTbl,
- (parseTree->quarkTblSize *
- sizeof(XrmQuark)));
- }
- }
- parseTree->quarkTbl[parseTree->numQuarks++] = quark;
- }
- return i;
-}
-
-/*
- * Get an entry from the parseTrees complex branchHead tbl. If there's none
- * there then allocate one
- */
-/*ARGSUSED*/
-static TMShortCard GetComplexBranchIndex(parseTree, typeIndex, modIndex)
- TMParseStateTree parseTree;
- TMShortCard typeIndex;
- TMShortCard modIndex;
-{
-#define TM_COMPLEXBRANCH_HEAD_TBL_ALLOC 8
-#define TM_COMPLEXBRANCH_HEAD_TBL_REALLOC 4
-
- if (parseTree->numComplexBranchHeads == parseTree->complexBranchHeadTblSize) {
- TMShortCard newSize;
-
- if (parseTree->complexBranchHeadTblSize == 0)
- parseTree->complexBranchHeadTblSize += TM_COMPLEXBRANCH_HEAD_TBL_ALLOC;
- else
- parseTree->complexBranchHeadTblSize += TM_COMPLEXBRANCH_HEAD_TBL_REALLOC;
-
- newSize = (parseTree->complexBranchHeadTblSize * sizeof(StatePtr));
-
- if (parseTree->isStackComplexBranchHeads) {
- StatePtr *oldcomplexBranchHeadTbl
- = parseTree->complexBranchHeadTbl;
- parseTree->complexBranchHeadTbl = (StatePtr *) __XtMalloc(newSize);
- XtMemmove(parseTree->complexBranchHeadTbl,
- oldcomplexBranchHeadTbl, newSize);
- parseTree->isStackComplexBranchHeads = False;
- }
- else {
- parseTree->complexBranchHeadTbl = (StatePtr *)
- XtRealloc((char *)parseTree->complexBranchHeadTbl,
- (parseTree->complexBranchHeadTblSize *
- sizeof(StatePtr)));
- }
- }
- parseTree->complexBranchHeadTbl[parseTree->numComplexBranchHeads++] = NULL;
- return parseTree->numComplexBranchHeads-1;
-}
-
-TMShortCard _XtGetTypeIndex(event)
- Event *event;
-{
- TMShortCard i, j = TM_TYPE_SEGMENT_SIZE;
- TMShortCard typeIndex = 0;
- TMTypeMatch typeMatch;
- TMTypeMatch segment;
-
- LOCK_PROCESS;
- for (i = 0; i < _XtGlobalTM.numTypeMatchSegments; i++) {
- segment = _XtGlobalTM.typeMatchSegmentTbl[i];
- for (j = 0;
- typeIndex < _XtGlobalTM.numTypeMatches && j < TM_TYPE_SEGMENT_SIZE;
- j++, typeIndex++)
- {
- typeMatch = &(segment[j]);
- if (event->eventType == typeMatch->eventType &&
- event->eventCode == typeMatch->eventCode &&
- event->eventCodeMask == typeMatch->eventCodeMask &&
- event->matchEvent == typeMatch->matchEvent) {
- UNLOCK_PROCESS;
- return typeIndex;
- }
- }
- }
-
- if (j == TM_TYPE_SEGMENT_SIZE) {
- if (_XtGlobalTM.numTypeMatchSegments == _XtGlobalTM.typeMatchSegmentTblSize) {
- _XtGlobalTM.typeMatchSegmentTblSize += 4;
- _XtGlobalTM.typeMatchSegmentTbl = (TMTypeMatch *)
- XtRealloc((char *)_XtGlobalTM.typeMatchSegmentTbl,
- (_XtGlobalTM.typeMatchSegmentTblSize * sizeof(TMTypeMatch)));
- }
- _XtGlobalTM.typeMatchSegmentTbl[_XtGlobalTM.numTypeMatchSegments++] =
- segment = (TMTypeMatch)
- __XtMalloc(TM_TYPE_SEGMENT_SIZE * sizeof(TMTypeMatchRec));
- j = 0;
- }
- typeMatch = &segment[j];
- typeMatch->eventType = event->eventType;
- typeMatch->eventCode = event->eventCode;
- typeMatch->eventCodeMask = event->eventCodeMask;
- typeMatch->matchEvent = event->matchEvent;
- _XtGlobalTM.numTypeMatches++;
- UNLOCK_PROCESS;
- return typeIndex;
-}
-
-static Boolean CompareLateModifiers(lateBind1P, lateBind2P)
- LateBindingsPtr lateBind1P, lateBind2P;
-{
- LateBindingsPtr late1P = lateBind1P;
- LateBindingsPtr late2P = lateBind2P;
-
- if (late1P != NULL || late2P != NULL) {
- int i = 0;
- int j = 0;
- if (late1P != NULL)
- for (; late1P->keysym != NoSymbol; i++) late1P++;
- if (late2P != NULL)
- for (; late2P->keysym != NoSymbol; j++) late2P++;
- if (i != j) return FALSE;
- late1P--;
- while (late1P >= lateBind1P) {
- Boolean last = True;
- for (late2P = lateBind2P + i - 1;
- late2P >= lateBind2P;
- late2P--) {
- if (late1P->keysym == late2P->keysym
- && late1P->knot == late2P->knot) {
- j--;
- if (last) i--;
- break;
- }
- last = False;
- }
- late1P--;
- }
- if (j != 0) return FALSE;
- }
- return TRUE;
-}
-
-TMShortCard _XtGetModifierIndex(event)
- Event *event;
-{
- TMShortCard i, j = TM_MOD_SEGMENT_SIZE;
- TMShortCard modIndex = 0;
- TMModifierMatch modMatch;
- TMModifierMatch segment;
-
- LOCK_PROCESS;
- for (i = 0; i < _XtGlobalTM.numModMatchSegments; i++) {
- segment = _XtGlobalTM.modMatchSegmentTbl[i];
- for (j = 0;
- modIndex < _XtGlobalTM.numModMatches && j < TM_MOD_SEGMENT_SIZE;
- j++, modIndex++) {
- modMatch = &(segment[j]);
- if (event->modifiers == modMatch->modifiers &&
- event->modifierMask == modMatch->modifierMask &&
- event->standard == modMatch->standard &&
- ((!event->lateModifiers && !modMatch->lateModifiers) ||
- CompareLateModifiers(event->lateModifiers,
- modMatch->lateModifiers))) {
- /*
- * if we found a match then we can free the parser's
- * late modifiers. If there isn't a match we use the
- * parser's copy
- */
- if (event->lateModifiers &&
- --event->lateModifiers->ref_count == 0) {
- XtFree((char *)event->lateModifiers);
- event->lateModifiers = NULL;
- }
- UNLOCK_PROCESS;
- return modIndex;
- }
- }
- }
-
- if (j == TM_MOD_SEGMENT_SIZE) {
- if (_XtGlobalTM.numModMatchSegments == _XtGlobalTM.modMatchSegmentTblSize) {
- _XtGlobalTM.modMatchSegmentTblSize += 4;
- _XtGlobalTM.modMatchSegmentTbl = (TMModifierMatch *)
- XtRealloc((char *)_XtGlobalTM.modMatchSegmentTbl,
- (_XtGlobalTM.modMatchSegmentTblSize * sizeof(TMModifierMatch)));
- }
- _XtGlobalTM.modMatchSegmentTbl[_XtGlobalTM.numModMatchSegments++] =
- segment = (TMModifierMatch)
- __XtMalloc(TM_MOD_SEGMENT_SIZE * sizeof(TMModifierMatchRec));
- j = 0;
- }
- modMatch = &segment[j];
- modMatch->modifiers = event->modifiers;;
- modMatch->modifierMask = event->modifierMask;
- modMatch->standard = event->standard;
- /*
- * We use the parser's copy of the late binding array
- */
-#ifdef TRACE_TM
- if (event->lateModifiers)
- _XtGlobalTM.numLateBindings++;
-#endif /* TRACE_TM */
- modMatch->lateModifiers = event->lateModifiers;
- _XtGlobalTM.numModMatches++;
- UNLOCK_PROCESS;
- return modIndex;
-}
-
-
-/*
- * This is called from the SimpleStateHandler to match a stateTree
- * entry to the event coming in
- */
-static int MatchBranchHead(stateTree, startIndex, event)
- TMSimpleStateTree stateTree;
- int startIndex;
- TMEventPtr event;
-{
- TMBranchHead branchHead = &stateTree->branchHeadTbl[startIndex];
- int i;
-
- LOCK_PROCESS;
- for (i = startIndex;
- i < (int)stateTree->numBranchHeads;
- i++, branchHead++)
- {
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
-
- typeMatch = TMGetTypeMatch(branchHead->typeIndex);
- modMatch = TMGetModifierMatch(branchHead->modIndex);
-
- if (MatchIncomingEvent(event, typeMatch, modMatch)) {
- UNLOCK_PROCESS;
- return i;
- }
- }
- UNLOCK_PROCESS;
- return (TM_NO_MATCH);
-}
-
-Boolean _XtRegularMatch(typeMatch, modMatch, eventSeq)
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- TMEventPtr eventSeq;
-{
- Modifiers computed =0;
- Modifiers computedMask =0;
- Boolean resolved = TRUE;
- if (typeMatch->eventCode != (eventSeq->event.eventCode &
- typeMatch->eventCodeMask)) return FALSE;
- if (modMatch->lateModifiers != NULL)
- resolved = _XtComputeLateBindings(eventSeq->xev->xany.display,
- modMatch->lateModifiers,
- &computed, &computedMask);
- if (!resolved) return FALSE;
- computed |= modMatch->modifiers;
- computedMask |= modMatch->modifierMask;
-
- return ( (computed & computedMask) ==
- (eventSeq->event.modifiers & computedMask));
-}
-
-/*ARGSUSED*/
-Boolean _XtMatchAtom(typeMatch, modMatch, eventSeq)
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- TMEventPtr eventSeq;
-{
- Atom atom;
-
- atom = XInternAtom(eventSeq->xev->xany.display,
- XrmQuarkToString(typeMatch->eventCode),
- False);
- return (atom == eventSeq->event.eventCode);
-}
-
-#define IsOn(vec,idx) ((vec)[(idx)>>3] & (1 << ((idx) & 7)))
-
-/*
- * there are certain cases where you want to ignore the event and stay
- * in the same state.
- */
-static Boolean Ignore(event)
- TMEventPtr event;
-{
- Display *dpy;
- XtPerDisplay pd;
-
- if (event->event.eventType == MotionNotify)
- return TRUE;
- if (!(event->event.eventType == KeyPress ||
- event->event.eventType == KeyRelease))
- return FALSE;
- dpy = event->xev->xany.display;
- pd = _XtGetPerDisplay(dpy);
- _InitializeKeysymTables(dpy, pd);
- return IsOn(pd->isModifier, event->event.eventCode) ? TRUE : FALSE;
-}
-
-
-static void XEventToTMEvent(event, tmEvent)
- XEvent *event;
- TMEventPtr tmEvent;
-{
- tmEvent->xev = event;
- tmEvent->event.eventCodeMask = 0;
- tmEvent->event.modifierMask = 0;
- tmEvent->event.eventType = event->type;
- tmEvent->event.lateModifiers = NULL;
- tmEvent->event.matchEvent = NULL;
- tmEvent->event.standard = FALSE;
-
- switch (event->type) {
-
- case KeyPress:
- case KeyRelease:
- tmEvent->event.eventCode = event->xkey.keycode;
- tmEvent->event.modifiers = event->xkey.state;
- break;
-
- case ButtonPress:
- case ButtonRelease:
- tmEvent->event.eventCode = event->xbutton.button;
- tmEvent->event.modifiers = event->xbutton.state;
- break;
-
- case MotionNotify:
- tmEvent->event.eventCode = event->xmotion.is_hint;
- tmEvent->event.modifiers = event->xmotion.state;
- break;
-
- case EnterNotify:
- case LeaveNotify:
- tmEvent->event.eventCode = event->xcrossing.mode;
- tmEvent->event.modifiers = event->xcrossing.state;
- break;
-
- case PropertyNotify:
- tmEvent->event.eventCode = event->xproperty.atom;
- tmEvent->event.modifiers = 0;
- break;
-
- case SelectionClear:
- tmEvent->event.eventCode = event->xselectionclear.selection;
- tmEvent->event.modifiers = 0;
- break;
-
- case SelectionRequest:
- tmEvent->event.eventCode = event->xselectionrequest.selection;
- tmEvent->event.modifiers = 0;
- break;
-
- case SelectionNotify:
- tmEvent->event.eventCode = event->xselection.selection;
- tmEvent->event.modifiers = 0;
- break;
-
- case ClientMessage:
- tmEvent->event.eventCode = event->xclient.message_type;
- tmEvent->event.modifiers = 0;
- break;
-
- case MappingNotify:
- tmEvent->event.eventCode = event->xmapping.request;
- tmEvent->event.modifiers = 0;
- break;
-
- case FocusIn:
- case FocusOut:
- tmEvent->event.eventCode = event->xfocus.mode;
- tmEvent->event.modifiers = 0;
- break;
-
- default:
- tmEvent->event.eventCode = 0;
- tmEvent->event.modifiers = 0;
- break;
- }
-}
-
-
-static unsigned long GetTime(tm, event)
- XtTM tm;
- XEvent *event;
-{
- switch (event->type) {
-
- case KeyPress:
- case KeyRelease:
- return event->xkey.time;
-
- case ButtonPress:
- case ButtonRelease:
- return event->xbutton.time;
-
- default:
- return tm->lastEventTime;
-
- }
-
-}
-
-static void HandleActions(w, event, stateTree, accelWidget, procs, actions)
- Widget w;
- XEvent *event;
- TMSimpleStateTree stateTree;
- Widget accelWidget;
- XtActionProc *procs;
- ActionRec *actions;
-{
- ActionHook actionHookList;
- Widget bindWidget;
-
- bindWidget = accelWidget ? accelWidget : w;
- if (accelWidget && !XtIsSensitive(accelWidget) &&
- (event->type == KeyPress || event->type == KeyRelease ||
- event->type == ButtonPress || event->type == ButtonRelease ||
- event->type == MotionNotify || event->type == EnterNotify ||
- event->type == LeaveNotify || event->type == FocusIn ||
- event->type == FocusOut))
- return;
-
- actionHookList = XtWidgetToApplicationContext(w)->action_hook_list;
-
- while (actions != NULL) {
- /* perform any actions */
- if (procs[actions->idx] != NULL) {
- if (actionHookList) {
- ActionHook hook;
- ActionHook next_hook;
- String procName =
- XrmQuarkToString(stateTree->quarkTbl[actions->idx] );
-
- for (hook = actionHookList; hook != NULL; ) {
- /*
- * Need to cache hook->next because the following action
- * proc may free hook via XtRemoveActionHook making
- * hook->next invalid upon return from the action proc.
- */
- next_hook = hook->next;
- (*hook->proc)(bindWidget,
- hook->closure,
- procName,
- event,
- actions->params,
- &actions->num_params
- );
- hook = next_hook;
- }
- }
- (*(procs[actions->idx]))
- (bindWidget, event,
- actions->params, &actions->num_params );
- }
- actions = actions->next;
- }
-}
-
-typedef struct {
- unsigned int isCycleStart:1;
- unsigned int isCycleEnd:1;
- TMShortCard typeIndex;
- TMShortCard modIndex;
-}MatchPairRec, *MatchPair;
-
-typedef struct TMContextRec{
- TMShortCard numMatches;
- TMShortCard maxMatches;
- MatchPair matches;
-}TMContextRec, *TMContext;
-
-static TMContextRec contextCache[2];
-
-#define GetContextPtr(tm) ((TMContext *)&(tm->current_state))
-
-#define TM_CONTEXT_MATCHES_ALLOC 4
-#define TM_CONTEXT_MATCHES_REALLOC 2
-
-static void PushContext(contextPtr, newState)
- TMContext *contextPtr;
- StatePtr newState;
-{
- TMContext context = *contextPtr;
-
- LOCK_PROCESS;
- if (context == NULL)
- {
- if (contextCache[0].numMatches == 0)
- context = &contextCache[0];
- else if (contextCache[1].numMatches == 0)
- context = &contextCache[1];
- if (!context)
- {
- context = XtNew(TMContextRec);
- context->matches = NULL;
- context->numMatches =
- context->maxMatches = 0;
- }
- }
- if (context->numMatches &&
- context->matches[context->numMatches-1].isCycleEnd)
- {
- TMShortCard i;
- for (i = 0;
- i < context->numMatches &&
- !(context->matches[i].isCycleStart);
- i++){};
- if (i < context->numMatches)
- context->numMatches = i+1;
-#ifdef DEBUG
- else
- XtWarning("pushing cycle end with no cycle start");
-#endif /* DEBUG */
- }
- else
- {
- if (context->numMatches == context->maxMatches)
- {
- if (context->maxMatches == 0)
- context->maxMatches += TM_CONTEXT_MATCHES_ALLOC;
- else
- context->maxMatches += TM_CONTEXT_MATCHES_REALLOC;
- context->matches = (MatchPairRec *)
- XtRealloc((char *)context->matches,
- context->maxMatches * sizeof(MatchPairRec));
- }
- context->matches[context->numMatches].isCycleStart = newState->isCycleStart;
- context->matches[context->numMatches].isCycleEnd = newState->isCycleEnd;
- context->matches[context->numMatches].typeIndex = newState->typeIndex;
- context->matches[context->numMatches++].modIndex = newState->modIndex;
- *contextPtr = context;
- }
- UNLOCK_PROCESS;
-}
-
-static void FreeContext(contextPtr)
- TMContext *contextPtr;
-{
- TMContext context = NULL;
-
- LOCK_PROCESS;
-
- if (&contextCache[0] == *contextPtr)
- context = &contextCache[0];
- else if (&contextCache[1] == *contextPtr)
- context = &contextCache[1];
-
- if (context)
- context->numMatches = 0;
- else if (*contextPtr)
- {
- if ((*contextPtr)->matches)
- XtFree ((char *) ((*contextPtr)->matches));
- XtFree((char *)*contextPtr);
- }
-
- *contextPtr = NULL;
- UNLOCK_PROCESS;
-}
-
-static int MatchExact(stateTree, startIndex, typeIndex, modIndex)
- TMSimpleStateTree stateTree;
- int startIndex;
- TMShortCard typeIndex, modIndex;
-{
- TMBranchHead branchHead = &(stateTree->branchHeadTbl[startIndex]);
- int i;
-
- for (i = startIndex;
- i < (int)stateTree->numBranchHeads;
- i++, branchHead++)
- {
- if ((branchHead->typeIndex == typeIndex) &&
- (branchHead->modIndex == modIndex))
- return i;
- }
- return (TM_NO_MATCH);
-}
-
-
-
-static void HandleSimpleState(w, tmRecPtr, curEventPtr)
- Widget w;
- XtTM tmRecPtr;
- TMEventRec *curEventPtr;
-{
- XtTranslations xlations = tmRecPtr->translations;
- TMSimpleStateTree stateTree;
- TMContext *contextPtr = GetContextPtr(tmRecPtr);
- TMShortCard i;
- ActionRec *actions;
- Boolean matchExact = False;
- Boolean match = False;
- StatePtr complexMatchState = NULL;
- int currIndex;
- TMShortCard typeIndex, modIndex;
- int matchTreeIndex = TM_NO_MATCH;
-
- LOCK_PROCESS;
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[0];
-
- for (i = 0;
- ((!match || !complexMatchState) && (i < xlations->numStateTrees));
- i++){
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i];
- currIndex = -1;
- /*
- * don't process this tree if we're only looking for a
- * complexMatchState and there are no complex states
- */
- while (!(match && stateTree->isSimple) &&
- ((!match || !complexMatchState) && (currIndex != TM_NO_MATCH))) {
- currIndex++;
- if (matchExact)
- currIndex = MatchExact(stateTree,currIndex,typeIndex,modIndex);
- else
- currIndex = MatchBranchHead(stateTree,currIndex,curEventPtr);
- if (currIndex != TM_NO_MATCH) {
- TMBranchHead branchHead;
- StatePtr currState;
-
- branchHead = &stateTree->branchHeadTbl[currIndex];
- if (branchHead->isSimple)
- currState = NULL;
- else
- currState = ((TMComplexStateTree)stateTree)
- ->complexBranchHeadTbl[TMBranchMore(branchHead)];
-
- /*
- * first check for a complete match
- */
- if (!match) {
- if (branchHead->hasActions) {
- if (branchHead->isSimple) {
- static ActionRec dummyAction;
-
- dummyAction.idx = TMBranchMore(branchHead);
- actions = &dummyAction;
- }
- else
- actions = currState->actions;
- tmRecPtr->lastEventTime =
- GetTime(tmRecPtr, curEventPtr->xev);
- FreeContext((TMContext
- *)&tmRecPtr->current_state);
- match = True;
- matchTreeIndex = i;
- }
- /*
- * if it doesn't have actions and
- * it's bc mode then it's a potential match node that is
- * used to match later sequences.
- */
- if (!TMNewMatchSemantics() && !matchExact) {
- matchExact = True;
- typeIndex = branchHead->typeIndex;
- modIndex = branchHead->modIndex;
- }
- }
- /*
- * check for it being an event sequence which can be
- * a future match
- */
- if (!branchHead->isSimple &&
- !branchHead->hasActions &&
- !complexMatchState)
- complexMatchState = currState;
- }
- }
- }
- if (match)
- {
- TMBindData bindData = (TMBindData) tmRecPtr->proc_table;
- XtActionProc *procs;
- Widget accelWidget;
-
- if (bindData->simple.isComplex) {
- TMComplexBindProcs bindProcs =
- TMGetComplexBindEntry(bindData, matchTreeIndex);
- procs = bindProcs->procs;
- accelWidget = bindProcs->widget;
- }
- else {
- TMSimpleBindProcs bindProcs =
- TMGetSimpleBindEntry(bindData, matchTreeIndex);
- procs = bindProcs->procs;
- accelWidget = NULL;
- }
- HandleActions
- (w,
- curEventPtr->xev,
- (TMSimpleStateTree)xlations->stateTreeTbl[matchTreeIndex],
- accelWidget,
- procs,
- actions);
- }
- if (complexMatchState)
- PushContext(contextPtr, complexMatchState);
- UNLOCK_PROCESS;
-}
-
-static int MatchComplexBranch(stateTree, startIndex, context, leafStateRtn)
- TMComplexStateTree stateTree;
- int startIndex;
- TMContext context;
- StatePtr *leafStateRtn;
-{
- TMShortCard i;
-
- LOCK_PROCESS;
- for (i = startIndex; i < stateTree->numComplexBranchHeads; i++)
- {
- StatePtr candState;
- TMShortCard numMatches = context->numMatches;
- MatchPair statMatch = context->matches;
-
- for (candState = stateTree->complexBranchHeadTbl[i];
- numMatches && candState;
- numMatches--, statMatch++, candState = candState->nextLevel)
- {
- if ((statMatch->typeIndex != candState->typeIndex) ||
- (statMatch->modIndex != candState->modIndex))
- break;
- }
- if (numMatches == 0) {
- *leafStateRtn = candState;
- UNLOCK_PROCESS;
- return i;
- }
- }
- *leafStateRtn = NULL;
- UNLOCK_PROCESS;
- return (TM_NO_MATCH);
-}
-
-static StatePtr TryCurrentTree(stateTreePtr, tmRecPtr, curEventPtr)
- TMComplexStateTree *stateTreePtr;
- XtTM tmRecPtr;
- TMEventRec *curEventPtr;
-{
- StatePtr candState = NULL, matchState = NULL;
- TMContext *contextPtr = GetContextPtr(tmRecPtr);
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
- int currIndex = -1;
-
- /*
- * we want the first sequence that both matches and has actions.
- * we keep on looking till we find both
- */
- LOCK_PROCESS;
- while ((currIndex =
- MatchComplexBranch(*stateTreePtr,
- ++currIndex,
- (*contextPtr),
- &candState))
- != TM_NO_MATCH) {
- if (candState != NULL) {
- typeMatch = TMGetTypeMatch(candState->typeIndex);
- modMatch = TMGetModifierMatch(candState->modIndex);
-
- /* does this state's index match? --> done */
- if (MatchIncomingEvent(curEventPtr, typeMatch, modMatch))
- {
- if (candState->actions) {
- UNLOCK_PROCESS;
- return candState;
- }
- else
- matchState = candState;
- }
- /* is this an event timer? */
- if (typeMatch->eventType == _XtEventTimerEventType) {
- StatePtr nextState = candState->nextLevel;
-
- /* does the succeeding state match? */
- if (nextState != NULL) {
- TMTypeMatch nextTypeMatch;
- TMModifierMatch nextModMatch;
-
- nextTypeMatch = TMGetTypeMatch(nextState->typeIndex);
- nextModMatch = TMGetModifierMatch(nextState->modIndex);
-
- /* is it within the timeout? */
- if (MatchIncomingEvent(curEventPtr,
- nextTypeMatch,
- nextModMatch)) {
- XEvent *xev = curEventPtr->xev;
- unsigned long time = GetTime(tmRecPtr, xev);
- XtPerDisplay pd = _XtGetPerDisplay(xev->xany.display);
- unsigned long delta = pd->multi_click_time;
-
- if ((tmRecPtr->lastEventTime + delta) >= time) {
- if (nextState->actions) {
- UNLOCK_PROCESS;
- return candState;
- }
- else
- matchState = candState;
- }
- }
- }
- }
- }
- }
- UNLOCK_PROCESS;
- return matchState;
-}
-
-static void HandleComplexState(w, tmRecPtr, curEventPtr)
- Widget w;
- XtTM tmRecPtr;
- TMEventRec *curEventPtr;
-{
- XtTranslations xlations = tmRecPtr->translations;
- TMContext *contextPtr = GetContextPtr(tmRecPtr);
- TMShortCard i, matchTreeIndex;
- StatePtr matchState = NULL, candState;
- TMComplexStateTree *stateTreePtr =
- (TMComplexStateTree *)&xlations->stateTreeTbl[0];
-
- LOCK_PROCESS;
- for (i = 0;
- i < xlations->numStateTrees;
- i++, stateTreePtr++) {
- /*
- * some compilers sign extend Boolean bit fields so test for
- * false |||
- */
- if (((*stateTreePtr)->isSimple == False) &&
- (candState = TryCurrentTree(stateTreePtr,
- tmRecPtr,
- curEventPtr))) {
- if (!matchState || candState->actions) {
- matchTreeIndex = i;
- matchState = candState;
- if (candState->actions)
- break;
- }
- }
- }
- if (matchState == NULL){
- /* couldn't find it... */
- if (!Ignore(curEventPtr))
- {
- FreeContext(contextPtr);
- HandleSimpleState(w, tmRecPtr, curEventPtr);
- }
- }
- else {
- TMBindData bindData = (TMBindData) tmRecPtr->proc_table;
- XtActionProc *procs;
- Widget accelWidget;
- TMTypeMatch typeMatch;
-
- typeMatch = TMGetTypeMatch(matchState->typeIndex);
-
- PushContext(contextPtr, matchState);
- if (typeMatch->eventType == _XtEventTimerEventType) {
- matchState = matchState->nextLevel;
- PushContext(contextPtr, matchState);
- }
- tmRecPtr->lastEventTime = GetTime (tmRecPtr, curEventPtr->xev);
-
- if (bindData->simple.isComplex) {
- TMComplexBindProcs bindProcs =
- TMGetComplexBindEntry(bindData, matchTreeIndex);
- procs = bindProcs->procs;
- accelWidget = bindProcs->widget;
- }
- else {
- TMSimpleBindProcs bindProcs =
- TMGetSimpleBindEntry(bindData, matchTreeIndex);
- procs = bindProcs->procs;
- accelWidget = NULL;
- }
- HandleActions(w,
- curEventPtr->xev,
- (TMSimpleStateTree)
- xlations->stateTreeTbl[matchTreeIndex],
- accelWidget,
- procs,
- matchState->actions);
- }
- UNLOCK_PROCESS;
-}
-
-
-void _XtTranslateEvent (w, event)
- Widget w;
- XEvent * event;
-{
- XtTM tmRecPtr = &w->core.tm;
- TMEventRec curEvent;
- StatePtr current_state = tmRecPtr->current_state;
-
- XEventToTMEvent (event, &curEvent);
-
- if (! tmRecPtr->translations) {
- XtAppWarningMsg(XtWidgetToApplicationContext(w),
- XtNtranslationError,"nullTable",XtCXtToolkitError,
- "Can't translate event through NULL table",
- (String *)NULL, (Cardinal *)NULL);
- return ;
- }
- if (current_state == NULL)
- HandleSimpleState(w, tmRecPtr, &curEvent);
- else
- HandleComplexState(w, tmRecPtr, &curEvent);
-}
-
-
-/*ARGSUSED*/
-static StatePtr NewState(stateTree, typeIndex, modIndex)
- TMParseStateTree stateTree;
- TMShortCard typeIndex, modIndex;
-{
- StatePtr state = XtNew(StateRec);
-
-#ifdef TRACE_TM
- LOCK_PROCESS;
- _XtGlobalTM.numComplexStates++;
- UNLOCK_PROCESS;
-#endif /* TRACE_TM */
- state->typeIndex = typeIndex;
- state->modIndex = modIndex;
- state->nextLevel = NULL;
- state->actions = NULL;
- state->isCycleStart = state->isCycleEnd = False;
- return state;
-}
-
-/*
- * This routine is an iterator for state trees. If the func returns
- * true then iteration is over.
- */
-void _XtTraverseStateTree(tree, func, data)
- TMStateTree tree;
- _XtTraversalProc func;
- XtPointer data;
-{
- TMComplexStateTree stateTree = (TMComplexStateTree)tree;
- TMBranchHead currBH;
- TMShortCard i;
- StateRec dummyStateRec, *dummyState = &dummyStateRec;
- ActionRec dummyActionRec, *dummyAction = &dummyActionRec;
- Boolean firstSimple = True;
- StatePtr currState;
-
- /* first traverse the complex states */
- if (stateTree->isSimple == False)
- for (i = 0; i < stateTree->numComplexBranchHeads; i++) {
- currState = stateTree->complexBranchHeadTbl[i];
- for (; currState; currState = currState->nextLevel) {
- if (func(currState, data))
- return;
- if (currState->isCycleEnd)
- break;
- }
- }
-
- /* now traverse the simple ones */
- for (i = 0, currBH = stateTree->branchHeadTbl;
- i < stateTree->numBranchHeads;
- i++, currBH++)
- {
- if (currBH->isSimple && currBH->hasActions)
- {
- if (firstSimple)
- {
- XtBZero((char *) dummyState, sizeof(StateRec));
- XtBZero((char *) dummyAction, sizeof(ActionRec));
- dummyState->actions = dummyAction;
- firstSimple = False;
- }
- dummyState->typeIndex = currBH->typeIndex;
- dummyState->modIndex = currBH->modIndex;
- dummyAction->idx = currBH->more;
- if (func(dummyState, data))
- return;
- }
- }
-}
-
-static EventMask EventToMask(typeMatch, modMatch)
- TMTypeMatch typeMatch;
- TMModifierMatch modMatch;
-{
- EventMask returnMask;
- unsigned long eventType = typeMatch->eventType;
-
- if (eventType == MotionNotify) {
- Modifiers modifierMask = modMatch->modifierMask;
- Modifiers tempMask;
-
- returnMask = 0;
- if (modifierMask == 0) {
- if (modMatch->modifiers == AnyButtonMask)
- return ButtonMotionMask;
- else
- return PointerMotionMask;
- }
- tempMask = modifierMask &
- (Button1Mask | Button2Mask | Button3Mask
- | Button4Mask | Button5Mask);
- if (tempMask == 0)
- return PointerMotionMask;
- if (tempMask & Button1Mask)
- returnMask |= Button1MotionMask;
- if (tempMask & Button2Mask)
- returnMask |= Button2MotionMask;
- if (tempMask & Button3Mask)
- returnMask |= Button3MotionMask;
- if (tempMask & Button4Mask)
- returnMask |= Button4MotionMask;
- if (tempMask & Button5Mask)
- returnMask |= Button5MotionMask;
- return returnMask;
- }
- returnMask = _XtConvertTypeToMask(eventType);
- if (returnMask == (StructureNotifyMask|SubstructureNotifyMask))
- returnMask = StructureNotifyMask;
- return returnMask;
-}
-
-/*ARGSUSED*/
-static void DispatchMappingNotify(widget, closure, call_data)
- Widget widget; /* will be NULL from _RefreshMapping */
- XtPointer closure; /* real Widget */
- XtPointer call_data; /* XEvent* */
-{
- _XtTranslateEvent( (Widget)closure, (XEvent*)call_data);
-}
-
-
-/*ARGSUSED*/
-static void RemoveFromMappingCallbacks(widget, closure, call_data)
- Widget widget;
- XtPointer closure; /* target widget */
- XtPointer call_data;
-{
- _XtRemoveCallback( &_XtGetPerDisplay(XtDisplay(widget))->mapping_callbacks,
- DispatchMappingNotify,
- closure
- );
-}
-
-static Boolean AggregateEventMask(state, data)
- StatePtr state;
- XtPointer data;
-{
- LOCK_PROCESS;
- *((EventMask *)data) |= EventToMask(TMGetTypeMatch(state->typeIndex),
- TMGetModifierMatch(state->modIndex));
- UNLOCK_PROCESS;
- return False;
-}
-
-void _XtInstallTranslations(widget)
- Widget widget;
-{
- XtTranslations xlations;
- Cardinal i;
- TMStateTree stateTree;
- Boolean mappingNotifyInterest = False;
-
- xlations = widget->core.tm.translations;
- if (xlations == NULL) return;
-
- /*
- * check for somebody stuffing the translations directly into the
- * instance structure. We will end up being called again out of
- * ComposeTranslations but we *should* have bindings by then
- */
- if (widget->core.tm.proc_table == NULL) {
- _XtMergeTranslations(widget, NULL, XtTableReplace);
- /*
- * if we're realized then we'll be called out of
- * ComposeTranslations
- */
- if (XtIsRealized(widget))
- return;
- }
-
- xlations->eventMask = 0;
- for (i = 0;
- i < xlations->numStateTrees;
- i++)
- {
- stateTree = xlations->stateTreeTbl[i];
- _XtTraverseStateTree(stateTree,
- AggregateEventMask,
- (XtPointer)&xlations->eventMask);
- mappingNotifyInterest |= stateTree->simple.mappingNotifyInterest;
- }
- /* double click needs to make sure that you have selected on both
- button down and up. */
-
- if (xlations->eventMask & ButtonPressMask)
- xlations->eventMask |= ButtonReleaseMask;
- if (xlations->eventMask & ButtonReleaseMask)
- xlations->eventMask |= ButtonPressMask;
-
- if (mappingNotifyInterest) {
- XtPerDisplay pd = _XtGetPerDisplay(XtDisplay(widget));
- if (pd->mapping_callbacks)
- _XtAddCallbackOnce(&(pd->mapping_callbacks),
- DispatchMappingNotify,
- (XtPointer)widget);
- else
- _XtAddCallback(&(pd->mapping_callbacks),
- DispatchMappingNotify,
- (XtPointer)widget);
-
- if (widget->core.destroy_callbacks != NULL)
- _XtAddCallbackOnce( (InternalCallbackList *)
- &widget->core.destroy_callbacks,
- RemoveFromMappingCallbacks,
- (XtPointer)widget
- );
- else
- _XtAddCallback((InternalCallbackList *)
- &widget->core.destroy_callbacks,
- RemoveFromMappingCallbacks,
- (XtPointer)widget
- );
- }
- _XtBindActions(widget, (XtTM)&widget->core.tm);
- _XtRegisterGrabs(widget);
-}
-
-void _XtRemoveTranslations(widget)
- Widget widget;
-{
- Cardinal i;
- TMSimpleStateTree stateTree;
- Boolean mappingNotifyInterest = False;
- XtTranslations xlations = widget->core.tm.translations;
-
- if (xlations == NULL)
- return;
-
- for (i = 0;
- i < xlations->numStateTrees;
- i++)
- {
- stateTree = (TMSimpleStateTree)xlations->stateTreeTbl[i];
- mappingNotifyInterest |= stateTree->mappingNotifyInterest;
- }
- if (mappingNotifyInterest)
- RemoveFromMappingCallbacks(widget, (XtPointer)widget, NULL);
-}
-
-static void _XtUninstallTranslations(widget)
- Widget widget;
-{
- XtTranslations xlations = widget->core.tm.translations;
-
- _XtUnbindActions(widget,
- xlations,
- (TMBindData)widget->core.tm.proc_table);
- _XtRemoveTranslations(widget);
- widget->core.tm.translations = NULL;
- FreeContext((TMContext *)&widget->core.tm.current_state);
-}
-
-void _XtDestroyTMData(widget)
- Widget widget;
-{
- TMComplexBindData cBindData;
-
- _XtUninstallTranslations(widget);
-
- if (cBindData = (TMComplexBindData)widget->core.tm.proc_table) {
- if (cBindData->isComplex) {
- ATranslations aXlations, nXlations;
-
- nXlations = (ATranslations) cBindData->accel_context;
- while (nXlations){
- aXlations = nXlations;
- nXlations = nXlations->next;
- XtFree((char *)aXlations);
- }
- }
- XtFree((char *)cBindData);
- }
-}
-
-/*** Public procedures ***/
-
-
-void XtUninstallTranslations(widget)
- Widget widget;
-{
- EventMask oldMask;
- Widget hookobj;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- if (! widget->core.tm.translations) {
- UNLOCK_APP(app);
- return;
- }
- oldMask = widget->core.tm.translations->eventMask;
- _XtUninstallTranslations(widget);
- if (XtIsRealized(widget) && oldMask)
- XSelectInput(XtDisplay(widget), XtWindow(widget),
- XtBuildEventMask(widget));
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHuninstallTranslations;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_APP(app);
-}
-
-#if NeedFunctionPrototypes
-XtTranslations _XtCreateXlations(
- TMStateTree *stateTrees,
- TMShortCard numStateTrees,
- XtTranslations first,
- XtTranslations second)
-#else
-XtTranslations _XtCreateXlations(stateTrees, numStateTrees, first, second)
- TMStateTree *stateTrees;
- TMShortCard numStateTrees;
- XtTranslations first, second;
-#endif
-{
- XtTranslations xlations;
- TMShortCard i;
-
- xlations = (XtTranslations)
- __XtMalloc(sizeof(TranslationData) +
- (numStateTrees-1) * sizeof(TMStateTree));
-#ifdef TRACE_TM
- LOCK_PROCESS;
- if (_XtGlobalTM.numTms == _XtGlobalTM.tmTblSize) {
- _XtGlobalTM.tmTblSize += 16;
- _XtGlobalTM.tmTbl = (XtTranslations *)
- XtRealloc((char *)_XtGlobalTM.tmTbl,
- _XtGlobalTM.tmTblSize * sizeof(XtTranslations));
- }
- _XtGlobalTM.tmTbl[_XtGlobalTM.numTms++] = xlations;
- UNLOCK_PROCESS;
-#endif /* TRACE_TM */
-
- xlations->composers[0] = first;
- xlations->composers[1] = second;
- xlations->hasBindings = False;
- xlations->operation = XtTableReplace;
-
- for (i = 0;i < numStateTrees; i++)
- {
- xlations->stateTreeTbl[i] = (TMStateTree) stateTrees[i];
- stateTrees[i]->simple.refCount++;
- }
- xlations->numStateTrees = numStateTrees;
- xlations->eventMask = 0;
- return xlations;
-}
-
-TMStateTree _XtParseTreeToStateTree(parseTree)
- TMParseStateTree parseTree;
-{
- TMSimpleStateTree simpleTree;
- unsigned int tableSize;
-
- if (parseTree->numComplexBranchHeads) {
- TMComplexStateTree complexTree;
-
- complexTree = XtNew(TMComplexStateTreeRec);
- complexTree->isSimple = False;
- tableSize = parseTree->numComplexBranchHeads * sizeof(StatePtr);
- complexTree->complexBranchHeadTbl = (StatePtr *)
- __XtMalloc(tableSize);
- XtMemmove(complexTree->complexBranchHeadTbl,
- parseTree->complexBranchHeadTbl, tableSize);
- complexTree->numComplexBranchHeads =
- parseTree->numComplexBranchHeads;
- simpleTree = (TMSimpleStateTree)complexTree;
- }
- else {
- simpleTree = XtNew(TMSimpleStateTreeRec);
- simpleTree->isSimple = True;
- }
- simpleTree->isAccelerator = parseTree->isAccelerator;
- simpleTree->refCount = 0;
- simpleTree->mappingNotifyInterest = parseTree->mappingNotifyInterest;
-
- tableSize = parseTree->numBranchHeads * sizeof(TMBranchHeadRec);
- simpleTree->branchHeadTbl = (TMBranchHead)
- __XtMalloc(tableSize);
- XtMemmove(simpleTree->branchHeadTbl, parseTree->branchHeadTbl, tableSize);
- simpleTree->numBranchHeads = parseTree->numBranchHeads;
-
- tableSize = parseTree->numQuarks * sizeof(XrmQuark);
- simpleTree->quarkTbl = (XrmQuark *) __XtMalloc(tableSize);
- XtMemmove(simpleTree->quarkTbl, parseTree->quarkTbl, tableSize);
- simpleTree->numQuarks = parseTree->numQuarks;
-
- return (TMStateTree)simpleTree;
-}
-
-static void FreeActions(actions)
- ActionPtr actions;
-{
- ActionPtr action;
- TMShortCard i;
- for (action = actions; action;) {
- ActionPtr nextAction = action->next;
- for (i = action->num_params; i;) {
- XtFree( action->params[--i] );
- }
- XtFree( (char*)action->params );
- XtFree((char*) action);
- action = nextAction;
- }
-}
-
-/*ARGSUSED*/
-static void AmbigActions(initialEvent, state, stateTree)
- EventSeqPtr initialEvent;
- StatePtr *state;
- TMParseStateTree stateTree;
-{
- String params[3];
- Cardinal numParams = 0;
-
- params[numParams++] = _XtPrintEventSeq(initialEvent, NULL);
- params[numParams++] = _XtPrintActions((*state)->actions,
- stateTree->quarkTbl);
- XtWarningMsg (XtNtranslationError,"oldActions",XtCXtToolkitError,
- "Previous entry was: %s %s", params, &numParams);
- XtFree((char *)params[0]);
- XtFree((char *)params[1]);
- numParams = 0;
- params[numParams++] = _XtPrintActions(initialEvent->actions,
- stateTree->quarkTbl);
- XtWarningMsg (XtNtranslationError,"newActions",XtCXtToolkitError,
- "New actions are:%s", params, &numParams);
- XtFree((char *)params[0]);
- XtWarningMsg (XtNtranslationError,"ambiguousActions",
- XtCXtToolkitError,
- "Overriding earlier translation manager actions.",
- (String *)NULL, (Cardinal *)NULL);
-
- FreeActions((*state)->actions);
- (*state)->actions = NULL;
-}
-
-
-void _XtAddEventSeqToStateTree(eventSeq, stateTree)
- EventSeqPtr eventSeq;
- TMParseStateTree stateTree;
-{
- StatePtr *state;
- EventSeqPtr initialEvent = eventSeq;
- TMBranchHead branchHead;
- TMShortCard idx, modIndex, typeIndex;
-
- if (eventSeq == NULL) return;
-
- /* note that all states in the event seq passed in start out null */
- /* we fill them in with the matching state as we traverse the list */
-
- /*
- * We need to free the parser data structures !!!
- */
-
- typeIndex = _XtGetTypeIndex(&eventSeq->event);
- modIndex = _XtGetModifierIndex(&eventSeq->event);
- idx = GetBranchHead(stateTree, typeIndex, modIndex, False);
- branchHead = &stateTree->branchHeadTbl[idx];
-
- /*
- * Need to check for pre-existing actions with same lhs |||
- */
-
- /*
- * Check for optimized case. Don't assume that the eventSeq has actions.
- */
- if (!eventSeq->next &&
- eventSeq->actions &&
- !eventSeq->actions->next &&
- !eventSeq->actions->num_params)
- {
- if (eventSeq->event.eventType == MappingNotify)
- stateTree->mappingNotifyInterest = True;
- branchHead->hasActions = True;
- branchHead->more = eventSeq->actions->idx;
- FreeActions(eventSeq->actions);
- eventSeq->actions = NULL;
- return;
- }
-
- branchHead->isSimple = False;
- if (!eventSeq->next)
- branchHead->hasActions = True;
- branchHead->more = GetComplexBranchIndex(stateTree, typeIndex, modIndex);
- state = &stateTree->complexBranchHeadTbl[TMBranchMore(branchHead)];
-
- for (;;) {
- *state = NewState(stateTree, typeIndex, modIndex);
-
- if (eventSeq->event.eventType == MappingNotify)
- stateTree->mappingNotifyInterest = True;
-
- /* *state now points at state record matching event */
- eventSeq->state = *state;
-
- if (eventSeq->actions != NULL) {
- if ((*state)->actions != NULL)
- AmbigActions(initialEvent, state, stateTree);
- (*state)->actions = eventSeq->actions;
-#ifdef TRACE_TM
- LOCK_PROCESS
- _XtGlobalTM.numComplexActions++;
- UNLOCK_PROCESS;
-#endif /* TRACE_TM */
- }
-
- if (((eventSeq = eventSeq->next) == NULL) || (eventSeq->state))
- break;
-
- state = &(*state)->nextLevel;
- typeIndex = _XtGetTypeIndex(&eventSeq->event);
- modIndex = _XtGetModifierIndex(&eventSeq->event);
- LOCK_PROCESS;
- if (!TMNewMatchSemantics()) {
- /*
- * force a potential empty entry into the branch head
- * table in order to emulate old matching behavior
- */
- (void) GetBranchHead(stateTree, typeIndex, modIndex, True);
- }
- UNLOCK_PROCESS;
- }
-
- if (eventSeq && eventSeq->state) {
- /* we've been here before... must be a cycle in the event seq. */
- branchHead->hasCycles = True;
- (*state)->nextLevel = eventSeq->state;
- eventSeq->state->isCycleStart = True;
- (*state)->isCycleEnd = TRUE;
- }
-}
-
-
-/*
- * Internal Converter for merging. Old and New must both be valid xlations
- */
-
-/*ARGSUSED*/
-Boolean _XtCvtMergeTranslations(dpy, args, num_args, from, to, closure_ret)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr from,to;
- XtPointer *closure_ret;
-{
- XtTranslations first, second, xlations;
- TMStateTree *stateTrees, stackStateTrees[16];
- TMShortCard numStateTrees, i;
-
- if (*num_args != 0)
- XtWarningMsg("invalidParameters","mergeTranslations",XtCXtToolkitError,
- "MergeTM to TranslationTable needs no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- if (to->addr != NULL && to->size < sizeof(XtTranslations)) {
- to->size = sizeof(XtTranslations);
- return False;
- }
-
- first = ((TMConvertRec*)from->addr)->old;
- second = ((TMConvertRec*)from->addr)->new;
-
- numStateTrees = first->numStateTrees + second->numStateTrees;
-
- stateTrees = (TMStateTree *)
- XtStackAlloc(numStateTrees * sizeof(TMStateTree), stackStateTrees);
-
- for (i = 0; i < first->numStateTrees; i++)
- stateTrees[i] = first->stateTreeTbl[i];
- for (i = 0; i < second->numStateTrees; i++)
- stateTrees[i + first->numStateTrees] = second->stateTreeTbl[i];
-
- xlations = _XtCreateXlations(stateTrees, numStateTrees, first, second);
-
- if (to->addr != NULL) {
- *(XtTranslations*)to->addr = xlations;
- }
- else {
- static XtTranslations staticStateTable;
- staticStateTable = xlations;
- to->addr= (XPointer)&staticStateTable;
- to->size = sizeof(XtTranslations);
- }
-
- XtStackFree((XtPointer)stateTrees, (XtPointer)stackStateTrees);
- return True;
-}
-
-
-static XtTranslations MergeThem(dest, first, second)
- Widget dest;
- XtTranslations first, second;
-{
- XtCacheRef cache_ref;
- static XrmQuark from_type = NULLQUARK, to_type;
- XrmValue from, to;
- TMConvertRec convert_rec;
- XtTranslations newTable;
-
- LOCK_PROCESS;
- if (from_type == NULLQUARK) {
- from_type = XrmPermStringToQuark(_XtRStateTablePair);
- to_type = XrmPermStringToQuark(XtRTranslationTable);
- }
- UNLOCK_PROCESS;
- from.addr = (XPointer)&convert_rec;
- from.size = sizeof(TMConvertRec);
- to.addr = (XPointer)&newTable;
- to.size = sizeof(XtTranslations);
- convert_rec.old = first;
- convert_rec.new = second;
-
- LOCK_PROCESS;
- if (! _XtConvert(dest, from_type, &from, to_type, &to, &cache_ref)) {
- UNLOCK_PROCESS;
- return NULL;
- }
- UNLOCK_PROCESS;
- if (cache_ref)
- XtAddCallback(dest, XtNdestroyCallback,
- XtCallbackReleaseCacheRef, (XtPointer)cache_ref);
- return newTable;
-}
-
-/*
- * Unmerge will recursively traverse the xlation compose tree and
- * generate a new xlation that is the result of all instances of
- * xlations being removed. It currently doesn't differentiate between
- * the potential that an xlation will be both an accelerator and
- * normal. This is not supported by the spec anyway.
- */
-static XtTranslations UnmergeTranslations(widget, xlations, unmergeXlations,
- currIndex,
- oldBindings, numOldBindings,
- newBindings, numNewBindingsRtn)
- Widget widget;
- XtTranslations xlations, unmergeXlations;
- TMComplexBindProcs oldBindings, newBindings;
- TMShortCard currIndex, numOldBindings, *numNewBindingsRtn;
-
-{
- XtTranslations first, second, result;
-
- if (!xlations || (xlations == unmergeXlations))
- return NULL;
-
- if (xlations->composers[0]) {
- first = UnmergeTranslations(widget, xlations->composers[0],
- unmergeXlations, currIndex,
- oldBindings, numOldBindings,
- newBindings, numNewBindingsRtn);
- }
- else
- first = NULL;
-
- if (xlations->composers[1]) {
- second = UnmergeTranslations(widget, xlations->composers[1],
- unmergeXlations,
- currIndex +
- xlations->composers[0]->numStateTrees,
- oldBindings, numOldBindings,
- newBindings, numNewBindingsRtn);
- }
- else
- second = NULL;
-
- if (first || second) {
- if (first && second) {
- if ((first != xlations->composers[0]) ||
- (second != xlations->composers[1]))
- result = MergeThem(widget, first, second);
- else result = xlations;
- }
- else {
- if (first)
- result = first;
- else
- result = second;
- }
- } else { /* only update for leaf nodes */
- if (numOldBindings) {
- Cardinal i;
- for (i = 0; i < xlations->numStateTrees; i++) {
- if (xlations->stateTreeTbl[i]->simple.isAccelerator)
- newBindings[*numNewBindingsRtn] =
- oldBindings[currIndex + i];
- (*numNewBindingsRtn)++;
- }
- }
- result = xlations;
- }
- return result;
-}
-
-typedef struct {
- XtTranslations xlations;
- TMComplexBindProcs bindings;
-}MergeBindRec, *MergeBind;
-
-static XtTranslations MergeTranslations(widget, oldXlations, newXlations,
- operation, source, oldBindings,
- newBindings, numNewRtn)
- Widget widget;
- XtTranslations oldXlations, newXlations;
- _XtTranslateOp operation;
- TMComplexBindProcs oldBindings, newBindings;
- Widget source;
- TMShortCard *numNewRtn;
-{
- XtTranslations newTable, xlations;
- TMComplexBindProcs bindings;
- TMShortCard i, j;
- TMStateTree *treePtr;
- TMShortCard numNew = *numNewRtn;
- MergeBindRec bindPair[2];
-
- /* If the new translation has an accelerator context then pull it
- * off and pass it and the real xlations in to the caching merge
- * routine.
- */
- if (newXlations->hasBindings) {
- xlations = ((ATranslations) newXlations)->xlations;
- bindings = (TMComplexBindProcs)
- &((ATranslations) newXlations)->bindTbl[0];
- }
- else {
- xlations = newXlations;
- bindings = NULL;
- }
- switch(operation) {
- case XtTableReplace:
- newTable = bindPair[0].xlations = xlations;
- bindPair[0].bindings = bindings;
- bindPair[1].xlations = NULL;
- bindPair[1].bindings = NULL;
- break;
- case XtTableAugment:
- bindPair[0].xlations = oldXlations;
- bindPair[0].bindings = oldBindings;
- bindPair[1].xlations = xlations;
- bindPair[1].bindings = bindings;
- newTable = NULL;
- break;
- case XtTableOverride:
- bindPair[0].xlations = xlations;
- bindPair[0].bindings = bindings;
- bindPair[1].xlations = oldXlations;
- bindPair[1].bindings = oldBindings;
- newTable = NULL;
- break;
- }
- if (!newTable)
- newTable = MergeThem(widget, bindPair[0].xlations, bindPair[1].xlations);
-
- for (i = 0, numNew = 0; i < 2; i++) {
- if (bindPair[i].xlations)
- for (j = 0; j < bindPair[i].xlations->numStateTrees; j++, numNew++) {
- if (bindPair[i].xlations->stateTreeTbl[j]->simple.isAccelerator) {
- if (bindPair[i].bindings)
- newBindings[numNew] = bindPair[i].bindings[j];
- else {
- newBindings[numNew].widget = source;
- newBindings[numNew].aXlations =
- bindPair[i].xlations;
- }
- }
- }
- }
- *numNewRtn = numNew;
- treePtr = &newTable->stateTreeTbl[0];
- for (i = 0; i < newTable->numStateTrees; i++, treePtr++)
- (*treePtr)->simple.refCount++;
- return newTable;
-}
-
-static TMBindData MakeBindData(bindings, numBindings, oldBindData)
- TMComplexBindProcs bindings;
- TMShortCard numBindings;
- TMBindData oldBindData;
-{
- TMLongCard bytes;
- TMShortCard i;
- Boolean isComplex;
- TMBindData bindData;
-
- if (numBindings == 0)
- return NULL;
- for (i = 0; i < numBindings; i++)
- if (bindings[i].widget)
- break;
- isComplex = (i < numBindings);
- if (isComplex)
- bytes = (sizeof(TMComplexBindDataRec) +
- ((numBindings - 1) *
- sizeof(TMComplexBindProcsRec)));
- else
- bytes = (sizeof(TMSimpleBindDataRec) +
- ((numBindings - 1) *
- sizeof(TMSimpleBindProcsRec)));
-
- bindData = (TMBindData) __XtCalloc(sizeof(char), bytes);
- bindData->simple.isComplex = isComplex;
- if (isComplex) {
- TMComplexBindData cBindData = (TMComplexBindData)bindData;
- /*
- * If there were any accelerator contexts in the old bindData
- * then propagate them to the new one.
- */
- if (oldBindData && oldBindData->simple.isComplex)
- cBindData->accel_context =
- ((TMComplexBindData) oldBindData)->accel_context;
- XtMemmove((char *)&cBindData->bindTbl[0], (char *)bindings,
- numBindings * sizeof(TMComplexBindProcsRec));
- }
- return bindData;
-}
-
-/*
- * This routine is the central clearinghouse for merging translations
- * into a widget. It takes care of preping the action bindings for
- * realize time and calling the converter or doing a straight merge if
- * the destination is empty.
- */
-static Boolean ComposeTranslations(dest, operation, source, newXlations)
- Widget dest, source;
- _XtTranslateOp operation;
- XtTranslations newXlations;
-{
- XtTranslations newTable, oldXlations;
- XtTranslations accNewXlations;
- EventMask oldMask;
- TMBindData bindData;
- TMComplexBindProcs oldBindings = NULL;
- TMShortCard numOldBindings, numNewBindings = 0, numBytes;
- TMComplexBindProcsRec stackBindings[16], *newBindings;
-
- /*
- * how should we be handling the refcount decrement for the
- * replaced translation table ???
- */
- if (!newXlations)
- {
- XtAppWarningMsg(XtWidgetToApplicationContext(dest),
- XtNtranslationError,"nullTable",XtCXtToolkitError,
- "table to (un)merge must not be null",
- (String *)NULL, (Cardinal *)NULL);
- return False;
- }
-
- accNewXlations = newXlations;
- newXlations = ((newXlations->hasBindings)
- ? ((ATranslations)newXlations)->xlations
- : newXlations);
-
- if (!(oldXlations = dest->core.tm.translations))
- operation = XtTableReplace;
-
- /*
- * try to avoid generation of duplicate state trees. If the source
- * isn't simple (1 state Tree) then it's too much hassle
- */
- if (((operation == XtTableAugment) ||
- (operation == XtTableOverride)) &&
- (newXlations->numStateTrees == 1)) {
- Cardinal i;
- for (i = 0; i < oldXlations->numStateTrees; i++)
- if (oldXlations->stateTreeTbl[i] ==
- newXlations->stateTreeTbl[0])
- break;
- if (i < oldXlations->numStateTrees) {
- if (operation == XtTableAugment) {
- /*
- * we don't need to do anything since it's already
- * there
- */
- return True;
- }
- else {/* operation == XtTableOverride */
- /*
- * We'll get rid of the duplicate trees throughout the
- * and leave it with a pruned translation table. This
- * will only work if the same table has been merged
- * into this table (or one of it's composers
- */
- _XtUnmergeTranslations(dest, newXlations);
- /*
- * reset oldXlations so we're back in sync
- */
- if (!(oldXlations = dest->core.tm.translations))
- operation = XtTableReplace;
- }
- }
- }
-
- bindData = (TMBindData) dest->core.tm.proc_table;
- if (bindData) {
- numOldBindings = (oldXlations ? oldXlations->numStateTrees : 0);
- if (bindData->simple.isComplex)
- oldBindings = &((TMComplexBindData)bindData)->bindTbl[0];
- else
- oldBindings = (TMComplexBindProcs)
- (&((TMSimpleBindData)bindData)->bindTbl[0]);
- }
-
- numBytes =(((oldXlations ? oldXlations->numStateTrees : 0)
- + newXlations->numStateTrees) * sizeof(TMComplexBindProcsRec));
- newBindings = (TMComplexBindProcs) XtStackAlloc(numBytes, stackBindings);
- XtBZero((char *)newBindings, numBytes);
-
- if (operation == XtTableUnmerge) {
- newTable = UnmergeTranslations(dest,
- oldXlations,
- newXlations,
- 0,
- oldBindings, numOldBindings,
- newBindings, &numNewBindings);
-#ifdef DEBUG
- /* check for no match for unmerge */
- if (newTable == oldXlations) {
- XtWarning("attempt to unmerge invalid table");
- XtStackFree((char *)newBindings, (char *)stackBindings);
- return(newTable != NULL);
- }
-#endif /* DEBUG */
- }
- else {
- newTable = MergeTranslations(dest,
- oldXlations,
- accNewXlations,
- operation,
- source,
- oldBindings,
- newBindings,
- &numNewBindings);
- }
- if (XtIsRealized(dest)) {
- oldMask = 0;
- if (oldXlations)
- oldMask = oldXlations->eventMask;
- _XtUninstallTranslations(dest);
- }
-
- dest->core.tm.proc_table =
- (XtActionProc *) MakeBindData(newBindings, numNewBindings, bindData);
-
- if (bindData) XtFree((char *)bindData);
-
- dest->core.tm.translations = newTable;
-
- if (XtIsRealized(dest)) {
- EventMask mask = 0;
- _XtInstallTranslations(dest);
- if (newTable)
- mask = newTable->eventMask;
- if (mask != oldMask)
- XSelectInput(XtDisplay(dest), XtWindow(dest),
- XtBuildEventMask(dest));
- }
- XtStackFree((XtPointer)newBindings, (XtPointer)stackBindings);
- return(newTable != NULL);
-}
-
-/*
- * If a GetValues is done on a translation resource that contains
- * accelerators we need to return the accelerator context in addition
- * to the pure translations. Since this means returning memory that
- * the client controlls but we still own, we will track the "headers"
- * that we return (via a linked list pointed to from the bindData) and
- * free it at destroy time.
- */
-XtTranslations _XtGetTranslationValue(w)
- Widget w;
-{
- XtTM tmRecPtr = (XtTM) &w->core.tm;
- ATranslations *aXlationsPtr;
- TMComplexBindData cBindData = (TMComplexBindData) tmRecPtr->proc_table;
- XtTranslations xlations = tmRecPtr->translations;
-
- if (!xlations || !cBindData || !cBindData->isComplex)
- return xlations;
-
- /* Walk the list looking to see if we already have generated a
- * header for the currently installed translations. If we have,
- * just return that header. Otherwise create a new header.
- */
- for (aXlationsPtr = (ATranslations *) &cBindData->accel_context;
- *aXlationsPtr && (*aXlationsPtr)->xlations != xlations;
- aXlationsPtr = &(*aXlationsPtr)->next)
- ;
- if (*aXlationsPtr)
- return (XtTranslations) *aXlationsPtr;
- else {
- /* create a new aXlations context */
- ATranslations aXlations;
- Cardinal numBindings = xlations->numStateTrees;
-
- (*aXlationsPtr) = aXlations = (ATranslations)
- __XtMalloc(sizeof(ATranslationData) +
- (numBindings - 1) * sizeof(TMComplexBindProcsRec));
-
- aXlations->hasBindings = True;
- aXlations->xlations = xlations;
- aXlations->next = NULL;
- XtMemmove((char *) &aXlations->bindTbl[0],
- (char *) &cBindData->bindTbl[0],
- numBindings * sizeof(TMComplexBindProcsRec));
- return (XtTranslations) aXlations;
- }
-}
-
-
-/*ARGSUSED*/
-static void RemoveStateTree(tree)
- TMStateTree tree;
-{
-#ifdef REFCNT_TRANSLATIONS
- TMComplexStateTree stateTree = (TMComplexStateTree)tree;
-
- if (--stateTree->refCount == 0) {
- /*
- * should we free/refcount the match recs ?
- */
- if (!stateTree->isSimple) {
- StatePtr currState, nextState;
- TMShortCard i;
- for (i = 0; i < stateTree->numComplexBranchHeads; i++) {
- currState =
- nextState =
- stateTree->complexBranchHeadTbl[i];
- for (; nextState;){
- FreeActions(currState->actions);
- currState->actions = NULL;
- if (!currState->isCycleEnd)
- nextState = currState->nextLevel;
- else
- nextState = NULL;
- XtFree( (char*)currState );
- }
- }
- XtFree((char*)stateTree->complexBranchHeadTbl);
- }
- XtFree((char*)stateTree->branchHeadTbl);
- XtFree((char*)stateTree);
- }
-#endif /* REFCNT_TRANSLATIONS */
-}
-
-void _XtRemoveStateTreeByIndex(xlations, i)
- XtTranslations xlations;
- TMShortCard i;
-{
- TMStateTree *stateTrees = xlations->stateTreeTbl;
-
- RemoveStateTree(stateTrees[i]);
- xlations->numStateTrees--;
-
- for (; i < xlations->numStateTrees; i++)
- {
- stateTrees[i] = stateTrees[i+1];
- }
-}
-
-/* ARGSUSED */
-void _XtFreeTranslations(app, toVal, closure, args, num_args)
- XtAppContext app;
- XrmValuePtr toVal;
- XtPointer closure;
- XrmValuePtr args;
- Cardinal *num_args;
-{
- XtTranslations xlations;
- int i;
-
- if (*num_args != 0)
- XtAppWarningMsg(app,
- "invalidParameters","freeTranslations",XtCXtToolkitError,
- "Freeing XtTranslations requires no extra arguments",
- (String *)NULL, (Cardinal *)NULL);
-
- xlations = *(XtTranslations*)toVal->addr;
- for (i = 0; i < (int)xlations->numStateTrees; i++)
- RemoveStateTree(xlations->stateTreeTbl[i]);
- XtFree((char *)xlations);
-}
-
-/* The spec is not clear on when actions specified in accelerators are bound;
- * Bind them at Realize the same as translations
- */
-void XtInstallAccelerators(destination, source)
- Widget destination, source;
-{
- XtTranslations aXlations;
- _XtTranslateOp op;
- String buf;
- WIDGET_TO_APPCON(destination);
-
- /*
- * test that it was parsed as an accelarator table. Even though
- * there doesn't need to be a distinction it makes life easier if
- * we honor the spec implication that aXlations is an accelerator
- */
- LOCK_APP(app);
- LOCK_PROCESS;
- if ((!XtIsWidget(source)) ||
- ((aXlations = source->core.accelerators) == NULL) ||
- (aXlations->stateTreeTbl[0]->simple.isAccelerator == False)) {
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
- return;
- }
-
- aXlations = source->core.accelerators;
- op = aXlations->operation;
-
- if (ComposeTranslations(destination, op, source, aXlations) &&
- (XtClass(source)->core_class.display_accelerator != NULL)) {
-
- buf = _XtPrintXlations(destination, aXlations, source, False);
- (*(XtClass(source)->core_class.display_accelerator))(source,buf);
- XtFree(buf);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void XtInstallAllAccelerators(destination,source)
- Widget destination,source;
-{
- int i;
- CompositeWidget cw;
- WIDGET_TO_APPCON(destination);
-
- /* Recurse down normal children */
- LOCK_APP(app);
- LOCK_PROCESS;
- if (XtIsComposite(source)) {
- cw = (CompositeWidget) source;
- for (i = 0; i < cw->composite.num_children; i++) {
- XtInstallAllAccelerators(destination,cw->composite.children[i]);
- }
- }
-
- /* Recurse down popup children */
- if (XtIsWidget(source)) {
- for (i = 0; i < source->core.num_popups; i++) {
- XtInstallAllAccelerators(destination,source->core.popup_list[i]);
- }
- }
- /* Finally, apply procedure to this widget */
- XtInstallAccelerators(destination,source);
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-#if 0 /* dead code */
-static _XtTranslateOp _XtGetTMOperation(xlations)
- XtTranslations xlations;
-{
- return ((xlations->hasBindings)
- ? ((ATranslations)xlations)->xlations->operation
- : xlations->operation);
-}
-#endif
-
-void XtAugmentTranslations(widget, new)
- Widget widget;
- XtTranslations new;
-{
- Widget hookobj;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- (void)ComposeTranslations(widget, XtTableAugment, (Widget)NULL, new);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHaugmentTranslations;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void XtOverrideTranslations(widget, new)
- Widget widget;
- XtTranslations new;
-{
- Widget hookobj;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- LOCK_PROCESS;
- (void) ComposeTranslations(widget, XtTableOverride, (Widget)NULL, new);
- hookobj = XtHooksOfDisplay(XtDisplayOfObject(widget));
- if (XtHasCallbacks(hookobj, XtNchangeHook) == XtCallbackHasSome) {
- XtChangeHookDataRec call_data;
-
- call_data.type = XtHoverrideTranslations;
- call_data.widget = widget;
- XtCallCallbackList(hookobj,
- ((HookObject)hookobj)->hooks.changehook_callbacks,
- (XtPointer)&call_data);
- }
- UNLOCK_PROCESS;
- UNLOCK_APP(app);
-}
-
-void _XtMergeTranslations(widget, newXlations, op)
- Widget widget;
- XtTranslations newXlations;
- _XtTranslateOp op;
-{
- if (!newXlations){
- if (!widget->core.tm.translations)
- return;
- else {
- newXlations = widget->core.tm.translations;
- widget->core.tm.translations = NULL;
- }
- }
- (void) ComposeTranslations(widget,
- op,
- (Widget)NULL,
- newXlations);
-}
-
-void _XtUnmergeTranslations(widget, xlations)
- Widget widget;
- XtTranslations xlations;
-{
- ComposeTranslations(widget, XtTableUnmerge, (Widget)NULL, xlations);
-}
diff --git a/xc/lib/Xt/Threads.c b/xc/lib/Xt/Threads.c
deleted file mode 100644
index daf8b7e91..000000000
--- a/xc/lib/Xt/Threads.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/* $TOG: Threads.c /main/19 1998/02/06 13:26:39 kaleb $ */
-
-/************************************************************
-Copyright 1993 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 name Sun not be used in advertising
-or publicity pertaining to distribution of the software
-without specific prior written permission. Sun makes 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 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 "IntrinsicI.h"
-
-#ifdef XTHREADS
-
-#define xmalloc __XtMalloc
-#define xfree XtFree
-#include <X11/Xthreads.h>
-
-#ifndef NDEBUG
-#define NDEBUG
-#endif
-#include <assert.h>
-#include <stdio.h>
-
-typedef struct _ThreadStack {
- unsigned int size;
- int sp;
- struct _Tstack {
- xthread_t t;
- xcondition_t c;
- } *st;
-} ThreadStack;
-
-typedef struct _LockRec {
- xmutex_t mutex;
- int level;
- ThreadStack stack;
-#ifndef _XMUTEX_NESTS
- xthread_t holder;
- xcondition_t cond;
-#endif
-} LockRec;
-
-
-#define STACK_INCR 16
-
-static LockPtr process_lock = NULL;
-
-static void
-InitProcessLock()
-{
- if(!process_lock) {
- process_lock = XtNew(LockRec);
- process_lock->mutex = xmutex_malloc();
- xmutex_init(process_lock->mutex);
- process_lock->level = 0;
-#ifndef _XMUTEX_NESTS
- process_lock->cond = xcondition_malloc();
- xcondition_init(process_lock->cond);
- xthread_clear_id(process_lock->holder);
-#endif
- }
-}
-
-static void
-ProcessLock()
-{
-#ifdef _XMUTEX_NESTS
- xmutex_lock(process_lock->mutex);
- process_lock->level++;
-#else
- xthread_t this_thread = xthread_self();
-
- xmutex_lock(process_lock->mutex);
-
- if (!xthread_have_id(process_lock->holder)) {
- process_lock->holder = this_thread;
- xmutex_unlock(process_lock->mutex);
- return;
- }
-
- if (xthread_equal(process_lock->holder,this_thread)) {
- process_lock->level++;
- xmutex_unlock(process_lock->mutex);
- return;
- }
-
- while(xthread_have_id(process_lock->holder))
- xcondition_wait(process_lock->cond, process_lock->mutex);
-
- process_lock->holder = this_thread;
- assert(xthread_equal(process_lock->holder, this_thread));
- xmutex_unlock(process_lock->mutex);
-#endif
-}
-
-static void
-ProcessUnlock()
-{
-#ifdef _XMUTEX_NESTS
- process_lock->level--;
- xmutex_unlock(process_lock->mutex);
-#else
- xmutex_lock(process_lock->mutex);
- assert(xthread_equal(process_lock->holder, xthread_self()));
- if (process_lock->level != 0) {
- process_lock->level--;
- xmutex_unlock(process_lock->mutex);
- return;
- }
-
- xthread_clear_id(process_lock->holder);
- xcondition_signal(process_lock->cond);
-
- xmutex_unlock(process_lock->mutex);
-#endif
-}
-
-
-static void
-#if NeedFunctionPrototypes
-AppLock(
- XtAppContext app)
-#else
-AppLock(app)
- XtAppContext app;
-#endif
-{
- LockPtr app_lock = app->lock_info;
-#ifdef _XMUTEX_NESTS
- xmutex_lock(app_lock->mutex);
- app_lock->level++;
-#else
- xthread_t self = xthread_self();
- xmutex_lock(app_lock->mutex);
- if (!xthread_have_id(app_lock->holder)) {
- app_lock->holder = self;
- assert(xthread_equal(app_lock->holder, self));
- xmutex_unlock(app_lock->mutex);
- return;
- }
- if (xthread_equal(app_lock->holder, self)) {
- app_lock->level++;
- xmutex_unlock(app_lock->mutex);
- return;
- }
- while(xthread_have_id(app_lock->holder)) {
- xcondition_wait(app_lock->cond, app_lock->mutex);
- }
- app_lock->holder = self;
- assert(xthread_equal(app_lock->holder, self));
- xmutex_unlock(app_lock->mutex);
-#endif
-}
-
-static void
-#if NeedFunctionPrototypes
-AppUnlock(
- XtAppContext app)
-#else
-AppUnlock(app)
- XtAppContext app;
-#endif
-{
- LockPtr app_lock = app->lock_info;
-#ifdef _XMUTEX_NESTS
- app_lock->level--;
- xmutex_unlock(app_lock->mutex);
-#else
- xthread_t self = xthread_self();
- xmutex_lock(app_lock->mutex);
- assert(xthread_equal(app_lock->holder, self));
- if (app_lock->level != 0) {
- app_lock->level--;
- xmutex_unlock(app_lock->mutex);
- return;
- }
- xthread_clear_id(app_lock->holder);
- xcondition_signal(app_lock->cond);
- xmutex_unlock(app_lock->mutex);
-#endif
-}
-
-static void
-#if NeedFunctionPrototypes
-YieldAppLock(
- XtAppContext app,
- Boolean* push_thread,
- Boolean* pushed_thread,
- int* level)
-#else
-YieldAppLock(app, push_thread, pushed_thread, level)
- XtAppContext app;
- Boolean* push_thread;
- Boolean* pushed_thread;
- int* level;
-#endif
-{
- LockPtr app_lock = app->lock_info;
- xthread_t self = xthread_self();
-#ifndef _XMUTEX_NESTS
- xmutex_lock(app_lock->mutex);
- assert(xthread_equal(app_lock->holder, self));
-#endif
- *level = app_lock->level;
- if (*push_thread) {
- *push_thread = FALSE;
- *pushed_thread = TRUE;
-
- if(app_lock->stack.sp == app_lock->stack.size - 1) {
- int ii;
- app_lock->stack.st = (struct _Tstack *)
- XtRealloc ((char *)app_lock->stack.st,
- (app_lock->stack.size + STACK_INCR) * sizeof (struct _Tstack));
- ii = app_lock->stack.size;
- app_lock->stack.size += STACK_INCR;
- for ( ; ii < app_lock->stack.size; ii++) {
- app_lock->stack.st[ii].c = xcondition_malloc();
- xcondition_init(app_lock->stack.st[ii].c);
- }
- }
- app_lock->stack.st[++(app_lock->stack.sp)].t = self;
- }
-#ifdef _XMUTEX_NESTS
- while (app_lock->level > 0) {
- app_lock->level--;
- xmutex_unlock(app_lock->mutex);
- }
-#else
- xcondition_signal(app_lock->cond);
- app_lock->level = 0;
- xthread_clear_id(app_lock->holder);
- xmutex_unlock(app_lock->mutex);
-#endif
-}
-
-static void
-#if NeedFunctionPrototypes
-RestoreAppLock(
- XtAppContext app,
- int level,
- Boolean* pushed_thread)
-#else
-RestoreAppLock(app, level, pushed_thread)
- XtAppContext app;
- int level;
- Boolean* pushed_thread;
-#endif
-{
- LockPtr app_lock = app->lock_info;
- xthread_t self = xthread_self();
- xmutex_lock(app_lock->mutex);
-#ifdef _XMUTEX_NESTS
- app_lock->level++;
-#else
- while(xthread_have_id(app_lock->holder)) {
- xcondition_wait(app_lock->cond, app_lock->mutex);
- }
-#endif
- if (!xthread_equal(app_lock->stack.st[app_lock->stack.sp].t, self)) {
- int ii;
- for (ii = app_lock->stack.sp - 1; ii >= 0; ii--) {
- if (xthread_equal(app_lock->stack.st[ii].t, self)) {
- xcondition_wait(app_lock->stack.st[ii].c, app_lock->mutex);
- break;
- }
- }
-#ifndef _XMUTEX_NESTS
- while(xthread_have_id(app_lock->holder)) {
- xcondition_wait(app_lock->cond, app_lock->mutex);
- }
-#endif
- }
-#ifdef _XMUTEX_NESTS
- while (app_lock->level < level) {
- xmutex_lock(app_lock->mutex);
- app_lock->level++;
- }
-#else
- app_lock->holder = self;
- app_lock->level = level;
- assert(xthread_equal(app_lock->holder, self));
-#endif
- if (*pushed_thread) {
- *pushed_thread = FALSE;
- (app_lock->stack.sp)--;
- if (app_lock->stack.sp >= 0) {
- xcondition_signal (app_lock->stack.st[app_lock->stack.sp].c);
- }
- }
-#ifndef _XMUTEX_NESTS
- xmutex_unlock(app_lock->mutex);
-#endif
-}
-
-static void
-#if NeedFunctionPrototypes
-FreeAppLock(
- XtAppContext app)
-#else
-FreeAppLock(app)
- XtAppContext app;
-#endif
-{
- int ii;
- LockPtr app_lock = app->lock_info;
-
- if(app_lock) {
- xmutex_clear(app_lock->mutex);
- xmutex_free(app_lock->mutex);
-#ifndef _XMUTEX_NESTS
- xcondition_clear(app_lock->cond);
- xcondition_free(app_lock->cond);
-#endif
- if(app_lock->stack.st != (struct _Tstack *)NULL) {
- for (ii = 0; ii < app_lock->stack.size; ii++) {
- xcondition_clear(app_lock->stack.st[ii].c);
- xcondition_free(app_lock->stack.st[ii].c);
- }
- XtFree((char *)app_lock->stack.st);
- }
- XtFree((char *)app_lock);
- app->lock_info = NULL;
- }
-}
-
-static void
-#if NeedFunctionPrototypes
-InitAppLock(
- XtAppContext app)
-#else
-InitAppLock(app)
- XtAppContext app;
-#endif
-{
- int ii;
- LockPtr app_lock;
-
- app->lock = AppLock;
- app->unlock = AppUnlock;
- app->yield_lock = YieldAppLock;
- app->restore_lock = RestoreAppLock;
- app->free_lock = FreeAppLock;
-
- app_lock = app->lock_info = XtNew(LockRec);
- app_lock->mutex = xmutex_malloc();
- xmutex_init(app_lock->mutex);
- app_lock->level = 0;
-#ifndef _XMUTEX_NESTS
- app_lock->cond = xcondition_malloc();
- xcondition_init(app_lock->cond);
- xthread_clear_id(app_lock->holder);
-#endif
- app_lock->stack.size = STACK_INCR;
- app_lock->stack.sp = -1;
- app_lock->stack.st =
- (struct _Tstack *)__XtMalloc(sizeof(struct _Tstack)*STACK_INCR);
- for (ii = 0; ii < STACK_INCR; ii++) {
- app_lock->stack.st[ii].c = xcondition_malloc();
- xcondition_init(app_lock->stack.st[ii].c);
- }
-}
-
-#endif /* defined(XTHREADS) */
-
-#if NeedFunctionPrototypes
-void XtAppLock(
- XtAppContext app)
-#else
-void XtAppLock(app)
- XtAppContext app;
-#endif
-{
-#ifdef XTHREADS
- if(app->lock)
- (*app->lock)(app);
-#endif
-}
-
-#if NeedFunctionPrototypes
-void XtAppUnlock(
- XtAppContext app)
-#else
-void XtAppUnlock(app)
- XtAppContext app;
-#endif
-{
-#ifdef XTHREADS
- if(app->unlock)
- (*app->unlock)(app);
-#endif
-}
-
-void XtProcessLock()
-{
-#ifdef XTHREADS
- if(_XtProcessLock)
- (*_XtProcessLock)();
-#endif
-}
-
-void XtProcessUnlock()
-{
-#ifdef XTHREADS
- if(_XtProcessUnlock)
- (*_XtProcessUnlock)();
-#endif
-}
-
-Boolean XtToolkitThreadInitialize()
-{
-#ifdef XTHREADS
- if (_XtProcessLock == NULL) {
-#ifdef xthread_init
- xthread_init();
-#endif
- InitProcessLock();
- _XtProcessLock = ProcessLock;
- _XtProcessUnlock = ProcessUnlock;
- _XtInitAppLock = InitAppLock;
- }
- return True;
-#else
- return False;
-#endif
-}
-
diff --git a/xc/lib/Xt/ThreadsI.h b/xc/lib/Xt/ThreadsI.h
deleted file mode 100644
index 38f11ae1e..000000000
--- a/xc/lib/Xt/ThreadsI.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $TOG: ThreadsI.h /main/11 1998/02/06 13:26:34 kaleb $ */
-
-/************************************************************
-Copyright 1993 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 name Sun not be used in advertising
-or publicity pertaining to distribution of the software
-without specific prior written permission. Sun makes 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 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.
-
-*/
-#ifdef XTHREADS
-
-typedef struct _LockRec *LockPtr;
-
-typedef void (*ThreadAppProc)(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-typedef void (*ThreadAppYieldLockProc)(
-#if NeedFunctionPrototypes
- XtAppContext, /* app */
- Boolean*, /* push_thread */
- Boolean*, /* pushed_thread */
- int* /* level */
-#endif
-);
-
-typedef void (*ThreadAppRestoreLockProc)(
-#if NeedFunctionPrototypes
- XtAppContext /* app */,
- int, /* level */
- Boolean* /* pushed_thread */
-#endif
-);
-
-extern void (*_XtProcessLock)(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void (*_XtProcessUnlock)(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void (*_XtInitAppLock)(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-#define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app)
-#define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app)
-
-#define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)()
-#define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)()
-#define LOCK_APP(app) if(app && app->lock)(*app->lock)(app)
-#define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app)
-
-#define YIELD_APP_LOCK(app,push,pushed,level)\
- if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level)
-#define RESTORE_APP_LOCK(app,level,pushed)\
- if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed)
-
-#define WIDGET_TO_APPCON(w) \
- XtAppContext app = (w && _XtProcessLock ? \
- XtWidgetToApplicationContext(w) : NULL)
-
-#define DPY_TO_APPCON(d) \
- XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): 0)
-
-#else /* defined(XTHREADS) */
-
-#define LOCK_PROCESS
-#define UNLOCK_PROCESS
-#define LOCK_APP(app)
-#define UNLOCK_APP(app)
-
-#define INIT_APP_LOCK(app)
-#define FREE_APP_LOCK(app)
-
-#define WIDGET_TO_APPCON(w)
-#define DPY_TO_APPCON(d)
-
-#endif /* !defined(XTHREADS) */
diff --git a/xc/lib/Xt/TranslateI.h b/xc/lib/Xt/TranslateI.h
deleted file mode 100644
index 6756b75d7..000000000
--- a/xc/lib/Xt/TranslateI.h
+++ /dev/null
@@ -1,651 +0,0 @@
-/* $TOG: TranslateI.h /main/49 1998/02/06 13:27:28 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-/*
- * TranslateI.h - Header file private to translation management
- *
- * Author: Gabe Beged-Dov, HP
- *
- * Former Author: Charles Haynes
- * Digital Equipment Corporation
- * Western Research Laboratory
- * Date: Sat Aug 29 1987
- */
-
-/*#define REFCNT_TRANSLATIONS*/
-#define CACHE_TRANSLATIONS
-
-#define TM_NO_MATCH (-2)
-
-#define _XtRStateTablePair "_XtStateTablePair"
-
-typedef unsigned char TMByteCard;
-typedef unsigned short TMShortCard;
-typedef unsigned long TMLongCard;
-typedef short TMShortInt;
-
-typedef Boolean (*MatchProc)();
- /* Event *parsed, TMEventPtr incoming */
-
-typedef struct _ModToKeysymTable {
- Modifiers mask;
- int count;
- int idx;
-} ModToKeysymTable;
-
-typedef struct _LateBindings {
- unsigned int knot:1;
- unsigned int pair:1;
- unsigned short ref_count; /* garbage collection */
- KeySym keysym;
-} LateBindings, *LateBindingsPtr;
-
-typedef short ModifierMask;
-
-typedef struct _ActionsRec *ActionPtr;
-typedef struct _ActionsRec {
- int idx; /* index into quarkTable to find proc */
- String *params; /* pointer to array of params */
- Cardinal num_params; /* number of params */
- ActionPtr next; /* next action to perform */
-} ActionRec;
-
-typedef struct _XtStateRec *StatePtr;
-typedef struct _XtStateRec {
- unsigned int isCycleStart:1;
- unsigned int isCycleEnd:1;
- TMShortCard typeIndex;
- TMShortCard modIndex;
- ActionPtr actions; /* rhs list of actions to perform */
- StatePtr nextLevel;
-}StateRec;
-
-
-#define XtTableReplace 0
-#define XtTableAugment 1
-#define XtTableOverride 2
-#define XtTableUnmerge 3
-
-typedef unsigned int _XtTranslateOp;
-
-/*
- * New Definitions
- */
-typedef struct _TMModifierMatchRec{
- TMLongCard modifiers;
- TMLongCard modifierMask;
- LateBindingsPtr lateModifiers;
- Boolean standard;
-}TMModifierMatchRec, *TMModifierMatch;
-
-typedef struct _TMTypeMatchRec{
- TMLongCard eventType;
- TMLongCard eventCode;
- TMLongCard eventCodeMask;
- MatchProc matchEvent;
-}TMTypeMatchRec, *TMTypeMatch;
-
-typedef struct _TMBranchHeadRec {
- unsigned int isSimple:1;
- unsigned int hasActions:1;
- unsigned int hasCycles:1;
- unsigned int more:13;
- TMShortCard typeIndex;
- TMShortCard modIndex;
-}TMBranchHeadRec, *TMBranchHead;
-
-/* NOTE: elements of this structure must match those of
- * TMComplexStateTreeRec and TMParseStateTreeRec.
- */
-typedef struct _TMSimpleStateTreeRec{
- unsigned int isSimple:1;
- unsigned int isAccelerator:1;
- unsigned int mappingNotifyInterest:1;
- unsigned int refCount:13;
- TMShortCard numBranchHeads;
- TMShortCard numQuarks; /* # of entries in quarkTbl */
- TMShortCard unused; /* to ensure same alignment */
- TMBranchHeadRec *branchHeadTbl;
- XrmQuark *quarkTbl; /* table of quarkified rhs*/
-}TMSimpleStateTreeRec, *TMSimpleStateTree;
-
-/* NOTE: elements of this structure must match those of
- * TMSimpleStateTreeRec and TMParseStateTreeRec.
- */
-typedef struct _TMComplexStateTreeRec{
- unsigned int isSimple:1;
- unsigned int isAccelerator:1;
- unsigned int mappingNotifyInterest:1;
- unsigned int refCount:13;
- TMShortCard numBranchHeads;
- TMShortCard numQuarks; /* # of entries in quarkTbl */
- TMShortCard numComplexBranchHeads;
- TMBranchHeadRec *branchHeadTbl;
- XrmQuark *quarkTbl; /* table of quarkified rhs*/
- StatePtr *complexBranchHeadTbl;
-}TMComplexStateTreeRec, *TMComplexStateTree;
-
-/* NOTE: elements of this structure must match those of
- * TMSimpleStateTreeRec and TMComplexStateTreeRec.
- */
-typedef struct _TMParseStateTreeRec{
- unsigned int isSimple:1;
- unsigned int isAccelerator:1;
- unsigned int mappingNotifyInterest:1;
- unsigned int isStackQuarks:1;
- unsigned int isStackBranchHeads:1;
- unsigned int isStackComplexBranchHeads:1;
- unsigned int unused:10; /* to ensure correct alignment */
- TMShortCard numBranchHeads;
- TMShortCard numQuarks; /* # of entries in quarkTbl */
- TMShortCard numComplexBranchHeads;
- TMBranchHeadRec *branchHeadTbl;
- XrmQuark *quarkTbl; /* table of quarkified rhs*/
- StatePtr *complexBranchHeadTbl;
- TMShortCard branchHeadTblSize;
- TMShortCard quarkTblSize; /*total size of quarkTbl */
- TMShortCard complexBranchHeadTblSize;
- StatePtr head;
-}TMParseStateTreeRec, *TMParseStateTree;
-
-typedef union _TMStateTreeRec{
- TMSimpleStateTreeRec simple;
- TMParseStateTreeRec parse;
- TMComplexStateTreeRec complex;
-}*TMStateTree, **TMStateTreePtr, **TMStateTreeList;
-
-typedef struct _TMSimpleBindProcsRec {
- XtActionProc *procs;
-}TMSimpleBindProcsRec, *TMSimpleBindProcs;
-
-typedef struct _TMComplexBindProcsRec {
- Widget widget; /*widgetID to pass to action Proc*/
- XtTranslations aXlations;
- XtActionProc *procs;
-}TMComplexBindProcsRec, *TMComplexBindProcs;
-
-typedef struct _TMSimpleBindDataRec {
- unsigned int isComplex:1; /* must be first */
- TMSimpleBindProcsRec bindTbl[1]; /* variable length */
-}TMSimpleBindDataRec, *TMSimpleBindData;
-
-typedef struct _TMComplexBindDataRec {
- unsigned int isComplex:1; /* must be first */
- struct _ATranslationData *accel_context; /* for GetValues */
- TMComplexBindProcsRec bindTbl[1]; /* variable length */
-}TMComplexBindDataRec, *TMComplexBindData;
-
-typedef union _TMBindDataRec{
- TMSimpleBindDataRec simple;
- TMComplexBindDataRec complex;
-}*TMBindData;
-
-typedef struct _TranslationData{
- unsigned char hasBindings; /* must be first */
- unsigned char operation; /*replace,augment,override*/
- TMShortCard numStateTrees;
- struct _TranslationData *composers[2];
- EventMask eventMask;
- TMStateTree stateTreeTbl[1]; /* variable length */
-}TranslationData;
-
-/*
- * ATranslations is returned by GetValues for translations that contain
- * accelerators. The TM can differentiate between this and TranslationData
- * (that don't have a bindTbl) by looking at the first field (hasBindings)
- * of either structure. All ATranslationData structures associated with a
- * widget are chained off the BindData record of the widget.
- */
-typedef struct _ATranslationData{
- unsigned char hasBindings; /* must be first */
- unsigned char operation;
- struct _TranslationData *xlations; /* actual translations */
- struct _ATranslationData *next; /* chain the contexts together */
- TMComplexBindProcsRec bindTbl[1]; /* accelerator bindings */
-}ATranslationData, *ATranslations;
-
-typedef struct _TMConvertRec {
- XtTranslations old; /* table to merge into */
- XtTranslations new; /* table to merge from */
-} TMConvertRec;
-
-#define _XtEventTimerEventType ((TMLongCard)~0L)
-#define KeysymModMask (1L<<27) /* private to TM */
-#define AnyButtonMask (1L<<28) /* private to TM */
-
-typedef struct _EventRec {
- TMLongCard modifiers;
- TMLongCard modifierMask;
- LateBindingsPtr lateModifiers;
- TMLongCard eventType;
- TMLongCard eventCode;
- TMLongCard eventCodeMask;
- MatchProc matchEvent;
- Boolean standard;
-} Event;
-
-typedef struct _EventSeqRec *EventSeqPtr;
-typedef struct _EventSeqRec {
- Event event; /* X event description */
- StatePtr state; /* private to state table builder */
- EventSeqPtr next; /* next event on line */
- ActionPtr actions; /* r.h.s. list of actions to perform */
-} EventSeqRec;
-
-typedef EventSeqRec EventRec;
-typedef EventSeqPtr EventPtr;
-
-typedef struct _TMEventRec {
- XEvent *xev;
- Event event;
-}TMEventRec,*TMEventPtr;
-
-typedef struct _ActionHookRec {
- struct _ActionHookRec* next; /* must remain first */
- XtAppContext app;
- XtActionHookProc proc;
- XtPointer closure;
-} ActionHookRec, *ActionHook;
-
-/* choose a number between 2 and 8 */
-#define TMKEYCACHELOG2 6
-#define TMKEYCACHESIZE (1<<TMKEYCACHELOG2)
-
-typedef struct _KeyCacheRec {
- unsigned char modifiers_return[256]; /* constant per KeyCode, key proc */
- KeyCode keycode[TMKEYCACHESIZE];
- unsigned char modifiers[TMKEYCACHESIZE];
- KeySym keysym[TMKEYCACHESIZE];
-} TMKeyCache;
-
-typedef struct _TMKeyContextRec {
- XEvent *event;
- unsigned long serial;
- KeySym keysym;
- Modifiers modifiers;
- TMKeyCache keycache; /* keep this last, to keep offsets to others small */
-} TMKeyContextRec, *TMKeyContext;
-
-typedef struct _TMGlobalRec{
- TMTypeMatchRec **typeMatchSegmentTbl;
- TMShortCard numTypeMatches;
- TMShortCard numTypeMatchSegments;
- TMShortCard typeMatchSegmentTblSize;
- TMModifierMatchRec **modMatchSegmentTbl;
- TMShortCard numModMatches;
- TMShortCard numModMatchSegments;
- TMShortCard modMatchSegmentTblSize;
- Boolean newMatchSemantics;
-#ifdef TRACE_TM
- XtTranslations *tmTbl;
- TMShortCard numTms;
- TMShortCard tmTblSize;
- struct _TMBindCacheRec **bindCacheTbl;
- TMShortCard numBindCache;
- TMShortCard bindCacheTblSize;
- TMShortCard numLateBindings;
- TMShortCard numBranchHeads;
- TMShortCard numComplexStates;
- TMShortCard numComplexActions;
-#endif /* TRACE_TM */
-}TMGlobalRec;
-
-extern TMGlobalRec _XtGlobalTM;
-
-#define TM_MOD_SEGMENT_SIZE 16
-#define TM_TYPE_SEGMENT_SIZE 16
-
-#define TMGetTypeMatch(idx) \
- ((TMTypeMatch) \
- &((_XtGlobalTM.typeMatchSegmentTbl[((idx) >> 4)])[(idx) & 15]))
-#define TMGetModifierMatch(idx) \
- ((TMModifierMatch) \
- &((_XtGlobalTM.modMatchSegmentTbl[(idx) >> 4])[(idx) & 15]))
-
-/* Useful Access Macros */
-#define TMNewMatchSemantics() (_XtGlobalTM.newMatchSemantics)
-#define TMBranchMore(branch) (branch->more)
-#define TMComplexBranchHead(tree, br) \
- (((TMComplexStateTree)tree)->complexBranchHeadTbl[TMBranchMore(br)])
-
-#define TMGetComplexBindEntry(bindData, idx) \
- ((TMComplexBindProcs)&(((TMComplexBindData)bindData)->bindTbl[idx]))
-
-#define TMGetSimpleBindEntry(bindData, idx) \
- ((TMSimpleBindProcs)&(((TMSimpleBindData)bindData)->bindTbl[idx]))
-
-
-#define _InitializeKeysymTables(dpy, pd) \
- if (pd->keysyms == NULL) \
- _XtBuildKeysymTables(dpy, pd)
-
-/*
- * Internal Functions
- */
-
-extern void _XtPopup(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtGrabKind /* grab_kind */,
- _XtBoolean /* spring_loaded */
-#endif
-);
-
-extern String _XtPrintXlations(
-#if NeedFunctionPrototypes
- Widget /* w */,
- XtTranslations /* xlations */,
- Widget /* accelWidget */,
- _XtBoolean /* includeRHS */
-#endif
-);
-
-extern void _XtRegisterGrabs(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern XtPointer _XtInitializeActionData(
-#if NeedFunctionPrototypes
- struct _XtActionsRec * /* actions */,
- Cardinal /* count */,
- _XtBoolean /* inPlace */
-#endif
-);
-
-extern void _XtAddEventSeqToStateTree(
-#if NeedFunctionPrototypes
- EventSeqPtr /* eventSeq */,
- TMParseStateTree /* stateTree */
-#endif
-);
-
-extern Boolean _XtMatchUsingStandardMods(
-#if NeedFunctionPrototypes
- TMTypeMatch /* typeMatch */,
- TMModifierMatch /* modMatch */,
- TMEventPtr /* eventSeq */
-#endif
-);
-
-extern Boolean _XtMatchUsingDontCareMods(
-#if NeedFunctionPrototypes
- TMTypeMatch /* typeMatch */,
- TMModifierMatch /* modMatch */,
- TMEventPtr /* eventSeq */
-#endif
-);
-
-extern Boolean _XtRegularMatch(
-#if NeedFunctionPrototypes
- TMTypeMatch /* typeMatch */,
- TMModifierMatch /* modMatch */,
- TMEventPtr /* eventSeq */
-#endif
-);
-
-extern Boolean _XtMatchAtom(
-#if NeedFunctionPrototypes
- TMTypeMatch /* typeMatch */,
- TMModifierMatch /* modMatch */,
- TMEventPtr /* eventSeq */
-#endif
-);
-
-extern void _XtTranslateEvent(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */
-#endif
-);
-
-extern void _XtBuildKeysymTables();
-
-#ifndef NO_MIT_HACKS
-extern void _XtDisplayTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern void _XtDisplayAccelerators(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-
-extern void _XtDisplayInstalledAccelerators(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XEvent* /* event */,
- String* /* params */,
- Cardinal* /* num_params */
-#endif
-);
-#endif /* ifndef NO_MIT_HACKS */
-
-extern void _XtPopupInitialize(
-#if NeedFunctionPrototypes
- XtAppContext /* app_context */
-#endif
-);
-
-extern void _XtBindActions(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtTM /* tm_rec */
-#endif
-);
-
-extern Boolean _XtComputeLateBindings(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- LateBindingsPtr /* lateModifiers */,
- Modifiers* /* computed */,
- Modifiers* /* computedMask */
-#endif
-);
-
-extern XtTranslations _XtCreateXlations(
-#if NeedFunctionPrototypes
- TMStateTree * /* stateTrees */,
- TMShortCard /* numStateTrees */,
- XtTranslations /* first */,
- XtTranslations /* second */
-#endif
-);
-
-extern Boolean _XtCvtMergeTranslations(
-#if NeedFunctionPrototypes
- Display* /* dpy */,
- XrmValuePtr /* args */,
- Cardinal* /* num_args */,
- XrmValuePtr /* from */,
- XrmValuePtr /* to */,
- XtPointer* /* closure_ret */
-#endif
-);
-
-void _XtFreeTranslations(
-#if NeedFunctionPrototypes
- XtAppContext /* app */,
- XrmValuePtr /* toVal */,
- XtPointer /* closure */,
- XrmValuePtr /* args */,
- Cardinal* /* num_args */
-#endif
-);
-
-extern TMShortCard _XtGetModifierIndex(
-#if NeedFunctionPrototypes
- Event* /* event */
-#endif
-);
-
-extern TMShortCard _XtGetQuarkIndex(
-#if NeedFunctionPrototypes
- TMParseStateTree /* stateTreePtr */,
- XrmQuark /* quark */
-#endif
-);
-
-extern XtTranslations _XtGetTranslationValue(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern TMShortCard _XtGetTypeIndex(
-#if NeedFunctionPrototypes
- Event* /* event */
-#endif
-);
-
-extern void _XtGrabInitialize(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-extern void _XtInstallTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void _XtRemoveTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void _XtDestroyTMData(
-#if NeedFunctionPrototypes
- Widget /* widget */
-#endif
-);
-
-extern void _XtMergeTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtTranslations /* newXlations */,
- _XtTranslateOp /* operation */
-#endif
-);
-
-extern void _XtActionInitialize(
-#if NeedFunctionPrototypes
- XtAppContext /* app */
-#endif
-);
-
-extern TMStateTree _XtParseTreeToStateTree(
-#if NeedFunctionPrototypes
- TMParseStateTree /* parseTree */
-#endif
-);
-
-extern String _XtPrintActions(
-#if NeedFunctionPrototypes
- ActionRec* /* actions */,
- XrmQuark* /* quarkTbl */
-#endif
-);
-
-extern String _XtPrintEventSeq(
-#if NeedFunctionPrototypes
- EventSeqPtr /* eventSeq */,
- Display* /* dpy */
-#endif
-);
-
-typedef Boolean (*_XtTraversalProc)(
-#if NeedFunctionPrototypes
- StatePtr /* state */,
- XtPointer /* data */
-#endif
-);
-
-extern void _XtTraverseStateTree(
-#if NeedFunctionPrototypes
- TMStateTree /* tree */,
- _XtTraversalProc /* func */,
- XtPointer /* data */
-#endif
-);
-
-extern void _XtTranslateInitialize(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern void _XtAddTMConverters(
-#if NeedFunctionPrototypes
- ConverterTable /* table */
-#endif
-);
-
-extern void _XtUnbindActions(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtTranslations /* xlations */,
- TMBindData /* bindData */
-#endif
-);
-
-extern void _XtUnmergeTranslations(
-#if NeedFunctionPrototypes
- Widget /* widget */,
- XtTranslations /* xlations */
-#endif
-);
diff --git a/xc/lib/Xt/VarCreate.c b/xc/lib/Xt/VarCreate.c
deleted file mode 100644
index dfff7047f..000000000
--- a/xc/lib/Xt/VarCreate.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* $TOG: VarCreate.c /main/34 1998/02/06 13:27:44 kaleb $ */
-
-/*
-
-Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above 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 not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-Sun makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without 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 1885, 1986, 1987, 1988, 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.
-
-*/
-
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-#include "Shell.h"
-#include "VarargsI.h"
-
-#if (defined(SUNSHLIB) || defined(AIXSHLIB)) && defined(SHAREDCODE)
-#define XtToolkitInitialize _XtToolkitInitialize
-#endif /* (SUNSHLIB || AIXSHLIB) && SHAREDCODE */
-
-extern Widget _XtCreateWidget();
-extern Widget _XtAppCreateShell();
-extern Widget _XtCreatePopupShell();
-
-static Widget
-_XtVaCreateWidget(name, widget_class, parent, var, count)
- String name;
- WidgetClass widget_class;
- Widget parent;
- va_list var;
- int count;
-{
- register Widget widget;
- XtTypedArgList typed_args = NULL;
- Cardinal num_args;
-
- _XtVaToTypedArgList(var, count, &typed_args, &num_args);
-
- widget = _XtCreateWidget(name, widget_class, parent, (ArgList)NULL,
- (Cardinal)0, typed_args, num_args);
-
- if (typed_args != NULL) {
- XtFree((XtPointer)typed_args);
- }
-
- return widget;
-}
-
-
-#if NeedVarargsPrototypes
-Widget
-XtVaCreateWidget(
- _Xconst char* name,
- WidgetClass widget_class,
- Widget parent,
- ...)
-#else
-/*VARARGS3*/
-Widget XtVaCreateWidget(name, widget_class, parent, va_alist)
- String name;
- WidgetClass widget_class;
- Widget parent;
- va_dcl
-#endif
-{
- va_list var;
- register Widget widget;
- int total_count, typed_count;
- WIDGET_TO_APPCON(parent);
-
- LOCK_APP(app);
- Va_start(var,parent);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var,parent);
- widget = _XtVaCreateWidget(name, widget_class, parent, var, total_count);
- va_end(var);
- UNLOCK_APP(app);
- return widget;
-}
-
-
-#if NeedVarargsPrototypes
-Widget
-XtVaCreateManagedWidget(
- _Xconst char* name,
- WidgetClass widget_class,
- Widget parent,
- ...)
-#else
-/*VARARGS3*/
-Widget XtVaCreateManagedWidget(name, widget_class, parent, va_alist)
- String name;
- WidgetClass widget_class;
- Widget parent;
- va_dcl
-#endif
-{
- va_list var;
- register Widget widget;
- int total_count, typed_count;
- WIDGET_TO_APPCON(parent);
-
- LOCK_APP(app);
- Va_start(var,parent);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var,parent);
- widget = _XtVaCreateWidget(name, widget_class, parent, var, total_count);
- XtManageChild(widget);
- va_end(var);
- UNLOCK_APP(app);
- return widget;
-}
-
-
-#if NeedVarargsPrototypes
-Widget
-XtVaAppCreateShell(
- _Xconst char* name,
- _Xconst char* class,
- WidgetClass widget_class,
- Display* display,
- ...)
-#else
-/*VARARGS4*/
-Widget XtVaAppCreateShell(name, class, widget_class, display, va_alist)
- String name;
- String class;
- WidgetClass widget_class;
- Display* display;
- va_dcl
-#endif
-{
- va_list var;
- register Widget widget;
- XtTypedArgList typed_args = NULL;
- Cardinal num_args;
- int total_count, typed_count;
- DPY_TO_APPCON(display);
-
- LOCK_APP(app);
- Va_start(var,display);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var,display);
-
- _XtVaToTypedArgList(var, total_count, &typed_args, &num_args);
- widget = _XtAppCreateShell(name, class, widget_class, display,
- (ArgList)NULL, (Cardinal)0, typed_args, num_args);
- if (typed_args != NULL) {
- XtFree((XtPointer)typed_args);
- }
-
- va_end(var);
- UNLOCK_APP(app);
- return widget;
-}
-
-
-#if NeedVarargsPrototypes
-Widget
-XtVaCreatePopupShell(
- _Xconst char* name,
- WidgetClass widget_class,
- Widget parent,
- ...)
-#else
-/*VARARGS3*/
-Widget XtVaCreatePopupShell(name, widget_class, parent, va_alist)
- String name;
- WidgetClass widget_class;
- Widget parent;
- va_dcl
-#endif
-{
- va_list var;
- register Widget widget;
- XtTypedArgList typed_args = NULL;
- Cardinal num_args;
- int total_count, typed_count;
- WIDGET_TO_APPCON(parent);
-
- LOCK_APP(app);
- Va_start(var,parent);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var,parent);
-
- _XtVaToTypedArgList(var, total_count, &typed_args, &num_args);
- widget = _XtCreatePopupShell(name, widget_class, parent,
- (ArgList)NULL, (Cardinal)0, typed_args, num_args);
- if (typed_args != NULL) {
- XtFree((XtPointer)typed_args);
- }
-
- va_end(var);
- UNLOCK_APP(app);
- return widget;
-}
-
-#if NeedVarargsPrototypes
-void
-XtVaSetValues(Widget widget, ...)
-#else
-/*VARARGS1*/
-void XtVaSetValues(widget, va_alist)
- Widget widget;
- va_dcl
-#endif
-{
- va_list var;
- ArgList args = NULL;
- Cardinal num_args;
- int total_count, typed_count;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- Va_start(var,widget);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var,widget);
-
- _XtVaToArgList(widget, var, total_count, &args, &num_args);
- XtSetValues(widget, args, num_args);
- _XtFreeArgList(args, total_count, typed_count);
-
- UNLOCK_APP(app);
- va_end(var);
-}
-
-
-#if NeedVarargsPrototypes
-void
-XtVaSetSubvalues(XtPointer base, XtResourceList resources, Cardinal num_resources, ...)
-#else
-/*VARARGS3*/
-void XtVaSetSubvalues(base, resources, num_resources, va_alist)
- XtPointer base;
- XtResourceList resources;
- Cardinal num_resources;
- va_dcl
-#endif
-{
- va_list var;
- ArgList args;
- Cardinal num_args;
- int total_count, typed_count;
-
- Va_start(var, num_resources);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- if (typed_count != 0) {
- XtWarning("XtVaTypedArg is not valid in XtVaSetSubvalues()\n");
- }
-
- Va_start(var, num_resources);
- _XtVaToArgList((Widget)NULL, var, total_count, &args, &num_args);
-
- XtSetSubvalues(base, resources, num_resources, args, num_args);
-
- if (num_args != 0) {
- XtFree((XtPointer)args);
- }
-
- va_end(var);
-}
-
-#if NeedVarargsPrototypes
-Widget
-_XtVaOpenApplication(
- XtAppContext *app_context_return,
- _Xconst char* application_class,
- XrmOptionDescList options,
- Cardinal num_options,
- int *argc_in_out,
- String *argv_in_out,
- String *fallback_resources,
- WidgetClass widget_class,
- va_list var_args)
-#else
-/*VARARGS8*/
-Widget _XtVaOpenApplication(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class, var_args)
- XtAppContext *app_context_return;
- char *application_class;
- XrmOptionDescList options;
- Cardinal num_options;
- int *argc_in_out;
- String *argv_in_out;
- String *fallback_resources;
- WidgetClass widget_class;
- va_list var_args;
-#endif
-{
- XtAppContext app_con;
- Display * dpy;
- register int saved_argc = *argc_in_out;
- Widget root;
- String attr;
- int count = 0;
- XtTypedArgList typed_args;
-
- XtToolkitInitialize(); /* cannot be moved into _XtAppInit */
-
- dpy = _XtAppInit(&app_con, (String)application_class, options, num_options,
- argc_in_out, &argv_in_out, fallback_resources);
-
- typed_args = (XtTypedArgList) __XtMalloc((unsigned) sizeof(XtTypedArg));
- attr = va_arg (var_args, String);
- for(; attr != NULL; attr = va_arg (var_args, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- typed_args[count].name = va_arg(var_args, String);
- typed_args[count].type = va_arg(var_args, String);
- typed_args[count].value = va_arg(var_args, XtArgVal);
- typed_args[count].size = va_arg(var_args, int);
- } else {
- typed_args[count].name = attr;
- typed_args[count].type = NULL;
- typed_args[count].value = va_arg(var_args, XtArgVal);
- typed_args[count].size = 0;
- }
- count++;
- typed_args = (XtTypedArgList)
- XtRealloc((char *) typed_args,
- (unsigned) (count + 1) * sizeof(XtTypedArg));
- }
- typed_args[count].name = NULL;
-
- va_end (var_args);
-
- root =
- XtVaAppCreateShell( NULL, application_class,
- widget_class, dpy,
- XtNscreen, (XtArgVal)DefaultScreenOfDisplay(dpy),
- XtNargc, (XtArgVal)saved_argc,
- XtNargv, (XtArgVal)argv_in_out,
- XtVaNestedList, (XtVarArgsList)typed_args,
- NULL );
-
- if (app_context_return != NULL)
- *app_context_return = app_con;
-
- XtFree((XtPointer)typed_args);
- XtFree((XtPointer)argv_in_out);
- return(root);
-}
-
-#if NeedVarargsPrototypes
-Widget
-_XtVaAppInitialize(
- XtAppContext *app_context_return,
- _Xconst char* application_class,
- XrmOptionDescList options,
- Cardinal num_options,
- int *argc_in_out,
- String *argv_in_out,
- String *fallback_resources,
- va_list var_args)
-#else
-/*VARARGS7*/
-Widget _XtVaAppInitialize(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, var_args)
- XtAppContext *app_context_return;
- char *application_class;
- XrmOptionDescList options;
- Cardinal num_options;
- int *argc_in_out;
- String *argv_in_out;
- String *fallback_resources;
- va_list var_args;
-#endif
-{
- return _XtVaOpenApplication(app_context_return, application_class,
- options, num_options,
- argc_in_out, argv_in_out, fallback_resources,
- applicationShellWidgetClass, var_args);
-}
-
-#if !((defined(SUNSHLIB) || defined(AIXSHLIB)) && defined(SHAREDCODE))
-
-/*
- * If not used as a shared library, we still need a front end to
- * _XtVaOpenApplication and to _XtVaAppInitialize.
- */
-
-#if NeedVarargsPrototypes
-Widget
-XtVaOpenApplication(
- XtAppContext *app_context_return,
- _Xconst char* application_class,
- XrmOptionDescList options,
- Cardinal num_options,
- int *argc_in_out,
- String *argv_in_out,
- String *fallback_resources,
- WidgetClass widget_class,
- ...)
-#else
-Widget XtVaOpenApplication(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class, va_alist)
- XtAppContext *app_context_return;
- String application_class;
- XrmOptionDescList options;
- Cardinal num_options;
- int *argc_in_out;
- String *argv_in_out;
- String *fallback_resources;
- WidgetClass widget_class;
- va_dcl
-#endif
-{
- va_list var;
-
- Va_start(var, widget_class);
- return _XtVaOpenApplication(app_context_return, (String)application_class,
- options, num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class, var);
-}
-
-#if NeedVarargsPrototypes
-Widget
-XtVaAppInitialize(
- XtAppContext *app_context_return,
- _Xconst char* application_class,
- XrmOptionDescList options,
- Cardinal num_options,
- int *argc_in_out,
- String *argv_in_out,
- String *fallback_resources,
- ...)
-#else
-Widget XtVaAppInitialize(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, va_alist)
- XtAppContext *app_context_return;
- String application_class;
- XrmOptionDescList options;
- Cardinal num_options;
- int *argc_in_out;
- String *argv_in_out;
- String *fallback_resources;
- va_dcl
-#endif
-{
- va_list var;
-
- Va_start(var, fallback_resources);
- return _XtVaOpenApplication(app_context_return, (String)application_class,
- options, num_options, argc_in_out, argv_in_out,
- fallback_resources,
- applicationShellWidgetClass, var);
-}
-
-#endif /* !((SUNSHLIB || AIXSHLIB) && SHAREDCODE) */
-
diff --git a/xc/lib/Xt/VarGet.c b/xc/lib/Xt/VarGet.c
deleted file mode 100644
index 0b95935ba..000000000
--- a/xc/lib/Xt/VarGet.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/* $TOG: VarGet.c /main/23 1998/02/06 13:27:49 kaleb $ */
-/*
-
-Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
-
-Permission to use, copy, modify, and distribute this
-software and its documentation for any purpose and without
-fee is hereby granted, provided that the above 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 not be used in
-advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-Sun makes no representations about the suitability of
-this software for any purpose. It is provided "as is"
-without 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 1985, 1986, 1987, 1988, 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.
-
-*/
-
-#include "IntrinsicI.h"
-#include "VarargsI.h"
-#include "StringDefs.h"
-
-static String XtNxtGetTypedArg = "xtGetTypedArg";
-
-#if NeedVarargsPrototypes
-void
-XtVaGetSubresources(
- Widget widget,
- XtPointer base,
- _Xconst char* name,
- _Xconst char* class,
- XtResourceList resources,
- Cardinal num_resources,
- ...)
-#else
-/*VARARGS6*/
-void XtVaGetSubresources(widget, base, name, class, resources, num_resources, va_alist)
- Widget widget;
- XtPointer base;
- String name;
- String class;
- XtResourceList resources;
- Cardinal num_resources;
- va_dcl
-#endif
-{
- va_list var;
- XtTypedArgList args;
- Cardinal num_args;
- int total_count, typed_count;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- Va_start(var, num_resources);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var, num_resources);
-
- _XtVaToTypedArgList(var, total_count, &args, &num_args);
-
- _XtGetSubresources(widget, base, name, class, resources, num_resources,
- NULL, 0, args, num_args);
-
- if (num_args != 0) {
- XtFree((XtPointer)args);
- }
-
- va_end(var);
- UNLOCK_APP(app);
-}
-
-
-#if NeedVarargsPrototypes
-void
-XtVaGetApplicationResources(Widget widget, XtPointer base, XtResourceList resources, Cardinal num_resources, ...)
-#else
-/*VARARGS4*/
-void XtVaGetApplicationResources(widget, base, resources, num_resources, va_alist)
- Widget widget;
- XtPointer base;
- XtResourceList resources;
- Cardinal num_resources;
- va_dcl
-#endif
-{
- va_list var;
- XtTypedArgList args;
- Cardinal num_args;
- int total_count, typed_count;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- Va_start(var,num_resources);
- _XtCountVaList(var, &total_count, &typed_count);
- va_end(var);
-
- Va_start(var,num_resources);
-
- _XtVaToTypedArgList(var, total_count, &args, &num_args);
-
- _XtGetApplicationResources(widget, base, resources, num_resources,
- NULL, 0, args, num_args);
-
- if (num_args != 0) {
- XtFree((XtPointer)args);
- }
-
- va_end(var);
- UNLOCK_APP(app);
-}
-
-
-static void
-GetTypedArg(widget, typed_arg, resources, num_resources)
- Widget widget;
- XtTypedArgList typed_arg;
- XtResourceList resources;
- Cardinal num_resources;
-{
- String from_type = NULL;
- Cardinal from_size = 0;
- XrmValue from_val, to_val;
- register int i;
- Arg arg;
- XtPointer value;
-
- /* note we presume that the XtResourceList to be un-compiled */
-
- for (i = 0; i < num_resources; i++) {
- if (StringToName(typed_arg->name) == StringToName(resources[i].resource_name)) {
- from_type = resources[i].resource_type;
- from_size = resources[i].resource_size;
- break;
- }
- }
-
- if (i == num_resources) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "unknownType", XtNxtGetTypedArg, XtCXtToolkitError,
- "Unable to find type of resource for conversion",
- (String *)NULL, (Cardinal *)NULL);
- return;
- }
-
- value = ALLOCATE_LOCAL(from_size);
- if (value == NULL) _XtAllocError(NULL);
- XtSetArg(arg, typed_arg->name, value);
- XtGetValues(widget, &arg, 1);
-
- from_val.size = from_size;
- from_val.addr = (XPointer)value;
- to_val.addr = (XPointer)typed_arg->value;
- to_val.size = typed_arg->size;
-
- if (!XtConvertAndStore(widget, from_type, &from_val,
- typed_arg->type, &to_val)) {
- if (to_val.size > typed_arg->size) {
- String params[2];
- Cardinal num_params = 2;
- params[0] = typed_arg->type;
- params[1] = XtName(widget);
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "insufficientSpace", XtNxtGetTypedArg, XtCXtToolkitError,
- "Insufficient space for converted type '%s' in widget '%s'",
- params, &num_params);
- }
- else {
- String params[3];
- Cardinal num_params = 3;
- params[0] = from_type;
- params[1] = typed_arg->type;
- params[2] = XtName(widget);
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "conversionFailed", XtNxtGetTypedArg, XtCXtToolkitError,
- "Type conversion (%s to %s) failed for widget '%s'",
- params, &num_params);
- }
- }
- DEALLOCATE_LOCAL(value);
-}
-
-static int
-GetNestedArg(widget, avlist, args, resources, num_resources)
- Widget widget;
- XtTypedArgList avlist;
- ArgList args;
- XtResourceList resources;
- Cardinal num_resources;
-{
- int count = 0;
-
- for (; avlist->name != NULL; avlist++) {
- if (avlist->type != NULL) {
- GetTypedArg(widget, avlist, resources, num_resources);
- } else if(strcmp(avlist->name, XtVaNestedList) == 0) {
- count += GetNestedArg(widget, (XtTypedArgList)avlist->value,
- args, resources, num_resources);
- } else {
- (args+count)->name = avlist->name;
- (args+count)->value = avlist->value;
- ++count;
- }
- }
-
- return(count);
-}
-
-#if NeedVarargsPrototypes
-void
-XtVaGetValues(Widget widget, ...)
-#else
-/*VARARGS1*/
-void XtVaGetValues(widget, va_alist)
- Widget widget;
- va_dcl
-#endif
-{
- va_list var;
- String attr;
- ArgList args;
- XtTypedArg typed_arg;
- XtResourceList resources = (XtResourceList)NULL;
- Cardinal num_resources;
- int count, total_count, typed_count;
- WIDGET_TO_APPCON(widget);
-
- LOCK_APP(app);
- Va_start(var,widget);
-
- _XtCountVaList(var, &total_count, &typed_count);
-
- if (total_count != typed_count) {
- args = (ArgList)__XtMalloc((unsigned)((total_count - typed_count)
- * sizeof(Arg)));
- }
- else args = NULL; /* for lint; really unused */
- va_end(var);
-
- Va_start(var,widget);
- for(attr = va_arg(var, String), count = 0 ; attr != NULL;
- attr = va_arg(var, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- typed_arg.name = va_arg(var, String);
- typed_arg.type = va_arg(var, String);
- typed_arg.value = va_arg(var, XtArgVal);
- typed_arg.size = va_arg(var, int);
-
- if (resources == NULL) {
- XtGetResourceList(XtClass(widget), &resources,&num_resources);
- }
-
- GetTypedArg(widget, &typed_arg, resources, num_resources);
- } else if (strcmp(attr, XtVaNestedList) == 0) {
- if (resources == NULL) {
- XtGetResourceList(XtClass(widget),&resources, &num_resources);
- }
-
- count += GetNestedArg(widget, va_arg(var, XtTypedArgList),
- (args+count), resources, num_resources);
- } else {
- args[count].name = attr;
- args[count].value = va_arg(var, XtArgVal);
- count ++;
- }
- }
- va_end(var);
-
- if (resources != (XtResourceList)NULL) {
- XtFree((XtPointer)resources);
- }
-
- if (total_count != typed_count) {
- XtGetValues(widget, args, count);
- XtFree((XtPointer)args);
- }
- UNLOCK_APP(app);
-}
-
-#if NeedVarargsPrototypes
-void
-XtVaGetSubvalues(XtPointer base,XtResourceList resources, Cardinal num_resources, ...)
-#else
-/*VARARGS3*/
-void XtVaGetSubvalues(base, resources, num_resources, va_alist)
- XtPointer base;
- XtResourceList resources;
- Cardinal num_resources;
- va_dcl
-#endif
-{
- va_list var;
- ArgList args;
- Cardinal num_args;
- int total_count, typed_count;
-
- Va_start(var,num_resources);
-
- _XtCountVaList(var, &total_count, &typed_count);
-
- if (typed_count != 0) {
- XtWarning("XtVaTypedArg is an invalid argument to XtVaGetSubvalues()\n");
- }
- va_end(var);
-
- Va_start(var,num_resources);
- _XtVaToArgList((Widget)NULL, var, total_count, &args, &num_args);
- va_end(var);
-
- XtGetSubvalues(base, resources, num_resources, args, num_args);
-
- if (num_args != 0) {
- XtFree((XtPointer)args);
- }
-}
diff --git a/xc/lib/Xt/Varargs.c b/xc/lib/Xt/Varargs.c
deleted file mode 100644
index bfe6b0d50..000000000
--- a/xc/lib/Xt/Varargs.c
+++ /dev/null
@@ -1,561 +0,0 @@
-/* $TOG: Varargs.c /main/35 1998/02/06 13:27:38 kaleb $ */
-
-/*
-
-Copyright 1985, 1986, 1987, 1988, 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.
-
-*/
-
-#include "IntrinsicI.h"
-#include "VarargsI.h"
-#include "StringDefs.h"
-
-static String XtNxtConvertVarToArgList = "xtConvertVarToArgList";
-
-/*
- * Given a nested list, _XtCountNestedList() returns counts of the
- * total number of attribute-value pairs and the count of those
- * attributes that are typed. The list is counted recursively.
- */
-static void
-_XtCountNestedList(avlist, total_count, typed_count)
- XtTypedArgList avlist;
- int *total_count;
- int *typed_count;
-{
- for (; avlist->name != NULL; avlist++) {
- if (strcmp(avlist->name, XtVaNestedList) == 0) {
- _XtCountNestedList((XtTypedArgList)avlist->value, total_count,
- typed_count);
- } else {
- if (avlist->type != NULL) {
- ++(*typed_count);
- }
- ++(*total_count);
- }
- }
-}
-
-
-/*
- * Given a variable length attribute-value list, _XtCountVaList()
- * returns counts of the total number of attribute-value pairs,
- * and the count of the number of those attributes that are typed.
- * The list is counted recursively.
- */
-#if NeedFunctionPrototypes
-void
-_XtCountVaList(va_list var, int* total_count, int* typed_count)
-#else
-void
-_XtCountVaList(var, total_count, typed_count)
- va_list var;
- int *total_count;
- int *typed_count;
-#endif
-{
- String attr;
-
- *total_count = 0;
- *typed_count = 0;
-
- for(attr = va_arg(var, String) ; attr != NULL;
- attr = va_arg(var, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- va_arg(var, String);
- va_arg(var, String);
- va_arg(var, XtArgVal);
- va_arg(var, int);
- ++(*total_count);
- ++(*typed_count);
- } else if (strcmp(attr, XtVaNestedList) == 0) {
- _XtCountNestedList(va_arg(var, XtTypedArgList), total_count,
- typed_count);
- } else {
- va_arg(var, XtArgVal);
- ++(*total_count);
- }
- }
-}
-
-
-/*
- * Given a variable length attribute-value list, XtVaCreateArgsList()
- * constructs an attribute-value list of type XtTypedArgList and
- * returns the list.
- */
-#if NeedVarargsPrototypes
-XtVarArgsList
-XtVaCreateArgsList(XtPointer unused, ...)
-#else
-/*ARGSUSED*/
-/*VARARGS1*/
-XtVarArgsList XtVaCreateArgsList(unused, va_alist)
- XtPointer unused;
- va_dcl
-#endif
-{
- va_list var;
- XtTypedArgList avlist;
- int count = 0;
- String attr;
-
- /*
- * Count the number of attribute-value pairs in the list.
- * Note: The count is required only to allocate enough space to store
- * the list. Therefore nested lists are not counted recursively.
- */
- Va_start(var,unused);
- for(attr = va_arg(var, String) ; attr != NULL;
- attr = va_arg(var, String)) {
- ++count;
- if (strcmp(attr, XtVaTypedArg) == 0) {
- va_arg(var, String);
- va_arg(var, String);
- va_arg(var, XtArgVal);
- va_arg(var, int);
- } else {
- va_arg(var, XtArgVal);
- }
- }
- va_end(var);
-
- Va_start(var,unused);
- avlist = _XtVaCreateTypedArgList(var, count);
- va_end(var);
- return (XtVarArgsList)avlist;
-}
-
-
-#if NeedFunctionPrototypes
-XtTypedArgList _XtVaCreateTypedArgList(va_list var, register int count)
-#else
-XtTypedArgList _XtVaCreateTypedArgList(var, count)
- va_list var;
- register int count;
-#endif
-{
- String attr;
- XtTypedArgList avlist;
-
- avlist = (XtTypedArgList)
- __XtCalloc((int)count + 1, (unsigned)sizeof(XtTypedArg));
-
- for(attr = va_arg(var, String), count = 0; attr != NULL;
- attr = va_arg(var, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- avlist[count].name = va_arg(var, String);
- avlist[count].type = va_arg(var, String);
- avlist[count].value = va_arg(var, XtArgVal);
- avlist[count].size = va_arg(var, int);
- } else {
- avlist[count].name = attr;
- avlist[count].type = NULL;
- avlist[count].value = va_arg(var, XtArgVal);
- }
- ++count;
- }
- avlist[count].name = NULL;
-
- return avlist;
-}
-
-
-/*
- * TypedArgToArg() invokes a resource converter to convert the
- * passed typed arg into a name/value pair and stores the name/value
- * pair in the passed Arg structure. If memory is allocated for the
- * converted value, the address is returned in the value field of
- * memory_return; otherwise that field is NULL. The function returns
- * 1 if the conversion succeeded and 0 if the conversion failed.
- */
-static int
-TypedArgToArg(widget, typed_arg, arg_return, resources, num_resources,
- memory_return)
- Widget widget;
- XtTypedArgList typed_arg;
- ArgList arg_return;
- XtResourceList resources;
- Cardinal num_resources;
- ArgList memory_return;
-{
- String to_type = NULL;
- XrmValue from_val, to_val;
-
-
- if (widget == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "nullWidget", XtNxtConvertVarToArgList, XtCXtToolkitError,
- "XtVaTypedArg conversion needs non-NULL widget handle",
- (String *)NULL, (Cardinal *)NULL);
- return(0);
- }
-
- /* again we assume that the XtResourceList is un-compiled */
-
- for (; num_resources--; resources++)
- if (strcmp(typed_arg->name, resources->resource_name) == 0) {
- to_type = resources->resource_type;
- break;
- }
-
- if (to_type == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "unknownType", XtNxtConvertVarToArgList, XtCXtToolkitError,
- "Unable to find type of resource for conversion",
- (String *)NULL, (Cardinal *)NULL);
- return(0);
- }
-
- to_val.addr = NULL;
- from_val.size = typed_arg->size;
- if ((strcmp(typed_arg->type, XtRString) == 0) ||
- (typed_arg->size > sizeof(XtArgVal))) {
- from_val.addr = (XPointer)typed_arg->value;
- } else {
- from_val.addr = (XPointer)&typed_arg->value;
- }
-
- LOCK_PROCESS;
- XtConvertAndStore(widget, typed_arg->type, &from_val, to_type, &to_val);
-
- if (to_val.addr == NULL) {
- UNLOCK_PROCESS;
- XtAppWarningMsg(XtWidgetToApplicationContext(widget),
- "conversionFailed", XtNxtConvertVarToArgList, XtCXtToolkitError,
- "Type conversion failed", (String *)NULL, (Cardinal *)NULL);
- return(0);
- }
-
- arg_return->name = typed_arg->name;
- memory_return->value = (XtArgVal) NULL;
-
- if (strcmp(to_type, XtRString) == 0) {
- arg_return->value = (XtArgVal) to_val.addr;
- }
- else {
- if (to_val.size == sizeof(long))
- arg_return->value = (XtArgVal) *(long *)to_val.addr;
- else if (to_val.size == sizeof(short))
- arg_return->value = (XtArgVal) *(short *)to_val.addr;
- else if (to_val.size == sizeof(char))
- arg_return->value = (XtArgVal) *(char *)to_val.addr;
- else if (to_val.size == sizeof(XtArgVal))
- arg_return->value = *(XtArgVal *)to_val.addr;
- else if (to_val.size > sizeof(XtArgVal)) {
- arg_return->value = (XtArgVal) __XtMalloc(to_val.size);
- memory_return->value = (XtArgVal)
- memcpy((void *)arg_return->value, to_val.addr, to_val.size);
- }
- }
- UNLOCK_PROCESS;
-
- return(1);
-}
-
-
-/*
- * NestedArgtoArg() converts the passed nested list into
- * an ArgList/count.
- */
-static int
-NestedArgtoArg(widget, avlist, args, resources, num_resources,
- memory_return)
- Widget widget;
- XtTypedArgList avlist;
- ArgList args;
- XtResourceList resources;
- Cardinal num_resources;
- ArgList memory_return;
-{
- int count = 0;
-
- for (; avlist->name != NULL; avlist++) {
- if (avlist->type != NULL) {
- /* If widget is NULL, the typed arg is ignored */
- if (widget != NULL) {
- /* this is a typed arg */
- count += TypedArgToArg(widget, avlist, (args+count),
- resources, num_resources,
- (memory_return+count));
- }
- } else if (strcmp(avlist->name, XtVaNestedList) == 0) {
- count += NestedArgtoArg(widget, (XtTypedArgList)avlist->value,
- (args+count), resources, num_resources,
- (memory_return+count));
- } else {
- (args+count)->name = avlist->name;
- (args+count)->value = avlist->value;
- ++count;
- }
- }
-
- return(count);
-}
-
-/*
- * Free memory allocated through _XtVaToArgList. The actual args array
- * size is expected to be total_count * 2, where total_count is the number
- * of elements needed for resource representations. The lower half of the
- * array contains pairs of resource names and values as usual. For each
- * element [n] in the lower half of the array, the value field of the
- * corresponding element [n + total_count] in the upper half of the array
- * has been pressed into service in order to note whether the resource value
- * is a pointer to memory that was allocated in TypedArgToArg. In the
- * upper half, if the value field is not NULL, it contains the address of
- * memory which should now be freed. That memory could have been allocated
- * only as a result of the conversion of typed arguments. Therefore, if
- * there were no typed arguments in the original varargs, there is no need
- * to examine the upper half of the array. In the choice of data structure
- * to make this representation, priority was given to the wish to retrofit
- * the release of memory around the existing signature of _XtVaToArgList.
- */
-#if NeedFunctionPrototypes
-void
-_XtFreeArgList(
- ArgList args, /* as returned by _XtVaToArgList */
- int total_count, /* argument count returned by _XtCountVaList */
- int typed_count) /* typed arg count returned by _XtCountVaList */
-#else
-void
-_XtFreeArgList(args, total_count, typed_count)
- ArgList args;
- int total_count;
- int typed_count;
-#endif
-{
- ArgList p;
-
- if (args) {
- if (typed_count)
- for (p = args + total_count; total_count--; ++p) {
- if (p->value) XtFree((char *)p->value);
- }
- XtFree((char *)args);
- }
-}
-
-
-static void GetResources();
-
-
-/*
- * Given a variable argument list, _XtVaToArgList() returns the
- * equivalent ArgList and count. _XtVaToArgList() handles nested
- * lists and typed arguments. If typed arguments are present, the
- * ArgList should be freed with _XtFreeArgList.
- */
-#if NeedFunctionPrototypes
-void
-_XtVaToArgList(
- Widget widget,
- va_list var,
- int max_count,
- ArgList *args_return,
- Cardinal *num_args_return)
-#else
-void
-_XtVaToArgList(widget, var, max_count, args_return, num_args_return)
- Widget widget;
- va_list var;
- int max_count;
- ArgList *args_return;
- Cardinal *num_args_return;
-#endif
-{
- String attr;
- int count;
- ArgList args = (ArgList)NULL;
- XtTypedArg typed_arg;
- XtResourceList resources = (XtResourceList)NULL;
- Cardinal num_resources;
- Boolean fetched_resource_list = False;
-
- if (max_count == 0) {
- *num_args_return = 0;
- *args_return = (ArgList)NULL;
- return;
- }
-
- args = (ArgList)__XtMalloc((unsigned)(max_count * 2 * sizeof(Arg)));
- for (count = max_count * 2; --count >= 0; )
- args[count].value = (XtArgVal) NULL;
- count = 0;
-
- for(attr = va_arg(var, String) ; attr != NULL;
- attr = va_arg(var, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- typed_arg.name = va_arg(var, String);
- typed_arg.type = va_arg(var, String);
- typed_arg.value = va_arg(var, XtArgVal);
- typed_arg.size = va_arg(var, int);
-
- /* if widget is NULL, typed args are ignored */
- if (widget != NULL) {
- if (!fetched_resource_list) {
- GetResources(widget, &resources, &num_resources);
- fetched_resource_list = True;
- }
- count += TypedArgToArg(widget, &typed_arg, &args[count],
- resources, num_resources,
- &args[max_count + count]);
- }
- } else if (strcmp(attr, XtVaNestedList) == 0) {
- if (widget != NULL) {
- if (!fetched_resource_list) {
- GetResources(widget, &resources, &num_resources);
- fetched_resource_list = True;
- }
- }
-
- count += NestedArgtoArg(widget, va_arg(var, XtTypedArgList),
- &args[count], resources, num_resources,
- &args[max_count + count]);
- } else {
- args[count].name = attr;
- args[count].value = va_arg(var, XtArgVal);
- count ++;
- }
- }
-
- if (resources != NULL)
- XtFree((XtPointer)resources);
-
- *num_args_return = (Cardinal)count;
- *args_return = (ArgList)args;
-}
-
-/* Function Name: GetResources
- * Description: Retreives the normal and constraint resources
- * for this widget.
- * Arguments: widget - the widget.
- * RETURNED res_list - the list of resource for this widget
- * RETURNED number - the number of resources in the above list.
- * Returns: none
- */
-
-static void
-GetResources(widget, res_list, number)
-Widget widget;
-XtResourceList * res_list;
-Cardinal * number;
-{
- Widget parent = XtParent(widget);
-
- XtInitializeWidgetClass(XtClass(widget));
- XtGetResourceList(XtClass(widget), res_list, number);
-
- if (!XtIsShell(widget) && parent && XtIsConstraint(parent)) {
- XtResourceList res, constraint, cons_top;
- Cardinal num_constraint, temp;
-
- XtGetConstraintResourceList(XtClass(parent), &constraint,
- &num_constraint);
-
- cons_top = constraint;
- *res_list = (XtResourceList) XtRealloc((char*)*res_list,
- ((*number + num_constraint) *
- sizeof(XtResource)));
-
- for (temp= num_constraint, res= *res_list + *number; temp != 0; temp--)
- *res++ = *constraint++;
-
- *number += num_constraint;
- XtFree( (XtPointer) cons_top);
- }
-}
-
-static int NestedArgtoTypedArg(args, avlist)
- XtTypedArgList args;
- XtTypedArgList avlist;
-{
- int count = 0;
-
- for (; avlist->name != NULL; avlist++) {
- if (avlist->type != NULL) {
- (args+count)->name = avlist->name;
- (args+count)->type = avlist->type;
- (args+count)->size = avlist->size;
- (args+count)->value = avlist->value;
- ++count;
- } else if(strcmp(avlist->name, XtVaNestedList) == 0) {
- count += NestedArgtoTypedArg((args+count),
- (XtTypedArgList)avlist->value);
- } else {
- (args+count)->name = avlist->name;
- (args+count)->type = NULL;
- (args+count)->value = avlist->value;
- ++count;
- }
- }
- return(count);
-}
-
-
-/*
- * Given a variable argument list, _XtVaToTypedArgList() returns
- * the equivalent TypedArgList. _XtVaToTypedArgList() handles nested
- * lists.
- * Note: _XtVaToTypedArgList() does not do type conversions.
- */
-#if NeedFunctionPrototypes
-void
-_XtVaToTypedArgList(
- va_list var,
- int max_count,
- XtTypedArgList *args_return,
- Cardinal *num_args_return)
-#else
-void
-_XtVaToTypedArgList(var, max_count, args_return, num_args_return)
- va_list var;
- int max_count;
- XtTypedArgList *args_return;
- Cardinal *num_args_return;
-#endif
-{
- XtTypedArgList args = NULL;
- String attr;
- int count;
-
- args = (XtTypedArgList)
- __XtMalloc((unsigned)(max_count * sizeof(XtTypedArg)));
-
- for(attr = va_arg(var, String), count = 0 ; attr != NULL;
- attr = va_arg(var, String)) {
- if (strcmp(attr, XtVaTypedArg) == 0) {
- args[count].name = va_arg(var, String);
- args[count].type = va_arg(var, String);
- args[count].value = va_arg(var, XtArgVal);
- args[count].size = va_arg(var, int);
- ++count;
- } else if (strcmp(attr, XtVaNestedList) == 0) {
- count += NestedArgtoTypedArg(&args[count],
- va_arg(var, XtTypedArgList));
- } else {
- args[count].name = attr;
- args[count].type = NULL;
- args[count].value = va_arg(var, XtArgVal);
- ++count;
- }
- }
-
- *args_return = args;
- *num_args_return = count;
-}
diff --git a/xc/lib/Xt/VarargsI.h b/xc/lib/Xt/VarargsI.h
deleted file mode 100644
index 079ae5b1b..000000000
--- a/xc/lib/Xt/VarargsI.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* $TOG: VarargsI.h /main/19 1998/02/06 13:27:34 kaleb $ */
-
-/*
-
-Copyright 1985, 1986, 1987, 1988, 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.
-
-*/
-
-#ifndef _VarargsI_h_
-#define _VarargsI_h_
-
-#if NeedVarargsPrototypes
-# include <stdarg.h>
-# define Va_start(a,b) va_start(a,b)
-#else
-# include <varargs.h>
-# define Va_start(a,b) va_start(a)
-#endif
-
-/* private routines */
-
-extern void _XtCountVaList(
-#if NeedFunctionPrototypes
- va_list /*var*/, int* /*total_count*/, int* /*typed_count*/
-#endif
-);
-
-extern void _XtVaToArgList(
-#if NeedFunctionPrototypes
- Widget /*widget*/, va_list /*var*/, int /*max_count*/, ArgList* /*args_return*/, Cardinal* /*num_args_return*/
-#endif
-);
-
-extern void _XtVaToTypedArgList(
-#if NeedFunctionPrototypes
- va_list /*var*/, int /*count*/, XtTypedArgList* /*args_return*/, Cardinal* /*num_args_return*/
-#endif
-);
-
-extern XtTypedArgList _XtVaCreateTypedArgList(
-#if NeedFunctionPrototypes
- va_list /*var*/, int /*count*/
-#endif
-);
-
-extern void _XtFreeArgList(
-#if NeedFunctionPrototypes
- ArgList /*args*/, int /*total_count*/, int /*typed_count*/
-#endif
-);
-
-extern void _XtGetApplicationResources(
-#if NeedFunctionPrototypes
- Widget /*w*/, XtPointer /*base*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/
-#endif
-);
-
-extern void _XtGetSubresources(
-#if NeedFunctionPrototypes
- Widget /*w*/, XtPointer /*base*/, const char* /*name*/, const char* /*class*/, XtResourceList /*resources*/, Cardinal /*num_resources*/, ArgList /*args*/, Cardinal /*num_args*/, XtTypedArgList /*typed_args*/, Cardinal /*num_typed_args*/
-#endif
-);
-
-#endif /* _VarargsI_h_ */
diff --git a/xc/lib/Xt/Vendor.c b/xc/lib/Xt/Vendor.c
deleted file mode 100644
index 960a1c3dc..000000000
--- a/xc/lib/Xt/Vendor.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $TOG: Vendor.c /main/21 1998/02/06 13:28:00 kaleb $ */
-
-/***********************************************************
-
-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 1987, 1988 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/lib/Xt/Vendor.c,v 1.4 1998/10/03 09:07:02 dawes Exp $ */
-
-/* Make sure all wm properties can make it out of the resource manager */
-
-#include "IntrinsicI.h"
-#include "StringDefs.h"
-#include "Shell.h"
-#include "ShellP.h"
-#include "Vendor.h"
-#include "VendorP.h"
-#include <stdio.h>
-
-/***************************************************************************
- *
- * Vendor shell class record
- *
- ***************************************************************************/
-
-#ifdef __EMX__
-/* to fix the EditRes problem because of wrong linker semantics */
-extern WidgetClass vendorShellWidgetClass;
-unsigned long _DLL_InitTerm(unsigned long mod,unsigned long flag)
-{
- switch (flag) {
- case 0: /*called on init*/
- _CRT_init();
- vendorShellWidgetClass = (WidgetClass)(&vendorShellClassRec);
- return 1;
- case 1: /*called on exit*/
- return 1;
- default:
- return 0;
- }
-}
-#endif
-
-externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = {
- {
- /* superclass */ (WidgetClass) &wmShellClassRec,
- /* class_name */ "VendorShell",
- /* size */ sizeof(VendorShellRec),
- /* Class Initializer */ NULL,
- /* class_part_initialize*/ NULL,
- /* Class init'ed ? */ FALSE,
- /* initialize */ NULL,
- /* initialize_notify */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ NULL,
- /* resource_count */ 0,
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ FALSE,
- /* compress_exposure */ TRUE,
- /* compress_enterleave*/ FALSE,
- /* visible_interest */ FALSE,
- /* destroy */ NULL,
- /* resize */ XtInheritResize,
- /* expose */ NULL,
- /* set_values */ NULL,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* intrinsics version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ NULL,
- /* display_accelerator */ NULL,
- /* extension */ NULL
- },{
- /* geometry_manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- },{
- /* extension */ NULL
- }
-};
-
-#if !defined(AIXSHLIB) || !defined(SHAREDCODE)
-externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass =
- (WidgetClass) (&vendorShellClassRec);
-#endif
diff --git a/xc/lib/Xt/Vendor.h b/xc/lib/Xt/Vendor.h
deleted file mode 100644
index 53b3a7f3c..000000000
--- a/xc/lib/Xt/Vendor.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* $TOG: Vendor.h /main/9 1998/02/06 13:28:06 kaleb $
-* $oHeader: Vendor.h,v 1.2 88/08/18 15:56:44 asente Exp $
-*/
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtVendor_h
-#define _XtVendor_h
-
-/***********************************************************************
- *
- * VendorShell Widget
- *
- ***********************************************************************/
-
-/* Class record constants */
-
-typedef struct _VendorShellClassRec *VendorShellWidgetClass;
-
-externalref WidgetClass vendorShellWidgetClass;
-
-#endif /* _XtVendor_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/VendorP.h b/xc/lib/Xt/VendorP.h
deleted file mode 100644
index 7b80ed995..000000000
--- a/xc/lib/Xt/VendorP.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-* $TOG: VendorP.h /main/12 1998/02/06 13:27:55 kaleb $
-* $oHeader: VendorP.h,v 1.2 88/08/18 15:56:48 asente Exp $
-*/
-
-/***********************************************************
-
-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 1987, 1988 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.
-
-******************************************************************/
-
-/*
- * VendorP.h - Private definitions for VendorShell widget
- *
- * Author: Paul Asente
- * Digital Equipment Corporation
- * Western Software Laboratory
- * Date: Thu Dec 3, 1987
- */
-
-/***********************************************************************
- *
- * VendorShell Widget Private Data
- *
- ***********************************************************************/
-
-#ifndef _XtVendorPrivate_h
-#define _XtVendorPrivate_h
-
-#include <X11/Vendor.h>
-
-/* New fields for the VendorShell widget class record */
-
-typedef struct {
- XtPointer extension; /* pointer to extension record */
-} VendorShellClassPart;
-
-typedef struct _VendorShellClassRec {
- CoreClassPart core_class;
- CompositeClassPart composite_class;
- ShellClassPart shell_class;
- WMShellClassPart wm_shell_class;
- VendorShellClassPart vendor_shell_class;
-} VendorShellClassRec;
-
-externalref VendorShellClassRec vendorShellClassRec;
-
-/* New fields for the vendor shell widget. */
-
-typedef struct {
- int vendor_specific;
-} VendorShellPart;
-
-typedef struct {
- CorePart core;
- CompositePart composite;
- ShellPart shell;
- WMShellPart wm;
- VendorShellPart vendor;
-} VendorShellRec, *VendorShellWidget;
-
-#endif /* _XtVendorPrivate_h */
diff --git a/xc/lib/Xt/Xt-def.cpp b/xc/lib/Xt/Xt-def.cpp
deleted file mode 100644
index 8ea16d0fd..000000000
--- a/xc/lib/Xt/Xt-def.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-LIBRARY Xt
-VERSION LIBRARY_VERSION
-EXPORTS
- applicationShellClassRec DATA
- applicationShellWidgetClass DATA
- compositeClassRec DATA
- compositeWidgetClass DATA
- constraintClassRec DATA
- constraintWidgetClass DATA
- coreWidgetClass DATA
- hookObjClassRec DATA
- hookObjectClass DATA
- objectClass DATA
- objectClassRec DATA
- overrideShellClassRec DATA
- overrideShellWidgetClass DATA
- rectObjClass DATA
- rectObjClassRec DATA
- screenConvertArg DATA
- sessionShellClassRec DATA
- sessionShellWidgetClass DATA
- shellClassRec DATA
- shellWidgetClass DATA
- topLevelShellClassRec DATA
- topLevelShellWidgetClass DATA
- transientShellClassRec DATA
- transientShellWidgetClass DATA
- vendorShellClassRec DATA
- vendorShellWidgetClass DATA
- widgetClass DATA
- widgetClassRec DATA
- wmShellClassRec DATA
- wmShellWidgetClass DATA
- _XtCheckSubclassFlag
- _XtCopyFromArg
- _XtInherit
- _XtInheritTranslations
- _XtIsSubclassOf
- XtAddActions
- XtAddCallback
- XtAddCallbacks
- XtAddConverter
- XtAddEventHandler
- XtAddExposureToRegion
- XtAddGrab
- XtAddInput
- XtAddRawEventHandler
- XtAddSignal
- XtAddTimeOut
- XtAddWorkProc
- XtAllocateGC
- XtAppAddActionHook
- XtAppAddActions
- XtAppAddBlockHook
- XtAppAddConverter
- XtAppAddInput
- XtAppAddSignal
- XtAppAddTimeOut
- XtAppAddWorkProc
- XtAppCreateShell
- XtAppError
- XtAppErrorMsg
- XtAppGetErrorDatabase
- XtAppGetErrorDatabaseText
- XtAppGetExitFlag
- XtAppGetSelectionTimeout
- XtAppInitialize
- XtAppLock
- XtAppMainLoop
- XtAppNextEvent
- XtAppPeekEvent
- XtAppPending
- XtAppProcessEvent
- XtAppReleaseCacheRefs
- XtAppSetErrorHandler
- XtAppSetErrorMsgHandler
- XtAppSetExitFlag
- XtAppSetFallbackResources
- XtAppSetSelectionTimeout
- XtAppSetTypeConverter
- XtAppSetWarningHandler
- XtAppSetWarningMsgHandler
- XtAppUnlock
- XtAppWarning
- XtAppWarningMsg
- XtAugmentTranslations
- XtBuildEventMask
- XtCallAcceptFocus
- XtCallActionProc
- XtCallbackExclusive
- XtCallbackNone
- XtCallbackNonexclusive
- XtCallbackPopdown
- XtCallbackReleaseCacheRef
- XtCallbackReleaseCacheRefList
- XtCallCallbackList
- XtCallCallbacks
- XtCallConverter
- XtCalloc
- XtCancelSelectionRequest
- XtChangeManagedSet
- XtClass
- XtCloseDisplay
- XtConfigureWidget
- XtConvert
- XtConvertAndStore
- XtConvertCase
- XtCreateApplicationContext
- XtCreateApplicationShell
- XtCreateManagedWidget
- XtCreatePopupShell
- XtCreateSelectionRequest
- XtCreateWidget
- XtCreateWindow
- XtCvtColorToPixel
- XtCvtIntToBool
- XtCvtIntToBoolean
- XtCvtIntToColor
- XtCvtIntToFloat
- XtCvtIntToFont
- XtCvtIntToPixel
- XtCvtIntToPixmap
- XtCvtIntToShort
- XtCvtIntToUnsignedChar
- XtCvtStringToAcceleratorTable
- XtCvtStringToAtom
- XtCvtStringToBool
- XtCvtStringToBoolean
- XtCvtStringToCommandArgArray
- XtCvtStringToCursor
- XtCvtStringToDimension
- XtCvtStringToDirectoryString
- XtCvtStringToDisplay
- XtCvtStringToFile
- XtCvtStringToFloat
- XtCvtStringToFont
- XtCvtStringToFontSet
- XtCvtStringToFontStruct
- XtCvtStringToGravity
- XtCvtStringToInitialState
- XtCvtStringToInt
- XtCvtStringToPixel
- XtCvtStringToRestartStyle
- XtCvtStringToShort
- XtCvtStringToTranslationTable
- XtCvtStringToUnsignedChar
- XtCvtStringToVisual
- XtCXtToolkitError
- XtDatabase
- XtDestroyApplicationContext
- XtDestroyGC
- XtDestroyWidget
- XtDirectConvert
- XtDisownSelection
- XtDispatchEvent
- XtDispatchEventToWidget
- XtDisplay
- XtDisplayInitialize
- XtDisplayOfObject
- XtDisplayStringConversionWarning
- XtDisplayToApplicationContext
- XtError
- XtErrorMsg
- XtFindFile
- XtFree
- XtGetActionKeysym
- XtGetActionList
- XtGetApplicationNameAndClass
- XtGetApplicationResources
- XtGetClassExtension
- XtGetConstraintResourceList
- XtGetDisplays
- XtGetErrorDatabase
- XtGetErrorDatabaseText
- XtGetGC
- XtGetKeyboardFocusWidget
- XtGetKeysymTable
- XtGetMultiClickTime
- XtGetResourceList
- XtGetSelectionParameters
- XtGetSelectionRequest
- XtGetSelectionTimeout
- XtGetSelectionValue
- XtGetSelectionValueIncremental
- XtGetSelectionValues
- XtGetSelectionValuesIncremental
- XtGetSubresources
- XtGetSubvalues
- XtGetValues
- XtGrabButton
- XtGrabKey
- XtGrabKeyboard
- XtGrabPointer
- XtHasCallbacks
- XtHooksOfDisplay
- XtInitialize
- XtInitializeWidgetClass
- XtInsertEventHandler
- XtInsertEventTypeHandler
- XtInsertRawEventHandler
- XtInstallAccelerators
- XtInstallAllAccelerators
- XtIsApplicationShell
- XtIsComposite
- XtIsConstraint
- XtIsManaged
- XtIsObject
- XtIsOverrideShell
- XtIsRealized
- XtIsRectObj
- XtIsSensitive
- XtIsSessionShell
- XtIsShell
- XtIsSubclass
- XtIsTopLevelShell
- XtIsTransientShell
- XtIsVendorShell
- XtIsWidget
- XtIsWMShell
- XtKeysymToKeycodeList
- XtLastEventProcessed
- XtLastTimestampProcessed
- XtMainLoop
- XtMakeGeometryRequest
- XtMakeResizeRequest
- XtMalloc
- XtManageChild
- XtManageChildren
- XtMapWidget
- XtMenuPopupAction
- XtMergeArgLists
- XtMoveWidget
- XtName
- XtNameToWidget
- XtNewString
- XtNextEvent
- XtNoticeSignal
- XtOpenApplication
- XtOpenDisplay
- XtOverrideTranslations
- XtOwnSelection
- XtOwnSelectionIncremental
- XtParent
- XtParseAcceleratorTable
- XtParseTranslationTable
- XtPeekEvent
- XtPending
- XtPopdown
- XtPopup
- XtPopupSpringLoaded
- XtProcessEvent
- XtProcessLock
- XtProcessUnlock
- XtQueryGeometry
- XtRealizeWidget
- XtRealloc
- XtRegisterCaseConverter
- XtRegisterDrawable
- XtRegisterExtensionSelector
- XtRegisterGrabAction
- XtReleaseGC
- XtReleasePropertyAtom
- XtRemoveActionHook
- XtRemoveAllCallbacks
- XtRemoveBlockHook
- XtRemoveCallback
- XtRemoveCallbacks
- XtRemoveEventHandler
- XtRemoveEventTypeHandler
- XtRemoveGrab
- XtRemoveInput
- XtRemoveRawEventHandler
- XtRemoveSignal
- XtRemoveTimeOut
- XtRemoveWorkProc
- XtReservePropertyAtom
- XtResizeWidget
- XtResizeWindow
- XtResolvePathname
- XtScreen
- XtScreenDatabase
- XtScreenOfObject
- XtSendSelectionRequest
- XtSessionGetToken
- XtSessionReturnToken
- XtSetErrorHandler
- XtSetErrorMsgHandler
- XtSetEventDispatcher
- XtSetKeyboardFocus
- XtSetKeyTranslator
- XtSetLanguageProc
- XtSetMappedWhenManaged
- XtSetMultiClickTime
- XtSetSelectionParameters
- XtSetSelectionTimeout
- XtSetSensitive
- XtSetSubvalues
- XtSetTypeConverter
- XtSetValues
- XtSetWarningHandler
- XtSetWarningMsgHandler
- XtSetWMColormapWindows
- XtShellStrings
- XtStringConversionWarning
- XtStrings
- XtSuperclass
- XtToolkitInitialize
- XtToolkitThreadInitialize
- XtTranslateCoords
- XtTranslateKey
- XtTranslateKeycode
- XtUngrabButton
- XtUngrabKey
- XtUngrabKeyboard
- XtUngrabPointer
- XtUninstallTranslations
- XtUnmanageChild
- XtUnmanageChildren
- XtUnmapWidget
- XtUnrealizeWidget
- XtUnregisterDrawable
- XtVaAppCreateShell
- XtVaAppInitialize
- XtVaCreateArgsList
- XtVaCreateManagedWidget
- XtVaCreatePopupShell
- XtVaCreateWidget
- XtVaGetApplicationResources
- XtVaGetSubresources
- XtVaGetSubvalues
- XtVaGetValues
- XtVaOpenApplication
- XtVaSetSubvalues
- XtVaSetValues
- XtWarning
- XtWarningMsg
- XtWidgetToApplicationContext
- XtWindow
- XtWindowOfObject
- XtWindowToWidget
-/* $TOG: Xt-def.cpp /main/1 1997/09/16 10:02:29 kaleb $ */
diff --git a/xc/lib/Xt/Xtos.h b/xc/lib/Xt/Xtos.h
deleted file mode 100644
index 59a020651..000000000
--- a/xc/lib/Xt/Xtos.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* $TOG: Xtos.h /main/20 1998/02/06 13:28:11 kaleb $
-*/
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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/lib/Xt/Xtos.h,v 3.3 1998/10/03 09:07:03 dawes Exp $ */
-
-#ifndef _Xtos_h
-#define _Xtos_h
-
-#define ALLOCATE_LOCAL_FALLBACK(_size) XtMalloc((unsigned long)(_size))
-#define DEALLOCATE_LOCAL_FALLBACK(_ptr) XtFree((XtPointer)(_ptr))
-#include <X11/Xalloca.h>
-
-#ifdef CRAY
-#define WORD64
-#endif
-
-#if defined(__alpha) || defined(__alpha__)
-#define LONG64
-#endif
-
-#ifdef __sgi
-#if (_MIPS_SZLONG == 64)
-#define LONG64
-#endif
-#endif
-
-#endif /* _Xtos_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/Xtos2.def b/xc/lib/Xt/Xtos2.def
deleted file mode 100644
index c6c3da3ca..000000000
--- a/xc/lib/Xt/Xtos2.def
+++ /dev/null
@@ -1,475 +0,0 @@
-LIBRARY Xt INITINSTANCE TERMINSTANCE
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xt/Xtos2.def,v 3.7 1999/04/29 09:13:33 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- XtAppAddActionHook @ 1
- XtRemoveActionHook @ 2
- XtMalloc @ 3
- XtRealloc @ 4
- XtCalloc @ 5
- XtFree @ 6
- XtMergeArgLists @ 7
- XtAddCallback @ 8
- XtAddCallbacks @ 9
- XtRemoveCallback @ 10
- XtRemoveCallbacks @ 11
- XtRemoveAllCallbacks @ 12
- XtCallCallbacks @ 13
- XtHasCallbacks @ 14
- XtCallCallbackList @ 15
- XtSetMultiClickTime @ 16
- XtGetMultiClickTime @ 17
- XtSetTypeConverter @ 18
- XtAppSetTypeConverter @ 19
- XtAddConverter @ 20
- XtAppAddConverter @ 21
- XtCallConverter @ 22
- XtConvert @ 23
- XtConvertAndStore @ 24
- XtAppReleaseCacheRefs @ 25
- XtCallbackReleaseCacheRefList @ 26
- XtCallbackReleaseCacheRef @ 27
- XtDisplayStringConversionWarning @ 28
- XtStringConversionWarning @ 29
- XtCvtIntToBoolean @ 30
- XtCvtIntToShort @ 31
- XtCvtStringToBoolean @ 32
- XtCvtIntToBool @ 33
- XtCvtStringToBool @ 34
- XtCvtIntToColor @ 35
- XtCvtStringToPixel @ 36
- XtCvtStringToCursor @ 37
- XtCvtStringToDisplay @ 38
- XtCvtStringToFile @ 39
- XtCvtIntToFloat @ 40
- XtCvtStringToFloat @ 41
- XtCvtStringToFont @ 42
- XtCvtIntToFont @ 43
- XtCvtStringToFontSet @ 44
- XtCvtStringToFontStruct @ 45
- XtCvtStringToInt @ 46
- XtCvtStringToShort @ 47
- XtCvtStringToDimension @ 48
- XtCvtIntToUnsignedChar @ 49
- XtCvtStringToUnsignedChar @ 50
- XtCvtColorToPixel @ 51
- XtCvtIntToPixel @ 52
- XtCvtIntToPixmap @ 53
- XtCvtStringToInitialState @ 54
- XtCvtStringToVisual @ 55
- XtCvtStringToAtom @ 56
- XtCvtStringToDirectoryString @ 57
- XtCvtStringToCommandArgArray @ 58
- XtInitializeWidgetClass @ 59
- XtCreateWidget @ 60
- XtCreateManagedWidget @ 61
- XtCreatePopupShell @ 62
- XtAppCreateShell @ 63
- XtCreateApplicationShell @ 64
- XtDestroyWidget @ 65
- XtOpenDisplay @ 66
- XtDisplayInitialize @ 67
- XtCreateApplicationContext @ 68
- XtDestroyApplicationContext @ 69
- XtDatabase @ 70
- XtDisplayToApplicationContext @ 71
- XtCloseDisplay @ 72
- XtWidgetToApplicationContext @ 73
- XtGetApplicationNameAndClass @ 74
- XtGetErrorDatabase @ 75
- XtAppGetErrorDatabase @ 76
- XtGetErrorDatabaseText @ 77
- XtAppGetErrorDatabaseText @ 78
- XtErrorMsg @ 79
- XtAppErrorMsg @ 80
- XtWarningMsg @ 81
- XtAppWarningMsg @ 82
- XtSetErrorMsgHandler @ 83
- XtAppSetErrorMsgHandler @ 84
- XtSetWarningMsgHandler @ 85
- XtAppSetWarningMsgHandler @ 86
- XtError @ 87
- XtAppError @ 88
- XtWarning @ 89
- XtAppWarning @ 90
- XtSetErrorHandler @ 91
- XtAppSetErrorHandler @ 92
- XtSetWarningHandler @ 93
- XtAppSetWarningHandler @ 94
- XtBuildEventMask @ 95
- XtRemoveEventHandler @ 96
- XtAddEventHandler @ 97
- XtInsertEventHandler @ 98
- XtRemoveRawEventHandler @ 99
- XtInsertRawEventHandler @ 100
- XtAddRawEventHandler @ 101
- XtWindowToWidget @ 102
- XtDispatchEvent @ 103
- XtAddGrab @ 104
- XtRemoveGrab @ 105
- XtMainLoop @ 106
- XtAppMainLoop @ 107
- XtAddExposureToRegion @ 108
- XtLastTimestampProcessed @ 109
- XtIsRectObj @ 110
- XtIsWidget @ 111
- XtIsComposite @ 112
- XtIsConstraint @ 113
- XtIsShell @ 114
- XtIsOverrideShell @ 115
- XtIsWMShell @ 116
- XtIsVendorShell @ 117
- XtIsTransientShell @ 118
- XtIsTopLevelShell @ 119
- XtIsApplicationShell @ 120
- XtMapWidget @ 121
- XtUnmapWidget @ 122
- XtNewString @ 123
- XtIsSessionShell @ 124
- XtAllocateGC @ 125
- XtGetGC @ 126
- XtReleaseGC @ 127
- XtDestroyGC @ 128
- XtMakeGeometryRequest @ 129
- XtMakeResizeRequest @ 130
- XtResizeWindow @ 131
- XtResizeWidget @ 132
- XtConfigureWidget @ 133
- XtMoveWidget @ 134
- XtTranslateCoords @ 135
- XtQueryGeometry @ 136
- XtGetActionKeysym @ 137
- XtGetResourceList @ 138
- XtGetConstraintResourceList @ 139
- XtGetValues @ 140
- XtGetSubvalues @ 141
- XtToolkitInitialize @ 142
- XtSetLanguageProc @ 143
- XtScreenDatabase @ 144
- XtAppSetFallbackResources @ 145
- XtAppInitialize @ 146
- XtInitialize @ 147
- XtOpenApplication @ 148
- XtIsSubclass @ 149
- XtRealizeWidget @ 150
- XtUnrealizeWidget @ 151
- XtCreateWindow @ 152
- XtNameToWidget @ 153
- XtDisplayOfObject @ 154
- XtDisplay @ 155
- XtScreenOfObject @ 156
- XtScreen @ 157
- XtWindowOfObject @ 158
- XtWindow @ 159
- XtSuperclass @ 160
- XtClass @ 161
- XtIsManaged @ 162
- XtIsRealized @ 163
- XtIsSensitive @ 164
- XtParent @ 165
- XtName @ 166
- XtIsObject @ 167
- XtFindFile @ 168
- XtResolvePathname @ 169
- XtCallAcceptFocus @ 170
- XtSetKeyboardFocus @ 171
- XtUnmanageChildren @ 172
- XtUnmanageChild @ 173
- XtManageChildren @ 174
- XtManageChild @ 175
- XtSetMappedWhenManaged @ 176
- XtAddTimeOut @ 177
- XtAppAddTimeOut @ 178
- XtRemoveTimeOut @ 179
- XtAddWorkProc @ 180
- XtAppAddWorkProc @ 181
- XtRemoveWorkProc @ 182
- XtAddInput @ 183
- XtAppAddInput @ 184
- XtRemoveInput @ 185
- XtNextEvent @ 186
- XtAppNextEvent @ 187
- XtProcessEvent @ 188
- XtAppProcessEvent @ 189
- XtPending @ 190
- XtAppPending @ 191
- XtPeekEvent @ 192
- XtAppPeekEvent @ 193
- XtGrabKey @ 194
- XtGrabButton @ 195
- XtUngrabKey @ 196
- XtUngrabButton @ 197
- XtGrabKeyboard @ 198
- XtUngrabKeyboard @ 199
- XtGrabPointer @ 200
- XtUngrabPointer @ 201
- XtPopup @ 202
- XtPopupSpringLoaded @ 203
- XtPopdown @ 204
- XtCallbackPopdown @ 205
- XtCallbackNone @ 206
- XtCallbackNonexclusive @ 207
- XtCallbackExclusive @ 208
- XtGetSubresources @ 209
- XtGetApplicationResources @ 210
- XtSetSelectionTimeout @ 211
- XtAppSetSelectionTimeout @ 212
- XtGetSelectionTimeout @ 213
- XtAppGetSelectionTimeout @ 214
- XtOwnSelection @ 215
- XtOwnSelectionIncremental @ 216
- XtDisownSelection @ 217
- XtGetSelectionValue @ 218
- XtGetSelectionValueIncremental @ 219
- XtGetSelectionValues @ 220
- XtGetSelectionValuesIncremental @ 221
- XtGetSelectionRequest @ 222
- XtSetSensitive @ 223
- XtSetSubvalues @ 224
- XtSetValues @ 225
- XtSetWMColormapWindows @ 226
- XtAddActions @ 227
- XtAppAddActions @ 228
- XtGetActionList @ 229
- XtMenuPopupAction @ 230
- XtCallActionProc @ 231
- XtRegisterGrabAction @ 232
- XtConvertCase @ 233
- XtTranslateKeycode @ 234
- XtTranslateKey @ 235
- XtSetKeyTranslator @ 236
- XtRegisterCaseConverter @ 237
- XtGetKeysymTable @ 238
- XtKeysymToKeycodeList @ 239
- XtCvtStringToAcceleratorTable @ 240
- XtCvtStringToTranslationTable @ 241
- XtParseAcceleratorTable @ 242
- XtParseTranslationTable @ 243
- XtUninstallTranslations @ 244
- XtInstallAccelerators @ 245
- XtInstallAllAccelerators @ 246
- XtAugmentTranslations @ 247
- XtOverrideTranslations @ 248
- XtVaCreateWidget @ 249
- XtVaCreateManagedWidget @ 250
- XtVaAppCreateShell @ 251
- XtVaCreatePopupShell @ 252
- XtVaSetValues @ 253
- XtVaSetSubvalues @ 254
- XtVaAppInitialize @ 255
- XtVaOpenApplication @ 256
- XtVaGetSubresources @ 257
- XtVaGetApplicationResources @ 258
- XtVaGetValues @ 259
- XtVaGetSubvalues @ 260
- XtVaCreateArgsList @ 261
- XtCvtStringToRestartStyle @ 262
- XtCvtStringToGravity @ 263
- XtAppSetExitFlag @ 264
- XtAppGetExitFlag @ 265
- XtGetDisplays @ 266
- XtRemoveEventTypeHandler @ 267
- XtInsertEventTypeHandler @ 268
- XtRegisterDrawable @ 269
- XtUnregisterDrawable @ 270
- XtDispatchEventToWidget @ 271
- XtLastEventProcessed @ 272
- XtSetEventDispatcher @ 273
- XtRegisterExtensionSelector @ 274
- XtAppAddBlockHook @ 275
- XtRemoveBlockHook @ 276
- XtHooksOfDisplay @ 277
- XtGetClassExtension @ 278
- XtGetKeyboardFocusWidget @ 279
- XtChangeManagedSet @ 280
- XtAddSignal @ 281
- XtAppAddSignal @ 282
- XtRemoveSignal @ 283
- XtNoticeSignal @ 284
- XtReservePropertyAtom @ 285
- XtReleasePropertyAtom @ 286
- XtCreateSelectionRequest @ 287
- XtSendSelectionRequest @ 288
- XtCancelSelectionRequest @ 289
- XtSetSelectionParameters @ 290
- XtGetSelectionParameters @ 291
- XtSessionGetToken @ 292
- XtSessionReturnToken @ 293
- XtAppLock @ 294
- XtAppUnlock @ 295
- XtProcessLock @ 296
- XtProcessUnlock @ 297
- XtToolkitThreadInitialize @ 298
- _XtDoFreeBindings @ 299
- _XtAllocError @ 300
- _XtHeapInit @ 301
- _XtHeapAlloc @ 302
- _XtHeapFree @ 303
- _XtAddCallback @ 304
- _XtAddCallbackOnce @ 305
- _XtRemoveCallback @ 306
- _XtRemoveAllCallbacks @ 307
- _XtCompileCallbackList @ 308
- _XtGetCallbackList @ 309
- _XtCallConditionalCallbackList @ 310
- _XtSetDefaultConverterTable @ 311
- _XtFreeConverterTable @ 312
- _XtTableAddConverter @ 313
- _XtCacheFlushTag @ 314
- _XtConvert @ 315
- _XtConvertInitialize @ 316
- _XtAddDefaultConverters @ 317
- _XtCreateWidget @ 318
- _XtCreatePopupShell @ 319
- _XtAppCreateShell @ 320
- _XtDoPhase2Destroy @ 321
- _XtGetProcessContext @ 322
- _XtDefaultAppContext @ 323
- _XtAppInit @ 324
- _XtDestroyAppContexts @ 325
- _XtSortPerDisplayList @ 326
- _XtCloseDisplays @ 327
- _XtDefaultErrorMsg @ 328
- _XtDefaultWarningMsg @ 329
- _XtDefaultError @ 330
- _XtDefaultWarning @ 331
- _XtSetDefaultErrorHandlers @ 332
- _XtAllocWWTable @ 333
- _XtFreeWWTable @ 334
- _XtConvertTypeToMask @ 335
- _XtOnGrabList @ 336
- _XtEventInitialize @ 337
- _XtFreeEventTable @ 338
- _XtSendFocusEvent @ 339
- _XtFreePerWidgetInput @ 340
- _XtGetPerWidgetInput @ 341
- _XtFillAncestorList @ 342
- _XtFindRemapWidget @ 343
- _XtUngrabBadGrabs @ 344
- _XtGClistFree @ 345
- _XtMakeGeometryRequest @ 346
- _XtInherit @ 347
- _XtPreparseCommandLine @ 348
- _XtDisplayInitialize @ 349
- _XtCheckSubclassFlag @ 350
- _XtIsSubclassOf @ 351
- _XtWindowedAncestor @ 352
- _XtProcessKeyboardEvent @ 353
- _XtHandleFocus @ 354
- _XtRemoveAllInputs @ 355
- _XtRefreshMapping @ 356
- _XtDestroyServerGrabs @ 357
- _XtCheckServerGrabsOnWidget @ 358
- _XtProcessPointerEvent @ 359
- _XtPopup @ 360
- _XtCopyFromParent @ 361
- _XtCopyFromArg @ 362
- _XtCopyToArg @ 363
- _XtCompileResourceList @ 364
- _XtDependencies @ 365
- _XtResourceDependencies @ 366
- _XtConstraintResDependencies @ 367
- _XtCreateIndirectionTable @ 368
- _XtGetResources @ 369
- _XtResourceListInitialize @ 370
- _XtSetDefaultSelectionTimeout @ 371
- _XtShellGetCoordinates @ 372
- _XtInitializeActionData @ 373
- _XtBindActions @ 374
- _XtUnbindActions @ 375
- _XtFreeActions @ 376
- _XtRegisterGrabs @ 377
- _XtGrabInitialize @ 378
- _XtComputeLateBindings @ 379
- _XtAllocTMContext @ 380
- _XtMatchUsingDontCareMods @ 381
- _XtMatchUsingStandardMods @ 382
- _XtBuildKeysymTables @ 383
- _XtTranslateInitialize @ 384
- _XtAddTMConverters @ 385
- _XtPrintXlations @ 386
- _XtDisplayTranslations @ 387
- _XtDisplayAccelerators @ 388
- _XtDisplayInstalledAccelerators @ 389
- _XtPrintActions @ 390
- _XtPrintState @ 391
- _XtPrintEventSeq @ 392
- _XtGetQuarkIndex @ 393
- _XtGetTypeIndex @ 394
- _XtGetModifierIndex @ 395
- _XtRegularMatch @ 396
- _XtMatchAtom @ 397
- _XtTranslateEvent @ 398
- _XtTraverseStateTree @ 399
- _XtInstallTranslations @ 400
- _XtRemoveTranslations @ 401
- _XtDestroyTMData @ 402
- _XtCreateXlations @ 403
- _XtParseTreeToStateTree @ 404
- _XtAddEventSeqToStateTree @ 405
- _XtCvtMergeTranslations @ 406
- _XtGetTranslationValue @ 407
- _XtRemoveStateTreeByIndex @ 408
- _XtFreeTranslations @ 409
- _XtMergeTranslations @ 410
- _XtUnmergeTranslations @ 411
- _XtPopupInitialize @ 412
- _XtVaAppInitialize @ 413
- _XtVaOpenApplication @ 414
- _XtCountVaList @ 415
- _XtVaCreateTypedArgList @ 416
- _XtVaToArgList @ 417
- _XtVaToTypedArgList @ 418
- _XtPeekCallback @ 419
- _XtCreateHookObj @ 420
- _XtGetPerDisplay @ 421
- _XtGetPerDisplayInput @ 422
- _XtExtensionSelect @ 423
- _XtAddShellToHookObj @ 424
- _XtIsHookObject @ 425
- _XtGetUserName @ 426
- _XtWaitForSomething @ 427
- XtDirectConvert @ 433
- colorConvertArgs @ 435
- screenConvertArg @ 436
- XtCXtToolkitError @ 437
- _XtQString @ 438
- _XtAppDestroyCount @ 439
- _XtperDisplayList @ 440
- _XtGlobalTM @ 444
- XtStrings @ 445
- overrideShellClassRec @ 446
- overrideShellWidgetClass @ 447
- constraintClassRec @ 448
- constraintWidgetClass @ 449
- objectClassRec @ 450
- objectClass @ 451
- widgetClassRec @ 452
- widgetClass @ 453
- rectObjClassRec @ 454
- rectObjClass @ 455
- coreWidgetClass @ 457
- wmShellClassRec @ 458
- wmShellWidgetClass @ 459
- XtShellStrings @ 460
- topLevelShellClassRec @ 461
- topLevelShellWidgetClass @ 462
- transientShellClassRec @ 463
- transientShellWidgetClass @ 464
- shellClassRec @ 465
- shellWidgetClass @ 466
- compositeClassRec @ 467
- compositeWidgetClass @ 468
- applicationShellClassRec @ 469
- applicationShellWidgetClass @ 470
- _XtInheritTranslations @ 471
- sessionShellClassRec @ 472
- sessionShellWidgetClass @ 473
- vendorShellClassRec @ 474
- vendorShellWidgetClass @ 475
- hookObjClassRec @ 476
- hookObjectClass @ 477
diff --git a/xc/lib/Xt/Xtos2.rsp b/xc/lib/Xt/Xtos2.rsp
deleted file mode 100644
index d4c85cd8c..000000000
--- a/xc/lib/Xt/Xtos2.rsp
+++ /dev/null
@@ -1,12 +0,0 @@
-ActionHook.obj Alloc.obj ArgList.obj Callback.obj ClickTime.obj Composite.obj+
-Constraint.obj Convert.obj Converters.obj Core.obj Create.obj Destroy.obj+
-Display.obj Error.obj Event.obj EventUtil.obj Functions.obj GCManager.obj+
-Geometry.obj GetActKey.obj GetResList.obj GetValues.obj HookObj.obj Hooks.obj+
-Initialize.obj Intrinsic.obj Keyboard.obj Manage.obj NextEvent.obj Object.obj+
-PassivGrab.obj Pointer.obj Popup.obj PopupCB.obj RectObj.obj Resources.obj+
-ResConfig.obj Selection.obj SetSens.obj SetValues.obj SetWMCW.obj Shell.obj+
-StringDefs.obj TMaction.obj TMgrab.obj TMkey.obj TMparse.obj TMprint.obj+
-TMstate.obj Threads.obj VarCreate.obj VarGet.obj Varargs.obj Vendor.obj+
-/NOI /NOL /NOD /BAT
-Xt.dll
-Xt.map
diff --git a/xc/lib/Xt/jump_funcs b/xc/lib/Xt/jump_funcs
deleted file mode 100644
index 44d91a7c4..000000000
--- a/xc/lib/Xt/jump_funcs
+++ /dev/null
@@ -1,752 +0,0 @@
-# $XConsortium: jump_funcs,v 1.4 95/06/30 18:48:53 kaleb Exp $
-# $XFree86: xc/lib/Xt/jump_funcs,v 3.5 1996/12/30 13:58:31 dawes Exp $
-#
-00000000 T _XtAppAddActionHook libXt ActionHook
-00000000 T _XtRemoveActionHook libXt ActionHook
-00000000 T __XtAllocError libXt Alloc
-00000000 T __XtHeapInit libXt Alloc
-00000000 T _XtMalloc libXt Alloc
-00000000 T _XtRealloc libXt Alloc
-00000000 T _XtCalloc libXt Alloc
-00000000 T _XtFree libXt Alloc
-00000000 T __XtHeapAlloc libXt Alloc
-00000000 T __XtHeapFree libXt Alloc
-00000000 T _XtMergeArgLists libXt ArgList
-00000000 T __XtAddCallback libXt Callback
-00000000 T __XtAddCallbackOnce libXt Callback
-00000000 T _XtAddCallback libXt Callback
-00000000 T _XtAddCallbacks libXt Callback
-00000000 T __XtRemoveCallback libXt Callback
-00000000 T _XtRemoveCallback libXt Callback
-00000000 T _XtRemoveCallbacks libXt Callback
-00000000 T __XtRemoveAllCallbacks libXt Callback
-00000000 T _XtRemoveAllCallbacks libXt Callback
-00000000 T __XtCompileCallbackList libXt Callback
-00000000 T __XtGetCallbackList libXt Callback
-00000000 T _XtCallCallbacks libXt Callback
-00000000 T _XtHasCallbacks libXt Callback
-00000000 T _XtCallCallbackList libXt Callback
-00000000 T __XtCallConditionalCallbackList libXt Callback
-00000000 T _XtSetMultiClickTime libXt ClickTime
-00000000 T _XtGetMultiClickTime libXt ClickTime
-00000000 T __XtSetDefaultConverterTable libXt Convert
-00000000 T __XtFreeConverterTable libXt Convert
-00000000 T __XtTableAddConverter libXt Convert
-00000000 T _XtSetTypeConverter libXt Convert
-00000000 T _XtAppSetTypeConverter libXt Convert
-00000000 T _XtAddConverter libXt Convert
-00000000 T _XtAppAddConverter libXt Convert
-00000000 T __XtCacheFlushTag libXt Convert
-00000000 T _XtDirectConvert libXt Convert
-00000000 T _XtCallConverter libXt Convert
-00000000 T __XtConvert libXt Convert
-00000000 T _XtConvert libXt Convert
-00000000 T _XtConvertAndStore libXt Convert
-00000000 T _XtAppReleaseCacheRefs libXt Convert
-00000000 T _XtCallbackReleaseCacheRefList libXt Convert
-00000000 T _XtCallbackReleaseCacheRef libXt Convert
-00000000 T __XtConvertInitialize libXt Converters
-00000000 T _XtDisplayStringConversionWarning libXt Converters
-00000000 T _XtStringConversionWarning libXt Converters
-00000000 T _XtCvtIntToBoolean libXt Converters
-00000000 T _XtCvtIntToShort libXt Converters
-00000000 T _XtCvtStringToBoolean libXt Converters
-00000000 T _XtCvtIntToBool libXt Converters
-00000000 T _XtCvtStringToBool libXt Converters
-00000000 T _XtCvtIntToColor libXt Converters
-00000000 T _XtCvtStringToPixel libXt Converters
-00000000 T _XtCvtStringToCursor libXt Converters
-00000000 T _XtCvtStringToDisplay libXt Converters
-00000000 T _XtCvtStringToFile libXt Converters
-00000000 T _XtCvtIntToFloat libXt Converters
-00000000 T _XtCvtStringToFloat libXt Converters
-00000000 T _XtCvtStringToFont libXt Converters
-00000000 T _XtCvtIntToFont libXt Converters
-00000000 T _XtCvtStringToFontSet libXt Converters
-00000000 T _XtCvtStringToFontStruct libXt Converters
-00000000 T _XtCvtStringToInt libXt Converters
-00000000 T _XtCvtStringToShort libXt Converters
-00000000 T _XtCvtStringToDimension libXt Converters
-00000000 T _XtCvtIntToUnsignedChar libXt Converters
-00000000 T _XtCvtStringToUnsignedChar libXt Converters
-00000000 T _XtCvtColorToPixel libXt Converters
-00000000 T _XtCvtIntToPixel libXt Converters
-00000000 T _XtCvtIntToPixmap libXt Converters
-00000000 T _XtCvtStringToInitialState libXt Converters
-00000000 T _XtCvtStringToVisual libXt Converters
-00000000 T _XtCvtStringToAtom libXt Converters
-00000000 T __XtAddDefaultConverters libXt Converters
-00000000 T _XtCvtStringToDirectoryString libXt Converters
-00000000 T _XtCvtStringToCommandArgArray libXt Converters
-00000000 T _XtInitializeWidgetClass libXt Create
-00000000 T __XtCreateWidget libXt Create
-00000000 T _XtCreateWidget libXt Create
-00000000 T _XtCreateManagedWidget libXt Create
-00000000 T __XtCreatePopupShell libXt Create
-00000000 T _XtCreatePopupShell libXt Create
-00000000 T __XtAppCreateShell libXt Create
-00000000 T _XtAppCreateShell libXt Create
-00000000 T _XtCreateApplicationShell libXt Create
-00000000 T __XtDoPhase2Destroy libXt Destroy
-00000000 T _XtDestroyWidget libXt Destroy
-00000000 T __XtGetProcessContext libXt Display
-00000000 T __XtDefaultAppContext libXt Display
-00000000 T _XtOpenDisplay libXt Display
-00000000 T __XtAppInit libXt Display
-00000000 T _XtDisplayInitialize libXt Display
-00000000 T _XtCreateApplicationContext libXt Display
-00000000 T _XtDestroyApplicationContext libXt Display
-00000000 T __XtDestroyAppContexts libXt Display
-00000000 T _XtDatabase libXt Display
-00000000 T __XtSortPerDisplayList libXt Display
-00000000 T _XtDisplayToApplicationContext libXt Display
-00000000 T _XtCloseDisplay libXt Display
-00000000 T __XtCloseDisplays libXt Display
-00000000 T _XtWidgetToApplicationContext libXt Display
-00000000 T _XtGetApplicationNameAndClass libXt Display
-00000000 T _XtGetErrorDatabase libXt Error
-00000000 T _XtAppGetErrorDatabase libXt Error
-00000000 T _XtGetErrorDatabaseText libXt Error
-00000000 T _XtAppGetErrorDatabaseText libXt Error
-00000000 T __XtDefaultErrorMsg libXt Error
-00000000 T __XtDefaultWarningMsg libXt Error
-00000000 T _XtErrorMsg libXt Error
-00000000 T _XtAppErrorMsg libXt Error
-00000000 T _XtWarningMsg libXt Error
-00000000 T _XtAppWarningMsg libXt Error
-00000000 T _XtSetErrorMsgHandler libXt Error
-00000000 T _XtAppSetErrorMsgHandler libXt Error
-00000000 T _XtSetWarningMsgHandler libXt Error
-00000000 T _XtAppSetWarningMsgHandler libXt Error
-00000000 T __XtDefaultError libXt Error
-00000000 T __XtDefaultWarning libXt Error
-00000000 T _XtError libXt Error
-00000000 T _XtAppError libXt Error
-00000000 T _XtWarning libXt Error
-00000000 T _XtAppWarning libXt Error
-00000000 T _XtSetErrorHandler libXt Error
-00000000 T _XtAppSetErrorHandler libXt Error
-00000000 T _XtSetWarningHandler libXt Error
-00000000 T _XtAppSetWarningHandler libXt Error
-00000000 T __XtSetDefaultErrorHandlers libXt Error
-00000000 T _XtBuildEventMask libXt Event
-00000000 T _XtRemoveEventHandler libXt Event
-00000000 T _XtAddEventHandler libXt Event
-00000000 T _XtInsertEventHandler libXt Event
-00000000 T _XtRemoveRawEventHandler libXt Event
-00000000 T _XtInsertRawEventHandler libXt Event
-00000000 T _XtAddRawEventHandler libXt Event
-00000000 T _XtWindowToWidget libXt Event
-00000000 T __XtAllocWWTable libXt Event
-00000000 T __XtFreeWWTable libXt Event
-00000000 T __XtConvertTypeToMask libXt Event
-00000000 T __XtOnGrabList libXt Event
-00000000 T _XtDispatchEvent libXt Event
-00000000 T _XtAddGrab libXt Event
-00000000 T _XtRemoveGrab libXt Event
-00000000 T _XtMainLoop libXt Event
-00000000 T _XtAppMainLoop libXt Event
-00000000 T __XtEventInitialize libXt Event
-00000000 T _XtAddExposureToRegion libXt Event
-00000000 T __XtFreeEventTable libXt Event
-00000000 T _XtLastTimestampProcessed libXt Event
-00000000 T __XtSendFocusEvent libXt Event
-00000000 T __XtFreePerWidgetInput libXt EventUtil
-00000000 T __XtGetPerWidgetInput libXt EventUtil
-00000000 T __XtFillAncestorList libXt EventUtil
-00000000 T __XtFindRemapWidget libXt EventUtil
-00000000 T __XtUngrabBadGrabs libXt EventUtil
-00000000 T _XtIsRectObj libXt Functions
-00000000 T _XtIsWidget libXt Functions
-00000000 T _XtIsComposite libXt Functions
-00000000 T _XtIsConstraint libXt Functions
-00000000 T _XtIsShell libXt Functions
-00000000 T _XtIsOverrideShell libXt Functions
-00000000 T _XtIsWMShell libXt Functions
-00000000 T _XtIsVendorShell libXt Functions
-00000000 T _XtIsTransientShell libXt Functions
-00000000 T _XtIsTopLevelShell libXt Functions
-00000000 T _XtIsApplicationShell libXt Functions
-00000000 T _XtMapWidget libXt Functions
-00000000 T _XtUnmapWidget libXt Functions
-00000000 T _XtNewString libXt Functions
-00000000 T _XtIsSessionShell libXt Functions
-00000000 T __XtGClistFree libXt GCManager
-00000000 T _XtAllocateGC libXt GCManager
-00000000 T _XtGetGC libXt GCManager
-00000000 T _XtReleaseGC libXt GCManager
-00000000 T _XtDestroyGC libXt GCManager
-00000000 T __XtMakeGeometryRequest libXt Geometry
-00000000 T _XtMakeGeometryRequest libXt Geometry
-00000000 T _XtMakeResizeRequest libXt Geometry
-00000000 T _XtResizeWindow libXt Geometry
-00000000 T _XtResizeWidget libXt Geometry
-00000000 T _XtConfigureWidget libXt Geometry
-00000000 T _XtMoveWidget libXt Geometry
-00000000 T _XtTranslateCoords libXt Geometry
-00000000 T _XtQueryGeometry libXt Geometry
-00000000 T _XtGetActionKeysym libXt GetActKey
-00000000 T _XtGetResourceList libXt GetResList
-00000000 T _XtGetConstraintResourceList libXt GetResList
-00000000 T _XtGetValues libXt GetValues
-00000000 T _XtGetSubvalues libXt GetValues
-00000000 T __XtInherit libXt Initialize
-00000000 T _XtToolkitInitialize libXt Initialize
-00000000 T _XtSetLanguageProc libXt Initialize
-00000000 T _XtScreenDatabase libXt Initialize
-00000000 T __XtPreparseCommandLine libXt Initialize
-00000000 T __XtDisplayInitialize libXt Initialize
-00000000 T _XtAppSetFallbackResources libXt Initialize
-00000000 T _XtAppInitialize libXt Initialize
-00000000 T _XtInitialize libXt Initialize
-00000000 T _XtOpenApplication libXt Initialize
-00000000 T _XtIsSubclass libXt Intrinsic
-00000000 T __XtCheckSubclassFlag libXt Intrinsic
-00000000 T __XtIsSubclassOf libXt Intrinsic
-00000000 T _XtRealizeWidget libXt Intrinsic
-00000000 T _XtUnrealizeWidget libXt Intrinsic
-00000000 T _XtCreateWindow libXt Intrinsic
-00000000 T _XtNameToWidget libXt Intrinsic
-00000000 T _XtDisplayOfObject libXt Intrinsic
-00000000 T _XtDisplay libXt Intrinsic
-00000000 T _XtScreenOfObject libXt Intrinsic
-00000000 T _XtScreen libXt Intrinsic
-00000000 T _XtWindowOfObject libXt Intrinsic
-00000000 T _XtWindow libXt Intrinsic
-00000000 T _XtSuperclass libXt Intrinsic
-00000000 T _XtClass libXt Intrinsic
-00000000 T _XtIsManaged libXt Intrinsic
-00000000 T _XtIsRealized libXt Intrinsic
-00000000 T _XtIsSensitive libXt Intrinsic
-00000000 T __XtWindowedAncestor libXt Intrinsic
-00000000 T _XtParent libXt Intrinsic
-00000000 T _XtName libXt Intrinsic
-00000000 T _XtIsObject libXt Intrinsic
-00000000 T _XtFindFile libXt Intrinsic
-00000000 T _XtResolvePathname libXt Intrinsic
-00000000 T _XtCallAcceptFocus libXt Intrinsic
-00000000 T __XtProcessKeyboardEvent libXt Keyboard
-00000000 T __XtHandleFocus libXt Keyboard
-00000000 T _XtSetKeyboardFocus libXt Keyboard
-00000000 T _XtUnmanageChildren libXt Manage
-00000000 T _XtUnmanageChild libXt Manage
-00000000 T _XtManageChildren libXt Manage
-00000000 T _XtManageChild libXt Manage
-00000000 T _XtSetMappedWhenManaged libXt Manage
-00000000 T _XtAddTimeOut libXt NextEvent
-00000000 T _XtAppAddTimeOut libXt NextEvent
-00000000 T _XtRemoveTimeOut libXt NextEvent
-00000000 T _XtAddWorkProc libXt NextEvent
-00000000 T _XtAppAddWorkProc libXt NextEvent
-00000000 T _XtRemoveWorkProc libXt NextEvent
-00000000 T _XtAddInput libXt NextEvent
-00000000 T _XtAppAddInput libXt NextEvent
-00000000 T _XtRemoveInput libXt NextEvent
-00000000 T __XtRemoveAllInputs libXt NextEvent
-00000000 T _XtNextEvent libXt NextEvent
-00000000 T __XtRefreshMapping libXt NextEvent
-00000000 T _XtAppNextEvent libXt NextEvent
-00000000 T _XtProcessEvent libXt NextEvent
-00000000 T _XtAppProcessEvent libXt NextEvent
-00000000 T _XtPending libXt NextEvent
-00000000 T _XtAppPending libXt NextEvent
-00000000 T _XtPeekEvent libXt NextEvent
-00000000 T _XtAppPeekEvent libXt NextEvent
-00000000 T __XtDestroyServerGrabs libXt PassivGrab
-00000000 T __XtCheckServerGrabsOnWidget libXt PassivGrab
-00000000 T _XtGrabKey libXt PassivGrab
-00000000 T _XtGrabButton libXt PassivGrab
-00000000 T _XtUngrabKey libXt PassivGrab
-00000000 T _XtUngrabButton libXt PassivGrab
-00000000 T _XtGrabKeyboard libXt PassivGrab
-00000000 T _XtUngrabKeyboard libXt PassivGrab
-00000000 T _XtGrabPointer libXt PassivGrab
-00000000 T _XtUngrabPointer libXt PassivGrab
-00000000 T __XtProcessPointerEvent libXt Pointer
-00000000 T __XtPopup libXt Popup
-00000000 T _XtPopup libXt Popup
-00000000 T _XtPopupSpringLoaded libXt Popup
-00000000 T _XtPopdown libXt Popup
-00000000 T _XtCallbackPopdown libXt Popup
-00000000 T _XtCallbackNone libXt PopupCB
-00000000 T _XtCallbackNonexclusive libXt PopupCB
-00000000 T _XtCallbackExclusive libXt PopupCB
-00000000 T __XtCopyFromParent libXt Resources
-00000000 T __XtCopyFromArg libXt Resources
-00000000 T __XtCopyToArg libXt Resources
-00000000 T __XtCompileResourceList libXt Resources
-00000000 T __XtDependencies libXt Resources
-00000000 T __XtResourceDependencies libXt Resources
-00000000 T __XtConstraintResDependencies libXt Resources
-00000000 T __XtCreateIndirectionTable libXt Resources
-00000000 T __XtGetResources libXt Resources
-00000000 T _XtGetSubresources libXt Resources
-00000000 T _XtGetApplicationResources libXt Resources
-00000000 T __XtResourceListInitialize libXt Resources
-00000000 T __XtSetDefaultSelectionTimeout libXt Selection
-00000000 T _XtSetSelectionTimeout libXt Selection
-00000000 T _XtAppSetSelectionTimeout libXt Selection
-00000000 T _XtGetSelectionTimeout libXt Selection
-00000000 T _XtAppGetSelectionTimeout libXt Selection
-00000000 T _XtOwnSelection libXt Selection
-00000000 T _XtOwnSelectionIncremental libXt Selection
-00000000 T _XtDisownSelection libXt Selection
-00000000 T _XtGetSelectionValue libXt Selection
-00000000 T _XtGetSelectionValueIncremental libXt Selection
-00000000 T _XtGetSelectionValues libXt Selection
-00000000 T _XtGetSelectionValuesIncremental libXt Selection
-00000000 T _XtGetSelectionRequest libXt Selection
-00000000 T _XtSetSensitive libXt SetSens
-00000000 T _XtSetSubvalues libXt SetValues
-00000000 T _XtSetValues libXt SetValues
-00000000 T _XtSetWMColormapWindows libXt SetWMCW
-00000000 T __XtShellGetCoordinates libXt Shell
-00000000 T __XtInitializeActionData libXt TMaction
-00000000 T __XtBindActions libXt TMaction
-00000000 T __XtUnbindActions libXt TMaction
-00000000 T __XtFreeActions libXt TMaction
-00000000 T _XtAddActions libXt TMaction
-00000000 T _XtAppAddActions libXt TMaction
-00000000 T _XtGetActionList libXt TMaction
-00000000 T _XtMenuPopupAction libXt TMaction
-00000000 T _XtCallActionProc libXt TMaction
-00000000 T __XtRegisterGrabs libXt TMgrab
-00000000 T _XtRegisterGrabAction libXt TMgrab
-00000000 T __XtGrabInitialize libXt TMgrab
-00000000 T __XtComputeLateBindings libXt TMkey
-00000000 T __XtAllocTMContext libXt TMkey
-00000000 T __XtMatchUsingDontCareMods libXt TMkey
-00000000 T _XtConvertCase libXt TMkey
-00000000 T __XtMatchUsingStandardMods libXt TMkey
-00000000 T __XtBuildKeysymTables libXt TMkey
-00000000 T _XtTranslateKeycode libXt TMkey
-00000000 T _XtTranslateKey libXt TMkey
-00000000 T _XtSetKeyTranslator libXt TMkey
-00000000 T _XtRegisterCaseConverter libXt TMkey
-00000000 T _XtGetKeysymTable libXt TMkey
-00000000 T _XtKeysymToKeycodeList libXt TMkey
-00000000 T _XtCvtStringToAcceleratorTable libXt TMparse
-00000000 T _XtCvtStringToTranslationTable libXt TMparse
-00000000 T _XtParseAcceleratorTable libXt TMparse
-00000000 T _XtParseTranslationTable libXt TMparse
-00000000 T __XtTranslateInitialize libXt TMparse
-00000000 T __XtAddTMConverters libXt TMparse
-00000000 T __XtPrintXlations libXt TMprint
-00000000 T __XtDisplayTranslations libXt TMprint
-00000000 T __XtDisplayAccelerators libXt TMprint
-00000000 T __XtDisplayInstalledAccelerators libXt TMprint
-00000000 T __XtPrintActions libXt TMprint
-00000000 T __XtPrintState libXt TMprint
-00000000 T __XtPrintEventSeq libXt TMprint
-00000000 T __XtGetQuarkIndex libXt TMstate
-00000000 T __XtGetTypeIndex libXt TMstate
-00000000 T __XtGetModifierIndex libXt TMstate
-00000000 T __XtRegularMatch libXt TMstate
-00000000 T __XtMatchAtom libXt TMstate
-00000000 T __XtTranslateEvent libXt TMstate
-00000000 T __XtTraverseStateTree libXt TMstate
-00000000 T __XtInstallTranslations libXt TMstate
-00000000 T __XtRemoveTranslations libXt TMstate
-00000000 T __XtDestroyTMData libXt TMstate
-00000000 T _XtUninstallTranslations libXt TMstate
-00000000 T __XtCreateXlations libXt TMstate
-00000000 T __XtParseTreeToStateTree libXt TMstate
-00000000 T __XtAddEventSeqToStateTree libXt TMstate
-00000000 T __XtCvtMergeTranslations libXt TMstate
-00000000 T __XtGetTranslationValue libXt TMstate
-00000000 T __XtRemoveStateTreeByIndex libXt TMstate
-00000000 T __XtFreeTranslations libXt TMstate
-00000000 T _XtInstallAccelerators libXt TMstate
-00000000 T _XtInstallAllAccelerators libXt TMstate
-00000000 T _XtAugmentTranslations libXt TMstate
-00000000 T _XtOverrideTranslations libXt TMstate
-00000000 T __XtMergeTranslations libXt TMstate
-00000000 T __XtUnmergeTranslations libXt TMstate
-00000000 T __XtPopupInitialize libXt TMstate
-00000000 T _XtVaCreateWidget libXt VarCreate
-00000000 T _XtVaCreateManagedWidget libXt VarCreate
-00000000 T _XtVaAppCreateShell libXt VarCreate
-00000000 T _XtVaCreatePopupShell libXt VarCreate
-00000000 T _XtVaSetValues libXt VarCreate
-00000000 T _XtVaSetSubvalues libXt VarCreate
-00000000 T __XtVaAppInitialize libXt VarCreate
-00000000 T _XtVaAppInitialize libXt VarCreate
-00000000 T __XtVaOpenApplication libXt VarCreate
-00000000 T _XtVaOpenApplication libXt VarCreate
-00000000 T _XtVaGetSubresources libXt VarGet
-00000000 T _XtVaGetApplicationResources libXt VarGet
-00000000 T _XtVaGetValues libXt VarGet
-00000000 T _XtVaGetSubvalues libXt VarGet
-00000000 T __XtCountVaList libXt Varargs
-00000000 T _XtVaCreateArgsList libXt Varargs
-00000000 T __XtVaCreateTypedArgList libXt Varargs
-00000000 T __XtVaToArgList libXt Varargs
-00000000 T __XtVaToTypedArgList libXt Varargs
-00000000 T _XmuAllStandardColormaps libXmu AllCmap
-00000000 T _XmuMakeAtom libXmu Atoms
-00000000 T _XmuNameOfAtom libXmu Atoms
-00000000 T _XmuInternAtom libXmu Atoms
-00000000 T _XmuGetAtomName libXmu Atoms
-00000000 T _XmuInternStrings libXmu Atoms
-00000000 T _XmuClientWindow libXmu ClientWin
-00000000 T _XmuAddCloseDisplayHook libXmu CloseHook
-00000000 T _XmuRemoveCloseDisplayHook libXmu CloseHook
-00000000 T _XmuLookupCloseDisplayHook libXmu CloseHook
-00000000 T _XmuGetColormapAllocation libXmu CmapAlloc
-00000000 T _XmuCreateColormap libXmu CrCmap
-00000000 T _XmuCreatePixmapFromBitmap libXmu CrPixFBit
-00000000 T _XmuCursorNameToIndex libXmu CursorName
-00000000 T __XmuCCLookupDisplay libXmu CvtCache
-00000000 T _XmuConvertStandardSelection libXmu CvtStdSel
-00000000 T _XmuPrintDefaultErrorMessage libXmu DefErrMsg
-00000000 T _XmuSimpleErrorHandler libXmu DefErrMsg
-00000000 T _XmuDeleteStandardColormap libXmu DelCmap
-00000000 T _XmuDQCreate libXmu DisplayQue
-00000000 T _XmuDQDestroy libXmu DisplayQue
-00000000 T _XmuDQLookupDisplay libXmu DisplayQue
-00000000 T _XmuDQAddDisplay libXmu DisplayQue
-00000000 T _XmuDQRemoveDisplay libXmu DisplayQue
-00000000 T _XmuDistinguishableColors libXmu Distinct
-00000000 T _XmuDistinguishablePixels libXmu Distinct
-00000000 T _XmuDrawLogo libXmu DrawLogo
-00000000 T _XmuDrawRoundedRectangle libXmu DrRndRect
-00000000 T _XmuFillRoundedRectangle libXmu DrRndRect
-00000000 T __XEditResCheckMessages libXmu EditresCom
-00000000 T __XEditResPutString8 libXmu EditresCom
-00000000 T __XEditResPut8 libXmu EditresCom
-00000000 T __XEditResPut16 libXmu EditresCom
-00000000 T __XEditResPut32 libXmu EditresCom
-00000000 T __XEditResPutWidgetInfo libXmu EditresCom
-00000000 T __XEditResResetStream libXmu EditresCom
-00000000 T __XEditResGet8 libXmu EditresCom
-00000000 T __XEditResGet16 libXmu EditresCom
-00000000 T __XEditResGetSigned16 libXmu EditresCom
-00000000 T __XEditResGet32 libXmu EditresCom
-00000000 T __XEditResGetString8 libXmu EditresCom
-00000000 T __XEditResGetWidgetInfo libXmu EditresCom
-00000000 T _XmuRegisterExternalAgent libXmu ExtAgent
-00000000 T _XmuCvtFunctionToCallback libXmu FToCback
-00000000 T _XmuGetHostname libXmu GetHost
-00000000 T _XmuCreateStippledPixmap libXmu GrayPixmap
-00000000 T _XmuReleaseStippledPixmap libXmu GrayPixmap
-00000000 T _XmuAddInitializer libXmu Initer
-00000000 T _XmuCallInitializers libXmu Initer
-00000000 T _XmuLocateBitmapFile libXmu LocBitmap
-00000000 T _XmuLocatePixmapFile libXmu LocBitmap
-00000000 T __XmuStringToBitmapInitCache libXmu LocBitmap
-00000000 T __XmuStringToBitmapFreeCache libXmu LocBitmap
-00000000 T _XmuLookupString libXmu Lookup
-00000000 T _XmuLookupLatin1 libXmu Lookup
-00000000 T _XmuLookupLatin2 libXmu Lookup
-00000000 T _XmuLookupLatin3 libXmu Lookup
-00000000 T _XmuLookupLatin4 libXmu Lookup
-00000000 T _XmuLookupKana libXmu Lookup
-00000000 T _XmuLookupJISX0201 libXmu Lookup
-00000000 T _XmuLookupArabic libXmu Lookup
-00000000 T _XmuLookupCyrillic libXmu Lookup
-00000000 T _XmuLookupGreek libXmu Lookup
-00000000 T _XmuLookupAPL libXmu Lookup
-00000000 T _XmuLookupHebrew libXmu Lookup
-00000000 T _XmuLookupStandardColormap libXmu LookupCmap
-00000000 T _XmuCopyISOLatin1Lowered libXmu Lower
-00000000 T _XmuCopyISOLatin1Uppered libXmu Lower
-00000000 T _XmuCompareISOLatin1 libXmu Lower
-00000000 T _XmuReadBitmapData libXmu RdBitF
-00000000 T _XmuReadBitmapDataFromFile libXmu RdBitF
-00000000 T _XmuScreenOfWindow libXmu ScrOfWin
-00000000 T _XmuReshapeWidget libXmu ShapeWidg
-00000000 T _XmuStandardColormap libXmu StdCmap
-00000000 T _XmuCvtStringToBackingStore libXmu StrToBS
-00000000 T _XmuCvtStringToBitmap libXmu StrToBmap
-00000000 T _XmuCvtStringToCursor libXmu StrToCurs
-00000000 T _XmuCvtStringToColorCursor libXmu StrToCurs
-00000000 T _XmuCvtStringToGravity libXmu StrToGrav
-00000000 T _XmuCvtStringToJustify libXmu StrToJust
-00000000 T _XmuCvtStringToLong libXmu StrToLong
-00000000 T _XmuCvtStringToOrientation libXmu StrToOrnt
-00000000 T _XmuCvtStringToShapeStyle libXmu StrToShap
-00000000 T _XmuCvtStringToWidget libXmu StrToWidg
-00000000 T _XmuNewCvtStringToWidget libXmu StrToWidg
-00000000 T _XmuUpdateMapHints libXmu UpdMapHint
-00000000 T _XmuVisualStandardColormaps libXmu VisCmap
-00000000 T _XmuWnInitializeNodes libXmu WidgetNode
-00000000 T _XmuWnFetchResources libXmu WidgetNode
-00000000 T _XmuWnCountOwnedResources libXmu WidgetNode
-00000000 T _XmuWnNameToNode libXmu WidgetNode
-00000000 T _XctCreate libXmu Xct
-00000000 T _XctReset libXmu Xct
-00000000 T _XctNextItem libXmu Xct
-00000000 T _XctFree libXmu Xct
-00000000 T _XextCreateExtension libXext extutil
-00000000 T _XextDestroyExtension libXext extutil
-00000000 T _XextAddDisplay libXext extutil
-00000000 T _XextRemoveDisplay libXext extutil
-00000000 T _XextFindDisplay libXext extutil
-00000000 T _XSetExtensionErrorHandler libXext extutil
-00000000 T _XMissingExtension libXext extutil
-00000000 T _XmbufQueryExtension libXext XMultibuf
-00000000 T _XmbufGetVersion libXext XMultibuf
-00000000 T _XmbufCreateBuffers libXext XMultibuf
-00000000 T _XmbufDestroyBuffers libXext XMultibuf
-00000000 T _XmbufDisplayBuffers libXext XMultibuf
-00000000 T _XmbufGetWindowAttributes libXext XMultibuf
-00000000 T _XmbufChangeWindowAttributes libXext XMultibuf
-00000000 T _XmbufGetBufferAttributes libXext XMultibuf
-00000000 T _XmbufChangeBufferAttributes libXext XMultibuf
-00000000 T _XmbufGetScreenInfo libXext XMultibuf
-00000000 T _XmbufCreateStereoWindow libXext XMultibuf
-00000000 T _XShapeQueryExtension libXext XShape
-00000000 T _XShapeQueryVersion libXext XShape
-00000000 T _XShapeCombineRegion libXext XShape
-00000000 T _XShapeCombineRectangles libXext XShape
-00000000 T _XShapeCombineMask libXext XShape
-00000000 T _XShapeCombineShape libXext XShape
-00000000 T _XShapeOffsetShape libXext XShape
-00000000 T _XShapeQueryExtents libXext XShape
-00000000 T _XShapeSelectInput libXext XShape
-00000000 T _XShapeInputSelected libXext XShape
-00000000 T _XShapeGetRectangles libXext XShape
-00000000 T _XMITMiscQueryExtension libXext MITMisc
-00000000 T _XMITMiscSetBugMode libXext MITMisc
-00000000 T _XMITMiscGetBugMode libXext MITMisc
-00000000 T _XTestFakeInput libXext XTestExt1
-00000000 T _XTestGetInput libXext XTestExt1
-00000000 T _XTestStopInput libXext XTestExt1
-00000000 T _XTestReset libXext XTestExt1
-00000000 T _XTestQueryInputSize libXext XTestExt1
-00000000 T _XTestPressKey libXext XTestExt1
-00000000 T _XTestPressButton libXext XTestExt1
-00000000 T _XTestMovePointer libXext XTestExt1
-00000000 T _XTestFlush libXext XTestExt1
-00000000 T _XAllowDeviceEvents libXi XAllowDv
-00000000 T _XChangeDeviceControl libXi XChgDCtl
-00000000 T _XChangeFeedbackControl libXi XChgFCtl
-00000000 T _XChangeKeyboardDevice libXi XChgKbd
-00000000 T _XChangeDeviceKeyMapping libXi XChgKMap
-00000000 T _XChangePointerDevice libXi XChgPnt
-00000000 T _XChangeDeviceDontPropagateList libXi XChgProp
-00000000 T _XCloseDevice libXi XCloseDev
-00000000 T _XDeviceBell libXi XDevBell
-00000000 T _XGetDeviceButtonMapping libXi XGetBMap
-00000000 T _XGetDeviceControl libXi XGetDCtl
-00000000 T _XFreeDeviceControl libXi XGetDCtl
-00000000 T _XGetFeedbackControl libXi XGetFCtl
-00000000 T _XFreeFeedbackList libXi XGetFCtl
-00000000 T _XGetDeviceKeyMapping libXi XGetKMap
-00000000 T _XGetDeviceModifierMapping libXi XGetMMap
-00000000 T _XGetDeviceDontPropagateList libXi XGetProp
-00000000 T _XGetExtensionVersion libXi XGetVers
-00000000 T _XGetDeviceMotionEvents libXi XGMotion
-00000000 T _XFreeDeviceMotionEvents libXi XGMotion
-00000000 T _XGrabDevice libXi XGrabDev
-00000000 T _XGrabDeviceButton libXi XGrDvBut
-00000000 T _XGrabDeviceKey libXi XGrDvKey
-00000000 T _XGetDeviceFocus libXi XGtFocus
-00000000 T _XGetSelectedExtensionEvents libXi XGtSelect
-00000000 T _XListInputDevices libXi XListDev
-00000000 T _XFreeDeviceList libXi XListDev
-00000000 T _XOpenDevice libXi XOpenDev
-00000000 T _XQueryDeviceState libXi XQueryDv
-00000000 T _XFreeDeviceState libXi XQueryDv
-00000000 T _XSelectExtensionEvent libXi XSelect
-00000000 T _XSetDeviceButtonMapping libXi XSetBMap
-00000000 T _XSetDeviceValuators libXi XSetDVal
-00000000 T _XSetDeviceModifierMapping libXi XSetMMap
-00000000 T _XSetDeviceMode libXi XSetMode
-00000000 T _XSendExtensionEvent libXi XSndExEv
-00000000 T _XSetDeviceFocus libXi XStFocus
-00000000 T _XUngrabDevice libXi XUngrDev
-00000000 T _XUngrabDeviceButton libXi XUngrDvB
-00000000 T _XUngrabDeviceKey libXi XUngrDvK
-00000000 T _XInput_find_display libXi XExtInt
-00000000 T __xibaddevice libXi XExtInt
-00000000 T __xibadclass libXi XExtInt
-00000000 T __xibadevent libXi XExtInt
-00000000 T __xibadmode libXi XExtInt
-00000000 T __xidevicebusy libXi XExtInt
-00000000 T _XTestQueryExtension libXtst XTest
-00000000 T _XTestCompareCursorWithWindow libXtst XTest
-00000000 T _XTestCompareCurrentCursorWithWindow libXtst XTest
-00000000 T _XTestFakeKeyEvent libXtst XTest
-00000000 T _XTestFakeButtonEvent libXtst XTest
-00000000 T _XTestFakeMotionEvent libXtst XTest
-00000000 T _XTestFakeRelativeMotionEvent libXtst XTest
-00000000 T _XTestSetGContextOfGC libXtst XTest
-00000000 T _XTestSetVisualIDOfVisual libXtst XTest
-00000000 T _XTestDiscard libXtst XTest
-00000000 T _XShmQueryExtension libXext XShm
-00000000 T _XShmGetEventBase libXext XShm
-00000000 T _XShmQueryVersion libXext XShm
-00000000 T _XShmPixmapFormat libXext XShm
-00000000 T _XShmAttach libXext XShm
-00000000 T _XShmDetach libXext XShm
-00000000 T _XShmCreateImage libXext XShm
-00000000 T _XShmPutImage libXext XShm
-00000000 T _XShmGetImage libXext XShm
-00000000 T _XShmCreatePixmap libXext XShm
-00000000 T __XtPeekCallback libXt Callback
-00000000 T _XtCvtStringToRestartStyle libXt Converters
-00000000 T _XtCvtStringToGravity libXt Converters
-00000000 T __XtCreateHookObj libXt Create
-00000000 T _XtAppSetExitFlag libXt Display
-00000000 T _XtAppGetExitFlag libXt Display
-00000000 T __XtGetPerDisplay libXt Display
-00000000 T __XtGetPerDisplayInput libXt Display
-00000000 T _XtGetDisplays libXt Display
-00000000 T _XtRemoveEventTypeHandler libXt Event
-00000000 T _XtInsertEventTypeHandler libXt Event
-00000000 T _XtRegisterDrawable libXt Event
-00000000 T _XtUnregisterDrawable libXt Event
-00000000 T _XtDispatchEventToWidget libXt Event
-00000000 T _XtLastEventProcessed libXt Event
-00000000 T _XtSetEventDispatcher libXt Event
-00000000 T _XtRegisterExtensionSelector libXt Event
-00000000 T __XtExtensionSelect libXt Event
-00000000 T _XtAppAddBlockHook libXt Hooks
-00000000 T _XtRemoveBlockHook libXt Hooks
-00000000 T __XtAddShellToHookObj libXt Hooks
-00000000 T __XtIsHookObject libXt Hooks
-00000000 T _XtHooksOfDisplay libXt Hooks
-00000000 T __XtGetUserName libXt Initialize
-00000000 T _XtGetClassExtension libXt Intrinsic
-00000000 T _XtGetKeyboardFocusWidget libXt Keyboard
-00000000 T _XtChangeManagedSet libXt Manage
-00000000 T __XtWaitForSomething libXt NextEvent
-00000000 T _XtAddSignal libXt NextEvent
-00000000 T _XtAppAddSignal libXt NextEvent
-00000000 T _XtRemoveSignal libXt NextEvent
-00000000 T _XtNoticeSignal libXt NextEvent
-00000000 T _XtReservePropertyAtom libXt Selection
-00000000 T _XtReleasePropertyAtom libXt Selection
-00000000 T _XtCreateSelectionRequest libXt Selection
-00000000 T _XtSendSelectionRequest libXt Selection
-00000000 T _XtCancelSelectionRequest libXt Selection
-00000000 T _XtSetSelectionParameters libXt Selection
-00000000 T _XtGetSelectionParameters libXt Selection
-00000000 T _XtSessionGetToken libXt Shell
-00000000 T _XtSessionReturnToken libXt Shell
-00000000 T _XtAppLock libXt Threads
-00000000 T _XtAppUnlock libXt Threads
-00000000 T _XtProcessLock libXt Threads
-00000000 T _XtProcessUnlock libXt Threads
-00000000 T _XtToolkitThreadInitialize libXt Threads
-00000000 T __XtDoFreeBindings libXt TMaction
-00000000 T _XmbufClearBufferArea libXext XMultibuf
-00000000 T _XSyncQueryExtension libXext XSync
-00000000 T _XSyncInitialize libXext XSync
-00000000 T _XSyncListSystemCounters libXext XSync
-00000000 T _XSyncFreeSystemCounterList libXext XSync
-00000000 T _XSyncCreateCounter libXext XSync
-00000000 T _XSyncSetCounter libXext XSync
-00000000 T _XSyncChangeCounter libXext XSync
-00000000 T _XSyncDestroyCounter libXext XSync
-00000000 T _XSyncQueryCounter libXext XSync
-00000000 T _XSyncAwait libXext XSync
-00000000 T _XSyncCreateAlarm libXext XSync
-00000000 T _XSyncDestroyAlarm libXext XSync
-00000000 T _XSyncQueryAlarm libXext XSync
-00000000 T _XSyncChangeAlarm libXext XSync
-00000000 T _XSyncSetPriority libXext XSync
-00000000 T _XSyncGetPriority libXext XSync
-00000000 T _XSyncIntToValue libXext XSync
-00000000 T _XSyncIntsToValue libXext XSync
-00000000 T _XSyncValueGreaterThan libXext XSync
-00000000 T _XSyncValueLessThan libXext XSync
-00000000 T _XSyncValueGreaterOrEqual libXext XSync
-00000000 T _XSyncValueLessOrEqual libXext XSync
-00000000 T _XSyncValueEqual libXext XSync
-00000000 T _XSyncValueIsNegative libXext XSync
-00000000 T _XSyncValueIsZero libXext XSync
-00000000 T _XSyncValueIsPositive libXext XSync
-00000000 T _XSyncValueLow32 libXext XSync
-00000000 T _XSyncValueHigh32 libXext XSync
-00000000 T _XSyncValueAdd libXext XSync
-00000000 T _XSyncValueSubtract libXext XSync
-00000000 T _XSyncMaxValue libXext XSync
-00000000 T _XSyncMinValue libXext XSync
-00000000 T __XiEventToWire libXi XExtToWire
-00000000 T __XiCheckExtInit libXi XExtInt
-00000000 T _XTestFakeDeviceKeyEvent libXtst XTest
-00000000 T _XTestFakeDeviceButtonEvent libXtst XTest
-00000000 T _XTestFakeProximityEvent libXtst XTest
-00000000 T _XTestFakeDeviceMotionEvent libXtst XTest
-00000000 T _XTestGrabControl libXtst XTest
-00000000 T _XdbeQueryExtension libXext Xdbe
-00000000 T _XdbeAllocateBackBufferName libXext Xdbe
-00000000 T _XdbeDeallocateBackBufferName libXext Xdbe
-00000000 T _XdbeSwapBuffers libXext Xdbe
-00000000 T _XdbeBeginIdiom libXext Xdbe
-00000000 T _XdbeEndIdiom libXext Xdbe
-00000000 T _XdbeGetVisualInfo libXext Xdbe
-00000000 T _XdbeFreeVisualInfo libXext Xdbe
-00000000 T _XdbeGetBackBufferAttributes libXext Xdbe
-00000000 T _XRecordIdBaseMask libXtst XRecord
-00000000 T _XRecordQueryVersion libXtst XRecord
-00000000 T _XRecordCreateContext libXtst XRecord
-00000000 T _XRecordAllocRange libXtst XRecord
-00000000 T _XRecordRegisterClients libXtst XRecord
-00000000 T _XRecordUnregisterClients libXtst XRecord
-00000000 T _XRecordGetContext libXtst XRecord
-00000000 T _XRecordFreeState libXtst XRecord
-00000000 T _XRecordFreeData libXtst XRecord
-00000000 T _XRecordEnableContext libXtst XRecord
-00000000 T _XRecordEnableContextAsync libXtst XRecord
-00000000 T _XRecordProcessReplies libXtst XRecord
-00000000 T _XRecordDisableContext libXtst XRecord
-00000000 T _XRecordFreeContext libXtst XRecord
-00000000 T _XLbxQueryExtension libXext XLbx
-00000000 T _XLbxGetEventBase libXext XLbx
-00000000 T _XLbxQueryVersion libXext XLbx
-00000000 T _XSecurityQueryExtension libXext XSecurity
-00000000 T _XSecurityAllocXauth libXext XSecurity
-00000000 T _XSecurityFreeXauth libXext XSecurity
-00000000 T _XSecurityGenerateAuthorization libXext XSecurity
-00000000 T _XSecurityRevokeAuthorization libXext XSecurity
-00000000 T _XagQueryVersion libXext XAppgroup
-00000000 T _XagCreateEmbeddedApplicationGroup libXext XAppgroup
-00000000 T _XagCreateNonembeddedApplicationGroup libXext XAppgroup
-00000000 T _XagDestroyApplicationGroup libXext XAppgroup
-00000000 T _XagGetApplicationGroupAttributes libXext XAppgroup
-00000000 T _XagQueryApplicationGroup libXext XAppgroup
-00000000 T _XagCreateAssociation libXext XAppgroup
-00000000 T _XagDestroyAssociation libXext XAppgroup
-00000000 T _XpGetAttributes libXp XpAttr
-00000000 T _XpGetOneAttribute libXp XpAttr
-00000000 T _XpSetAttributes libXp XpAttr
-00000000 T _XpCreateContext libXp XpContext
-00000000 T _XpSetContext libXp XpContext
-00000000 T _XpGetContext libXp XpContext
-00000000 T _XpDestroyContext libXp XpContext
-00000000 T _XpGetScreenOfContext libXp XpContext
-00000000 T _XpStartDoc libXp XpDoc
-00000000 T _XpEndDoc libXp XpDoc
-00000000 T _XpCancelDoc libXp XpDoc
-00000000 T _xp_find_display libXp XpExtUtil
-00000000 T _XpCheckExtInit libXp XpExtUtil
-00000000 T _XpQueryExtension libXp XpExtVer
-00000000 T _XpQueryVersion libXp XpExtVer
-00000000 T _XpGetDocumentData libXp XpGetData
-00000000 T _XpSelectInput libXp XpInput
-00000000 T _XpInputSelected libXp XpInput
-00000000 T _XpStartJob libXp XpJob
-00000000 T _XpEndJob libXp XpJob
-00000000 T _XpCancelJob libXp XpJob
-00000000 T _XpSetLocaleHinter libXp XpLocale
-00000000 T _XpGetLocaleHinter libXp XpLocale
-00000000 T _XpGetLocaleNetString libXp XpLocale
-00000000 T _XpStartPage libXp XpPage
-00000000 T _XpEndPage libXp XpPage
-00000000 T _XpCancelPage libXp XpPage
-00000000 T _XpGetPdmStartParams libXp XpNotifyPdm
-00000000 T _XpSendOneTicket libXp XpNotifyPdm
-00000000 T _XpSendAuth libXp XpNotifyPdm
-00000000 T _XpGetAuthParams libXp XpNotifyPdm
-00000000 T _XpNotifyPdm libXp XpNotifyPdm
-00000000 T _XpGetPrinterList libXp XpPrinter
-00000000 T _XpFreePrinterList libXp XpPrinter
-00000000 T _XpRehashPrinterList libXp XpPrinter
-00000000 T _XpPutDocumentData libXp XpPutData
-00000000 T _XpQueryScreens libXp XpScreens
-00000000 T _XpGetPageDimensions libXp XpPageDim
-00000000 T _XpSetImageResolution libXp XpImageRes
-00000000 T _XpGetImageResolution libXp XpImageRes
diff --git a/xc/lib/Xt/jump_ignore b/xc/lib/Xt/jump_ignore
deleted file mode 100644
index 881952a89..000000000
--- a/xc/lib/Xt/jump_ignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# $XConsortium: jump_ignore,v 1.3 95/06/30 18:48:53 kaleb Exp $
-# $XFree86: xc/lib/Xt/jump_ignore,v 3.7 1996/12/30 13:58:32 dawes Exp $
-# jump_ignore
-00000000 T __XtFreeArgList libXt Varargs
-00000000 T __XtClearAncestorCache libXt Keyboard
-00000000 T __XtSnprintf libXt snprintf
-00000000 T __XtVsnprintf libXt snprintf
-00000000 D __xp_hinter_proc libXp XpLocale
-00000000 D __xp_hinter_desc libXp XpLocale
-00000000 D __xp_hinter_init libXp XpLocale
-00000000 T __xpstrdup libXp XpNotifyPdm
diff --git a/xc/lib/Xt/jump_vars b/xc/lib/Xt/jump_vars
deleted file mode 100644
index c3eb91170..000000000
--- a/xc/lib/Xt/jump_vars
+++ /dev/null
@@ -1,67 +0,0 @@
-# $XConsortium: jump_vars,v 1.2 94/12/07 10:45:51 kaleb Exp $
-# $XFree86: xc/lib/Xt/jump_vars,v 3.2 1995/01/28 15:44:05 dawes Exp $
-#
-00000100 D _compositeClassRec libXt Composite
-00000004 D _compositeWidgetClass libXt Composite
-00000140 D _constraintClassRec libXt Constraint
-00000004 D _constraintWidgetClass libXt Constraint
-00000040 D _colorConvertArgs libXt Converters
-00000020 D _screenConvertArg libXt Converters
-00000004 D __XtQString libXt Converters
-00000004 D __XtInheritTranslations libXt Core
-00000100 D _widgetClassRec libXt Core
-00000004 D _widgetClass libXt Core
-00000004 D _coreWidgetClass libXt Core
-00000004 D __XtAppDestroyCount libXt Display
-00000004 D __XtperDisplayList libXt Display
-00000004 D _XtCXtToolkitError libXt Intrinsic
-00000100 D _objectClassRec libXt Object
-00000004 D _objectClass libXt Object
-00000100 D _rectObjClassRec libXt RectObj
-00000004 D _rectObjClass libXt RectObj
-00000100 D _shellClassRec libXt Shell
-00000004 D _shellWidgetClass libXt Shell
-00000100 D _overrideShellClassRec libXt Shell
-00000004 D _overrideShellWidgetClass libXt Shell
-00000100 D _wmShellClassRec libXt Shell
-00000004 D _wmShellWidgetClass libXt Shell
-00000100 D _transientShellClassRec libXt Shell
-00000004 D _transientShellWidgetClass libXt Shell
-00000100 D _topLevelShellClassRec libXt Shell
-00000004 D _topLevelShellWidgetClass libXt Shell
-00000100 D _applicationShellClassRec libXt Shell
-00000004 D _applicationShellWidgetClass libXt Shell
-00000100 D _sessionShellClassRec libXt Shell
-00000004 D _sessionShellWidgetClass libXt Shell
-00001000 D _XtStrings libXt StringDefs
-00000800 D _XtShellStrings libXt StringDefs
-00000040 D __XtGlobalTM libXt TMstate
-00000100 D _vendorShellClassRec libXt Vendor
-00000004 D _vendorShellWidgetClass libXt Vendor
-00000004 D __XA_ATOM_PAIR libXmu Atoms
-00000004 D __XA_CHARACTER_POSITION libXmu Atoms
-00000004 D __XA_CLASS libXmu Atoms
-00000004 D __XA_CLIENT_WINDOW libXmu Atoms
-00000004 D __XA_CLIPBOARD libXmu Atoms
-00000004 D __XA_COMPOUND_TEXT libXmu Atoms
-00000004 D __XA_DECNET_ADDRESS libXmu Atoms
-00000004 D __XA_DELETE libXmu Atoms
-00000004 D __XA_FILENAME libXmu Atoms
-00000004 D __XA_HOSTNAME libXmu Atoms
-00000004 D __XA_IP_ADDRESS libXmu Atoms
-00000004 D __XA_LENGTH libXmu Atoms
-00000004 D __XA_LIST_LENGTH libXmu Atoms
-00000004 D __XA_NAME libXmu Atoms
-00000004 D __XA_NET_ADDRESS libXmu Atoms
-00000004 D __XA_NULL libXmu Atoms
-00000004 D __XA_OWNER_OS libXmu Atoms
-00000004 D __XA_SPAN libXmu Atoms
-00000004 D __XA_TARGETS libXmu Atoms
-00000004 D __XA_TEXT libXmu Atoms
-00000004 D __XA_TIMESTAMP libXmu Atoms
-00000004 D __XA_USER libXmu Atoms
-00000004 D __XExtensionErrorFunction libXext globals
-00000004 D _XTestInputActionType libXext XTestExt1
-00000004 D _XTestFakeAckType libXext XTestExt1
-00000100 D _hookObjClassRec libXt HookObj
-00000004 D _hookObjectClass libXt HookObj
diff --git a/xc/lib/Xt/libXt.elist b/xc/lib/Xt/libXt.elist
deleted file mode 100644
index aef351cac..000000000
--- a/xc/lib/Xt/libXt.elist
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $XConsortium: libXt.elist /main/1 1996/09/28 16:47:19 rws $ */
-
-/*************************************************************************
- * Export list for libXt
- * This list *must* be updated whenever a change is made to the API.
- *
- * The syntax for the symbol declarations in this list is below.
- * public sym => Public C symbol, i.e., publicized API
- * publicC++ sym => Public C++ symbol, i.e., publicized API
- * private sym => Private C symbol, i.e., unpublicized API
- * privateC++ sym => Private C++ symbol, i.e., unpublicized API
- * internal sym => Internal C symbol, i.e., not part of API
- * internalC++ sym => Internal C++ symbol, i.e., not part of API
- * force sym => symbol to be exported even if not found. Some
- * restrictions may apply. Avoid this directive.
- *
- * Note that exporting C++ symbols is not portable; different
- * compilers may use different name mangling schemes and different
- * hidden name (e.g. virtual function table) generation schemes.
- *
- * In addition a single "default" directive may appear, specifying how
- * unmentioned symbols should be treated. The possible options are:
- * default Warn about implicit symbols and hide them.
- * default public Export public symbols implicitly.
- * default private Export public symbols implicitly.
- * default internal Hide public symbols implicitly.
- *
- *
- **************************************************************************/
-
-/* We will not be naming symbols; export all public symbols in the library. */
-default public
-
-#ifdef AIXV4
-/*
- * In earlier releases of this library, IBM exported some standard
- * symbols from the system libraries. We must keep re-exporting these
- * symbols for binary compatibility.
- */
-force errno
-force _iob
-#endif
diff --git a/xc/lib/Xt/sharedlib.c b/xc/lib/Xt/sharedlib.c
deleted file mode 100644
index 64c19f993..000000000
--- a/xc/lib/Xt/sharedlib.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* $TOG: sharedlib.c /main/19 1998/02/06 13:26:09 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.
-
-*/
-/* $XFree86: xc/lib/Xt/sharedlib.c,v 3.2 1998/10/03 09:07:03 dawes Exp $ */
-
-#if (defined(SUNSHLIB) || defined(AIXSHLIB)) && !defined(SHAREDCODE)
-#include "IntrinsicI.h"
-#include "VarargsI.h"
-#include "ShellP.h"
-#include "VendorP.h"
-
-
-#if defined(AIXSHLIB) || defined(__EMX__)
-WidgetClass vendorShellWidgetClass = (WidgetClass) &vendorShellClassRec;
-
-static void _XtVendorInitialize()
-{
- transientShellWidgetClass->core_class.superclass =
- (WidgetClass) &vendorShellClassRec;
- topLevelShellWidgetClass->core_class.superclass =
- (WidgetClass) &vendorShellClassRec;
-}
-
-#define VENDORINIT _XtVendorInitialize();
-
-#else
-
-#define VENDORINIT /* as nothing */
-
-#endif
-
-#ifdef SUNSHLIB
-/*
- * _XtInherit needs to be statically linked since it is compared against as
- * well as called.
- */
-void _XtInherit()
-{
- extern void __XtInherit();
- __XtInherit();
-}
-#endif
-
-/*
- * The following routine will be called by every toolkit
- * application, forcing this file to be statically linked.
- *
- * Note: XtInitialize, XtAppInitialize, and XtOpenApplication
- * call XtToolkitInitialize.
- */
-
-void XtToolkitInitialize()
-{
- extern void _XtToolkitInitialize();
- VENDORINIT
- _XtToolkitInitialize();
-}
-
-#if NeedFunctionPrototypes
-Widget
-XtInitialize(
-_Xconst char* name,
-_Xconst char* classname,
-XrmOptionDescRec *options,
-Cardinal num_options,
-int *argc,
-String *argv
-)
-#else
-Widget
-XtInitialize(name, classname, options, num_options, argc, argv)
-String name, classname;
-XrmOptionDescRec *options;
-Cardinal num_options;
-String *argv;
-int *argc;
-#endif
-{
- extern Widget _XtInitialize();
- VENDORINIT
- return _XtInitialize (name, classname, options, num_options, argc, argv);
-}
-
-#if NeedFunctionPrototypes
-Widget
-XtAppInitialize(
-XtAppContext * app_context_return,
-_Xconst char* application_class,
-XrmOptionDescRec *options,
-Cardinal num_options,
-int *argc_in_out,
-String *argv_in_out,
-String *fallback_resources,
-ArgList args_in,
-Cardinal num_args_in
-)
-#else
-Widget
-XtAppInitialize(app_context_return, application_class, options, num_options,
- argc_in_out, argv_in_out, fallback_resources,
- args_in, num_args_in)
-XtAppContext * app_context_return;
-String application_class;
-XrmOptionDescRec *options;
-Cardinal num_options, num_args_in;
-int *argc_in_out;
-String *argv_in_out, * fallback_resources;
-ArgList args_in;
-#endif
-{
- extern Widget _XtAppInitialize();
- VENDORINIT
- return _XtAppInitialize (app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, args_in, num_args_in);
-}
-
-#if NeedVarargsPrototypes
-Widget
-XtVaAppInitialize(
- XtAppContext *app_context_return,
- _Xconst char* application_class,
- XrmOptionDescList options,
- Cardinal num_options,
- int *argc_in_out,
- String *argv_in_out,
- String *fallback_resources,
- ...)
-#else
-Widget XtVaAppInitialize(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, va_alist)
- XtAppContext *app_context_return;
- String application_class;
- XrmOptionDescList options;
- Cardinal num_options;
- int *argc_in_out;
- String *argv_in_out;
- String *fallback_resources;
- va_dcl
-#endif
-{
- va_list var;
- extern Widget _XtVaAppInitialize();
-
- VENDORINIT
- Va_start(var, fallback_resources);
- return _XtVaAppInitialize(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, var);
-}
-
-#if NeedFunctionPrototypes
-Widget
-XtOpenApplication(
-XtAppContext * app_context_return,
-_Xconst char* application_class,
-XrmOptionDescRec *options,
-Cardinal num_options,
-int *argc_in_out,
-String *argv_in_out,
-String *fallback_resources,
-WidgetClass widget_class,
-ArgList args_in,
-Cardinal num_args_in
-)
-#else
-Widget
-XtOpenApplication(app_context_return, application_class, options, num_options,
- argc_in_out, argv_in_out, fallback_resources,
- widget_class, args_in, num_args_in)
-XtAppContext * app_context_return;
-String application_class;
-XrmOptionDescRec *options;
-Cardinal num_options, num_args_in;
-int *argc_in_out;
-String *argv_in_out, * fallback_resources;
-WidgetClass widget_class;
-ArgList args_in;
-#endif
-{
- extern Widget _XtOpenApplication();
- VENDORINIT
- return _XtOpenApplication (app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class,
- args_in, num_args_in);
-}
-
-#if NeedVarargsPrototypes
-Widget
-XtVaOpenApplication(
- XtAppContext *app_context_return,
- _Xconst char* application_class,
- XrmOptionDescList options,
- Cardinal num_options,
- int *argc_in_out,
- String *argv_in_out,
- String *fallback_resources,
- WidgetClass widget_class,
- ...)
-#else
-Widget XtVaOpenApplication(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class, va_alist)
- XtAppContext *app_context_return;
- String application_class;
- XrmOptionDescList options;
- Cardinal num_options;
- int *argc_in_out;
- String *argv_in_out;
- String *fallback_resources;
- WidgetClass widget_class;
- va_dcl
-#endif
-{
- va_list var;
- extern Widget _XtVaOpenApplication();
-
- VENDORINIT
- Va_start(var, widget_class);
- return _XtVaOpenApplication(app_context_return, application_class, options,
- num_options, argc_in_out, argv_in_out,
- fallback_resources, widget_class, var);
-}
-
-#else
-
-#ifndef lint
-static int dummy; /* avoid warning from ranlib */
-#endif
-
-#endif /* SUNSHLIB or AIXSHLIB */
-
-#if defined(SUNSHLIB) && !defined(SHAREDCODE)
-
-int _XtInheritTranslations = 0;
-
-extern CompositeClassRec compositeClassRec;
-WidgetClass compositeWidgetClass = (WidgetClass) &compositeClassRec;
-
-extern ConstraintClassRec constraintClassRec;
-WidgetClass constraintWidgetClass = (WidgetClass) &constraintClassRec;
-
-extern WidgetClassRec widgetClassRec;
-WidgetClass widgetClass = &widgetClassRec;
-WidgetClass coreWidgetClass = &widgetClassRec;
-
-extern ObjectClassRec objectClassRec;
-WidgetClass objectClass = (WidgetClass)&objectClassRec;
-
-extern RectObjClassRec rectObjClassRec;
-WidgetClass rectObjClass = (WidgetClass)&rectObjClassRec;
-
-extern ShellClassRec shellClassRec;
-WidgetClass shellWidgetClass = (WidgetClass) &shellClassRec;
-
-extern OverrideShellClassRec overrideShellClassRec;
-WidgetClass overrideShellWidgetClass = (WidgetClass) &overrideShellClassRec;
-
-extern WMShellClassRec wmShellClassRec;
-WidgetClass wmShellWidgetClass = (WidgetClass) &wmShellClassRec;
-
-extern TransientShellClassRec transientShellClassRec;
-WidgetClass transientShellWidgetClass = (WidgetClass) &transientShellClassRec;
-
-extern TopLevelShellClassRec topLevelShellClassRec;
-WidgetClass topLevelShellWidgetClass = (WidgetClass) &topLevelShellClassRec;
-
-extern ApplicationShellClassRec applicationShellClassRec;
-WidgetClass applicationShellWidgetClass = (WidgetClass) &applicationShellClassRec;
-
-extern SessionShellClassRec sessionShellClassRec;
-WidgetClass sessionShellWidgetClass = (WidgetClass) &sessionShellClassRec;
-
-extern HookObjClassRec hookObjClassRec;
-WidgetClass hookObjectClass = (WidgetClass) &hookObjClassRec;
-
-#endif /* SUNSHLIB */
diff --git a/xc/lib/Xt/util/Shell.ht b/xc/lib/Xt/util/Shell.ht
deleted file mode 100644
index c736fc087..000000000
--- a/xc/lib/Xt/util/Shell.ht
+++ /dev/null
@@ -1,95 +0,0 @@
-/* $TOG: Shell.ht /main/27 1998/02/06 13:33:40 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtShell_h
-#define _XtShell_h
-
-#include <X11/SM/SMlib.h>
-
-/***********************************************************************
- *
- * Shell Widget
- *
- ***********************************************************************/
-/*
- * Shell-specific resources names, classes, and a representation type.
- */
-
-#ifndef XTSTRINGDEFINES
-#ifdef __STDC__
-#define _XtShell_h_Const const
-#else
-#define _XtShell_h_Const /**/
-#endif
-#endif
-
-<<<STRING_TABLE_GOES_HERE>>>
-
-#ifndef XTSTRINGDEFINES
-#undef _XtShell_h_Const
-#endif
-
-/* Class record constants */
-
-typedef struct _ShellClassRec *ShellWidgetClass;
-typedef struct _OverrideShellClassRec *OverrideShellWidgetClass;
-typedef struct _WMShellClassRec *WMShellWidgetClass;
-typedef struct _TransientShellClassRec *TransientShellWidgetClass;
-typedef struct _TopLevelShellClassRec *TopLevelShellWidgetClass;
-typedef struct _ApplicationShellClassRec *ApplicationShellWidgetClass;
-typedef struct _SessionShellClassRec *SessionShellWidgetClass;
-
-#ifndef SHELL
-externalref WidgetClass shellWidgetClass;
-externalref WidgetClass overrideShellWidgetClass;
-externalref WidgetClass wmShellWidgetClass;
-externalref WidgetClass transientShellWidgetClass;
-externalref WidgetClass topLevelShellWidgetClass;
-externalref WidgetClass applicationShellWidgetClass;
-externalref WidgetClass sessionShellWidgetClass;
-#endif
-
-#endif /* _XtShell_h */
-/* DON'T ADD STUFF AFTER THIS #endif */
diff --git a/xc/lib/Xt/util/StrDefs.ct b/xc/lib/Xt/util/StrDefs.ct
deleted file mode 100644
index 2c3ebb67e..000000000
--- a/xc/lib/Xt/util/StrDefs.ct
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $TOG: StrDefs.ct /main/3 1998/02/06 13:33:46 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-<<<STRING_TABLE_GOES_HERE>>>
-
diff --git a/xc/lib/Xt/util/StrDefs.ht b/xc/lib/Xt/util/StrDefs.ht
deleted file mode 100644
index edcf2a04e..000000000
--- a/xc/lib/Xt/util/StrDefs.ht
+++ /dev/null
@@ -1,63 +0,0 @@
-/* $TOG: StrDefs.ht /main/4 1998/02/06 13:33:51 kaleb $ */
-
-/***********************************************************
-
-Copyright 1987, 1988, 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.
-
-
-Copyright 1987, 1988 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.
-
-******************************************************************/
-
-#ifndef _XtStringDefs_h_
-#define _XtStringDefs_h_
-
-#ifndef XTSTRINGDEFINES
-#ifdef __STDC__
-#define _XtStringDefs_h_Const const
-#else
-#define _XtStringDefs_h_Const /**/
-#endif
-#endif
-
-<<<STRING_TABLE_GOES_HERE>>>
-
-#ifndef XTSTRINGDEFINES
-#undef _XtStringDefs_h_Const
-#endif
-
-#endif /* _XtStringDefs_h_ */
diff --git a/xc/lib/Xt/util/string.list b/xc/lib/Xt/util/string.list
deleted file mode 100644
index ba363cac0..000000000
--- a/xc/lib/Xt/util/string.list
+++ /dev/null
@@ -1,399 +0,0 @@
-! $XConsortium: string.list,v 1.12 95/05/11 22:32:57 kaleb Exp $
-! NOTE: To maintain binary compatibility, you can only APPEND items within
-! a given list!!!!
-!
-! See the makestrs(1) manual.
-!
-
-#prefix Xt
-#feature XTSTRINGDEFINES
-#externref extern
-#externdef
-! note that the trailing space is required in the #externdef line.
-#ctmpl util/StrDefs.ct
-
-#file StringDefs.h
-#table XtStrings
-#htmpl util/StrDefs.ht
-
-Naccelerators
-NallowHoriz
-NallowVert
-NancestorSensitive
-Nbackground
-NbackgroundPixmap
-Nbitmap
-NborderColor
-Nborder borderColor
-NborderPixmap
-NborderWidth
-Ncallback
-Nchildren
-Ncolormap
-Ndepth
-NdestroyCallback
-NeditType
-Nfile
-Nfont
-NforceBars
-Nforeground
-Nfunction
-Nheight
-Nhighlight
-NhSpace
-Nindex
-NinitialResourcesPersistent
-NinnerHeight
-NinnerWidth
-NinnerWindow
-NinsertPosition
-NinternalHeight
-NinternalWidth
-NjumpProc
-Njustify
-NknobHeight
-NknobIndent
-NknobPixel
-NknobWidth
-Nlabel
-Nlength
-NlowerRight
-NmappedWhenManaged
-NmenuEntry
-Nname
-Nnotify
-NnumChildren
-Norientation
-Nparameter
-Npixmap
-NpopupCallback
-NpopdownCallback
-Nresize
-NreverseVideo
-Nscreen
-NscrollProc
-NscrollDCursor
-NscrollHCursor
-NscrollLCursor
-NscrollRCursor
-NscrollUCursor
-NscrollVCursor
-Nselection
-NselectionArray
-Nsensitive
-Nshown
-Nspace
-Nstring
-NtextOptions
-NtextSink
-NtextSource
-Nthickness
-Nthumb
-NthumbProc
-Ntop
-Ntranslations
-NunrealizeCallback
-Nupdate
-NuseBottom
-NuseRight
-Nvalue
-NvSpace
-Nwidth
-Nwindow
-Nx
-Ny
-CAccelerators
-CBackground
-CBitmap
-CBoolean
-CBorderColor
-CBorderWidth
-CCallback
-CColormap
-CColor
-CCursor
-CDepth
-CEditType
-CEventBindings
-CFile
-CFont
-CForeground
-CFraction
-CFunction
-CHeight
-CHSpace
-CIndex
-CInitialResourcesPersistent
-CInsertPosition
-CInterval
-CJustify
-CKnobIndent
-CKnobPixel
-CLabel
-CLength
-CMappedWhenManaged
-CMargin
-CMenuEntry
-CNotify
-COrientation
-CParameter
-CPixmap
-CPosition
-CReadOnly
-CResize
-CReverseVideo
-CScreen
-CScrollProc
-CScrollDCursor
-CScrollHCursor
-CScrollLCursor
-CScrollRCursor
-CScrollUCursor
-CScrollVCursor
-CSelection
-CSensitive
-CSelectionArray
-CSpace
-CString
-CTextOptions
-CTextPosition
-CTextSink
-CTextSource
-CThickness
-CThumb
-CTranslations
-CValue
-CVSpace
-CWidth
-CWindow
-CX
-CY
-RAcceleratorTable
-RAtom
-RBitmap
-RBool
-RBoolean
-RCallback
-RCallProc
-RCardinal
-RColor
-RColormap
-RCursor
-RDimension
-RDisplay
-REditMode
-REnum
-RFile
-RFloat
-RFont
-RFontStruct
-RFunction
-RGeometry
-RImmediate
-RInitialState
-RInt
-RJustify
-RLongBoolean Bool
-RObject
-ROrientation
-RPixel
-RPixmap
-RPointer
-RPosition
-RScreen
-RShort
-RString
-RStringArray
-RStringTable
-RUnsignedChar
-RTranslationTable
-RVisual
-RWidget
-RWidgetClass
-RWidgetList
-RWindow
-Eoff
-Efalse
-Eno
-Eon
-Etrue
-Eyes
-Evertical
-Ehorizontal
-EtextRead read
-EtextAppend append
-EtextEdit edit
-Extdefaultbackground
-Extdefaultforeground
-Extdefaultfont
-NfontSet
-RFontSet
-CFontSet
-
-#table XtStringsR6
-
-RGravity
-NcreateHook
-NchangeHook
-NconfigureHook
-NgeometryHook
-NdestroyHook
-Nshells
-NnumShells
-RCommandArgArray
-RDirectoryString
-REnvironmentArray
-RRestartStyle
-RSmcConn
-Hcreate
-HsetValues
-HmanageChildren
-HunmanageChildren
-HmanageSet
-HunmanageSet
-HrealizeWidget
-HunrealizeWidget
-HaddCallback
-HaddCallbacks
-HremoveCallback
-HremoveCallbacks
-HremoveAllCallbacks
-HaugmentTranslations
-HoverrideTranslations
-HuninstallTranslations
-HsetKeyboardFocus
-HsetWMColormapWindows
-HsetMappedWhenManaged
-HmapWidget
-HunmapWidget
-Hpopup
-HpopupSpringLoaded
-Hpopdown
-Hconfigure
-HpreGeometry
-HpostGeometry
-Hdestroy
-
-#file Shell.h
-#table XtShellStrings
-#htmpl util/Shell.ht
-
-NiconName
-CIconName
-NiconPixmap
-CIconPixmap
-NiconWindow
-CIconWindow
-NiconMask
-CIconMask
-NwindowGroup
-CWindowGroup
-Nvisual
-CVisual
-NtitleEncoding
-CTitleEncoding
-NsaveUnder
-CSaveUnder
-Ntransient
-CTransient
-NoverrideRedirect
-COverrideRedirect
-NtransientFor
-CTransientFor
-NiconNameEncoding
-CIconNameEncoding
-NallowShellResize
-CAllowShellResize
-NcreatePopupChildProc
-CCreatePopupChildProc
-Ntitle
-CTitle
-RAtom
-Nargc
-CArgc
-Nargv
-CArgv
-NiconX
-CIconX
-NiconY
-CIconY
-Ninput
-CInput
-Niconic
-CIconic
-NinitialState
-CInitialState
-Ngeometry
-CGeometry
-NbaseWidth
-CBaseWidth
-NbaseHeight
-CBaseHeight
-NwinGravity
-CWinGravity
-NminWidth
-CMinWidth
-NminHeight
-CMinHeight
-NmaxWidth
-CMaxWidth
-NmaxHeight
-CMaxHeight
-NwidthInc
-CWidthInc
-NheightInc
-CHeightInc
-NminAspectY
-CMinAspectY
-NmaxAspectY
-CMaxAspectY
-NminAspectX
-CMinAspectX
-NmaxAspectX
-CMaxAspectX
-NwmTimeout
-CWmTimeout
-NwaitForWm waitforwm
-CWaitForWm Waitforwm
-
-#table XtShellStringsR6
-
-Nwaitforwm
-CWaitforwm
-NclientLeader
-CClientLeader
-NwindowRole
-CWindowRole
-Nurgency
-CUrgency
-NcancelCallback
-NcloneCommand
-CCloneCommand
-Nconnection
-CConnection
-NcurrentDirectory
-CCurrentDirectory
-NdieCallback
-NdiscardCommand
-CDiscardCommand
-Nenvironment
-CEnvironment
-NinteractCallback
-NjoinSession
-CJoinSession
-NprogramPath
-CProgramPath
-NresignCommand
-CResignCommand
-NrestartCommand
-CRestartCommand
-NrestartStyle
-CRestartStyle
-NsaveCallback
-NsaveCompleteCallback
-NsessionID
-CSessionID
-NshutdownCommand
-CShutdownCommand
-NerrorCallback
-
diff --git a/xc/lib/Xtst/Imakefile b/xc/lib/Xtst/Imakefile
deleted file mode 100644
index 4d8f58262..000000000
--- a/xc/lib/Xtst/Imakefile
+++ /dev/null
@@ -1,27 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/11 1995/12/08 11:56:32 dpw $
-XCOMM $XFree86: xc/lib/Xtst/Imakefile,v 1.2 1998/12/20 11:57:12 dawes Exp $
-#define DoNormalLib NormalLibXtst
-#define DoSharedLib SharedLibXtst
-#define DoExtraLib SharedLibXtst
-#define DoDebugLib DebugLibXtst
-#define DoProfileLib ProfileLibXtst
-#define LibName Xtst
-#define SoRev SOXTESTREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXtstReqs
-REQUIREDLIBS = SharedXtstReqs
-#endif
-
-INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
-
-SRCS = XTest.c XRecord.c
-OBJS = XTest.o XRecord.o
-
-LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xtst/XRecord.c b/xc/lib/Xtst/XRecord.c
deleted file mode 100644
index f544b60a2..000000000
--- a/xc/lib/Xtst/XRecord.c
+++ /dev/null
@@ -1,1102 +0,0 @@
-/*
-$TOG: XRecord.c /main/7 1998/05/01 10:37:53 kaleb $
-
-XRecord.c - client-side library for RECORD extension
-
-Copyright 1995, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be 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 1995 Network Computing Devices
- *
- * 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 Network Computing Devices
- * not be used in advertising or publicity pertaining to distribution
- * of the software without specific, written prior permission.
- *
- * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
- * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES BE LIABLE
- * FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- **************************************************************************/
-/*
- * By Stephen Gildea, X Consortium, and Martha Zimet, NCD.
- */
-
-#include <stdio.h>
-#include <assert.h>
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include <X11/Xlibint.h>
-#include "Xext.h"
-#include <X11/Xtrans.h>
-#include "extutil.h"
-#include "recordstr.h"
-
-extern unsigned long _XSetLastRequestRead();
-
-static XExtensionInfo _xrecord_info_data;
-static XExtensionInfo *xrecord_info = &_xrecord_info_data;
-static /* const */ char *xrecord_extension_name = RECORD_NAME;
-
-#define XRecordCheckExtension(dpy,i,val) \
- XextCheckExtension(dpy, i, xrecord_extension_name, val)
-
-/**************************************************************************
- * *
- * private utility routines *
- * *
- **************************************************************************/
-
-static XExtDisplayInfo *find_display();
-
-/*
- * A reply buffer holds a reply from RecordEnableContext.
- * Pieces of that buffer are passed to the XRecordEnableContext callback.
- * ref_count is incremented each time we do that.
- * ref_count is decremented each time XRecordFreeData is called on
- * the buffer. When ref_count is 0, we can free or reuse the buffer.
- */
-struct reply_buffer
-{
- struct reply_buffer *next; /* next in list or NULL */
- unsigned char *buf; /* pointer to malloc'd buffer */
- int nbytes; /* size of buf */
- int ref_count; /* callback uses pending */
-};
-
-
-/*
- * There's some extra information the implementation finds useful
- * to attach to an XRecordInterceptData packet to handle memory
- * management. So we really allocate one of these.
- */
-struct intercept_queue
-{
- /* this struct gets passed to the user as an XRecordInterceptData,
- so the data field must come first so we can cast the address
- back and forth */
- XRecordInterceptData data;
- struct intercept_queue *next; /* next in free list or NULL */
- struct mem_cache_str *cache; /* contains head of free list */
-};
-
-/*
- * per-display pointers to cache of malloc'd but unused memory
- */
-struct mem_cache_str
-{
- struct intercept_queue *inter_data; /* free structs only */
- struct reply_buffer *reply_buffers; /* all reply buffers */
- int inter_data_count; /* total allocated, free and in use */
- Bool display_closed; /* so we know when to free ourself */
-};
-
-static int close_display(dpy, codes)
- Display *dpy;
- XExtCodes *codes; /* not used */
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- LockDisplay(dpy);
- if (info && info->data) {
- struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
- struct intercept_queue *iq, *iq_next;
- struct reply_buffer *rbp, **rbp_next_p;
-
- for (iq=cache->inter_data; iq; iq=iq_next) {
- iq_next = iq->next;
- XFree(iq);
- cache->inter_data_count--;
- }
-
- /* this is a little trickier, because some of these
- might still be in use */
- for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) {
- rbp = *rbp_next_p;
- if (rbp->ref_count == 0) {
- *rbp_next_p = rbp->next;
- XFree(rbp->buf);
- XFree(rbp);
- } else {
- rbp_next_p = &rbp->next;
- }
- }
-
- if (cache->reply_buffers == NULL && cache->inter_data_count == 0) {
- /* every thing has been freed, can free ourselves, too */
- XFree(cache);
- } else {
- cache->display_closed = True;
- cache->inter_data = NULL; /* neatness only; won't be used */
- }
- }
- UnlockDisplay(dpy);
- return XextRemoveDisplay(xrecord_info, dpy);
-}
-
-static XPointer alloc_mem_cache()
-{
- struct mem_cache_str *cache;
-
- /* note that an error will go unnoticed */
- cache = (struct mem_cache_str *) Xmalloc(sizeof(struct mem_cache_str));
- if (cache) {
- cache->display_closed = False;
- cache->inter_data = NULL;
- cache->inter_data_count = 0;
- cache->reply_buffers = NULL;
- }
- return (XPointer) cache;
-}
-
-static char *xrecord_error_list[] = {
- "XRecordBadContext (Not a defined RECORD context)",
-};
-
-static XEXT_GENERATE_ERROR_STRING (error_string, xrecord_extension_name,
- RecordNumErrors, xrecord_error_list)
-
-static XExtensionHooks xrecord_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- error_string /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xrecord_info,
- xrecord_extension_name, &xrecord_extension_hooks, RecordNumEvents,
- alloc_mem_cache())
-
-/**************************************************************************
- * *
- * private library routines *
- * *
- **************************************************************************/
-
-static void
-SendRange(dpy, range_item, nranges)
- Display *dpy;
- XRecordRange **range_item;
- int nranges;
-{
- int rlen = SIZEOF(xRecordRange);
- while(nranges--)
- {
- xRecordRange xrange;
-
- xrange.coreRequestsFirst = (*range_item)->core_requests.first;
- xrange.coreRequestsLast = (*range_item)->core_requests.last;
- xrange.coreRepliesFirst = (*range_item)->core_replies.first;
- xrange.coreRepliesLast = (*range_item)->core_replies.last;
- xrange.extRequestsMajorFirst = (*range_item)->ext_requests.ext_major.first;
- xrange.extRequestsMajorLast = (*range_item)->ext_requests.ext_major.last;
- xrange.extRequestsMinorFirst = (*range_item)->ext_requests.ext_minor.first;
- xrange.extRequestsMinorLast = (*range_item)->ext_requests.ext_minor.last;
- xrange.extRepliesMajorFirst = (*range_item)->ext_replies.ext_major.first;
- xrange.extRepliesMajorLast = (*range_item)->ext_replies.ext_major.last;
- xrange.extRepliesMinorFirst = (*range_item)->ext_replies.ext_minor.first;
- xrange.extRepliesMinorLast = (*range_item)->ext_replies.ext_minor.last;
- xrange.deliveredEventsFirst = (*range_item)->delivered_events.first;
- xrange.deliveredEventsLast = (*range_item)->delivered_events.last;
- xrange.deviceEventsFirst = (*range_item)->device_events.first;
- xrange.deviceEventsLast = (*range_item)->device_events.last;
- xrange.errorsFirst = (*range_item)->errors.first;
- xrange.errorsLast = (*range_item)->errors.last;
- xrange.clientStarted = (*range_item)->client_started;
- xrange.clientDied = (*range_item)->client_died;
-
- Data(dpy, (char *)&xrange, rlen);
- range_item++;
- }
-}
-
-/**************************************************************************
- * *
- * public routines *
- * *
- **************************************************************************/
-
-XID
-XRecordIdBaseMask(dpy)
- Display *dpy;
-{
- return 0x1fffffff & ~dpy->resource_mask;
-}
-
-Status
-XRecordQueryVersion (dpy, cmajor_return, cminor_return)
- Display *dpy;
- int *cmajor_return, *cminor_return;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordQueryVersionReq *req;
- xRecordQueryVersionReply rep;
-
- XRecordCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(RecordQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordQueryVersion;
- req->majorVersion = RECORD_MAJOR_VERSION;
- req->minorVersion = RECORD_MINOR_VERSION;
- if (!_XReply(dpy,(xReply *)&rep, 0, True)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *cmajor_return = rep.majorVersion;
- *cminor_return = rep.minorVersion;
- return ((rep.majorVersion == RECORD_MAJOR_VERSION) &&
- (rep.minorVersion >= RECORD_LOWEST_MINOR_VERSION));
-}
-
-XRecordContext
-XRecordCreateContext(dpy, datum_flags, clients, nclients, ranges, nranges)
- Display *dpy;
- int datum_flags;
- XRecordClientSpec *clients;
- int nclients;
- XRecordRange **ranges;
- int nranges;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordCreateContextReq *req;
- int clen = 4 * nclients;
-
- XRecordCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RecordCreateContext, req);
-
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordCreateContext;
- req->context = XAllocID(dpy);
- req->length += (nclients * 4 +
- nranges * SIZEOF(xRecordRange)) >> 2;
- req->elementHeader = datum_flags;
- req->nClients = nclients;
- req->nRanges = nranges;
-
- Data32(dpy, (long *)clients, clen);
- SendRange(dpy, ranges, nranges);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return req->context;
-}
-
-XRecordRange *
-XRecordAllocRange()
-{
- return (XRecordRange*)Xcalloc(1, sizeof(XRecordRange));
-}
-
-Status
-XRecordRegisterClients(dpy, context, datum_flags, clients, nclients, ranges, nranges)
- Display *dpy;
- XRecordContext context;
- int datum_flags;
- XRecordClientSpec *clients;
- int nclients;
- XRecordRange **ranges;
- int nranges;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordRegisterClientsReq *req;
- int clen = 4 * nclients;
-
- XRecordCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RecordRegisterClients, req);
-
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordRegisterClients;
- req->context = context;
- req->length += (nclients * 4 +
- nranges * SIZEOF(xRecordRange)) >> 2;
- req->elementHeader = datum_flags;
- req->nClients = nclients;
- req->nRanges = nranges;
-
- Data32(dpy, (long *)clients, clen);
- SendRange(dpy, ranges, nranges);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Status
-XRecordUnregisterClients(dpy, context, clients, nclients)
- Display *dpy;
- XRecordContext context;
- XRecordClientSpec *clients;
- int nclients;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordUnregisterClientsReq *req;
- int clen = 4 * nclients;
-
- XRecordCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RecordUnregisterClients, req);
-
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordUnregisterClients;
- req->context = context;
- req->length += nclients;
- req->nClients = nclients;
-
- Data32(dpy, (long *)clients, clen);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-static void
-WireToLibRange(wire_range, lib_range)
- xRecordRange *wire_range;
- XRecordRange *lib_range;
-{
- lib_range->core_requests.first = wire_range->coreRequestsFirst;
- lib_range->core_requests.last = wire_range->coreRequestsLast;
- lib_range->core_replies.first = wire_range->coreRepliesFirst;
- lib_range->core_replies.last = wire_range->coreRepliesLast;
- lib_range->ext_requests.ext_major.first = wire_range->extRequestsMajorFirst;
- lib_range->ext_requests.ext_major.last = wire_range->extRequestsMajorLast;
- lib_range->ext_requests.ext_minor.first = wire_range->extRequestsMinorFirst;
- lib_range->ext_requests.ext_minor.last = wire_range->extRequestsMinorLast;
- lib_range->ext_replies.ext_major.first = wire_range->extRepliesMajorFirst;
- lib_range->ext_replies.ext_major.last = wire_range->extRepliesMajorLast;
- lib_range->ext_replies.ext_minor.first = wire_range->extRepliesMinorFirst;
- lib_range->ext_replies.ext_minor.last = wire_range->extRepliesMinorLast;
- lib_range->delivered_events.first = wire_range->deliveredEventsFirst;
- lib_range->delivered_events.last = wire_range->deliveredEventsLast;
- lib_range->device_events.first = wire_range->deviceEventsFirst;
- lib_range->device_events.last = wire_range->deviceEventsLast;
- lib_range->errors.first = wire_range->errorsFirst;
- lib_range->errors.last = wire_range->errorsLast;
- lib_range->client_started = wire_range->clientStarted;
- lib_range->client_died = wire_range->clientDied;
-}
-
-Status
-XRecordGetContext(dpy, context, state_return)
- Display *dpy;
- XRecordContext context;
- XRecordState **state_return;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordGetContextReq *req;
- xRecordGetContextReply rep;
- int count, i, rn;
- xRecordRange xrange;
- XRecordRange *ranges;
- xRecordClientInfo xclient_inf;
- XRecordClientInfo **client_inf, *client_inf_str;
- XRecordState *ret;
-
- XRecordCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RecordGetContext, req);
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordGetContext;
- req->context = context;
- if (!_XReply(dpy,(xReply *)&rep, 0, False)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
- count = rep.nClients;
-
- ret = (XRecordState*)Xmalloc(sizeof(XRecordState));
- if (!ret) {
- /* XXX - eat data */
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
-
- ret->enabled = rep.enabled;
- ret->datum_flags = rep.elementHeader;
- ret->nclients = count;
-
- if (count)
- {
- client_inf = (XRecordClientInfo **) Xcalloc(count, sizeof(XRecordClientInfo*));
- ret->client_info = client_inf;
- client_inf_str = (XRecordClientInfo *) Xmalloc(count*sizeof(XRecordClientInfo));
- if (!client_inf || !client_inf_str)
- {
- for(i = 0; i < count; i++)
- {
- _XEatData (dpy, sizeof(xRecordClientInfo));
- _XEatData (dpy, SIZEOF(xRecordRange)); /* XXX - don't know how many */
- }
- UnlockDisplay(dpy);
- XRecordFreeState(ret);
- SyncHandle();
- return 0;
- }
- for(i = 0; i < count; i++)
- {
- client_inf[i] = &(client_inf_str[i]);
- _XRead(dpy, (char *)&xclient_inf, (long)sizeof(xRecordClientInfo));
- client_inf_str[i].client = xclient_inf.clientResource;
- client_inf_str[i].nranges = xclient_inf.nRanges;
-
- if (xclient_inf.nRanges)
- {
- client_inf_str[i].ranges = (XRecordRange**) Xcalloc(xclient_inf.nRanges, sizeof(XRecordRange*));
- ranges = (XRecordRange*) Xmalloc(xclient_inf.nRanges * sizeof(XRecordRange));
- if (!client_inf_str[i].ranges || !ranges) {
- /* XXX eat data */
- UnlockDisplay(dpy);
- XRecordFreeState(ret);
- SyncHandle();
- return 0;
- }
- for (rn=0; rn<xclient_inf.nRanges; rn++) {
- client_inf_str[i].ranges[rn] = &(ranges[rn]);
- _XRead(dpy, (char *)&xrange, (long)sizeof(xRecordRange));
- WireToLibRange(&xrange, &(ranges[rn]));
- }
- } else {
- client_inf_str[i].ranges = NULL;
- }
- }
- } else {
- ret->client_info = NULL;
- }
-
- *state_return = ret;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-void
-XRecordFreeState(state)
- XRecordState *state;
-{
- int i;
-
- for(i=0; i<state->nclients; i++) {
- if (state->client_info[i]->ranges) {
- if (state->client_info[i]->ranges[0])
- Xfree(state->client_info[i]->ranges[0]);
- Xfree(state->client_info[i]->ranges);
- }
- }
- if (state->client_info) {
- if (state->client_info[0])
- Xfree(state->client_info[0]);
- Xfree(state->client_info);
- }
- Xfree(state);
-}
-
-static struct reply_buffer *alloc_reply_buffer(info, nbytes)
- XExtDisplayInfo *info;
- int nbytes;
-{
- struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
- struct reply_buffer *rbp;
- struct reply_buffer *saved_rb = NULL;
- /*
- * First look for an allocated buffer that is not in use.
- * If we have a big enough buffer, use that, otherwise
- * realloc an existing one.
- */
- for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) {
- if (rbp->ref_count == 0) {
- if (rbp->nbytes >= nbytes)
- return rbp;
- else
- saved_rb = rbp;
- }
- }
- if (saved_rb) {
- saved_rb->buf = (unsigned char *)Xrealloc(saved_rb->buf, nbytes);
- if (!saved_rb->buf) {
- saved_rb->nbytes = 0;
- return NULL;
- }
- saved_rb->nbytes = nbytes;
- return saved_rb;
- }
-
- /*
- * nothing available; malloc a new struct
- */
- rbp = (struct reply_buffer *)Xmalloc(sizeof(struct reply_buffer));
- if (!rbp)
- return NULL;
- rbp->buf = (unsigned char *)Xmalloc(nbytes);
- if (!rbp->buf) {
- Xfree(rbp);
- return NULL;
- }
- rbp->nbytes = nbytes;
- rbp->ref_count = 0;
- rbp->next = cache->reply_buffers;
- cache->reply_buffers = rbp;
- return rbp;
-}
-
-static XRecordInterceptData *alloc_inter_data(info)
- XExtDisplayInfo *info;
-{
- struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
- struct intercept_queue *iq;
-
- /* if there is one on the free list, pop it */
- if (cache->inter_data) {
- iq = cache->inter_data;
- cache->inter_data = iq->next;
- return &iq->data;
- }
- /* allocate a new one */
- iq = (struct intercept_queue *)Xmalloc(sizeof(struct intercept_queue));
- if (!iq)
- return NULL;
- iq->cache = cache;
- cache->inter_data_count++;
- return &iq->data;
-}
-
-void
-XRecordFreeData(data)
- XRecordInterceptData *data;
-{
- /* we can do this cast because that is what we really allocated */
- struct intercept_queue *iq = (struct intercept_queue *)data;
- struct reply_buffer *rbp = NULL;
- struct mem_cache_str *cache = iq->cache;
-
- /*
- * figure out what reply_buffer this points at
- * and decrement its ref_count.
- */
- if (data->data) {
-
- for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) {
- if (data->data >= rbp->buf
- && data->data < rbp->buf + rbp->nbytes)
- {
- assert(rbp->ref_count > 0);
- rbp->ref_count--;
- break;
- }
- }
- /* it's an error if we didn't find something to free */
- assert(rbp);
- }
- /*
- * If the display is still open, put this back on the free queue.
- *
- * Otherwise the display is closed and we won't reuse this, so free it.
- * See if we can free the reply buffer, too.
- * If we can, see if this is the last reply buffer and if so
- * free the list of reply buffers.
- */
- if (cache->display_closed == False) {
- iq->next = cache->inter_data;
- cache->inter_data = iq;
- } else {
- if (rbp && rbp->ref_count == 0) {
- struct reply_buffer *rbp2, **rbp_next_p;
-
- /* Have to search the list again to find the prev element.
- This is not the common case, so don't slow down the code
- above by doing it then. */
- for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) {
- rbp2 = *rbp_next_p;
- if (rbp == rbp2) {
- *rbp_next_p = rbp2->next;
- break;
- } else {
- rbp_next_p = &rbp2->next;
- }
- }
- XFree(rbp->buf);
- XFree(rbp);
- }
-
- XFree(iq);
- cache->inter_data_count--;
-
- if (cache->reply_buffers == NULL && cache->inter_data_count == 0) {
- XFree(cache); /* all finished */
- }
- }
-}
-
-/* the EXTRACT macros are adapted from ICElibint.h */
-
-#ifndef WORD64
-
-#define EXTRACT_CARD16(swap, src, dst) \
-{ \
- (dst) = *((CARD16 *) (src)); \
- if (swap) \
- (dst) = lswaps (dst); \
-}
-
-#define EXTRACT_CARD32(swap, src, dst) \
-{ \
- (dst) = *((CARD32 *) (src)); \
- if (swap) \
- (dst) = lswapl (dst); \
-}
-
-#else /* WORD64 */
-
-#define EXTRACT_CARD16(swap, src, dst) \
-{ \
- (dst) = *((src) + 0); \
- (dst) <<= 8; \
- (dst) |= *((src) + 1); \
- if (swap) \
- (dst) = lswaps (dst); \
-}
-
-#define EXTRACT_CARD32(swap, src, dst) \
-{ \
- (dst) = *((src) + 0); \
- (dst) <<= 8; \
- (dst) |= *((src) + 1); \
- (dst) <<= 8; \
- (dst) |= *((src) + 2); \
- (dst) <<= 8; \
- (dst) |= *((src) + 3); \
- if (swap) \
- (dst) = lswapl (dst); \
-}
-
-#endif /* WORD64 */
-
-/* byte swapping macros from xfs/include/misc.h */
-
-/* byte swap a long literal */
-#define lswapl(x) ((((x) & 0xff) << 24) |\
- (((x) & 0xff00) << 8) |\
- (((x) & 0xff0000) >> 8) |\
- (((x) >> 24) & 0xff))
-
-/* byte swap a short literal */
-#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
-
-enum parser_return { Continue, End, Error };
-
-static enum parser_return
-parse_reply_call_callback(dpy, info, rep, reply, callback, closure)
- Display *dpy;
- XExtDisplayInfo *info;
- xRecordEnableContextReply *rep;
- struct reply_buffer *reply;
- XRecordInterceptProc callback;
- XPointer closure;
-{
- int current_index;
- int datum_bytes;
- XRecordInterceptData *data;
-
- /* call the callback for each protocol element in the reply */
- current_index = 0;
- do {
- data = alloc_inter_data(info);
- if (!data)
- return Error;
-
- data->id_base = rep->idBase;
- data->category = rep->category;
- data->client_swapped = rep->clientSwapped;
- data->server_time = rep->serverTime;
- data->client_seq = rep->recordedSequenceNumber;
- /*
- * compute the size of this protocol element.
- */
- switch (rep->category) {
- case XRecordFromServer:
- if (rep->elementHeader&XRecordFromServerTime) {
- EXTRACT_CARD32(rep->clientSwapped,
- reply->buf+current_index,
- data->server_time);
- current_index += 4;
- }
- switch (reply->buf[current_index]) {
- case X_Reply: /* reply */
- EXTRACT_CARD32(rep->clientSwapped,
- reply->buf+current_index+4, datum_bytes);
- datum_bytes = (datum_bytes+8) << 2;
- break;
- default: /* error or event */
- datum_bytes = 32;
- }
- break;
- case XRecordFromClient:
- if (rep->elementHeader&XRecordFromClientTime) {
- EXTRACT_CARD32(rep->clientSwapped,
- reply->buf+current_index,
- data->server_time);
- current_index += 4;
- }
- if (rep->elementHeader&XRecordFromClientSequence) {
- EXTRACT_CARD32(rep->clientSwapped,
- reply->buf+current_index,
- data->client_seq);
- current_index += 4;
- }
- if (reply->buf[current_index+2] == 0
- && reply->buf[current_index+3] == 0) /* needn't swap 0 */
- { /* BIG-REQUESTS */
- EXTRACT_CARD32(rep->clientSwapped,
- reply->buf+current_index+4, datum_bytes);
- } else {
- EXTRACT_CARD16(rep->clientSwapped,
- reply->buf+current_index+2, datum_bytes);
- }
- datum_bytes <<= 2;
- break;
- case XRecordClientStarted:
- EXTRACT_CARD16(rep->clientSwapped,
- reply->buf+current_index+6, datum_bytes);
- datum_bytes = (datum_bytes+2) << 2;
- break;
- case XRecordClientDied:
- if (rep->elementHeader&XRecordFromClientSequence) {
- EXTRACT_CARD32(rep->clientSwapped,
- reply->buf+current_index,
- data->client_seq);
- current_index += 4;
- }
- /* fall through */
- case XRecordStartOfData:
- case XRecordEndOfData:
- datum_bytes = 0;
- }
-
- if (datum_bytes > 0) {
- if (current_index + datum_bytes > rep->length << 2)
- fprintf(stderr,
- "XRecord: %lu-byte reply claims %d-byte element (seq %lu)\n",
- rep->length << 2, current_index + datum_bytes,
- dpy->last_request_read);
- /*
- * This assignment (and indeed the whole buffer sharing
- * scheme) assumes arbitrary 4-byte boundaries are
- * addressable.
- */
- data->data = reply->buf+current_index;
- reply->ref_count++;
- } else {
- data->data = NULL;
- }
- data->data_len = datum_bytes >> 2;
-
- (*callback)(closure, data);
-
- current_index += datum_bytes;
- } while (current_index<rep->length<<2);
-
- if (rep->category == XRecordEndOfData)
- return End;
-
- return Continue;
-}
-
-Status
-XRecordEnableContext(dpy, context, callback, closure)
- Display *dpy;
- XRecordContext context;
- XRecordInterceptProc callback;
- XPointer closure;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordEnableContextReq *req;
- xRecordEnableContextReply rep;
- struct reply_buffer *reply;
- enum parser_return status;
-
- XRecordCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RecordEnableContext, req);
-
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordEnableContext;
- req->context = context;
-
- while (1)
- {
- /* This code should match that in XRecordEnableContextAsync */
- if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
-
- if (rep.length > 0) {
- reply = alloc_reply_buffer(info, rep.length<<2);
- if (!reply) {
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
- _XRead (dpy, (char *)reply->buf, rep.length<<2);
- } else {
- reply = NULL;
- }
-
- status = parse_reply_call_callback(dpy, info, &rep, reply,
- callback, closure);
- switch (status) {
- case Continue:
- break;
- case End:
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
- case Error:
- UnlockDisplay(dpy);
- SyncHandle();
- return 0;
- }
- }
-}
-
-
-typedef struct _record_async_state
-{
- unsigned long enable_seq;
- _XAsyncHandler *async;
- _XAsyncErrorState *error_state;
- XExtDisplayInfo *info;
- XRecordInterceptProc callback;
- XPointer closure;
-} record_async_state;
-
-static Bool
-record_async_handler(dpy, rep, buf, len, adata)
- register Display *dpy;
- register xReply *rep;
- char *buf;
- int len;
- XPointer adata;
-{
- register record_async_state *state = (record_async_state *)adata;
- struct reply_buffer *reply;
- enum parser_return status;
- extern void _XGetAsyncData();
-
- if (dpy->last_request_read != state->enable_seq)
- {
- if (dpy->last_request_read > state->enable_seq) {
- /* it is an error that we are still on the handler list */
- fprintf(stderr, "XRecord: handler for seq %lu never saw XRecordEndOfData. (seq now %lu)\n",
- state->enable_seq, dpy->last_request_read);
- DeqAsyncHandler(dpy, state->async);
- Xfree(state->async);
- }
- return False;
- }
- if (rep->generic.type == X_Error)
- {
- DeqAsyncHandler(dpy, state->async);
- Xfree(state->async);
- return False;
- }
-
- if (rep->generic.length > 0) {
- reply = alloc_reply_buffer(state->info, rep->generic.length<<2);
-
- if (!reply) {
- DeqAsyncHandler(dpy, state->async);
- Xfree(state->async);
- return False;
- }
-
- _XGetAsyncData(dpy, reply->buf, buf, len,
- SIZEOF(xRecordEnableContextReply),
- rep->generic.length << 2, 0);
- } else {
- reply = NULL;
- }
-
- status = parse_reply_call_callback(dpy, state->info,
- (xRecordEnableContextReply*) rep,
- reply, state->callback, state->closure);
-
- if (status != Continue)
- {
- DeqAsyncHandler(dpy, state->async);
- Xfree(state->async);
- if (status == Error)
- return False;
- }
-
- return True;
-}
-
-/*
- * reads the first reply, StartOfData, synchronously,
- * then returns allowing the app to call XRecordProcessReplies
- * to get the rest.
- */
-Status
-XRecordEnableContextAsync(dpy, context, callback, closure)
- Display *dpy;
- XRecordContext context;
- XRecordInterceptProc callback;
- XPointer closure;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordEnableContextReq *req;
- xRecordEnableContextReply rep;
- struct reply_buffer *reply;
- enum parser_return status;
- _XAsyncHandler *async;
- record_async_state *async_state;
-
- XRecordCheckExtension (dpy, info, 0);
- async = (_XAsyncHandler *)Xmalloc(sizeof(_XAsyncHandler) +
- sizeof(record_async_state));
- if (!async)
- return 0;
- async_state = (record_async_state *)(async + 1);
-
- LockDisplay(dpy);
- GetReq(RecordEnableContext, req);
-
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordEnableContext;
- req->context = context;
-
- /* Get the StartOfData reply. */
- /* This code should match that in XRecordEnableContext */
- if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- Xfree(async);
- return 0;
- }
-
- /* this had better be a StartOfData, which has no extra data. */
- if (rep.length != 0) {
- fprintf(stderr, "XRecord: malformed StartOfData for sequence %lu\n",
- dpy->last_request_read);
- }
- reply = NULL;
-
- status = parse_reply_call_callback(dpy, info, &rep, reply,
- callback, closure);
- if (status != Continue)
- {
- UnlockDisplay(dpy);
- Xfree(async);
- return 0;
- }
-
- /* hook in the async handler for the rest of the replies */
- async_state->enable_seq = dpy->request;
- async_state->async = async;
- async_state->info = info;
- async_state->callback = callback;
- async_state->closure = closure;
-
- async->next = dpy->async_handlers;
- async->handler = record_async_handler;
- async->data = (XPointer)async_state;
- dpy->async_handlers = async;
-
- UnlockDisplay(dpy);
- /* Don't invoke SyncHandle here, since this is an async
- function. Does this break XSetAfterFunction() ? */
- return 1;
-}
-
-void
-XRecordProcessReplies(dpy)
- Display *dpy;
-{
- (void) XPending(dpy);
-}
-
-Status
-XRecordDisableContext(dpy, context)
- Display *dpy;
- XRecordContext context;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordDisableContextReq *req;
-
- XRecordCheckExtension (dpy, info, 0);
- LockDisplay(dpy);
- GetReq(RecordDisableContext, req);
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordDisableContext;
- req->context = context;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-Status
-XRecordFreeContext(dpy, context)
- Display *dpy;
- XRecordContext context;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xRecordFreeContextReq *req;
-
- XRecordCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(RecordFreeContext, req);
- req->reqType = info->codes->major_opcode;
- req->recordReqType = X_RecordFreeContext;
- req->context = context;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
diff --git a/xc/lib/Xtst/XTest.c b/xc/lib/Xtst/XTest.c
deleted file mode 100644
index 2cb880444..000000000
--- a/xc/lib/Xtst/XTest.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/* $TOG: XTest.c /main/16 1998/02/06 15:58:41 kaleb $ */
-/*
-Copyright 1990, 1991 by UniSoft Group Limited
-*/
-
-/*
-
-Copyright 1992, 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/lib/Xtst/XTest.c,v 1.2 1998/12/20 11:57:12 dawes Exp $ */
-
-#define NEED_REPLIES
-#include "Xlibint.h"
-#include "XTest.h"
-#include "xteststr.h"
-#include "Xext.h"
-#include "extutil.h"
-#include "XInput.h"
-#include "XIproto.h"
-
-static XExtensionInfo _xtest_info_data;
-static XExtensionInfo *xtest_info = &_xtest_info_data;
-static /* const */ char *xtest_extension_name = XTestExtensionName;
-
-#define XTestCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xtest_extension_name, val)
-
-#define XTestICheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xtest_extension_name, val); \
- if (!i->data) return val
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display();
-static /* const */ XExtensionHooks xtest_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL /* error_string */
-};
-
-static XPointer
-get_xinput_base(dpy)
- Display *dpy;
-{
- int major_opcode, first_event, first_error;
- first_event = 0;
-
- XQueryExtension(dpy, INAME, &major_opcode, &first_event, &first_error);
- return (XPointer)(long)first_event;
-}
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xtest_info,
- xtest_extension_name,
- &xtest_extension_hooks, XTestNumberEvents,
- get_xinput_base(dpy))
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtest_info)
-
-/*****************************************************************************
- * *
- * public routines *
- * *
- *****************************************************************************/
-
-Bool
-XTestQueryExtension (dpy, event_basep, error_basep, majorp, minorp)
- Display *dpy;
- int *event_basep, *error_basep;
- int *majorp, *minorp;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestGetVersionReq *req;
- xXTestGetVersionReply rep;
-
- if (XextHasExtension(info)) {
- LockDisplay(dpy);
- GetReq(XTestGetVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestGetVersion;
- req->majorVersion = XTestMajorVersion;
- req->minorVersion = XTestMinorVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- *majorp = rep.majorVersion;
- *minorp = rep.minorVersion;
- return True;
- } else {
- return False;
- }
-}
-
-Bool
-XTestCompareCursorWithWindow(dpy, window, cursor)
- Display *dpy;
- Window window;
- Cursor cursor;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestCompareCursorReq *req;
- xXTestCompareCursorReply rep;
-
- XTestCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestCompareCursor, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestCompareCursor;
- req->window = window;
- req->cursor = cursor;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.same;
-}
-
-Bool
-XTestCompareCurrentCursorWithWindow(dpy, window)
- Display *dpy;
- Window window;
-{
- return XTestCompareCursorWithWindow(dpy, window, XTestCurrentCursor);
-}
-
-XTestFakeKeyEvent(dpy, keycode, is_press, delay)
- Display *dpy;
- unsigned int keycode;
- Bool is_press;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = is_press ? KeyPress : KeyRelease;
- req->detail = keycode;
- req->time = delay;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestFakeButtonEvent(dpy, button, is_press, delay)
- Display *dpy;
- unsigned int button;
- Bool is_press;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = is_press ? ButtonPress : ButtonRelease;
- req->detail = button;
- req->time = delay;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestFakeMotionEvent(dpy, screen, x, y, delay)
- Display *dpy;
- int screen;
- int x, y;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = MotionNotify;
- req->detail = False;
- if (screen == -1)
- req->root = None;
- else
- req->root = RootWindow(dpy, screen);
- req->rootX = x;
- req->rootY = y;
- req->time = delay;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestFakeRelativeMotionEvent(dpy, dx, dy, delay)
- Display *dpy;
- int dx, dy;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = MotionNotify;
- req->detail = True;
- req->root = None;
- req->rootX = dx;
- req->rootY = dy;
- req->time = delay;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-static void
-send_axes(dpy, info, req, dev, first_axis, axes, n_axes)
- Display *dpy;
- XExtDisplayInfo *info;
- xXTestFakeInputReq *req;
- XDevice *dev;
- int first_axis;
- int *axes;
- int n_axes;
-{
- deviceValuator ev;
- int n;
-
- req->deviceid |= MORE_EVENTS;
- req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2);
- ev.type = XI_DeviceValuator + (long)info->data;
- ev.deviceid = dev->device_id;
- ev.num_valuators = n_axes;
- ev.first_valuator = first_axis;
- while (n_axes > 0) {
- n = n_axes;
- if (n > 6)
- n = 6;
- switch (n) {
- case 6:
- ev.valuator5 = *(axes+5);
- case 5:
- ev.valuator4 = *(axes+4);
- case 4:
- ev.valuator3 = *(axes+3);
- case 3:
- ev.valuator2 = *(axes+2);
- case 2:
- ev.valuator1 = *(axes+1);
- case 1:
- ev.valuator0 = *axes;
- }
- Data(dpy, (char *)&ev, SIZEOF(xEvent));
- axes += n;
- n_axes -= n;
- ev.first_valuator += n;
- }
-}
-
-XTestFakeDeviceKeyEvent(dpy, dev, keycode, is_press, axes, n_axes, delay)
- Display *dpy;
- XDevice *dev;
- unsigned int keycode;
- Bool is_press;
- int *axes;
- int n_axes;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestICheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = is_press ? XI_DeviceKeyPress : XI_DeviceKeyRelease;
- req->type += (int)(long)info->data;
- req->detail = keycode;
- req->time = delay;
- req->deviceid = dev->device_id;
- if (n_axes)
- send_axes(dpy, info, req, dev, 0, axes, n_axes);
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestFakeDeviceButtonEvent(dpy, dev, button, is_press, axes, n_axes, delay)
- Display *dpy;
- XDevice *dev;
- unsigned int button;
- Bool is_press;
- int *axes;
- int n_axes;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestICheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = is_press ? XI_DeviceButtonPress : XI_DeviceButtonRelease;
- req->type += (int)(long)info->data;
- req->detail = button;
- req->time = delay;
- req->deviceid = dev->device_id;
- if (n_axes)
- send_axes(dpy, info, req, dev, 0, axes, n_axes);
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestFakeProximityEvent(dpy, dev, in_prox, axes, n_axes, delay)
- Display *dpy;
- XDevice *dev;
- Bool in_prox;
- int *axes;
- int n_axes;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestICheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = in_prox ? XI_ProximityIn : XI_ProximityOut;
- req->type += (int)(long)info->data;
- req->time = delay;
- req->deviceid = dev->device_id;
- if (n_axes)
- send_axes(dpy, info, req, dev, 0, axes, n_axes);
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestFakeDeviceMotionEvent(dpy, dev, is_relative,
- first_axis, axes, n_axes, delay)
- Display *dpy;
- XDevice *dev;
- Bool is_relative;
- int first_axis;
- int *axes;
- int n_axes;
- unsigned long delay;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestFakeInputReq *req;
-
- XTestICheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestFakeInput, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestFakeInput;
- req->type = XI_DeviceMotionNotify + (int)(long)info->data;
- req->detail = is_relative;
- req->time = delay;
- req->deviceid = dev->device_id;
- send_axes(dpy, info, req, dev, first_axis, axes, n_axes);
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-XTestGrabControl(dpy, impervious)
- Display *dpy;
- Bool impervious;
-{
- XExtDisplayInfo *info = find_display (dpy);
- register xXTestGrabControlReq *req;
-
- XTestCheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XTestGrabControl, req);
- req->reqType = info->codes->major_opcode;
- req->xtReqType = X_XTestGrabControl;
- req->impervious = impervious;
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-
-void
-XTestSetGContextOfGC(gc, gid)
- GC gc;
- GContext gid;
-{
- gc->gid = gid;
-}
-
-void
-XTestSetVisualIDOfVisual(visual, visualid)
- Visual *visual;
- VisualID visualid;
-{
- visual->visualid = visualid;
-}
-
-static xReq _dummy_request = {
- 0, 0, 0
-};
-
-Status
-XTestDiscard(dpy)
- Display *dpy;
-{
- Bool something;
- register char *ptr;
-
- LockDisplay(dpy);
- if (something = (dpy->bufptr != dpy->buffer)) {
- for (ptr = dpy->buffer;
- ptr < dpy->bufptr;
- ptr += (((xReq *)ptr)->length << 2))
- dpy->request--;
- dpy->bufptr = dpy->buffer;
- dpy->last_req = (char *)&_dummy_request;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return something;
-}
diff --git a/xc/lib/Xtst/Xtst-def.cpp b/xc/lib/Xtst/Xtst-def.cpp
deleted file mode 100644
index 518895aef..000000000
--- a/xc/lib/Xtst/Xtst-def.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-LIBRARY XTST
-VERSION LIBRARY_VERSION
-EXPORTS
- XTestCompareCurrentCursorWithWindow
- XTestCompareCursorWithWindow
- XTestDiscard
- XTestFakeButtonEvent
- XTestFakeDeviceButtonEvent
- XTestFakeDeviceKeyEvent
- XTestFakeDeviceMotionEvent
- XTestFakeKeyEvent
- XTestFakeMotionEvent
- XTestFakeProximityEvent
- XTestFakeRelativeMotionEvent
- XTestGrabControl
- XTestQueryExtension
- XTestSetGContextOfGC
- XTestSetVisualIDOfVisual
- XRecordQueryVersion
- XRecordCreateContext
- XRecordAllocRange
- XRecordRegisterClients
- XRecordUnregisterClients
- XRecordGetContext
- XRecordFreeState
- XRecordEnableContext
- XRecordEnableContextAsync
- XRecordProcessReplies
- XRecordFreeData
- XRecordDisableContext
- XRecordFreeContext
-/* $XConsortium: Xtst-def.cpp /main/4 1996/05/07 13:15:38 kaleb $ */
diff --git a/xc/lib/Xtst/Xtstos2.def b/xc/lib/Xtst/Xtstos2.def
deleted file mode 100644
index 55a1c089c..000000000
--- a/xc/lib/Xtst/Xtstos2.def
+++ /dev/null
@@ -1,37 +0,0 @@
-LIBRARY XTST
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xtst/Xtstos2.def,v 3.5 1999/04/29 09:13:34 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- XTestCompareCurrentCursorWithWindow @ 1
- XTestCompareCursorWithWindow @ 2
- XTestDiscard @ 3
- XTestFakeButtonEvent @ 4
- XTestFakeDeviceButtonEvent @ 5
- XTestFakeDeviceKeyEvent @ 6
- XTestFakeDeviceMotionEvent @ 7
- XTestFakeKeyEvent @ 8
- XTestFakeMotionEvent @ 9
- XTestFakeProximityEvent @ 10
- XTestFakeRelativeMotionEvent @ 11
- XTestGrabControl @ 12
- XTestQueryExtension @ 13
- XTestSetGContextOfGC @ 14
- XTestSetVisualIDOfVisual @ 15
- XRecordIdBaseMask @ 16
- XRecordQueryVersion @ 17
- XRecordCreateContext @ 18
- XRecordAllocRange @ 19
- XRecordRegisterClients @ 20
- XRecordUnregisterClients @ 21
- XRecordGetContext @ 22
- XRecordFreeState @ 23
- XRecordFreeData @ 24
- XRecordEnableContext @ 25
- XRecordEnableContextAsync @ 26
- XRecordProcessReplies @ 27
- XRecordDisableContext @ 28
- XRecordFreeContext @ 29
diff --git a/xc/lib/Xtst/Xtstos2.rsp b/xc/lib/Xtst/Xtstos2.rsp
deleted file mode 100644
index 530157763..000000000
--- a/xc/lib/Xtst/Xtstos2.rsp
+++ /dev/null
@@ -1,3 +0,0 @@
-Xtest.obj XRecord.obj /NOL /NOD /BAT
-Xtst.dll
-Xtst.map
diff --git a/xc/lib/Xv/Imakefile b/xc/lib/Xv/Imakefile
deleted file mode 100644
index 9975c85db..000000000
--- a/xc/lib/Xv/Imakefile
+++ /dev/null
@@ -1,29 +0,0 @@
-XCOMM $XFree86: xc/lib/Xv/Imakefile,v 1.5 1999/05/23 08:23:10 dawes Exp $
-
-#define DoNormalLib NormalLibXv
-#define DoSharedLib SharedLibXv
-#define DoDebugLib DebugLibXv
-#define DoProfileLib ProfileLibXv
-#define LibName Xv
-#define SoRev SOXVREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXvReqs
-REQUIREDLIBS = SharedXvReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = Xv.c
- OBJS = Xv.o
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xv/Xv.c b/xc/lib/Xv/Xv.c
deleted file mode 100644
index 0b14d55a0..000000000
--- a/xc/lib/Xv/Xv.c
+++ /dev/null
@@ -1,873 +0,0 @@
-/***********************************************************
-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/lib/Xv/Xv.c,v 1.8 1999/05/23 06:33:31 dawes Exp $ */
-/*
-** File:
-**
-** Xv.c --- Xv library extension module.
-**
-** Author:
-**
-** David Carver (Digital Workstation Engineering/Project Athena)
-**
-** Revisions:
-**
-** 26.06.91 Carver
-** - changed XvFreeAdaptors to XvFreeAdaptorInfo
-** - changed XvFreeEncodings to XvFreeEncodingInfo
-**
-** 11.06.91 Carver
-** - changed SetPortControl to SetPortAttribute
-** - changed GetPortControl to GetPortAttribute
-** - changed QueryBestSize
-**
-** 15.05.91 Carver
-** - version 2.0 upgrade
-**
-** 240.01.91 Carver
-** - version 1.4 upgrade
-**
-*/
-
-#include "Xvlibint.h"
-#include "extutil.h"
-
-static XExtCodes *_XvCodes;
-static Bool (* _XvOldWireToEventVideo)();
-static Bool (* _XvOldWireToEventPort)();
-static char *(* _XvOldErrorString)();
-
-static Bool _XvWireToEvent();
-static char *_XvErrorString();
-
-#define PREAMBLE(stat) \
- LockDisplay(dpy); \
- if ((!_XvCodes) && (!_XvInitExtension(dpy))) \
- { \
- UnlockDisplay(dpy); SyncHandle(); return (stat); \
- }
-
-#define POSTAMBLE \
- UnlockDisplay(dpy); \
- SyncHandle()
-
-int
-XvQueryExtension(
- Display *dpy,
- unsigned int *p_version,
- unsigned int *p_revision,
- unsigned int *p_requestBase,
- unsigned int *p_eventBase,
- unsigned int *p_errorBase
-){
- xvQueryExtensionReq *req;
- xvQueryExtensionReply rep;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(QueryExtension, req);
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadExtension);
- }
-
- *p_version = rep.version;
- *p_revision = rep.revision;
- *p_requestBase = _XvCodes->major_opcode;
- *p_eventBase = _XvCodes->first_event;
- *p_errorBase = _XvCodes->first_error;
-
- return Success;
-}
-
-int
-XvQueryAdaptors(
- Display *dpy,
- Window window,
- unsigned int *p_nAdaptors,
- XvAdaptorInfo **p_pAdaptors
-){
- xvQueryAdaptorsReq *req;
- xvQueryAdaptorsReply rep;
- int size,ii,jj;
- char *name;
- XvAdaptorInfo *pas, *pa;
- XvFormat *pfs, *pf;
- char *buffer;
- union
- {
- char *buffer;
- char *string;
- xvAdaptorInfo *pa;
- xvFormat *pf;
- } u;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(QueryAdaptors, req);
- req->window = window;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadReply);
- }
-
- size = rep.length << 2;
- if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- _XRead (dpy, buffer, size);
-
- u.buffer = buffer;
-
- /* GET INPUT ADAPTORS */
-
- size = rep.num_adaptors*sizeof(XvAdaptorInfo);
- if ((pas=(XvAdaptorInfo *)Xmalloc(size))==NULL)
- {
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
-
- /* INIT ADAPTOR FIELDS */
-
- pa = pas;
- for (ii=0; ii<rep.num_adaptors; ii++)
- {
- pa->num_adaptors = 0;
- pa->name = (char *)NULL;
- pa->formats = (XvFormat *)NULL;
- }
-
- pa = pas;
- for (ii=0; ii<rep.num_adaptors; ii++)
- {
- pa->type = u.pa->type;
- pa->base_id = u.pa->base_id;
- pa->num_ports = u.pa->num_ports;
- pa->num_formats = u.pa->num_formats;
- pa->num_adaptors = rep.num_adaptors - ii;
-
- /* GET ADAPTOR NAME */
-
- size = u.pa->name_size;
- u.buffer += (sz_xvAdaptorInfo + 3) & ~3;
-
- if ( (name = (char *)Xmalloc(size+1)) == NULL)
- {
- XvFreeAdaptorInfo(pas);
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- (void)strncpy(name, u.string, size);
- name[size] = '\0';
- pa->name = name;
-
- u.buffer += (size + 3) & ~3;
-
- /* GET FORMATS */
-
- size = pa->num_formats*sizeof(XvFormat);
- if ((pfs=(XvFormat *)Xmalloc(size))==NULL)
- {
- XvFreeAdaptorInfo(pas);
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
-
- pf = pfs;
- for (jj=0; jj<pa->num_formats; jj++)
- {
- pf->depth = u.pf->depth;
- pf->visual_id = u.pf->visual;
- pf++;
-
- u.buffer += (sz_xvFormat + 3) & ~3;
- }
-
- pa->formats = pfs;
-
- pa++;
-
- }
-
- *p_nAdaptors = rep.num_adaptors;
- *p_pAdaptors = pas;
-
- POSTAMBLE;
-
- return (Success);
-}
-
-
-void
-XvFreeAdaptorInfo(XvAdaptorInfo *pAdaptors)
-{
-
- XvAdaptorInfo *pa;
- int ii;
-
- if (!pAdaptors) return;
-
- pa = pAdaptors;
-
- for (ii=0; ii<pAdaptors->num_adaptors; ii++, pa++)
- {
- if (pa->name)
- {
- Xfree(pa->name);
- }
- if (pa->formats)
- {
- Xfree(pa->formats);
- }
- }
-
- Xfree(pAdaptors);
-}
-
-int
-XvQueryEncodings(
- Display *dpy,
- XvPortID port,
- unsigned int *p_nEncodings,
- XvEncodingInfo **p_pEncodings
-){
- xvQueryEncodingsReq *req;
- xvQueryEncodingsReply rep;
- int size, jj;
- char *name;
- XvEncodingInfo *pes, *pe;
- char *buffer;
- union
- {
- char *buffer;
- char *string;
- xvEncodingInfo *pe;
- } u;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(QueryEncodings, req);
- req->port = port;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadReply);
- }
-
- size = rep.length << 2;
- if ( (buffer = (char *)Xmalloc ((unsigned) size)) == NULL)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- _XRead (dpy, buffer, size);
-
- u.buffer = buffer;
-
- /* GET ENCODINGS */
-
- size = rep.num_encodings*sizeof(XvEncodingInfo);
- if ( (pes = (XvEncodingInfo *)Xmalloc(size)) == NULL)
- {
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
-
- /* INITIALIZE THE ENCODING POINTER */
-
- pe = pes;
- for (jj=0; jj<rep.num_encodings; jj++)
- {
- pe->name = (char *)NULL;
- pe->num_encodings = 0;
- pe++;
- }
-
- pe = pes;
- for (jj=0; jj<rep.num_encodings; jj++)
- {
- pe->encoding_id = u.pe->encoding;
- pe->width = u.pe->width;
- pe->height = u.pe->height;
- pe->rate.numerator = u.pe->rate.numerator;
- pe->rate.denominator = u.pe->rate.denominator;
- pe->num_encodings = rep.num_encodings - jj;
-
- size = u.pe->name_size;
- u.buffer += (sz_xvEncodingInfo + 3) & ~3;
-
- if ( (name = (char *)Xmalloc(size+1)) == NULL)
- {
- Xfree(buffer);
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadAlloc);
- }
- strncpy(name, u.string, size);
- name[size] = '\0';
- pe->name = name;
- pe++;
-
- u.buffer += (size + 3) & ~3;
-
- }
-
- *p_nEncodings = rep.num_encodings;
- *p_pEncodings = pes;
-
- POSTAMBLE;
-
- return (Success);
-}
-
-void
-XvFreeEncodingInfo(XvEncodingInfo *pEncodings)
-{
-
- XvEncodingInfo *pe;
- int ii;
-
- if (!pEncodings) return;
-
- pe = pEncodings;
-
- for (ii=0; ii<pEncodings->num_encodings; ii++, pe++)
- {
- if (pe->name) Xfree(pe->name);
- }
-
- Xfree(pEncodings);
-
-}
-
-int
-XvPutVideo(
- Display *dpy,
- XvPortID port,
- Drawable d,
- GC gc,
- int vx, int vy,
- unsigned int vw, unsigned int vh,
- int dx, int dy,
- unsigned int dw, unsigned int dh
-){
- xvPutVideoReq *req;
-
- PREAMBLE(XvBadExtension);
-
- FlushGC(dpy, gc);
-
- XvGetReq(PutVideo, req);
-
- req->port = port;
- req->drawable = d;
- req->gc = gc->gid;
- req->vid_x = vx;
- req->vid_y = vy;
- req->vid_w = vw;
- req->vid_h = vh;
- req->drw_x = dx;
- req->drw_y = dy;
- req->drw_w = dw;
- req->drw_h = dh;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvPutStill(
- Display *dpy,
- XvPortID port,
- Drawable d,
- GC gc,
- int vx, int vy,
- unsigned int vw, unsigned int vh,
- int dx, int dy,
- unsigned int dw, unsigned int dh
-){
- xvPutStillReq *req;
-
- PREAMBLE(XvBadExtension);
-
- FlushGC(dpy, gc);
-
- XvGetReq(PutStill, req);
- req->port = port;
- req->drawable = d;
- req->gc = gc->gid;
- req->vid_x = vx;
- req->vid_y = vy;
- req->vid_w = vw;
- req->vid_h = vh;
- req->drw_x = dx;
- req->drw_y = dy;
- req->drw_w = dw;
- req->drw_h = dh;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvGetVideo(
- Display *dpy,
- XvPortID port,
- Drawable d,
- GC gc,
- int vx, int vy,
- unsigned int vw, unsigned int vh,
- int dx, int dy,
- unsigned int dw, unsigned int dh
-){
- xvGetVideoReq *req;
-
- PREAMBLE(XvBadExtension);
-
- FlushGC(dpy, gc);
-
- XvGetReq(GetVideo, req);
- req->port = port;
- req->drawable = d;
- req->gc = gc->gid;
- req->vid_x = vx;
- req->vid_y = vy;
- req->vid_w = vw;
- req->vid_h = vh;
- req->drw_x = dx;
- req->drw_y = dy;
- req->drw_w = dw;
- req->drw_h = dh;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvGetStill(
- Display *dpy,
- XvPortID port,
- Drawable d,
- GC gc,
- int vx, int vy,
- unsigned int vw, unsigned int vh,
- int dx, int dy,
- unsigned int dw, unsigned int dh
-){
- xvGetStillReq *req;
-
- PREAMBLE(XvBadExtension);
-
- FlushGC(dpy, gc);
-
- XvGetReq(GetStill, req);
- req->port = port;
- req->drawable = d;
- req->gc = gc->gid;
- req->vid_x = vx;
- req->vid_y = vy;
- req->vid_w = vw;
- req->vid_h = vh;
- req->drw_x = dx;
- req->drw_y = dy;
- req->drw_w = dw;
- req->drw_h = dh;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvStopVideo(
- Display *dpy,
- XvPortID port,
- Drawable draw
-){
- xvStopVideoReq *req;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(StopVideo, req);
- req->port = port;
- req->drawable = draw;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvGrabPort(
- Display *dpy,
- XvPortID port,
- Time time
-){
- int result;
- xvGrabPortReply rep;
- xvGrabPortReq *req;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(GrabPort, req);
- req->port = port;
- req->time = time;
-
- if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0)
- rep.result = GrabSuccess;
-
- result = rep.result;
-
- POSTAMBLE;
-
- return result;
-}
-
-int
-XvUngrabPort(
- Display *dpy,
- XvPortID port,
- Time time
-){
- xvUngrabPortReq *req;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(UngrabPort, req);
- req->port = port;
- req->time = time;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvSelectVideoNotify(
- Display *dpy,
- Drawable drawable,
- Bool onoff
-){
- register xvSelectVideoNotifyReq *req;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(SelectVideoNotify, req);
- req->drawable = drawable;
- req->onoff = onoff;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvSelectPortNotify(
- Display *dpy,
- XvPortID port,
- Bool onoff
-){
- xvSelectPortNotifyReq *req;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(SelectPortNotify, req);
- req->port = port;
- req->onoff = onoff;
-
- POSTAMBLE;
-
- return Success;
-}
-
-int
-XvSetPortAttribute (dpy, port, attribute, value)
- register Display *dpy;
- XvPortID port;
- Atom attribute;
- int value;
-{
- register xvSetPortAttributeReq *req;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(SetPortAttribute, req);
- req->port = port;
- req->attribute = attribute;
- req->value = value;
-
- POSTAMBLE;
-
- return (Success);
-}
-
-int
-XvGetPortAttribute (dpy, port, attribute, p_value)
- register Display *dpy;
- XvPortID port;
- Atom attribute;
- int *p_value;
-{
- register xvGetPortAttributeReq *req;
- xvGetPortAttributeReply rep;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(GetPortAttribute, req);
- req->port = port;
- req->attribute = attribute;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadReply);
- }
-
- *p_value = rep.value;
-
- POSTAMBLE;
-
- return (Success);
-}
-
-int
-XvQueryBestSize(dpy, port, motion, vid_w, vid_h, drw_w, drw_h,
- p_actual_width, p_actual_height)
- register Display *dpy;
- XvPortID port;
- Bool motion;
- unsigned int vid_w, vid_h;
- unsigned int drw_w, drw_h;
- unsigned int *p_actual_width, *p_actual_height;
-{
- register xvQueryBestSizeReq *req;
- xvQueryBestSizeReply rep;
-
- PREAMBLE(XvBadExtension);
-
- XvGetReq(QueryBestSize, req);
- req->port = port;
- req->motion = motion;
- req->vid_w = vid_w;
- req->vid_h = vid_h;
- req->drw_w = drw_w;
- req->drw_h = drw_h;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0)
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return(XvBadReply);
- }
-
- *p_actual_width = rep.actual_width;
- *p_actual_height = rep.actual_height;
-
- POSTAMBLE;
-
- return (Success);
-}
-
-
-XvAttribute*
-XvQueryPortAttributes(Display *dpy, XvPortID port, int *num)
-{
- xvQueryPortAttributesReq *req;
- xvQueryPortAttributesReply rep;
- XvAttribute *ret = NULL;
-
- *num = 0;
-
- PREAMBLE(NULL);
-
- XvGetReq(QueryPortAttributes, req);
- req->port = port;
-
- /* READ THE REPLY */
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) {
- UnlockDisplay(dpy);
- SyncHandle();
- return ret;
- }
-
- if(rep.num_attributes) {
- int size = (rep.num_attributes * sizeof(XvAttribute)) + rep.text_size;
-
- if((ret = Xmalloc(size))) {
- char* marker = (char*)(&ret[rep.num_attributes]);
- xvAttributeInfo Info;
- int i;
-
- for(i = 0; i < rep.num_attributes; i++) {
- _XRead(dpy, (char*)(&Info), sz_xvAttributeInfo);
- ret[i].flags = (int)Info.flags;
- ret[i].name = marker;
- _XRead(dpy, marker, Info.size);
- marker += Info.size;
- (*num)++;
- }
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- POSTAMBLE;
-
- return ret;
-}
-
-static Bool
-_XvWireToEvent(Display *dpy, XvEvent *re, xvEvent *event)
-{
-
- if (event->u.u.type == _XvCodes->first_event+XvVideoNotify)
- {
- re->xvvideo.type = event->u.u.type & 0x7f;
- re->xvvideo.serial =
- _XSetLastRequestRead(dpy, (xGenericReply *)event);
- re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0);
- re->xvvideo.display = dpy;
- re->xvvideo.time = event->u.videoNotify.time;
- re->xvvideo.reason = event->u.videoNotify.reason;
- re->xvvideo.drawable = event->u.videoNotify.drawable;
- re->xvvideo.port_id = event->u.videoNotify.port;
- if (_XvOldWireToEventVideo)
- {
- (void)(* _XvOldWireToEventVideo)(dpy, re, event);
- }
- }
- else if (event->u.u.type == _XvCodes->first_event+XvPortNotify)
- {
- re->xvport.type = event->u.u.type & 0x7f;
- re->xvport.serial =
- _XSetLastRequestRead(dpy, (xGenericReply *)event);
- re->xvport.send_event = ((event->u.u.type & 0x80) != 0);
- re->xvport.display = dpy;
- re->xvport.time = event->u.portNotify.time;
- re->xvport.port_id = event->u.portNotify.port;
- re->xvport.attribute = event->u.portNotify.attribute;
- re->xvport.value = event->u.portNotify.value;
- if (_XvOldWireToEventPort)
- {
- (void)(* _XvOldWireToEventPort)(dpy, re, event);
- }
- }
- else
- {
- return (False);
- }
-
- return (True);
-}
-
-Bool
-_XvInitExtension(Display *dpy)
-{
- if (!(_XvCodes = XInitExtension (dpy, XvName)))
- {
- return False;
- }
-
- _XvOldWireToEventVideo =
- XESetWireToEvent(dpy,
- _XvCodes->first_event + XvVideoNotify,
- _XvWireToEvent);
-
- _XvOldWireToEventPort =
- XESetWireToEvent(dpy,
- _XvCodes->first_event + XvPortNotify,
- _XvWireToEvent);
-
- _XvOldErrorString = XESetErrorString(dpy, _XvCodes->extension,
- _XvErrorString);
-
- return True;
-}
-
-static char *
-_XvErrorString(
- Display *dpy,
- int code,
- XExtCodes *ecodes,
- char *buffer,
- int size
-){
-
- if (size < strlen("Encoding") + 1)
- {
- if (_XvOldErrorString)
- return (* _XvOldErrorString)(dpy, code, ecodes, buffer, size);
- }
-
- if (code - ecodes->first_error == XvBadPort)
- {
- strcpy(buffer, "Port");
- }
- else if (code - ecodes->first_error == XvBadEncoding)
- {
- strcpy(buffer, "Encoding");
- }
- else
- {
- if (_XvOldErrorString)
- return (* _XvOldErrorString)(dpy, code, ecodes, buffer, size);
- }
-
- return (char *)NULL;
-}
diff --git a/xc/lib/Xv/Xvlibint.h b/xc/lib/Xv/Xvlibint.h
deleted file mode 100644
index 3f15b731d..000000000
--- a/xc/lib/Xv/Xvlibint.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/***********************************************************
-Copyright 1987 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 XVLIBINT_H
-#define XVLIBINT_H
-/*
-** File:
-**
-** Xvlibint.h --- Xv library internal header file
-**
-** Author:
-**
-** David Carver (Digital Workstation Engineering/Project Athena)
-**
-** Revisions:
-**
-** 01.24.91 Carver
-** - version 1.4 upgrade
-**
-*/
-
-#define NEED_REPLIES
-
-#include "Xlibint.h"
-#include "Xvproto.h"
-#include "Xvlib.h"
-
-#if defined(__STDC__) && !defined(UNIXCPP)
-#define XvGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = _XvCodes->major_opcode;\
- req->xvReqType = xv_##name; \
- req->length = (SIZEOF(xv##name##Req))>>2;\
- dpy->bufptr += SIZEOF(xv##name##Req);\
- dpy->request++
-
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define XvGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = _XvCodes->major_opcode;\
- req->xvReqType = xv_/**/name;\
- req->length = (SIZEOF(xv/**/name/**/Req))>>2;\
- dpy->bufptr += SIZEOF(xv/**/name/**/Req);\
- dpy->request++
-#endif
-
-
-#if defined(__STDC__) && !defined(UNIXCPP)
-#define XvGetReqExtra(name, n, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xv##name##Req) + n) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = _XvCodes->major_opcode;\
- req->xvReqType = xv_##name;\
- req->length = (SIZEOF(xv##name##Req) + n)>>2;\
- dpy->bufptr += SIZEOF(xv##name##Req) + n;\
- dpy->request++
-#else
-#define XvGetReqExtra(name, n, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xv/**/name/**/Req) + n) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xv/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = _XvCodes->major_opcode;\
- req->xvReqType = xv_/**/name;\
- req->length = (SIZEOF(xv/**/name/**/Req) + n)>>2;\
- dpy->bufptr += SIZEOF(xv/**/name/**/Req) + n;\
- dpy->request++
-#endif
-
-
-#endif /* XVLIBINT_H */
diff --git a/xc/lib/XvMC/Imakefile b/xc/lib/XvMC/Imakefile
deleted file mode 100644
index 3a3c55df1..000000000
--- a/xc/lib/XvMC/Imakefile
+++ /dev/null
@@ -1,29 +0,0 @@
-XCOMM $XFree86: xc/lib/XvMC/Imakefile,v 1.2 2001/04/01 14:00:02 tsi Exp $
-
-#define DoNormalLib NormalLibXvMC
-#define DoSharedLib SharedLibXvMC
-#define DoDebugLib DebugLibXvMC
-#define DoProfileLib ProfileLibXvMC
-#define LibName XvMC
-#define SoRev SOXVMCREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXvMCReqs
-REQUIREDLIBS = SharedXvMCReqs
-#endif
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = XvMC.c
- OBJS = XvMC.o
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/XvMC/XvMC.c b/xc/lib/XvMC/XvMC.c
deleted file mode 100644
index 911b81bf7..000000000
--- a/xc/lib/XvMC/XvMC.c
+++ /dev/null
@@ -1,468 +0,0 @@
-/* $XFree86: xc/lib/XvMC/XvMC.c,v 1.3 2001/04/01 14:00:02 tsi Exp $ */
-
-#define NEED_REPLIES
-
-#include <stdio.h>
-#include "XvMClibint.h"
-#include "Xext.h"
-#include "extutil.h"
-
-static XExtensionInfo _xvmc_info_data;
-static XExtensionInfo *xvmc_info = &_xvmc_info_data;
-static char *xvmc_extension_name = XvMCName;
-
-static char *xvmc_error_list[] =
-{
- "BadContext",
- "BadSurface",
- "BadSubpicture"
-};
-
-static XEXT_GENERATE_CLOSE_DISPLAY (xvmc_close_display, xvmc_info)
-
-
-static XEXT_GENERATE_ERROR_STRING (xvmc_error_string, xvmc_extension_name,
- XvMCNumErrors, xvmc_error_list)
-
-
-static XExtensionHooks xvmc_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- xvmc_close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- xvmc_error_string /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (xvmc_find_display, xvmc_info,
- xvmc_extension_name,
- &xvmc_extension_hooks,
- XvMCNumEvents, NULL)
-
-Bool XvMCQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Status XvMCQueryVersion (Display *dpy, int *major, int *minor)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcQueryVersionReply rep;
- xvmcQueryVersionReq *req;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (QueryVersion, req);
- if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return BadImplementation;
- }
- *major = rep.major;
- *minor = rep.minor;
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
-
-XvMCSurfaceInfo * XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcListSurfaceTypesReply rep;
- xvmcListSurfaceTypesReq *req;
- XvMCSurfaceInfo *surface_info = NULL;
-
- *num = 0;
-
- XvMCCheckExtension (dpy, info, NULL);
-
- LockDisplay (dpy);
- XvMCGetReq (ListSurfaceTypes, req);
- req->port = port;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- if(rep.num > 0) {
- surface_info =
- (XvMCSurfaceInfo*)Xmalloc(rep.num * sizeof(XvMCSurfaceInfo));
-
- if(surface_info) {
- xvmcSurfaceInfo sinfo;
- int i;
-
- *num = rep.num;
-
- for(i = 0; i < rep.num; i++) {
- _XRead(dpy, (char*)&sinfo, sizeof(xvmcSurfaceInfo));
- surface_info[i].surface_type_id = sinfo.surface_type_id;
- surface_info[i].chroma_format = sinfo.chroma_format;
- surface_info[i].color_description = sinfo.color_description;
- surface_info[i].max_width = sinfo.max_width;
- surface_info[i].max_height = sinfo.max_height;
- surface_info[i].subpicture_max_width =
- sinfo.subpicture_max_width;
- surface_info[i].subpicture_max_height =
- sinfo.subpicture_max_height;
- surface_info[i].mc_type = sinfo.mc_type;
- surface_info[i].flags = sinfo.flags;
- }
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return surface_info;
-}
-
-
-XvImageFormatValues * XvMCListSubpictureTypes (
- Display * dpy,
- XvPortID port,
- int surface_type_id,
- int *count_return
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcListSubpictureTypesReply rep;
- xvmcListSubpictureTypesReq *req;
- XvImageFormatValues *ret = NULL;
-
-
- *count_return = 0;
-
- XvMCCheckExtension (dpy, info, NULL);
-
-
- LockDisplay (dpy);
- XvMCGetReq (ListSubpictureTypes, req);
- req->port = port;
- req->surface_type_id = surface_type_id;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return NULL;
- }
-
- if(rep.num > 0) {
- ret =
- (XvImageFormatValues*)Xmalloc(rep.num * sizeof(XvImageFormatValues));
-
- if(ret) {
- xvImageFormatInfo Info;
- int i;
-
- *count_return = rep.num;
-
- for(i = 0; i < rep.num; i++) {
- _XRead(dpy, (char*)(&Info), sz_xvImageFormatInfo);
- ret[i].id = Info.id;
- ret[i].type = Info.type;
- ret[i].byte_order = Info.byte_order;
- memcpy(&(ret[i].guid[0]), &(Info.guid[0]), 16);
- ret[i].bits_per_pixel = Info.bpp;
- ret[i].format = Info.format;
- ret[i].num_planes = Info.num_planes;
- ret[i].depth = Info.depth;
- ret[i].red_mask = Info.red_mask;
- ret[i].green_mask = Info.green_mask;
- ret[i].blue_mask = Info.blue_mask;
- ret[i].y_sample_bits = Info.y_sample_bits;
- ret[i].u_sample_bits = Info.u_sample_bits;
- ret[i].v_sample_bits = Info.v_sample_bits;
- ret[i].horz_y_period = Info.horz_y_period;
- ret[i].horz_u_period = Info.horz_u_period;
- ret[i].horz_v_period = Info.horz_v_period;
- ret[i].vert_y_period = Info.vert_y_period;
- ret[i].vert_u_period = Info.vert_u_period;
- ret[i].vert_v_period = Info.vert_v_period;
- memcpy(&(ret[i].component_order[0]), &(Info.comp_order[0]), 32);
- ret[i].scanline_order = Info.scanline_order;
- }
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return ret;
-}
-
-
-/******************************************************************
- These are intended as a protocol interface to be used by direct
- rendering libraries. They are not intended to be client viewable
- functions. These will stay in place until we have a mechanism in
- place similar to that of OpenGL with an libXvMCcore library.
-*******************************************************************/
-
-/*
- _xvmc_create_context -
-
- Pass in the context with the surface_type_id, width, height,
- port and flags filled out. This function will fill out the
- context_id and update the width, height and flags field.
- The server may return implementation-specific information
- back in the priv_data. The size of that information will
- an array of priv_count CARD32s. This data is allocated by
- this function. If returned, the caller is responsible for
- freeing it! Generally, such information is only returned if
- an XVMC_DIRECT context was specified.
-*/
-
-
-Status _xvmc_create_context (
- Display *dpy,
- XvMCContext *context,
- int *priv_count,
- CARD32 **priv_data
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcCreateContextReply rep;
- xvmcCreateContextReq *req;
-
- *priv_count = 0;
- *priv_data = NULL;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (CreateContext, req);
- context->context_id = XAllocID(dpy);
- req->context_id = context->context_id;
- req->port = context->port;
- req->surface_type_id = context->surface_type_id;
- req->width = context->width;
- req->height = context->height;
- req->flags = context->flags;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return BadImplementation;
- }
- context->width = rep.width_actual;
- context->height = rep.height_actual;
- context->flags = rep.flags_return;
-
- if(rep.length) {
- *priv_data = Xmalloc(rep.length << 2);
- if(*priv_data) {
- _XRead(dpy, (char*)(*priv_data), rep.length << 2);
- *priv_count = rep.length;
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
-Status _xvmc_destroy_context (
- Display *dpy,
- XvMCContext *context
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcDestroyContextReq *req;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (DestroyContext, req);
- req->context_id = context->context_id;
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
-
-/*
- _xvmc_create_surface -
-
- Pass the context and this function will fill out all the
- information in the surface.
- The server may return implementation-specific information
- back in the priv_data. The size of that information will
- an array of priv_count CARD32s. This data is allocated by
- this function. If returned, the caller is responsible for
- freeing it! Generally, such information is returned only if
- the context was a direct context.
-
-*/
-
-Status _xvmc_create_surface (
- Display *dpy,
- XvMCContext *context,
- XvMCSurface *surface,
- int *priv_count,
- CARD32 **priv_data
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcCreateSurfaceReply rep;
- xvmcCreateSurfaceReq *req;
-
- *priv_count = 0;
- *priv_data = NULL;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (CreateSurface, req);
-
- surface->surface_id = XAllocID(dpy);
- surface->context_id = context->context_id;
- surface->surface_type_id = context->surface_type_id;
- surface->width = context->width;
- surface->height = context->height;
-
- req->surface_id = surface->surface_id;
- req->context_id = surface->context_id;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return BadImplementation;
- }
-
- if(rep.length) {
- *priv_data = Xmalloc(rep.length << 2);
- if(*priv_data) {
- _XRead(dpy, (char*)(*priv_data), rep.length << 2);
- *priv_count = rep.length;
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
-Status _xvmc_destroy_surface (
- Display *dpy,
- XvMCSurface *surface
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcDestroySurfaceReq *req;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (DestroySurface, req);
- req->surface_id = surface->surface_id;
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
-/*
- _xvmc_create_subpicture -
-
- Pass the subpicture with the width, height and xvimage_id filled
- out and this function will fill out everything else in the
- subpicture as well as adjust the width and height if needed.
- The server may return implementation-specific information
- back in the priv_data. The size of that information will
- an array of priv_count CARD32s. This data is allocated by
- this function. If returned, the caller is responsible for
- freeing it! Generally, such information is returned only if
- the context was a direct context.
-
-*/
-
-Status _xvmc_create_subpicture (
- Display *dpy,
- XvMCContext *context,
- XvMCSubpicture *subpicture,
- int *priv_count,
- CARD32 **priv_data
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcCreateSubpictureReply rep;
- xvmcCreateSubpictureReq *req;
-
- *priv_count = 0;
- *priv_data = NULL;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (CreateSubpicture, req);
-
- subpicture->subpicture_id = XAllocID(dpy);
- subpicture->context_id = context->context_id;
-
- req->subpicture_id = subpicture->subpicture_id;
- req->context_id = subpicture->context_id;
- req->xvimage_id = subpicture->xvimage_id;
- req->width = subpicture->width;
- req->height = subpicture->height;
- if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
- UnlockDisplay (dpy);
- SyncHandle ();
- return BadImplementation;
- }
-
- subpicture->width = rep.width_actual;
- subpicture->height = rep.height_actual;
- subpicture->num_palette_entries = rep.num_palette_entries;
- subpicture->entry_bytes = rep.entry_bytes;
- subpicture->component_order[0] = rep.component_order[0];
- subpicture->component_order[1] = rep.component_order[1];
- subpicture->component_order[2] = rep.component_order[2];
- subpicture->component_order[3] = rep.component_order[3];
-
- if(rep.length) {
- *priv_data = Xmalloc(rep.length << 2);
- if(*priv_data) {
- _XRead(dpy, (char*)(*priv_data), rep.length << 2);
- *priv_count = rep.length;
- } else
- _XEatData(dpy, rep.length << 2);
- }
-
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
-Status _xvmc_destroy_subpicture(
- Display *dpy,
- XvMCSubpicture *subpicture
-)
-{
- XExtDisplayInfo *info = xvmc_find_display(dpy);
- xvmcDestroySubpictureReq *req;
-
- XvMCCheckExtension (dpy, info, BadImplementation);
-
- LockDisplay (dpy);
- XvMCGetReq (DestroySubpicture, req);
- req->subpicture_id = subpicture->subpicture_id;
- UnlockDisplay (dpy);
- SyncHandle ();
- return Success;
-}
-
diff --git a/xc/lib/XvMC/XvMClibint.h b/xc/lib/XvMC/XvMClibint.h
deleted file mode 100644
index e3bd9891d..000000000
--- a/xc/lib/XvMC/XvMClibint.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $XFree86: xc/lib/XvMC/XvMClibint.h,v 1.3 2001/04/01 14:00:02 tsi Exp $ */
-
-#ifndef _XVMCLIBINT_H
-#define _XVMCLIBINT_H
-#define NEED_REPLIES
-
-#include "Xlibint.h"
-#include "Xvproto.h"
-#include "XvMCproto.h"
-#include "XvMClib.h"
-
-#define XvMCCheckExtension(dpy, i, val) \
- XextCheckExtension(dpy, i, xvmc_extension_name, val)
-
-
-#if defined(__STDC__) && !defined(UNIXCPP)
-#define XvMCGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + sizeof(xvmc##name##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xvmc##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = info->codes->major_opcode;\
- req->xvmcReqType = xvmc_##name; \
- req->length = sizeof(xvmc##name##Req)>>2;\
- dpy->bufptr += sizeof(xvmc##name##Req);\
- dpy->request++
-#else
-#define XvMCGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + sizeof(xvmc/**/name/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xvmc/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = info->codes->major_opcode;\
- req->xvmcReqType = xvmc_/**/name;\
- req->length = sizeof(xvmc/**/name/**/Req)>>2;\
- dpy->bufptr += sizeof(xvmc/**/name/**/Req);\
- dpy->request++
-#endif
-
-#endif /* XVMCLIBINT_H */
diff --git a/xc/lib/Xxf86dga/Imakefile b/xc/lib/Xxf86dga/Imakefile
deleted file mode 100644
index e3eb0ff99..000000000
--- a/xc/lib/Xxf86dga/Imakefile
+++ /dev/null
@@ -1,32 +0,0 @@
-XCOMM $XFree86: xc/lib/Xxf86dga/Imakefile,v 3.2 1999/03/28 15:31:35 dawes Exp $
-#define DoNormalLib NormalLibXxf86dga
-#define DoSharedLib SharedLibXxf86dga
-#define DoExtraLib SharedLibXxf86dga
-#define DoDebugLib DebugLibXxf86dga
-#define DoProfileLib ProfileLibXxf86dga
-#define LibName Xxf86dga
-#define SoRev SOXXF86DGAREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86dgaReqs
-REQUIREDLIBS = SharedXxf86dgaReqs
-#endif
-
-XF86DGASRCS = XF86DGA.c XF86DGA2.c
-XF86DGAOBJS = XF86DGA.o XF86DGA2.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = $(XF86DGASRCS)
- OBJS = $(XF86DGAOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xxf86dga/XF86DGA.c b/xc/lib/Xxf86dga/XF86DGA.c
deleted file mode 100644
index 017de6eb4..000000000
--- a/xc/lib/Xxf86dga/XF86DGA.c
+++ /dev/null
@@ -1,715 +0,0 @@
-/* $XFree86: xc/lib/Xxf86dga/XF86DGA.c,v 3.16 1999/05/03 12:15:53 dawes Exp $ */
-/*
-
-Copyright (c) 1995 Jon Tombs
-Copyright (c) 1995,1996 The XFree86 Project, Inc
-
-*/
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef __EMX__ /* needed here to override certain constants in X headers */
-#define INCL_DOS
-#define INCL_DOSIOCTL
-#include <os2.h>
-#endif
-
-#if defined(linux)
-#define HAS_MMAP_ANON
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <asm/page.h> /* PAGE_SIZE */
-#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */
-#define HAS_GETPAGESIZE
-#endif /* linux */
-
-#if defined(CSRG_BASED)
-#define HAS_MMAP_ANON
-#define HAS_GETPAGESIZE
-#include <sys/types.h>
-#include <sys/mman.h>
-#endif /* CSRG_BASED */
-
-#if defined(DGUX)
-#define HAS_GETPAGESIZE
-#define MMAP_DEV_ZERO
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#endif /* DGUX */
-
-#if defined(SVR4) && !defined(DGUX)
-#define MMAP_DEV_ZERO
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#endif /* SVR4 && !DGUX */
-
-#if defined(sun) && !defined(SVR4) /* SunOS */
-#define MMAP_DEV_ZERO /* doesn't SunOS have MAP_ANON ?? */
-#define HAS_GETPAGESIZE
-#include <sys/types.h>
-#include <sys/mman.h>
-#endif /* sun && !SVR4 */
-
-#ifdef XNO_SYSCONF
-#undef _SC_PAGESIZE
-#endif
-
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include "Xlibint.h"
-#include "xf86dga.h"
-#include "xf86dgastr.h"
-#include "Xext.h"
-#include "extutil.h"
-
-extern XExtDisplayInfo* xdga_find_display(Display*);
-extern char *xdga_extension_name;
-
-#define XF86DGACheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xdga_extension_name, val)
-
-/*****************************************************************************
- * *
- * public XFree86-DGA Extension routines *
- * *
- *****************************************************************************/
-
-Bool XF86DGAQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep
-){
- return XDGAQueryExtension(dpy, event_basep, error_basep);
-}
-
-Bool XF86DGAQueryVersion(
- Display* dpy,
- int* majorVersion,
- int* minorVersion
-){
- return XDGAQueryVersion(dpy, majorVersion, minorVersion);
-}
-
-Bool XF86DGAGetVideoLL(
- Display* dpy,
- int screen,
- int *offset,
- int *width,
- int *bank_size,
- int *ram_size
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAGetVideoLLReply rep;
- xXF86DGAGetVideoLLReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAGetVideoLL, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAGetVideoLL;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *offset = /*(char *)*/rep.offset;
- *width = rep.width;
- *bank_size = rep.bank_size;
- *ram_size = rep.ram_size;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool XF86DGADirectVideoLL(
- Display* dpy,
- int screen,
- int enable
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGADirectVideoReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGADirectVideo, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGADirectVideo;
- req->screen = screen;
- req->enable = enable;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-Bool XF86DGAGetViewPortSize(
- Display* dpy,
- int screen,
- int *width,
- int *height
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAGetViewPortSizeReply rep;
- xXF86DGAGetViewPortSizeReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAGetViewPortSize, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAGetViewPortSize;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *width = rep.width;
- *height = rep.height;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool XF86DGASetViewPort(
- Display* dpy,
- int screen,
- int x,
- int y
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGASetViewPortReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGASetViewPort, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGASetViewPort;
- req->screen = screen;
- req->x = x;
- req->y = y;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-
-Bool XF86DGAGetVidPage(
- Display* dpy,
- int screen,
- int *vpage
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAGetVidPageReply rep;
- xXF86DGAGetVidPageReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAGetVidPage, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAGetVidPage;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *vpage = rep.vpage;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-
-Bool XF86DGASetVidPage(
- Display* dpy,
- int screen,
- int vpage
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGASetVidPageReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGASetVidPage, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGASetVidPage;
- req->screen = screen;
- req->vpage = vpage;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-Bool XF86DGAInstallColormap(
- Display* dpy,
- int screen,
- Colormap cmap
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAInstallColormapReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAInstallColormap, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAInstallColormap;
- req->screen = screen;
- req->id = cmap;
- UnlockDisplay(dpy);
- SyncHandle();
- XSync(dpy,False);
- return True;
-}
-
-Bool XF86DGAQueryDirectVideo(
- Display *dpy,
- int screen,
- int *flags
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAQueryDirectVideoReply rep;
- xXF86DGAQueryDirectVideoReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAQueryDirectVideo, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAQueryDirectVideo;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *flags = rep.flags;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86DGAViewPortChanged(
- Display *dpy,
- int screen,
- int n
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXF86DGAViewPortChangedReply rep;
- xXF86DGAViewPortChangedReq *req;
-
- XF86DGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86DGAViewPortChanged, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XF86DGAViewPortChanged;
- req->screen = screen;
- req->n = n;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.result;
-}
-
-
-
-/* Helper functions */
-
-#include <X11/Xmd.h>
-#include <X11/extensions/xf86dga.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#if defined(ISC)
-# define HAS_SVR3_MMAP
-# include <sys/types.h>
-# include <errno.h>
-
-# include <sys/at_ansi.h>
-# include <sys/kd.h>
-
-# include <sys/sysmacros.h>
-# include <sys/immu.h>
-# include <sys/region.h>
-
-# include <sys/mmap.h>
-#else
-# if !defined(Lynx)
-# if !defined(__EMX__)
-# include <sys/mman.h>
-# endif
-# else
-# include <sys/types.h>
-# include <errno.h>
-# include <smem.h>
-# endif
-#endif
-#include <sys/wait.h>
-#include <signal.h>
-#include <unistd.h>
-extern int errno;
-
-#if defined(SVR4) && !defined(sun) && !defined(SCO325)
-#define DEV_MEM "/dev/pmem"
-#else
-#define DEV_MEM "/dev/mem"
-#endif
-
-typedef struct {
- unsigned long physaddr; /* actual requested physical address */
- unsigned long size; /* actual requested map size */
- unsigned long delta; /* delta to account for page alignment */
- void * vaddr; /* mapped address, without the delta */
- int refcount; /* reference count */
-} MapRec, *MapPtr;
-
-typedef struct {
- Display * display;
- int screen;
- MapPtr map;
-} ScrRec, *ScrPtr;
-
-static int mapFd = -1;
-static int numMaps = 0;
-static int numScrs = 0;
-static MapPtr *mapList = NULL;
-static ScrPtr *scrList = NULL;
-
-static MapPtr
-AddMap(void)
-{
- MapPtr *old;
-
- old = mapList;
- mapList = realloc(mapList, sizeof(MapPtr) * (numMaps + 1));
- if (!mapList) {
- mapList = old;
- return NULL;
- }
- mapList[numMaps] = malloc(sizeof(MapRec));
- if (!mapList[numMaps])
- return NULL;
- return mapList[numMaps++];
-}
-
-static ScrPtr
-AddScr(void)
-{
- ScrPtr *old;
-
- old = scrList;
- scrList = realloc(scrList, sizeof(ScrPtr) * (numScrs + 1));
- if (!scrList) {
- scrList = old;
- return NULL;
- }
- scrList[numScrs] = malloc(sizeof(ScrRec));
- if (!scrList[numScrs])
- return NULL;
- return scrList[numScrs++];
-}
-
-static MapPtr
-FindMap(unsigned long address, unsigned long size)
-{
- int i;
-
- for (i = 0; i < numMaps; i++) {
- if (mapList[i]->physaddr == address &&
- mapList[i]->size == size)
- return mapList[i];
- }
- return NULL;
-}
-
-static ScrPtr
-FindScr(Display *display, int screen)
-{
- int i;
-
- for (i = 0; i < numScrs; i++) {
- if (scrList[i]->display == display &&
- scrList[i]->screen == screen)
- return scrList[i];
- }
- return NULL;
-}
-
-static void *
-MapPhysAddress(unsigned long address, unsigned long size)
-{
- unsigned long offset, delta;
- int pagesize = -1;
- void *vaddr;
- MapPtr mp;
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- struct kd_memloc mloc;
-#elif defined(__EMX__)
- APIRET rc;
- ULONG action;
- HFILE hfd;
-#endif
-
- if ((mp = FindMap(address, size))) {
- mp->refcount++;
- return (void *)((unsigned long)mp->vaddr + mp->delta);
- }
-
-#if defined(_SC_PAGESIZE) && defined(HAS_SC_PAGESIZE)
- pagesize = sysconf(_SC_PAGESIZE);
-#endif
-#ifdef _SC_PAGE_SIZE
- if (pagesize == -1)
- pagesize = sysconf(_SC_PAGE_SIZE);
-#endif
-#ifdef HAS_GETPAGESIZE
- if (pagesize == -1)
- pagesize = getpagesize();
-#endif
-#ifdef PAGE_SIZE
- if (pagesize == -1)
- pagesize = PAGE_SIZE;
-#endif
- if (pagesize == -1)
- pagesize = 4096;
-
- delta = address % pagesize;
- offset = address - delta;
-
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- if (mapFd < 0) {
- if ((mapFd = open("/dev/mmap", O_RDWR)) < 0)
- return NULL;
- }
- mloc.vaddr = (char *)0;
- mloc.physaddr = (char *)offset;
- mloc.length = size + delta;
- mloc.ioflg=1;
-
- if ((vaddr = (void *)ioctl(mapFd, MAP, &mloc)) == (void *)-1)
- return NULL;
-#elif defined (__EMX__)
- /*
- * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
- * Consecutive calling of this routine will make PMAP$ driver run out
- * of memory handles. Some umap/close mechanism should be provided
- */
-
- rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
- OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
- if (rc != 0)
- return NULL;
- {
- struct map_ioctl {
- union {
- ULONG phys;
- void* user;
- } a;
- ULONG size;
- } pmap,dmap;
- ULONG plen,dlen;
-#define XFREE86_PMAP 0x76
-#define PMAP_MAP 0x44
-
- pmap.a.phys = offset;
- pmap.size = size + delta;
- rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
- (PULONG)&pmap, sizeof(pmap), &plen,
- (PULONG)&dmap, sizeof(dmap), &dlen);
- if (rc == 0) {
- vaddr = dmap.a.user;
- }
- }
- if (rc != 0)
- return NULL;
-#elif defined (Lynx)
- vaddr = (void *)smem_create("XF86DGA", (char *)offset,
- size + delta, SM_READ|SM_WRITE);
-#else
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
- if (mapFd < 0) {
- if ((mapFd = open(DEV_MEM, O_RDWR)) < 0)
- return NULL;
- }
- vaddr = (void *)mmap(NULL, size + delta, PROT_READ | PROT_WRITE,
- MAP_FILE | MAP_SHARED, mapFd, (off_t)offset);
- if (vaddr == (void *)-1)
- return NULL;
-#endif
-
- if (!vaddr) {
- if (!(mp = AddMap()))
- return NULL;
- mp->physaddr = address;
- mp->size = size;
- mp->delta = delta;
- mp->vaddr = vaddr;
- mp->refcount = 1;
- }
- return (void *)((unsigned long)vaddr + delta);
-}
-
-/*
- * Still need to find a clean way of detecting the death of a DGA app
- * and returning things to normal - Jon
- * This is here to help debugging without rebooting... Also C-A-BS
- * should restore text mode.
- */
-
-int
-XF86DGAForkApp(int screen)
-{
- pid_t pid;
- int status;
- int i;
-
- /* fork the app, parent hangs around to clean up */
- if ((pid = fork()) > 0) {
- ScrPtr sp;
-
- waitpid(pid, &status, 0);
- for (i = 0; i < numScrs; i++) {
- sp = scrList[i];
- XF86DGADirectVideoLL(sp->display, sp->screen, 0);
- XSync(sp->display, False);
- }
- if (WIFEXITED(status))
- _exit(0);
- else
- _exit(-1);
- }
- return pid;
-}
-
-
-Bool
-XF86DGADirectVideo(
- Display *dis,
- int screen,
- int enable
-){
- ScrPtr sp;
- MapPtr mp = NULL;
-
- if ((sp = FindScr(dis, screen)))
- mp = sp->map;
-
- if (enable & XF86DGADirectGraphics) {
-#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
- && !defined(__EMX__)
- if (mp && mp->vaddr)
- mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
-#endif
- } else {
-#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
- && !defined(__EMX__)
- if (mp && mp->vaddr)
- mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
-#elif defined(Lynx)
- /* XXX this doesn't allow enable after disable */
- smem_create(NULL, mp->vaddr, mp->size + mp->delta, SM_DETACH);
- smem_remove("XF86DGA");
-#endif
- }
-
- XF86DGADirectVideoLL(dis, screen, enable);
- return 1;
-}
-
-
-static void
-XF86cleanup(int sig)
-{
- ScrPtr sp;
- int i;
- static beenhere = 0;
-
- if (beenhere)
- _exit(3);
- beenhere = 1;
-
- for (i = 0; i < numScrs; i++) {
- sp = scrList[i];
- XF86DGADirectVideo(sp->display, sp->screen, 0);
- XSync(sp->display, False);
- }
- _exit(3);
-}
-
-Bool
-XF86DGAGetVideo(
- Display *dis,
- int screen,
- char **addr,
- int *width,
- int *bank,
- int *ram
-){
- /*unsigned long*/ int offset;
- static int beenHere = 0;
- ScrPtr sp;
- MapPtr mp;
-
- if (!(sp = FindScr(dis, screen))) {
- if (!(sp = AddScr())) {
- fprintf(stderr, "XF86DGAGetVideo: malloc failure\n");
- exit(-2);
- }
- sp->display = dis;
- sp->screen = screen;
- sp->map = NULL;
- }
-
- XF86DGAGetVideoLL(dis, screen , &offset, width, bank, ram);
-
- *addr = MapPhysAddress(offset, *bank);
- if (*addr == NULL) {
- fprintf(stderr, "XF86DGAGetVideo: failed to map video memory (%s)\n",
- strerror(errno));
- exit(-2);
- }
-
- if ((mp = FindMap(offset, *bank)))
- sp->map = mp;
-
- if (!beenHere) {
- beenHere = 1;
- atexit((void(*)(void))XF86cleanup);
- /* one shot XF86cleanup attempts */
- signal(SIGSEGV, XF86cleanup);
-#ifdef SIGBUS
- signal(SIGBUS, XF86cleanup);
-#endif
- signal(SIGHUP, XF86cleanup);
- signal(SIGFPE, XF86cleanup);
- }
-
- return 1;
-}
-
diff --git a/xc/lib/Xxf86dga/XF86DGA2.c b/xc/lib/Xxf86dga/XF86DGA2.c
deleted file mode 100644
index 54730d3f0..000000000
--- a/xc/lib/Xxf86dga/XF86DGA2.c
+++ /dev/null
@@ -1,941 +0,0 @@
-/* $XFree86: xc/lib/Xxf86dga/XF86DGA2.c,v 1.12 1999/08/22 05:57:23 dawes Exp $ */
-/*
-
-Copyright (c) 1995 Jon Tombs
-Copyright (c) 1995,1996 The XFree86 Project, Inc
-
-*/
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#ifdef __EMX__ /* needed here to override certain constants in X headers */
-#define INCL_DOS
-#define INCL_DOSIOCTL
-#include <os2.h>
-#endif
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include "Xlibint.h"
-#include "xf86dga.h"
-#include "xf86dgastr.h"
-#include "Xext.h"
-#include "extutil.h"
-#include <stdio.h>
-
-
-/* If you change this, change the Bases[] array below as well */
-#define MAX_HEADS 16
-
-char *xdga_extension_name = XF86DGANAME;
-
-static XExtensionInfo _xdga_info_data;
-static XExtensionInfo *xdga_info = &_xdga_info_data;
-
-
-Bool XDGAMapFramebuffer(int, char *, unsigned char*, CARD32, CARD32, CARD32);
-void XDGAUnmapFramebuffer(int);
-unsigned char* XDGAGetMappedMemory(int);
-
-#define XDGACheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xdga_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int xdga_close_display();
-static Bool xdga_wire_to_event();
-static Status xdga_event_to_wire();
-
-static XExtensionHooks xdga_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- xdga_close_display, /* close_display */
- xdga_wire_to_event, /* wire_to_event */
- xdga_event_to_wire, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_CLOSE_DISPLAY (xdga_close_display, xdga_info)
-
-
-XEXT_GENERATE_FIND_DISPLAY (xdga_find_display, xdga_info,
- "XFree86-DGA",
- &xdga_extension_hooks,
- XF86DGANumberEvents, NULL)
-
-
-static Status
-xdga_event_to_wire(
- Display *dpy,
- XEvent *event,
- dgaEvent *wire
-){
- return True;
-}
-
-static Bool
-xdga_wire_to_event(
- Display *dpy,
- XEvent *event,
- dgaEvent *wire
-){
- XDGAButtonEvent *bevent;
- XDGAKeyEvent *kevent;
- XDGAMotionEvent *mevent;
- XExtDisplayInfo *info = xdga_find_display (dpy);
-
- XDGACheckExtension (dpy, info, False);
-
- switch((wire->u.u.type & 0x7f) - info->codes->first_event) {
- case MotionNotify:
- mevent = (XDGAMotionEvent*)event;
- mevent->type = wire->u.u.type & 0x7F;
- mevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
- mevent->display = dpy;
- mevent->screen = wire->u.event.screen;
- mevent->time = wire->u.event.time;
- mevent->state = wire->u.event.state;
- mevent->dx = wire->u.event.dx;
- mevent->dy = wire->u.event.dy;
- return True;
- case ButtonPress:
- case ButtonRelease:
- bevent = (XDGAButtonEvent*)event;
- bevent->type = wire->u.u.type & 0x7F;
- bevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
- bevent->display = dpy;
- bevent->screen = wire->u.event.screen;
- bevent->time = wire->u.event.time;
- bevent->state = wire->u.event.state;
- bevent->button = wire->u.u.detail;
- return True;
- case KeyPress:
- case KeyRelease:
- kevent = (XDGAKeyEvent*)event;
- kevent->type = wire->u.u.type & 0x7F;
- kevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *)wire);
- kevent->display = dpy;
- kevent->screen = wire->u.event.screen;
- kevent->time = wire->u.event.time;
- kevent->state = wire->u.event.state;
- kevent->keycode = wire->u.u.detail;
- return True;
- }
-
- return False;
-}
-
-
-Bool XDGAQueryExtension (
- Display *dpy,
- int *event_basep,
- int *error_basep
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-
-Bool XDGAQueryVersion(
- Display *dpy,
- int *majorVersion,
- int *minorVersion
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAQueryVersionReply rep;
- xXDGAQueryVersionReq *req;
-
- XDGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XDGAQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- if (*majorVersion >= 2)
- XDGASetClientVersion(dpy);
- return True;
-}
-
-Bool XDGASetClientVersion(
- Display *dpy
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASetClientVersionReq *req;
-
- XDGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XDGASetClientVersion, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASetClientVersion;
- req->major = XDGA_MAJOR_VERSION;
- req->minor = XDGA_MINOR_VERSION;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XDGAOpenFramebuffer(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAOpenFramebufferReply rep;
- xXDGAOpenFramebufferReq *req;
- char *deviceName = NULL;
- Bool ret;
-
- XDGACheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XDGAOpenFramebuffer, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAOpenFramebuffer;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- if(rep.length) {
- deviceName = Xmalloc(rep.length << 2);
- _XRead(dpy, deviceName, rep.length << 2);
- }
-
- ret = XDGAMapFramebuffer(screen, deviceName, (unsigned char*)rep.mem1,
- rep.size, rep.offset, rep.extra);
-
- if(deviceName)
- Xfree(deviceName);
-
- UnlockDisplay(dpy);
- SyncHandle();
- return ret;
-}
-
-void XDGACloseFramebuffer(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACloseFramebufferReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- XDGAUnmapFramebuffer(screen);
-
- LockDisplay(dpy);
- GetReq(XDGACloseFramebuffer, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACloseFramebuffer;
- req->screen = screen;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-
-XDGAMode* XDGAQueryModes(
- Display *dpy,
- int screen,
- int *num
-){
- XExtDisplayInfo *dinfo = xdga_find_display (dpy);
- xXDGAQueryModesReply rep;
- xXDGAQueryModesReq *req;
- XDGAMode *modes = NULL;
-
- *num = 0;
-
- XDGACheckExtension (dpy, dinfo, NULL);
-
- LockDisplay(dpy);
- GetReq(XDGAQueryModes, req);
- req->reqType = dinfo->codes->major_opcode;
- req->dgaReqType = X_XDGAQueryModes;
- req->screen = screen;
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- if(rep.length) {
- xXDGAModeInfo info;
- int i, size;
- char *offset;
-
- size = rep.length << 2;
- size -= rep.number * sz_xXDGAModeInfo; /* find text size */
- modes = (XDGAMode*)Xmalloc((rep.number * sizeof(XDGAMode)) + size);
- offset = (char*)(&modes[rep.number]); /* start of text */
-
-
- if(modes) {
- for(i = 0; i < rep.number; i++) {
- _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
-
- modes[i].num = info.num;
- modes[i].verticalRefresh =
- (float)info.vsync_num / (float)info.vsync_den;
- modes[i].flags = info.flags;
- modes[i].imageWidth = info.image_width;
- modes[i].imageHeight = info.image_height;
- modes[i].pixmapWidth = info.pixmap_width;
- modes[i].pixmapHeight = info.pixmap_height;
- modes[i].bytesPerScanline = info.bytes_per_scanline;
- modes[i].byteOrder = info.byte_order;
- modes[i].depth = info.depth;
- modes[i].bitsPerPixel = info.bpp;
- modes[i].redMask = info.red_mask;
- modes[i].greenMask = info.green_mask;
- modes[i].blueMask = info.blue_mask;
- modes[i].visualClass = info.visual_class;
- modes[i].viewportWidth = info.viewport_width;
- modes[i].viewportHeight = info.viewport_height;
- modes[i].xViewportStep = info.viewport_xstep;
- modes[i].yViewportStep = info.viewport_ystep;
- modes[i].maxViewportX = info.viewport_xmax;
- modes[i].maxViewportY = info.viewport_ymax;
- modes[i].viewportFlags = info.viewport_flags;
- modes[i].reserved1 = info.reserved1;
- modes[i].reserved2 = info.reserved2;
-
- _XRead(dpy, offset, info.name_size);
- modes[i].name = offset;
- offset += info.name_size;
- }
- *num = rep.number;
- } else
- _XEatData(dpy, rep.length << 2);
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return modes;
-}
-
-
-XDGADevice *
-XDGASetMode(
- Display *dpy,
- int screen,
- int mode
-){
- XExtDisplayInfo *dinfo = xdga_find_display (dpy);
- xXDGASetModeReply rep;
- xXDGASetModeReq *req;
- XDGADevice *dev = NULL;
- Pixmap pid;
-
- XDGACheckExtension (dpy, dinfo, NULL);
-
- LockDisplay(dpy);
- GetReq(XDGASetMode, req);
- req->reqType = dinfo->codes->major_opcode;
- req->dgaReqType = X_XDGASetMode;
- req->screen = screen;
- req->mode = mode;
- req->pid = pid = XAllocID(dpy);
-
- if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- if(rep.length) {
- xXDGAModeInfo info;
- int size;
-
- size = rep.length << 2;
- size -= sz_xXDGAModeInfo; /* get text size */
-
- dev = (XDGADevice*)Xmalloc(sizeof(XDGADevice) + size);
-
- if(dev) {
- _XRead(dpy, (char*)(&info), sz_xXDGAModeInfo);
-
- dev->mode.num = info.num;
- dev->mode.verticalRefresh =
- (float)info.vsync_num / (float)info.vsync_den;
- dev->mode.flags = info.flags;
- dev->mode.imageWidth = info.image_width;
- dev->mode.imageHeight = info.image_height;
- dev->mode.pixmapWidth = info.pixmap_width;
- dev->mode.pixmapHeight = info.pixmap_height;
- dev->mode.bytesPerScanline = info.bytes_per_scanline;
- dev->mode.byteOrder = info.byte_order;
- dev->mode.depth = info.depth;
- dev->mode.bitsPerPixel = info.bpp;
- dev->mode.redMask = info.red_mask;
- dev->mode.greenMask = info.green_mask;
- dev->mode.blueMask = info.blue_mask;
- dev->mode.visualClass = info.visual_class;
- dev->mode.viewportWidth = info.viewport_width;
- dev->mode.viewportHeight = info.viewport_height;
- dev->mode.xViewportStep = info.viewport_xstep;
- dev->mode.yViewportStep = info.viewport_ystep;
- dev->mode.maxViewportX = info.viewport_xmax;
- dev->mode.maxViewportY = info.viewport_ymax;
- dev->mode.viewportFlags = info.viewport_flags;
- dev->mode.reserved1 = info.reserved1;
- dev->mode.reserved2 = info.reserved2;
-
- dev->mode.name = (char*)(&dev[1]);
- _XRead(dpy, dev->mode.name, info.name_size);
-
- dev->pixmap = (rep.flags & XDGAPixmap) ? pid : 0;
- dev->data = XDGAGetMappedMemory(screen);
-
- if(dev->data)
- dev->data += rep.offset;
- }
- /* not sure what to do if the allocation fails */
- }
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return dev;
-}
-
-
-void XDGASetViewport(
- Display *dpy,
- int screen,
- int x,
- int y,
- int flags
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASetViewportReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGASetViewport, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASetViewport;
- req->screen = screen;
- req->x = x;
- req->y = y;
- req->flags = flags;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-void XDGAInstallColormap(
- Display *dpy,
- int screen,
- Colormap cmap
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAInstallColormapReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGAInstallColormap, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAInstallColormap;
- req->screen = screen;
- req->cmap = cmap;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGASelectInput(
- Display *dpy,
- int screen,
- long mask
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASelectInputReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGASelectInput, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASelectInput;
- req->screen = screen;
- req->mask = mask;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGAFillRectangle(
- Display *dpy,
- int screen,
- int x,
- int y,
- unsigned int width,
- unsigned int height,
- unsigned long color
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAFillRectangleReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGAFillRectangle, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAFillRectangle;
- req->screen = screen;
- req->x = x;
- req->y = y;
- req->width = width;
- req->height = height;
- req->color = color;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGACopyArea(
- Display *dpy,
- int screen,
- int srcx,
- int srcy,
- unsigned int width,
- unsigned int height,
- int dstx,
- int dsty
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACopyAreaReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGACopyArea, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACopyArea;
- req->screen = screen;
- req->srcx = srcx;
- req->srcy = srcy;
- req->width = width;
- req->height = height;
- req->dstx = dstx;
- req->dsty = dsty;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-void XDGACopyTransparentArea(
- Display *dpy,
- int screen,
- int srcx,
- int srcy,
- unsigned int width,
- unsigned int height,
- int dstx,
- int dsty,
- unsigned long key
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACopyTransparentAreaReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGACopyTransparentArea, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACopyTransparentArea;
- req->screen = screen;
- req->srcx = srcx;
- req->srcy = srcy;
- req->width = width;
- req->height = height;
- req->dstx = dstx;
- req->dsty = dsty;
- req->key = key;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-int XDGAGetViewportStatus(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAGetViewportStatusReply rep;
- xXDGAGetViewportStatusReq *req;
- int status = 0;
-
- XDGACheckExtension (dpy, info, 0);
-
- LockDisplay(dpy);
- GetReq(XDGAGetViewportStatus, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAGetViewportStatus;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
- status = rep.status;
- UnlockDisplay(dpy);
- SyncHandle();
- return status;
-}
-
-void XDGASync(
- Display *dpy,
- int screen
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGASyncReply rep;
- xXDGASyncReq *req;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGASync, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGASync;
- req->screen = screen;
- _XReply(dpy, (xReply *)&rep, 0, xFalse);
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-
-void XDGAChangePixmapMode(
- Display *dpy,
- int screen,
- int *x,
- int *y,
- int mode
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGAChangePixmapModeReq *req;
- xXDGAChangePixmapModeReply rep;
-
- XextSimpleCheckExtension (dpy, info, xdga_extension_name);
-
- LockDisplay(dpy);
- GetReq(XDGAChangePixmapMode, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGAChangePixmapMode;
- req->screen = screen;
- req->x = *x;
- req->y = *y;
- req->flags = mode;
- _XReply(dpy, (xReply *)&rep, 0, xFalse);
- *x = rep.x;
- *y = rep.y;
- UnlockDisplay(dpy);
- SyncHandle();
-}
-
-Colormap XDGACreateColormap(
- Display *dpy,
- int screen,
- XDGADevice *dev,
- int alloc
-){
- XExtDisplayInfo *info = xdga_find_display (dpy);
- xXDGACreateColormapReq *req;
- Colormap cid;
-
- XDGACheckExtension (dpy, info, -1);
-
- LockDisplay(dpy);
- GetReq(XDGACreateColormap, req);
- req->reqType = info->codes->major_opcode;
- req->dgaReqType = X_XDGACreateColormap;
- req->screen = screen;
- req->mode = dev->mode.num;
- req->alloc = alloc;
- cid = req->id = XAllocID(dpy);
- UnlockDisplay(dpy);
- SyncHandle();
-
- return cid;
-}
-
-
-void XDGAKeyEventToXKeyEvent(
- XDGAKeyEvent* dk,
- XKeyEvent* xk
-){
- xk->type = dk->type;
- xk->serial = dk->serial;
- xk->send_event = False;
- xk->display = dk->display;
- xk->window = RootWindow(dk->display, dk->screen);
- xk->root = xk->window;
- xk->subwindow = None;
- xk->time = dk->time;
- xk->x = xk->y = xk->x_root = xk->y_root = 0;
- xk->state = dk->state;
- xk->keycode = dk->keycode;
- xk->same_screen = True;
-}
-
-#include <X11/Xmd.h>
-#include <X11/extensions/xf86dga.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#if defined(ISC)
-# define HAS_SVR3_MMAP
-# include <sys/types.h>
-# include <errno.h>
-
-# include <sys/at_ansi.h>
-# include <sys/kd.h>
-
-# include <sys/sysmacros.h>
-# include <sys/immu.h>
-# include <sys/region.h>
-
-# include <sys/mmap.h>
-#else
-# if !defined(Lynx)
-# if !defined(__EMX__)
-# include <sys/mman.h>
-# endif
-# else
-# include <sys/types.h>
-# include <errno.h>
-# include <smem.h>
-# endif
-#endif
-#include <sys/wait.h>
-#include <signal.h>
-#include <unistd.h>
-
-#if defined(SVR4) && !defined(sun) && !defined(SCO325)
-#define DEV_MEM "/dev/pmem"
-#else
-#define DEV_MEM "/dev/mem"
-#endif
-
-
-
-typedef struct _DGAMapRec{
- unsigned char *physical;
- unsigned char *virtual;
- CARD32 size;
- int fd;
- int screen;
- struct _DGAMapRec *next;
-} DGAMapRec, *DGAMapPtr;
-
-static Bool
-DGAMapPhysical(int, char*, unsigned char*, CARD32, CARD32, CARD32, DGAMapPtr);
-static void DGAUnmapPhysical(DGAMapPtr);
-
-static DGAMapPtr _Maps = NULL;
-
-
-unsigned char*
-XDGAGetMappedMemory(int screen)
-{
- DGAMapPtr pMap = _Maps;
- unsigned char *pntr = NULL;
-
- while(pMap != NULL) {
- if(pMap->screen == screen) {
- pntr = pMap->virtual;
- break;
- }
- pMap = pMap->next;
- }
-
- return pntr;
-}
-
-Bool
-XDGAMapFramebuffer(
- int screen,
- char *name, /* optional device name */
- unsigned char* base, /* physical memory */
- CARD32 size, /* size */
- CARD32 offset, /* optional offset */
- CARD32 extra /* optional extra data */
-){
- DGAMapPtr pMap = _Maps;
- Bool result;
-
- /* is it already mapped ? */
- while(pMap != NULL) {
- if(pMap->screen == screen)
- return True;
- pMap = pMap->next;
- }
-
- if(extra & XDGANeedRoot) {
- /* we should probably check if we have root permissions and
- return False here */
-
- }
-
- pMap = (DGAMapPtr)Xmalloc(sizeof(DGAMapRec));
-
- result = DGAMapPhysical(screen, name, base, size, offset, extra, pMap);
-
- if(result) {
- pMap->next = _Maps;
- _Maps = pMap;
- } else
- Xfree(pMap);
-
- return result;
-}
-
-void
-XDGAUnmapFramebuffer(int screen)
-{
- DGAMapPtr pMap = _Maps;
- DGAMapPtr pPrev = NULL;
-
- /* is it already mapped */
- while(pMap != NULL) {
- if(pMap->screen == screen)
- break;
- pPrev = pMap;
- pMap = pMap->next;
- }
-
- if(!pMap)
- return;
-
- DGAUnmapPhysical(pMap);
-
- if(!pPrev)
- _Maps = pMap->next;
- else
- pPrev->next = pMap->next;
-
- Xfree(pMap);
-}
-
-
-static Bool
-DGAMapPhysical(
- int screen,
- char *name, /* optional device name */
- unsigned char* base, /* physical memory */
- CARD32 size, /* size */
- CARD32 offset, /* optional offset */
- CARD32 extra, /* optional extra data */
- DGAMapPtr pMap
-) {
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- struct kd_memloc mloc;
-#elif defined(__EMX__)
- APIRET rc;
- ULONG action;
- HFILE hfd;
-#endif
-
- pMap->screen = screen;
- pMap->physical = base;
- pMap->size = size;
-
-#if defined(ISC) && defined(HAS_SVR3_MMAP)
- if ((pMap->fd = open("/dev/mmap", O_RDWR)) < 0)
- return False;
- mloc.vaddr = (char *)0;
- mloc.physaddr = (char *)base;
- mloc.length = size;
- mloc.ioflg=1;
-
- if ((pMap->virtual = (void *)ioctl(pMap->fd, MAP, &mloc)) == (void *)-1)
- return False;
-#elif defined (__EMX__)
- /*
- * Dragon warning here! /dev/pmap$ is never closed, except on progam exit.
- * Consecutive calling of this routine will make PMAP$ driver run out
- * of memory handles. Some umap/close mechanism should be provided
- */
-
- rc = DosOpen("/dev/pmap$", &hfd, &action, 0, FILE_NORMAL, FILE_OPEN,
- OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYNONE, (PEAOP2)NULL);
- if (rc != 0)
- return False;
- {
- struct map_ioctl {
- union {
- ULONG phys;
- void* user;
- } a;
- ULONG size;
- } pmap,dmap;
- ULONG plen,dlen;
-#define XFREE86_PMAP 0x76
-#define PMAP_MAP 0x44
-
- pmap.a.phys = base;
- pmap.size = size;
- rc = DosDevIOCtl(hfd, XFREE86_PMAP, PMAP_MAP,
- (PULONG)&pmap, sizeof(pmap), &plen,
- (PULONG)&dmap, sizeof(dmap), &dlen);
- if (rc == 0) {
- pMap->virtual = dmap.a.user;
- }
- }
- if (rc != 0)
- return False;
-#elif defined (Lynx)
- pMap->virtual = smem_create("XF86DGA", (char*)base, size, SM_READ|SM_WRITE);
-#else
-#ifndef MAP_FILE
-#define MAP_FILE 0
-#endif
- if ((pMap->fd = open(DEV_MEM, O_RDWR)) < 0)
- return False;
- pMap->virtual = mmap(NULL, size, PROT_READ, MAP_FILE | MAP_SHARED,
- pMap->fd, (off_t)base);
- if (pMap->virtual == (void *)-1)
- return False;
-#endif
-
-#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
- && !defined(__EMX__)
- mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE);
-#endif
-
- return True;
-}
-
-
-
-static void
-DGAUnmapPhysical(DGAMapPtr pMap)
-{
-#if !defined(ISC) && !defined(HAS_SVR3_MMAP) && !defined(Lynx) \
- && !defined(__EMX__)
- mprotect(pMap->virtual,pMap->size, PROT_READ);
-#elif defined(Lynx)
- /* XXX this doesn't allow enable after disable */
- smem_create(NULL, pMap->virtual, pMap->size, SM_DETACH);
- smem_remove("XF86DGA");
-#endif
-
-
- /* We need to unmap and close too !!!!!!!!!!*/
-}
diff --git a/xc/lib/Xxf86dga/Xxf86dga-def.cpp b/xc/lib/Xxf86dga/Xxf86dga-def.cpp
deleted file mode 100644
index 7bbd72d2c..000000000
--- a/xc/lib/Xxf86dga/Xxf86dga-def.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-LIBRARY libXxf86dga
-EXPORTS
- XF86DGAQueryExtension
- XF86DGAQueryDirectVideo
- XF86DGAQueryVersion
- XF86DGAInstallColormap
- XF86DGAGetVideoLL
- XF86DGADirectVideoLL
-; XF86DGAGetViewPort
- XF86DGASetViewPort
- XF86DGAGetVidPage
- XF86DGASetVidPage
- XF86DGADirectVideo
- XF86DGAGetVideo
-
-/* $XFree86: xc/lib/Xxf86dga/Xxf86dga-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */
diff --git a/xc/lib/Xxf86dga/Xxf86dgaos2.def b/xc/lib/Xxf86dga/Xxf86dgaos2.def
deleted file mode 100644
index 81fc09ee4..000000000
--- a/xc/lib/Xxf86dga/Xxf86dgaos2.def
+++ /dev/null
@@ -1,18 +0,0 @@
-LIBRARY XXF86DGA
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xxf86dga/Xxf86dgaos2.def,v 3.2 1999/04/29 09:13:35 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- XF86DGAQueryExtension @ 1
- XF86DGAQueryVersion @ 2
- XF86DGAGetVideoLL @ 3
- XF86DGADirectVideoLL @ 4
- XF86DGAGetViewPort @ 5
- XF86DGASetViewPort @ 6
- XF86DGAGetVidPage @ 7
- XF86DGASetVidPage @ 8
- XF86DGADirectVideo @ 9
- XF86DGAGetVideo @ 10
diff --git a/xc/lib/Xxf86dga/Xxf86dgaos2.rsp b/xc/lib/Xxf86dga/Xxf86dgaos2.rsp
deleted file mode 100644
index acadff4b2..000000000
--- a/xc/lib/Xxf86dga/Xxf86dgaos2.rsp
+++ /dev/null
@@ -1,3 +0,0 @@
-XF86DGA.obj /NOL /NOD /BAT
-Xxf86dga.dll
-
diff --git a/xc/lib/Xxf86misc/Imakefile b/xc/lib/Xxf86misc/Imakefile
deleted file mode 100644
index b7d5e03d0..000000000
--- a/xc/lib/Xxf86misc/Imakefile
+++ /dev/null
@@ -1,32 +0,0 @@
-XCOMM $XFree86: xc/lib/Xxf86misc/Imakefile,v 3.1 1998/12/20 11:57:13 dawes Exp $
-#define DoNormalLib NormalLibXxf86misc
-#define DoSharedLib SharedLibXxf86misc
-#define DoExtraLib SharedLibXxf86misc
-#define DoDebugLib DebugLibXxf86misc
-#define DoProfileLib ProfileLibXxf86misc
-#define LibName Xxf86misc
-#define SoRev SOXXF86MISCREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86miscReqs
-REQUIREDLIBS = SharedXxf86miscReqs
-#endif
-
-XF86MISCSRCS = XF86Misc.c
-XF86MISCOBJS = XF86Misc.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = $(XF86MISCSRCS)
- OBJS = $(XF86MISCOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xxf86misc/XF86Misc.c b/xc/lib/Xxf86misc/XF86Misc.c
deleted file mode 100644
index 35c77a5e4..000000000
--- a/xc/lib/Xxf86misc/XF86Misc.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $XFree86: xc/lib/Xxf86misc/XF86Misc.c,v 3.7 1998/06/28 03:52:34 dawes Exp $ */
-
-/*
- * Copyright (c) 1995, 1996 The XFree86 Project, Inc
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include "Xlibint.h"
-#include "xf86mscstr.h"
-#include "Xext.h"
-#include "extutil.h"
-
-static XExtensionInfo _xf86misc_info_data;
-static XExtensionInfo *xf86misc_info = &_xf86misc_info_data;
-static char *xf86misc_extension_name = XF86MISCNAME;
-
-#define XF86MiscCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86misc_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display();
-static /* const */ XExtensionHooks xf86misc_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86misc_info,
- xf86misc_extension_name,
- &xf86misc_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86misc_info)
-
-
-/*****************************************************************************
- * *
- * public XFree86-Misc Extension routines *
- * *
- *****************************************************************************/
-
-Bool XF86MiscQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Bool XF86MiscQueryVersion(dpy, majorVersion, minorVersion)
- Display* dpy;
- int* majorVersion;
- int* minorVersion;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscQueryVersionReply rep;
- xXF86MiscQueryVersionReq *req;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscGetMouseSettings(dpy, mouseinfo)
- Display* dpy;
- XF86MiscMouseSettings *mouseinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscGetMouseSettingsReply rep;
- xXF86MiscGetMouseSettingsReq *req;
- int i;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscGetMouseSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscGetMouseSettings;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86MiscGetMouseSettingsReply) - SIZEOF(xReply))>>2,
- xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- mouseinfo->type = rep.mousetype;
- mouseinfo->baudrate = rep.baudrate;
- mouseinfo->samplerate = rep.samplerate;
- mouseinfo->resolution = rep.resolution;
- mouseinfo->buttons = rep.buttons;
- mouseinfo->emulate3buttons = rep.emulate3buttons;
- mouseinfo->emulate3timeout = rep.emulate3timeout;
- mouseinfo->chordmiddle = rep.chordmiddle;
- mouseinfo->flags = rep.flags;
- if (rep.devnamelen > 0) {
- if (!(mouseinfo->device = Xcalloc(rep.devnamelen + 1, 1))) {
- _XEatData(dpy, (rep.devnamelen+3) & ~3);
- Xfree(mouseinfo->device);
- return False;
- }
- _XReadPad(dpy, mouseinfo->device, rep.devnamelen);
- } else
- mouseinfo->device = NULL;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscGetKbdSettings(dpy, kbdinfo)
- Display* dpy;
- XF86MiscKbdSettings *kbdinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscGetKbdSettingsReply rep;
- xXF86MiscGetKbdSettingsReq *req;
- int i;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscGetKbdSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscGetKbdSettings;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- kbdinfo->type = rep.kbdtype;
- kbdinfo->rate = rep.rate;
- kbdinfo->delay = rep.delay;
- kbdinfo->servnumlock = rep.servnumlock;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscSetMouseSettings(dpy, mouseinfo)
- Display* dpy;
- XF86MiscMouseSettings *mouseinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscSetMouseSettingsReq *req;
- int i;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscSetMouseSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscSetMouseSettings;
- req->mousetype = mouseinfo->type;
- req->baudrate = mouseinfo->baudrate;
- req->samplerate = mouseinfo->samplerate;
- req->resolution = mouseinfo->resolution;
- req->buttons = mouseinfo->buttons;
- req->emulate3buttons = mouseinfo->emulate3buttons;
- req->emulate3timeout = mouseinfo->emulate3timeout;
- req->chordmiddle = mouseinfo->chordmiddle;
- req->flags = mouseinfo->flags;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86MiscSetKbdSettings(dpy, kbdinfo)
- Display* dpy;
- XF86MiscKbdSettings *kbdinfo;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86MiscSetKbdSettingsReq *req;
- int i;
-
- XF86MiscCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86MiscSetKbdSettings, req);
- req->reqType = info->codes->major_opcode;
- req->xf86miscReqType = X_XF86MiscSetKbdSettings;
- req->kbdtype = kbdinfo->type;
- req->rate = kbdinfo->rate;
- req->delay = kbdinfo->delay;
- req->servnumlock = kbdinfo->servnumlock;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
diff --git a/xc/lib/Xxf86misc/Xxf86misc-def.cpp b/xc/lib/Xxf86misc/Xxf86misc-def.cpp
deleted file mode 100644
index 10f9116b7..000000000
--- a/xc/lib/Xxf86misc/Xxf86misc-def.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-LIBRARY XXF86MISC
-EXPORTS
- XF86MiscQueryExtension
- XF86MiscQueryVersion
- XF86MiscSetKbdSettings
- XF86MiscGetKbdSettings
- XF86MiscSetMouseSettings
- XF86MiscGetMouseSettings
-; XF86MiscSetSaver
-; XF86MiscGetSaver
-
-
-/* $XFree86: xc/lib/Xxf86misc/Xxf86misc-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */
diff --git a/xc/lib/Xxf86misc/Xxf86miscos2.def b/xc/lib/Xxf86misc/Xxf86miscos2.def
deleted file mode 100644
index 8fc881b4b..000000000
--- a/xc/lib/Xxf86misc/Xxf86miscos2.def
+++ /dev/null
@@ -1,13 +0,0 @@
-LIBRARY XXF86MISC
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xxf86misc/Xxf86miscos2.def,v 3.2 1999/04/29 09:13:35 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- XF86MiscQueryExtension @ 1
- XF86MiscQueryVersion @ 2
- XF86MiscSetSaver @ 3
- XF86MiscGetSaver @ 4
-
diff --git a/xc/lib/Xxf86misc/Xxf86miscos2.rsp b/xc/lib/Xxf86misc/Xxf86miscos2.rsp
deleted file mode 100644
index dd02e1c2d..000000000
--- a/xc/lib/Xxf86misc/Xxf86miscos2.rsp
+++ /dev/null
@@ -1,3 +0,0 @@
-XF86Misc.obj /NOL /NOD /BAT
-Xxf86msic.dll
-
diff --git a/xc/lib/Xxf86rush/Imakefile b/xc/lib/Xxf86rush/Imakefile
deleted file mode 100644
index 014cdcb45..000000000
--- a/xc/lib/Xxf86rush/Imakefile
+++ /dev/null
@@ -1,31 +0,0 @@
-XCOMM $XFree86: xc/lib/Xxf86rush/Imakefile,v 1.1 1999/09/04 09:14:09 dawes Exp $
-#define DoNormalLib NormalLibXxf86rush
-#define DoSharedLib SharedLibXxf86rush
-#define DoDebugLib DebugLibXxf86rush
-#define DoProfileLib ProfileLibXxf86rush
-#define LibName Xxf86rush
-#define SoRev SOXXF86RUSHREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86rushReqs
-REQUIREDLIBS = SharedXxf86rushReqs
-#endif
-
-XF86RUSHSRCS = XF86Rush.c
-XF86RUSHOBJS = XF86Rush.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = $(XF86RUSHSRCS)
- OBJS = $(XF86RUSHOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xxf86rush/XF86Rush.c b/xc/lib/Xxf86rush/XF86Rush.c
deleted file mode 100644
index 1b4ec1b19..000000000
--- a/xc/lib/Xxf86rush/XF86Rush.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* $XFree86: xc/lib/Xxf86rush/XF86Rush.c,v 1.5 2000/09/26 15:56:59 tsi Exp $ */
-/*
-
-Copyright (c) 1998 Daryll Strauss
-
-*/
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#include "Xlibint.h"
-#include "xf86rushstr.h"
-#include "Xext.h"
-#include "extutil.h"
-
-static XExtensionInfo _xf86rush_info_data;
-static XExtensionInfo *xf86rush_info = &_xf86rush_info_data;
-static char *xf86rush_extension_name = XF86RUSHNAME;
-
-#define XF86RushCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86rush_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static int close_display();
-static /* const */ XExtensionHooks xf86rush_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86rush_info,
- xf86rush_extension_name,
- &xf86rush_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86rush_info)
-
-
-/*****************************************************************************
- * *
- * public XFree86-DGA Extension routines *
- * *
- *****************************************************************************/
-
-Bool XF86RushQueryExtension (Display *dpy, int *event_basep, int *error_basep)
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Bool XF86RushQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86RushQueryVersionReply rep;
- xXF86RushQueryVersionReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86RushQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86RushLockPixmap(Display *dpy, int screen, Pixmap pixmap, void **addr)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86RushLockPixmapReply rep;
- xXF86RushLockPixmapReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86RushLockPixmap, req);
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushLockPixmap;
- req->screen = screen;
- req->pixmap = pixmap;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- if (addr)
- *addr = (void *)(long)rep.addr;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86RushUnlockPixmap(Display *dpy, int screen, Pixmap pixmap)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushUnlockPixmapReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86RushUnlockPixmap, req);
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushUnlockPixmap;
- req->screen=screen;
- req->pixmap=pixmap;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86RushUnlockAllPixmaps(Display *dpy)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushUnlockAllPixmapsReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86RushUnlockAllPixmaps, req);
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushUnlockAllPixmaps;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86RushSetCopyMode(Display *dpy, int screen, int mode)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushSetCopyModeReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86RushSetCopyMode, req);
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushSetCopyMode;
- req->screen = screen;
- req->CopyMode = mode;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool XF86RushSetPixelStride(Display *dpy, int screen, int stride)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushSetPixelStrideReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
- LockDisplay(dpy);
- GetReq(XF86RushSetPixelStride, req);
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushSetPixelStride;
- req->screen = screen;
- req->PixelStride = stride;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-int XF86RushOverlayPixmap (Display *dpy, XvPortID port, Drawable d,
- GC gc, Pixmap pixmap, int src_x, int src_y,
- unsigned int src_w, unsigned int src_h,
- int dest_x, int dest_y,
- unsigned int dest_w, unsigned int dest_h,
- unsigned int id)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushOverlayPixmapReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
-
- FlushGC(dpy, gc);
-
- LockDisplay(dpy);
- GetReq(XF86RushOverlayPixmap, req);
-
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushOverlayPixmap;
- req->port = port;
- req->drawable = d;
- req->gc = gc->gid;
- req->id = id;
- req->pixmap = pixmap;
- req->src_x = src_x;
- req->src_y = src_y;
- req->src_w = src_w;
- req->src_h = src_h;
- req->drw_x = dest_x;
- req->drw_y = dest_y;
- req->drw_w = dest_w;
- req->drw_h = dest_h;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return Success;
-}
-
-int XF86RushStatusRegOffset (Display *dpy, int screen)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushStatusRegOffsetReq *req;
- xXF86RushStatusRegOffsetReply rep;
-
- XF86RushCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86RushStatusRegOffset, req);
-
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushStatusRegOffset;
- req->screen = screen;
-
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.offset;
-}
-
-Bool XF86RushAT3DEnableRegs (Display *dpy, int screen)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushAT3DEnableRegsReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86RushAT3DEnableRegs, req);
-
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushAT3DEnableRegs;
- req->screen = screen;
-
- UnlockDisplay(dpy);
- SyncHandle();
- /*
- * The request has to be processed to stay in sync...
- */
- XSync(dpy, False);
- return Success;
-}
-
-Bool XF86RushAT3DDisableRegs (Display *dpy, int screen)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86RushAT3DDisableRegsReq *req;
-
- XF86RushCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86RushAT3DDisableRegs, req);
-
- req->reqType = info->codes->major_opcode;
- req->rushReqType = X_XF86RushAT3DDisableRegs;
- req->screen = screen;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return Success;
-}
diff --git a/xc/lib/Xxf86vm/Imakefile b/xc/lib/Xxf86vm/Imakefile
deleted file mode 100644
index 7edb2d50a..000000000
--- a/xc/lib/Xxf86vm/Imakefile
+++ /dev/null
@@ -1,32 +0,0 @@
-XCOMM $XFree86: xc/lib/Xxf86vm/Imakefile,v 3.1 1998/12/20 11:57:13 dawes Exp $
-#define DoNormalLib NormalLibXxf86vm
-#define DoSharedLib SharedLibXxf86vm
-#define DoExtraLib SharedLibXxf86vm
-#define DoDebugLib DebugLibXxf86vm
-#define DoProfileLib ProfileLibXxf86vm
-#define LibName Xxf86vm
-#define SoRev SOXXF86VMREV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-#ifdef SharedXxf86vmReqs
-REQUIREDLIBS = SharedXxf86vmReqs
-#endif
-
-VIDMODESRCS = XF86VMode.c
-VIDMODEOBJS = XF86VMode.o
-
-#if Malloc0ReturnsNull
-ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
-
- DEFINES = $(ALLOC_DEFINES)
- INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC)
- SRCS = $(VIDMODESRCS)
- OBJS = $(VIDMODEOBJS)
- LINTLIBS = $(LINTXLIB)
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/Xxf86vm/XF86VMode.c b/xc/lib/Xxf86vm/XF86VMode.c
deleted file mode 100644
index b3b30212e..000000000
--- a/xc/lib/Xxf86vm/XF86VMode.c
+++ /dev/null
@@ -1,1111 +0,0 @@
-/* $XConsortium: XF86VMode.c /main/2 1995/11/14 18:17:58 kaleb $ */
-/* $XFree86: xc/lib/Xxf86vm/XF86VMode.c,v 3.27 1999/07/19 13:36:06 dawes Exp $ */
-/*
-
-Copyright (c) 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.
-
-*/
-/* $XConsortium: XF86VMode.c /main/4 1996/01/16 07:52:25 kaleb CHECKEDOUT $ */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-#ifndef XBUILD_IN_CLIENT
-#include "Xlibint.h"
-#include "xf86vmstr.h"
-#include "Xext.h"
-#include "extutil.h"
-#else
-#include "lib/X11/Xlibint.h"
-#include "include/extensions/xf86vmstr.h"
-#include "include/extensions/Xext.h"
-#include "include/extensions/extutil.h"
-#endif
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#ifndef MODE_BAD
-#define MODE_BAD 255
-#endif
-
-static XExtensionInfo _xf86vidmode_info_data;
-static XExtensionInfo *xf86vidmode_info = &_xf86vidmode_info_data;
-static char *xf86vidmode_extension_name = XF86VIDMODENAME;
-
-#define XF86VidModeCheckExtension(dpy,i,val) \
- XextCheckExtension (dpy, i, xf86vidmode_extension_name, val)
-
-/*****************************************************************************
- * *
- * private utility routines *
- * *
- *****************************************************************************/
-
-static XEXT_CLOSE_DISPLAY_PROTO(close_display);
-static /* const */ XExtensionHooks xf86vidmode_extension_hooks = {
- NULL, /* create_gc */
- NULL, /* copy_gc */
- NULL, /* flush_gc */
- NULL, /* free_gc */
- NULL, /* create_font */
- NULL, /* free_font */
- close_display, /* close_display */
- NULL, /* wire_to_event */
- NULL, /* event_to_wire */
- NULL, /* error */
- NULL, /* error_string */
-};
-
-static XEXT_GENERATE_FIND_DISPLAY (find_display, xf86vidmode_info,
- xf86vidmode_extension_name,
- &xf86vidmode_extension_hooks,
- 0, NULL)
-
-static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xf86vidmode_info)
-
-
-/*****************************************************************************
- * *
- * public XFree86-VidMode Extension routines *
- * *
- *****************************************************************************/
-
-Bool
-XF86VidModeQueryExtension (dpy, event_basep, error_basep)
- Display *dpy;
- int *event_basep, *error_basep;
-{
- XExtDisplayInfo *info = find_display (dpy);
-
- if (XextHasExtension(info)) {
- *event_basep = info->codes->first_event;
- *error_basep = info->codes->first_error;
- return True;
- } else {
- return False;
- }
-}
-
-Bool
-XF86VidModeQueryVersion(dpy, majorVersion, minorVersion)
- Display* dpy;
- int* majorVersion;
- int* minorVersion;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeQueryVersionReply rep;
- xXF86VidModeQueryVersionReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeQueryVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeQueryVersion;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *majorVersion = rep.majorVersion;
- *minorVersion = rep.minorVersion;
- UnlockDisplay(dpy);
- SyncHandle();
- if (*majorVersion >= 2)
- XF86VidModeSetClientVersion(dpy);
- return True;
-}
-
-Bool
-XF86VidModeSetClientVersion(Display *dpy)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86VidModeSetClientVersionReq *req;
-
- XF86VidModeCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSetClientVersion, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetClientVersion;
- req->major = XF86VIDMODE_MAJOR_VERSION;
- req->minor = XF86VIDMODE_MINOR_VERSION;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSetGamma(Display *dpy, int screen, XF86VidModeGamma *Gamma)
-{
- XExtDisplayInfo *info = find_display(dpy);
- xXF86VidModeSetGammaReq *req;
-
- XF86VidModeCheckExtension(dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSetGamma, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetGamma;
- req->screen = screen;
- req->red = (CARD32)(Gamma->red * 10000.);
- req->green = (CARD32)(Gamma->green * 10000.);
- req->blue = (CARD32)(Gamma->blue * 10000.);
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetGamma(Display *dpy, int screen, XF86VidModeGamma *Gamma)
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetGammaReply rep;
- xXF86VidModeGetGammaReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetGamma, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetGamma;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- Gamma->red = ((float)rep.red) / 10000.;
- Gamma->green = ((float)rep.green) / 10000.;
- Gamma->blue = ((float)rep.blue) / 10000.;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetModeLine(dpy, screen, dotclock, modeline)
- Display* dpy;
- int screen;
- int* dotclock;
- XF86VidModeModeLine* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetModeLineReply rep;
- xXF86OldVidModeGetModeLineReply oldrep;
- xXF86VidModeGetModeLineReq *req;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, False);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetModeLine;
- req->screen = screen;
-
- if (majorVersion < 2) {
- if (!_XReply(dpy, (xReply *)&oldrep,
- (SIZEOF(xXF86OldVidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *dotclock = rep.dotclock;
- modeline->hdisplay = rep.hdisplay;
- modeline->hsyncstart = rep.hsyncstart;
- modeline->hsyncend = rep.hsyncend;
- modeline->htotal = rep.htotal;
- modeline->hskew = 0;
- modeline->vdisplay = rep.vdisplay;
- modeline->vsyncstart = rep.vsyncstart;
- modeline->vsyncend = rep.vsyncend;
- modeline->vtotal = rep.vtotal;
- modeline->flags = rep.flags;
- modeline->privsize = rep.privsize;
- } else {
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86VidModeGetModeLineReply) - SIZEOF(xReply)) >> 2, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *dotclock = rep.dotclock;
- modeline->hdisplay = rep.hdisplay;
- modeline->hsyncstart = rep.hsyncstart;
- modeline->hsyncend = rep.hsyncend;
- modeline->htotal = rep.htotal;
- modeline->hskew = rep.hskew;
- modeline->vdisplay = rep.vdisplay;
- modeline->vsyncstart = rep.vsyncstart;
- modeline->vsyncend = rep.vsyncend;
- modeline->vtotal = rep.vtotal;
- modeline->flags = rep.flags;
- modeline->privsize = rep.privsize;
- }
-
- if (rep.privsize > 0) {
- if (!(modeline->private = Xcalloc(rep.privsize, sizeof(INT32)))) {
- _XEatData(dpy, (rep.privsize) * sizeof(INT32));
- Xfree(modeline->private);
- return False;
- }
- _XRead32(dpy, modeline->private, rep.privsize * sizeof(INT32));
- } else {
- modeline->private = NULL;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetAllModeLines(dpy, screen, modecount, modelinesPtr)
- Display* dpy;
- int screen;
- int* modecount;
- XF86VidModeModeInfo ***modelinesPtr;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetAllModeLinesReply rep;
- xXF86VidModeGetAllModeLinesReq *req;
- XF86VidModeModeInfo *mdinfptr, **modelines;
- xXF86VidModeModeInfo xmdline;
- xXF86OldVidModeModeInfo oldxmdline;
- int i;
- int majorVersion, minorVersion;
- Bool protocolBug = False;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- /*
- * Note: There was a bug in the protocol implementation in versions
- * 0.x with x < 8 (the .private field wasn't being passed over the wire).
- * Check the server's version, and accept the old format if appropriate.
- */
-
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
- if (majorVersion == 0 && minorVersion < 8) {
- protocolBug = True;
-#ifdef DEBUG
- fprintf(stderr, "XF86VidModeGetAllModeLines: Warning: Xserver is"
- "running an old version (%d.%d)\n", majorVersion,
- minorVersion);
-#endif
- }
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetAllModeLines, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetAllModeLines;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86VidModeGetAllModeLinesReply) - SIZEOF(xReply)) >> 2, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
-
- *modecount = rep.modecount;
-
- if (!(modelines = (XF86VidModeModeInfo **) Xcalloc(rep.modecount,
- sizeof(XF86VidModeModeInfo *)
- +sizeof(XF86VidModeModeInfo)))) {
- if (majorVersion < 2)
- _XEatData(dpy, (rep.modecount) * sizeof(xXF86OldVidModeModeInfo));
- else
- _XEatData(dpy, (rep.modecount) * sizeof(xXF86VidModeModeInfo));
- Xfree(modelines);
- return False;
- }
- mdinfptr = (XF86VidModeModeInfo *) (
- (char *) modelines
- + rep.modecount*sizeof(XF86VidModeModeInfo *)
- );
-
- for (i = 0; i < rep.modecount; i++) {
- modelines[i] = mdinfptr++;
- if (majorVersion < 2) {
- _XRead32(dpy, &oldxmdline, sizeof(xXF86OldVidModeModeInfo));
- modelines[i]->dotclock = oldxmdline.dotclock;
- modelines[i]->hdisplay = oldxmdline.hdisplay;
- modelines[i]->hsyncstart = oldxmdline.hsyncstart;
- modelines[i]->hsyncend = oldxmdline.hsyncend;
- modelines[i]->htotal = oldxmdline.htotal;
- modelines[i]->hskew = 0;
- modelines[i]->vdisplay = oldxmdline.vdisplay;
- modelines[i]->vsyncstart = oldxmdline.vsyncstart;
- modelines[i]->vsyncend = oldxmdline.vsyncend;
- modelines[i]->vtotal = oldxmdline.vtotal;
- modelines[i]->flags = oldxmdline.flags;
- if (protocolBug) {
- modelines[i]->privsize = 0;
- modelines[i]->private = NULL;
- } else {
- modelines[i]->privsize = oldxmdline.privsize;
- if (oldxmdline.privsize > 0) {
- if (!(modelines[i]->private =
- Xcalloc(oldxmdline.privsize, sizeof(INT32)))) {
- _XEatData(dpy, (oldxmdline.privsize) * sizeof(INT32));
- Xfree(modelines[i]->private);
- } else {
- _XRead32(dpy, modelines[i]->private,
- oldxmdline.privsize * sizeof(INT32));
- }
- } else {
- modelines[i]->private = NULL;
- }
- }
- } else {
- _XRead32(dpy, &xmdline, sizeof(xXF86VidModeModeInfo));
- modelines[i]->dotclock = xmdline.dotclock;
- modelines[i]->hdisplay = xmdline.hdisplay;
- modelines[i]->hsyncstart = xmdline.hsyncstart;
- modelines[i]->hsyncend = xmdline.hsyncend;
- modelines[i]->htotal = xmdline.htotal;
- modelines[i]->hskew = xmdline.hskew;
- modelines[i]->vdisplay = xmdline.vdisplay;
- modelines[i]->vsyncstart = xmdline.vsyncstart;
- modelines[i]->vsyncend = xmdline.vsyncend;
- modelines[i]->vtotal = xmdline.vtotal;
- modelines[i]->flags = xmdline.flags;
- if (protocolBug) {
- modelines[i]->privsize = 0;
- modelines[i]->private = NULL;
- } else {
- modelines[i]->privsize = xmdline.privsize;
- if (xmdline.privsize > 0) {
- if (!(modelines[i]->private =
- Xcalloc(xmdline.privsize, sizeof(INT32)))) {
- _XEatData(dpy, (xmdline.privsize) * sizeof(INT32));
- Xfree(modelines[i]->private);
- } else {
- _XRead32(dpy, modelines[i]->private,
- xmdline.privsize * sizeof(INT32));
- }
- } else {
- modelines[i]->private = NULL;
- }
- }
- }
- }
- *modelinesPtr = modelines;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-/*
- * GetReq replacement for use with VidMode protocols earlier than 2.0
- */
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define GetOldReq(name, oldname, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x##oldname##Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x##oldname##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_##name;\
- req->length = (SIZEOF(x##oldname##Req))>>2;\
- dpy->bufptr += SIZEOF(x##oldname##Req);\
- dpy->request++
-
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define GetOldReq(name, oldname, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x/**/oldname/**/Req)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x/**/oldname/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_/**/name;\
- req->length = (SIZEOF(x/**/oldname/**/Req))>>2;\
- dpy->bufptr += SIZEOF(x/**/oldname/**/Req);\
- dpy->request++
-#endif
-
-Bool
-XF86VidModeAddModeLine (dpy, screen, newmodeline, aftermodeline)
- Display *dpy;
- int screen;
- XF86VidModeModeInfo* newmodeline;
- XF86VidModeModeInfo* aftermodeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeAddModeLineReq *req;
- xXF86OldVidModeAddModeLineReq *oldreq;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, False);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeAddModeLine, XF86OldVidModeAddModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeAddModeLine;
- oldreq->screen = screen;
- oldreq->dotclock = newmodeline->dotclock;
- oldreq->hdisplay = newmodeline->hdisplay;
- oldreq->hsyncstart = newmodeline->hsyncstart;
- oldreq->hsyncend = newmodeline->hsyncend;
- oldreq->htotal = newmodeline->htotal;
- oldreq->vdisplay = newmodeline->vdisplay;
- oldreq->vsyncstart = newmodeline->vsyncstart;
- oldreq->vsyncend = newmodeline->vsyncend;
- oldreq->vtotal = newmodeline->vtotal;
- oldreq->flags = newmodeline->flags;
- oldreq->privsize = newmodeline->privsize;
- if (aftermodeline != NULL) {
- oldreq->after_dotclock = aftermodeline->dotclock;
- oldreq->after_hdisplay = aftermodeline->hdisplay;
- oldreq->after_hsyncstart = aftermodeline->hsyncstart;
- oldreq->after_hsyncend = aftermodeline->hsyncend;
- oldreq->after_htotal = aftermodeline->htotal;
- oldreq->after_vdisplay = aftermodeline->vdisplay;
- oldreq->after_vsyncstart = aftermodeline->vsyncstart;
- oldreq->after_vsyncend = aftermodeline->vsyncend;
- oldreq->after_vtotal = aftermodeline->vtotal;
- oldreq->after_flags = aftermodeline->flags;
- } else {
- oldreq->after_dotclock = 0;
- oldreq->after_hdisplay = 0;
- oldreq->after_hsyncstart = 0;
- oldreq->after_hsyncend = 0;
- oldreq->after_htotal = 0;
- oldreq->after_vdisplay = 0;
- oldreq->after_vsyncstart = 0;
- oldreq->after_vsyncend = 0;
- oldreq->after_vtotal = 0;
- oldreq->after_flags = 0;
- }
- if (newmodeline->privsize) {
- oldreq->length += newmodeline->privsize;
- Data32(dpy, (long *) newmodeline->private,
- newmodeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeAddModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeAddModeLine;
- req->screen = screen;
- req->dotclock = newmodeline->dotclock;
- req->hdisplay = newmodeline->hdisplay;
- req->hsyncstart = newmodeline->hsyncstart;
- req->hsyncend = newmodeline->hsyncend;
- req->htotal = newmodeline->htotal;
- req->hskew = newmodeline->hskew;
- req->vdisplay = newmodeline->vdisplay;
- req->vsyncstart = newmodeline->vsyncstart;
- req->vsyncend = newmodeline->vsyncend;
- req->vtotal = newmodeline->vtotal;
- req->flags = newmodeline->flags;
- req->privsize = newmodeline->privsize;
- if (aftermodeline != NULL) {
- req->after_dotclock = aftermodeline->dotclock;
- req->after_hdisplay = aftermodeline->hdisplay;
- req->after_hsyncstart = aftermodeline->hsyncstart;
- req->after_hsyncend = aftermodeline->hsyncend;
- req->after_htotal = aftermodeline->htotal;
- req->after_hskew = aftermodeline->hskew;
- req->after_vdisplay = aftermodeline->vdisplay;
- req->after_vsyncstart = aftermodeline->vsyncstart;
- req->after_vsyncend = aftermodeline->vsyncend;
- req->after_vtotal = aftermodeline->vtotal;
- req->after_flags = aftermodeline->flags;
- } else {
- req->after_dotclock = 0;
- req->after_hdisplay = 0;
- req->after_hsyncstart = 0;
- req->after_hsyncend = 0;
- req->after_htotal = 0;
- req->after_hskew = 0;
- req->after_vdisplay = 0;
- req->after_vsyncstart = 0;
- req->after_vsyncend = 0;
- req->after_vtotal = 0;
- req->after_flags = 0;
- }
- if (newmodeline->privsize) {
- req->length += newmodeline->privsize;
- Data32(dpy, (long *) newmodeline->private,
- newmodeline->privsize * sizeof(INT32));
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeDeleteModeLine (dpy, screen, modeline)
- Display *dpy;
- int screen;
- XF86VidModeModeInfo* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeDeleteModeLineReq *req;
- xXF86OldVidModeDeleteModeLineReq *oldreq;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, 0);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeDeleteModeLine, XF86OldVidModeDeleteModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine;
- oldreq->screen = screen;
- oldreq->dotclock = modeline->dotclock;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeDeleteModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeDeleteModeLine;
- req->screen = screen;
- req->dotclock = modeline->dotclock;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeModModeLine (dpy, screen, modeline)
- Display *dpy;
- int screen;
- XF86VidModeModeLine* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeModModeLineReq *req;
- xXF86OldVidModeModModeLineReq *oldreq;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, 0);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeModModeLine, XF86OldVidModeModModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeModModeLine;
- oldreq->screen = screen;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeModModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeModModeLine;
- req->screen = screen;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Status
-XF86VidModeValidateModeLine (dpy, screen, modeline)
- Display *dpy;
- int screen;
- XF86VidModeModeInfo* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeValidateModeLineReq *req;
- xXF86OldVidModeValidateModeLineReq *oldreq;
- xXF86VidModeValidateModeLineReply rep;
- int majorVersion, minorVersion;
-
- XF86VidModeCheckExtension (dpy, info, 0);
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
-
- LockDisplay(dpy);
-
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeValidateModeLine, XF86OldVidModeValidateModeLine, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeValidateModeLine;
- oldreq->screen = screen;
- oldreq->dotclock = modeline->dotclock;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- } else {
- GetReq(XF86VidModeValidateModeLine, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeValidateModeLine;
- req->screen = screen;
- req->dotclock = modeline->dotclock;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return MODE_BAD;
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return rep.status;
-}
-
-Bool
-XF86VidModeSwitchMode(dpy, screen, zoom)
- Display* dpy;
- int screen;
- int zoom;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSwitchModeReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSwitchMode, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSwitchMode;
- req->screen = screen;
- req->zoom = zoom;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSwitchToMode(dpy, screen, modeline)
- Display* dpy;
- int screen;
- XF86VidModeModeInfo* modeline;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSwitchToModeReq *req;
- xXF86OldVidModeSwitchToModeReq *oldreq;
- int majorVersion, minorVersion;
- Bool protocolBug = False;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- /*
- * Note: There was a bug in the protocol implementation in versions
- * 0.x with x < 8 (the .private field wasn't expected to be sent over
- * the wire). Check the server's version, and accept the old format
- * if appropriate.
- */
-
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
- if (majorVersion == 0 && minorVersion < 8) {
- protocolBug = True;
-#ifdef DEBUG
- fprintf(stderr, "XF86VidModeSwitchToMode: Warning: Xserver is"
- "running an old version (%d.%d)\n", majorVersion,
- minorVersion);
-#endif
- }
-
- LockDisplay(dpy);
- if (majorVersion < 2) {
- GetOldReq(XF86VidModeSwitchToMode, XF86OldVidModeSwitchToMode, oldreq);
- oldreq->reqType = info->codes->major_opcode;
- oldreq->xf86vidmodeReqType = X_XF86VidModeSwitchToMode;
- oldreq->screen = screen;
- oldreq->dotclock = modeline->dotclock;
- oldreq->hdisplay = modeline->hdisplay;
- oldreq->hsyncstart = modeline->hsyncstart;
- oldreq->hsyncend = modeline->hsyncend;
- oldreq->htotal = modeline->htotal;
- oldreq->vdisplay = modeline->vdisplay;
- oldreq->vsyncstart = modeline->vsyncstart;
- oldreq->vsyncend = modeline->vsyncend;
- oldreq->vtotal = modeline->vtotal;
- oldreq->flags = modeline->flags;
- if (protocolBug) {
- oldreq->privsize = 0;
- } else {
- oldreq->privsize = modeline->privsize;
- if (modeline->privsize) {
- oldreq->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- } else {
- GetReq(XF86VidModeSwitchToMode, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSwitchToMode;
- req->screen = screen;
- req->dotclock = modeline->dotclock;
- req->hdisplay = modeline->hdisplay;
- req->hsyncstart = modeline->hsyncstart;
- req->hsyncend = modeline->hsyncend;
- req->htotal = modeline->htotal;
- req->hskew = modeline->hskew;
- req->vdisplay = modeline->vdisplay;
- req->vsyncstart = modeline->vsyncstart;
- req->vsyncend = modeline->vsyncend;
- req->vtotal = modeline->vtotal;
- req->flags = modeline->flags;
- if (protocolBug) {
- req->privsize = 0;
- } else {
- req->privsize = modeline->privsize;
- if (modeline->privsize) {
- req->length += modeline->privsize;
- Data32(dpy, (long *) modeline->private,
- modeline->privsize * sizeof(INT32));
- }
- }
- }
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeLockModeSwitch(dpy, screen, lock)
- Display* dpy;
- int screen;
- int lock;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeLockModeSwitchReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeLockModeSwitch, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeLockModeSwitch;
- req->screen = screen;
- req->lock = lock;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetMonitor(dpy, screen, monitor)
- Display* dpy;
- int screen;
- XF86VidModeMonitor* monitor;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetMonitorReply rep;
- xXF86VidModeGetMonitorReq *req;
- CARD32 syncrange;
- int i;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetMonitor, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetMonitor;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- monitor->nhsync = rep.nhsync;
- monitor->nvsync = rep.nvsync;
-#if 0
- monitor->bandwidth = (float)rep.bandwidth / 1e6;
-#endif
- if (rep.vendorLength) {
- if (!(monitor->vendor = (char *)Xcalloc(rep.vendorLength + 1, 1))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
- return False;
- }
- } else {
- monitor->vendor = NULL;
- }
- if (rep.modelLength) {
- if (!(monitor->model = Xcalloc(rep.modelLength + 1, 1))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
- if (monitor->vendor)
- Xfree(monitor->vendor);
- return False;
- }
- } else {
- monitor->model = NULL;
- }
- if (!(monitor->hsync = Xcalloc(rep.nhsync, sizeof(XF86VidModeSyncRange)))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
-
- if (monitor->vendor)
- Xfree(monitor->vendor);
- if (monitor->model)
- Xfree(monitor->model);
- return False;
- }
- if (!(monitor->vsync = Xcalloc(rep.nvsync, sizeof(XF86VidModeSyncRange)))) {
- _XEatData(dpy, (rep.nhsync + rep.nvsync) * 4 +
- ((rep.vendorLength+3) & ~3) + ((rep.modelLength+3) & ~3));
- if (monitor->vendor)
- Xfree(monitor->vendor);
- if (monitor->model)
- Xfree(monitor->model);
- Xfree(monitor->hsync);
- return False;
- }
- for (i = 0; i < rep.nhsync; i++) {
- _XRead32(dpy, (long *)&syncrange, 4);
- monitor->hsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
- monitor->hsync[i].hi = (float)(syncrange >> 16) / 100.0;
- }
- for (i = 0; i < rep.nvsync; i++) {
- _XRead32(dpy, (long *)&syncrange, 4);
- monitor->vsync[i].lo = (float)(syncrange & 0xFFFF) / 100.0;
- monitor->vsync[i].hi = (float)(syncrange >> 16) / 100.0;
- }
- if (rep.vendorLength)
- _XReadPad(dpy, monitor->vendor, rep.vendorLength);
- else
- monitor->vendor = "";
- if (rep.modelLength)
- _XReadPad(dpy, monitor->model, rep.modelLength);
- else
- monitor->model = "";
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetViewPort(dpy, screen, x, y)
- Display* dpy;
- int screen;
- int *x, *y;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetViewPortReply rep;
- xXF86VidModeGetViewPortReq *req;
- int majorVersion, minorVersion;
- Bool protocolBug = False;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- /*
- * Note: There was a bug in the protocol implementation in versions
- * 0.x with x < 8 (no reply was sent, so the client would hang)
- * Check the server's version, and don't wait for a reply with older
- * versions.
- */
-
- XF86VidModeQueryVersion(dpy, &majorVersion, &minorVersion);
- if (majorVersion == 0 && minorVersion < 8) {
- protocolBug = True;
-#ifdef DEBUG
- fprintf(stderr, "XF86VidModeGetViewPort: Warning: Xserver is"
- "running an old version (%d.%d)\n", majorVersion,
- minorVersion);
-#endif
- }
- LockDisplay(dpy);
- GetReq(XF86VidModeGetViewPort, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetViewPort;
- req->screen = screen;
- if (protocolBug) {
- *x = 0;
- *y = 0;
- } else {
- if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *x = rep.x;
- *y = rep.y;
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeSetViewPort(dpy, screen, x, y)
- Display* dpy;
- int screen;
- int x, y;
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeSetViewPortReq *req;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeSetViewPort, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeSetViewPort;
- req->screen = screen;
- req->x = x;
- req->y = y;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
-Bool
-XF86VidModeGetDotClocks(dpy, screen,
- flagsPtr, numclocksPtr, maxclocksPtr, clocksPtr)
- Display* dpy;
- int screen;
- int *flagsPtr, *numclocksPtr, *maxclocksPtr, *clocksPtr[];
-{
- XExtDisplayInfo *info = find_display (dpy);
- xXF86VidModeGetDotClocksReply rep;
- xXF86VidModeGetDotClocksReq *req;
- int i, *dotclocks;
- CARD32 dotclk;
-
- XF86VidModeCheckExtension (dpy, info, False);
-
- LockDisplay(dpy);
- GetReq(XF86VidModeGetDotClocks, req);
- req->reqType = info->codes->major_opcode;
- req->xf86vidmodeReqType = X_XF86VidModeGetDotClocks;
- req->screen = screen;
- if (!_XReply(dpy, (xReply *)&rep,
- (SIZEOF(xXF86VidModeGetDotClocksReply) - SIZEOF(xReply)) >> 2, xFalse))
- {
- UnlockDisplay(dpy);
- SyncHandle();
- return False;
- }
- *numclocksPtr = rep.clocks;
- *maxclocksPtr = rep.maxclocks;
- *flagsPtr = rep.flags;
-
- if (!(dotclocks = (int*) Xcalloc(rep.clocks, sizeof(int)))) {
- _XEatData(dpy, (rep.clocks) * 4);
- Xfree(dotclocks);
- return False;
- }
-
- for (i = 0; i < rep.clocks; i++) {
- _XRead32(dpy, &dotclk, 4);
- dotclocks[i] = dotclk;
- }
- *clocksPtr = dotclocks;
- UnlockDisplay(dpy);
- SyncHandle();
- return True;
-}
-
diff --git a/xc/lib/Xxf86vm/Xxf86vm-def.cpp b/xc/lib/Xxf86vm/Xxf86vm-def.cpp
deleted file mode 100644
index 9f08eb85f..000000000
--- a/xc/lib/Xxf86vm/Xxf86vm-def.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-LIBRARY XXF86VM
-EXPORTS
- XF86VidModeQueryExtension
- XF86VidModeQueryVersion
- XF86VidModeGetModeLine
- XF86VidModeGetAllModeLines
- XF86VidModeModModeLine
- XF86VidModeSwitchMode
- XF86VidModeLockModeSwitch
- XF86VidModeGetMonitor
- XF86VidModeGetGamma
- XF86VidModeSetGamma
- XF86VidModeSwitchToMode
- XF86VidModeAddModeLine
-
-/* $XFree86: xc/lib/Xxf86vm/Xxf86vm-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */
diff --git a/xc/lib/Xxf86vm/Xxf86vmos2.def b/xc/lib/Xxf86vm/Xxf86vmos2.def
deleted file mode 100644
index 4d389c74e..000000000
--- a/xc/lib/Xxf86vm/Xxf86vmos2.def
+++ /dev/null
@@ -1,16 +0,0 @@
-LIBRARY XXF86VM
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/Xxf86vm/Xxf86vmos2.def,v 3.2 1999/04/29 09:13:36 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 4096
-EXPORTS
- XF86VidModeQueryExtension @ 1
- XF86VidModeQueryVersion @ 2
- XF86VidModeGetModeLine @ 3
- XF86VidModeModModeLine @ 4
- XF86VidModeSwitchMode @ 5
- XF86VidModeLockModeSwitch @ 6
- XF86VidModeGetMonitor @ 7
-
diff --git a/xc/lib/Xxf86vm/Xxf86vmos2.rsp b/xc/lib/Xxf86vm/Xxf86vmos2.rsp
deleted file mode 100644
index df7707d4e..000000000
--- a/xc/lib/Xxf86vm/Xxf86vmos2.rsp
+++ /dev/null
@@ -1,3 +0,0 @@
-XF86VMode.obj /NOL /NOD /BAT
-Xxf86vm.dll
-
diff --git a/xc/lib/dps/DPSCAP.h b/xc/lib/dps/DPSCAP.h
deleted file mode 100644
index cb36016c2..000000000
--- a/xc/lib/dps/DPSCAP.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * DPSCAP.h -- CAP constants, analogous to X.h
- *
- * (c) Copyright 1990-1994 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
- */
-
-#ifndef _DPSCAP_h
-#define _DPSCAP_h
-
-/* DPSCAPConnSetup functional hint flags */
-
-#define DPSCAPNONEFLAG 0x0000
-
-/* Values for DPSCAPNotify */
-
-#define DPSCAPNOTE_GRAB 0
-#define DPSCAPNOTE_UNGRAB 1
-#define DPSCAPNOTE_FREEGC 2
-#define DPSCAPNOTE_SYNC 3
-#define DPSCAPNOTE_PAUSE 4
-
-/* Minor opcodes for CAP errors */
-
-#define DPSCAPDEADLOCK 0
-
-/* Pnames for ClientMessage type atoms */
-
-
-#define DPSCAP_TYPE_PSOUTPUT "_ADOBE_DPSCAP_TYPE_PSOUTPUT"
-#define DPSCAP_TYPE_PSOUTPUT_LEN "_ADOBE_DPSCAP_TYPE_PSOUTPUT_WITH_LEN"
-#define DPSCAP_TYPE_PSSTATUS "_ADOBE_DPSCAP_TYPE_PSSTATUS"
-#define DPSCAP_TYPE_NOOP "_ADOBE_DPSCAP_TYPE_NOOP"
-#define DPSCAP_TYPE_SYNC "_ADOBE_DPSCAP_TYPE_SYNC"
-#define DPSCAP_TYPE_XERROR "_ADOBE_DPSCAP_TYPE_XERROR"
-#define DPSCAP_TYPE_PSREADY "_ADOBE_DPSCAP_TYPE_PSREADY"
-#define DPSCAP_TYPE_RESUME "_ADOBE_DPSCAP_TYPE_RESUME"
-
-#define DPSCAP_ATOMS 8
-
-/* Translate argument names for X_CAPSetArg, see dpsNXargs.h */
-
-#define DPSCAP_ARG_SMALLFONTS 1
-#define DPSCAP_ARG_PIXMEM 2
-
-#endif /* _DPSCAP_h */
diff --git a/xc/lib/dps/DPSCAPClient.h b/xc/lib/dps/DPSCAPClient.h
deleted file mode 100644
index c3930bc74..000000000
--- a/xc/lib/dps/DPSCAPClient.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * DPSCAPClient.h -- DPSCAP client definitions
- *
- * (c) Copyright 1990-1994 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
- */
-
-#ifndef DPSCAPCLIENT_H
-#define DPSCAPCLIENT_H 1
-
-#include "DPSCAP.h"
-#include "DPSCAPproto.h"
-#include <X11/Xlib.h>
-#ifndef Xmalloc
-#endif
-#include <DPS/XDPSlib.h>
-
-/* === DEFINES === */
-
-#ifndef _NFILE
-#define _NFILE 128
-#endif
-
-#define DPSCAPFAILED -1
-#define DPSCAPSUCCESS 0
-
-#define DPSGCBITS \
-(GCPlaneMask|GCSubwindowMode|GCClipXOrigin|GCClipYOrigin|GCClipMask)
-
-/* === TYPEDEFS === */
-
-typedef enum {
- dpscap_nopad,
- dpscap_pad,
- dpscap_insert,
- dpscap_append
-} DPSCAPIOFlags;
-
-typedef struct _t_DPSCAPData {
- struct _t_DPSCAPData *next;
- Display *dpy;
- /* shadow connection to agent */
- Display *agent; /* Dummy display structure is agent */
- char *otherConnID; /* VMS AST? */
- XExtCodes *codes;
- XExtData *extData; /* Back pointer for clearing private */
- Atom typePSOutput;
- Atom typePSOutputWithLen;
- Atom typePSStatus;
- Atom typeNoop;
- Atom typeSync;
- Atom typeXError;
- Atom typePSReady; /* L2-DPS/PROTO 9 addition */
- Atom typeResume;
- unsigned long saveseq;
- int dpscapVersion;
- Window agentWindow;
-} DPSCAPDataRec, *DPSCAPData;
-
-typedef struct {
- struct _t_DPSCAPData *head; /* list of active agent connections */
- char *defaultAgentName; /* settable agent name */
- char *map[_NFILE]; /* map DPY_NUMBER to agent name */
-} DPSCAPGlobalsRec, *DPSCAPGlobals;
-
-/* === GLOBALS === */
-
-extern DPSCAPGlobals gCSDPS;
-
-/* === PUBLIC PROCS === */
-
-extern int CSDPSInit(/* Display *dpy, int *numberType, char **floatingName */);
-
-extern XExtData **CSDPSHeadOfDpyExt(/* Display *dpy */);
-
-/* === SUPPORT PROCS === */
-
-extern void DPSCAPChangeGC(/* Display *agent, GC gc, unsigned long valuemask, XGCValues *values */);
-
-extern DPSCAPData DPSCAPCreate(/* Display *dpy, *agent */);
-
-extern int DPSCAPDestroy(/* DPSCAPData my */);
-
-extern XExtData * DPSCAPOpenAgent(/* Display *dpy, char *trueDisplayName */);
-
-extern void DPSCAPRead(/* DPSCAPData my, char *buf, unsigned len, DPSCAPIOFlags includePad */);
-
-extern void DPSCAPStartUp();
-
-extern void DPSCAPWrite(/* DPSCAPData my, char *buf, unsigned len, DPSCAPIOFlags writePad, bufMode */);
-
-/* ext callback hooks */
-
-extern int DPSCAPCloseDisplayProc(/* Display *dpy, XExtCodes *codes */);
-
-extern int DPSCAPGrabServerProc(/* Display *dpy, XExtCodes *codes */);
-
-extern int DPSCAPUngrabServerProc(/* Display *dpy, XExtCodes *codes */);
-
-extern void DPSCAPCloseAgent(/* Display *agent */);
-
-/* === NEW HOOKS INTO XLIB === */
-
-#ifdef XXX
-extern int (*XESetGrabServer(/* Display *dpy, int extension, int (*proc)() */))();
-
-extern int (*XESetUngrabServer(/* Display *dpy, int extension, int (*proc)() */))();
-#endif /* XXX */
-
-#endif /* DPSCAPCLIENT_H */
-
diff --git a/xc/lib/dps/DPSCAPproto.h b/xc/lib/dps/DPSCAPproto.h
deleted file mode 100644
index e35487b2b..000000000
--- a/xc/lib/dps/DPSCAPproto.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * DPSCAPproto.h -- CAP requests constants and alignment values,
- * analgous to Xproto.h
- *
- * (c) Copyright 1991-1994 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
- */
-
-
-#ifndef _DPSCAPproto_h
-#define _DPSCAPproto_h
-
-/* === DEFINITIONS === */
-
-#define DPSCAPPROTOVERSION 3
-#define DPSCAPPROTOVERSION_2 2
-
-#define CSDPSPORT 6016 /* add agent instance number */
-#define DPS_NX_SERV_NAME "dpsnx" /* name to look up in /etc/services */
-
-/* Request Opcodes */
-
-#define DPSCAPOPCODEBASE 126
-#define DPSXOPCODEBASE 125
-
-#define X_CAPFlushAgent 1
-#define X_CAPNotify 2
-#define X_CAPSetArg 3
-
-/* === REQUESTS === */
-
-typedef struct _CAPConnSetup {
- BYTE byteorder; /* #x42 MSB, #x6C LSB */
- BYTE dpscapVersion; /* proto version of connecting client */
- CARD16 flags B16; /* functional hint flags */
- CARD32 libraryversion B32; /* as for XPSInit */
- CARD16 authProtoNameLength B16; /* in bytes */
- CARD16 authProtoDataLength B16; /* in bytes */
- CARD16 displayStringLength B16; /* in bytes */
- CARD16 nodeStringLength B16; /* in bytes */
- CARD16 transportStringLength B16; /* in bytes */
- CARD16 display B16; /* Display number */
- CARD16 screen B16; /* Screen number */
- CARD16 reserved B16;
- CARD32 clientWindow B32; /* window for ClientMessage */
-} xCAPConnSetupReq;
-#define sz_xCAPConnSetupReq 28
-
-typedef struct {
- BYTE success;
- BYTE reasonLength;
- CARD16 additionalLength B16;
-} xCAPConnReplyPrefix;
-#define sz_xCAPConnReplyPrefix 4
-
-typedef struct _CAPConnFailed {
- BYTE success; /* failed = 0, success = 1 */
- BYTE reasonLength; /* in bytes if failed, ignore if success */
- CARD16 additionalLength B16;/* quadbytes ADDITIONAL length */
- CARD32 serverVersion B32; /* as for XPSInit */
- CARD8 dpscapVersion; /* proto version of agent */
- CARD8 pad;
- CARD16 reserved B16;
-} xCAPConnFailed;
-#define sz_xCAPConnFailed 12
-
-typedef struct _CAPConnSuccess {
- BYTE success; /* failed = 0, success = 1 */
- BYTE reasonLength; /* in bytes if failed, ignore if success */
- CARD16 additionalLength B16;/* quadbytes ADDITIONAL length */
- CARD32 serverVersion B32; /* as for XPSInit */
- CARD8 dpscapVersion; /* proto version of agent */
- CARD8 reserved;
- CARD16 flagsUsed B16; /* mask of functional hint flags used */
- CARD32 preferredNumberFormat B32; /* as for XPSInit */
- CARD32 floatingNameLength B32; /* as for XPSInit */
- CARD32 agentWindow B32; /* client sends messages to this window */
-} xCAPConnSuccess;
-#define sz_xCAPConnSuccess 24
-
-typedef struct _CAPFlushAgent {
- CARD8 reqType; /* always DPSCAPOPCODEBASE */
- CARD8 type; /* always X_CAPFlushAgent */
- CARD16 length B16; /* quadbyte length of request */
- CARD32 cxid B32; /* context XID */
-} xCAPFlushAgentReq;
-#define sz_xCAPFlushAgentReq 8
-
-typedef struct _CAPNotify {
- CARD8 reqType; /* always DPSCAPOPCODEBASE */
- CARD8 type; /* always X_CAPNotify */
- CARD16 length B16; /* quadbyte length of request */
- CARD32 cxid B32; /* context XID */
- CARD32 notification B32; /* notify code */
- CARD32 data B32; /* data word */
- CARD32 extra B32; /* extra word */
-} xCAPNotifyReq;
-#define sz_xCAPNotifyReq 20
-
-typedef struct _CAPSetArg {
- CARD8 reqType; /* always DPSCAPOPCODEBASE */
- CARD8 type; /* always X_CAPNotify */
- CARD16 length B16; /* quadbyte length of request */
- CARD32 arg B32; /* argument type */
- CARD32 val B32; /* value */
-} xCAPSetArgReq;
-#define sz_xCAPSetArgReq 12
-
-/* === ERRORS === */
-
-typedef struct _DPSCAPError {
- BYTE type; /* always 0 */
- BYTE errorCode; /* always 255 */
- CARD16 sequenceNumber B16; /* the nth request from this client */
- CARD8 subLength; /* how much of 21 bytes are used */
- CARD8 unused;
- CARD16 reserved B16;
- CARD16 minorOpcode B16;
- CARD8 majorOpcode; /* always 0 */
- BYTE subData1;
- CARD32 subData2 B32;
- CARD32 subData3 B32;
- CARD32 subData4 B32;
- CARD32 subData5 B32;
- CARD32 subData6 B32;
- CARD32 subData7 B32;
-} xDPSCAPError;
-
-/* === EVENTS === */
-
-/* Events sent from agent to client via XSendEvent */
-
-#define DPSCAP_OUTPUT_OVERHEAD 4
-#define DPSCAP_BYTESPEROUTPUTEVENT (20 - DPSCAP_OUTPUT_OVERHEAD)
-#define DPSCAP_DATA_LEN (DPSCAP_BYTESPEROUTPUTEVENT-1)
-
-typedef struct {
- CARD32 cxid;
- CARD8 data[DPSCAP_BYTESPEROUTPUTEVENT];
-} DPSCAPOutputEvent;
-
-typedef struct {
- BYTE status;
- BYTE unused;
- CARD16 sequenceNumber;
- CARD32 cxid;
-} DPSCAPStatusEvent;
-
-#endif /* _DPSCAPproto_h */
diff --git a/xc/lib/dps/Imakefile b/xc/lib/dps/Imakefile
deleted file mode 100644
index d2d003921..000000000
--- a/xc/lib/dps/Imakefile
+++ /dev/null
@@ -1,319 +0,0 @@
-XCOMM $XFree86: xc/lib/dps/Imakefile,v 1.6 2000/02/16 15:34:27 dawes Exp $
-
-#define DoNormalLib NormalLibDps
-#define DoSharedLib SharedLibDps
-#define DoExtraLib SharedLibDps
-#define DoDebugLib DebugLibDps
-#define DoProfileLib ProfileLibDps
-#define LibName dps
-#define SoRev SODPSREV
-#define IncSubdir DPS
-
-XCOMM The Client Library uses definitions just like Xlib for network
-XCOMM capabilities, such as TCPCONN, UNIXCONN, and DNETCONN. See
-XCOMM csconndi.c and csopendi.c
-
-XCOMM The connection code should be rewritten to use xtrans. The STREAMSCONN
-XCOMM code here needs work. For now force ConnectionFlags to be
-XCOMM -DTCPCONN -DUNIXCONN
-
-#undef ConnectionFlags
-#define ConnectionFlags -DTCPCONN -DUNIXCONN
-
- DEFINES = -DXDPS -DCSDPS ConnectionFlags
- CAT = cat
- SED = sed
- AWK = awk
- SORT = sort
- PSWRAPSRC = $(TOP)/config/pswrap
- PSWRAP = $(PSWRAPSRC)/pswrap
-
-
-COMMONOBJECTFILES = \
- dpsclient.o\
- dpsprintf.o\
- dpsexcept.o\
- dpsdict.o\
- dpsabbrev.o
-
-COMMONSOURCEFILES = \
- dpsclient.c\
- dpsprintf.c\
- dpsexcept.c\
- dpsdict.c\
- dpsabbrev.c
-
-XOBJECTFILES = \
- dpsXclient.o\
- dpssysnames.o\
- dpsXpriv.o\
- XDPS.o\
- dpsXtdisp.o\
- dpsXcmu.o
-
-XSOURCEFILES = \
- dpsXclient.c\
- dpssysnames.c\
- dpsXpriv.c\
- XDPS.c\
- dpsXtdisp.c\
- dpsXcmu.c
-
-XCSDPSOBJECTFILES = \
- cslibext.o\
- csopendi.o\
- csconndi.o\
- csstartNX.o\
- csfindNX.o\
- cslibint.o
-
-XCSDPSSOURCEFILES = \
- cslibext.c\
- csopendi.c\
- csconndi.c\
- csstartNX.c\
- csfindNX.c\
- cslibint.c
-
-DPSOPSOBJECTS = \
- dpsclrops.o\
- dpsctrlops.o\
- dpsctxtops.o\
- dpsdataops.o\
- dpsfontops.o\
- dpsgsttops.o\
- dpsioops.o\
- dpsmathops.o\
- dpsmtrxops.o\
- dpsmiscops.o\
- dpspntops.o\
- dpspathops.o\
- dpssysops.o\
- dpswinops.o\
- dpsopstack.o\
- dpsXops.o\
- dpsl2ops.o
-
-PSOPSOBJECTS = \
- psclrops.o\
- psctrlops.o\
- psctxtops.o\
- psdataops.o\
- psfontops.o\
- psgsttops.o\
- psioops.o\
- psmathops.o\
- psmtrxops.o\
- psmiscops.o\
- pspntops.o\
- pspathops.o\
- pssysops.o\
- pswinops.o\
- psopstack.o\
- psXops.o\
- psl2ops.o
-
-DPSOPSHEADERFILES = \
- dpsclrops.h\
- dpsctrlops.h\
- dpsctxtops.h\
- dpsdataops.h\
- dpsfontops.h\
- dpsgsttops.h\
- dpsioops.h\
- dpsmathops.h\
- dpsmtrxops.h\
- dpsmiscops.h\
- dpsopstack.h\
- dpspntops.h\
- dpspathops.h\
- dpssysops.h\
- dpswinops.h\
- dpsXops.h\
- dpsl2ops.h
-
-PSOPSHEADERFILES = \
- psclrops.h\
- psctrlops.h\
- psctxtops.h\
- psdataops.h\
- psfontops.h\
- psgsttops.h\
- psioops.h\
- psmathops.h\
- psmtrxops.h\
- psmiscops.h\
- pspntops.h\
- pspathops.h\
- pssysops.h\
- pswinops.h\
- psopstack.h\
- psXops.h\
- psl2ops.h
-
-DPSOPSCFILES = \
- dpsclrops.c\
- dpsctrlops.c\
- dpsctxtops.c\
- dpsdataops.c\
- dpsfontops.c\
- dpsgsttops.c\
- dpsioops.c\
- dpsmathops.c\
- dpsmtrxops.c\
- dpsmiscops.c\
- dpsopstack.c\
- dpspntops.c\
- dpspathops.c\
- dpssysops.c\
- dpswinops.c\
- dpsXops.c\
- dpsl2ops.c
-
-PSOPSCFILES = \
- psclrops.c\
- psctrlops.c\
- psctxtops.c\
- psdataops.c\
- psfontops.c\
- psgsttops.c\
- psioops.c\
- psmathops.c\
- psmtrxops.c\
- psmiscops.c\
- pspntops.c\
- pspathops.c\
- pssysops.c\
- pswinops.c\
- psopstack.c\
- psXops.c\
- psl2ops.c
-
-DPSOPSANSIHEADERFILES = \
- dpsclrops.ah\
- dpsctrlops.ah\
- dpsctxtops.ah\
- dpsdataops.ah\
- dpsfontops.ah\
- dpsgsttops.ah\
- dpsioops.ah\
- dpsmathops.ah\
- dpsmtrxops.ah\
- dpsmiscops.ah\
- dpsopstack.ah\
- dpspntops.ah\
- dpspathops.ah\
- dpssysops.ah\
- dpswinops.ah\
- dpsXops.ah\
- dpsl2ops.ah
-
-PSOPSANSIHEADERFILES = \
- psclrops.ah\
- psctrlops.ah\
- psctxtops.ah\
- psdataops.ah\
- psfontops.ah\
- psgsttops.ah\
- psioops.ah\
- psmathops.ah\
- psmtrxops.ah\
- psmiscops.ah\
- pspntops.ah\
- pspathops.ah\
- pssysops.ah\
- pswinops.ah\
- psopstack.ah\
- psXops.ah\
- psl2ops.ah
-
-includes:: $(DPSOPSCFILES) $(PSOPSCFILES)
-
-$(DPSOPSCFILES) $(PSOPSCFILES): $(PSWRAP)
-
-XCOMM Unless you have a completely and thoroughly ANSI-C environment, dont run
-XCOMM pswrap on the singleops with -a (ANSI C). Many of the procedures have
-XCOMM float arguments, and if you run pswrap with -a these become really and
-XCOMM truly floats instead of the doubles they are automatically promoted
-XCOMM to under non-ANSI C. The resulting library cannot be linked with
-XCOMM code compiled with a non-ANSI C compiler.
-
-SRCS = \
- ${COMMONSOURCEFILES} \
- ${XSOURCEFILES} \
- ${XCSDPSSOURCEFILES} \
- ${DPSOPSCFILES} \
- ${PSOPSCFILES}
-
-OBJS = \
- ${COMMONOBJECTFILES} \
- ${XOBJECTFILES} \
- ${XCSDPSOBJECTFILES} \
- ${DPSOPSOBJECTS} \
- ${PSOPSOBJECTS}
-
-DERIVED_FILES = $(DPSOPSHEADERFILES) $(PSOPSHEADERFILES) \
- $(DPSOPSANSIHEADERFILES) $(PSOPSANSIHEADERFILES) \
- $(DPSOPSCFILES) $(PSOPSCFILES)
-
-#include <Library.tmpl>
-
-.SUFFIXES: .psw .ah .h
-
-.psw.c : ProgramTargetName($(PSWRAP))
- RunProgram(PSWRAP,-o $*.c -h $*.h $<)
-
-.psw.ah : ProgramTargetName($(PSWRAP))
- RunProgram(PSWRAP,-a -h $*.ah $< > /dev/null)
-
-.psw.h : ProgramTargetName($(PSWRAP))
- RunProgram(PSWRAP,-h $*.h $< > /dev/null)
-
-ProgramTargetName($(PSWRAP)):
- @echo "checking $@ over in $(PSWRAPSRC) first..."; \
- cd $(PSWRAPSRC) && $(MAKE); \
- echo "okay, continuing in $(CURRENT_DIR)"
-
-HEADERS = psops.h dpsops.h
-
-all :: psops.h dpsops.h
-
-psops.h : $(PSOPSHEADERFILES) $(PSOPSANSIHEADERFILES)
- $(RM) $@
- ${CAT} $(PSOPSHEADERFILES) |\
- ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\
- -e '/^ gener/D' -e '/^.\//D' |\
- ${SORT} > .sort
- ${AWK} '/;/ {print; printf("\n");}' .sort > .ttt
- ${CAT} $(PSOPSANSIHEADERFILES) |\
- ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\
- -e '/^ gener/D' -e '/^.\//D'\
- -e 's/float \([a-zA-Z][a-zA-Z0-9]*[,\)]\)/double \1/g' |\
- ${SORT} > .sort
- ${AWK} '/;/ {print; printf("\n");}' .sort > .attt
- ${CAT} psname.txt header.txt psifdef.txt .ttt else.txt .attt\
- psendif.txt > psops.h
- ${RM} .sort .ttt .attt
-
-dpsops.h : $(DPSOPSHEADERFILES) $(DPSOPSANSIHEADERFILES)
- $(RM) $@
- ${CAT} $(DPSOPSHEADERFILES) |\
- ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\
- -e '/^ gener/D' -e '/^.\//D' |\
- ${SORT} > .sort
- ${AWK} '/;/ {print; printf("\n");}' .sort > .ttt
- ${CAT} $(DPSOPSANSIHEADERFILES) |\
- ${SED} -e '/^$$/D' -e '/#/D' -e '/^\//D'\
- -e '/^ gener/D' -e '/^.\//D'\
- -e 's/float \([a-zA-Z][a-zA-Z0-9]*[,\)]\)/double \1/g' |\
- ${SORT} > .sort
- ${AWK} '/;/ {print; printf("\n");}' .sort > .attt
- ${CAT} dpsname.txt header.txt dpsifdef.txt .ttt else.txt .attt\
- dpsendif.txt > dpsops.h
- ${RM} .sort .ttt .attt
-
-clean ::
- ${RM} $(DERIVED_FILES) .sort .ttt .att psops.h dpsops.h *%
-
-DependTarget()
-
diff --git a/xc/lib/dps/XDPS.c b/xc/lib/dps/XDPS.c
deleted file mode 100644
index b945a4c8c..000000000
--- a/xc/lib/dps/XDPS.c
+++ /dev/null
@@ -1,2330 +0,0 @@
-/*
- * XDPS.c -- implementation of low-level Xlib routines for XDPS extension
- *
- * (c) Copyright 1989-1994 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
- */
-
-#define NEED_EVENTS
-#define NEED_REPLIES
-
-#include <stdio.h>
-/* Include this first so that Xasync.h, included from Xlibint.h, can find
- the definition of NOFILE */
-#include <sys/param.h>
-#include <X11/Xlibint.h>
-#include "cslibint.h"
-#include "DPS/XDPS.h"
-#include "DPS/XDPSproto.h"
-#include "DPS/XDPSlib.h"
-#include "DPS/dpsNXargs.h"
-#include <X11/Xatom.h>
-#include <X11/Xutil.h>
-#include "dpsassert.h"
-#include "DPSCAPClient.h"
-
-/* === DEFINITIONS === */
-
-#ifndef _NFILE
-#define DPSMAXDISPLAYS 128
-#else
-#define DPSMAXDISPLAYS _NFILE
-#endif /* _NFILE */
-
-#define MajorOpCode(dpy) (Codes[DPY_NUMBER(dpy)] ? \
- Codes[DPY_NUMBER(dpy)]->major_opcode : \
- Punt())
-
-#define DPSCAP_INITCTXTS 4 /* per display */
-
-/* === TYPES === */
-
-typedef Status (*PSCMProc)();
-
-typedef struct {
- char passEvents;
- char wrapWaiting;
- char syncMask; /* CSDPS only */
- char debugMask; /* CSDPS only */
-} DPSDisplayFlags;
-
-/* For now DPSDisplayFlags is no larger than a pointer. Revisit this if the
- structure grows. */
-
-typedef int (*GenericProcPtrReturnsInt)();
-
-typedef struct _t_DPSCAPPausedContextData {
- struct _t_DPSCAPPausedContextData *next;
- Bool paused;
- ContextXID cxid;
- unsigned int seqnum;
-} DPSCAPPausedContextData;
-
-typedef struct {
- char showSmallSizes;
- char pixMem;
-} DPSCAPAgentArgs;
-
-typedef struct {
- int (*Flush)();
- int (*Read)();
- int (*ReadPad)();
- Status (*Reply)();
- int (*Send)();
-} XDPSLIOProcs;
-
-/* === GLOBALS === */
-
-/* For debugging, allows client to force the library to use an agent */
-int gForceCSDPS = 0;
-
-/* Force all DPS NX protocol requests to flush if CSDPS */
-int gAutoFlush = 1;
-
-/* Force all NX XDPSLGiveInputs to flush independent of gAutoFlush */
-int gForceFlush = 1;
-
-/* Quick check for any paused contexts */
-int gTotalPaused = 0;
-
-/* === LOCALS === */
-
-/* Common stuff */
-static XExtCodes *Codes[DPSMAXDISPLAYS];
-static int version[DPSMAXDISPLAYS];
-static XDPSLEventHandler StatusProc[DPSMAXDISPLAYS];
-static DPSDisplayFlags displayFlags[DPSMAXDISPLAYS];
-static XDPSLEventHandler TextProc = NULL;
-static XDPSLEventHandler ReadyProc[DPSMAXDISPLAYS]; /* L2-DPS/PROTO 9 */
-static int NumberType[DPSMAXDISPLAYS]; /* Garbage okay after dpy closed */
-static char *FloatingName[DPSMAXDISPLAYS]; /* Garbage okay after dpy closed */
-
-/* CSDPS stuff */
-static Display *ShuntMap[DPSMAXDISPLAYS];
-static PSCMProc ClientMsgProc[DPSMAXDISPLAYS];
-static GenericProcPtrReturnsInt AfterProcs[DPSMAXDISPLAYS];
-static DPSCAPPausedContextData *PausedPerDisplay[DPSMAXDISPLAYS];
-static DPSCAPAgentArgs AgentArgs[DPSMAXDISPLAYS];
-static unsigned int LastXRequest[DPSMAXDISPLAYS];
-static int GCFlushMode[DPSMAXDISPLAYS];
-
-#ifdef VMS
-static Display *dpys[DPSMAXDISPLAYS];
-static nextDpy = 0;
-#endif /* VMS */
-
-static void DPSCAPInitGC();
-static Bool DPSCAPResumeWithIX();
-static Status DPSCAPClientMessageProc();
-static int DPSCAPAfterProc();
-static unsigned int DPSCAPSetPause();
-static Bool DPSCAPResumeContext();
-static Bool WaitForSyncProc();
-
-static XDPSLIOProcs xlProcs = { /* Use these for DPS/X extension */
- _XFlush,
- _XRead,
- _XReadPad,
- _XReply,
- _XSend
- };
-
-static XDPSLIOProcs nxlProcs = { /* Use these for NX */
- N_XFlush,
- N_XRead,
- N_XReadPad,
- N_XReply,
- N_XSend
- };
-
-/* === MACROS === */
-
-#define IFNXSETCALL(a, x) call = ((a) != (x)) ? &nxlProcs : &xlProcs
-
-/* === PRIVATE PROCS === */
-
-static int Punt()
-{
- DPSFatalProc(NULL, "Extension has not been initialized");
- exit(1);
-}
-
-#ifdef VMS
-/* This is a terribly inefficient way to find a per-display index, but we
- need it till we get dpy->fd fixed in VMS%%%%%*/
-static int FindDpyNum(dpy)
-{
-int i;
-for (i=0; dpys[i] != dpy ; i++)
- {
- if (i == nextDpy)
- {
- dpys[nextDpy++]=dpy;
- break;
- }
- }
-return i;
-}
-#define DPY_NUMBER(dpy) FindDpyNum(dpy)
-#else /* VMS */
-#define DPY_NUMBER(dpy) ((dpy)->fd)
-#endif /* VMS */
-
-/* === PROCEDURES === */
-
-/* ARGSUSED */
-void
-XDPSLSetTextEventHandler(dpy, proc)
- Display *dpy;
- XDPSLEventHandler proc;
-{
- TextProc = proc;
-}
-
-/* ARGSUSED */
-void
-XDPSLCallOutputEventHandler(dpy, event)
- Display *dpy;
- XEvent *event;
-{
- (*TextProc)(event);
-}
-
-void
-XDPSLSetStatusEventHandler(dpy, proc)
- Display *dpy;
- XDPSLEventHandler proc;
-{
- StatusProc[DPY_NUMBER(dpy)] = proc;
-}
-
-void
-XDPSLCallStatusEventHandler(dpy, event)
- Display *dpy;
- XEvent *event;
-{
- (*(StatusProc[DPY_NUMBER(dpy)]))(event);
-}
-
-/* Added for L2-DPS/PROTO 9 */
-void
-XDPSLSetReadyEventHandler(dpy, proc)
- Display *dpy;
- XDPSLEventHandler proc;
-{
- ReadyProc[DPY_NUMBER(dpy)] = proc;
-}
-
-/* Added for L2-DPS/PROTO 9 */
-void
-XDPSLCallReadyEventHandler(dpy, event)
- Display *dpy;
- XEvent *event;
-{
- (*(ReadyProc[DPY_NUMBER(dpy)]))(event);
-}
-
-/* Added for L2-DPS/PROTO 9 */
-int
-XDPSLGetVersion(dpy)
- Display *dpy;
-{
- return(version[DPY_NUMBER(dpy)]);
-}
-/* See CSDPS additions for XDPSLSetVersion */
-
-void
-XDPSLInitDisplayFlags(dpy)
- Display *dpy;
-{
- int d = DPY_NUMBER(dpy);
- displayFlags[d].wrapWaiting = False;
-
- /* Instead of explicitly setting the pass-event flag, rely upon the fact
- that it gets initialized to 0 by the compiler. This means that you
- can set the event delivery mode on a display before creating any
- contexts, which is a Good Thing */
-}
-
-XExtCodes *XDPSLGetCodes(dpy)
- Display *dpy;
-{
- return Codes[DPY_NUMBER(dpy)];
-}
-
-/* ARGSUSED */
-static int
-CloseDisplayProc(dpy, codes)
-Display *dpy;
-XExtCodes *codes;
-{
- extern void XDPSPrivZapDpy();
-
- /* This proc is for native DPS/X only, not CSDPS */
- Codes[DPY_NUMBER(dpy)] = NULL;
- /* Clear list */
- XDPSPrivZapDpy(dpy);
-#ifdef VMS
- dpys[DPY_NUMBER(dpy)] = NULL;
- /*%%%%Temp till we fix dpy->fd*/
-#endif /* VMS */
-}
-
-Bool
-XDPSLGetPassEventsFlag(dpy)
- Display *dpy;
-{
- return displayFlags[DPY_NUMBER(dpy)].passEvents;
-}
-
-void
-XDPSLSetPassEventsFlag(dpy, flag)
- Display *dpy;
- Bool flag;
-{
- displayFlags[DPY_NUMBER(dpy)].passEvents = flag;
-}
-
-Bool
-XDPSLGetWrapWaitingFlag(dpy)
- Display *dpy;
-{
- return displayFlags[DPY_NUMBER(dpy)].wrapWaiting;
-}
-
-void
-XDPSLSetWrapWaitingFlag(dpy, flag)
- Display *dpy;
- Bool flag;
-{
- displayFlags[DPY_NUMBER(dpy)].wrapWaiting = flag;
-}
-
-static Status
-ConvertOutputEvent(dpy, ce, we)
- Display *dpy;
- XEvent *ce;
- xEvent *we;
-{
- register PSOutputEvent *wireevent = (PSOutputEvent *) we;
- register XDPSLOutputEvent *clientevent = (XDPSLOutputEvent *) ce;
-
- clientevent->type = wireevent->type & 0x7f;
- clientevent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *)wireevent);
- clientevent->send_event = (wireevent->type & 0x80) != 0;
- clientevent->display = dpy;
- clientevent->cxid = wireevent->cxid;
- clientevent->length = wireevent->length;
- bcopy((char *) wireevent->data, clientevent->data, wireevent->length);
- if (TextProc && !XDPSLGetPassEventsFlag(dpy)) {
- (*TextProc)((XEvent *) clientevent);
- return False;
- }
- return True;
-}
-
-static Status
-ConvertStatusEvent(dpy, ce, we)
- Display *dpy;
- XEvent *ce;
- xEvent *we;
-{
- register PSStatusEvent *wireevent = (PSStatusEvent *) we;
- register XDPSLStatusEvent *clientevent = (XDPSLStatusEvent *) ce;
-
- clientevent->type = wireevent->type & 0x7f;
- clientevent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *)wireevent);
- clientevent->send_event = (wireevent->type & 0x80) != 0;
- clientevent->display = dpy;
- clientevent->cxid = wireevent->cxid;
- clientevent->status = wireevent->status;
- if (StatusProc[DPY_NUMBER(dpy)] && !XDPSLGetPassEventsFlag(dpy)) {
- (*(StatusProc[DPY_NUMBER(dpy)]))((XEvent *) clientevent);
- return False;
- }
- return True;
-}
-
-/* Added for L2-DPS/PROTO 9 */
-static Status
-ConvertReadyEvent(dpy, ce, we)
- Display *dpy;
- XEvent *ce;
- xEvent *we;
-{
- register PSReadyEvent *wireevent = (PSReadyEvent *) we;
- register XDPSLReadyEvent *clientevent = (XDPSLReadyEvent *) ce;
-
- clientevent->type = wireevent->type & 0x7f;
- clientevent->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *)wireevent);
- clientevent->send_event = (wireevent->type & 0x80) != 0;
- clientevent->display = dpy;
- clientevent->cxid = wireevent->cxid;
- clientevent->val[0] = wireevent->val1;
- clientevent->val[1] = wireevent->val2;
- clientevent->val[2] = wireevent->val3;
- clientevent->val[3] = wireevent->val4;
- if (ReadyProc[DPY_NUMBER(dpy)] && !XDPSLGetPassEventsFlag(dpy)) {
- (*(ReadyProc[DPY_NUMBER(dpy)]))((XEvent *) clientevent);
- return False;
- }
- return True;
-}
-
-/* Added for L2-DPS/PROTO 9 */
-/* ARGSUSED */
-
-static int
-CatchBadMatch(dpy, err, codes, ret_code)
- Display *dpy;
- xError *err;
- XExtCodes *codes;
- int *ret_code;
-{
- if (err->errorCode == BadMatch)
- {
- *ret_code = 0;
- return 1; /* suppress error */
- }
- else
- {
- *ret_code = 1;
- return 0; /* pass error along */
- }
-}
-
-
-int
-XDPSLInit(dpy, numberType, floatingName)
- Display *dpy;
- int *numberType; /* RETURN */
- char **floatingName; /* RETURN: CALLER MUST NOT MODIFY OR FREE! */
-{
- XExtCodes *codes = (XExtCodes *)NULL;
- register xPSInitReq *req;
- xPSInitReply rep;
- char *ptr;
- int first_event;
-
- {
- char *ddt;
- extern char *getenv();
-
- if ((ddt = getenv("DPSNXOVER")) != NULL) {
- gForceCSDPS = (*ddt == 't' || *ddt == 'T');
- if (gForceCSDPS)
- DPSWarnProc(NULL, "*** USING DPS NX ***");
- }
- }
-
- if ((codes = Codes[DPY_NUMBER(dpy)]) != NULL) {
- if (numberType)
- *numberType = NumberType[DPY_NUMBER(dpy)];
- if (floatingName)
- *floatingName = FloatingName[DPY_NUMBER(dpy)];
- return codes->first_event;
- } else {
- if (gForceCSDPS)
- goto try_dps_nx;
- codes = XInitExtension(dpy, DPSNAME);
- if (codes == NULL) {
- /* try DEC UWS 2.2 server */
- codes = XInitExtension(dpy, DECDPSNAME);
-try_dps_nx:
- if (codes == NULL) {
- int myNumberType;
- char *myFloatingName;
-
- first_event = CSDPSInit(dpy, &myNumberType, &myFloatingName);
- NumberType[DPY_NUMBER(dpy)] = myNumberType;
- FloatingName[DPY_NUMBER(dpy)] = myFloatingName;
- if (numberType)
- *numberType = myNumberType;
- if (floatingName)
- *floatingName = myFloatingName;
- return first_event;
- }
- }
- Codes[DPY_NUMBER(dpy)] = codes;
- ShuntMap[DPY_NUMBER(dpy)] = dpy;
- /* set procs for native DPS/X */
- XESetCloseDisplay(dpy, codes->extension, CloseDisplayProc);
- XESetWireToEvent(dpy, codes->first_event + PSEVENTOUTPUT,
- ConvertOutputEvent);
- XESetWireToEvent(dpy, codes->first_event + PSEVENTSTATUS,
- ConvertStatusEvent);
- XESetWireToEvent(dpy, codes->first_event + PSEVENTREADY,
- ConvertReadyEvent);
- first_event = codes->first_event;
- }
-
- /* We have to handle a BadMatch error, in the case where
- the client has a later (higher) version of
- the protocol than the server */
- {
- int (*oldErrorProc)();
- int libVersion;
- Bool doneIt;
-
- XSync(dpy, False);
- LockDisplay(dpy);
- oldErrorProc = XESetError(dpy, codes->extension, CatchBadMatch);
- libVersion = DPSPROTOCOLVERSION;
- doneIt = False;
- while (libVersion >= DPSPROTO_OLDEST)
- {
- GetReq(PSInit, req);
- req->reqType = MajorOpCode(dpy);
- req->dpsReqType = X_PSInit;
- req->libraryversion = libVersion;
- if (_XReply(dpy, (xReply *) &rep, 0, xFalse))
- {
- doneIt = True;
- break;
- }
- /* otherwise, try previous version */
- --libVersion;
- }
- oldErrorProc = XESetError(dpy, codes->extension, oldErrorProc);
- if (!doneIt)
- {
- DPSFatalProc(NULL, "Incompatible protocol versions");
- exit(1);
- }
-
- /* NOTE *************************************************
- We made a boo-boo in the 1007.2 and earlier versions of
- our X server glue code. Instead of sending a
- BadMatch error if the client's version is newer (higher)
- than the server's, it just replies with success. We
- could test for that situation here by looking at
- rep.serverversion, but it turns out that we don't need
- to do anything special. Since rep.serverversion gets
- assigned to our version[] array, it is as if we handled
- the BadMatch correctly. Just for safety's sake, we'll
- do some bulletproofing here instead.
- Fixes 2ps_xdps BUG #6 */
-
- else if (rep.serverversion < DPSPROTO_OLDEST
- || rep.serverversion > DPSPROTOCOLVERSION)
- {
- DPSFatalProc(NULL, "Server replied with bogus version");
- exit(1);
- }
- }
-
- version[DPY_NUMBER(dpy)] = rep.serverversion;
- NumberType[DPY_NUMBER(dpy)] = rep.preferredNumberFormat;
- if (numberType)
- *numberType = rep.preferredNumberFormat;
-
- ptr = (char *) Xmalloc(rep.floatingNameLength + 1);
- _XReadPad(dpy, ptr, rep.floatingNameLength);
- ptr[rep.floatingNameLength] = 0;
- FloatingName[DPY_NUMBER(dpy)] = ptr;
- if (floatingName)
- *floatingName = ptr;
-
- UnlockDisplay(dpy);
- SyncHandle();
- return first_event;
-}
-
-
-
-
-static void CopyColorMapsIntoCreateContextReq(req, colorcube, grayramp)
- xPSCreateContextReq *req;
- XStandardColormap *colorcube, *grayramp;
-{
- req->cmap = 0;
- if (colorcube != NULL) {
- req->cmap = colorcube->colormap;
- req->redmax = colorcube->red_max;
- req->redmult = colorcube->red_mult;
- req->greenmax = colorcube->green_max;
- req->greenmult = colorcube->green_mult;
- req->bluemax = colorcube->blue_max;
- req->bluemult = colorcube->blue_mult;
- req->colorbase = colorcube->base_pixel;
- }
- else {
- req->redmult = 0;
- /* The rest of this shouldn't be necessary, but there are some
- servers out there that erroneously check the other fields
- even when redmult is 0 */
- req->redmax = 0;
- req->greenmult = 0;
- req->greenmax = 0;
- req->bluemult = 0;
- req->bluemax = 0;
- req->colorbase = 0;
- }
-
- if (grayramp != NULL) {
- req->cmap = grayramp->colormap;
- req->graymax = grayramp->red_max;
- req->graymult = grayramp->red_mult;
- req->graybase = grayramp->base_pixel;
- }
- else req->graymult = 0;
-}
-
-
-
-
-
-
-/* ARGSUSED */
-ContextXID
-XDPSLCreateContextAndSpace(xdpy, draw, gc, x, y, eventMask, grayRamp,
- colorCube, actual, cpsid, sxid,
- secure)
- register Display *xdpy;
- Drawable draw;
- GC gc;
- int x, y;
- unsigned int eventMask;
- XStandardColormap *grayRamp,*colorCube;
- unsigned int actual;
- ContextPSID *cpsid; /* RETURN */
- SpaceXID *sxid; /* RETURN */
- Bool secure; /* Added for L2-DPS/PROTO 9 */
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- ContextXID cxid;
- register xPSCreateContextReq *req; /* Same struct for CreateSecureContext */
- xPSCreateContextReply rep;
- XStandardColormap defColorcube, defGrayramp;
- XStandardColormap *requestCube, *requestRamp;
- int index;
- XDPSLIOProcs *call;
-
- if (grayRamp == NULL && colorCube == NULL) return(None);
-
- if (secure && version[dpyix] < DPSPROTO_V09)
- return(None); /* No secure contexts before PROTO 9 */
-
- /* Index gets encoded as follows:
- *
- * 0 grayRamp = Default, colorCube = Default
- * 1 grayRamp = non-Default, colorcube = Default
- * 2 grayRamp = Default, colorcube = non-Default
- * 3 grayRamp = non-Default, colorcube = non-Default
- *
- */
- index = ((grayRamp == DefaultStdCMap || grayRamp == NULL) ? 0 : 1) +
- (colorCube == DefaultStdCMap ? 0 : 2);
-
- switch (index)
- {
- case 0: /* Both are default */
- XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw,
- &defColorcube, &defGrayramp);
- requestCube = &defColorcube;
- requestRamp = &defGrayramp;
- break;
-
- case 1: /* gray specified, Color default */
- XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw,
- &defColorcube, (XStandardColormap *) NULL);
- requestCube = &defColorcube;
- requestRamp = grayRamp;
- break;
-
- case 2: /* gray default, Color specified */
- XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw,
- (XStandardColormap *) NULL, &defGrayramp);
- requestCube = colorCube;
- requestRamp = &defGrayramp;
- break;
-
- case 3: /* Both specified */
- requestCube = colorCube;
- requestRamp = grayRamp;
- break;
- }
-
- if (gc != NULL)
- XDPSLFlushGC(xdpy, gc);
- if (dpy != xdpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* Don't worry about pauses here, since we are just
- now creating the context! */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSCreateContext, req);
- CopyColorMapsIntoCreateContextReq(req, requestCube, requestRamp);
-
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = (secure) ? X_PSCreateSecureContext : X_PSCreateContext;
- req->x = x;
- req->y = y;
- req->drawable = draw;
- req->gc = (gc != NULL) ? XGContextFromGC(gc) : None;
- cxid = req->cxid = XAllocID(xdpy);
- req->sxid = XAllocID(xdpy);
- if (sxid)
- *sxid = req->sxid;
- req->eventmask = 0; /* %%% */
- req->actual = actual;
- IFNXSETCALL(dpy, xdpy);
- (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue);
-
- if (cpsid)
- *cpsid = (int)rep.cpsid;
-
- UnlockDisplay(dpy);
- /* If the context creation succeeded and we are CSDPS, send GC values */
- if (rep.cpsid && xdpy != dpy && gc != NULL)
- {
- DPSCAPInitGC(xdpy, dpy, gc);
- }
- SyncHandle();
-
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return (cxid);
-}
-
-
-/* ARGSUSED */
-ContextXID
-XDPSLCreateContext(xdpy, sxid, draw, gc, x, y, eventMask, grayRamp,
- colorCube, actual, cpsid,
- secure)
- register Display *xdpy;
- SpaceXID sxid;
- Drawable draw;
- GC gc;
- int x, y;
- unsigned int eventMask;
- XStandardColormap *grayRamp,*colorCube;
- unsigned int actual;
- ContextPSID *cpsid; /* RETURN */
- Bool secure; /* L2-DPS/PROTO 9 addition */
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSCreateContextReq *req;
- xPSCreateContextReply rep;
- ContextXID cxid; /* RETURN */
- XStandardColormap defColorcube, defGrayramp;
- XStandardColormap *requestCube, *requestRamp;
- int index;
- XDPSLIOProcs *call;
-
- if (secure && version[dpyix] < DPSPROTO_V09)
- return(None); /* No secure contexts before PROTO 9 */
-
- /* Index gets encoded as follows:
- *
- * 0 grayRamp = Default, colorCube = Default
- * 1 grayRamp = non-Default, colorcube = Default
- * 2 grayRamp = Default, colorcube = non-Default
- * 3 grayRamp = non-Default, colorcube = non-Default
- *
- * Note that only the first or last case should ever happen.
- */
- index = ((grayRamp == DefaultStdCMap) ? 0 : 1) +
- ((colorCube == DefaultStdCMap) ? 0 : 2);
-
- switch (index)
- {
- case 0: /* Both are default */
- XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw,
- &defColorcube, &defGrayramp);
- requestCube = &defColorcube;
- requestRamp = &defGrayramp;
- break;
-
- case 1: /* gray specified, Color default */
- XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw,
- &defColorcube, (XStandardColormap *) NULL);
- requestCube = &defColorcube;
- requestRamp = grayRamp;
- break;
-
- case 2: /* gray default, Color specified */
- XDPSGetDefaultColorMaps(xdpy, (Screen *) NULL, draw,
- (XStandardColormap *) NULL, &defGrayramp);
- requestCube = colorCube;
- requestRamp = &defGrayramp;
- break;
-
- case 3: /* Both specified */
- requestCube = colorCube;
- requestRamp = grayRamp;
- break;
- }
-
-
- if (gc != NULL)
- XDPSLFlushGC(xdpy, gc);
- if (dpy != xdpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* Don't worry about pauses here, since we are
- just now creating this context! */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSCreateContext, req);
- CopyColorMapsIntoCreateContextReq(req, requestCube, requestRamp);
-
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = (secure) ? X_PSCreateSecureContext : X_PSCreateContext;
- req->x = x;
- req->y = y;
- req->drawable = draw;
- req->gc = (gc != NULL) ? XGContextFromGC(gc) : None;
- cxid = req->cxid = XAllocID(xdpy);
- req->sxid = sxid;
- req->actual = actual;
-
- IFNXSETCALL(dpy, xdpy);
- (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue);
- if (cpsid)
- *cpsid = (int)rep.cpsid;
-
- UnlockDisplay(dpy);
- /* If the context creation succeeded and we are CSDPS, send GC values */
- if (rep.cpsid && xdpy != dpy && gc != NULL)
- {
- DPSCAPInitGC(xdpy, dpy, gc);
- }
-
- SyncHandle();
-
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return cxid;
-}
-
-SpaceXID
-XDPSLCreateSpace(xdpy)
- register Display *xdpy;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSCreateSpaceReq *req;
- SpaceXID sxid;
-
- LockDisplay(dpy);
-
- NXMacroGetReq(PSCreateSpace, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSCreateSpace;
- sxid = req->sxid = XAllocID(xdpy);
-
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return sxid;
-}
-
-
-
-/*
- * I'm not sure how portable my coalescing code is, so I've provided the
- * below define. If it turns out this code just breaks somewhere, you
- * can simply undefine COALESCEGIVEINPUT, and then everything will work
- * (but slower). 6/16/89 (tw)
- */
-
-#define COALESCEGIVEINPUT
-
-void
-XDPSLGiveInput(xdpy, cxid, data, length)
-register Display *xdpy;
-ContextXID cxid;
-char *data;
-int length;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSGiveInputReq *req;
- int sendlen;
- XDPSLIOProcs *call;
- Bool didFlush = False;
-
- if (dpy != xdpy)
- {
- register int syncMask = displayFlags[dpyix].syncMask;
-
- if (syncMask & DPSCAP_SYNCMASK_RECONCILE)
- {
- XDPSLReconcileRequests(xdpy, cxid);
- didFlush = True;
- }
-
- /* If this context got paused, no matter how, ignore
- mode and resume it */
- if (gTotalPaused && DPSCAPResumeContext(xdpy, cxid))
- {
- /* xdpy was flushed by DPSCAPResumeContext */
- if (!didFlush)
- {
- N_XFlush(dpy);
- didFlush = True;
- }
- }
- else if (syncMask & DPSCAP_SYNCMASK_SYNC)
- {
- didFlush = True;
- XSync(xdpy, False);
- }
- }
- LockDisplay(dpy);
-
-#ifdef COALESCEGIVEINPUT
- req = (xPSGiveInputReq *) dpy->last_req;
- if (req->reqType == MajorOpCode(xdpy)
- && req->dpsReqType == X_PSGiveInput
- && req->cxid == cxid
- && dpy->bufptr + length + 3 < dpy->bufmax) {
- bcopy(data, ((char *) req) + sizeof(xPSGiveInputReq) + req->nunits,
- length);
- req->nunits += length;
- req->length = (sizeof(xPSGiveInputReq) + req->nunits + 3) >> 2;
- dpy->bufptr = dpy->last_req + sizeof(xPSGiveInputReq) +
- ((req->nunits + 3) & ~3);
- } else
-#endif /* COALESCEGIVEINPUT */
- {
- int flushOnce = 1;
- int maxedOutLen = xdpy->max_request_size - sizeof(xPSGiveInputReq) - 4;
- int nunits;
-
- /* We have the rare opportunity to chop up a buffer that is larger
- than the max request size into separate requests, unlike
- most other X requests (such as DrawText). The -4 is to
- force these maxed out requests to be less than the maximum
- padding that would ever be needed, and to minimize padding
- in the case where the input buffer is several times
- larger than max request length. */
-
- nunits = maxedOutLen;
- do {
- if (length < maxedOutLen)
- nunits = length; /* Normal size block */
- NXMacroGetReq(PSGiveInput, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSGiveInput;
- req->cxid = cxid;
- req->nunits = nunits;
- req->length += ((nunits + 3) >> 2);
- if (dpy != xdpy) {
- if (flushOnce && !didFlush) {
- LockDisplay(xdpy);
- _XFlush(xdpy);
- UnlockDisplay(xdpy);
- flushOnce = 0;
- }
- NXProcData(dpy, (char *) data, nunits);
- } else
- {Data(dpy, (char *) data, nunits);}
- data += nunits;
- length -= nunits;
- } while (length);
- }
-
- /* In the NX case (didFlush is always False for the non-NX case),
- the xdpy may have been flushed, but there is stuff left
- buffered in dpy (NX connection). We can't leave the stuff
- there, since we may never call a DPS routine again. Until
- we can be notified about xdpy being flushed, we have to
- clear out the dpy buffer after we cleared out the xdpy
- buffer (didFlush == True). */
-
- if (dpy != xdpy
- && dpy->bufptr != dpy->buffer
- && (gForceFlush || didFlush))
- N_XFlush(dpy);
-
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
-}
-
-
-int
-XDPSLGetStatus(xdpy, cxid)
- register Display *xdpy;
- ContextXID cxid;
-{
- int dpyix;
- Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSGetStatusReq *req;
- xPSGetStatusReply rep;
- XDPSLIOProcs *call;
-
- if (dpy != xdpy)
- {
- register int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSGetStatus, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSGetStatus;
- req->cxid = cxid;
- req->notifyIfChange = 0;
-
- IFNXSETCALL(dpy, xdpy);
- if (! (*call->Reply)(dpy, (xReply *)&rep, 0, xTrue))
- rep.status = PSSTATUSERROR;
- UnlockDisplay(dpy);
- SyncHandle();
- /* For CSDPS, guarantee that status events arrive just like DPS/X */
- if (dpy != xdpy)
- {
- XDPSLSync(xdpy);
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- }
- return (int) rep.status;
-}
-
-void
-XDPSLDestroySpace( xdpy, sxid )
- Display *xdpy;
- SpaceXID sxid;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSDestroySpaceReq *req;
-
- if (dpy != xdpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSDestroySpace, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSDestroySpace;
- req->sxid = sxid;
-
- if (gAutoFlush && dpy != xdpy)
- {
- N_XFlush(dpy);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
-}
-
-
-void
-XDPSLReset( xdpy, cxid )
- Display *xdpy;
- ContextXID cxid;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSResetReq *req;
-
- if (dpy != xdpy)
- {
- register int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSReset, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSReset;
- req->cxid = cxid;
-
- if (gAutoFlush && dpy != xdpy)
- {
- N_XFlush(dpy);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
-}
-
-void
-XDPSLNotifyContext( xdpy, cxid, ntype )
- Display *xdpy;
- ContextXID cxid;
- int ntype; /* should this be an enum?? %%% */
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSNotifyContextReq *req;
-
- if (dpy != xdpy)
- {
- register int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSNotifyContext, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSNotifyContext;
- req->cxid = cxid;
- req->notifyType = ntype;
-
- if (dpy != xdpy)
- {
- N_XFlush(dpy); /* THIS IS CRITICAL TO AVOID HANGING! */
- }
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (dpy != xdpy)
- {
- if (ntype == PSKILL)
- XDPSLCleanContext(xdpy, cxid);
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- }
-}
-
-
-ContextXID
-XDPSLCreateContextFromID( xdpy, cpsid, sxid )
- Display *xdpy;
- ContextPSID cpsid;
- SpaceXID *sxid; /* RETURN */
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSCreateContextFromIDReq *req;
- xPSCreateContextFromIDReply rep;
- ContextXID cxid;
- XDPSLIOProcs *call;
-
- if (dpy != xdpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSCreateContextFromID, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSCreateContextFromID;
- req->cpsid = cpsid;
- cxid = req->cxid = XAllocID(xdpy);
-
- IFNXSETCALL(dpy, xdpy);
- (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue);
- if (sxid)
- *sxid = (int)rep.sxid;
-
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return(cxid);
-}
-
-
-/* Returns 1 on success, 0 on failure (cpsid not a valid context). */
-
-Status
-XDPSLIDFromContext( xdpy, cpsid, cxid, sxid )
- Display *xdpy;
- ContextPSID cpsid;
- ContextXID *cxid; /* RETURN */
- SpaceXID *sxid; /* RETURN */
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSXIDFromContextReq *req;
- xPSXIDFromContextReply rep;
- XDPSLIOProcs *call;
-
- if (dpy != xdpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSXIDFromContext, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSXIDFromContext;
- req->cpsid = cpsid;
-
- IFNXSETCALL(dpy, xdpy);
- (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue);
- *sxid = (int)rep.sxid;
- *cxid = (int)rep.cxid;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return((Status)(*sxid != None && *cxid != None));
-}
-
-
-ContextPSID
-XDPSLContextFromXID( xdpy, cxid )
- Display *xdpy;
- ContextXID cxid;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSContextFromXIDReq *req;
- xPSContextFromXIDReply rep;
- XDPSLIOProcs *call;
-
- if (dpy != xdpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSContextFromXID, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSContextFromXID;
- req->cxid = cxid;
-
- IFNXSETCALL(dpy, xdpy);
- (void) (*call->Reply) (dpy, (xReply *)&rep, 0, xTrue);
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return (int)rep.cpsid;
-}
-
-
-void
-XDPSLSetStatusMask( xdpy, cxid, enableMask, disableMask, nextMask )
- Display *xdpy;
- ContextXID cxid;
- unsigned int enableMask, disableMask, nextMask;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSSetStatusMaskReq *req;
-
- if (dpy != xdpy)
- {
- register int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSSetStatusMask, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSSetStatusMask;
- req->cxid = cxid;
- req->enableMask = enableMask;
- req->disableMask = disableMask;
- req->nextMask = nextMask;
-
- if (gAutoFlush && dpy != xdpy)
- {
- N_XFlush(dpy);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
-}
-
-
-#ifdef VMS
-/*
- * _XReadPad - Read bytes from the socket taking into account incomplete
- * reads. If the number of bytes is not 0 mod 32, read additional pad
- * bytes. This routine may have to be reworked if int < long.
- */
-
-/* This is really in xlib, but is not in the sharable image transfer vector
- * so I am copying it here for now. BF
-
-The following notice applies only to the functions
-_XReadPad and XFlush
-
-Copyright 1985, 1986, 1987, 1988, 1989 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.
-
-*/
-
-_XReadPad (xdpy, data, size)
- register Display *dpy;
- register char *data;
- register long size;
-{
- static int padlength[4] = {0,3,2,1};
- register long bytes_read;
- char pad[3];
-
- CheckLock(dpy);
- if (size == 0) return;
- _XRead( dpy, data, size );
- if ( padlength[size & 3] ) {
- _XRead( dpy, pad, padlength[size & 3] );
- }
-
-}
-#endif /* VMS */
-
-/* _____________ LEVEL 2 DPS/PROTOCOL 9 ADDITIONS _____________ */
-
-void
-XDPSLNotifyWhenReady( xdpy, cxid, val )
- Display *xdpy;
- ContextXID cxid;
- int val[4];
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xPSNotifyWhenReadyReq *req;
-
- if (version[dpyix] < DPSPROTO_V09)
- {
- DPSWarnProc(NULL, "Attempted use of XDPSLNotifyWhenReady with incompatible server ignored");
- return; /* PROTO 9 or later only */
- }
-
- if (dpy != xdpy)
- {
- register int syncMask = displayFlags[dpyix].syncMask;
-
- if (syncMask & DPSCAP_SYNCMASK_RECONCILE)
- XDPSLReconcileRequests(xdpy, cxid);
-
- /* If this context got paused, no matter how, ignore
- mode and resume it */
- if (gTotalPaused && DPSCAPResumeContext(xdpy, cxid))
- {
- /* xdpy was flushed by DPSCAPResumeContext */
- if (gAutoFlush)
- N_XFlush(dpy);
- }
- else if (syncMask & DPSCAP_SYNCMASK_SYNC)
- XSync(xdpy, False);
- }
- LockDisplay(dpy);
-
- NXMacroGetReq(PSNotifyWhenReady, req);
- req->reqType = MajorOpCode(xdpy);
- req->dpsReqType = X_PSNotifyWhenReady;
- req->cxid = cxid;
- req->val1 = val[0];
- req->val2 = val[1];
- req->val3 = val[2];
- req->val4 = val[3];
-
- if (gAutoFlush && dpy != xdpy)
- {
- N_XFlush(dpy);
- }
- UnlockDisplay(dpy);
- SyncHandle();
- if (dpy != xdpy)
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
-}
-
-XDPSLPSErrors
-XDPSLTestErrorCode(dpy, ecode)
- Display *dpy;
- int ecode;
-{
- XExtCodes *c = XDPSLGetCodes(dpy);
-
- if (c == NULL)
- return False; /* Not inited on that display; must be False */
-
- switch (ecode - c->first_error)
- {
- case PSERRORBADCONTEXT: return(pserror_badcontext);
- case PSERRORBADSPACE: return(pserror_badspace);
- case PSERRORABORT:
- if (version[DPY_NUMBER(dpy)] < DPSPROTO_V09)
- return(not_pserror);
- else
- return(pserror_abort);
- default: return(not_pserror);
- }
-}
-
-/* _____________ CLIENT SIDE DPS ADDITIONS _____________ */
-
-/* === NEW HOOKS INTO XDPS === */
-
-void
-XDPSLSetVersion(dpy, ver)
- Display *dpy;
- unsigned ver;
-{
- version[DPY_NUMBER(dpy)] = ver;
-}
-
-void
-XDPSLSetCodes(dpy, codes)
- Display *dpy;
- XExtCodes *codes;
-{
- Codes[DPY_NUMBER(dpy)] = codes;
-}
-
-Display *
-XDPSLGetShunt(dpy_in)
- register Display *dpy_in;
-{
- return(ShuntMap[DPY_NUMBER(dpy_in)]);
-}
-
-void
-XDPSLSetShunt(dpy_in, dpy_out)
- Display *dpy_in, *dpy_out;
-{
- ShuntMap[DPY_NUMBER(dpy_in)] = dpy_out;
-}
-
-int
-XDPSLGetSyncMask(dpy)
- Display *dpy;
-{
- return (int)displayFlags[DPY_NUMBER(dpy)].syncMask;
-}
-
-void
-XDPSLSetSyncMask(dpy, mask)
- Display *dpy;
- int mask;
-{
- displayFlags[DPY_NUMBER(dpy)].syncMask = (char)mask;
- gForceFlush = (mask & DPSCAP_SYNCMASK_RECONCILE);
-}
-
-void
-XDPSLFlush(xdpy)
- register Display *xdpy;
-{
- register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)];
-
- _XFlush(xdpy);
- if (dpy != xdpy)
- N_XFlush(dpy);
-}
-
-void
-XDPSLSyncGCClip(xdpy, gc)
- register Display *xdpy;
- register GC gc;
-{
- register unsigned long oldDirty;
- register int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- extern int gNXSyncGCMode;
-
- /* We DON'T want to notice all gc changes, just the clip */
- oldDirty = gc->dirty;
- gc->dirty = (GCClipXOrigin|GCClipYOrigin);
- XDPSLFlushGC(xdpy, gc);
- gc->dirty = oldDirty;
- if (dpy == xdpy || gNXSyncGCMode != 1) /* 1 means sync always */
- {
- /* For DPS NX and SLOW mode, flushing the gc cache has
- the side-effect of synching agent and server connections.
- So, to have consistent behavior, we sync for the DPS/X
- or FAST cases too. */
-
- if (GCFlushMode[dpyix] == XDPSNX_GC_UPDATES_FAST
- || dpy == xdpy)
- XDPSLSync(xdpy);
- }
-}
-
-
-#ifdef VMS
-void
-XDPSLSetDisplay(dpy)
- Display *dpy;
-{
- dpys[DPY_NUMBER(dpy)] = dpy;
-}
-#endif /* VMS */
-
-char *
-XDPSLSetAgentName(dpy, name, deflt)
- Display *dpy;
- char *name;
- int deflt;
-{
- char *old;
-
- if (gCSDPS == NULL)
- DPSCAPStartUp();
- if (deflt)
- {
- old = gCSDPS->defaultAgentName;
- gCSDPS->defaultAgentName = name;
- }
- else
- {
- old = gCSDPS->map[DPY_NUMBER(dpy)];
- gCSDPS->map[DPY_NUMBER(dpy)] = name;
- }
- return(old);
-}
-
-
-void
-XDPSLSetClientMessageHandler(dpy)
- Display *dpy;
-{
- if (dpy == NULL) return;
- ClientMsgProc[DPY_NUMBER(dpy)] = XESetWireToEvent(
- dpy,
- ClientMessage,
- DPSCAPClientMessageProc);
-}
-
-void
-XDPSLSetAfterProc(xdpy)
- Display *xdpy;
-{
- if (xdpy == NULL) return;
- AfterProcs[DPY_NUMBER(xdpy)] = (GenericProcPtrReturnsInt)
- XSetAfterFunction(xdpy, DPSCAPAfterProc);
- /* +++ Consider using agent->synchandler to store old proc */
-}
-
-
-CSDPSFakeEventTypes
-XDPSLGetCSDPSFakeEventType(dpy, event)
- Display *dpy;
- XEvent *event;
-{
- XExtCodes *codes = Codes[DPY_NUMBER(dpy)];
- XExtData *extData;
- DPSCAPData my;
-
- if (event->type != ClientMessage || codes == NULL)
- return(csdps_not);
- extData = XFindOnExtensionList(
- CSDPSHeadOfDpyExt(dpy),
- codes->extension);
- if (!extData)
- return(csdps_not);
- my = (DPSCAPData) extData->private_data;
-
- if (event->xclient.message_type == my->typePSOutput)
- return(csdps_output);
- if (event->xclient.message_type == my->typePSOutputWithLen)
- return(csdps_output_with_len);
- if (event->xclient.message_type == my->typePSStatus)
- return(csdps_status);
- if (event->xclient.message_type == my->typeNoop)
- return(csdps_noop);
- if (event->xclient.message_type == my->typePSReady)
- return(csdps_ready);
- return(csdps_not);
-}
-
-Bool
-XDPSLDispatchCSDPSFakeEvent(dpy, event, t)
- Display *dpy;
- XEvent *event;
- CSDPSFakeEventTypes t;
-{
- register XDPSLOutputEvent *oce;
- register DPSCAPOutputEvent *oev;
- XDPSLOutputEvent fakeOutput;
- XExtCodes *codes = Codes[DPY_NUMBER(dpy)];
-
- if (codes == NULL)
- return(False);
-
- /* Fake up an event in the client's format. Bypasses
- extension wire-to-event conversion */
- switch (t)
- {
- case csdps_output:
- oce = &fakeOutput;
- oev = (DPSCAPOutputEvent *)event->xclient.data.b;
- oce->length = DPSCAP_BYTESPEROUTPUTEVENT;
- goto samo_samo;
- case csdps_output_with_len:
- oce = &fakeOutput;
- oev = (DPSCAPOutputEvent *)event->xclient.data.b;
- oce->length = oev->data[DPSCAP_DATA_LEN];
-samo_samo:
- oce->type = codes->first_event + PSEVENTOUTPUT;
- oce->serial = event->xclient.serial;
- oce->send_event = True; /* ??? */
- oce->display = dpy;
- oce->cxid = oev->cxid;
- bcopy((char *) oev->data, oce->data, oce->length);
- XDPSLCallOutputEventHandler(dpy, (XEvent *) oce);
- break;
- case csdps_status:
- {
- register XDPSLStatusEvent *sce;
- register DPSCAPStatusEvent *sev;
- XDPSLStatusEvent fakeStatus;
-
- sev = (DPSCAPStatusEvent *)event->xclient.data.b;
- sce = &fakeStatus;
- sce->type = codes->first_event + PSEVENTSTATUS;
- sce->serial = event->xclient.serial;
- sce->send_event = True; /* ??? */
- sce->display = dpy;
- sce->status = sev->status;
- sce->cxid = sev->cxid;
- XDPSLCallStatusEventHandler(dpy, (XEvent *) sce);
- break;
- }
- case csdps_ready: /* L2-DPS/PROTO 9 addition */
- {
- register XDPSLReadyEvent *rce;
- XDPSLReadyEvent fakeReady;
-
- rce = &fakeReady;
- rce->type = codes->first_event + PSEVENTREADY;
- rce->serial = event->xclient.serial;
- rce->send_event = True;
- rce->display = dpy;
- rce->cxid = event->xclient.data.l[0];
- rce->val[0] = event->xclient.data.l[1];
- rce->val[1] = event->xclient.data.l[2];
- rce->val[2] = event->xclient.data.l[3];
- rce->val[3] = event->xclient.data.l[4];
- XDPSLCallReadyEventHandler(dpy, (XEvent *) rce);
- break;
- }
- default:
- return(False);
- }
- return(True);
-}
-
-extern struct _t_DPSContextRec *XDPSContextFromXID();
-
-void
-XDPSLGetCSDPSStatus(xdpy, event, ret_ctxt, ret_status)
- Display *xdpy;
- XEvent *event;
- void **ret_ctxt;
- int *ret_status;
-{
- register DPSCAPStatusEvent *sev;
-
- /* Assert: event is ClientMessage with typePSStatus */
- sev = (DPSCAPStatusEvent *)event->xclient.data.b;
-
- if (ret_ctxt != NULL)
- *ret_ctxt = XDPSContextFromXID(xdpy, sev->cxid);
- if (ret_status != NULL)
- *ret_status = sev->status;
-}
-
-void
-XDPSLGetCSDPSReady(xdpy, event, ret_ctxt, ret_val)
- Display *xdpy;
- XEvent *event;
- void **ret_ctxt;
- int *ret_val;
-{
- /* Assert: event is ClientMessage with typePSReady */
-
- if (ret_ctxt != NULL)
- *ret_ctxt =
- XDPSContextFromXID(xdpy, (ContextXID)event->xclient.data.l[0]);
- if (ret_val != NULL)
- {
- ret_val[0] = event->xclient.data.l[1];
- ret_val[1] = event->xclient.data.l[2];
- ret_val[2] = event->xclient.data.l[3];
- ret_val[3] = event->xclient.data.l[4];
- }
-}
-
-void
-XDPSLCAPNotify(xdpy, cxid, ntype, data, extra)
- Display *xdpy;
- ContextXID cxid;
- unsigned int ntype; /* should this be an enum?? %%% */
- unsigned int data;
- unsigned int extra;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- register xCAPNotifyReq *req;
-
- if (dpy == xdpy) return;
-
- /* We _have_ to sync client and server here in order to guarantee
- correct execution sequencing. We call this procedure alot
- to keep track of GC's going away, so this is a major
- performance hit. */
- if (ntype == DPSCAPNOTE_FREEGC)
- XSync(xdpy, False);
-
- LockDisplay(dpy);
-
- NXMacroGetReq(CAPNotify, req);
- req->reqType = DPSCAPOPCODEBASE;
- req->type = X_CAPNotify;
- req->cxid = cxid;
- req->notification = ntype;
- req->data = data;
- req->extra = extra;
-
- if (gAutoFlush)
- N_XFlush(dpy);
-
- UnlockDisplay(dpy);
- SyncHandle();
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
-}
-
-void
-XDPSLSync(xdpy)
- Display *xdpy;
-{
- register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)];
-
- if (dpy == xdpy)
- {
- /* DPS/X */
- XSync(dpy, False);
- }
- else
- {
- /* CSDPS */
- XEvent event;
- DPSCAPData my;
- XExtData *extData;
- void *next;
- XExtCodes *codes = Codes[DPY_NUMBER(xdpy)];
-
- if (codes == NULL)
- return;
- /* Get private data */
- extData = XFindOnExtensionList(
- CSDPSHeadOfDpyExt(xdpy),
- codes->extension);
- if (!extData)
- return;
- my = (DPSCAPData) extData->private_data;
- my->saveseq = XNextRequest(dpy)-1;
- /* first send notification to agent */
- XDPSLCAPNotify(xdpy, 0, DPSCAPNOTE_SYNC, my->saveseq, 0);
-#ifdef XXX
-fprintf(stderr, "\nXDPSLSync(DPSCAPNOTE_SYNC) sending ... ");
-#endif
- _XFlush(xdpy);
- N_XFlush(dpy);
-#ifdef XXX
-fprintf(stderr, "sent.\nWaiting for reply ... ");
-#endif
- /* agent should send a ClientMessage, so wait for it */
- XIfEvent(xdpy, &event, WaitForSyncProc, (char *) my);
-
-#ifdef XXX
-fprintf(stderr, "received.\n");
-#endif
- /* now client, agent, and server are synchronized */
- }
-}
-
-void
-XDPSLReconcileRequests(xdpy, cxid)
- Display *xdpy;
- ContextXID cxid;
-{
- int dpyix;
- unsigned int seqnum;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
-
- if (dpy == xdpy)
- return; /* No-op for DPS/X */
-
- /* Get the sequence number and set the pause flag
- IFF we are sure that some X protocol has occurred
- since the last time we did a DPS request. This
- minimizes pause/resume requests */
-
- if (LastXRequest[dpyix] == XNextRequest(xdpy)-1)
- {
- if (gAutoFlush)
- N_XFlush(dpy); /* This is what XDPSLCAPNotify would do */
- return;
- }
- else
- seqnum = DPSCAPSetPause(xdpy, cxid);
-
- /* Pause the context specified. */
- XDPSLCAPNotify(xdpy, cxid, DPSCAPNOTE_PAUSE, seqnum, 0);
-
- /* We don't even need to flush. All we have to do is make
- sure that the notify request is queued before any
- DPS requests that follow. */
-}
-
-Status
-XDPSLSetAgentArg(xdpy, arg, val)
- Display *xdpy;
- int arg, val;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
- CARD32 capArg;
- register xCAPSetArgReq *req;
-
- if (dpy == xdpy)
- return(Success); /* No-op for DPS/X */
-
- /* dpy will be NIL if we haven't opened a connection yet,
- but that's okay since we need to save the value anyway. */
-
- if (dpy)
- {
- int syncMask = displayFlags[dpyix].syncMask;
-
- /* ASSERT: There is no reason to pause the context for this
- request, so just sync. */
- if (syncMask & (DPSCAP_SYNCMASK_SYNC|DPSCAP_SYNCMASK_RECONCILE))
- XSync(xdpy, False);
- }
-
- switch (arg)
- {
- case AGENT_ARG_SMALLFONTS:
- AgentArgs[dpyix].showSmallSizes = val;
- capArg = DPSCAP_ARG_SMALLFONTS;
- break;
- case AGENT_ARG_PIXMEM:
- AgentArgs[dpyix].pixMem = val;
- capArg = DPSCAP_ARG_PIXMEM;
- break;
- default:
- return(!Success);
- }
- if (!dpy)
- return(Success);
-
- LockDisplay(dpy);
-
- NXMacroGetReq(CAPSetArg, req);
- req->reqType = DPSCAPOPCODEBASE;
- req->type = X_CAPSetArg;
- req->arg = capArg;
- req->val = val;
-
- if (gAutoFlush)
- N_XFlush(dpy);
-
- UnlockDisplay(dpy);
- SyncHandle();
- LastXRequest[dpyix] = XNextRequest(xdpy)-1;
- return(Success);
-}
-
-
-void
-XDPSLCleanAll(xdpy)
- register Display *xdpy;
-{
- /* Clean up all state associated with dpy */
- register DPSCAPPausedContextData *slot;
- int dpyix = DPY_NUMBER(xdpy);
-
- /* Clean up paused context list */
- for (slot = PausedPerDisplay[dpyix]; slot; slot = PausedPerDisplay[dpyix])
- {
- PausedPerDisplay[dpyix] = slot->next;
- Xfree(slot);
- }
-
- /* Clear agent args */
- AgentArgs[dpyix].showSmallSizes = 0;
- AgentArgs[dpyix].pixMem = 0;
-}
-
-void
-XDPSLUpdateAgentArgs(xdpy)
- register Display *xdpy;
-{
- int dpyix = DPY_NUMBER(xdpy);
-
- if (AgentArgs[dpyix].showSmallSizes)
- XDPSLSetAgentArg(xdpy, AGENT_ARG_SMALLFONTS, AgentArgs[dpyix].showSmallSizes);
- if (AgentArgs[dpyix].pixMem)
- XDPSLSetAgentArg(xdpy, AGENT_ARG_PIXMEM, AgentArgs[dpyix].pixMem);
-}
-
-void
-XDPSLCleanContext(xdpy, cxid)
- Display *xdpy;
- ContextXID cxid;
-{
- /* Clean up all state associated with cxid on this dpy */
- register DPSCAPPausedContextData *slot, *prev;
- int dpyix = DPY_NUMBER(xdpy);
-
- /* If this is DPS/X, then slot will never have been initialized.
- See XDPSLNotifyContext */
-
- /* Clean up paused context list */
- prev = (DPSCAPPausedContextData *)NULL;
- for (slot = PausedPerDisplay[dpyix]; slot; prev = slot, slot = slot->next)
- {
- if (slot->cxid != cxid)
- continue;
- if (!prev)
- PausedPerDisplay[dpyix] = slot->next;
- else
- prev->next = slot->next;
- Xfree(slot);
- break;
- }
-}
-
-/* DPS NX 2.0 */
-void
-XDPSLSetGCFlushMode(dpy, value)
- Display *dpy;
- int value;
-{
- int dpyix;
- register Display *agent = ShuntMap[dpyix = DPY_NUMBER(dpy)];
-
- if (value != XDPSNX_GC_UPDATES_SLOW && value != XDPSNX_GC_UPDATES_FAST)
- {
- DPSWarnProc(NULL, "DPS NX: Bogus GC flush mode.\n");
- return;
- }
- /* 0 means no NX */
- GCFlushMode[dpyix] = (agent == dpy) ? 0 : value;
-}
-
-int
-XDPSLGetGCFlushMode(dpy)
- Display *dpy;
-{
- return(GCFlushMode[DPY_NUMBER(dpy)]);
-}
-
-void
-XDPSLFlushGC(xdpy, gc)
- Display *xdpy;
- GC gc;
-{
- int dpyix;
- register Display *dpy = ShuntMap[dpyix = DPY_NUMBER(xdpy)];
-
- if (!gc->dirty) return;
-
- if (GCFlushMode[dpyix] == XDPSNX_GC_UPDATES_FAST)
- {
- XGCValues vals;
- static unsigned long valuemask = DPSGCBITS & ~(GCClipMask);
-
- /* Okay to call Xlib, since dpy isn't locked */
- DPSAssertWarn(XGetGCValues(xdpy, gc, valuemask, &vals),
- NULL, "DPS NX: XGetGCValues returned False\n");
- vals.clip_mask = gc->values.clip_mask;
- LockDisplay(dpy);
- DPSCAPChangeGC(dpy, gc, DPSGCBITS, &vals);
- UnlockDisplay(dpy);
- SyncHandle();
- }
- /* Fall thru. Either the GCFlushMode is SLOW, which means
- we will DPSCAPChangeGC as a side-effect of FlushGC when
- the GC hook is called, or we just did it in the FAST case. */
- FlushGC(xdpy, gc);
- XDPSLFlush(xdpy);
-}
-
-/* === PRIVATE CSDPS PROCS === */
-
-static Status
-DPSCAPClientMessageProc(dpy, re, event)
- Display *dpy;
- XEvent *re;
- register xEvent *event;
-{
- register XDPSLOutputEvent *oce;
- register DPSCAPOutputEvent *oev;
- XDPSLOutputEvent fakeOutput;
- XExtCodes *codes = Codes[DPY_NUMBER(dpy)];
- PSCMProc oldProc = ClientMsgProc[DPY_NUMBER(dpy)];
-
- if (codes != NULL)
- {
- /* Get private data */
- XExtData *extData = XFindOnExtensionList(
- CSDPSHeadOfDpyExt(dpy),
- codes->extension);
- DPSCAPData my;
-
- /* There's no extension, or there is an extension but we are
- passing events uninterpreted, so just pass it along
- unless it is a DPSCAP error. */
-
- if (!extData)
- goto pass_the_buck;
- my = (DPSCAPData) extData->private_data;
- if (XDPSLGetPassEventsFlag(dpy) &&
- (event->u.clientMessage.u.l.type != my->typeXError))
- goto pass_the_buck;
-
- /* Fake up a DPS extension event and handle it transparently,
- without going through the Xlib event queue */
-
- if (event->u.clientMessage.u.b.type == my->typePSOutput)
- {
- oce = &fakeOutput;
- oce->length = DPSCAP_BYTESPEROUTPUTEVENT;
- oev = (DPSCAPOutputEvent *)event->u.clientMessage.u.b.bytes;
- goto common_stuff;
- }
- else if (event->u.clientMessage.u.b.type == my->typePSOutputWithLen)
- {
- oce = &fakeOutput;
- oev = (DPSCAPOutputEvent *)event->u.clientMessage.u.b.bytes;
- oce->length = oev->data[DPSCAP_DATA_LEN];
-common_stuff:
- oce->type = codes->first_event + PSEVENTOUTPUT;
- oce->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event);
- oce->send_event = True; /* ??? */
- oce->display = dpy;
- oce->cxid = oev->cxid;
- bcopy((char *) oev->data, oce->data, oce->length);
- /* We've converted the event, give it to DPS */
- if (TextProc)
- (*TextProc)((XEvent *) oce);
- return(False);
- }
- else if (event->u.clientMessage.u.b.type == my->typePSStatus)
- {
- register XDPSLStatusEvent *sce;
- register DPSCAPStatusEvent *sev;
- XDPSLStatusEvent fakeStatus;
-
- sev = (DPSCAPStatusEvent *)event->u.clientMessage.u.b.bytes;
- sce = &fakeStatus;
- sce->type = codes->first_event + PSEVENTSTATUS;
- sce->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event);
- sce->send_event = True; /* ??? */
- sce->display = dpy;
- sce->cxid = sev->cxid;
- sce->status = sev->status;
- /* We've converted the event, give it to DPS */
- if (StatusProc[DPY_NUMBER(dpy)])
- (*(StatusProc[DPY_NUMBER(dpy)]))((XEvent *) sce);
- return(False);
- }
- else if (event->u.clientMessage.u.l.type == my->typeXError)
- {
- xError err;
- register xError *e = &err;
-
- e->type = X_Error;
- e->errorCode = event->u.clientMessage.u.l.longs0;
- e->sequenceNumber = event->u.u.sequenceNumber;
- e->resourceID = event->u.clientMessage.u.l.longs3;
- e->minorCode = event->u.clientMessage.u.l.longs2;
- e->majorCode = event->u.clientMessage.u.l.longs1;
- /* Smash the wire event here, before going off deep end */
- event->u.clientMessage.u.l.type = my->typeNoop;
- /* Jump! */
- return(_XError(dpy, e));
- }
- else if (event->u.clientMessage.u.l.type == my->typePSReady)
- /* L2-DPS/PROTO 9 addition */
- {
- register XDPSLReadyEvent *rce;
- XDPSLReadyEvent fakeReady;
-
- rce = &fakeReady;
- rce->type = codes->first_event + PSEVENTREADY;
- rce->serial = _XSetLastRequestRead(dpy, (xGenericReply *)event);
- rce->send_event = True;
- rce->display = dpy;
- rce->cxid = event->u.clientMessage.u.l.longs0;
- rce->val[0] = event->u.clientMessage.u.l.longs1;
- rce->val[1] = event->u.clientMessage.u.l.longs2;
- rce->val[2] = event->u.clientMessage.u.l.longs3;
- rce->val[3] = event->u.clientMessage.u.l.longs4;
- XDPSLCallReadyEventHandler(dpy, (XEvent *) rce);
- return(False);
- }
- }
-
- /* Put the event on the queue, so that Xlib is happy */
-pass_the_buck:
- return(oldProc(dpy, re, event));
-}
-
-
-static void
-DPSCAPInitGC(dpy, agent, gc)
- Display *dpy, *agent;
- GC gc;
-{
- XGCValues values;
- unsigned long valuemask = DPSGCBITS & ~(GCClipMask);
-
- /* Okay to call Xlib, since dpy isn't locked */
- DPSAssertWarn(XGetGCValues(dpy, gc, valuemask, &values),
- NULL, "DPS NX: XGetGCValues returned False\n");
- values.clip_mask = gc->values.clip_mask;
- DPSCAPChangeGC(agent, gc, DPSGCBITS, &values);
- SyncHandle();
- XDPSLSync(dpy);
-}
-
-
-/* ARGSUSED */
-
-static Bool
-WaitForSyncProc(xdpy, event, arg)
- Display *xdpy;
- XEvent *event;
- char *arg;
-{
- DPSCAPData my = (DPSCAPData)arg;
-
- if ((event->type & 0x7F) == ClientMessage
- && event->xclient.message_type == my->typeSync
- && event->xclient.data.l[0] == my->saveseq) {
- return(True);
- } else {
- return(False);
- }
-}
-
-
-static int
-DPSCAPAfterProc(xdpy)
- Display *xdpy;
-{
- register Display *dpy = ShuntMap[DPY_NUMBER(xdpy)];
- GenericProcPtrReturnsInt proc;
-
- if (dpy != (Display *)NULL && dpy != xdpy)
- {
- LockDisplay(dpy);
- N_XFlush(dpy);
- UnlockDisplay(dpy);
- LockDisplay(xdpy);
- _XFlush(xdpy);
- UnlockDisplay(xdpy);
- }
- if ((proc = AfterProcs[DPY_NUMBER(xdpy)]) != NULL)
- return((*proc)(xdpy));
- else
- return(0);
-}
-
-
-static unsigned int
-DPSCAPSetPause(xdpy, cxid)
- register Display *xdpy;
- register ContextXID cxid;
-{
- register DPSCAPPausedContextData *slot;
- int dpyix;
- unsigned int ret;
-
- /* Find or create slot */
-
- slot = PausedPerDisplay[dpyix = DPY_NUMBER(xdpy)];
- if (!slot)
- {
- slot = (DPSCAPPausedContextData *)
- Xcalloc(1, sizeof(DPSCAPPausedContextData));
- PausedPerDisplay[dpyix] = slot;
- goto common_code;
- /* IMPLICATION: it is okay to fall through common_code
- and do test_ret. */
- }
- while (1)
- if (slot->cxid == cxid)
- {
- if (!slot->paused)
- {
- slot->paused = True;
- ++gTotalPaused;
- }
- /* Back-to-back pauses get different sequence numbers */
- ret = ++slot->seqnum;
- goto test_ret;
- }
- else if (slot->next) slot = slot->next;
- else break;
- /* cxid wasn't found, so add it */
- /* ASSERT: slot points to last record of the list */
- slot->next = (DPSCAPPausedContextData *)
- Xcalloc(1, sizeof(DPSCAPPausedContextData));
- slot = slot->next;
-common_code:
- slot->paused = True;
- ++gTotalPaused;
- slot->cxid = cxid;
- ret = ++slot->seqnum;
-test_ret:
- if (!ret)
- {
- DPSWarnProc(NULL, "Pause sequence wrapped around!");
- }
- return(ret);
-}
-
-static Bool
-DPSCAPResumeContext(xdpy, cxid)
- register Display *xdpy;
- register ContextXID cxid;
-{
- register DPSCAPPausedContextData *slot;
- unsigned int ret;
- int dpyix = DPY_NUMBER(xdpy);
-
- /* Try to match cxid to list of paused contexts */
- for (slot = PausedPerDisplay[dpyix]; slot; slot = slot->next)
- if (slot->cxid == cxid && slot->paused)
- {
- /* Send resume event */
- register XClientMessageEvent *ee;
- XEvent e;
- XExtData *extData;
- DPSCAPData my;
- XExtCodes *codes = Codes[dpyix];
-
- extData = XFindOnExtensionList(
- CSDPSHeadOfDpyExt(xdpy),
- codes->extension);
- if (!extData)
- return(False);
- my = (DPSCAPData) extData->private_data;
-
- ee = &e.xclient;
- ee->type = ClientMessage;
- ee->display = xdpy;
- ee->window = my->agentWindow;
- ee->format = 32;
- ee->message_type = my->typeResume;
- ee->data.l[0] = cxid;
- ee->data.l[1] = slot->seqnum;
- (void) XSendEvent(
- xdpy,
- my->agentWindow,
- False,
- NoEventMask,
- &e);
- XFlush(xdpy);
- /* Turn off flag */
- slot->paused = False;
- --gTotalPaused;
- return(True);
- }
- /* Fall thru */
- return(False);
-}
-
-
-
-
-
-
diff --git a/xc/lib/dps/Xlibnet.h b/xc/lib/dps/Xlibnet.h
deleted file mode 100644
index 4354674d6..000000000
--- a/xc/lib/dps/Xlibnet.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/* $XConsortium: Xlibnet.h,v 1.18 91/07/23 19:01:27 rws Exp $ */
-
-/*
-Copyright 1991 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.
-*/
-/* $XFree86: xc/lib/dps/Xlibnet.h,v 1.3 2000/02/21 20:12:03 dawes Exp $ */
-/*
- * Xlibnet.h - Xlib networking include files for UNIX Systems.
- */
-
-#ifndef X_UNIX_PATH
-#ifdef hpux
-#define X_UNIX_PATH "/usr/spool/sockets/X11/"
-#define OLD_UNIX_PATH "/tmp/.X11-unix/X"
-#else
-#define X_UNIX_PATH "/tmp/.X11-unix/X"
-#endif
-#endif /* X_UNIX_PATH */
-
-#ifdef STREAMSCONN
-#ifdef SYSV
-/*
- * UNIX System V Release 3.2
- */
-#define BytesReadable(fd,ptr) (_XBytesReadable ((fd), (ptr)))
-#define MALLOC_0_RETURNS_NULL
-#include <sys/ioctl.h>
-
-#endif /* SYSV */
-#ifdef SVR4
-/*
- * TLI (Streams-based) networking
- */
-#define BytesReadable(fd,ptr) (_XBytesReadable ((fd), (ptr)))
-#include <sys/uio.h> /* define struct iovec */
-
-#endif /* SVR4 */
-#else /* not STREAMSCONN */
-/*
- * socket-based systems
- */
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <netdb.h>
-#include <sys/uio.h> /* needed for XlibInt.c */
-#ifdef SVR4
-#include <sys/filio.h>
-#endif
-
-#if defined(i386) && defined(SYSV)
-#include <net/errno.h>
-#include <sys/stropts.h>
-#define BytesReadable(fd,ptr) ioctl((fd), I_NREAD, (ptr))
-#else
-#define BytesReadable(fd, ptr) ioctl ((fd), FIONREAD, (ptr))
-#endif
-
-#endif /* STREAMSCONN else */
-
-/*
- * If your BytesReadable correctly detects broken connections, then
- * you should NOT define XCONN_CHECK_FREQ.
- */
-#define XCONN_CHECK_FREQ 256
-
-#ifndef X_NOT_POSIX
-#ifdef _POSIX_SOURCE
-#include <limits.h>
-#else
-#define _POSIX_SOURCE
-#include <limits.h>
-#undef _POSIX_SOURCE
-#endif
-#endif
-#ifndef OPEN_MAX
-#ifdef SVR4
-#define OPEN_MAX 256
-#else
-#include <sys/param.h>
-#ifndef OPEN_MAX
-#ifdef NOFILE
-#define OPEN_MAX NOFILE
-#else
-#define OPEN_MAX NOFILES_MAX
-#endif
-#endif
-#endif
-#endif
-
-#if OPEN_MAX > 256
-#undef OPEN_MAX
-#define OPEN_MAX 256
-#endif
-
-/* Adobe additions */
-#ifdef MSKCNT
-#undef MSKCNT
-#endif
-#ifdef BITMASK
-#undef BITMASK
-#endif
-#ifdef MASKIDX
-#undef MASKIDX
-#endif
-
-#define MSKCNT ((OPEN_MAX + 31) / 32)
-
-#if (MSKCNT==1)
-#define BITMASK(i) (1 << (i))
-#define MASKIDX(i) 0
-#endif
-#if (MSKCNT>1)
-#define BITMASK(i) (1 << ((i) & 31))
-#define MASKIDX(i) ((i) >> 5)
-#endif
-
-#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))
-
-/* Adobe additions */
-#ifdef COPYBITS
-#undef COPYBITS
-#undef CLEARBITS
-#undef MASKANDSETBITS
-#undef ORBITS
-#undef UNSETBITS
-#endif
-
-#if (MSKCNT==1)
-#define COPYBITS(src, dst) dst[0] = src[0]
-#define CLEARBITS(buf) buf[0] = 0
-#define MASKANDSETBITS(dst, b1, b2) dst[0] = (b1[0] & b2[0])
-#define ORBITS(dst, b1, b2) dst[0] = (b1[0] | b2[0])
-#define UNSETBITS(dst, b1) (dst[0] &= ~b1[0])
-#define _XANYSET(src) (src[0])
-#endif
-#if (MSKCNT==2)
-#define COPYBITS(src, dst) { dst[0] = src[0]; dst[1] = src[1]; }
-#define CLEARBITS(buf) { buf[0] = 0; buf[1] = 0; }
-#define MASKANDSETBITS(dst, b1, b2) {\
- dst[0] = (b1[0] & b2[0]);\
- dst[1] = (b1[1] & b2[1]); }
-#define ORBITS(dst, b1, b2) {\
- dst[0] = (b1[0] | b2[0]);\
- dst[1] = (b1[1] | b2[1]); }
-#define UNSETBITS(dst, b1) {\
- dst[0] &= ~b1[0]; \
- dst[1] &= ~b1[1]; }
-#define _XANYSET(src) (src[0] || src[1])
-#endif
-#if (MSKCNT==3)
-#define COPYBITS(src, dst) { dst[0] = src[0]; dst[1] = src[1]; \
- dst[2] = src[2]; }
-#define CLEARBITS(buf) { buf[0] = 0; buf[1] = 0; buf[2] = 0; }
-#define MASKANDSETBITS(dst, b1, b2) {\
- dst[0] = (b1[0] & b2[0]);\
- dst[1] = (b1[1] & b2[1]);\
- dst[2] = (b1[2] & b2[2]); }
-#define ORBITS(dst, b1, b2) {\
- dst[0] = (b1[0] | b2[0]);\
- dst[1] = (b1[1] | b2[1]);\
- dst[2] = (b1[2] | b2[2]); }
-#define UNSETBITS(dst, b1) {\
- dst[0] &= ~b1[0]; \
- dst[1] &= ~b1[1]; \
- dst[2] &= ~b1[2]; }
-#define _XANYSET(src) (src[0] || src[1] || src[2])
-#endif
-#if (MSKCNT==4)
-#define COPYBITS(src, dst) dst[0] = src[0]; dst[1] = src[1]; \
- dst[2] = src[2]; dst[3] = src[3]
-#define CLEARBITS(buf) buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = 0
-#define MASKANDSETBITS(dst, b1, b2) \
- dst[0] = (b1[0] & b2[0]);\
- dst[1] = (b1[1] & b2[1]);\
- dst[2] = (b1[2] & b2[2]);\
- dst[3] = (b1[3] & b2[3])
-#define ORBITS(dst, b1, b2) \
- dst[0] = (b1[0] | b2[0]);\
- dst[1] = (b1[1] | b2[1]);\
- dst[2] = (b1[2] | b2[2]);\
- dst[3] = (b1[3] | b2[3])
-#define UNSETBITS(dst, b1) \
- dst[0] &= ~b1[0]; \
- dst[1] &= ~b1[1]; \
- dst[2] &= ~b1[2]; \
- dst[3] &= ~b1[3]
-#define _XANYSET(src) (src[0] || src[1] || src[2] || src[3])
-#endif
-
-#if (MSKCNT>4)
-#define COPYBITS(src, dst) bcopy((char *) src, (char *) dst,\
- MSKCNT*sizeof(long))
-#define CLEARBITS(buf) bzero((char *) buf, MSKCNT*sizeof(long))
-#define MASKANDSETBITS(dst, b1, b2) \
- { int cri; \
- for (cri=MSKCNT; --cri>=0; ) \
- dst[cri] = (b1[cri] & b2[cri]); }
-#define ORBITS(dst, b1, b2) \
- { int cri; \
- for (cri=MSKCNT; --cri>=0; ) \
- dst[cri] = (b1[cri] | b2[cri]); }
-#define UNSETBITS(dst, b1) \
- { int cri; \
- for (cri=MSKCNT; --cri>=0; ) \
- dst[cri] &= ~b1[cri]; }
-/*
- * If MSKCNT>4, then _XANYSET is a routine defined in XlibInt.c.
- *
- * #define _XANYSET(src) (src[0] || src[1] || src[2] || src[3] || src[4] ...)
- */
-#endif
-
-/*
- * ReadvFromServer and WritevToSever use struct iovec, normally found
- * in Berkeley systems in <sys/uio.h>. See the readv(2) and writev(2)
- * manual pages for details.
- *
- * struct iovec {
- * caddr_t iov_base;
- * int iov_len;
- * };
- */
-#if defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA)
-struct iovec {
- caddr_t iov_base;
- int iov_len;
-};
-#endif /* USG */
-
-
-#ifdef STREAMSCONN
-#include "Xstreams.h"
-
-extern char _XsTypeOfStream[];
-extern Xstream _XsStream[];
-
-#define ReadFromServer(dpy, data, size) \
- (*_XsStream[_XsTypeOfStream[dpy]].ReadFromStream)((dpy), (data), (size), \
- BUFFERING)
-#define WriteToServer(dpy, bufind, size) \
- (*_XsStream[_XsTypeOfStream[dpy]].WriteToStream)((dpy), (bufind), (size))
-
-#else /* else not STREAMSCONN */
-
-/*
- * bsd can read from sockets directly
- */
-#define ReadFromServer(dpy, data, size) read((dpy), (data), (size))
-#define WriteToServer(dpy, bufind, size) write((dpy), (bufind), (size))
-
-#endif /* STREAMSCONN */
-
-
-#ifndef USL_COMPAT
-#if !defined(USG) || defined(MOTOROLA)
-#if !(defined(SYSV) && defined(i386))
-#define _XReadV readv
-#endif
-#define _XWriteV writev
-#endif
-#endif /* !USL_COMPAT */
-
-#define ReadvFromServer(dpy, iov, iovcnt) _XReadV((dpy), (iov), (iovcnt))
-#define WritevToServer(dpy, iov, iovcnt) _XWriteV((dpy), (iov), (iovcnt))
diff --git a/xc/lib/dps/Xstreams.h b/xc/lib/dps/Xstreams.h
deleted file mode 100644
index a45c13028..000000000
--- a/xc/lib/dps/Xstreams.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/* $XConsortium: Xstreams.h,v 1.6 91/07/19 23:22:53 gildea Exp $ */
-/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of AT&T or USL not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission. AT&T and USL make no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * AT&T and USL DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL AT&T or USL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER 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/lib/dps/Xstreams.h,v 1.1 2000/02/15 14:51:21 dawes Exp $ */
-
-
-#ifndef _XSTREAMS_H_
-#define _XSTREAMS_H_
-/*
- Xstreams.h (C header file)
- Acc: 575304412 Tue Apr 26 09:46:52 1988
- Mod: 574017273 Tue Apr 26 12:14:33 1988
- Sta: 574017273 Tue Apr 26 12:14:33 1988
- Owner: 2011
- Group: 1985
- Permissions: 644
-*/
-/*
- START USER STAMP AREA
-*/
-/*
- END USER STAMP AREA
-*/
-
-
-
-#define MEM_ALLIGN(ptr) ((((unsigned) (ptr + 3)) >> 2) << 2)
-
-#define CONNECT_TIMEOUT 60
-#define MAX_AUTO_BUF_LEN 256
-#define MAX_DISP_DIGITS 20
-#define MAX_NETS 8
-
-typedef struct _host {
- char host_name[32];
- int host_len;
- struct _host *next;
-} HOST;
-
-/*
- * Structure for handling multiple connection requests on the same stream.
- */
-
-struct listenCall {
- struct t_call *CurrentCall;
- struct listenCall *NextCall;
-};
-
-struct listenQue {
- struct listenCall *QueHead;
- struct listenCall *QueTail;
-};
-
-#define EMPTY(p) (p->QueHead == (struct listenCall *) NULL)
-
-
-typedef struct {
- int flags;
- char type;
- int display;
- char *inputbuf;
- int buflen;
- int bufptr;
- int msglen;
- } IOBUFFER;
-
-typedef struct {
- int _nnets;
-#ifdef SVR4
- struct netconfig *_net[MAX_NETS];
-#else
- char *_net[MAX_NETS];
-#endif
- struct listenQue FreeList[MAX_NETS];
- struct listenQue PendingQue[MAX_NETS];
- int _npeers;
- char **_peer;
- int *_peerlen;
- HOST *_validhosts;
- } networkInfo;
-
-
-typedef struct _Xstream {
- int (*SetupTheListener)();
- int (*ConnectNewClient)();
- int (*CallTheListener)();
- int (*ReadFromStream)();
- int (*BytesCanBeRead)();
- int (*WriteToStream)();
- int (*CloseStream)();
- int (*CreateAddress)();
- union ext {
- int (*NameServer)();
- networkInfo *NetInfo;
- } u;
- } Xstream;
-
-/* old shared libraries have the names already fixed */
-#ifdef USL_COMPAT
-#define _XsStream xstream
-#define _XReadV _readv
-#define _XWriteV _writev
-#define _XSelect XSelect
-#define _XsErrorCall ErrorCall
-#define _XsSetupLocalStream SetupLocalStream
-#define _XsConnectLocalClient ConnectLocalClient
-#define _XsOpenSpServer OpenSpServer
-#define _XsReadLocalStream ReadLocalStream
-#define _XsConnectTliClient ConnectTliClient
-#define _XsSetupTliStrean SetupTliStream
-#define _XsCallTliServer CallTliServer
-#define _XsCallLocalServer CallLocalServer
-#define _XsTypeOfStream TypeOfStream
-#ifdef SVR4
-#define _XsSetupNamedStream SetupNamedStream
-#define _XsSetupSpStream SetupSpStream
-#endif /* SVR4 */
-#endif /* USL_COMPAT */
-
-extern Xstream _XsStream[];
-
-#define NO_BUFFERING 0
-#define BUFFERING 1
-
-/* Network services */
-
-#define OpenDaemonConnection 0
-#define PEER_NAME 1
-#define PEER_ALLOC 2
-#define PEER_FREE 3
-#define ConvertNetAddrToName 4
-#define ConvertNameToNetAddr 5
-#define ConvertNameToTliCall 6
-#define ConvertTliCallToName 7
-#define ConvertNameToTliBind 8
-
-#define UNAME_LENGTH 14
-
-#define X_LOCAL_STREAM 0
-#define X_NAMED_STREAM 1
-/* Enhanced Application Compatibility Support */
-#define X_SP_STREAM 2
-/* End Enhanced Application Compatibility Support */
-
-#define X_TLI_STREAM 3
-#define CLOSED_STREAM -1
-
-/*
- The following are defined in X.h. Any changes to FamilyUname
- should take X.h into consideration.
-*/
- /* protocol families */
-
- /*
-
- #define FamilyInternet 0
- #define FamilyDECnet 1
- #define FamilyChaos 2
-
- */
-
-#define FamilyUname 3
-
-#define X_TCP_PORT 6000
-
-#define NAMED_LISTENER "/dev/X/Nserver"
-#define LOCAL_LISTENER "/dev/X/server"
-/* Enhanced Application Compatibility Support */
-/* End Enhanced Application Compatibility Support */
-
-#define NAME_SERVER_NODE "/dev/X/nameserver"
-#define XNETSPECDIR "lib/net"
-#define XROOTDIR "/usr/X"
-
-#define MAX_SIMUL_TLI_CALLS 20
-
-#define SetupNetworkInfo() _XsStream[X_LOCAL_STREAM].u.NetInfo = &Network; \
- _XsStream[X_NAMED_STREAM].u.NetInfo = &Network; \
-/* Enhanced Application Compatibility Support */ \
-/* End Enhanced Application Compatibility Support */ \
- _XsStream[X_TLI_STREAM].u.NameServer = nameserver
-
-#define NetworkInfo (_XsStream[X_LOCAL_STREAM].u.NetInfo)
-#define GetNetworkInfo (*_XsStream[X_TLI_STREAM].u.NameServer)
-#define validhosts _XsStream[X_LOCAL_STREAM].u.NetInfo->_validhosts
-
-/*
- * header of messages sent by X to the nameserver
- * 1st int: the size of the entire message.
- * 2nd int: the size of the header itself.
- * 3rd int: the service number.
- * 4th int: the display number.
- * 5th int: the length of the network name.
- */
-
-#define HEADERSIZE (5*sizeof(int))
-#endif /* _XSTREAMS_H_ */
diff --git a/xc/lib/dps/csconndi.c b/xc/lib/dps/csconndi.c
deleted file mode 100644
index a74eb0af2..000000000
--- a/xc/lib/dps/csconndi.c
+++ /dev/null
@@ -1,852 +0,0 @@
-/*
- * csconndi.c -- low level connection maker for CSDPS
- *
- * (c) Copyright 1990-1994 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
- *
- * Portions Copyright 1989 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.
- *
- * Author: Adobe Systems Incorporated and MIT X Consortium
- */
-/* $XFree86: xc/lib/dps/csconndi.c,v 1.2 2000/02/15 14:51:21 dawes Exp $ */
-
-#if defined(sun) && !defined(SVR4)
-#define memmove(t,f,c) bcopy(f,t,c)
-#endif
-
-#define NEED_EVENTS
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <X11/Xos.h>
-/* Include this first so that Xasync.h, included from Xlibint.h, can find
- the definition of NOFILE */
-#include <sys/param.h>
-#include <X11/Xlibint.h>
-#include "Xlibnet.h" /* New for R5, delete for R4 */
-
-#ifndef hpux /* HP doesn't include Xauth.h :-( */
-#include <X11/Xauth.h>
-#else
-#define FamilyLocal (256)
-#endif
-
-#include <ctype.h>
-#ifdef DNETCONN
-#include <netdnet/dn.h>
-#include <netdnet/dnetdb.h>
-#endif
-
-#include <netdb.h>
-
-#include "DPSCAPproto.h"
-#include "cslibint.h"
-
-#if defined(hpux) || defined(AIXV3)
-#define SELECT_TYPE int *
-#else
-#define SELECT_TYPE fd_set *
-#endif
-
-#ifndef _XANYSET
-extern int N_XANYSET();
-#define _XANYSET N_XANYSET
-#endif /* _XANYSET */
-
-#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */
-#define X_CONNECTION_RETRIES 5
-#endif
-
-#ifdef DNETCONN
-static int MakeDECnetConnection();
-#endif
-#ifdef UNIXCONN
-static int MakeUNIXSocketConnection();
-#endif
-#ifdef TCPCONN
-static int MakeTCPConnection();
-#endif
-#ifdef STREAMSCONN
-extern int _XMakeStreamsConnection();
-#endif
-
-/* This global controls the size of the output socket buffer. Zero
- means to use the system default size. */
-int gNXSndBufSize = 0;
-
-static char *copystring (src, len)
- char *src;
- int len;
-{
- char *dst = Xmalloc (len + 1);
-
- if (dst) {
- strncpy (dst, src, len);
- dst[len] = '\0';
- }
-
- return dst;
-}
-
-
-/*
- * Attempts to connect to agent, given name. Returns file descriptor
- * (network socket) or -1 if connection fails. Names may be of the
- * following format:
- *
- * [hostname] : [:] agentnumber
- *
- * The second colon indicates a DECnet style name. No hostname is interpretted
- * as the most efficient local connection to a server on the same machine.
- * This is usually:
- *
- * o shared memory
- * o local stream
- * o UNIX domain socket
- * o TCP to local host
- */
-
-int
-DPSCAPConnect(display_name, fullnamep, dpynump,
- familyp, saddrlenp, saddrp)
- char *display_name;
- char **fullnamep; /* RETURN */
- int *dpynump; /* RETURN */
- int *familyp; /* RETURN */
- int *saddrlenp; /* RETURN */
- char **saddrp; /* RETURN, freed by caller */
-{
- char *lastp, *p; /* char pointers */
- char *phostname = NULL; /* start of host of display */
- char *pdpynum = NULL; /* start of dpynum of display */
- char *pscrnum = NULL; /* start of screen of display */
- Bool dnet = False; /* if true, then DECnet format */
- int iagent; /* required display number */
- int iscreen = 0; /* optional screen number */
- int (*connfunc)(); /* method to create connection */
- int fd = -1; /* file descriptor to return */
- int len; /* length tmp variable */
-
- p = display_name;
-
- *saddrlenp = 0; /* set so that we can clear later */
- *saddrp = NULL;
-
- /*
- * Step 1, find the hostname. This is delimited by the required
- * first colon.
- */
- for (lastp = p; *p && *p != ':'; p++) ;
- if (!*p) return -1; /* must have a colon */
-
- if (p != lastp) { /* no hostname given */
- phostname = copystring (lastp, p - lastp);
- if (!phostname) goto bad; /* no memory */
- }
-
-
- /*
- * Step 2, see if this is a DECnet address by looking for the optional
- * second colon.
- */
- if (p[1] == ':') { /* then DECnet format */
- dnet = True;
- p++;
- }
-
- /*
- * see if we're allowed to have a DECnet address
- */
-#ifndef DNETCONN
- if (dnet) goto bad;
-#endif
-
-
- /*
- * Step 3, find the port number. This field is required.
- * Zero is acceptable as a port number, meaning use the default.
- */
-
- for (lastp = ++p; *p && isascii(*p) && isdigit(*p); p++) ;
- if ((p == lastp) || /* required field */
- (*p != '\0' && *p != '.') || /* invalid non-digit terminator */
- !(pdpynum = copystring (lastp, p - lastp))) /* no memory */
- goto bad;
- iagent = atoi (pdpynum);
-
-
- /*
- * At this point, we know the following information:
- *
- * phostname hostname string or NULL
- * iagent agent port number
- * dnet DECnet boolean
- *
- * We can now decide which transport to use based on the ConnectionFlags
- * build parameter the hostname string. If phostname is NULL or equals
- * the string "local", then choose the best transport. If phostname
- * is "unix", then choose BSD UNIX domain sockets (if configured).
- *
- * First, choose default transports: DECnet else (TCP or STREAMS)
- */
-
-
-#ifdef DNETCONN
- if (dnet)
- connfunc = MakeDECnetConnection;
- else
-#endif
-#ifdef TCPCONN
- connfunc = MakeTCPConnection;
-#else
-#ifdef STREAMSCONN
- connfunc = _XMakeStreamsConnection;
-#else
- connfunc = NULL;
-#endif
-#endif
-
-#ifdef UNIXCONN
- /*
- * Now that the defaults have been established, see if we have any
- * special names that we have to override:
- *
- * :N => if UNIXCONN then unix-domain-socket
- * ::N => if UNIXCONN then unix-domain-socket
- * unix:N => if UNIXCONN then unix-domain-socket
- *
- * Note that if UNIXCONN isn't defined, then we can use the default
- * transport connection function set above.
- */
- if (!phostname) {
- connfunc = MakeUNIXSocketConnection;
- }
- else if (strcmp (phostname, "unix") == 0) {
- connfunc = MakeUNIXSocketConnection;
- }
-#endif
- if (!connfunc)
- goto bad;
-
-
-#ifdef UNIXCONN
-#define LOCALCONNECTION (!phostname || connfunc == MakeUNIXSocketConnection)
-#else
-#define LOCALCONNECTION (!phostname)
-#endif
-
- if (LOCALCONNECTION) {
- /*
- * Get the auth info for local hosts so that it doesn't have to be
- * repeated everywhere; the particular values in these fields are
- * not part of the protocol.
- */
- char hostnamebuf[256];
- int len = N_XGetHostname (hostnamebuf, sizeof hostnamebuf);
-
- *familyp = FamilyLocal;
- if (len > 0) {
- *saddrp = Xmalloc (len + 1);
- if (*saddrp) {
- strcpy (*saddrp, hostnamebuf);
- *saddrlenp = len;
- } else {
- *saddrlenp = 0;
- }
- }
- }
-#undef LOCALCONNECTION
-
-#ifndef ultrix
- /* Ultrix has a nasty bug in getservbyname(); if the name passed to
- it is not in the services list it seg faults! *sigh* So, we
- don't ever look in the services info for ultrix... */
- if (iagent == 0) { /* find service default, if one's defined */
- struct servent *serventInfo;
-
- if ((serventInfo = getservbyname(DPS_NX_SERV_NAME,
- (char *) NULL)) != NULL) {
- if (strcmp("tcp", serventInfo->s_proto) != 0) {
- DPSWarnProc(NULL, "Services database specifies a protocol other than tcp. Using default port.\n");
- } else /* extract the port number */
- iagent = ntohs(serventInfo->s_port);
- }
- }
-#endif /* ultrix */
- /*
- * Make the connection, also need to get the auth address info for
- * non-local connections. Do retries in case server host has hit its
- * backlog (which, unfortunately, isn't distinguishable from there not
- * being a server listening at all, which is why we have to not retry
- * too many times).
- */
- if ((fd = (*connfunc) (phostname, iagent, X_CONNECTION_RETRIES,
- familyp, saddrlenp, saddrp)) < 0)
- goto bad;
-
-
- /*
- * Set the connection non-blocking since we use select() to block; also
- * set close-on-exec so that programs that fork() doesn't get confused.
- */
-#ifdef FIOSNBIO
- {
- int arg = 1;
- ioctl (fd, FIOSNBIO, &arg);
- }
-#else
-#if defined(sun) && defined(SVR4)
-#if !defined(_POSIX_C_SOURCE)
- (void) fcntl (fd, F_SETFL, O_NDELAY);
-#else
- (void) fcntl (fd, F_SETFL, O_NONBLOCK);
-#endif
-#else /* sun && SVR4 */
-#ifdef FNDELAY
- (void) fcntl (fd, F_SETFL, FNDELAY);
-#else
- (void) fcntl (fd, F_SETFL, O_NDELAY);
-#endif /* FNDELAY */
-#endif /* sun && SVR4 */
-#endif /* FIOSNBIO */
-
- (void) fcntl (fd, F_SETFD, 1);
-
-
- /*
- * Build the expanded display name:
- *
- * [host] : [:] agent \0
- */
- len = ((phostname ? strlen(phostname) : 0) + 1 + (dnet ? 1 : 0) +
- strlen(pdpynum) + 1);
- *fullnamep = (char *) Xmalloc (len);
- if (!*fullnamep) goto bad;
-
- sprintf (*fullnamep, "%s%s%d",
- (phostname ? phostname : ""), (dnet ? "::" : ":"),
- iagent);
-
- *dpynump = iagent;
- if (phostname) Xfree (phostname);
- if (pdpynum) Xfree (pdpynum);
- if (pscrnum) Xfree (pscrnum);
- return fd;
-
-
- /*
- * error return; make sure everything is cleaned up.
- */
- bad:
- if (fd >= 0) (void) close (fd);
- if (*saddrp) {
- Xfree (*saddrp);
- *saddrp = NULL;
- }
- *saddrlenp = 0;
- if (phostname) Xfree (phostname);
- if (pdpynum) Xfree (pdpynum);
- return -1;
-
-}
-
-
-/*****************************************************************************
- * *
- * Make Connection Routines *
- * *
- *****************************************************************************/
-
-#ifdef DNETCONN /* stupid makedepend */
-#define NEED_BSDISH
-#endif
-#ifdef UNIXCONN
-#define NEED_BSDISH
-#endif
-#ifdef TCPCONN
-#define NEED_BSDISH
-#endif
-
-#ifdef NEED_BSDISH /* makedepend can't handle #if */
-/*
- * 4.2bsd-based systems
- */
-#include <sys/socket.h>
-
-#ifndef hpux
-#ifdef apollo /* nest if(n)defs because makedepend is broken */
-#ifndef NO_TCP_H
-#include <netinet/tcp.h>
-#endif /* NO_TCP_H */
-#else /* apollo */
-#include <netinet/tcp.h>
-#endif /* apollo */
-#endif
-#endif /* NEED_BSDISH */
-
-
-#ifdef DNETCONN
-static int MakeDECnetConnection (phostname, iagent, retries,
- familyp, saddrlenp, saddrp)
- char *phostname;
- int iagent;
- int retries;
- int *familyp; /* RETURN */
- int *saddrlenp; /* RETURN */
- char **saddrp; /* RETURN */
-{
- int fd;
- char objname[20];
- extern int dnet_conn();
- struct dn_naddr *dnaddrp, dnaddr;
- struct nodeent *np;
-
- if (!phostname) phostname = "0";
-
- /*
- * build the target object name.
- */
- sprintf (objname, "DPS$EXECUTIVE_%d", iagent);
-
- /*
- * Attempt to open the DECnet connection, return -1 if fails; ought to
- * do some retries here....
- */
- if ((fd = dnet_conn (phostname, objname, SOCK_STREAM, 0, 0, 0, 0)) < 0) {
- return -1;
- }
-
- *familyp = FamilyDECnet;
- if (dnaddrp = dnet_addr (phostname)) { /* stolen from xhost */
- dnaddr = *dnaddrp;
- } else {
- if ((np = getnodebyname (phostname)) == NULL) {
- (void) close (fd);
- return -1;
- }
- dnaddr.a_len = np->n_length;
- memmove(dnaddr.a_addr, np->n_addr, np->n_length);
- }
-
- *saddrlenp = sizeof (struct dn_naddr);
- *saddrp = Xmalloc (*saddrlenp);
- if (!*saddrp) {
- (void) close (fd);
- return -1;
- }
- memmove (*saddrp, (char *)&dnaddr, *saddrlenp);
- return fd;
-}
-#endif /* DNETCONN */
-
-
-#ifdef UNIXCONN
-#include <sys/un.h>
-
-#ifndef CSDPS_UNIX_PATH
-#ifdef hpux
-#define CSDPS_UNIX_DIR "/usr/spool/sockets/DPSNX"
-#define CSDPS_UNIX_PATH "/usr/spool/sockets/DPSNX/"
-#else
-#define CSDPS_UNIX_DIR "/tmp/.DPSNX-unix"
-#define CSDPS_UNIX_PATH "/tmp/.DPSNX-unix/AGENT"
-#endif
-#endif
-
-static int MakeUNIXSocketConnection (phostname, iagent, retries,
- familyp, saddrlenp, saddrp)
- char *phostname;
- int iagent;
- int retries;
- int *familyp; /* RETURN */
- int *saddrlenp; /* RETURN */
- char **saddrp; /* RETURN */
-{
- struct sockaddr_un unaddr; /* UNIX socket data block */
- struct sockaddr *addr; /* generic socket pointer */
- int addrlen; /* length of addr */
- int fd; /* socket file descriptor */
- int port = (iagent == 0) ? CSDPSPORT : iagent;
- int ret;
-
- unaddr.sun_family = AF_UNIX;
- sprintf (unaddr.sun_path, "%s_%d", CSDPS_UNIX_PATH, port);
-
- addr = (struct sockaddr *) &unaddr;
- addrlen = strlen(unaddr.sun_path) + sizeof(unaddr.sun_family);
-
- /*
- * Open the network connection.
- */
- do {
- if ((fd = socket ((int) addr->sa_family, SOCK_STREAM, 0)) < 0) {
- return -1;
- }
-
- if (gNXSndBufSize > 0)
- ret = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &gNXSndBufSize, sizeof(gNXSndBufSize));
-
- if (connect (fd, addr, addrlen) < 0) {
- int olderrno = errno;
- (void) close (fd);
- if (olderrno != ENOENT || retries <= 0) {
- errno = olderrno;
- return -1;
- }
- sleep (1);
- } else {
- break;
- }
- } while (retries-- > 0);
-
- /*
- * Don't need to get auth info since we're local
- */
- return fd;
-}
-#endif /* UNIXCONN */
-
-
-#ifdef TCPCONN
-static int MakeTCPConnection (phostname, iagent, retries,
- familyp, saddrlenp, saddrp)
- char *phostname;
- int iagent;
- int retries;
- int *familyp; /* RETURN */
- int *saddrlenp; /* RETURN */
- char **saddrp; /* RETURN */
-{
- char hostnamebuf[256]; /* tmp space */
- unsigned long hostinetaddr; /* result of inet_addr of arpa addr */
- struct sockaddr_in inaddr; /* IP socket */
- struct sockaddr *addr; /* generic socket pointer */
- int addrlen; /* length of addr */
- struct hostent *hp; /* entry in hosts table */
- char *cp; /* character pointer iterator */
- int fd; /* file descriptor to return */
- int len; /* length tmp variable */
-
-#define INVALID_INETADDR ((unsigned long) -1)
-
- if (!phostname) {
- hostnamebuf[0] = '\0';
- (void) N_XGetHostname (hostnamebuf, sizeof hostnamebuf);
- phostname = hostnamebuf;
- }
-
- /*
- * if numeric host name then try to parse it as such; do the number
- * first because some systems return garbage instead of INVALID_INETADDR
- */
- if (isascii(phostname[0]) && isdigit(phostname[0])) {
- hostinetaddr = inet_addr (phostname);
- } else {
- hostinetaddr = INVALID_INETADDR;
- }
-
- /*
- * try numeric
- */
- if (hostinetaddr == INVALID_INETADDR) {
- if ((hp = gethostbyname(phostname)) == NULL) {
- /* No such host! */
- return -1;
- }
- if (hp->h_addrtype != AF_INET) { /* is IP host? */
- /* Not an Internet host! */
- return -1;
- }
-
- /* Set up the socket data. */
- inaddr.sin_family = hp->h_addrtype;
-#if defined(CRAY) && defined(OLDTCP)
- /* Only Cray UNICOS3 and UNICOS4 will define this */
- {
- long t;
- memmove ((char *)&t, (char *)hp->h_addr, sizeof(t));
- inaddr.sin_addr = t;
- }
-#else
- memmove ((char *)&inaddr.sin_addr, (char *)hp->h_addr,
- sizeof(inaddr.sin_addr));
-#endif /* CRAY and OLDTCP */
- } else {
-#if defined(CRAY) && defined(OLDTCP)
- /* Only Cray UNICOS3 and UNICOS4 will define this */
- inaddr.sin_addr = hostinetaddr;
-#else
- inaddr.sin_addr.s_addr = hostinetaddr;
-#endif /* CRAY and OLDTCP */
- inaddr.sin_family = AF_INET;
- }
-
- addr = (struct sockaddr *) &inaddr;
- addrlen = sizeof (struct sockaddr_in);
- inaddr.sin_port = (iagent == 0) ? CSDPSPORT : iagent;
- inaddr.sin_port = htons (inaddr.sin_port); /* may be funky macro */
-
-
- /*
- * Open the network connection.
- */
- do {
- if ((fd = socket ((int) addr->sa_family, SOCK_STREAM, 0)) < 0) {
- return -1;
- }
-
- /*
- * turn off TCP coalescence
- */
-#ifdef TCP_NODELAY
- {
- int tmp = 1;
- setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (char *)&tmp, sizeof (int));
- }
-#endif
- if (gNXSndBufSize > 0)
- len = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *) &gNXSndBufSize, sizeof(gNXSndBufSize));
-
- /*
- * connect to the socket; if there is no X server or if the backlog has
- * been reached, then ECONNREFUSED will be returned.
- */
- if (connect (fd, addr, addrlen) < 0) {
- int olderrno = errno;
- (void) close (fd);
- if (olderrno != ECONNREFUSED || retries <= 0) {
- errno = olderrno;
- return -1;
- }
- sleep (1);
- } else {
- break;
- }
- } while (retries-- > 0);
-
-
- /*
- * Success! So, save the auth information
- */
-#ifdef CRAY
-#ifdef OLDTCP
- len = sizeof(inaddr.sin_addr);
-#else
- len = SIZEOF_in_addr;
-#endif /* OLDTCP */
- cp = (char *) &inaddr.sin_addr;
-#else /* else not CRAY */
- len = sizeof(inaddr.sin_addr.s_addr);
- cp = (char *) &inaddr.sin_addr.s_addr;
-#endif /* CRAY */
-
- /*
- * We are special casing the BSD hack localhost address
- * 127.0.0.1, since this address shouldn't be copied to
- * other machines. So, we simply omit generating the auth info
- * since we set it to the local machine before calling this routine!
- */
- if (!((len == 4) && (cp[0] == 127) && (cp[1] == 0) &&
- (cp[2] == 0) && (cp[3] == 1))) {
- *saddrp = Xmalloc (len);
- if (*saddrp) {
- *saddrlenp = len;
- memmove (*saddrp, cp, len);
- *familyp = FamilyInternet;
- } else {
- *saddrlenp = 0;
- }
- }
-
- return fd;
-}
-#undef INVALID_INETADDR
-#endif /* TCPCONN */
-
-
-/*****************************************************************************
- * *
- * Connection Utility Routines *
- * *
- *****************************************************************************/
-
-/*
- * Disconnect from server.
- */
-
-int N_XDisconnectDisplay (server)
-
- int server;
-
-{
- (void) close(server);
- return 0;
-}
-
-
-
-#undef NULL
-#define NULL ((char *) 0)
-/*
- * This is an OS dependent routine which:
- * 1) returns as soon as the connection can be written on....
- * 2) if the connection can be read, must enqueue events and handle errors,
- * until the connection is writable.
- */
-void N_XWaitForWritable(dpy)
- Display *dpy;
-{
- unsigned long r_mask[MSKCNT];
- unsigned long w_mask[MSKCNT];
- int nfound;
-
- CLEARBITS(r_mask);
- CLEARBITS(w_mask);
-
- while (1) {
- BITSET(r_mask, dpy->fd);
- BITSET(w_mask, dpy->fd);
-
- do {
- nfound = select (dpy->fd + 1, (SELECT_TYPE) r_mask,
- (SELECT_TYPE) w_mask, (SELECT_TYPE) NULL,
- (struct timeval *) NULL);
- if (nfound < 0 && errno != EINTR)
- _XIOError(dpy);
- } while (nfound <= 0);
-
- if (_XANYSET(r_mask)) {
- char buf[BUFSIZE];
- long pend_not_register;
- register long pend;
- register xEvent *ev;
-
- /* find out how much data can be read */
- if (BytesReadable(dpy->fd, (char *) &pend_not_register) < 0)
- _XIOError(dpy);
- pend = pend_not_register;
-
- /* must read at least one xEvent; if none is pending, then
- we'll just block waiting for it */
- if (pend < SIZEOF(xEvent)) pend = SIZEOF(xEvent);
-
- /* but we won't read more than the max buffer size */
- if (pend > BUFSIZE) pend = BUFSIZE;
-
- /* round down to an integral number of XReps */
- pend = (pend / SIZEOF(xEvent)) * SIZEOF(xEvent);
-
- N_XRead (dpy, buf, pend);
-
- /* no space between comma and type or else macro will die */
- STARTITERATE (ev,xEvent, buf, (pend > 0),
- (pend -= SIZEOF(xEvent))) {
- if (ev->u.u.type == X_Error)
- _XError (dpy, (xError *) ev);
- else /* it's an event packet; die */
- DPSFatalProc(NULL, "N_XWaitForWritable read bogus X event");
- }
- ENDITERATE
- }
- if (_XANYSET(w_mask))
- return;
- }
-}
-
-
-N_XWaitForReadable(dpy)
- Display *dpy;
-{
- unsigned long r_mask[MSKCNT];
- int result;
-
- CLEARBITS(r_mask);
- do {
- BITSET(r_mask, dpy->fd);
- result = select(dpy->fd + 1, (SELECT_TYPE) r_mask, (SELECT_TYPE) NULL,
- (SELECT_TYPE) NULL, (struct timeval *) NULL);
- if (result == -1 && errno != EINTR) _XIOError(dpy);
- } while (result <= 0);
-}
-
-#ifdef XXX
-
-static int padlength[4] = {0, 3, 2, 1}; /* make sure auth is multiple of 4 */
-
-_XSendClientPrefix (dpy, client, auth_proto, auth_string)
- Display *dpy;
- xConnClientPrefix *client; /* contains count for auth_* */
- char *auth_proto, *auth_string; /* NOT null-terminated */
-{
- int auth_length = client->nbytesAuthProto;
- int auth_strlen = client->nbytesAuthString;
- char padbuf[3]; /* for padding to 4x bytes */
- int pad;
- struct iovec iovarray[5], *iov = iovarray;
- int niov = 0;
-
-#define add_to_iov(b,l) \
- { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; }
-
- add_to_iov ((caddr_t) client, SIZEOF(xConnClientPrefix));
-
- /*
- * write authorization protocol name and data
- */
- if (auth_length > 0) {
- add_to_iov (auth_proto, auth_length);
- pad = padlength [auth_length & 3];
- if (pad) add_to_iov (padbuf, pad);
- }
- if (auth_strlen > 0) {
- add_to_iov (auth_string, auth_strlen);
- pad = padlength [auth_strlen & 3];
- if (pad) add_to_iov (padbuf, pad);
- }
-
-#undef add_to_iov
-
- (void) WritevToServer (dpy->fd, iovarray, niov);
- return;
-}
-
-#endif /* XXX */
diff --git a/xc/lib/dps/csfindNX.c b/xc/lib/dps/csfindNX.c
deleted file mode 100644
index 312fe2b81..000000000
--- a/xc/lib/dps/csfindNX.c
+++ /dev/null
@@ -1,658 +0,0 @@
-/*
- * csfindNX.c -- DPSCAP client Xlib extension hookup
- *
- * (c) Copyright 1992-1994 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
- */
-/* $XFree86: xc/lib/dps/csfindNX.c,v 1.3 2000/02/18 12:18:53 tsi Exp $ */
-
-#include <sys/param.h> /* for MAXHOSTNAMELEN */
-#include <stdlib.h>
-#include <string.h>
-#include <pwd.h>
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xlibint.h>
-#include <X11/Xatom.h>
-#include <X11/Xresource.h>
-#include "csfindNX.h"
-#include "dpsNXprops.h"
-#include "Xlibnet.h"
-#include "DPS/dpsXclient.h"
-#include "DPS/dpsNXargs.h"
-#include <DPS/XDPSlib.h>
-#include "cslibint.h"
-
-extern char *getenv();
-
-/* ---Defines--- */
-
-#define CANTSTARTAGENT "Unable to start agent.\n"
-
-/* ---Types--- */
-
-typedef struct {
- Window id;
- int willingness;
-} Agent, *AgentIdList;
-
-/* ---Globals--- */
-
-static char *XDPSLNXHost = NULL;
-static int XDPSLNXPort = 0; /* default port to be used */
-static int XDPSLNXTrans = XDPSNX_TRANS_UNIX;
-static int gXDPSNXLaunchedAgentTrans = XDPSNX_USE_BEST;
-static int gXDPSNXLaunchedAgentPort = XDPSNX_USE_BEST;
-static char *gXDPSNXExecObj = XDPSNX_DEFAULT_EXEC_NAME; /* NX object file */
-static char **gXDPSNXExecArgs = NULL; /* the args for gXDPSNXExecObj */
-static Bool gWasAgentSet = False;
-static Bool gXDPSNXAutoLaunch = False;
-unsigned char gXDPSNXErrorCode;
-extern int gNXSndBufSize; /* Output buffer size, zero means default */
-
-static char *getHomeDir();
-
-/* ---Private Functions--- */
-
-static int
-TmpErrorHandler(dpy, err)
- Display *dpy;
- XErrorEvent *err;
-{
- gXDPSNXErrorCode = err->error_code;
-}
-
-
-static int
-GetProperty(dpy, w, prop, type, nitems, data)
- Display *dpy;
- Window w;
- Atom prop;
- Atom type;
- int *nitems; /* IN: if non-null then RETURN val */
- char **data; /* RETURN */
-{
- long largest_len = ((((unsigned long) -1) >> 1) / 4);
- Atom actual_type;
- int actual_format;
- unsigned long actual_number;
- unsigned long remaining;
-
- if (type == None) return(!Success); /* We need to have a type */
- if ((XGetWindowProperty(dpy, w, prop, 0, largest_len, False, type,
- &actual_type, &actual_format, &actual_number,
- &remaining, (unsigned char **) data) == Success)
- && (actual_type == type)) {
- if (nitems != NULL) *nitems = actual_number;
- return(Success);
- } else {
- if (*nitems != 0) { /* if data returned, clean up */
- XFree(*data);
- *data = NULL; /* is this necessary? */
- *nitems = 0;
- }
- return(!Success);
- }
-}
-
-
-/*
- GetAgentIdList returns a list of agents advertising on the passed display (dpy),
- and it returns the number of agents in the list in the parameter nAgents.
- The returned list is sorted in most to least willing order.
- GetAgentIdList assumes that it has exclusive access to the server associated with
- dpy (ie. it assumes that the caller has done an XGrabServer).
- */
-static AgentIdList
-GetAgentIdList(dpy, nAgents)
- Display *dpy;
- unsigned long *nAgents; /* RETURN: number of agents in list */
-{
- Atom serverListAtom = XInternAtom(dpy, XDPSNX_BILLBOARD_PROP, True);
- Window *agents = NULL;
- AgentIdList agentList = NULL;
- int (*oldErrorHandler)() = (int (*)())NULL; /* the current error handler */
- int i, current;
-
- if (serverListAtom == None) { /* Servers registered on dpy */
- goto failed;
- }
-
- XSync(dpy, False); /* force processing of pending requests */
-
- if (GetProperty(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- serverListAtom, XA_WINDOW, nAgents,
- (char **) &agents) != Success) {
- goto failed;
- }
-
- if ((agentList = (AgentIdList)
- Xcalloc(*nAgents, (unsigned) sizeof(Agent))) == NULL)
- goto failed;
-
- /* let's go through the list and figure out which servers are okay */
- oldErrorHandler = XSetErrorHandler(TmpErrorHandler);
- current = 0;
- for (i=0; i < *nAgents; i++) {
- unsigned long len;
- int *agentWillingness;
- int k;
-
- for (k=0; k < i; k++) /* Search for duplicate ids */
- if (agents[i] == agents[k]) { /* uh oh... */
- agents[i] = None;
- break;
- }
- if (k == i) { /* No duplicate ids */
- if (GetProperty(dpy, agents[i],
- XInternAtom(dpy, XDPSNX_WILLINGNESS_PROP, True),
- XA_INTEGER, &len, (char **) &agentWillingness)
- != Success) {
- /* Assume that Agent i is dead... */
- /* reap the agent */
- agents[i] = None;
- gXDPSNXErrorCode = None;
- } else {
- int j = 0;
-
- /* insert the agents into agentList in "most to least willing" order */
- while ((j < current) && (agentList[j].willingness > *agentWillingness))
- j++;
- if (j < current)
- (void) bcopy((char *) &agentList[j], (char *) &agentList[j+1],
- sizeof(Agent) * (*nAgents - j - 1));
- agents[current] = agents[i];
- agentList[j].id = agents[current++];
- agentList[j].willingness = *agentWillingness;
- XFree(agentWillingness);
- }
- }
- }
- (void) XSetErrorHandler(oldErrorHandler);
- oldErrorHandler = NULL;
- if (*nAgents != current) { /* agent list changed */
- if (current > 0) { /* are there living ones? */
- *nAgents = current;
- /* write the list back out onto the root window */
- (void) XChangeProperty(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- serverListAtom, XA_WINDOW, 32,
- PropModeReplace, (unsigned char *) agents, *nAgents);
- } else {
- (void) XDeleteProperty(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- serverListAtom);
- goto failed;
- }
- }
- (void) XFree(agents);
- return(agentList);
-
- failed:
- if (agents != NULL) XFree(agents);
- if (agentList != NULL) XFree(agentList);
- if (oldErrorHandler != NULL) (void) XSetErrorHandler(oldErrorHandler);
- *nAgents = 0;
- return(NULL);
-}
-
-
-static int
-XDPSNXOnDisplay(dpy, licenseMethod, host, transport, port)
- Display *dpy;
- char *licenseMethod;
- char **host;
- int *transport;
- int *port;
-{
- int nAgents = 0;
- AgentIdList agentList = NULL;
- Bool match = False;
- int i = 0;
- int status = !Success;
-
-#ifdef DPSLNKL
- extern unsigned ANXKFunc();
-#endif /* DPSLNKL */
-
- (void) XGrabServer(dpy); /* Can we do this later? */
- if ((agentList = GetAgentIdList(dpy, &nAgents)) == NULL)
- goto cleanup;
- /* NOTE: agentList was sorted most to least willing by GetAgentIdList */
- if (agentList[i].willingness <= 0) { /* Is there a willing agent? */
- DPSWarnProc(NULL, "Found agent(s) for display, but none willing to accept connections.\n");
- goto cleanup;
- }
-
-#ifdef DPSLNKL
- /* Masterkey bypass code */
- if (ANXKFunc() != 0) {
- /* We have a willing agent and the client has masterkeys so... */
- match = True;
- } else /* Search for appropriate agent */
-#endif /* DPSLNKL */
- {
- /* need to get licensing info from dpy */
- Atom desiredLicenseMethod, openLicenseMethod;
- char openLicenseString[256];
-
- (void) sprintf(openLicenseString, "%s:%d",
- LICENSE_METHOD_OPEN,
- OPEN_LICENSE_VERSION);
- openLicenseMethod = XInternAtom(dpy, openLicenseString, True);
-
- if (licenseMethod != NULL)
- desiredLicenseMethod = XInternAtom(dpy, licenseMethod, True);
- else
- desiredLicenseMethod = None;
-
- if ((desiredLicenseMethod != None) || (openLicenseMethod != None)) {
- for (i=0;
- (i < nAgents) && (agentList[i].willingness > 0) && (match == False);
- i++) {
- Atom *licenseMethods = NULL;
- unsigned long nMethods;
- unsigned long remaining;
- int j;
-
- if (GetProperty(dpy, agentList[i].id,
- XInternAtom(dpy, XDPSNX_LICENSE_METHOD_PROP, True),
- XA_ATOM,
- &nMethods, (char **) &licenseMethods) != Success)
- goto cleanup;
-
- /*
- Check to see if the agent supports either our desired license method or
- if it is an open service.
- */
- j = 0;
- while((j < nMethods)
- && (licenseMethods[j] != desiredLicenseMethod)
- && (licenseMethods[j] != openLicenseMethod)) j++;
- if (j < nMethods) { /* We found one */
- match = True;
- break;
- }
- (void) XFree(licenseMethods);
- }
- }
- }
-
- if (match) { /* We had a match on license method */
- TransportInfo *transInfo;
-
- if (GetProperty(dpy, agentList[i].id,
- XInternAtom(dpy, XDPSNX_TRANSPORT_INFO_PROP, True),
- XA_INTEGER, NULL, (char **) &transInfo) != Success) {
- goto cleanup;
- } else { /* We got one! */
- *transport = transInfo->transport;
- *port = transInfo->port;
- match = True;
- XFree(transInfo);
- }
- if (GetProperty(dpy, agentList[i].id,
- XInternAtom(dpy, XDPSNX_HOST_NAME_PROP, True), XA_STRING,
- NULL, (char **) host) == Success) {
- status = Success;
- /*
- * If transport is TCP, but we are on the same host as the agent then
- * trade-up to the more efficient UNIX transport...
- */
- if (*transport == XDPSNX_TRANS_TCP) {
- char hostname[MAXHOSTNAMELEN];
- (void) N_XGetHostname(hostname, MAXHOSTNAMELEN);
- if (strcmp(hostname, *host) == 0)
- *transport = XDPSNX_TRANS_UNIX;
- }
- }
- }
- /*
- * Exit Clauses: status inited to FAILURE. Therefore cleanup "assumes"
- * a failure unless noted otherwise.
- */
- cleanup:
- (void) XUngrabServer(dpy);
- (void) XDPSLFlush(dpy); /* Flush the ungrab */
- if (agentList != NULL) XFree(agentList);
- return(status);
-}
-
-
-static int
-ParseAgentString(string, hostname, transport, port)
- char *string;
- char **hostname; /* RETURN */
- int *transport; /* RETURN */
- int *port; /* RETURN */
-{
- int dnet = 0;
- Bool transportSpecified = False;
- char namebuf[255];
- char *lastp, *p;
-
- (void) strncpy(namebuf, string, strlen(string)+1);
- p = &namebuf[0];
- /*
- * Step 1, find the hostname. This is delimited by a required colon.
- */
- for (lastp = p; *p && *p != ':'; p++);
- if (!*p) return(!Success); /* There must be a colon */
-
- if (*(p+1) == ':') {
- dnet++;
- *(p++) = '\0';
- }
- *(p++) = '\0';
-
- /*
- * Step 2, get the port number. It follows the colon(s)
- */
- if (*p == '\0') /* No port number specified... */
- return(!Success);
-
- *port = atoi(p);
-
- /*
- * Step 3, transport?
- */
- if (namebuf[0] == '\0') { /* no transport/hostname specified... */
- if (dnet)
- (void) strcpy(namebuf, "0");
- else { /* no hostname, so must be UNIX */
- *hostname = NULL;
- *transport = XDPSNX_TRANS_UNIX;
- return(Success);
- }
- } else {
- /* find the delimiting '/' */
- for (p = &namebuf[0]; *p && *p != '/'; p++);
- if (*p == '/') {
- transportSpecified = True;
- *p = '\0';
- p++;
- } else /* no transport specified */
- p = &namebuf[0];
- if ((*hostname = (char *) Xmalloc(strlen(p))) == NULL)
- return(!Success); /* can't alloc space for hostname */
- (void) strcpy(*hostname, p);
-
- /* identify protocol */
- if (dnet)
- *transport = XDPSNX_TRANS_DECNET;
- else if (transportSpecified)
- if (strcmp(namebuf, "unix") == 0)
- *transport = XDPSNX_TRANS_UNIX;
- else /* assume tcp */
- *transport = XDPSNX_TRANS_TCP;
- else
- *transport = XDPSNX_TRANS_TCP;
- }
- return(Success);
-}
-
-static int
-FindXDPSNXInXrmDatabase(dpy, host, transport, port)
- Display *dpy;
- char **host;
- int *transport;
- int *port;
-{
- XrmDatabase rDB = NULL; /* for merged database */
- XrmDatabase serverDB, applicationDB;
- char filenamebuf[1024];
- char *filename = &filenamebuf[0];
- char *env, *str_type;
- char name[255];
- XrmValue value;
- int retVal = !Success;
-
- XrmInitialize();
- (void) strcpy(name, "/usr/lib/X11/app-defaults/");
- (void) strcat(name, XDPSNX_X_CLASS_NAME);
-
- /* try to get application defaults file, if there is any */
- XrmMergeDatabases(XrmGetFileDatabase(name), &rDB);
-
- /* try to merge the server defaults. if not defined then use .Xdefaults */
- if (XResourceManagerString(dpy) != NULL) {
- serverDB = XrmGetStringDatabase(XResourceManagerString(dpy));
- } else { /* use the .Xdefaults */
- (void) getHomeDir(filename);
- (void) strcat(filename, "/.Xdefaults");
-
- serverDB = XrmGetFileDatabase(filename);
- }
- XrmMergeDatabases(serverDB, &rDB);
-
- /* try the XENVIRONMENT file, or if not defined, then .Xdefaults */
- if ((env = getenv("XENVIRONMENT")) == NULL) {
- int len;
- env = getHomeDir(filename);
- (void) strcat(filename, "/.Xdefaults-");
- len = strlen(env);
- (void) gethostname(env+len, 1024-len);
- }
- XrmMergeDatabases(XrmGetFileDatabase(env), &rDB);
-
- /* Now that the database is built, try to extract the values we want. */
-
- if (XrmGetResource(rDB, XDPSNX_X_RESOURCE, XDPSNX_X_CLASS_NAME, &str_type,
- &value) == True) {
- retVal = ParseAgentString((char *) value.addr, host, transport, port);
- }
- (void) XrmDestroyDatabase(rDB);
- return(retVal);
-}
-
-
-static char *
-getHomeDir(dest)
- char *dest;
-{
- register char *ptr;
-
- if ((ptr = getenv("HOME")) != NULL) {
- (void) strcpy(dest, ptr);
- } else {
- struct passwd *pw;
-
- if ((ptr = getenv("USER")) != NULL) {
- pw = getpwnam(ptr);
- } else {
- pw = getpwuid(getuid());
- }
- if (pw) {
- (void) strcpy(dest, pw->pw_dir);
- } else {
- *dest = ' ';
- }
- }
- return (dest);
-}
-
-
-
-/* ---Public Functions--- */
-
-int gForceLaunchHack = 0; /* Undocumented way to force autolaunch */
-
-XDPSNXFindNXResult
-XDPSNXFindNX(dpy, licenseMethod, host, transport, port)
- Display *dpy;
- char *licenseMethod;
- char **host;
- int *transport;
- int *port;
-{
- char *agentenv;
-
- if (gForceLaunchHack)
- return(findnx_not_found);
-
- if (gWasAgentSet) { /* check if client set up host */
- *host = XDPSLNXHost;
- *transport = XDPSLNXTrans;
- *port = XDPSLNXPort;
- return(findnx_found);
- /* check DPSNXHOST environment variable */
- } else if ((agentenv = getenv(AGENT_ENV_VAR)) != NULL) {
- int status = ParseAgentString(agentenv, host, transport, port);
- if (status != Success) {
- DPSWarnProc((DPSContext) NULL, "Illegal syntax for DPSNXHOST");
- return(findnx_error);
- } else return(findnx_found);
- /* check advertisements... */
- } else if (XDPSNXOnDisplay(dpy, licenseMethod, host, transport, port) ==
- Success) {
- return(findnx_found);
- /* check XrmDatabase */
- } else if (FindXDPSNXInXrmDatabase(dpy, host, transport, port) == Success) {
- return(findnx_found);
- }
- /* Nada */
- return(findnx_not_found);
-}
-
-
-Status
-XDPSNXSetClientArg(arg, value)
- int arg;
- void *value;
-{
- Display *dpy;
-
- if (arg == XDPSNX_AGENT) {
- gWasAgentSet = True;
- return(ParseAgentString(value,
- &XDPSLNXHost, &XDPSLNXTrans, &XDPSLNXPort));
- }
- else if (arg == XDPSNX_EXEC_FILE) {
- if ((gXDPSNXExecObj = Xmalloc(strlen((char *) value) + 1)) == NULL) {
- return(!Success);
- }
- gXDPSNXExecObj = strcpy(gXDPSNXExecObj, (char *) value);
- } else if (arg == XDPSNX_EXEC_ARGS) {
- int i;
- char **cpp, **execInfo;
-
- execInfo = (char **) value;
- for(cpp = execInfo, i = 1; *cpp != NULL; i++, cpp++); /* count */
- gXDPSNXExecArgs = (char **) Xcalloc(i, sizeof(char *));
- if (gXDPSNXExecArgs == NULL) return(!Success);
- for(cpp = gXDPSNXExecArgs; *execInfo != NULL;
- execInfo++, cpp++) {
- /* copy each entry */
- if ((*cpp = Xmalloc(strlen(*execInfo) + 1)) == NULL)
- return(!Success);
- *cpp = strcpy(*cpp, *execInfo);
- }
- } else if (arg == XDPSNX_AUTO_LAUNCH) {
- gXDPSNXAutoLaunch = (Bool) value;
- } else if (arg == XDPSNX_LAUNCHED_AGENT_TRANS) {
- gXDPSNXLaunchedAgentTrans = (int) value;
- } else if (arg == XDPSNX_LAUNCHED_AGENT_PORT) {
- gXDPSNXLaunchedAgentPort = (int) value;
- } else if (arg == XDPSNX_REQUEST_XSYNC) {
- dpy = (Display *) value;
- if (dpy == (Display *)NULL)
- return(Success);
- XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_SYNC);
- } else if (arg == XDPSNX_REQUEST_RECONCILE) {
- dpy = (Display *) value;
- if (dpy == (Display *)NULL)
- return(Success);
- XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_RECONCILE);
- } else if (arg == XDPSNX_REQUEST_BUFFER) {
- dpy = (Display *) value;
- if (dpy == (Display *)NULL)
- return(Success);
- XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_BUFFER);
- } else if (arg == XDPSNX_GC_UPDATES_SLOW) {
- dpy = (Display *) value;
- if (dpy == (Display *)NULL)
- return(Success);
- XDPSLSetGCFlushMode(dpy, XDPSNX_GC_UPDATES_SLOW);
- } else if (arg == XDPSNX_GC_UPDATES_FAST) {
- dpy = (Display *) value;
- if (dpy == (Display *)NULL)
- return(Success);
- XDPSLSetGCFlushMode(dpy, XDPSNX_GC_UPDATES_FAST);
- } else if (arg == XDPSNX_SEND_BUF_SIZE) {
- int i = (int) value;
- if (i >= 4096 && i <= 65536) gNXSndBufSize = i;
- }
- return(Success);
-}
-
-
-void
-XDPSGetNXArg(arg, value)
- int arg;
- void **value;
-{
- static char agentBuffer[255];
-
- if (arg == XDPSNX_AGENT) {
- switch(XDPSLNXTrans) {
- case XDPSNX_TRANS_UNIX:
- (void) sprintf(agentBuffer, "unix/");
- break;
- case XDPSNX_TRANS_TCP:
- (void) sprintf(agentBuffer, "tcp/");
- break;
- case XDPSNX_TRANS_DECNET:
- (void) sprintf(agentBuffer, "decnet/");
- break;
- default:
- DPSWarnProc(NULL, "Unknown transport passed to XDPSGetNXArg ignored.\n");
- agentBuffer[0] = '\0';
- break;
- }
- (void) strcat(agentBuffer, XDPSLNXHost);
- (void) strcat(agentBuffer,
- (XDPSLNXTrans == XDPSNX_TRANS_DECNET ? "::" : ":"));
- (void) sprintf(&agentBuffer[strlen(agentBuffer)], "%d", XDPSLNXPort);
- *value = (void *) agentBuffer;
- }
- else if (arg == XDPSNX_EXEC_FILE) {
- *value = (void *) gXDPSNXExecObj;
- } else if (arg == XDPSNX_EXEC_ARGS) {
- *value = (void *) gXDPSNXExecArgs;
- } else if (arg == XDPSNX_AUTO_LAUNCH) {
- *value = (void *) gXDPSNXAutoLaunch;
- } else if (arg == XDPSNX_LAUNCHED_AGENT_TRANS) {
- *value = (void *) gXDPSNXLaunchedAgentTrans;
- } else if (arg == XDPSNX_LAUNCHED_AGENT_PORT) {
- *value = (void *) gXDPSNXLaunchedAgentPort;
- }
-}
diff --git a/xc/lib/dps/csfindNX.h b/xc/lib/dps/csfindNX.h
deleted file mode 100644
index 3e25dbaef..000000000
--- a/xc/lib/dps/csfindNX.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * csfindNX.h
- *
- * (c) Copyright 1992-1994 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
- */
-
-#ifndef CSFINDNX_H
-#define CSFINDNX_H
-
-
-/* ---DEFINES--- */
-
-#define XDPSNX_DEFAULT_EXEC_NAME "dpsnx.agent"
-
-
-#ifndef _NO_PROTO
-#define ARGS(list) list
-#else
-#define ARGS(list) ()
-#endif
-
-/* ---TYPES--- */
-
-typedef enum {
- findnx_found,
- findnx_not_found,
- findnx_error
-} XDPSNXFindNXResult;
-
-
-/* ---Functions--- */
-
-extern XDPSNXFindNXResult
-XDPSNXFindNX ARGS((
- Display *dpy, /* Display client wants to attach to */
- char *licenseMethod, /* license method client speaks */
- char **host, /* RETURN: Agent host name */
- int *transport, /* RETURN: Agent transport */
- int *port)); /* RETURN: Agent's port */
- /*
- * Find an agent for this client that will service display dpy.
- * The licenseMethod arg. specifies the type of licensing that the client
- * is capable of speaking. A (char *) NULL, means that it can handle
- * any type (i.e. master key in lock & key).
- * Return values indicates success in finding an agent.
- * Success: host, transport, and port indicate where the agent is.
- * !Success: the values of host, transport, and port are undefined.
- * The client of the call is responsible for freeing the space (XFree())
- * allocated for the host name string.
- */
-
-
-extern void
-XDPSGetNXArg ARGS((
- int arg, /* Argument to be retrieved */
- void **value)); /* value of the argument */
- /*
- Gets the value of the given argument. Returns the value in val. If the
- value will fit in val (ie, a Bool) then the value is placed there,
- otherwise a pointer to the value is placed there. It is assumed that
- the caller will know the correct type. The types of arguments are
- detailed with the argument definitions in dpsNXargs.h.
- NOTE: the caller should NOT modify any values returned via pointer.
- XDPSGetNXArg does not copy the data, rather it returns a pointer to the
- internally held structure.
- */
-
-#endif /* CSFINDNX_H */
diff --git a/xc/lib/dps/cslibext.c b/xc/lib/dps/cslibext.c
deleted file mode 100644
index 62332b962..000000000
--- a/xc/lib/dps/cslibext.c
+++ /dev/null
@@ -1,759 +0,0 @@
-/*
- * cslibext.c -- DPSCAP client Xlib extension hookup
- *
- * (c) Copyright 1991-1994 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
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <sys/param.h> /* for MAXHOSTNAMELEN */
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xlibint.h>
-#include "cslibint.h"
-#include <DPS/XDPS.h>
-#include <DPS/XDPSproto.h>
-#include <DPS/dpsXclient.h>
-#include <DPS/dpsNXargs.h>
-#include "DPSCAPClient.h"
-#include "dpsassert.h"
-#include <DPS/XDPSlib.h>
-
-/* === DEFINES === */
-
-#define DPSNXSYNCGCMODE_FLUSH 0
-#define DPSNXSYNCGCMODE_SYNC 1
-#define DPSNXSYNCGCMODE_DELAYED 2
-#define DPSNXSYNCGCMODE_DEFAULT DPSNXSYNCGCMODE_DELAYED
-
-/* === GLOBALS === */
-
-DPSCAPGlobals gCSDPS = NULL;
-
-#ifdef DPSLNKL
-#define ANXCYAN
-#define ANXMAGENTA
-#define ANXYELLOW
-#define ANXBLACK
-#define ANXSPOT
-#include "dpslnkl.inc"
-#endif /* DPSLNKL */
-
-int gNXSyncGCMode = DPSNXSYNCGCMODE_DEFAULT;
-
-/* === PUBLIC PROCS === */
-
-int
-CSDPSInit(dpy, numberType, floatingName)
- Display *dpy;
- int *numberType; /* RETURN */
- char **floatingName; /* RETURN */
-{
- register Display *agent;
- register xCAPConnReplyPrefix *p;
- register char *c;
- DPSCAPData my;
- xCAPConnSetupReq setup;
- union {
- xCAPConnSuccess good;
- xCAPConnFailed bad;
- } reply;
- XExtData *extData;
- XExtCodes *codes;
- int indian;
- int rest;
- Window clientWindow;
- char fullDisplayName[MAXHOSTNAMELEN+10];
- int DPSCAPCopyGCProc(), DPSCAPFreeGCProc(), DPSCAPFlushGCProc();
- extern char * getenv();
-
- if (gCSDPS == NULL)
- DPSCAPStartUp();
-
- /* To fix dps-nx #68, Motif too slow on HP */
- if (c = getenv("DPSNXGCMODE"))
- {
- gNXSyncGCMode = atoi(c);
- if (gNXSyncGCMode < DPSNXSYNCGCMODE_FLUSH
- || gNXSyncGCMode > DPSNXSYNCGCMODE_DELAYED)
- gNXSyncGCMode = DPSNXSYNCGCMODE_DEFAULT;
- }
-
- /* We may have already called this routine via XDPSExtensionPresent,
- so don't do it again! */
-
- if ((codes = XDPSLGetCodes(dpy))
- && (agent = XDPSLGetShunt(dpy))
- && agent != dpy
- && codes->major_opcode == DPSXOPCODEBASE)
- return(DPSCAPSUCCESS);
-
- /* Try to create a window for ClientMessage communication */
-
- clientWindow = XCreateSimpleWindow(
- dpy,
- DefaultRootWindow(dpy),
- 0, 0,
- 1, 1,
- 0,
- BlackPixel(dpy, DefaultScreen(dpy)),
- WhitePixel(dpy, DefaultScreen(dpy)));
- if (clientWindow == None)
- return(DPSCAPFAILED);
-
- /* Try to open a connection to an agent */
-
- if ((extData = DPSCAPOpenAgent(dpy, fullDisplayName)) == NULL)
- {
- XDestroyWindow(dpy, clientWindow);
- return(DPSCAPFAILED);
- }
-
- /* DPSCAPOpenAgent only partially fills in extData, so finish it */
-
- codes = XAddExtension(dpy);
- codes->major_opcode = DPSXOPCODEBASE;
- codes->first_event = 0; /* REQUIRED */
- codes->first_error = FirstExtensionError;
- extData->number = codes->extension;
- extData->free_private = DPSCAPDestroy;
- my = (DPSCAPData) extData->private_data;
- my->codes = codes;
- agent = my->agent;
- /* +++ Is this all we have to do here? */
-
- /* Send opening handshake */
-
- indian = 1;
- if (*(char *) &indian)
- setup.byteorder = 'l';
- else
- setup.byteorder = 'B';
- setup.dpscapVersion = DPSCAPPROTOVERSION;
- setup.flags = DPSCAPNONEFLAG;
- setup.libraryversion = DPSPROTOCOLVERSION;
- setup.authProtoNameLength = 0;
- setup.authProtoDataLength = 0;
- setup.displayStringLength = strlen(fullDisplayName);
- setup.nodeStringLength = 0;
- setup.transportStringLength = 0;
- setup.display = 0;
- setup.screen = 0;
- setup.reserved = 0;
- setup.clientWindow = clientWindow;
-
-#ifndef DPSLNKL
- DPSCAPWrite(agent, (char *)&setup, sizeof(xCAPConnSetupReq), dpscap_nopad,dpscap_insert);
- DPSCAPWrite(agent, fullDisplayName, setup.displayStringLength, dpscap_pad, dpscap_append);
- N_XFlush(agent);
-#else /* DPSLNKL */
- if (CSDPSConfirmDisplay(agent, dpy, &setup, &reply, fullDisplayName) == 1)
- {
- p = (xCAPConnReplyPrefix *)&reply.good;
- goto skip_read;
- }
- /* Read normal reply */
-#endif /* DPSLNKL */
-
- /* Read common reply prefix */
-
- p = (xCAPConnReplyPrefix *)&reply.good;
- N_XRead(agent, (char *)p, (long)sizeof(xCAPConnReplyPrefix));
-skip_read:
- if (!p->success)
- {
- char mbuf[512];
- /* read the rest */
- c = (char *)&reply.bad.serverVersion;
- N_XRead(agent, c, sz_xCAPConnFailed - sz_xCAPConnReplyPrefix);
- sprintf(mbuf, "DPS NX: connection to \"%s\" refused by agent.", DisplayString(agent));
- DPSWarnProc(NULL, mbuf);
- c = (char *)Xmalloc(reply.bad.reasonLength);
- if (!c) return(DPSCAPFAILED);
- N_XReadPad(agent, c, (long)reply.bad.reasonLength);
- if (!reply.bad.reasonLength)
- sprintf(mbuf, "DPS NX: (no reason given)\n");
- else
- {
- strcpy(mbuf, "DPS NX: ");
- strncat(mbuf, c, reply.bad.reasonLength);
- mbuf[reply.bad.reasonLength+7] = '\0';
- }
- DPSWarnProc(NULL, mbuf);
- Xfree(c);
- DPSCAPDestroy(extData);
- Xfree(extData);
- XDestroyWindow(dpy, clientWindow);
- return(DPSCAPFAILED);
- }
-
- /* read the rest of the fixed length reply */
- c = (char *)&reply.good.serverVersion;
- rest = sizeof(xCAPConnSuccess) - sizeof(xCAPConnReplyPrefix);
- N_XRead(agent, c, rest);
-
- /* verify */
-
- if (reply.good.serverVersion < DPSPROTOCOLVERSION)
- {
- /* Fine, we downgrade the client */
- char qbuf[256];
- sprintf(qbuf, "NX: server version %d older than expected %d, client will downgrade", reply.good.serverVersion, DPSPROTOCOLVERSION);
- DPSWarnProc(NULL, qbuf);
- }
- my->dpscapVersion = reply.good.dpscapVersion;
- if (my->dpscapVersion < DPSCAPPROTOVERSION)
- {
- /* Fine, we downgrade the client */
- char kbuf[256];
- sprintf(kbuf, "NX: agent version %d older than expected %d, client will downgrade", my->dpscapVersion, DPSCAPPROTOVERSION);
- DPSWarnProc(NULL, kbuf);
-#ifdef XXX
- /* Saving this code as a reminder about what needs to be
- cleaned up if we exit here */
- DPSCAPDestroy(extData);
- Xfree(extData);
- XDestroyWindow(clientWindow);
- return(DPSCAPFAILED);
-#endif
- }
-
- if (numberType)
- *numberType = reply.good.preferredNumberFormat;
-
- /* read additional data */
-
- c = (char *)Xmalloc(reply.good.floatingNameLength + 1);
- N_XReadPad(agent, c, reply.good.floatingNameLength);
- c[reply.good.floatingNameLength] = 0;
- if (floatingName)
- *floatingName = c;
- else
- Xfree(c);
-
- /* set library extension data */
-
- XDPSLSetVersion(agent, reply.good.serverVersion);
- XDPSLSetVersion(dpy, reply.good.serverVersion);
- XDPSLSetShunt(dpy, agent);
- XDPSLSetCodes(dpy, codes);
- if (XDPSLGetSyncMask(dpy) == DPSCAP_SYNCMASK_NONE)
- XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_DFLT);
- my->agentWindow = reply.good.agentWindow;
- XDPSLSetGCFlushMode(dpy, XDPSNX_GC_UPDATES_SLOW); /* default */
-
- /* Hook my extension data on the dpy */
-
- my->extData = extData;
- XAddToExtensionList(CSDPSHeadOfDpyExt(dpy), extData);
- (void) XESetCloseDisplay(dpy, codes->extension, DPSCAPCloseDisplayProc);
- (void) XESetCopyGC(dpy, codes->extension, DPSCAPCopyGCProc);
- (void) XESetFreeGC(dpy, codes->extension, DPSCAPFreeGCProc);
- (void) XESetFlushGC(dpy, codes->extension, DPSCAPFlushGCProc);
- XDPSLSetClientMessageHandler(dpy);
-
- /* Chain my data on global list */
-
- my->next = gCSDPS->head;
- gCSDPS->head = my;
-
-#ifdef MAHALO
- /* Set function that is called after every Xlib protocol proc */
- XDPSLSetAfterProc(dpy);
-
- /* All CSDPS protocol is auto-flushed */
- {
- static int DPSCAPFlushAfterProc();
-
- (void) XSetAfterFunction(agent, DPSCAPFlushAfterProc);
- }
-#endif /* MAHALO */
-
- /* set agent arguments, if needed */
- /* must follow setting of ShuntMap at least, so safest to
- do here when everything has been setup */
- XDPSLUpdateAgentArgs(dpy);
-
- return(DPSCAPSUCCESS);
-}
-
-
-XExtData **
-CSDPSHeadOfDpyExt(dpy)
- Display *dpy;
-{
- XEDataObject object;
-
- object.display = dpy;
- return(XEHeadOfExtensionList(object));
-}
-
-void
-XDPSSyncGCClip(dpy, gc)
- register Display *dpy;
- register GC gc;
-{
- /* The primary utility of this function is for DPS NX correctness,
- but it also helps DPS/X do less work in tracking GC changes. */
- XDPSLSyncGCClip(dpy, gc);
-}
-
-void
-XDPSReconcileRequests(ctxt)
- register DPSContext ctxt;
-{
- Display *dpy;
- register ContextXID cxid;
- register DPSContext curCtxt;
-
- for (curCtxt = ctxt; curCtxt; curCtxt = curCtxt->chainChild)
- {
- cxid = XDPSXIDFromContext(&dpy, curCtxt);
- if (dpy == (Display *)NULL || cxid == None)
- break; /* Skip text contexts */
- XDPSLReconcileRequests(dpy, cxid);
- }
-}
-
-Status
-XDPSNXSetAgentArg(dpy, arg, val)
- Display *dpy;
- int arg, val;
-{
- if (!dpy || arg >= 0 || arg < AGENTLASTARG)
- return(!Success);
- else
- return(XDPSLSetAgentArg(dpy, arg, val));
-}
-
-/* New for DPS NX 2.0 */
-void
-XDPSFlushGC(dpy, gc)
- Display *dpy;
- GC gc;
-{
- if (dpy && gc)
- XDPSLFlushGC(dpy, gc);
-}
-
-/* === SUPPORT PROCS === */
-
-void
-DPSCAPChangeGC(agent, gc, valuemask, values)
- register Display *agent;
- GC gc;
- unsigned long valuemask;
- XGCValues *values;
-{
- register xChangeGCReq *req;
- register _XExtension *ext;
- unsigned long oldDirty = gc->dirty;
-
- /* ASSERT: called from within LockDisplay section */
-
- /* Always include the clip_mask */
- valuemask |= GCClipMask;
- /* +++ HACK! Hide the gc->rects flag in arc_mode */
- valuemask |= GCArcMode;
- valuemask &= (1L << (GCLastBit + 1)) - 1;
-
- /* Stupid macro insists on Display being called 'dpy' */
- {
- Display *dpy = agent;
- Display *xdpy = (Display *)NULL;
- NXMacroGetReq(ChangeGC, req);
- }
- req->gc = XGContextFromGC(gc);
- gc->dirty = req->mask = valuemask;
- {
-/* Derived from MIT XCrGC.c, _XGenerateGCList:
-Copyright 1985, 1986, 1987, 1988, 1989 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.
-*/
- /* Warning! This code assumes that "unsigned int" is 32-bits wide */
-
- unsigned int vals[32];
- register unsigned int *value = vals;
- long nvalues;
- register XGCValues *gv = values;
- register unsigned long dirty = gc->dirty;
-
- /*
- * Note: The order of these tests are critical; the order must be the
- * same as the GC mask bits in the word.
- */
- if (dirty & GCFunction) *value++ = gv->function;
- if (dirty & GCPlaneMask) *value++ = gv->plane_mask;
- if (dirty & GCForeground) *value++ = gv->foreground;
- if (dirty & GCBackground) *value++ = gv->background;
- if (dirty & GCLineWidth) *value++ = gv->line_width;
- if (dirty & GCLineStyle) *value++ = gv->line_style;
- if (dirty & GCCapStyle) *value++ = gv->cap_style;
- if (dirty & GCJoinStyle) *value++ = gv->join_style;
- if (dirty & GCFillStyle) *value++ = gv->fill_style;
- if (dirty & GCFillRule) *value++ = gv->fill_rule;
- if (dirty & GCTile) *value++ = gv->tile;
- if (dirty & GCStipple) *value++ = gv->stipple;
- if (dirty & GCTileStipXOrigin) *value++ = gv->ts_x_origin;
- if (dirty & GCTileStipYOrigin) *value++ = gv->ts_y_origin;
- if (dirty & GCFont) *value++ = gv->font;
- if (dirty & GCSubwindowMode) *value++ = gv->subwindow_mode;
- if (dirty & GCGraphicsExposures) *value++ = gv->graphics_exposures;
- if (dirty & GCClipXOrigin) *value++ = gv->clip_x_origin;
- if (dirty & GCClipYOrigin) *value++ = gv->clip_y_origin;
- if (dirty & GCClipMask) *value++ = gv->clip_mask;
- if (dirty & GCDashOffset) *value++ = gv->dash_offset;
- if (dirty & GCDashList) *value++ = gv->dashes;
- /* +++ HACK! Hide gc->rects flag in GCArcMode */
- if (dirty & GCArcMode) *value++ = gc->rects;
-
- req->length += (nvalues = value - vals);
-
- /*
- * note: Data is a macro that uses its arguments multiple
- * times, so "nvalues" is changed in a separate assignment
- * statement
- */
-
- nvalues <<= 2;
- Data32 (agent, (long *) vals, nvalues);
- }
-
- gc->dirty = oldDirty;
-
- /* ASSERT: SyncHandle called by caller */
-}
-
-
-DPSCAPData
-DPSCAPCreate(dpy, agent)
- Display *dpy, *agent;
-{
- register DPSCAPData my = (DPSCAPData)Xcalloc(1, sizeof(DPSCAPDataRec));
-
- if (my == (DPSCAPData)NULL) return(NULL);
- my->dpy = dpy;
- my->agent = agent;
- my->typePSOutput = XInternAtom(
- dpy,
- DPSCAP_TYPE_PSOUTPUT,
- False);
- my->typePSOutputWithLen = XInternAtom(
- dpy,
- DPSCAP_TYPE_PSOUTPUT_LEN,
- False);
- my->typePSStatus = XInternAtom(
- dpy,
- DPSCAP_TYPE_PSSTATUS,
- False);
- my->typeNoop = XInternAtom(
- dpy,
- DPSCAP_TYPE_NOOP,
- False);
- my->typeSync = XInternAtom(
- dpy,
- DPSCAP_TYPE_SYNC,
- False);
- my->typeXError = XInternAtom(
- dpy,
- DPSCAP_TYPE_XERROR,
- False);
- my->typePSReady = XInternAtom(
- dpy,
- DPSCAP_TYPE_PSREADY,
- False);
- my->typeResume = XInternAtom(
- dpy,
- DPSCAP_TYPE_RESUME,
- False);
- return(my);
-}
-
-int
-DPSCAPDestroy(extData)
- XExtData *extData;
-{
- register DPSCAPData my = (DPSCAPData) extData->private_data;
- register DPSCAPData n;
-
- if (my == (DPSCAPData)NULL) return(0);
- DPSCAPCloseAgent(my->agent);
- my->agent = NULL;
- /* my->extData->private_data = NIL; ???? +++ */
- if (my == gCSDPS->head)
- gCSDPS->head = my->next;
- else for (n = gCSDPS->head; n != NULL; n = n->next)
- if (n->next == my)
- {
- n->next = my->next;
- break;
- }
- Xfree(my);
- /* extData freed by caller (e.g., _XFreeExtData) */
- return(0);
-}
-
-void
-DPSCAPStartUp()
-{
- gCSDPS = (DPSCAPGlobals)Xcalloc(1, sizeof(DPSCAPGlobalsRec));
-}
-
-
-static unsigned char padAdd[] = {0, 3, 2, 1};
-
-void
-DPSCAPWrite(agent, buf, len, writePad, bufMode)
- register Display *agent;
- char *buf;
- register unsigned len;
- register DPSCAPIOFlags writePad;
- DPSCAPIOFlags bufMode;
-{
- int pad = padAdd[len & 3];
- unsigned fullLen = (writePad == dpscap_pad) ? len + pad : len;
-
- if (agent->bufptr + fullLen > agent->bufmax)
- N_XFlush(agent);
- if (agent->max_request_size && fullLen > agent->max_request_size)
- {
- DPSWarnProc(NULL, "DPS Client Library: request length exceeds max request size. Truncated.\n");
- len = agent->max_request_size;
- pad = 0;
- }
- if (bufMode == dpscap_insert)
- {
- agent->last_req = agent->bufptr;
- agent->request++;
- }
- bcopy(buf, agent->bufptr, len);
- agent->bufptr += len;
- if (writePad == dpscap_pad && pad)
- {
- bcopy((char *) padAdd, agent->bufptr, pad);
- agent->bufptr += pad;
- }
-}
-
-
-/* === EXT CALLBACK HOOKS === */
-
-int
-DPSCAPCloseDisplayProc(dpy, codes)
- Display *dpy;
- XExtCodes *codes;
-{
-#ifdef CSDPS
- fprintf(stderr, "NX: Closing agent \"%s\"\n", dpy->display_name);
-#endif
-
- /* Although it seems that we should free codes here, we can't
- because Xlib owns the storage */
-
- XDPSLSetShunt(dpy, (Display *) NULL);
- XDPSLSetCodes(dpy, (XExtCodes *) NULL);
- XDPSLSetSyncMask(dpy, DPSCAP_SYNCMASK_NONE);
- XDPSLCleanAll(dpy);
- XDPSPrivZapDpy(dpy);
- return(0);
-}
-
-
-int
-DPSCAPCopyGCProc(dpy, gc, codes)
- Display *dpy;
- GC gc;
- XExtCodes *codes;
-{
- XGCValues values;
- DPSCAPData my;
- XExtData *extData = XFindOnExtensionList(
- CSDPSHeadOfDpyExt(dpy),
- codes->extension);
-
- if (extData)
- my = (DPSCAPData) extData->private_data;
- else
- return(0);
-
- /* We change the GC unconditionally, since friggin' XCopyGC
- clears the dirty bits of the values that are copied! */
-
- DPSAssertWarn(XGetGCValues(dpy, gc, DPSGCBITS & ~(GCClipMask), &values),
- NULL, "DPS NX: XGetGCValues returned False\n");
- values.clip_mask = gc->values.clip_mask;
- DPSCAPChangeGC(my->agent, gc, DPSGCBITS, &values);
- /* We have to make sure that the agent completely processes
- the change to the GC. If we allow the agent to update the
- GC in its own sweet time, the stupid client may delete the
- GC after the agent has already queued a request to, e.g.,
- copy the GC, but before the request is flushed. */
- XDPSLSync(dpy);
- return(1);
-}
-
-int
-DPSCAPFreeGCProc(pdpy, gc, codes)
- Display *pdpy;
- GC gc;
- XExtCodes *codes;
-{
- register xCAPNotifyReq *req;
- DPSCAPData my;
- Display *dpy = pdpy; /* Stupid macros insists on Display being 'dpy' */
- XExtData *extData = XFindOnExtensionList(
- CSDPSHeadOfDpyExt(dpy),
- codes->extension);
-
- if (extData)
- my = (DPSCAPData) extData->private_data;
- else
- return(0);
-
- /* Notify the agent that the client deleted a GC. Let the
- agent figure out if it cares. */
-
- /* ASSERT: called from within LockDisplay section */
-
- dpy = my->agent;
- if (dpy == (Display *)NULL || dpy == pdpy)
- return(0);
-
- /* May need to sync changes to GC */
- if (gNXSyncGCMode == DPSNXSYNCGCMODE_DELAYED)
- XDPSLSync(pdpy);
-
- {
- Display *xdpy = pdpy; /* pdpy is X server */
- NXMacroGetReq(CAPNotify, req);
- }
- req->reqType = DPSCAPOPCODEBASE;
- req->type = X_CAPNotify;
- req->cxid = 0;
- req->notification = DPSCAPNOTE_FREEGC;
- req->data = XGContextFromGC(gc);
- req->extra = 0;
- /* Guarantee that everyone sees GC go away */
- XSync(pdpy, False); /* pdpy is X server */
- if (gNXSyncGCMode == DPSNXSYNCGCMODE_FLUSH)
- {
- LockDisplay(dpy); /* dpy means agent here */
- N_XFlush(dpy);
- UnlockDisplay(dpy);
- }
- else
- XDPSLSync(pdpy);
-
- /* ASSERT: SynchHandle called by caller */
- return(1);
-}
-
-#ifdef CSDPSDEBUG
-static unsigned int gcCountFlushedClean = 0;
-static unsigned int gcCountFlushedDirty = 0;
-#endif /* CSDPSDEBUG */
-
-int
-DPSCAPFlushGCProc(dpy, gc, codes)
- Display *dpy;
- GC gc;
- XExtCodes *codes;
-{
- XGCValues values;
- DPSCAPData my;
- XExtData *extData;
- unsigned long int dirty;
-
- /* When GC is created, it is flushed with no dirty bits set,
- so we have to notice that situation. */
-
- if (gc->dirty)
- {
- if (XDPSLGetGCFlushMode(dpy) == XDPSNX_GC_UPDATES_FAST
- || !(gc->dirty & DPSGCBITS))
- return(0);
- }
- extData = XFindOnExtensionList(CSDPSHeadOfDpyExt(dpy), codes->extension);
- if (extData)
- my = (DPSCAPData) extData->private_data;
- else
- return(0);
- /* HERE IF (gc->dirty & DPSGCBITS || !gc->dirty) */
- dirty = gc->dirty;
- DPSAssertWarn(XGetGCValues(dpy, gc, DPSGCBITS & ~(GCClipMask), &values),
- NULL, "NX: XGetGCValues returned False\n");
- values.clip_mask = gc->values.clip_mask;
- /* Must guarantee that gc change is registered by X server
- before notification is sent to agent. */
- XSync(dpy, False);
- DPSCAPChangeGC(my->agent, gc, DPSGCBITS, &values);
- /* We have to make sure that the agent completely processes
- the change to the GC. If we allow the agent to update the
- GC in its own sweet time, the stupid client may delete the
- GC after the agent has already queued a request to, e.g.,
- copy the GC, but before the request is flushed. */
- if (gNXSyncGCMode == DPSNXSYNCGCMODE_SYNC)
- XDPSLSync(dpy);
- else
- XDPSLFlush(dpy);
-#ifdef CSDPSDEBUG
- if (dirty)
- ++gcCountFlushedDirty;
- else
- ++gcCountFlushedClean;
-#endif /* CSDPSDEBUG */
- return(1);
-}
-
-
-static int
-DPSCAPFlushAfterProc(agent)
- Display *agent;
-{
- LockDisplay(agent);
- N_XFlush(agent);
- UnlockDisplay(agent);
-}
diff --git a/xc/lib/dps/cslibint.c b/xc/lib/dps/cslibint.c
deleted file mode 100644
index 4ec2ac5a0..000000000
--- a/xc/lib/dps/cslibint.c
+++ /dev/null
@@ -1,2003 +0,0 @@
-/*
- * cslibint.c -- low level I/O
- *
- * (c) Copyright 1993-1994 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
- *
- * Portions Copyright 1985, 1986, 1987 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.
- *
- * Author: Adobe Systems Incorporated and MIT X Consortium
- */
-/* $XFree86: xc/lib/dps/cslibint.c,v 1.3 2000/02/21 18:05:34 dawes Exp $ */
-
-/*
- * XlibInternal.c - Internal support routines for the C subroutine
- * interface library (Xlib) to the X Window System Protocol V11.0.
- */
-#define NEED_EVENTS
-#define NEED_REPLIES
-
-#include <X11/Xlibint.h>
-#include <X11/Xos.h>
-#include "Xlibnet.h"
-#include <stdio.h>
-
-static void _EatData32();
-
-/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX
- * systems are broken and return EWOULDBLOCK when they should return EAGAIN
- */
-#if defined(EAGAIN) && defined(EWOULDBLOCK)
-#define ETEST(err) (err == EAGAIN || err == EWOULDBLOCK)
-#else
-#ifdef EAGAIN
-#define ETEST(err) (err == EAGAIN)
-#else
-#define ETEST(err) (err == EWOULDBLOCK)
-#endif
-#endif
-
-#ifdef LACHMAN
-#ifdef EMSGSIZE
-#undef EMSGSIZE
-#endif
-#define EMSGSIZE ERANGE
-#endif
-
-#if defined(SVR4) && defined(sun)
-#define SUNSYSV 1
-#endif
-
-/*
- * The following routines are internal routines used by Xlib for protocol
- * packet transmission and reception.
- *
- * XIOError(Display *) will be called if any sort of system call error occurs.
- * This is assumed to be a fatal condition, i.e., XIOError should not return.
- *
- * XError(Display *, XErrorEvent *) will be called whenever an X_Error event is
- * received. This is not assumed to be a fatal condition, i.e., it is
- * acceptable for this procedure to return. However, XError should NOT
- * perform any operations (directly or indirectly) on the DISPLAY.
- *
- * Routines declared with a return type of 'Status' return 0 on failure,
- * and non 0 on success. Routines with no declared return type don't
- * return anything. Whenever possible routines that create objects return
- * the object they have created.
- */
-
-extern _XQEvent *_qfree;
-
-static int padlength[4] = {0, 3, 2, 1};
- /* lookup table for adding padding bytes to data that is read from
- or written to the X socket. */
-
-static xReq _dummy_request = {
- 0, 0, 0
-};
-/*
- * N_XFlush - Flush the X request buffer. If the buffer is empty, no
- * action is taken. This routine correctly handles incremental writes.
- * This routine may have to be reworked if int < long.
- */
-N_XFlush (dpy)
- register Display *dpy;
-{
- register long size, todo;
- register int write_stat;
- register char *bufindex;
-
- if (!dpy) return 0;
-
- if (dpy->flags & XlibDisplayIOError) return 0;
-
- size = todo = dpy->bufptr - dpy->buffer;
- bufindex = dpy->bufptr = dpy->buffer;
- /*
- * While write has not written the entire buffer, keep looping
- * until the entire buffer is written. bufindex will be incremented
- * and size decremented as buffer is written out.
- */
- while (size) {
- errno = 0;
- write_stat = WriteToServer(dpy->fd, bufindex, (int) todo);
- if (write_stat >= 0) {
- size -= write_stat;
- todo = size;
- bufindex += write_stat;
- } else if (ETEST(errno)) {
- N_XWaitForWritable(dpy);
-#ifdef SUNSYSV
- } else if (errno == 0) {
- N_XWaitForWritable(dpy);
-#endif
-#ifdef EMSGSIZE
- } else if (errno == EMSGSIZE) {
- if (todo > 1)
- todo >>= 1;
- else
- N_XWaitForWritable(dpy);
-#endif
- } else if (errno != EINTR) {
- /* Write failed! */
- /* errno set by write system call. */
- _XIOError(dpy);
- }
- }
- dpy->last_req = (char *)&_dummy_request;
- return 0;
-}
-
-#ifdef NEEDFORNX
-
-int
-_XEventsQueued (dpy, mode)
- register Display *dpy;
- int mode;
-{
- register int len;
- int pend;
- char buf[BUFSIZE];
- register xReply *rep;
-
- if (mode == QueuedAfterFlush)
- {
- _XFlush(dpy);
- if (dpy->qlen)
- return(dpy->qlen);
- }
- if (dpy->flags & XlibDisplayIOError) return(dpy->qlen);
- if (BytesReadable(dpy->fd, (char *) &pend) < 0)
- _XIOError(dpy);
-#ifdef XCONN_CHECK_FREQ
- /* This is a crock, required because FIONREAD or equivalent is
- * not guaranteed to detect a broken connection.
- */
- if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ)
- {
- unsigned long r_mask[MSKCNT];
- static struct timeval zero_time;
-
- dpy->conn_checker = 0;
- CLEARBITS(r_mask);
- BITSET(r_mask, dpy->fd);
- if (pend = select(dpy->fd + 1, (int *)r_mask, NULL, NULL,
- &zero_time))
- {
- if (pend > 0)
- {
- if (BytesReadable(dpy->fd, (char *) &pend) < 0)
- _XIOError(dpy);
- /* we should not get zero, if we do, force a read */
- if (!pend)
- pend = SIZEOF(xReply);
- }
- else if (pend < 0 && errno != EINTR)
- _XIOError(dpy);
- }
- }
-#endif /* XCONN_CHECK_FREQ */
- if (!(len = pend))
- return(dpy->qlen); /* _XFlush can enqueue events */
- /* Force a read if there is not enough data. Otherwise,
- * a select() loop at a higher-level will spin undesirably,
- * and we've seen at least one OS that appears to not update
- * the result from FIONREAD once it has returned nonzero.
- */
- if (len < SIZEOF(xReply))
- len = SIZEOF(xReply);
- else if (len > BUFSIZE)
- len = BUFSIZE;
- len /= SIZEOF(xReply);
- pend = len * SIZEOF(xReply);
-#ifdef XCONN_CHECK_FREQ
- dpy->conn_checker = 0;
-#endif
- _XRead (dpy, buf, (long) pend);
-
- /* no space between comma and type or else macro will die */
- STARTITERATE (rep,xReply, buf, (len > 0), len--) {
- if (rep->generic.type == X_Error)
- _XError(dpy, (xError *)rep);
- else /* must be an event packet */
- _XEnq(dpy, (xEvent *) rep);
- }
- ENDITERATE
- return(dpy->qlen);
-}
-
-/* _XReadEvents - Flush the output queue,
- * then read as many events as possible (but at least 1) and enqueue them
- */
-_XReadEvents(dpy)
- register Display *dpy;
-{
- char buf[BUFSIZE];
- long pend_not_register; /* because can't "&" a register variable */
- register long pend;
- register xEvent *ev;
- Bool not_yet_flushed = True;
-
- do {
- /* find out how much data can be read */
- if (BytesReadable(dpy->fd, (char *) &pend_not_register) < 0)
- _XIOError(dpy);
- pend = pend_not_register;
-
- /* must read at least one xEvent; if none is pending, then
- we'll just flush and block waiting for it */
- if (pend < SIZEOF(xEvent)) {
- pend = SIZEOF(xEvent);
- /* don't flush until we block the first time */
- if (not_yet_flushed) {
- int qlen = dpy->qlen;
- _XFlush (dpy);
- if (qlen != dpy->qlen) return;
- not_yet_flushed = False;
- }
- }
-
- /* but we won't read more than the max buffer size */
- if (pend > BUFSIZE)
- pend = BUFSIZE;
-
- /* round down to an integral number of XReps */
- pend = (pend / SIZEOF(xEvent)) * SIZEOF(xEvent);
-
- _XRead (dpy, buf, pend);
-
- /* no space between comma and type or else macro will die */
- STARTITERATE (ev,xEvent, buf, (pend > 0),
- pend -= SIZEOF(xEvent)) {
- if (ev->u.u.type == X_Error)
- _XError (dpy, (xError *) ev);
- else /* it's an event packet; enqueue it */
- _XEnq (dpy, ev);
- }
- ENDITERATE
- } while (dpy->head == NULL);
-}
-
-#endif /* NEEDFORNX */
-
-/*
- * N_XRead - Read bytes from the socket taking into account incomplete
- * reads. This routine may have to be reworked if int < long.
- */
-N_XRead (dpy, data, size)
- register Display *dpy;
- register char *data;
- register long size;
-{
- register long bytes_read;
-
- if (!dpy) return 0;
- if ((dpy->flags & XlibDisplayIOError) || size == 0) return 0;
- errno = 0;
- while ((bytes_read = ReadFromServer(dpy->fd, data, (int)size))
- != size) {
-
- if (bytes_read > 0) {
- size -= bytes_read;
- data += bytes_read;
- }
- else if (ETEST(errno)) {
- N_XWaitForReadable(dpy);
- errno = 0;
- }
-#ifdef SUNSYSV
- else if (errno == 0) {
- N_XWaitForReadable(dpy);
- }
-#endif
- else if (bytes_read == 0) {
- /* Read failed because of end of file! */
- errno = EPIPE;
- _XIOError(dpy);
- }
-
- else /* bytes_read is less than 0; presumably -1 */ {
- /* If it's a system call interrupt, it's not an error. */
- if (errno != EINTR)
- _XIOError(dpy);
- }
- }
- return 0;
-}
-
-#ifdef WORD64
-
-/*
- * XXX This is a *really* stupid way of doing this....
- * PACKBUFFERSIZE must be a multiple of 4.
- */
-
-#define PACKBUFFERSIZE 4096
-
-
-/*
- * _XRead32 - Read bytes from the socket unpacking each 32 bits
- * into a long (64 bits on a CRAY computer).
- *
- */
-static _doXRead32 (dpy, data, size, packbuffer)
- register Display *dpy;
- register long *data;
- register long size;
- register char *packbuffer;
-{
- long *lpack,*lp;
- long mask32 = 0x00000000ffffffff;
- long maskw, nwords, i, bits;
-
- _XReadPad (dpy, packbuffer, size);
-
- lp = data;
- lpack = (long *) packbuffer;
- nwords = size >> 2;
- bits = 32;
-
- for(i=0;i<nwords;i++){
- maskw = mask32 << bits;
- *lp++ = ( *lpack & maskw ) >> bits;
- bits = bits ^32;
- if(bits){
- lpack++;
- }
- }
-}
-
-_XRead32 (dpy, data, len)
- Display *dpy;
- long *data;
- long len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nunits = PACKBUFFERSIZE >> 2;
-
- for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) {
- _doXRead32 (dpy, data, PACKBUFFERSIZE, packbuffer);
- }
- if (len) _doXRead32 (dpy, data, len, packbuffer);
-}
-
-
-
-/*
- * _XRead16 - Read bytes from the socket unpacking each 16 bits
- * into a long (64 bits on a CRAY computer).
- *
- */
-static _doXRead16 (dpy, data, size, packbuffer)
- register Display *dpy;
- register short *data;
- register long size;
- char *packbuffer;
-{
- long *lpack,*lp;
- long mask16 = 0x000000000000ffff;
- long maskw, nwords, i, bits;
-
- _XRead(dpy,packbuffer,size); /* don't do a padded read... */
-
- lp = (long *) data;
- lpack = (long *) packbuffer;
- nwords = size >> 1; /* number of 16 bit words to be unpacked */
- bits = 48;
- for(i=0;i<nwords;i++){
- maskw = mask16 << bits;
- *lp++ = ( *lpack & maskw ) >> bits;
- bits -= 16;
- if(bits < 0){
- lpack++;
- bits = 48;
- }
- }
-}
-
-_XRead16 (dpy, data, len)
- Display *dpy;
- short *data;
- long len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nunits = PACKBUFFERSIZE >> 1;
-
- for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) {
- _doXRead16 (dpy, data, PACKBUFFERSIZE, packbuffer);
- }
- if (len) _doXRead16 (dpy, data, len, packbuffer);
-}
-
-_XRead16Pad (dpy, data, size)
- Display *dpy;
- short *data;
- long size;
-{
- int slop = (size & 3);
- short slopbuf[3];
-
- _XRead16 (dpy, data, size);
- if (slop > 0) {
- _XRead16 (dpy, slopbuf, 4 - slop);
- }
-}
-#endif /* WORD64 */
-
-
-/*
- * N_XReadPad - Read bytes from the socket taking into account incomplete
- * reads. If the number of bytes is not 0 mod 32, read additional pad
- * bytes. This routine may have to be reworked if int < long.
- */
-N_XReadPad (dpy, data, size)
- register Display *dpy;
- register char *data;
- register long size;
-{
- register long bytes_read;
- struct iovec iov[2];
- char pad[3];
-
- if (!dpy) return 0;
- if ((dpy->flags & XlibDisplayIOError) || size == 0) return 0;
- iov[0].iov_len = (int)size;
- iov[0].iov_base = data;
- /*
- * The following hack is used to provide 32 bit long-word
- * aligned padding. The [1] vector is of length 0, 1, 2, or 3,
- * whatever is needed.
- */
-
- iov[1].iov_len = padlength[size & 3];
- iov[1].iov_base = pad;
- size += iov[1].iov_len;
- errno = 0;
- while ((bytes_read = ReadvFromServer (dpy->fd, iov, 2)) != size) {
-
- if (bytes_read > 0) {
- size -= bytes_read;
- if ((iov[0].iov_len -= bytes_read) < 0) {
- iov[1].iov_len += iov[0].iov_len;
- iov[1].iov_base = (char *)iov[1].iov_base - iov[0].iov_len;
- iov[0].iov_len = 0;
- }
- else
- iov[0].iov_base = (char *)iov[0].iov_base + bytes_read;
- }
- else if (ETEST(errno)) {
- N_XWaitForReadable(dpy);
- errno = 0;
- }
-#ifdef SUNSYSV
- else if (errno == 0) {
- N_XWaitForReadable(dpy);
- }
-#endif
- else if (bytes_read == 0) {
- /* Read failed because of end of file! */
- errno = EPIPE;
- _XIOError(dpy);
- }
-
- else /* bytes_read is less than 0; presumably -1 */ {
- /* If it's a system call interrupt, it's not an error. */
- if (errno != EINTR)
- _XIOError(dpy);
- }
- }
- return 0;
-}
-
-/*
- * N_XSend - Flush the buffer and send the client data. 32 bit word aligned
- * transmission is used, if size is not 0 mod 4, extra bytes are transmitted.
- * This routine may have to be reworked if int < long;
- */
-N_XSend (dpy, data, size)
- register Display *dpy;
- char *data;
- register long size;
-{
- struct iovec iov[3];
- static char pad[3] = {0, 0, 0};
- /* XText8 and XText16 require that the padding bytes be zero! */
-
- long skip = 0;
- long dpybufsize = (dpy->bufptr - dpy->buffer);
- long padsize = padlength[size & 3];
- long total = dpybufsize + size + padsize;
- long todo = total;
-
- if (dpy->flags & XlibDisplayIOError) return 0;
-
- /*
- * There are 3 pieces that may need to be written out:
- *
- * o whatever is in the display buffer
- * o the data passed in by the user
- * o any padding needed to 32bit align the whole mess
- *
- * This loop looks at all 3 pieces each time through. It uses skip
- * to figure out whether or not a given piece is needed.
- */
- while (total) {
- long before = skip; /* amount of whole thing written */
- long remain = todo; /* amount to try this time, <= total */
- int i = 0;
- long len;
-
- /* You could be very general here and have "in" and "out" iovecs
- * and write a loop without using a macro, but what the heck. This
- * translates to:
- *
- * how much of this piece is new?
- * if more new then we are trying this time, clamp
- * if nothing new
- * then bump down amount already written, for next piece
- * else put new stuff in iovec, will need all of next piece
- *
- * Note that todo had better be at least 1 or else we'll end up
- * writing 0 iovecs.
- */
-#define InsertIOV(pointer, length) \
- len = (length) - before; \
- if (len > remain) \
- len = remain; \
- if (len <= 0) { \
- before = (-len); \
- } else { \
- iov[i].iov_len = len; \
- iov[i].iov_base = (pointer) + before; \
- i++; \
- remain -= len; \
- before = 0; \
- }
-
- InsertIOV (dpy->buffer, dpybufsize)
- InsertIOV (data, size)
- InsertIOV (pad, padsize)
-
- errno = 0;
- if ((len = WritevToServer(dpy->fd, iov, i)) >= 0) {
- skip += len;
- total -= len;
- todo = total;
- } else if (ETEST(errno)) {
- N_XWaitForWritable(dpy);
-#ifdef SUNSYSV
- } else if (errno == 0) {
- N_XWaitForWritable(dpy);
-#endif
-#ifdef EMSGSIZE
- } else if (errno == EMSGSIZE) {
- if (todo > 1)
- todo >>= 1;
- else
- N_XWaitForWritable(dpy);
-#endif
- } else if (errno != EINTR) {
- _XIOError(dpy);
- }
- }
-
- dpy->bufptr = dpy->buffer;
- dpy->last_req = (char *) & _dummy_request;
- return 0;
-}
-
-#ifdef NEEDFORNX
-/*
- * _XAllocID - normal resource ID allocation routine. A client
- * can roll his own and instatantiate it if he wants, but must
- * follow the rules.
- */
-XID _XAllocID(dpy)
-register Display *dpy;
-{
- XID id;
-
- id = dpy->resource_id << dpy->resource_shift;
- if (id <= dpy->resource_mask) {
- dpy->resource_id++;
- return (dpy->resource_base + id);
- }
- if (id != 0x10000000) {
- (void) fprintf(stderr,
- "Xlib: resource ID allocation space exhausted!\n");
- id = 0x10000000;
- dpy->resource_id = id >> dpy->resource_shift;
- }
- return id;
-}
-
-/*
- * The hard part about this is that we only get 16 bits from a reply. Well,
- * then, we have three values that will march along, with the following
- * invariant:
- * dpy->last_request_read <= rep->sequenceNumber <= dpy->request
- * The right choice for rep->sequenceNumber is the largest that
- * still meets these constraints.
- */
-
-unsigned long
-_XSetLastRequestRead(dpy, rep)
- register Display *dpy;
- register xGenericReply *rep;
-{
- register unsigned long newseq, lastseq;
-
- /*
- * KeymapNotify has no sequence number, but is always guaranteed
- * to immediately follow another event, except when generated via
- * SendEvent (hmmm).
- */
- if ((rep->type & 0x7f) == KeymapNotify)
- return(dpy->last_request_read);
-
- newseq = (dpy->last_request_read & ~((unsigned long)0xffff)) |
- rep->sequenceNumber;
- lastseq = dpy->last_request_read;
- while (newseq < lastseq) {
- newseq += 0x10000;
- if (newseq > dpy->request) {
- (void) fprintf (stderr,
- "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n",
- newseq, dpy->request,
- (unsigned int) rep->type);
- newseq -= 0x10000;
- break;
- }
- }
-
- dpy->last_request_read = newseq;
- return(newseq);
-}
-
-#endif /* NEEDFORNX */
-
-/*
- * N_XReply - Wait for a reply packet and copy its contents into the
- * specified rep. Mean while we must handle error and event packets that
- * we may encounter.
- */
-Status N_XReply (dpy, rep, extra, discard)
- register Display *dpy;
- register xReply *rep;
- int extra; /* number of 32-bit words expected after the reply */
- Bool discard; /* should I discard data following "extra" words? */
-{
- /* Pull out the serial number now, so that (currently illegal) requests
- * generated by an error handler don't confuse us.
- */
- unsigned long cur_request = dpy->request;
-
- if (dpy->flags & XlibDisplayIOError) return (0);
-
- N_XFlush(dpy);
- while (1) {
- N_XRead(dpy, (char *)rep, (long)SIZEOF(xReply));
- switch ((int)rep->generic.type) {
-
- case X_Reply:
- /* Reply received. Fast update for synchronous replies,
- * but deal with multiple outstanding replies.
- */
- if (rep->generic.sequenceNumber == (cur_request & 0xffff))
- dpy->last_request_read = cur_request;
- else
- (void) _XSetLastRequestRead(dpy, &rep->generic);
- if (extra == 0) {
- if (discard && (rep->generic.length > 0))
- /* unexpectedly long reply! */
- _EatData32 (dpy, rep->generic.length);
- return (1);
- }
- if (extra == rep->generic.length) {
- /*
- * Read the extra data into storage immediately following
- * the GenericReply structure.
- */
- N_XRead (dpy, (char *) (NEXTPTR(rep,xReply)),
- ((long)extra) << 2);
- return (1);
- }
- if (extra < rep->generic.length) {
- /* Actual reply is longer than "extra" */
- N_XRead (dpy, (char *) (NEXTPTR(rep,xReply)),
- ((long)extra) << 2);
- if (discard)
- _EatData32 (dpy, rep->generic.length - extra);
- return (1);
- }
- /*
- *if we get here, then extra > rep->generic.length--meaning we
- * read a reply that's shorter than we expected. This is an
- * error, but we still need to figure out how to handle it...
- */
- N_XRead (dpy, (char *) (NEXTPTR(rep,xReply)),
- ((long) rep->generic.length) << 2);
- _XIOError (dpy);
- return (0);
-
- case X_Error:
- {
- register _XExtension *ext;
- register Bool ret = False;
- int ret_code;
- xError *err = (xError *) rep;
- unsigned long serial;
-
- serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep);
- /*
- * we better see if there is an extension who may
- * want to suppress the error.
- */
- for (ext = dpy->ext_procs; !ret && ext; ext = ext->next) {
- if (ext->error)
- ret = (*ext->error)(dpy, err, &ext->codes, &ret_code);
- }
- if (!ret) {
- _XError(dpy, err);
- ret_code = 0;
- }
- if (serial == cur_request)
- return(ret_code);
- }
- break;
- default:
- /* There should never be any events on this connection! */
- DPSFatalProc(NULL, "N_XReply read bogus X event");
- break;
- }
- }
-}
-
-
-/* Read and discard "n" 8-bit bytes of data */
-
-static void
-N_XEatData (dpy, n)
- Display *dpy;
- register unsigned long n;
-{
-#define SCRATCHSIZE 2048
- char buf[SCRATCHSIZE];
-
- while (n > 0) {
- register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n;
- N_XRead (dpy, buf, bytes_read);
- n -= bytes_read;
- }
-#undef SCRATCHSIZE
-}
-
-
-/* Read and discard "n" 32-bit words. */
-
-static void _EatData32 (dpy, n)
- Display *dpy;
- unsigned long n;
-{
- N_XEatData (dpy, n << 2);
-}
-
-
-#ifdef NEEDFORNX
-/*
- * _XEnq - Place event packets on the display's queue.
- * note that no squishing of move events in V11, since there
- * is pointer motion hints....
- */
-_XEnq (dpy, event)
- register Display *dpy;
- register xEvent *event;
-{
- register _XQEvent *qelt;
-
-/*NOSTRICT*/
- if (qelt = _qfree) {
- /* If _qfree is non-NULL do this, else malloc a new one. */
- _qfree = qelt->next;
- }
- else if ((qelt =
- (_XQEvent *) Xmalloc((unsigned)sizeof(_XQEvent))) == NULL) {
- /* Malloc call failed! */
- errno = ENOMEM;
- _XIOError(dpy);
- }
- qelt->next = NULL;
- /* go call through display to find proper event reformatter */
- if ((*dpy->event_vec[event->u.u.type & 0177])(dpy, &qelt->event, event)) {
- if (dpy->tail) dpy->tail->next = qelt;
- else dpy->head = qelt;
-
- dpy->tail = qelt;
- dpy->qlen++;
- } else {
- /* ignored, or stashed away for many-to-one compression */
- qelt->next = _qfree;
- _qfree = qelt;
- }
-}
-/*
- * EventToWire in separate file in that often not needed.
- */
-#endif /* NEEDFORNX */
-
-/*ARGSUSED*/
-Bool
-N_XUnknownWireEvent(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
-{
- char mbuf[256];
-
- sprintf(mbuf, "NX: unhandled wire event %d, agent = %x", re->type, dpy);
- DPSWarnProc(NULL, mbuf);
- return(False);
-}
-
-/*ARGSUSED*/
-Status
-N_XUnknownNativeEvent(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
-{
- char mbuf[256];
-
- sprintf(mbuf, "NX: unhandled native event %d, agent = %x", re->type, dpy);
- DPSWarnProc(NULL, mbuf);
- return(0);
-}
-
-#ifdef NEEDFORNX
-/*
- * reformat a wire event into an XEvent structure of the right type.
- */
-Bool
-_XWireToEvent(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
-{
-
- re->type = event->u.u.type & 0x7f;
- ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy,
- (xGenericReply *)event);
- ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0);
- ((XAnyEvent *)re)->display = dpy;
-
- /* Ignore the leading bit of the event type since it is set when a
- client sends an event rather than the server. */
-
- switch (event-> u.u.type & 0177) {
- case KeyPress:
- case KeyRelease:
- {
- register XKeyEvent *ev = (XKeyEvent*) re;
- ev->root = event->u.keyButtonPointer.root;
- ev->window = event->u.keyButtonPointer.event;
- ev->subwindow = event->u.keyButtonPointer.child;
- ev->time = event->u.keyButtonPointer.time;
- ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX);
- ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY);
- ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX);
- ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY);
- ev->state = event->u.keyButtonPointer.state;
- ev->same_screen = event->u.keyButtonPointer.sameScreen;
- ev->keycode = event->u.u.detail;
- }
- break;
- case ButtonPress:
- case ButtonRelease:
- {
- register XButtonEvent *ev = (XButtonEvent *) re;
- ev->root = event->u.keyButtonPointer.root;
- ev->window = event->u.keyButtonPointer.event;
- ev->subwindow = event->u.keyButtonPointer.child;
- ev->time = event->u.keyButtonPointer.time;
- ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX);
- ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY);
- ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX);
- ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY);
- ev->state = event->u.keyButtonPointer.state;
- ev->same_screen = event->u.keyButtonPointer.sameScreen;
- ev->button = event->u.u.detail;
- }
- break;
- case MotionNotify:
- {
- register XMotionEvent *ev = (XMotionEvent *)re;
- ev->root = event->u.keyButtonPointer.root;
- ev->window = event->u.keyButtonPointer.event;
- ev->subwindow = event->u.keyButtonPointer.child;
- ev->time = event->u.keyButtonPointer.time;
- ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX);
- ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY);
- ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX);
- ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY);
- ev->state = event->u.keyButtonPointer.state;
- ev->same_screen = event->u.keyButtonPointer.sameScreen;
- ev->is_hint = event->u.u.detail;
- }
- break;
- case EnterNotify:
- case LeaveNotify:
- {
- register XCrossingEvent *ev = (XCrossingEvent *) re;
- ev->root = event->u.enterLeave.root;
- ev->window = event->u.enterLeave.event;
- ev->subwindow = event->u.enterLeave.child;
- ev->time = event->u.enterLeave.time;
- ev->x = cvtINT16toInt(event->u.enterLeave.eventX);
- ev->y = cvtINT16toInt(event->u.enterLeave.eventY);
- ev->x_root = cvtINT16toInt(event->u.enterLeave.rootX);
- ev->y_root = cvtINT16toInt(event->u.enterLeave.rootY);
- ev->state = event->u.enterLeave.state;
- ev->mode = event->u.enterLeave.mode;
- ev->same_screen = (event->u.enterLeave.flags &
- ELFlagSameScreen) && True;
- ev->focus = (event->u.enterLeave.flags &
- ELFlagFocus) && True;
- ev->detail = event->u.u.detail;
- }
- break;
- case FocusIn:
- case FocusOut:
- {
- register XFocusChangeEvent *ev = (XFocusChangeEvent *) re;
- ev->window = event->u.focus.window;
- ev->mode = event->u.focus.mode;
- ev->detail = event->u.u.detail;
- }
- break;
- case KeymapNotify:
- {
- register XKeymapEvent *ev = (XKeymapEvent *) re;
- ev->window = dpy->current;
- bcopy ((char *)((xKeymapEvent *) event)->map,
- &ev->key_vector[1],
- sizeof (((xKeymapEvent *) event)->map));
- }
- break;
- case Expose:
- {
- register XExposeEvent *ev = (XExposeEvent *) re;
- ev->window = event->u.expose.window;
- ev->x = event->u.expose.x;
- ev->y = event->u.expose.y;
- ev->width = event->u.expose.width;
- ev->height = event->u.expose.height;
- ev->count = event->u.expose.count;
- }
- break;
- case GraphicsExpose:
- {
- register XGraphicsExposeEvent *ev =
- (XGraphicsExposeEvent *) re;
- ev->drawable = event->u.graphicsExposure.drawable;
- ev->x = event->u.graphicsExposure.x;
- ev->y = event->u.graphicsExposure.y;
- ev->width = event->u.graphicsExposure.width;
- ev->height = event->u.graphicsExposure.height;
- ev->count = event->u.graphicsExposure.count;
- ev->major_code = event->u.graphicsExposure.majorEvent;
- ev->minor_code = event->u.graphicsExposure.minorEvent;
- }
- break;
- case NoExpose:
- {
- register XNoExposeEvent *ev = (XNoExposeEvent *) re;
- ev->drawable = event->u.noExposure.drawable;
- ev->major_code = event->u.noExposure.majorEvent;
- ev->minor_code = event->u.noExposure.minorEvent;
- }
- break;
- case VisibilityNotify:
- {
- register XVisibilityEvent *ev = (XVisibilityEvent *) re;
- ev->window = event->u.visibility.window;
- ev->state = event->u.visibility.state;
- }
- break;
- case CreateNotify:
- {
- register XCreateWindowEvent *ev =
- (XCreateWindowEvent *) re;
- ev->window = event->u.createNotify.window;
- ev->parent = event->u.createNotify.parent;
- ev->x = cvtINT16toInt(event->u.createNotify.x);
- ev->y = cvtINT16toInt(event->u.createNotify.y);
- ev->width = event->u.createNotify.width;
- ev->height = event->u.createNotify.height;
- ev->border_width = event->u.createNotify.borderWidth;
- ev->override_redirect = event->u.createNotify.override;
- }
- break;
- case DestroyNotify:
- {
- register XDestroyWindowEvent *ev =
- (XDestroyWindowEvent *) re;
- ev->window = event->u.destroyNotify.window;
- ev->event = event->u.destroyNotify.event;
- }
- break;
- case UnmapNotify:
- {
- register XUnmapEvent *ev = (XUnmapEvent *) re;
- ev->window = event->u.unmapNotify.window;
- ev->event = event->u.unmapNotify.event;
- ev->from_configure = event->u.unmapNotify.fromConfigure;
- }
- break;
- case MapNotify:
- {
- register XMapEvent *ev = (XMapEvent *) re;
- ev->window = event->u.mapNotify.window;
- ev->event = event->u.mapNotify.event;
- ev->override_redirect = event->u.mapNotify.override;
- }
- break;
- case MapRequest:
- {
- register XMapRequestEvent *ev = (XMapRequestEvent *) re;
- ev->window = event->u.mapRequest.window;
- ev->parent = event->u.mapRequest.parent;
- }
- break;
- case ReparentNotify:
- {
- register XReparentEvent *ev = (XReparentEvent *) re;
- ev->event = event->u.reparent.event;
- ev->window = event->u.reparent.window;
- ev->parent = event->u.reparent.parent;
- ev->x = cvtINT16toInt(event->u.reparent.x);
- ev->y = cvtINT16toInt(event->u.reparent.y);
- ev->override_redirect = event->u.reparent.override;
- }
- break;
- case ConfigureNotify:
- {
- register XConfigureEvent *ev = (XConfigureEvent *) re;
- ev->event = event->u.configureNotify.event;
- ev->window = event->u.configureNotify.window;
- ev->above = event->u.configureNotify.aboveSibling;
- ev->x = cvtINT16toInt(event->u.configureNotify.x);
- ev->y = cvtINT16toInt(event->u.configureNotify.y);
- ev->width = event->u.configureNotify.width;
- ev->height = event->u.configureNotify.height;
- ev->border_width = event->u.configureNotify.borderWidth;
- ev->override_redirect = event->u.configureNotify.override;
- }
- break;
- case ConfigureRequest:
- {
- register XConfigureRequestEvent *ev =
- (XConfigureRequestEvent *) re;
- ev->window = event->u.configureRequest.window;
- ev->parent = event->u.configureRequest.parent;
- ev->above = event->u.configureRequest.sibling;
- ev->x = cvtINT16toInt(event->u.configureRequest.x);
- ev->y = cvtINT16toInt(event->u.configureRequest.y);
- ev->width = event->u.configureRequest.width;
- ev->height = event->u.configureRequest.height;
- ev->border_width = event->u.configureRequest.borderWidth;
- ev->value_mask = event->u.configureRequest.valueMask;
- ev->detail = event->u.u.detail;
- }
- break;
- case GravityNotify:
- {
- register XGravityEvent *ev = (XGravityEvent *) re;
- ev->window = event->u.gravity.window;
- ev->event = event->u.gravity.event;
- ev->x = cvtINT16toInt(event->u.gravity.x);
- ev->y = cvtINT16toInt(event->u.gravity.y);
- }
- break;
- case ResizeRequest:
- {
- register XResizeRequestEvent *ev =
- (XResizeRequestEvent *) re;
- ev->window = event->u.resizeRequest.window;
- ev->width = event->u.resizeRequest.width;
- ev->height = event->u.resizeRequest.height;
- }
- break;
- case CirculateNotify:
- {
- register XCirculateEvent *ev = (XCirculateEvent *) re;
- ev->window = event->u.circulate.window;
- ev->event = event->u.circulate.event;
- ev->place = event->u.circulate.place;
- }
- break;
- case CirculateRequest:
- {
- register XCirculateRequestEvent *ev =
- (XCirculateRequestEvent *) re;
- ev->window = event->u.circulate.window;
- ev->parent = event->u.circulate.event;
- ev->place = event->u.circulate.place;
- }
- break;
- case PropertyNotify:
- {
- register XPropertyEvent *ev = (XPropertyEvent *) re;
- ev->window = event->u.property.window;
- ev->atom = event->u.property.atom;
- ev->time = event->u.property.time;
- ev->state = event->u.property.state;
- }
- break;
- case SelectionClear:
- {
- register XSelectionClearEvent *ev =
- (XSelectionClearEvent *) re;
- ev->window = event->u.selectionClear.window;
- ev->selection = event->u.selectionClear.atom;
- ev->time = event->u.selectionClear.time;
- }
- break;
- case SelectionRequest:
- {
- register XSelectionRequestEvent *ev =
- (XSelectionRequestEvent *) re;
- ev->owner = event->u.selectionRequest.owner;
- ev->requestor = event->u.selectionRequest.requestor;
- ev->selection = event->u.selectionRequest.selection;
- ev->target = event->u.selectionRequest.target;
- ev->property = event->u.selectionRequest.property;
- ev->time = event->u.selectionRequest.time;
- }
- break;
- case SelectionNotify:
- {
- register XSelectionEvent *ev = (XSelectionEvent *) re;
- ev->requestor = event->u.selectionNotify.requestor;
- ev->selection = event->u.selectionNotify.selection;
- ev->target = event->u.selectionNotify.target;
- ev->property = event->u.selectionNotify.property;
- ev->time = event->u.selectionNotify.time;
- }
- break;
- case ColormapNotify:
- {
- register XColormapEvent *ev = (XColormapEvent *) re;
- ev->window = event->u.colormap.window;
- ev->colormap = event->u.colormap.colormap;
- ev->new = event->u.colormap.new;
- ev->state = event->u.colormap.state;
- }
- break;
- case ClientMessage:
- {
- register int i;
- register XClientMessageEvent *ev
- = (XClientMessageEvent *) re;
- ev->window = event->u.clientMessage.window;
- ev->format = event->u.u.detail;
- switch (ev->format) {
- case 8:
- ev->message_type = event->u.clientMessage.u.b.type;
- for (i = 0; i < 20; i++)
- ev->data.b[i] = event->u.clientMessage.u.b.bytes[i];
- break;
- case 16:
- ev->message_type = event->u.clientMessage.u.s.type;
- ev->data.s[0] = cvtINT16toShort(event->u.clientMessage.u.s.shorts0);
- ev->data.s[1] = cvtINT16toShort(event->u.clientMessage.u.s.shorts1);
- ev->data.s[2] = cvtINT16toShort(event->u.clientMessage.u.s.shorts2);
- ev->data.s[3] = cvtINT16toShort(event->u.clientMessage.u.s.shorts3);
- ev->data.s[4] = cvtINT16toShort(event->u.clientMessage.u.s.shorts4);
- ev->data.s[5] = cvtINT16toShort(event->u.clientMessage.u.s.shorts5);
- ev->data.s[6] = cvtINT16toShort(event->u.clientMessage.u.s.shorts6);
- ev->data.s[7] = cvtINT16toShort(event->u.clientMessage.u.s.shorts7);
- ev->data.s[8] = cvtINT16toShort(event->u.clientMessage.u.s.shorts8);
- ev->data.s[9] = cvtINT16toShort(event->u.clientMessage.u.s.shorts9);
- break;
- case 32:
- ev->message_type = event->u.clientMessage.u.l.type;
- ev->data.l[0] = cvtINT32toLong(event->u.clientMessage.u.l.longs0);
- ev->data.l[1] = cvtINT32toLong(event->u.clientMessage.u.l.longs1);
- ev->data.l[2] = cvtINT32toLong(event->u.clientMessage.u.l.longs2);
- ev->data.l[3] = cvtINT32toLong(event->u.clientMessage.u.l.longs3);
- ev->data.l[4] = cvtINT32toLong(event->u.clientMessage.u.l.longs4);
- break;
- default: /* XXX should never occur */
- break;
- }
- }
- break;
- case MappingNotify:
- {
- register XMappingEvent *ev = (XMappingEvent *)re;
- ev->window = 0;
- ev->first_keycode = event->u.mappingNotify.firstKeyCode;
- ev->request = event->u.mappingNotify.request;
- ev->count = event->u.mappingNotify.count;
- }
- break;
- default:
- return(_XUnknownWireEvent(dpy, re, event));
- }
- return(True);
-}
-
-
-#ifndef USL_SHARELIB
-
-static char *_SysErrorMsg (n)
- int n;
-{
- extern char *sys_errlist[];
- extern int sys_nerr;
- char *s = ((n >= 0 && n < sys_nerr) ? sys_errlist[n] : "unknown error");
-
- return (s ? s : "no such error");
-}
-
-#endif /* USL sharedlibs in don't define for SVR3.2 */
-
-
-/*
- * _XDefaultIOError - Default fatal system error reporting routine. Called
- * when an X internal system error is encountered.
- */
-_XDefaultIOError (dpy)
- Display *dpy;
-{
- (void) fprintf (stderr,
- "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n",
- errno, _SysErrorMsg (errno), DisplayString (dpy));
- (void) fprintf (stderr,
- " after %lu requests (%lu known processed) with %d events remaining.\r\n",
- NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy),
- QLength(dpy));
-
- if (errno == EPIPE) {
- (void) fprintf (stderr,
- " The connection was probably broken by a server shutdown or KillClient.\r\n");
- }
- exit(1);
-}
-
-
-static int _XPrintDefaultError (dpy, event, fp)
- Display *dpy;
- XErrorEvent *event;
- FILE *fp;
-{
- char buffer[BUFSIZ];
- char mesg[BUFSIZ];
- char number[32];
- char *mtype = "XlibMessage";
- register _XExtension *ext = (_XExtension *)NULL;
- _XExtension *bext = (_XExtension *)NULL;
- XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
- XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
- (void) fprintf(fp, "%s: %s\n ", mesg, buffer);
- XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
- mesg, BUFSIZ);
- (void) fprintf(fp, mesg, event->request_code);
- if (event->request_code < 128) {
- sprintf(number, "%d", event->request_code);
- XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ);
- } else {
- for (ext = dpy->ext_procs;
- ext && (ext->codes.major_opcode != event->request_code);
- ext = ext->next)
- ;
- if (ext)
- strcpy(buffer, ext->name);
- else
- buffer[0] = '\0';
- }
- (void) fprintf(fp, " (%s)\n", buffer);
- if (event->request_code >= 128) {
- XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d",
- mesg, BUFSIZ);
- fputs(" ", fp);
- (void) fprintf(fp, mesg, event->minor_code);
- if (ext) {
- sprintf(mesg, "%s.%d", ext->name, event->minor_code);
- XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ);
- (void) fprintf(fp, " (%s)", buffer);
- }
- fputs("\n", fp);
- }
- if (event->error_code >= 128) {
- /* kludge, try to find the extension that caused it */
- buffer[0] = '\0';
- for (ext = dpy->ext_procs; ext; ext = ext->next) {
- if (ext->error_string)
- (*ext->error_string)(dpy, event->error_code, &ext->codes,
- buffer, BUFSIZ);
- if (buffer[0]) {
- bext = ext;
- break;
- }
- if (ext->codes.first_error &&
- ext->codes.first_error < event->error_code &&
- (!bext || ext->codes.first_error > bext->codes.first_error))
- bext = ext;
- }
- if (bext)
- sprintf(buffer, "%s.%d", bext->name,
- event->error_code - bext->codes.first_error);
- else
- strcpy(buffer, "Value");
- XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ);
- if (mesg[0]) {
- fputs(" ", fp);
- (void) fprintf(fp, mesg, event->resourceid);
- fputs("\n", fp);
- }
- /* let extensions try to print the values */
- for (ext = dpy->ext_procs; ext; ext = ext->next) {
- if (ext->error_values)
- (*ext->error_values)(dpy, event, fp);
- }
- } else if ((event->error_code == BadWindow) ||
- (event->error_code == BadPixmap) ||
- (event->error_code == BadCursor) ||
- (event->error_code == BadFont) ||
- (event->error_code == BadDrawable) ||
- (event->error_code == BadColor) ||
- (event->error_code == BadGC) ||
- (event->error_code == BadIDChoice) ||
- (event->error_code == BadValue) ||
- (event->error_code == BadAtom)) {
- if (event->error_code == BadValue)
- XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x",
- mesg, BUFSIZ);
- else if (event->error_code == BadAtom)
- XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x",
- mesg, BUFSIZ);
- else
- XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
- mesg, BUFSIZ);
- fputs(" ", fp);
- (void) fprintf(fp, mesg, event->resourceid);
- fputs("\n", fp);
- }
- XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
- mesg, BUFSIZ);
- fputs(" ", fp);
- (void) fprintf(fp, mesg, event->serial);
- XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
- mesg, BUFSIZ);
- fputs("\n ", fp);
- (void) fprintf(fp, mesg, dpy->request);
- fputs("\n", fp);
- if (event->error_code == BadImplementation) return 0;
- return 1;
-}
-
-int _XDefaultError(dpy, event)
- Display *dpy;
- XErrorEvent *event;
-{
- if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0;
- exit(1);
- /*NOTREACHED*/
-}
-
-/*ARGSUSED*/
-Bool _XDefaultWireError(display, he, we)
- Display *display;
- XErrorEvent *he;
- xError *we;
-{
- return True;
-}
-
-/*
- * _XError - prepare to upcall user protocol error handler
- */
-int _XError (dpy, rep)
- Display *dpy;
- xError *rep;
-{
- /*
- * X_Error packet encountered! We need to unpack the error before
- * giving it to the user.
- */
- XEvent event; /* make it a large event */
-
- event.xerror.display = dpy;
- event.xerror.type = X_Error;
- event.xerror.serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep);
- event.xerror.resourceid = rep->resourceID;
- event.xerror.error_code = rep->errorCode;
- event.xerror.request_code = rep->majorCode;
- event.xerror.minor_code = rep->minorCode;
- if (dpy->error_vec &&
- !(*dpy->error_vec[rep->errorCode])(dpy, &event.xerror, rep))
- return 0;
- if (_XErrorFunction != NULL) {
- return ((*_XErrorFunction)(dpy, &event)); /* upcall */
- } else {
- return _XDefaultError(dpy, &event);
- }
-}
-
-/*
- * _XIOError - call user connection error handler and exit
- */
-int _XIOError (dpy)
- Display *dpy;
-{
- dpy->flags |= XlibDisplayIOError;
- if (_XIOErrorFunction != NULL)
- (*_XIOErrorFunction)(dpy);
- else
- _XDefaultIOError(dpy);
- exit (1);
-}
-
-
-/*
- * This routine can be used to (cheaply) get some memory within a single
- * Xlib routine for scratch space. It is reallocated from the same place
- * each time, unless the library needs a large scratch space.
- */
-char *_XAllocScratch (dpy, nbytes)
- register Display *dpy;
- unsigned long nbytes;
-{
- if (nbytes > dpy->scratch_length) {
- if (dpy->scratch_buffer) Xfree (dpy->scratch_buffer);
- if (dpy->scratch_buffer = Xmalloc((unsigned) nbytes))
- dpy->scratch_length = nbytes;
- else dpy->scratch_length = 0;
- }
- return (dpy->scratch_buffer);
-}
-
-/*
- * Given a visual id, find the visual structure for this id on this display.
- */
-Visual *_XVIDtoVisual (dpy, id)
- Display *dpy;
- VisualID id;
-{
- register int i, j, k;
- register Screen *sp;
- register Depth *dp;
- register Visual *vp;
- for (i = 0; i < dpy->nscreens; i++) {
- sp = &dpy->screens[i];
- for (j = 0; j < sp->ndepths; j++) {
- dp = &sp->depths[j];
- /* if nvisuals == 0 then visuals will be NULL */
- for (k = 0; k < dp->nvisuals; k++) {
- vp = &dp->visuals[k];
- if (vp->visualid == id) return (vp);
- }
- }
- }
- return (NULL);
-}
-
-#if NeedFunctionPrototypes
-XFree (void *data)
-#else
-XFree (data)
- char *data;
-#endif
-{
- Xfree (data);
-}
-
-#ifdef _XNEEDBCOPYFUNC
-void _Xbcopy(b1, b2, length)
- register char *b1, *b2;
- register length;
-{
- if (b1 < b2) {
- b2 += length;
- b1 += length;
- while (length--)
- *--b2 = *--b1;
- } else {
- while (length--)
- *b2++ = *b1++;
- }
-}
-#endif
-
-#endif /* NEEDFORNX */
-
-void NXProcData (dpy, data, len)
- Display *dpy;
- char *data;
- long len;
-{
- if (dpy->bufptr + (len) <= dpy->bufmax) {
- bcopy(data, dpy->bufptr, (int)len);
- dpy->bufptr += ((len) + 3) & ~3;
- } else {
- N_XSend(dpy, data, len);
- }
-}
-
-
-#ifdef WORD64
-
-/*
- * XXX This is a *really* stupid way of doing this. It should just use
- * dpy->bufptr directly, taking into account where in the word it is.
- */
-
-/*
- * Data16 - Place 16 bit data in the buffer.
- *
- * "dpy" is a pointer to a Display.
- * "data" is a pointer to the data.
- * "len" is the length in bytes of the data.
- */
-
-static doData16(dpy, data, len, packbuffer)
- register Display *dpy;
- short *data;
- unsigned len;
- char *packbuffer;
-{
- long *lp,*lpack;
- long i, nwords,bits;
- long mask16 = 0x000000000000ffff;
-
- lp = (long *)data;
- lpack = (long *)packbuffer;
-
-/* nwords is the number of 16 bit values to be packed,
- * the low order 16 bits of each word will be packed
- * into 64 bit words
- */
- nwords = len >> 1;
- bits = 48;
-
- for(i=0;i<nwords;i++){
- if (bits == 48) *lpack = 0;
- *lpack ^= (*lp & mask16) << bits;
- bits -= 16 ;
- lp++;
- if(bits < 0){
- lpack++;
- bits = 48;
- }
- }
- Data(dpy, packbuffer, len);
-}
-
-Data16 (dpy, data, len)
- Display *dpy;
- short *data;
- unsigned len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nunits = PACKBUFFERSIZE >> 1;
-
- for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) {
- doData16 (dpy, data, PACKBUFFERSIZE, packbuffer);
- }
- if (len) doData16 (dpy, data, len, packbuffer);
-}
-
-/*
- * Data32 - Place 32 bit data in the buffer.
- *
- * "dpy" is a pointer to a Display.
- * "data" is a pointer to the data.
- * "len" is the length in bytes of the data.
- */
-
-static doData32 (dpy, data, len, packbuffer)
- register Display *dpy;
- long *data;
- unsigned len;
- char *packbuffer;
-{
- long *lp,*lpack;
- long i,bits,nwords;
- long mask32 = 0x00000000ffffffff;
-
- lpack = (long *) packbuffer;
- lp = data;
-
-/* nwords is the number of 32 bit values to be packed
- * the low order 32 bits of each word will be packed
- * into 64 bit words
- */
- nwords = len >> 2;
- bits = 32;
-
- for(i=0;i<nwords;i++){
- if (bits == 32) *lpack = 0;
- *lpack ^= (*lp & mask32) << bits;
- bits = bits ^32;
- lp++;
- if(bits)
- lpack++;
- }
- Data(dpy, packbuffer, len);
-}
-
-Data32 (dpy, data, len)
- Display *dpy;
- long *data;
- unsigned len;
-{
- char packbuffer[PACKBUFFERSIZE];
- unsigned nunits = PACKBUFFERSIZE >> 2;
-
- for (; len > PACKBUFFERSIZE; len -= PACKBUFFERSIZE, data += nunits) {
- doData32 (dpy, data, PACKBUFFERSIZE, packbuffer);
- }
- if (len) doData32 (dpy, data, len, packbuffer);
-}
-
-#endif /* WORD64 */
-
-
-#ifdef NEEDFORNX
-
-/*
- * _XFreeQ - free the queue of events, called by XCloseDisplay
- */
-
-void _XFreeQ ()
-{
- register _XQEvent *qelt = _qfree;
-
- while (qelt) {
- register _XQEvent *qnxt = qelt->next;
- Xfree ((char *) qelt);
- qelt = qnxt;
- }
- _qfree = NULL;
- return;
-}
-#endif /* NEEDFORNX */
-
-/* Make sure this produces the same string as DefineLocal/DefineSelf in xdm.
- * Otherwise, Xau will not be able to find your cookies in the Xauthority file.
- *
- * Note: POSIX says that the ``nodename'' member of utsname does _not_ have
- * to have sufficient information for interfacing to the network,
- * and so, you may be better off using gethostname (if it exists).
- */
-
-#if (defined(_POSIX_SOURCE) && !defined(AIXV3)) || defined(hpux) || defined(USG) || defined(SVR4)
-#define NEED_UTSNAME
-#include <sys/utsname.h>
-#endif
-
-/*
- * N_XGetHostname - similar to gethostname but allows special processing.
- */
-int N_XGetHostname (buf, maxlen)
- char *buf;
- int maxlen;
-{
- int len;
-
-#ifdef NEED_UTSNAME
- struct utsname name;
-
- uname (&name);
- len = strlen (name.nodename);
- if (len >= maxlen) len = maxlen - 1;
- strncpy (buf, name.nodename, len);
- buf[len] = '\0';
-#else
- buf[0] = '\0';
- (void) gethostname (buf, maxlen);
- buf [maxlen - 1] = '\0';
- len = strlen(buf);
-#endif /* NEED_UTSNAME */
- return len;
-}
-
-#ifdef NEEDFORNX
-/*
- * _XScreenOfWindow - get the Screen of a given window
- */
-
-Screen *_XScreenOfWindow (dpy, w)
- Display *dpy;
- Window w;
-{
- register int i;
- Window root;
- int x, y; /* dummy variables */
- unsigned int width, height, bw, depth; /* dummy variables */
-
- if (XGetGeometry (dpy, w, &root, &x, &y, &width, &height,
- &bw, &depth) == False) {
- return None;
- }
- for (i = 0; i < ScreenCount (dpy); i++) { /* find root from list */
- if (root == RootWindow (dpy, i)) {
- return ScreenOfDisplay (dpy, i);
- }
- }
- return NULL;
-}
-#endif /* NEEDFORNX */
-
-#if (MSKCNT > 4)
-/*
- * This is a macro if MSKCNT <= 4
- */
-N_XANYSET(src)
- long *src;
-{
- int i;
-
- for (i=0; i<MSKCNT; i++)
- if (src[ i ])
- return (1);
- return (0);
-}
-#endif
-
-#ifdef NEEDFORNX
-#ifdef CRAY
-/*
- * Cray UniCOS does not have readv and writev so we emulate
- */
-#include <sys/socket.h>
-
-int _XReadV (fd, iov, iovcnt)
-int fd;
-struct iovec *iov;
-int iovcnt;
-{
- struct msghdr hdr;
-
- hdr.msg_iov = iov;
- hdr.msg_iovlen = iovcnt;
- hdr.msg_accrights = 0;
- hdr.msg_accrightslen = 0;
- hdr.msg_name = 0;
- hdr.msg_namelen = 0;
-
- return (recvmsg (fd, &hdr, 0));
-}
-
-int _XWriteV (fd, iov, iovcnt)
-int fd;
-struct iovec *iov;
-int iovcnt;
-{
- struct msghdr hdr;
-
- hdr.msg_iov = iov;
- hdr.msg_iovlen = iovcnt;
- hdr.msg_accrights = 0;
- hdr.msg_accrightslen = 0;
- hdr.msg_name = 0;
- hdr.msg_namelen = 0;
-
- return (sendmsg (fd, &hdr, 0));
-}
-
-#endif /* CRAY */
-
-#if defined(SYSV) && defined(i386) && !defined(STREAMSCONN)
-/*
- * SYSV/386 does not have readv so we emulate
- */
-#include <sys/uio.h>
-
-int _XReadV (fd, iov, iovcnt)
-int fd;
-struct iovec *iov;
-int iovcnt;
-{
- int i, len, total;
- char *base;
-
- errno = 0;
- for (i=0, total=0; i<iovcnt; i++, iov++) {
- len = iov->iov_len;
- base = iov->iov_base;
- while (len > 0) {
- register int nbytes;
- nbytes = read(fd, base, len);
- if (nbytes < 0 && total == 0) return -1;
- if (nbytes <= 0) return total;
- errno = 0;
- len -= nbytes;
- total += nbytes;
- base += nbytes;
- }
- }
- return total;
-}
-
-#endif /* SYSV && i386 && !STREAMSCONN */
-
-#ifdef STREAMSCONN
-/*
- * Copyright 1988, 1989 AT&T, 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 AT&T not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission. AT&T makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL AT&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.
- *
- */
-
-/*
- iovec.c (C source file)
- Acc: 575557389 Mon Mar 28 08:03:09 1988
- Mod: 575557397 Mon Mar 28 08:03:17 1988
- Sta: 575557397 Mon Mar 28 08:03:17 1988
- Owner: 2011
- Group: 1985
- Permissions: 664
-*/
-/*
- START USER STAMP AREA
-*/
-/*
- END USER STAMP AREA
-*/
-
-
-extern char _XsTypeofStream[];
-extern Xstream _XsStream[];
-
-#define MAX_WORKAREA 4096
-static char workarea[MAX_WORKAREA];
-
-
-
-int
-_XReadV (fd, v, n)
- int fd;
- struct iovec v[];
- int n;
-{
- int i, rc, len, size = 0;
- char * buf = workarea;
- char * p;
-
- if (n <= 0 || n > 16)
- {
- errno = EINVAL;
- return (-1);
- }
- for (i = 0; i < n; ++i)
- {
- if ((len = v[i].iov_len) < 0 || v[i].iov_base == NULL)
- {
- errno = EINVAL;
- return (-1);
- }
- size += len;
- }
- if ((size > MAX_WORKAREA) && ((buf = malloc (size)) == NULL))
- {
- errno = EINVAL;
- return (-1);
- }
- if((rc = (*_XsStream[_XsTypeOfStream[fd]].ReadFromStream)(fd, buf, size,
- BUFFERING))> 0)
- {
- for (i = 0, p = buf; i < n; ++i)
- {
- memcpy (v[i].iov_base, p, len = v[i].iov_len);
- p += len;
- }
- }
- if (size > MAX_WORKAREA)
- free (buf);
-
- return (rc);
-}
-
-int
-_XWriteV (fd, v, n)
- int fd;
- struct iovec v[];
- int n;
-{
- int i, rc, len, size = 0;
- char * buf = workarea;
- char * p;
-
- if (n <= 0 || n > 16)
- {
- errno = EINVAL;
- return (-1);
- }
- for (i = 0; i < n; ++i)
- {
- if ((len = v[i].iov_len) < 0 || v[i].iov_base == NULL)
- {
- errno = EINVAL;
- return (-1);
- }
- size += len;
- }
-
- if ((size > MAX_WORKAREA) && ((buf = malloc (size)) == NULL))
- {
- errno = EINVAL;
- return (-1);
- }
- for (i = 0, p = buf; i < n; ++i)
- {
- memcpy (p, v[i].iov_base, len = v[i].iov_len);
- p += len;
- }
- rc = (*_XsStream[_XsTypeOfStream[fd]].WriteToStream)(fd, buf, size);
-
- if (size > MAX_WORKAREA)
- free (buf);
-
- return (rc);
-}
-
-
-
-#endif /* STREAMSCONN */
-#endif /* NEEDFORNX */
diff --git a/xc/lib/dps/cslibint.h b/xc/lib/dps/cslibint.h
deleted file mode 100644
index 18f4daf13..000000000
--- a/xc/lib/dps/cslibint.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * cslibint.h -- low level I/O
- *
- * (c) Copyright 1993-1994 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
- *
- * Portions Copyright 1984, 1985, 1987, 1989 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.
- *
- * Author: Adobe Systems Incorporated and MIT X Consortium
- */
-
-/*
- * XlibInternal.h - Header definition and support file for the internal
- * support routines (XlibInternal) used by the C subroutine interface
- * library (Xlib) to the X Window System.
- *
- * Warning, there be dragons here....
- */
-
-#ifndef _CSLIBINT_H
-#define _CSLIBINT_H
-
-/* For SYSV, no gethostname, so fake it */
-#include <sys/param.h>
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-/* === MACROS === */
-
-/*
- * GetReq - Get the next avilable X request packet in the buffer and
- * return it.
- *
- * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
- * "req" is the name of the request pointer.
- *
- */
-
-#if defined(__STDC__) && !defined(UNIXCPP)
-#define NXMacroGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
- {if (dpy != xdpy) N_XFlush(dpy); else _XFlush(dpy);}\
- req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_##name;\
- req->length = (SIZEOF(x##name##Req))>>2;\
- dpy->bufptr += SIZEOF(x##name##Req);\
- dpy->request++
-
-#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
-#define NXMacroGetReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
- {if (dpy != xdpy) N_XFlush(dpy); else _XFlush(dpy);}\
- req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_/**/name;\
- req->length = (SIZEOF(x/**/name/**/Req))>>2;\
- dpy->bufptr += SIZEOF(x/**/name/**/Req);\
- dpy->request++
-#endif
-
-#ifdef NEEDFORNX
-
-/* GetReqExtra is the same as GetReq, but allocates "n" additional
- bytes after the request. "n" must be a multiple of 4! */
-
-#if defined(__STDC__) && !defined(UNIXCPP)
-#define GetReqExtra(name, n, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_##name;\
- req->length = (SIZEOF(x##name##Req) + n)>>2;\
- dpy->bufptr += SIZEOF(x##name##Req) + n;\
- dpy->request++
-#else
-#define GetReqExtra(name, n, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
- req->reqType = X_/**/name;\
- req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\
- dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\
- dpy->request++
-#endif
-
-
-/*
- * GetResReq is for those requests that have a resource ID
- * (Window, Pixmap, GContext, etc.) as their single argument.
- * "rid" is the name of the resource.
- */
-
-#if __STDC__ && !defined(UNIXCPP)
-#define GetResReq(name, rid, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
- req->reqType = X_##name;\
- req->length = 2;\
- req->id = (rid);\
- dpy->bufptr += SIZEOF(xResourceReq);\
- dpy->request++
-#else
-#define GetResReq(name, rid, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
- req->reqType = X_/**/name;\
- req->length = 2;\
- req->id = (rid);\
- dpy->bufptr += SIZEOF(xResourceReq);\
- dpy->request++
-#endif
-
-/*
- * GetEmptyReq is for those requests that have no arguments
- * at all.
- */
-#if __STDC__ && !defined(UNIXCPP)
-#define GetEmptyReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xReq *) (dpy->last_req = dpy->bufptr);\
- req->reqType = X_##name;\
- req->length = 1;\
- dpy->bufptr += SIZEOF(xReq);\
- dpy->request++
-#else
-#define GetEmptyReq(name, req) \
- WORD64ALIGN\
- if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
- _XFlush(dpy);\
- req = (xReq *) (dpy->last_req = dpy->bufptr);\
- req->reqType = X_/**/name;\
- req->length = 1;\
- dpy->bufptr += SIZEOF(xReq);\
- dpy->request++
-#endif
-
-
-#define SyncHandle() \
- if (dpy->synchandler) (*dpy->synchandler)(dpy)
-
-#define FlushGC(dpy, gc) \
- if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
-/*
- * Data - Place data in the buffer and pad the end to provide
- * 32 bit word alignment. Transmit if the buffer fills.
- *
- * "dpy" is a pointer to a Display.
- * "data" is a pinter to a data buffer.
- * "len" is the length of the data buffer.
- * we can presume buffer less than 2^16 bytes, so bcopy can be used safely.
- */
-#ifndef DataRoutineIsProcedure
-#define Data(dpy, data, len) \
- if (dpy->bufptr + (len) <= dpy->bufmax) {\
- bcopy(data, dpy->bufptr, (int)len);\
- dpy->bufptr += ((len) + 3) & ~3;\
- } else\
- _XSend(dpy, data, len)
-#endif /* DataRoutineIsProcedure */
-
-
-/* Allocate bytes from the buffer. No padding is done, so if
- * the length is not a multiple of 4, the caller must be
- * careful to leave the buffer aligned after sending the
- * current request.
- *
- * "type" is the type of the pointer being assigned to.
- * "ptr" is the pointer being assigned to.
- * "n" is the number of bytes to allocate.
- *
- * Example:
- * xTextElt *elt;
- * BufAlloc (xTextElt *, elt, nbytes)
- */
-
-#define BufAlloc(type, ptr, n) \
- if (dpy->bufptr + (n) > dpy->bufmax) \
- _XFlush (dpy); \
- ptr = (type) dpy->bufptr; \
- dpy->bufptr += (n);
-
-/*
- * provide emulation routines for smaller architectures
- */
-#ifndef WORD64
-#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
-#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
-#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
-#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
-#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
-#endif /* not WORD64 */
-
-#define PackData16(dpy,data,len) Data16 (dpy, data, len)
-#define PackData32(dpy,data,len) Data32 (dpy, data, len)
-
-/* Xlib manual is bogus */
-#define PackData(dpy,data,len) PackData16 (dpy, data, len)
-
-
-
-#endif /* NEEDFORNX */
-
-#if !defined(STARTITERATE) && !defined(WORD64)
-
-#define STARTITERATE(tpvar,type,start,endcond,decr) \
- for (tpvar = (type *) start; endcond; tpvar++, decr) {
-#define ENDITERATE }
-
-#endif /* STARTITERATE */
-
-
-#ifndef WORD64
-#undef Data32
-#define Data32(dpy, data, len) NXProcData((dpy), (char *)(data), (len))
-#endif /* not WORD64 */
-
-
-/* extension hooks */
-
-extern void NXProcData();
-extern void N_XEatData(); /* swallow data from server */
-extern int N_XDisconnectDisplay();
-extern int N_XGetHostname();
-extern Status N_XUnknownNativeEvent();
-extern Bool N_XUnknownWireEvent();
-
-#if 0
-extern int _XFlush();
-extern int _XRead();
-extern int _XReadPad();
-extern Status _XReply();
-extern int _XSend();
-#endif
-
-extern int N_XFlush();
-extern int N_XRead();
-extern int N_XReadPad();
-extern Status N_XReply();
-extern int N_XSend();
-
-#endif /* _CSLIBINT_H */
-
diff --git a/xc/lib/dps/csopendi.c b/xc/lib/dps/csopendi.c
deleted file mode 100644
index a77663daa..000000000
--- a/xc/lib/dps/csopendi.c
+++ /dev/null
@@ -1,571 +0,0 @@
-/*
- * csopendi.c -- open connection to CSDPS agent
- *
- * (c) Copyright 1990-1994 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
- *
- * Portions Copyright Massachusetts Institute of Technology 1985, 1986
- * 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.
- *
- * Author: Adobe Systems Incorporated and MIT X Consortium
- */
-
-#include <stdio.h>
-#include <sys/param.h> /* for MAXHOSTNAMELEN */
-#define NEED_EVENTS
-#include <X11/Xlibint.h>
-#include <X11/Xos.h>
-#include "cslibint.h"
-#ifdef XXX
-#include <X11/Xauth.h>
-#include <X11/Xatom.h>
-
-extern int _Xdebug;
-extern Display *_XHeadOfDisplayList;
-
-#ifndef lint
-static int lock; /* get rid of ifdefs when locking implemented */
-#endif
-
-#endif /* XXX */
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "DPSCAPClient.h"
-#include <DPS/dpsNXargs.h>
-#include "dpsNXprops.h"
-#include "csfindNX.h"
-
-#ifdef DPSLNKL
-#include "dpslnkl.inc"
-#endif /* DPSLNKL */
-
-
-/* +++ Someday make this common with XDPS.c version */
-#define DPY_NUMBER(dpy) ((dpy)->fd)
-
-static xReq _dummy_request = {
- 0, 0, 0
-};
-
-/*
- * First, a routine for setting authorization data
- */
-static int xauth_namelen = 0;
-static char *xauth_name = NULL; /* NULL means use default mechanism */
-static int xauth_datalen = 0;
-static char *xauth_data = NULL; /* NULL means get default data */
-
-static OutOfMemory();
-#ifdef XXX
-void XSetAuthorization (name, namelen, data, datalen)
- int namelen, datalen; /* lengths of name and data */
- char *name, *data; /* NULL or arbitrary array of bytes */
-{
- char *tmpname, *tmpdata;
-
- if (xauth_name) Xfree (xauth_name); /* free any existing data */
- if (xauth_data) Xfree (xauth_data);
-
- xauth_name = xauth_data = NULL; /* mark it no longer valid */
- xauth_namelen = xauth_datalen = 0;
-
- if (namelen < 0) namelen = 0; /* check for bogus inputs */
- if (datalen < 0) datalen = 0; /* maybe should return? */
-
- if (namelen > 0) { /* try to allocate space */
- tmpname = Xmalloc ((unsigned) namelen);
- if (!tmpname) return;
- bcopy (name, tmpname, namelen);
- } else {
- tmpname = NULL;
- }
-
- if (datalen > 0) {
- tmpdata = Xmalloc ((unsigned) datalen);
- if (!tmpdata) {
- if (tmpname) (void) Xfree (tmpname);
- return;
- }
- bcopy (data, tmpdata, datalen);
- } else {
- tmpdata = NULL;
- }
-
- xauth_name = tmpname; /* and store the suckers */
- xauth_namelen = namelen;
- xauth_data = tmpdata;
- xauth_datalen = datalen;
- return;
-}
-
-#endif /* XXX */
-
-/*
- * Connects to a server, creates a Display object and returns a pointer to
- * the newly created Display back to the caller.
- */
-XExtData *
-DPSCAPOpenAgent(dpy, trueDisplayName)
- register Display *dpy;
- char *trueDisplayName;
-{
- register Display *agent;
- char *agentHost = (char *)NULL;
- register int i;
- int j, k; /* random iterator indexes */
- char display_name[256]; /* pointer to display name */
- char licMethBuf[256];
- char *licMeth = licMethBuf;
- char *fullname = NULL;
- int idisplay;
- int iscreen;
- char *server_addr = NULL;
- int server_addrlen = 0;
- int conn_family;
- int transport, port;
- XExtData *ext;
- DPSCAPData my;
- extern int _XConnectDisplay();
- extern char *getenv();
- char hostname[MAXHOSTNAMELEN];
-
-/*
- * Find an agent to talk to.
- */
-#ifdef DPSLNKL
- extern unsigned ANXPFunc();
-#ifdef PSUSEPN
- (void) sprintf(licMeth, "%s%s:%d",
- LICENSE_METHOD_PREFIX,
- ANXVENDOR, /* From dpslnkl.inc */
- ANXPFunc());
-#else /* PSUSEPN */
- (void) sprintf(licMeth, "%s%s",
- LICENSE_METHOD_PREFIX,
- ANXVENDOR); /* From dpslnkl.inc */
-#endif /* PSUSEPN */
-#else /* DPSLNKL */
- licMeth = NULL; /* We want an open service */
-#endif /* DPSLNKL */
- (void) N_XGetHostname(hostname, MAXHOSTNAMELEN);
- switch(XDPSNXFindNX(dpy, licMeth, &agentHost, &transport, &port)) {
- case findnx_not_found: {
- /* try to start-up an NX? */
- Bool autoLaunch;
-
- XDPSGetNXArg(XDPSNX_AUTO_LAUNCH, (void **) &autoLaunch);
- if (autoLaunch == True) {
- int requestedTrans;
- int requestedPort = 0;
- char **args = NULL;
- char *additionalArgs[2];
- char transportArg[256];
-
- (void) DPSWarnProc(NULL, "Auto-launching DPS NX agent.");
- XDPSGetNXArg(XDPSNX_LAUNCHED_AGENT_TRANS, (void **) &requestedTrans);
- if (requestedTrans == XDPSNX_USE_BEST) {
- XDPSNXSetClientArg(XDPSNX_LAUNCHED_AGENT_TRANS,
- (void *)XDPSNX_TRANS_UNIX);
- requestedTrans = XDPSNX_TRANS_UNIX;
- }
- /* cons-up an arg. to pass to Agent we are forking */
-
- additionalArgs[1] = (char *) NULL;
- additionalArgs[0] = transportArg;
- XDPSGetNXArg(XDPSNX_LAUNCHED_AGENT_PORT, (void **) &requestedPort);
- if (requestedPort == XDPSNX_USE_BEST) {
- requestedPort = XDPSNXRecommendPort(requestedTrans);
- if (requestedPort < 0) {
- DPSWarnProc(NULL, "Auto-launcher can't get a port.");
- return(NULL);
- }
- }
- (void) sprintf(transportArg, "%s/%d",
- (requestedTrans == XDPSNX_TRANS_DECNET ?
- "dec" : "tcp"),
- requestedPort);
- args = additionalArgs;
- /* ASSERT: first argument in additionalArgs must be
- transport/port, unless agent changes to take this
- anywhere */
- if (StartXDPSNX(args) != Success) {
- char tb[256], *fs, **as;
- (void) XDPSGetNXArg(XDPSNX_EXEC_FILE, (void **) &fs);
- (void) XDPSGetNXArg(XDPSNX_EXEC_ARGS, (void **) &as);
- (void) sprintf(tb, "FAILED to auto-launch:\n %s", fs);
- if (as != NULL)
- for (; *as != NULL; as++) {
- if ((int) (strlen(*as) + 1 + (i = strlen(tb))) > 256-1) {
- if (i > 256-1-4)
- strcpy(&(tb[256-1-1-4]), " ...");
- else
- strcat(tb, " ...");
- break;
- }
- (void) strcat(tb, " ");
- (void) strcat(tb, *as);
- }
- DPSWarnProc(NULL, tb);
- return(NULL);
- } else {
- (void) sprintf(display_name, "%s%s%d", hostname,
- (requestedTrans == XDPSNX_TRANS_DECNET ?
- "::" : ":"),
- requestedPort);
- }
- } else { /* autoLaunch != True */
- return(NULL);
- }
- }
- break;
- case findnx_found: { /* XDPSNXFindNX() == Success */
- (void) sprintf(display_name, "%s%s%d",
- (transport == XDPSNX_TRANS_UNIX ?
- "unix" : agentHost),
- (transport == XDPSNX_TRANS_DECNET ? "::" : ":"),
- port);
- /* Free agentHost later */
- }
- break;
- case findnx_error:
- return(NULL);
- break;
- default:
- DPSFatalProc(NULL, "Illegal value returned by XDPSNXFindNX");
- break;
- }
-
-
-/*
- * Attempt to allocate a display structure. Return NULL if allocation fails.
- */
- if ((agent = (Display *)Xcalloc(1, sizeof(Display))) == NULL) {
- return(NULL);
- }
-
-/*
- * Call the Connect routine to get the network socket. If -1 is returned, the
- * connection failed. The connect routine will set fullname to point to the
- * expanded name.
- */
-
- if ((agent->fd = DPSCAPConnect(display_name, &fullname, &idisplay,
- &conn_family,
- &server_addrlen, &server_addr)) < 0) {
- Xfree ((char *) agent);
- return(NULL);
- }
-#ifdef XXX
-/*
- * Look up the authorization protocol name and data if necessary.
- */
- if (xauth_name && xauth_data) {
- conn_auth_namelen = xauth_namelen;
- conn_auth_name = xauth_name;
- conn_auth_datalen = xauth_datalen;
- conn_auth_data = xauth_data;
- } else {
- char dpynumbuf[40]; /* big enough to hold 2^64 and more */
- (void) sprintf (dpynumbuf, "%d", idisplay);
-
- authptr = XauGetAuthByAddr ((unsigned short) conn_family,
- (unsigned short) server_addrlen,
- server_addr,
- (unsigned short) strlen (dpynumbuf),
- dpynumbuf,
- (unsigned short) xauth_namelen,
- xauth_name);
- if (authptr) {
- conn_auth_namelen = authptr->name_length;
- conn_auth_name = (char *)authptr->name;
- conn_auth_datalen = authptr->data_length;
- conn_auth_data = (char *)authptr->data;
- } else {
- conn_auth_namelen = 0;
- conn_auth_name = NULL;
- conn_auth_datalen = 0;
- conn_auth_data = NULL;
- }
- }
-#ifdef HASDES
- /*
- * build XDM-AUTHORIZATION-1 data
- */
- if (conn_auth_namelen == 19 &&
- !strncmp (conn_auth_name, "XDM-AUTHORIZATION-1", 19))
- {
- static char encrypted_data[192/8];
- int i, j;
- struct sockaddr_in in_addr;
- int addrlen;
- long now;
-
- j = 0;
- for (i = 0; i < 8; i++)
- {
- encrypted_data[j] = conn_auth_data[i];
- j++;
- }
- addrlen = sizeof (in_addr);
- getsockname (dpy->fd, (struct sockaddr *) &in_addr, &addrlen);
- if (in_addr.sin_family == 2)
- {
- encrypted_data[j] = in_addr.sin_addr.s_net; j++;
- encrypted_data[j] = in_addr.sin_addr.s_host; j++;
- encrypted_data[j] = in_addr.sin_addr.s_lh; j++;
- encrypted_data[j] = in_addr.sin_addr.s_impno; j++;
- encrypted_data[j] = (in_addr.sin_port >> 8) & 0xff; j++;
- encrypted_data[j] = (in_addr.sin_port) & 0xff; j++;
- }
- else
- {
- encrypted_data[j] = 0xff; j++;
- encrypted_data[j] = 0xff; j++;
- encrypted_data[j] = 0xff; j++;
- encrypted_data[j] = 0xff; j++;
- i = getpid ();
- encrypted_data[j] = (i >> 8) & 0xff; j++;
- encrypted_data[j] = (i) & 0xff; j++;
- }
- time (&now);
- for (i = 3; i >= 0; i--)
- {
- encrypted_data[j] = (now >> (i * 8)) & 0xff;
- j++;
- }
- XdmcpEncrypt (encrypted_data, conn_auth_data + 8,
- encrypted_data, 192/8);
- conn_auth_data = encrypted_data;
- conn_auth_datalen = 192 / 8;
- }
-#endif /* HASDES */
- if (server_addr) (void) Xfree (server_addr);
-
-#endif /* XXX */
-
-/*
- * We succeeded at authorization, so let us move the data into
- * the display structure.
- */
- agent->lock_meaning = NoSymbol;
-#ifdef XXX
- /* this field is not present in post X11R5 */
- agent->current = None;
-#endif
- agent->event_vec[X_Error] = N_XUnknownWireEvent;
- agent->event_vec[X_Reply] = N_XUnknownWireEvent;
- agent->wire_vec[X_Error] = N_XUnknownNativeEvent;
- agent->wire_vec[X_Reply] = N_XUnknownNativeEvent;
- for (i = KeyPress; i < 128; i++) {
- agent->event_vec[i] = N_XUnknownWireEvent;
- agent->wire_vec[i] = N_XUnknownNativeEvent;
- }
- agent->cursor_font = None;
- agent->last_req = (char *)&_dummy_request;
-
- /* Salt away the host:display string for later use.
- Storage owned by agent, Xmalloc'd by connection
- call above */
- agent->display_name = fullname;
-
- /* Set up the output buffers. */
- if ((agent->bufptr = agent->buffer = Xmalloc(BUFSIZE)) == NULL) {
- OutOfMemory (dpy);
- return(NULL);
- }
- agent->bufmax = agent->buffer + BUFSIZE;
-
-
- /* Create extension data */
-
- my = DPSCAPCreate(dpy, agent);
- if (my == (DPSCAPData)NULL)
- {
- OutOfMemory(agent);
- return(NULL);
- }
- ext = (XExtData *)Xcalloc(1, sizeof(XExtData));
- ext->private_data = (char *)my;
-
- /* Parse names to get true display name */
- if (agentHost && strcmp(hostname, agentHost))
- {
- register char *s, *p;
- char *dxname;
- char nametmp[MAXHOSTNAMELEN];
- /* Agent is not on the same host as client, so fix
- up the stupid abbreviations used for the display,
- and whoever came up with the syntax should be shot. */
- dxname = DisplayString(dpy);
- for (s = dxname, p = nametmp; *s; ++s)
- if (*s == ':')
- break;
- else
- *p++ = *s;
- *p = '\0';
- if (nametmp[0] == '\0'
- || !strcmp(nametmp, "unix")
- || !strcmp(nametmp, "localhost"))
- {
- strcpy(trueDisplayName, hostname);
- if (*s)
- strcat(trueDisplayName, s);
- else
- strcat(trueDisplayName, ":0.0");
- }
- else
- strcpy(trueDisplayName, dxname);
- }
- else
- strcpy(trueDisplayName, DisplayString(dpy));
- if (agentHost)
- Xfree(agentHost);
- return(ext);
-}
-
-
-/* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL
- after this returns. */
-
-static OutOfMemory (dpy)
- Display *dpy;
- {
- DPSCAPCloseAgent(dpy);
- }
-
-#ifdef NEEDFORNX
-/* XFreeDisplayStructure frees all the storage associated with a
- * Display. It is used by XOpenDisplay if it runs out of memory,
- * and also by XCloseDisplay. It needs to check whether all pointers
- * are non-NULL before dereferencing them, since it may be called
- * by XOpenDisplay before the Display structure is fully formed.
- * XOpenDisplay must be sure to initialize all the pointers to NULL
- * before the first possible call on this.
- */
-
-static void
-_XFreeDisplayStructure(dpy)
- register Display *dpy;
-{
- if (dpy->screens) {
- register int i;
-
- for (i = 0; i < dpy->nscreens; i++) {
- Screen *sp = &dpy->screens[i];
-
- if (sp->depths) {
- register int j;
-
- for (j = 0; j < sp->ndepths; j++) {
- Depth *dp = &sp->depths[j];
-
- if (dp->visuals) {
- register int k;
-
- for (k = 0; k < dp->nvisuals; k++)
- _XFreeExtData (dp->visuals[k].ext_data);
- Xfree ((char *) dp->visuals);
- }
- }
-
- Xfree ((char *) sp->depths);
- }
-
- _XFreeExtData (sp->ext_data);
- }
-
- Xfree ((char *)dpy->screens);
- }
-
- if (dpy->pixmap_format) {
- register int i;
-
- for (i = 0; i < dpy->nformats; i++)
- _XFreeExtData (dpy->pixmap_format[i].ext_data);
- Xfree ((char *)dpy->pixmap_format);
- }
-
- if (dpy->display_name)
- Xfree (dpy->display_name);
- if (dpy->vendor)
- Xfree (dpy->vendor);
-
- if (dpy->buffer)
- Xfree (dpy->buffer);
- if (dpy->atoms)
- Xfree ((char *) dpy->atoms);
- if (dpy->keysyms)
- Xfree ((char *) dpy->keysyms);
- if (dpy->modifiermap)
- XFreeModifiermap(dpy->modifiermap);
- if (dpy->xdefaults)
- Xfree (dpy->xdefaults);
- if (dpy->key_bindings)
- _XFreeKeyBindings(dpy);
-
- while (dpy->ext_procs) {
- _XExtension *ext = dpy->ext_procs;
- dpy->ext_procs = ext->next;
- if (ext->name)
- Xfree (ext->name);
- Xfree ((char *)ext);
- }
-
- _XFreeExtData (dpy->ext_data);
-
- Xfree ((char *)dpy);
-}
-#endif /* NEEDFORNX */
-
-
-
-void
-DPSCAPCloseAgent(agent)
- Display *agent;
-{
- if (!agent) return;
- N_XDisconnectDisplay(agent->fd);
- if (agent->display_name)
- Xfree(agent->display_name);
- if (agent->buffer)
- Xfree(agent->buffer);
- Xfree((char *)agent);
-}
diff --git a/xc/lib/dps/csstartNX.c b/xc/lib/dps/csstartNX.c
deleted file mode 100644
index 77d3f253c..000000000
--- a/xc/lib/dps/csstartNX.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- csstartNX.c
-
- * (c) Copyright 1992-1994 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
- */
-
-#include <sys/param.h>
-#include <X11/X.h>
-#include <X11/Xlibint.h>
-#include <sys/wait.h>
-#include <DPS/dpsNXargs.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <X11/Xos.h>
-#include "DPSCAPproto.h"
-#include "Xlibnet.h" /* New for R5, delete for R4 */
-
-/* ---Defines--- */
-
-#ifndef NULL
-#define NULL (void *) 0
-#endif
-
-#define DOZETIME 1 /* time to wait for agent to start up (sec) */
-
-#define BASE_TCP_PORT CSDPSPORT
-
-#ifndef CSDPSMAXPORT
-#define CSDPSMAXPORT 16
-#endif
-
-#ifndef SO_REUSEADDR
-#define SO_REUSEADDR 1
-#endif
-
-/* ---Globals--- */
-
-pid_t gSecretAgentPID = 0; /* PID of launched agent *Shh!* Not public! */
-
-/* ---Private Functions--- */
-
-static int
-TryTCP()
-{
- struct sockaddr_in insock;
- int request;
- int retry;
- unsigned short port, startPort = 0;
- struct servent *serventInfo;
- int okay;
-
-#ifndef ultrix
- /* Ultrix has a nasty bug in getservbyname(). If the name passed
- to it doesn't exist in the services list it will seg. fault...
- * sigh * */
- if ((serventInfo = getservbyname(DPS_NX_SERV_NAME,
- (char *) NULL)) != NULL)
- if (strcmp("tcp", serventInfo->s_proto) == 0) {
- startPort = ntohs(serventInfo->s_port);
- }
- /* So, for Ultrix we just default to the default default port :-) */
-#endif /* ultrix */
- if (startPort == 0) startPort = BASE_TCP_PORT;
- if ((request = socket (AF_INET, SOCK_STREAM, 0)) < 0)
- {
- DPSWarnProc(NULL, "Creating TCP socket while recommending port\n");
- return -1;
- }
-#ifdef SO_REUSEADDR
- /* Necesary to restart the server without a reboot */
- {
- int one = 1;
- setsockopt(request, SOL_SOCKET, SO_REUSEADDR, (char *)&one, sizeof(int));
- }
- /* What the hell is all this? I'll tell you. We don't know
- a prioi what port is free, so we try to bind to each
- in sequence and return the one that works. */
-#if !defined(AIXV3)
- {
- struct linger lingere;
-
- lingere.l_onoff = 0; /* off */
- lingere.l_linger = 0; /* don't */
- if(setsockopt(request, SOL_SOCKET, SO_LINGER, (char *)&lingere,
- sizeof(struct linger)) != 0)
- DPSWarnProc(NULL,
- "Couldn't set TCP SO_DONTLINGER while recommending port.");
- }
-#endif /* AIXV3 */
-#endif /* SO_REUSEADDR */
- bzero((char *)&insock, sizeof (insock));
- insock.sin_family = AF_INET;
- insock.sin_addr.s_addr = htonl(INADDR_ANY);
- okay = 0;
-
- for (port = startPort; (int) port < (int) startPort + CSDPSMAXPORT; port++)
- {
- int result;
- insock.sin_port = htons(port);
-
- errno = 0;
- result = bind(request, (struct sockaddr *) &insock, sizeof (insock));
- if (result < 0)
- {
- if (errno != EADDRINUSE)
- {
- DPSWarnProc(NULL, "Binding TCP socket while recommending port.\n");
- close(request);
- return -1;
- }
- continue;
- }
- else
- {
- /* We have a good port number */
- okay = 1;
- break;
- }
- }
- close(request);
- return (okay) ? port : -1;
-}
-
-/* ---Functions--- */
-
-int
-XDPSNXRecommendPort(transport)
- int transport;
-{
- int ret;
-
- switch (transport)
- {
- case XDPSNX_TRANS_UNIX:
- /* If the TCP socket exists, we just assume the UNIX one
- is there too. FALL THRU! */
- case XDPSNX_TRANS_TCP: /* TCP */
- ret = TryTCP();
- break;
- default: ret = -1;
- }
- return(ret);
-}
-
-int
-StartXDPSNX(additionalArgs)
- char **additionalArgs;
-{
- char **args, **cpp;
- pid_t childPid;
- int argc = 1; /* 1, args[0]:=path, args[1]:=null */
- int i = 0;
- int status = Success; /* assume we'll succeed */
- char *execObj, **execArgs;
-
- (void) XDPSGetNXArg(XDPSNX_EXEC_FILE, (void **) &execObj);
- if (execObj == NULL) return (!Success);
-
- /* Create the argv list for the execl() call */
- (void) XDPSGetNXArg(XDPSNX_EXEC_ARGS, (void **) &execArgs);
- if (execArgs != NULL)
- for(cpp = execArgs; *cpp != NULL; cpp++, argc++); /* count args. */
- if (additionalArgs != NULL) /* add on the add-on args. */
- for(cpp = additionalArgs; *cpp != NULL; cpp++, argc++);
-
- args = (char **) Xmalloc(sizeof(char *) * (argc+1));
- if (args == NULL)
- return(!Success);
- args[argc] = NULL; /* cap end of args */
- args[i++] = execObj;
- if (additionalArgs != NULL)
- for(cpp = additionalArgs; *cpp != NULL; cpp++, i++) args[i] = *cpp;
- if (execArgs != NULL)
- for(cpp = execArgs; *cpp != NULL; cpp++, i++) args[i] = *cpp;
-
- /* now try to start up the agent... */
- if ((childPid = fork()) != -1) {
- if (childPid == 0) { /* Child process */
- if (setsid() < 0)
- DPSWarnProc(NULL, "Agent unable to create session. Continuing...\n");
-
- /* Try to start the agent */
- if (execvp(args[0], args) < 0) { /* Error!! */
- exit(1); /* This is OKAY, we're the child here */
- }
- /* SHOULD NEVER REACH HERE */
- } else { /* Parent (NX Client) */
- (void) sleep(DOZETIME);
- /* if decmips, pray that we hesitate long enough for the child... */
- /* Check on child (NX Agent) */
- if (waitpid(childPid, NULL, WNOHANG) != 0) {
- /* Server terminated or stopped; don't care, result is same... */
- status = !Success;
- } else { /* we think the agent started okay */
- gSecretAgentPID = childPid; /* set secret global */
- }
- }
- } else { /* Error in fork */
- status = !Success;
- }
- if (args != NULL) (void) XFree(args);
- return(status);
-}
-
diff --git a/xc/lib/dps/csstartNX.h b/xc/lib/dps/csstartNX.h
deleted file mode 100644
index 78b0a550b..000000000
--- a/xc/lib/dps/csstartNX.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * csstartNX.h -- handles fork()/execl() for starting DPSNX from dps lib
- *
- * (c) Copyright 1992-1994 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
- */
-
-#ifndef CSSTARTNX_H
-#define CSSTARTNX_H
-
-#include <X11/Xlib.h>
-
-#ifndef _NO_PROTO
-#define ARGS(list) (list)
-#else
-#define ARGS(list) ()
-#endif
-
-/* ---Globals--- */
-
-extern Bool gStartXDPSNXIsPresent;
- /*
- * Indicates whether the function "StartXDPSNX" is live or just
- * a stubbed out version.
- */
-
-/* ---Functions--- */
-
-extern int
-StartXDPSNX ARGS((char **additionalArgs));
- /*
- * StartXDPSNX attempts to fork and exec the object file specified by
- * the DPSSetNXArg argument "DPSNXEXEC". It passes as arguments to the
- * object file the DPSSetNXArg argument "DPSNXEXECARGS" with the
- * additionalArgs (if there are any) appended.
- * RETURNS:
- * StartXDPSNX will return Success if it believes that the child has
- * started correctly. Otherwise it returns !Success
- */
-
-
-#endif /* CSSTARTNX_H */
diff --git a/xc/lib/dps/dps-def.cpp b/xc/lib/dps/dps-def.cpp
deleted file mode 100644
index 75501a8a7..000000000
--- a/xc/lib/dps/dps-def.cpp
+++ /dev/null
@@ -1,991 +0,0 @@
-LIBRARY Dps
-VERSION LIBRARY_VERSION
-EXPORTS
-DPSAddContextExtensionRec
-DPSAwaitReturnValues
-DPSBinObjSeqWrite
-DPSChainContext
-DPSCheckInitClientGlobals
-DPSCheckRaiseError
-DPSCreateContext
-DPSCreateTextContext
-DPSDefaultErrorProc
-DPSDestroyContext
-DPSDestroySpace
-DPSFlushContext
-DPSGenerateExtensionRecID
-DPSGetContextExtensionRec
-DPSGetContextType
-DPSGetCurrentContext
-DPSGetCurrentErrorBackstop
-DPSGetCurrentTextBackstop
-DPSInitCommonContextProcs
-DPSInitCommonSpaceProcs
-DPSInitCommonTextContextProcs
-DPSInitialize
-DPSInterruptContext
-DPSKnownContext
-DPSKnownSpace
-DPSMapNames
-DPSNameFromIndex
-DPSPrivCurrentContext
-DPSRemoveContextExtensionRec
-DPSResetContext
-DPSSafeSetLastNameIndex
-DPSSetAbbrevMode
-DPSSetContext
-DPSSetErrorBackstop
-DPSSetNumStringConversion
-DPSSetResultTable
-DPSSetTextBackstop
-DPSSetWh
-DPSSetWrapSynchronization
-DPSSuppressBinaryConversion
-DPSUnchainContext
-DPSUpdateNameMap
-DPSWaitContext
-DPSWriteData
-DPSWriteNumString
-DPSWritePostScript
-DPSWriteStringChars
-DPSWriteTypedObjectArray
-DPScalloc
-DPSclientPrintProc
-DPSPrintf
-DPSRaise
-DPSCreatePSWDict
-DPSDestroyPSWDict
-DPSMakeAtom
-DPSWDictEnter
-DPSWDictLookup
-DPSWDictRemove
-DPSFetchAbbrevList
-DPSGetOperatorAbbrev
-DPSGetSysnameAbbrev
-DPSCantHappen
-DPSChangeEncoding
-DPSCheckShared
-DPSContextFromContextID
-DPSDefaultPrivateHandler
-DPSFatalProc
-DPSHandleBogusError
-DPSInitPrivateContextFields
-DPSInitPrivateContextProcs
-DPSInitPrivateSpaceFields
-DPSInitPrivateTextContextFields
-DPSNewUserObjectIndex
-DPSPrivateCheckWait
-DPSPrivateDestroyContext
-DPSPrivateDestroySpace
-DPSServicePostScript
-DPSWarnProc
-DPSinnerProcWriteData
-XDPSContextFromSharedID
-XDPSContextFromXID
-XDPSCreateContext
-XDPSCreateSecureContext
-XDPSCreateSimpleContext
-XDPSDispatchEvent
-XDPSFindContext
-XDPSGetContextStatus
-XDPSGetProtocolVersion
-XDPSIsDPSEvent
-XDPSIsOutputEvent
-XDPSIsReadyEvent
-XDPSIsStatusEvent
-XDPSNotifyWhenReady
-XDPSReadyEventHandler
-XDPSRegisterReadyProc
-XDPSRegisterStatusProc
-XDPSSetEventDelivery
-XDPSSetProcs
-XDPSSetStatusMask
-XDPSSpaceFromSharedID
-XDPSSpaceFromXID
-XDPSStatusEventHandler
-XDPSUnfreezeContext
-XDPSXIDFromContext
-XDPSXIDFromSpace
-DPSInitSysNames
-DPSCreatePrivContext
-DPSDefaultTextBackstop
-DPSIncludePrivContext
-DPSInitClient
-DPSOutOfMemory
-DPSSendDestroySpace
-DPSSendEOF
-DPSSendInterrupt
-DPSSendPostScript
-DPSSendTerminate
-XDPSCreatePrivContextRec
-XDPSForceEvents
-XDPSNumFormat
-XDPSPrivZapDpy
-XDPSSendUnfreeze
-XDPSSetContextEncoding
-XDPSLCAPNotify
-XDPSLCallOutputEventHandler
-XDPSLCallReadyEventHandler
-XDPSLCallStatusEventHandler
-XDPSLCleanAll
-XDPSLCleanContext
-XDPSLContextFromXID
-XDPSLCreateContext
-XDPSLCreateContextAndSpace
-XDPSLCreateContextFromID
-XDPSLCreateSpace
-XDPSLDestroySpace
-XDPSLDispatchCSDPSFakeEvent
-XDPSLFlush
-XDPSLFlushGC
-XDPSLGetCSDPSFakeEventType
-XDPSLGetCSDPSReady
-XDPSLGetCSDPSStatus
-XDPSLGetCodes
-XDPSLGetGCFlushMode
-XDPSLGetPassEventsFlag
-XDPSLGetShunt
-XDPSLGetStatus
-XDPSLGetSyncMask
-XDPSLGetVersion
-XDPSLGetWrapWaitingFlag
-XDPSLGiveInput
-XDPSLIDFromContext
-XDPSLInit
-XDPSLInitDisplayFlags
-XDPSLNotifyContext
-XDPSLNotifyWhenReady
-XDPSLReconcileRequests
-XDPSLReset
-XDPSLSetAfterProc
-XDPSLSetAgentArg
-XDPSLSetAgentName
-XDPSLSetClientMessageHandler
-XDPSLSetCodes
-XDPSLSetGCFlushMode
-XDPSLSetPassEventsFlag
-XDPSLSetReadyEventHandler
-XDPSLSetShunt
-XDPSLSetStatusEventHandler
-XDPSLSetStatusMask
-XDPSLSetSyncMask
-XDPSLSetTextEventHandler
-XDPSLSetVersion
-XDPSLSetWrapWaitingFlag
-XDPSLSync
-XDPSLSyncGCClip
-XDPSLTestErrorCode
-XDPSLUpdateAgentArgs
-XDPSSetXtEventDispatching
-;XDPSCreateStandardColormaps
-XDPSGetDefaultColorMaps
-CSDPSHeadOfDpyExt
-CSDPSInit
-DPSCAPChangeGC
-DPSCAPCloseDisplayProc
-DPSCAPCopyGCProc
-DPSCAPCreate
-DPSCAPDestroy
-DPSCAPFlushGCProc
-DPSCAPFreeGCProc
-DPSCAPStartUp
-DPSCAPWrite
-XDPSFlushGC
-XDPSNXSetAgentArg
-XDPSReconcileRequests
-XDPSSyncGCClip
-DPSCAPCloseAgent
-DPSCAPOpenAgent
-DPSCAPConnect
-N_XDisconnectDisplay
-N_XWaitForReadable
-N_XWaitForWritable
-StartXDPSNX
-XDPSNXRecommendPort
-XDPSGetNXArg
-XDPSNXFindNX
-XDPSNXSetClientArg
-NXProcData
-N_XANYSET
-N_XFlush
-N_XGetHostname
-N_XRead
-N_XReadPad
-N_XReply
-N_XSend
-N_XUnknownNativeEvent
-N_XUnknownWireEvent
-DPScolorimage
-DPScurrentblackgeneration
-DPScurrentcmykcolor
-DPScurrentcolorscreen
-DPScurrentcolortransfer
-DPScurrentundercolorremoval
-DPSsetblackgeneration
-DPSsetcmykcolor
-DPSsetcolorscreen
-DPSsetcolortransfer
-DPSsetundercolorremoval
-DPSeq
-DPSexit
-DPSfalse
-DPSfor
-DPSforall
-DPSge
-DPSgt
-DPSif
-DPSifelse
-DPSle
-DPSloop
-DPSlt
-DPSne
-DPSnot
-DPSor
-DPSrepeat
-DPSstop
-DPSstopped
-DPStrue
-DPSUserObjects
-DPScondition
-DPScurrentcontext
-DPScurrentobjectformat
-DPSdefineusername
-DPSdefineuserobject
-DPSdetach
-DPSexecuserobject
-DPSfork
-DPSjoin
-DPSlock
-DPSmonitor
-DPSnotify
-DPSsetobjectformat
-DPSsetvmthreshold
-DPSundefineuserobject
-DPSwait
-DPSyield
-DPSaload
-DPSanchorsearch
-DPSarray
-DPSastore
-DPSbegin
-DPSclear
-DPScleartomark
-DPScopy
-DPScount
-DPScounttomark
-DPScvi
-DPScvlit
-DPScvn
-DPScvr
-DPScvrs
-DPScvs
-DPScvx
-DPSdef
-DPSdict
-DPSdictstack
-DPSdup
-DPSend
-DPSexch
-DPSexecstack
-DPSexecuteonly
-DPSget
-DPSgetinterval
-DPSindex
-DPSknown
-DPSlength
-DPSload
-DPSmark
-DPSmatrix
-DPSmaxlength
-DPSnoaccess
-DPSnull
-DPSpackedarray
-DPSpop
-DPSput
-DPSputinterval
-DPSrcheck
-DPSreadonly
-DPSroll
-DPSscheck
-DPSsearch
-DPSshareddict
-DPSstatusdict
-DPSstore
-DPSstring
-DPSstringwidth
-DPSsystemdict
-DPSuserdict
-DPSwcheck
-DPSwhere
-DPSxcheck
-DPSFontDirectory
-DPSISOLatin1Encoding
-DPSSharedFontDirectory
-DPSStandardEncoding
-DPScachestatus
-DPScurrentcacheparams
-DPScurrentfont
-DPSdefinefont
-DPSfindfont
-DPSmakefont
-DPSscalefont
-DPSselectfont
-DPSsetcachedevice
-DPSsetcachelimit
-DPSsetcacheparams
-DPSsetcharwidth
-DPSsetfont
-DPSundefinefont
-DPSconcat
-DPScurrentdash
-DPScurrentflat
-DPScurrentgray
-DPScurrentgstate
-DPScurrenthalftone
-DPScurrenthalftonephase
-DPScurrenthsbcolor
-DPScurrentlinecap
-DPScurrentlinejoin
-DPScurrentlinewidth
-DPScurrentmatrix
-DPScurrentmiterlimit
-DPScurrentpoint
-DPScurrentrgbcolor
-DPScurrentscreen
-DPScurrentstrokeadjust
-DPScurrenttransfer
-DPSdefaultmatrix
-DPSgrestore
-DPSgrestoreall
-DPSgsave
-DPSgstate
-DPSinitgraphics
-DPSinitmatrix
-DPSrotate
-DPSscale
-DPSsetdash
-DPSsetflat
-DPSsetgray
-DPSsetgstate
-DPSsethalftone
-DPSsethalftonephase
-DPSsethsbcolor
-DPSsetlinecap
-DPSsetlinejoin
-DPSsetlinewidth
-DPSsetmatrix
-DPSsetmiterlimit
-DPSsetrgbcolor
-DPSsetscreen
-DPSsetstrokeadjust
-DPSsettransfer
-DPStranslate
-DPSbytesavailable
-DPSclosefile
-DPScurrentfile
-DPSdeletefile
-DPSecho
-DPSequals
-DPSequalsequals
-DPSfile
-DPSfilenameforall
-DPSfileposition
-DPSflush
-DPSflushfile
-DPSprint
-DPSprintobject
-DPSpstack
-DPSread
-DPSreadhexstring
-DPSreadline
-DPSreadstring
-DPSrenamefile
-DPSresetfile
-DPSsetfileposition
-DPSstack
-DPSstatus
-DPStoken
-DPSwrite
-DPSwritehexstring
-DPSwriteobject
-DPSwritestring
-DPSabs
-DPSadd
-DPSand
-DPSatan
-DPSbitshift
-DPSceiling
-DPScos
-DPSdiv
-DPSexp
-DPSfloor
-DPSidiv
-DPSln
-DPSlog
-DPSmod
-DPSmul
-DPSneg
-DPSround
-DPSsin
-DPSsqrt
-DPSsub
-DPStruncate
-DPSxor
-DPSconcatmatrix
-DPSdtransform
-DPSidentmatrix
-DPSidtransform
-DPSinvertmatrix
-DPSitransform
-DPStransform
-DPSbanddevice
-DPSframedevice
-DPSnulldevice
-DPSrenderbands
-DPSashow
-DPSawidthshow
-DPScopypage
-DPSeofill
-DPSerasepage
-DPSfill
-DPSimage
-DPSimagemask
-DPSkshow
-DPSrectfill
-DPSrectstroke
-DPSshow
-DPSshowpage
-DPSstroke
-DPSstrokepath
-DPSueofill
-DPSufill
-DPSustroke
-DPSustrokepath
-DPSwidthshow
-DPSxshow
-DPSxyshow
-DPSyshow
-DPSarc
-DPSarcn
-DPSarct
-DPSarcto
-DPScharpath
-DPSclip
-DPSclippath
-DPSclosepath
-DPScurveto
-DPSeoclip
-DPSeoviewclip
-DPSflattenpath
-DPSinitclip
-DPSinitviewclip
-DPSlineto
-DPSmoveto
-DPSnewpath
-DPSpathbbox
-DPSpathforall
-DPSrcurveto
-DPSrectclip
-DPSrectviewclip
-DPSreversepath
-DPSrlineto
-DPSrmoveto
-DPSsetbbox
-DPSsetucacheparams
-DPSuappend
-DPSucache
-DPSucachestatus
-DPSupath
-DPSviewclip
-DPSviewclippath
-DPSbind
-DPScleardictstack
-DPScountdictstack
-DPScountexecstack
-DPScurrentdict
-DPScurrentpacking
-DPScurrentshared
-DPSdeviceinfo
-DPSerrordict
-DPSexec
-DPSprompt
-DPSquit
-DPSrand
-DPSrealtime
-DPSrestore
-DPSrrand
-DPSrun
-DPSsave
-DPSsetpacking
-DPSsetshared
-DPSsrand
-DPSstart
-DPStype
-DPSundef
-DPSusertime
-DPSversion
-DPSvmreclaim
-DPSvmstatus
-DPSineofill
-DPSinfill
-DPSinstroke
-DPSinueofill
-DPSinufill
-DPSinustroke
-DPSwtranslation
-DPSgetboolean
-DPSgetchararray
-DPSgetfloat
-DPSgetfloatarray
-DPSgetint
-DPSgetintarray
-DPSgetstring
-DPSsendboolean
-DPSsendchararray
-DPSsendfloat
-DPSsendfloatarray
-DPSsendint
-DPSsendintarray
-DPSsendstring
-DPSclientXready
-DPSclientsync
-DPScurrentXdrawingfunction
-DPScurrentXgcdrawable
-DPScurrentXgcdrawablecolor
-DPScurrentXoffset
-DPSsetXdrawingfunction
-DPSsetXgcdrawable
-DPSsetXgcdrawablecolor
-DPSsetXoffset
-DPSsetXrgbactual
-DPSGlobalFontDirectory
-DPScshow
-DPScurrentcolor
-DPScurrentcolorrendering
-DPScurrentcolorspace
-DPScurrentdevparams
-DPScurrentglobal
-DPScurrentoverprint
-DPScurrentpagedevice
-DPScurrentsystemparams
-DPScurrentuserparams
-DPSdefineresource
-DPSexecform
-DPSfilter
-DPSfindencoding
-DPSfindresource
-DPSgcheck
-DPSglobaldict
-DPSglyphshow
-DPSlanguagelevel
-DPSleftbracket
-DPSleftleft
-DPSmakepattern
-DPSproduct
-DPSresourceforall
-DPSresourcestatus
-DPSrevision
-DPSrightbracket
-DPSrightright
-DPSrootfont
-DPSserialnumber
-DPSsetcolor
-DPSsetcolorrendering
-DPSsetcolorspace
-DPSsetdevparams
-DPSsetglobal
-DPSsetoverprint
-DPSsetpagedevice
-DPSsetpattern
-DPSsetsystemparams
-DPSsetuserparams
-DPSstartjob
-DPSundefineresource
-PScolorimage
-PScurrentblackgeneration
-PScurrentcmykcolor
-PScurrentcolorscreen
-PScurrentcolortransfer
-PScurrentundercolorremoval
-PSsetblackgeneration
-PSsetcmykcolor
-PSsetcolorscreen
-PSsetcolortransfer
-PSsetundercolorremoval
-PSeq
-PSexit
-PSfalse
-PSfor
-PSforall
-PSge
-PSgt
-PSif
-PSifelse
-PSle
-PSloop
-PSlt
-PSne
-PSnot
-PSor
-PSrepeat
-PSstop
-PSstopped
-PStrue
-PSUserObjects
-PScondition
-PScurrentcontext
-PScurrentobjectformat
-PSdefineusername
-PSdefineuserobject
-PSdetach
-PSexecuserobject
-PSfork
-PSjoin
-PSlock
-PSmonitor
-PSnotify
-PSsetobjectformat
-PSsetvmthreshold
-PSundefineuserobject
-PSwait
-PSyield
-PSaload
-PSanchorsearch
-PSarray
-PSastore
-PSbegin
-PSclear
-PScleartomark
-PScopy
-PScount
-PScounttomark
-PScvi
-PScvlit
-PScvn
-PScvr
-PScvrs
-PScvs
-PScvx
-PSdef
-PSdict
-PSdictstack
-PSdup
-PSend
-PSexch
-PSexecstack
-PSexecuteonly
-PSget
-PSgetinterval
-PSindex
-PSknown
-PSlength
-PSload
-PSmark
-PSmatrix
-PSmaxlength
-PSnoaccess
-PSnull
-PSpackedarray
-PSpop
-PSput
-PSputinterval
-PSrcheck
-PSreadonly
-PSroll
-PSscheck
-PSsearch
-PSshareddict
-PSstatusdict
-PSstore
-PSstring
-PSstringwidth
-PSsystemdict
-PSuserdict
-PSwcheck
-PSwhere
-PSxcheck
-PSFontDirectory
-PSISOLatin1Encoding
-PSSharedFontDirectory
-PSStandardEncoding
-PScachestatus
-PScurrentcacheparams
-PScurrentfont
-PSdefinefont
-PSfindfont
-PSmakefont
-PSscalefont
-PSselectfont
-PSsetcachedevice
-PSsetcachelimit
-PSsetcacheparams
-PSsetcharwidth
-PSsetfont
-PSundefinefont
-PSconcat
-PScurrentdash
-PScurrentflat
-PScurrentgray
-PScurrentgstate
-PScurrenthalftone
-PScurrenthalftonephase
-PScurrenthsbcolor
-PScurrentlinecap
-PScurrentlinejoin
-PScurrentlinewidth
-PScurrentmatrix
-PScurrentmiterlimit
-PScurrentpoint
-PScurrentrgbcolor
-PScurrentscreen
-PScurrentstrokeadjust
-PScurrenttransfer
-PSdefaultmatrix
-PSgrestore
-PSgrestoreall
-PSgsave
-PSgstate
-PSinitgraphics
-PSinitmatrix
-PSrotate
-PSscale
-PSsetdash
-PSsetflat
-PSsetgray
-PSsetgstate
-PSsethalftone
-PSsethalftonephase
-PSsethsbcolor
-PSsetlinecap
-PSsetlinejoin
-PSsetlinewidth
-PSsetmatrix
-PSsetmiterlimit
-PSsetrgbcolor
-PSsetscreen
-PSsetstrokeadjust
-PSsettransfer
-PStranslate
-PSbytesavailable
-PSclosefile
-PScurrentfile
-PSdeletefile
-PSecho
-PSequals
-PSequalsequals
-PSfile
-PSfilenameforall
-PSfileposition
-PSflush
-PSflushfile
-PSprint
-PSprintobject
-PSpstack
-PSread
-PSreadhexstring
-PSreadline
-PSreadstring
-PSrenamefile
-PSresetfile
-PSsetfileposition
-PSstack
-PSstatus
-PStoken
-PSwrite
-PSwritehexstring
-PSwriteobject
-PSwritestring
-PSabs
-PSadd
-PSand
-PSatan
-PSbitshift
-PSceiling
-PScos
-PSdiv
-PSexp
-PSfloor
-PSidiv
-PSln
-PSlog
-PSmod
-PSmul
-PSneg
-PSround
-PSsin
-PSsqrt
-PSsub
-PStruncate
-PSxor
-PSconcatmatrix
-PSdtransform
-PSidentmatrix
-PSidtransform
-PSinvertmatrix
-PSitransform
-PStransform
-PSbanddevice
-PSframedevice
-PSnulldevice
-PSrenderbands
-PSashow
-PSawidthshow
-PScopypage
-PSeofill
-PSerasepage
-PSfill
-PSimage
-PSimagemask
-PSkshow
-PSrectfill
-PSrectstroke
-PSshow
-PSshowpage
-PSstroke
-PSstrokepath
-PSueofill
-PSufill
-PSustroke
-PSustrokepath
-PSwidthshow
-PSxshow
-PSxyshow
-PSyshow
-PSarc
-PSarcn
-PSarct
-PSarcto
-PScharpath
-PSclip
-PSclippath
-PSclosepath
-PScurveto
-PSeoclip
-PSeoviewclip
-PSflattenpath
-PSinitclip
-PSinitviewclip
-PSlineto
-PSmoveto
-PSnewpath
-PSpathbbox
-PSpathforall
-PSrcurveto
-PSrectclip
-PSrectviewclip
-PSreversepath
-PSrlineto
-PSrmoveto
-PSsetbbox
-PSsetucacheparams
-PSuappend
-PSucache
-PSucachestatus
-PSupath
-PSviewclip
-PSviewclippath
-PSbind
-PScleardictstack
-PScountdictstack
-PScountexecstack
-PScurrentdict
-PScurrentpacking
-PScurrentshared
-PSdeviceinfo
-PSerrordict
-PSexec
-PSprompt
-PSquit
-PSrand
-PSrealtime
-PSrestore
-PSrrand
-PSrun
-PSsave
-PSsetpacking
-PSsetshared
-PSsrand
-PSstart
-PStype
-PSundef
-PSusertime
-PSversion
-PSvmreclaim
-PSvmstatus
-PSineofill
-PSinfill
-PSinstroke
-PSinueofill
-PSinufill
-PSinustroke
-PSwtranslation
-PSgetboolean
-PSgetchararray
-PSgetfloat
-PSgetfloatarray
-PSgetint
-PSgetintarray
-PSgetstring
-PSsendboolean
-PSsendchararray
-PSsendfloat
-PSsendfloatarray
-PSsendint
-PSsendintarray
-PSsendstring
-PSclientXready
-PSclientsync
-PScurrentXdrawingfunction
-PScurrentXgcdrawable
-PScurrentXgcdrawablecolor
-PScurrentXoffset
-PSsetXdrawingfunction
-PSsetXgcdrawable
-PSsetXgcdrawablecolor
-PSsetXoffset
-PSsetXrgbactual
-PSGlobalFontDirectory
-PScshow
-PScurrentcolor
-PScurrentcolorrendering
-PScurrentcolorspace
-PScurrentdevparams
-PScurrentglobal
-PScurrentoverprint
-PScurrentpagedevice
-PScurrentsystemparams
-PScurrentuserparams
-PSdefineresource
-PSexecform
-PSfilter
-PSfindencoding
-PSfindresource
-PSgcheck
-PSglobaldict
-PSglyphshow
-PSlanguagelevel
-PSleftbracket
-PSleftleft
-PSmakepattern
-PSproduct
-PSresourceforall
-PSresourcestatus
-PSrevision
-PSrightbracket
-PSrightright
-PSrootfont
-PSserialnumber
-PSsetcolor
-PSsetcolorrendering
-PSsetcolorspace
-PSsetdevparams
-PSsetglobal
-PSsetoverprint
-PSsetpagedevice
-PSsetpattern
-PSsetsystemparams
-PSsetuserparams
-PSstartjob
-PSundefineresource
-
-/* $XFree86: xc/lib/dps/dps-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */
diff --git a/xc/lib/dps/dpsNXprops.h b/xc/lib/dps/dpsNXprops.h
deleted file mode 100644
index de394e455..000000000
--- a/xc/lib/dps/dpsNXprops.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * dpsNXprops.h
- *
- * (c) Copyright 1992-1994 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
- */
-
-#ifndef DPSNXPROPS_H
-#define DPSNXPROPS_H
-
-
-/* ---DEFINES--- */
-
-/* --- X Window Properties --- */
-
-#define XDPSNX_BILLBOARD_PROP "_ADOBE_DPS_NX_BILLBOARD" /* On dpy root win */
-
-/* Following are per Agent window properties */
-
-#define XDPSNX_WILLINGNESS_PROP "_ADOBE_DPS_NX_WILLINGNESS_PROP"
-#define XDPSNX_LICENSE_METHOD_PROP "_ADOBE_DPS_NX_LICENSE_METHODS_PROP"
-#define XDPSNX_TRANSPORT_INFO_PROP "_ADOBE_DPS_NX_TRANSPORT_INFO_PROP"
-#define XDPSNX_HOST_NAME_PROP "_ADOBE_DPS_NX_HOST_NAME_PROP"
-
-#define XDPSNX_X_CLASS_NAME "XDPSNX"
-#define XDPSNX_X_RESOURCE "xdpsnx.agenthost"
-#define XDPSNX_X_CLASS "XDPSNX.AgentHost"
-
-#define AGENT_ENV_VAR "DPSNXHOST"
-
-
-/* - Predefined Willingness Prop. Values. Range: [0, 100] - */
-
-#define XDPSNX_MAX_WILLINGNESS 100
-#define XDPSNX_NOT_WILLING 0 /* 0:= agent wishes to "refuses" service to
- new clients */
-#define XDPSNX_MIN_WILLINGNESS 1 /* 1:= agent may delegate a client's request
- for a connection to another "more willing"
- agent */
-
-/* ---Predefined License Method Values--- */
-
-#define LICENSE_METHOD_PREFIX "_ADOBE_DPS_NX_LICENSE_LOCK_&_KEY_"
-#define LICENSE_METHOD_OPEN "_ADOBE_DPS_NX_LICENSE_OPEN_SERVICE"
-#define OPEN_LICENSE_VERSION 1
-
-#ifndef NULL
-#define NULL (void *) 0
-#endif /* NULL */
-
-
-/* ---Types--- */
-
-typedef struct {
- int transport;
- int port;
-} TransportInfo;
-
-
-#endif /* DPSNXPROPS_H */
diff --git a/xc/lib/dps/dpsXclient.c b/xc/lib/dps/dpsXclient.c
deleted file mode 100644
index 83c9b5226..000000000
--- a/xc/lib/dps/dpsXclient.c
+++ /dev/null
@@ -1,1136 +0,0 @@
-/*
- * dpsXclient.c -- Implementation of the Display PostScript Client Library.
- *
- * (c) Copyright 1988-1994 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
- */
-
-#include <ctype.h>
-
-#ifdef VMS
-/* Xlib does not like UNIX defined to any value under VMS. */
-#undef UNIX
-#include <decw$include/X.h>
-#include <decw$include/Xlib.h>
-
-#else /* VMS */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#endif /* VMS */
-
-#include "DPS/XDPSlib.h"
-#include "DPS/XDPS.h"
-
-#include "publictypes.h"
-#include "DPS/dpsclient.h"
-#include "dpsprivate.h"
-
-#include "dpsXpriv.h"
-#include "DPS/dpsXclient.h"
-#define Atom PSWAtom
-
-#include "dpsdict.h"
-#include "DPS/dpsexcept.h"
-
-#include "dpsXint.h"
-
-static DPSPrivContext FindPrivContext (dpy, cid)
- Display *dpy;
- long int cid;
-{
- DPSPrivSpace ss;
- DPSPrivContext cc;
-
- for (ss = spaces; ss != NIL; ss = ss->next)
- for (cc = ss->firstContext; cc != NIL; cc = cc->next)
- if (cc->cid == cid && ((XDPSPrivContext) cc->wh)->dpy == dpy)
- return (cc);
- return (NIL);
-}
-
-DPSContext XDPSFindContext (dpy, cid)
- Display *dpy;
- int cid;
-{
- return ((DPSContext) FindPrivContext (dpy, cid));
-}
-
-DPSContext DPSContextFromContextID(ctxt, contextID, textProc, errorProc)
- DPSContext ctxt;
- int contextID;
- DPSTextProc textProc;
- DPSErrorProc errorProc; {
- DPSPrivSpace ss;
- Display *dpy = ((XDPSPrivContext) ((DPSPrivContext) ctxt)->wh)->dpy;
- DPSPrivContext c, cc = FindPrivContext (dpy, contextID);
- DPSPrivContext oldc = (DPSPrivContext)ctxt;
-
- if (cc != NIL) return (DPSContext)cc;
-
- c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1);
- if (!c) return NIL;
- *c = *oldc;
- ss = (DPSPrivSpace)c->space;
-
- if (textProc) c->textProc = textProc;
- if (errorProc) c->errorProc = errorProc;
-
- c->eofReceived = false;
- c->cid = contextID;
- c->buf = c->outBuf = c->objBuf = NIL;
- c->chainParent = c->chainChild = NIL;
-
- c->nBufChars = c->nOutBufChars = c->nObjBufChars = 0;
-
- c->next = ss->firstContext;
- DPSAssert(c->next != c);
- ss->firstContext = c;
-
- /* Note: there's no way to determine whether the new context id was obtained
- ** as a result of a fork operation or from another application. so, it must
- ** be assumed that the application is the creator of the new context.
- ** Otherwise, it would have called the XDPSContextFromSharedID.
- */
- c->creator = true;
- c->zombie = false;
- c->numstringOffsets = NULL;
-
- DPSIncludePrivContext(
- (XDPSPrivContext) c->wh, (DPSContext)c, c->cid, ss->sid, DPSclientPrintProc);
-
- return (DPSContext)c;
- }
-
-boolean DPSPrivateCheckWait(ctxt)
- DPSContext ctxt;
-{
- DPSPrivContext cc = (DPSPrivContext) ctxt;
-
- if (!cc->creator || cc->zombie) {
- DPSSafeSetLastNameIndex(ctxt);
- if (cc->errorProc != NIL) {
- (*cc->errorProc) (ctxt, cc->zombie ? dps_err_deadContext :
- dps_err_invalidAccess,
- (char *) ctxt, 0);
- }
- return true;
- }
- return false;
-}
-
-static void procFlushContext(ctxt)
- DPSContext ctxt; {
- DPSPrivContext c = (DPSPrivContext) ctxt;
- XDPSLFlush (((XDPSPrivContext) c->wh)->dpy);
- if (ctxt->chainChild != NIL) DPSFlushContext(ctxt->chainChild);
- }
-
-/* ARGSUSED */
-static Bool FindDPSEvent(dpy, event, arg)
- Display *dpy;
- XEvent *event;
- char *arg;
-{
- return XDPSIsDPSEvent(event);
-}
-
-static void procAwaitReturnValues(ctxt)
- DPSContext ctxt; {
- DPSPrivContext c = (DPSPrivContext)ctxt;
-
- XDPSPrivContext xwh = (XDPSPrivContext) c->wh;
- XEvent ev;
-
- /* Output currently goes only to creator! */
- if (!c->creator)
- {
- DPSSafeSetLastNameIndex(ctxt);
- c->resultTable = NIL;
- c->resultTableLength = 0;
- if (c->errorProc != NIL)
- (*c->errorProc) (ctxt, dps_err_invalidAccess, 0, 0);
- return;
- }
- if (c->resultTable != NIL)
- {
- DPSCheckInitClientGlobals();
-
- if (XDPSLGetWrapWaitingFlag(xwh->dpy)) {
- DPSSafeSetLastNameIndex(ctxt);
- c->resultTable = NIL;
- c->resultTableLength = 0;
- if (c->errorProc != NIL)
- (*c->errorProc) (ctxt, dps_err_recursiveWait,
- (unsigned long) xwh->dpy, 0);
- return;
- }
- XDPSLSetWrapWaitingFlag(xwh->dpy, True);
-
- DURING
- DPSFlushContext(ctxt);
- while (c->resultTable != NIL)
- {
- /* We may block indefinitely if the context is frozen or it
- somehow needs more input. */
- if (c->zombie)
- {
- DPSSafeSetLastNameIndex(ctxt);
- c->resultTable = NIL;
- c->resultTableLength = 0;
- if (c->errorProc != NIL)
- (*c->errorProc) (ctxt, dps_err_deadContext, (char *) c, 0);
- XDPSLSetWrapWaitingFlag(xwh->dpy, False);
- E_RTRN_VOID;
- }
-
- /* Someone could conceivably change the event delivery mode in the
- middle of this...best to check every time */
-
- if (XDPSLGetPassEventsFlag(xwh->dpy)) {
- XIfEvent(xwh->dpy, &ev, FindDPSEvent, (char *) NULL);
- if (!XDPSDispatchEvent(&ev)) DPSCantHappen();
- } else DPSSendPostScript((XDPSPrivContext) c->wh, DPSclientPrintProc,
- c->cid, NIL, 0, NIL);
- }
- HANDLER
- XDPSLSetWrapWaitingFlag(xwh->dpy, False);
- RERAISE;
- END_HANDLER
-
- XDPSLSetWrapWaitingFlag(xwh->dpy, False);
-
- }
-
- /* update space's name map.
- space->lastNameIndex is the highest index known to be known to the
- server for this space.
- c->lastNameIndex is the highest index sent so far to the context
- */
-
- if (((DPSPrivSpace)(c->space))->lastNameIndex < c->lastNameIndex)
- ((DPSPrivSpace)(c->space))->lastNameIndex = c->lastNameIndex;
- }
-
-void DPSinnerProcWriteData(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- DPSPrivContext c = (DPSPrivContext) ctxt;
-
- /* ASSERT: safe to call with chain */
-
- /* No local buffering */
- DPSSendPostScript ((XDPSPrivContext) c->wh, DPSclientPrintProc,
- c->cid, buf, count, NIL);
- } /* DPSinnerProcWriteData */
-
-static void procResetContext(ctxt)
- DPSContext ctxt; {
- DPSPrivContext c = (DPSPrivContext) ctxt;
- int currStatus;
- register XDPSPrivContext xwh = (XDPSPrivContext) c->wh;
- int retries = 0;
- int backoff = 2;
-
- /* First make sure context isn't frozen, try to unfreeze. */
-
-#define DPS_SLEEP_SECS 2
-
- while((currStatus = XDPSLGetStatus(xwh->dpy, xwh->cxid)) == PSFROZEN)
- {
- XDPSLNotifyContext(xwh->dpy, xwh->cxid, PSUNFREEZE);
- sleep(DPS_SLEEP_SECS);
- /* Okay if context is PSRUNNING, since the EOF will
- be handled at the next PSNEEDSINPUT */
- }
-
- /* Remove events from Xlib Qs before sending the reset request. */
- XDPSForceEvents (xwh->dpy);
-
- if (currStatus == PSSTATUSERROR)
- /* +++ report error? */;
- else /* Didn't become zombie. */
- {
- currStatus = 0;
- XDPSLReset(xwh->dpy, xwh->cxid);
- XDPSLFlush(xwh->dpy);
- /* Be optmistic for the first try. Assume the app set up a status mask
- correctly, we should get a status event without asking the
- server for status. */
-
- XDPSForceEvents(xwh->dpy);
- currStatus = c->statusFromEvent;
-
- while (currStatus != PSNEEDSINPUT && currStatus != PSZOMBIE)
- {
- if (currStatus == PSFROZEN)
- XDPSLNotifyContext(xwh->dpy, xwh->cxid, PSUNFREEZE);
- if (retries > backoff)
- {
- /* Optimism failed. App probably didn't set up a status mask.
- Ask the server for status. */
- currStatus = XDPSLGetStatus(xwh->dpy, xwh->cxid);
- retries = 0;
- backoff = (backoff > 30) ? 2 : backoff + 1;
- continue;
- }
- else
- ++retries;
- sleep(DPS_SLEEP_SECS);
- XDPSForceEvents(xwh->dpy);
- currStatus = c->statusFromEvent;
- }
- }
-
- c->eofReceived = false;
- }
-
-void DPSPrivateDestroyContext(ctxt)
- DPSContext ctxt;
-{
- DPSPrivContext c = (DPSPrivContext)ctxt;
- DPSPrivSpace s = (DPSPrivSpace) c->space;
-
- if (c->creator)
- DPSSendTerminate((XDPSPrivContext) c->wh, c->cid, DPSclientPrintProc);
- else
- XDPSSetStatusMask(ctxt, 0, XDPSL_ALL_EVENTS, 0); /* Stop status events */
- /* Don't free the space's wh out from under it */
- if (c->wh != s->wh) free(c->wh);
-}
-
-void DPSPrivateDestroySpace(space)
- DPSSpace space;
-{
- DPSPrivSpace ss = (DPSPrivSpace) space;
-
- if (ss->creator) DPSSendDestroySpace((XDPSPrivContext) ss->wh, ss->sid,
- DPSclientPrintProc);
-
- free (ss->wh);
-}
-
-boolean DPSCheckShared(ctxt)
- DPSPrivContext ctxt;
-{
- return ctxt->creator == false && ctxt->resultTable != NIL;
- /* let procAwaitReturnValues generate error */
-}
-
-/* ARGSUSED */
-void DPSServicePostScript(returnControl)
- boolean (*returnControl)(); {
- } /* DPSServicePostScript */
-
-DPSHandleBogusError(ctxt, prefix, suffix)
- DPSContext ctxt;
- char *prefix, *suffix;
-{
- char *buf = "bogus error output from context";
- DPSDefaultPrivateHandler(ctxt, dps_err_warning,
- (long unsigned int)buf, 0, prefix, suffix);
-}
-
-void DPSDefaultPrivateHandler(ctxt, errorCode, arg1, arg2, prefix, suffix)
- DPSContext ctxt;
- DPSErrorCode errorCode;
- long unsigned int arg1, arg2;
- char *prefix, *suffix;
-{
-
- DPSTextProc textProc = DPSGetCurrentTextBackstop();
-
- switch (errorCode) {
- case dps_err_invalidAccess:
- if (textProc != NIL)
- {
- char m[100];
- (void) sprintf (m, "%sInvalid context access.%s", prefix, suffix);
- (*textProc) (ctxt, m, strlen (m));
- }
- break;
- case dps_err_encodingCheck:
- if (textProc != NIL)
- {
- char m[100];
- (void) sprintf (m, "%sInvalid name/program encoding: %d/%d.%s",
- prefix, (int) arg1, (int) arg2, suffix);
- (*textProc) (ctxt, m, strlen (m));
- }
- break;
- case dps_err_closedDisplay:
- if (textProc != NIL)
- {
- char m[100];
- (void) sprintf (m, "%sBroken display connection %d.%s",
- prefix, (int) arg1, suffix);
- (*textProc) (ctxt, m, strlen (m));
- }
- break;
- case dps_err_deadContext:
- if (textProc != NIL)
- {
- char m[100];
- (void) sprintf (m, "%sDead context 0x0%x.%s", prefix,
- (int) arg1, suffix);
- (*textProc) (ctxt, m, strlen (m));
- }
- break;
- case dps_err_warning:
- if (textProc != NIL)
- {
- char *warn = (char *)arg1;
- char *msg = "%% DPS Client Library Warning:\n ";
- (*textProc)(ctxt, msg, strlen(msg));
- (*textProc)(ctxt, warn, strlen(warn));
- msg = "\n";
- (*textProc)(ctxt, msg, strlen(msg));
- /* flush convention */
- (*textProc)(ctxt, msg, 0);
- }
- break;
- case dps_err_fatal:
- if (textProc != NIL)
- {
- char *fatal = (char *)arg1;
- char *msg = "%% DPS Client Library Fatal Internal Error:\n ";
- (*textProc)(ctxt, msg, strlen(msg));
- (*textProc)(ctxt, fatal, strlen(fatal));
- msg = ".\nAborting ...\n";
- (*textProc)(ctxt, msg, strlen(msg));
- /* flush convention */
- (*textProc)(ctxt, msg, 0);
- abort();
- }
- break;
- case dps_err_recursiveWait:
- if (textProc != NIL)
- {
- char m[100];
- (void) sprintf (m,
- "%sRecursive wait for return values, display 0x%x.%s",
- prefix, (int) arg1, suffix);
- (*textProc) (ctxt, m, strlen (m));
- }
- break;
- }
-}
-
-void DPSInitPrivateSpaceFields(s)
- DPSPrivSpace s;
-{
- s->creator = true;
-}
-
-void DPSInitPrivateContextFields(c, s)
- DPSPrivContext c;
- DPSPrivSpace s;
-{
- c->creator = true;
- c->zombie = false;
- if (!s->creator) {
- c->procs = XDPSconvProcs;
- c->nameEncoding = dps_strings;
- }
-}
-
-void DPSInitPrivateTextContextFields(c, s)
- DPSPrivContext c;
- DPSPrivSpace s;
-{
- c->creator = true;
- c->zombie = false;
- c->space = (DPSSpace) s;
- c->next = s->firstContext;
- s->firstContext = c;
-}
-
-long int DPSLastUserObjectIndex = 0;
-
-long int DPSNewUserObjectIndex ()
-{
- return (DPSLastUserObjectIndex++);
-}
-
-void XDPSSetProcs ()
-{
- DPSCheckInitClientGlobals ();
- if (!textCtxProcs)
- {
- textCtxProcs = (DPSProcs) DPScalloc (sizeof (DPSProcsRec), 1);
- DPSInitCommonTextContextProcs(textCtxProcs);
- DPSInitSysNames();
- }
- if (!ctxProcs)
- {
- ctxProcs = (DPSProcs) DPScalloc (sizeof (DPSProcsRec), 1);
- DPSInitCommonContextProcs(ctxProcs);
- DPSInitPrivateContextProcs(ctxProcs);
- }
- if (!XDPSconvProcs)
- XDPSconvProcs = (DPSProcs) DPScalloc (sizeof (DPSProcsRec), 1);
- if (!XDPSrawProcs)
- XDPSrawProcs = ctxProcs;
- *XDPSconvProcs = *ctxProcs;
- XDPSconvProcs->BinObjSeqWrite = textCtxProcs->BinObjSeqWrite;
- XDPSconvProcs->WriteStringChars = textCtxProcs->WriteStringChars;
- XDPSconvProcs->WritePostScript = textCtxProcs->WritePostScript;
- XDPSconvProcs->WriteNumString = textCtxProcs->WriteNumString;
-}
-
-void DPSInitPrivateContextProcs(p)
- DPSProcs p;
-{
- p->FlushContext = procFlushContext;
- p->ResetContext = procResetContext;
- p->AwaitReturnValues = procAwaitReturnValues;
-}
-
-DPSContext XDPSCreateSimpleContext (dpy, draw, gc, x, y,
- textProc, errorProc, space)
- Display *dpy;
- Drawable draw;
- GC gc;
- int x;
- int y;
- DPSTextProc textProc;
- DPSErrorProc errorProc;
- DPSSpace space;
-{
- XDPSPrivContext xwh = XDPSCreatePrivContextRec (dpy, draw, gc, x, y,
- 0, DefaultStdCMap,
- DefaultStdCMap, 0, false);
- DPSContext newCtxt;
-
- if (xwh == NIL)
- return (NIL);
- else
- {
- newCtxt = DPSCreateContext ((char *) xwh, textProc, errorProc, space);
- if (newCtxt == NIL)
- free ((char *) xwh);
- return (newCtxt);
- }
-}
-
-
-DPSContext XDPSCreateContext (dpy, draw, gc, x, y, eventmask, grayramp,
- ccube, actual, textProc, errorProc, space)
- Display *dpy;
- Drawable draw;
- GC gc;
- int x;
- int y;
- unsigned int eventmask;
- XStandardColormap *grayramp;
- XStandardColormap *ccube;
- int actual;
- DPSTextProc textProc;
- DPSErrorProc errorProc;
- DPSSpace space;
-{
- XDPSPrivContext xwh = XDPSCreatePrivContextRec (dpy, draw, gc, x, y,
- eventmask, grayramp,
- ccube, actual, false);
- DPSContext newCtxt;
-
- if (xwh == NIL)
- return (NIL);
- else
- {
- newCtxt = DPSCreateContext ((char *) xwh, textProc, errorProc, space);
- if (newCtxt == NIL)
- free ((char *) xwh);
- return (newCtxt);
- }
-}
-
-DPSContext XDPSCreateSecureContext (dpy, draw, gc, x, y, eventmask, grayramp,
- ccube, actual, textProc, errorProc, space)
- Display *dpy;
- Drawable draw;
- GC gc;
- int x;
- int y;
- unsigned int eventmask;
- XStandardColormap *grayramp;
- XStandardColormap *ccube;
- int actual;
- DPSTextProc textProc;
- DPSErrorProc errorProc;
- DPSSpace space;
-{
- XDPSPrivContext xwh = XDPSCreatePrivContextRec (dpy, draw, gc, x, y,
- eventmask, grayramp,
- ccube, actual, true);
- DPSContext newCtxt;
-
- if (xwh == NIL)
- return (NIL);
- else
- {
- newCtxt = DPSCreateContext ((char *) xwh, textProc, errorProc, space);
- if (newCtxt == NIL)
- free ((char *) xwh);
- return (newCtxt);
- }
-}
-
-
-DPSContext XDPSContextFromSharedID (dpy, cid, textProc, errorProc)
- Display *dpy;
- ContextPSID cid;
- DPSTextProc textProc;
- DPSErrorProc errorProc;
-{
- DPSPrivContext c;
- DPSPrivSpace s;
- ContextXID cxid;
- SpaceXID sxid;
- XDPSPrivContext xwh;
-
- if (DPSInitialize () != 0)
- return (NIL);
-
- c = FindPrivContext (dpy, cid);
- if (c != NIL)
- return ((DPSContext) c);
-
- xwh = XDPSCreatePrivContextRec (dpy, 0, 0, 0, 0, 0, NIL, NIL, 0, false);
- if (xwh == NIL)
- return (NIL);
- else if (XDPSLIDFromContext (dpy, cid, &cxid, &sxid) != 1)
- {
- free ((char *) xwh);
- return (NIL);
- }
- xwh->cxid = cxid;
-
- if (spaceProcs == NIL)
- {
- spaceProcs = (DPSSpaceProcs) DPScalloc (sizeof (DPSSpaceProcsRec), 1);
- DPSInitCommonSpaceProcs(spaceProcs);
- }
-
- s = spaces;
- while (s != NIL)
- if (s->sid == sxid && ((XDPSPrivContext) s->wh)->dpy == dpy)
- break;
- else
- s = s->next;
-
- if (s == NIL) /* Create new space record. */
- {
- s = (DPSPrivSpace) DPScalloc (sizeof (DPSPrivSpaceRec), 1);
- s->procs = spaceProcs;
- s->lastNameIndex = -1;
- s->sid = sxid;
- s->wh = (char *) xwh;
- s->creator = false;
- s->next = spaces;
- spaces = s;
- }
-
- c = (DPSPrivContext) DPScalloc (sizeof (DPSPrivContextRec), 1);
- c->space = (DPSSpace) s;
- c->procs = XDPSconvProcs;
- c->textProc = textProc;
- c->errorProc = errorProc;
- c->programEncoding = DPSDefaultProgramEncoding;
- c->nameEncoding = dps_strings;
- c->next = s->firstContext;
- s->firstContext = c;
- c->lastNameIndex = s->lastNameIndex;
- c->cid = cid;
- c->numstringOffsets = NULL;
- c->creator = false;
- c->zombie = false;
- c->numFormat = XDPSNumFormat (dpy);
- c->wh = (char *) xwh;
-
- xwh->ctxt = (DPSContext) c;
-
- return ((DPSContext) c);
-}
-
-
-void DPSChangeEncoding (ctxt, newProgEncoding, newNameEncoding)
- DPSContext ctxt;
- DPSProgramEncoding newProgEncoding;
- DPSNameEncoding newNameEncoding;
-{
- if (ctxt->programEncoding != newProgEncoding ||
- ctxt->nameEncoding != newNameEncoding)
- {
- DPSPrivContext cc = (DPSPrivContext) ctxt;
- DPSPrivSpace ss = (DPSPrivSpace) (cc->space);
-
- if ((!cc->creator || !ss->creator) && newNameEncoding != dps_strings)
- {
- DPSSafeSetLastNameIndex(ctxt);
- if (cc->errorProc != NIL)
- (*cc->errorProc) (ctxt, dps_err_encodingCheck,
- (char *) newNameEncoding,
- (char *) newProgEncoding);
- return;
- }
- if (ctxt->procs == textCtxProcs)
- {
- ctxt->programEncoding = newProgEncoding;
- ctxt->nameEncoding = newNameEncoding;
- }
- else
- XDPSSetContextEncoding (ctxt, newProgEncoding, newNameEncoding);
- }
-}
-
-
-DPSSpace XDPSSpaceFromSharedID (dpy, sid)
- Display *dpy;
- SpaceXID sid;
-{
- DPSPrivSpace s;
- XDPSPrivContext xwh;
-
- if (DPSInitialize () != 0)
- return (NIL);
-
- if (spaceProcs == NIL)
- {
- spaceProcs = (DPSSpaceProcs) DPScalloc (sizeof (DPSSpaceProcsRec), 1);
- DPSInitCommonSpaceProcs(spaceProcs);
- }
-
- s = spaces;
- while (s != NIL)
- if (s->sid == sid && ((XDPSPrivContext) s->wh)->dpy == dpy)
- break;
- else
- s = s->next;
-
- if (s == NIL) /* Create new space record. */
- {
- xwh = XDPSCreatePrivContextRec (dpy, 0, 0, 0, 0, 0, NIL, NIL, 0, false);
- if (xwh == NIL)
- return (NIL);
-
- s = (DPSPrivSpace) DPScalloc (sizeof (DPSPrivSpaceRec), 1);
- s->procs = spaceProcs;
- s->lastNameIndex = -1;
- s->sid = sid;
- s->wh = (char *) xwh;
- s->creator = false;
- s->next = spaces;
- spaces = s;
- }
-
- return ((DPSSpace) s);
-}
-
-
-void XDPSUnfreezeContext (ctxt)
- DPSContext ctxt;
-{
- XDPSPrivContext wh = (XDPSPrivContext) (((DPSPrivContext) ctxt)->wh);
-
- if (wh != NIL && wh->cxid != 0)
- XDPSSendUnfreeze (wh->dpy, wh->cxid);
-}
-
-
-ContextXID XDPSXIDFromContext (Pdpy, ctxt)
- Display **Pdpy;
- DPSContext ctxt;
-{
- XDPSPrivContext xwh = (XDPSPrivContext) (((DPSPrivContext) ctxt)->wh);
-
- if (xwh == NIL || xwh->cxid == 0)
- {
- *Pdpy = NULL;
- return (0);
- }
- else
- {
- *Pdpy = xwh->dpy;
- return (xwh->cxid);
- }
-}
-
-
-SpaceXID XDPSXIDFromSpace (Pdpy, space)
- Display **Pdpy;
- DPSSpace space;
-{
- DPSPrivSpace ss = (DPSPrivSpace) space;
- XDPSPrivContext xwh = (XDPSPrivContext) ss->wh;
-
- if (xwh != NIL && xwh->dpy != NULL)
- {
- *Pdpy = xwh->dpy;
- return (ss->sid);
- }
- else
- {
- *Pdpy = NULL;
- return (0);
- }
-}
-
-
-DPSContext XDPSContextFromXID (dpy, cxid)
- Display *dpy;
- ContextXID cxid;
-{
- DPSPrivContext c;
- DPSPrivSpace ss;
-
- for (ss = spaces; ss != NIL; ss = ss->next)
- if (((XDPSPrivContext) ss->wh)->dpy == dpy)
- for (c = ss->firstContext; c != NIL; c = c->next)
- if (((XDPSPrivContext) c->wh)->cxid == cxid)
- return ((DPSContext) c);
-
- return (NIL);
-}
-
-
-DPSSpace XDPSSpaceFromXID (dpy, sxid)
- Display *dpy;
- SpaceXID sxid;
-{
- DPSPrivSpace ss;
-
- for (ss = spaces; ss != NIL; ss = ss->next)
- if (ss->sid == sxid && ((XDPSPrivContext) ss->wh)->dpy == dpy)
- return ((DPSSpace) ss);
-
- return (NIL);
-}
-
-
-XDPSStatusProc XDPSRegisterStatusProc (ctxt, statusProc)
- DPSContext ctxt;
- XDPSStatusProc statusProc;
-{
- DPSPrivContext c = (DPSPrivContext) ctxt;
- XDPSStatusProc old = c->statusProc;
-
- if (c->wh != NIL) c->statusProc = statusProc;
- return old;
-}
-
-
-XDPSReadyProc XDPSRegisterReadyProc (ctxt, readyProc)
- DPSContext ctxt;
- XDPSReadyProc readyProc;
-{
- DPSPrivContext c = (DPSPrivContext) ctxt;
- XDPSReadyProc old = c->readyProc;
-
- if (c->wh != NIL) c->readyProc = readyProc;
- return old;
-}
-
-
-void XDPSSetStatusMask(ctxt, enableMask, disableMask, nextMask)
- DPSContext ctxt;
- unsigned long enableMask, disableMask, nextMask;
-{
- XDPSPrivContext xwh = (XDPSPrivContext) (((DPSPrivContext) ctxt)->wh);
-
- if (xwh != NIL && xwh->cxid != 0)
- XDPSLSetStatusMask(xwh->dpy, xwh->cxid, enableMask, disableMask, nextMask);
-}
-
-
-int XDPSGetContextStatus(ctxt)
- DPSContext ctxt;
-{
- DPSPrivContext c = (DPSPrivContext) ctxt;
- XDPSPrivContext xwh = (XDPSPrivContext) c->wh;
-
- if (xwh != NIL && xwh->cxid != 0)
- return (XDPSLGetStatus(xwh->dpy, xwh->cxid));
- else
- return (0);
-}
-
-void XDPSNotifyWhenReady(ctxt, i0, i1, i2, i3)
- DPSContext ctxt;
- int i0, i1, i2, i3;
-{
- DPSPrivContext c = (DPSPrivContext) ctxt;
- XDPSPrivContext xwh = (XDPSPrivContext) c->wh;
- int i[4];
-
- i[0] = i0;
- i[1] = i1;
- i[2] = i2;
- i[3] = i3;
-
- XDPSLNotifyWhenReady(xwh->dpy, xwh->cxid, i);
-}
-
-void XDPSStatusEventHandler (e)
- XDPSLStatusEvent *e;
-{
- DPSPrivContext c = (DPSPrivContext) XDPSContextFromXID(e->display, e->cxid);
-
- if (c == NIL)
- return;
-
- c->statusFromEvent = e->status;
- if (e->status == PSZOMBIE)
- {
- c->zombie = true;
- if (c->resultTable != NIL) /* Currently waiting for results */
- XDPSQuitBlocking = true;
- }
-
- if (c->statusProc != NIL)
- (*(c->statusProc)) ((DPSContext) c, e->status);
-}
-
-void XDPSReadyEventHandler (e)
- XDPSLReadyEvent *e;
-{
- DPSPrivContext c = (DPSPrivContext) XDPSContextFromXID(e->display, e->cxid);
-
- if (c == NIL)
- return;
-
- if (c->readyProc != NIL)
- (*(c->readyProc)) ((DPSContext) c, e->val);
-}
-
-
-
-void DPSWarnProc(ctxt, msg)
- DPSContext ctxt;
- char *msg;
-{
- DPSErrorProc ep;
-
- if (DPSInitialize() != 0) return;
- ep = DPSGetCurrentErrorBackstop();
- if (ep == NULL) ep = DPSDefaultErrorProc;
- (*ep)(ctxt, dps_err_warning, (long unsigned int)msg, 0);
-}
-
-void DPSFatalProc(ctxt, msg)
- DPSContext ctxt;
- char *msg;
-{
- DPSErrorProc ep;
-
- if (DPSInitialize() != 0) return;
- ep = DPSGetCurrentErrorBackstop();
- if (ep == NULL) ep = DPSDefaultErrorProc;
- (*ep)(ctxt, dps_err_fatal, (long unsigned int)msg, 0);
-}
-
-void DPSCantHappen() {
- static locked = 0;
- char *msg = "assertion failure or DPSCantHappen";
- if (locked > 0) abort();
- ++locked;
- DPSFatalProc((DPSContext)NULL, msg);
- /* Fatal proc shouldn't return, but client can override and do anything. */
- --locked;
- }
-
-
-/* Procedures for delayed event dispatching */
-
-DPSEventDelivery XDPSSetEventDelivery(dpy, newMode)
- Display *dpy;
- DPSEventDelivery newMode;
-{
- Bool old = XDPSLGetPassEventsFlag(dpy);
-
- switch (newMode) {
- case dps_event_pass_through:
- XDPSLSetPassEventsFlag(dpy, True);
- break;
- case dps_event_internal_dispatch:
- XDPSLSetPassEventsFlag(dpy, False);
- break;
- }
-
- if (old) return dps_event_pass_through;
- else return dps_event_internal_dispatch;
-}
-
-Bool XDPSIsStatusEvent(event, ctxt, status)
- XEvent *event;
- DPSContext *ctxt;
- int *status;
-{
- Display *d = event->xany.display;
- XExtCodes *c = XDPSLGetCodes(d);
- XDPSLStatusEvent *se = (XDPSLStatusEvent *) event;
-
- if (c == NULL) return False; /* Not inited on that display;
- must be False */
-
- if (!c->first_event) /* Check CSDPS first */
- {
- if (XDPSLGetCSDPSFakeEventType(d, event) == csdps_status)
- { /* Check CSDPS first */
- XDPSLGetCSDPSStatus(d, event, (void **)ctxt, status);
- return True;
- }
- else
- return False;
- }
-
- if (event->type != c->first_event + PSEVENTSTATUS) return False;
-
- if (ctxt != NULL) *ctxt = XDPSContextFromXID(d, se->cxid);
- if (status != NULL) *status = se->status;
- return True;
-}
-
-Bool XDPSIsOutputEvent(event)
- XEvent *event;
-{
- Display *d = event->xany.display;
- XExtCodes *c = XDPSLGetCodes(d);
- CSDPSFakeEventTypes t;
-
- if (c == NULL) return False; /* Not inited on that display;
- must be False */
-
- if (!c->first_event) /* Check CSDPS first */
- {
- if ((t = XDPSLGetCSDPSFakeEventType(d, event)) == csdps_output
- || t == csdps_output_with_len)
- return True;
- else
- return False;
- }
-
- return event->type == c->first_event + PSEVENTOUTPUT;
-}
-
-Bool XDPSIsDPSEvent(event)
- XEvent *event;
-{
- Display *d = event->xany.display;
- XExtCodes *c = XDPSLGetCodes(d);
-
- if (c == NULL) return False; /* Not inited on that display;
- must be False */
-
- if (!c->first_event) /* Check CSDPS first */
- {
- if (XDPSLGetCSDPSFakeEventType(d, event) != csdps_not)
- return True;
- else
- return False;
- }
-
- return event->type >= c->first_event &&
- event->type < c->first_event + NPSEVENTS;
-}
-
-Bool XDPSDispatchEvent(event)
- XEvent *event;
-{
- Display *d = event->xany.display;
- XExtCodes *c = XDPSLGetCodes(d);
- CSDPSFakeEventTypes t;
-
- if (c == NULL) return False; /* Not inited on that display;
- must be False */
-
- if (!c->first_event) /* Check CSDPS first */
- {
- if ((t = XDPSLGetCSDPSFakeEventType(d, event)) != csdps_not)
- return(XDPSLDispatchCSDPSFakeEvent(d, event, t));
- else
- return False;
- }
-
- if (event->type == c->first_event + PSEVENTSTATUS) {
- XDPSLCallStatusEventHandler(d, event);
- } else if (event->type == c->first_event + PSEVENTOUTPUT) {
- XDPSLCallOutputEventHandler(d, event);
- } else if (event->type == c->first_event + PSEVENTREADY) {
- XDPSLCallReadyEventHandler(d, event);
- } else return False;
- return True;
-}
-
-/* L2-DPS/PROTO 9 addition */
-Bool XDPSIsReadyEvent(event, ctxt, val)
- XEvent *event;
- DPSContext *ctxt;
- int *val;
-{
- Display *d = event->xany.display;
- XExtCodes *c = XDPSLGetCodes(d);
- XDPSLReadyEvent *re = (XDPSLReadyEvent *) event;
-
- if (c == NULL) return False; /* Not inited on that display;
- must be False */
-
- if (!c->first_event) /* Check CSDPS first */
- {
- if (XDPSLGetCSDPSFakeEventType(d, event) == csdps_ready)
- {
- XDPSLGetCSDPSReady(d, event, (void **)ctxt, val);
- return True;
- }
- else
- return False;
- }
-
- if (event->type != c->first_event + PSEVENTREADY) return False;
-
- if (ctxt != NULL) *ctxt = XDPSContextFromXID(d, re->cxid);
- if (val != NULL) {
- val[0] = re->val[0];
- val[1] = re->val[1];
- val[2] = re->val[2];
- val[4] = re->val[3];
- }
- return True;
-}
-
-int XDPSGetProtocolVersion(dpy)
- Display *dpy;
-{
- return XDPSLGetVersion(dpy);
-}
diff --git a/xc/lib/dps/dpsXcmu.c b/xc/lib/dps/dpsXcmu.c
deleted file mode 100644
index bc9f9e681..000000000
--- a/xc/lib/dps/dpsXcmu.c
+++ /dev/null
@@ -1,1618 +0,0 @@
-/*
- * dpsXcmu.c -- Simple color management/allocation utility
- *
- * (c) Copyright 1988-1994 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
- *
- * Portions 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 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.
- *
- * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 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.
- *
- * Author: Adobe Systems Incorporated and Donna Converse, MIT X Consortium
- */
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/Xatom.h>
-#include <X11/Xresource.h>
-#include <X11/Xos.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <pwd.h>
-#include "dpsassert.h"
-
-/* Defines for standard colormap routines */
-
-#define PrivSort qsort
-#ifndef NULL
-#define NULL 0
-#endif /* NULL */
-
-static char redsName[] = "reds";
-static char greensName[] = "greens";
-static char bluesName[] = "blues";
-static char graysName[] = "grays";
-
-/* Database containing DPS default color cube values */
-
-typedef struct _dpyRec {
- Display *dpy;
- XrmDatabase db;
- Atom XA_GRAY_DEFAULT_MAP;
- struct _dpyRec *next;
-} DpyRec;
-
-static DpyRec *dpyRec = NULL;
-static DpyRec *curDpyRec;
-static DpyRec *FindDpyRec();
-
-typedef struct {
- unsigned long *pixels;
- int npixels;
-} PixelRec;
-
-static XVisualInfo *PickCorrectVisual();
-static Status contiguous();
-static void ColorValuesFromMask();
-static long NumColors();
-static void CreateDefaultsDb();
-static void GetHomeDir();
-static void FindStaticColorCube();
-static Bool CheckCube();
-static int FindRampSize();
-static void SetRamp();
-static void GetDatabaseValues();
-static void AllocateColorCube();
-static void AllocateGrayRamp();
-static Bool AllocateColormap();
-static Bool AllocateColor();
-static Bool CubicCube();
-static void DefineProperty();
-static void FindStaticGrayRamp();
-static void ShrinkMapToFit();
-static void UseGrayDiagonal();
-static void UseGrayCorners();
-static Bool GetColorCubeFromProperty();
-static Bool GetGrayRampFromProperty();
-
-#define SCALE 65535
-#undef ABS
-#define ABS(x) ((x) < 0 ? -(x) : (x))
-
-void XDPSGetDefaultColorMaps(dpy, screen, drawable, colorCube, grayRamp)
- Display *dpy;
- Screen *screen;
- Drawable drawable;
- XStandardColormap *colorCube, *grayRamp;
-{
- Window root;
- Visual *visual;
- XStandardColormap g;
-
- /* If there is a screen specified, use it; otherwise use the drawable */
-
- if (screen == NULL) {
- if (drawable == None || ScreenCount(dpy) == 1) {
- root = DefaultRootWindow(dpy);
- screen = DefaultScreenOfDisplay(dpy);
- } else {
- /* Have to get the root for this drawable */
- int x, y;
- int i;
- unsigned int width, height, bwidth, depth;
- if (!XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height,
- &bwidth, &depth)) root = DefaultRootWindow(dpy);
- for (i = 0;
- i < ScreenCount(dpy) && root != RootWindow(dpy, i);
- i++) {}
- screen = ScreenOfDisplay(dpy, i);
- }
- } else root = RootWindowOfScreen(screen);
-
- if (grayRamp == NULL) grayRamp = &g;
-
- visual = DefaultVisualOfScreen(screen);
- grayRamp->colormap = DefaultColormapOfScreen(screen);
- if (colorCube != NULL) colorCube->colormap = grayRamp->colormap;
-
- (void) XDPSCreateStandardColormaps(dpy, root, visual,
- 0, 0, 0, 0, colorCube, grayRamp, True);
-}
-
-Status XDPSCreateStandardColormaps(dpy, drawable, visual, reds, greens,
- blues, grays, colorCube, grayRamp, retain)
- Display *dpy;
- Drawable drawable;
- Visual *visual;
- int reds, greens, blues, grays;
- XStandardColormap *colorCube, *grayRamp;
- Bool retain;
-{
- XVisualInfo vtemp, *vinfo;
- int nvis;
- XStandardColormap *propCube = NULL, *propRamp = NULL;
- int nPropCube = 0, nPropRamp = 0;
- Bool gotCube, gotRamp;
- PixelRec pixels;
-
- if (grayRamp == NULL) return 0;
- if (colorCube != NULL &&
- colorCube->colormap != grayRamp->colormap) return 0;
-
- if (dpy == NULL || (drawable == None && visual == NULL)) return 0;
-
- if (visual == NULL) {
- XWindowAttributes attr;
- if (XGetWindowAttributes(dpy, drawable, &attr) == 0) return 0;
- visual = attr.visual;
- }
-
- if (grayRamp->colormap == None && drawable == None) return 0;
-
- curDpyRec = FindDpyRec(dpy);
- if (curDpyRec == NULL) return 0;
-
- vtemp.visualid = XVisualIDFromVisual(visual);
- vinfo = XGetVisualInfo(dpy, VisualIDMask, &vtemp, &nvis);
- if (nvis == 0) return 0;
-
- if (nvis > 1) {
- vinfo = PickCorrectVisual(dpy, vinfo, nvis, grayRamp->colormap);
- }
- if (vinfo == NULL) return 0;
-
- if (grays <= 1) grayRamp->red_max = 0;
- else grayRamp->red_max = grays - 1;
-
- if (colorCube != NULL) {
- if (reds <= 1) colorCube->red_max = 0;
- else colorCube->red_max = reds - 1;
- if (greens <= 1) colorCube->green_max = 0;
- else colorCube->green_max = greens - 1;
- if (blues <= 1) colorCube->blue_max = 0;
- else colorCube->blue_max = blues - 1;
- }
-
- if ((vinfo->class == StaticGray || vinfo->class == GrayScale) &&
- colorCube != NULL) {
- /* Can't do a color cube in a gray visual! */
- colorCube->red_max = colorCube->green_max = colorCube->blue_max =
- colorCube->red_mult = colorCube->green_mult = colorCube->blue_mult =
- colorCube->base_pixel = 0;
- colorCube = NULL;
- }
-
- if (retain) {
- Display *newDpy = XOpenDisplay(XDisplayString(dpy));
- if (newDpy == NULL) retain = False;
- else dpy = newDpy;
- XGrabServer(dpy);
- }
-
- if (grayRamp->colormap == None) {
- grayRamp->colormap = XCreateColormap(dpy, drawable, vinfo->visual,
- AllocNone);
- if (colorCube != NULL) colorCube->colormap = grayRamp->colormap;
- }
-
- if (colorCube != NULL) {
- gotCube = GetColorCubeFromProperty(dpy, vinfo, colorCube,
- &propCube, &nPropCube);
- }
- gotRamp = GetGrayRampFromProperty(dpy, vinfo, grayRamp,
- &propRamp, &nPropRamp);
-
- if (!gotRamp || (colorCube != NULL && !gotCube)) {
- /* Couldn't find at least one thing we wanted, so let's look in the
- database */
-
- GetDatabaseValues(dpy, vinfo, colorCube, grayRamp);
-
- pixels.pixels = NULL;
- pixels.npixels = 0;
-
- if (colorCube != NULL) {
- if (colorCube->red_max != 0) {
- AllocateColorCube(dpy, vinfo, colorCube, &pixels);
- }
- if (colorCube->red_max == 0) {
- colorCube->green_max = colorCube->blue_max =
- colorCube->red_mult = colorCube->green_mult =
- colorCube->blue_mult = 0;
- }
- }
-
- if (grayRamp->red_max != 0) {
- AllocateGrayRamp(dpy, vinfo, grayRamp, colorCube, &pixels);
- }
-
- if (pixels.pixels != NULL) {
- if (pixels.npixels != 0) {
- XFreeColors(dpy, grayRamp->colormap,
- pixels.pixels, pixels.npixels, 0);
- }
- free((char *) pixels.pixels);
- }
-
- if (retain) {
- Pixmap p;
-
- /* Create something to put in killid field so the entries can
- be deleted sometime */
- p = XCreatePixmap(dpy, RootWindow(dpy, vinfo->screen), 1, 1, 1);
- if (colorCube != NULL && !gotCube && colorCube->red_max != 0) {
- colorCube->visualid = vinfo->visualid;
- colorCube->killid = p;
- DefineProperty(dpy, colorCube, vinfo, propCube, nPropCube,
- XA_RGB_DEFAULT_MAP);
- }
- if (!gotRamp && grayRamp->red_max != 0) {
- grayRamp->visualid = vinfo->visualid;
- grayRamp->killid = p;
- DefineProperty(dpy, grayRamp, vinfo, propRamp, nPropRamp,
- (vinfo->class == GrayScale ? XA_RGB_GRAY_MAP :
- curDpyRec->XA_GRAY_DEFAULT_MAP));
- }
- XSetCloseDownMode(dpy, RetainTemporary);
- }
- }
-
- if (grayRamp->red_max == 0) {
- /* Use special magic values. If this is a default colormap,
- the server recognizes a gray ramp with red_max=1, red_mult=1,
- base_pixel=0 to mean a 2 gray ramp with BlackPixel being
- the lowest intensity gray and WhitePixel being the highest
- intensity gray. If it's not a default colormap, then the
- server will either generate a BadValue error, or just happily
- use pixel values 0 and 1; either is better than the alternative,
- silently converting into a null device. */
- grayRamp->red_max = 1;
- grayRamp->red_mult = 1;
- grayRamp->base_pixel = 0;
- }
-
- if (retain) {
- XUngrabServer(dpy);
- XCloseDisplay(dpy);
- }
- if (propCube != NULL) XFree((void *) propCube);
- if (propRamp != NULL) XFree((void *) propRamp);
- XFree((void *) vinfo);
- return 1;
-}
-
-static DpyRec *FindDpyRec(dpy)
- Display *dpy;
-{
- DpyRec *d;
-
- for (d = dpyRec; d != NULL; d = d->next) {
- if (d->dpy == dpy) return d;
- }
-
- d = (DpyRec *) malloc(sizeof(DpyRec));
- if (d == NULL) return NULL;
- d->XA_GRAY_DEFAULT_MAP = XInternAtom(dpy, "DEFAULT_GRAY", False);
- d->db = NULL;
- d->next = dpyRec;
- dpyRec = d;
- return d;
-}
-
-static XVisualInfo *PickCorrectVisual(dpy, vlist, n, cmap)
- Display *dpy;
- XVisualInfo *vlist;
- int n;
- Colormap cmap;
-{
- register int i;
- register int screen_number;
- Bool def_cmap = False;
-
- /* A visual id may be valid on multiple screens. Also, there may
- * be multiple visuals with identical visual ids at different depths.
- * If the colormap is the Default Colormap, use the Default Visual.
- * Otherwise, arbitrarily, use the deepest visual.
- */
-
- for (screen_number = ScreenCount(dpy); --screen_number >= 0; /**/) {
- if (cmap == DefaultColormap(dpy, screen_number)) {
- def_cmap = True;
- break;
- }
- }
-
- if (def_cmap) {
- for (i = 0; i < n; i++, vlist++) {
- if (vlist->visual == DefaultVisual(dpy, screen_number)) {
- return vlist;
- }
- }
- return NULL; /* Visual does not match colormap */
- } else {
- unsigned int maxdepth = 0;
- XVisualInfo *v;
-
- for (i = 0; i < n; i++, vlist++) {
- if (vlist->depth > maxdepth) {
- maxdepth = vlist->depth;
- v = vlist;
- }
- }
- return v;
- }
-}
-
-/* Do some rudimentary checking of the properties to avoid obviously bad ones.
- How did they get there, anyway? */
-
-static Bool ValidCube(c, vinfo)
- XStandardColormap *c;
- XVisualInfo *vinfo;
-{
- int max = 1 << vinfo->depth;
- int pixel;
-
- if (c->red_max < 1 || c->green_max < 1 || c->blue_max < 1) return False;
- if (c->base_pixel < 0 || c->base_pixel > max) return False;
- pixel = (c->red_max * c->red_mult + c->green_max * c->green_mult +
- c->blue_max * c->blue_mult + c->base_pixel) & 0xFFFFFFFF;
- if (pixel < 0 || pixel > max) return False;
-
- return True;
-}
-
-static Bool ValidRamp(c, vinfo)
- XStandardColormap *c;
- XVisualInfo *vinfo;
-{
- int max = 1 << vinfo->depth;
- int pixel;
-
- if (c->red_max < 1) return False;
- if (c->base_pixel < 0 || c->base_pixel > max) return False;
- pixel = (c->red_max * c->red_mult + c->base_pixel) & 0xFFFFFFFF;
- if (pixel < 0 || pixel > max) return False;
-
- return True;
-}
-
-static Bool GetColorCubeFromProperty(dpy, vinfo, colorCube, cube, ncube)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *colorCube;
- XStandardColormap **cube;
- int *ncube;
-{
- int gotCube;
- int i;
- register XStandardColormap *c;
-
- gotCube = XGetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), cube,
- ncube, XA_RGB_DEFAULT_MAP);
-
- if (gotCube) {
- /* Try to find a match with the visual */
- c = *cube;
- for (i = 0; i < *ncube; i++) {
- if (c->colormap == colorCube->colormap &&
- c->visualid == vinfo->visualid &&
- ValidCube(c, vinfo)) {
- colorCube->red_max = c->red_max;
- colorCube->red_mult = c->red_mult;
- colorCube->green_max = c->green_max;
- colorCube->green_mult = c->green_mult;
- colorCube->blue_max = c->blue_max;
- colorCube->blue_mult = c->blue_mult;
- colorCube->base_pixel = c->base_pixel;
- colorCube->visualid = c->visualid;
- colorCube->killid = c->killid;
- break;
- }
- c++;
- }
- if (i == *ncube) gotCube = False;
- }
- return gotCube;
-}
-
-static Bool GetGrayRampFromProperty(dpy, vinfo, grayRamp, ramp, nramp)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *grayRamp;
- XStandardColormap **ramp;
- int *nramp;
-{
- int gotRamp;
- int i;
- Atom grayAtom;
- register XStandardColormap *c;
-
- if (vinfo->class == GrayScale) grayAtom = XA_RGB_GRAY_MAP;
- else grayAtom = curDpyRec->XA_GRAY_DEFAULT_MAP;
-
- gotRamp = XGetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), ramp,
- nramp, grayAtom);
-
- if (gotRamp) {
- /* Try to find a match with the visual */
- c = *ramp;
- for (i = 0; i < *nramp; i++) {
- if (c->colormap == grayRamp->colormap &&
- c->visualid == vinfo->visualid &&
- ValidRamp(c, vinfo)) {
- grayRamp->red_max = c->red_max;
- grayRamp->red_mult = c->red_mult;
- grayRamp->base_pixel = c->base_pixel;
- grayRamp->visualid = c->visualid;
- grayRamp->killid = c->killid;
- break;
- }
- c++;
- }
- if (i == *nramp) gotRamp = False;
- }
- return gotRamp;
-}
-
-static void GetDatabaseValues(dpy, vinfo, colorCube, grayRamp)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *colorCube, *grayRamp;
-{
- char *class, *depth;
- char namePrefix[40], classPrefix[40];
- int max;
- XStandardColormap fakeCube;
-
- switch (vinfo->class) {
- case StaticGray: class = "StaticGray."; break;
- case GrayScale: class = "GrayScale."; break;
- case StaticColor: class = "StaticColor."; break;
- case PseudoColor: class = "PseudoColor."; break;
- case TrueColor: class = "TrueColor."; break;
- case DirectColor: class = "DirectColor."; break;
- }
-
- if (vinfo->depth >= 24) depth = "24.";
- else if (vinfo->depth >= 12) depth = "12.";
- else if (vinfo->depth >= 8) depth = "8.";
- else if (vinfo->depth >= 4) depth = "4.";
- else if (vinfo->depth >= 2) depth = "2.";
- else depth = "1.";
-
- (void) strcpy(namePrefix, "dpsColorCube.");
- (void) strcat(strcat(namePrefix, class), depth);
- (void) strcpy(classPrefix, "DPSColorCube.");
- (void) strcat(strcat(classPrefix, class), depth);
-
- CreateDefaultsDb(dpy);
-
- if (colorCube == NULL && vinfo->class == TrueColor) {
- /* We'll need the color cube information to compute the gray ramp,
- even if it wasn't asked for, so make colorCube point to a
- temporary structure */
- colorCube = &fakeCube;
- }
-
- if (colorCube != NULL) {
- switch (vinfo->class) {
- case StaticGray:
- case GrayScale:
- /* We can't do a color cube for these visuals */
- break;
-
- case TrueColor:
- /* Rewrite whatever was there before with real values */
- ColorValuesFromMask(vinfo->red_mask, &colorCube->red_max,
- &colorCube->red_mult);
- ColorValuesFromMask(vinfo->green_mask, &colorCube->green_max,
- &colorCube->green_mult);
- ColorValuesFromMask(vinfo->blue_mask, &colorCube->blue_max,
- &colorCube->blue_mult);
- colorCube->base_pixel = 0;
- break;
-
- case DirectColor:
- /* Get the mults from the masks; ignore maxes */
- ColorValuesFromMask(vinfo->red_mask, &max,
- &colorCube->red_mult);
- ColorValuesFromMask(vinfo->green_mask, &max,
- &colorCube->green_mult);
- ColorValuesFromMask(vinfo->blue_mask, &max,
- &colorCube->blue_mult);
- /* Get the maxes from the database */
- if (colorCube->red_max == 0) {
- colorCube->red_max =
- NumColors(namePrefix, classPrefix, redsName) - 1;
- }
- if (colorCube->green_max == 0) {
- colorCube->green_max =
- NumColors(namePrefix, classPrefix, greensName) - 1;
- }
- if (colorCube->blue_max == 0) {
- colorCube->blue_max =
- NumColors(namePrefix, classPrefix, bluesName) - 1;
- }
- colorCube->base_pixel = 0;
- break;
-
- case PseudoColor:
- if (colorCube->red_max == 0) {
- colorCube->red_max =
- NumColors(namePrefix, classPrefix, redsName) - 1;
- }
- if (colorCube->green_max == 0) {
- colorCube->green_max =
- NumColors(namePrefix, classPrefix, greensName) - 1;
- }
- if (colorCube->blue_max == 0) {
- colorCube->blue_max =
- NumColors(namePrefix, classPrefix, bluesName) - 1;
- }
- colorCube->red_mult = (colorCube->green_max + 1) *
- (colorCube->blue_max + 1);
- colorCube->green_mult = colorCube->blue_max + 1;
- colorCube->blue_mult = 1;
- break;
-
- case StaticColor:
- FindStaticColorCube(dpy, vinfo, colorCube);
- break;
- }
- }
-
- switch (vinfo->class) {
- case GrayScale:
- case PseudoColor:
- case DirectColor:
- if (grayRamp->red_max == 0) {
- grayRamp->red_max =
- NumColors(namePrefix, classPrefix, graysName) - 1;
- }
- grayRamp->red_mult = 1;
- break;
-
- case TrueColor:
- /* If the color cube is truly a cube, use its diagonal. Otherwise
- were SOL and have to use a two-element ramp. */
- if (CubicCube(colorCube)) UseGrayDiagonal(colorCube, grayRamp);
- else UseGrayCorners(colorCube, grayRamp);
- break;
-
- case StaticColor:
- case StaticGray:
- FindStaticGrayRamp(dpy, vinfo, grayRamp, colorCube);
- break;
- }
-}
-
-static Bool CubicCube(cube)
- XStandardColormap *cube;
-{
- return cube->red_max == cube->green_max && cube->red_max ==
- cube->blue_max;
-}
-
-static void UseGrayDiagonal(cube, ramp)
- XStandardColormap *cube, *ramp;
-{
- ramp->red_max = cube->red_max;
- ramp->red_mult = ABS(cube->red_mult) + ABS(cube->green_mult) +
- ABS(cube->blue_mult);
- if (cube->red_mult < 0) ramp->red_mult *= -1;
- ramp->base_pixel = cube->base_pixel;
-}
-
-static void UseGrayCorners(cube, ramp)
- XStandardColormap *cube, *ramp;
-{
- ramp->red_max = 1;
- ramp->red_mult = (cube->red_max + 1) * (cube->green_max + 1) *
- (cube->blue_max + 1) - 1;
- if (* (int *) &(cube->red_mult) < 0) ramp->red_mult *= -1;
- ramp->base_pixel = cube->base_pixel;
-}
-
-static void ColorValuesFromMask(mask, maxColor, mult)
- unsigned long mask;
- unsigned long *maxColor;
- int *mult;
-{
- *mult = 1;
- while ((mask & 1) == 0) {
- *mult <<= 1;
- mask >>= 1;
- }
- *maxColor = mask;
-}
-
-/*
-Resource definitions for default color cube / gray ramp sizes
-are based on visual class and depth. Working from least choices
-to most, here's motivation for the defaults:
-
-If unspecified, default is 0 values for red, green, and blue,
-and 2 (black and white) for grays. This covers StaticGray, StaticColor,
-and depths less than 4 of the other visual classes.
-
-If we have a choice, we try to allocate a gray ramp with an odd number
-of colors; this is so 50% gray can be rendered without dithering.
-In general we don't want to allocate a large cube (even when many
-colormap entries are available) because allocation of each entry
-requires a round-trip to the server (entries allocated read-only
-via XAllocColor).
-
-For GrayScale, any depth less than 4 is treated as monochrome.
-
-PseudoColor depth 4 we try for a 2x2x2 cube with the gray ramp on
-the diagonal. Depth 8 uses a 4x4x4 cube with a separate 9 entry
-gray ramp. Depth 12 uses a 6x6x5 "cube" with a separate 17 entry gray
-ramp. The cube is non-symmetrical; we don't want to use the diagonal
-for a gray ramp and we can get by with fewer blues than reds or greens.
-
-For DirectColor, allocating a gray ramp separate from the color cube
-is wasteful of map entries, so we specify a symmetrical cube and
-share the diagonal entries for the gray ramp.
-
-For TrueColor, # color shades is set equal to the # shades / primary;
-we don't actually allocate map entries, but it's handy to be able to
-do the resource lookup blindly and get the right value.
-*/
-
-static char dpsDefaults[] = "\
-*reds: 0\n\
-*greens: 0\n\
-*blues: 0\n\
-*grays: 2\n\
-\
-*GrayScale.4.grays: 9\n\
-*GrayScale.8.grays: 17\n\
-\
-*PseudoColor.4.reds: 2\n\
-*PseudoColor.4.greens: 2\n\
-*PseudoColor.4.blues: 2\n\
-*PseudoColor.4.grays: 2\n\
-*PseudoColor.8.reds: 4\n\
-*PseudoColor.8.greens: 4\n\
-*PseudoColor.8.blues: 4\n\
-*PseudoColor.8.grays: 9\n\
-*PseudoColor.12.reds: 6\n\
-*PseudoColor.12.greens: 6\n\
-*PseudoColor.12.blues: 5\n\
-*PseudoColor.12.grays: 17\n\
-\
-*DirectColor.8.reds: 4\n\
-*DirectColor.8.greens: 4\n\
-*DirectColor.8.blues: 4\n\
-*DirectColor.8.grays: 4\n\
-*DirectColor.12.reds: 6\n\
-*DirectColor.12.greens: 6\n\
-*DirectColor.12.blues: 6\n\
-*DirectColor.12.grays: 6\n\
-*DirectColor.24.reds: 7\n\
-*DirectColor.24.greens: 7\n\
-*DirectColor.24.blues: 7\n\
-*DirectColor.24.grays: 7\n\
-\
-*TrueColor.12.reds: 16\n\
-*TrueColor.12.greens: 16\n\
-*TrueColor.12.blues: 16\n\
-*TrueColor.12.grays: 16\n\
-*TrueColor.24.reds: 256\n\
-*TrueColor.24.greens: 256\n\
-*TrueColor.24.blues: 256\n\
-*TrueColor.24.grays: 256\n\
-";
-
-static XrmDatabase defaultDB = NULL;
-
-static void CreateDefaultsDb(dpy)
- Display *dpy;
-{
- char home[256], *dpyDefaults;
-
- if (defaultDB == NULL) defaultDB = XrmGetStringDatabase(dpsDefaults);
-
- if (curDpyRec->db != NULL) return;
-
- dpyDefaults = XResourceManagerString(dpy);
- if (dpyDefaults != NULL) {
- curDpyRec->db = XrmGetStringDatabase(dpyDefaults);
- }
-
- if (curDpyRec->db == NULL) {
- GetHomeDir(home);
- strcpy(home, "/.Xdefaults");
- curDpyRec->db = XrmGetFileDatabase(home);
- }
-}
-
-static void GetHomeDir(buf)
- char *buf;
-{
-#ifndef X_NOT_POSIX
- uid_t uid;
-#else
- int uid;
- extern int getuid();
-#ifndef SYSV386
- extern struct passwd *getpwuid(), *getpwnam();
-#endif
-#endif
- struct passwd *pw;
- static char *ptr = NULL;
-
- if (ptr == NULL) {
- if (!(ptr = getenv("HOME"))) {
- if ((ptr = getenv("USER")) != 0) pw = getpwnam(ptr);
- else {
- uid = getuid();
- pw = getpwuid(uid);
- }
- if (pw) ptr = pw->pw_dir;
- else {
- ptr = NULL;
- *buf = '\0';
- }
- }
- }
-
- if (ptr)
- (void) strcpy(buf, ptr);
-
- buf += strlen(buf);
- *buf = '/';
- buf++;
- *buf = '\0';
- return;
-}
-
-static long NumColors(namePrefix, classPrefix, color)
- char *namePrefix, *classPrefix, *color;
-{
- char name[40], class[40];
- XrmValue rtnValue;
- char *rtnType;
- long value;
-
- (void) strcpy(name, namePrefix);
- (void) strcpy(class, classPrefix);
- if (! XrmGetResource(curDpyRec->db, strcat(name, color),
- strcat(class, color), &rtnType, &rtnValue)) {
- if (! XrmGetResource(defaultDB, name, class, &rtnType, &rtnValue)) {
- /* This should never happen, as our defaults cover all cases */
- return 0;
- }
- }
-
- /* Resource value is number of shades of specified color. If value
- is not an integer, atoi returns 0, so we return 0. If value
- is less than 2, it is invalid (need at least 2 shades of a color).
- Explicitly setting 0 is ok for colors (means to not use a color
- cube) but merits a warning for gray. */
-
- if (strcmp(rtnValue.addr, "0") == 0 && strcmp(color, "grays") != 0) {
- return 0;
- }
-
- value = atol(rtnValue.addr);
- if (value < 2) {
- char mbuf[512];
- sprintf(mbuf, "%% Value '%s' is invalid for %s resource\n",
- rtnValue.addr, name);
- DPSWarnProc(NULL, mbuf);
- }
- return value;
-}
-
-/* Query the entire colormap in the static color case, then try to find
- a color cube. Check pairs of black and white cells trying to find
- a cube between them and take the first one you find. */
-
-static void FindStaticColorCube(dpy, vinfo, colorCube)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *colorCube;
-{
- XColor *ramp, *black, *white, *altBlack, *altWhite;
- int i, entries;
-
- entries = 1 << vinfo->depth;
- ramp = (XColor *) calloc(entries, sizeof(XColor));
-
- if (ramp == NULL) {
- colorCube->red_max = 0;
- return;
- }
-
- /* Query the colormap */
- for (i = 0; i < entries; i++) ramp[i].pixel = i;
- XQueryColors(dpy, colorCube->colormap, ramp, entries);
-
- /* Find the white and black entries */
-
- black = white = altBlack = altWhite = NULL;
- for (i = 0; i < entries; i++) {
- if (ramp[i].flags != (DoRed | DoBlue | DoGreen)) continue;
- if (ramp[i].red == 0 && ramp[i].blue == 0 &&
- ramp[i].green == 0) {
- if (black == NULL) black = ramp+i;
- else if (altBlack == NULL) altBlack = ramp+i;
- } else if (ramp[i].red == SCALE && ramp[i].blue == SCALE &&
- ramp[i].green == SCALE) {
- if (white == NULL) white = ramp+i;
- else if (altWhite == NULL) altWhite = ramp+i;
- }
- }
-
- if (black == NULL || white == NULL) {
- colorCube->red_max = 0;
- free(ramp);
- return;
- }
-
- /* Look for cubes between pairs of black & white */
- if (!CheckCube(black, white, colorCube) &&
- !CheckCube(altBlack, white, colorCube) &&
- !CheckCube(black, altWhite, colorCube) &&
- !CheckCube(altBlack, altWhite, colorCube)) {
- colorCube->red_max = 0;
- }
-
- free(ramp);
-}
-
-#define R 1
-#define G 2
-#define B 4
-#define C 8
-#define M 16
-#define Y 32
-
-#define SMALLSCALE 255
-#define CheckColor(color,r,g,b) ((((color)->red >> 8) == (r) * SMALLSCALE) && \
- (((color)->green >> 8) == (g) * SMALLSCALE) && \
- (((color)->blue >> 8) == (b) * SMALLSCALE))
-
-static Bool CheckCube(black, white, cube)
- XColor *black, *white;
- XStandardColormap *cube;
-{
- int r, g, b, c, m, y, k, w;
- XColor *color;
- unsigned int found = 0;
- int small, middle, large;
- int smallMult, smallMax, middleMult, middleMax, largeMult, largeMax;
- Bool backwards = False;
- int mult = 1;
- XStandardColormap test; /* Test cube */
- int i;
- int size;
-
- if (black == NULL || white == NULL) return False;
-
- k = black->pixel;
- w = white->pixel - k;
-
- size = ABS(w);
- if (w < 0) {
- backwards = True;
- mult = -1;
- }
-
- for (i = 1; i < size; i++) {
- color = black + i*mult;
- if (color->flags != (DoRed | DoBlue | DoGreen)) return False;
-
- /* If black or white is in the middle of the cube, can't work */
- if (CheckColor(color, 0, 0, 0)) return False;
- if (CheckColor(color, 1, 1, 1)) return False;
-
- /* Check for red, green, blue, cyan, magenta, and yellow */
- if (CheckColor(color, 1, 0, 0)) {r = color->pixel-k; found |= R;}
- else if (CheckColor(color, 0, 1, 0)) {g = color->pixel-k; found |= G;}
- else if (CheckColor(color, 0, 0, 1)) {b = color->pixel-k; found |= B;}
- else if (CheckColor(color, 0, 1, 1)) {c = color->pixel-k; found |= C;}
- else if (CheckColor(color, 1, 0, 1)) {m = color->pixel-k; found |= M;}
- else if (CheckColor(color, 1, 1, 0)) {y = color->pixel-k; found |= Y;}
- }
-
- /* If any color is missing no cube is possible */
- if (found != (R | G | B | C | M | Y)) return False;
-
- /* Next test. Make sure B + G = C, R + B = M, R + G = Y,
- and R + G + B = W */
- if (b + g != c) return False;
- if (r + b != m) return False;
- if (r + g != y) return False;
- if (r + g + b != w) return False;
-
- /* Looking good! Compensate for backwards cubes */
- if (backwards) {
- w = ABS(w);
- r = ABS(r);
- g = ABS(g);
- b = ABS(b);
- }
-
- /* Find the smallest, middle, and largest difference */
- if (r < b && b < g) {
- small = r; middle = b; large = g;
- } else if (r < g && g < b) {
- small = r; middle = g; large = b;
- } else if (b < r && r < g) {
- small = b; middle = r; large = g;
- } else if (b < g && g < r) {
- small = b; middle = g; large = r;
- } else if (g < r && r < b) {
- small = g; middle = r; large = b;
- } else {
- small = g; middle = b; large = r;
- }
-
- /* The smallest must divide the middle, and the middle the large */
- if ((middle % (small + 1)) != 0) return False;
- if ((large % (small + middle + 1)) != 0) return False;
-
- /* OK, we believe we have a cube. Compute the description */
- smallMult = 1;
- smallMax = small;
- middleMult = small + 1;
- middleMax = middle / middleMult;
- largeMult = small + middle + 1;
- largeMax = large / largeMult;
-
- if (small == r) {
- test.red_max = smallMax; test.red_mult = smallMult;
- if (middle == b) {
- test.blue_max = middleMax; test.blue_mult = middleMult;
- test.green_max = largeMax; test.green_mult = largeMult;
- } else {
- test.green_max = middleMax; test.green_mult = middleMult;
- test.blue_max = largeMax; test.blue_mult = largeMult;
- }
- } else if (small == g) {
- test.green_max = smallMax; test.green_mult = smallMult;
- if (middle == b) {
- test.blue_max = middleMax; test.blue_mult = middleMult;
- test.red_max = largeMax; test.red_mult = largeMult;
- } else {
- test.red_max = middleMax; test.red_mult = middleMult;
- test.blue_max = largeMax; test.blue_mult = largeMult;
- }
- } else { /* small == b */
- test.blue_max = smallMax; test.blue_mult = smallMult;
- if (middle == r) {
- test.red_max = middleMax; test.red_mult = middleMult;
- test.green_max = largeMax; test.green_mult = largeMult;
- } else {
- test.green_max = middleMax; test.green_mult = middleMult;
- test.red_max = largeMax; test.red_mult = largeMult;
- }
- }
-
- /* Re-compensate for backwards cube */
- if (backwards) {
- test.red_mult *= -1;
- test.green_mult *= -1;
- test.blue_mult *= -1;
- }
-
- /* Finally, test the hypothesis! The answer must be correct within 1
- bit. Only look at the top 8 bits; the others are too noisy */
-
- for (i = 1; i < size; i++) {
-#define calc(i, max, mult) ((((i / test.mult) % \
- (test.max + 1)) * SCALE) / test.max)
- r = ((unsigned short) calc(i, red_max, red_mult) >> 8) -
- (black[i*mult].red >> 8);
- g = ((unsigned short) calc(i, green_max, green_mult) >> 8) -
- (black[i*mult].green >> 8);
- b = ((unsigned short) calc(i, blue_max, blue_mult) >> 8) -
- (black[i*mult].blue >> 8);
-#undef calc
- if (ABS(r) > 2 || ABS(g) > 2 || ABS(b) > 2) return False;
- }
- cube->red_max = test.red_max;
- cube->red_mult = test.red_mult;
- cube->green_max = test.green_max;
- cube->green_mult = test.green_mult;
- cube->blue_max = test.blue_max;
- cube->blue_mult = test.blue_mult;
- cube->base_pixel = k;
- return True;
-}
-
-#undef R
-#undef G
-#undef B
-#undef C
-#undef M
-#undef Y
-
-/* Query the entire colormap in the static gray case, then try to find
- a gray ramp. This handles there being 2 white or black entries
- in the colormap and finds the longest linear ramp between pairs of
- white and black. If there is a color cube, also check its diagonal and
- use its corners if we need to */
-
-static void FindStaticGrayRamp(dpy, vinfo, grayRamp, colorCube)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *grayRamp, *colorCube;
-{
- XColor *ramp, *black, *white, *altBlack, *altWhite;
- int i, r0, r1, r2, r3, size, entries, redMult, base;
-
- entries = 1 << vinfo->depth;
- ramp = (XColor *) calloc(entries, sizeof(XColor));
-
- if (ramp == NULL) {
- grayRamp->red_max = 0;
- return;
- }
-
- /* Query the colormap */
- for (i = 0; i < entries; i++) ramp[i].pixel = i;
- XQueryColors(dpy, grayRamp->colormap, ramp, entries);
-
- /* Find the white and black entries */
-
- black = white = altBlack = altWhite = NULL;
- for (i = 0; i < entries; i++) {
- if (ramp[i].flags != (DoRed | DoBlue | DoGreen)) continue;
- if (CheckColor(ramp+i, 0, 0, 0)) {
- if (black == NULL) black = ramp+i;
- else if (altBlack == NULL) altBlack = ramp+i;
- } else if (CheckColor(ramp+i, 1, 1, 1)) {
- if (white == NULL) white = ramp+i;
- else if (altWhite == NULL) altWhite = ramp+i;
- }
- }
-
- if (black == NULL || white == NULL) {
- grayRamp->red_max = 0;
- free(ramp);
- return;
- }
-
- /* Find out how large a ramp exists between pairs of black & white */
- r0 = FindRampSize(black, white);
- r1 = FindRampSize(altBlack, white);
- r2 = FindRampSize(black, altWhite);
- r3 = FindRampSize(altBlack, altWhite);
-
- size = r0;
- if (r1 > size) size = r1;
- if (r2 > size) size = r2;
- if (r3 > size) size = r3;
- if (size == r0) SetRamp(black, white, size, &redMult, &base);
- else if (size == r1) SetRamp(altBlack, white, size, &redMult, &base);
- else if (size == r2) SetRamp(black, altWhite, size, &redMult, &base);
- else if (size == r3) SetRamp(altBlack, altWhite, size, &redMult, &base);
-
- if (colorCube != NULL && CubicCube(colorCube) &&
- colorCube->red_max > size) {
- UseGrayDiagonal(colorCube, grayRamp);
- } else {
- grayRamp->red_max = size;
- grayRamp->red_mult = redMult;
- grayRamp->base_pixel = base;
- }
-
- free(ramp);
-}
-
-static int FindRampSize(black, white)
- XColor *black, *white;
-{
- XColor *c;
- int r;
- int mult = 1;
- int i, size;
-
- if (black == NULL || white == NULL) return 0;
- size = ABS(white - black);
-
- /* See if we have a backwards ramp */
- if (black > white) mult = -1;
-
- /* See if all cells between black and white are linear, to within 1 bit.
- Only look at the high order 8 bits */
-
- for (i = 1; i < size; i++) {
- c = &black[i*mult];
- if (c->red != c->blue || c->red != c->green) return 1;
- r = ((unsigned short) ((i * SCALE) / size) >> 8) - (c->red >> 8);
- if (ABS(r) > 2) return 1;
- }
- return size;
-}
-
-static void SetRamp(black, white, size, mult, base)
- XColor *black, *white;
- int size;
- int *mult;
- unsigned long *base;
-{
- *base = black->pixel;
- *mult = (white - black) / size;
-}
-
-#define lowbit(x) ((x) & (~(x) + 1))
-
-static int shiftdown(x)
- register unsigned long x;
-{
- while ((x & 1) == 00) {
- x = x >> 1;
- }
- return x;
-}
-
-static void AllocateColorCube(dpy, vinfo, colorCube, pixels)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *colorCube;
- PixelRec *pixels;
-{
- int count, first, remain, n, i;
- Colormap cmap = colorCube->colormap;
- unsigned long delta;
- XColor color;
-
- /* We do no allocation for TrueColor or StaticColor */
- if (vinfo->class == TrueColor || vinfo->class == StaticColor) return;
-
- if (vinfo->class == DirectColor) {
- if ((i = shiftdown(vinfo->red_mask)) > colorCube->red_max)
- colorCube->red_max = i;
- if ((i = shiftdown(vinfo->green_mask)) > colorCube->green_max)
- colorCube->green_max = i;
- if ((i = shiftdown(vinfo->blue_mask)) > colorCube->blue_max)
- colorCube->blue_max = i;
-
- /* We only handle symmetric DirectColor */
- count = colorCube->red_max + 1;
- if (colorCube->blue_max + 1 < count) count = colorCube->blue_max + 1;
- if (colorCube->green_max + 1 < count) count = colorCube->green_max + 1;
- colorCube->red_max = colorCube->blue_max = colorCube->green_max =
- count - 1;
-
- delta = lowbit(vinfo->red_mask) + lowbit(vinfo->green_mask) +
- lowbit(vinfo->blue_mask);
- } else {
- count = (colorCube->red_max + 1) * (colorCube->blue_max + 1) *
- (colorCube->green_max + 1);
- delta = 1;
- }
-
- colorCube->base_pixel = 0; /* temporary, may change */
-
- pixels->pixels = (unsigned long *) calloc(vinfo->colormap_size,
- sizeof(unsigned long));
- if (pixels->pixels == NULL) {
- colorCube->red_max = 0;
- return;
- }
-
- if (!AllocateColormap(dpy, colorCube, vinfo, &count, pixels,
- &first, &remain, delta)) {
- free((char *) pixels->pixels);
- pixels->pixels = NULL;
- colorCube->red_max = 0;
- return;
- }
-
- colorCube->base_pixel = pixels->pixels[first];
- color.flags = DoRed | DoGreen | DoBlue;
-
- /* Define colors */
- for (n = 0, i = 0; i < count; ++i, n += delta) {
- color.pixel = n + pixels->pixels[first];
- if (vinfo->class == PseudoColor) {
-#define calc(i, max, mult) ((((i / colorCube->mult) % \
- (colorCube->max + 1)) * SCALE) / colorCube->max)
- color.red = (unsigned short) calc(n, red_max, red_mult);
- color.green = (unsigned short) calc(n, green_max, green_mult);
- color.blue = (unsigned short) calc(n, blue_max, blue_mult);
-#undef calc
- } else {
- color.red = color.green = color.blue =
- (i * SCALE) / colorCube->red_max;
- }
- if (!AllocateColor(dpy, cmap, &color)) {
- XFreeColors(dpy, cmap, pixels->pixels, count+first+remain, 0);
- free((char *) pixels->pixels);
- pixels->pixels = NULL;
- colorCube->red_max = 0;
- return;
- }
- }
-
- /* Smush down unused pixels, if any */
-
- for (i = 0; i < remain; i++) {
- pixels->pixels[first+i] = pixels->pixels[first+count+i];
- }
- pixels->npixels -= count;
-}
-
-static void AllocateGrayRamp(dpy, vinfo, grayRamp, colorCube, pixels)
- Display *dpy;
- XVisualInfo *vinfo;
- XStandardColormap *grayRamp, *colorCube;
- PixelRec *pixels;
-{
- int count, first, remain, n, i;
- Colormap cmap = grayRamp->colormap;
- XColor color;
- unsigned long delta;
-
- /* Allocate cells in read/write visuals only */
- if (vinfo->class != PseudoColor && vinfo->class != GrayScale &&
- vinfo->class != DirectColor) return;
-
- if (vinfo->class == DirectColor) {
- delta = lowbit(vinfo->red_mask) + lowbit(vinfo->green_mask) +
- lowbit(vinfo->blue_mask);
- } else delta = 1;
-
- /* First of all see if there's a usable gray ramp in the color cube */
-
- if (colorCube != NULL) {
- if (CubicCube(colorCube)) {
- if (colorCube->red_max >= grayRamp->red_max) {
- /* diagonal is long enough! use it */
- UseGrayDiagonal(colorCube, grayRamp);
- return;
- }
- }
- }
-
- grayRamp->base_pixel = 0; /* temporary, may change */
-
- count = grayRamp->red_max + 1;
-
- if (pixels->pixels == NULL) {
- pixels->pixels = (unsigned long *) calloc(vinfo->colormap_size,
- sizeof(unsigned long));
- if (pixels->pixels == NULL) {
- grayRamp->red_max = 0;
- return;
- }
- }
-
- if (!AllocateColormap(dpy, grayRamp, vinfo, &count, pixels,
- &first, &remain, delta)) {
- /* Last gasp: try any diagonal or the corners of the color cube */
- if (colorCube != NULL) {
- if (CubicCube(colorCube)) UseGrayDiagonal(colorCube, grayRamp);
- else UseGrayCorners(colorCube, grayRamp);
- } else {
- grayRamp->red_max = 0;
- }
- return;
- }
-
- grayRamp->base_pixel = pixels->pixels[first];
- color.flags = DoRed | DoGreen | DoBlue;
-
- /* Define colors */
- for (n = 0, i = 0; i < count; ++i, n += delta) {
- color.pixel = n + pixels->pixels[first];
- color.red = (unsigned short)((n * SCALE) / (grayRamp->red_max));
- color.green = color.red;
- color.blue = color.red;
-
- if (!AllocateColor(dpy, cmap, &color)) {
- /* Don't need to free pixels here; we'll do it on return */
- grayRamp->red_max = 0;
- return;
- }
- }
-
- /* Smush down unused pixels, if any */
-
- for (i = 0; i < remain; i++) {
- pixels->pixels[first+i] = pixels->pixels[first+count+i];
- }
- pixels->npixels -= count;
-}
-
-#ifdef __STDC__
-
-static int compare(a1, a2)
- const void *a1, *a2;
-{
- register unsigned long *e1 = (unsigned long *) a1,
- *e2 = (unsigned long *) a2;
-
- if (*e1 < *e2) return -1;
- if (*e1 > *e2) return 1;
- return 0;
-}
-
-#else /* __STDC__ */
-
-static int compare(e1, e2)
- register unsigned long *e1, *e2;
-{
- if (*e1 < *e2) return -1;
- if (*e1 > *e2) return 1;
- return 0;
-}
-
-#endif /* __STDC__ */
-
-static Bool AllocateColormap(dpy, map, vinfo, count, pixels,
- first, remain, delta)
- Display *dpy;
- XStandardColormap *map;
- XVisualInfo *vinfo;
- int *count;
- PixelRec *pixels;
- int *first, *remain;
- unsigned long delta;
-{
- Colormap cmap = map->colormap;
- int npixels, ok, i;
- Bool success = False;
-
- if (pixels->npixels == 0) {
- /* First try to allocate the entire colormap */
- npixels = vinfo->colormap_size;
- ok = XAllocColorCells(dpy, cmap, 1, NULL, 0, pixels->pixels, npixels);
- if (ok) success = True;
- else {
- int total;
- int top, mid;
-
- /* If it's a gray ramp or direct color we need at least 2;
- others 8 */
- if (map->blue_max == 0 || vinfo->class == DirectColor) total = 2;
- else total = 8;
-
- /* Allocate all available cells, using binary backoff */
- top = vinfo->colormap_size - 1;
- while (total <= top) {
- mid = total + ((top - total + 1) / 2);
- ok = XAllocColorCells(dpy, cmap, 1, NULL, 0,
- pixels->pixels, mid);
- if (ok) {
- if (mid == top) {
- success = True;
- break;
- } else {
- XFreeColors(dpy, cmap, pixels->pixels, mid, 0);
- total = mid;
- }
- } else top = mid - 1;
- }
- if (success) npixels = mid;
- else npixels = 0;
- }
- } else {
- /* We must be in the gray ramp case, so we need at least 2 entries */
- npixels = pixels->npixels;
- if (map->blue_max != 0 || npixels >= 2) success = True;
- }
-
- if (success) {
- /* Avoid pessimal case by testing to see if already sorted */
- for (i = 0; i < npixels-1; ++i) {
- if (pixels->pixels[i] != pixels->pixels[i+1]-1) break;
- }
-
- if (i < npixels-1) {
- PrivSort((char *)pixels->pixels, npixels,
- sizeof(unsigned long), compare);
- }
-
- if (!contiguous(pixels->pixels, npixels, count, delta,
- first, remain)) {
- /* If there are enough free cells, shrink the map to fit.
- Otherwise fail; we'll free the pixels later */
- if (((map->blue_max == 0 || vinfo->class == DirectColor) &&
- *count >= 2) || *count >=8) {
- ShrinkMapToFit(map, count, vinfo);
- *remain = npixels - *first - *count;
- } else success = False;
- }
- }
-
- pixels->npixels = npixels;
- return success;
-}
-
-static Bool contiguous(pixels, npixels, ncolors, delta, first, rem)
- unsigned long pixels[]; /* specifies allocated pixels */
- int npixels; /* specifies count of alloc'd pixels */
- int *ncolors; /* specifies needed sequence length
- If not available, returns max
- available contiguous sequence */
- unsigned long delta;
- int *first; /* returns first index of sequence */
- int *rem; /* returns first index after sequence,
- * or 0, if none follow */
-{
- register int i = 1; /* walking index into the pixel array */
- register int count = 1; /* length of sequence discovered so far */
- int max = 1; /* longest sequence we found */
- int maxstart = 0;
-
- *first = 0;
- while (count < *ncolors && i < npixels) {
- if (pixels[i-1] + delta == pixels[i]) count++;
- else {
- if (count > max) {
- max = count;
- maxstart = *first;
- }
- count = 1;
- *first = i;
- }
- i++;
- }
- if (i == npixels && count > max) {
- max = count;
- maxstart = *first;
- }
- *rem = npixels - i;
- if (count != *ncolors) {
- *ncolors = max;
- *first = maxstart;
- return False;
- } return True;
-}
-
-static Bool AllocateColor(dpy, cmap, color, n)
- Display *dpy;
- Colormap cmap;
- XColor *color;
-{
- unsigned long pix = color->pixel;
- XColor request;
- int ok;
-
- request = *color;
-
- /* Free RW, Alloc RO, if fails, try RW */
- XFreeColors(dpy, cmap, &pix, 1, 0);
- ok = XAllocColor(dpy, cmap, &request);
-
- /* If the pixel we get back isn't the request one, probably RO
- White or Black, so shove it in RW so our cube is correct.
- If alloc fails, try RW. */
-
- if (!ok || request.pixel != color->pixel) {
- ok = XAllocColorCells(dpy, cmap, 0, NULL, 0, &pix, 1);
-
- if (pix != color->pixel) XFreeColors(dpy, cmap, &pix, 1, 0);
- if (!ok || pix != color->pixel) {
- return False;
- }
- request = *color;
- XStoreColor(dpy, cmap, &request);
- }
- return True;
-}
-
-static void ShrinkMapToFit(map, space, vinfo)
- XStandardColormap *map;
- int *space;
- XVisualInfo *vinfo;
-{
- if (map->blue_max == 0) map->red_max = *space - 1;
- else if (vinfo->class == DirectColor) {
- if (map->red_max > *space - 1) map->red_max = *space - 1;
- if (map->green_max > *space - 1) map->green_max = *space - 1;
- if (map->blue_max > *space - 1) map->blue_max = *space - 1;
- } else {
- int which = 2;
- while ((map->red_max + 1) * (map->green_max + 1) *
- (map->blue_max + 1) > *space) {
- if (which == 0) {
- if (map->red_max > 1) map->red_max--;
- which = 1;
- } else if (which == 1) {
- if (map->green_max > 1) map->green_max--;
- which = 2;
- } else {
- if (map->blue_max > 1) map->blue_max--;
- which = 0;
- }
- }
- *space = (map->red_max + 1) * (map->green_max + 1) *
- (map->blue_max + 1);
-
- map->red_mult = (map->green_max + 1) * (map->blue_max + 1);
- map->green_mult = map->blue_max + 1;
- map->blue_mult = 1;
- }
-}
-
-static void DefineProperty(dpy, map, vinfo, prop, nProp, atom)
- Display *dpy;
- XStandardColormap *map;
- XVisualInfo *vinfo;
- XStandardColormap *prop;
- int nProp;
- Atom atom;
-{
- XStandardColormap *copy;
- int i;
-
- if (nProp == 0) {
- XSetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), map, 1, atom);
- return;
- }
-
- copy = (XStandardColormap *) calloc(nProp+1, sizeof(XStandardColormap));
-
- /* Hm. If I can't allocate the list, is it better to just put our
- property on, or to leave the ones there? I'll guess the latter... */
- if (copy == NULL) return;
-
- if (vinfo->visual == DefaultVisual(dpy, vinfo->screen) &&
- map->colormap == DefaultColormap(dpy, vinfo->screen)) {
- /* Put new entry first; it's more likely to be useful */
- for (i = 0; i < nProp; i++) copy[i+1] = prop[i];
- i = 0;
- } else {
- /* Put it at the end */
- for (i = 0; i < nProp; i++) copy[i] = prop[i];
- /* i = nProp; (it does already) */
- }
-
- copy[i] = *map;
- XSetRGBColormaps(dpy, RootWindow(dpy, vinfo->screen), copy, nProp+1, atom);
-
- free((void *) copy);
-}
diff --git a/xc/lib/dps/dpsXint.h b/xc/lib/dps/dpsXint.h
deleted file mode 100644
index 3f875f8e3..000000000
--- a/xc/lib/dps/dpsXint.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * dpsXint.h -- internal definitions to dpsXclient.c
- *
- * (c) Copyright 1989-1994 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
- */
-
-#ifndef DPSXINT_H
-#define DPSXINT_H
-
-/* The first part of this structure is generic; the last part is
- implementation-specific. */
-
-typedef struct _t_DPSPrivContextRec {
- char *priv;
- DPSSpace space;
- DPSProgramEncoding programEncoding;
- DPSNameEncoding nameEncoding;
- DPSProcs procs;
- void (*textProc)();
- void (*errorProc)();
- DPSResults resultTable;
- unsigned int resultTableLength;
- struct _t_DPSContextRec *chainParent, *chainChild;
- unsigned int contextFlags;
- DPSContextExtensionRec *extension;
-
- struct _t_DPSPrivContextRec *next;
- integer lastNameIndex, cid;
- boolean eofReceived;
- char *wh;
- char *buf, *outBuf, *objBuf;
- integer nBufChars, nOutBufChars, nObjBufChars;
- DPSNumFormat numFormat;
- boolean resyncing; /* Error has occured and waiting ResetContext */
- int *numstringOffsets; /* see comment below */
-
-/* Everthing after this is XDPS-specific */
-
- boolean creator; /* Did this app. create the context? */
- int statusFromEvent; /* Latest status reported by an event during reset. */
- void (*statusProc)();
- boolean zombie; /* To avoid DPSAwaitReturnValues */
- void (*readyProc)();
-} DPSPrivContextRec, *DPSPrivContext;
-
-/* The numstringOffsets field lists offsets of encoded number strings in
- the current buffer. If non NULL, the first entry contains the size of
- the allocated offset buffer and the second entry contains the next
- available offset entry for use. */
-
-/* The first part of this structure is generic; the last part is
- implementation-specific. */
-
-typedef struct _t_DPSPrivSpaceRec {
- DPSSpaceProcs procs;
-
- struct _t_DPSPrivSpaceRec *next;
- long int lastNameIndex, sid;
- char *wh; /* KLUDGE to support DPSSendDestroySpace */
- DPSPrivContext firstContext;
-
-/* Everthing after this is XDPS-specific */
-
- boolean creator; /* Did this app. create the space? */
-} DPSPrivSpaceRec, *DPSPrivSpace;
-
-#include "dpsint.h"
-
-#endif /* DPSXINT_H */
diff --git a/xc/lib/dps/dpsXops.psw b/xc/lib/dps/dpsXops.psw
deleted file mode 100644
index a14335739..000000000
--- a/xc/lib/dps/dpsXops.psw
+++ /dev/null
@@ -1,80 +0,0 @@
-/* dpsXops.psw
- *
- * (c) Copyright 1991-1994 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
- */
-
-defineps DPSclientsync(DPSContext ctxt)
- clientsync
-endps
-
-defineps DPScurrentXgcdrawable(DPSContext ctxt | int *gc, *draw, *x, *y)
- currentXgcdrawable y x draw gc
-endps
-
-defineps DPScurrentXgcdrawablecolor(DPSContext ctxt | int *gc, *draw, *x, *y, colorInfo[12])
- currentXgcdrawablecolor colorInfo y x draw gc
-endps
-
-defineps DPScurrentXoffset(DPSContext ctxt | int *x, *y)
- currentXoffset y x
-endps
-
-defineps DPSsetXgcdrawable(DPSContext ctxt; int gc, draw, x, y)
- gc draw x y setXgcdrawable
-endps
-
-defineps DPSsetXgcdrawablecolor(DPSContext ctxt; int gc, draw, x, y, colorInfo[12])
- gc draw x y colorInfo setXgcdrawablecolor
-endps
-
-defineps DPSsetXoffset(DPSContext ctxt; int x, y)
- x y setXoffset
-endps
-
-defineps DPSsetXrgbactual(DPSContext ctxt; float r, g, b | boolean *success)
- r g b setXrgbactual success
-endps
-
-defineps DPSclientXready(DPSContext ctxt; int i0, i1, i2, i3)
- [ i0 i1 i2 i3 ] clientXready
-endps
-
-defineps DPSsetXdrawingfunction(DPSContext ctxt; int function)
- function setXdrawingfunction
-endps
-
-defineps DPScurrentXdrawingfunction(DPSContext ctxt | int *function)
- currentXdrawingfunction function
-endps
diff --git a/xc/lib/dps/dpsXpriv.c b/xc/lib/dps/dpsXpriv.c
deleted file mode 100644
index 8f9a8185b..000000000
--- a/xc/lib/dps/dpsXpriv.c
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
- * dpsXpriv.c
- *
- * (c) Copyright 1988-1994 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
- */
-/* $XFree86: xc/lib/dps/dpsXpriv.c,v 1.2 2000/02/21 18:05:35 dawes Exp $ */
-
-#include <stdio.h>
-#include <errno.h>
-
-#ifdef GC
-#undef GC
-#endif /* GC */
-
-#ifdef VMS
-/* Xlib does not like UNIX defined to any value under VMS. */
-#undef UNIX
-#include <decw$include/X.h>
-#include <decw$include/Xproto.h>
-#include <decw$include/Xlib.h>
-#include <decw$include/Xutil.h>
-#else /* VMS */
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#endif /* VMS */
-#include "DPS/XDPSlib.h"
-#include "DPS/XDPS.h"
-#include "dpsprivate.h"
-#include "DPS/dpsconfig.h"
-#include "publictypes.h"
-#include "dpsXpriv.h"
-#include "DPS/dpsXclient.h"
-#include "DPS/dpsexcept.h"
-#include "dpsassert.h"
-
-#ifdef ISC
-#include <sys/bsdtypes.h>
-#endif
-
-#if defined(hpux) || defined(AIXV3)
-#define SELECT_TYPE int *
-#else
-#define SELECT_TYPE fd_set *
-#endif
-
-typedef struct _RegstDPY
- {
- Display *dpy;
- int firstEvent;
- struct _RegstDPY *next;
- unsigned char ctxtTokenType; /* establish for each context. */
- unsigned char prefTokenType; /* ...of the server. */
- } RegstDPYRec, *PRegstDPY;
-
-
-/* XDPSContextTimedOut is set to true by the BlockForEvent routine
- when expected return values are not received within a certain
- amount of time. In this case, BlockForEvent will return and the
- higher callers may take appropriate action to avoid deadlocks. */
-int XDPSContextTimedOut = false; /* Unimplemented */
-DPSProcs XDPSconvProcs = NIL;
-DPSProcs XDPSrawProcs = NIL;
-
-/* XDPSQuitBlocking is set to false by the BlockForEvent routine and
- becomes true if either a zombie status event or an output event
- is received for the context waiting for return values. */
-int XDPSQuitBlocking = false;
-
-
-static DPSClientPrintProc clientPrintProc = NIL;
-static PRegstDPY firstDPY = NIL;
-/* operands for "setobjectformat" if we must agree with server. */
-static char *format_operands[] = {"1", "2", "3", "4"};
-
-
-
-static PRegstDPY IsRegistered (dpy)
- register Display *dpy;
-{
- register PRegstDPY rdpy;
-
- for (rdpy = firstDPY; rdpy != NIL; rdpy = rdpy->next)
- if (rdpy->dpy == dpy)
- return (rdpy);
- return (NIL);
-}
-
-
-void XDPSPrivZapDpy(dpy)
- register Display *dpy;
-{
- register PRegstDPY rdpy, prev = NIL;
-
- for (rdpy = firstDPY; rdpy != NIL; prev = rdpy,rdpy = rdpy->next)
- if (rdpy->dpy == dpy)
- {
- if (prev == NIL)
- firstDPY = rdpy->next;
- else
- prev->next = rdpy->next;
- break;
- }
- free(rdpy);
-}
-
-
-/* ARGSUSED */
-static int UsuallyFalse (dpy, event, arg)
- Display *dpy;
- XEvent *event;
- char *arg;
-{
- return((event->type & 0x7F) == X_Error);
-}
-
-void XDPSForceEvents (dpy)
- Display *dpy;
-{
- XEvent event;
-
- while (XCheckIfEvent (dpy, &event, UsuallyFalse, (char *) NULL)) {
- int (*proc)() = XSetErrorHandler(NULL);
- (void) XSetErrorHandler(proc);
- if (proc != (int (*)())NULL && event.type < 256)
- (void)(*proc)(dpy, &event.xerror);
- }
-}
-
-
-static void OutputEventHandler (event)
- register XDPSLOutputEvent *event;
-{
- PRegstDPY rdpy;
- register DPSContext ctxt;
-
- if ((rdpy = IsRegistered (event->display)) == NIL ||
- rdpy->firstEvent != event->type)
- return;
-
- ctxt = XDPSContextFromXID (event->display, event->cxid);
- if (ctxt != NIL)
- {
- if (ctxt->resultTable != NIL)
- XDPSQuitBlocking = true;
- (*clientPrintProc) (ctxt, event->data, event->length);
- }
-}
-
-
-static int BlockForEvent (dpy)
- Display *dpy;
-{
- long readfds;
-
- XDPSQuitBlocking = false;
- /* XDPSQuitBlocking becomes true if a zombie status event or
- any output event is received by the status event handler for
- the currently-awaiting-results context. */
- while (1) {
- readfds = (1 << ConnectionNumber(dpy));
- if (select (ConnectionNumber(dpy)+1, (SELECT_TYPE) &readfds,
- (SELECT_TYPE) NULL, (SELECT_TYPE) NULL,
- (struct timeval *) NULL) < 0) {
- if (errno == EINTR) {
- /* Ignore interrupt signals */
- errno = 0;
- continue;
- }
- return (-1); /* Broken connection (errno == EBADF) */
- } else {
- XDPSForceEvents (dpy);
- if (XDPSQuitBlocking) break;
- XNoOp(dpy);
- /* The noop is necessary to force proper behavior when the
- connection goes away - listen carefully! When the dpy
- connection is closed, the above select returns indicating
- activity on the connection. We call XDPSForceEvents, which
- calls XCheckIfEvent, which ultimately may call XFlush
- (if there are no events queued). The XNoOp call puts
- a message in the outgoing queue, so that XFlush is forced
- to write on the connection. When it tries to write, the
- error condition will be noted and XIOError will be called,
- usually causing the application to terminate. Note that
- the error won't happen until the second time thru this
- loop, but that's ok. */
- }
- }
- return (0);
-}
-
-
-void XDPSSetContextEncoding (ctxt, progEncoding, nameEncoding)
- DPSContext ctxt;
- DPSProgramEncoding progEncoding;
- DPSNameEncoding nameEncoding;
-{
- /* This routine should not be called if ctxt is a text context */
-
- if ((nameEncoding != dps_indexed && nameEncoding != dps_strings) ||
- (progEncoding != dps_ascii && progEncoding != dps_encodedTokens &&
- progEncoding != dps_binObjSeq))
- {
- if (ctxt->errorProc != NIL)
- (*ctxt->errorProc) (ctxt, dps_err_encodingCheck,
- (char *) nameEncoding, (char *) progEncoding);
- return;
- }
- else if (progEncoding == dps_ascii || progEncoding == dps_encodedTokens ||
- nameEncoding == dps_strings)
- ctxt->procs = XDPSconvProcs;
- else
- ctxt->procs = XDPSrawProcs;
-
- ctxt->nameEncoding = nameEncoding;
- ctxt->programEncoding = progEncoding;
-}
-
-
-/* ARGSUSED */
-void DPSDefaultTextBackstop (ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- long unsigned int count;
-{
- if (buf == NULL || count == 0)
- {
- (void) fflush(stdout);
- return;
- }
- (void) fwrite (buf, sizeof (char), count, stdout);
- (void) fflush (stdout);
-}
-
-/* ARGSUSED */
-void DPSInitClient(textProc, releaseProc)
- DPSTextProc textProc;
- void (*releaseProc) ();
-{
- DPSAssert (releaseProc != NIL);
- XDPSSetProcs ();
- DPSSetTextBackstop (DPSDefaultTextBackstop);
- DPSSetErrorBackstop (DPSDefaultErrorProc);
-}
-
-
-DPSNumFormat XDPSNumFormat (dpy)
- Display *dpy;
-{
- PRegstDPY rdpy;
-
- if ((rdpy = IsRegistered (dpy)) == NIL)
- return ((DPSNumFormat) -1);
- else
- return ((rdpy->ctxtTokenType < DPS_HI_NATIVE) ? dps_ieee : dps_native);
-}
-
-XDPSPrivContext XDPSCreatePrivContextRec (dpy, drawable, gc, x, y,
- eventmask, grayramp, ccube,
- actual, secure)
- Display *dpy;
- Drawable drawable;
- GC gc;
- int x;
- int y;
- unsigned int eventmask;
- XStandardColormap *grayramp;
- XStandardColormap *ccube;
- int actual;
- int secure;
-{
- int event_base;
- int token_type; /* From server. */
- char *num_format_name; /* From server. */
- PRegstDPY rdpy;
- XDPSPrivContext wh;
-
- if (DPSInitialize() != 0) return(NULL);
- if ((rdpy = IsRegistered (dpy)) == NIL)
- {
- /* DPS extension on this dpy? */
- event_base = XDPSLInit (dpy, &token_type, &num_format_name);
- if (event_base >= 0 &&
- (rdpy = (PRegstDPY) calloc (sizeof (RegstDPYRec), 1)))
- {
- XDPSLSetTextEventHandler (dpy, (XDPSLEventHandler) OutputEventHandler);
- XDPSLSetStatusEventHandler (dpy, XDPSStatusEventHandler);
- XDPSLSetReadyEventHandler (dpy, XDPSReadyEventHandler);
- XDPSLInitDisplayFlags(dpy);
- rdpy->dpy = dpy;
- rdpy->firstEvent = event_base;
- rdpy->next = firstDPY;
-
- rdpy->prefTokenType = (unsigned char) token_type;
-
- if (strcmp (num_format_name, DPS_FORMATNAME) == 0)
- rdpy->ctxtTokenType = DPS_DEF_TOKENTYPE;
- else
- /* Everybody must talk ieee! */
-#if SWAPBITS
- rdpy->ctxtTokenType = DPS_LO_IEEE;
-#else /* SWAPBITS */
- rdpy->ctxtTokenType = DPS_HI_IEEE;
-#endif /* SWAPBITS */
-
- firstDPY = rdpy;
- }
- else
- return (NULL);
- }
-
- if ((wh = (XDPSPrivContext) calloc (sizeof (XDPSPrivContextRec), 1)) != 0)
- {
- wh->dpy = dpy;
- wh->drawable = drawable;
- wh->gc = gc;
- wh->x = x;
- wh->y = y;
- wh->eventmask = eventmask;
- wh->grayramp = grayramp;
- wh->ccube = ccube;
- wh->actual = actual;
- wh->newObjFormat = format_operands[rdpy->ctxtTokenType - DPS_HI_IEEE];
- wh->secure = secure;
- return (wh);
- }
- else
- return (NULL);
-}
-
-
-DPSNumFormat DPSCreatePrivContext (wh, ctxt, cidP, sxidP,
- newSpace, printProc)
- XDPSPrivContext wh;
- DPSContext ctxt;
- ContextPSID *cidP;
- SpaceXID *sxidP;
- boolean newSpace;
- DPSClientPrintProc printProc;
-{
- PRegstDPY rdpy;
-
- if (clientPrintProc == NIL)
- clientPrintProc = printProc;
-
- if ((rdpy = IsRegistered (wh->dpy)) == NIL)
- return ((DPSNumFormat) -1);
-
- if (newSpace || sxidP == NIL)
- wh->cxid = XDPSLCreateContextAndSpace (wh->dpy, wh->drawable, wh->gc,
- wh->x, wh->y, wh->eventmask,
- wh->grayramp, wh->ccube,
- wh->actual, cidP, sxidP,
- wh->secure); /* L2-DPS/PROTO 9 */
- else
- wh->cxid = XDPSLCreateContext (wh->dpy, *sxidP, wh->drawable, wh->gc,
- wh->x, wh->y, wh->eventmask,
- wh->grayramp, wh->ccube, wh->actual, cidP,
- wh->secure); /* L2-DPS/PROTO 9 */
- if (wh->cxid == None) return((DPSNumFormat) -1);
- wh->ctxt = ctxt;
- if (wh->newObjFormat != NIL)
- {
- XDPSLGiveInput (wh->dpy, wh->cxid, wh->newObjFormat, 1);
- XDPSLGiveInput (wh->dpy, wh->cxid, " setobjectformat\n", 17);
- }
-
- if (rdpy->ctxtTokenType != DPS_DEF_TOKENTYPE)
- ctxt->procs = XDPSconvProcs;
- return ((rdpy->ctxtTokenType < DPS_HI_NATIVE) ? dps_ieee : dps_native);
-}
-
-
-void DPSIncludePrivContext (wh, ctxt, cid, sxid, printProc)
- XDPSPrivContext wh;
- DPSContext ctxt;
- ContextPSID cid;
- SpaceXID sxid;
- DPSClientPrintProc printProc;
-{
- XDPSPrivContext newWh;
- SpaceXID space;
-
- if (clientPrintProc == NIL)
- clientPrintProc = printProc;
-
- newWh = (XDPSPrivContext) calloc (sizeof (XDPSPrivContextRec), 1);
- if (!newWh) DPSOutOfMemory();
- *newWh = *wh;
- if (IsRegistered (wh->dpy) != NIL)
- {
- newWh->cxid = XDPSLCreateContextFromID (wh->dpy, cid, &space);
- DPSAssertWarn (space == sxid, ctxt, "attempting context from context ID from different space");
- newWh->ctxt = ctxt;
- /* Did we have to change object format for parent context? */
- /* Note: the child context must inherit the object format of
- its parent. When this happens in the server there
- will be no need for the following code segment. */
- if (wh->newObjFormat != NIL) /* Yes, do it for the child too. */
- {
- XDPSLGiveInput (wh->dpy, newWh->cxid, wh->newObjFormat, 1);
- XDPSLGiveInput (wh->dpy, newWh->cxid, " setobjectformat\n", 17);
- }
- }
- else
- {
- newWh->cxid = 0; /* Must not refer to a good context. */
- newWh->ctxt = NIL;
- }
-
- (void) DPSSetWh (ctxt, (char *) newWh);
-}
-
-/* ARGSUSED */
-void DPSSendPostScript (wh, printProc, cid,
- buffer, count, returnControl)
- register XDPSPrivContext wh;
- DPSClientPrintProc printProc;
- ContextPSID cid;
- char *buffer;
- long int count;
- boolean (*returnControl)();
-{
- boolean blocking = buffer == NIL;
-
- if (IsRegistered (wh->dpy) == NIL)
- (*printProc) (wh->ctxt, NIL, 0);
- else {
- if (count > 0)
- XDPSLGiveInput (wh->dpy, wh->cxid, buffer, count);
-
- if (blocking) {
- XDPSLFlush (wh->dpy);
- if (BlockForEvent (wh->dpy) < 0 && wh->ctxt->errorProc != NIL) {
- (*(wh->ctxt->errorProc)) (wh->ctxt, dps_err_closedDisplay,
- (char *) ConnectionNumber(wh->dpy),
- 0);
- }
- }
- DPSCheckRaiseError(wh->ctxt);
- }
-}
-
-
-/* ARGSUSED */
-void DPSSendInterrupt (wh, cid, printProc)
- XDPSPrivContext wh;
- ContextPSID cid;
- DPSClientPrintProc printProc;
-{
- XDPSLNotifyContext (wh->dpy, wh->cxid, PSINTERRUPT);
-}
-
-
-/* ARGSUSED */
-void DPSSendEOF (wh, cid, printProc)
- XDPSPrivContext wh;
- ContextPSID cid;
- DPSClientPrintProc printProc;
-{
- XDPSLReset (wh->dpy, wh->cxid);
-}
-
-
-/* ARGSUSED */
-void DPSSendTerminate (wh, cid, printProc)
- XDPSPrivContext wh;
- ContextPSID cid;
- DPSClientPrintProc printProc;
-{
- XDPSLNotifyContext (wh->dpy, wh->cxid, PSKILL);
-}
-
-
-void XDPSSendUnfreeze (dpy, cxid)
- Display *dpy;
- ContextXID cxid;
-{
- XDPSLNotifyContext (dpy, cxid, PSUNFREEZE);
-}
-
-
-/* ARGSUSED */
-void DPSSendDestroySpace(wh, sxid, printProc)
- XDPSPrivContext wh;
- SpaceXID sxid;
- DPSClientPrintProc printProc;
-{
- XDPSLDestroySpace (wh->dpy, sxid);
-}
-
-
-void DPSOutOfMemory ()
-{
- DPSFatalProc(NULL, "DPS Client Library Error: Out of memory.\n");
- exit (1);
-}
diff --git a/xc/lib/dps/dpsXpriv.h b/xc/lib/dps/dpsXpriv.h
deleted file mode 100644
index 263d5677e..000000000
--- a/xc/lib/dps/dpsXpriv.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * dpsXpriv.h -- client lib internal impl interface for the X version
- *
- * (c) Copyright 1989-1994 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
- */
-
-#ifndef DPSXPRIVATE_H
-#define DPSXPRIVATE_H
-
-#ifdef VMS
-#include <decw$include/X.h>
-#include <decw$include/Xlib.h>
-#include <decw$include/Xutil.h>
-#else /* VMS */
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#endif /* VMS */
-#include "DPS/dpsclient.h"
-#include "dpsprivate.h"
-#include "DPS/dpsXclient.h"
-
-/* typedefs */
-
-typedef struct _t_XDPSPrivContextRec
- {
- Display *dpy;
- Drawable drawable;
- GC gc;
- int x;
- int y;
- unsigned int eventmask;
- XStandardColormap *grayramp;
- XStandardColormap *ccube;
- int actual;
- DPSContext ctxt; /* Points back to its context */
- ContextXID cxid;
- char *newObjFormat; /* This is the object format that a */
- /* new context must use for sending */
- /* BOS's to the client. If the */
- /* server and client have the same */
- /* number formats then this will be */
- /* null. */
- int secure;
- } XDPSPrivContextRec, *XDPSPrivContext;
-
-
-extern DPSProcs XDPSconvProcs;
-extern DPSProcs XDPSrawProcs;
-extern int XDPSQuitBlocking;
-
-
-extern XDPSPrivContext XDPSCreatePrivContextRec (/*
- Display *dpy,
- Drawable drawable,
- GC gc,
- int x,
- int y,
- unsigned int eventmask,
- XStandardColormap grayramp,
- XStandardColormap ccube,
- int actual,
- int secure L2-DPS/PROTO 9 */);
-
- /* See if dpy supports the DPS extension. If not, return NULL. If so,
- it sets up a private context object that is used for creating
- contexts and spaces. */
-
-
-extern DPSNumFormat XDPSNumFormat (/* Display *dpy */);
-
- /* Determine the number format for server over the "dpy" connection. */
-
-extern void XDPSSetProcs ();
-
- /* Set pointers to raw and conversion context procs. */
-
-extern void XDPSSetContextEncoding ( /*
- DPSContext ctxt,
- DPSProgramEncoding progEncoding,
- DPSNameEncoding nameEncoding */);
-
- /* Sets context's program and name encodings to new values. */
-
-extern void XDPSStatusEventHandler (/* XDPSLStatusEvent *event */);
-
- /* Is registered with Xlib and is called when a dps status event is
- received. It determines what context the event belongs to and,
- if that context has a status event handler, calls its handler
- passing it the status type. */
-
-extern void XDPSReadyEventHandler (/* XDPSLReadyEvent *event */);
-
- /* Is registered with Xlib and is called when a dps ready event is
- received. It determines what context the event belongs to and,
- if that context has a status event handler, calls its handler
- passing it the ready data. */
-
-extern void XDPSForceEvents (/* Display *dpy */);
-
- /* Forces processing of events that are pending over the 'dpy'
- connection. This causes DPS events to be handled by their handlers. */
-
-extern void XDPSSendUnfreeze (/* Display *dpy, ContextXID cxid */);
-
-#endif /* DPSXPRIVATE_H */
diff --git a/xc/lib/dps/dpsXtdisp.c b/xc/lib/dps/dpsXtdisp.c
deleted file mode 100644
index 6d086a078..000000000
--- a/xc/lib/dps/dpsXtdisp.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * dpsXtdisp.c
- *
- * (c) Copyright 1994 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
- */
-
-#include <X11/Intrinsic.h>
-
-#if XtSpecificationRelease < 6
-
-#include "dpsassert.h"
-
-void XDPSSetXtEventDispatching(dpy)
- Display *dpy;
-{
- DPSFatalProc(NULL, "Attempt to use XDPSSetXtEventDispatching with pre-R6 Intrinsics\n");
- exit(1);
-}
-
-#else
-
-#include <DPS/XDPSlib.h>
-#include <DPS/dpsXclient.h>
-
-typedef struct _DpyProcRec {
- Display *dpy;
- XtEventDispatchProc oldproc;
- struct _DpyProcRec *next;
-} DpyProcRec;
-
-static DpyProcRec *dpyProcList = NULL;
-
-static Boolean NXDispatcher(event)
- XEvent *event;
-{
- DpyProcRec *d;
-
- if (XDPSDispatchEvent(event)) return True;
-
- for (d = dpyProcList; d != NULL && d->dpy != event->xany.display;
- d = d->next) {}
- if (d != NULL) return (*(d->oldproc))(event);
- else return False;
-}
-
-void XDPSSetXtEventDispatching(dpy)
- Display *dpy;
-{
- int codes;
- XExtCodes *c;
-
- codes = XDPSLInit(dpy, (int *) NULL, (char **) NULL);
-
- if (codes == -1) return; /* No extension or NX, so nothing to do */
- else {
- (void) XDPSSetEventDelivery(dpy, dps_event_pass_through);
- c = XDPSLGetCodes(dpy);
-
- /* First check for NX */
- if (!c->first_event) {
- DpyProcRec *d = XtNew(DpyProcRec);
- d->dpy = dpy;
- d->next = dpyProcList;
- d->oldproc =
- XtSetEventDispatcher(dpy, ClientMessage, NXDispatcher);
- dpyProcList = d;
-
- } else {
- /* Extension */
- (void) XtSetEventDispatcher(dpy, c->first_event + PSEVENTSTATUS,
- (XtEventDispatchProc) XDPSDispatchEvent);
- (void) XtSetEventDispatcher(dpy, c->first_event + PSEVENTOUTPUT,
- (XtEventDispatchProc) XDPSDispatchEvent);
- (void) XtSetEventDispatcher(dpy, c->first_event + PSEVENTREADY,
- (XtEventDispatchProc) XDPSDispatchEvent);
- }
- }
-}
-
-#endif
diff --git a/xc/lib/dps/dpsabbrev.c b/xc/lib/dps/dpsabbrev.c
deleted file mode 100644
index 89b797ddf..000000000
--- a/xc/lib/dps/dpsabbrev.c
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * dpsabbrev.c -- Implementation of Client Library abbrev mode
- *
- * (c) Copyright 1993-1994 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
- */
-
-#include "publictypes.h"
-#include "DPS/dpsclient.h"
-#include "dpsprivate.h"
-
-static DPSAbbrevRec abbrev[] = {
- {1, "add", "!+"},
- {10, "ashow", "!a"},
- {12, "awidthshow", "!A"},
- {13, "begin", "!B"},
- {14, "bind", "!b"},
- {20, "clip", "!CL"},
- {22, "closepath", "!c"},
- {23, "concat", "!CC"},
- {25, "copy", "!CP"},
- {39, "currentmatrix", "!CM"},
- {40, "currentpoint", "!Cp"},
- {43, "curveto", "!C"},
- {51, "def", "!D"},
- {53, "dict", "!d"},
- {62, "exch", "!E"},
- {63, "exec", "!e"},
- {66, "fill", "!F"},
- {67, "findfont", "!f"},
- {77, "grestore", "!G"},
- {78, "gsave", "!g"},
- {85, "ifelse", "!I"},
- {88, "index", "!i"},
- {98, "length", "!LE"},
- {99, "lineto", "!L"},
- {100, "load", "!l"},
- {103, "makefont", "!MF"},
- {104, "matrix", "!m"},
- {107, "moveto", "!M"},
- {111, "newpath", "!N"},
- {113, "null", "!n"},
- {117, "pop", "!p"},
- {122, "rcurveto", "!RC"},
- {127, "rectclip", "!R"},
- {128, "rectfill", "!RF"},
- {129, "rectstroke", "!RS"},
- {131, "repeat", "!RP"},
- {132, "restore", "!Rs"},
- {133, "rlineto", "!r"},
- {134, "rmoveto", "!RM"},
- {135, "roll", "!RL"},
- {136, "rotate", "!RO"},
- {137, "round", "!RN"},
- {138, "save", "!SV"},
- {139, "scale", "!SC"},
- {140, "scalefont", "!SF"},
- {142, "selectfont", "!s"},
- {147, "setcmykcolor", "!Sc"},
- {148, "setdash", "!SD"},
- {149, "setfont", "!Sf"},
- {150, "setgray", "!Sg"},
- {152, "sethsbcolor", "!Sh"},
- {153, "setlinecap", "!SL"},
- {154, "setlinejoin", "!SJ"},
- {155, "setlinewidth", "!SW"},
- {156, "setmatrix", "!SM"},
- {157, "setrgbcolor", "!Sr"},
- {158, "setshared", "!SS"},
- {160, "show", "!S"},
- {161, "showpage", "!SP"},
- {167, "stroke", "!ST"},
- {170, "systemdict", "!Sd"},
- {173, "translate", "!T"},
- {182, "userdict", "!u"},
- {186, "where", "!w"},
- {187, "widthshow", "!W"},
- {194, "xshow", "!X"},
- {195, "xyshow", "!x"},
- {196, "yshow", "!Y"},
-};
-
-static short abbrevPtr[] = {
- -1, /* 0 */
- 0, /* 1 */
- -1, /* 2 */
- -1, /* 3 */
- -1, /* 4 */
- -1, /* 5 */
- -1, /* 6 */
- -1, /* 7 */
- -1, /* 8 */
- -1, /* 9 */
- 1, /* 10 */
- -1, /* 11 */
- 2, /* 12 */
- 3, /* 13 */
- 4, /* 14 */
- -1, /* 15 */
- -1, /* 16 */
- -1, /* 17 */
- -1, /* 18 */
- -1, /* 19 */
- 5, /* 20 */
- -1, /* 21 */
- 6, /* 22 */
- 7, /* 23 */
- -1, /* 24 */
- 8, /* 25 */
- -1, /* 26 */
- -1, /* 27 */
- -1, /* 28 */
- -1, /* 29 */
- -1, /* 30 */
- -1, /* 31 */
- -1, /* 32 */
- -1, /* 33 */
- -1, /* 34 */
- -1, /* 35 */
- -1, /* 36 */
- -1, /* 37 */
- -1, /* 38 */
- 9, /* 39 */
- 10, /* 40 */
- -1, /* 41 */
- -1, /* 42 */
- 11, /* 43 */
- -1, /* 44 */
- -1, /* 45 */
- -1, /* 46 */
- -1, /* 47 */
- -1, /* 48 */
- -1, /* 49 */
- -1, /* 50 */
- 12, /* 51 */
- -1, /* 52 */
- 13, /* 53 */
- -1, /* 54 */
- -1, /* 55 */
- -1, /* 56 */
- -1, /* 57 */
- -1, /* 58 */
- -1, /* 59 */
- -1, /* 60 */
- -1, /* 61 */
- 14, /* 62 */
- 15, /* 63 */
- -1, /* 64 */
- -1, /* 65 */
- 16, /* 66 */
- 17, /* 67 */
- -1, /* 68 */
- -1, /* 69 */
- -1, /* 70 */
- -1, /* 71 */
- -1, /* 72 */
- -1, /* 73 */
- -1, /* 74 */
- -1, /* 75 */
- -1, /* 76 */
- 18, /* 77 */
- 19, /* 78 */
- -1, /* 79 */
- -1, /* 80 */
- -1, /* 81 */
- -1, /* 82 */
- -1, /* 83 */
- -1, /* 84 */
- 20, /* 85 */
- -1, /* 86 */
- -1, /* 87 */
- 21, /* 88 */
- -1, /* 89 */
- -1, /* 90 */
- -1, /* 91 */
- -1, /* 92 */
- -1, /* 93 */
- -1, /* 94 */
- -1, /* 95 */
- -1, /* 96 */
- -1, /* 97 */
- 22, /* 98 */
- 23, /* 99 */
- 24, /* 100 */
- -1, /* 101 */
- -1, /* 102 */
- 25, /* 103 */
- 26, /* 104 */
- -1, /* 105 */
- -1, /* 106 */
- 27, /* 107 */
- -1, /* 108 */
- -1, /* 109 */
- -1, /* 110 */
- 28, /* 111 */
- -1, /* 112 */
- 29, /* 113 */
- -1, /* 114 */
- -1, /* 115 */
- -1, /* 116 */
- 30, /* 117 */
- -1, /* 118 */
- -1, /* 119 */
- -1, /* 120 */
- -1, /* 121 */
- 31, /* 122 */
- -1, /* 123 */
- -1, /* 124 */
- -1, /* 125 */
- -1, /* 126 */
- 32, /* 127 */
- 33, /* 128 */
- 34, /* 129 */
- -1, /* 130 */
- 35, /* 131 */
- 36, /* 132 */
- 37, /* 133 */
- 38, /* 134 */
- 39, /* 135 */
- 40, /* 136 */
- 41, /* 137 */
- 42, /* 138 */
- 43, /* 139 */
- 44, /* 140 */
- -1, /* 141 */
- 45, /* 142 */
- -1, /* 143 */
- -1, /* 144 */
- -1, /* 145 */
- -1, /* 146 */
- 46, /* 147 */
- 47, /* 148 */
- 48, /* 149 */
- 49, /* 150 */
- -1, /* 151 */
- 50, /* 152 */
- 51, /* 153 */
- 52, /* 154 */
- 53, /* 155 */
- 54, /* 156 */
- 55, /* 157 */
- 56, /* 158 */
- -1, /* 159 */
- 57, /* 160 */
- 58, /* 161 */
- -1, /* 162 */
- -1, /* 163 */
- -1, /* 164 */
- -1, /* 165 */
- -1, /* 166 */
- 59, /* 167 */
- -1, /* 168 */
- -1, /* 169 */
- 60, /* 170 */
- -1, /* 171 */
- -1, /* 172 */
- 61, /* 173 */
- -1, /* 174 */
- -1, /* 175 */
- -1, /* 176 */
- -1, /* 177 */
- -1, /* 178 */
- -1, /* 179 */
- -1, /* 180 */
- -1, /* 181 */
- 62, /* 182 */
- -1, /* 183 */
- -1, /* 184 */
- -1, /* 185 */
- 63, /* 186 */
- 64, /* 187 */
- -1, /* 188 */
- -1, /* 189 */
- -1, /* 190 */
- -1, /* 191 */
- -1, /* 192 */
- -1, /* 193 */
- 65, /* 194 */
- 66, /* 195 */
- 67, /* 196 */
- -1, /* 197 */
- -1, /* 198 */
- -1, /* 199 */
- -1, /* 200 */
- -1, /* 201 */
- -1, /* 202 */
- -1, /* 203 */
- -1, /* 204 */
- -1, /* 205 */
- -1, /* 206 */
- -1, /* 207 */
- -1, /* 208 */
- -1, /* 209 */
- -1, /* 210 */
- -1, /* 211 */
-};
-
-void DPSFetchAbbrevList(list, count)
- DPSAbbrevRec **list;
- int *count;
-{
- *list = abbrev;
- *count = sizeof(abbrev) / sizeof(abbrev[0]);
-}
-
-char *DPSGetSysnameAbbrev(n)
- int n;
-{
- if (n > sizeof(abbrevPtr) / sizeof(abbrevPtr[0])) return NULL;
- if (abbrevPtr[n] == -1) return NULL;
- return abbrev[abbrevPtr[n]].abbrev;
-}
-
-char *DPSGetOperatorAbbrev(op)
- char *op;
-{
- int min, max, n;
- int res;
-
- min = 0;
- max = sizeof(abbrev) / sizeof(abbrev[0]) - 1;
-
- while (min <= max) {
- n = (max + min) / 2;
- res = strcmp(op, abbrev[n].operatorName);
- if (res == 0) return abbrev[n].abbrev;
- if (res < 0) max = n - 1;
- if (res > 0) min = n + 1;
- }
- return NULL;
-}
diff --git a/xc/lib/dps/dpsassert.h b/xc/lib/dps/dpsassert.h
deleted file mode 100644
index b42a43ff9..000000000
--- a/xc/lib/dps/dpsassert.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * dpsassert.h
- *
- * (c) Copyright 1991-1994 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
- */
-
-#ifndef DPSASSERT_H
-#define DPSASSERT_H
-
-#define DPSAssertWarn(cndtn, cntxt, mssg)\
- if (!(cndtn)) DPSWarnProc((cntxt),(mssg))
-
-extern void DPSWarnProc();
-extern void DPSFatalProc();
-extern void DPSCantHappen();
-
-#define DPSAssert(condition) \
- if (! (condition)) DPSCantHappen();
-/* Tests whether the specified condition is true and aborts the
- entire application if not.
- */
-
-#endif /* DPSASSERT_H */
diff --git a/xc/lib/dps/dpsclient.c b/xc/lib/dps/dpsclient.c
deleted file mode 100644
index 4b50c5df6..000000000
--- a/xc/lib/dps/dpsclient.c
+++ /dev/null
@@ -1,2918 +0,0 @@
-/*
- * dpsclient.c -- Implementation of the Display PostScript Client Library.
- *
- * (c) Copyright 1988-1994 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
- */
-
-#include <ctype.h>
-
-#include "publictypes.h"
-#include "DPS/dpsclient.h"
-#include "dpsprivate.h"
-#include "dpsdict.h"
-#include "DPS/dpsexcept.h"
-#include "dpsassert.h"
-
-#ifdef XDPS
-#include "dpsXint.h"
-#endif /* XDPS */
-
-#if defined(SVR4) || defined(SYSV) || defined(SystemV)
-#define os_bcopy(f,t,c) memcpy(t,f,c)
-#else
-#define os_bcopy(f,t,c) bcopy(f,t,c)
-#endif
-
-#if !IEEEFLOAT
-extern void IEEEHighToNative(/* FloatRep *from, real *to */);
-/* Converts from IEEE high-byte-first real to native real. */
-
-extern void NativeToIEEEHigh(/* real *from, FloatRep *to */);
-/* Converts from native real to IEEE high-byte-first real. */
-
-extern void IEEELowToNative(/* FloatRep *from, real *to */);
-/* Converts from IEEE low-byte-first real to native real. */
-
-extern void NativeToIEEELow(/* real *from, FloatRep *to */);
-/* Converts from native real to IEEE low-byte-first real. */
-#endif /* !IEEEFLOAT */
-
-typedef union { /* 32 bit number representations */
- unsigned int u;
- int i;
- float f;
- unsigned char bytes[4];
- /* raw bytes, in whatever order they appear in memory */
- } Swap32Rec;
-
-typedef union { /* 16 bit number representations */
- unsigned short u;
- short i;
- unsigned char bytes[2];
- } Swap16Rec;
-
-#if SWAPBITS
-#define Copy4SrcLo(src, dst)\
- (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[0], \
- ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[1], \
- ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[2], \
- ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[3] )
-#define Copy4SrcHi(src, dst)\
- (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[3], \
- ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[2], \
- ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[1], \
- ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[0] )
-#define Copy2SrcLo(src, dst)\
- (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[0], \
- ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[1] )
-#define Copy2SrcHi(src, dst)\
- (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[1], \
- ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[0] )
-#else /* SWAPBITS */
-#define Copy4SrcHi(src, dst)\
- (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[0], \
- ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[1], \
- ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[2], \
- ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[3] )
-#define Copy4SrcLo(src, dst)\
- (((Swap32Rec *) dst)->bytes[0] = ((Swap32Rec *) src)->bytes[3], \
- ((Swap32Rec *) dst)->bytes[1] = ((Swap32Rec *) src)->bytes[2], \
- ((Swap32Rec *) dst)->bytes[2] = ((Swap32Rec *) src)->bytes[1], \
- ((Swap32Rec *) dst)->bytes[3] = ((Swap32Rec *) src)->bytes[0] )
-#define Copy2SrcHi(src, dst)\
- (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[0], \
- ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[1] )
-#define Copy2SrcLo(src, dst)\
- (((Swap16Rec *) dst)->bytes[0] = ((Swap16Rec *) src)->bytes[1], \
- ((Swap16Rec *) dst)->bytes[1] = ((Swap16Rec *) src)->bytes[0] )
-#endif /* SWAPBITS */
-
-
-#define DPS_ERR_TAG 250
-
-#define CONTEXTBUFFERSIZE 256
-#define MAXQUEUEDBUFFERS 5
-
-DPSContext DPSGlobalContext;
-
-Globals DPSglobals = NULL;
-
-char *DPScalloc(e, n) integer e, n; {
- char *p;
- while (!(p = (char *)calloc(e, n))) {
- DPSOutOfMemory();
- }
- return p;
- }
-
-
-
-void DPSSafeSetLastNameIndex(ctxt) DPSContext ctxt; {
- /* we're about to call the error handler, so roll back the
- lastNameIndex to the last known valid index */
- DPSCheckInitClientGlobals();
- if (ctxt != dummyCtx && ctxt->space != NIL)
- ((DPSPrivContext)ctxt)->lastNameIndex = ((DPSPrivSpace)(ctxt->space))->lastNameIndex;
- }
-
-void DPSCheckInitClientGlobals() {
- if (!DPSglobals) {
- DPSglobals = (Globals)DPScalloc(sizeof(GlobalsRec), 1);
- globLastNameIndex = -1;
- }
- }
-
-/**************************************************************/
-/* Procedures that support the DPSCreateContext context procs */
-/**************************************************************/
-
-/* ARGSUSED */
-static void ReleaseInput(unused, buffer)
- char *unused; char *buffer; {
- ContextBuffer cb = (ContextBuffer)buffer;
- if (cb == NIL) return;
- cb->next = contextBuffers;
- contextBuffers = cb;
- queuedBuffers--;
- }
-
-/* ARGSUSED */
-static void StuffResultVal(ctxt, result, tag, obj)
- DPSContext ctxt;
- DPSResults result;
- integer tag;
- DPSBinObj obj; {
-
- integer type = obj->attributedType & ~DPS_EXEC;
- integer nObjs = 1;
-
- /* check if array */
- if (type == DPS_ARRAY) {
- nObjs = obj->length;
- if (nObjs < 1) return;
- if (result->count == -1 && nObjs != 1) {
- DPSSafeSetLastNameIndex(ctxt);
- if (ctxt->errorProc != NIL)
- (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (char *)obj, 0);
- return;
- }
- obj = (DPSBinObj) ((char *)obj + obj->val.arrayVal);
- type = obj->attributedType & ~DPS_EXEC;
- }
-
- do {
- integer bump = 0;
- if (result->count == 0) return;
- switch (result->type) {
- case dps_tBoolean:
- if (type == DPS_BOOL) {
- int *b = (int *) result->value;
- *b = (int) obj->val.booleanVal;
- bump = sizeof(int);
- }
- break;
- case dps_tFloat: {
- float *f = (float *) result->value;
- if (type == DPS_REAL) {
- *f = obj->val.realVal;
- bump = sizeof(float);
- }
- else if (type == DPS_INT) {
- *f = (float) obj->val.integerVal;
- bump = sizeof(float);
- }
- break;
- }
- case dps_tDouble: {
- double *d = (double *) result->value;
- if (type == DPS_REAL) {
- *d = (double) obj->val.realVal;
- bump = sizeof(double);
- }
- else if (type == DPS_INT) {
- *d = (double) obj->val.integerVal;
- bump = sizeof(double);
- }
- break;
- }
- case dps_tShort:
- if (type == DPS_INT) {
- short *s = (short *) result->value;
- *s = (short) obj->val.integerVal;
- bump = sizeof(short);
- }
- break;
- case dps_tUShort:
- if (type == DPS_INT) {
- unsigned short *us = (unsigned short *) result->value;
- *us = (unsigned short) obj->val.integerVal;
- bump = sizeof(unsigned short);
- }
- break;
- case dps_tInt:
- if (type == DPS_INT) {
- int *i = (int *) result->value;
- *i = (int) obj->val.integerVal;
- bump = sizeof(int);
- }
- break;
- case dps_tUInt:
- if (type == DPS_INT) {
- unsigned int *ui = (unsigned int *) result->value;
- *ui = (unsigned int) obj->val.integerVal;
- bump = sizeof(unsigned int);
- }
- break;
- case dps_tLong:
- if (type == DPS_INT) {
- long int *li = (long int *) result->value;
- *li = obj->val.integerVal;
- bump = sizeof(long int);
- }
- break;
- case dps_tULong:
- if (type == DPS_INT) {
- unsigned long *u = (unsigned long *) result->value;
- *u = (unsigned long) obj->val.integerVal;
- bump = sizeof(unsigned long);
- }
- break;
- case dps_tChar:
- case dps_tUChar:
- if (nObjs != 1) {
- DPSSafeSetLastNameIndex(ctxt);
- if (ctxt->errorProc != NIL)
- (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (char *)obj, 0);
- }
- else if (type == DPS_STRING) {
- if (result->count == -1) {
- /* char * result, copy first, ignore subsequent, null terminate */
- os_bcopy(((integer)(obj->val.stringVal)) + (char *)obj,
- result->value, obj->length);
- (result->value)[obj->length] = '\0';
- result->count = 0;
- }
- else {
- unsigned slen;
- if (result->count >= (int) obj->length) {
- /* copy entire string into char array */
- slen = obj->length;
- }
- else if (result->count > 0) {
- /* copy partial string into char array */
- slen = result->count;
- }
- else return; /* ignore string result, no room left */
- os_bcopy(((integer)(obj->val.stringVal)) + (char *)obj,
- result->value, slen);
- result->value += slen;
- result->count -= slen;
- }
- return;
- }
- break;
-
- default:
- DPSSafeSetLastNameIndex(ctxt);
- if (ctxt->errorProc != NIL)
- (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (char *)obj, 0);
- } /* switch (result->type) */
-
- if (bump == 0) {
- DPSSafeSetLastNameIndex(ctxt);
- if (ctxt->errorProc != NIL)
- (*ctxt->errorProc)(ctxt, dps_err_resultTypeCheck, (char *)obj, 0);
- return;
- }
- if (result->count != -1) {
- result->count--;
- result->value += bump;
- }
- obj += 1;
- nObjs--;
- } while (nObjs > 0); /* do */
-
- } /* StuffResultVal */
-
-
-static void NumFormatFromTokenType(t, numFormat)
- unsigned char t;
- DPSNumFormat *numFormat; {
-
- switch (t) {
- case DPS_HI_IEEE:
- *numFormat = dps_ieee;
- break;
- case DPS_LO_IEEE:
- *numFormat = dps_ieee;
- break;
- case DPS_HI_NATIVE:
- *numFormat = dps_native;
- break;
- case DPS_LO_NATIVE:
- *numFormat = dps_native;
- break;
- default: DPSCantHappen();
- }
- }
-
-
-#if !IEEEFLOAT
-/* called to deal with results from the server */
-static void ConvSeqInPlace(nObjs, currObj, base, tokenType)
- integer nObjs;
- DPSBinObj currObj;
- char *base;
- unsigned char tokenType; {
- DPSNumFormat numFormat;
-
- NumFormatFromTokenType(tokenType, &numFormat);
-
- while (nObjs--) {
- unsigned char t = currObj->attributedType & 0x07f;
- integer i;
- switch (t) {
- case DPS_REAL: {
- float f;
- if (numFormat == dps_ieee) {
- if (DPSDefaultByteOrder == dps_hiFirst)
- IEEEHighToNative(&currObj->val.realVal, &f);
- else
- IEEELowToNative(&currObj->val.realVal, &f);
- }
- else break; /* switch */
- currObj->val.realVal = f;
- break;
- }
- case DPS_ARRAY:
- if (currObj->length > 0)
- ConvSeqInPlace(currObj->length, (DPSBinObj)(base + currObj->val.arrayVal), base, tokenType);
- break;
- case DPS_NAME:
- case DPS_STRING:
- break;
- default:;
- } /* end switch */
- ++currObj;
- } /* end while */
- }
-#endif /* !IEEEFLOAT */
-
-boolean DPSKnownContext(ctxt) DPSContext ctxt; {
- DPSPrivContext cc, c = (DPSPrivContext) ctxt;
- DPSPrivSpace ss;
- for (ss = spaces; ss != NIL; ss = ss->next)
- for (cc = ss->firstContext; cc != NIL; cc = cc->next)
- if (cc == c) return true;
- return false;
- }
-
-boolean DPSKnownSpace(space) DPSSpace space; {
- DPSPrivSpace ss, s = (DPSPrivSpace) space;
- for (ss = spaces; ss != NIL; ss = ss->next)
- if (ss == s) return true;
- return false;
- }
-
-void DPSclientPrintProc (ctxt, buf, nch)
- DPSContext ctxt;
- char *buf;
- integer nch;
- {
- DPSPrivContext cc = (DPSPrivContext) ctxt;
-
-#define DPS_SEQ_MIN 2
-
- DPSCheckInitClientGlobals();
- if (cc == NIL) cc = (DPSPrivContext)dummyCtx;
- if (cc == NIL) return;
-
- if (nch == 0) { /* this is an EOF */
- DPSAssertWarn(buf == NIL, cc, "non-nil output buffer with 0 length");
- cc->eofReceived = true;
- if (cc->objBuf) {
- /* we were buffering; drop buffered chars on the floor */
- free(cc->objBuf);
- cc->objBuf = NIL;
- cc->nObjBufChars = 0;
- }
- }
- while (nch > 0) {
- char *oldBuf = NIL;
- integer oldNch = 0;
- integer n;
- if (cc->objBuf) { /* we're buffering */
- unsigned long int m;
- char *b = cc->objBuf + cc->nObjBufChars;
- integer minSize;
- while (cc->nObjBufChars < DPS_SEQ_MIN) {
- if (nch == 0) return;
- *b++ = *buf++;
- ++cc->nObjBufChars;
- --nch;
- }
- b = cc->objBuf;
- minSize = (*(b+1) == 0) ? DPS_EXT_HEADER_SIZE : DPS_HEADER_SIZE;
- if (cc->nObjBufChars < minSize) {
- if (nch + cc->nObjBufChars < minSize) {
- os_bcopy(buf, b + cc->nObjBufChars, nch);
- cc->nObjBufChars += nch;
- return;
- }
- else {
- os_bcopy(buf, b + cc->nObjBufChars, minSize - cc->nObjBufChars);
- buf += minSize - cc->nObjBufChars;
- nch -= minSize - cc->nObjBufChars;
- cc->nObjBufChars = minSize;
- }
- }
-
- if (minSize == DPS_HEADER_SIZE) {
- unsigned short *sizeP = (unsigned short *)(cc->objBuf+2);
- m = *sizeP;
- }
- else {
- unsigned long *extSizeP = (unsigned long *)(cc->objBuf+4);
- m = *extSizeP;
- }
-
- /* here with m = BOS total length in bytes, b = cc->objBuf */
- cc->objBuf = (char *)realloc(b, m);
-
- if (nch < m - cc->nObjBufChars) {
- os_bcopy(buf, cc->objBuf + cc->nObjBufChars, nch);
- cc->nObjBufChars += nch;
- return;
- }
- else {
- os_bcopy(buf, cc->objBuf + cc->nObjBufChars, m - cc->nObjBufChars);
- buf += m - cc->nObjBufChars;
- nch -= m - cc->nObjBufChars;
- cc->nObjBufChars = m;
- }
- /* we're here only if cc->objBuf contains a complete BOS */
- oldBuf = buf;
- oldNch = nch;
- buf = cc->objBuf;
- nch = cc->nObjBufChars;
- cc->objBuf = NIL;
- cc->nObjBufChars = 0;
- } /* if we're buffering */
-
- /* dispose of any plain text. If no binary conversion, all output
- is plain text */
- if (cc->contextFlags & DPS_FLAG_NO_BINARY_CONVERSION) n = nch;
- else {
- for (n = 0; n < nch &&
- ((unsigned char) buf[n] < 128 || (unsigned char) buf[n] > 159); n++);
- }
- if ((n > 0) && (cc->textProc != NIL)) {
- (*cc->textProc)((DPSContext)cc, buf, n);
- }
- buf += n;
- nch -= n;
-
- if (nch != 0) {
- /* here with the next binary object sequence from a server */
- DPSExtendedBinObjSeq bos;
- DPSExtendedBinObjSeqRec bosRec;
- DPSBinObj firstObj;
- integer t;
- unsigned long int m;
- integer minSize;
-
- if (nch < DPS_SEQ_MIN) {
- /* gotta buffer it */
- DPSAssertWarn(nch == 1 && !oldBuf, cc, "illegal binary output from context (oldBuf)");
- cc->objBuf = (char *)DPScalloc(DPS_EXT_HEADER_SIZE, 1);
- cc->nObjBufChars = nch;
- *cc->objBuf = *buf;
- return;
- }
- /* check for quadbyte alignment */
- if ((long int)buf & (MIN_POINTER_ALIGN - 1)) {
- /* not aligned, we gotta copy the buffer */
- /* we assert that we can't have an oldBuf if we're not aligned,
- since we only get an oldBuf if we copied to a new buffer,
- and we have already tested nch to be at least DPS_SEQ_MIN */
- DPSAssertWarn(!oldBuf && nch > 1, cc, "return values garbled (oldBuf||nch<DPS_SEQ_MIN");
- /* copy DPS_SEQ_MIN bytes, so we can use existing buffering code */
- cc->objBuf = (char *)DPScalloc(DPS_EXT_HEADER_SIZE, 1);
- cc->nObjBufChars = DPS_SEQ_MIN;
- os_bcopy(buf, cc->objBuf, cc->nObjBufChars);
- buf += DPS_SEQ_MIN;
- nch -= DPS_SEQ_MIN;
- /* now go to top of loop and go through the buffer update code */
- continue;
- }
- bos = (DPSExtendedBinObjSeq) buf;
- t = bos->tokenType;
- minSize = (bos->escape == 0) ? DPS_EXT_HEADER_SIZE : DPS_HEADER_SIZE;
- if (nch < minSize) {
- /* gotta buffer it */
- char *tb;
- DPSAssertWarn(!oldBuf, cc, "return values garbled (oldBuf)");
- tb = cc->objBuf = (char *)DPScalloc(minSize, 1);
- cc->nObjBufChars = nch;
- while (nch--) *tb++ = *buf++;
- return;
- }
- else if (minSize == DPS_HEADER_SIZE) {
- /* this is not an extended BOS */
- DPSBinObjSeq seqHead = (DPSBinObjSeq) buf;
- bos = &bosRec;
- bos->tokenType = t;
- bos->nTopElements = seqHead->nTopElements;
- bos->length = seqHead->length;
- firstObj = &(seqHead->objects[0]);
- }
- else firstObj = &(bos->objects[0]);
- m = bos->length;
- if (nch < m) {
- /* gotta buffer it */
- DPSAssertWarn(!oldBuf, cc, "return values garbled (oldBuf&&nch<m");
- cc->objBuf = (char *)DPScalloc(bos->length, 1);
- cc->nObjBufChars = nch;
- os_bcopy(buf, cc->objBuf, nch);
- return;
- }
- DPSAssertWarn(bos->nTopElements == 1, cc, "illegal binary output detected (bos->nTopElements!=1)");
-#if !IEEEFLOAT
- if (t != DPS_DEF_TOKENTYPE)
- ConvSeqInPlace(1, firstObj, firstObj, bos->tokenType);
-#endif /* !IEEEFLOAT */
- t = firstObj->tag;
- if (t == DPS_ERR_TAG) {
- cc->resultTable = NIL;
- DPSSafeSetLastNameIndex((DPSContext)cc);
- DURING
- if (cc->errorProc != NIL)
- (*cc->errorProc)((DPSContext)cc, dps_err_ps, buf, m);
- HANDLER
- if (oldBuf) free(buf);
- RERAISE;
- END_HANDLER
- }
- else { /* dispatch this result */
- if (!cc->resultTable || t > cc->resultTableLength) {
- if (cc->chainParent == NIL && cc->errorProc != NIL) {
- DPSSafeSetLastNameIndex((DPSContext)cc);
- (*cc->errorProc)((DPSContext)cc, dps_err_resultTagCheck, buf, m);
- }
- }
- else if (t == cc->resultTableLength) {
- cc->resultTable = NIL;
- }
- else {
- StuffResultVal((DPSContext)cc, &cc->resultTable[t], t, firstObj);
- }
- }
- if (!oldBuf)
- buf += m;
- nch -= m;
- } /* if (nch != 0) ... the next binary object sequence from a server */
- if (oldBuf) {
- DPSAssertWarn(nch == 0, cc, "some return values/data lost (nch)");
- free(buf);
- buf = oldBuf;
- nch = oldNch;
- }
- } /* while (nch > 0) */
-
-} /* DPSclientPrintProc */
-
-/**************************************/
-/* Context procs for DPSCreateContext */
-/**************************************/
-
-
-static void procWaitContext(ctxt)
- DPSContext ctxt; {
-
- typedef struct {
- unsigned char tokenType;
- unsigned char topLevelCount;
- unsigned short int nBytes;
-
- DPSBinObjGeneric obj0;
- DPSBinObjGeneric obj1;
- DPSBinObjGeneric obj2;
- DPSBinObjGeneric obj3;
- } DPSQ;
- static DPSQ dpsF = {
- DPS_DEF_TOKENTYPE, 4, sizeof(DPSQ),
- {DPS_LITERAL|DPS_INT, 0, 0, -23}, /* arbitrary int */
- {DPS_LITERAL|DPS_INT, 0, 0, 0}, /* termination tag = 0 */
- {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 119}, /* printobject */
- {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 70}, /* flush */
- }; /* DPSQ */
- DPSResultsRec DPSR;
-
- if (DPSPrivateCheckWait(ctxt)) return;
-
- ctxt->resultTable = &DPSR; /* must be non-null for handler to work */
- ctxt->resultTableLength = 0; /* same value as termination tag */
- DPSBinObjSeqWrite(ctxt, (char *) &dpsF,sizeof(DPSQ));
- DPSAwaitReturnValues(ctxt);
- }
-
-static void procUpdateNameMap(ctxt)
- DPSContext ctxt; {
- integer i;
- DPSPrivContext c = (DPSPrivContext) ctxt;
- DPSPrivSpace s = (DPSPrivSpace) ctxt->space;
- DPSContext children = ctxt->chainChild;
-
- /* unlink context from chain temporarily, so DPSPrintf can be called */
- if (children != NIL) ctxt->chainChild = NIL;
- DURING
- for (i = s->lastNameIndex+1; i <= globLastNameIndex; i++)
- DPSPrintf(ctxt, "%d /%s defineusername\n", i, userNames[i]);
- HANDLER
- if (children != NIL) ctxt->chainChild = children;
- RERAISE;
- END_HANDLER
- c->lastNameIndex = globLastNameIndex;
- if (children != NIL) {
- /* update any children */
- ctxt->chainChild = children;
- DPSUpdateNameMap(ctxt->chainChild);
- }
-}
-
-static void procWriteData(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- /* safe to call with chain */
- DPSinnerProcWriteData(ctxt, buf, count);
- if (ctxt->chainChild != NIL) DPSWriteData(ctxt->chainChild, buf, count);
- }
-
-static void procBinObjSeqWrite(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- if (((DPSPrivContext)ctxt)->lastNameIndex < globLastNameIndex) DPSUpdateNameMap(ctxt);
- DPSinnerProcWriteData(ctxt, buf, count);
- if (ctxt->chainChild != NIL) DPSBinObjSeqWrite(ctxt->chainChild, buf, count);
- }
-
-static void procWriteStringChars(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- DPSinnerProcWriteData(ctxt, buf, count);
- if (ctxt->chainChild != NIL) DPSWriteStringChars(ctxt->chainChild, buf, count);
- }
-
-static void procWritePostScript(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- DPSinnerProcWriteData(ctxt, buf, count);
- if (ctxt->chainChild != NIL) DPSWritePostScript(ctxt->chainChild, buf, count);
- }
-
-static void innerProcWriteNumstring(ctxt, type, data, size, scale, writeProc)
- DPSContext ctxt;
- DPSDefinedType type;
- char *data;
- unsigned int size;
- int scale;
- void (*writeProc)();
-{
- unsigned char HNumHeader[4];
- register int i;
-#define NBUFSIZE 10
- int ibuf[NBUFSIZE]; /* This needs to be a 32 bit datatype */
-
- HNumHeader[0] = 149;
- switch (type) {
- case dps_tLong:
- HNumHeader[1] = (DPS_DEF_TOKENTYPE % 2) * 128 + scale;
- break;
-
- case dps_tInt:
- HNumHeader[1] = ((sizeof(int) >= 4) ? 0 : 32)
- + ((DPS_DEF_TOKENTYPE % 2) * 128) + scale;
- break;
-
- case dps_tShort:
- HNumHeader[1] = 32 + ((DPS_DEF_TOKENTYPE % 2) * 128) + scale;
- break;
-
- case dps_tFloat:
- HNumHeader[1] = 48 + ((DPS_DEF_TOKENTYPE % 2) * 128)
- + ((DPS_DEF_TOKENTYPE >= 130) ? 1 : 0);
- break;
- }
-
- HNumHeader[(DPS_DEF_TOKENTYPE % 2) ? 2 : 3] = (unsigned char) size;
- HNumHeader[(DPS_DEF_TOKENTYPE % 2) ? 3 : 2] = (unsigned char) (size >> 8);
-
- (*writeProc)(ctxt, (char *)HNumHeader, 4);
-
- switch (type) {
- case dps_tLong:
- if (sizeof(long) == 4) {
- (*writeProc)(ctxt, (char *) data, size * 4);
- } else {
- while (size > 0) {
- for (i = 0; i < NBUFSIZE && i < size; i++) {
- ibuf[i] = ((long *) data)[i];
- }
- (*writeProc)(ctxt, (char *) ibuf,
- 4 * (size < NBUFSIZE ? size : NBUFSIZE));
- size -= NBUFSIZE;
- }
- }
- break;
-
- case dps_tInt:
- (*writeProc)(ctxt, (char *) data, size * sizeof(int));
- break;
-
- case dps_tShort:
- (*writeProc)(ctxt, (char *) data, size * sizeof(short));
- break;
-
- case dps_tFloat:
- (*writeProc)(ctxt, (char *) data, size * sizeof(float));
- }
-} /* innerProcWriteNumstring */
-
-static void procWriteNumstring(ctxt, type, data, size, scale)
- DPSContext ctxt;
- DPSDefinedType type;
- char *data;
- unsigned int size;
- int scale;
-{
- innerProcWriteNumstring(ctxt, type, data, size, scale, DPSinnerProcWriteData);
- if (ctxt->chainChild != NIL) DPSWriteNumString(ctxt->chainChild, type, data, size, scale);
- }
-
-static void writeTypedObjectArray(ctxt, type, array, length)
- DPSContext ctxt;
- DPSDefinedType type;
- char *array;
- unsigned int length; {
-
-#define DPSMAX_SEQ 10
- unsigned int i;
- DPSPrivContext c = (DPSPrivContext)(ctxt);
- static DPSBinObjGeneric bboolObj[DPSMAX_SEQ] = {
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- {DPS_LITERAL | DPS_BOOL, 0,0,0},
- };
- static DPSBinObjReal rrealObj[DPSMAX_SEQ] = {
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- {DPS_LITERAL | DPS_REAL, 0,0,0},
- };
- static DPSBinObjGeneric iintObj[DPSMAX_SEQ] = {
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- {DPS_LITERAL | DPS_INT, 0,0,0},
- };
-
- if (DPSCheckShared(c)) return;
-
- switch (type) {
- case dps_tChar:
- case dps_tUChar:
- DPSCantHappen();
- break;
-
- case dps_tBoolean: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- bboolObj[i].val = *((int *)array);
- array += sizeof(int);
- }
- DPSWritePostScript(ctxt, (char *) bboolObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tFloat: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- rrealObj[i].realVal = *((float *)array);
- array += sizeof(float);
- }
- DPSWritePostScript(ctxt, (char *) rrealObj, sizeof(DPSBinObjReal) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tDouble: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- rrealObj[i].realVal = *((double *)array);
- array += sizeof(double);
- }
- DPSWritePostScript(ctxt, (char *) rrealObj, sizeof(DPSBinObjReal) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tShort: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- iintObj[i].val = *((short *)array);
- array += sizeof(short);
- }
- DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tUShort: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- iintObj[i].val = *((unsigned short *)array);
- array += sizeof(unsigned short);
- }
- DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tInt: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- iintObj[i].val = *((int *)array);
- array += sizeof(int);
- }
- DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tUInt: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- iintObj[i].val = *((unsigned int *)array);
- array += sizeof(unsigned int);
- }
- DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tLong: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- iintObj[i].val = *((long *)array);
- array += sizeof(long);
- }
- DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
- }
-
- case dps_tULong: {
- while (length > 0) {
- for (i = 0; i < MIN(DPSMAX_SEQ, length); i++) {
- iintObj[i].val = *((unsigned long *)array);
- array += sizeof(unsigned long);
- }
- DPSWritePostScript(ctxt, (char *) iintObj, sizeof(DPSBinObjGeneric) * i);
- length -= i;
- }
- break;
-
-
- }
-
- default:;
- }
- } /* writeTypedObjectArray */
-
-static void procDestroyContext(ctxt)
- DPSContext ctxt; {
- DPSPrivContext c = (DPSPrivContext)ctxt, cc, prev;
- DPSPrivSpace ss = (DPSPrivSpace)(c->space);
-
- if (c->buf != NIL) {
- ContextBuffer b = (ContextBuffer)(c->buf);
- b->next = contextBuffers;
- contextBuffers = b;
- c->buf = NIL;
- }
- if (c->objBuf != NIL) {
- free(c->objBuf);
- c->objBuf = NIL;
- }
-
- DPSUnchainContext(ctxt);
-
- prev = NIL;
- DPSAssert(ss != NIL);
- for (cc = ss->firstContext; (cc != NIL) && (cc != c); cc = cc->next)
- prev = cc;
- DPSAssert(cc != NIL);
- DPSAssert(cc != prev);
- if (prev == NIL) ss->firstContext = cc->next;
- else {
- prev->next = cc->next;
- DPSAssert(prev->next != prev);
- }
-
- DPSPrivateDestroyContext(ctxt);
- free(c);
- }
-
-static void procDestroySpace(space) DPSSpace space; {
- DPSPrivSpace ns, prevS, ss = (DPSPrivSpace)space;
- integer sid = ss->sid;
-
- while (ss->firstContext != NIL)
- DPSDestroyContext((DPSContext)(ss->firstContext));
-
- prevS = NIL;
- for (ns = spaces; (ns != NIL) && (ns->sid != sid); ns = ns->next)
- prevS = ns;
- DPSAssert(ns != NIL);
- DPSAssert(ns == ss);
- if (prevS == NIL) spaces = ns->next;
- else {
- prevS->next = ns->next;
- DPSAssert(prevS->next != prevS);
- }
-
- DPSPrivateDestroySpace(space);
- free(ss);
- }
-
-static void procInterrupt(ctxt)
- DPSContext ctxt; {
- DPSPrivContext c = (DPSPrivContext)ctxt;
- DPSSendInterrupt(c->wh, c->cid, DPSclientPrintProc);
- if (ctxt->chainChild != NIL) DPSInterruptContext(ctxt->chainChild);
- }
-
-
-/****************************************************************/
-/* Procedures that support the DPSCreateTextContext context procs */
-/****************************************************************/
-
-/* precondition: (c >= 129 && c <= 159), which means that c is the
- first byte of either a binary token or a binary object sequence */
-
-static boolean IsBinaryToken(c) unsigned char c; {
- return (c != DPS_HI_IEEE && c != DPS_LO_IEEE
- && c != DPS_HI_NATIVE && c != DPS_LO_NATIVE);
- }
-
-/* returns the number of initial bytes of a given goody that are
- required to figure out how many bytes are needed for the entire goody */
-
-static integer GetHdrNBytes(t) unsigned char *t; {
- if (!IsBinaryToken(*t)) {
- if (*(++t) == 0) return DPS_EXT_HEADER_SIZE;
- else return DPS_HEADER_SIZE;
- }
- switch (*t) {
- case 137:
- case 142:
- return(2);
- case 143:
- case 144:
- return(3);
- case 149:
- return(4);
- default:
- if (*t > 149 && *t < 160) return(1); /* unassigned */
- else return(1);
- }
- }
-
-
-static void WriteHomogeneousArrayAsASCII(ctxt, buf)
- DPSContext ctxt;
- register unsigned char *buf; {
- Swap32Rec n32;
- Swap16Rec n16;
- register unsigned char *b;
-
- unsigned char r = *buf++;
- float f;
- boolean hi = (r < 128);
-
- if (!hi) r -= 128;
- DPSPrintf(ctxt, "[ ");
- b = n16.bytes;
- if (hi) {Copy2SrcHi(buf, b);} else {Copy2SrcLo(buf, b);}
- buf += 2;
- if (r < 32) /* 32-bit fixed */
- while (n16.u--) {
- b = n32.bytes;
- if (hi) {Copy4SrcHi(buf, b);} else {Copy4SrcLo(buf, b);}
- if (r == 0)
- DPSPrintf(ctxt, "%d ", n32.i);
- else {
- f = n32.i; /* convert to float */
- n32.f = f / (1 << r); /* scale */
- DPSPrintf(ctxt, "%g ", n32.f);
- }
- buf += 4;
- }
- else if (r < 48) { /* 16-bit fixed */
- unsigned l = n16.u;
- r -= 32;
- while (l--) {
- b = n16.bytes;
- if (hi) {Copy2SrcHi(buf, b);} else {Copy2SrcLo(buf, b);}
- if (r == 0)
- DPSPrintf(ctxt, "%d ", n16.i);
- else {
- f = n16.i; /* convert to float */
- n32.f = f / (1 << r); /* scale */
- DPSPrintf(ctxt, "%g ", n32.f);
- }
- buf += 2;
- }
- }
- else if (r == 48) /* 32-bit IEEE */
- while (n16.u--) {
-#if IEEEFLOAT
- b = n32.bytes;
- if (hi) {Copy4SrcHi(buf, b);} else {Copy4SrcLo(buf, b);}
-#else /* IEEEFLOAT */
- if (hi) IEEEHighToNative(buf, &n32.f);
- else IEEELowToNative(buf, &n32.f);
-#endif /* IEEEFLOAT */
- DPSPrintf(ctxt, "%g ", n32.f);
- buf += 4;
- }
- else if (r == 49) /* 32-bit native */
- while (n16.u--) {
- b = n32.bytes;
- *b++ = *buf++,*b++ = *buf++,*b++ = *buf++,*b = *buf++;
- DPSPrintf(ctxt, "%g ", n32.f);
- }
- else DPSCantHappen();
- DPSPrintf(ctxt, "\n] ");
- } /* WriteHomogeneousArrayAsASCII */
-
-/* returns the number of bytes needed for the entire goody. buf points
- to enough initial bytes of the goody to figure this out (see above). */
-
-static integer GetNBytes(buf) register unsigned char *buf; {
- unsigned short int nBytes;
- register unsigned char *r = (unsigned char *)&nBytes;
-
- switch (*buf) {
- case DPS_HI_IEEE:
- case DPS_HI_NATIVE:
- if (*(buf+1) == 0) {
- unsigned int nb;
- r = (unsigned char *)&nb;
- buf += 4;
- Copy4SrcHi(buf, r);
- return(nb);
- }
- else {
- buf += 2;
- Copy2SrcHi(buf, r);
- }
- break;
- case DPS_LO_IEEE:
- case DPS_LO_NATIVE:
- if (*(buf+1) == 0) {
- unsigned int nb;
- r = (unsigned char *)&nb;
- buf += 4;
- Copy4SrcLo(buf, r);
- return(nb);
- }
- else {
- buf += 2;
- Copy2SrcLo(buf, r);
- }
- break;
- case 132:
- case 133:
- case 138:
- case 139:
- case 140:
- nBytes = 5; break;
- case 134:
- case 135:
- nBytes = 3; break;
- case 136:
- case 141:
- case 145:
- case 146:
- case 147:
- case 148:
- nBytes = 2; break;
- case 137: {
- unsigned int l = *(buf+1);
- if (l < 32) {nBytes = 6; break;}
- if (l < 48) {nBytes = 4; break;}
- if (l-128 < 32) {nBytes = 6; break;}
- if (l-128 < 48) {nBytes = 4; break;}
- DPSCantHappen();
- }
- case 142:
- nBytes = *(buf+1);
- nBytes += 2;
- break;
- case 143:
- buf++;
- Copy2SrcHi(buf, r);
- nBytes += 3;
- break;
- case 144:
- buf++;
- Copy2SrcLo(buf, r);
- nBytes += 3;
- break;
- case 149: {
- unsigned char scale = *(buf+1);
- buf += 2;
- if (scale < 128)
- Copy2SrcHi(buf, r);
- else {
- scale -= 128;
- Copy2SrcLo(buf, r);
- }
- if (scale < 32)
- nBytes *= 4;
- else if (scale < 48)
- nBytes *= 2;
- else
- nBytes *= 4;
- nBytes += 4;
- break;
- }
- default: nBytes = 1; /* unassigned */
- }
- return(nBytes);
- }
-
-static void WriteSeqAsAscii(ctxt, base, currObj, nObjs, tokenType,
- numstringOffsets)
- DPSContext ctxt;
- char *base;
- DPSBinObj currObj;
- unsigned int nObjs;
- unsigned char tokenType;
- int *numstringOffsets;
-{
-
- integer nLineObjs = 0;
- DPSNumFormat numFormat;
- float f;
- long int i;
- unsigned short int length;
-
- /* NOTE: It's ok to call DPSPrintf (which calls DPSWritePostScript)
- from here since we are only sending text, so there's no problem
- with re-entering DPSWritePostScript. Caller guarantees
- that this context has no children. */
-
- NumFormatFromTokenType(tokenType, &numFormat);
-
- while (nObjs--) {
- unsigned char type = currObj->attributedType & ~DPS_EXEC;
- boolean lit = ((currObj->attributedType & DPS_EXEC) == 0);
-
- switch (type) {
- case DPS_NULL:
- break;
- case DPS_BOOL:
- i = currObj->val.booleanVal;
- if (i)
- DPSPrintf(ctxt, "true ");
- else
- DPSPrintf(ctxt, "false ");
- break;
- case DPS_INT:
- i = currObj->val.integerVal;
- DPSPrintf(ctxt, "%d ", i);
- break;
- case DPS_REAL:
-#if IEEEFLOAT
- f = currObj->val.realVal;
-#else /* IEEEFLOAT */
- if (numFormat != DPSDefaultNumFormat)
-#if SWAPBITS
- IEEELowToNative(&currObj->val.realVal, &f);
-#else /* SWAPBITS */
- IEEEHighToNative(&currObj->val.realVal, &f);
-#endif /* SWAPBITS */
- else
- f = currObj->val.realVal;
-#endif /* IEEEFLOAT */
-
- DPSPrintf(ctxt, "%g ", f);
- break;
- case DPS_NAME: {
- char *p;
- integer index;
-
- index = currObj->val.nameVal;
- length = currObj->length;
-
- if (lit) DPSPrintf(ctxt, "/");
-
- if (length == DPSSYSNAME) { /* system name index */
- if (index <= DPS_LAST_COMMON_SYSNAME) {
- if (!lit && (ctxt->contextFlags & DPS_FLAG_USE_ABBREVS)) {
- p = DPSGetSysnameAbbrev(index);
- if (p == NULL) p = DPSSysNames[index];
- } else p = DPSSysNames[index];
- } else if (DPS_FIRST_AUX_SYSNAME <= index
- && index <= DPS_LAST_AUX_SYSNAME)
- p = DPSSysNamesAux[index - DPS_FIRST_AUX_SYSNAME];
- else DPSCantHappen();
- length = strlen(p);
- }
- else if (length == 0) { /* user name index */
- p = DPSNameFromIndex(index);
- length = strlen(p);
- }
- else
- p = base + index;
-
- DPSWriteData(ctxt, p, length);
- DPSPrintf(ctxt, " ");
- break;
- }
- case DPS_ARRAY:
- DPSPrintf(ctxt, (lit ? "[ " : "{ "));
- WriteSeqAsAscii(
- ctxt,
- base,
- (DPSBinObj)(base+currObj->val.arrayVal),
- currObj->length,
- tokenType, numstringOffsets);
- DPSPrintf(ctxt, (lit ? " ] " : " } "));
- break;
- case DPS_MARK:
- if (lit)
- DPSPrintf(ctxt, "/mark ");
- else
- DPSPrintf(ctxt, "mark ");
- break;
- case DPS_STRING: {
- char *p;
- int j;
- i = currObj->val.stringVal;
- length = currObj->length;
- p = base + i;
- if (numstringOffsets != NULL) {
- for (j = 2; j < numstringOffsets[1] &&
- numstringOffsets[j] != i; j++) ;
- if (numstringOffsets[j] == i) {
- DPSAssert(*(unsigned char *) p++ == 149);
- WriteHomogeneousArrayAsASCII(ctxt, (unsigned char *) p);
- break;
- }
- }
- DPSPrintf(ctxt, "(");
-#ifdef VMS
- WriteVMSStringBody(ctxt, p, length); /* write this */
-#else /* VMS */
- /* render string bytes correctly */
- while (length--) {
- char c = *p++;
- if (c == '(' || c == ')' || c == '\\')
- DPSPrintf(ctxt, "\\%c", c);
- else if (c == '\n')
- DPSPrintf(ctxt, "\\n");
- else if (!(isascii(c) && isprint(c)))
- DPSPrintf(ctxt, "\\%03.3o", (unsigned char) c);
- else DPSWriteData(ctxt, &c, 1);
- }
-#endif /* VMS */
- DPSPrintf(ctxt, ") ");
- break;
- }
- default: DPSCantHappen();
- }
-
- currObj++;
- if (++nLineObjs == 15) {
- nLineObjs = 0;
- DPSPrintf(ctxt, "\n ");
- }
- } /* end while */
-
- DPSPrintf(ctxt, "\n");
-
- } /* WriteSeqAsAscii */
-
-static void ConvertAndWriteSeqAsData(ctxt, bosBuf, pass)
- DPSContext ctxt;
- char *bosBuf;
- int pass; {
- DPSPrivContext cc = (DPSPrivContext) ctxt;
- DPSExtendedBinObjSeq bos;
- DPSExtendedBinObjSeqRec bosRec;
- DPSNumFormat numFormat;
- unsigned int offset, firstCharOffset;
- unsigned int nameOffset;
- unsigned int len = 0;
- DPSBinObj currObj;
- integer headSize;
- char *seqBase;
-
- if (*(bosBuf+1) != 0) {
- /* not an extended BOS */
- DPSBinObjSeq seqHead = (DPSBinObjSeq) bosBuf;
- bos = &bosRec;
- bos->tokenType = seqHead->tokenType;
- bos->escape = seqHead->nTopElements;
- bos->nTopElements = seqHead->nTopElements;
- bos->length = seqHead->length;
- currObj = &(seqHead->objects[0]);
- seqBase = (char *) &(seqHead->objects[0]);
- headSize = DPS_HEADER_SIZE;
- }
- else {
- bos = (DPSExtendedBinObjSeq) bosBuf;
- currObj = &(bos->objects[0]);
- seqBase = (char *) &(bos->objects[0]);
- headSize = DPS_EXT_HEADER_SIZE;
- }
- firstCharOffset = bos->length - headSize;
- nameOffset = firstCharOffset;
-
- /* Caller guarantees that this context has no children,
- so it is okay to call DPSWriteData */
-
- NumFormatFromTokenType(bos->tokenType, &numFormat);
-
- /* Pass 0: If we're expanding name indices, find all name objects,
- lookup their strings, sum the lengths.
- Write the modified sequence header regardless.
- Pass 1: we're converting indices to strings and/or
- converting numbers. Write each modified object, and
- subsidiary strings.
- Pass 2: Find all name objects, lookup and write the strings. */
-
- if (pass == 0 && ctxt->nameEncoding != dps_strings)
- /* we're just converting numbers, so skip while loop */
- offset = firstCharOffset;
- else
- offset = 0;
-
- while (offset < firstCharOffset) {
- DPSBinObjRec newObj;
- unsigned char type = (currObj->attributedType & ~DPS_EXEC);
-
- newObj = *currObj;
-
-#if !IEEEFLOAT
- if (type == DPS_REAL) {
- if (numFormat != cc->numFormat) {
- if (numFormat == dps_ieee) {
- if (DPSDefaultByteOrder == dps_loFirst)
- IEEELowToNative(&currObj->val.realVal, &newObj.val.realVal);
- else
- IEEEHighToNative(&currObj->val.realVal, &newObj.val.realVal);
- }
- else { /* numFormat is native */
- if (DPSDefaultByteOrder == dps_loFirst)
- NativeToIEEELow(&currObj->val.realVal, &newObj.val.realVal);
- else
- NativeToIEEEHigh(&currObj->val.realVal, &newObj.val.realVal);
- }
- }
- }
-#endif /* !IEEEFLOAT */
-
- if (type == DPS_STRING && newObj.length > 0) {
- /* keep track of where strings start */
- firstCharOffset = (newObj.val.stringVal < firstCharOffset)
- ? newObj.val.stringVal : firstCharOffset;
- }
- if (type == DPS_NAME) {
- if (newObj.length == DPSSYSNAME) { /* system name index, never expand to string body */
- if (pass != 1) goto next_obj;
- }
- else if (newObj.length == 0) { /* user name index */
- register char *p = DPSNameFromIndex(newObj.val.nameVal);
- switch (pass) {
- case 0: len += strlen(p); goto next_obj;
- case 1:
- if (ctxt->nameEncoding == dps_strings) {
- newObj.length = strlen(p);
- newObj.val.nameVal = nameOffset;
- nameOffset += newObj.length;
- }
- break;
- case 2: DPSWriteData(ctxt, p, strlen(p)); goto next_obj;
- default:;
- }
- }
- else { /* name is already a string */
- /* keep track of where strings start */
- firstCharOffset = (newObj.val.nameVal < firstCharOffset)
- ? newObj.val.nameVal : firstCharOffset;
- }
- } /* end if type == DPS_NAME */
- if (pass == 1) {
- DPSWriteData(ctxt, (char *) &newObj, sizeof(newObj));
- }
-
-next_obj:
- offset += sizeof(newObj);
- ++currObj;
- } /* end while */
-
- /* finish pass */
- switch (pass) {
- case 0: {
- unsigned char t;
- /* write modified seqHead */
- if (DPSDefaultByteOrder == dps_hiFirst && cc->numFormat == dps_ieee)
- t = DPS_HI_IEEE;
- else if (DPSDefaultByteOrder == dps_loFirst && cc->numFormat == dps_ieee)
- t = DPS_LO_IEEE;
- else if (DPSDefaultByteOrder == dps_hiFirst && cc->numFormat == dps_native)
- t = DPS_HI_NATIVE;
- else
- t = DPS_LO_NATIVE;
- DPSWriteData(ctxt, (char *) &t, 1);
- if (headSize == DPS_HEADER_SIZE) {
- unsigned short int nBytes;
- unsigned char c = bos->nTopElements;
- /* write top level count */
- DPSWriteData(ctxt, (char *) &c, 1);
- /* write nBytes */
- nBytes = (ctxt->nameEncoding == dps_strings) ? bos->length + len :
- bos->length;
- DPSWriteData(ctxt, (char *)&nBytes, 2);
- }
- else {
- unsigned int nBytes;
- /* write escape code & top level count */
- DPSWriteData(ctxt, (char *)&bos->escape, 3);
- /* write nBytes */
- nBytes = (ctxt->nameEncoding == dps_strings) ? bos->length + len :
- bos->length;
- DPSWriteData(ctxt, (char *)&nBytes, 4);
- }
- break;
- }
- case 1: {
- char *stringStart = seqBase + firstCharOffset;
- DPSWriteData(ctxt, stringStart, (bos->length - headSize - firstCharOffset));
- break;
- }
- default:;
- }
-
- } /* ConvertAndWriteSeqAsData */
-
-#define MIN16 -32768
-#define MAX16 32767
-
-/* TestHomogeneous will return a non-negative representation code 'r'
- if all of the array elements are "integers", or all are "reals".
- Will return -1 for any other case. */
-
-static integer TestHomogeneous(aryObj, length, numFormat)
- DPSBinObj aryObj;
- unsigned short length;
- DPSNumFormat numFormat; {
- integer tmp, r = -1;
-
- while (length--) {
- switch (aryObj->attributedType & ~DPS_EXEC) {
- case DPS_INT:
-#if SWAPBITS
- tmp = (aryObj->val.integerVal < MIN16
- || aryObj->val.integerVal > MAX16) ? 128 : 128+32;
-#else /* SWAPBITS */
- tmp = (aryObj->val.integerVal < MIN16
- || aryObj->val.integerVal > MAX16) ? 0 : 32;
-#endif /* SWAPBITS */
- if ((r == -1) || ((r & 0x07F) == 32 && (tmp & 0x07F) == 0))
- r = tmp; /* first element, or was 16-bit => bump to 32-bit */
- else if ((r & 0x07F) == 0 && (tmp & 0x07F) == 32)
- goto bump_obj; /* is 32-bit => stay 32-bit */
- else if (r != tmp)
- return(-1);
- /* else fall thru, r == tmp */
- break;
- case DPS_REAL:
-#if SWAPBITS
- tmp = (numFormat == dps_ieee) ? 128+48 : 128+49;
-#else /* SWAPBITS */
- tmp = (numFormat == dps_ieee) ? 48 : 49;
-#endif /* SWAPBITS */
- if (r == -1)
- r = tmp;
- else if (r != tmp) return(-1);
- break;
- default: return(-1);
- }
-bump_obj:
- ++aryObj;
- }
- return(r);
- } /* TestHomogeneous */
-
-static void WriteSeqAsTokens(ctxt, base, currObj, nObjs, tokenType,
- numstringOffsets)
- DPSContext ctxt;
- char *base;
- DPSBinObj currObj;
- unsigned int nObjs;
- unsigned char tokenType;
- int *numstringOffsets;
-{
- int nLineObjs = 0;
- DPSNumFormat numFormat;
- unsigned short length;
- Swap32Rec n32;
- Swap16Rec n16;
- unsigned char c;
-
-#define PB(byte) c = (byte),DPSWriteData(ctxt, (char *) &c, 1)
-#if SWAPBITS
-#define WTT(byte) PB((byte)+1)
-#else /* SWAPBITS */
-#define WTT(byte) PB(byte)
-#endif /* SWAPBITS */
-
- NumFormatFromTokenType(tokenType, &numFormat);
-
- while (nObjs--) {
- unsigned char type = currObj->attributedType & ~DPS_EXEC;
- boolean lit = ((currObj->attributedType & DPS_EXEC) == 0);
-
- switch (type) {
- case DPS_NULL:
- break;
- case DPS_BOOL:
- PB(141); /* boolean */
- if (currObj->val.booleanVal)
- PB(true);
- else
- PB(false);
- break;
- case DPS_INT:
- n32.i = currObj->val.integerVal;
- if (n32.i < MIN16 || n32.i > MAX16) {
- WTT(132); /* 32-bit int */
- DPSWriteData(ctxt, (char *) n32.bytes, 4);
- }
- else if (n32.i < -128 || n32.i > 127) {
- WTT(134); /* 16-bit int */
- n16.i = n32.i;
- DPSWriteData(ctxt, (char *) n16.bytes, 2);
- }
- else {
- WTT(136); /* 8-bit int */
- PB(n32.i);
- }
- break;
- case DPS_REAL:
-#if IEEEFLOAT
- WTT(138); /* 32-bit IEEE float */
-#else /* IEEEFLOAT */
- if (numFormat != DPSDefaultNumFormat)
- /* then it must be IEEE */
- WTT(138); /* 32-bit IEEE float */
- else
- PB(140); /* 32-bit native float */
-#endif /* IEEEFLOAT */
-
- DPSWriteData(ctxt, (char *) &currObj->val.realVal, 4);
- break;
- case DPS_NAME: {
- char *p;
- integer index = currObj->val.nameVal;
-
- length = currObj->length;
- if (length == DPSSYSNAME) {/* system name index */
- if (index >= 0 && index < 256) {
- if (lit)
- PB(145); /* literal system name */
- else
- PB(146); /* exec. system name */
- PB(index);
- goto next_obj;
- }
- else if (DPS_FIRST_AUX_SYSNAME <= index
- && index <= DPS_LAST_AUX_SYSNAME)
- p = DPSSysNamesAux[index - DPS_FIRST_AUX_SYSNAME];
- else DPSCantHappen();
- length = strlen(p);
- }
- else if (length == 0) { /* user name index */
- if (ctxt->nameEncoding == dps_indexed && index < 256) {
- if (lit)
- PB(147); /* literal user name index */
- else
- PB(148); /* executable user name index */
- PB(index);
- goto next_obj;
- }
- else {
- p = DPSNameFromIndex(index);
- length = strlen(p);
- }
- }
- else
- p = base + index;
- if (lit) DPSPrintf(ctxt, "/");
- DPSWriteData(ctxt, p, length);
- DPSPrintf(ctxt, " ");
- break;
- }
- case DPS_ARRAY: {
- DPSBinObj aryObj = (DPSBinObj)(base+currObj->val.arrayVal);
- integer r;
- length = currObj->length;
- if (lit && (r = TestHomogeneous(aryObj, length, numFormat)) != -1) {
- PB(149); /* homogeneous number array */
- PB(r);
- DPSWriteData(ctxt, (char *) &length, 2);
- if (r > 127) r -= 128;
- while (length--) {
- switch (r) {
- case 0:
- DPSWriteData(ctxt, (char *) &aryObj->val.integerVal, 4);
- break;
- case 32:
- n16.i = aryObj->val.integerVal;
- DPSWriteData(ctxt, (char *) n16.bytes, 2);
- break;
- case 48:
- case 49:
- DPSWriteData(ctxt, (char *) &aryObj->val.realVal, 4);
- break;
- default: DPSCantHappen();
- }
- ++aryObj;
- }
- }
- else {
- DPSPrintf(ctxt, (lit ? "[ " : "{ "));
- WriteSeqAsTokens(ctxt, base, aryObj, length, tokenType,
- numstringOffsets);
- DPSPrintf(ctxt, (lit ? " ] " : " } "));
- }
- break; }
- case DPS_MARK:
- if (lit)
- DPSPrintf(ctxt, "/mark ");
- else
- DPSPrintf(ctxt, "mark ");
- break;
- case DPS_STRING: {
- char *p = base + currObj->val.stringVal;
- int i;
- if (numstringOffsets != NULL) {
- for (i = 2; i < numstringOffsets[1] &&
- numstringOffsets[i] != currObj->val.stringVal; i++) ;
- if (numstringOffsets[i] == currObj->val.stringVal) {
- DPSAssert(*(unsigned char *) p == 149);
- DPSWriteData(ctxt, p, length);
- break;
- }
- }
- length = currObj->length;
- if (length < 256) {
- PB(142); /* short string */
- PB(length);
- }
- else {
- WTT(143); /* long string */
- DPSWriteData(ctxt, (char *) &length, 2);
- }
- DPSWriteData(ctxt, p, length);
- break;
- }
- default: DPSCantHappen();
- }
-next_obj:
- ++currObj;
- if (++nLineObjs == 15) {
- nLineObjs = 0;
- DPSPrintf(ctxt, "\n ");
- }
- } /* end while */
-
- DPSPrintf(ctxt, "\n");
- } /* WriteSeqAsTokens */
-
-static void WriteTokenAsAscii(ctxt, buf)
- DPSContext ctxt;
- register unsigned char *buf; {
- Swap32Rec n32;
- Swap16Rec n16;
- register unsigned char *b;
-
- switch (*buf++) {
- case 132: /* 32-bit int, hi */
- b = n32.bytes;
- Copy4SrcHi(buf, b);
- DPSPrintf(ctxt, "%d ", n32.i);
- break;
- case 133: /* 32-bit int, lo */
- b = n32.bytes;
- Copy4SrcLo(buf, b);
- DPSPrintf(ctxt, "%d ", n32.i);
- break;
- case 134: /* 16-bit int, hi */
- b = n16.bytes;
- Copy2SrcHi(buf, b);
- DPSPrintf(ctxt, "%d ", n16.i);
- break;
- case 135: /* 16-bit int, lo */
- b = n16.bytes;
- Copy2SrcLo(buf, b);
- DPSPrintf(ctxt, "%d ", n16.i);
- break;
- case 136: /* 8-bit int, signed */
- n32.i = (char) *buf;
- DPSPrintf(ctxt, "%d ", n32.i);
- break;
- case 137: { /* 16 or 32-bit fixed */
- unsigned char r = *buf++;
- float f;
- boolean hi = (r < 128);
-
- if (!hi) r -= 128;
- if (r < 32) { /* 32-bit */
- b = n32.bytes;
- if (hi) {Copy4SrcHi(buf, b);} else {Copy4SrcLo(buf, b);}
- if (r == 0) {
- DPSPrintf(ctxt, "%d ", n32.i);
- break;
- }
- else {
- f = n32.i; /* convert to float */
- goto do_scale;
- }
- }
- else if (r < 48) { /* 16-bit */
- b = n16.bytes;
- if (hi) {Copy2SrcHi(buf, b);} else {Copy2SrcLo(buf, b);};
- if (r == 0) {
- DPSPrintf(ctxt, "%d ", n16.i);
- break;
- }
- else {
- r -= 32;
- f = n16.i; /* convert to float */
- goto do_scale;
- }
- }
- else DPSCantHappen();
-do_scale:
- n32.f = f / (1 << r); /* scale */
- DPSPrintf(ctxt, "%g ", n32.f);
- break;
- }
- case 138: /* 32-bit IEEE float, hi */
-#if IEEEFLOAT
- b = n32.bytes;
- Copy4SrcHi(buf, b);
-#else /* IEEEFLOAT */
- IEEEHighToNative(buf, &n32.f);
-#endif /* IEEEFLOAT */
- DPSPrintf(ctxt, "%g ", n32.f);
- break;
- case 139: /* 32-bit IEEE float, lo */
-#if IEEEFLOAT
- b = n32.bytes;
- Copy4SrcLo(buf, b);
-#else /* IEEEFLOAT */
- IEEELowToNative(buf, &n32.f);
-#endif /* IEEEFLOAT */
- DPSPrintf(ctxt, "%g ", n32.f);
- break;
- case 140: /* 32-bit native float */
- b = n32.bytes;
- *b++ = *buf++,*b++ = *buf++,*b++ = *buf++,*b = *buf;
- DPSPrintf(ctxt, "%g ", n32.f);
- break;
- case 141: /* boolean */
- if (*buf)
- DPSPrintf(ctxt, "true ");
- else
- DPSPrintf(ctxt, "false ");
- break;
- case 142: /* short string */
- DPSPrintf(ctxt, "(");
- n16.u = *buf++;
- goto share_str_code;
- case 143: /* long string, hi */
- b = n16.bytes;
- Copy2SrcHi(buf, b);
- DPSPrintf(ctxt, "(");
- buf += 2;
- goto share_str_code;
- case 144: /* long string, lo */
- b = n16.bytes;
- Copy2SrcLo(buf, b);
- DPSPrintf(ctxt, "(");
- buf += 2;
-share_str_code:
-#ifdef VMS
- WriteVMSStringBody(ctxt, buf, n16.u); /* write this */
-#else /* VMS */
- /* render string bytes correctly */
- while (n16.u--) {
- unsigned char c = *buf++;
- if (c == '(' || c == ')' || c == '\\')
- DPSPrintf(ctxt, "\\%c", c);
- else if (c == '\n')
- DPSPrintf(ctxt, "\\n");
- else if (!(isascii(c) && isprint(c)))
- DPSPrintf(ctxt, "\\%03.3o", c);
- else DPSWriteData(ctxt, (char *) &c, 1);
- }
-#endif /* VMS */
- DPSPrintf(ctxt, ") ");
- break;
- case 145: /* literal system name index */
- DPSPrintf(ctxt, "/%s ", DPSSysNames[*buf]);
- break;
- case 146: /* executable system name index */
- DPSPrintf(ctxt, "%s ", DPSSysNames[*buf]);
- break;
- case 147: /* literal user name index */
- if ((int) *buf > globLastNameIndex) /* +++ */;
- DPSPrintf(ctxt, "/%s ", DPSNameFromIndex(*buf));
- break;
- case 148: /* executable user name index */
- if ((int) *buf > globLastNameIndex) /* +++ */;
- DPSPrintf(ctxt, "%s ", DPSNameFromIndex(*buf));
- break;
- case 149: { /* homogeneous number array */
- WriteHomogeneousArrayAsASCII(ctxt, buf);
- break;
- }
- default:; /* unassigned */
- }
- } /* WriteTokenAsAscii */
-
-
-/* WriteEntireGoody converts an entire binary token or binary object
- sequence as specified by ctxt's encoding parameters. Write the
- converted bytes via DPSWriteData. buf points to the complete goody. */
-
-static void WriteEntireGoody(ctxt, buf, numstringOffsets)
- DPSContext ctxt;
- unsigned char *buf;
- int *numstringOffsets;
-{
-
- DPSExtendedBinObjSeq bos = (DPSExtendedBinObjSeq) buf;
- DPSExtendedBinObjSeqRec bosRec;
- DPSBinObj currObj;
- DPSPrivContext cc = (DPSPrivContext) ctxt;
-
- if (IsBinaryToken(*buf)) {
- /* only supported conversion is binary token to ASCII */
- WriteTokenAsAscii(ctxt, buf);
- if (numstringOffsets) numstringOffsets[1] = 2;
- return;
- }
-
- if (bos->escape != 0) {
- /* not extended BOS */
- DPSBinObjSeq seqHead = (DPSBinObjSeq) buf;
- bos = &bosRec;
- bos->tokenType = seqHead->tokenType;
- bos->escape = seqHead->nTopElements;
- bos->nTopElements = seqHead->nTopElements;
- bos->length = seqHead->length;
- currObj = &(seqHead->objects[0]);
- }
- else currObj = &(bos->objects[0]);
-
- switch (ctxt->programEncoding) {
- case dps_binObjSeq:
- if (ctxt->nameEncoding == dps_strings) {
- /* takes three passes to do conversions */
- ConvertAndWriteSeqAsData(ctxt, (unsigned char *) buf, 0);
- ConvertAndWriteSeqAsData(ctxt, (unsigned char *) buf, 1);
- ConvertAndWriteSeqAsData(ctxt, (unsigned char *) buf, 2);
- }
- else if (bos->tokenType != DPS_DEF_TOKENTYPE
- || cc->numFormat != DPSDefaultNumFormat) {
- /* first pass just writes modified seqHead */
- ConvertAndWriteSeqAsData(ctxt, (unsigned char *) buf, 0);
- /* second pass converts numbers and writes the sequence */
- ConvertAndWriteSeqAsData(ctxt, (unsigned char *) buf, 1);
- }
- else DPSWriteData(ctxt, (char *) buf, bos->length);
- break;
- case dps_ascii:
- case dps_encodedTokens: {
-
- if (ctxt->programEncoding == dps_ascii)
- {
- WriteSeqAsAscii(
- ctxt, (char *)currObj, currObj, bos->nTopElements,
- bos->tokenType, numstringOffsets);
- }
- else
- WriteSeqAsTokens(
- ctxt, (char *)currObj, currObj, bos->nTopElements,
- bos->tokenType, numstringOffsets);
- DPSWriteData(ctxt, "\n", 1);
- break;
- }
- default:;
- }
- if (numstringOffsets) numstringOffsets[1] = 2;
-} /* WriteEntireGoody */
-
-
-/**************************************/
-/* Context procs for DPSCreateTextContext */
-/**************************************/
-
-static void textWriteData(ctxt, buf, nch)
- DPSContext ctxt; char *buf; unsigned int nch; {
- (*ctxt->textProc)(ctxt, buf, nch);
- if (ctxt->chainChild != NIL) DPSWriteData(ctxt->chainChild, buf, nch);
- }
-
-static void textFlushContext(ctxt) DPSContext ctxt; {
- if (ctxt->chainChild != NIL) DPSFlushContext(ctxt->chainChild);
- }
-
-static void textInterruptContext(ctxt) DPSContext ctxt; {
- if (ctxt->chainChild != NIL) DPSInterruptContext(ctxt->chainChild);
- }
-
-static void textDestroyContext(ctxt) DPSContext ctxt; {
- DPSPrivContext c = (DPSPrivContext)ctxt;
-
- DPSUnchainContext(ctxt);
-
- free(c);
- }
-
-static void textInnerWritePostScript(ctxt, buf, nch)
- DPSContext ctxt; char *buf; unsigned int nch; {
- DPSPrivContext cc = (DPSPrivContext)ctxt;
- while (nch > 0) {
- char *oldBuf = NIL;
- integer oldNch = 0;
- integer n;
- if (cc->outBuf) { /* we're buffering */
- integer m;
- integer bst;
- if (!IsBinaryToken(cc->outBuf[0]) && cc->nOutBufChars < DPS_SEQ_MIN) {
- char *tb = cc->outBuf + cc->nOutBufChars;
- integer nn = DPS_SEQ_MIN - cc->nOutBufChars;
- DPSAssert(nn == 1);
- cc->nOutBufChars += nn;
- nch -= nn;
- *tb++ = *buf++;
- }
- bst = GetHdrNBytes((unsigned char *) cc->outBuf);
- /* # bytes needed to determine size */
- if (cc->nOutBufChars < bst) {
- char *b = cc->outBuf;
- if (nch + cc->nOutBufChars < bst) {
- os_bcopy(buf, cc->outBuf + cc->nOutBufChars, nch);
- cc->nOutBufChars += nch;
- return;
- }
- os_bcopy(buf, b + cc->nOutBufChars, bst - cc->nOutBufChars);
- buf += bst - cc->nOutBufChars;
- nch -= bst - cc->nOutBufChars;
- cc->nOutBufChars = bst;
- m = GetNBytes((unsigned char *) cc->outBuf);
- cc->outBuf = (char *)DPScalloc(m, 1);
- os_bcopy(b, cc->outBuf, bst);
- free(b);
- }
- else m = GetNBytes((unsigned char *) cc->outBuf);
-
- /* here with size of entire goody in m and outBuf set up */
- if (nch < m - cc->nOutBufChars) {
- os_bcopy(buf, cc->outBuf + cc->nOutBufChars, nch);
- cc->nOutBufChars += nch;
- return;
- }
- os_bcopy(buf, cc->outBuf + cc->nOutBufChars, m - cc->nOutBufChars);
- buf += m - cc->nOutBufChars;
- nch -= m - cc->nOutBufChars;
- cc->nOutBufChars = m;
- oldBuf = buf;
- oldNch = nch;
- buf = cc->outBuf;
- nch = cc->nOutBufChars;
- cc->outBuf = NIL;
- cc->nOutBufChars = 0;
- } /* if (cc->outBuf) */
-
- /* dispose of any plain text. If no binary conversion, all output
- is plain text */
- if (cc->contextFlags & DPS_FLAG_NO_BINARY_CONVERSION) n = nch;
- else {
- for (n = 0; n < nch &&
- ((unsigned char) buf[n] < 128 || (unsigned char) buf[n] > 159); n++);
- }
- if (n > 0) {
- /* Assumes below that any error proc called uses dpsexcept.h
- if it rips control away */
- DURING
- DPSWriteData((DPSContext)cc, buf, n);
- HANDLER
- if (oldBuf) free(buf);
- RERAISE;
- END_HANDLER
- }
- buf += n;
- nch -= n;
-
- if (nch != 0) {
- /* here with the next binary object sequence or encoded token */
- integer m;
- integer bst;
- if (!IsBinaryToken(buf[0]) && nch < DPS_SEQ_MIN) {
- /* gotta buffer it */
- DPSAssertWarn(nch == 1 && !oldBuf, cc, "problem converting binary token/sequence (nch!=1||oldBuf)");
- cc->outBuf = (char *)DPScalloc(DPS_EXT_HEADER_SIZE, 1);
- cc->nOutBufChars = nch;
- cc->outBuf[0] = *buf;
- return;
- }
- bst = GetHdrNBytes((unsigned char *) buf);
- if (nch < bst || nch < (m = GetNBytes((unsigned char *) buf))) {
- /* gotta buffer it */
- DPSAssertWarn(!oldBuf, cc, "problem converting binary token/sequence (oldBuf)");
- if (nch < bst) {
- cc->outBuf = (char *)DPScalloc(bst, 1);
- }
- else {
- cc->outBuf = (char *)DPScalloc(m, 1);
- }
- cc->nOutBufChars = nch;
- os_bcopy(buf, cc->outBuf, nch);
- return;
- }
-
- /* Assumes below that any error proc called uses dpsexcept.h
- if it rips control away */
- DURING
- WriteEntireGoody(ctxt, (unsigned char *) buf, cc->numstringOffsets);
- HANDLER
- if (oldBuf) {
- DPSAssertWarn(nch == m, cc, "some converted PostScript language may be lost during error recovery (nch!=m)");
- free(buf);
- }
- RERAISE;
- END_HANDLER
-
- if (oldBuf) {
- DPSAssertWarn(nch == m, cc, "some converted PostScript language may be lost (nch!=m)");
- free(buf);
- buf = oldBuf;
- nch = oldNch;
- oldBuf = NIL;
- }
- else {
- buf += m;
- nch -= m;
- }
- } /* if (nch != 0) */
- } /* while (nch > 0) */
- } /* textInnerWritePostScript */
-
-static void textWritePostScript(ctxt, buf, nch)
- DPSContext ctxt; char *buf; unsigned int nch; {
- DPSContext children = ctxt->chainChild;
- /* disconnect temporarily so that high level procs can
- be called safely */
- if (children != NIL) ctxt->chainChild = NIL;
- DURING
- textInnerWritePostScript(ctxt, buf, nch);
- HANDLER
- if (children != NIL) ctxt->chainChild = children;
- RERAISE;
- END_HANDLER
- if (children != NIL) {
- ctxt->chainChild = children;
- DPSWritePostScript(ctxt->chainChild, buf, nch);
- }
- }
-
-static void textWriteStringChars(ctxt, buf, nch)
- DPSContext ctxt; char *buf; unsigned int nch; {
- DPSContext children = ctxt->chainChild;
-
- if (DPSCheckShared(ctxt)) return;
- /* disconnect temporarily so that high level procs can
- be called safely */
- if (children != NIL) ctxt->chainChild = NIL;
- DURING
- textInnerWritePostScript(ctxt, buf, nch);
- HANDLER
- if (children != NIL) ctxt->chainChild = children;
- RERAISE;
- END_HANDLER
- if (children != NIL) {
- ctxt->chainChild = children;
- DPSWriteStringChars(ctxt->chainChild, buf, nch);
- }
- }
-
-static void textBinObjSeqWrite(ctxt, buf, nch)
- DPSContext ctxt; char *buf; unsigned int nch; {
- DPSContext children = ctxt->chainChild;
- DPSPrivContext c = (DPSPrivContext) ctxt;
-
- if (DPSCheckShared(ctxt)) return;
- if (c->lastNameIndex < globLastNameIndex)
- DPSUpdateNameMap(ctxt);
- /* disconnect temporarily so that high level procs can
- be called safely */
- if (children != NIL) ctxt->chainChild = NIL;
- DURING
- textInnerWritePostScript(ctxt, buf, nch);
- HANDLER
- if (children != NIL) ctxt->chainChild = children;
- RERAISE;
- END_HANDLER
- if (children != NIL) {
- ctxt->chainChild = children;
- DPSBinObjSeqWrite(ctxt->chainChild, buf, nch);
- }
- }
-
-static void textWriteNumstring(ctxt, type, data, size, scale)
- DPSContext ctxt;
- DPSDefinedType type;
- char *data;
- unsigned int size;
- int scale;
-{
- DPSPrivContext cc = (DPSPrivContext) ctxt;
-#define BUFFER_GROW 10
-
- if (cc->contextFlags & DPS_FLAG_CONVERT_NUMSTRINGS) {
- if (cc->numstringOffsets == NULL) {
- cc->numstringOffsets = (int *) DPScalloc(sizeof(int),
- BUFFER_GROW + 2);
- cc->numstringOffsets[0] = BUFFER_GROW + 2; /* Current size */
- cc->numstringOffsets[1] = 2; /* Next slot */
- } else if (cc->numstringOffsets[1] >= cc->numstringOffsets[0]) {
- cc->numstringOffsets[0] += BUFFER_GROW;
- cc->numstringOffsets =
- (int *) realloc(cc->numstringOffsets,
- sizeof(int)* cc->numstringOffsets[0]);
- }
-
- /* Subtract 4 because of binary object sequence header */
- cc->numstringOffsets[cc->numstringOffsets[1]] = cc->nOutBufChars - 4;
- cc->numstringOffsets[1] += 1;
- }
-
- innerProcWriteNumstring(ctxt, type, data, size, scale, textInnerWritePostScript);
-#undef BUFFER_GROW
-} /* textWriteNumstring */
-
-/*********************/
-/* Public procedures */
-/*********************/
-
-/********************************************/
-/* Public procs for dealing with user names */
-
-char *DPSNameFromIndex(index) long int index; {
- if (DPSglobals == NIL || index < 0 || index > globLastNameIndex
- || userNameDict == NIL)
- return NIL;
- return (char *) userNames[index];
- }
-
-void DPSMapNames(ctxt, nNames, names, indices)
- DPSContext ctxt;
- unsigned int nNames;
- char **names;
- int **indices; {
- integer i;
- char *last;
-
- DPSCheckInitClientGlobals();
-
-#define USERNAMEDICTLENGTH 100
-
- if (userNameDict == NIL) {
- userNameDict = DPSCreatePSWDict(USERNAMEDICTLENGTH);
- userNames = (char **)DPScalloc(sizeof(char *), USERNAMEDICTLENGTH);
- userNamesLength = USERNAMEDICTLENGTH;
- }
-
- for (i = 0; i < nNames; i++) {
- integer j;
- char *n = names[i];
- DPSContext c;
-
- if (i == 0) last = names[0];
- if (n == NIL)
- n = last;
- else
- last = n;
- DPSAssert(n != NIL);
- if (strlen(n) > 128) {
- DPSSafeSetLastNameIndex(ctxt);
- (*ctxt->errorProc)(ctxt, dps_err_nameTooLong, n, strlen(n));
- return;
- }
- j = DPSWDictLookup(userNameDict, n);
- if (j >= 0) {
- *(indices[i]) = j;
- /* handle the case where another context in another space has
- defined this name */
- if (((DPSPrivContext)ctxt)->lastNameIndex < j)
- DPSUpdateNameMap(ctxt);
- }
- else {
- /* handle other cases where another context in another
- space has defined names */
- if (((DPSPrivContext)ctxt)->lastNameIndex < globLastNameIndex)
- DPSUpdateNameMap(ctxt);
- globLastNameIndex++;
- if (((globLastNameIndex + 1) > userNamesLength)) {
- char **t = (char **)DPScalloc(sizeof(char *),
- userNamesLength + USERNAMEDICTLENGTH);
- for (j = 0; j < userNamesLength; j++) {
- t[j] = userNames[j];
- }
- free(userNames);
- userNames = t;
- userNamesLength += USERNAMEDICTLENGTH;
- }
- userNames[globLastNameIndex] = n;
- DPSWDictEnter(userNameDict, n, globLastNameIndex);
- *(indices[i]) = globLastNameIndex;
- DPSPrintf(ctxt, "%d /%s defineusername\n", globLastNameIndex, n);
- for (c = ctxt; c != NIL; c = c->chainChild)
- ((DPSPrivContext)c)->lastNameIndex = globLastNameIndex;
- }
- } /* for */
- }
-
-/**********************/
-/* Other public procs */
-
-void DPSDefaultErrorProc(ctxt, errorCode, arg1, arg2)
- DPSContext ctxt;
- DPSErrorCode errorCode;
- long unsigned int arg1, arg2; {
-
- DPSTextProc textProc = DPSGetCurrentTextBackstop();
-
- char *prefix = "%%[ Error: ";
- char *suffix = " ]%%\n";
-
- char *infix = "; OffendingCommand: ";
- char *nameinfix = "User name too long; Name: ";
- char *contextinfix = "Invalid context: ";
- char *taginfix = "Unexpected wrap result tag: ";
- char *typeinfix = "Unexpected wrap result type; tag: ";
-
- switch (errorCode) {
- case dps_err_ps: {
- char *buf = (char *)arg1;
- DPSBinObj ary = (DPSBinObj) (buf+DPS_HEADER_SIZE);
- DPSBinObj elements;
- char *error, *errorName;
- integer errorCount, errorNameCount;
- boolean resyncFlg;
-
- if ((ary->attributedType & 0x7f) != DPS_ARRAY
- || ary->length != 4) {
- DPSHandleBogusError(ctxt, prefix, suffix);
- }
-
- elements = (DPSBinObj)(((char *) ary) + ary->val.arrayVal);
-
- errorName = (char *)(((char *) ary) + elements[1].val.nameVal);
- errorNameCount = elements[1].length;
-
- error = (char *)(((char *) ary) + elements[2].val.nameVal);
- errorCount = elements[2].length;
-
- resyncFlg = elements[3].val.booleanVal;
-
- if (textProc != NIL) {
- (*textProc)(ctxt, prefix, strlen(prefix));
- (*textProc)(ctxt, errorName, errorNameCount);
- (*textProc)(ctxt, infix, strlen(infix));
- (*textProc)(ctxt, error, errorCount);
- (*textProc)(ctxt, suffix, strlen(suffix));
- }
- if (resyncFlg && (ctxt != dummyCtx) && (ctxt != NULL)) {
-#if 0 /* Postpone the raise 'til later to avoid RAISEing through Xlib */
- RAISE(dps_err_ps, (char *) ctxt);
- DPSCantHappen();
-#else
- DPSPrivContext cc = (DPSPrivContext) ctxt;
- cc->resyncing = true;
-#endif
- }
- break;
- }
- case dps_err_nameTooLong:
- if (textProc != NIL) {
- char *buf = (char *)arg1;
- (*textProc)(ctxt, prefix, strlen(prefix));
- (*textProc)(ctxt, nameinfix, strlen(nameinfix));
- (*textProc)(ctxt, buf, arg2);
- (*textProc)(ctxt, suffix, strlen(suffix));
- }
- break;
- case dps_err_invalidContext:
- if (textProc != NIL) {
- char m[100];
- (void) sprintf(m, "%s%s%d%s", prefix, contextinfix, arg1, suffix);
- (*textProc)(ctxt, m, strlen(m));
- }
- break;
- case dps_err_resultTagCheck:
- if (textProc != NIL) {
- char m[100];
- unsigned char tag = *((unsigned char *) arg1+1);
- (void) sprintf(m, "%s%s%d%s", prefix, taginfix, tag, suffix);
- (*textProc)(ctxt, m, strlen(m));
- }
- break;
- case dps_err_resultTypeCheck:
- if (textProc != NIL) {
- char m[100];
- unsigned char tag = *((unsigned char *) arg1+1);
- (void) sprintf(m, "%s%s%d%s", prefix, typeinfix, tag, suffix);
- (*textProc)(ctxt, m, strlen(m));
- }
- break;
- default:
- DPSDefaultPrivateHandler(ctxt, errorCode, arg1, arg2, prefix, suffix);
- break;
- }
- } /* DPSDefaultErrorProc */
-
-void DPSCheckRaiseError(c)
- DPSContext c;
-{
- DPSPrivContext cc = (DPSPrivContext) c;
- if (cc != NULL && cc->resyncing) {
- cc->resyncing = false;
- RAISE(dps_err_ps, (char *) c);
- DPSCantHappen();
- }
-}
-
-/**************************************/
-/* Public procs for creating contexts */
-
-/* dps_err_invalidAccess is now defined for all clients. */
-
-static void textAwaitReturnValues(ctxt) DPSContext ctxt; {
- (*ctxt->errorProc)(ctxt, dps_err_invalidAccess, 0, 0);
- }
-
-static void Noop() {
- }
-
-DPSContext DPSCreateTextContext(textProc, errorProc)
- DPSTextProc textProc; DPSErrorProc errorProc;
- {
- DPSPrivContext c;
-
- if (DPSInitialize () != 0) return((DPSContext) NIL);
- if (!textCtxProcs) {
- textCtxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1);
- DPSInitCommonTextContextProcs(textCtxProcs);
- DPSInitSysNames();
- }
-
- c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1);
- c->textProc = textProc;
- c->procs = textCtxProcs;
- c->textProc = textProc;
- c->errorProc = errorProc;
- c->programEncoding = dps_ascii;
- c->nameEncoding = dps_strings; /* don't write user name indices on a file */
- c->contextFlags = DPS_FLAG_CONVERT_NUMSTRINGS; /* Convert by default */
- c->numFormat = DPSDefaultNumFormat;
- c->numstringOffsets = NULL;
- c->lastNameIndex = -1;
-
- /* Setup a dummy space */
- if (textSpace == NIL)
- {
- textSpace = (DPSPrivSpace) DPScalloc(sizeof (DPSPrivSpaceRec), 1);
- textSpace->procs = (DPSSpaceProcs) DPScalloc(sizeof (DPSSpaceProcsRec), 1);
- textSpace->procs->DestroySpace = Noop;
- textSpace->lastNameIndex = -1;
- DPSInitPrivateSpaceFields(textSpace);
- }
- c->space = (DPSSpace) textSpace;
-
- DPSInitPrivateTextContextFields(c, textSpace);
- return (DPSContext)c;
- } /* DPSCreateTextContext */
-
-
-static DPSContext CreateDummyContext() {
- DPSPrivContext c;
-
- DPSCheckInitClientGlobals();
- if (!dummyCtxProcs) {
- dummyCtxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1);
- dummyCtxProcs->BinObjSeqWrite = Noop;
- dummyCtxProcs->WriteTypedObjectArray = Noop;
- dummyCtxProcs->WriteStringChars = Noop;
- dummyCtxProcs->WritePostScript = Noop;
- dummyCtxProcs->WriteData = Noop;
- dummyCtxProcs->FlushContext = Noop;
- dummyCtxProcs->ResetContext = Noop;
- dummyCtxProcs->WaitContext = Noop;
- dummyCtxProcs->UpdateNameMap = Noop;
- dummyCtxProcs->AwaitReturnValues = Noop;
- dummyCtxProcs->Interrupt = Noop;
- dummyCtxProcs->DestroyContext = Noop;
- dummyCtxProcs->WriteNumString = Noop;
- }
-
- c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1);
- c->procs = dummyCtxProcs;
- c->programEncoding = DPSDefaultProgramEncoding;
- c->nameEncoding = DPSDefaultNameEncoding; /* don't care */
- c->numFormat = DPSDefaultNumFormat;
- c->lastNameIndex = -1;
- c->numstringOffsets = NULL;
-
- return (DPSContext)c;
- } /* CreateDummyContext */
-
-void DPSSetTextBackstop(textProc)
- DPSTextProc textProc; {
- DPSCheckInitClientGlobals();
- if (!dummyCtx) dummyCtx = CreateDummyContext();
- dummyCtx->textProc = textProc;
- }
-
-DPSTextProc DPSGetCurrentTextBackstop() {
- DPSCheckInitClientGlobals();
- if (dummyCtx == NIL) return NIL;
- else return dummyCtx->textProc;
- }
-
-void DPSSetErrorBackstop(errorProc)
- DPSErrorProc errorProc; {
- DPSCheckInitClientGlobals();
- if (!dummyCtx) dummyCtx = CreateDummyContext();
- dummyCtx->errorProc = errorProc;
- }
-
-DPSErrorProc DPSGetCurrentErrorBackstop() {
- DPSCheckInitClientGlobals();
- if (dummyCtx == NIL) return NIL;
- else return dummyCtx->errorProc;
- }
-
-static void NoteInitFailure() {
- initFailed = -1;
- }
-
-int DPSInitialize() {
- DPSCheckInitClientGlobals();
- if (!clientStarted) {
- clientStarted = true;
- initFailed = 0;
- DPSInitClient(NoteInitFailure, ReleaseInput); /* may call DPSCreateContext */
- /* textProc will not be used unless DPS initialization fails */
- }
- return initFailed;
- }
-
-DPSContext DPSCreateContext(wh, textProc, errorProc, space)
- char *wh;
- DPSTextProc textProc;
- DPSErrorProc errorProc;
- DPSSpace space;
- {
-
- DPSPrivSpace ss;
- DPSPrivContext c;
-
- if (DPSInitialize() != 0) return NIL;
-
- if (!ctxProcs) {
- ctxProcs = (DPSProcs)DPScalloc(sizeof(DPSProcsRec), 1);
- ctxProcs->BinObjSeqWrite = procBinObjSeqWrite;
- ctxProcs->WriteTypedObjectArray = writeTypedObjectArray;
- ctxProcs->WriteStringChars = procWriteStringChars;
- ctxProcs->WritePostScript = procWritePostScript;
- ctxProcs->WriteData = procWriteData;
- ctxProcs->UpdateNameMap = procUpdateNameMap;
- ctxProcs->Interrupt = procInterrupt;
- ctxProcs->WriteNumString = procWriteNumstring;
- }
- if (!spaceProcs) {
- spaceProcs = (DPSSpaceProcs)DPScalloc(sizeof(DPSSpaceProcsRec), 1);
- DPSInitCommonSpaceProcs(spaceProcs);
- }
-
- ss = (DPSPrivSpace)space;
-
- if (ss == NIL) {
- ss = (DPSPrivSpace)DPScalloc(sizeof(DPSPrivSpaceRec), 1);
- ss->procs = spaceProcs;
- ss->lastNameIndex = -1;
- ss->next = spaces;
- DPSAssert(ss->next != ss);
- spaces = ss;
- DPSInitPrivateSpaceFields(ss);
- }
-
- if (ss->wh == NIL) ss->wh = wh; /* KLUDGE to support DPSSendDestroySpace */
-
- c = (DPSPrivContext)DPScalloc(sizeof(DPSPrivContextRec), 1);
- c->procs = ctxProcs;
- c->wh = wh;
- c->textProc = textProc;
- c->errorProc = errorProc;
- c->programEncoding = DPSDefaultProgramEncoding;
- c->nameEncoding = DPSDefaultNameEncoding;
- c->lastNameIndex = -1;
- c->space = (DPSSpace)ss;
- c->numstringOffsets = NULL;
-
- c->next = ss->firstContext;
- DPSAssert(c->next != c);
- ss->firstContext = c;
-
- DPSInitPrivateContextFields(c, ss);
-
- c->numFormat = DPSCreatePrivContext(
- wh, (DPSContext)c, &c->cid, &ss->sid,
- (space == NIL), DPSclientPrintProc);
- if (c->numFormat == (DPSNumFormat) -1)
- { /* can't create the context */
- if (space == NIL) {
- spaces = ss->next;
- free(ss);
- }
- else ss->firstContext = c->next;
- free(c);
- return NIL;
- }
- else return (DPSContext)c;
- } /* DPSCreateContext */
-
-char *DPSSetWh(ctxt, newWh)
- DPSContext ctxt;
- char *newWh; {
- DPSPrivContext cc = (DPSPrivContext) ctxt;
- char *tmp = cc->wh;
- cc->wh = newWh;
- return(tmp);
- }
-
-/*
- The chainParent field is non-NIL if this context automatically receives
- a copy of the PostScript code sent to the referenced (parent) context.
-
- The chainChild field is non-NIL if this context automatically sends along
- to the referenced (child) context a copy of any PostScript code received.
-*/
-int DPSChainContext(parent, child) DPSContext parent, child; {
- DPSContext cc = child->chainChild;
-
- if (child->chainParent != NIL)
- return -1; /* report an error */
-
- /* insert new child between parent and existing children */
- child->chainChild = parent->chainChild;
- if (parent->chainChild != NIL) {
- DPSAssertWarn(parent->chainChild->chainParent == parent, (DPSPrivContext)parent, "attempting to chain context on invalid chain");
- child->chainChild->chainParent = child;
- }
- child->chainParent = parent;
- parent->chainChild = child;
- /* if child has children, recursively chain them */
- if (cc != NIL) {
- cc->chainParent = NIL;
- (void) DPSChainContext(child, cc);
- }
- return 0;
- }
-
-void DPSUnchainContext(ctxt) DPSContext ctxt; {
- DPSContext p = ctxt->chainParent;
- DPSContext c = ctxt->chainChild;
-
- if (p != NIL) { /* remove ctxt from parent's chain */
- DPSAssertWarn(p->chainChild == ctxt, (DPSPrivContext)p, "attempting to unchain context from wrong chain (parent)");
- p->chainChild = c;
- ctxt->chainParent = NIL;
- }
- if (c != NIL) { /* remove ctxt's child (if any) from ctxt's chain */
- DPSAssertWarn(c->chainParent == ctxt, (DPSPrivContext)c, "attempting to unchain context from wrong chain (child)");
- c->chainParent = p;
- ctxt->chainChild = NIL;
- }
- }
-
-/****************/
-/* Veneer procs */
-
-void DPSAwaitReturnValues(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->AwaitReturnValues)((ctxt));
- }
-
-void DPSDestroyContext(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->DestroyContext)((ctxt));
- }
-
-void DPSDestroySpace(spc)
- DPSSpace spc; {
- (*(spc)->procs->DestroySpace)((spc));
- }
-
-void DPSFlushContext(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->FlushContext)((ctxt));
- }
-
-DPSContext DPSGetCurrentContext() { return DPSGlobalContext; }
-
-void DPSInterruptContext(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->Interrupt)((ctxt));
- }
-
-DPSContext DPSPrivCurrentContext() { return DPSGlobalContext; }
-
-void DPSResetContext(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->ResetContext)((ctxt));
- }
-
-void DPSSetResultTable(ctxt, tbl, len)
- register DPSContext ctxt;
- DPSResults tbl;
- unsigned int len; {
- (ctxt)->resultTable = (tbl);
- (ctxt)->resultTableLength = (len);
- }
-
-void DPSSetContext(ctxt)
- DPSContext ctxt; {
- DPSGlobalContext = ctxt;
- }
-
-void DPSUpdateNameMap(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->UpdateNameMap)((ctxt));
- }
-
-void DPSWaitContext(ctxt)
- DPSContext ctxt; {
- (*(ctxt)->procs->WaitContext)(ctxt);
- }
-
-void DPSBinObjSeqWrite(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- (*(ctxt)->procs->BinObjSeqWrite)((ctxt), (buf), (count));
- }
-
-void DPSWriteData(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- (*(ctxt)->procs->WriteData)((ctxt), (buf), (count));
- }
-
-void DPSWritePostScript(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- (*(ctxt)->procs->WritePostScript)((ctxt), (buf), (count));
- }
-
-void DPSWriteStringChars(ctxt, buf, count)
- DPSContext ctxt;
- char *buf;
- unsigned int count; {
- (*(ctxt)->procs->WriteStringChars)((ctxt), (buf), (count));
- }
-
-void DPSWriteNumString(ctxt, type, data, size, scale)
- DPSContext ctxt;
- DPSDefinedType type;
- char *data;
- unsigned int size;
- int scale;
-{
- (*(ctxt)->procs->WriteNumString)((ctxt), (type), (data), (size), (scale));
-}
-
-void DPSWriteTypedObjectArray(ctxt, type, array, length)
- DPSContext ctxt;
- DPSDefinedType type;
- char *array;
- unsigned int length; {
- (*(ctxt)->procs->WriteTypedObjectArray)((ctxt), (type), (array), (length));
- }
-
-void DPSInitCommonTextContextProcs(p)
- DPSProcs p;
-{
- p->BinObjSeqWrite = textBinObjSeqWrite;
- p->WriteTypedObjectArray = writeTypedObjectArray;
- p->WriteStringChars = textWriteStringChars;
- p->WritePostScript = textWritePostScript;
- p->WriteData = textWriteData;
- p->FlushContext = textFlushContext;
- p->ResetContext = Noop;
- p->WaitContext = Noop;
- p->UpdateNameMap = procUpdateNameMap;
- p->AwaitReturnValues = textAwaitReturnValues;
- p->Interrupt = textInterruptContext;
- p->DestroyContext = textDestroyContext;
- p->WriteNumString = textWriteNumstring;
-}
-
-void DPSInitCommonContextProcs(p)
- DPSProcs p;
-{
- p->BinObjSeqWrite = procBinObjSeqWrite;
- p->WriteTypedObjectArray = writeTypedObjectArray;
- p->WriteStringChars = procWriteStringChars;
- p->WritePostScript = procWritePostScript;
- p->WaitContext = procWaitContext;
- p->DestroyContext = procDestroyContext;
- p->WriteData = procWriteData;
- p->UpdateNameMap = procUpdateNameMap;
- p->Interrupt = procInterrupt;
- p->WriteNumString = procWriteNumstring;
-}
-
-void DPSInitCommonSpaceProcs(p)
- DPSSpaceProcs p;
-{
- p->DestroySpace = procDestroySpace;
-}
-
-void DPSSetNumStringConversion(ctxt, flag)
- DPSContext ctxt;
- int flag;
-{
- if (flag) ctxt->contextFlags |= DPS_FLAG_CONVERT_NUMSTRINGS;
- else ctxt->contextFlags &= ~DPS_FLAG_CONVERT_NUMSTRINGS;
-}
-
-void DPSSetWrapSynchronization(ctxt, flag)
- DPSContext ctxt;
- int flag;
-{
- if (flag) ctxt->contextFlags |= DPS_FLAG_SYNC;
- else ctxt->contextFlags &= ~DPS_FLAG_SYNC;
-}
-
-void DPSSuppressBinaryConversion(ctxt, flag)
- DPSContext ctxt;
- int flag;
-{
- if (flag) ctxt->contextFlags |= DPS_FLAG_NO_BINARY_CONVERSION;
- else ctxt->contextFlags &= ~DPS_FLAG_NO_BINARY_CONVERSION;
-}
-
-void DPSSetAbbrevMode(ctxt, flag)
- DPSContext ctxt;
- int flag;
-{
- if (flag) ctxt->contextFlags |= DPS_FLAG_USE_ABBREVS;
- else ctxt->contextFlags &= ~DPS_FLAG_USE_ABBREVS;
-}
-
-DPSContextExtensionRec *DPSGetContextExtensionRec(ctxt, extensionId)
- DPSContext ctxt;
- int extensionId;
-{
- DPSContextExtensionRec *r = ctxt->extension;
-
- while (r != NULL && r->extensionId != extensionId) r = r->next;
- return r;
-}
-
-void DPSAddContextExtensionRec(ctxt, rec)
- DPSContext ctxt;
- DPSContextExtensionRec *rec;
-{
- rec->next = ctxt->extension;
- ctxt->extension = rec;
-}
-
-DPSContextExtensionRec *DPSRemoveContextExtensionRec(ctxt, extensionId)
- DPSContext ctxt;
- int extensionId;
-{
- DPSContextExtensionRec *rret, **r = &ctxt->extension;
-
-
- while (*r != NULL && (*r)->extensionId != extensionId) {
- r = &(*r)->next;
- }
- rret = *r;
- if (*r != NULL) *r = (*r)->next;
- return rret;
-}
-
-int DPSGenerateExtensionRecID()
-{
- static int id = 1;
-
- return id++;
-}
-
-DPSContextType DPSGetContextType(ctxt)
- DPSContext ctxt;
-{
- DPSPrivContext c = (DPSPrivContext) ctxt;
-
- if (c->procs == textCtxProcs) return dps_context_text;
- else return dps_context_execution;
-}
diff --git a/xc/lib/dps/dpsclrops.psw b/xc/lib/dps/dpsclrops.psw
deleted file mode 100644
index f8ec18269..000000000
--- a/xc/lib/dps/dpsclrops.psw
+++ /dev/null
@@ -1,81 +0,0 @@
-/* dpsclrops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPScolorimage(DPSContext ctxt)
- colorimage
-endps
-
-defineps DPScurrentblackgeneration(DPSContext ctxt)
- currentblackgeneration
-endps
-
-defineps DPScurrentcmykcolor(DPSContext ctxt | float *c, *m, *y, *k)
- currentcmykcolor k y m c
-endps
-
-defineps DPScurrentcolorscreen(DPSContext ctxt)
- currentcolorscreen
-endps
-
-defineps DPScurrentcolortransfer(DPSContext ctxt)
- currentcolortransfer
-endps
-
-defineps DPScurrentundercolorremoval(DPSContext ctxt)
- currentundercolorremoval
-endps
-
-defineps DPSsetblackgeneration(DPSContext ctxt)
- setblackgeneration
-endps
-
-defineps DPSsetcmykcolor(DPSContext ctxt; float c, m, y, k)
- c m y k setcmykcolor
-endps
-
-defineps DPSsetcolorscreen(DPSContext ctxt)
- setcolorscreen
-endps
-
-defineps DPSsetcolortransfer(DPSContext ctxt)
- setcolortransfer
-endps
-
-defineps DPSsetundercolorremoval(DPSContext ctxt)
- setundercolorremoval
-endps
-
diff --git a/xc/lib/dps/dpsctrlops.psw b/xc/lib/dps/dpsctrlops.psw
deleted file mode 100644
index d00707d4c..000000000
--- a/xc/lib/dps/dpsctrlops.psw
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * dpsctrlops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSeq(DPSContext ctxt)
- eq
-endps
-
-defineps DPSexit(DPSContext ctxt)
- exit
-endps
-
-defineps DPSfalse(DPSContext ctxt)
- false
-endps
-
-defineps DPSfor(DPSContext ctxt)
- for
-endps
-
-defineps DPSforall(DPSContext ctxt)
- forall
-endps
-
-defineps DPSge(DPSContext ctxt)
- ge
-endps
-
-defineps DPSgt(DPSContext ctxt)
- gt
-endps
-
-defineps DPSif(DPSContext ctxt)
- if
-endps
-
-defineps DPSifelse(DPSContext ctxt)
- ifelse
-endps
-
-defineps DPSle(DPSContext ctxt)
- le
-endps
-
-defineps DPSloop(DPSContext ctxt)
- loop
-endps
-
-defineps DPSlt(DPSContext ctxt)
- lt
-endps
-
-defineps DPSne(DPSContext ctxt)
- ne
-endps
-
-defineps DPSnot(DPSContext ctxt)
- not
-endps
-
-defineps DPSor(DPSContext ctxt)
- or
-endps
-
-defineps DPSrepeat(DPSContext ctxt)
- repeat
-endps
-
-defineps DPSstop(DPSContext ctxt)
- stop
-endps
-
-defineps DPSstopped(DPSContext ctxt)
- stopped
-endps
-
-defineps DPStrue(DPSContext ctxt)
- true
-endps
-
diff --git a/xc/lib/dps/dpsctxtops.psw b/xc/lib/dps/dpsctxtops.psw
deleted file mode 100644
index 00f6f8f18..000000000
--- a/xc/lib/dps/dpsctxtops.psw
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * dpsctxtops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSUserObjects(DPSContext ctxt)
- UserObjects
-endps
-
-defineps DPScondition(DPSContext ctxt)
- condition
-endps
-
-defineps DPScurrentcontext(DPSContext ctxt | int *cid)
- currentcontext cid
-endps
-
-defineps DPScurrentobjectformat(DPSContext ctxt | int *code)
- currentobjectformat code
-endps
-
-defineps DPSdefineusername(DPSContext ctxt; int i; char *username)
- i /username defineusername
-endps
-
-defineps DPSdefineuserobject(DPSContext ctxt)
- defineuserobject
-endps
-
-defineps DPSdetach(DPSContext ctxt)
- detach
-endps
-
-defineps DPSexecuserobject(DPSContext ctxt; int userObjIndex)
- userObjIndex execuserobject
-endps
-
-defineps DPSfork(DPSContext ctxt)
- fork
-endps
-
-defineps DPSjoin(DPSContext ctxt)
- join
-endps
-
-defineps DPSlock(DPSContext ctxt)
- lock
-endps
-
-defineps DPSmonitor(DPSContext ctxt)
- monitor
-endps
-
-defineps DPSnotify(DPSContext ctxt)
- notify
-endps
-
-defineps DPSsetobjectformat(DPSContext ctxt; int code)
- code setobjectformat
-endps
-
-defineps DPSsetvmthreshold(DPSContext ctxt; int i)
- i setvmthreshold
-endps
-
-defineps DPSundefineuserobject(DPSContext ctxt; int userObjIndex)
- userObjIndex undefineuserobject
-endps
-
-defineps DPSwait(DPSContext ctxt)
- wait
-endps
-
-defineps DPSyield(DPSContext ctxt)
- yield
-endps
-
diff --git a/xc/lib/dps/dpsdataops.psw b/xc/lib/dps/dpsdataops.psw
deleted file mode 100644
index c38893678..000000000
--- a/xc/lib/dps/dpsdataops.psw
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * dpsdataops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSaload(DPSContext ctxt)
- aload
-endps
-
-defineps DPSanchorsearch(DPSContext ctxt| boolean *truth)
- anchorsearch truth
-endps
-
-defineps DPSarray(DPSContext ctxt; int len)
- len array
-endps
-
-defineps DPSastore(DPSContext ctxt)
- astore
-endps
-
-defineps DPSbegin(DPSContext ctxt)
- begin
-endps
-
-defineps DPSclear(DPSContext ctxt)
- clear
-endps
-
-defineps DPScleartomark(DPSContext ctxt)
- cleartomark
-endps
-
-defineps DPScopy(DPSContext ctxt; int n)
- n copy
-endps
-
-defineps DPScount(DPSContext ctxt | int *n)
- count n
-endps
-
-defineps DPScounttomark(DPSContext ctxt | int *n)
- counttomark n
-endps
-
-defineps DPScvi(DPSContext ctxt)
- cvi
-endps
-
-defineps DPScvlit(DPSContext ctxt)
- cvlit
-endps
-
-defineps DPScvn(DPSContext ctxt)
- cvn
-endps
-
-defineps DPScvr(DPSContext ctxt)
- cvr
-endps
-
-defineps DPScvrs(DPSContext ctxt)
- cvrs
-endps
-
-defineps DPScvs(DPSContext ctxt)
- cvs
-endps
-
-defineps DPScvx(DPSContext ctxt)
- cvx
-endps
-
-defineps DPSdef(DPSContext ctxt)
- def
-endps
-
-defineps DPSdict(DPSContext ctxt; int len)
- len dict
-endps
-
-defineps DPSdictstack(DPSContext ctxt)
- dictstack
-endps
-
-defineps DPSdup(DPSContext ctxt)
- dup
-endps
-
-defineps DPSend(DPSContext ctxt)
- end
-endps
-
-defineps DPSexch(DPSContext ctxt)
- exch
-endps
-
-defineps DPSexecstack(DPSContext ctxt)
- execstack
-endps
-
-defineps DPSexecuteonly(DPSContext ctxt)
- executeonly
-endps
-
-defineps DPSget(DPSContext ctxt)
- get
-endps
-
-defineps DPSgetinterval(DPSContext ctxt)
- getinterval
-endps
-
-defineps DPSindex(DPSContext ctxt; int i)
- i index
-endps
-
-defineps DPSknown(DPSContext ctxt | boolean *b)
- known b
-endps
-
-defineps DPSlength(DPSContext ctxt | int *len)
- length len
-endps
-
-defineps DPSload(DPSContext ctxt)
- load
-endps
-
-defineps DPSmark(DPSContext ctxt)
- mark
-endps
-
-defineps DPSmatrix(DPSContext ctxt)
- matrix
-endps
-
-defineps DPSmaxlength(DPSContext ctxt | int *len)
- maxlength len
-endps
-
-defineps DPSnoaccess(DPSContext ctxt)
- noaccess
-endps
-
-defineps DPSnull(DPSContext ctxt)
- null
-endps
-
-defineps DPSpackedarray(DPSContext ctxt)
- packedarray
-endps
-
-defineps DPSpop(DPSContext ctxt)
- pop
-endps
-
-defineps DPSput(DPSContext ctxt)
- put
-endps
-
-defineps DPSputinterval(DPSContext ctxt)
- putinterval
-endps
-
-defineps DPSrcheck(DPSContext ctxt | boolean *b)
- rcheck b
-endps
-
-defineps DPSreadonly(DPSContext ctxt)
- readonly
-endps
-
-defineps DPSroll(DPSContext ctxt; int n, j)
- n j roll
-endps
-
-defineps DPSscheck(DPSContext ctxt | boolean *b)
- scheck b
-endps
-
-defineps DPSsearch(DPSContext ctxt| boolean *b)
- search b
-endps
-
-defineps DPSshareddict(DPSContext ctxt)
- shareddict
-endps
-
-defineps DPSstatusdict(DPSContext ctxt)
- statusdict
-endps
-
-defineps DPSstore(DPSContext ctxt)
- store
-endps
-
-defineps DPSstring(DPSContext ctxt; int len)
- len string
-endps
-
-defineps DPSstringwidth(DPSContext ctxt; char *s | float *xp, *yp)
- (s) stringwidth yp xp
-endps
-
-defineps DPSsystemdict(DPSContext ctxt)
- systemdict
-endps
-
-defineps DPSuserdict(DPSContext ctxt)
- userdict
-endps
-
-defineps DPSwcheck(DPSContext ctxt | boolean *b)
- wcheck b
-endps
-
-defineps DPSwhere(DPSContext ctxt| boolean *b)
- where b
-endps
-
-defineps DPSxcheck(DPSContext ctxt | boolean *b)
- xcheck b
-endps
-
diff --git a/xc/lib/dps/dpsdict.c b/xc/lib/dps/dpsdict.c
deleted file mode 100644
index 4d95ec75f..000000000
--- a/xc/lib/dps/dpsdict.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * dpsdict.c
- *
- * (c) Copyright 1988-1994 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
- */
-
-/***********/
-/* Imports */
-/***********/
-
-#include "dpsdict.h"
-
-
-/********************/
-/* Types */
-/********************/
-
-typedef struct _EntryRec {
- struct _EntryRec *next;
- char *name;
- PSWDictValue value;
- } EntryRec, *Entry;
-
- /* The concrete definition for a dictionary */
- typedef struct _PSWDictRec {
- integer nEntries;
- Entry *entries;
- } PSWDictRec;
-
-static PSWDict atoms;
-
-/**************************/
-/* Procedure Declarations */
-/**************************/
-
-extern char *DPScalloc();
-
-/* Creates and returns a new dictionary. nEntries is a hint. */
-PSWDict DPSCreatePSWDict(nEntries) integer nEntries; {
- PSWDict d = (PSWDict)DPScalloc(sizeof(PSWDictRec), 1);
- d->nEntries = nEntries;
- d->entries = (Entry *)DPScalloc(sizeof(EntryRec), d->nEntries);
- return d;
- }
-
-/* Destroys a dictionary */
-void DPSDestroyPSWDict(dict) PSWDict dict; {
- integer links = dict->nEntries;
- Entry next;
- Entry prev;
-
- while (links > 0)
- {
- next = (dict->entries)[links];
- while (next != NIL)
- {
- prev = next;
- next = next->next;
- free (prev);
- }
- links--;
- }
- free(dict->entries);
- free(dict);
- }
-
-static integer Hash(name, nEntries) char *name; integer nEntries; {
- register integer val = 0;
- while (*name) val += *name++;
- if (val < 0) val = -val;
- return (val % nEntries);
- }
-
-static Entry Probe(d, x, name) PSWDict d; integer x; char *name; {
- register Entry e;
- for (e = (d->entries)[x]; e != NIL; e = e->next) {
- if (strcmp(name, e->name) == 0) break;
- }
- return e;
- }
-
-static Entry PrevProbe(prev, d, x, name)
- Entry *prev; PSWDict d; integer x; char *name;
- {
- register Entry e;
- *prev = NIL;
- for (e = (d->entries)[x]; e != NIL; e = e->next) {
- if (strcmp(name, e->name) == 0) break;
- *prev = e;
- }
- return e;
- }
-
-/* -1 => not found */
-PSWDictValue DPSWDictLookup(dict, name) PSWDict dict; char *name; {
- Entry e;
- e = Probe(dict, Hash(name, dict->nEntries), name);
- if (e == NIL) return -1;
- return e->value;
- }
-
-/* 0 => normal return (not found)
- -1 => found. If found, value is replaced. */
-PSWDictValue DPSWDictEnter(dict, name, value)
- PSWDict dict; char *name; PSWDictValue value;
- {
- Entry e;
- integer x = Hash(name, dict->nEntries);
- e = Probe(dict, x, name);
- if (e != NIL) {
- e->value = value;
- return -1;
- }
- e = (Entry)DPScalloc(sizeof(EntryRec), 1);
- e->next = (dict->entries)[x]; (dict->entries)[x] = e;
- e->value = value;
- e->name = name; /* MakeAtom(name); */
- return 0;
- }
-
-/* -1 => not found. If found, value is returned. */
-PSWDictValue DPSWDictRemove(dict, name) PSWDict dict; char *name; {
- Entry e, prev;
- PSWDictValue value;
- integer x = Hash(name, dict->nEntries);
-
- e = PrevProbe(&prev, dict, x, name);
- if (e == NIL) return -1;
- value = e->value;
- if (prev == NIL) (dict->entries)[x] = e->next; else prev->next = e->next;
- free(e);
- return value;
- }
-
-Atom DPSMakeAtom(name) char *name; {
- Entry e;
- integer x = Hash(name, 511);
- char *newname;
-
- if (atoms == NIL) atoms = DPSCreatePSWDict(511);
- e = Probe(atoms, x, name);
- if (e == NIL) {
- e = (Entry)DPScalloc(sizeof(EntryRec), 1);
- e->next = (atoms->entries)[x]; (atoms->entries)[x] = e;
- e->value = 0;
- newname = (char *)DPScalloc(strlen(name)+1, 1);
- strcpy(newname, name);
- e->name = newname;
- }
- return e->name;
- }
-
diff --git a/xc/lib/dps/dpsdict.h b/xc/lib/dps/dpsdict.h
deleted file mode 100644
index 89a820400..000000000
--- a/xc/lib/dps/dpsdict.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * dpsdict.h
- *
- * (c) Copyright 1988-1994 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
- */
-
-#ifndef PSWDICT_H
-#define PSWDICT_H
-
-#include "publictypes.h"
-
-typedef struct _PSWDictRec *PSWDict;
-/* Opaque designator for a dictionary */
-
-typedef int PSWDictValue; /* non-negative */
-typedef char *Atom;
-
-/* PROCEDURES */
-
-/* The name parameters defined below are NULL-terminated C strings.
- None of the name parameters are handed off, i.e. the caller is
- responsible for managing their storage. */
-
-extern PSWDict DPSCreatePSWDict(/* integer nEntries */);
-/* nEntries is a hint. Creates and returns a new dictionary */
-
-extern void DPSDestroyPSWDict(/* PSWDict dict */);
-/* Destroys a dictionary */
-
-extern PSWDictValue DPSWDictLookup(/* PSWDict dict; char *name */);
-/* -1 => not found. */
-
-extern PSWDictValue DPSWDictEnter
- (/* PSWDict dict; char *name; PSWDictValue value; */);
-/* 0 => normal return (not found)
- -1 => found. If found, the old value gets replaced with the new one.
- caller must ensure continuing validity of name. */
-
-extern PSWDictValue DPSWDictRemove(/* PSWDict dict; char *name */);
-/* -1 => not found. If found, value is returned. */
-
-extern Atom DPSMakeAtom(/* char *name */);
-/* name characters are copied. */
-
-#endif /* PSWDICT_H */
diff --git a/xc/lib/dps/dpsendif.txt b/xc/lib/dps/dpsendif.txt
deleted file mode 100644
index 6cf055875..000000000
--- a/xc/lib/dps/dpsendif.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _NO_PROTO */
-
-#endif /* DPSOPS_H */
diff --git a/xc/lib/dps/dpsexcept.c b/xc/lib/dps/dpsexcept.c
deleted file mode 100644
index 1b347e318..000000000
--- a/xc/lib/dps/dpsexcept.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * dpsexcept.c
- *
- * (c) Copyright 1984-1994 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
- */
-/* $XFree86: xc/lib/dps/dpsexcept.c,v 1.2 2000/02/18 12:18:55 tsi Exp $ */
-
-/*
-Original version: Jeffrey Mogul, Stanford, 18 February 1983
-*/
-
-#ifdef VMS
-/* Add publictype.h to get a lowercase definition of "false" */
-#include "publictypes.h"
-#endif /* VMS */
-
-#include "DPS/dpsexcept.h"
-
-_Exc_Buf *_Exc_Header;
-
-
-
-void DPSRaise(code, msg)
- int code; char *msg; {
- register _Exc_Buf *EBp = _Exc_Header;
-
- if (EBp == 0) { /* uncaught exception */
- DPSCantHappen();
- }
-
- EBp->Code = code;
- EBp->Message = msg;
- _Exc_Header = EBp->Prev;
- longjmp(EBp->Environ, 1);
- }
-
-#ifndef XDPS
-void DPSCantHappen() {
- abort();
- }
-#endif /* XDPS */
diff --git a/xc/lib/dps/dpsfontops.psw b/xc/lib/dps/dpsfontops.psw
deleted file mode 100644
index 9958e776a..000000000
--- a/xc/lib/dps/dpsfontops.psw
+++ /dev/null
@@ -1,109 +0,0 @@
-/* dpsfontops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSFontDirectory(DPSContext ctxt)
- FontDirectory
-endps
-
-defineps DPSISOLatin1Encoding(DPSContext ctxt)
- ISOLatin1Encoding
-endps
-
-defineps DPSSharedFontDirectory(DPSContext ctxt)
- SharedFontDirectory
-endps
-
-defineps DPSStandardEncoding(DPSContext ctxt)
- StandardEncoding
-endps
-
-defineps DPScachestatus(DPSContext ctxt)
- cachestatus
-endps
-
-defineps DPScurrentcacheparams(DPSContext ctxt)
- currentcacheparams
-endps
-
-defineps DPScurrentfont(DPSContext ctxt)
- currentfont
-endps
-
-defineps DPSdefinefont(DPSContext ctxt)
- definefont
-endps
-
-defineps DPSfindfont(DPSContext ctxt; char *name)
- /name findfont
-endps
-
-defineps DPSmakefont(DPSContext ctxt)
- makefont
-endps
-
-defineps DPSscalefont(DPSContext ctxt; float size)
- size scalefont
-endps
-
-defineps DPSselectfont(DPSContext ctxt; char *name; float scale)
- /name scale selectfont
-endps
-
-defineps DPSsetcachedevice(DPSContext ctxt; float wx, wy, llx, lly, urx, ury)
- wx wy llx lly urx ury setcachedevice
-endps
-
-defineps DPSsetcachelimit(DPSContext ctxt; int n)
- n setcachelimit
-endps
-
-defineps DPSsetcacheparams(DPSContext ctxt)
- setcacheparams
-endps
-
-defineps DPSsetcharwidth(DPSContext ctxt; float wx, wy)
- wx wy setcharwidth
-endps
-
-defineps DPSsetfont(DPSContext ctxt; userobject f)
- f setfont
-endps
-
-defineps DPSundefinefont(DPSContext ctxt; char *name)
- /name undefinefont
-endps
-
diff --git a/xc/lib/dps/dpsgsttops.psw b/xc/lib/dps/dpsgsttops.psw
deleted file mode 100644
index d9b2728e7..000000000
--- a/xc/lib/dps/dpsgsttops.psw
+++ /dev/null
@@ -1,213 +0,0 @@
-/* dpsgsttops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSconcat(DPSContext ctxt; float m[6])
- m concat
-endps
-
-defineps DPScurrentdash(DPSContext ctxt)
- currentdash
-endps
-
-defineps DPScurrentflat(DPSContext ctxt | float *flatness)
- currentflat flatness
-endps
-
-defineps DPScurrentgray(DPSContext ctxt | float *gray)
- currentgray gray
-endps
-
-defineps DPScurrentgstate(DPSContext ctxt; userobject gst)
- gst currentgstate
-endps
-
-defineps DPScurrenthalftone(DPSContext ctxt)
- currenthalftone
-endps
-
-defineps DPScurrenthalftonephase(DPSContext ctxt | float *x, *y)
- currenthalftonephase y x
-endps
-
-defineps DPScurrenthsbcolor(DPSContext ctxt | float *h, *s, *b)
- currenthsbcolor b s h
-endps
-
-defineps DPScurrentlinecap(DPSContext ctxt | int *linecap)
- currentlinecap linecap
-endps
-
-defineps DPScurrentlinejoin(DPSContext ctxt | int *linejoin)
- currentlinejoin linejoin
-endps
-
-defineps DPScurrentlinewidth(DPSContext ctxt | float *width)
- currentlinewidth width
-endps
-
-defineps DPScurrentmatrix(DPSContext ctxt)
- currentmatrix
-endps
-
-defineps DPScurrentmiterlimit(DPSContext ctxt | float *limit)
- currentmiterlimit limit
-endps
-
-defineps DPScurrentpoint(DPSContext ctxt | float *x, *y)
- currentpoint y x
-endps
-
-defineps DPScurrentrgbcolor(DPSContext ctxt | float *r, *g, *b)
- currentrgbcolor b g r
-endps
-
-defineps DPScurrentscreen(DPSContext ctxt)
- currentscreen
-endps
-
-defineps DPScurrentstrokeadjust(DPSContext ctxt | boolean *b)
- currentstrokeadjust b
-endps
-
-defineps DPScurrenttransfer(DPSContext ctxt)
- currenttransfer
-endps
-
-defineps DPSdefaultmatrix(DPSContext ctxt)
- defaultmatrix
-endps
-
-defineps DPSgrestore(DPSContext ctxt)
- grestore
-endps
-
-defineps DPSgrestoreall(DPSContext ctxt)
- grestoreall
-endps
-
-defineps DPSgsave(DPSContext ctxt)
- gsave
-endps
-
-defineps DPSgstate(DPSContext ctxt)
- gstate
-endps
-
-defineps DPSinitgraphics(DPSContext ctxt)
- initgraphics
-endps
-
-defineps DPSinitmatrix(DPSContext ctxt)
- initmatrix
-endps
-
-defineps DPSrotate(DPSContext ctxt; float angle)
- angle rotate
-endps
-
-defineps DPSscale(DPSContext ctxt; float x, y)
- x y scale
-endps
-
-defineps DPSsetdash(DPSContext ctxt; float pat[size]; int size; float offset)
- pat offset setdash
-endps
-
-defineps DPSsetflat(DPSContext ctxt; float flatness)
- flatness setflat
-endps
-
-defineps DPSsetgray(DPSContext ctxt; float gray)
- gray setgray
-endps
-
-defineps DPSsetgstate(DPSContext ctxt; userobject gst)
- gst setgstate
-endps
-
-defineps DPSsethalftone(DPSContext ctxt)
- sethalftone
-endps
-
-defineps DPSsethalftonephase(DPSContext ctxt; float x, y)
- x y sethalftonephase
-endps
-
-defineps DPSsethsbcolor(DPSContext ctxt; float h, s, b)
- h s b sethsbcolor
-endps
-
-defineps DPSsetlinecap(DPSContext ctxt; int linecap)
- linecap setlinecap
-endps
-
-defineps DPSsetlinejoin(DPSContext ctxt; int linejoin)
- linejoin setlinejoin
-endps
-
-defineps DPSsetlinewidth(DPSContext ctxt; float width)
- width setlinewidth
-endps
-
-defineps DPSsetmatrix(DPSContext ctxt)
- setmatrix
-endps
-
-defineps DPSsetmiterlimit(DPSContext ctxt; float limit)
- limit setmiterlimit
-endps
-
-defineps DPSsetrgbcolor(DPSContext ctxt; float r, g, b)
- r g b setrgbcolor
-endps
-
-defineps DPSsetscreen(DPSContext ctxt)
- setscreen
-endps
-
-defineps DPSsetstrokeadjust(DPSContext ctxt; boolean b)
- b setstrokeadjust
-endps
-
-defineps DPSsettransfer(DPSContext ctxt)
- settransfer
-endps
-
-defineps DPStranslate(DPSContext ctxt; float x, y)
- x y translate
-endps
-
diff --git a/xc/lib/dps/dpsifdef.txt b/xc/lib/dps/dpsifdef.txt
deleted file mode 100644
index 70368c2cc..000000000
--- a/xc/lib/dps/dpsifdef.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef DPSOPS_H
-#define DPSOPS_H
-
-#ifdef _NO_PROTO
-
diff --git a/xc/lib/dps/dpsint.h b/xc/lib/dps/dpsint.h
deleted file mode 100644
index 73b9740c4..000000000
--- a/xc/lib/dps/dpsint.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * dpsint.h -- internal definitions to dpsclient.c
- *
- * (c) Copyright 1989-1994 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
- */
-
-#ifndef DPSINT_H
-#define DPSINT_H
-
-#include "dpsassert.h"
-
-typedef struct _t_ContextBufferRec {
- struct _t_ContextBufferRec *next;
- } ContextBufferRec, *ContextBuffer;
-
-typedef struct {
- ContextBuffer gcontextBuffers;
- integer gqueuedBuffers;
- DPSProcs gctxProcs, gtextCtxProcs, gdummyCtxProcs;
- DPSSpaceProcs gspaceProcs;
- DPSPrivSpace gspaces;
- char **guserNames;
- integer guserNamesLength;
- PSWDict guserNameDict;
- boolean gclientStarted;
- DPSContext gdummyCtx;
- integer ginitFailed, gglobLastNameIndex;
- DPSPrivSpace gTextSpace;
-} GlobalsRec, *Globals;
-
-extern Globals DPSglobals;
-
-#define contextBuffers DPSglobals->gcontextBuffers
-#define queuedBuffers DPSglobals->gqueuedBuffers
-#define ctxProcs DPSglobals->gctxProcs
-#define textCtxProcs DPSglobals->gtextCtxProcs
-#define dummyCtxProcs DPSglobals->gdummyCtxProcs
-#define spaceProcs DPSglobals->gspaceProcs
-#define spaces DPSglobals->gspaces
-#define userNames DPSglobals->guserNames
-#define userNamesLength DPSglobals->guserNamesLength
-#define userNameDict DPSglobals->guserNameDict
-#define clientStarted DPSglobals->gclientStarted
-#define dummyCtx DPSglobals->gdummyCtx
-#define initFailed DPSglobals->ginitFailed
-#define globLastNameIndex DPSglobals->gglobLastNameIndex
-#define textSpace DPSglobals->gTextSpace
-
-extern void DPSclientPrintProc();
-extern void DPSinnerProcWriteData();
-extern void DPSSafeSetLastNameIndex();
-extern void DPSCheckInitClientGlobals();
-extern boolean DPSPrivateCheckWait();
-extern void DPSPrivateDestroyContext();
-extern void DPSPrivateDestroySpace();
-extern boolean DPSCheckShared();
-
-extern void DPSDefaultPrivateHandler();
-
-extern DPSContext DPSCreateContext();
-
-extern void DPSInitCommonTextContextProcs();
-
-extern void DPSInitCommonContextProcs();
-extern void DPSInitPrivateContextProcs();
-extern void DPSInitPrivateContextFields();
-extern void DPSInitPrivateTextContextFields();
-
-extern void DPSInitCommonSpaceProcs();
-extern void DPSInitPrivateSpaceFields();
-
-#endif /* DPSINT_H */
diff --git a/xc/lib/dps/dpsioops.psw b/xc/lib/dps/dpsioops.psw
deleted file mode 100644
index dec3bb7c3..000000000
--- a/xc/lib/dps/dpsioops.psw
+++ /dev/null
@@ -1,153 +0,0 @@
-/* dpsioops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSequals(DPSContext ctxt)
- =
-endps
-
-defineps DPSequalsequals(DPSContext ctxt)
- ==
-endps
-
-defineps DPSbytesavailable(DPSContext ctxt | int *n)
- bytesavailable n
-endps
-
-defineps DPSclosefile(DPSContext ctxt)
- closefile
-endps
-
-defineps DPScurrentfile(DPSContext ctxt)
- currentfile
-endps
-
-defineps DPSdeletefile(DPSContext ctxt; char *filename)
- (filename) deletefile
-endps
-
-defineps DPSecho(DPSContext ctxt; boolean b)
- b echo
-endps
-
-defineps DPSfile(DPSContext ctxt; char *name, *access)
- (name) (access) file
-endps
-
-defineps DPSfilenameforall(DPSContext ctxt)
- filenameforall
-endps
-
-defineps DPSfileposition(DPSContext ctxt | int *pos)
- fileposition pos
-endps
-
-defineps DPSflush(DPSContext ctxt)
- flush
-endps
-
-defineps DPSflushfile(DPSContext ctxt)
- flushfile
-endps
-
-defineps DPSprint(DPSContext ctxt)
- print
-endps
-
-defineps DPSprintobject(DPSContext ctxt; int tag)
- tag printobject
-endps
-
-defineps DPSpstack(DPSContext ctxt)
- pstack
-endps
-
-defineps DPSread(DPSContext ctxt| boolean *b)
- read b
-endps
-
-defineps DPSreadhexstring(DPSContext ctxt| boolean *b)
- readhexstring b
-endps
-
-defineps DPSreadline(DPSContext ctxt| boolean *b)
- readline b
-endps
-
-defineps DPSreadstring(DPSContext ctxt| boolean *b)
- readstring b
-endps
-
-defineps DPSrenamefile(DPSContext ctxt; char *oldname, *newname)
- (oldname) (newname) renamefile
-endps
-
-defineps DPSresetfile(DPSContext ctxt)
- resetfile
-endps
-
-defineps DPSsetfileposition(DPSContext ctxt; int pos)
- pos setfileposition
-endps
-
-defineps DPSstack(DPSContext ctxt)
- stack
-endps
-
-defineps DPSstatus(DPSContext ctxt | boolean *b)
- status b
-endps
-
-defineps DPStoken(DPSContext ctxt| boolean *b)
- token b
-endps
-
-defineps DPSwrite(DPSContext ctxt)
- write
-endps
-
-defineps DPSwritehexstring(DPSContext ctxt)
- writehexstring
-endps
-
-defineps DPSwriteobject(DPSContext ctxt; int tag)
- tag writeobject
-endps
-
-defineps DPSwritestring(DPSContext ctxt)
- writestring
-endps
-
diff --git a/xc/lib/dps/dpsl2ops.psw b/xc/lib/dps/dpsl2ops.psw
deleted file mode 100644
index 67c1aee22..000000000
--- a/xc/lib/dps/dpsl2ops.psw
+++ /dev/null
@@ -1,208 +0,0 @@
-/* dpsl2ops.psw
- * (c) Copyright 1991-1994 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
- */
-
-defineps DPSleftbracket(DPSContext ctxt)
- mark % [ annoys pswrap
-endps
-
-defineps DPSrightbracket(DPSContext ctxt)
- counttomark array astore exch pop % ] annoys pswrap
-endps
-
-defineps DPSleftleft(DPSContext ctxt)
- <<
-endps
-
-defineps DPSrightright(DPSContext ctxt)
- >>
-endps
-
-defineps DPScshow(DPSContext ctxt; char *s)
- (s) cshow
-endps
-
-defineps DPScurrentcolor(DPSContext ctxt)
- currentcolor
-endps
-
-defineps DPScurrentcolorrendering(DPSContext ctxt)
- currentcolorrendering
-endps
-
-defineps DPScurrentcolorspace(DPSContext ctxt)
- currentcolorspace
-endps
-
-defineps DPScurrentdevparams(DPSContext ctxt; char *dev)
- (dev) currentdevparams
-endps
-
-defineps DPScurrentglobal(DPSContext ctxt | boolean *b)
- currentglobal b
-endps
-
-defineps DPScurrentoverprint(DPSContext ctxt | boolean *b)
- currentoverprint b
-endps
-
-defineps DPScurrentpagedevice(DPSContext ctxt)
- currentpagedevice
-endps
-
-defineps DPScurrentsystemparams(DPSContext ctxt)
- currentsystemparams
-endps
-
-defineps DPScurrentuserparams(DPSContext ctxt)
- currentuserparams
-endps
-
-defineps DPSdefineresource(DPSContext ctxt; char *category)
- /category defineresource
-endps
-
-defineps DPSexecform(DPSContext ctxt)
- execform
-endps
-
-defineps DPSfilter(DPSContext ctxt)
- filter
-endps
-
-defineps DPSfindencoding(DPSContext ctxt; char *key)
- /key findencoding
-endps
-
-defineps DPSfindresource(DPSContext ctxt; char *key, *category)
- /key /category findresource
-endps
-
-defineps DPSgcheck(DPSContext ctxt | boolean *b)
- gcheck b
-endps
-
-defineps DPSglobaldict(DPSContext ctxt)
- globaldict
-endps
-
-defineps DPSGlobalFontDirectory(DPSContext ctxt)
- GlobalFontDirectory
-endps
-
-defineps DPSglyphshow(DPSContext ctxt; char *name)
- /name glyphshow
-endps
-
-defineps DPSlanguagelevel(DPSContext ctxt | int *n)
- languagelevel n
-endps
-
-defineps DPSmakepattern(DPSContext ctxt)
- makepattern
-endps
-
-defineps DPSproduct(DPSContext ctxt)
- product
-endps
-
-defineps DPSresourceforall(DPSContext ctxt; char *category)
- /category resourceforall
-endps
-
-defineps DPSresourcestatus(DPSContext ctxt; char *key, *category; | boolean *b)
- /key /category resourcestatus b
-endps
-
-defineps DPSrevision(DPSContext ctxt | int *n)
- revision n
-endps
-
-defineps DPSrootfont(DPSContext ctxt)
- rootfont
-endps
-
-defineps DPSserialnumber(DPSContext ctxt | int *n)
- serialnumber n
-endps
-
-defineps DPSsetcolor(DPSContext ctxt)
- setcolor
-endps
-
-defineps DPSsetcolorrendering(DPSContext ctxt)
- setcolorrendering
-endps
-
-defineps DPSsetcolorspace(DPSContext ctxt)
- setcolorspace
-endps
-
-defineps DPSsetdevparams(DPSContext ctxt)
- setdevparams
-endps
-
-defineps DPSsetglobal(DPSContext ctxt; boolean b)
- b setglobal
-endps
-
-defineps DPSsetoverprint(DPSContext ctxt; boolean b)
- b setoverprint
-endps
-
-defineps DPSsetpagedevice(DPSContext ctxt)
- setpagedevice
-endps
-
-defineps DPSsetpattern(DPSContext ctxt)
- setpattern
-endps
-
-defineps DPSsetsystemparams(DPSContext ctxt)
- setsystemparams
-endps
-
-defineps DPSsetuserparams(DPSContext ctxt)
- setuserparams
-endps
-
-defineps DPSstartjob(DPSContext ctxt; boolean b; char *password)
- b password startjob
-endps
-
-defineps DPSundefineresource(DPSContext ctxt; char *key, *category)
- /key /category undefineresource
-endps
-
diff --git a/xc/lib/dps/dpsmathops.psw b/xc/lib/dps/dpsmathops.psw
deleted file mode 100644
index e7ada11af..000000000
--- a/xc/lib/dps/dpsmathops.psw
+++ /dev/null
@@ -1,125 +0,0 @@
-/* dpsmathops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSabs(DPSContext ctxt)
- abs
-endps
-
-defineps DPSadd(DPSContext ctxt)
- add
-endps
-
-defineps DPSand(DPSContext ctxt)
- and
-endps
-
-defineps DPSatan(DPSContext ctxt)
- atan
-endps
-
-defineps DPSbitshift(DPSContext ctxt; int shift)
- shift bitshift
-endps
-
-defineps DPSceiling(DPSContext ctxt)
- ceiling
-endps
-
-defineps DPScos(DPSContext ctxt)
- cos
-endps
-
-defineps DPSdiv(DPSContext ctxt)
- div
-endps
-
-defineps DPSexp(DPSContext ctxt)
- exp
-endps
-
-defineps DPSfloor(DPSContext ctxt)
- floor
-endps
-
-defineps DPSidiv(DPSContext ctxt)
- idiv
-endps
-
-defineps DPSln(DPSContext ctxt)
- ln
-endps
-
-defineps DPSlog(DPSContext ctxt)
- log
-endps
-
-defineps DPSmod(DPSContext ctxt)
- mod
-endps
-
-defineps DPSmul(DPSContext ctxt)
- mul
-endps
-
-defineps DPSneg(DPSContext ctxt)
- neg
-endps
-
-defineps DPSround(DPSContext ctxt)
- round
-endps
-
-defineps DPSsin(DPSContext ctxt)
- sin
-endps
-
-defineps DPSsqrt(DPSContext ctxt)
- sqrt
-endps
-
-defineps DPSsub(DPSContext ctxt)
- sub
-endps
-
-defineps DPStruncate(DPSContext ctxt)
- truncate
-endps
-
-defineps DPSxor(DPSContext ctxt)
- xor
-endps
-
diff --git a/xc/lib/dps/dpsmiscops.psw b/xc/lib/dps/dpsmiscops.psw
deleted file mode 100644
index 6b5bb8078..000000000
--- a/xc/lib/dps/dpsmiscops.psw
+++ /dev/null
@@ -1,53 +0,0 @@
-/* dpsmiscops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSbanddevice(DPSContext ctxt)
- banddevice
-endps
-
-defineps DPSframedevice(DPSContext ctxt)
- framedevice
-endps
-
-defineps DPSnulldevice(DPSContext ctxt)
- nulldevice
-endps
-
-defineps DPSrenderbands(DPSContext ctxt)
- renderbands
-endps
-
diff --git a/xc/lib/dps/dpsmtrxops.psw b/xc/lib/dps/dpsmtrxops.psw
deleted file mode 100644
index 6b5303ba0..000000000
--- a/xc/lib/dps/dpsmtrxops.psw
+++ /dev/null
@@ -1,65 +0,0 @@
-/* dpsmtrxops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSconcatmatrix(DPSContext ctxt)
- concatmatrix
-endps
-
-defineps DPSdtransform(DPSContext ctxt; float x1, y1 | float *x2, *y2)
- x1 y1 dtransform y2 x2
-endps
-
-defineps DPSidentmatrix(DPSContext ctxt)
- identmatrix
-endps
-
-defineps DPSidtransform(DPSContext ctxt; float x1, y1 | float *x2, *y2)
- x1 y1 idtransform y2 x2
-endps
-
-defineps DPSinvertmatrix(DPSContext ctxt)
- invertmatrix
-endps
-
-defineps DPSitransform(DPSContext ctxt; float x1, y1 | float *x2, *y2)
- x1 y1 itransform y2 x2
-endps
-
-defineps DPStransform(DPSContext ctxt; float x1, y1 | float *x2, *y2)
- x1 y1 transform y2 x2
-endps
-
diff --git a/xc/lib/dps/dpsname.txt b/xc/lib/dps/dpsname.txt
deleted file mode 100644
index ab32b7f7d..000000000
--- a/xc/lib/dps/dpsname.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- * dpsops.h
- */
-
diff --git a/xc/lib/dps/dpsops.h.os2 b/xc/lib/dps/dpsops.h.os2
deleted file mode 100644
index 44a2c3f60..000000000
--- a/xc/lib/dps/dpsops.h.os2
+++ /dev/null
@@ -1,1601 +0,0 @@
-/*
- * dpsops.h
- */
-
-/*
- * (c) Copyright 1988-1994 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
- */
-#ifndef DPSOPS_H
-#define DPSOPS_H
-
-#ifdef _NO_PROTO
-
-extern void DPSFontDirectory( /* DPSContext ctxt; */ );
-
-extern void DPSGlobalFontDirectory( /* DPSContext ctxt; */ );
-
-extern void DPSISOLatin1Encoding( /* DPSContext ctxt; */ );
-
-extern void DPSSharedFontDirectory( /* DPSContext ctxt; */ );
-
-extern void DPSStandardEncoding( /* DPSContext ctxt; */ );
-
-extern void DPSUserObjects( /* DPSContext ctxt; */ );
-
-extern void DPSabs( /* DPSContext ctxt; */ );
-
-extern void DPSadd( /* DPSContext ctxt; */ );
-
-extern void DPSaload( /* DPSContext ctxt; */ );
-
-extern void DPSanchorsearch( /* DPSContext ctxt; int *truth; */ );
-
-extern void DPSand( /* DPSContext ctxt; */ );
-
-extern void DPSarc( /* DPSContext ctxt; float x, y, r, angle1, angle2; */ );
-
-extern void DPSarcn( /* DPSContext ctxt; float x, y, r, angle1, angle2; */ );
-
-extern void DPSarct( /* DPSContext ctxt; float x1, y1, x2, y2, r; */ );
-
-extern void DPSarcto( /* DPSContext ctxt; float x1, y1, x2, y2, r; float *xt1, *yt1, *xt2, *yt2; */ );
-
-extern void DPSarray( /* DPSContext ctxt; int len; */ );
-
-extern void DPSashow( /* DPSContext ctxt; float x, y; char *s; */ );
-
-extern void DPSastore( /* DPSContext ctxt; */ );
-
-extern void DPSatan( /* DPSContext ctxt; */ );
-
-extern void DPSawidthshow( /* DPSContext ctxt; float cx, cy; int c; float ax, ay; char *s; */ );
-
-extern void DPSbanddevice( /* DPSContext ctxt; */ );
-
-extern void DPSbegin( /* DPSContext ctxt; */ );
-
-extern void DPSbind( /* DPSContext ctxt; */ );
-
-extern void DPSbitshift( /* DPSContext ctxt; int shift; */ );
-
-extern void DPSbytesavailable( /* DPSContext ctxt; int *n; */ );
-
-extern void DPScachestatus( /* DPSContext ctxt; */ );
-
-extern void DPSceiling( /* DPSContext ctxt; */ );
-
-extern void DPScharpath( /* DPSContext ctxt; char *s; int b; */ );
-
-extern void DPSclear( /* DPSContext ctxt; */ );
-
-extern void DPScleardictstack( /* DPSContext ctxt; */ );
-
-extern void DPScleartomark( /* DPSContext ctxt; */ );
-
-extern void DPSclientXready( /* DPSContext ctxt; int i0, i1, i2, i3; */ );
-
-extern void DPSclientsync( /* DPSContext ctxt; */ );
-
-extern void DPSclip( /* DPSContext ctxt; */ );
-
-extern void DPSclippath( /* DPSContext ctxt; */ );
-
-extern void DPSclosefile( /* DPSContext ctxt; */ );
-
-extern void DPSclosepath( /* DPSContext ctxt; */ );
-
-extern void DPScolorimage( /* DPSContext ctxt; */ );
-
-extern void DPSconcat( /* DPSContext ctxt; float m[]; */ );
-
-extern void DPSconcatmatrix( /* DPSContext ctxt; */ );
-
-extern void DPScondition( /* DPSContext ctxt; */ );
-
-extern void DPScopy( /* DPSContext ctxt; int n; */ );
-
-extern void DPScopypage( /* DPSContext ctxt; */ );
-
-extern void DPScos( /* DPSContext ctxt; */ );
-
-extern void DPScount( /* DPSContext ctxt; int *n; */ );
-
-extern void DPScountdictstack( /* DPSContext ctxt; int *n; */ );
-
-extern void DPScountexecstack( /* DPSContext ctxt; int *n; */ );
-
-extern void DPScounttomark( /* DPSContext ctxt; int *n; */ );
-
-extern void DPScshow( /* DPSContext ctxt; char *s; */ );
-
-extern void DPScurrentXdrawingfunction( /* DPSContext ctxt; int *function; */ );
-
-extern void DPScurrentXgcdrawable( /* DPSContext ctxt; int *gc, *draw, *x, *y; */ );
-
-extern void DPScurrentXgcdrawablecolor( /* DPSContext ctxt; int *gc, *draw, *x, *y, colorInfo[]; */ );
-
-extern void DPScurrentXoffset( /* DPSContext ctxt; int *x, *y; */ );
-
-extern void DPScurrentblackgeneration( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcacheparams( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcmykcolor( /* DPSContext ctxt; float *c, *m, *y, *k; */ );
-
-extern void DPScurrentcolor( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcolorrendering( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcolorscreen( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcolorspace( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcolortransfer( /* DPSContext ctxt; */ );
-
-extern void DPScurrentcontext( /* DPSContext ctxt; int *cid; */ );
-
-extern void DPScurrentdash( /* DPSContext ctxt; */ );
-
-extern void DPScurrentdevparams( /* DPSContext ctxt; char *dev; */ );
-
-extern void DPScurrentdict( /* DPSContext ctxt; */ );
-
-extern void DPScurrentfile( /* DPSContext ctxt; */ );
-
-extern void DPScurrentflat( /* DPSContext ctxt; float *flatness; */ );
-
-extern void DPScurrentfont( /* DPSContext ctxt; */ );
-
-extern void DPScurrentglobal( /* DPSContext ctxt; int *b; */ );
-
-extern void DPScurrentgray( /* DPSContext ctxt; float *gray; */ );
-
-extern void DPScurrentgstate( /* DPSContext ctxt; int gst; */ );
-
-extern void DPScurrenthalftone( /* DPSContext ctxt; */ );
-
-extern void DPScurrenthalftonephase( /* DPSContext ctxt; float *x, *y; */ );
-
-extern void DPScurrenthsbcolor( /* DPSContext ctxt; float *h, *s, *b; */ );
-
-extern void DPScurrentlinecap( /* DPSContext ctxt; int *linecap; */ );
-
-extern void DPScurrentlinejoin( /* DPSContext ctxt; int *linejoin; */ );
-
-extern void DPScurrentlinewidth( /* DPSContext ctxt; float *width; */ );
-
-extern void DPScurrentmatrix( /* DPSContext ctxt; */ );
-
-extern void DPScurrentmiterlimit( /* DPSContext ctxt; float *limit; */ );
-
-extern void DPScurrentobjectformat( /* DPSContext ctxt; int *code; */ );
-
-extern void DPScurrentoverprint( /* DPSContext ctxt; int *b; */ );
-
-extern void DPScurrentpacking( /* DPSContext ctxt; int *b; */ );
-
-extern void DPScurrentpagedevice( /* DPSContext ctxt; */ );
-
-extern void DPScurrentpoint( /* DPSContext ctxt; float *x, *y; */ );
-
-extern void DPScurrentrgbcolor( /* DPSContext ctxt; float *r, *g, *b; */ );
-
-extern void DPScurrentscreen( /* DPSContext ctxt; */ );
-
-extern void DPScurrentshared( /* DPSContext ctxt; int *b; */ );
-
-extern void DPScurrentstrokeadjust( /* DPSContext ctxt; int *b; */ );
-
-extern void DPScurrentsystemparams( /* DPSContext ctxt; */ );
-
-extern void DPScurrenttransfer( /* DPSContext ctxt; */ );
-
-extern void DPScurrentundercolorremoval( /* DPSContext ctxt; */ );
-
-extern void DPScurrentuserparams( /* DPSContext ctxt; */ );
-
-extern void DPScurveto( /* DPSContext ctxt; float x1, y1, x2, y2, x3, y3; */ );
-
-extern void DPScvi( /* DPSContext ctxt; */ );
-
-extern void DPScvlit( /* DPSContext ctxt; */ );
-
-extern void DPScvn( /* DPSContext ctxt; */ );
-
-extern void DPScvr( /* DPSContext ctxt; */ );
-
-extern void DPScvrs( /* DPSContext ctxt; */ );
-
-extern void DPScvs( /* DPSContext ctxt; */ );
-
-extern void DPScvx( /* DPSContext ctxt; */ );
-
-extern void DPSdef( /* DPSContext ctxt; */ );
-
-extern void DPSdefaultmatrix( /* DPSContext ctxt; */ );
-
-extern void DPSdefinefont( /* DPSContext ctxt; */ );
-
-extern void DPSdefineresource( /* DPSContext ctxt; char *category; */ );
-
-extern void DPSdefineusername( /* DPSContext ctxt; int i; char *username; */ );
-
-extern void DPSdefineuserobject( /* DPSContext ctxt; */ );
-
-extern void DPSdeletefile( /* DPSContext ctxt; char *filename; */ );
-
-extern void DPSdetach( /* DPSContext ctxt; */ );
-
-extern void DPSdeviceinfo( /* DPSContext ctxt; */ );
-
-extern void DPSdict( /* DPSContext ctxt; int len; */ );
-
-extern void DPSdictstack( /* DPSContext ctxt; */ );
-
-extern void DPSdiv( /* DPSContext ctxt; */ );
-
-extern void DPSdtransform( /* DPSContext ctxt; float x1, y1; float *x2, *y2; */ );
-
-extern void DPSdup( /* DPSContext ctxt; */ );
-
-extern void DPSecho( /* DPSContext ctxt; int b; */ );
-
-extern void DPSend( /* DPSContext ctxt; */ );
-
-extern void DPSeoclip( /* DPSContext ctxt; */ );
-
-extern void DPSeofill( /* DPSContext ctxt; */ );
-
-extern void DPSeoviewclip( /* DPSContext ctxt; */ );
-
-extern void DPSeq( /* DPSContext ctxt; */ );
-
-extern void DPSequals( /* DPSContext ctxt; */ );
-
-extern void DPSequalsequals( /* DPSContext ctxt; */ );
-
-extern void DPSerasepage( /* DPSContext ctxt; */ );
-
-extern void DPSerrordict( /* DPSContext ctxt; */ );
-
-extern void DPSexch( /* DPSContext ctxt; */ );
-
-extern void DPSexec( /* DPSContext ctxt; */ );
-
-extern void DPSexecform( /* DPSContext ctxt; */ );
-
-extern void DPSexecstack( /* DPSContext ctxt; */ );
-
-extern void DPSexecuserobject( /* DPSContext ctxt; int userObjIndex; */ );
-
-extern void DPSexecuteonly( /* DPSContext ctxt; */ );
-
-extern void DPSexit( /* DPSContext ctxt; */ );
-
-extern void DPSexp( /* DPSContext ctxt; */ );
-
-extern void DPSfalse( /* DPSContext ctxt; */ );
-
-extern void DPSfile( /* DPSContext ctxt; char *name, *access; */ );
-
-extern void DPSfilenameforall( /* DPSContext ctxt; */ );
-
-extern void DPSfileposition( /* DPSContext ctxt; int *pos; */ );
-
-extern void DPSfill( /* DPSContext ctxt; */ );
-
-extern void DPSfilter( /* DPSContext ctxt; */ );
-
-extern void DPSfindencoding( /* DPSContext ctxt; char *key; */ );
-
-extern void DPSfindfont( /* DPSContext ctxt; char *name; */ );
-
-extern void DPSfindresource( /* DPSContext ctxt; char *key, *category; */ );
-
-extern void DPSflattenpath( /* DPSContext ctxt; */ );
-
-extern void DPSfloor( /* DPSContext ctxt; */ );
-
-extern void DPSflush( /* DPSContext ctxt; */ );
-
-extern void DPSflushfile( /* DPSContext ctxt; */ );
-
-extern void DPSfor( /* DPSContext ctxt; */ );
-
-extern void DPSforall( /* DPSContext ctxt; */ );
-
-extern void DPSfork( /* DPSContext ctxt; */ );
-
-extern void DPSframedevice( /* DPSContext ctxt; */ );
-
-extern void DPSgcheck( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSge( /* DPSContext ctxt; */ );
-
-extern void DPSget( /* DPSContext ctxt; */ );
-
-extern void DPSgetboolean( /* DPSContext ctxt; int *it; */ );
-
-extern void DPSgetchararray( /* DPSContext ctxt; int size; char s[]; */ );
-
-extern void DPSgetfloat( /* DPSContext ctxt; float *it; */ );
-
-extern void DPSgetfloatarray( /* DPSContext ctxt; int size; float a[]; */ );
-
-extern void DPSgetint( /* DPSContext ctxt; int *it; */ );
-
-extern void DPSgetintarray( /* DPSContext ctxt; int size; int a[]; */ );
-
-extern void DPSgetinterval( /* DPSContext ctxt; */ );
-
-extern void DPSgetstring( /* DPSContext ctxt; char *s; */ );
-
-extern void DPSglobaldict( /* DPSContext ctxt; */ );
-
-extern void DPSglyphshow( /* DPSContext ctxt; char *name; */ );
-
-extern void DPSgrestore( /* DPSContext ctxt; */ );
-
-extern void DPSgrestoreall( /* DPSContext ctxt; */ );
-
-extern void DPSgsave( /* DPSContext ctxt; */ );
-
-extern void DPSgstate( /* DPSContext ctxt; */ );
-
-extern void DPSgt( /* DPSContext ctxt; */ );
-
-extern void DPSidentmatrix( /* DPSContext ctxt; */ );
-
-extern void DPSidiv( /* DPSContext ctxt; */ );
-
-extern void DPSidtransform( /* DPSContext ctxt; float x1, y1; float *x2, *y2; */ );
-
-extern void DPSif( /* DPSContext ctxt; */ );
-
-extern void DPSifelse( /* DPSContext ctxt; */ );
-
-extern void DPSimage( /* DPSContext ctxt; */ );
-
-extern void DPSimagemask( /* DPSContext ctxt; */ );
-
-extern void DPSindex( /* DPSContext ctxt; int i; */ );
-
-extern void DPSineofill( /* DPSContext ctxt; float x, y; int *b; */ );
-
-extern void DPSinfill( /* DPSContext ctxt; float x, y; int *b; */ );
-
-extern void DPSinitclip( /* DPSContext ctxt; */ );
-
-extern void DPSinitgraphics( /* DPSContext ctxt; */ );
-
-extern void DPSinitmatrix( /* DPSContext ctxt; */ );
-
-extern void DPSinitviewclip( /* DPSContext ctxt; */ );
-
-extern void DPSinstroke( /* DPSContext ctxt; float x, y; int *b; */ );
-
-extern void DPSinueofill( /* DPSContext ctxt; float x, y; char nums[]; int n; char ops[]; int l; int *b; */ );
-
-extern void DPSinufill( /* DPSContext ctxt; float x, y; char nums[]; int n; char ops[]; int l; int *b; */ );
-
-extern void DPSinustroke( /* DPSContext ctxt; float x, y; char nums[]; int n; char ops[]; int l; int *b; */ );
-
-extern void DPSinvertmatrix( /* DPSContext ctxt; */ );
-
-extern void DPSitransform( /* DPSContext ctxt; float x1, y1; float *x2, *y2; */ );
-
-extern void DPSjoin( /* DPSContext ctxt; */ );
-
-extern void DPSknown( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSkshow( /* DPSContext ctxt; char *s; */ );
-
-extern void DPSlanguagelevel( /* DPSContext ctxt; int *n; */ );
-
-extern void DPSle( /* DPSContext ctxt; */ );
-
-extern void DPSleftbracket( /* DPSContext ctxt; */ );
-
-extern void DPSleftleft( /* DPSContext ctxt; */ );
-
-extern void DPSlength( /* DPSContext ctxt; int *len; */ );
-
-extern void DPSlineto( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPSln( /* DPSContext ctxt; */ );
-
-extern void DPSload( /* DPSContext ctxt; */ );
-
-extern void DPSlock( /* DPSContext ctxt; */ );
-
-extern void DPSlog( /* DPSContext ctxt; */ );
-
-extern void DPSloop( /* DPSContext ctxt; */ );
-
-extern void DPSlt( /* DPSContext ctxt; */ );
-
-extern void DPSmakefont( /* DPSContext ctxt; */ );
-
-extern void DPSmakepattern( /* DPSContext ctxt; */ );
-
-extern void DPSmark( /* DPSContext ctxt; */ );
-
-extern void DPSmatrix( /* DPSContext ctxt; */ );
-
-extern void DPSmaxlength( /* DPSContext ctxt; int *len; */ );
-
-extern void DPSmod( /* DPSContext ctxt; */ );
-
-extern void DPSmonitor( /* DPSContext ctxt; */ );
-
-extern void DPSmoveto( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPSmul( /* DPSContext ctxt; */ );
-
-extern void DPSne( /* DPSContext ctxt; */ );
-
-extern void DPSneg( /* DPSContext ctxt; */ );
-
-extern void DPSnewpath( /* DPSContext ctxt; */ );
-
-extern void DPSnoaccess( /* DPSContext ctxt; */ );
-
-extern void DPSnot( /* DPSContext ctxt; */ );
-
-extern void DPSnotify( /* DPSContext ctxt; */ );
-
-extern void DPSnull( /* DPSContext ctxt; */ );
-
-extern void DPSnulldevice( /* DPSContext ctxt; */ );
-
-extern void DPSor( /* DPSContext ctxt; */ );
-
-extern void DPSpackedarray( /* DPSContext ctxt; */ );
-
-extern void DPSpathbbox( /* DPSContext ctxt; float *llx, *lly, *urx, *ury; */ );
-
-extern void DPSpathforall( /* DPSContext ctxt; */ );
-
-extern void DPSpop( /* DPSContext ctxt; */ );
-
-extern void DPSprint( /* DPSContext ctxt; */ );
-
-extern void DPSprintobject( /* DPSContext ctxt; int tag; */ );
-
-extern void DPSproduct( /* DPSContext ctxt; */ );
-
-extern void DPSprompt( /* DPSContext ctxt; */ );
-
-extern void DPSpstack( /* DPSContext ctxt; */ );
-
-extern void DPSput( /* DPSContext ctxt; */ );
-
-extern void DPSputinterval( /* DPSContext ctxt; */ );
-
-extern void DPSquit( /* DPSContext ctxt; */ );
-
-extern void DPSrand( /* DPSContext ctxt; */ );
-
-extern void DPSrcheck( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSrcurveto( /* DPSContext ctxt; float x1, y1, x2, y2, x3, y3; */ );
-
-extern void DPSread( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSreadhexstring( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSreadline( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSreadonly( /* DPSContext ctxt; */ );
-
-extern void DPSreadstring( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSrealtime( /* DPSContext ctxt; int *i; */ );
-
-extern void DPSrectclip( /* DPSContext ctxt; float x, y, w, h; */ );
-
-extern void DPSrectfill( /* DPSContext ctxt; float x, y, w, h; */ );
-
-extern void DPSrectstroke( /* DPSContext ctxt; float x, y, w, h; */ );
-
-extern void DPSrectviewclip( /* DPSContext ctxt; float x, y, w, h; */ );
-
-extern void DPSrenamefile( /* DPSContext ctxt; char *oldname, *newname; */ );
-
-extern void DPSrenderbands( /* DPSContext ctxt; */ );
-
-extern void DPSrepeat( /* DPSContext ctxt; */ );
-
-extern void DPSresetfile( /* DPSContext ctxt; */ );
-
-extern void DPSresourceforall( /* DPSContext ctxt; char *category; */ );
-
-extern void DPSresourcestatus( /* DPSContext ctxt; char *key, *category; int *b; */ );
-
-extern void DPSrestore( /* DPSContext ctxt; */ );
-
-extern void DPSreversepath( /* DPSContext ctxt; */ );
-
-extern void DPSrevision( /* DPSContext ctxt; int *n; */ );
-
-extern void DPSrightbracket( /* DPSContext ctxt; */ );
-
-extern void DPSrightright( /* DPSContext ctxt; */ );
-
-extern void DPSrlineto( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPSrmoveto( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPSroll( /* DPSContext ctxt; int n, j; */ );
-
-extern void DPSrootfont( /* DPSContext ctxt; */ );
-
-extern void DPSrotate( /* DPSContext ctxt; float angle; */ );
-
-extern void DPSround( /* DPSContext ctxt; */ );
-
-extern void DPSrrand( /* DPSContext ctxt; */ );
-
-extern void DPSrun( /* DPSContext ctxt; char *filename; */ );
-
-extern void DPSsave( /* DPSContext ctxt; */ );
-
-extern void DPSscale( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPSscalefont( /* DPSContext ctxt; float size; */ );
-
-extern void DPSscheck( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSsearch( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSselectfont( /* DPSContext ctxt; char *name; float scale; */ );
-
-extern void DPSsendboolean( /* DPSContext ctxt; int it; */ );
-
-extern void DPSsendchararray( /* DPSContext ctxt; char s[]; int size; */ );
-
-extern void DPSsendfloat( /* DPSContext ctxt; float it; */ );
-
-extern void DPSsendfloatarray( /* DPSContext ctxt; float a[]; int size; */ );
-
-extern void DPSsendint( /* DPSContext ctxt; int it; */ );
-
-extern void DPSsendintarray( /* DPSContext ctxt; int a[]; int size; */ );
-
-extern void DPSsendstring( /* DPSContext ctxt; char *s; */ );
-
-extern void DPSserialnumber( /* DPSContext ctxt; int *n; */ );
-
-extern void DPSsetXdrawingfunction( /* DPSContext ctxt; int function; */ );
-
-extern void DPSsetXgcdrawable( /* DPSContext ctxt; int gc, draw, x, y; */ );
-
-extern void DPSsetXgcdrawablecolor( /* DPSContext ctxt; int gc, draw, x, y, colorInfo[]; */ );
-
-extern void DPSsetXoffset( /* DPSContext ctxt; int x, y; */ );
-
-extern void DPSsetXrgbactual( /* DPSContext ctxt; float r, g, b; int *success; */ );
-
-extern void DPSsetbbox( /* DPSContext ctxt; float llx, lly, urx, ury; */ );
-
-extern void DPSsetblackgeneration( /* DPSContext ctxt; */ );
-
-extern void DPSsetcachedevice( /* DPSContext ctxt; float wx, wy, llx, lly, urx, ury; */ );
-
-extern void DPSsetcachelimit( /* DPSContext ctxt; int n; */ );
-
-extern void DPSsetcacheparams( /* DPSContext ctxt; */ );
-
-extern void DPSsetcharwidth( /* DPSContext ctxt; float wx, wy; */ );
-
-extern void DPSsetcmykcolor( /* DPSContext ctxt; float c, m, y, k; */ );
-
-extern void DPSsetcolor( /* DPSContext ctxt; */ );
-
-extern void DPSsetcolorrendering( /* DPSContext ctxt; */ );
-
-extern void DPSsetcolorscreen( /* DPSContext ctxt; */ );
-
-extern void DPSsetcolorspace( /* DPSContext ctxt; */ );
-
-extern void DPSsetcolortransfer( /* DPSContext ctxt; */ );
-
-extern void DPSsetdash( /* DPSContext ctxt; float pat[]; int size; float offset; */ );
-
-extern void DPSsetdevparams( /* DPSContext ctxt; */ );
-
-extern void DPSsetfileposition( /* DPSContext ctxt; int pos; */ );
-
-extern void DPSsetflat( /* DPSContext ctxt; float flatness; */ );
-
-extern void DPSsetfont( /* DPSContext ctxt; int f; */ );
-
-extern void DPSsetglobal( /* DPSContext ctxt; int b; */ );
-
-extern void DPSsetgray( /* DPSContext ctxt; float gray; */ );
-
-extern void DPSsetgstate( /* DPSContext ctxt; int gst; */ );
-
-extern void DPSsethalftone( /* DPSContext ctxt; */ );
-
-extern void DPSsethalftonephase( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPSsethsbcolor( /* DPSContext ctxt; float h, s, b; */ );
-
-extern void DPSsetlinecap( /* DPSContext ctxt; int linecap; */ );
-
-extern void DPSsetlinejoin( /* DPSContext ctxt; int linejoin; */ );
-
-extern void DPSsetlinewidth( /* DPSContext ctxt; float width; */ );
-
-extern void DPSsetmatrix( /* DPSContext ctxt; */ );
-
-extern void DPSsetmiterlimit( /* DPSContext ctxt; float limit; */ );
-
-extern void DPSsetobjectformat( /* DPSContext ctxt; int code; */ );
-
-extern void DPSsetoverprint( /* DPSContext ctxt; int b; */ );
-
-extern void DPSsetpacking( /* DPSContext ctxt; int b; */ );
-
-extern void DPSsetpagedevice( /* DPSContext ctxt; */ );
-
-extern void DPSsetpattern( /* DPSContext ctxt; */ );
-
-extern void DPSsetrgbcolor( /* DPSContext ctxt; float r, g, b; */ );
-
-extern void DPSsetscreen( /* DPSContext ctxt; */ );
-
-extern void DPSsetshared( /* DPSContext ctxt; int b; */ );
-
-extern void DPSsetstrokeadjust( /* DPSContext ctxt; int b; */ );
-
-extern void DPSsetsystemparams( /* DPSContext ctxt; */ );
-
-extern void DPSsettransfer( /* DPSContext ctxt; */ );
-
-extern void DPSsetucacheparams( /* DPSContext ctxt; */ );
-
-extern void DPSsetundercolorremoval( /* DPSContext ctxt; */ );
-
-extern void DPSsetuserparams( /* DPSContext ctxt; */ );
-
-extern void DPSsetvmthreshold( /* DPSContext ctxt; int i; */ );
-
-extern void DPSshareddict( /* DPSContext ctxt; */ );
-
-extern void DPSshow( /* DPSContext ctxt; char *s; */ );
-
-extern void DPSshowpage( /* DPSContext ctxt; */ );
-
-extern void DPSsin( /* DPSContext ctxt; */ );
-
-extern void DPSsqrt( /* DPSContext ctxt; */ );
-
-extern void DPSsrand( /* DPSContext ctxt; */ );
-
-extern void DPSstack( /* DPSContext ctxt; */ );
-
-extern void DPSstart( /* DPSContext ctxt; */ );
-
-extern void DPSstartjob( /* DPSContext ctxt; int b; char *password; */ );
-
-extern void DPSstatus( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSstatusdict( /* DPSContext ctxt; */ );
-
-extern void DPSstop( /* DPSContext ctxt; */ );
-
-extern void DPSstopped( /* DPSContext ctxt; */ );
-
-extern void DPSstore( /* DPSContext ctxt; */ );
-
-extern void DPSstring( /* DPSContext ctxt; int len; */ );
-
-extern void DPSstringwidth( /* DPSContext ctxt; char *s; float *xp, *yp; */ );
-
-extern void DPSstroke( /* DPSContext ctxt; */ );
-
-extern void DPSstrokepath( /* DPSContext ctxt; */ );
-
-extern void DPSsub( /* DPSContext ctxt; */ );
-
-extern void DPSsystemdict( /* DPSContext ctxt; */ );
-
-extern void DPStoken( /* DPSContext ctxt; int *b; */ );
-
-extern void DPStransform( /* DPSContext ctxt; float x1, y1; float *x2, *y2; */ );
-
-extern void DPStranslate( /* DPSContext ctxt; float x, y; */ );
-
-extern void DPStrue( /* DPSContext ctxt; */ );
-
-extern void DPStruncate( /* DPSContext ctxt; */ );
-
-extern void DPStype( /* DPSContext ctxt; */ );
-
-extern void DPSuappend( /* DPSContext ctxt; char nums[]; int n; char ops[]; int l; */ );
-
-extern void DPSucache( /* DPSContext ctxt; */ );
-
-extern void DPSucachestatus( /* DPSContext ctxt; */ );
-
-extern void DPSueofill( /* DPSContext ctxt; char nums[]; int n; char ops[]; int l; */ );
-
-extern void DPSufill( /* DPSContext ctxt; char nums[]; int n; char ops[]; int l; */ );
-
-extern void DPSundef( /* DPSContext ctxt; char *name; */ );
-
-extern void DPSundefinefont( /* DPSContext ctxt; char *name; */ );
-
-extern void DPSundefineresource( /* DPSContext ctxt; char *key, *category; */ );
-
-extern void DPSundefineuserobject( /* DPSContext ctxt; int userObjIndex; */ );
-
-extern void DPSupath( /* DPSContext ctxt; int b; */ );
-
-extern void DPSuserdict( /* DPSContext ctxt; */ );
-
-extern void DPSusertime( /* DPSContext ctxt; int *milliseconds; */ );
-
-extern void DPSustroke( /* DPSContext ctxt; char nums[]; int n; char ops[]; int l; */ );
-
-extern void DPSustrokepath( /* DPSContext ctxt; char nums[]; int n; char ops[]; int l; */ );
-
-extern void DPSversion( /* DPSContext ctxt; int bufsize; char buf[]; */ );
-
-extern void DPSviewclip( /* DPSContext ctxt; */ );
-
-extern void DPSviewclippath( /* DPSContext ctxt; */ );
-
-extern void DPSvmreclaim( /* DPSContext ctxt; int code; */ );
-
-extern void DPSvmstatus( /* DPSContext ctxt; int *level, *used, *maximum; */ );
-
-extern void DPSwait( /* DPSContext ctxt; */ );
-
-extern void DPSwcheck( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSwhere( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSwidthshow( /* DPSContext ctxt; float x, y; int c; char *s; */ );
-
-extern void DPSwrite( /* DPSContext ctxt; */ );
-
-extern void DPSwritehexstring( /* DPSContext ctxt; */ );
-
-extern void DPSwriteobject( /* DPSContext ctxt; int tag; */ );
-
-extern void DPSwritestring( /* DPSContext ctxt; */ );
-
-extern void DPSwtranslation( /* DPSContext ctxt; float *x, *y; */ );
-
-extern void DPSxcheck( /* DPSContext ctxt; int *b; */ );
-
-extern void DPSxor( /* DPSContext ctxt; */ );
-
-extern void DPSxshow( /* DPSContext ctxt; char *s; float numarray[]; int size; */ );
-
-extern void DPSxyshow( /* DPSContext ctxt; char *s; float numarray[]; int size; */ );
-
-extern void DPSyield( /* DPSContext ctxt; */ );
-
-extern void DPSyshow( /* DPSContext ctxt; char *s; float numarray[]; int size; */ );
-
-#else /* _NO_PROTO */
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-extern void DPSFontDirectory(DPSContext ctxt);
-
-extern void DPSGlobalFontDirectory(DPSContext ctxt);
-
-extern void DPSISOLatin1Encoding(DPSContext ctxt);
-
-extern void DPSSharedFontDirectory(DPSContext ctxt);
-
-extern void DPSStandardEncoding(DPSContext ctxt);
-
-extern void DPSUserObjects(DPSContext ctxt);
-
-extern void DPSabs(DPSContext ctxt);
-
-extern void DPSadd(DPSContext ctxt);
-
-extern void DPSaload(DPSContext ctxt);
-
-extern void DPSanchorsearch(DPSContext ctxt, int *truth);
-
-extern void DPSand(DPSContext ctxt);
-
-extern void DPSarc(DPSContext ctxt, float x, float y, float r, float angle1, float angle2);
-
-extern void DPSarcn(DPSContext ctxt, float x, float y, float r, float angle1, float angle2);
-
-extern void DPSarct(DPSContext ctxt, float x1, float y1, float x2, float y2, float r);
-
-extern void DPSarcto(DPSContext ctxt, float x1, float y1, float x2, float y2, float r, float *xt1, float *yt1, float *xt2, float *yt2);
-
-extern void DPSarray(DPSContext ctxt, int len);
-
-extern void DPSashow(DPSContext ctxt, float x, float y, const char *s);
-
-extern void DPSastore(DPSContext ctxt);
-
-extern void DPSatan(DPSContext ctxt);
-
-extern void DPSawidthshow(DPSContext ctxt, float cx, float cy, int c, float ax, float ay, const char *s);
-
-extern void DPSbanddevice(DPSContext ctxt);
-
-extern void DPSbegin(DPSContext ctxt);
-
-extern void DPSbind(DPSContext ctxt);
-
-extern void DPSbitshift(DPSContext ctxt, int shift);
-
-extern void DPSbytesavailable(DPSContext ctxt, int *n);
-
-extern void DPScachestatus(DPSContext ctxt);
-
-extern void DPSceiling(DPSContext ctxt);
-
-extern void DPScharpath(DPSContext ctxt, const char *s, int b);
-
-extern void DPSclear(DPSContext ctxt);
-
-extern void DPScleardictstack(DPSContext ctxt);
-
-extern void DPScleartomark(DPSContext ctxt);
-
-extern void DPSclientXready(DPSContext ctxt, int i0, int i1, int i2, int i3);
-
-extern void DPSclientsync(DPSContext ctxt);
-
-extern void DPSclip(DPSContext ctxt);
-
-extern void DPSclippath(DPSContext ctxt);
-
-extern void DPSclosefile(DPSContext ctxt);
-
-extern void DPSclosepath(DPSContext ctxt);
-
-extern void DPScolorimage(DPSContext ctxt);
-
-extern void DPSconcat(DPSContext ctxt, const float m[]);
-
-extern void DPSconcatmatrix(DPSContext ctxt);
-
-extern void DPScondition(DPSContext ctxt);
-
-extern void DPScopy(DPSContext ctxt, int n);
-
-extern void DPScopypage(DPSContext ctxt);
-
-extern void DPScos(DPSContext ctxt);
-
-extern void DPScount(DPSContext ctxt, int *n);
-
-extern void DPScountdictstack(DPSContext ctxt, int *n);
-
-extern void DPScountexecstack(DPSContext ctxt, int *n);
-
-extern void DPScounttomark(DPSContext ctxt, int *n);
-
-extern void DPScshow(DPSContext ctxt, const char *s);
-
-extern void DPScurrentXdrawingfunction(DPSContext ctxt, int *function);
-
-extern void DPScurrentXgcdrawable(DPSContext ctxt, int *gc, int *draw, int *x, int *y);
-
-extern void DPScurrentXgcdrawablecolor(DPSContext ctxt, int *gc, int *draw, int *x, int *y, int colorInfo[]);
-
-extern void DPScurrentXoffset(DPSContext ctxt, int *x, int *y);
-
-extern void DPScurrentblackgeneration(DPSContext ctxt);
-
-extern void DPScurrentcacheparams(DPSContext ctxt);
-
-extern void DPScurrentcmykcolor(DPSContext ctxt, float *c, float *m, float *y, float *k);
-
-extern void DPScurrentcolor(DPSContext ctxt);
-
-extern void DPScurrentcolorrendering(DPSContext ctxt);
-
-extern void DPScurrentcolorscreen(DPSContext ctxt);
-
-extern void DPScurrentcolorspace(DPSContext ctxt);
-
-extern void DPScurrentcolortransfer(DPSContext ctxt);
-
-extern void DPScurrentcontext(DPSContext ctxt, int *cid);
-
-extern void DPScurrentdash(DPSContext ctxt);
-
-extern void DPScurrentdevparams(DPSContext ctxt, const char *dev);
-
-extern void DPScurrentdict(DPSContext ctxt);
-
-extern void DPScurrentfile(DPSContext ctxt);
-
-extern void DPScurrentflat(DPSContext ctxt, float *flatness);
-
-extern void DPScurrentfont(DPSContext ctxt);
-
-extern void DPScurrentglobal(DPSContext ctxt, int *b);
-
-extern void DPScurrentgray(DPSContext ctxt, float *gray);
-
-extern void DPScurrentgstate(DPSContext ctxt, int gst);
-
-extern void DPScurrenthalftone(DPSContext ctxt);
-
-extern void DPScurrenthalftonephase(DPSContext ctxt, float *x, float *y);
-
-extern void DPScurrenthsbcolor(DPSContext ctxt, float *h, float *s, float *b);
-
-extern void DPScurrentlinecap(DPSContext ctxt, int *linecap);
-
-extern void DPScurrentlinejoin(DPSContext ctxt, int *linejoin);
-
-extern void DPScurrentlinewidth(DPSContext ctxt, float *width);
-
-extern void DPScurrentmatrix(DPSContext ctxt);
-
-extern void DPScurrentmiterlimit(DPSContext ctxt, float *limit);
-
-extern void DPScurrentobjectformat(DPSContext ctxt, int *code);
-
-extern void DPScurrentoverprint(DPSContext ctxt, int *b);
-
-extern void DPScurrentpacking(DPSContext ctxt, int *b);
-
-extern void DPScurrentpagedevice(DPSContext ctxt);
-
-extern void DPScurrentpoint(DPSContext ctxt, float *x, float *y);
-
-extern void DPScurrentrgbcolor(DPSContext ctxt, float *r, float *g, float *b);
-
-extern void DPScurrentscreen(DPSContext ctxt);
-
-extern void DPScurrentshared(DPSContext ctxt, int *b);
-
-extern void DPScurrentstrokeadjust(DPSContext ctxt, int *b);
-
-extern void DPScurrentsystemparams(DPSContext ctxt);
-
-extern void DPScurrenttransfer(DPSContext ctxt);
-
-extern void DPScurrentundercolorremoval(DPSContext ctxt);
-
-extern void DPScurrentuserparams(DPSContext ctxt);
-
-extern void DPScurveto(DPSContext ctxt, float x1, float y1, float x2, float y2, float x3, float y3);
-
-extern void DPScvi(DPSContext ctxt);
-
-extern void DPScvlit(DPSContext ctxt);
-
-extern void DPScvn(DPSContext ctxt);
-
-extern void DPScvr(DPSContext ctxt);
-
-extern void DPScvrs(DPSContext ctxt);
-
-extern void DPScvs(DPSContext ctxt);
-
-extern void DPScvx(DPSContext ctxt);
-
-extern void DPSdef(DPSContext ctxt);
-
-extern void DPSdefaultmatrix(DPSContext ctxt);
-
-extern void DPSdefinefont(DPSContext ctxt);
-
-extern void DPSdefineresource(DPSContext ctxt, const char *category);
-
-extern void DPSdefineusername(DPSContext ctxt, int i, const char *username);
-
-extern void DPSdefineuserobject(DPSContext ctxt);
-
-extern void DPSdeletefile(DPSContext ctxt, const char *filename);
-
-extern void DPSdetach(DPSContext ctxt);
-
-extern void DPSdeviceinfo(DPSContext ctxt);
-
-extern void DPSdict(DPSContext ctxt, int len);
-
-extern void DPSdictstack(DPSContext ctxt);
-
-extern void DPSdiv(DPSContext ctxt);
-
-extern void DPSdtransform(DPSContext ctxt, float x1, float y1, float *x2, float *y2);
-
-extern void DPSdup(DPSContext ctxt);
-
-extern void DPSecho(DPSContext ctxt, int b);
-
-extern void DPSend(DPSContext ctxt);
-
-extern void DPSeoclip(DPSContext ctxt);
-
-extern void DPSeofill(DPSContext ctxt);
-
-extern void DPSeoviewclip(DPSContext ctxt);
-
-extern void DPSeq(DPSContext ctxt);
-
-extern void DPSequals(DPSContext ctxt);
-
-extern void DPSequalsequals(DPSContext ctxt);
-
-extern void DPSerasepage(DPSContext ctxt);
-
-extern void DPSerrordict(DPSContext ctxt);
-
-extern void DPSexch(DPSContext ctxt);
-
-extern void DPSexec(DPSContext ctxt);
-
-extern void DPSexecform(DPSContext ctxt);
-
-extern void DPSexecstack(DPSContext ctxt);
-
-extern void DPSexecuserobject(DPSContext ctxt, int userObjIndex);
-
-extern void DPSexecuteonly(DPSContext ctxt);
-
-extern void DPSexit(DPSContext ctxt);
-
-extern void DPSexp(DPSContext ctxt);
-
-extern void DPSfalse(DPSContext ctxt);
-
-extern void DPSfile(DPSContext ctxt, const char *name, const char *access);
-
-extern void DPSfilenameforall(DPSContext ctxt);
-
-extern void DPSfileposition(DPSContext ctxt, int *pos);
-
-extern void DPSfill(DPSContext ctxt);
-
-extern void DPSfilter(DPSContext ctxt);
-
-extern void DPSfindencoding(DPSContext ctxt, const char *key);
-
-extern void DPSfindfont(DPSContext ctxt, const char *name);
-
-extern void DPSfindresource(DPSContext ctxt, const char *key, const char *category);
-
-extern void DPSflattenpath(DPSContext ctxt);
-
-extern void DPSfloor(DPSContext ctxt);
-
-extern void DPSflush(DPSContext ctxt);
-
-extern void DPSflushfile(DPSContext ctxt);
-
-extern void DPSfor(DPSContext ctxt);
-
-extern void DPSforall(DPSContext ctxt);
-
-extern void DPSfork(DPSContext ctxt);
-
-extern void DPSframedevice(DPSContext ctxt);
-
-extern void DPSgcheck(DPSContext ctxt, int *b);
-
-extern void DPSge(DPSContext ctxt);
-
-extern void DPSget(DPSContext ctxt);
-
-extern void DPSgetboolean(DPSContext ctxt, int *it);
-
-extern void DPSgetchararray(DPSContext ctxt, int size, char s[]);
-
-extern void DPSgetfloat(DPSContext ctxt, float *it);
-
-extern void DPSgetfloatarray(DPSContext ctxt, int size, float a[]);
-
-extern void DPSgetint(DPSContext ctxt, int *it);
-
-extern void DPSgetintarray(DPSContext ctxt, int size, int a[]);
-
-extern void DPSgetinterval(DPSContext ctxt);
-
-extern void DPSgetstring(DPSContext ctxt, char *s);
-
-extern void DPSglobaldict(DPSContext ctxt);
-
-extern void DPSglyphshow(DPSContext ctxt, const char *name);
-
-extern void DPSgrestore(DPSContext ctxt);
-
-extern void DPSgrestoreall(DPSContext ctxt);
-
-extern void DPSgsave(DPSContext ctxt);
-
-extern void DPSgstate(DPSContext ctxt);
-
-extern void DPSgt(DPSContext ctxt);
-
-extern void DPSidentmatrix(DPSContext ctxt);
-
-extern void DPSidiv(DPSContext ctxt);
-
-extern void DPSidtransform(DPSContext ctxt, float x1, float y1, float *x2, float *y2);
-
-extern void DPSif(DPSContext ctxt);
-
-extern void DPSifelse(DPSContext ctxt);
-
-extern void DPSimage(DPSContext ctxt);
-
-extern void DPSimagemask(DPSContext ctxt);
-
-extern void DPSindex(DPSContext ctxt, int i);
-
-extern void DPSineofill(DPSContext ctxt, float x, float y, int *b);
-
-extern void DPSinfill(DPSContext ctxt, float x, float y, int *b);
-
-extern void DPSinitclip(DPSContext ctxt);
-
-extern void DPSinitgraphics(DPSContext ctxt);
-
-extern void DPSinitmatrix(DPSContext ctxt);
-
-extern void DPSinitviewclip(DPSContext ctxt);
-
-extern void DPSinstroke(DPSContext ctxt, float x, float y, int *b);
-
-extern void DPSinueofill(DPSContext ctxt, float x, float y, const char nums[], int n, const char ops[], int l, int *b);
-
-extern void DPSinufill(DPSContext ctxt, float x, float y, const char nums[], int n, const char ops[], int l, int *b);
-
-extern void DPSinustroke(DPSContext ctxt, float x, float y, const char nums[], int n, const char ops[], int l, int *b);
-
-extern void DPSinvertmatrix(DPSContext ctxt);
-
-extern void DPSitransform(DPSContext ctxt, float x1, float y1, float *x2, float *y2);
-
-extern void DPSjoin(DPSContext ctxt);
-
-extern void DPSknown(DPSContext ctxt, int *b);
-
-extern void DPSkshow(DPSContext ctxt, const char *s);
-
-extern void DPSlanguagelevel(DPSContext ctxt, int *n);
-
-extern void DPSle(DPSContext ctxt);
-
-extern void DPSleftbracket(DPSContext ctxt);
-
-extern void DPSleftleft(DPSContext ctxt);
-
-extern void DPSlength(DPSContext ctxt, int *len);
-
-extern void DPSlineto(DPSContext ctxt, float x, float y);
-
-extern void DPSln(DPSContext ctxt);
-
-extern void DPSload(DPSContext ctxt);
-
-extern void DPSlock(DPSContext ctxt);
-
-extern void DPSlog(DPSContext ctxt);
-
-extern void DPSloop(DPSContext ctxt);
-
-extern void DPSlt(DPSContext ctxt);
-
-extern void DPSmakefont(DPSContext ctxt);
-
-extern void DPSmakepattern(DPSContext ctxt);
-
-extern void DPSmark(DPSContext ctxt);
-
-extern void DPSmatrix(DPSContext ctxt);
-
-extern void DPSmaxlength(DPSContext ctxt, int *len);
-
-extern void DPSmod(DPSContext ctxt);
-
-extern void DPSmonitor(DPSContext ctxt);
-
-extern void DPSmoveto(DPSContext ctxt, float x, float y);
-
-extern void DPSmul(DPSContext ctxt);
-
-extern void DPSne(DPSContext ctxt);
-
-extern void DPSneg(DPSContext ctxt);
-
-extern void DPSnewpath(DPSContext ctxt);
-
-extern void DPSnoaccess(DPSContext ctxt);
-
-extern void DPSnot(DPSContext ctxt);
-
-extern void DPSnotify(DPSContext ctxt);
-
-extern void DPSnull(DPSContext ctxt);
-
-extern void DPSnulldevice(DPSContext ctxt);
-
-extern void DPSor(DPSContext ctxt);
-
-extern void DPSpackedarray(DPSContext ctxt);
-
-extern void DPSpathbbox(DPSContext ctxt, float *llx, float *lly, float *urx, float *ury);
-
-extern void DPSpathforall(DPSContext ctxt);
-
-extern void DPSpop(DPSContext ctxt);
-
-extern void DPSprint(DPSContext ctxt);
-
-extern void DPSprintobject(DPSContext ctxt, int tag);
-
-extern void DPSproduct(DPSContext ctxt);
-
-extern void DPSprompt(DPSContext ctxt);
-
-extern void DPSpstack(DPSContext ctxt);
-
-extern void DPSput(DPSContext ctxt);
-
-extern void DPSputinterval(DPSContext ctxt);
-
-extern void DPSquit(DPSContext ctxt);
-
-extern void DPSrand(DPSContext ctxt);
-
-extern void DPSrcheck(DPSContext ctxt, int *b);
-
-extern void DPSrcurveto(DPSContext ctxt, float x1, float y1, float x2, float y2, float x3, float y3);
-
-extern void DPSread(DPSContext ctxt, int *b);
-
-extern void DPSreadhexstring(DPSContext ctxt, int *b);
-
-extern void DPSreadline(DPSContext ctxt, int *b);
-
-extern void DPSreadonly(DPSContext ctxt);
-
-extern void DPSreadstring(DPSContext ctxt, int *b);
-
-extern void DPSrealtime(DPSContext ctxt, int *i);
-
-extern void DPSrectclip(DPSContext ctxt, float x, float y, float w, float h);
-
-extern void DPSrectfill(DPSContext ctxt, float x, float y, float w, float h);
-
-extern void DPSrectstroke(DPSContext ctxt, float x, float y, float w, float h);
-
-extern void DPSrectviewclip(DPSContext ctxt, float x, float y, float w, float h);
-
-extern void DPSrenamefile(DPSContext ctxt, const char *oldname, const char *newname);
-
-extern void DPSrenderbands(DPSContext ctxt);
-
-extern void DPSrepeat(DPSContext ctxt);
-
-extern void DPSresetfile(DPSContext ctxt);
-
-extern void DPSresourceforall(DPSContext ctxt, const char *category);
-
-extern void DPSresourcestatus(DPSContext ctxt, const char *key, const char *category, int *b);
-
-extern void DPSrestore(DPSContext ctxt);
-
-extern void DPSreversepath(DPSContext ctxt);
-
-extern void DPSrevision(DPSContext ctxt, int *n);
-
-extern void DPSrightbracket(DPSContext ctxt);
-
-extern void DPSrightright(DPSContext ctxt);
-
-extern void DPSrlineto(DPSContext ctxt, float x, float y);
-
-extern void DPSrmoveto(DPSContext ctxt, float x, float y);
-
-extern void DPSroll(DPSContext ctxt, int n, int j);
-
-extern void DPSrootfont(DPSContext ctxt);
-
-extern void DPSrotate(DPSContext ctxt, float angle);
-
-extern void DPSround(DPSContext ctxt);
-
-extern void DPSrrand(DPSContext ctxt);
-
-extern void DPSrun(DPSContext ctxt, const char *filename);
-
-extern void DPSsave(DPSContext ctxt);
-
-extern void DPSscale(DPSContext ctxt, float x, float y);
-
-extern void DPSscalefont(DPSContext ctxt, float size);
-
-extern void DPSscheck(DPSContext ctxt, int *b);
-
-extern void DPSsearch(DPSContext ctxt, int *b);
-
-extern void DPSselectfont(DPSContext ctxt, const char *name, float scale);
-
-extern void DPSsendboolean(DPSContext ctxt, int it);
-
-extern void DPSsendchararray(DPSContext ctxt, const char s[], int size);
-
-extern void DPSsendfloat(DPSContext ctxt, float it);
-
-extern void DPSsendfloatarray(DPSContext ctxt, const float a[], int size);
-
-extern void DPSsendint(DPSContext ctxt, int it);
-
-extern void DPSsendintarray(DPSContext ctxt, const int a[], int size);
-
-extern void DPSsendstring(DPSContext ctxt, const char *s);
-
-extern void DPSserialnumber(DPSContext ctxt, int *n);
-
-extern void DPSsetXdrawingfunction(DPSContext ctxt, int function);
-
-extern void DPSsetXgcdrawable(DPSContext ctxt, int gc, int draw, int x, int y);
-
-extern void DPSsetXgcdrawablecolor(DPSContext ctxt, int gc, int draw, int x, int y, const int colorInfo[]);
-
-extern void DPSsetXoffset(DPSContext ctxt, int x, int y);
-
-extern void DPSsetXrgbactual(DPSContext ctxt, float r, float g, float b, int *success);
-
-extern void DPSsetbbox(DPSContext ctxt, float llx, float lly, float urx, float ury);
-
-extern void DPSsetblackgeneration(DPSContext ctxt);
-
-extern void DPSsetcachedevice(DPSContext ctxt, float wx, float wy, float llx, float lly, float urx, float ury);
-
-extern void DPSsetcachelimit(DPSContext ctxt, int n);
-
-extern void DPSsetcacheparams(DPSContext ctxt);
-
-extern void DPSsetcharwidth(DPSContext ctxt, float wx, float wy);
-
-extern void DPSsetcmykcolor(DPSContext ctxt, float c, float m, float y, float k);
-
-extern void DPSsetcolor(DPSContext ctxt);
-
-extern void DPSsetcolorrendering(DPSContext ctxt);
-
-extern void DPSsetcolorscreen(DPSContext ctxt);
-
-extern void DPSsetcolorspace(DPSContext ctxt);
-
-extern void DPSsetcolortransfer(DPSContext ctxt);
-
-extern void DPSsetdash(DPSContext ctxt, const float pat[], int size, float offset);
-
-extern void DPSsetdevparams(DPSContext ctxt);
-
-extern void DPSsetfileposition(DPSContext ctxt, int pos);
-
-extern void DPSsetflat(DPSContext ctxt, float flatness);
-
-extern void DPSsetfont(DPSContext ctxt, int f);
-
-extern void DPSsetglobal(DPSContext ctxt, int b);
-
-extern void DPSsetgray(DPSContext ctxt, float gray);
-
-extern void DPSsetgstate(DPSContext ctxt, int gst);
-
-extern void DPSsethalftone(DPSContext ctxt);
-
-extern void DPSsethalftonephase(DPSContext ctxt, float x, float y);
-
-extern void DPSsethsbcolor(DPSContext ctxt, float h, float s, float b);
-
-extern void DPSsetlinecap(DPSContext ctxt, int linecap);
-
-extern void DPSsetlinejoin(DPSContext ctxt, int linejoin);
-
-extern void DPSsetlinewidth(DPSContext ctxt, float width);
-
-extern void DPSsetmatrix(DPSContext ctxt);
-
-extern void DPSsetmiterlimit(DPSContext ctxt, float limit);
-
-extern void DPSsetobjectformat(DPSContext ctxt, int code);
-
-extern void DPSsetoverprint(DPSContext ctxt, int b);
-
-extern void DPSsetpacking(DPSContext ctxt, int b);
-
-extern void DPSsetpagedevice(DPSContext ctxt);
-
-extern void DPSsetpattern(DPSContext ctxt);
-
-extern void DPSsetrgbcolor(DPSContext ctxt, float r, float g, float b);
-
-extern void DPSsetscreen(DPSContext ctxt);
-
-extern void DPSsetshared(DPSContext ctxt, int b);
-
-extern void DPSsetstrokeadjust(DPSContext ctxt, int b);
-
-extern void DPSsetsystemparams(DPSContext ctxt);
-
-extern void DPSsettransfer(DPSContext ctxt);
-
-extern void DPSsetucacheparams(DPSContext ctxt);
-
-extern void DPSsetundercolorremoval(DPSContext ctxt);
-
-extern void DPSsetuserparams(DPSContext ctxt);
-
-extern void DPSsetvmthreshold(DPSContext ctxt, int i);
-
-extern void DPSshareddict(DPSContext ctxt);
-
-extern void DPSshow(DPSContext ctxt, const char *s);
-
-extern void DPSshowpage(DPSContext ctxt);
-
-extern void DPSsin(DPSContext ctxt);
-
-extern void DPSsqrt(DPSContext ctxt);
-
-extern void DPSsrand(DPSContext ctxt);
-
-extern void DPSstack(DPSContext ctxt);
-
-extern void DPSstart(DPSContext ctxt);
-
-extern void DPSstartjob(DPSContext ctxt, int b, const char *password);
-
-extern void DPSstatus(DPSContext ctxt, int *b);
-
-extern void DPSstatusdict(DPSContext ctxt);
-
-extern void DPSstop(DPSContext ctxt);
-
-extern void DPSstopped(DPSContext ctxt);
-
-extern void DPSstore(DPSContext ctxt);
-
-extern void DPSstring(DPSContext ctxt, int len);
-
-extern void DPSstringwidth(DPSContext ctxt, const char *s, float *xp, float *yp);
-
-extern void DPSstroke(DPSContext ctxt);
-
-extern void DPSstrokepath(DPSContext ctxt);
-
-extern void DPSsub(DPSContext ctxt);
-
-extern void DPSsystemdict(DPSContext ctxt);
-
-extern void DPStoken(DPSContext ctxt, int *b);
-
-extern void DPStransform(DPSContext ctxt, float x1, float y1, float *x2, float *y2);
-
-extern void DPStranslate(DPSContext ctxt, float x, float y);
-
-extern void DPStrue(DPSContext ctxt);
-
-extern void DPStruncate(DPSContext ctxt);
-
-extern void DPStype(DPSContext ctxt);
-
-extern void DPSuappend(DPSContext ctxt, const char nums[], int n, const char ops[], int l);
-
-extern void DPSucache(DPSContext ctxt);
-
-extern void DPSucachestatus(DPSContext ctxt);
-
-extern void DPSueofill(DPSContext ctxt, const char nums[], int n, const char ops[], int l);
-
-extern void DPSufill(DPSContext ctxt, const char nums[], int n, const char ops[], int l);
-
-extern void DPSundef(DPSContext ctxt, const char *name);
-
-extern void DPSundefinefont(DPSContext ctxt, const char *name);
-
-extern void DPSundefineresource(DPSContext ctxt, const char *key, const char *category);
-
-extern void DPSundefineuserobject(DPSContext ctxt, int userObjIndex);
-
-extern void DPSupath(DPSContext ctxt, int b);
-
-extern void DPSuserdict(DPSContext ctxt);
-
-extern void DPSusertime(DPSContext ctxt, int *milliseconds);
-
-extern void DPSustroke(DPSContext ctxt, const char nums[], int n, const char ops[], int l);
-
-extern void DPSustrokepath(DPSContext ctxt, const char nums[], int n, const char ops[], int l);
-
-extern void DPSversion(DPSContext ctxt, int bufsize, char buf[]);
-
-extern void DPSviewclip(DPSContext ctxt);
-
-extern void DPSviewclippath(DPSContext ctxt);
-
-extern void DPSvmreclaim(DPSContext ctxt, int code);
-
-extern void DPSvmstatus(DPSContext ctxt, int *level, int *used, int *maximum);
-
-extern void DPSwait(DPSContext ctxt);
-
-extern void DPSwcheck(DPSContext ctxt, int *b);
-
-extern void DPSwhere(DPSContext ctxt, int *b);
-
-extern void DPSwidthshow(DPSContext ctxt, float x, float y, int c, const char *s);
-
-extern void DPSwrite(DPSContext ctxt);
-
-extern void DPSwritehexstring(DPSContext ctxt);
-
-extern void DPSwriteobject(DPSContext ctxt, int tag);
-
-extern void DPSwritestring(DPSContext ctxt);
-
-extern void DPSwtranslation(DPSContext ctxt, float *x, float *y);
-
-extern void DPSxcheck(DPSContext ctxt, int *b);
-
-extern void DPSxor(DPSContext ctxt);
-
-extern void DPSxshow(DPSContext ctxt, const char *s, const float numarray[], int size);
-
-extern void DPSxyshow(DPSContext ctxt, const char *s, const float numarray[], int size);
-
-extern void DPSyield(DPSContext ctxt);
-
-extern void DPSyshow(DPSContext ctxt, const char *s, const float numarray[], int size);
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _NO_PROTO */
-
-#endif /* DPSOPS_H */
diff --git a/xc/lib/dps/dpsopstack.psw b/xc/lib/dps/dpsopstack.psw
deleted file mode 100644
index ac10d77c5..000000000
--- a/xc/lib/dps/dpsopstack.psw
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * dpsopstack.psw -- wrapped procedures for sending and getting operands
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSgetboolean(DPSContext ctxt | boolean *it)
- it
-endps
-
-defineps DPSgetchararray(DPSContext ctxt; int size | char s[size])
- s
-endps
-
-defineps DPSgetfloat(DPSContext ctxt | float *it)
- it
-endps
-
-defineps DPSgetfloatarray(DPSContext ctxt; int size | float a[size])
- dup type /arraytype eq { a } { size { a } repeat } ifelse
-endps
-
-defineps DPSgetint(DPSContext ctxt | int *it)
- it
-endps
-
-defineps DPSgetintarray(DPSContext ctxt; int size | int a[size])
- dup type /arraytype eq { a } { size { a } repeat } ifelse
-endps
-
-defineps DPSgetstring(DPSContext ctxt | char *s)
- s
-endps
-
-defineps DPSsendboolean(DPSContext ctxt; boolean it)
- it
-endps
-
-defineps DPSsendchararray(DPSContext ctxt; char s[size]; int size)
- (s)
-endps
-
-defineps DPSsendfloat(DPSContext ctxt; float it)
- it
-endps
-
-defineps DPSsendfloatarray(DPSContext ctxt; float a[size]; int size)
- a
-endps
-
-defineps DPSsendint(DPSContext ctxt; int it)
- it
-endps
-
-defineps DPSsendintarray(DPSContext ctxt; int a[size]; int size)
- a
-endps
-
-defineps DPSsendstring(DPSContext ctxt; char *s)
- (s)
-endps
-
-
-
diff --git a/xc/lib/dps/dpsos2.def b/xc/lib/dps/dpsos2.def
deleted file mode 100644
index 309481c16..000000000
--- a/xc/lib/dps/dpsos2.def
+++ /dev/null
@@ -1,854 +0,0 @@
-LIBRARY dps
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/dps/dpsos2.def,v 1.1 2000/04/05 18:13:21 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 131072
-EXPORTS
- CSDPSInit @ 1
- CSDPSHeadOfDpyExt @ 2
- DPSCAPChangeGC @ 3
- DPSCAPCreate @ 4
- DPSCAPDestroy @ 5
- DPSCAPOpenAgent @ 6
- DPSCAPStartUp @ 8
- DPSCAPWrite @ 9
- DPSCAPCloseDisplayProc @ 10
- DPSCAPCloseAgent @ 13
- DPSclientsync @ 14
- DPScurrentXgcdrawable @ 15
- DPScurrentXgcdrawablecolor @ 16
- DPScurrentXoffset @ 17
- DPSsetXgcdrawable @ 18
- DPSsetXgcdrawablecolor @ 19
- DPSsetXoffset @ 20
- DPSsetXrgbactual @ 21
- DPSclientXready @ 22
- DPSsetXdrawingfunction @ 23
- DPScurrentXdrawingfunction @ 24
- DPSWarnProc @ 25
- DPSFatalProc @ 26
- DPSCantHappen @ 27
- DPScolorimage @ 28
- DPScurrentblackgeneration @ 29
- DPScurrentcmykcolor @ 30
- DPScurrentcolorscreen @ 31
- DPScurrentcolortransfer @ 32
- DPScurrentundercolorremoval @ 33
- DPSsetblackgeneration @ 34
- DPSsetcmykcolor @ 35
- DPSsetcolorscreen @ 36
- DPSsetcolortransfer @ 37
- DPSsetundercolorremoval @ 38
- DPSeq @ 39
- DPSexit @ 40
- DPSfalse @ 41
- DPSfor @ 42
- DPSforall @ 43
- DPSge @ 44
- DPSgt @ 45
- DPSif @ 46
- DPSifelse @ 47
- DPSle @ 48
- DPSloop @ 49
- DPSlt @ 50
- DPSne @ 51
- DPSnot @ 52
- DPSor @ 53
- DPSrepeat @ 54
- DPSstop @ 55
- DPSstopped @ 56
- DPStrue @ 57
- DPSUserObjects @ 58
- DPScondition @ 59
- DPScurrentcontext @ 60
- DPScurrentobjectformat @ 61
- DPSdefineusername @ 62
- DPSdefineuserobject @ 63
- DPSdetach @ 64
- DPSexecuserobject @ 65
- DPSfork @ 66
- DPSjoin @ 67
- DPSlock @ 68
- DPSmonitor @ 69
- DPSnotify @ 70
- DPSsetobjectformat @ 71
- DPSsetvmthreshold @ 72
- DPSundefineuserobject @ 73
- DPSwait @ 74
- DPSyield @ 75
- DPSaload @ 76
- DPSanchorsearch @ 77
- DPSarray @ 78
- DPSastore @ 79
- DPSbegin @ 80
- DPSclear @ 81
- DPScleartomark @ 82
- DPScopy @ 83
- DPScount @ 84
- DPScounttomark @ 85
- DPScvi @ 86
- DPScvlit @ 87
- DPScvn @ 88
- DPScvr @ 89
- DPScvrs @ 90
- DPScvs @ 91
- DPScvx @ 92
- DPSdef @ 93
- DPSdict @ 94
- DPSdictstack @ 95
- DPSdup @ 96
- DPSend @ 97
- DPSexch @ 98
- DPSexecstack @ 99
- DPSexecuteonly @ 100
- DPSget @ 101
- DPSgetinterval @ 102
- DPSindex @ 103
- DPSknown @ 104
- DPSlength @ 105
- DPSload @ 106
- DPSmark @ 107
- DPSmatrix @ 108
- DPSmaxlength @ 109
- DPSnoaccess @ 110
- DPSnull @ 111
- DPSpackedarray @ 112
- DPSpop @ 113
- DPSput @ 114
- DPSputinterval @ 115
- DPSrcheck @ 116
- DPSreadonly @ 117
- DPSroll @ 118
- DPSscheck @ 119
- DPSsearch @ 120
- DPSshareddict @ 121
- DPSstatusdict @ 122
- DPSstore @ 123
- DPSstring @ 124
- DPSstringwidth @ 125
- DPSsystemdict @ 126
- DPSuserdict @ 127
- DPSwcheck @ 128
- DPSwhere @ 129
- DPSxcheck @ 130
- DPSCreatePSWDict @ 131
- DPSDestroyPSWDict @ 132
- DPSWDictLookup @ 133
- DPSWDictEnter @ 134
- DPSWDictRemove @ 135
- DPSMakeAtom @ 136
- DPSFontDirectory @ 137
- DPSISOLatin1Encoding @ 138
- DPSSharedFontDirectory @ 139
- DPSStandardEncoding @ 140
- DPScachestatus @ 141
- DPScurrentcacheparams @ 142
- DPScurrentfont @ 143
- DPSdefinefont @ 144
- DPSfindfont @ 145
- DPSmakefont @ 146
- DPSscalefont @ 147
- DPSselectfont @ 148
- DPSsetcachedevice @ 149
- DPSsetcachelimit @ 150
- DPSsetcacheparams @ 151
- DPSsetcharwidth @ 152
- DPSsetfont @ 153
- DPSundefinefont @ 154
- DPSconcat @ 155
- DPScurrentdash @ 156
- DPScurrentflat @ 157
- DPScurrentgray @ 158
- DPScurrentgstate @ 159
- DPScurrenthalftone @ 160
- DPScurrenthalftonephase @ 161
- DPScurrenthsbcolor @ 162
- DPScurrentlinecap @ 163
- DPScurrentlinejoin @ 164
- DPScurrentlinewidth @ 165
- DPScurrentmatrix @ 166
- DPScurrentmiterlimit @ 167
- DPScurrentpoint @ 168
- DPScurrentrgbcolor @ 169
- DPScurrentscreen @ 170
- DPScurrentstrokeadjust @ 171
- DPScurrenttransfer @ 172
- DPSdefaultmatrix @ 173
- DPSgrestore @ 174
- DPSgrestoreall @ 175
- DPSgsave @ 176
- DPSgstate @ 177
- DPSinitgraphics @ 178
- DPSinitmatrix @ 179
- DPSrotate @ 180
- DPSscale @ 181
- DPSsetdash @ 182
- DPSsetflat @ 183
- DPSsetgray @ 184
- DPSsetgstate @ 185
- DPSsethalftone @ 186
- DPSsethalftonephase @ 187
- DPSsethsbcolor @ 188
- DPSsetlinecap @ 189
- DPSsetlinejoin @ 190
- DPSsetlinewidth @ 191
- DPSsetmatrix @ 192
- DPSsetmiterlimit @ 193
- DPSsetrgbcolor @ 194
- DPSsetscreen @ 195
- DPSsetstrokeadjust @ 196
- DPSsettransfer @ 197
- DPStranslate @ 198
- DPSclientPrintProc @ 199
- DPSinnerProcWriteData @ 200
- DPSSafeSetLastNameIndex @ 201
- DPSCheckInitClientGlobals @ 202
- DPSPrivateCheckWait @ 203
- DPSPrivateDestroyContext @ 204
- DPSPrivateDestroySpace @ 205
- DPSCheckShared @ 206
- DPSDefaultPrivateHandler @ 207
- DPSCreateContext @ 208
- DPSInitCommonTextContextProcs @ 209
- DPSInitCommonContextProcs @ 210
- DPSInitPrivateContextProcs @ 211
- DPSInitPrivateContextFields @ 212
- DPSInitPrivateTextContextFields @ 213
- DPSInitCommonSpaceProcs @ 214
- DPSInitPrivateSpaceFields @ 215
- DPSequals @ 216
- DPSequalsequals @ 217
- DPSbytesavailable @ 218
- DPSclosefile @ 219
- DPScurrentfile @ 220
- DPSdeletefile @ 221
- DPSecho @ 222
- DPSfile @ 223
- DPSfilenameforall @ 224
- DPSfileposition @ 225
- DPSflush @ 226
- DPSflushfile @ 227
- DPSprint @ 228
- DPSprintobject @ 229
- DPSpstack @ 230
- DPSread @ 231
- DPSreadhexstring @ 232
- DPSreadline @ 233
- DPSreadstring @ 234
- DPSrenamefile @ 235
- DPSresetfile @ 236
- DPSsetfileposition @ 237
- DPSstack @ 238
- DPSstatus @ 239
- DPStoken @ 240
- DPSwrite @ 241
- DPSwritehexstring @ 242
- DPSwriteobject @ 243
- DPSwritestring @ 244
- DPSleftbracket @ 245
- DPSrightbracket @ 246
- DPSleftleft @ 247
- DPSrightright @ 248
- DPScshow @ 249
- DPScurrentcolor @ 250
- DPScurrentcolorrendering @ 251
- DPScurrentcolorspace @ 252
- DPScurrentdevparams @ 253
- DPScurrentglobal @ 254
- DPScurrentoverprint @ 255
- DPScurrentpagedevice @ 256
- DPScurrentsystemparams @ 257
- DPScurrentuserparams @ 258
- DPSdefineresource @ 259
- DPSexecform @ 260
- DPSfilter @ 261
- DPSfindencoding @ 262
- DPSfindresource @ 263
- DPSgcheck @ 264
- DPSglobaldict @ 265
- DPSGlobalFontDirectory @ 266
- DPSglyphshow @ 267
- DPSlanguagelevel @ 268
- DPSmakepattern @ 269
- DPSproduct @ 270
- DPSresourceforall @ 271
- DPSresourcestatus @ 272
- DPSrevision @ 273
- DPSrootfont @ 274
- DPSserialnumber @ 275
- DPSsetcolor @ 276
- DPSsetcolorrendering @ 277
- DPSsetcolorspace @ 278
- DPSsetdevparams @ 279
- DPSsetglobal @ 280
- DPSsetoverprint @ 281
- DPSsetpagedevice @ 282
- DPSsetpattern @ 283
- DPSsetsystemparams @ 284
- DPSsetuserparams @ 285
- DPSstartjob @ 286
- DPSundefineresource @ 287
- DPSabs @ 288
- DPSadd @ 289
- DPSand @ 290
- DPSatan @ 291
- DPSbitshift @ 292
- DPSceiling @ 293
- DPScos @ 294
- DPSdiv @ 295
- DPSexp @ 296
- DPSfloor @ 297
- DPSidiv @ 298
- DPSln @ 299
- DPSlog @ 300
- DPSmod @ 301
- DPSmul @ 302
- DPSneg @ 303
- DPSround @ 304
- DPSsin @ 305
- DPSsqrt @ 306
- DPSsub @ 307
- DPStruncate @ 308
- DPSxor @ 309
- DPSbanddevice @ 310
- DPSframedevice @ 311
- DPSnulldevice @ 312
- DPSrenderbands @ 313
- DPSconcatmatrix @ 314
- DPSdtransform @ 315
- DPSidentmatrix @ 316
- DPSidtransform @ 317
- DPSinvertmatrix @ 318
- DPSitransform @ 319
- DPStransform @ 320
- DPSgetboolean @ 321
- DPSgetchararray @ 322
- DPSgetfloat @ 323
- DPSgetfloatarray @ 324
- DPSgetint @ 325
- DPSgetintarray @ 326
- DPSgetstring @ 327
- DPSsendboolean @ 328
- DPSsendchararray @ 329
- DPSsendfloat @ 330
- DPSsendfloatarray @ 331
- DPSsendint @ 332
- DPSsendintarray @ 333
- DPSsendstring @ 334
- DPSarc @ 335
- DPSarcn @ 336
- DPSarct @ 337
- DPSarcto @ 338
- DPScharpath @ 339
- DPSclip @ 340
- DPSclippath @ 341
- DPSclosepath @ 342
- DPScurveto @ 343
- DPSeoclip @ 344
- DPSeoviewclip @ 345
- DPSflattenpath @ 346
- DPSinitclip @ 347
- DPSinitviewclip @ 348
- DPSlineto @ 349
- DPSmoveto @ 350
- DPSnewpath @ 351
- DPSpathbbox @ 352
- DPSpathforall @ 353
- DPSrcurveto @ 354
- DPSrectclip @ 355
- DPSrectviewclip @ 356
- DPSreversepath @ 357
- DPSrlineto @ 358
- DPSrmoveto @ 359
- DPSsetbbox @ 360
- DPSsetucacheparams @ 361
- DPSuappend @ 362
- DPSucache @ 363
- DPSucachestatus @ 364
- DPSupath @ 365
- DPSviewclip @ 366
- DPSviewclippath @ 367
- DPSashow @ 368
- DPSawidthshow @ 369
- DPScopypage @ 370
- DPSeofill @ 371
- DPSerasepage @ 372
- DPSfill @ 373
- DPSimage @ 374
- DPSimagemask @ 375
- DPSkshow @ 376
- DPSrectfill @ 377
- DPSrectstroke @ 378
- DPSshow @ 379
- DPSshowpage @ 380
- DPSstroke @ 381
- DPSstrokepath @ 382
- DPSueofill @ 383
- DPSufill @ 384
- DPSustroke @ 385
- DPSustrokepath @ 386
- DPSwidthshow @ 387
- DPSxshow @ 388
- DPSxyshow @ 389
- DPSyshow @ 390
- DPSInitClient @ 391
- DPSIncludePrivContext @ 392
- DPSSendPostScript @ 393
- DPSSendInterrupt @ 394
- DPSSendEOF @ 395
- DPSSendTerminate @ 396
- DPSSendDestroySpace @ 397
- DPSCheckRaiseError @ 399
- DPSInitSysNames @ 400
- DPSSetWh @ 401
- DPSOutOfMemory @ 402
- DPSbind @ 403
- DPScleardictstack @ 404
- DPScountdictstack @ 405
- DPScountexecstack @ 406
- DPScurrentdict @ 407
- DPScurrentpacking @ 408
- DPScurrentshared @ 409
- DPSdeviceinfo @ 410
- DPSerrordict @ 411
- DPSexec @ 412
- DPSprompt @ 413
- DPSquit @ 414
- DPSrand @ 415
- DPSrealtime @ 416
- DPSrestore @ 417
- DPSrrand @ 418
- DPSrun @ 419
- DPSsave @ 420
- DPSsetpacking @ 421
- DPSsetshared @ 422
- DPSsrand @ 423
- DPSstart @ 424
- DPStype @ 425
- DPSundef @ 426
- DPSusertime @ 427
- DPSversion @ 428
- DPSvmreclaim @ 429
- DPSvmstatus @ 430
- DPSineofill @ 431
- DPSinfill @ 432
- DPSinstroke @ 433
- DPSinueofill @ 434
- DPSinufill @ 435
- DPSinustroke @ 436
- DPSwtranslation @ 437
- PSclientsync @ 438
- PScurrentXgcdrawable @ 439
- PScurrentXgcdrawablecolor @ 440
- PScurrentXoffset @ 441
- PSsetXgcdrawable @ 442
- PSsetXgcdrawablecolor @ 443
- PSsetXoffset @ 444
- PSsetXrgbactual @ 445
- PSclientXready @ 446
- PSsetXdrawingfunction @ 447
- PScurrentXdrawingfunction @ 448
- PScolorimage @ 449
- PScurrentblackgeneration @ 450
- PScurrentcmykcolor @ 451
- PScurrentcolorscreen @ 452
- PScurrentcolortransfer @ 453
- PScurrentundercolorremoval @ 454
- PSsetblackgeneration @ 455
- PSsetcmykcolor @ 456
- PSsetcolorscreen @ 457
- PSsetcolortransfer @ 458
- PSsetundercolorremoval @ 459
- PSeq @ 460
- PSexit @ 461
- PSfalse @ 462
- PSfor @ 463
- PSforall @ 464
- PSge @ 465
- PSgt @ 466
- PSif @ 467
- PSifelse @ 468
- PSle @ 469
- PSloop @ 470
- PSlt @ 471
- PSne @ 472
- PSnot @ 473
- PSor @ 474
- PSrepeat @ 475
- PSstop @ 476
- PSstopped @ 477
- PStrue @ 478
- PSUserObjects @ 479
- PScondition @ 480
- PScurrentcontext @ 481
- PScurrentobjectformat @ 482
- PSdefineusername @ 483
- PSdefineuserobject @ 484
- PSdetach @ 485
- PSexecuserobject @ 486
- PSfork @ 487
- PSjoin @ 488
- PSlock @ 489
- PSmonitor @ 490
- PSnotify @ 491
- PSsetobjectformat @ 492
- PSsetvmthreshold @ 493
- PSundefineuserobject @ 494
- PSwait @ 495
- PSyield @ 496
- PSaload @ 497
- PSanchorsearch @ 498
- PSarray @ 499
- PSastore @ 500
- PSbegin @ 501
- PSclear @ 502
- PScleartomark @ 503
- PScopy @ 504
- PScount @ 505
- PScounttomark @ 506
- PScvi @ 507
- PScvlit @ 508
- PScvn @ 509
- PScvr @ 510
- PScvrs @ 511
- PScvs @ 512
- PScvx @ 513
- PSdef @ 514
- PSdict @ 515
- PSdictstack @ 516
- PSdup @ 517
- PSend @ 518
- PSexch @ 519
- PSexecstack @ 520
- PSexecuteonly @ 521
- PSget @ 522
- PSgetinterval @ 523
- PSindex @ 524
- PSknown @ 525
- PSlength @ 526
- PSload @ 527
- PSmark @ 528
- PSmatrix @ 529
- PSmaxlength @ 530
- PSnoaccess @ 531
- PSnull @ 532
- PSpackedarray @ 533
- PSpop @ 534
- PSput @ 535
- PSputinterval @ 536
- PSrcheck @ 537
- PSreadonly @ 538
- PSroll @ 539
- PSscheck @ 540
- PSsearch @ 541
- PSshareddict @ 542
- PSstatusdict @ 543
- PSstore @ 544
- PSstring @ 545
- PSstringwidth @ 546
- PSsystemdict @ 547
- PSuserdict @ 548
- PSwcheck @ 549
- PSwhere @ 550
- PSxcheck @ 551
- PSFontDirectory @ 552
- PSISOLatin1Encoding @ 553
- PSSharedFontDirectory @ 554
- PSStandardEncoding @ 555
- PScachestatus @ 556
- PScurrentcacheparams @ 557
- PScurrentfont @ 558
- PSdefinefont @ 559
- PSfindfont @ 560
- PSmakefont @ 561
- PSscalefont @ 562
- PSselectfont @ 563
- PSsetcachedevice @ 564
- PSsetcachelimit @ 565
- PSsetcacheparams @ 566
- PSsetcharwidth @ 567
- PSsetfont @ 568
- PSundefinefont @ 569
- PSconcat @ 570
- PScurrentdash @ 571
- PScurrentflat @ 572
- PScurrentgray @ 573
- PScurrentgstate @ 574
- PScurrenthalftone @ 575
- PScurrenthalftonephase @ 576
- PScurrenthsbcolor @ 577
- PScurrentlinecap @ 578
- PScurrentlinejoin @ 579
- PScurrentlinewidth @ 580
- PScurrentmatrix @ 581
- PScurrentmiterlimit @ 582
- PScurrentpoint @ 583
- PScurrentrgbcolor @ 584
- PScurrentscreen @ 585
- PScurrentstrokeadjust @ 586
- PScurrenttransfer @ 587
- PSdefaultmatrix @ 588
- PSgrestore @ 589
- PSgrestoreall @ 590
- PSgsave @ 591
- PSgstate @ 592
- PSinitgraphics @ 593
- PSinitmatrix @ 594
- PSrotate @ 595
- PSscale @ 596
- PSsetdash @ 597
- PSsetflat @ 598
- PSsetgray @ 599
- PSsetgstate @ 600
- PSsethalftone @ 601
- PSsethalftonephase @ 602
- PSsethsbcolor @ 603
- PSsetlinecap @ 604
- PSsetlinejoin @ 605
- PSsetlinewidth @ 606
- PSsetmatrix @ 607
- PSsetmiterlimit @ 608
- PSsetrgbcolor @ 609
- PSsetscreen @ 610
- PSsetstrokeadjust @ 611
- PSsettransfer @ 612
- PStranslate @ 613
- PSequals @ 614
- PSequalsequals @ 615
- PSbytesavailable @ 616
- PSclosefile @ 617
- PScurrentfile @ 618
- PSdeletefile @ 619
- PSecho @ 620
- PSfile @ 621
- PSfilenameforall @ 622
- PSfileposition @ 623
- PSflush @ 624
- PSflushfile @ 625
- PSprint @ 626
- PSprintobject @ 627
- PSpstack @ 628
- PSread @ 629
- PSreadhexstring @ 630
- PSreadline @ 631
- PSreadstring @ 632
- PSrenamefile @ 633
- PSresetfile @ 634
- PSsetfileposition @ 635
- PSstack @ 636
- PSstatus @ 637
- PStoken @ 638
- PSwrite @ 639
- PSwritehexstring @ 640
- PSwriteobject @ 641
- PSwritestring @ 642
- PSleftbracket @ 643
- PSrightbracket @ 644
- PSleftleft @ 645
- PSrightright @ 646
- PScshow @ 647
- PScurrentcolor @ 648
- PScurrentcolorrendering @ 649
- PScurrentcolorspace @ 650
- PScurrentdevparams @ 651
- PScurrentglobal @ 652
- PScurrentoverprint @ 653
- PScurrentpagedevice @ 654
- PScurrentsystemparams @ 655
- PScurrentuserparams @ 656
- PSdefineresource @ 657
- PSexecform @ 658
- PSfilter @ 659
- PSfindencoding @ 660
- PSfindresource @ 661
- PSgcheck @ 662
- PSglobaldict @ 663
- PSGlobalFontDirectory @ 664
- PSglyphshow @ 665
- PSlanguagelevel @ 666
- PSmakepattern @ 667
- PSproduct @ 668
- PSresourceforall @ 669
- PSresourcestatus @ 670
- PSrevision @ 671
- PSrootfont @ 672
- PSserialnumber @ 673
- PSsetcolor @ 674
- PSsetcolorrendering @ 675
- PSsetcolorspace @ 676
- PSsetdevparams @ 677
- PSsetglobal @ 678
- PSsetoverprint @ 679
- PSsetpagedevice @ 680
- PSsetpattern @ 681
- PSsetsystemparams @ 682
- PSsetuserparams @ 683
- PSstartjob @ 684
- PSundefineresource @ 685
- PSabs @ 686
- PSadd @ 687
- PSand @ 688
- PSatan @ 689
- PSbitshift @ 690
- PSceiling @ 691
- PScos @ 692
- PSdiv @ 693
- PSexp @ 694
- PSfloor @ 695
- PSidiv @ 696
- PSln @ 697
- PSlog @ 698
- PSmod @ 699
- PSmul @ 700
- PSneg @ 701
- PSround @ 702
- PSsin @ 703
- PSsqrt @ 704
- PSsub @ 705
- PStruncate @ 706
- PSxor @ 707
- PSbanddevice @ 708
- PSframedevice @ 709
- PSnulldevice @ 710
- PSrenderbands @ 711
- PSconcatmatrix @ 712
- PSdtransform @ 713
- PSidentmatrix @ 714
- PSidtransform @ 715
- PSinvertmatrix @ 716
- PSitransform @ 717
- PStransform @ 718
- PSgetboolean @ 719
- PSgetchararray @ 720
- PSgetfloat @ 721
- PSgetfloatarray @ 722
- PSgetint @ 723
- PSgetintarray @ 724
- PSgetstring @ 725
- PSsendboolean @ 726
- PSsendchararray @ 727
- PSsendfloat @ 728
- PSsendfloatarray @ 729
- PSsendint @ 730
- PSsendintarray @ 731
- PSsendstring @ 732
- PSarc @ 733
- PSarcn @ 734
- PSarct @ 735
- PSarcto @ 736
- PScharpath @ 737
- PSclip @ 738
- PSclippath @ 739
- PSclosepath @ 740
- PScurveto @ 741
- PSeoclip @ 742
- PSeoviewclip @ 743
- PSflattenpath @ 744
- PSinitclip @ 745
- PSinitviewclip @ 746
- PSlineto @ 747
- PSmoveto @ 748
- PSnewpath @ 749
- PSpathbbox @ 750
- PSpathforall @ 751
- PSrcurveto @ 752
- PSrectclip @ 753
- PSrectviewclip @ 754
- PSreversepath @ 755
- PSrlineto @ 756
- PSrmoveto @ 757
- PSsetbbox @ 758
- PSsetucacheparams @ 759
- PSuappend @ 760
- PSucache @ 761
- PSucachestatus @ 762
- PSupath @ 763
- PSviewclip @ 764
- PSviewclippath @ 765
- PSashow @ 766
- PSawidthshow @ 767
- PScopypage @ 768
- PSeofill @ 769
- PSerasepage @ 770
- PSfill @ 771
- PSimage @ 772
- PSimagemask @ 773
- PSkshow @ 774
- PSrectfill @ 775
- PSrectstroke @ 776
- PSshow @ 777
- PSshowpage @ 778
- PSstroke @ 779
- PSstrokepath @ 780
- PSueofill @ 781
- PSufill @ 782
- PSustroke @ 783
- PSustrokepath @ 784
- PSwidthshow @ 785
- PSxshow @ 786
- PSxyshow @ 787
- PSyshow @ 788
- PSbind @ 789
- PScleardictstack @ 790
- PScountdictstack @ 791
- PScountexecstack @ 792
- PScurrentdict @ 793
- PScurrentpacking @ 794
- PScurrentshared @ 795
- PSdeviceinfo @ 796
- PSerrordict @ 797
- PSexec @ 798
- PSprompt @ 799
- PSquit @ 800
- PSrand @ 801
- PSrealtime @ 802
- PSrestore @ 803
- PSrrand @ 804
- PSrun @ 805
- PSsave @ 806
- PSsetpacking @ 807
- PSsetshared @ 808
- PSsrand @ 809
- PSstart @ 810
- PStype @ 811
- PSundef @ 812
- PSusertime @ 813
- PSversion @ 814
- PSvmreclaim @ 815
- PSvmstatus @ 816
- PSineofill @ 817
- PSinfill @ 818
- PSinstroke @ 819
- PSinueofill @ 820
- PSinufill @ 821
- PSinustroke @ 822
- PSwtranslation @ 823
- XDPSLInit @824
- DPSWriteStringChars @ 825
- XDPSUnfreezeContext @ 826
- DPSGetCurrentContext @ 827
- DPSAwaitReturnValues @ 828
- DPSNewUserObjectIndex @ 829
- XDPSGetContextStatus @ 830
- XDPSRegisterStatusProc @ 831
- DPSDefaultTextBackstop @ 832
- DPSMapNames @ 833
- XDPSGetDefaultColorMaps @ 834
- XDPSCreateSimpleContext @ 835
- DPSGenerateExtensionRecID @ 836
- DPSWaitContext @ 837
- DPSAddContextExtensionRec @ 838
- DPSGetContextExtensionRec @ 839
- DPSChainContext @ 840
- DPSDestroySpace @ 841
- DPSUnchainContext @ 842
- DPSBinObjSeqWrite @ 843
- DPSSetResultTable @ 844
- XDPSSetStatusMask @ 845
- XDPSXIDFromContext @ 846
- DPSWritePostScript @ 847
- DPSRemoveContextExtensionRec @ 848
- DPSDefaultErrorProc @ 849
- DPSCreateTextContext @ 850
diff --git a/xc/lib/dps/dpsos2.rsp b/xc/lib/dps/dpsos2.rsp
deleted file mode 100644
index f920c7f81..000000000
--- a/xc/lib/dps/dpsos2.rsp
+++ /dev/null
@@ -1,13 +0,0 @@
-XDPS.obj csconndi.obj csfindNX.obj cslibext.obj cslibint.obj csopendi.obj+
-csstartNX.obj dpsXclient.obj dpsXcmu.obj dpsXops.obj dpsXpriv.obj+
-dpsXtdisp.obj dpsabbrev.obj dpsclient.obj dpsclrops.obj dpsctrlops.obj+
-dpsctxtops.obj dpsdataops.obj dpsdict.obj dpsexcept.obj dpsfontops.obj+
-dpsgsttops.obj dpsioops.obj dpsl2ops.obj dpsmathops.obj dpsmiscops.obj+
-dpsmtrxops.obj dpsopstack.obj dpspathops.obj dpspntops.obj dpsprintf.obj+
-dpssysnames.obj dpssysops.obj dpswinops.obj psXops.obj psclrops.obj+
-psctrlops.obj psctxtops.obj psdataops.obj psfontops.obj psgsttops.obj+
-psioops.obj psl2ops.obj psmathops.obj psmiscops.obj psmtrxops.obj+
-psopstack.obj pspathops.obj pspntops.obj pssysops.obj pswinops.obj+
-/NOI /NOL /NOD /BAT
-dps.dll
-dps.map
diff --git a/xc/lib/dps/dpspathops.psw b/xc/lib/dps/dpspathops.psw
deleted file mode 100644
index 7c0ed7600..000000000
--- a/xc/lib/dps/dpspathops.psw
+++ /dev/null
@@ -1,169 +0,0 @@
-/* dpspathops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSarc(DPSContext ctxt; float x, y, r, angle1, angle2)
- x y r angle1 angle2 arc
-endps
-
-defineps DPSarcn(DPSContext ctxt; float x, y, r, angle1, angle2)
- x y r angle1 angle2 arcn
-endps
-
-defineps DPSarct(DPSContext ctxt; float x1, y1, x2, y2, r)
- x1 y1 x2 y2 r arct
-endps
-
-defineps DPSarcto(DPSContext ctxt; float x1, y1, x2, y2, r | float *xt1, *yt1, *xt2, *yt2)
- x1 y1 x2 y2 r arcto yt2 xt2 yt1 xt1
-endps
-
-defineps DPScharpath(DPSContext ctxt; char *s; boolean b)
- (s) b charpath
-endps
-
-defineps DPSclip(DPSContext ctxt)
- clip
-endps
-
-defineps DPSclippath(DPSContext ctxt)
- clippath
-endps
-
-defineps DPSclosepath(DPSContext ctxt)
- closepath
-endps
-
-defineps DPScurveto(DPSContext ctxt; float x1, y1, x2, y2, x3, y3)
- x1 y1 x2 y2 x3 y3 curveto
-endps
-
-defineps DPSeoclip(DPSContext ctxt)
- eoclip
-endps
-
-defineps DPSeoviewclip(DPSContext ctxt)
- eoviewclip
-endps
-
-defineps DPSflattenpath(DPSContext ctxt)
- flattenpath
-endps
-
-defineps DPSinitclip(DPSContext ctxt)
- initclip
-endps
-
-defineps DPSinitviewclip(DPSContext ctxt)
- initviewclip
-endps
-
-defineps DPSlineto(DPSContext ctxt; float x, y)
- x y lineto
-endps
-
-defineps DPSmoveto(DPSContext ctxt; float x, y)
- x y moveto
-endps
-
-defineps DPSnewpath(DPSContext ctxt)
- newpath
-endps
-
-defineps DPSpathbbox(DPSContext ctxt | float *llx, *lly, *urx, *ury)
- pathbbox ury urx lly llx
-endps
-
-defineps DPSpathforall(DPSContext ctxt)
- pathforall
-endps
-
-defineps DPSrcurveto(DPSContext ctxt; float x1, y1, x2, y2, x3, y3)
- x1 y1 x2 y2 x3 y3 rcurveto
-endps
-
-defineps DPSrectclip(DPSContext ctxt; float x, y, w, h)
- x y w h rectclip
-endps
-
-defineps DPSrectviewclip(DPSContext ctxt; float x, y, w, h)
- x y w h rectviewclip
-endps
-
-defineps DPSreversepath(DPSContext ctxt)
- reversepath
-endps
-
-defineps DPSrlineto(DPSContext ctxt; float x, y)
- x y rlineto
-endps
-
-defineps DPSrmoveto(DPSContext ctxt; float x, y)
- x y rmoveto
-endps
-
-defineps DPSsetbbox(DPSContext ctxt; float llx, lly, urx, ury)
- llx lly urx ury setbbox
-endps
-
-defineps DPSsetucacheparams(DPSContext ctxt)
- setucacheparams
-endps
-
-defineps DPSuappend(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] uappend
-endps
-
-defineps DPSucache(DPSContext ctxt)
- ucache
-endps
-
-defineps DPSucachestatus(DPSContext ctxt)
- ucachestatus
-endps
-
-defineps DPSupath(DPSContext ctxt; boolean b)
- b upath
-endps
-
-defineps DPSviewclip(DPSContext ctxt)
- viewclip
-endps
-
-defineps DPSviewclippath(DPSContext ctxt)
- viewclippath
-endps
-
diff --git a/xc/lib/dps/dpspntops.psw b/xc/lib/dps/dpspntops.psw
deleted file mode 100644
index e57de4997..000000000
--- a/xc/lib/dps/dpspntops.psw
+++ /dev/null
@@ -1,129 +0,0 @@
-/* dpspntops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSashow(DPSContext ctxt; float x, y; char *s)
- x y (s) ashow
-endps
-
-defineps DPSawidthshow(DPSContext ctxt; float cx, cy; int c; float ax, ay; char *s)
- cx cy c ax ay (s) awidthshow
-endps
-
-defineps DPScopypage(DPSContext ctxt)
- copypage
-endps
-
-defineps DPSeofill(DPSContext ctxt)
- eofill
-endps
-
-defineps DPSerasepage(DPSContext ctxt)
- erasepage
-endps
-
-defineps DPSfill(DPSContext ctxt)
- fill
-endps
-
-defineps DPSimage(DPSContext ctxt)
- image
-endps
-
-defineps DPSimagemask(DPSContext ctxt)
- imagemask
-endps
-
-defineps DPSkshow(DPSContext ctxt; char *s)
- (s) kshow
-endps
-
-defineps DPSrectfill(DPSContext ctxt; float x, y, w, h)
- x y w h rectfill
-endps
-
-defineps DPSrectstroke(DPSContext ctxt; float x, y, w, h)
- x y w h rectstroke
-endps
-
-defineps DPSshow(DPSContext ctxt; char *s)
- (s) show
-endps
-
-defineps DPSshowpage(DPSContext ctxt)
- showpage
-endps
-
-defineps DPSstroke(DPSContext ctxt)
- stroke
-endps
-
-defineps DPSstrokepath(DPSContext ctxt)
- strokepath
-endps
-
-defineps DPSueofill(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ueofill
-endps
-
-defineps DPSufill(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ufill
-endps
-
-defineps DPSustroke(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ustroke
-endps
-
-defineps DPSustrokepath(DPSContext ctxt; char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ustrokepath
-endps
-
-defineps DPSwidthshow(DPSContext ctxt; float x, y; int c; char *s)
- x y c (s) widthshow
-endps
-
-defineps DPSxshow(DPSContext ctxt; char *s; float numarray[size]; int size)
- (s) numarray xshow
-endps
-
-defineps DPSxyshow(DPSContext ctxt; char *s; float numarray[size]; int size)
- (s) numarray xyshow
-endps
-
-defineps DPSyshow(DPSContext ctxt; char *s; float numarray[size]; int size)
- (s) numarray yshow
-endps
-
diff --git a/xc/lib/dps/dpsprintf.c b/xc/lib/dps/dpsprintf.c
deleted file mode 100644
index 1121122f4..000000000
--- a/xc/lib/dps/dpsprintf.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * dpsprintf.c
- *
- * (c) Copyright 1985-1994 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
- */
-
-#include "publictypes.h"
-#include "DPS/dpsclient.h"
-
-#ifdef USE_DOPRINT
-extern void DPSdoprint();
-#endif /* USE_DOPRINT */
-
-#ifdef _NO_PROTO
-#include <varargs.h>
-
-void DPSPrintf(va_alist)
- va_dcl
-{
- va_list args;
- DPSContext ctxt;
- char *fmt;
-
-#ifdef VAXC
- va_start_1(args, sizeof(DPSContext) + sizeof(char *));
-#else /* VAXC */
- va_start(args);
-#endif /* VAXC */
-
- ctxt = (DPSContext) va_arg(args, DPSContext);
- fmt = va_arg(args, char *);
-
-#ifdef USE_DOPRINT
- DPSdoprint(ctxt, fmt, &args);
-#else /* USE_DOPRINT */
- {
- char buffer[10000];
- vsprintf(buffer, fmt, args);
- DPSWritePostScript(ctxt, buffer, strlen(buffer));
- }
-#endif /* USE_DOPRINT */
- va_end(args);
-}
-
-#else /* _NO_PROTO */
-
-#include <stdarg.h>
-
-void DPSPrintf(DPSContext ctxt, char *fmt, ...)
-{
- va_list args;
-
-#if defined(__STDC__) || defined(AIXV3) || defined(ultrix)
- va_start(args, fmt);
-#else
- va_start(args);
-#endif
-
-#ifdef USE_DOPRINT
- DPSdoprint(ctxt, fmt, &args);
-#else /* USE_DOPRINT */
- {
- char buffer[10000];
- vsprintf(buffer, fmt, args);
- DPSWritePostScript(ctxt, buffer, strlen(buffer));
- }
-#endif /* USE_DOPRINT */
- va_end(args);
-}
-
-#endif /* _NO_PROTO */
diff --git a/xc/lib/dps/dpsprivate.h b/xc/lib/dps/dpsprivate.h
deleted file mode 100644
index 96af322ac..000000000
--- a/xc/lib/dps/dpsprivate.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * dpsprivate.h -- Private interface for the DPS client library implementation.
- *
- * (c) Copyright 1988-1994 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
- */
-
-#ifndef DPSPRIVATE_H
-#define DPSPRIVATE_H
-
-#include "DPS/dpsconfig.h"
-
-typedef enum {
- dps_hiFirst, dps_loFirst
- } DPSByteOrder;
-
-typedef enum {
- dps_ieee, dps_native
- } DPSNumFormat;
-
-typedef void (*DPSClientPrintProc)(/*
- ContextID cid;
- unsigned char *buf;
- unsigned int count; */);
- /* Call-back procedure to handle output from the PostScript server for
- context with id 'cid'. Passed to DPSServicePostScript.
- 'buf' contains 'count' bytes. */
-
-extern void DPSInitClient(
- /* DPSTextProc textProc;
- procedure (*bufReleaseProc)(PSContext context; char *buffer);
- */
- );
-/* Initialize the environment-specific parts of the client library */
-
-#ifndef DPSDefaultProgramEncoding
-#define DPSDefaultProgramEncoding dps_binObjSeq
-#endif /* not DPSDefaultProgramEncoding */
-
-#ifndef DPSDefaultByteOrder
-#if SWAPBITS
-#define DPSDefaultByteOrder dps_loFirst
-#else /* SWAPBITS */
-#define DPSDefaultByteOrder dps_hiFirst
-#endif /* SWAPBITS */
-#endif /* DPSDefaultByteOrder */
-
-#ifndef DPSDefaultNumFormat
-#if IEEEFLOAT
-#define DPSDefaultNumFormat dps_ieee
-#else /* IEEEFLOAT */
-#define DPSDefaultNumFormat dps_native
-#endif /* IEEEFLOAT */
-#endif /* not DPSDefaultNumFormat */
-
-#ifndef DPSDefaultNameEncoding
-#define DPSDefaultNameEncoding dps_indexed
-#endif /* not DPSDefaultNameEncoding */
-
-extern DPSNumFormat DPSCreatePrivContext(
- /* void *wh;
- * DPSContext ctxt;
- * long int *cidP, *sidP;
- * boolean newSpace;
- * DPSClientPrintProc printProc;
- */
- );
- /* returns -1 if server can't create the context */
-
-extern void DPSIncludePrivContext(
- /* void *wh;
- * DPSContext ctxt;
- * long int cid, sid;
- * DPSClientPrintProc printProc;
- */
- );
-
-extern void DPSSendPostScript(
- /* void *wh; DPSClientPrintProc printProc;
- * ContextID cID; char *buffer; long int count;
- * boolean (*returnControl)();
- */
- );
-
-extern void DPSSendInterrupt(
- /* void *wh; ContextID cID; DPSClientPrintProc printProc; */
- );
-
-extern void DPSSendEOF(
- /* void *wh; ContextID cID; DPSClientPrintProc printProc; */
- );
-
-extern void DPSSendTerminate(
- /* void *wh; ContextID cID; DPSClientPrintProc printProc; */
- );
-
-extern void DPSSendDestroySpace(
- /* void *wh; SpaceID sid; DPSClientPrintProc printProc; */
- );
-
-extern void DPSReportInvalid(/* ContextID cID; */);
- /* Called by the implementation of dpsprivate.h. Implemented by dpsclient.c */
-
-extern void DPSCheckRaiseError(/* DPSContext c; */);
- /* Checks the resynching flag in a DPSPrivContext and raises an exception
- if true */
-
-/* system name table boundaries */
-#define DPS_LAST_COMMON_SYSNAME 212
-#define DPS_FIRST_AUX_SYSNAME 256
-#define DPS_LAST_AUX_SYSNAME 427
-
-extern char **DPSSysNames;
-extern char **DPSSysNamesAux;
-
- /* System name tables. DPSSysNames[index] is the string for the name.
- DPSSysNamesAux[index - DPS_FIRST_AUX_SYSNAME] is the string
- for an uncommon system name. */
-
-extern void DPSInitSysNames();
-
-extern char *DPSSetWh(/* DPSContext ctxt; char *newWh */);
- /* set new window handle, returns old window handle */
-
-extern void DPSOutOfMemory();
- /*
- This is called by the DPS software when it cannot allocate any more
- storage from the heap (e.g., when malloc returns NIL).
-
- MAC ONLY
- DPSOutOfMemory calls CantHappen (see dpsexcept.h) unless you
- have used DPSSetOutOfMemoryProc to establish a different procedure
- to be called, in which case DPSOutOfMemory calls your procedure instead.
- If your procedure returns, DPSOutOfMemory returns to its caller, which
- re-attempts the allocation. Note that another allocation failure will
- cause DPSOutOfMemory to be called again (and again ...).
-
- */
-
-#endif /* DPSPRIVATE_H */
diff --git a/xc/lib/dps/dpssimpint.h b/xc/lib/dps/dpssimpint.h
deleted file mode 100644
index 8485bc389..000000000
--- a/xc/lib/dps/dpssimpint.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * dpsXint.h -- internal definitions to dpsXclient.c
- *
- * (c) Copyright 1989-1994 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
- */
-
-#ifndef DPSXINT_H
-#define DPSXINT_H
-
-/* The first part of this structure is generic; the last part is
- implementation-specific. */
-
-typedef struct _t_DPSPrivContextRec {
- char *priv;
- DPSSpace space;
- DPSProgramEncoding programEncoding;
- DPSNameEncoding nameEncoding;
- DPSProcs procs;
- void (*textProc)();
- void (*errorProc)();
- DPSResults resultTable;
- unsigned int resultTableLength;
- struct _t_DPSContextRec *chainParent, *chainChild;
- unsigned int contextFlags;
- DPSContextExtensionRec *extension;
-
- struct _t_DPSPrivContextRec *next;
- integer lastNameIndex, cid;
- boolean eofReceived;
- char *wh;
- char *buf, *outBuf, *objBuf;
- integer nBufChars, nOutBufChars, nObjBufChars;
- DPSNumFormat numFormat;
-
-/* Nothing is simple-specific */
-
-} DPSPrivContextRec, *DPSPrivContext;
-
-/* The first part of this structure is generic; the last part is
- implementation-specific. */
-
-typedef struct _t_DPSPrivSpaceRec {
- DPSSpaceProcs procs;
-
- struct _t_DPSPrivSpaceRec *next;
- long int lastNameIndex, sid;
- char *wh; /* KLUDGE to support DPSSendDestroySpace */
- DPSPrivContext firstContext;
-
-/* Nothing is simple-specific */
-
-} DPSPrivSpaceRec, *DPSPrivSpace;
-
-#include "dpsint.h"
-
-#endif /* DPSXINT_H */
diff --git a/xc/lib/dps/dpssysnames.c b/xc/lib/dps/dpssysnames.c
deleted file mode 100644
index 54bf07431..000000000
--- a/xc/lib/dps/dpssysnames.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* dpssysnames.c -- system name table
- *
- * (c) Copyright 1988-1994 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
- */
-
-#include "publictypes.h"
-#include "DPS/dpsclient.h"
-#include "dpsprivate.h"
-
-char **DPSSysNames;
-char **DPSSysNamesAux;
-
-static char *sysNames[] = {
- "abs",
- "add",
- "aload",
- "anchorsearch",
- "and",
- "arc",
- "arcn",
- "arct",
- "arcto",
- "array",
- "ashow",
- "astore",
- "awidthshow",
- "begin",
- "bind",
- "bitshift",
- "ceiling",
- "charpath",
- "clear",
- "cleartomark",
- "clip",
- "clippath",
- "closepath",
- "concat",
- "concatmatrix",
- "copy",
- "count",
- "counttomark",
- "currentcmykcolor",
- "currentdash",
- "currentdict",
- "currentfile",
- "currentfont",
- "currentgray",
- "currentgstate",
- "currenthsbcolor",
- "currentlinecap",
- "currentlinejoin",
- "currentlinewidth",
- "currentmatrix",
- "currentpoint",
- "currentrgbcolor",
- "currentshared",
- "curveto",
- "cvi",
- "cvlit",
- "cvn",
- "cvr",
- "cvrs",
- "cvs",
- "cvx",
- "def",
- "defineusername",
- "dict",
- "div",
- "dtransform",
- "dup",
- "end",
- "eoclip",
- "eofill",
- "eoviewclip",
- "eq",
- "exch",
- "exec",
- "exit",
- "file",
- "fill",
- "findfont",
- "flattenpath",
- "floor",
- "flush",
- "flushfile",
- "for",
- "forall",
- "ge",
- "get",
- "getinterval",
- "grestore",
- "gsave",
- "gstate",
- "gt",
- "identmatrix",
- "idiv",
- "idtransform",
- "if",
- "ifelse",
- "image",
- "imagemask",
- "index",
- "ineofill",
- "infill",
- "initviewclip",
- "inueofill",
- "inufill",
- "invertmatrix",
- "itransform",
- "known",
- "le",
- "length",
- "lineto",
- "load",
- "loop",
- "lt",
- "makefont",
- "matrix",
- "maxlength",
- "mod",
- "moveto",
- "mul",
- "ne",
- "neg",
- "newpath",
- "not",
- "null",
- "or",
- "pathbbox",
- "pathforall",
- "pop",
- "print",
- "printobject",
- "put",
- "putinterval",
- "rcurveto",
- "read",
- "readhexstring",
- "readline",
- "readstring",
- "rectclip",
- "rectfill",
- "rectstroke",
- "rectviewclip",
- "repeat",
- "restore",
- "rlineto",
- "rmoveto",
- "roll",
- "rotate",
- "round",
- "save",
- "scale",
- "scalefont",
- "search",
- "selectfont",
- "setbbox",
- "setcachedevice",
- "setcachedevice2",
- "setcharwidth",
- "setcmykcolor",
- "setdash",
- "setfont",
- "setgray",
- "setgstate",
- "sethsbcolor",
- "setlinecap",
- "setlinejoin",
- "setlinewidth",
- "setmatrix",
- "setrgbcolor",
- "setshared",
- "shareddict",
- "show",
- "showpage",
- "stop",
- "stopped",
- "store",
- "string",
- "stringwidth",
- "stroke",
- "strokepath",
- "sub",
- "systemdict",
- "token",
- "transform",
- "translate",
- "truncate",
- "type",
- "uappend",
- "ucache",
- "ueofill",
- "ufill",
- "undef",
- "upath",
- "userdict",
- "ustroke",
- "viewclip",
- "viewclippath",
- "where",
- "widthshow",
- "write",
- "writehexstring",
- "writeobject",
- "writestring",
- "wtranslation",
- "xor",
- "xshow",
- "xyshow",
- "yshow",
- "FontDirectory",
- "SharedFontDirectory",
- "Courier",
- "Courier-Bold",
- "Courier-BoldOblique",
- "Courier-Oblique",
- "Helvetica",
- "Helvetica-Bold",
- "Helvetica-BoldOblique",
- "Helvetica-Oblique",
- "Symbol",
- "Times-Bold",
- "Times-BoldItalic",
- "Times-Italic",
- "Times-Roman",
- "execuserobject", /* 212 */
- ""
-};
-
-static char *sysNamesAux[] = {
- "=", /* 256 */
- "==",
- "ISOLatin1Encoding",
- "StandardEncoding",
- "[",
- "]",
- "atan",
- "banddevice",
- "bytesavailable",
- "cachestatus",
- "closefile",
- "colorimage",
- "condition",
- "copypage",
- "cos",
- "countdictstack",
- "countexecstack",
- "cshow",
- "currentblackgeneration",
- "currentcacheparams",
- "currentcolorscreen",
- "currentcolortransfer",
- "currentcontext",
- "currentflat",
- "currenthalftone",
- "currenthalftonephase",
- "currentmiterlimit",
- "currentobjectformat",
- "currentpacking",
- "currentscreen",
- "currentstrokeadjust",
- "currenttransfer",
- "currentundercolorremoval",
- "defaultmatrix",
- "definefont",
- "deletefile",
- "detach",
- "deviceinfo",
- "dictstack",
- "echo",
- "erasepage",
- "errordict",
- "execstack",
- "executeonly",
- "exp",
- "false",
- "filenameforall",
- "fileposition",
- "fork",
- "framedevice",
- "grestoreall",
- "handleerror",
- "initclip",
- "initgraphics",
- "initmatrix",
- "instroke",
- "inustroke",
- "join",
- "kshow",
- "ln",
- "lock",
- "log",
- "mark",
- "monitor",
- "noaccess",
- "notify",
- "nulldevice",
- "packedarray",
- "quit",
- "rand",
- "rcheck",
- "readonly",
- "realtime",
- "renamefile",
- "renderbands",
- "resetfile",
- "reversepath",
- "rootfont",
- "rrand",
- "run",
- "scheck",
- "setblackgeneration",
- "setcachelimit",
- "setcacheparams",
- "setcolorscreen",
- "setcolortransfer",
- "setfileposition",
- "setflat",
- "sethalftone",
- "sethalftonephase",
- "setmiterlimit",
- "setobjectformat",
- "setpacking",
- "setscreen",
- "setstrokeadjust",
- "settransfer",
- "setucacheparams",
- "setundercolorremoval",
- "sin",
- "sqrt",
- "srand",
- "stack",
- "status",
- "statusdict",
- "true",
- "ucachestatus",
- "undefinefont",
- "usertime",
- "ustrokepath",
- "version",
- "vmreclaim",
- "vmstatus",
- "wait",
- "wcheck",
- "xcheck",
- "yield",
- "defineuserobject",
- "undefineuserobject",
- "UserObjects",
- "cleardictstack",
- "A", /* 376 */
- "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",
- "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", /* 427 */
- "setvmthreshold", /* 428 */
- "<<", /* 429 */
- ">>", /* 430 */
- ""
-};
-
-void DPSInitSysNames() {
- DPSSysNames = (char **)sysNames;
- DPSSysNamesAux = (char **)sysNamesAux;
- }
diff --git a/xc/lib/dps/dpssysops.psw b/xc/lib/dps/dpssysops.psw
deleted file mode 100644
index 731287930..000000000
--- a/xc/lib/dps/dpssysops.psw
+++ /dev/null
@@ -1,149 +0,0 @@
-/* dpssysops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSbind(DPSContext ctxt)
- bind
-endps
-
-defineps DPScleardictstack(DPSContext ctxt)
- cleardictstack
-endps
-
-defineps DPScountdictstack(DPSContext ctxt | int *n)
- countdictstack n
-endps
-
-defineps DPScountexecstack(DPSContext ctxt | int *n)
- countexecstack n
-endps
-
-defineps DPScurrentdict(DPSContext ctxt)
- currentdict
-endps
-
-defineps DPScurrentpacking(DPSContext ctxt | boolean *b)
- currentpacking b
-endps
-
-defineps DPScurrentshared(DPSContext ctxt | boolean *b)
- currentshared b
-endps
-
-defineps DPSdeviceinfo(DPSContext ctxt)
- deviceinfo
-endps
-
-defineps DPSerrordict(DPSContext ctxt)
- errordict
-endps
-
-defineps DPSexec(DPSContext ctxt)
- exec
-endps
-
-defineps DPSprompt(DPSContext ctxt)
- prompt
-endps
-
-defineps DPSquit(DPSContext ctxt)
- quit
-endps
-
-defineps DPSrand(DPSContext ctxt)
- rand
-endps
-
-defineps DPSrealtime(DPSContext ctxt | int *i)
- realtime i
-endps
-
-defineps DPSrestore(DPSContext ctxt)
- restore
-endps
-
-defineps DPSrrand(DPSContext ctxt)
- rrand
-endps
-
-defineps DPSrun(DPSContext ctxt; char *filename)
- (filename) run
-endps
-
-defineps DPSsave(DPSContext ctxt)
- save
-endps
-
-defineps DPSsetpacking(DPSContext ctxt; boolean b)
- b setpacking
-endps
-
-defineps DPSsetshared(DPSContext ctxt; boolean b)
- b setshared
-endps
-
-defineps DPSsrand(DPSContext ctxt)
- srand
-endps
-
-defineps DPSstart(DPSContext ctxt)
- start
-endps
-
-defineps DPStype(DPSContext ctxt)
- type
-endps
-
-defineps DPSundef(DPSContext ctxt; char *name)
- /name undef
-endps
-
-defineps DPSusertime(DPSContext ctxt | int *milliseconds)
- usertime milliseconds
-endps
-
-defineps DPSversion(DPSContext ctxt; int bufsize | char buf[bufsize])
- version buf
-endps
-
-defineps DPSvmreclaim(DPSContext ctxt; int code)
- code vmreclaim
-endps
-
-defineps DPSvmstatus(DPSContext ctxt | int *level, *used, *maximum)
- vmstatus maximum used level
-endps
-
diff --git a/xc/lib/dps/dpswinops.psw b/xc/lib/dps/dpswinops.psw
deleted file mode 100644
index 6ccf77b4c..000000000
--- a/xc/lib/dps/dpswinops.psw
+++ /dev/null
@@ -1,65 +0,0 @@
-/* dpswinops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps DPSineofill(DPSContext ctxt; float x, y | boolean *b)
- x y ineofill b
-endps
-
-defineps DPSinfill(DPSContext ctxt; float x, y | boolean *b)
- x y infill b
-endps
-
-defineps DPSinstroke(DPSContext ctxt; float x, y | boolean *b)
- x y instroke b
-endps
-
-defineps DPSinueofill(DPSContext ctxt; float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b)
- x y [(nums) (ops)] inueofill b
-endps
-
-defineps DPSinufill(DPSContext ctxt; float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b)
- x y [(nums) (ops)] inufill b
-endps
-
-defineps DPSinustroke(DPSContext ctxt; float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b)
- x y [(nums) (ops)] inustroke b
-endps
-
-defineps DPSwtranslation(DPSContext ctxt | float *x, *y)
- wtranslation y x
-endps
-
diff --git a/xc/lib/dps/else.txt b/xc/lib/dps/else.txt
deleted file mode 100644
index b74df412a..000000000
--- a/xc/lib/dps/else.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-#else /* _NO_PROTO */
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
diff --git a/xc/lib/dps/genheader.cmd b/xc/lib/dps/genheader.cmd
deleted file mode 100644
index 9bcc394ff..000000000
--- a/xc/lib/dps/genheader.cmd
+++ /dev/null
@@ -1,14 +0,0 @@
-REM
-/* OS/2 generate header files */
-/* $XFree86: xc/lib/dps/genheader.cmd,v 1.2 2000/05/18 23:46:14 dawes Exp $ */
-cat psclrops.h psctrlops.h psctxtops.h psdataops.h psfontops.h psgsttops.h psioops.h psmathops.h psmtrxops.h psmiscops.h pspntops.h pspathops.h pssysops.h pswinops.h psopstack.h psXops.h psl2ops.h >.ph
-sed -e "/^$$/D" -e "/#/D" -e "/^\//D" -e "/^ gener/D" -e "/^.\//D" .ph | sort >.sort
-awk "/;/ {print;printf(\"\n\");}" .sort >.ttt
-cat psname.txt header.txt psifdef.txt .ttt psendif.txt > psops.h.os2
-rm .ph .sort .ttt
-
-cat dpsclrops.h dpsctrlops.h dpsctxtops.h dpsdataops.h dpsfontops.h dpsgsttops.h dpsioops.h dpsmathops.h dpsmtrxops.h dpsmiscops.h dpspntops.h dpspathops.h dpssysops.h dpswinops.h dpsopstack.h dpsXops.h dpsl2ops.h >.ph
-sed -e "/^$$/D" -e "/#/D" -e "/^\//D" -e "/^ gener/D" -e "/^.\//D" .ph | sort >.sort
-awk "/;/ {print;printf(\"\n\");}" .sort >.ttt
-cat dpsname.txt header.txt dpsifdef.txt .ttt dpsendif.txt > dpsops.h.os2
-rm .ph .sort .ttt
diff --git a/xc/lib/dps/header.txt b/xc/lib/dps/header.txt
deleted file mode 100644
index 8b37ebe67..000000000
--- a/xc/lib/dps/header.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * (c) Copyright 1988-1994 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
- */
diff --git a/xc/lib/dps/psXops.psw b/xc/lib/dps/psXops.psw
deleted file mode 100644
index 940a84630..000000000
--- a/xc/lib/dps/psXops.psw
+++ /dev/null
@@ -1,80 +0,0 @@
-/* psXops.psw
- *
- * (c) Copyright 1991-1994 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
- */
-
-defineps PSclientsync()
- clientsync
-endps
-
-defineps PScurrentXgcdrawable(| int *gc, *draw, *x, *y)
- currentXgcdrawable y x draw gc
-endps
-
-defineps PScurrentXgcdrawablecolor(| int *gc, *draw, *x, *y, colorInfo[12])
- currentXgcdrawablecolor colorInfo y x draw gc
-endps
-
-defineps PScurrentXoffset(| int *x, *y)
- currentXoffset y x
-endps
-
-defineps PSsetXgcdrawable(int gc, draw, x, y)
- gc draw x y setXgcdrawable
-endps
-
-defineps PSsetXgcdrawablecolor(int gc, draw, x, y, colorInfo[12])
- gc draw x y colorInfo setXgcdrawablecolor
-endps
-
-defineps PSsetXoffset(short x, y)
- x y setXoffset
-endps
-
-defineps PSsetXrgbactual(float r, g, b | boolean *success)
- r g b setXrgbactual success
-endps
-
-defineps PSclientXready(int i0, i1, i2, i3)
- [ i0 i1 i2 i3 ] clientXready
-endps
-
-defineps PSsetXdrawingfunction(int function)
- function setXdrawingfunction
-endps
-
-defineps PScurrentXdrawingfunction(| int *function)
- currentXdrawingfunction function
-endps
diff --git a/xc/lib/dps/psclrops.psw b/xc/lib/dps/psclrops.psw
deleted file mode 100644
index 986f85176..000000000
--- a/xc/lib/dps/psclrops.psw
+++ /dev/null
@@ -1,81 +0,0 @@
-/* psclrops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PScolorimage()
- colorimage
-endps
-
-defineps PScurrentblackgeneration()
- currentblackgeneration
-endps
-
-defineps PScurrentcmykcolor( | float *c, *m, *y, *k)
- currentcmykcolor k y m c
-endps
-
-defineps PScurrentcolorscreen()
- currentcolorscreen
-endps
-
-defineps PScurrentcolortransfer()
- currentcolortransfer
-endps
-
-defineps PScurrentundercolorremoval()
- currentundercolorremoval
-endps
-
-defineps PSsetblackgeneration()
- setblackgeneration
-endps
-
-defineps PSsetcmykcolor(float c, m, y, k)
- c m y k setcmykcolor
-endps
-
-defineps PSsetcolorscreen()
- setcolorscreen
-endps
-
-defineps PSsetcolortransfer()
- setcolortransfer
-endps
-
-defineps PSsetundercolorremoval()
- setundercolorremoval
-endps
-
diff --git a/xc/lib/dps/psctrlops.psw b/xc/lib/dps/psctrlops.psw
deleted file mode 100644
index 882020d63..000000000
--- a/xc/lib/dps/psctrlops.psw
+++ /dev/null
@@ -1,113 +0,0 @@
-/* psctrlops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSeq()
- eq
-endps
-
-defineps PSexit()
- exit
-endps
-
-defineps PSfalse()
- false
-endps
-
-defineps PSfor()
- for
-endps
-
-defineps PSforall()
- forall
-endps
-
-defineps PSge()
- ge
-endps
-
-defineps PSgt()
- gt
-endps
-
-defineps PSif()
- if
-endps
-
-defineps PSifelse()
- ifelse
-endps
-
-defineps PSle()
- le
-endps
-
-defineps PSloop()
- loop
-endps
-
-defineps PSlt()
- lt
-endps
-
-defineps PSne()
- ne
-endps
-
-defineps PSnot()
- not
-endps
-
-defineps PSor()
- or
-endps
-
-defineps PSrepeat()
- repeat
-endps
-
-defineps PSstop()
- stop
-endps
-
-defineps PSstopped()
- stopped
-endps
-
-defineps PStrue()
- true
-endps
-
diff --git a/xc/lib/dps/psctxtops.psw b/xc/lib/dps/psctxtops.psw
deleted file mode 100644
index 43ca803fc..000000000
--- a/xc/lib/dps/psctxtops.psw
+++ /dev/null
@@ -1,109 +0,0 @@
-/* psctxtops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSUserObjects()
- UserObjects
-endps
-
-defineps PScondition()
- condition
-endps
-
-defineps PScurrentcontext( | int *cid)
- currentcontext cid
-endps
-
-defineps PScurrentobjectformat( | int *code)
- currentobjectformat code
-endps
-
-defineps PSdefineusername(int i; char *username)
- i /username defineusername
-endps
-
-defineps PSdefineuserobject()
- defineuserobject
-endps
-
-defineps PSdetach()
- detach
-endps
-
-defineps PSexecuserobject(int userObjIndex)
- userObjIndex execuserobject
-endps
-
-defineps PSfork()
- fork
-endps
-
-defineps PSjoin()
- join
-endps
-
-defineps PSlock()
- lock
-endps
-
-defineps PSmonitor()
- monitor
-endps
-
-defineps PSnotify()
- notify
-endps
-
-defineps PSsetobjectformat(int code)
- code setobjectformat
-endps
-
-defineps PSsetvmthreshold(int i)
- i setvmthreshold
-endps
-
-defineps PSundefineuserobject(int userObjIndex)
- userObjIndex undefineuserobject
-endps
-
-defineps PSwait()
- wait
-endps
-
-defineps PSyield()
- yield
-endps
-
diff --git a/xc/lib/dps/psdataops.psw b/xc/lib/dps/psdataops.psw
deleted file mode 100644
index ee89313f6..000000000
--- a/xc/lib/dps/psdataops.psw
+++ /dev/null
@@ -1,257 +0,0 @@
-/* psdataops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSaload()
- aload
-endps
-
-defineps PSanchorsearch(| boolean *truth)
- anchorsearch truth
-endps
-
-defineps PSarray(int len)
- len array
-endps
-
-defineps PSastore()
- astore
-endps
-
-defineps PSbegin()
- begin
-endps
-
-defineps PSclear()
- clear
-endps
-
-defineps PScleartomark()
- cleartomark
-endps
-
-defineps PScopy(int n)
- n copy
-endps
-
-defineps PScount( | int *n)
- count n
-endps
-
-defineps PScounttomark( | int *n)
- counttomark n
-endps
-
-defineps PScvi()
- cvi
-endps
-
-defineps PScvlit()
- cvlit
-endps
-
-defineps PScvn()
- cvn
-endps
-
-defineps PScvr()
- cvr
-endps
-
-defineps PScvrs()
- cvrs
-endps
-
-defineps PScvs()
- cvs
-endps
-
-defineps PScvx()
- cvx
-endps
-
-defineps PSdef()
- def
-endps
-
-defineps PSdict(int len)
- len dict
-endps
-
-defineps PSdictstack()
- dictstack
-endps
-
-defineps PSdup()
- dup
-endps
-
-defineps PSend()
- end
-endps
-
-defineps PSexch()
- exch
-endps
-
-defineps PSexecstack()
- execstack
-endps
-
-defineps PSexecuteonly()
- executeonly
-endps
-
-defineps PSget()
- get
-endps
-
-defineps PSgetinterval()
- getinterval
-endps
-
-defineps PSindex(int i)
- i index
-endps
-
-defineps PSknown( | boolean *b)
- known b
-endps
-
-defineps PSlength( | int *len)
- length len
-endps
-
-defineps PSload()
- load
-endps
-
-defineps PSmark()
- mark
-endps
-
-defineps PSmatrix()
- matrix
-endps
-
-defineps PSmaxlength( | int *len)
- maxlength len
-endps
-
-defineps PSnoaccess()
- noaccess
-endps
-
-defineps PSnull()
- null
-endps
-
-defineps PSpackedarray()
- packedarray
-endps
-
-defineps PSpop()
- pop
-endps
-
-defineps PSput()
- put
-endps
-
-defineps PSputinterval()
- putinterval
-endps
-
-defineps PSrcheck( | boolean *b)
- rcheck b
-endps
-
-defineps PSreadonly()
- readonly
-endps
-
-defineps PSroll(int n, j)
- n j roll
-endps
-
-defineps PSscheck( | boolean *b)
- scheck b
-endps
-
-defineps PSsearch(| boolean *b)
- search b
-endps
-
-defineps PSshareddict()
- shareddict
-endps
-
-defineps PSstatusdict()
- statusdict
-endps
-
-defineps PSstore()
- store
-endps
-
-defineps PSstring(int len)
- len string
-endps
-
-defineps PSstringwidth(char *s | float *xp, *yp)
- (s) stringwidth yp xp
-endps
-
-defineps PSsystemdict()
- systemdict
-endps
-
-defineps PSuserdict()
- userdict
-endps
-
-defineps PSwcheck( | boolean *b)
- wcheck b
-endps
-
-defineps PSwhere(| boolean *b)
- where b
-endps
-
-defineps PSxcheck( | boolean *b)
- xcheck b
-endps
-
diff --git a/xc/lib/dps/psendif.txt b/xc/lib/dps/psendif.txt
deleted file mode 100644
index 52943f5ad..000000000
--- a/xc/lib/dps/psendif.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _NO_PROTO */
-
-#endif /* PSOPS_H */
diff --git a/xc/lib/dps/psfontops.psw b/xc/lib/dps/psfontops.psw
deleted file mode 100644
index 9d9b99914..000000000
--- a/xc/lib/dps/psfontops.psw
+++ /dev/null
@@ -1,109 +0,0 @@
-/* psfontops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSFontDirectory()
- FontDirectory
-endps
-
-defineps PSISOLatin1Encoding()
- ISOLatin1Encoding
-endps
-
-defineps PSSharedFontDirectory()
- SharedFontDirectory
-endps
-
-defineps PSStandardEncoding()
- StandardEncoding
-endps
-
-defineps PScachestatus()
- cachestatus
-endps
-
-defineps PScurrentcacheparams()
- currentcacheparams
-endps
-
-defineps PScurrentfont()
- currentfont
-endps
-
-defineps PSdefinefont()
- definefont
-endps
-
-defineps PSfindfont(char *name)
- /name findfont
-endps
-
-defineps PSmakefont()
- makefont
-endps
-
-defineps PSscalefont(float size)
- size scalefont
-endps
-
-defineps PSselectfont(char *name; float scale)
- /name scale selectfont
-endps
-
-defineps PSsetcachedevice(float wx, wy, llx, lly, urx, ury)
- wx wy llx lly urx ury setcachedevice
-endps
-
-defineps PSsetcachelimit(int n)
- n setcachelimit
-endps
-
-defineps PSsetcacheparams()
- setcacheparams
-endps
-
-defineps PSsetcharwidth(float wx, wy)
- wx wy setcharwidth
-endps
-
-defineps PSsetfont(userobject f)
- f setfont
-endps
-
-defineps PSundefinefont(char *name)
- /name undefinefont
-endps
-
diff --git a/xc/lib/dps/psgsttops.psw b/xc/lib/dps/psgsttops.psw
deleted file mode 100644
index a6eb87b62..000000000
--- a/xc/lib/dps/psgsttops.psw
+++ /dev/null
@@ -1,213 +0,0 @@
-/* psgsttops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSconcat(float m[6])
- m concat
-endps
-
-defineps PScurrentdash()
- currentdash
-endps
-
-defineps PScurrentflat( | float *flatness)
- currentflat flatness
-endps
-
-defineps PScurrentgray( | float *gray)
- currentgray gray
-endps
-
-defineps PScurrentgstate(userobject gst)
- gst currentgstate
-endps
-
-defineps PScurrenthalftone()
- currenthalftone
-endps
-
-defineps PScurrenthalftonephase( | float *x, *y)
- currenthalftonephase y x
-endps
-
-defineps PScurrenthsbcolor( | float *h, *s, *b)
- currenthsbcolor b s h
-endps
-
-defineps PScurrentlinecap( | int *linecap)
- currentlinecap linecap
-endps
-
-defineps PScurrentlinejoin( | int *linejoin)
- currentlinejoin linejoin
-endps
-
-defineps PScurrentlinewidth( | float *width)
- currentlinewidth width
-endps
-
-defineps PScurrentmatrix()
- currentmatrix
-endps
-
-defineps PScurrentmiterlimit( | float *limit)
- currentmiterlimit limit
-endps
-
-defineps PScurrentpoint( | float *x, *y)
- currentpoint y x
-endps
-
-defineps PScurrentrgbcolor( | float *r, *g, *b)
- currentrgbcolor b g r
-endps
-
-defineps PScurrentscreen()
- currentscreen
-endps
-
-defineps PScurrentstrokeadjust( | boolean *b)
- currentstrokeadjust b
-endps
-
-defineps PScurrenttransfer()
- currenttransfer
-endps
-
-defineps PSdefaultmatrix()
- defaultmatrix
-endps
-
-defineps PSgrestore()
- grestore
-endps
-
-defineps PSgrestoreall()
- grestoreall
-endps
-
-defineps PSgsave()
- gsave
-endps
-
-defineps PSgstate()
- gstate
-endps
-
-defineps PSinitgraphics()
- initgraphics
-endps
-
-defineps PSinitmatrix()
- initmatrix
-endps
-
-defineps PSrotate(float angle)
- angle rotate
-endps
-
-defineps PSscale(float x, y)
- x y scale
-endps
-
-defineps PSsetdash(float pat[size]; int size; float offset)
- pat offset setdash
-endps
-
-defineps PSsetflat(float flatness)
- flatness setflat
-endps
-
-defineps PSsetgray(float gray)
- gray setgray
-endps
-
-defineps PSsetgstate(userobject gst)
- gst setgstate
-endps
-
-defineps PSsethalftone()
- sethalftone
-endps
-
-defineps PSsethalftonephase(float x, y)
- x y sethalftonephase
-endps
-
-defineps PSsethsbcolor(float h, s, b)
- h s b sethsbcolor
-endps
-
-defineps PSsetlinecap(int linecap)
- linecap setlinecap
-endps
-
-defineps PSsetlinejoin(int linejoin)
- linejoin setlinejoin
-endps
-
-defineps PSsetlinewidth(float width)
- width setlinewidth
-endps
-
-defineps PSsetmatrix()
- setmatrix
-endps
-
-defineps PSsetmiterlimit(float limit)
- limit setmiterlimit
-endps
-
-defineps PSsetrgbcolor(float r, g, b)
- r g b setrgbcolor
-endps
-
-defineps PSsetscreen()
- setscreen
-endps
-
-defineps PSsetstrokeadjust(boolean b)
- b setstrokeadjust
-endps
-
-defineps PSsettransfer()
- settransfer
-endps
-
-defineps PStranslate(float x, y)
- x y translate
-endps
-
diff --git a/xc/lib/dps/psifdef.txt b/xc/lib/dps/psifdef.txt
deleted file mode 100644
index 716cacccf..000000000
--- a/xc/lib/dps/psifdef.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef PSOPS_H
-#define PSOPS_H
-
-#ifdef _NO_PROTO
-
diff --git a/xc/lib/dps/psioops.psw b/xc/lib/dps/psioops.psw
deleted file mode 100644
index c4d4b4bb9..000000000
--- a/xc/lib/dps/psioops.psw
+++ /dev/null
@@ -1,153 +0,0 @@
-/* psioops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSequals()
- =
-endps
-
-defineps PSequalsequals()
- ==
-endps
-
-defineps PSbytesavailable( | int *n)
- bytesavailable n
-endps
-
-defineps PSclosefile()
- closefile
-endps
-
-defineps PScurrentfile()
- currentfile
-endps
-
-defineps PSdeletefile(char *filename)
- (filename) deletefile
-endps
-
-defineps PSecho(boolean b)
- b echo
-endps
-
-defineps PSfile(char *name, *access)
- (name) (access) file
-endps
-
-defineps PSfilenameforall()
- filenameforall
-endps
-
-defineps PSfileposition( | int *pos)
- fileposition pos
-endps
-
-defineps PSflush()
- flush
-endps
-
-defineps PSflushfile()
- flushfile
-endps
-
-defineps PSprint()
- print
-endps
-
-defineps PSprintobject(int tag)
- tag printobject
-endps
-
-defineps PSpstack()
- pstack
-endps
-
-defineps PSread(| boolean *b)
- read b
-endps
-
-defineps PSreadhexstring(| boolean *b)
- readhexstring b
-endps
-
-defineps PSreadline(| boolean *b)
- readline b
-endps
-
-defineps PSreadstring(| boolean *b)
- readstring b
-endps
-
-defineps PSrenamefile(char *oldname, *newname)
- (oldname) (newname) renamefile
-endps
-
-defineps PSresetfile()
- resetfile
-endps
-
-defineps PSsetfileposition(int pos)
- pos setfileposition
-endps
-
-defineps PSstack()
- stack
-endps
-
-defineps PSstatus( | boolean *b)
- status b
-endps
-
-defineps PStoken(| boolean *b)
- token b
-endps
-
-defineps PSwrite()
- write
-endps
-
-defineps PSwritehexstring()
- writehexstring
-endps
-
-defineps PSwriteobject(int tag)
- tag writeobject
-endps
-
-defineps PSwritestring()
- writestring
-endps
-
diff --git a/xc/lib/dps/psl2ops.psw b/xc/lib/dps/psl2ops.psw
deleted file mode 100644
index 684b5b2e0..000000000
--- a/xc/lib/dps/psl2ops.psw
+++ /dev/null
@@ -1,208 +0,0 @@
-/* psl2ops.psw
- * (c) Copyright 1991-1994 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
- */
-
-defineps PSleftbracket()
- mark % [ annoys pswrap
-endps
-
-defineps PSrightbracket()
- counttomark array astore exch pop % ] annoys pswrap
-endps
-
-defineps PSleftleft()
- <<
-endps
-
-defineps PSrightright()
- >>
-endps
-
-defineps PScshow(char *s)
- (s) cshow
-endps
-
-defineps PScurrentcolor()
- currentcolor
-endps
-
-defineps PScurrentcolorrendering()
- currentcolorrendering
-endps
-
-defineps PScurrentcolorspace()
- currentcolorspace
-endps
-
-defineps PScurrentdevparams(char *dev)
- (dev) currentdevparams
-endps
-
-defineps PScurrentglobal(| boolean *b)
- currentglobal b
-endps
-
-defineps PScurrentoverprint(| boolean *b)
- currentoverprint b
-endps
-
-defineps PScurrentpagedevice()
- currentpagedevice
-endps
-
-defineps PScurrentsystemparams()
- currentsystemparams
-endps
-
-defineps PScurrentuserparams()
- currentuserparams
-endps
-
-defineps PSdefineresource(char *category)
- /category defineresource
-endps
-
-defineps PSexecform()
- execform
-endps
-
-defineps PSfilter()
- filter
-endps
-
-defineps PSfindencoding(char *key)
- /key findencoding
-endps
-
-defineps PSfindresource(char *key, *category)
- /key /category findresource
-endps
-
-defineps PSgcheck(| boolean *b)
- gcheck b
-endps
-
-defineps PSglobaldict()
- globaldict
-endps
-
-defineps PSGlobalFontDirectory()
- GlobalFontDirectory
-endps
-
-defineps PSglyphshow(char *name)
- /name glyphshow
-endps
-
-defineps PSlanguagelevel(| int *n)
- languagelevel n
-endps
-
-defineps PSmakepattern()
- makepattern
-endps
-
-defineps PSproduct()
- product
-endps
-
-defineps PSresourceforall(char *category)
- /category resourceforall
-endps
-
-defineps PSresourcestatus(char *key, *category; | boolean *b)
- /key /category resourcestatus b
-endps
-
-defineps PSrevision(| int *n)
- revision n
-endps
-
-defineps PSrootfont()
- rootfont
-endps
-
-defineps PSserialnumber(| int *n)
- serialnumber n
-endps
-
-defineps PSsetcolor()
- setcolor
-endps
-
-defineps PSsetcolorrendering()
- setcolorrendering
-endps
-
-defineps PSsetcolorspace()
- setcolorspace
-endps
-
-defineps PSsetdevparams()
- setdevparams
-endps
-
-defineps PSsetglobal(boolean b)
- b setglobal
-endps
-
-defineps PSsetoverprint(boolean b)
- b setoverprint
-endps
-
-defineps PSsetpagedevice()
- setpagedevice
-endps
-
-defineps PSsetpattern()
- setpattern
-endps
-
-defineps PSsetsystemparams()
- setsystemparams
-endps
-
-defineps PSsetuserparams()
- setuserparams
-endps
-
-defineps PSstartjob(boolean b; char *password)
- b password startjob
-endps
-
-defineps PSundefineresource(char *key, *category)
- /key /category undefineresource
-endps
-
diff --git a/xc/lib/dps/psmathops.psw b/xc/lib/dps/psmathops.psw
deleted file mode 100644
index 268535348..000000000
--- a/xc/lib/dps/psmathops.psw
+++ /dev/null
@@ -1,125 +0,0 @@
-/* psmathops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSabs()
- abs
-endps
-
-defineps PSadd()
- add
-endps
-
-defineps PSand()
- and
-endps
-
-defineps PSatan()
- atan
-endps
-
-defineps PSbitshift(int shift)
- shift bitshift
-endps
-
-defineps PSceiling()
- ceiling
-endps
-
-defineps PScos()
- cos
-endps
-
-defineps PSdiv()
- div
-endps
-
-defineps PSexp()
- exp
-endps
-
-defineps PSfloor()
- floor
-endps
-
-defineps PSidiv()
- idiv
-endps
-
-defineps PSln()
- ln
-endps
-
-defineps PSlog()
- log
-endps
-
-defineps PSmod()
- mod
-endps
-
-defineps PSmul()
- mul
-endps
-
-defineps PSneg()
- neg
-endps
-
-defineps PSround()
- round
-endps
-
-defineps PSsin()
- sin
-endps
-
-defineps PSsqrt()
- sqrt
-endps
-
-defineps PSsub()
- sub
-endps
-
-defineps PStruncate()
- truncate
-endps
-
-defineps PSxor()
- xor
-endps
-
diff --git a/xc/lib/dps/psmiscops.psw b/xc/lib/dps/psmiscops.psw
deleted file mode 100644
index 35bc092d0..000000000
--- a/xc/lib/dps/psmiscops.psw
+++ /dev/null
@@ -1,53 +0,0 @@
-/* psmiscops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSbanddevice()
- banddevice
-endps
-
-defineps PSframedevice()
- framedevice
-endps
-
-defineps PSnulldevice()
- nulldevice
-endps
-
-defineps PSrenderbands()
- renderbands
-endps
-
diff --git a/xc/lib/dps/psmtrxops.psw b/xc/lib/dps/psmtrxops.psw
deleted file mode 100644
index cd9ae1b79..000000000
--- a/xc/lib/dps/psmtrxops.psw
+++ /dev/null
@@ -1,65 +0,0 @@
-/* psmtrxops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSconcatmatrix()
- concatmatrix
-endps
-
-defineps PSdtransform(float x1, y1 | float *x2, *y2)
- x1 y1 dtransform y2 x2
-endps
-
-defineps PSidentmatrix()
- identmatrix
-endps
-
-defineps PSidtransform(float x1, y1 | float *x2, *y2)
- x1 y1 idtransform y2 x2
-endps
-
-defineps PSinvertmatrix()
- invertmatrix
-endps
-
-defineps PSitransform(float x1, y1 | float *x2, *y2)
- x1 y1 itransform y2 x2
-endps
-
-defineps PStransform(float x1, y1 | float *x2, *y2)
- x1 y1 transform y2 x2
-endps
-
diff --git a/xc/lib/dps/psname.txt b/xc/lib/dps/psname.txt
deleted file mode 100644
index 508b7a86d..000000000
--- a/xc/lib/dps/psname.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
- * psops.h
- */
diff --git a/xc/lib/dps/psops.h.os2 b/xc/lib/dps/psops.h.os2
deleted file mode 100644
index 20ff44844..000000000
--- a/xc/lib/dps/psops.h.os2
+++ /dev/null
@@ -1,1602 +0,0 @@
-/*
- * psops.h
- */
-/*
- * (c) Copyright 1988-1994 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
- */
-/* $XFree86: xc/lib/dps/psops.h.os2,v 1.2 2000/06/07 22:02:57 tsi Exp $ */
-
-#ifndef PSOPS_H
-#define PSOPS_H
-
-#ifdef _NO_PROTO
-
-extern void PSFontDirectory();
-
-extern void PSGlobalFontDirectory();
-
-extern void PSISOLatin1Encoding();
-
-extern void PSSharedFontDirectory();
-
-extern void PSStandardEncoding();
-
-extern void PSUserObjects();
-
-extern void PSabs();
-
-extern void PSadd();
-
-extern void PSaload();
-
-extern void PSanchorsearch( /* int *truth; */ );
-
-extern void PSand();
-
-extern void PSarc( /* float x, y, r, angle1, angle2; */ );
-
-extern void PSarcn( /* float x, y, r, angle1, angle2; */ );
-
-extern void PSarct( /* float x1, y1, x2, y2, r; */ );
-
-extern void PSarcto( /* float x1, y1, x2, y2, r; float *xt1, *yt1, *xt2, *yt2; */ );
-
-extern void PSarray( /* int len; */ );
-
-extern void PSashow( /* float x, y; char *s; */ );
-
-extern void PSastore();
-
-extern void PSatan();
-
-extern void PSawidthshow( /* float cx, cy; int c; float ax, ay; char *s; */ );
-
-extern void PSbanddevice();
-
-extern void PSbegin();
-
-extern void PSbind();
-
-extern void PSbitshift( /* int shift; */ );
-
-extern void PSbytesavailable( /* int *n; */ );
-
-extern void PScachestatus();
-
-extern void PSceiling();
-
-extern void PScharpath( /* char *s; int b; */ );
-
-extern void PSclear();
-
-extern void PScleardictstack();
-
-extern void PScleartomark();
-
-extern void PSclientXready( /* int i0, i1, i2, i3; */ );
-
-extern void PSclientsync();
-
-extern void PSclip();
-
-extern void PSclippath();
-
-extern void PSclosefile();
-
-extern void PSclosepath();
-
-extern void PScolorimage();
-
-extern void PSconcat( /* float m[]; */ );
-
-extern void PSconcatmatrix();
-
-extern void PScondition();
-
-extern void PScopy( /* int n; */ );
-
-extern void PScopypage();
-
-extern void PScos();
-
-extern void PScount( /* int *n; */ );
-
-extern void PScountdictstack( /* int *n; */ );
-
-extern void PScountexecstack( /* int *n; */ );
-
-extern void PScounttomark( /* int *n; */ );
-
-extern void PScshow( /* char *s; */ );
-
-extern void PScurrentXdrawingfunction( /* int *function; */ );
-
-extern void PScurrentXgcdrawable( /* int *gc, *draw, *x, *y; */ );
-
-extern void PScurrentXgcdrawablecolor( /* int *gc, *draw, *x, *y, colorInfo[]; */ );
-
-extern void PScurrentXoffset( /* int *x, *y; */ );
-
-extern void PScurrentblackgeneration();
-
-extern void PScurrentcacheparams();
-
-extern void PScurrentcmykcolor( /* float *c, *m, *y, *k; */ );
-
-extern void PScurrentcolor();
-
-extern void PScurrentcolorrendering();
-
-extern void PScurrentcolorscreen();
-
-extern void PScurrentcolorspace();
-
-extern void PScurrentcolortransfer();
-
-extern void PScurrentcontext( /* int *cid; */ );
-
-extern void PScurrentdash();
-
-extern void PScurrentdevparams( /* char *dev; */ );
-
-extern void PScurrentdict();
-
-extern void PScurrentfile();
-
-extern void PScurrentflat( /* float *flatness; */ );
-
-extern void PScurrentfont();
-
-extern void PScurrentglobal( /* int *b; */ );
-
-extern void PScurrentgray( /* float *gray; */ );
-
-extern void PScurrentgstate( /* int gst; */ );
-
-extern void PScurrenthalftone();
-
-extern void PScurrenthalftonephase( /* float *x, *y; */ );
-
-extern void PScurrenthsbcolor( /* float *h, *s, *b; */ );
-
-extern void PScurrentlinecap( /* int *linecap; */ );
-
-extern void PScurrentlinejoin( /* int *linejoin; */ );
-
-extern void PScurrentlinewidth( /* float *width; */ );
-
-extern void PScurrentmatrix();
-
-extern void PScurrentmiterlimit( /* float *limit; */ );
-
-extern void PScurrentobjectformat( /* int *code; */ );
-
-extern void PScurrentoverprint( /* int *b; */ );
-
-extern void PScurrentpacking( /* int *b; */ );
-
-extern void PScurrentpagedevice();
-
-extern void PScurrentpoint( /* float *x, *y; */ );
-
-extern void PScurrentrgbcolor( /* float *r, *g, *b; */ );
-
-extern void PScurrentscreen();
-
-extern void PScurrentshared( /* int *b; */ );
-
-extern void PScurrentstrokeadjust( /* int *b; */ );
-
-extern void PScurrentsystemparams();
-
-extern void PScurrenttransfer();
-
-extern void PScurrentundercolorremoval();
-
-extern void PScurrentuserparams();
-
-extern void PScurveto( /* float x1, y1, x2, y2, x3, y3; */ );
-
-extern void PScvi();
-
-extern void PScvlit();
-
-extern void PScvn();
-
-extern void PScvr();
-
-extern void PScvrs();
-
-extern void PScvs();
-
-extern void PScvx();
-
-extern void PSdef();
-
-extern void PSdefaultmatrix();
-
-extern void PSdefinefont();
-
-extern void PSdefineresource( /* char *category; */ );
-
-extern void PSdefineusername( /* int i; char *username; */ );
-
-extern void PSdefineuserobject();
-
-extern void PSdeletefile( /* char *filename; */ );
-
-extern void PSdetach();
-
-extern void PSdeviceinfo();
-
-extern void PSdict( /* int len; */ );
-
-extern void PSdictstack();
-
-extern void PSdiv();
-
-extern void PSdtransform( /* float x1, y1; float *x2, *y2; */ );
-
-extern void PSdup();
-
-extern void PSecho( /* int b; */ );
-
-extern void PSend();
-
-extern void PSeoclip();
-
-extern void PSeofill();
-
-extern void PSeoviewclip();
-
-extern void PSeq();
-
-extern void PSequals();
-
-extern void PSequalsequals();
-
-extern void PSerasepage();
-
-extern void PSerrordict();
-
-extern void PSexch();
-
-extern void PSexec();
-
-extern void PSexecform();
-
-extern void PSexecstack();
-
-extern void PSexecuserobject( /* int userObjIndex; */ );
-
-extern void PSexecuteonly();
-
-extern void PSexit();
-
-extern void PSexp();
-
-extern void PSfalse();
-
-extern void PSfile( /* char *name, *access; */ );
-
-extern void PSfilenameforall();
-
-extern void PSfileposition( /* int *pos; */ );
-
-extern void PSfill();
-
-extern void PSfilter();
-
-extern void PSfindencoding( /* char *key; */ );
-
-extern void PSfindfont( /* char *name; */ );
-
-extern void PSfindresource( /* char *key, *category; */ );
-
-extern void PSflattenpath();
-
-extern void PSfloor();
-
-extern void PSflush();
-
-extern void PSflushfile();
-
-extern void PSfor();
-
-extern void PSforall();
-
-extern void PSfork();
-
-extern void PSframedevice();
-
-extern void PSgcheck( /* int *b; */ );
-
-extern void PSge();
-
-extern void PSget();
-
-extern void PSgetboolean( /* int *it; */ );
-
-extern void PSgetchararray( /* int size; char s[]; */ );
-
-extern void PSgetfloat( /* float *it; */ );
-
-extern void PSgetfloatarray( /* int size; float a[]; */ );
-
-extern void PSgetint( /* int *it; */ );
-
-extern void PSgetintarray( /* int size; int a[]; */ );
-
-extern void PSgetinterval();
-
-extern void PSgetstring( /* char *s; */ );
-
-extern void PSglobaldict();
-
-extern void PSglyphshow( /* char *name; */ );
-
-extern void PSgrestore();
-
-extern void PSgrestoreall();
-
-extern void PSgsave();
-
-extern void PSgstate();
-
-extern void PSgt();
-
-extern void PSidentmatrix();
-
-extern void PSidiv();
-
-extern void PSidtransform( /* float x1, y1; float *x2, *y2; */ );
-
-extern void PSif();
-
-extern void PSifelse();
-
-extern void PSimage();
-
-extern void PSimagemask();
-
-extern void PSindex( /* int i; */ );
-
-extern void PSineofill( /* float x, y; int *b; */ );
-
-extern void PSinfill( /* float x, y; int *b; */ );
-
-extern void PSinitclip();
-
-extern void PSinitgraphics();
-
-extern void PSinitmatrix();
-
-extern void PSinitviewclip();
-
-extern void PSinstroke( /* float x, y; int *b; */ );
-
-extern void PSinueofill( /* float x, y; char nums[]; int n; char ops[]; int l; int *b; */ );
-
-extern void PSinufill( /* float x, y; char nums[]; int n; char ops[]; int l; int *b; */ );
-
-extern void PSinustroke( /* float x, y; char nums[]; int n; char ops[]; int l; int *b; */ );
-
-extern void PSinvertmatrix();
-
-extern void PSitransform( /* float x1, y1; float *x2, *y2; */ );
-
-extern void PSjoin();
-
-extern void PSknown( /* int *b; */ );
-
-extern void PSkshow( /* char *s; */ );
-
-extern void PSlanguagelevel( /* int *n; */ );
-
-extern void PSle();
-
-extern void PSleftbracket();
-
-extern void PSleftleft();
-
-extern void PSlength( /* int *len; */ );
-
-extern void PSlineto( /* float x, y; */ );
-
-extern void PSln();
-
-extern void PSload();
-
-extern void PSlock();
-
-extern void PSlog();
-
-extern void PSloop();
-
-extern void PSlt();
-
-extern void PSmakefont();
-
-extern void PSmakepattern();
-
-extern void PSmark();
-
-extern void PSmatrix();
-
-extern void PSmaxlength( /* int *len; */ );
-
-extern void PSmod();
-
-extern void PSmonitor();
-
-extern void PSmoveto( /* float x, y; */ );
-
-extern void PSmul();
-
-extern void PSne();
-
-extern void PSneg();
-
-extern void PSnewpath();
-
-extern void PSnoaccess();
-
-extern void PSnot();
-
-extern void PSnotify();
-
-extern void PSnull();
-
-extern void PSnulldevice();
-
-extern void PSor();
-
-extern void PSpackedarray();
-
-extern void PSpathbbox( /* float *llx, *lly, *urx, *ury; */ );
-
-extern void PSpathforall();
-
-extern void PSpop();
-
-extern void PSprint();
-
-extern void PSprintobject( /* int tag; */ );
-
-extern void PSproduct();
-
-extern void PSprompt();
-
-extern void PSpstack();
-
-extern void PSput();
-
-extern void PSputinterval();
-
-extern void PSquit();
-
-extern void PSrand();
-
-extern void PSrcheck( /* int *b; */ );
-
-extern void PSrcurveto( /* float x1, y1, x2, y2, x3, y3; */ );
-
-extern void PSread( /* int *b; */ );
-
-extern void PSreadhexstring( /* int *b; */ );
-
-extern void PSreadline( /* int *b; */ );
-
-extern void PSreadonly();
-
-extern void PSreadstring( /* int *b; */ );
-
-extern void PSrealtime( /* int *i; */ );
-
-extern void PSrectclip( /* float x, y, w, h; */ );
-
-extern void PSrectfill( /* float x, y, w, h; */ );
-
-extern void PSrectstroke( /* float x, y, w, h; */ );
-
-extern void PSrectviewclip( /* float x, y, w, h; */ );
-
-extern void PSrenamefile( /* char *oldname, *newname; */ );
-
-extern void PSrenderbands();
-
-extern void PSrepeat();
-
-extern void PSresetfile();
-
-extern void PSresourceforall( /* char *category; */ );
-
-extern void PSresourcestatus( /* char *key, *category; int *b; */ );
-
-extern void PSrestore();
-
-extern void PSreversepath();
-
-extern void PSrevision( /* int *n; */ );
-
-extern void PSrightbracket();
-
-extern void PSrightright();
-
-extern void PSrlineto( /* float x, y; */ );
-
-extern void PSrmoveto( /* float x, y; */ );
-
-extern void PSroll( /* int n, j; */ );
-
-extern void PSrootfont();
-
-extern void PSrotate( /* float angle; */ );
-
-extern void PSround();
-
-extern void PSrrand();
-
-extern void PSrun( /* char *filename; */ );
-
-extern void PSsave();
-
-extern void PSscale( /* float x, y; */ );
-
-extern void PSscalefont( /* float size; */ );
-
-extern void PSscheck( /* int *b; */ );
-
-extern void PSsearch( /* int *b; */ );
-
-extern void PSselectfont( /* char *name; float scale; */ );
-
-extern void PSsendboolean( /* int it; */ );
-
-extern void PSsendchararray( /* char s[]; int size; */ );
-
-extern void PSsendfloat( /* float it; */ );
-
-extern void PSsendfloatarray( /* float a[]; int size; */ );
-
-extern void PSsendint( /* int it; */ );
-
-extern void PSsendintarray( /* int a[]; int size; */ );
-
-extern void PSsendstring( /* char *s; */ );
-
-extern void PSserialnumber( /* int *n; */ );
-
-extern void PSsetXdrawingfunction( /* int function; */ );
-
-extern void PSsetXgcdrawable( /* int gc, draw, x, y; */ );
-
-extern void PSsetXgcdrawablecolor( /* int gc, draw, x, y, colorInfo[]; */ );
-
-extern void PSsetXoffset( /* int x, y; */ );
-
-extern void PSsetXrgbactual( /* float r, g, b; int *success; */ );
-
-extern void PSsetbbox( /* float llx, lly, urx, ury; */ );
-
-extern void PSsetblackgeneration();
-
-extern void PSsetcachedevice( /* float wx, wy, llx, lly, urx, ury; */ );
-
-extern void PSsetcachelimit( /* int n; */ );
-
-extern void PSsetcacheparams();
-
-extern void PSsetcharwidth( /* float wx, wy; */ );
-
-extern void PSsetcmykcolor( /* float c, m, y, k; */ );
-
-extern void PSsetcolor();
-
-extern void PSsetcolorrendering();
-
-extern void PSsetcolorscreen();
-
-extern void PSsetcolorspace();
-
-extern void PSsetcolortransfer();
-
-extern void PSsetdash( /* float pat[]; int size; float offset; */ );
-
-extern void PSsetdevparams();
-
-extern void PSsetfileposition( /* int pos; */ );
-
-extern void PSsetflat( /* float flatness; */ );
-
-extern void PSsetfont( /* int f; */ );
-
-extern void PSsetglobal( /* int b; */ );
-
-extern void PSsetgray( /* float gray; */ );
-
-extern void PSsetgstate( /* int gst; */ );
-
-extern void PSsethalftone();
-
-extern void PSsethalftonephase( /* float x, y; */ );
-
-extern void PSsethsbcolor( /* float h, s, b; */ );
-
-extern void PSsetlinecap( /* int linecap; */ );
-
-extern void PSsetlinejoin( /* int linejoin; */ );
-
-extern void PSsetlinewidth( /* float width; */ );
-
-extern void PSsetmatrix();
-
-extern void PSsetmiterlimit( /* float limit; */ );
-
-extern void PSsetobjectformat( /* int code; */ );
-
-extern void PSsetoverprint( /* int b; */ );
-
-extern void PSsetpacking( /* int b; */ );
-
-extern void PSsetpagedevice();
-
-extern void PSsetpattern();
-
-extern void PSsetrgbcolor( /* float r, g, b; */ );
-
-extern void PSsetscreen();
-
-extern void PSsetshared( /* int b; */ );
-
-extern void PSsetstrokeadjust( /* int b; */ );
-
-extern void PSsetsystemparams();
-
-extern void PSsettransfer();
-
-extern void PSsetucacheparams();
-
-extern void PSsetundercolorremoval();
-
-extern void PSsetuserparams();
-
-extern void PSsetvmthreshold( /* int i; */ );
-
-extern void PSshareddict();
-
-extern void PSshow( /* char *s; */ );
-
-extern void PSshowpage();
-
-extern void PSsin();
-
-extern void PSsqrt();
-
-extern void PSsrand();
-
-extern void PSstack();
-
-extern void PSstart();
-
-extern void PSstartjob( /* int b; char *password; */ );
-
-extern void PSstatus( /* int *b; */ );
-
-extern void PSstatusdict();
-
-extern void PSstop();
-
-extern void PSstopped();
-
-extern void PSstore();
-
-extern void PSstring( /* int len; */ );
-
-extern void PSstringwidth( /* char *s; float *xp, *yp; */ );
-
-extern void PSstroke();
-
-extern void PSstrokepath();
-
-extern void PSsub();
-
-extern void PSsystemdict();
-
-extern void PStoken( /* int *b; */ );
-
-extern void PStransform( /* float x1, y1; float *x2, *y2; */ );
-
-extern void PStranslate( /* float x, y; */ );
-
-extern void PStrue();
-
-extern void PStruncate();
-
-extern void PStype();
-
-extern void PSuappend( /* char nums[]; int n; char ops[]; int l; */ );
-
-extern void PSucache();
-
-extern void PSucachestatus();
-
-extern void PSueofill( /* char nums[]; int n; char ops[]; int l; */ );
-
-extern void PSufill( /* char nums[]; int n; char ops[]; int l; */ );
-
-extern void PSundef( /* char *name; */ );
-
-extern void PSundefinefont( /* char *name; */ );
-
-extern void PSundefineresource( /* char *key, *category; */ );
-
-extern void PSundefineuserobject( /* int userObjIndex; */ );
-
-extern void PSupath( /* int b; */ );
-
-extern void PSuserdict();
-
-extern void PSusertime( /* int *milliseconds; */ );
-
-extern void PSustroke( /* char nums[]; int n; char ops[]; int l; */ );
-
-extern void PSustrokepath( /* char nums[]; int n; char ops[]; int l; */ );
-
-extern void PSversion( /* int bufsize; char buf[]; */ );
-
-extern void PSviewclip();
-
-extern void PSviewclippath();
-
-extern void PSvmreclaim( /* int code; */ );
-
-extern void PSvmstatus( /* int *level, *used, *maximum; */ );
-
-extern void PSwait();
-
-extern void PSwcheck( /* int *b; */ );
-
-extern void PSwhere( /* int *b; */ );
-
-extern void PSwidthshow( /* float x, y; int c; char *s; */ );
-
-extern void PSwrite();
-
-extern void PSwritehexstring();
-
-extern void PSwriteobject( /* int tag; */ );
-
-extern void PSwritestring();
-
-extern void PSwtranslation( /* float *x, *y; */ );
-
-extern void PSxcheck( /* int *b; */ );
-
-extern void PSxor();
-
-extern void PSxshow( /* char *s; float numarray[]; int size; */ );
-
-extern void PSxyshow( /* char *s; float numarray[]; int size; */ );
-
-extern void PSyield();
-
-extern void PSyshow( /* char *s; float numarray[]; int size; */ );
-
-#else /* _NO_PROTO */
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-extern void PSFontDirectory( void );
-
-extern void PSGlobalFontDirectory( void );
-
-extern void PSISOLatin1Encoding( void );
-
-extern void PSSharedFontDirectory( void );
-
-extern void PSStandardEncoding( void );
-
-extern void PSUserObjects( void );
-
-extern void PSabs( void );
-
-extern void PSadd( void );
-
-extern void PSaload( void );
-
-extern void PSanchorsearch(int *truth);
-
-extern void PSand( void );
-
-extern void PSarc(float x, float y, float r, float angle1, float angle2);
-
-extern void PSarcn(float x, float y, float r, float angle1, float angle2);
-
-extern void PSarct(float x1, float y1, float x2, float y2, float r);
-
-extern void PSarcto(float x1, float y1, float x2, float y2, float r, float *xt1, float *yt1, float *xt2, float *yt2);
-
-extern void PSarray(int len);
-
-extern void PSashow(float x, float y, const char *s);
-
-extern void PSastore( void );
-
-extern void PSatan( void );
-
-extern void PSawidthshow(float cx, float cy, int c, float ax, float ay, const char *s);
-
-extern void PSbanddevice( void );
-
-extern void PSbegin( void );
-
-extern void PSbind( void );
-
-extern void PSbitshift(int shift);
-
-extern void PSbytesavailable(int *n);
-
-extern void PScachestatus( void );
-
-extern void PSceiling( void );
-
-extern void PScharpath(const char *s, int b);
-
-extern void PSclear( void );
-
-extern void PScleardictstack( void );
-
-extern void PScleartomark( void );
-
-extern void PSclientXready(int i0, int i1, int i2, int i3);
-
-extern void PSclientsync( void );
-
-extern void PSclip( void );
-
-extern void PSclippath( void );
-
-extern void PSclosefile( void );
-
-extern void PSclosepath( void );
-
-extern void PScolorimage( void );
-
-extern void PSconcat(const float m[]);
-
-extern void PSconcatmatrix( void );
-
-extern void PScondition( void );
-
-extern void PScopy(int n);
-
-extern void PScopypage( void );
-
-extern void PScos( void );
-
-extern void PScount(int *n);
-
-extern void PScountdictstack(int *n);
-
-extern void PScountexecstack(int *n);
-
-extern void PScounttomark(int *n);
-
-extern void PScshow(const char *s);
-
-extern void PScurrentXdrawingfunction(int *function);
-
-extern void PScurrentXgcdrawable(int *gc, int *draw, int *x, int *y);
-
-extern void PScurrentXgcdrawablecolor(int *gc, int *draw, int *x, int *y, int colorInfo[]);
-
-extern void PScurrentXoffset(int *x, int *y);
-
-extern void PScurrentblackgeneration( void );
-
-extern void PScurrentcacheparams( void );
-
-extern void PScurrentcmykcolor(float *c, float *m, float *y, float *k);
-
-extern void PScurrentcolor( void );
-
-extern void PScurrentcolorrendering( void );
-
-extern void PScurrentcolorscreen( void );
-
-extern void PScurrentcolorspace( void );
-
-extern void PScurrentcolortransfer( void );
-
-extern void PScurrentcontext(int *cid);
-
-extern void PScurrentdash( void );
-
-extern void PScurrentdevparams(const char *dev);
-
-extern void PScurrentdict( void );
-
-extern void PScurrentfile( void );
-
-extern void PScurrentflat(float *flatness);
-
-extern void PScurrentfont( void );
-
-extern void PScurrentglobal(int *b);
-
-extern void PScurrentgray(float *gray);
-
-extern void PScurrentgstate(int gst);
-
-extern void PScurrenthalftone( void );
-
-extern void PScurrenthalftonephase(float *x, float *y);
-
-extern void PScurrenthsbcolor(float *h, float *s, float *b);
-
-extern void PScurrentlinecap(int *linecap);
-
-extern void PScurrentlinejoin(int *linejoin);
-
-extern void PScurrentlinewidth(float *width);
-
-extern void PScurrentmatrix( void );
-
-extern void PScurrentmiterlimit(float *limit);
-
-extern void PScurrentobjectformat(int *code);
-
-extern void PScurrentoverprint(int *b);
-
-extern void PScurrentpacking(int *b);
-
-extern void PScurrentpagedevice( void );
-
-extern void PScurrentpoint(float *x, float *y);
-
-extern void PScurrentrgbcolor(float *r, float *g, float *b);
-
-extern void PScurrentscreen( void );
-
-extern void PScurrentshared(int *b);
-
-extern void PScurrentstrokeadjust(int *b);
-
-extern void PScurrentsystemparams( void );
-
-extern void PScurrenttransfer( void );
-
-extern void PScurrentundercolorremoval( void );
-
-extern void PScurrentuserparams( void );
-
-extern void PScurveto(float x1, float y1, float x2, float y2, float x3, float y3);
-
-extern void PScvi( void );
-
-extern void PScvlit( void );
-
-extern void PScvn( void );
-
-extern void PScvr( void );
-
-extern void PScvrs( void );
-
-extern void PScvs( void );
-
-extern void PScvx( void );
-
-extern void PSdef( void );
-
-extern void PSdefaultmatrix( void );
-
-extern void PSdefinefont( void );
-
-extern void PSdefineresource(const char *category);
-
-extern void PSdefineusername(int i, const char *username);
-
-extern void PSdefineuserobject( void );
-
-extern void PSdeletefile(const char *filename);
-
-extern void PSdetach( void );
-
-extern void PSdeviceinfo( void );
-
-extern void PSdict(int len);
-
-extern void PSdictstack( void );
-
-extern void PSdiv( void );
-
-extern void PSdtransform(float x1, float y1, float *x2, float *y2);
-
-extern void PSdup( void );
-
-extern void PSecho(int b);
-
-extern void PSend( void );
-
-extern void PSeoclip( void );
-
-extern void PSeofill( void );
-
-extern void PSeoviewclip( void );
-
-extern void PSeq( void );
-
-extern void PSequals( void );
-
-extern void PSequalsequals( void );
-
-extern void PSerasepage( void );
-
-extern void PSerrordict( void );
-
-extern void PSexch( void );
-
-extern void PSexec( void );
-
-extern void PSexecform( void );
-
-extern void PSexecstack( void );
-
-extern void PSexecuserobject(int userObjIndex);
-
-extern void PSexecuteonly( void );
-
-extern void PSexit( void );
-
-extern void PSexp( void );
-
-extern void PSfalse( void );
-
-extern void PSfile(const char *name, const char *access);
-
-extern void PSfilenameforall( void );
-
-extern void PSfileposition(int *pos);
-
-extern void PSfill( void );
-
-extern void PSfilter( void );
-
-extern void PSfindencoding(const char *key);
-
-extern void PSfindfont(const char *name);
-
-extern void PSfindresource(const char *key, const char *category);
-
-extern void PSflattenpath( void );
-
-extern void PSfloor( void );
-
-extern void PSflush( void );
-
-extern void PSflushfile( void );
-
-extern void PSfor( void );
-
-extern void PSforall( void );
-
-extern void PSfork( void );
-
-extern void PSframedevice( void );
-
-extern void PSgcheck(int *b);
-
-extern void PSge( void );
-
-extern void PSget( void );
-
-extern void PSgetboolean(int *it);
-
-extern void PSgetchararray(int size, char s[]);
-
-extern void PSgetfloat(float *it);
-
-extern void PSgetfloatarray(int size, float a[]);
-
-extern void PSgetint(int *it);
-
-extern void PSgetintarray(int size, int a[]);
-
-extern void PSgetinterval( void );
-
-extern void PSgetstring(char *s);
-
-extern void PSglobaldict( void );
-
-extern void PSglyphshow(const char *name);
-
-extern void PSgrestore( void );
-
-extern void PSgrestoreall( void );
-
-extern void PSgsave( void );
-
-extern void PSgstate( void );
-
-extern void PSgt( void );
-
-extern void PSidentmatrix( void );
-
-extern void PSidiv( void );
-
-extern void PSidtransform(float x1, float y1, float *x2, float *y2);
-
-extern void PSif( void );
-
-extern void PSifelse( void );
-
-extern void PSimage( void );
-
-extern void PSimagemask( void );
-
-extern void PSindex(int i);
-
-extern void PSineofill(float x, float y, int *b);
-
-extern void PSinfill(float x, float y, int *b);
-
-extern void PSinitclip( void );
-
-extern void PSinitgraphics( void );
-
-extern void PSinitmatrix( void );
-
-extern void PSinitviewclip( void );
-
-extern void PSinstroke(float x, float y, int *b);
-
-extern void PSinueofill(float x, float y, const char nums[], int n, const char ops[], int l, int *b);
-
-extern void PSinufill(float x, float y, const char nums[], int n, const char ops[], int l, int *b);
-
-extern void PSinustroke(float x, float y, const char nums[], int n, const char ops[], int l, int *b);
-
-extern void PSinvertmatrix( void );
-
-extern void PSitransform(float x1, float y1, float *x2, float *y2);
-
-extern void PSjoin( void );
-
-extern void PSknown(int *b);
-
-extern void PSkshow(const char *s);
-
-extern void PSlanguagelevel(int *n);
-
-extern void PSle( void );
-
-extern void PSleftbracket( void );
-
-extern void PSleftleft( void );
-
-extern void PSlength(int *len);
-
-extern void PSlineto(float x, float y);
-
-extern void PSln( void );
-
-extern void PSload( void );
-
-extern void PSlock( void );
-
-extern void PSlog( void );
-
-extern void PSloop( void );
-
-extern void PSlt( void );
-
-extern void PSmakefont( void );
-
-extern void PSmakepattern( void );
-
-extern void PSmark( void );
-
-extern void PSmatrix( void );
-
-extern void PSmaxlength(int *len);
-
-extern void PSmod( void );
-
-extern void PSmonitor( void );
-
-extern void PSmoveto(float x, float y);
-
-extern void PSmul( void );
-
-extern void PSne( void );
-
-extern void PSneg( void );
-
-extern void PSnewpath( void );
-
-extern void PSnoaccess( void );
-
-extern void PSnot( void );
-
-extern void PSnotify( void );
-
-extern void PSnull( void );
-
-extern void PSnulldevice( void );
-
-extern void PSor( void );
-
-extern void PSpackedarray( void );
-
-extern void PSpathbbox(float *llx, float *lly, float *urx, float *ury);
-
-extern void PSpathforall( void );
-
-extern void PSpop( void );
-
-extern void PSprint( void );
-
-extern void PSprintobject(int tag);
-
-extern void PSproduct( void );
-
-extern void PSprompt( void );
-
-extern void PSpstack( void );
-
-extern void PSput( void );
-
-extern void PSputinterval( void );
-
-extern void PSquit( void );
-
-extern void PSrand( void );
-
-extern void PSrcheck(int *b);
-
-extern void PSrcurveto(float x1, float y1, float x2, float y2, float x3, float y3);
-
-extern void PSread(int *b);
-
-extern void PSreadhexstring(int *b);
-
-extern void PSreadline(int *b);
-
-extern void PSreadonly( void );
-
-extern void PSreadstring(int *b);
-
-extern void PSrealtime(int *i);
-
-extern void PSrectclip(float x, float y, float w, float h);
-
-extern void PSrectfill(float x, float y, float w, float h);
-
-extern void PSrectstroke(float x, float y, float w, float h);
-
-extern void PSrectviewclip(float x, float y, float w, float h);
-
-extern void PSrenamefile(const char *oldname, const char *newname);
-
-extern void PSrenderbands( void );
-
-extern void PSrepeat( void );
-
-extern void PSresetfile( void );
-
-extern void PSresourceforall(const char *category);
-
-extern void PSresourcestatus(const char *key, const char *category, int *b);
-
-extern void PSrestore( void );
-
-extern void PSreversepath( void );
-
-extern void PSrevision(int *n);
-
-extern void PSrightbracket( void );
-
-extern void PSrightright( void );
-
-extern void PSrlineto(float x, float y);
-
-extern void PSrmoveto(float x, float y);
-
-extern void PSroll(int n, int j);
-
-extern void PSrootfont( void );
-
-extern void PSrotate(float angle);
-
-extern void PSround( void );
-
-extern void PSrrand( void );
-
-extern void PSrun(const char *filename);
-
-extern void PSsave( void );
-
-extern void PSscale(float x, float y);
-
-extern void PSscalefont(float size);
-
-extern void PSscheck(int *b);
-
-extern void PSsearch(int *b);
-
-extern void PSselectfont(const char *name, float scale);
-
-extern void PSsendboolean(int it);
-
-extern void PSsendchararray(const char s[], int size);
-
-extern void PSsendfloat(float it);
-
-extern void PSsendfloatarray(const float a[], int size);
-
-extern void PSsendint(int it);
-
-extern void PSsendintarray(const int a[], int size);
-
-extern void PSsendstring(const char *s);
-
-extern void PSserialnumber(int *n);
-
-extern void PSsetXdrawingfunction(int function);
-
-extern void PSsetXgcdrawable(int gc, int draw, int x, int y);
-
-extern void PSsetXgcdrawablecolor(int gc, int draw, int x, int y, const int colorInfo[]);
-
-extern void PSsetXoffset(int x, int y);
-
-extern void PSsetXrgbactual(float r, float g, float b, int *success);
-
-extern void PSsetbbox(float llx, float lly, float urx, float ury);
-
-extern void PSsetblackgeneration( void );
-
-extern void PSsetcachedevice(float wx, float wy, float llx, float lly, float urx, float ury);
-
-extern void PSsetcachelimit(int n);
-
-extern void PSsetcacheparams( void );
-
-extern void PSsetcharwidth(float wx, float wy);
-
-extern void PSsetcmykcolor(float c, float m, float y, float k);
-
-extern void PSsetcolor( void );
-
-extern void PSsetcolorrendering( void );
-
-extern void PSsetcolorscreen( void );
-
-extern void PSsetcolorspace( void );
-
-extern void PSsetcolortransfer( void );
-
-extern void PSsetdash(const float pat[], int size, float offset);
-
-extern void PSsetdevparams( void );
-
-extern void PSsetfileposition(int pos);
-
-extern void PSsetflat(float flatness);
-
-extern void PSsetfont(int f);
-
-extern void PSsetglobal(int b);
-
-extern void PSsetgray(float gray);
-
-extern void PSsetgstate(int gst);
-
-extern void PSsethalftone( void );
-
-extern void PSsethalftonephase(float x, float y);
-
-extern void PSsethsbcolor(float h, float s, float b);
-
-extern void PSsetlinecap(int linecap);
-
-extern void PSsetlinejoin(int linejoin);
-
-extern void PSsetlinewidth(float width);
-
-extern void PSsetmatrix( void );
-
-extern void PSsetmiterlimit(float limit);
-
-extern void PSsetobjectformat(int code);
-
-extern void PSsetoverprint(int b);
-
-extern void PSsetpacking(int b);
-
-extern void PSsetpagedevice( void );
-
-extern void PSsetpattern( void );
-
-extern void PSsetrgbcolor(float r, float g, float b);
-
-extern void PSsetscreen( void );
-
-extern void PSsetshared(int b);
-
-extern void PSsetstrokeadjust(int b);
-
-extern void PSsetsystemparams( void );
-
-extern void PSsettransfer( void );
-
-extern void PSsetucacheparams( void );
-
-extern void PSsetundercolorremoval( void );
-
-extern void PSsetuserparams( void );
-
-extern void PSsetvmthreshold(int i);
-
-extern void PSshareddict( void );
-
-extern void PSshow(const char *s);
-
-extern void PSshowpage( void );
-
-extern void PSsin( void );
-
-extern void PSsqrt( void );
-
-extern void PSsrand( void );
-
-extern void PSstack( void );
-
-extern void PSstart( void );
-
-extern void PSstartjob(int b, const char *password);
-
-extern void PSstatus(int *b);
-
-extern void PSstatusdict( void );
-
-extern void PSstop( void );
-
-extern void PSstopped( void );
-
-extern void PSstore( void );
-
-extern void PSstring(int len);
-
-extern void PSstringwidth(const char *s, float *xp, float *yp);
-
-extern void PSstroke( void );
-
-extern void PSstrokepath( void );
-
-extern void PSsub( void );
-
-extern void PSsystemdict( void );
-
-extern void PStoken(int *b);
-
-extern void PStransform(float x1, float y1, float *x2, float *y2);
-
-extern void PStranslate(float x, float y);
-
-extern void PStrue( void );
-
-extern void PStruncate( void );
-
-extern void PStype( void );
-
-extern void PSuappend(const char nums[], int n, const char ops[], int l);
-
-extern void PSucache( void );
-
-extern void PSucachestatus( void );
-
-extern void PSueofill(const char nums[], int n, const char ops[], int l);
-
-extern void PSufill(const char nums[], int n, const char ops[], int l);
-
-extern void PSundef(const char *name);
-
-extern void PSundefinefont(const char *name);
-
-extern void PSundefineresource(const char *key, const char *category);
-
-extern void PSundefineuserobject(int userObjIndex);
-
-extern void PSupath(int b);
-
-extern void PSuserdict( void );
-
-extern void PSusertime(int *milliseconds);
-
-extern void PSustroke(const char nums[], int n, const char ops[], int l);
-
-extern void PSustrokepath(const char nums[], int n, const char ops[], int l);
-
-extern void PSversion(int bufsize, char buf[]);
-
-extern void PSviewclip( void );
-
-extern void PSviewclippath( void );
-
-extern void PSvmreclaim(int code);
-
-extern void PSvmstatus(int *level, int *used, int *maximum);
-
-extern void PSwait( void );
-
-extern void PSwcheck(int *b);
-
-extern void PSwhere(int *b);
-
-extern void PSwidthshow(float x, float y, int c, const char *s);
-
-extern void PSwrite( void );
-
-extern void PSwritehexstring( void );
-
-extern void PSwriteobject(int tag);
-
-extern void PSwritestring( void );
-
-extern void PSwtranslation(float *x, float *y);
-
-extern void PSxcheck(int *b);
-
-extern void PSxor( void );
-
-extern void PSxshow(const char *s, const float numarray[], int size);
-
-extern void PSxyshow(const char *s, const float numarray[], int size);
-
-extern void PSyield( void );
-
-extern void PSyshow(const char *s, const float numarray[], int size);
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _NO_PROTO */
-
-#endif /* PSOPS_H */
diff --git a/xc/lib/dps/psopstack.psw b/xc/lib/dps/psopstack.psw
deleted file mode 100644
index d78ad6b7c..000000000
--- a/xc/lib/dps/psopstack.psw
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * psopstack.psw -- wrapped procedures for sending and getting operands
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSgetboolean(| boolean *it)
- it
-endps
-
-defineps PSgetchararray(int size | char s[size])
- s
-endps
-
-defineps PSgetfloat(| float *it)
- it
-endps
-
-defineps PSgetfloatarray(int size | float a[size])
- dup type /arraytype eq { a } { size { a } repeat } ifelse
-endps
-
-defineps PSgetint(| int *it)
- it
-endps
-
-defineps PSgetintarray(int size | int a[size])
- dup type /arraytype eq { a } { size { a } repeat } ifelse
-endps
-
-defineps PSgetstring(| char *s)
- s
-endps
-
-defineps PSsendboolean(boolean it)
- it
-endps
-
-defineps PSsendchararray(char s[size]; int size)
- (s)
-endps
-
-defineps PSsendfloat(float it)
- it
-endps
-
-defineps PSsendfloatarray(float a[size]; int size)
- a
-endps
-
-defineps PSsendint(int it)
- it
-endps
-
-defineps PSsendintarray(int a[size]; int size)
- a
-endps
-
-defineps PSsendstring(char *s)
- (s)
-endps
-
-
-
diff --git a/xc/lib/dps/pspathops.psw b/xc/lib/dps/pspathops.psw
deleted file mode 100644
index e4c378282..000000000
--- a/xc/lib/dps/pspathops.psw
+++ /dev/null
@@ -1,169 +0,0 @@
-/* pspathops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSarc(float x, y, r, angle1, angle2)
- x y r angle1 angle2 arc
-endps
-
-defineps PSarcn(float x, y, r, angle1, angle2)
- x y r angle1 angle2 arcn
-endps
-
-defineps PSarct(float x1, y1, x2, y2, r)
- x1 y1 x2 y2 r arct
-endps
-
-defineps PSarcto(float x1, y1, x2, y2, r | float *xt1, *yt1, *xt2, *yt2)
- x1 y1 x2 y2 r arcto yt2 xt2 yt1 xt1
-endps
-
-defineps PScharpath(char *s; boolean b)
- (s) b charpath
-endps
-
-defineps PSclip()
- clip
-endps
-
-defineps PSclippath()
- clippath
-endps
-
-defineps PSclosepath()
- closepath
-endps
-
-defineps PScurveto(float x1, y1, x2, y2, x3, y3)
- x1 y1 x2 y2 x3 y3 curveto
-endps
-
-defineps PSeoclip()
- eoclip
-endps
-
-defineps PSeoviewclip()
- eoviewclip
-endps
-
-defineps PSflattenpath()
- flattenpath
-endps
-
-defineps PSinitclip()
- initclip
-endps
-
-defineps PSinitviewclip()
- initviewclip
-endps
-
-defineps PSlineto(float x, y)
- x y lineto
-endps
-
-defineps PSmoveto(float x, y)
- x y moveto
-endps
-
-defineps PSnewpath()
- newpath
-endps
-
-defineps PSpathbbox( | float *llx, *lly, *urx, *ury)
- pathbbox ury urx lly llx
-endps
-
-defineps PSpathforall()
- pathforall
-endps
-
-defineps PSrcurveto(float x1, y1, x2, y2, x3, y3)
- x1 y1 x2 y2 x3 y3 rcurveto
-endps
-
-defineps PSrectclip(float x, y, w, h)
- x y w h rectclip
-endps
-
-defineps PSrectviewclip(float x, y, w, h)
- x y w h rectviewclip
-endps
-
-defineps PSreversepath()
- reversepath
-endps
-
-defineps PSrlineto(float x, y)
- x y rlineto
-endps
-
-defineps PSrmoveto(float x, y)
- x y rmoveto
-endps
-
-defineps PSsetbbox(float llx, lly, urx, ury)
- llx lly urx ury setbbox
-endps
-
-defineps PSsetucacheparams()
- setucacheparams
-endps
-
-defineps PSuappend(char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] uappend
-endps
-
-defineps PSucache()
- ucache
-endps
-
-defineps PSucachestatus()
- ucachestatus
-endps
-
-defineps PSupath(boolean b)
- b upath
-endps
-
-defineps PSviewclip()
- viewclip
-endps
-
-defineps PSviewclippath()
- viewclippath
-endps
-
diff --git a/xc/lib/dps/pspntops.psw b/xc/lib/dps/pspntops.psw
deleted file mode 100644
index 2f7beef00..000000000
--- a/xc/lib/dps/pspntops.psw
+++ /dev/null
@@ -1,129 +0,0 @@
-/* pspntops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSashow(float x, y; char *s)
- x y (s) ashow
-endps
-
-defineps PSawidthshow(float cx, cy; int c; float ax, ay; char *s)
- cx cy c ax ay (s) awidthshow
-endps
-
-defineps PScopypage()
- copypage
-endps
-
-defineps PSeofill()
- eofill
-endps
-
-defineps PSerasepage()
- erasepage
-endps
-
-defineps PSfill()
- fill
-endps
-
-defineps PSimage()
- image
-endps
-
-defineps PSimagemask()
- imagemask
-endps
-
-defineps PSkshow(char *s)
- (s) kshow
-endps
-
-defineps PSrectfill(float x, y, w, h)
- x y w h rectfill
-endps
-
-defineps PSrectstroke(float x, y, w, h)
- x y w h rectstroke
-endps
-
-defineps PSshow(char *s)
- (s) show
-endps
-
-defineps PSshowpage()
- showpage
-endps
-
-defineps PSstroke()
- stroke
-endps
-
-defineps PSstrokepath()
- strokepath
-endps
-
-defineps PSueofill(char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ueofill
-endps
-
-defineps PSufill(char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ufill
-endps
-
-defineps PSustroke(char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ustroke
-endps
-
-defineps PSustrokepath(char nums[n]; int n; char ops[l]; int l)
- [(nums) (ops)] ustrokepath
-endps
-
-defineps PSwidthshow(float x, y; int c; char *s)
- x y c (s) widthshow
-endps
-
-defineps PSxshow(char *s; float numarray[size]; int size)
- (s) numarray xshow
-endps
-
-defineps PSxyshow(char *s; float numarray[size]; int size)
- (s) numarray xyshow
-endps
-
-defineps PSyshow(char *s; float numarray[size]; int size)
- (s) numarray yshow
-endps
-
diff --git a/xc/lib/dps/pssysops.psw b/xc/lib/dps/pssysops.psw
deleted file mode 100644
index 024d4fd52..000000000
--- a/xc/lib/dps/pssysops.psw
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * pssysops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSbind()
- bind
-endps
-
-defineps PScleardictstack()
- cleardictstack
-endps
-
-defineps PScountdictstack( | int *n)
- countdictstack n
-endps
-
-defineps PScountexecstack( | int *n)
- countexecstack n
-endps
-
-defineps PScurrentdict()
- currentdict
-endps
-
-defineps PScurrentpacking( | boolean *b)
- currentpacking b
-endps
-
-defineps PScurrentshared( | boolean *b)
- currentshared b
-endps
-
-defineps PSdeviceinfo()
- deviceinfo
-endps
-
-defineps PSerrordict()
- errordict
-endps
-
-defineps PSexec()
- exec
-endps
-
-defineps PSprompt()
- prompt
-endps
-
-defineps PSquit()
- quit
-endps
-
-defineps PSrand()
- rand
-endps
-
-defineps PSrealtime( | int *i)
- realtime i
-endps
-
-defineps PSrestore()
- restore
-endps
-
-defineps PSrrand()
- rrand
-endps
-
-defineps PSrun(char *filename)
- (filename) run
-endps
-
-defineps PSsave()
- save
-endps
-
-defineps PSsetpacking(boolean b)
- b setpacking
-endps
-
-defineps PSsetshared(boolean b)
- b setshared
-endps
-
-defineps PSsrand()
- srand
-endps
-
-defineps PSstart()
- start
-endps
-
-defineps PStype()
- type
-endps
-
-defineps PSundef(char *name)
- /name undef
-endps
-
-defineps PSusertime( | int *milliseconds)
- usertime milliseconds
-endps
-
-defineps PSversion(int bufsize | char buf[bufsize])
- version buf
-endps
-
-defineps PSvmreclaim(int code)
- code vmreclaim
-endps
-
-defineps PSvmstatus( | int *level, *used, *maximum)
- vmstatus maximum used level
-endps
-
diff --git a/xc/lib/dps/pswinops.psw b/xc/lib/dps/pswinops.psw
deleted file mode 100644
index 4a6a2db5a..000000000
--- a/xc/lib/dps/pswinops.psw
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * pswinops.psw
- *
- * (c) Copyright 1988-1994 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
- */
-
-defineps PSineofill(float x, y | boolean *b)
- x y ineofill b
-endps
-
-defineps PSinfill(float x, y | boolean *b)
- x y infill b
-endps
-
-defineps PSinstroke(float x, y | boolean *b)
- x y instroke b
-endps
-
-defineps PSinueofill(float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b)
- x y [(nums) (ops)] inueofill b
-endps
-
-defineps PSinufill(float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b)
- x y [(nums) (ops)] inufill b
-endps
-
-defineps PSinustroke(float x, y; char nums[n]; int n; char ops[l]; int l | boolean *b)
- x y [(nums) (ops)] inustroke b
-endps
-
-defineps PSwtranslation( | float *x, *y)
- wtranslation y x
-endps
-
diff --git a/xc/lib/dps/publictypes.h b/xc/lib/dps/publictypes.h
deleted file mode 100644
index 54657a436..000000000
--- a/xc/lib/dps/publictypes.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * publictypes.h
- *
- * (c) Copyright 1984-1994 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
- */
-
-#ifndef PUBLICTYPES_H
-#define PUBLICTYPES_H
-
-/*
- * Note: for the moment we depend absolutely on an int being the same
- * as a long int and being at least 32 bits.
- */
-
-/* Inline Functions */
-
-#define MIN(a,b) ((a)<(b)?(a):(b))
-#define MAX(a,b) ((a)>(b)?(a):(b))
-
-/* Declarative Sugar */
-
-/* Type boolean based derived from unsigned int */
-
-typedef unsigned int boolean;
-typedef long int integer;
-
-#define true 1
-#define false 0
-
-/* Generic Pointers */
-
-#ifndef NULL
-#define NULL 0
-#endif /* NULL */
-
-#define NIL NULL
-
-#endif /* PUBLICTYPES_H */
diff --git a/xc/lib/dpstk/CSBwraps.psw b/xc/lib/dpstk/CSBwraps.psw
deleted file mode 100644
index 02a2041ee..000000000
--- a/xc/lib/dpstk/CSBwraps.psw
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * CSBwraps.psw
- *
- * (c) Copyright 1993-1994 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
- */
-
-defineps _DPSCColormapMatch(DPSContext ctxt; int colormap | boolean *match)
- currentXgcdrawablecolor % gc draw x y [....colormap...]
- 10 get colormap eq match % gc draw x y
- pop pop pop pop
-endps
-
-defineps _DPSCTriangle(DPSContext ctxt; double h, w)
- newpath
- 0 0 moveto
- w 0 rlineto
- 0 h rlineto
- closepath
- fill
-endps
-
-defineps _DPSCShowFillMe(DPSContext ctxt; char *str)
- /Helvetica-Bold 12 selectfont
- 2 5 moveto
- 0 setgray
- (str) show
-endps
-
-defineps _DPSCShowMessage(DPSContext ctxt; char *str)
- 1 setgray
- 0 0 1000 1000 rectfill
- /Helvetica-Bold 12 selectfont
- 10 2 moveto
- 0 setgray
- (str) show
-endps
-
-defineps _DPSCRGBBlend(DPSContext ctxt; double x, y, width, height;
- char *function; int steps)
- gsave
- x y translate
- width steps div
- 0 1 steps 1 sub {
- steps div (function) cvx exec setrgbcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
-endps
-
-defineps _DPSCHSBBlend(DPSContext ctxt; double x, y, width, height;
- char *function; int steps)
- gsave
- x y translate
- width steps div
- 0 1 steps 1 sub {
- steps div (function) cvx exec sethsbcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
-endps
-
-defineps _DPSCCMYKBlend(DPSContext ctxt; double x, y, width, height;
- char *function; int steps)
- gsave
- x y translate
- width steps div
- 0 1 steps 1 sub {
- steps div (function) cvx exec setcmykcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
-endps
-
-defineps _DPSCGrayBlend(DPSContext ctxt; double x, y, width, height;
- char *function; int steps)
- gsave
- x y translate
- width steps div
- 0 1 steps 1 sub {
- steps div (function) cvx exec setgray
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
-endps
-
-defineps _DPSCGetInvCTM(DPSContext ctxt; | float invctm[6])
- matrix currentmatrix matrix invertmatrix invctm
-endps
-
-defineps _DPSCDoRGBColorPalette(DPSContext ctxt; char *func;
- double red, green, blue; double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div red green blue 4 -1 roll func setrgbcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCDoCMYKColorPalette(DPSContext ctxt; char *func;
- double cyan, magenta, yellow, black;
- double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div cyan magenta yellow black 5 -1 roll func setcmykcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCDoHSBColorPalette(DPSContext ctxt; char *func;
- double hue, sat, bright;
- double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div hue sat bright 4 -1 roll func sethsbcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCDoGrayColorPalette(DPSContext ctxt; char *func;
- double gray; double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div gray exch func setgray
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-
-defineps _DPSCDoRGBPalette(DPSContext ctxt; char *func;
- double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div func setrgbcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCDoCMYKPalette(DPSContext ctxt; char *func;
- double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div func setcmykcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCDoHSBPalette(DPSContext ctxt; char *func;
- double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div func sethsbcolor
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCDoGrayPalette(DPSContext ctxt; char *func;
- double width, height;
- int steps | boolean *success)
- mark {
- gsave
- 0 0 translate
- width steps div
- 0 1 steps 1 sub {
- steps div func setgray
- dup 0 0 3 -1 roll height rectfill
- dup 0 translate
- } for
- pop
- grestore
- } stopped not success cleartomark
-endps
-
-defineps _DPSCQueryRGBColorPalette(DPSContext ctxt; char *func;
- double pct, red, green, blue; |
- float *redOut, *greenOut, *blueOut;
- boolean *success)
- mark {
- red green blue pct func
- } stopped dup not success {0 0 0} if
- blueOut greenOut redOut cleartomark
-endps
-
-defineps _DPSCQueryCMYKColorPalette(DPSContext ctxt; char *func;
- double pct, cyan, magenta, yellow, black; |
- float *cyanOut, *magentaOut, *yellowOut,
- *blackOut; boolean *success)
- mark {
- cyan magenta yellow black pct func
- } stopped dup not success {0 0 0 0} if
- blackOut yellowOut magentaOut cyanOut cleartomark
-endps
-
-defineps _DPSCQueryHSBColorPalette(DPSContext ctxt; char *func;
- double pct, hue, sat, bright; |
- float *hueOut, *satOut, *brightOut;
- boolean *success)
- mark {
- hue sat bright pct func
- } stopped dup not success {0 0 0} if
- brightOut satOut hueOut cleartomark
-endps
-
-defineps _DPSCQueryGrayColorPalette(DPSContext ctxt; char *func;
- double pct, gray; |
- float *grayOut; boolean *success)
- mark {
- gray pct func
- } stopped dup not success {0} if
- grayOut cleartomark
-endps
-
-
-defineps _DPSCQueryRGBPalette(DPSContext ctxt; char *func; double pct; |
- float *redOut, *greenOut, *blueOut;
- boolean *success)
- mark {
- pct func
- } stopped dup not success {0 0 0} if
- blueOut greenOut redOut cleartomark
-endps
-
-defineps _DPSCQueryCMYKPalette(DPSContext ctxt; char *func; double pct; |
- float *cyanOut, *magentaOut, *yellowOut,
- *blackOut; boolean *success)
- mark {
- pct func
- } stopped dup not success {0 0 0 0} if
- blackOut yellowOut magentaOut cyanOut cleartomark
-endps
-
-defineps _DPSCQueryHSBPalette(DPSContext ctxt; char *func; double pct; |
- float *hueOut, *satOut, *brightOut;
- boolean *success)
- mark {
- pct func
- } stopped dup not success {0 0 0} if
- brightOut satOut hueOut cleartomark
-endps
-
-defineps _DPSCQueryGrayPalette(DPSContext ctxt; char *func; double pct; |
- float *grayOut; boolean *success)
- mark {
- pct func
- } stopped dup not success {0} if
- grayOut cleartomark
-endps
-
diff --git a/xc/lib/dpstk/ColorSB.c b/xc/lib/dpstk/ColorSB.c
deleted file mode 100644
index e783c2d5c..000000000
--- a/xc/lib/dpstk/ColorSB.c
+++ /dev/null
@@ -1,3393 +0,0 @@
-/*
- * ColorSB.c
- *
- * (c) Copyright 1993-1994 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
- */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/ShellP.h>
-#include <stdlib.h>
-#include <Xm/Xm.h>
-
-/* There are no words to describe how I feel about having to do this */
-
-#if XmVersion > 1001
-#include <Xm/ManagerP.h>
-#else
-#include <Xm/XmP.h>
-#endif
-
-#include <Xm/Form.h>
-#include <Xm/Label.h>
-#include <Xm/LabelG.h>
-#include <Xm/PushB.h>
-#include <Xm/PushBG.h>
-#include <Xm/SeparatoG.h>
-#include <Xm/DrawingA.h>
-#include <Xm/Scale.h>
-#include <Xm/RowColumn.h>
-#include <Xm/Frame.h>
-#include <Xm/MessageB.h>
-#include "DPS/dpsXclient.h"
-#include "dpsXcommonI.h"
-#include "DPS/dpsXshare.h"
-#include "eyedrop16.xbm"
-#include "eyedropmask16.xbm"
-#include "eyedrop32.xbm"
-#include "eyedropmask32.xbm"
-#include "heyedrop.xbm"
-#include "square.xbm"
-#include "squaremask.xbm"
-#include "CSBwraps.h"
-#include <math.h>
-#include <stdio.h>
-#include <pwd.h>
-#include "DPS/ColorSBP.h"
-
-#define PATH_BUF_SIZE 1024
-
-/* Turn a string into a compound string */
-#define CS(str, w) CreateSharedCS(str, w)
-
-#undef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#undef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#define TO_PCT(val) ((int) (val * 100.0 + 0.5))
-#define TO_X(color) ((color) * 65535)
-
-#define Offset(field) XtOffsetOf(ColorSelectionBoxRec, csb.field)
-
-static XtResource resources[] = {
- {XtNcontext, XtCContext, XtRDPSContext, sizeof(DPSContext),
- Offset(context), XtRDPSContext, (XtPointer) NULL},
- {XtNrgbLabels, XtCRgbLabels, XtRString, sizeof(String),
- Offset(rgb_labels), XtRString, (XtPointer) "R:G:B"},
- {XtNcmykLabels, XtCCmykLabels, XtRString, sizeof(String),
- Offset(cmyk_labels), XtRString, (XtPointer) "C:M:Y:K"},
- {XtNhsbLabels, XtCHsbLabels, XtRString, sizeof(String),
- Offset(hsb_labels), XtRString, (XtPointer) "H:S:B"},
- {XtNgrayLabels, XtCGrayLabels, XtRString, sizeof(String),
- Offset(gray_labels), XtRString, (XtPointer) "Gray"},
- {XtNcellSize, XtCCellSize, XtRDimension, sizeof(Dimension),
- Offset(cell_size), XtRImmediate, (XtPointer) 15},
- {XtNnumCells, XtCNumCells, XtRShort, sizeof(short),
- Offset(num_cells), XtRImmediate, (XtPointer) 30},
- {XtNfillMe, XtCFillMe, XtRString, sizeof(String),
- Offset(fill_me), XtRString, (XtPointer) "Fill me with colors"},
- {XtNcurrentSpace, XtCCurrentSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(current_space), XtRImmediate, (XtPointer) CSBSpaceHSB},
- {XtNcurrentRendering, XtCCurrentRendering, XtRRenderingType,
- sizeof(CSBRenderingType), Offset(current_rendering),
- XtRImmediate, (XtPointer) CSBDisplayDPS},
- {XtNcurrentPalette, XtCCurrentPalette, XtRShort, sizeof(short),
- Offset(current_palette), XtRImmediate, (XtPointer) 0},
- {XtNbrokenPaletteLabel, XtCBrokenPaletteLabel, XtRString,
- sizeof(String), Offset(broken_palette_label),
- XtRString, (XtPointer) "(broken)"},
- {XtNbrokenPaletteMessage, XtCBrokenPaletteMessage, XtRString,
- sizeof(String), Offset(broken_palette_message),
- XtRString, (XtPointer) "The current palette contains an error"},
-
- {XtNpalette0Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[0]), XtRString, (XtPointer) NULL},
- {XtNpalette0Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[0]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette0ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[0]), XtRImmediate, (XtPointer) False},
- {XtNpalette0Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[0]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette1Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[1]), XtRString, (XtPointer) NULL},
- {XtNpalette1Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[1]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette1ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[1]), XtRImmediate, (XtPointer) False},
- {XtNpalette1Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[1]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette2Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[2]), XtRString, (XtPointer) NULL},
- {XtNpalette2Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[2]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette2ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[2]), XtRImmediate, (XtPointer) False},
- {XtNpalette2Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[2]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette3Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[3]), XtRString, (XtPointer) NULL},
- {XtNpalette3Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[3]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette3ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[3]), XtRImmediate, (XtPointer) False},
- {XtNpalette3Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[3]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette4Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[4]), XtRString, (XtPointer) NULL},
- {XtNpalette4Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[4]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette4ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[4]), XtRImmediate, (XtPointer) False},
- {XtNpalette4Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[4]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette5Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[5]), XtRString, (XtPointer) NULL},
- {XtNpalette5Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[5]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette5ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[5]), XtRImmediate, (XtPointer) False},
- {XtNpalette5Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[5]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette6Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[6]), XtRString, (XtPointer) NULL},
- {XtNpalette6Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[6]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette6ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[6]), XtRImmediate, (XtPointer) False},
- {XtNpalette6Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[6]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette7Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[7]), XtRString, (XtPointer) NULL},
- {XtNpalette7Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[7]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette7ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[7]), XtRImmediate, (XtPointer) False},
- {XtNpalette7Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[7]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette8Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[8]), XtRString, (XtPointer) NULL},
- {XtNpalette8Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[8]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette8ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[8]), XtRImmediate, (XtPointer) False},
- {XtNpalette8Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[8]), XtRImmediate, (XtPointer) NULL},
-
- {XtNpalette9Label, XtCPaletteLabel, XtRString, sizeof(String),
- Offset(palette_label[9]), XtRString, (XtPointer) NULL},
- {XtNpalette9Space, XtCPaletteSpace, XtRColorSpace, sizeof(CSBColorSpace),
- Offset(palette_space[9]), XtRImmediate, (XtPointer) CSBSpaceRGB},
- {XtNpalette9ColorDependent, XtCPaletteColorDependent,
- XtRBoolean, sizeof(Boolean),
- Offset(palette_color_dependent[9]), XtRImmediate, (XtPointer) False},
- {XtNpalette9Function, XtCPaletteFunction, XtRString, sizeof(String),
- Offset(palette_function[9]), XtRImmediate, (XtPointer) NULL},
-
- {XtNokCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(ok_callback), XtRCallback, (XtPointer) NULL},
- {XtNapplyCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(apply_callback), XtRCallback, (XtPointer) NULL},
- {XtNresetCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(reset_callback), XtRCallback, (XtPointer) NULL},
- {XtNcancelCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(cancel_callback), XtRCallback, (XtPointer) NULL},
- {XtNvalueChangedCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(value_changed_callback), XtRCallback, (XtPointer) NULL}
-};
-
-static void ClassInitialize(), ClassPartInitialize(), Initialize(), Destroy(),
- ChangeManaged(), Realize(), Resize(), GetColor();
-static Boolean SetValues(), SetColor();
-static XtGeometryResult GeometryManager();
-
-static void CreateChildren(), UpdateColorSpaces(), FillPatch(),
- SetBackground();
-static void SetSliders(), SetRGBValues(), SetCMYKValues(), SetHSBValues(),
- SetGrayValues(), ChangeLabel(), SetColorSpace(), SetRendering();
-static void FormResize(), EyedropPointer(), PatchPress(), PatchRelease(),
- DrawDock(), DockPress(), DrawPalette(),
- PalettePress(), InitializeDock(), SaveDockContents();
-static void SetRGBCallback(), SetCMYKCallback(),
- SetHSBCallback(), SetGrayCallback(),
- Slider1Callback(), Slider2Callback(),
- Slider3Callback(), Slider4Callback(),
- FillPatchCallback(), DrawDockCallback(), DrawPaletteCallback(),
- DoEyedropCallback(), OKCallback(), ApplyCallback();
-
-ColorSelectionBoxClassRec colorSelectionBoxClassRec = {
- /* Core class part */
- {
- /* superclass */ (WidgetClass) &xmManagerClassRec,
- /* class_name */ "ColorSelectionBox",
- /* widget_size */ sizeof(ColorSelectionBoxRec),
- /* class_initialize */ ClassInitialize,
- /* class_part_initialize */ ClassPartInitialize,
- /* class_inited */ False,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ Realize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ True,
- /* compress_exposure */ XtExposeCompressMultiple,
- /* compress_enterleave */ True,
- /* visible_interest */ False,
- /* destroy */ Destroy,
- /* resize */ Resize,
- /* expose */ NULL,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ XtInheritQueryGeometry,
- /* display_accelerator */ NULL,
- /* extension */ NULL,
- },
- /* Composite class part */
- {
- /* geometry_manager */ GeometryManager,
- /* change_managed */ ChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL,
- },
- /* Constraint class part */
- {
- /* resources */ NULL,
- /* num_resources */ 0,
- /* constraint_size */ 0,
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ NULL,
- /* extension */ NULL,
- },
- /* Manager class part */
- {
- /* translations */ XtInheritTranslations,
- /* syn_resources */ NULL,
- /* num_syn_resources */ 0,
- /* syn_constraint_resources */ NULL,
- /* num_syn_constraint_resources */ 0,
- /* parent_process */ XmInheritParentProcess,
- /* extension */ NULL,
- },
- /* ColorSelectionBox class part */
- {
- /* set_color */ SetColor,
- /* get_color */ GetColor,
- /* extension */ NULL,
- }
-};
-
-WidgetClass colorSelectionBoxWidgetClass =
- (WidgetClass) &colorSelectionBoxClassRec;
-
-static XmString CreateSharedCS(str, w)
- String str;
- Widget w;
-{
- XrmValue src, dst;
- XmString result;
-
- src.addr = str;
- src.size = strlen(str);
-
- dst.addr = (caddr_t) &result;
- dst.size = sizeof(result);
-
- if (XtConvertAndStore(w, XtRString, &src, XmRXmString, &dst)) {
- return result;
- } else return NULL;
-}
-
-static Boolean LowerCase(from, to, size)
- register String from, to;
- int size;
-{
- register char ch;
- register int i;
-
- for (i = 0; i < size; i++) {
- ch = from[i];
- if (ch >= 'A' && ch <= 'Z') to[i] = ch - 'A' + 'a';
- else to[i] = ch;
- if (ch == '\0') return False;
- }
- return TRUE;
-}
-
-/* ARGSUSED */
-
-static Boolean CvtStringToColorSpace(dpy, args, num_args, from, to, data)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr from, to;
- XtPointer *data;
-{
-#define LOWER_SIZE 5
- char lower[LOWER_SIZE]; /* Lower cased string value */
- Boolean badConvert;
- static CSBColorSpace c;
-
- if (*num_args != 0) { /* Check for correct number */
- XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
- "cvtStringToColorSpace", "wrongParameters",
- "XtToolkitError",
- "String to colorspace conversion needs no extra arguments",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- /* Lower case the value */
- badConvert = LowerCase(from->addr, lower, LOWER_SIZE);
-
- /* Try to convert if a short enough string specified */
- if (!badConvert) {
- if (strcmp(lower, "rgb") == 0) c = CSBSpaceRGB;
- else if (strcmp(lower, "cmyk") == 0) c = CSBSpaceCMYK;
- else if (strcmp(lower, "hsb") == 0) c = CSBSpaceHSB;
- else if (strcmp(lower, "gray") == 0) c = CSBSpaceGray;
- else if (strcmp(lower, "grey") == 0) c = CSBSpaceGray;
- else badConvert = True;
- }
-
- /* String too long or unknown value -- issue warning */
- if (badConvert) {
- XtDisplayStringConversionWarning(dpy, from->addr, "ColorSpace");
- } else {
- if (to->addr == NULL) to->addr = (caddr_t) &c;
-
- else if (to->size < sizeof(CSBColorSpace)) badConvert = TRUE;
- else *(CSBColorSpace *) to->addr = c;
-
- to->size = sizeof(CSBColorSpace);
- }
- return !badConvert;
-#undef LOWER_SIZE
-}
-
-/* ARGSUSED */
-
-static Boolean CvtStringToRenderingType(dpy, args, num_args, from, to, data)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr from, to;
- XtPointer *data;
-{
-#define LOWER_SIZE 5
- char lower[LOWER_SIZE]; /* Lower cased string value */
- Boolean badConvert;
- static CSBRenderingType c;
-
- if (*num_args != 0) { /* Check for correct number */
- XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
- "cvtStringToRenderingType", "wrongParameters",
- "XtToolkitError",
- "String to rendering type conversion needs no extra arguments",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- /* Lower case the value */
- badConvert = LowerCase(from->addr, lower, LOWER_SIZE);
-
- /* Try to convert if a short enough string specified */
- if (!badConvert) {
- if (strcmp(lower, "x") == 0) c = CSBDisplayX;
- else if (strcmp(lower, "dps") == 0) c = CSBDisplayDPS;
- else if (strcmp(lower, "both") == 0) c = CSBDisplayBoth;
- else badConvert = True;
- }
-
- /* String too long or unknown value -- issue warning */
- if (badConvert) {
- XtDisplayStringConversionWarning(dpy, from->addr, "RenderingType");
- } else {
- if (to->addr == NULL) to->addr = (caddr_t) &c;
-
- else if (to->size < sizeof(CSBRenderingType)) badConvert = TRUE;
- else *(CSBRenderingType *) to->addr = c;
-
- to->size = sizeof(CSBRenderingType);
- }
- return !badConvert;
-#undef LOWER_SIZE
-}
-
-static void ClassInitialize()
-{
- /* Register converters */
-
- XtSetTypeConverter(XtRString, XtRColorSpace,
- CvtStringToColorSpace, (XtConvertArgList) NULL, 0,
- XtCacheAll, (XtDestructor) NULL);
- XtSetTypeConverter(XtRString, XtRRenderingType,
- CvtStringToRenderingType, (XtConvertArgList) NULL, 0,
- XtCacheAll, (XtDestructor) NULL);
-}
-
-/* ARGSUSED */
-
-static void ClassPartInitialize(widget_class)
- WidgetClass widget_class;
-{
- register ColorSelectionBoxWidgetClass wc =
- (ColorSelectionBoxWidgetClass) widget_class;
- ColorSelectionBoxWidgetClass super =
- (ColorSelectionBoxWidgetClass) wc->core_class.superclass;
-
- if (wc->csb_class.set_color == InheritSetColor) {
- wc->csb_class.set_color = super->csb_class.set_color;
- }
- if (wc->csb_class.get_color == InheritGetColor) {
- wc->csb_class.get_color = super->csb_class.get_color;
- }
-}
-
-static void ToUserSpace(csb, xWidth, xHeight, uWidth, uHeight)
- ColorSelectionBoxWidget csb;
- int xWidth, xHeight;
- float *uWidth, *uHeight;
-{
- register float *i = csb->csb.itransform;
-
- *uWidth = i[0] * xWidth - i[2] * xHeight + i[4];
- *uHeight= i[1] * xWidth - i[3] * xHeight + i[5];
-}
-
-static void ColorizeRGB(csb)
- ColorSelectionBoxWidget csb;
-{
- Dimension height, width;
- int depth, steps;
- float w, h;
-
- XtVaGetValues(csb->csb.slider_child[0], XtNwidth, &width,
- XtNheight, &height,
- XtNdepth, &depth, NULL);
-
- if (csb->csb.red_pixmap != None && width != csb->csb.rgb_slider_width) {
- XFreePixmap(XtDisplay(csb), csb->csb.red_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.green_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.blue_pixmap);
- csb->csb.red_pixmap = None;
- }
-
- if (csb->csb.red_pixmap == None) {
- csb->csb.rgb_slider_width = width;
- if (csb->csb.visual_class == TrueColor) steps = width / 2;
- else steps = width / 4;
-
- ToUserSpace(csb, width, height, &w, &h);
-
- csb->csb.red_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context, csb->csb.red_pixmap, height);
-
- _DPSCRGBBlend(csb->csb.context, 0.0, 0.0, w, h, "0 0", steps);
-
- csb->csb.green_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context,
- csb->csb.green_pixmap, height);
-
- _DPSCRGBBlend(csb->csb.context, 0.0, 0.0, w, h, "0 exch 0", steps);
-
- csb->csb.blue_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context, csb->csb.blue_pixmap, height);
-
- _DPSCRGBBlend(csb->csb.context,
- 0.0, 0.0, w, h, "0 0 3 -1 roll", steps);
-
- DPSWaitContext(csb->csb.context);
- }
-
- XtVaSetValues(csb->csb.slider_child[0],
- XtNbackgroundPixmap, csb->csb.red_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[1],
- XtNbackgroundPixmap, csb->csb.green_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[2],
- XtNbackgroundPixmap, csb->csb.blue_pixmap, NULL);
-}
-
-static void ColorizeCMYK(csb)
- ColorSelectionBoxWidget csb;
-{
- Dimension height, width;
- int depth, steps;
- float w, h;
-
- XtVaGetValues(csb->csb.slider_child[0], XtNwidth, &width,
- XtNheight, &height,
- XtNdepth, &depth, NULL);
-
- if (csb->csb.cyan_pixmap != None && width != csb->csb.cmyk_slider_width) {
- XFreePixmap(XtDisplay(csb), csb->csb.cyan_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.magenta_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.yellow_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.black_pixmap);
- csb->csb.cyan_pixmap = None;
- }
-
- if (csb->csb.cyan_pixmap == None) {
- csb->csb.cmyk_slider_width = width;
- if (csb->csb.visual_class == TrueColor) steps = width / 2;
- else steps = width / 4;
-
- ToUserSpace(csb, width, height, &w, &h);
-
- csb->csb.cyan_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context, csb->csb.cyan_pixmap, height);
-
- _DPSCCMYKBlend(csb->csb.context, 0.0, 0.0, w, h, "0 0 0", steps);
-
- csb->csb.magenta_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context, csb->csb.magenta_pixmap,
- height);
-
- _DPSCCMYKBlend(csb->csb.context, 0.0, 0.0, w, h, "0 exch 0 0", steps);
-
- csb->csb.yellow_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context, csb->csb.yellow_pixmap,
- height);
-
- _DPSCCMYKBlend(csb->csb.context, 0.0, 0.0, w, h, "0 0 3 -1 roll 0",
- steps);
-
- csb->csb.black_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context, csb->csb.black_pixmap,
- height);
-
- _DPSCCMYKBlend(csb->csb.context, 0.0, 0.0, w, h, "0 0 0 4 -1 roll",
- steps);
-
- DPSWaitContext(csb->csb.context);
- }
-
- XtVaSetValues(csb->csb.slider_child[0], XtNbackgroundPixmap,
- csb->csb.cyan_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[1], XtNbackgroundPixmap,
- csb->csb.magenta_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[2], XtNbackgroundPixmap,
- csb->csb.yellow_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[3], XtNbackgroundPixmap,
- csb->csb.black_pixmap, NULL);
-}
-
-static void ColorizeHSB(csb)
- ColorSelectionBoxWidget csb;
-{
- Dimension height, width;
- int depth, steps;
- float w, h;
-
- XtVaGetValues(csb->csb.slider_child[0], XtNwidth, &width,
- XtNheight, &height,
- XtNdepth, &depth, NULL);
-
- if (csb->csb.hue_pixmap != None && width != csb->csb.hsb_slider_width) {
- XFreePixmap(XtDisplay(csb), csb->csb.hue_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.sat_pixmap);
- XFreePixmap(XtDisplay(csb), csb->csb.bright_pixmap);
- csb->csb.hue_pixmap = None;
- }
-
- if (csb->csb.hue_pixmap == None) {
- csb->csb.hsb_slider_width = width;
- if (csb->csb.visual_class == TrueColor) steps = width / 2;
- else steps = width / 4;
-
- ToUserSpace(csb, width, height, &w, &h);
-
- csb->csb.hue_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context, csb->csb.hue_pixmap, height);
-
- _DPSCHSBBlend(csb->csb.context, 0.0, 0.0, w, h, "1 1", steps);
-
- csb->csb.sat_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context, csb->csb.sat_pixmap, height);
-
- _DPSCHSBBlend(csb->csb.context, 0.0, 0.0, w, h, "0 exch 1", steps);
-
- csb->csb.bright_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextDrawable(csb->csb.context, csb->csb.bright_pixmap,
- height);
-
- _DPSCHSBBlend(csb->csb.context, 0.0, 0.0, w, h, "0 1 3 -1 roll",
- steps);
-
- DPSWaitContext(csb->csb.context);
- }
-
- XtVaSetValues(csb->csb.slider_child[0], XtNbackgroundPixmap,
- csb->csb.hue_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[1], XtNbackgroundPixmap,
- csb->csb.sat_pixmap, NULL);
- XtVaSetValues(csb->csb.slider_child[2], XtNbackgroundPixmap,
- csb->csb.bright_pixmap, NULL);
-}
-
-static void ColorizeGray(csb)
- ColorSelectionBoxWidget csb;
-{
- Dimension height, width;
- int depth, steps;
- float w, h;
-
- XtVaGetValues(csb->csb.slider_child[0], XtNwidth, &width,
- XtNheight, &height,
- XtNdepth, &depth, NULL);
-
- if (csb->csb.gray_pixmap != None && width != csb->csb.gray_slider_width) {
- XFreePixmap(XtDisplay(csb), csb->csb.gray_pixmap);
- csb->csb.gray_pixmap = None;
- }
-
- if (csb->csb.gray_pixmap == None) {
- csb->csb.gray_slider_width = width;
- if (csb->csb.visual_class == TrueColor) steps = width / 2;
- else steps = width / 4;
-
- ToUserSpace(csb, width, height, &w, &h);
-
- csb->csb.gray_pixmap = XCreatePixmap(XtDisplay(csb), XtWindow(csb),
- width, height, depth);
-
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context, csb->csb.gray_pixmap, height);
-
- _DPSCGrayBlend(csb->csb.context, 0.0, 0.0, w, h, " ", steps);
-
- DPSWaitContext(csb->csb.context);
- }
-
- XtVaSetValues(csb->csb.slider_child[0], XtNbackgroundPixmap,
- csb->csb.gray_pixmap, NULL);
-}
-
-static void ColorizeSliders(csb)
- ColorSelectionBoxWidget csb;
-{
- if (!XtIsRealized(csb)) return;
-
- switch (csb->csb.current_space) {
- case CSBSpaceRGB:
- ColorizeRGB(csb);
- break;
- case CSBSpaceCMYK:
- ColorizeCMYK(csb);
- break;
- case CSBSpaceHSB:
- ColorizeHSB(csb);
- break;
- case CSBSpaceGray:
- ColorizeGray(csb);
- break;
- }
-}
-
-/* ARGSUSED */
-
-static void FormResize(w, data, event, goOn)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *goOn;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) data;
-
- if (event->type != ConfigureNotify && event->type != MapNotify) return;
-
- csb->csb.rgb_slider_width = csb->csb.cmyk_slider_width =
- csb->csb.hsb_slider_width = csb->csb.gray_slider_width = 0;
- csb->csb.palette_pixmap_valid = False;
- if (csb->csb.patch_gstate != 0) {
- XDPSFreeContextGState(csb->csb.context, csb->csb.patch_gstate);
- csb->csb.patch_gstate = 0;
- }
- if (csb->csb.dock_gstate != 0) {
- XDPSFreeContextGState(csb->csb.context, csb->csb.dock_gstate);
- csb->csb.dock_gstate = 0;
- }
- ColorizeSliders(csb);
- DrawPalette(csb);
- if (XtIsRealized(csb->csb.patch_child)) {
- XClearArea(XtDisplay(csb), XtWindow(csb->csb.patch_child),
- 0, 0, 1000, 1000, True);
- }
-}
-
-static void FillCallbackRec(csb, rec)
- ColorSelectionBoxWidget csb;
- CSBCallbackRec *rec;
-{
- rec->current_space = csb->csb.current_space;
- rec->red = csb->csb.current_color.red;
- rec->green = csb->csb.current_color.green;
- rec->blue = csb->csb.current_color.blue;
- rec->cyan = csb->csb.current_color.cyan;
- rec->magenta = csb->csb.current_color.magenta;
- rec->yellow = csb->csb.current_color.yellow;
- rec->black = csb->csb.current_color.black;
- rec->hue = csb->csb.current_color.hue;
- rec->saturation = csb->csb.current_color.saturation;
- rec->brightness = csb->csb.current_color.brightness;
- rec->gray = csb->csb.current_color.gray;
-}
-
-/* ARGSUSED */
-
-static void OKCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- CSBCallbackRec rec;
-
- csb->csb.save_color = csb->csb.current_color;
- FillCallbackRec(csb, &rec);
- rec.reason = CSBOK;
- XtCallCallbackList((Widget) csb, csb->csb.ok_callback, (XtPointer) &rec);
- if (XtIsShell(XtParent(csb))) XtPopdown(XtParent(csb));
-
- SaveDockContents(csb);
-}
-
-/* ARGSUSED */
-
-static void ApplyCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- CSBCallbackRec rec;
-
- csb->csb.save_color = csb->csb.current_color;
- FillCallbackRec(csb, &rec);
- rec.reason = CSBApply;
- XtCallCallbackList((Widget) csb, csb->csb.apply_callback,
- (XtPointer) &rec);
-
- SaveDockContents(csb);
-}
-
-/* ARGSUSED */
-
-static void ResetCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- CSBCallbackRec rec;
-
- csb->csb.current_color = csb->csb.save_color;
- FillPatch(csb);
- SetSliders(csb);
- FillCallbackRec(csb, &rec);
- rec.reason = CSBReset;
- XtCallCallbackList((Widget) csb, csb->csb.reset_callback,
- (XtPointer) &rec);
-}
-
-/* ARGSUSED */
-
-static void CancelCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- CSBCallbackRec rec;
-
- csb->csb.current_color = csb->csb.save_color;
- FillPatch(csb);
- SetSliders(csb);
- FillCallbackRec(csb, &rec);
- rec.reason = CSBCancel;
- XtCallCallbackList((Widget) csb, csb->csb.cancel_callback,
- (XtPointer) &rec);
- if (XtIsShell(XtParent(csb))) XtPopdown(XtParent(csb));
-}
-
-/* ARGSUSED */
-
-static void DoValueChangedCallback(csb)
- ColorSelectionBoxWidget csb;
-{
- CSBCallbackRec rec;
-
- FillCallbackRec(csb, &rec);
- rec.reason = CSBValueChanged;
- XtCallCallbackList((Widget) csb, csb->csb.value_changed_callback,
- (XtPointer) &rec);
-}
-
-/* ARGSUSED */
-
-static void ChangeLabelCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData;
-
- ChangeLabel((Widget) clientData, ((float) scaleData->value) / 100.0);
-}
-
-static void ChangeLabel(label, n)
- Widget label;
- float n;
-{
- char buf[10];
-
- sprintf(buf, "%d", TO_PCT(n));
- XtVaSetValues(label, XmNlabelString, CS(buf, label), NULL);
-}
-
-static void CreateModelMenu(parent, csb)
- Widget parent, csb;
-{
- Widget kids[4];
-
- kids[0] = XmCreatePushButtonGadget(parent, "rgb", (ArgList) NULL, 0);
- XtAddCallback(kids[0], XmNactivateCallback,
- SetRGBCallback, (XtPointer) csb);
- kids[1] = XmCreatePushButtonGadget(parent, "cmyk", (ArgList) NULL, 0);
- XtAddCallback(kids[1], XmNactivateCallback,
- SetCMYKCallback, (XtPointer) csb);
- kids[2] = XmCreatePushButtonGadget(parent, "hsb", (ArgList) NULL, 0);
- XtAddCallback(kids[2], XmNactivateCallback,
- SetHSBCallback, (XtPointer) csb);
- kids[3] = XmCreatePushButtonGadget(parent, "gray", (ArgList) NULL, 0);
- XtAddCallback(kids[3], XmNactivateCallback,
- SetGrayCallback, (XtPointer) csb);
-
- XtManageChildren(kids, 4);
-}
-
-typedef struct {
- ColorSelectionBoxWidget csb;
- CSBRenderingType rendering;
-} RenderingRec;
-
-/* ARGSUSED */
-
-static void SetRenderingCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- RenderingRec *r = (RenderingRec *) clientData;
-
- r->csb->csb.current_rendering = r->rendering;
- FillPatch(r->csb);
-}
-
-static void CreateDisplayMenu(parent, csb)
- Widget parent;
- ColorSelectionBoxWidget csb;
-{
- Widget kids[3];
- RenderingRec *r;
-
- r = XtNew(RenderingRec);
- r->csb = csb;
- r->rendering = CSBDisplayDPS;
- kids[0] = XmCreatePushButtonGadget(parent, "displayDPS",
- (ArgList) NULL, 0);
- XtAddCallback(kids[0], XmNactivateCallback,
- SetRenderingCallback, (XtPointer) r);
- r = XtNew(RenderingRec);
- r->csb = csb;
- r->rendering = CSBDisplayX;
- kids[1] = XmCreatePushButtonGadget(parent, "displayX", (ArgList) NULL, 0);
- XtAddCallback(kids[1], XmNactivateCallback,
- SetRenderingCallback, (XtPointer) r);
- r = XtNew(RenderingRec);
- r->csb = csb;
- r->rendering = CSBDisplayBoth;
- kids[2] = XmCreatePushButtonGadget(parent, "displayBoth",
- (ArgList) NULL, 0);
- XtAddCallback(kids[2], XmNactivateCallback,
- SetRenderingCallback, (XtPointer) r);
-
- XtManageChildren(kids, 3);
-}
-
-typedef struct {
- ColorSelectionBoxWidget csb;
- int n;
-} PaletteRec;
-
-/* ARGSUSED */
-
-static void SetPaletteCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- PaletteRec *p = (PaletteRec *) clientData;
-
- if (p->csb->csb.palette_broken[p->n]) return;
-
- if (p->n != p->csb->csb.current_palette ||
- p->csb->csb.palette_color_dependent[p->n]) {
- p->csb->csb.palette_pixmap_valid = False;
- }
-
- p->csb->csb.current_palette = p->n;
- DrawPalette(p->csb);
-}
-
-static void CreatePaletteMenu(parent, csb)
- Widget parent;
- ColorSelectionBoxWidget csb;
-{
- Widget w, managed[PALETTE_MAX];
- int j, k;
- char buf[10];
- PaletteRec *p;
-
- j = 0;
-
- for (k = 0; k < PALETTE_MAX; k++) {
- p = XtNew(PaletteRec);
- p->csb = csb;
- p->n = k;
- sprintf(buf, "palette%d", k);
- w = XtVaCreateWidget(buf, xmPushButtonGadgetClass, parent, NULL);
- if (csb->csb.palette_label[k] != NULL) {
- XtVaSetValues(w, XtVaTypedArg, XmNlabelString,
- XtRString, csb->csb.palette_label[k],
- strlen(csb->csb.palette_label[k])+1,
- NULL);
- }
- XtAddCallback(w, XmNactivateCallback,
- SetPaletteCallback, (XtPointer) p);
- if (csb->csb.palette_function[k] != NULL) managed[j++] = w;
- }
-
- if (j != 0) XtManageChildren(managed, j);
-}
-
-static void CreateChildren(csb)
- ColorSelectionBoxWidget csb;
-{
- int i;
- Arg args[20];
- Widget form, menu, button, w, dock_frame, palette_frame;
- Pixel fg, bg;
- int depth;
- Pixmap eyedrop;
-
- i = 0;
- XtSetArg(args[i], XmNresizePolicy, XmRESIZE_NONE); i++;
- form = XtCreateManagedWidget("panel", xmFormWidgetClass,
- (Widget) csb, args, i);
- csb->csb.form_child = form;
- XtAddEventHandler(form, StructureNotifyMask, False, FormResize,
- (XtPointer) csb);
-
- i = 0;
- menu = XmCreatePulldownMenu(form, "modelMenu", args, i);
- CreateModelMenu(menu, (Widget) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNsubMenuId, menu); i++;
- csb->csb.model_option_menu_child =
- XmCreateOptionMenu(form, "modelOptionMenu",
- args, i);
- XtManageChild(csb->csb.model_option_menu_child);
-
- XtVaGetValues(form, XtNbackground, &bg, XmNforeground, &fg,
- XtNdepth, &depth, NULL);
- eyedrop = XCreatePixmapFromBitmapData(XtDisplay(csb),
- RootWindowOfScreen(XtScreen(csb)),
- (char *) heyedrop_bits,
- heyedrop_width, heyedrop_height,
- fg, bg, depth);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, csb->csb.model_option_menu_child); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.model_option_menu_child); i++;
- XtSetArg(args[i], XmNlabelPixmap, eyedrop); i++;
- button = XtCreateManagedWidget("eyedropButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback,
- DoEyedropCallback, (XtPointer) csb);
- XtInsertRawEventHandler(button, PointerMotionMask | ButtonReleaseMask,
- False, EyedropPointer, (XtPointer) csb,
- XtListHead);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.model_option_menu_child); i++;
- csb->csb.label_child[0] =
- XtCreateManagedWidget("label1", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.model_option_menu_child); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- csb->csb.value_child[0] =
- XtCreateManagedWidget("value1", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, csb->csb.label_child[0]); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.model_option_menu_child); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.value_child[0]); i++;
- csb->csb.slider_child[0] =
- XtCreateManagedWidget("slider1", xmScaleWidgetClass,
- form, args, i);
- XtAddCallback(csb->csb.slider_child[0], XmNvalueChangedCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[0]);
- XtAddCallback(csb->csb.slider_child[0], XmNdragCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[0]);
- XtAddCallback(csb->csb.slider_child[0], XmNvalueChangedCallback,
- Slider1Callback, (XtPointer) csb);
- XtAddCallback(csb->csb.slider_child[0], XmNdragCallback,
- Slider1Callback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[0]); i++;
- csb->csb.label_child[1] =
- XtCreateManagedWidget("label2", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[0]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.value_child[0]); i++;
- csb->csb.value_child[1] =
- XtCreateManagedWidget("value2", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, csb->csb.slider_child[0]); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[0]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.slider_child[0]); i++;
- csb->csb.slider_child[1] =
- XtCreateManagedWidget("slider2", xmScaleWidgetClass,
- form, args, i);
- XtAddCallback(csb->csb.slider_child[1], XmNvalueChangedCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[1]);
- XtAddCallback(csb->csb.slider_child[1], XmNdragCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[1]);
- XtAddCallback(csb->csb.slider_child[1], XmNvalueChangedCallback,
- Slider2Callback, (XtPointer) csb);
- XtAddCallback(csb->csb.slider_child[1], XmNdragCallback,
- Slider2Callback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[1]); i++;
- csb->csb.label_child[2] =
- XtCreateManagedWidget("label3", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[1]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.value_child[0]); i++;
- csb->csb.value_child[2] =
- XtCreateManagedWidget("value3", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, csb->csb.slider_child[0]); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[1]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.slider_child[0]); i++;
- csb->csb.slider_child[2] =
- XtCreateManagedWidget("slider3", xmScaleWidgetClass,
- form, args, i);
- XtAddCallback(csb->csb.slider_child[2], XmNvalueChangedCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[2]);
- XtAddCallback(csb->csb.slider_child[2], XmNdragCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[2]);
- XtAddCallback(csb->csb.slider_child[2], XmNvalueChangedCallback,
- Slider3Callback, (XtPointer) csb);
- XtAddCallback(csb->csb.slider_child[2], XmNdragCallback,
- Slider3Callback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[2]); i++;
- csb->csb.label_child[3] =
- XtCreateManagedWidget("label4", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[2]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.value_child[0]); i++;
- csb->csb.value_child[3] =
- XtCreateManagedWidget("value4", xmLabelWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, csb->csb.slider_child[0]); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.slider_child[2]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, csb->csb.slider_child[0]); i++;
- csb->csb.slider_child[3] =
- XtCreateManagedWidget("slider4", xmScaleWidgetClass,
- form, args, i);
- XtAddCallback(csb->csb.slider_child[3], XmNvalueChangedCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[3]);
- XtAddCallback(csb->csb.slider_child[3], XmNdragCallback,
- ChangeLabelCallback, (XtPointer) csb->csb.value_child[3]);
- XtAddCallback(csb->csb.slider_child[3], XmNvalueChangedCallback,
- Slider4Callback, (XtPointer) csb);
- XtAddCallback(csb->csb.slider_child[3], XmNdragCallback,
- Slider4Callback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("okButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback, OKCallback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNdefaultButton, button); i++;
- XtSetValues(form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, button); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("applyButton", xmPushButtonWidgetClass,
- form, args, i);
-
- XtAddCallback(button, XmNactivateCallback, ApplyCallback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, button); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("resetButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback, ResetCallback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, button); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("cancelButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback,
- CancelCallback, (XtPointer) csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, button); i++;
- w = XtCreateManagedWidget("separator", xmSeparatorGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, w); i++;
- palette_frame = XtCreateManagedWidget("paletteFrame", xmFrameWidgetClass,
- form, args, i);
-
- i = 0;
- csb->csb.palette_child =
- XtCreateManagedWidget("palette", xmDrawingAreaWidgetClass,
- palette_frame, args, i);
- XtAddCallback(csb->csb.palette_child, XmNexposeCallback,
- DrawPaletteCallback, (XtPointer) csb);
- XtAddEventHandler(csb->csb.palette_child, ButtonPressMask, False,
- PalettePress, (XtPointer) csb);
-
- i = 0;
- menu = XmCreatePulldownMenu(form, "paletteMenu", args, i);
- CreatePaletteMenu(menu, csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, palette_frame); i++;
- XtSetArg(args[i], XmNsubMenuId, menu); i++;
- csb->csb.palette_option_menu_child =
- XmCreateOptionMenu(form, "paletteOptionMenu",
- args, i);
- XtManageChild(csb->csb.palette_option_menu_child);
-
- i = 0;
- menu = XmCreatePulldownMenu(form, "displayMenu", args, i);
- CreateDisplayMenu(menu, csb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNsubMenuId, menu); i++;
- csb->csb.display_option_menu_child =
- XmCreateOptionMenu(form, "displayOptionMenu",
- args, i);
- XtManageChild(csb->csb.display_option_menu_child);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, csb->csb.display_option_menu_child);i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, palette_frame); i++;
- dock_frame = XtCreateManagedWidget("dockFrame", xmFrameWidgetClass,
- form, args, i);
-
- i = 0;
- csb->csb.dock_child =
- XtCreateManagedWidget("dock", xmDrawingAreaWidgetClass,
- dock_frame, args, i);
- XtAddCallback(csb->csb.dock_child, XmNexposeCallback,
- DrawDockCallback, (XtPointer) csb);
- XtAddEventHandler(csb->csb.dock_child, ButtonPressMask, False, DockPress,
- (XtPointer) csb);
-
- {
- Dimension height;
- int q;
-
- XtVaGetValues(csb->csb.dock_child, XtNheight, &height, NULL);
- if (height < csb->csb.cell_size) height = csb->csb.cell_size;
- else if (height % csb->csb.cell_size != 0) {
- q = height / csb->csb.cell_size;
- height = csb->csb.cell_size * q;
- }
- XtVaSetValues(csb->csb.dock_child, XtNheight, height, NULL);
- }
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, dock_frame); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, csb->csb.display_option_menu_child);i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, dock_frame); i++;
- w = XtCreateManagedWidget("patchFrame", xmFrameWidgetClass,
- form, args, i);
-
- i = 0;
- csb->csb.patch_child =
- XtCreateManagedWidget("patch", xmDrawingAreaWidgetClass,
- w, args, i);
- XtAddCallback(csb->csb.patch_child, XmNexposeCallback,
- FillPatchCallback, (XtPointer) csb);
- XtAddRawEventHandler(csb->csb.patch_child, ButtonPressMask,
- False, PatchPress, (XtPointer) csb);
- XtAddRawEventHandler(csb->csb.patch_child, ButtonReleaseMask,
- False, PatchRelease, (XtPointer) csb);
-}
-
-static void NoBackgroundPixel(csb)
- ColorSelectionBoxWidget csb;
-{
- Widget w, message;
-
- csb->csb.no_background = True;
- w = XtNameToWidget((Widget) csb, "*displayX");
- XtSetSensitive(w, False);
- w = XtNameToWidget((Widget) csb, "*displayBoth");
- XtSetSensitive(w, False);
- w = XtNameToWidget((Widget) csb, "*displayDPS");
- XtVaSetValues(csb->csb.display_option_menu_child, XmNmenuHistory, w, NULL);
-
- message = XmCreateInformationDialog(csb->csb.form_child,
- "noBackgroundMessage",
- (ArgList) NULL, 0);
- w = XmMessageBoxGetChild(message, XmDIALOG_CANCEL_BUTTON);
- XtUnmanageChild(w);
- w = XmMessageBoxGetChild(message, XmDIALOG_HELP_BUTTON);
- XtUnmanageChild(w);
-
- XtManageChild(message);
-}
-
-/* labelString is changed by this */
-
-static void ParseLabels(labelString, labels, n)
- String labelString;
- register String labels[4];
-{
- register char *ch;
- int i;
-
- ch = labelString;
- for (i = 0; i < n; i++) {
- labels[i] = ch;
- while (*ch != ':' && *ch != '\0') ch++;
- *ch++ = '\0';
- }
-
- for (i = n; i < 4; i++) labels[i] = NULL;
-}
-
-static void SetLabels(csb, labels)
- ColorSelectionBoxWidget csb;
- String *labels;
-{
- Widget w = (Widget) csb;
- int i;
-
- for (i = 0; i < 4; i++) {
- if (labels[i] != NULL) {
- XtVaSetValues(csb->csb.label_child[i],
- XmNlabelString, CS(labels[i], w), NULL);
- }
- }
-}
-
-static void MapChildren(children, n)
- Widget *children;
- int n;
-{
- XtManageChildren(children, n);
-}
-
-static void UnmapChildren(children, n)
- Widget *children;
- int n;
-{
- XtUnmanageChildren(children, n);
-}
-
-static void SetSliders(csb)
- ColorSelectionBoxWidget csb;
-{
- switch(csb->csb.current_space) {
- case CSBSpaceRGB: SetRGBValues(csb); break;
- case CSBSpaceCMYK: SetCMYKValues(csb); break;
- case CSBSpaceHSB: SetHSBValues(csb); break;
- case CSBSpaceGray: SetGrayValues(csb); break;
- }
-}
-
-static void SetRGBValues(csb)
- ColorSelectionBoxWidget csb;
-{
- XmScaleSetValue(csb->csb.slider_child[0],
- TO_PCT(csb->csb.current_color.red));
- XmScaleSetValue(csb->csb.slider_child[1],
- TO_PCT(csb->csb.current_color.green));
- XmScaleSetValue(csb->csb.slider_child[2],
- TO_PCT(csb->csb.current_color.blue));
- ChangeLabel(csb->csb.value_child[0], csb->csb.current_color.red);
- ChangeLabel(csb->csb.value_child[1], csb->csb.current_color.green);
- ChangeLabel(csb->csb.value_child[2], csb->csb.current_color.blue);
-}
-
-/* ARGSUSED */
-
-static void SetRGBCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Widget rgb;
- Widget children[6];
- String labels[4];
- int i, j;
-
- csb->csb.current_space = CSBSpaceRGB;
-
- ParseLabels(csb->csb.rgb_labels, labels, 3);
-
- rgb = XtNameToWidget((Widget) csb, "*rgb");
-
- XtVaSetValues(csb->csb.model_option_menu_child, XmNmenuHistory, rgb, NULL);
-
- SetLabels(csb, labels);
-
- SetRGBValues(csb);
-
- j = 0;
- for (i = 1; i < 3; i++) {
- children[j++] = csb->csb.label_child[i];
- children[j++] = csb->csb.slider_child[i];
- children[j++] = csb->csb.value_child[i];
- }
-
- MapChildren(children, 6);
-
- children[0] = csb->csb.label_child[3];
- children[1] = csb->csb.slider_child[3];
- children[2] = csb->csb.value_child[3];
-
- UnmapChildren(children, 3);
-
- ColorizeSliders(csb);
- FillPatch(csb);
-}
-
-static void SetCMYKValues(csb)
- ColorSelectionBoxWidget csb;
-{
- XmScaleSetValue(csb->csb.slider_child[0],
- TO_PCT(csb->csb.current_color.cyan));
- XmScaleSetValue(csb->csb.slider_child[1],
- TO_PCT(csb->csb.current_color.magenta));
- XmScaleSetValue(csb->csb.slider_child[2],
- TO_PCT(csb->csb.current_color.yellow));
- XmScaleSetValue(csb->csb.slider_child[3],
- TO_PCT(csb->csb.current_color.black));
- ChangeLabel(csb->csb.value_child[0], csb->csb.current_color.cyan);
- ChangeLabel(csb->csb.value_child[1], csb->csb.current_color.magenta);
- ChangeLabel(csb->csb.value_child[2], csb->csb.current_color.yellow);
- ChangeLabel(csb->csb.value_child[3], csb->csb.current_color.black);
-}
-
-/* ARGSUSED */
-
-static void SetCMYKCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Widget cmyk;
- Widget children[9];
- String labels[4];
- int i, j;
-
- csb->csb.current_space = CSBSpaceCMYK;
-
- ParseLabels(csb->csb.cmyk_labels, labels, 4);
-
- cmyk = XtNameToWidget((Widget) csb, "*cmyk");
-
- XtVaSetValues(csb->csb.model_option_menu_child,
- XmNmenuHistory, cmyk, NULL);
-
- SetLabels(csb, labels);
-
- SetCMYKValues(csb);
-
- j = 0;
- for (i = 1; i < 4; i++) {
- children[j++] = csb->csb.label_child[i];
- children[j++] = csb->csb.slider_child[i];
- children[j++] = csb->csb.value_child[i];
- }
-
- MapChildren(children, 9);
-
- ColorizeSliders(csb);
- FillPatch(csb);
-}
-
-static void SetHSBValues(csb)
- ColorSelectionBoxWidget csb;
-{
- XmScaleSetValue(csb->csb.slider_child[0],
- TO_PCT(csb->csb.current_color.hue));
- XmScaleSetValue(csb->csb.slider_child[1],
- TO_PCT(csb->csb.current_color.saturation));
- XmScaleSetValue(csb->csb.slider_child[2],
- TO_PCT(csb->csb.current_color.brightness));
- ChangeLabel(csb->csb.value_child[0], csb->csb.current_color.hue);
- ChangeLabel(csb->csb.value_child[1], csb->csb.current_color.saturation);
- ChangeLabel(csb->csb.value_child[2], csb->csb.current_color.brightness);
-}
-
-/* ARGSUSED */
-
-static void SetHSBCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Widget hsb;
- Widget children[6];
- String labels[4];
- int i, j;
-
- csb->csb.current_space = CSBSpaceHSB;
-
- ParseLabels(csb->csb.hsb_labels, labels, 3);
-
- hsb = XtNameToWidget((Widget) csb, "*hsb");
-
- XtVaSetValues(csb->csb.model_option_menu_child, XmNmenuHistory, hsb, NULL);
-
- SetLabels(csb, labels);
-
- SetHSBValues(csb);
-
- j = 0;
- for (i = 1; i < 3; i++) {
- children[j++] = csb->csb.label_child[i];
- children[j++] = csb->csb.slider_child[i];
- children[j++] = csb->csb.value_child[i];
- }
-
- MapChildren(children, 6);
-
- children[0] = csb->csb.label_child[3];
- children[1] = csb->csb.slider_child[3];
- children[2] = csb->csb.value_child[3];
-
- UnmapChildren(children, 3);
-
- ColorizeSliders(csb);
- FillPatch(csb);
-}
-
-static void SetGrayValues(csb)
- ColorSelectionBoxWidget csb;
-{
- XmScaleSetValue(csb->csb.slider_child[0],
- TO_PCT(csb->csb.current_color.gray));
- ChangeLabel(csb->csb.value_child[0], csb->csb.current_color.gray);
-}
-
-/* ARGSUSED */
-
-static void SetGrayCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Widget gray;
- Widget children[9];
- String labels[4];
- int i, j;
-
- csb->csb.current_space = CSBSpaceGray;
-
- gray = XtNameToWidget((Widget) csb, "*gray");
-
- XtVaSetValues(csb->csb.model_option_menu_child, XmNmenuHistory, gray, NULL);
-
- labels[0] = csb->csb.gray_labels;
- labels[1] = labels[2] = labels[3] = NULL;
- SetLabels(csb, labels);
-
- SetGrayValues(csb);
-
- j = 0;
- for (i = 1; i < 4; i++) {
- children[j++] = csb->csb.label_child[i];
- children[j++] = csb->csb.slider_child[i];
- children[j++] = csb->csb.value_child[i];
- }
-
- UnmapChildren(children, 9);
-
- ColorizeSliders(csb);
- FillPatch(csb);
-}
-
-static void RGBToCMYK(csb)
- ColorSelectionBoxWidget csb;
-{
- csb->csb.current_color.cyan = 1.0 - csb->csb.current_color.red;
- csb->csb.current_color.magenta = 1.0 - csb->csb.current_color.green;
- csb->csb.current_color.yellow = 1.0 - csb->csb.current_color.blue;
- csb->csb.current_color.black = 0.0;
-}
-
-static void RGBToGray(csb)
- ColorSelectionBoxWidget csb;
-{
- csb->csb.current_color.gray = .3 * csb->csb.current_color.red +
- .59 * csb->csb.current_color.green +
- .11 * csb->csb.current_color.blue;
-}
-
-static void HSBToRGB(csb)
- ColorSelectionBoxWidget csb;
-{
- double r, g, bl;
- double h, s, b;
- double f, m, n, k;
- int i;
-
- if (csb->csb.current_color.saturation == 0) {
- r = g = bl = csb->csb.current_color.brightness;
- } else {
- h = csb->csb.current_color.hue;
- s = csb->csb.current_color.saturation;
- b = csb->csb.current_color.brightness;
-
- h = 6.0 * h;
- if (h >= 6.0) h = 0.0;
- i = (int) h;
- f = h - (double)i;
- m = b * (1.0 - s);
- n = b * (1.0 - (s * f));
- k = b * (1.0 - (s * (1.0 - f)));
-
- switch(i) {
- case 0: r = b; g = k; bl = m; break;
- case 1: r = n; g = b; bl = m; break;
- case 2: r = m; g = b; bl = k; break;
- case 3: r = m; g = n; bl = b; break;
- case 4: r = k; g = m; bl = b; break;
- case 5: r = b; g = m; bl = n; break;
- }
- }
-
- csb->csb.current_color.red = r;
- csb->csb.current_color.green = g;
- csb->csb.current_color.blue = bl;
-}
-
-static void RGBToHSB(csb)
- ColorSelectionBoxWidget csb;
-{
- double hue, sat, value;
- double diff, x, r, g, b;
- double red, green, blue;
-
- red = csb->csb.current_color.red;
- green = csb->csb.current_color.green;
- blue = csb->csb.current_color.blue;
-
- hue = sat = 0.0;
- value = x = red;
- if (green > value) value = green; else x = green;
- if (blue > value) value = blue;
- if (blue < x) x = blue;
-
- if (value != 0.0) {
- diff = value - x;
- if (diff != 0.0) {
- sat = diff / value;
- r = (value - red) / diff;
- g = (value - green) / diff;
- b = (value - blue) / diff;
- if (red == value) hue = (green == x) ? 5.0 + b : 1.0 - g;
- else if (green == value) hue = (blue == x) ? 1.0 + r : 3.0 - b;
- else hue = (red == x) ? 3.0 + g : 5.0 - r;
- hue /= 6.0; if (hue >= 1.0 || hue <= 0.0) hue = 0.0;
- }
- }
- csb->csb.current_color.hue = hue;
- csb->csb.current_color.saturation = sat;
- csb->csb.current_color.brightness = value;
-}
-
-static void UpdateColorSpaces(csb, masterSpace)
- ColorSelectionBoxWidget csb;
- CSBColorSpace masterSpace;
-{
- switch (masterSpace) {
- case CSBSpaceRGB:
- RGBToCMYK(csb);
- RGBToHSB(csb);
- RGBToGray(csb);
- break;
-
- case CSBSpaceCMYK:
- csb->csb.current_color.red =
- 1.0 - MIN(1.0, csb->csb.current_color.cyan +
- csb->csb.current_color.black);
- csb->csb.current_color.green =
- 1.0 - MIN(1.0, csb->csb.current_color.magenta +
- csb->csb.current_color.black);
- csb->csb.current_color.blue =
- 1.0 - MIN(1.0, csb->csb.current_color.yellow +
- csb->csb.current_color.black);
- RGBToHSB(csb);
- RGBToGray(csb);
- break;
-
- case CSBSpaceHSB:
- HSBToRGB(csb);
- RGBToCMYK(csb);
- RGBToGray(csb);
- break;
-
- case CSBSpaceGray:
- csb->csb.current_color.red = csb->csb.current_color.green =
- csb->csb.current_color.blue = csb->csb.current_color.gray;
-
- csb->csb.current_color.hue =
- csb->csb.current_color.saturation = 0.0;
- csb->csb.current_color.brightness = csb->csb.current_color.gray;
-
- csb->csb.current_color.cyan = csb->csb.current_color.magenta =
- csb->csb.current_color.yellow = 0.0;
- csb->csb.current_color.black = 1.0 - csb->csb.current_color.gray;
- break;
- }
-}
-
-/* ARGSUSED */
-
-static void Slider1Callback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData;
-
- switch(csb->csb.current_space) {
- case CSBSpaceRGB:
- csb->csb.current_color.red = scaleData->value / 100.0;
- break;
- case CSBSpaceCMYK:
- csb->csb.current_color.cyan = scaleData->value / 100.0;
- break;
- case CSBSpaceHSB:
- csb->csb.current_color.hue = scaleData->value / 100.0;
- break;
- case CSBSpaceGray:
- csb->csb.current_color.gray = scaleData->value / 100.0;
- break;
- }
-
- UpdateColorSpaces(csb, csb->csb.current_space);
- DoValueChangedCallback(csb);
- FillPatch(csb);
-}
-
-/* ARGSUSED */
-
-static void Slider2Callback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData;
-
- switch(csb->csb.current_space) {
- case CSBSpaceRGB:
- csb->csb.current_color.green = scaleData->value / 100.0;
- break;
- case CSBSpaceCMYK:
- csb->csb.current_color.magenta = scaleData->value / 100.0;
- break;
- case CSBSpaceHSB:
- csb->csb.current_color.saturation = scaleData->value / 100.0;
- break;
- }
-
- UpdateColorSpaces(csb, csb->csb.current_space);
- DoValueChangedCallback(csb);
- FillPatch(csb);
-}
-
-/* ARGSUSED */
-
-static void Slider3Callback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData;
-
- switch(csb->csb.current_space) {
- case CSBSpaceRGB:
- csb->csb.current_color.blue = scaleData->value / 100.0;
- break;
- case CSBSpaceCMYK:
- csb->csb.current_color.yellow = scaleData->value / 100.0;
- break;
- case CSBSpaceHSB:
- csb->csb.current_color.brightness = scaleData->value / 100.0;
- break;
- }
-
- UpdateColorSpaces(csb, csb->csb.current_space);
- DoValueChangedCallback(csb);
- FillPatch(csb);
-}
-
-/* ARGSUSED */
-
-static void Slider4Callback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData;
-
- csb->csb.current_color.black = scaleData->value / 100.0;
-
- UpdateColorSpaces(csb, csb->csb.current_space);
- DoValueChangedCallback(csb);
- FillPatch(csb);
-}
-
-static void FillPatch(csb)
- ColorSelectionBoxWidget csb;
-{
- Colormap c;
- XColor xc;
- Widget patch = csb->csb.patch_child;
-
- if (!XtIsRealized(csb->csb.patch_child)) return;
-
- if (csb->csb.no_background) {
- XClearArea(XtDisplay(patch), XtWindow(patch), 0, 0, 1000, 1000, True);
- return;
- }
-
- /* All we have to do is set the background; the expose event will
- do the rest */
-
- XtVaGetValues(patch, XtNcolormap, (XtPointer) &c, NULL);
-
- if (csb->csb.current_space == CSBSpaceGray) {
- xc.red = xc.green = xc.blue = TO_X(csb->csb.current_color.gray);
- } else {
- xc.red = TO_X(csb->csb.current_color.red);
- xc.green = TO_X(csb->csb.current_color.green);
- xc.blue = TO_X(csb->csb.current_color.blue);
- }
-
- if (csb->csb.static_visual) {
- (void) XAllocColor(XtDisplay(patch), c, &xc);
- csb->csb.background = xc.pixel;
- XtVaSetValues(patch, XtNbackground, csb->csb.background, NULL);
- } else {
- xc.pixel = csb->csb.background;
- xc.flags = DoRed | DoGreen | DoBlue;
- XStoreColor(XtDisplay(patch), c, &xc);
- }
-
- XClearArea(XtDisplay(patch), XtWindow(patch), 0, 0, 1000, 1000, True);
-}
-
-/* ARGSUSED */
-
-static void FillPatchCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Dimension height, width;
- float fh, fw;
-
- if (csb->csb.current_rendering != CSBDisplayX) {
- XtVaGetValues(w, XtNheight, &height, XtNwidth, &width, NULL);
- if (csb->csb.patch_gstate == 0) {
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context, XtWindow(w), height);
- (void) XDPSCaptureContextGState(csb->csb.context,
- &csb->csb.patch_gstate);
- } else XDPSSetContextGState(csb->csb.context, csb->csb.patch_gstate);
-
- switch (csb->csb.current_space) {
- case CSBSpaceRGB:
- DPSsetrgbcolor(csb->csb.context, csb->csb.current_color.red,
- csb->csb.current_color.green,
- csb->csb.current_color.blue);
- break;
- case CSBSpaceCMYK:
- DPSsetcmykcolor(csb->csb.context, csb->csb.current_color.cyan,
- csb->csb.current_color.magenta,
- csb->csb.current_color.yellow,
- csb->csb.current_color.black);
- break;
- case CSBSpaceHSB:
- DPSsethsbcolor(csb->csb.context, csb->csb.current_color.hue,
- csb->csb.current_color.saturation,
- csb->csb.current_color.brightness);
- break;
- case CSBSpaceGray:
- DPSsetgray(csb->csb.context, csb->csb.current_color.gray);
- break;
- }
- }
-
- switch (csb->csb.current_rendering) {
- case CSBDisplayDPS:
- DPSrectfill(csb->csb.context, 0.0, 0.0, 1000.0, 1000.0);
- break;
- case CSBDisplayX:
- break;
- case CSBDisplayBoth:
- ToUserSpace(csb, width, height, &fw, &fh);
- _DPSCTriangle(csb->csb.context, fh, fw);
- break;
- }
-}
-
-/* The following function Copyright 1987, 1988 by Digital Equipment
-Corporation, Maynard, Massachusetts, and the Massachusetts Institute of
-Technology, Cambridge, Massachusetts. */
-
-static String GetRootDirName(buf)
- String buf;
-{
-#ifndef X_NOT_POSIX
- uid_t uid;
-#else
- int uid;
- extern int getuid();
-#ifndef SYSV386
- extern struct passwd *getpwuid(), *getpwnam();
-#endif
-#endif
- struct passwd *pw;
- static char *ptr = NULL;
-
- if (ptr == NULL) {
- if (!(ptr = getenv("HOME"))) {
- if (ptr = getenv("USER")) pw = getpwnam(ptr);
- else {
- uid = getuid();
- pw = getpwuid(uid);
- }
- if (pw) ptr = pw->pw_dir;
- else {
- ptr = NULL;
- *buf = '\0';
- }
- }
- }
-
- if (ptr)
- (void) strcpy(buf, ptr);
-
- buf += strlen(buf);
- *buf = '/';
- buf++;
- *buf = '\0';
- return buf;
-}
-
-static void AllocateDock(csb)
- ColorSelectionBoxWidget csb;
-{
- int entry;
-
- csb->csb.dock_cyan = (float *) XtCalloc(csb->csb.num_cells, sizeof(float));
- csb->csb.dock_magenta =
- (float *) XtCalloc(csb->csb.num_cells, sizeof(float));
- csb->csb.dock_yellow =
- (float *) XtCalloc(csb->csb.num_cells, sizeof(float));
- csb->csb.dock_black =
- (float *) XtCalloc(csb->csb.num_cells, sizeof(float));
- csb->csb.dock_used =
- (Boolean *) XtCalloc(csb->csb.num_cells, sizeof(Boolean));
-
- for (entry = 0; entry < csb->csb.num_cells; entry++) {
- csb->csb.dock_used[entry] = 0;
- }
-}
-
-static void InitializeDock(csb)
- ColorSelectionBoxWidget csb;
-{
- String dockEnv;
- char homeDir[PATH_BUF_SIZE];
- FILE *dockFile = NULL;
- char fileName[PATH_BUF_SIZE];
-#define BUF 256
- char buf[BUF+1];
- int entry;
- float cyan, magenta, yellow, black;
-#define CHECK(v) ((v) > 1.0 ? 1.0 : ((v) < 0.0 ? 0.0 : (v)))
-
- AllocateDock(csb);
- csb->csb.dock_changed = False;
-
- dockEnv = getenv("DPSCPICKRC");
-
- if (dockEnv != NULL) dockFile = fopen(dockEnv, "r");
-
- if (dockFile == NULL) {
- (void) GetRootDirName(homeDir);
-
- if (dockFile == NULL) {
- sprintf(fileName, "%s/.dpscpickrc", homeDir);
- dockFile = fopen(fileName, "r");
-
- if (dockFile == NULL) return;
- }
- }
-
- while (1) {
- if (fgets(buf, BUF, dockFile) == NULL) {
- fclose(dockFile);
- return;
- }
- if (sscanf(buf, "%d %f %f %f %f",
- &entry, &cyan, &magenta, &yellow, &black) == 5) {
- if (entry <= csb->csb.num_cells) {
- csb->csb.dock_cyan[entry] = CHECK(cyan);
- csb->csb.dock_magenta[entry] = CHECK(magenta);
- csb->csb.dock_yellow[entry] = CHECK(yellow);
- csb->csb.dock_black[entry] = CHECK(black);
- csb->csb.dock_used[entry] = True;
- }
- }
- }
-
-#undef BUF
-#undef CHECK
-}
-
-static void SaveDockContents(csb)
- ColorSelectionBoxWidget csb;
-{
- String dockEnv;
- char homeDir[PATH_BUF_SIZE];
- FILE *dockFile = NULL;
- char fileName[PATH_BUF_SIZE];
- int i;
-
- if (!csb->csb.dock_changed) return;
-
- dockEnv = getenv("DPSCPICKRC");
-
- if (dockEnv != NULL) dockFile = fopen(dockEnv, "w");
-
- if (dockFile == NULL) {
- (void) GetRootDirName(homeDir);
-
- if (dockFile == NULL) {
- sprintf(fileName, "%s/.dpscpickrc", homeDir);
- dockFile = fopen(fileName, "w");
-
- if (dockFile == NULL) return;
- }
- }
-
- for (i = 0; i < csb->csb.num_cells; i++) {
- if (!csb->csb.dock_used[i]) continue;
- fprintf(dockFile, "%d %g %g %g %g\n", i, csb->csb.dock_cyan[i],
- csb->csb.dock_magenta[i], csb->csb.dock_yellow[i],
- csb->csb.dock_black[i]);
- }
- fclose(dockFile);
- csb->csb.dock_changed = False;
-}
-
-/* ARGSUSED */
-
-static void DrawDockCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
-
- XClearArea(XtDisplay(csb), XtWindow(csb->csb.dock_child),
- 0, 0, 1000, 1000, False);
- DrawDock(csb);
-}
-
-static void DrawDock(csb)
- ColorSelectionBoxWidget csb;
-{
- Dimension height;
- float w, h;
- int lines;
- int i, row, col;
- Boolean didAny = False;
-
- XtVaGetValues(csb->csb.dock_child, XtNheight, &height, NULL);
-
- lines = height / csb->csb.cell_size;
-
- if (csb->csb.dock_gstate == 0) {
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context,
- XtWindow(csb->csb.dock_child), height);
- (void) XDPSCaptureContextGState(csb->csb.context,
- &csb->csb.dock_gstate);
- } else XDPSSetContextGState(csb->csb.context, csb->csb.dock_gstate);
-
- ToUserSpace(csb, csb->csb.cell_size, csb->csb.cell_size, &w, &h);
-
- for (i = 0; i < csb->csb.num_cells; i++) {
- if (!csb->csb.dock_used[i]) continue;
- row = (lines - 1) - (i % lines);
- col = i / lines;
-
- DPSsetcmykcolor(csb->csb.context, csb->csb.dock_cyan[i],
- csb->csb.dock_magenta[i], csb->csb.dock_yellow[i],
- csb->csb.dock_black[i]);
-
- DPSrectfill(csb->csb.context,
- (float) (col * w), (float) (row * h), w, h);
- didAny = True;
- }
- if (!didAny) _DPSCShowFillMe(csb->csb.context, csb->csb.fill_me);
-}
-
-static void StoreColorInDock(csb, x_offset, y_offset, dockHeight)
- ColorSelectionBoxWidget csb;
- int x_offset, y_offset;
- Dimension dockHeight;
-{
- int i, lines, row, col;
-
- lines = dockHeight / csb->csb.cell_size;
-
- row = y_offset / (int) csb->csb.cell_size;
- col = x_offset / (int) csb->csb.cell_size;
- i = col * lines + row;
-
- if (i >= csb->csb.num_cells) i = csb->csb.num_cells;
- csb->csb.dock_cyan[i] = csb->csb.current_color.cyan;
- csb->csb.dock_magenta[i] = csb->csb.current_color.magenta;
- csb->csb.dock_yellow[i] = csb->csb.current_color.yellow;
- csb->csb.dock_black[i] = csb->csb.current_color.black;
- csb->csb.dock_used[i] = True;
- csb->csb.dock_changed = True;
- DrawDock(csb);
-}
-
-/* ARGSUSED */
-
-static void DockPress(w, data, event, goOn)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *goOn;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) data;
- Dimension height;
- int i, lines, row, col;
-
- XtVaGetValues(csb->csb.dock_child, XtNheight, &height, NULL);
-
- lines = height / csb->csb.cell_size;
-
- row = event->xbutton.y / (int) csb->csb.cell_size;
- col = event->xbutton.x / (int) csb->csb.cell_size;
- i = col * lines + row;
- if (i >= csb->csb.num_cells) i = csb->csb.num_cells;
-
- if (!csb->csb.dock_used[i]) return;
-
- csb->csb.current_color.cyan = csb->csb.dock_cyan[i];
- csb->csb.current_color.magenta = csb->csb.dock_magenta[i];
- csb->csb.current_color.yellow = csb->csb.dock_yellow[i];
- csb->csb.current_color.black = csb->csb.dock_black[i];
- UpdateColorSpaces(csb, CSBSpaceCMYK);
- DoValueChangedCallback(csb);
- FillPatch(csb);
- SetSliders(csb);
-}
-
-static void InitializePalettes(csb)
- ColorSelectionBoxWidget csb;
-{
- int k;
-
- for (k = 0; k < PALETTE_MAX; k++) {
- if (csb->csb.palette_function[k] != NULL) {
- DPSPrintf(csb->csb.context,
- "/palette%dfunc%d { %s } bind def\n", k, (int) csb,
- csb->csb.palette_function[k]);
- }
- csb->csb.palette_broken[k] = False;
- }
-}
-
-static void InvalidatePalette(csb)
- ColorSelectionBoxWidget csb;
-{
- int len;
- char *buf;
- Widget w;
- register int i = csb->csb.current_palette;
-
- len = strlen(csb->csb.palette_label[i]) +
- strlen(csb->csb.broken_palette_label) + 2;
- len = MAX(len, 11);
- buf = (char *) XtMalloc(len);
-
- csb->csb.palette_broken[i] = True;
- sprintf(buf, "*palette%d", csb->csb.current_palette);
- w = XtNameToWidget((Widget) csb, buf);
- if (w != NULL) XtSetSensitive(w, False);
- sprintf(buf, "%s %s", csb->csb.palette_label[i],
- csb->csb.broken_palette_label);
- len = strlen(buf);
- XtVaSetValues(w, XtVaTypedArg, XmNlabelString, XtRString, buf, len, NULL);
-}
-
-static void DoPalette(csb, pixelWidth, w, h)
- ColorSelectionBoxWidget csb;
- Dimension pixelWidth;
- float w, h;
-{
- char whichFunc[25];
- int steps;
- int success;
-
- sprintf(whichFunc, "palette%dfunc%d", csb->csb.current_palette, (int) csb);
- if (csb->csb.visual_class == TrueColor) steps = pixelWidth / 2;
- else steps = pixelWidth / 4;
-
- if (csb->csb.palette_color_dependent[csb->csb.current_palette]) {
- switch (csb->csb.palette_space[csb->csb.current_palette]) {
- case CSBSpaceRGB:
- _DPSCDoRGBColorPalette(csb->csb.context, whichFunc,
- csb->csb.current_color.red,
- csb->csb.current_color.green,
- csb->csb.current_color.blue,
- w, h, steps, &success);
- break;
- case CSBSpaceCMYK:
- _DPSCDoCMYKColorPalette(csb->csb.context, whichFunc,
- csb->csb.current_color.cyan,
- csb->csb.current_color.magenta,
- csb->csb.current_color.yellow,
- csb->csb.current_color.black,
- w, h, steps, &success);
- break;
- case CSBSpaceHSB:
- _DPSCDoHSBColorPalette(csb->csb.context, whichFunc,
- csb->csb.current_color.hue,
- csb->csb.current_color.saturation,
- csb->csb.current_color.brightness,
- w, h, steps, &success);
- break;
- case CSBSpaceGray:
- _DPSCDoGrayColorPalette(csb->csb.context, whichFunc,
- csb->csb.current_color.gray,
- w, h, steps, &success);
- break;
- }
- } else {
- switch (csb->csb.palette_space[csb->csb.current_palette]) {
- case CSBSpaceRGB:
- _DPSCDoRGBPalette(csb->csb.context, whichFunc, w, h,
- steps, &success);
- break;
- case CSBSpaceCMYK:
- _DPSCDoCMYKPalette(csb->csb.context, whichFunc, w, h,
- steps, &success);
- break;
- case CSBSpaceHSB:
- _DPSCDoHSBPalette(csb->csb.context, whichFunc, w, h,
- steps, &success);
- break;
- case CSBSpaceGray:
- _DPSCDoGrayPalette(csb->csb.context, whichFunc, w, h,
- steps, &success);
- break;
- }
- }
- if (!success) {
- InvalidatePalette(csb);
- _DPSCShowMessage(csb->csb.context, csb->csb.broken_palette_message);
- }
-}
-
-static void DrawPalette(csb)
- ColorSelectionBoxWidget csb;
-{
- DrawPaletteCallback(csb->csb.palette_child,
- (XtPointer) csb, (XtPointer) NULL);
-}
-
-/* ARGSUSED */
-
-static void DrawPaletteCallback(wid, clientData, callData)
- Widget wid;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Dimension width, height;
- Pixmap palette_pixmap;
- int depth;
- float w, h;
-
- if (csb->csb.palette_broken[csb->csb.current_palette]) return;
- if (!csb->csb.palette_pixmap_valid) {
- XtVaGetValues(csb->csb.palette_child,
- XtNwidth, &width, XtNheight, &height,
- XtNdepth, &depth, NULL);
-
- ToUserSpace(csb, width, height, &w, &h);
-
- palette_pixmap =
- XCreatePixmap(XtDisplay(csb), XtWindow(csb->csb.palette_child),
- width, height, depth);
-
- XDPSSetContextGState(csb->csb.context, csb->csb.base_gstate);
- XDPSSetContextDrawable(csb->csb.context, palette_pixmap, height);
-
- DoPalette(csb, width, w, h);
- csb->csb.palette_color = csb->csb.current_color;
- DPSWaitContext(csb->csb.context);
- XtVaSetValues(csb->csb.palette_child,
- XtNbackgroundPixmap, palette_pixmap, NULL);
- XFreePixmap(XtDisplay(csb), palette_pixmap);
- csb->csb.palette_pixmap_valid = True;
- }
-}
-
-/* ARGSUSED */
-
-static void PalettePress(w, data, event, goOn)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *goOn;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) data;
- Dimension width;
- float pct;
- char whichFunc[25];
- int success;
- float f1, f2, f3, f4;
-
- if (csb->csb.palette_broken[csb->csb.current_palette]) return;
-
- sprintf(whichFunc, "palette%dfunc%d", csb->csb.current_palette, (int) csb);
-
- XtVaGetValues(csb->csb.palette_child, XtNwidth, &width, NULL);
-
- pct = ((float) event->xbutton.x) / ((float) width);
-
- if (csb->csb.palette_color_dependent[csb->csb.current_palette]) {
- switch (csb->csb.palette_space[csb->csb.current_palette]) {
- case CSBSpaceRGB:
- _DPSCQueryRGBColorPalette(csb->csb.context, whichFunc, pct,
- csb->csb.palette_color.red,
- csb->csb.palette_color.green,
- csb->csb.palette_color.blue,
- &f1, &f2, &f3, &success);
- if (success) {
- csb->csb.current_color.red = f1;
- csb->csb.current_color.green = f2;
- csb->csb.current_color.blue = f3;
- }
- break;
- case CSBSpaceCMYK:
- _DPSCQueryCMYKColorPalette(csb->csb.context, whichFunc, pct,
- csb->csb.palette_color.cyan,
- csb->csb.palette_color.magenta,
- csb->csb.palette_color.yellow,
- csb->csb.palette_color.black,
- &f1, &f2, &f3, &f4, &success);
- if (success) {
- csb->csb.current_color.cyan = f1;
- csb->csb.current_color.magenta = f2;
- csb->csb.current_color.yellow = f3;
- csb->csb.current_color.black = f4;
- }
- break;
- case CSBSpaceHSB:
- _DPSCQueryHSBColorPalette(csb->csb.context, whichFunc, pct,
- csb->csb.palette_color.hue,
- csb->csb.palette_color.saturation,
- csb->csb.palette_color.brightness,
- &f1, &f2, &f3, &success);
- if (success) {
- csb->csb.current_color.hue = f1;
- csb->csb.current_color.saturation = f2;
- csb->csb.current_color.brightness = f3;
- }
- break;
- case CSBSpaceGray:
- _DPSCQueryGrayColorPalette(csb->csb.context, whichFunc, pct,
- csb->csb.palette_color.gray,
- &f1, &success);
- if (success) csb->csb.current_color.gray = f1;
- break;
- }
- } else {
- switch (csb->csb.palette_space[csb->csb.current_palette]) {
- case CSBSpaceRGB:
- _DPSCQueryRGBPalette(csb->csb.context, whichFunc, pct,
- &f1, &f2, &f3, &success);
- if (success) {
- csb->csb.current_color.red = f1;
- csb->csb.current_color.green = f2;
- csb->csb.current_color.blue = f3;
- }
- break;
- case CSBSpaceCMYK:
- _DPSCQueryCMYKPalette(csb->csb.context, whichFunc, pct,
- &f1, &f2, &f3, &f4, &success);
- if (success) {
- csb->csb.current_color.cyan = f1;
- csb->csb.current_color.magenta = f2;
- csb->csb.current_color.yellow = f3;
- csb->csb.current_color.black = f4;
- }
- break;
- case CSBSpaceHSB:
- _DPSCQueryHSBPalette(csb->csb.context, whichFunc, pct,
- &f1, &f2, &f3, &success);
- if (success) {
- csb->csb.current_color.hue = f1;
- csb->csb.current_color.saturation = f2;
- csb->csb.current_color.brightness = f3;
- }
- break;
- case CSBSpaceGray:
- _DPSCQueryGrayPalette(csb->csb.context, whichFunc, pct,
- &f1, &success);
- if (success) csb->csb.current_color.gray = f1;
- break;
- }
- }
- if (!success) InvalidatePalette(csb);
- else {
- UpdateColorSpaces(csb,
- csb->csb.palette_space[csb->csb.current_palette]);
- DoValueChangedCallback(csb);
- FillPatch(csb);
- SetSliders(csb);
- }
-}
-
-/* ARGSUSED */
-
-static void DoEyedropCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) clientData;
- Pixmap eyedropBitmap, eyedropMaskBitmap;
- XColor black, fg;
- Display *dpy;
- unsigned int x, y;
- XEvent ev;
-
- dpy = XtDisplay(w);
-
- black.red = 0;
- black.green = 0;
- black.blue = 0;
-
- fg.red = 65535;
- fg.green = 65535;
- fg.blue = 65535;
-
- if (csb->csb.eyedrop == None) {
- XQueryBestCursor(dpy, XtWindow(w), 32, 32,
- &x, &y);
-
- if (x >= 32 && y >= 32) {
- eyedropBitmap =
- XCreateBitmapFromData(dpy, XtWindow(w),
- (char *) eyedrop32_bits,
- eyedrop32_width, eyedrop32_height);
-
- eyedropMaskBitmap =
- XCreateBitmapFromData(dpy, XtWindow(w),
- (char *) eyedropmask32_bits,
- eyedropmask32_width,
- eyedropmask32_height);
-
- csb->csb.eyedrop =
- XCreatePixmapCursor(dpy, eyedropBitmap,
- eyedropMaskBitmap,
- &fg, &black,
- eyedrop32_x_hot, eyedrop32_y_hot);
- } else {
- eyedropBitmap =
- XCreateBitmapFromData(dpy, XtWindow(w),
- (char *) eyedrop16_bits,
- eyedrop16_width, eyedrop16_height);
-
- eyedropMaskBitmap =
- XCreateBitmapFromData(dpy, XtWindow(w),
- (char *) eyedropmask16_bits,
- eyedropmask16_width,
- eyedropmask16_height);
-
- csb->csb.eyedrop =
- XCreatePixmapCursor(dpy, eyedropBitmap,
- eyedropMaskBitmap,
- &fg, &black,
- eyedrop16_x_hot, eyedrop16_y_hot);
- }
- } else {
- XRecolorCursor(dpy, csb->csb.eyedrop, &fg, &black);
- }
-
- (void) XtGrabPointer(w, False,
- PointerMotionMask | PointerMotionHintMask |
- ButtonReleaseMask,
- GrabModeAsync, GrabModeAsync,
- None, csb->csb.eyedrop,
- XtLastTimestampProcessed(dpy));
- csb->csb.eyedrop_grabbed = True;
-
- ev.type = 0;
- EyedropPointer(w, (XtPointer) csb, &ev, (Boolean *) NULL);
-}
-
-/* ARGSUSED */
-
-static void EyedropPointer(w, data, event, goOn)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *goOn;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) data;
- XColor fg, black;
- Window root, child, stop, old_child = None;
- int root_x, root_y, x, y;
- unsigned int mask;
- XWindowAttributes att;
- XImage *image;
- Pixel pixel;
- Colormap colormap;
- Display *dpy = XtDisplay(w);
-
- if (!csb->csb.eyedrop_grabbed) return;
-
- if (event->type == ButtonPress || event->type == ButtonRelease) {
- root = event->xbutton.root;
- root_x = event->xbutton.x_root;
- root_y = event->xbutton.y_root;
-
- XTranslateCoordinates(dpy, root, root, root_x, root_y, &x, &y, &child);
-
- } else {
- XQueryPointer(dpy, RootWindowOfScreen(XtScreen(w)),
- &root, &child, &root_x, &root_y, &x, &y, &mask);
- }
-
- if (child == None) child = root;
- else {
- stop = child;
-
- while (stop != None) {
- XTranslateCoordinates(dpy, root, stop, x, y, &x, &y, &child);
- root = stop;
- if (child != None && XGetWindowAttributes(dpy, child, &att) &&
- att.class != InputOutput) break;
- stop = child;
- }
- child = root;
- }
-
- if (child != old_child) {
- XGetWindowAttributes(dpy, child, &att);
- colormap = att.colormap;
- old_child = child;
- }
-
- image = XGetImage(dpy, child, x, y, 1, 1, AllPlanes, XYPixmap);
-
- pixel = XGetPixel(image, 0, 0);
-
- XDestroyImage(image);
- fg.pixel = pixel;
- XQueryColors(dpy, colormap, &fg, 1);
-
- black.red = 0;
- black.green = 0;
- black.blue = 0;
-
- XRecolorCursor(dpy, csb->csb.eyedrop, &fg, &black);
-
- if (event->type == ButtonRelease) {
- XtUngrabPointer(w, XtLastTimestampProcessed(dpy));
- csb->csb.eyedrop_grabbed = False;
-
- csb->csb.current_color.red = (float) fg.red / 65535.0;
- csb->csb.current_color.green = (float) fg.green / 65535.0;
- csb->csb.current_color.blue = (float) fg.blue / 65535.0;
- UpdateColorSpaces(csb, CSBSpaceRGB);
- DoValueChangedCallback(csb);
- FillPatch(csb);
- SetSliders(csb);
- }
-}
-
-/* ARGSUSED */
-
-static void PatchPress(w, data, event, goOn)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *goOn;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) data;
- Pixmap squareBitmap, squareMaskBitmap;
- XColor black, fg;
- Display *dpy;
-
- dpy = XtDisplay(w);
-
- black.red = 0;
- black.green = 0;
- black.blue = 0;
-
- fg.red = TO_X(csb->csb.current_color.red);
- fg.green = TO_X(csb->csb.current_color.green);
- fg.blue = TO_X(csb->csb.current_color.blue);
-
- if (csb->csb.square == None) {
- squareBitmap =
- XCreateBitmapFromData(dpy, XtWindow(w), (char *) square_bits,
- square_width, square_height);
-
- squareMaskBitmap =
- XCreateBitmapFromData(dpy, XtWindow(w),
- (char *) squaremask_bits,
- squaremask_width, squaremask_height);
-
- csb->csb.square =
- XCreatePixmapCursor(dpy, squareBitmap, squareMaskBitmap,
- &fg, &black, square_x_hot, square_y_hot);
- } else {
- XRecolorCursor(dpy, csb->csb.square, &fg, &black);
- }
-
- (void) XtGrabPointer(w, False, ButtonReleaseMask,
- GrabModeAsync, GrabModeAsync,
- None, csb->csb.square, XtLastTimestampProcessed(dpy));
-}
-
-/* ARGSUSED */
-
-static void PatchRelease(w, data, event, goOn)
- Widget w;
- XtPointer data;
- XEvent *event;
- Boolean *goOn;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) data;
- Dimension width, height;
- Position left, top;
-
- XtUngrabPointer(w, XtLastTimestampProcessed(XtDisplay(w)));
- XFlush(XtDisplay(w));
-
- XtVaGetValues(csb->csb.dock_child, XtNwidth, &width,
- XtNheight, &height, NULL);
-
- XtTranslateCoords(csb->csb.dock_child, (Position) 0, (Position) 0,
- &left, &top);
-
- if ((int) event->xbutton.x_root >= left &&
- (int) event->xbutton.x_root <= left + (int) width &&
- (int) event->xbutton.y_root >= top &&
- (int) event->xbutton.y_root <= top + (int) height) {
- StoreColorInDock(csb, event->xbutton.x_root - left,
- event->xbutton.y_root - top, height);
- }
-}
-
-static void GetVisualInfo(csb, visual)
- ColorSelectionBoxWidget csb;
- Visual **visual;
-{
- Widget w = (Widget) csb;
- XVisualInfo *vip, viproto;
- int n;
- XWindowAttributes xwa;
-
- XGetWindowAttributes(XtDisplay(w), XtWindow(w), &xwa);
-
- *visual = viproto.visual = xwa.visual;
- viproto.visualid = XVisualIDFromVisual(xwa.visual);
- vip = XGetVisualInfo(XtDisplay(w), VisualIDMask, &viproto, &n);
-
- if (n != 1) {
- csb->csb.static_visual = False; /* Actually we have no idea, but... */
- csb->csb.visual_class = PseudoColor;
- } else {
- csb->csb.visual_class = vip->class;
- csb->csb.static_visual = (vip->class == StaticGray ||
- vip->class == TrueColor ||
- vip->class == StaticColor);
- }
-
- if (n > 0) XFree((char *) vip);
-}
-
-static void SetBackground(csb)
- ColorSelectionBoxWidget csb;
-{
- Colormap c;
- XColor xc;
- int status;
- unsigned long pix;
- unsigned long mask;
-
- XtVaGetValues(csb->csb.patch_child, XtNcolormap, (XtPointer) &c, NULL);
-
- if (csb->csb.current_space == CSBSpaceGray) {
- xc.red = xc.green = xc.blue = TO_X(csb->csb.current_color.gray);
- } else {
- xc.red = TO_X(csb->csb.current_color.red);
- xc.green = TO_X(csb->csb.current_color.green);
- xc.blue = TO_X(csb->csb.current_color.blue);
- }
-
- if (csb->csb.static_visual) {
- status = XAllocColor(XtDisplay(csb), c, &xc);
- if (status == 0) NoBackgroundPixel(csb);
- else {
- csb->csb.background = xc.pixel;
- XtVaSetValues(csb->csb.patch_child,
- XtNbackground, csb->csb.background, NULL);
- }
-
- } else {
- if (csb->csb.visual_class == DirectColor) {
- status = XAllocColorPlanes(XtDisplay(csb), c,
- False, &pix, 1, 0, 0, 0,
- &mask, &mask, &mask);
- } else {
- status = XAllocColorCells(XtDisplay(csb), c,
- False, (unsigned long *) NULL, 0,
- &pix, 1);
- }
-
- if (status == 0) NoBackgroundPixel(csb);
- else {
- xc.pixel = pix;
- xc.flags = DoRed | DoGreen | DoBlue;
- XStoreColor(XtDisplay(csb), c, &xc);
-
- csb->csb.background = xc.pixel;
- XtVaSetValues(csb->csb.patch_child,
- XtNbackground, csb->csb.background, NULL);
- }
- }
-}
-
-/* ARGSUSED */
-
-static void Initialize(request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) new;
- Bool inited;
- int i;
-
- if (csb->csb.rgb_labels != NULL) {
- csb->csb.rgb_labels = XtNewString(csb->csb.rgb_labels);
- }
- if (csb->csb.cmyk_labels != NULL) {
- csb->csb.cmyk_labels = XtNewString(csb->csb.cmyk_labels);
- }
- if (csb->csb.hsb_labels != NULL) {
- csb->csb.hsb_labels = XtNewString(csb->csb.hsb_labels);
- }
- if (csb->csb.gray_labels != NULL) {
- csb->csb.gray_labels = XtNewString(csb->csb.gray_labels);
- }
- if (csb->csb.fill_me != NULL) {
- csb->csb.fill_me = XtNewString(csb->csb.fill_me);
- }
- if (csb->csb.broken_palette_label != NULL) {
- csb->csb.broken_palette_label =
- XtNewString(csb->csb.broken_palette_label);
- }
- if (csb->csb.broken_palette_message != NULL) {
- csb->csb.broken_palette_message =
- XtNewString(csb->csb.broken_palette_message);
- }
-
- for (i = 0; i < PALETTE_MAX; i++) {
- if (csb->csb.palette_function[i] != NULL) {
- csb->csb.palette_function[i] =
- XtNewString(csb->csb.palette_function[i]);
- }
- }
-
- if (csb->csb.num_cells <= 0) csb->csb.num_cells = 1;
-
- /* Get the context */
-
- if (csb->csb.context == NULL) {
- csb->csb.context = XDPSGetSharedContext(XtDisplay(csb));
- }
-
- if (_XDPSTestComponentInitialized(csb->csb.context,
- dps_init_bit_csb, &inited) ==
- dps_status_unregistered_context) {
- XDPSRegisterContext(csb->csb.context, False);
- }
-
- if (!inited) {
- (void) _XDPSSetComponentInitialized(csb->csb.context,
- dps_init_bit_csb);
- InitializePalettes(csb);
- }
-
- if (csb->csb.current_palette < 0 ||
- csb->csb.current_palette > PALETTE_MAX ||
- csb->csb.palette_function[csb->csb.current_palette] == NULL) {
- csb->csb.current_palette = 0;
- }
-
- /* Initialize non-resource fields */
-
- CreateChildren(csb);
- csb->csb.no_background = False;
- csb->csb.patch_gstate = csb->csb.dock_gstate = 0;
- csb->csb.red_pixmap = csb->csb.green_pixmap = csb->csb.blue_pixmap =
- csb->csb.cyan_pixmap = csb->csb.magenta_pixmap =
- csb->csb.yellow_pixmap = csb->csb.black_pixmap =
- csb->csb.hue_pixmap = csb->csb.sat_pixmap =
- csb->csb.bright_pixmap = csb->csb.gray_pixmap = None;
-
- csb->csb.square = csb->csb.eyedrop = None;
- csb->csb.eyedrop_grabbed = False;
-
- for (i = 0; i < PALETTE_MAX; i++) csb->csb.palette_broken[i] = False;
- csb->csb.palette_pixmap_valid = False;
-
- csb->csb.current_color.hue = 0.0;
- csb->csb.current_color.saturation = 1.0;
- csb->csb.current_color.brightness = 1.0;
- UpdateColorSpaces(csb, CSBSpaceHSB);
- csb->csb.save_color = csb->csb.current_color;
- SetSliders(csb);
-
- InitializeDock(csb);
- SetColorSpace(csb);
- SetRendering(csb);
-}
-
-static void Destroy(widget)
- Widget widget;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) widget;
- Display *dpy = XtDisplay(csb);
- int i;
-
- /* Lots of stuff to destroy! */
-
- if (csb->csb.patch_gstate != 0) {
- XDPSFreeContextGState(csb->csb.context, csb->csb.patch_gstate);
- }
- if (csb->csb.dock_gstate != 0) {
- XDPSFreeContextGState(csb->csb.context, csb->csb.dock_gstate);
- }
- if (csb->csb.base_gstate != 0) {
- XDPSFreeContextGState(csb->csb.context, csb->csb.base_gstate);
- }
-
- if (csb->csb.rgb_labels != NULL) XtFree(csb->csb.rgb_labels);
- if (csb->csb.cmyk_labels != NULL) XtFree(csb->csb.cmyk_labels);
- if (csb->csb.hsb_labels != NULL) XtFree(csb->csb.hsb_labels);
- if (csb->csb.gray_labels != NULL) XtFree(csb->csb.gray_labels);
- if (csb->csb.fill_me != NULL) XtFree(csb->csb.fill_me);
- if (csb->csb.broken_palette_message != NULL) {
- XtFree(csb->csb.broken_palette_message);
- }
- if (csb->csb.broken_palette_label != NULL) {
- XtFree(csb->csb.broken_palette_label);
- }
-
- XtFree((XtPointer) csb->csb.dock_cyan);
- XtFree((XtPointer) csb->csb.dock_magenta);
- XtFree((XtPointer) csb->csb.dock_yellow);
- XtFree((XtPointer) csb->csb.dock_black);
- XtFree((XtPointer) csb->csb.dock_used);
-
- for (i = 0; i < PALETTE_MAX; i++) {
- if (csb->csb.palette_function[i] != NULL) {
- XtFree(csb->csb.palette_function[i]);
- }
- }
-
- if (csb->csb.eyedrop != None) XFreeCursor(dpy, csb->csb.eyedrop);
- if (csb->csb.square != None) XFreeCursor(dpy, csb->csb.square);
-
- if (csb->csb.red_pixmap != None) XFreePixmap(dpy, csb->csb.red_pixmap);
- if (csb->csb.green_pixmap != None) XFreePixmap(dpy, csb->csb.green_pixmap);
- if (csb->csb.blue_pixmap != None) XFreePixmap(dpy, csb->csb.blue_pixmap);
- if (csb->csb.cyan_pixmap != None) XFreePixmap(dpy, csb->csb.cyan_pixmap);
- if (csb->csb.magenta_pixmap != None)
- XFreePixmap(dpy, csb->csb.magenta_pixmap);
- if (csb->csb.yellow_pixmap != None)
- XFreePixmap(dpy, csb->csb.yellow_pixmap);
- if (csb->csb.black_pixmap != None) XFreePixmap(dpy, csb->csb.black_pixmap);
- if (csb->csb.hue_pixmap != None) XFreePixmap(dpy, csb->csb.hue_pixmap);
- if (csb->csb.sat_pixmap != None) XFreePixmap(dpy, csb->csb.sat_pixmap);
- if (csb->csb.bright_pixmap != None)
- XFreePixmap(dpy, csb->csb.bright_pixmap);
- if (csb->csb.gray_pixmap != None) XFreePixmap(dpy, csb->csb.gray_pixmap);
-}
-
-static void ChangeManaged(w)
- Widget w;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) w;
-
- w->core.width = csb->composite.children[0]->core.width;
- w->core.height = csb->composite.children[0]->core.height;
-}
-
-/* ARGSUSED */
-
-static XtGeometryResult GeometryManager(w, desired, allowed)
- Widget w;
- XtWidgetGeometry *desired, *allowed;
-{
-#define WANTS(flag) (desired->request_mode & flag)
-
- if (WANTS(XtCWQueryOnly)) return XtGeometryYes;
-
- if (WANTS(CWWidth)) w->core.width = desired->width;
- if (WANTS(CWHeight)) w->core.height = desired->height;
- if (WANTS(CWX)) w->core.x = desired->x;
- if (WANTS(CWY)) w->core.y = desired->y;
- if (WANTS(CWBorderWidth)) {
- w->core.border_width = desired->border_width;
- }
-
- return XtGeometryYes;
-#undef WANTS
-}
-
-static void SetColorSpace(csb)
- ColorSelectionBoxWidget csb;
-{
- switch(csb->csb.current_space) {
- case CSBSpaceRGB:
- SetRGBCallback((Widget) csb, (XtPointer) csb, (XtPointer) NULL);
- break;
-
- case CSBSpaceCMYK:
- SetCMYKCallback((Widget) csb, (XtPointer) csb, (XtPointer) NULL);
- break;
-
- case CSBSpaceHSB:
- SetHSBCallback((Widget) csb, (XtPointer) csb, (XtPointer) NULL);
- break;
-
- case CSBSpaceGray:
- SetGrayCallback((Widget) csb, (XtPointer) csb, (XtPointer) NULL);
- break;
- }
-}
-
-static void SetRendering(csb)
- ColorSelectionBoxWidget csb;
-{
- Widget w;
-
- switch(csb->csb.current_rendering) {
- case CSBDisplayX:
- w = XtNameToWidget((Widget) csb, "*displayX");
- break;
- case CSBDisplayDPS:
- w = XtNameToWidget((Widget) csb, "*displayDPS");
- break;
- case CSBDisplayBoth:
- w = XtNameToWidget((Widget) csb, "*displayBoth");
- break;
- }
- XtVaSetValues(csb->csb.display_option_menu_child, XmNmenuHistory, w, NULL);
- if (XtIsRealized(csb->csb.patch_child)) {
- XClearArea(XtDisplay(csb), XtWindow(csb->csb.patch_child),
- 0, 0, 1000, 1000, True);
- }
-}
-
-static void SetPalette(csb)
- ColorSelectionBoxWidget csb;
-{
- Widget w;
- char buf[10];
-
- sprintf(buf, "*palette%d", csb->csb.current_palette);
- w = XtNameToWidget((Widget) csb, buf);
-
- XtVaSetValues(csb->csb.palette_option_menu_child, XmNmenuHistory, w, NULL);
-
- csb->csb.palette_pixmap_valid = False;
- DrawPalette(csb);
-}
-
-static void SetBaseGState(csb, visual)
- ColorSelectionBoxWidget csb;
- Visual *visual;
-{
- XStandardColormap colorCube, grayRamp;
- int match;
-
- /* If the context's colormap matches the widget's colormap, assume that
- everything is already set up right in the color cube department. This
- allows an application to supply us with a custom color cube by
- installing it in the context before calling us */
-
- _DPSCColormapMatch(csb->csb.context, csb->core.colormap, &match);
-
- if (match) {
- XDPSSetContextParameters(csb->csb.context, XtScreen(csb),
- csb->core.depth, XtWindow(csb),
- csb->core.height, NULL, NULL,
- XDPSContextScreenDepth | XDPSContextDrawable);
- } else {
- grayRamp.colormap = colorCube.colormap = csb->core.colormap;
-
- XDPSCreateStandardColormaps(XtDisplay(csb), XtWindow(csb), visual,
- 0, 0, 0, 0, &colorCube, &grayRamp, False);
-
- XDPSSetContextParameters(csb->csb.context, XtScreen(csb),
- csb->core.depth, XtWindow(csb),
- csb->core.height,
- (XDPSStandardColormap *) &colorCube,
- (XDPSStandardColormap *) &grayRamp,
- XDPSContextScreenDepth | XDPSContextDrawable |
- XDPSContextRGBMap | XDPSContextGrayMap);
- }
-
- XDPSCaptureContextGState(csb->csb.context, &csb->csb.base_gstate);
-}
-
-/* ARGSUSED */
-
-static Boolean SetValues(old, req, new, args, num_args)
- Widget old, req, new;
- ArgList args;
- Cardinal *num_args;
-{
- ColorSelectionBoxWidget oldcsb = (ColorSelectionBoxWidget) old;
- ColorSelectionBoxWidget newcsb = (ColorSelectionBoxWidget) new;
- Bool inited;
- char buf[10];
- Widget w;
- int i;
-
-#define NE(field) newcsb->csb.field != oldcsb->csb.field
-
- if (NE(rgb_labels)) {
- XtFree(oldcsb->csb.rgb_labels);
- newcsb->csb.rgb_labels = XtNewString(newcsb->csb.rgb_labels);
- }
- if (NE(cmyk_labels)) {
- XtFree(oldcsb->csb.cmyk_labels);
- newcsb->csb.cmyk_labels = XtNewString(newcsb->csb.cmyk_labels);
- }
- if (NE(hsb_labels)) {
- XtFree(oldcsb->csb.hsb_labels);
- newcsb->csb.hsb_labels = XtNewString(newcsb->csb.hsb_labels);
- }
- if (NE(gray_labels)) {
- XtFree(oldcsb->csb.gray_labels);
- newcsb->csb.gray_labels = XtNewString(newcsb->csb.gray_labels);
- }
-
- if (NE(context)) {
- if (newcsb->csb.context == NULL) {
- newcsb->csb.context = XDPSGetSharedContext(XtDisplay(newcsb));
- }
- if (_XDPSTestComponentInitialized(newcsb->csb.context,
- dps_init_bit_csb, &inited) ==
- dps_status_unregistered_context) {
- XDPSRegisterContext(newcsb->csb.context, False);
- }
- if (!inited) {
- (void) _XDPSSetComponentInitialized(newcsb->csb.context,
- dps_init_bit_csb);
- InitializePalettes(newcsb);
- }
- newcsb->csb.patch_gstate = newcsb->csb.dock_gstate = 0;
- XDPSFreeContextGState(newcsb->csb.context, newcsb->csb.patch_gstate);
- XDPSFreeContextGState(newcsb->csb.context, newcsb->csb.dock_gstate);
- if (XtIsRealized(newcsb)) {
- XWindowAttributes xwa;
-
- XGetWindowAttributes(XtDisplay(newcsb), XtWindow(newcsb), &xwa);
- SetBaseGState(newcsb, xwa.visual);
- }
- }
-
- if (NE(fill_me)) {
- XtFree(oldcsb->csb.fill_me);
- newcsb->csb.fill_me = XtNewString(newcsb->csb.fill_me);
- }
-
- if (NE(broken_palette_label)) {
- XtFree(oldcsb->csb.broken_palette_label);
- newcsb->csb.broken_palette_label =
- XtNewString(newcsb->csb.broken_palette_label);
- }
-
- if (NE(broken_palette_message)) {
- XtFree(oldcsb->csb.broken_palette_message);
- newcsb->csb.broken_palette_message =
- XtNewString(newcsb->csb.broken_palette_message);
- }
-
- if (newcsb->csb.num_cells <= 0) newcsb->csb.num_cells = 1;
- if (NE(num_cells)) {
- int i, min;
-
- AllocateDock(newcsb);
- min = MIN(newcsb->csb.num_cells, oldcsb->csb.num_cells);
- for (i = 0; i < min; i++) {
- newcsb->csb.dock_cyan[i] = oldcsb->csb.dock_cyan[i];
- newcsb->csb.dock_magenta[i] = oldcsb->csb.dock_magenta[i];
- newcsb->csb.dock_yellow[i] = oldcsb->csb.dock_yellow[i];
- newcsb->csb.dock_black[i] = oldcsb->csb.dock_black[i];
- newcsb->csb.dock_used[i] = oldcsb->csb.dock_used[i];
- }
- XtFree((XtPointer) oldcsb->csb.dock_cyan);
- XtFree((XtPointer) oldcsb->csb.dock_magenta);
- XtFree((XtPointer) oldcsb->csb.dock_yellow);
- XtFree((XtPointer) oldcsb->csb.dock_black);
- XtFree((XtPointer) oldcsb->csb.dock_used);
- }
-
- for (i = 0; i < PALETTE_MAX; i++) {
- if (NE(palette_function[i]) || NE(palette_label[i])) {
- sprintf(buf, "*palette%d", i);
- w = XtNameToWidget((Widget) newcsb, buf);
- }
- if (NE(palette_function[i])) {
- if (newcsb->csb.palette_function[i] != NULL) {
- DPSPrintf(newcsb->csb.context,
- "/palette%dfunc%d { %s } bind def\n", i,
- (int) newcsb, newcsb->csb.palette_function[i]);
- /* Assume the best... */
- newcsb->csb.palette_broken[i] = False;
- XtManageChild(w);
- } else {
- XtUnmanageChild(w);
- if (newcsb->csb.current_palette == i) {
- newcsb->csb.current_palette = -1;
- }
- }
- }
- if (NE(palette_label[i]) || NE(palette_function[i])) {
- XtSetSensitive(w, True);
- XtVaSetValues(w, XtVaTypedArg, XmNlabelString, XtRString,
- newcsb->csb.palette_label[i],
- strlen(newcsb->csb.palette_label[i])+1, NULL);
- }
- }
-
- if (NE(current_palette)) {
- if (newcsb->csb.current_palette < 0 ||
- newcsb->csb.current_palette > PALETTE_MAX ||
- newcsb->csb.palette_function[newcsb->csb.current_palette] == NULL ||
- newcsb->csb.palette_broken[newcsb->csb.current_palette]) {
- newcsb->csb.current_palette = 0;
- }
- }
- if (NE(current_palette) ||
- NE(palette_function[newcsb->csb.current_palette])) SetPalette(newcsb);
-
- if ((NE(cell_size) || NE(fill_me)) &&
- XtIsRealized(newcsb->csb.dock_child)) {
- XClearArea(XtDisplay(newcsb), XtWindow(newcsb->csb.dock_child),
- 0, 0, 1000, 1000, True);
- }
-
- if (NE(current_space)) SetColorSpace(newcsb);
- if (NE(current_rendering)) SetRendering(newcsb);
-
- return False;
-#undef NE
-}
-
-static void Realize(w, mask, attr)
- Widget w;
- XtValueMask *mask;
- XSetWindowAttributes *attr;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) w;
- Visual *v;
-
- (*colorSelectionBoxClassRec.core_class.superclass->core_class.realize)
- (w, mask, attr);
-
- GetVisualInfo(csb, &v);
- SetBackground(csb);
- SetBaseGState(csb, v);
- _DPSCGetInvCTM(csb->csb.context, csb->csb.itransform);
-}
-
-static void Resize(widget)
- Widget widget;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) widget;
-
- XtResizeWidget(csb->csb.form_child, csb->core.width, csb->core.height, 0);
-}
-
-static Boolean SetColor(w, space, c1, c2, c3, c4, setSpace)
- Widget w;
- CSBColorSpace space;
- double c1, c2, c3, c4;
- Bool setSpace;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) w;
-#define CHECK(c) if ((c) > 1.0 || (c) < 0.0) return False;
-
- CHECK(c1);
- switch (space) {
- case CSBSpaceRGB:
- CHECK(c2);
- CHECK(c3);
- csb->csb.current_color.red = c1;
- csb->csb.current_color.green = c2;
- csb->csb.current_color.blue = c3;
- break;
- case CSBSpaceCMYK:
- CHECK(c2);
- CHECK(c3);
- CHECK(c4);
- csb->csb.current_color.cyan = c1;
- csb->csb.current_color.magenta = c2;
- csb->csb.current_color.yellow = c3;
- csb->csb.current_color.black = c4;
- break;
- case CSBSpaceHSB:
- CHECK(c2);
- CHECK(c3);
- csb->csb.current_color.hue = c1;
- csb->csb.current_color.saturation = c2;
- csb->csb.current_color.brightness = c3;
- break;
- case CSBSpaceGray:
- csb->csb.current_color.gray = c1;
- break;
- }
- UpdateColorSpaces(csb, space);
- csb->csb.save_color = csb->csb.current_color;
- DoValueChangedCallback(csb);
- FillPatch(csb);
- SetSliders(csb);
- if (setSpace) XtVaSetValues(w, XtNcurrentSpace, space, NULL);
- return True;
-#undef CHECK
-}
-
-Boolean CSBSetColor(w, space, c1, c2, c3, c4, setSpace)
- Widget w;
- CSBColorSpace space;
- double c1, c2, c3, c4;
- Bool setSpace;
-{
- XtCheckSubclass(w, colorSelectionBoxWidgetClass, NULL);
-
- return (*((ColorSelectionBoxWidgetClass) XtClass(w))->
- csb_class.set_color) (w, space, c1, c2, c3, c4, setSpace);
-}
-
-static void GetColor(w, space, c1, c2, c3, c4)
- Widget w;
- CSBColorSpace space;
- float *c1, *c2, *c3, *c4;
-{
- ColorSelectionBoxWidget csb = (ColorSelectionBoxWidget) w;
-
- switch (space) {
- case CSBSpaceRGB:
- *c1 = csb->csb.current_color.red;
- *c2 = csb->csb.current_color.green;
- *c3 = csb->csb.current_color.blue;
- break;
- case CSBSpaceCMYK:
- *c1 = csb->csb.current_color.cyan;
- *c2 = csb->csb.current_color.magenta;
- *c3 = csb->csb.current_color.yellow;
- *c4 = csb->csb.current_color.black;
- break;
- case CSBSpaceHSB:
- *c1 = csb->csb.current_color.hue;
- *c2 = csb->csb.current_color.saturation;
- *c3 = csb->csb.current_color.brightness;
- break;
- case CSBSpaceGray:
- *c1 = csb->csb.current_color.gray;
- break;
- }
-}
-
-void CSBGetColor(w, space, c1, c2, c3, c4)
- Widget w;
- CSBColorSpace space;
- float *c1, *c2, *c3, *c4;
-{
- XtCheckSubclass(w, colorSelectionBoxWidgetClass, NULL);
-
- (*((ColorSelectionBoxWidgetClass) XtClass(w))->
- csb_class.get_color) (w, space, c1, c2, c3, c4);
-}
diff --git a/xc/lib/dpstk/ColorSelect.ad b/xc/lib/dpstk/ColorSelect.ad
deleted file mode 100644
index 8c3baa8c6..000000000
--- a/xc/lib/dpstk/ColorSelect.ad
+++ /dev/null
@@ -1,162 +0,0 @@
-! ColorSelect
-!
-! (c) Copyright 1991-1994 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
-!
-! Resource file for Color Picker
-!
-! This resource file must be merged into the resource file for
-! any application that uses the Color Picker
-!
-!
-*ColorSelectionBox*fontList: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1
-*ColorSelectionBox*XmPushButton.marginLeft: 5
-*ColorSelectionBox*XmPushButton.marginRight: 5
-*ColorSelectionBox*XmScale.orientation: horizontal
-*ColorSelectionBox*XmScale.highlightThickness: 0
-
-*ColorSelectionBox*panel.width: 350
-*ColorSelectionBox*panel.height: 250
-
-*ColorSelectionBox*panel.horizontalSpacing: 5
-*ColorSelectionBox*panel.verticalSpacing: 5
-*ColorSelectionBox*panel.shadowThickness: 0
-
-*ColorSelectionBox*okButton.labelString: OK
-*ColorSelectionBox*applyButton.labelString: Apply
-*ColorSelectionBox*resetButton.labelString: Reset
-*ColorSelectionBox*cancelButton.labelString: Cancel
-
-*ColorSelectionBox*XmScale.topOffset: 8
-*ColorSelectionBox*slider2.leftOffset: 0
-*ColorSelectionBox*slider2.rightOffset: 0
-*ColorSelectionBox*slider3.leftOffset: 0
-*ColorSelectionBox*slider3.rightOffset: 0
-*ColorSelectionBox*slider4.leftOffset: 0
-*ColorSelectionBox*slider4.rightOffset: 0
-
-*ColorSelectionBox*displayX.labelString: X Rendering
-*ColorSelectionBox*displayDPS.labelString: DPS Rendering
-*ColorSelectionBox*displayBoth.labelString: Both
-
-*ColorSelectionBox*noBackgroundMessage.messageString: Unable to allocate solid color\n\
-for color patch. Patch can only be\n\
-displayed using DPS rendering.
-*ColorSelectionBox*noBackgroundMessage.dialogTitle: Color Picker Alert
-
-*ColorSelectionBox*rgb.labelString: RGB
-*ColorSelectionBox*cmyk.labelString: CMYK
-*ColorSelectionBox*hsb.labelString: HSB
-*ColorSelectionBox*gray.labelString: Gray
-
-*ColorSelectionBox*value1.rightPosition: 60
-*ColorSelectionBox*value2.rightOffset:0
-*ColorSelectionBox*value3.rightOffset:0
-*ColorSelectionBox*value4.rightOffset:0
-
-*ColorSelectionBox*label1.alignment: alignment_end
-*ColorSelectionBox*label2.alignment: alignment_end
-*ColorSelectionBox*label3.alignment: alignment_end
-*ColorSelectionBox*label4.alignment: alignment_end
-
-*ColorSelectionBox*value1.recomputeSize: false
-*ColorSelectionBox*value2.recomputeSize: false
-*ColorSelectionBox*value3.recomputeSize: false
-*ColorSelectionBox*value4.recomputeSize: false
-*ColorSelectionBox*value1.width: 20
-*ColorSelectionBox*value2.width: 20
-*ColorSelectionBox*value3.width: 20
-*ColorSelectionBox*value4.width: 20
-*ColorSelectionBox*value1.labelString: 0
-*ColorSelectionBox*value2.labelString: 0
-*ColorSelectionBox*value3.labelString: 0
-*ColorSelectionBox*value4.labelString: 0
-
-*ColorSelectionBox*displayOptionMenu.leftPosition: 60
-*ColorSelectionBox*displayOptionMenu.labelString:
-*ColorSelectionBox*modelOptionMenu.labelString:
-*ColorSelectionBox*modelOptionMenu.leftOffset: 10
-*ColorSelectionBox*paletteOptionMenu.labelString:
-*ColorSelectionBox*paletteOptionMenu.leftOffset: 10
-
-*ColorSelectionBox*eyedropButton.topOffset: -3
-*ColorSelectionBox*eyedropButton.labelType: pixmap
-*ColorSelectionBox*eyedropButton.marginLeft: 2
-*ColorSelectionBox*eyedropButton.marginRight: 2
-*ColorSelectionBox*paletteFrame.shadowType: shadow_in
-*ColorSelectionBox*palette.height: 15
-
-*ColorSelectionBox*dockFrame.leftOffset: 12
-*ColorSelectionBox*dockFrame.shadowType: shadow_in
-
-*ColorSelectionBox*dock.height: 30
-
-*ColorSelectionBox*patchFrame.leftOffset: 0
-*ColorSelectionBox*patchFrame.shadowType: shadow_in
-*ColorSelectionBox*patchFrame.bottomOffset: 0
-*ColorSelectionBox*patch.shadowThickness: 0
-
-*ColorSelectionBox*palette0Label: Full Spectrum
-*ColorSelectionBox*palette0Space: HSB
-*ColorSelectionBox*palette0ColorDependent: False
-*ColorSelectionBox*palette0Function: 1 1
-
-*ColorSelectionBox*palette1Label: NarrowSpectrum
-*ColorSelectionBox*palette1Space: HSB
-*ColorSelectionBox*palette1ColorDependent: True
-*ColorSelectionBox*palette1Function: .5 sub .3 mul \
- 4 -1 roll add \
- dup 0.0 lt {1.0 add} if \
- dup 1.0 gt {1.0 sub} if \
- 3 1 roll
-
-*ColorSelectionBox*palette2Label: Shades
-*ColorSelectionBox*palette2Space: HSB
-*ColorSelectionBox*palette2ColorDependent: True
-*ColorSelectionBox*palette2Function: exch pop
-
-*ColorSelectionBox*palette3Label: Pastels
-*ColorSelectionBox*palette3Space: HSB
-*ColorSelectionBox*palette3ColorDependent: True
-*ColorSelectionBox*palette3Function: 3 -1 roll pop exch
-
-*ColorSelectionBox*palette4Label:Black to White
-*ColorSelectionBox*palette4Space: HSB
-*ColorSelectionBox*palette4ColorDependent: True
-*ColorSelectionBox*palette4Function: dup .5 lt {2 mul 3 1 roll pop pop 1 exch} {.5 sub 2 mul 1 sub neg 3 1 roll pop pop 1} ifelse
-
-*ColorSelectionBox*palette5Label: Grays
-*ColorSelectionBox*palette5Space: Gray
-*ColorSelectionBox*palette5ColorDependent: False
-*ColorSelectionBox*palette5Function:
diff --git a/xc/lib/dpstk/DPSScrollW.c b/xc/lib/dpstk/DPSScrollW.c
deleted file mode 100644
index 2184b3bce..000000000
--- a/xc/lib/dpstk/DPSScrollW.c
+++ /dev/null
@@ -1,3531 +0,0 @@
- /*
- * DPSScrollW.c
- *
- * (c) Copyright 1993-1994 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
- */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/ShellP.h>
-#include <X11/Xproto.h>
-#include <stdlib.h>
-#include <Xm/Xm.h>
-
-/* There are no words to describe how I feel about having to do this */
-
-#if XmVersion > 1001
-#include <Xm/ManagerP.h>
-#else
-#include <Xm/XmP.h>
-#endif
-
-#include <Xm/DrawingA.h>
-#include <Xm/ScrolledW.h>
-#include <Xm/ScrollBar.h>
-#include "DPS/dpsXclient.h"
-#include "dpsXcommonI.h"
-#include "DPS/dpsXshare.h"
-#include "DSWwraps.h"
-#include <stdio.h>
-#include "DPS/DPSScrollWP.h"
-
-#undef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#undef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
-#undef ABS
-#define ABS(x) ((x) >= 0 ? (x) : -(x))
-#undef CEIL
-#define CEIL(x) ((int) ((float)((int)(x)) == (x) ? (x) : (x) + 1))
-
-/* Define macros to get rectangle entries. All rectangles are stored as
- x, y, width, height. NOTE: ONLY FOR USER SPACE RECTANGLES, NOT X
- RECTANGLES!!!! */
-
-#define LEFT(r) ((r)[0])
-#define RIGHT(r) ((r)[0] + (r)[2])
-#define BOTTOM(r) ((r)[1])
-#define TOP(r) ((r)[1] + (r)[3])
-#define WIDTH(r) ((r)[2])
-#define HEIGHT(r) ((r)[3])
-
-/* This is used in converting bounding boxes into user space to ensure
- that we don't end up slopping over into another pixel */
-
-#define DELTA .001
-
-#define Offset(field) XtOffsetOf(DPSScrolledWindowRec, sw.field)
-
-static float initScale = 1.0;
-
-static XtResource resources[] = {
- {XtNcontext, XtCContext, XtRDPSContext, sizeof(DPSContext),
- Offset(context), XtRImmediate, (XtPointer) NULL},
- {XtNareaWidth, XtCAreaWidth, XtRInt, sizeof(int),
- Offset(area_width), XtRImmediate, (XtPointer) ((int) (8.5*72))},
- {XtNareaHeight, XtCAreaHeight, XtRInt, sizeof(int),
- Offset(area_height), XtRImmediate, (XtPointer) (11*72)},
- {XtNscale, XtCScale, XtRFloat, sizeof(float),
- Offset(scale), XtRFloat, (XtPointer) &initScale},
- {XtNctm, XtCCtm, XtRFloatArray, sizeof(float *),
- Offset(ctm_ptr), XtRImmediate, (XtPointer) NULL},
- {XtNinvCtm, XtCInvCtm, XtRFloatArray, sizeof(float *),
- Offset(inv_ctm_ptr), XtRImmediate, (XtPointer) NULL},
- {XtNuseBackingPixmap, XtCUseBackingPixmap, XtRBoolean, sizeof(Boolean),
- Offset(use_backing_pixmap), XtRImmediate, (XtPointer) True},
- {XtNuseFeedbackPixmap, XtCUseFeedbackPixmap, XtRBoolean, sizeof(Boolean),
- Offset(use_feedback_pixmap), XtRImmediate, (XtPointer) True},
- {XtNbackingPixmap, XtCBackingPixmap, XtRPixmap, sizeof(Pixmap),
- Offset(backing_pixmap), XtRImmediate, (XtPointer) None},
- {XtNfeedbackPixmap, XtCFeedbackPixmap, XtRPixmap, sizeof(Pixmap),
- Offset(feedback_pixmap), XtRImmediate, (XtPointer) None},
- {XtNdocumentSizePixmaps, XtCDocumentSizePixmaps,
- XtRBoolean, sizeof(Boolean),
- Offset(document_size_pixmaps), XtRImmediate, (XtPointer) False},
- {XtNwindowGState, XtCWindowGState, XtRDPSGState, sizeof(DPSGState),
- Offset(window_gstate), XtRImmediate, (XtPointer) 0},
- {XtNbackingGState, XtCBackingGState, XtRDPSGState, sizeof(DPSGState),
- Offset(backing_gstate), XtRImmediate, (XtPointer) 0},
- {XtNfeedbackGState, XtCFeedbackGState, XtRDPSGState, sizeof(DPSGState),
- Offset(feedback_gstate), XtRImmediate, (XtPointer) 0},
- {XtNdirtyAreas, XtCDirtyAreas, XtRFloatArray, sizeof(float *),
- Offset(dirty_areas), XtRImmediate, (XtPointer) NULL},
- {XtNnumDirtyAreas, XtCNumDirtyAreas, XtRShort, sizeof(short),
- Offset(num_dirty_areas), XtRImmediate, (XtPointer) 0},
- {XtNpixmapLimit, XtCPixmapLimit, XtRInt, sizeof(int),
- Offset(pixmap_limit), XtRImmediate, (XtPointer) -1},
- {XtNabsolutePixmapLimit, XtCAbsolutePixmapLimit, XtRInt, sizeof(int),
- Offset(absolute_pixmap_limit), XtRImmediate, (XtPointer) 0},
- {XtNwatchProgress, XtCWatchProgress, XtRBoolean, sizeof(Boolean),
- Offset(watch_progress), XtRImmediate, (XtPointer) False},
- {XtNwatchProgressDelay, XtCWatchProgressDelay, XtRInt, sizeof(int),
- Offset(watch_progress_delay), XtRImmediate, (XtPointer) 1000},
- {XtNminimalDrawing, XtCMinimalDrawing, XtRBoolean, sizeof(Boolean),
- Offset(minimal_drawing), XtRImmediate, (XtPointer) False},
- {XtNapplicationScrolling, XtCApplicationScrolling,
- XtRBoolean, sizeof(Boolean),
- Offset(application_scrolling), XtRImmediate, (XtPointer) False},
- {XtNsetupCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(setup_callback), XtRCallback, (XtPointer) NULL},
- {XtNexposeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(expose_callback), XtRCallback, (XtPointer) NULL},
- {XtNbackgroundCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(background_callback), XtRCallback, (XtPointer) NULL},
- {XtNfeedbackCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(feedback_callback), XtRCallback, (XtPointer) NULL},
- {XtNresizeCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(resize_callback), XtRCallback, (XtPointer) NULL},
-};
-
-static void ClassPartInitialize(), Initialize(), Destroy(),
- Realize(), Resize();
-static Boolean SetValues();
-static XtGeometryResult GeometryManager(), QueryGeometry();
-
-static void SetScale(), ScrollPoint(), ScrollBy(), ScrollTo(),
- SetScaleAndScroll(), ConvertXToPS(), ConvertPSToX(),
- AddToDirtyArea(), StartFeedbackDrawing(), EndFeedbackDrawing(),
- SetFeedbackDirtyArea(), FinishPendingDrawing(),
- AbortPendingDrawing(), GetDrawingInfo(), UpdateDrawing(),
- GetScrollInfo();
-
-static Boolean TakeFeedbackPixmap(), GiveFeedbackPixmap();
-
-static void ConvertToX(), ConvertToPS(), ConvertToOrigPS(),
- AddRectsToPending(), AddExposureToPending(),
- AddUserSpaceRectsToPending(),
- CopyRectsToCurrentDrawing(), CallFeedbackCallback(),
- CopyRectsToDirtyArea(), AddRectsToDirtyArea(), FinishDrawing(),
- CheckFeedbackPixmap(), CopyToFeedbackPixmap();
-
-static void DrawingAreaExpose(), DrawingAreaGraphicsExpose(), ScrollMoved(),
- HScrollCallback(), VScrollCallback();
-
-DPSScrolledWindowClassRec dpsScrolledWindowClassRec = {
- /* Core class part */
- {
- /* superclass */ (WidgetClass) &xmManagerClassRec,
- /* class_name */ "DPSScrolledWindow",
- /* widget_size */ sizeof(DPSScrolledWindowRec),
- /* class_initialize */ NULL,
- /* class_part_initialize */ ClassPartInitialize,
- /* class_inited */ False,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ Realize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ True,
- /* compress_exposure */ XtExposeCompressMultiple,
- /* compress_enterleave */ True,
- /* visible_interest */ False,
- /* destroy */ Destroy,
- /* resize */ Resize,
- /* expose */ NULL,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ QueryGeometry,
- /* display_accelerator */ NULL,
- /* extension */ NULL,
- },
- /* Composite class part */
- {
- /* geometry_manager */ GeometryManager,
- /* change_managed */ NULL,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL,
- },
- /* Constraint class part */
- {
- /* resources */ NULL,
- /* num_resources */ 0,
- /* constraint_size */ 0,
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ NULL,
- /* extension */ NULL,
- },
- /* Manager class part */
- {
- /* translations */ XtInheritTranslations,
- /* syn_resources */ NULL,
- /* num_syn_resources */ 0,
- /* syn_constraint_resources */ NULL,
- /* num_syn_constraint_resources */ 0,
- /* parent_process */ XmInheritParentProcess,
- /* extension */ NULL,
- },
- /* DPSScrolledWindow class part */
- {
- /* set_scale */ SetScale,
- /* scroll_point */ ScrollPoint,
- /* scroll_by */ ScrollBy,
- /* scroll_to */ ScrollTo,
- /* set_scale_and_scroll */ SetScaleAndScroll,
- /* convert_x_to_ps */ ConvertXToPS,
- /* convert_ps_to_x */ ConvertPSToX,
- /* add_to_dirty_area */ AddToDirtyArea,
- /* take_feedback_pixmap */ TakeFeedbackPixmap,
- /* give_feedback_pixmap */ GiveFeedbackPixmap,
- /* start_feedback_drawing */ StartFeedbackDrawing,
- /* end_feedback_drawing */ EndFeedbackDrawing,
- /* set_feedback_dirty_area */ SetFeedbackDirtyArea,
- /* finish_pending_drawing */ FinishPendingDrawing,
- /* abort_pending_drawing */ AbortPendingDrawing,
- /* get_drawing_info */ GetDrawingInfo,
- /* update_drawing */ UpdateDrawing,
- /* get_scroll_info */ GetScrollInfo,
- /* extension */ NULL,
- }
-};
-
-WidgetClass dpsScrolledWindowWidgetClass =
- (WidgetClass) &dpsScrolledWindowClassRec;
-
-/***** UTILITY FUNCTIONS *****/
-
-static void PrintRectList(r, num_r)
- float *r;
- short num_r;
-{
- int i;
-
- for (i = 0; i < num_r; i++) {
- printf("Rectangle %d: ", i);
- printf("X %g Y %g W %g H %g\n", r[0], r[1], r[2], r[3]);
- r += 4;
- }
-}
-
-/* Make sure the list pointed to by r can hold n more rectangles. Always
- grow by at least min_grow */
-
-static void GrowRectList(r, r_size, num_r, n, min_grow)
- float **r;
- short *r_size;
- short num_r;
- int n, min_grow;
-{
- if (*r_size < num_r + n) {
- if (min_grow > 1 && num_r + n - *r_size < min_grow) {
- *r_size += min_grow;
- } else *r_size = num_r + n;
- *r = (float *) XtRealloc((char *) *r, *r_size * 4 * sizeof(float));
- }
-}
-
-static void GrowIntRectList(r, r_size, num_r, n, min_grow)
- int **r;
- short *r_size;
- short num_r;
- int n, min_grow;
-{
- if (*r_size < num_r + n) {
- if (min_grow > 1 && num_r + n - *r_size < min_grow) {
- *r_size += min_grow;
- } else *r_size = num_r + n;
- *r = (int *) XtRealloc((char *) *r, *r_size * 4 * sizeof(int));
- }
-}
-
-static Boolean Intersects(r1, r2)
- float *r1, *r2;
-{
- if (RIGHT(r1) <= LEFT(r2)) return False;
- if (RIGHT(r2) <= LEFT(r1)) return False;
- if (TOP(r1) <= BOTTOM(r2)) return False;
- if (TOP(r2) <= BOTTOM(r1)) return False;
-
- return True;
-}
-
-/* Subtract sub from src, putting result into dst. Return rectangle count */
-
-static int Subtract(src, sub, dst)
- float *src, *sub, *dst;
-{
- int n = 0;
-
- /* If bottom of sub is greater than bottom of src, there's a
- rectangle across the bottom */
- if (BOTTOM(sub) > BOTTOM(src)) {
- LEFT(dst) = LEFT(src);
- BOTTOM(dst) = BOTTOM(src);
- WIDTH(dst) = WIDTH(src);
- HEIGHT(dst) = BOTTOM(sub) - BOTTOM(src);
- n++;
- dst += 4;
- }
-
- /* If left of sub is greater than left of src, there's a left rectangle. */
- if (LEFT(sub) > LEFT(src)) {
- LEFT(dst) = LEFT(src);
- BOTTOM(dst) = MAX(BOTTOM(src), BOTTOM(sub));
- WIDTH(dst) = LEFT(sub) - LEFT(src);
- HEIGHT(dst) = MIN(TOP(src), TOP(sub)) - BOTTOM(dst);
- n++;
- dst += 4;
- }
-
- /* If right of sub is less than right of src, there's a right rect */
- if (RIGHT(sub) < RIGHT(src)) {
- LEFT(dst) = RIGHT(sub);
- BOTTOM(dst) = MAX(BOTTOM(src), BOTTOM(sub));
- WIDTH(dst) = RIGHT(src) - RIGHT(sub);
- HEIGHT(dst) = MIN(TOP(src), TOP(sub)) - BOTTOM(dst);
- n++;
- dst += 4;
- }
-
- /* If top of sub is less than top of src, there's a top rectangle */
- if (TOP(sub) < TOP(src)) {
- LEFT(dst) = LEFT(src);
- BOTTOM(dst) = TOP(sub);
- WIDTH(dst) = WIDTH(src);
- HEIGHT(dst) = TOP(src) - TOP(sub);
- n++;
- dst += 4;
- }
-
- return n;
-}
-
-static void Copy(src, dst)
- float *src, *dst;
-{
- LEFT(dst) = LEFT(src);
- BOTTOM(dst) = BOTTOM(src);
- WIDTH(dst) = WIDTH(src);
- HEIGHT(dst) = HEIGHT(src);
-}
-
-static void Intersection(r1, r2, dst)
- float *r1, *r2, *dst;
-{
- LEFT(dst) = MAX(LEFT(r1), LEFT(r2));
- BOTTOM(dst) = MAX(BOTTOM(r1), BOTTOM(r2));
- WIDTH(dst) = MIN(RIGHT(r1), RIGHT(r2)) - LEFT(dst);
- HEIGHT(dst) = MIN(TOP(r1), TOP(r2)) - BOTTOM(dst);
-}
-
-/* These are used by the SubtractRects and IntersectRects procedures */
-
-static float *rbuf = NULL;
-static short rbuf_size = 0;
-#define GROW_BUF 10
-
-/* Replace the rectangle list in src with src minus sub */
-
-static void SubtractRects(src, src_size, num_src, sub, num_sub)
- float **src;
- short *src_size;
- short *num_src;
- float *sub;
- int num_sub;
-{
- short num_rbuf;
- float *r;
- int i;
-
- /* Go through, subtracting the first sub rectangle from each src
- rectangle. Put the result in the internal buffer, then copy this
- list to the src. Repeat for each sub rectangle. */
-
- while (num_sub > 0) {
- num_rbuf = 0;
- for (r = *src, i = 0; i < *num_src; r += 4, i++) {
- if (Intersects(r, sub)) {
- /* Subtract sub from r, putting result into rbuf. First
- make sure there are at least 4 spaces in the buffer */
- GrowRectList(&rbuf, &rbuf_size, num_rbuf, 4, GROW_BUF);
-
- /* Do the subtraction */
- num_rbuf += Subtract(r, sub, rbuf + (num_rbuf*4));
- } else {
- /* Copy r into buffer */
- GrowRectList(&rbuf, &rbuf_size, num_rbuf, 1, GROW_BUF);
- Copy(r, rbuf + (num_rbuf*4));
- num_rbuf++;
- }
- }
-
- /* Copy buffered rectangles back into src */
- GrowRectList(src, src_size, 0, num_rbuf, 1);
- for (i = 0; i < num_rbuf * 4; i++) (*src)[i] = rbuf[i];
- *num_src = num_rbuf;
-
- /* Check if we've taken everything away */
- if (*num_src == 0) return;
-
- /* Skip on to the next sub rectangle */
- num_sub--;
- sub += 4;
- }
-}
-
-/* Replace list r1 with the intersection of r1 and r2 */
-
-static void IntersectRects(r1, r1_size, num_r1, r2, num_r2)
- float **r1;
- short *r1_size;
- short *num_r1;
- float *r2;
- int num_r2;
-{
- short num_rbuf = 0;
- float *r;
- int i;
-
- /* Fairly straightforward. Intersect each rectangle in r1 with each
- rectangle in r2, then copy the results to r1 */
-
- while (num_r2 > 0) {
- for (r = *r1, i = 0; i < *num_r1; r += 4, i++) {
- if (Intersects(r, r2)) {
- GrowRectList(&rbuf, &rbuf_size, num_rbuf, 1, GROW_BUF);
- Intersection(r, r2, rbuf + (num_rbuf*4));
- num_rbuf++;
- }
- }
- num_r2--;
- r2 += 4;
- }
-
- /* Copy intersection rectangles back into r1 */
- GrowRectList(r1, r1_size, 0, num_rbuf, 1);
- for (i = 0; i < num_rbuf * 4; i++) (*r1)[i] = rbuf[i];
- *num_r1 = num_rbuf;
-}
-
-static void SimplifyRects(rect, num)
- float *rect;
- register short *num;
-{
- int i, j, k;
- float *r, *r1;
-
- i = 0;
- while (i < *num) {
- r = rect + (i * 4);
- if (WIDTH(r) == 0 || HEIGHT(r) == 0) {
- for (k = 4*(i+1); k < *num * 4; k++) rect[k-4] = rect[k];
- (*num)--;
- goto LOOPEND;
- }
- j = i+1;
- while (j < *num) {
- r1 = rect + (j * 4);
- if (TOP(r1) <= TOP(r) && BOTTOM(r1) >= BOTTOM(r) &&
- LEFT(r1) >= LEFT(r) && RIGHT(r1) <= RIGHT(r)) {
- for (k = 4*(j+1); k < *num * 4; k++) rect[k-4] = rect[k];
- (*num)--;
- } else if (TOP(r) <= TOP(r1) && BOTTOM(r) >= BOTTOM(r1) &&
- LEFT(r) >= LEFT(r1) && RIGHT(r) <= RIGHT(r1)) {
- for (k = 4*(i+1); k < *num * 4; k++) rect[k-4] = rect[k];
- (*num)--;
- goto LOOPEND;
- } else j++;
- }
- i++;
-LOOPEND:;
- }
-}
-
-static void ComputeOffsets(dsw, dx, dy)
- DPSScrolledWindowWidget dsw;
- int *dx, *dy;
-{
- if (dsw->sw.doing_feedback && dsw->sw.feedback_pixmap != None) {
- *dx = *dy = 0;
- } else {
- if (dsw->sw.pixmap_width == dsw->sw.drawing_area->core.width) *dx = 0;
- else *dx = -dsw->sw.origin_x;
- if (dsw->sw.pixmap_height == dsw->sw.drawing_area->core.height) *dy = 0;
- else *dy = CEIL(dsw->sw.drawing_height) - dsw->sw.origin_y;
- }
-}
-
-static void ClassPartInitialize(widget_class)
- WidgetClass widget_class;
-{
- register DPSScrolledWindowWidgetClass wc =
- (DPSScrolledWindowWidgetClass) widget_class;
- DPSScrolledWindowWidgetClass super =
- (DPSScrolledWindowWidgetClass) wc->core_class.superclass;
-
- if (wc->sw_class.set_scale == InheritSetScale) {
- wc->sw_class.set_scale = super->sw_class.set_scale;
- }
- if (wc->sw_class.scroll_point == InheritScrollPoint) {
- wc->sw_class.scroll_point = super->sw_class.scroll_point;
- }
- if (wc->sw_class.scroll_by == InheritScrollBy) {
- wc->sw_class.scroll_by = super->sw_class.scroll_by;
- }
- if (wc->sw_class.scroll_to == InheritScrollTo) {
- wc->sw_class.scroll_to = super->sw_class.scroll_to;
- }
- if (wc->sw_class.set_scale_and_scroll == InheritSetScaleAndScroll) {
- wc->sw_class.set_scale_and_scroll =
- super->sw_class.set_scale_and_scroll;
- }
- if (wc->sw_class.convert_x_to_ps == InheritConvertXToPS) {
- wc->sw_class.convert_x_to_ps = super->sw_class.convert_x_to_ps;
- }
- if (wc->sw_class.convert_ps_to_x == InheritConvertPSToX) {
- wc->sw_class.convert_ps_to_x = super->sw_class.convert_ps_to_x;
- }
- if (wc->sw_class.add_to_dirty_area == InheritAddToDirtyArea) {
- wc->sw_class.add_to_dirty_area = super->sw_class.add_to_dirty_area;
- }
- if (wc->sw_class.take_feedback_pixmap == InheritTakeFeedbackPixmap) {
- wc->sw_class.take_feedback_pixmap =
- super->sw_class.take_feedback_pixmap;
- }
- if (wc->sw_class.give_feedback_pixmap == InheritGiveFeedbackPixmap) {
- wc->sw_class.give_feedback_pixmap =
- super->sw_class.give_feedback_pixmap;
- }
- if (wc->sw_class.start_feedback_drawing == InheritStartFeedbackDrawing) {
- wc->sw_class.start_feedback_drawing =
- super->sw_class.start_feedback_drawing;
- }
- if (wc->sw_class.end_feedback_drawing == InheritEndFeedbackDrawing) {
- wc->sw_class.end_feedback_drawing =
- super->sw_class.end_feedback_drawing;
- }
- if (wc->sw_class.set_feedback_dirty_area == InheritSetFeedbackDirtyArea) {
- wc->sw_class.set_feedback_dirty_area =
- super->sw_class.set_feedback_dirty_area;
- }
- if (wc->sw_class.finish_pending_drawing == InheritFinishPendingDrawing) {
- wc->sw_class.finish_pending_drawing =
- super->sw_class.finish_pending_drawing;
- }
- if (wc->sw_class.abort_pending_drawing == InheritAbortPendingDrawing) {
- wc->sw_class.abort_pending_drawing =
- super->sw_class.abort_pending_drawing;
- }
- if (wc->sw_class.get_drawing_info == InheritGetDrawingInfo) {
- wc->sw_class.get_drawing_info = super->sw_class.get_drawing_info;
- }
- if (wc->sw_class.update_drawing == InheritUpdateDrawing) {
- wc->sw_class.update_drawing = super->sw_class.update_drawing;
- }
- if (wc->sw_class.get_scroll_info == InheritGetScrollInfo) {
- wc->sw_class.get_scroll_info = super->sw_class.get_scroll_info;
- }
-}
-
-static void CreateChildren(dsw)
- DPSScrolledWindowWidget dsw;
-{
- Widget w;
-
- w = dsw->sw.scrolled_window =
- XtVaCreateManagedWidget("scrolledWindow",
- xmScrolledWindowWidgetClass,
- (Widget) dsw,
- XtNwidth, dsw->core.width,
- XtNheight, dsw->core.height,
- XmNscrollingPolicy, XmAPPLICATION_DEFINED,
- NULL);
-
- dsw->sw.h_scroll =
- XtVaCreateManagedWidget("horizontalScrollBar",
- xmScrollBarWidgetClass, w,
- XmNorientation, XmHORIZONTAL,
- NULL);
- XtAddCallback(dsw->sw.h_scroll, XmNvalueChangedCallback, HScrollCallback,
- (XtPointer) dsw);
- XtAddCallback(dsw->sw.h_scroll, XmNdragCallback, HScrollCallback,
- (XtPointer) dsw);
-
- dsw->sw.v_scroll =
- XtVaCreateManagedWidget("verticalScrollBar",
- xmScrollBarWidgetClass, w,
- XmNorientation, XmVERTICAL,
- NULL);
- XtAddCallback(dsw->sw.v_scroll, XmNvalueChangedCallback, VScrollCallback,
- (XtPointer) dsw);
- XtAddCallback(dsw->sw.v_scroll, XmNdragCallback, VScrollCallback,
- (XtPointer) dsw);
-
-
- dsw->sw.drawing_area =
- XtVaCreateManagedWidget("drawingArea",
- xmDrawingAreaWidgetClass, w, NULL);
- XtAddCallback(dsw->sw.drawing_area, XtNexposeCallback, DrawingAreaExpose,
- (XtPointer) dsw);
- XtAddRawEventHandler(dsw->sw.drawing_area, 0, True,
- DrawingAreaGraphicsExpose, (XtPointer) dsw);
-
- XmScrolledWindowSetAreas(w, dsw->sw.h_scroll, dsw->sw.v_scroll,
- dsw->sw.drawing_area);
-}
-
-/* ARGSUSED */
-
-static void Initialize(request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) new;
- XGCValues gcVal;
- Bool inited;
-
- if (dsw->sw.area_width <= 0) dsw->sw.area_width = 8.5*72;
- if (dsw->sw.area_height <= 0) dsw->sw.area_height = 11*72;
- if (dsw->sw.scale <= 0) dsw->sw.scale = 1.0;
- dsw->sw.ctm_ptr = dsw->sw.ctm;
- dsw->sw.inv_ctm_ptr = dsw->sw.inv_ctm;
- dsw->sw.backing_pixmap = None;
- dsw->sw.feedback_pixmap = None;
- dsw->sw.window_gstate = 0;
- dsw->sw.backing_gstate = 0;
- dsw->sw.feedback_gstate = 0;
- dsw->sw.scrolling = False;
- dsw->sw.num_pending_expose = dsw->sw.pending_expose_size = 0;
- dsw->sw.pending_expose = NULL;
- dsw->sw.num_pending_dirty = dsw->sw.pending_dirty_size = 0;
- dsw->sw.pending_dirty = NULL;
- dsw->sw.num_current_drawing = dsw->sw.current_drawing_size = 0;
- dsw->sw.current_drawing = NULL;
- dsw->sw.num_prev_dirty_areas = dsw->sw.prev_dirty_areas_size = 0;
- dsw->sw.prev_dirty_areas = NULL;
- dsw->sw.drawing_stage = DSWStart;
- dsw->sw.work = 0;
- dsw->sw.big_pixmap = False;
-
- /* Set the initial dirty area to everything */
-
- dsw->sw.dirty_areas_size = 0;
- dsw->sw.dirty_areas = NULL;
-
- GrowRectList(&dsw->sw.dirty_areas, &dsw->sw.dirty_areas_size, 0, 1, 1);
- dsw->sw.num_dirty_areas = 1;
- LEFT(dsw->sw.dirty_areas) = 0.0;
- BOTTOM(dsw->sw.dirty_areas) = 0.0;
- WIDTH(dsw->sw.dirty_areas) = dsw->sw.area_width;
- HEIGHT(dsw->sw.dirty_areas) = dsw->sw.area_height;
-
- /* Make the scratch list have at least one element */
-
- dsw->sw.num_scratch = dsw->sw.scratch_size = 0;
- dsw->sw.scratch = NULL;
- GrowRectList(&dsw->sw.scratch, &dsw->sw.scratch_size, 0, 1, 1);
-
- /* Get the context */
-
- if (dsw->sw.context == NULL) {
- dsw->sw.context = XDPSGetSharedContext(XtDisplay(dsw));
- }
-
- /* Watch progress only works with pass-through event dispatching */
-
- if (dsw->sw.watch_progress &&
- XDPSSetEventDelivery(XtDisplay(dsw), dps_event_query) !=
- dps_event_pass_through) dsw->sw.watch_progress = False;
-
- if (_XDPSTestComponentInitialized(dsw->sw.context,
- dps_init_bit_dsw, &inited) ==
- dps_status_unregistered_context) {
- XDPSRegisterContext(dsw->sw.context, False);
- }
-
- dsw->sw.use_saved_scroll = False;
- dsw->sw.context_inited = False;
- dsw->sw.doing_feedback = False;
- dsw->sw.feedback_displayed = False;
-
- CreateChildren(dsw);
-
- dsw->sw.ge_gc = XtGetGC(dsw->sw.drawing_area, 0, (XGCValues *) NULL);
-
- gcVal.graphics_exposures = False;
- dsw->sw.no_ge_gc = XtGetGC(dsw->sw.drawing_area, GCGraphicsExposures,
- &gcVal);
-}
-
-static void Destroy(widget)
- Widget widget;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) widget;
-
- if (dsw->sw.backing_pixmap != None) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.backing_pixmap);
- }
- if (dsw->sw.feedback_pixmap != None) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.feedback_pixmap);
- }
-
- if (dsw->sw.window_gstate != 0) {
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.window_gstate);
- }
- if (dsw->sw.backing_gstate != 0) {
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.backing_gstate);
- }
- if (dsw->sw.feedback_gstate != 0) {
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.feedback_gstate);
- }
-
- if (dsw->sw.pending_expose != NULL) {
- XtFree((char *) dsw->sw.pending_expose);
- }
- if (dsw->sw.current_drawing != NULL) {
- XtFree((char *) dsw->sw.current_drawing);
- }
- if (dsw->sw.prev_dirty_areas != NULL) {
- XtFree((char *) dsw->sw.prev_dirty_areas);
- }
- if (dsw->sw.dirty_areas != NULL) XtFree((char *) dsw->sw.dirty_areas);
- if (dsw->sw.pending_dirty != NULL) XtFree((char *) dsw->sw.pending_dirty);
- if (dsw->sw.scratch != NULL) XtFree((char *) dsw->sw.scratch);
-
- XtReleaseGC(widget, dsw->sw.ge_gc);
- XtReleaseGC(widget, dsw->sw.no_ge_gc);
-}
-
-static void SetOriginAndGetTransform(dsw)
- DPSScrolledWindowWidget dsw;
-{
- float psX, psY;
-
- ConvertToOrigPS(dsw, dsw->sw.origin_x, dsw->sw.origin_y, &psX, &psY);
- _DPSSWSetMatrixAndGetTransform(dsw->sw.context, psX, psY, dsw->sw.scale,
- dsw->sw.origin_x, dsw->sw.origin_y,
- dsw->sw.ctm, dsw->sw.inv_ctm,
- &dsw->sw.x_offset, &dsw->sw.y_offset);
-}
-
-static void SetPixmapOrigin(dsw)
- DPSScrolledWindowWidget dsw;
-{
- float psX, psY;
-
- ConvertToOrigPS(dsw, dsw->sw.origin_x, dsw->sw.origin_y, &psX, &psY);
- _DPSSWSetMatrix(dsw->sw.context, psX, psY, dsw->sw.scale,
- dsw->sw.origin_x, dsw->sw.origin_y);
-}
-
-static void SetPixmapOffset(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int ox, oy;
-
- if (dsw->sw.pixmap_width <= (int) dsw->sw.drawing_area->core.width) ox = 0;
- else ox = -dsw->sw.origin_x;
- if (dsw->sw.pixmap_height <= (int) dsw->sw.drawing_area->core.height) {
- oy = dsw->sw.drawing_area->core.height;
- } else oy = dsw->sw.pixmap_height - dsw->sw.origin_y +
- dsw->sw.drawing_area->core.height;
-
- DPSsetXoffset(dsw->sw.context, ox, oy);
-}
-
-static Boolean pixmapError;
-static int (*oldHandler)();
-
-static int PixmapHandler(dpy, error)
- Display *dpy;
- XErrorEvent *error;
-{
- if (error->error_code == BadAlloc &&
- error->request_code == X_CreatePixmap) {
- pixmapError = True;
- return 0;
- } else return (*oldHandler) (dpy, error);
-}
-
-static Pixmap AllocPixmap(dsw, w, h)
- DPSScrolledWindowWidget dsw;
- unsigned int w, h;
-{
- Pixmap p;
- unsigned int dBytes;
- Widget wid = dsw->sw.drawing_area;
-
- if (dsw->sw.pixmap_limit > 0) {
- if (w * h > dsw->sw.pixmap_limit) return None;
- } else if (dsw->sw.pixmap_limit < 0 &&
- w * h > dsw->sw.unscaled_width * dsw->sw.unscaled_height &&
- w * h > wid->core.width * wid->core.height) return None;
-
- if (dsw->sw.absolute_pixmap_limit > 0) {
- dBytes = (wid->core.depth + 7) / 8; /* Convert into bytes */
- if (w * h * dBytes > dsw->sw.absolute_pixmap_limit * 1024) {
- return None;
- }
- }
-
- XSync(XtDisplay(dsw), False);
- oldHandler = XSetErrorHandler(PixmapHandler);
- pixmapError = False;
- p = XCreatePixmap(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area), w, h,
- wid->core.depth);
- XSync(XtDisplay(dsw), False);
- (void) XSetErrorHandler(oldHandler);
- if (pixmapError) return None;
- else return p;
-}
-
-static void CreateBackingPixmap(dsw)
- DPSScrolledWindowWidget dsw;
-{
- Pixmap p;
-
- if (dsw->sw.document_size_pixmaps) {
- dsw->sw.pixmap_width =
- MAX(CEIL(dsw->sw.drawing_width),
- (int) dsw->sw.drawing_area->core.width);
- dsw->sw.pixmap_height =
- MAX(CEIL(dsw->sw.drawing_height),
- (int) dsw->sw.drawing_area->core.height);
-
- p = dsw->sw.backing_pixmap =
- AllocPixmap(dsw, dsw->sw.pixmap_width, dsw->sw.pixmap_height);
- if (p != None) {
- dsw->sw.big_pixmap =
- dsw->sw.pixmap_width >
- (int) dsw->sw.drawing_area->core.width ||
- dsw->sw.pixmap_height >
- (int) dsw->sw.drawing_area->core.height;
- return;
- }
- }
- dsw->sw.big_pixmap = False;
- dsw->sw.pixmap_width = dsw->sw.drawing_area->core.width;
- dsw->sw.pixmap_height = dsw->sw.drawing_area->core.height;
- p = dsw->sw.backing_pixmap =
- AllocPixmap(dsw, dsw->sw.pixmap_width, dsw->sw.pixmap_height);
- if (p == None) dsw->sw.pixmap_width = dsw->sw.pixmap_height = 0;
-}
-
-static void FreeBackingPixmap(dsw)
- DPSScrolledWindowWidget dsw;
-{
- if (dsw->sw.backing_pixmap == None) return;
- XFreePixmap(XtDisplay(dsw), dsw->sw.backing_pixmap);
- dsw->sw.backing_pixmap = None;
- dsw->sw.big_pixmap = False;
- dsw->sw.pixmap_width = dsw->sw.pixmap_height = 0;
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.backing_gstate);
-}
-
-static void SetDrawingAreaPosition(dsw, ix, iy, vx, vy, setOrigin)
- DPSScrolledWindowWidget dsw;
- float ix;
- float iy;
- int vx;
- int vy;
- Boolean setOrigin;
-{
- int xoff, yoff;
- int hSize, vSize;
- float scrollX, scrollY;
-
- /* Convert ix, iy into X units */
-
- ix *= dsw->sw.drawing_width / dsw->sw.area_width;
- iy *= dsw->sw.drawing_height / dsw->sw.area_height;
-
- if ((int)dsw->sw.drawing_area->core.width >= CEIL(dsw->sw.drawing_width)) {
- /* The scaled width is narrower than the view window, so
- center the picture and set scroll bar to be unscrollable */
-
- xoff = ((int) dsw->sw.drawing_area->core.width -
- CEIL(dsw->sw.drawing_width))
- / 2.0;
- scrollX = 0;
- hSize = CEIL(dsw->sw.drawing_width);
- } else {
- /* The scaled width is larger than the view window, so
- turn on the scroll bar, and set up its maximum and
- slider size. Do this by converting the image offset into X
- coordinates and subtracting the view offset */
-
- scrollX = ix - vx;
- scrollX = MAX(scrollX, 0);
- scrollX = MIN(scrollX, CEIL(dsw->sw.drawing_width) -
- (int) dsw->sw.drawing_area->core.width);
- hSize = dsw->sw.drawing_area->core.width;
- xoff = -(int) (scrollX + 0.5);
- }
-
- /* Now do the same thing for the height. We want to compute the offset
- relative to the lower left corner, but X coordinates are relative
- to the upper left, so the drawing height must be added in. Also, since
- the coordinates go in the other direction, the view offset must be
- added, not subtracted. */
-
- if ((int) dsw->sw.drawing_area->core.height >=
- CEIL(dsw->sw.drawing_height)) {
- yoff = ((int) dsw->sw.drawing_area->core.height -
- CEIL(dsw->sw.drawing_height)) / 2.0;
- scrollY = CEIL(dsw->sw.drawing_height) -
- (int) dsw->sw.drawing_area->core.height;
- vSize = CEIL(dsw->sw.drawing_height);
- } else {
- scrollY = iy + vy - (int) dsw->sw.drawing_area->core.height;
- scrollY = MAX(scrollY, 0);
- scrollY = MIN(scrollY, CEIL(dsw->sw.drawing_height) -
- (int) dsw->sw.drawing_area->core.height);
- vSize = dsw->sw.drawing_area->core.height;
- yoff = -(int) (scrollY + 0.5);
- }
-
- /* Update the scrollbars */
- dsw->sw.scroll_x = (int) (scrollX + 0.5);
- dsw->sw.scroll_y = (int) (CEIL(dsw->sw.drawing_height) -
- (int) dsw->sw.drawing_area->core.height -
- scrollY + 0.5);
-
- yoff = dsw->sw.drawing_area->core.height - yoff;
-
- dsw->sw.scroll_h_value = dsw->sw.scroll_x;
- dsw->sw.scroll_h_size = hSize;
- dsw->sw.scroll_h_max = CEIL(dsw->sw.drawing_width);
- dsw->sw.scroll_v_value = dsw->sw.scroll_y;
- dsw->sw.scroll_v_size = vSize;
- dsw->sw.scroll_v_max = CEIL(dsw->sw.drawing_height);
-
- if (!dsw->sw.application_scrolling) {
- XtVaSetValues(dsw->sw.h_scroll, XmNmaximum, dsw->sw.scroll_h_max,
- XmNvalue, dsw->sw.scroll_x, XmNsliderSize, hSize, NULL);
- XtVaSetValues(dsw->sw.v_scroll, XmNmaximum, dsw->sw.scroll_v_max,
- XmNvalue, dsw->sw.scroll_y, XmNsliderSize, vSize, NULL);
- }
-
- if (setOrigin) {
- /* Set the origin in the X window to reflect the new location */
- dsw->sw.origin_x = xoff;
- dsw->sw.origin_y = yoff;
- }
-}
-
-static void DrawBackground(dsw, which)
- DPSScrolledWindowWidget dsw;
- DSWDrawableType which;
-{
- DSWExposeCallbackRec e;
-
- e.type = which;
- e.directions = DSWFinish;
- e.results = DSWUndefined;
- e.first = True;
- e.background = True;
- if (which == DSWBackingPixmap) {
- e.drawable = dsw->sw.backing_pixmap;
- e.gstate = dsw->sw.backing_gstate;
- } else if (which == DSWFeedbackPixmap) {
- e.drawable = dsw->sw.feedback_pixmap;
- e.gstate = dsw->sw.feedback_gstate;
- } else {
- e.drawable = XtWindow(dsw->sw.drawing_area);
- e.gstate = dsw->sw.window_gstate;
- }
- e.context = dsw->sw.context;
-
- SimplifyRects(dsw->sw.current_drawing, &dsw->sw.num_current_drawing);
-
- XDPSSetContextGState(dsw->sw.context, e.gstate);
- _DPSSWSetRectViewClip(dsw->sw.context, dsw->sw.current_drawing,
- dsw->sw.num_current_drawing * 4);
-
- e.rects = dsw->sw.current_drawing;
- e.rect_count = dsw->sw.num_current_drawing;
-
- do {
- XtCallCallbackList((Widget) dsw, dsw->sw.background_callback,
- (XtPointer) &e);
- if (e.results == DSWUndefined) {
- if (XtHasCallbacks((Widget) dsw, XtNbackgroundCallback) !=
- XtCallbackHasNone) {
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget) dsw),
- "returnError", "backgroundCallback",
- "DPSScrollError",
- "Background callback did not set result field",
- (String *) NULL, (Cardinal *) NULL);
- }
- e.results = DSWFinished;
- }
- } while (e.results != DSWFinished);
-
-
- DPSinitviewclip(dsw->sw.context);
-}
-
-static void ClipToDrawingSize(dsw, which)
- DPSScrolledWindowWidget dsw;
- DSWDrawableType which;
-{
- int i;
- float r[4];
-
- if (CEIL(dsw->sw.drawing_width) >= (int) dsw->sw.drawing_area->core.width &&
- CEIL(dsw->sw.drawing_height) >= (int) dsw->sw.drawing_area->core.height) return;
-
- /* Copy current drawing area to scratch */
-
- GrowRectList(&dsw->sw.scratch, &dsw->sw.scratch_size, 0,
- dsw->sw.num_current_drawing, 1);
- dsw->sw.num_scratch = dsw->sw.num_current_drawing;
- for (i = 0; i < dsw->sw.num_current_drawing * 4; i++) {
- dsw->sw.scratch[i] = dsw->sw.current_drawing[i];
- }
-
- /* Construct a rectangle of the drawing area */
-
- ConvertToPS(dsw, dsw->sw.origin_x + DELTA, dsw->sw.origin_y - DELTA,
- r, r+1);
- ConvertToPS(dsw, dsw->sw.origin_x + CEIL(dsw->sw.drawing_width) - DELTA,
- dsw->sw.origin_y - CEIL(dsw->sw.drawing_height) + DELTA,
- r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
-
- /* Subtract the area of the drawing from the current drawing list */
-
- SubtractRects(&dsw->sw.current_drawing, &dsw->sw.current_drawing_size,
- &dsw->sw.num_current_drawing, r, 1);
-
- if (dsw->sw.num_current_drawing != 0) {
- DrawBackground(dsw, which);
- /* Now intersect the rectangle with the current drawing area */
- IntersectRects(&dsw->sw.scratch, &dsw->sw.scratch_size,
- &dsw->sw.num_scratch, r, 1);
- /* If nothing left, we won't be drawing anything more, so
- synchronize. Otherwise wait until we're done drawing */
- if (dsw->sw.num_scratch == 0) DPSWaitContext(dsw->sw.context);
- }
-
- /* Copy scratch back into the current drawing list */
- GrowRectList(&dsw->sw.current_drawing, &dsw->sw.current_drawing_size, 0,
- dsw->sw.num_scratch, 1);
- dsw->sw.num_current_drawing = dsw->sw.num_scratch;
- for (i = 0; i < dsw->sw.num_scratch * 4; i++) {
- dsw->sw.current_drawing[i] = dsw->sw.scratch[i];
- }
-}
-
-static DSWResults ClipAndDraw(dsw, which, howMuch, first)
- DPSScrolledWindowWidget dsw;
- DSWDrawableType which;
- DSWDirections howMuch;
- Boolean first;
-{
- DSWExposeCallbackRec e;
-
- e.type = which;
- e.directions = howMuch;
- e.results = DSWUndefined;
- e.first = first;
- e.background = False;
- if (which == DSWBackingPixmap) {
- e.drawable = dsw->sw.backing_pixmap;
- e.gstate = dsw->sw.backing_gstate;
- } else if (which == DSWFeedbackPixmap) {
- e.drawable = dsw->sw.feedback_pixmap;
- e.gstate = dsw->sw.feedback_gstate;
- } else {
- e.drawable = XtWindow(dsw->sw.drawing_area);
- e.gstate = dsw->sw.window_gstate;
- }
- e.context = dsw->sw.context;
-
- if (first) {
- XDPSSetContextGState(dsw->sw.context, e.gstate);
- if (howMuch != DSWAbort) {
- ClipToDrawingSize(dsw, which);
- SimplifyRects(dsw->sw.current_drawing,
- &dsw->sw.num_current_drawing);
- if (dsw->sw.num_current_drawing == 0) return DSWFinished;
- _DPSSWSetRectViewClip(dsw->sw.context, dsw->sw.current_drawing,
- dsw->sw.num_current_drawing * 4);
- }
- }
-
- e.rects = dsw->sw.current_drawing;
- e.rect_count = dsw->sw.num_current_drawing;
-
- do {
- XtCallCallbackList((Widget) dsw, dsw->sw.expose_callback,
- (XtPointer) &e);
- if (e.results == DSWUndefined) {
- if (XtHasCallbacks((Widget) dsw,
- XtNexposeCallback) != XtCallbackHasNone) {
- XtAppWarningMsg(XtWidgetToApplicationContext((Widget) dsw),
- "returnError", "exposeCallback",
- "DPSScrollError",
- "Expose callback did not set result field",
- (String *) NULL, (Cardinal *) NULL);
- }
- e.results = DSWFinished;
- }
- } while ((e.results != DSWFinished && howMuch == DSWFinish) ||
- (e.results != DSWFinished && e.results != DSWAborted &&
- howMuch == DSWAbortOrFinish) ||
- (e.results != DSWAborted && howMuch == DSWAbort));
-
- if (e.results == DSWFinished) {
- DPSinitviewclip(dsw->sw.context);
- DPSWaitContext(dsw->sw.context);
- }
- return e.results;
-}
-
-static void SplitExposeEvent(dsw, ev)
- DPSScrolledWindowWidget dsw;
- XExposeEvent *ev;
-{
- float *r;
- float llx, lly, urx, ury;
- int xr[4];
- int i;
- int dx, dy;
-
- ComputeOffsets(dsw, &dx, &dy);
-
- /* Put the expose event into the scratch list */
- dsw->sw.num_scratch = 1;
- r = dsw->sw.scratch;
- ConvertToPS(dsw, ev->x + DELTA, ev->y + ev->height - DELTA, &llx, &lly);
- ConvertToPS(dsw, ev->x + ev->width - DELTA, ev->y + DELTA, &urx, &ury);
- LEFT(r) = llx;
- BOTTOM(r) = lly;
- WIDTH(r) = urx - llx;
- HEIGHT(r) = ury - lly;
-
- /* Subtract the dirty area from the exposed area and copy the resulting
- area to the window */
- SubtractRects(&dsw->sw.scratch, &dsw->sw.scratch_size,
- &dsw->sw.num_scratch,
- dsw->sw.dirty_areas, dsw->sw.num_dirty_areas);
- for (i = 0; i < dsw->sw.num_scratch; i++) {
- r = dsw->sw.scratch + 4*i;
- ConvertToX(dsw, LEFT(r), TOP(r), xr, xr+1);
- ConvertToX(dsw, RIGHT(r), BOTTOM(r), xr+2, xr+3);
- xr[2] -= xr[0];
- xr[3] -= xr[1];
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area), dsw->sw.no_ge_gc,
- xr[0] + dx, xr[1] + dy, xr[2], xr[3], xr[0], xr[1]);
- }
-
- /* Now do it again, but intersect the exposed area with the dirty area
- and add the intersection to the pending list */
-
- dsw->sw.num_scratch = 1;
- r = dsw->sw.scratch;
- LEFT(r) = llx;
- BOTTOM(r) = lly;
- WIDTH(r) = urx - llx;
- HEIGHT(r) = ury - lly;
- IntersectRects(&dsw->sw.scratch, &dsw->sw.scratch_size,
- &dsw->sw.num_scratch,
- dsw->sw.dirty_areas, dsw->sw.num_dirty_areas);
- AddUserSpaceRectsToPending(dsw, dsw->sw.scratch, dsw->sw.num_scratch);
-}
-
-/* ARGSUSED */
-
-static Bool CheckWatchProgressEvent(dpy, e, arg)
- Display *dpy;
- XEvent *e;
- char *arg;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) arg;
-
- return (e->xany.window == dsw->sw.backing_pixmap &&
- (e->type == GraphicsExpose || e->type == NoExpose)) ||
- (e->xany.window == XtWindow(dsw->sw.drawing_area) &&
- e->type == Expose);
-}
-
-static void CopyWindowToBackingPixmap(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int llx, lly, urx, ury;
- XEvent e;
- XExposeEvent *ev = (XExposeEvent *) &e;
- int i;
- float *r;
- int copies = 0;
- int dx, dy;
-
- ComputeOffsets(dsw, &dx, &dy);
-
- for (i = 0; i < dsw->sw.num_dirty_areas; i++) {
- r = dsw->sw.dirty_areas + i*4;
- ConvertToX(dsw, LEFT(r), BOTTOM(r), &llx, &lly);
- ConvertToX(dsw, RIGHT(r), TOP(r), &urx, &ury);
- XCopyArea(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area),
- dsw->sw.backing_pixmap, dsw->sw.ge_gc,
- llx, ury, urx-llx, lly-ury, llx + dx, ury + dy);
- copies++;
- }
-
- /* Unfortunately the Intrinsics won't let us get ahold of the the
- GraphicsExpose events for the pixmap, so we have to wait and
- get them the old fashioned way. Yuck. */
-
- while (copies > 0) {
- XIfEvent(XtDisplay(dsw), &e, CheckWatchProgressEvent,
- (char *) dsw);
- if (e.type == Expose) {
- SplitExposeEvent(dsw, ev);
- continue;
- } else if (e.type == GraphicsExpose) {
- ev->x -= dx;
- ev->y -= dy;
- AddExposureToPending(dsw, ev);
- if (ev->count == 0) copies--;
- } else copies--; /* NoExpose */
- }
- CopyRectsToCurrentDrawing(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
-
- dsw->sw.num_pending_dirty = 0;
- dsw->sw.num_pending_expose = 0;
- if (dsw->sw.num_current_drawing == 0) {
- dsw->sw.drawing_stage = DSWDone;
- dsw->sw.num_dirty_areas = 0;
- } else {
- /* The dirty area is now the intersection of the old dirty area and
- the newly-created current drawing list */
- IntersectRects(&dsw->sw.dirty_areas, &dsw->sw.dirty_areas_size,
- &dsw->sw.num_dirty_areas,
- dsw->sw.current_drawing, dsw->sw.num_current_drawing);
- }
-}
-
-/* Subtract the window area from the dirty area, and make the
- result be the new current drawing list */
-
-static void SetCurrentDrawingToBackground(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int i;
- float r[4];
-
- ConvertToPS(dsw, 0 + DELTA, dsw->sw.drawing_area->core.height - DELTA,
- r, r+1);
- ConvertToPS(dsw, dsw->sw.drawing_area->core.width - DELTA, 0 + DELTA,
- r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
-
- SubtractRects(&dsw->sw.dirty_areas, &dsw->sw.dirty_areas_size,
- &dsw->sw.num_dirty_areas, r, 1);
-
- GrowRectList(&dsw->sw.current_drawing, &dsw->sw.current_drawing_size,
- 0, dsw->sw.num_dirty_areas, 1);
- for (i = 0; i < 4 * dsw->sw.num_dirty_areas; i++) {
- dsw->sw.current_drawing[i] = dsw->sw.dirty_areas[i];
- }
- dsw->sw.num_current_drawing = dsw->sw.num_dirty_areas;
-}
-
-static void CopyPendingExpose(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int dx, dy;
- int i;
- int *r;
-
- ComputeOffsets(dsw, &dx, &dy);
-
- for (i = 0; i < dsw->sw.num_pending_expose; i++) {
- r = dsw->sw.pending_expose + 4*i;
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc,
- LEFT(r) + dx, BOTTOM(r) + dy, WIDTH(r), HEIGHT(r),
- LEFT(r), BOTTOM(r));
- }
- dsw->sw.num_pending_expose = dsw->sw.num_pending_dirty = 0;
-}
-
-static void UpdateWindowFromBackingPixmap(dsw, rects, n)
- DPSScrolledWindowWidget dsw;
- float *rects;
- int n;
-{
- int dx, dy;
- int llx, lly, urx, ury;
- int i;
- float *r;
-
- ComputeOffsets(dsw, &dx, &dy);
-
- for (i = 0; i < n; i++) {
- r = rects + 4*i;
- ConvertToX(dsw, LEFT(r), BOTTOM(r), &llx, &lly);
- ConvertToX(dsw, RIGHT(r), TOP(r), &urx, &ury);
-
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc,
- llx+dx-1, ury+dy-1, urx-llx+2, lly-ury+2, llx-1, ury-1);
- }
-}
-
-static void UpdateWindowFromFeedbackPixmap(dsw, rects, n)
- DPSScrolledWindowWidget dsw;
- float *rects;
- int n;
-{
- int llx, lly, urx, ury;
- int i;
- float *r;
-
- for (i = 0; i < n; i++) {
- r = rects + (i * 4);
- ConvertToX(dsw, LEFT(r), BOTTOM(r), &llx, &lly);
- ConvertToX(dsw, RIGHT(r), TOP(r), &urx, &ury);
-
- XCopyArea(XtDisplay(dsw), dsw->sw.feedback_pixmap,
- XtWindow(dsw->sw.drawing_area), dsw->sw.no_ge_gc,
- llx-1, ury-1, urx-llx+2, lly-ury+2, llx-1, ury-1);
- }
-}
-
-/* This is the heart of the drawing code; it does one piece of drawing.
- It can be called either directly or as a work procedure */
-
-static Boolean DoDrawing(clientData)
- XtPointer clientData;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData;
- DSWResults results;
- DSWDrawableType which;
-
- if (dsw->sw.drawing_stage == DSWStart && dsw->sw.watch_progress &&
- dsw->sw.backing_pixmap != None && dsw->sw.num_current_drawing == 0) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- CopyWindowToBackingPixmap(dsw);
- }
-
- switch (dsw->sw.drawing_stage) {
- case DSWStart:
- case DSWDrawingVisible:
- if (dsw->sw.watch_progress || dsw->sw.backing_pixmap == None) {
- which = DSWWindow;
- } else which = DSWBackingPixmap;
- results = ClipAndDraw(dsw, which, DSWDrawSome,
- (dsw->sw.drawing_stage == DSWStart));
- if (results == DSWFinished) {
- if (dsw->sw.watch_progress && dsw->sw.backing_pixmap != None) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- CopyWindowToBackingPixmap(dsw);
- } else {
- if (dsw->sw.minimal_drawing && dsw->sw.big_pixmap) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- SetCurrentDrawingToBackground(dsw);
- } else {
- dsw->sw.drawing_stage = DSWDone;
- dsw->sw.num_dirty_areas = 0;
- }
- if (dsw->sw.num_pending_expose != 0 &&
- dsw->sw.backing_pixmap != None) {
- CopyPendingExpose(dsw);
- }
- }
- } else dsw->sw.drawing_stage = DSWDrawingVisible;
- break;
-
- case DSWDrewVisible:
- case DSWDrawingBackground:
- results = ClipAndDraw(dsw, DSWBackingPixmap, DSWDrawSome,
- (dsw->sw.drawing_stage == DSWDrewVisible));
- if (results == DSWFinished) {
- dsw->sw.drawing_stage = DSWDone;
- dsw->sw.num_dirty_areas = 0;
- }
- else dsw->sw.drawing_stage = DSWDrawingBackground;
- break;
-
- case DSWDone:
- break;
- }
-
- if (dsw->sw.drawing_stage == DSWDone && dsw->sw.num_pending_dirty != 0) {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
- CopyRectsToDirtyArea(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
- dsw->sw.num_pending_dirty = 0;
- dsw->sw.num_pending_expose = 0;
- dsw->sw.drawing_stage = DSWStart;
- }
-
- if (dsw->sw.drawing_stage == DSWDone) {
- dsw->sw.work = 0;
- if (dsw->sw.watch_progress) {
- /* Some of the background drawing may have been to areas that
- are visible */
- UpdateWindowFromBackingPixmap(dsw, dsw->sw.current_drawing,
- dsw->sw.num_current_drawing);
- }
- dsw->sw.num_current_drawing = 0;
- if (dsw->sw.scrolling) {
- dsw->sw.scrolling = False;
- ScrollMoved(dsw);
- }
- return True;
- } else return False;
-}
-
-static void StartDrawing(dsw)
- DPSScrolledWindowWidget dsw;
-{
- float r[4];
-
- CopyRectsToCurrentDrawing(dsw, dsw->sw.dirty_areas,
- dsw->sw.num_dirty_areas);
-
- if (dsw->sw.watch_progress || dsw->sw.backing_pixmap == None) {
- /* Intersect the current drawing area with the pending dirty area
- (The pending dirty area represents the window exposures that
- have happened so far) */
- IntersectRects(&dsw->sw.current_drawing, &dsw->sw.current_drawing_size,
- &dsw->sw.num_current_drawing,
- dsw->sw.pending_dirty, dsw->sw.num_pending_dirty);
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
- } else {
- if (!dsw->sw.big_pixmap || dsw->sw.minimal_drawing) {
- /* Intersect the current drawing area to the window to start */
- ConvertToPS(dsw, 0 + DELTA,
- dsw->sw.drawing_area->core.height - DELTA, r, r+1);
- ConvertToPS(dsw, dsw->sw.drawing_area->core.width - DELTA,
- 0 + DELTA, r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- IntersectRects(&dsw->sw.current_drawing,
- &dsw->sw.current_drawing_size,
- &dsw->sw.num_current_drawing, r, 1);
- }
- }
-
- if (dsw->sw.num_current_drawing == 0 && !dsw->sw.watch_progress) {
- dsw->sw.drawing_stage = DSWFinished;
- dsw->sw.num_dirty_areas = 0;
- return;
- }
-
- dsw->sw.drawing_stage = DSWStart;
- if (!DoDrawing((XtPointer) dsw)) {
- dsw->sw.work =
- XtAppAddWorkProc(XtWidgetToApplicationContext((Widget) dsw),
- DoDrawing, (XtPointer) dsw);
- }
-}
-
-static void RedisplaySliver(dsw, deltaX, deltaY)
- DPSScrolledWindowWidget dsw;
-{
- float r[8];
- int xr[8];
- int n;
- int xllx, xlly, xurx, xury;
- float llx, lly, urx, ury;
-
- /* If one of the deltas is 0, then the area to update is just a
- single rectangle. */
- if (deltaX == 0 || deltaY == 0) {
- if (deltaX == 0) {
- /* Just a single horizontal rectangle */
-
- xllx = 0;
- xurx = dsw->sw.drawing_area->core.width;
- if (deltaY > 0) {
- xlly = dsw->sw.drawing_area->core.height;
- xury = dsw->sw.drawing_area->core.height - deltaY;
- } else {
- xlly = -deltaY;
- xury = 0;
- }
-
- } else if (deltaY == 0) {
- /* Just a single vertical rectangle */
- xlly = dsw->sw.drawing_area->core.height;
- xury = 0;
- if (deltaX > 0) {
- xllx = dsw->sw.drawing_area->core.width - deltaX;
- xurx = dsw->sw.drawing_area->core.width;
- } else {
- xllx = 0;
- xurx = -deltaX;
- }
- }
- /* Convert the rectangle into PS coordinates */
- ConvertToPS(dsw, xllx + DELTA, xlly - DELTA, &llx, &lly);
- ConvertToPS(dsw, xurx - DELTA, xury + DELTA, &urx, &ury);
- r[0] = llx;
- r[1] = lly;
- r[2] = urx - llx;
- r[3] = ury - lly;
- xr[0] = xllx;
- xr[1] = xury;
- xr[2] = xurx - xllx;
- xr[3] = xlly - xury;
- n = 1;
-
- } else {
- /* Scrolling in both directions, so there are two rectangles.
- It's easiest to do if we let them overlap; fortunately that is
- legal! First do the horizontal rectangle. */
- xllx = 0;
- xurx = dsw->sw.drawing_area->core.width;
- if (deltaY > 0) {
- xlly = dsw->sw.drawing_area->core.height;
- xury = dsw->sw.drawing_area->core.height - deltaY;
- } else {
- xlly = -deltaY;
- xury = 0;
- }
- ConvertToPS(dsw, xllx + DELTA, xlly - DELTA, &llx, &lly);
- ConvertToPS(dsw, xurx - DELTA, xury + DELTA, &urx, &ury);
-
- /* Store in point array */
- r[0] = llx;
- r[1] = lly;
- r[2] = urx - llx;
- r[3] = ury - lly;
- xr[0] = xllx;
- xr[1] = xury;
- xr[2] = xurx - xllx;
- xr[3] = xlly - xury;
-
- /* Now do vertical rectangle and store in point array */
- xlly = dsw->sw.drawing_area->core.height;
- xury = 0;
- if (deltaX > 0) {
- xllx = dsw->sw.drawing_area->core.width - deltaX;
- xurx = dsw->sw.drawing_area->core.width;
- } else {
- xllx = 0;
- xurx = -deltaX;
- }
- ConvertToPS(dsw, xllx + DELTA, xlly - DELTA, &llx, &lly);
- ConvertToPS(dsw, xurx - DELTA, xury + DELTA, &urx, &ury);
- r[4] = llx;
- r[5] = lly;
- r[6] = urx - llx;
- r[7] = ury - lly;
- xr[4] = xllx;
- xr[5] = xury;
- xr[6] = xurx - xllx;
- xr[7] = xlly - xury;
- n = 2;
- }
-
- AddRectsToDirtyArea(dsw, r, n);
- AddRectsToPending(dsw, xr, n);
- StartDrawing(dsw);
-}
-
-static void SetUpInitialPixmap(dsw)
- DPSScrolledWindowWidget dsw;
-{
- float *r = dsw->sw.dirty_areas;
- int llx, lly, urx, ury;
-
- CreateBackingPixmap(dsw);
- if (dsw->sw.backing_pixmap != None) {
- XDPSSetContextDrawable(dsw->sw.context, dsw->sw.backing_pixmap,
- dsw->sw.pixmap_height);
-
- SetPixmapOffset(dsw);
- SetPixmapOrigin(dsw);
- XDPSCaptureContextGState(dsw->sw.context, &dsw->sw.backing_gstate);
-
- if (dsw->sw.pixmap_width != CEIL(dsw->sw.drawing_width) ||
- dsw->sw.pixmap_height != CEIL(dsw->sw.drawing_height)) {
-
- /* Make the dirty area match the window */
- if (dsw->sw.pixmap_width > (int)dsw->sw.drawing_area->core.width) {
- llx = dsw->sw.origin_x;
- urx = llx + CEIL(dsw->sw.drawing_width);
- } else {
- llx = 0;
- urx = dsw->sw.drawing_area->core.width;
- }
- if (dsw->sw.pixmap_height >
- (int) dsw->sw.drawing_area->core.height) {
- lly = dsw->sw.origin_y;
- ury = dsw->sw.origin_y - CEIL(dsw->sw.drawing_height);
- } else {
- lly = dsw->sw.drawing_area->core.height;
- ury = 0;
- }
- ConvertToPS(dsw, llx + DELTA, lly - DELTA, r, r+1);
- ConvertToPS(dsw, urx - DELTA, ury + DELTA, r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- dsw->sw.num_dirty_areas = 1;
- }
- if (dsw->sw.doing_feedback) {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.dirty_areas,
- dsw->sw.num_dirty_areas);
- FinishDrawing(dsw);
- } else if (!dsw->sw.watch_progress) StartDrawing(dsw);
- }
-}
-
-/* ARGSUSED */
-
-static void TimerStart(clientData, id)
- XtPointer clientData;
- XtIntervalId *id;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData;
-
- if (dsw->sw.drawing_stage == DSWStart) StartDrawing(dsw);
-}
-
-static void SetUpInitialInformation(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int i;
- float llx, lly, urx, ury;
- float xScale, yScale;
- XExposeEvent ev;
- XStandardColormap colorCube, grayRamp;
- int match;
-
- /* If the context's colormap matches the widget's colormap, assume that
- everything is already set up right in the color cube department. This
- allows an application to supply us with a custom color cube by
- installing it in the context before calling us */
-
- _DPSSWColormapMatch(dsw->sw.context,
- dsw->sw.drawing_area->core.colormap, &match);
-
- if (match) {
- XDPSSetContextParameters(dsw->sw.context, XtScreen(dsw),
- dsw->sw.drawing_area->core.depth,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.drawing_area->core.height, NULL, NULL,
- XDPSContextScreenDepth | XDPSContextDrawable);
- } else {
- grayRamp.colormap = colorCube.colormap =
- dsw->sw.drawing_area->core.colormap;
-
- XDPSCreateStandardColormaps(XtDisplay(dsw), XtWindow(dsw),
- (Visual *) NULL, 0, 0, 0, 0,
- &colorCube, &grayRamp, False);
-
- XDPSSetContextParameters(dsw->sw.context, XtScreen(dsw),
- dsw->sw.drawing_area->core.depth,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.drawing_area->core.height,
- (XDPSStandardColormap *) &colorCube,
- (XDPSStandardColormap *) &grayRamp,
- XDPSContextScreenDepth | XDPSContextDrawable |
- XDPSContextRGBMap | XDPSContextGrayMap);
- }
-
- DPSinitgraphics(dsw->sw.context);
- _DPSSWGetTransform(dsw->sw.context, dsw->sw.ctm, dsw->sw.orig_inv_ctm);
- dsw->sw.x_offset = 0;
- dsw->sw.y_offset = dsw->sw.drawing_area->core.height;
- for (i = 0; i < 6; i++) dsw->sw.inv_ctm[i] = dsw->sw.orig_inv_ctm[i];
-
- ConvertToPS(dsw, 0.0, 100.0, &llx, &lly);
- ConvertToPS(dsw, 100.0, 0.0, &urx, &ury);
- xScale = ABS(100.0 / (urx - llx));
- yScale = ABS(100.0 / (ury - lly));
-
- if (dsw->sw.scale != 1.0) {
- DPSscale(dsw->sw.context, dsw->sw.scale, dsw->sw.scale);
- _DPSSWGetTransform(dsw->sw.context, dsw->sw.ctm, dsw->sw.inv_ctm);
- }
-
- dsw->sw.drawing_width = dsw->sw.area_width * xScale * dsw->sw.scale;
- dsw->sw.drawing_height = dsw->sw.area_height * yScale * dsw->sw.scale;
-
- dsw->sw.unscaled_width = dsw->sw.drawing_width / dsw->sw.scale + 1;
- dsw->sw.unscaled_height = dsw->sw.drawing_height / dsw->sw.scale + 1;
-
- if (!dsw->sw.use_saved_scroll) {
- dsw->sw.scroll_pic_x = dsw->sw.area_width / 2;
- dsw->sw.scroll_pic_y = dsw->sw.area_height / 2;
- dsw->sw.scroll_win_x = dsw->sw.drawing_area->core.width / 2;
- dsw->sw.scroll_win_y = dsw->sw.drawing_area->core.height / 2;
- }
-
- SetDrawingAreaPosition(dsw, dsw->sw.scroll_pic_x, dsw->sw.scroll_pic_y,
- dsw->sw.scroll_win_x, dsw->sw.scroll_win_y, True);
- SetOriginAndGetTransform(dsw);
- XDPSCaptureContextGState(dsw->sw.context, &dsw->sw.window_gstate);
-
- dsw->sw.drawing_stage = DSWStart;
-
- if (dsw->sw.use_backing_pixmap) SetUpInitialPixmap(dsw);
-
- if (dsw->sw.doing_feedback) return;
-
- if (dsw->sw.watch_progress || dsw->sw.backing_pixmap == None) {
- /* If watching progress or no pixmap, clear the window to ensure
- that things get started */
- XClearArea(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area),
- 0, 0, 0, 0, True);
- XSync(XtDisplay(dsw), False);
- if (dsw->sw.watch_progress && dsw->sw.watch_progress_delay > 0) {
- /* Set a timer so that we start drawing if nothing is visible */
- (void) XtAppAddTimeOut(XtWidgetToApplicationContext((Widget) dsw),
- dsw->sw.watch_progress_delay,
- TimerStart, (XtPointer) dsw);
- }
- } else {
- /* Put a synthetic expose event in the pending queue */
- ev.x = ev.y = 0;
- ev.width = dsw->sw.drawing_area->core.width;
- ev.height = dsw->sw.drawing_area->core.height;
- SplitExposeEvent(dsw, &ev);
- }
-}
-
-static void Realize(w, mask, attr)
- Widget w;
- XtValueMask *mask;
- XSetWindowAttributes *attr;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- DSWSetupCallbackRec setup;
-
- /* Let my parent do all the hard work */
- (*dpsScrolledWindowClassRec.core_class.superclass->core_class.realize)
- (w, mask, attr);
-
- /* We delay calling the setup callback so that the caller can use
- XtAddCallback to add it */
- setup.context = dsw->sw.context;
- XtCallCallbackList((Widget) dsw, dsw->sw.setup_callback,
- (XtPointer) &setup);
-
- /* Now, explicitly realize my children */
- XtRealizeWidget(dsw->sw.scrolled_window);
-
- /* Et voila, now we have windows! */
- SetUpInitialInformation(dsw);
-}
-
-static void AbortOrFinish(dsw)
- DPSScrolledWindowWidget dsw;
-{
- DSWResults results;
- DSWDrawableType which;
-
- if (dsw->sw.work != 0) {
- XtRemoveWorkProc(dsw->sw.work);
- dsw->sw.work = 0;
- }
-
- switch (dsw->sw.drawing_stage) {
- case DSWStart:
- return;
- /* break; */
-
- case DSWDrawingVisible:
- if (dsw->sw.watch_progress || dsw->sw.backing_pixmap == None) {
- which = DSWWindow;
- } else which = DSWBackingPixmap;
- results = ClipAndDraw(dsw, which, DSWAbortOrFinish, False);
- if (results == DSWAborted) {
- dsw->sw.drawing_stage = DSWStart;
- if (dsw->sw.backing_pixmap == None || dsw->sw.watch_progress) {
- /* Add the current drawing area back into the pending
- expose area */
- AddUserSpaceRectsToPending(dsw, dsw->sw.current_drawing,
- dsw->sw.num_current_drawing);
- }
- return;
- }
- if (dsw->sw.watch_progress && dsw->sw.backing_pixmap != None) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- CopyWindowToBackingPixmap(dsw);
- if (dsw->sw.num_current_drawing != 0) {
- results = ClipAndDraw(dsw, DSWBackingPixmap,
- DSWAbortOrFinish, True);
- }
- if (results == DSWAborted) {
- dsw->sw.drawing_stage = DSWStart;
- return;
- }
- } else {
- if (dsw->sw.backing_pixmap != None) {
- if (dsw->sw.num_pending_expose != 0) {
- CopyPendingExpose(dsw);
- }
-
- if (dsw->sw.minimal_drawing && dsw->sw.big_pixmap) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- SetCurrentDrawingToBackground(dsw);
- results = ClipAndDraw(dsw, which,
- DSWAbortOrFinish, True);
- if (results == DSWAborted) {
- dsw->sw.drawing_stage = DSWStart;
- return;
- }
- }
- }
- }
- break;
-
- case DSWDrewVisible:
- case DSWDrawingBackground:
- results = ClipAndDraw(dsw, DSWBackingPixmap, DSWAbortOrFinish,
- (dsw->sw.drawing_stage == DSWDrewVisible));
- if (results == DSWAborted) {
- dsw->sw.drawing_stage = DSWStart;
- return;
- }
- break;
-
- case DSWDone:
- break;
- }
-
- dsw->sw.drawing_stage = DSWDone;
- dsw->sw.num_dirty_areas = 0;
- return;
-}
-
-static void AbortDrawing(dsw)
- DPSScrolledWindowWidget dsw;
-{
- DSWDrawableType which;
-
- if (dsw->sw.work != 0) {
- XtRemoveWorkProc(dsw->sw.work);
- dsw->sw.work = 0;
- }
-
- switch (dsw->sw.drawing_stage) {
- case DSWStart:
- case DSWDone:
- case DSWDrewVisible:
- break;
-
- case DSWDrawingVisible:
- if (dsw->sw.watch_progress || dsw->sw.backing_pixmap == None) {
- which = DSWWindow;
- } else which = DSWBackingPixmap;
- (void) ClipAndDraw(dsw, which, DSWAbort, False);
- break;
-
- case DSWDrawingBackground:
- (void) ClipAndDraw(dsw, DSWBackingPixmap, DSWAbort, False);
- break;
-
- }
-
- dsw->sw.num_pending_expose = dsw->sw.num_pending_dirty = 0;
-}
-
-static void FinishDrawing(dsw)
- DPSScrolledWindowWidget dsw;
-{
- DSWDrawableType which;
-
- if (dsw->sw.work != 0) {
- XtRemoveWorkProc(dsw->sw.work);
- dsw->sw.work = 0;
- }
-
- switch (dsw->sw.drawing_stage) {
- case DSWStart:
- case DSWDrawingVisible:
- if (dsw->sw.watch_progress || dsw->sw.backing_pixmap == None) {
- which = DSWWindow;
- } else which = DSWBackingPixmap;
- if (dsw->sw.drawing_stage == DSWStart) {
- ClipToDrawingSize(dsw, which);
- if (dsw->sw.num_current_drawing == 0) return;
- }
- (void) ClipAndDraw(dsw, which, DSWFinish,
- dsw->sw.drawing_stage == DSWStart);
- if (dsw->sw.watch_progress && dsw->sw.backing_pixmap != None) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- CopyWindowToBackingPixmap(dsw);
- if (dsw->sw.num_current_drawing != 0) {
- (void) ClipAndDraw(dsw, DSWBackingPixmap, DSWFinish, True);
- }
- } else {
- if (dsw->sw.backing_pixmap != None) {
- if (dsw->sw.num_pending_expose != 0) {
- CopyPendingExpose(dsw);
- }
-
- if (dsw->sw.minimal_drawing && dsw->sw.big_pixmap) {
- dsw->sw.drawing_stage = DSWDrewVisible;
- SetCurrentDrawingToBackground(dsw);
- (void) ClipAndDraw(dsw, which, DSWFinish, True);
- }
- }
- }
- break;
-
- case DSWDrewVisible:
- case DSWDrawingBackground:
- (void) ClipAndDraw(dsw, DSWBackingPixmap, DSWFinish,
- (dsw->sw.drawing_stage == DSWDrewVisible));
- break;
-
- case DSWDone:
- break;
- }
-
- dsw->sw.drawing_stage = DSWDone;
- dsw->sw.num_dirty_areas = 0;
-}
-
-static void DoScroll(dsw, deltaX, deltaY)
- DPSScrolledWindowWidget dsw;
- int deltaX, deltaY;
-{
- /* Set the PS origin in the X window to the new settings of
- the scrollbars */
- dsw->sw.origin_x -= deltaX;
- dsw->sw.origin_y -= deltaY;
-
- /* Update the graphics states for the window and backing pixmap to
- reflect new origin */
- (void) XDPSSetContextGState(dsw->sw.context, dsw->sw.window_gstate);
- SetOriginAndGetTransform(dsw);
- (void) XDPSUpdateContextGState(dsw->sw.context, dsw->sw.window_gstate);
-
- if (dsw->sw.backing_pixmap != None && !dsw->sw.big_pixmap) {
- (void) XDPSSetContextGState(dsw->sw.context, dsw->sw.backing_gstate);
- SetPixmapOrigin(dsw);
- (void) XDPSUpdateContextGState(dsw->sw.context,
- dsw->sw.backing_gstate);
- }
-
- /* Update the stored position of the scroll bars */
- dsw->sw.scroll_x += deltaX;
- dsw->sw.scroll_y += deltaY;
-}
-
-static void ShiftPendingExpose(dsw, deltaX, deltaY)
- DPSScrolledWindowWidget dsw;
- int deltaX, deltaY;
-{
- int i;
- int *r;
-
- for (i = 0; i < dsw->sw.num_pending_expose; i++) {
- r = dsw->sw.pending_expose + 4*i;
- r[0] -= deltaX;
- r[1] -= deltaY;
- }
-}
-
-static void HScrollCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData;
- XmScrollBarCallbackStruct *sb = (XmScrollBarCallbackStruct *) callData;
-
- if (!dsw->sw.application_scrolling) {
- dsw->sw.scroll_h_value = sb->value;
- ScrollMoved(dsw);
- }
-}
-
-static void VScrollCallback(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData;
- XmScrollBarCallbackStruct *sb = (XmScrollBarCallbackStruct *) callData;
-
- if (!dsw->sw.application_scrolling) {
- dsw->sw.scroll_v_value = sb->value;
- ScrollMoved(dsw);
- }
-}
-
-/* ARGSUSED */
-
-static void ScrollMoved(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int deltaX, deltaY;
-
- /* If we haven't started drawing yet, it must be because we're waiting
- for GraphicsExpose events. Delay scrolling until they come in */
- if (dsw->sw.scrolling && dsw->sw.drawing_stage == DSWStart) return;
-
- /* Calculate the delta in the scrolling */
- deltaX = dsw->sw.scroll_h_value - dsw->sw.scroll_x;
- deltaY = dsw->sw.scroll_v_value - dsw->sw.scroll_y;
-
- /* If there is some scrolling to do, then scroll the pixmap and
- copy the pixmap to the window */
- if (deltaX == 0 && deltaY == 0) return;
-
- ShiftPendingExpose(dsw, deltaX, deltaY);
-
- AbortOrFinish(dsw);
-
- DoScroll(dsw, deltaX, deltaY);
-
- if (!dsw->sw.big_pixmap) {
- /* Copy visible area to new location */
- if (dsw->sw.backing_pixmap != None) {
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- dsw->sw.backing_pixmap, dsw->sw.no_ge_gc,
- deltaX, deltaY, dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- if (!dsw->sw.doing_feedback || dsw->sw.feedback_pixmap == None) {
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area), dsw->sw.no_ge_gc,
- 0, 0, dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- }
- RedisplaySliver(dsw, deltaX, deltaY);
- } else {
- if (!dsw->sw.doing_feedback || dsw->sw.feedback_pixmap == None) {
- XCopyArea(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area),
- XtWindow(dsw->sw.drawing_area), dsw->sw.ge_gc,
- deltaX, deltaY, dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- }
- if (dsw->sw.doing_feedback) RedisplaySliver(dsw, deltaX, deltaY);
- else dsw->sw.drawing_stage = DSWStart;
- }
- }
-
- if (dsw->sw.doing_feedback) {
- float *r;
-
- FinishDrawing(dsw);
-
- r = dsw->sw.prev_dirty_areas;
- ConvertToPS(dsw, 0 + DELTA, dsw->sw.drawing_area->core.height - DELTA,
- r, r+1);
- ConvertToPS(dsw, dsw->sw.drawing_area->core.width - DELTA, 0 + DELTA,
- r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- dsw->sw.num_prev_dirty_areas = 1;
-
- if (dsw->sw.feedback_pixmap != None) {
- XDPSSetContextDrawable(dsw->sw.context, dsw->sw.feedback_pixmap,
- dsw->sw.drawing_area->core.height);
- SetPixmapOrigin(dsw);
- XDPSCaptureContextGState(dsw->sw.context,
- &dsw->sw.feedback_gstate);
-
- /* Initialize the feedback pixmap with a copy of the drawing */
- if (dsw->sw.backing_pixmap != None) {
- CopyToFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- (void) ClipAndDraw(dsw, DSWFeedbackPixmap, DSWFinish, True);
- }
- if (!dsw->sw.feedback_displayed) {
- XCopyArea(XtDisplay(dsw), dsw->sw.feedback_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc, 0, 0,
- dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- }
- }
-
- if (dsw->sw.feedback_displayed) {
- CallFeedbackCallback(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- }
- if (dsw->sw.feedback_pixmap != None) {
- UpdateWindowFromFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- }
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
-
- } else {
- if (dsw->sw.backing_pixmap != None &&
- dsw->sw.drawing_stage == DSWDone) {
- ComputeOffsets(dsw, &deltaX, &deltaY);
- if (!dsw->sw.big_pixmap) dsw->sw.scrolling = True;
-
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area), dsw->sw.no_ge_gc,
- deltaX, deltaY,
- dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- } else dsw->sw.scrolling = True;
- }
-}
-
-static void AddExposureToPending(dsw, ev)
- DPSScrolledWindowWidget dsw;
- XExposeEvent *ev;
-{
- float *f;
- int *i;
-
- if (dsw->sw.backing_pixmap == None || dsw->sw.watch_progress ||
- dsw->sw.doing_feedback) {
- GrowRectList(&dsw->sw.pending_dirty, &dsw->sw.pending_dirty_size,
- dsw->sw.num_pending_dirty, 1, 1);
-
- f = dsw->sw.pending_dirty + (dsw->sw.num_pending_dirty * 4);
- ConvertToPS(dsw, ev->x + DELTA, ev->y + ev->height - DELTA, f, f+1);
- ConvertToPS(dsw, ev->x + ev->width - DELTA, ev->y + DELTA, f+2, f+3);
- f[2] -= f[0];
- f[3] -= f[1];
- dsw->sw.num_pending_dirty++;
- }
-
- GrowIntRectList(&dsw->sw.pending_expose, &dsw->sw.pending_expose_size,
- dsw->sw.num_pending_expose, 1, 1);
-
- i = dsw->sw.pending_expose + (dsw->sw.num_pending_expose * 4);
- i[0] = ev->x;
- i[1] = ev->y;
- i[2] = ev->width;
- i[3] = ev->height;
- dsw->sw.num_pending_expose++;
-}
-
-static void AddRectsToPending(dsw, newRect, n)
- DPSScrolledWindowWidget dsw;
- int *newRect;
- int n;
-{
- int *r;
- int i;
- float *f;
-
- if (dsw->sw.backing_pixmap == None || dsw->sw.watch_progress) {
- GrowRectList(&dsw->sw.pending_dirty, &dsw->sw.pending_dirty_size,
- dsw->sw.num_pending_dirty, n, 1);
-
- for (i = 0; i < n; i++) {
- f = dsw->sw.pending_dirty + (dsw->sw.num_pending_dirty * 4);
- r = newRect + (i * 4);
- ConvertToPS(dsw, r[0] + DELTA, r[1] + r[3] - DELTA, f, f+1);
- ConvertToPS(dsw, r[0] + r[2] - DELTA, r[1] + DELTA, f+2, f+3);
- f[2] -= f[0];
- f[3] -= f[1];
- dsw->sw.num_pending_dirty++;
- }
- }
-
- GrowIntRectList(&dsw->sw.pending_expose, &dsw->sw.pending_expose_size,
- dsw->sw.num_pending_expose, n, 1);
-
- r = dsw->sw.pending_expose + (dsw->sw.num_pending_expose * 4);
- for (i = 0; i < 4*n; i++) r[i] = newRect[i];
- dsw->sw.num_pending_expose += n;
-}
-
-static void AddUserSpaceRectsToPending(dsw, newRect, n)
- DPSScrolledWindowWidget dsw;
- float *newRect;
- int n;
-{
- int *r;
- int i;
- float *f;
-
- if (dsw->sw.backing_pixmap == None || dsw->sw.watch_progress) {
- GrowRectList(&dsw->sw.pending_dirty, &dsw->sw.pending_dirty_size,
- dsw->sw.num_pending_dirty, n, 1);
-
- f = dsw->sw.pending_dirty + (dsw->sw.num_pending_dirty * 4);
- for (i = 0; i < 4*n; i++) f[i] = newRect[i];
- dsw->sw.num_pending_dirty += n;
- }
-
- GrowIntRectList(&dsw->sw.pending_expose, &dsw->sw.pending_expose_size,
- dsw->sw.num_pending_expose, n, 1);
-
- for (i = 0; i < n; i++) {
- r = dsw->sw.pending_expose + (dsw->sw.num_pending_expose * 4);
- f = newRect + (i * 4);
- ConvertToX(dsw, LEFT(f), TOP(f), r, r+1);
- ConvertToX(dsw, RIGHT(f), BOTTOM(f), r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- dsw->sw.num_pending_expose++;
- }
-}
-
-static void CopyRectsToCurrentDrawing(dsw, newRect, n)
- DPSScrolledWindowWidget dsw;
- float *newRect;
- int n;
-{
- float *r;
- int i;
-
- GrowRectList(&dsw->sw.current_drawing, &dsw->sw.current_drawing_size,
- 0, n, 1);
-
- r = dsw->sw.current_drawing;
- for (i = 0; i < 4*n; i++) r[i] = newRect[i];
- dsw->sw.num_current_drawing = n;
-}
-
-static void CopyRectsToDirtyArea(dsw, newRect, n)
- DPSScrolledWindowWidget dsw;
- float *newRect;
- int n;
-{
- float *r;
- int i;
-
- GrowRectList(&dsw->sw.dirty_areas, &dsw->sw.dirty_areas_size, 0, n, 1);
-
- r = dsw->sw.dirty_areas;
- for (i = 0; i < 4*n; i++) r[i] = newRect[i];
- dsw->sw.num_dirty_areas = n;
-}
-
-static void AddRectsToDirtyArea(dsw, newRect, n)
- DPSScrolledWindowWidget dsw;
- float *newRect;
- int n;
-{
- float *r;
- int i;
-
- GrowRectList(&dsw->sw.dirty_areas, &dsw->sw.dirty_areas_size,
- dsw->sw.num_dirty_areas, n, 1);
-
- r = dsw->sw.dirty_areas + (4 * dsw->sw.num_dirty_areas);
- for (i = 0; i < 4*n; i++) r[i] = newRect[i];
- dsw->sw.num_dirty_areas += n;
-}
-
-static void CopyRectsToPrevDirtyArea(dsw, newRect, n)
- DPSScrolledWindowWidget dsw;
- float *newRect;
- int n;
-{
- float *r;
- int i;
-
- GrowRectList(&dsw->sw.prev_dirty_areas,
- &dsw->sw.prev_dirty_areas_size, 0, n, 1);
-
- r = dsw->sw.prev_dirty_areas;
- for (i = 0; i < 4*n; i++) r[i] = newRect[i];
- dsw->sw.num_prev_dirty_areas = n;
-}
-
-/* ARGSUSED */
-
-static void DrawingAreaGraphicsExpose(w, clientData, event, goOn)
- Widget w;
- XtPointer clientData;
- XEvent *event;
- Boolean *goOn;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData;
- XExposeEvent *ev = (XExposeEvent *) event;
-
- switch (event->type) {
- case GraphicsExpose:
- /* GraphicsExpose occur during unbuffered scrolling */
- if (dsw->sw.backing_pixmap == None && dsw->sw.scrolling) {
- /* Unbuffered scrolling case */
- AddExposureToPending(dsw, ev);
-
- if (ev->count == 0) {
- AddRectsToDirtyArea(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
- StartDrawing(dsw);
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
- }
- }
- break;
- }
-}
-
-static Boolean MoreExposes(w)
- Widget w;
-{
- XEvent event;
-
- if (XPending(XtDisplay(w)) > 0) {
- if (XCheckTypedWindowEvent(XtDisplay(w), XtWindow(w),
- Expose, &event)) {
- XPutBackEvent(XtDisplay(w), &event);
- return True;;
- }
- }
- return False;
-}
-
-static void DrawingAreaExpose(w, clientData, callData)
- Widget w;
- XtPointer clientData, callData;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) clientData;
- XmDrawingAreaCallbackStruct *d = (XmDrawingAreaCallbackStruct *) callData;
- XExposeEvent *ev = (XExposeEvent *) d->event;
- int dx, dy;
-
- if (dsw->sw.doing_feedback) {
- if (dsw->sw.feedback_pixmap != None) {
- XCopyArea(XtDisplay(dsw), dsw->sw.feedback_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc,
- ev->x, ev->y, ev->width, ev->height, ev->x, ev->y);
- } else {
- if (dsw->sw.backing_pixmap != None) {
- ComputeOffsets(dsw, &dx, &dy);
-
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc, ev->x + dx, ev->y + dy,
- ev->width, ev->height, ev->x, ev->y);
- }
- AddExposureToPending(dsw, ev);
- if (ev->count != 0 || MoreExposes(w)) return;
-
- if (dsw->sw.backing_pixmap == None) {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
- dsw->sw.drawing_stage = DSWStart;
- FinishDrawing(dsw);
- }
- if (dsw->sw.feedback_displayed) {
- CallFeedbackCallback(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
- }
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
- }
- return;
- }
-
- if (dsw->sw.backing_pixmap != None) {
- if (dsw->sw.drawing_stage == DSWStart && dsw->sw.watch_progress) {
- SplitExposeEvent(dsw, ev);
- if (ev->count == 0) {
- if (MoreExposes(w)) return;
- StartDrawing(dsw);
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
- }
- return;
- }
-
- if (dsw->sw.drawing_stage < DSWDrewVisible) {
- SplitExposeEvent(dsw, ev);
- return;
- }
- ComputeOffsets(dsw, &dx, &dy);
-
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc,
- ev->x + dx, ev->y + dy, ev->width, ev->height, ev->x, ev->y);
- } else {
- AddExposureToPending(dsw, ev);
- if (ev->count == 0) {
- if (MoreExposes(w)) return;
- if (dsw->sw.drawing_stage == DSWDone ||
- dsw->sw.drawing_stage == DSWStart) {
- CopyRectsToDirtyArea(dsw, dsw->sw.pending_dirty,
- dsw->sw.num_pending_dirty);
- StartDrawing(dsw);
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
- }
- }
- }
-}
-
-static void Resize(w)
- Widget w;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- DSWResizeCallbackRec r;
- float x, y;
-
- if (XtIsRealized(w)) (void) AbortOrFinish(dsw);
-
- r.oldw = dsw->sw.scrolled_window->core.width;
- r.oldh = dsw->sw.scrolled_window->core.height;
- r.neww = dsw->core.width;
- r.newh = dsw->core.height;
- r.x = r.y = 0;
-
- XtCallCallbackList(w, dsw->sw.resize_callback, (XtPointer) &r);
-
- if (XtIsRealized(w)) {
- ConvertToPS(dsw, (float) r.x, (float) r.y, &x, &y);
- } else if (r.x != 0 || r.y != 0) ScrollBy(w, r.x, r.y);
-
- XtResizeWidget(dsw->sw.scrolled_window, w->core.width, w->core.height, 0);
-
- if (!XtIsRealized(w)) return;
-
- if (dsw->sw.backing_pixmap != None &&
- dsw->sw.pixmap_width == CEIL(dsw->sw.drawing_width) &&
- dsw->sw.pixmap_height == CEIL(dsw->sw.drawing_height) &&
- dsw->sw.pixmap_width >= (int) dsw->sw.drawing_area->core.width &&
- dsw->sw.pixmap_height >= (int) dsw->sw.drawing_area->core.width) {
-
- XDPSSetContextGState(dsw->sw.context, dsw->sw.window_gstate);
- DPSinitclip(dsw->sw.context);
- DPSinitviewclip(dsw->sw.context);
- SetDrawingAreaPosition(dsw, x, y, r.x, r.y, True);
- SetOriginAndGetTransform(dsw);
- XDPSUpdateContextGState(dsw->sw.context, dsw->sw.window_gstate);
- XClearArea(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area),
- 0, 0, 0, 0, True);
- } else {
- dsw->sw.use_saved_scroll = True;
- dsw->sw.scroll_pic_x = x;
- dsw->sw.scroll_pic_y = y;
- dsw->sw.scroll_win_x = r.x;
- dsw->sw.scroll_win_y = r.y;
-
- if (dsw->sw.backing_pixmap != None) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.backing_pixmap);
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.backing_gstate);
- }
- dsw->sw.backing_pixmap = None;
- dsw->sw.big_pixmap = False;
- dsw->sw.pixmap_width = dsw->sw.pixmap_height = 0;
-
- dsw->sw.num_dirty_areas = 1;
- LEFT(dsw->sw.dirty_areas) = 0.0;
- BOTTOM(dsw->sw.dirty_areas) = 0.0;
- WIDTH(dsw->sw.dirty_areas) = dsw->sw.area_width;
- HEIGHT(dsw->sw.dirty_areas) = dsw->sw.area_height;
-
- SetUpInitialInformation(dsw);
- }
-
- if (dsw->sw.doing_feedback) {
- float *r;
- int dx, dy;
-
- CheckFeedbackPixmap(dsw);
- r = dsw->sw.prev_dirty_areas;
- ConvertToPS(dsw, 0 + DELTA, dsw->sw.drawing_area->core.height - DELTA,
- r, r+1);
- ConvertToPS(dsw, dsw->sw.drawing_area->core.width - DELTA, 0 + DELTA,
- r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- dsw->sw.num_prev_dirty_areas = 1;
-
- if (dsw->sw.feedback_pixmap != None) {
- /* Initialize the feedback pixmap with a copy of the drawing */
- if (dsw->sw.backing_pixmap != None) {
- CopyToFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- (void) ClipAndDraw(dsw, DSWFeedbackPixmap, DSWFinish, True);
- }
- XCopyArea(XtDisplay(dsw), dsw->sw.feedback_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc, 0, 0,
- dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- } else {
- if (dsw->sw.backing_pixmap != None) {
- ComputeOffsets(dsw, &dx, &dy);
-
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- XtWindow(dsw->sw.drawing_area),
- dsw->sw.no_ge_gc, dx, dy,
- dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height, 0, 0);
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- dsw->sw.drawing_stage = DSWStart;
- FinishDrawing(dsw);
- }
- }
- if (dsw->sw.feedback_displayed) {
- CallFeedbackCallback(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- }
- if (dsw->sw.feedback_pixmap != None) {
- UpdateWindowFromFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- }
- dsw->sw.num_pending_dirty = dsw->sw.num_pending_expose = 0;
- }
-}
-
-static void CheckFeedbackPixmap(dsw)
- DPSScrolledWindowWidget dsw;
-{
- if (dsw->sw.feedback_pixmap != None &&
- (dsw->sw.feedback_width < (int) dsw->sw.drawing_area->core.width ||
- dsw->sw.feedback_height < (int) dsw->sw.drawing_area->core.height)) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.feedback_pixmap);
- dsw->sw.feedback_pixmap = None;
- dsw->sw.feedback_width = dsw->sw.feedback_height = 0;
- }
- if (dsw->sw.use_feedback_pixmap && dsw->sw.feedback_pixmap == None) {
- dsw->sw.feedback_pixmap =
- AllocPixmap(dsw, dsw->sw.drawing_area->core.width,
- dsw->sw.drawing_area->core.height);
- if (dsw->sw.feedback_pixmap != None) {
- dsw->sw.feedback_width = dsw->sw.drawing_area->core.width;
- dsw->sw.feedback_height = dsw->sw.drawing_area->core.height;
- }
- }
- if (dsw->sw.feedback_pixmap != None) {
- XDPSSetContextDrawable(dsw->sw.context, dsw->sw.feedback_pixmap,
- dsw->sw.drawing_area->core.height);
- SetPixmapOrigin(dsw);
- XDPSCaptureContextGState(dsw->sw.context, &dsw->sw.feedback_gstate);
- }
-}
-
-static void UpdateGStates(dsw)
- DPSScrolledWindowWidget dsw;
-{
- /* Create graphics states for the window and backing pixmap in
- the new context */
- XDPSSetContextDrawable(dsw->sw.context, XtWindow(dsw->sw.drawing_area),
- dsw->sw.drawing_area->core.height);
- DPSinitgraphics(dsw->sw.context);
- if (dsw->sw.scale != 1.0) {
- DPSscale(dsw->sw.context, dsw->sw.scale, dsw->sw.scale);
- }
-
- SetOriginAndGetTransform(dsw);
- (void) XDPSCaptureContextGState(dsw->sw.context, &dsw->sw.window_gstate);
- if (dsw->sw.backing_pixmap != None) {
- XDPSSetContextDrawable(dsw->sw.context, dsw->sw.backing_pixmap,
- dsw->sw.pixmap_height);
-
- SetPixmapOffset(dsw);
- SetPixmapOrigin(dsw);
- XDPSCaptureContextGState(dsw->sw.context, &dsw->sw.backing_gstate);
- }
-}
-
-static void CheckPixmapSize(dsw)
- DPSScrolledWindowWidget dsw;
-{
- Boolean freeIt = False;
- int w = dsw->sw.pixmap_width, h = dsw->sw.pixmap_height;
- Widget wid = dsw->sw.drawing_area;
- unsigned int dBytes;
-
- if (dsw->sw.pixmap_limit > 0) {
- if (w * h > dsw->sw.pixmap_limit) freeIt = True;
- } else if (dsw->sw.pixmap_limit < 0 &&
- w * h > dsw->sw.unscaled_width * dsw->sw.unscaled_height &&
- w * h > (int) wid->core.width * (int) wid->core.height) {
- freeIt = True;
- }
-
- if (dsw->sw.absolute_pixmap_limit > 0) {
- dBytes = (wid->core.depth + 7) / 8; /* Convert into bytes */
- if (w * h * dBytes > dsw->sw.absolute_pixmap_limit * 1024) {
- freeIt = True;
- }
- }
- if (freeIt) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.backing_pixmap);
- dsw->sw.backing_pixmap = None;
- dsw->sw.big_pixmap = False;
- dsw->sw.pixmap_width = dsw->sw.pixmap_height = 0;
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.backing_gstate);
- }
-}
-
-static void ResizeArea(dsw)
- DPSScrolledWindowWidget dsw;
-{
- AbortDrawing(dsw);
-
- /* Make everything dirty */
- dsw->sw.num_dirty_areas = 1;
- LEFT(dsw->sw.dirty_areas) = 0.0;
- BOTTOM(dsw->sw.dirty_areas) = 0.0;
- WIDTH(dsw->sw.dirty_areas) = dsw->sw.area_width;
- HEIGHT(dsw->sw.dirty_areas) = dsw->sw.area_height;
-
- if (dsw->sw.big_pixmap) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.backing_pixmap);
- dsw->sw.backing_pixmap = None;
- dsw->sw.big_pixmap = False;
- dsw->sw.pixmap_width = dsw->sw.pixmap_height = 0;
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.backing_gstate);
- }
-
- if (!dsw->sw.use_saved_scroll) {
- /* Keep the upper left in the same place */
- dsw->sw.scroll_win_x = 0;
- dsw->sw.scroll_win_y = 0;
- ConvertToPS(dsw, 0.0, 0.0,
- &dsw->sw.scroll_pic_x, &dsw->sw.scroll_pic_y);
- dsw->sw.use_saved_scroll = True;
- }
-
- SetUpInitialInformation(dsw);
-}
-
-static void ClearDirtyAreas(dsw)
- DPSScrolledWindowWidget dsw;
-{
- int i;
- float *r;
- int llx, lly, urx, ury;
-
- for (i = 0; i < dsw->sw.num_dirty_areas; i++) {
- r = dsw->sw.dirty_areas + (i * 4);
- ConvertToX(dsw, LEFT(r), BOTTOM(r), &llx, &lly);
- ConvertToX(dsw, RIGHT(r), TOP(r), &urx, &ury);
- XClearArea(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area),
- llx, ury, urx-llx, lly-ury, True);
- }
-}
-
-static void HandleFeedbackPixmapChange(dsw)
- DPSScrolledWindowWidget dsw;
-{
- if (!dsw->sw.use_feedback_pixmap) {
- /* Get rid of one if we have it */
- if (dsw->sw.feedback_pixmap != None) {
- XFreePixmap(XtDisplay(dsw), dsw->sw.feedback_pixmap);
- dsw->sw.feedback_pixmap = None;
- dsw->sw.feedback_width = dsw->sw.feedback_height = 0;
- }
- } else {
- if (dsw->sw.doing_feedback) {
- float *r;
-
- CheckFeedbackPixmap(dsw);
- if (dsw->sw.feedback_pixmap == None) return;
-
- r = dsw->sw.prev_dirty_areas;
- ConvertToPS(dsw, 0 + DELTA,
- dsw->sw.drawing_area->core.height - DELTA, r, r+1);
- ConvertToPS(dsw, dsw->sw.drawing_area->core.width - DELTA,
- 0 + DELTA, r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- dsw->sw.num_prev_dirty_areas = 1;
-
- /* Initialize the feedback pixmap with a copy of the drawing */
- if (dsw->sw.backing_pixmap != None) {
- CopyToFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- (void) ClipAndDraw(dsw, DSWFeedbackPixmap, DSWFinish, True);
- }
- if (dsw->sw.feedback_displayed) {
- CallFeedbackCallback(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- }
- }
- }
-}
-
-/* ARGSUSED */
-
-static Boolean SetValues(old, req, new, args, num_args)
- Widget old, req, new;
- ArgList args;
- Cardinal *num_args;
-{
- DPSScrolledWindowWidget olddsw = (DPSScrolledWindowWidget) old;
- DPSScrolledWindowWidget newdsw = (DPSScrolledWindowWidget) new;
- Bool inited;
-
-#define NE(field) newdsw->sw.field != olddsw->sw.field
-#define DONT_CHANGE(field) \
- if (NE(field)) newdsw->sw.field = olddsw->sw.field;
-
- DONT_CHANGE(ctm_ptr);
- DONT_CHANGE(inv_ctm_ptr);
- DONT_CHANGE(backing_pixmap);
- DONT_CHANGE(feedback_pixmap);
- DONT_CHANGE(window_gstate);
- DONT_CHANGE(backing_gstate);
- DONT_CHANGE(feedback_gstate);
-
- if (NE(context)) {
- DSWSetupCallbackRec setup;
-
- if (newdsw->sw.context == NULL) {
- newdsw->sw.context = XDPSGetSharedContext(XtDisplay(newdsw));
- }
- if (_XDPSTestComponentInitialized(newdsw->sw.context,
- dps_init_bit_dsw, &inited) ==
- dps_status_unregistered_context) {
- XDPSRegisterContext(newdsw->sw.context, False);
- }
- if (XtIsRealized(newdsw)) {
- setup.context = newdsw->sw.context;
- XtCallCallbackList((Widget) newdsw, newdsw->sw.setup_callback,
- (XtPointer) &setup);
- }
- UpdateGStates(newdsw);
- }
-
- /* Watch progress only works with pass-through event dispatching */
-
- if (NE(watch_progress)) {
- if (newdsw->sw.watch_progress &&
- XDPSSetEventDelivery(XtDisplay(newdsw), dps_event_query) !=
- dps_event_pass_through) newdsw->sw.watch_progress = False;
- }
-
- if (NE(application_scrolling) && !newdsw->sw.application_scrolling) {
- XtVaSetValues(newdsw->sw.h_scroll, XmNmaximum, newdsw->sw.scroll_h_max,
- XmNvalue, newdsw->sw.scroll_h_value,
- XmNsliderSize, newdsw->sw.scroll_h_size, NULL);
- XtVaSetValues(newdsw->sw.v_scroll, XmNmaximum, newdsw->sw.scroll_v_max,
- XmNvalue, newdsw->sw.scroll_v_value,
- XmNsliderSize, newdsw->sw.scroll_v_size, NULL);
- }
-
- if (newdsw->sw.doing_feedback) {
- DONT_CHANGE(scale);
- DONT_CHANGE(area_width);
- DONT_CHANGE(area_height);
- }
-
- if (NE(pixmap_limit) || NE(absolute_pixmap_limit)) CheckPixmapSize(newdsw);
-
- if (NE(area_width) || NE(area_height) || NE(scale)) ResizeArea(newdsw);
-
- /* It's too confusing to let any of these things change in the middle
- of drawing */
-
- if (NE(use_backing_pixmap) || NE(watch_progress) ||
- NE(minimal_drawing) || NE(document_size_pixmaps)) {
- Boolean freeIt = False, setUp = False;
- AbortOrFinish(newdsw);
- if (NE(use_backing_pixmap)) {
- if (newdsw->sw.use_backing_pixmap) setUp = True;
- else freeIt = True;
- }
- if (NE(document_size_pixmaps)) {
- if (newdsw->sw.backing_pixmap != None) freeIt = True;
- setUp = True;
- }
- if (freeIt) FreeBackingPixmap(newdsw);
- if (setUp) SetUpInitialPixmap(newdsw);
- }
-
- if (NE(dirty_areas)) {
- float *r = newdsw->sw.dirty_areas;
- int n = newdsw->sw.num_dirty_areas;
- DONT_CHANGE(dirty_areas);
- DONT_CHANGE(num_dirty_areas);
- AbortOrFinish(newdsw);
- AddRectsToDirtyArea(newdsw, r, n);
- if (newdsw->sw.watch_progress || newdsw->sw.backing_pixmap == None) {
- ClearDirtyAreas(newdsw);
- newdsw->sw.drawing_stage = DSWStart;
- } else {
- AddUserSpaceRectsToPending(newdsw, r, n);
- StartDrawing(newdsw);
- }
- }
-
- if (NE(use_feedback_pixmap)) HandleFeedbackPixmapChange(newdsw);
-
- return False;
-#undef DONT_CHANGE
-}
-
-static XtGeometryResult GeometryManager(w, desired, allowed)
- Widget w;
- XtWidgetGeometry *desired, *allowed;
-{
- /* Pass geometry requests up to our parent */
- return XtMakeGeometryRequest(XtParent(w), desired, allowed);
-}
-
-static XtGeometryResult QueryGeometry(w, desired, allowed)
- Widget w;
- XtWidgetGeometry *desired, *allowed;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- /* Pass geometry requests down to our child */
- return XtQueryGeometry(dsw->sw.scrolled_window, desired, allowed);
-}
-
-static void CopyToFeedbackPixmap(dsw, rects, n)
- DPSScrolledWindowWidget dsw;
- float *rects;
- int n;
-{
- int llx, lly, urx, ury;
- int dx, dy;
- int i;
- float *r;
-
- ComputeOffsets(dsw, &dx, &dy);
-
- for (i = 0; i < n; i++) {
- r = rects + (i * 4);
- ConvertToX(dsw, LEFT(r), BOTTOM(r), &llx, &lly);
- ConvertToX(dsw, RIGHT(r), TOP(r), &urx, &ury);
-
- XCopyArea(XtDisplay(dsw), dsw->sw.backing_pixmap,
- dsw->sw.feedback_pixmap, dsw->sw.no_ge_gc,
- llx+dx-1, ury+dy-1, urx-llx+2, lly-ury+2, llx-1, ury-1);
- }
-}
-
-static void CallFeedbackCallback(dsw, r, n)
- DPSScrolledWindowWidget dsw;
- float *r;
- int n;
-{
- DSWFeedbackCallbackRec f;
-
- f.start_feedback_data = dsw->sw.start_feedback_data;
- f.continue_feedback_data = dsw->sw.continue_feedback_data;
- if (dsw->sw.feedback_pixmap == None) {
- f.type = DSWWindow;
- f.drawable = XtWindow(dsw->sw.drawing_area);
- f.gstate = dsw->sw.window_gstate;
- } else {
- f.type = DSWFeedbackPixmap;
- f.drawable = dsw->sw.feedback_pixmap;
- f.gstate = dsw->sw.feedback_gstate;
- }
- f.context = dsw->sw.context;
- f.dirty_rects = r;
- f.dirty_count = n;
-
- XDPSSetContextGState(dsw->sw.context, f.gstate);
- _DPSSWSetRectViewClip(dsw->sw.context, r, n * 4);
- XtCallCallbackList((Widget) dsw, dsw->sw.feedback_callback,
- (XtPointer) &f);
- DPSWaitContext(dsw->sw.context);
-}
-
-static void SetScale(w, scale, fixedX, fixedY)
- Widget w;
- double scale;
- long fixedX, fixedY;
-{
- float psX, psY;
-
- ConvertToPS((DPSScrolledWindowWidget) w, (float) fixedX, (float) fixedY,
- &psX, &psY);
- SetScaleAndScroll(w, scale, psX, psY, fixedX, fixedY);
-}
-
-void DSWSetScale(w, scale, fixedX, fixedY)
- Widget w;
- double scale;
- long fixedX, fixedY;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.set_scale) (w, scale, fixedX, fixedY);
-}
-
-static void ScrollPoint(w, psX, psY, xX, xY)
- Widget w;
- double psX, psY;
- long xX, xY;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (!XtIsRealized(w)) {
- dsw->sw.use_saved_scroll = True;
- dsw->sw.scroll_pic_x = psX;
- dsw->sw.scroll_pic_y = psY;
- dsw->sw.scroll_win_x = xX;
- dsw->sw.scroll_win_y = xY;
- return;
- } else {
- SetDrawingAreaPosition(dsw, psX, psY, xX, xY, False);
- ScrollMoved(dsw);
- }
-}
-
-void DSWScrollPoint(w, psX, psY, xX, xY)
- Widget w;
- double psX, psY;
- long xX, xY;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.scroll_point) (w, psX, psY, xX, xY);
-}
-
-static void ScrollBy(w, dx, dy)
- Widget w;
- long dx, dy;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- int value;
-
- if (dx == 0 && dy == 0) return;
-
- if (!XtIsRealized(w) && dsw->sw.use_saved_scroll) {
- dsw->sw.scroll_win_x += dx;
- dsw->sw.scroll_win_y += dy;
- } else {
- value = dsw->sw.scroll_h_value + dx;
-
- if (value < 0) value = 0;
- else if (value > dsw->sw.scroll_h_max - dsw->sw.scroll_h_size) {
- value = dsw->sw.scroll_h_max - dsw->sw.scroll_h_size;
- }
- dsw->sw.scroll_h_value = value;
-
- if (!dsw->sw.application_scrolling) {
- XtVaSetValues(dsw->sw.h_scroll, XmNvalue, value, NULL);
- }
-
- value = dsw->sw.scroll_v_value + dy;
-
- if (value < 0) value = 0;
- else if (value > dsw->sw.scroll_v_max - dsw->sw.scroll_v_size) {
- value = dsw->sw.scroll_v_max - dsw->sw.scroll_v_size;
- }
- dsw->sw.scroll_v_value = value;
-
- if (!dsw->sw.application_scrolling) {
- XtVaSetValues(dsw->sw.v_scroll, XmNvalue, value, NULL);
- }
-
- ScrollMoved(dsw);
- }
-}
-
-void DSWScrollBy(w, dx, dy)
- Widget w;
- long dx, dy;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.scroll_by) (w, dx, dy);
-}
-
-static void ScrollTo(w, x, y)
- Widget w;
- long x, y;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- int max, size;
-
- if (XtIsRealized(w)) {
- if (x < 0) x = 0;
- else if (x > dsw->sw.scroll_h_max - dsw->sw.scroll_h_size) {
- x = dsw->sw.scroll_h_max - dsw->sw.scroll_h_size;
- }
- dsw->sw.scroll_h_value = x;
-
- if (y < 0) y = 0;
- else if (y > dsw->sw.scroll_v_max - dsw->sw.scroll_v_size) {
- y = dsw->sw.scroll_v_max - dsw->sw.scroll_v_size;
- }
- dsw->sw.scroll_v_value = y;
-
- if (!dsw->sw.application_scrolling) {
- XtVaSetValues(dsw->sw.h_scroll, XmNvalue, x, NULL);
- XtVaSetValues(dsw->sw.v_scroll, XmNvalue, y, NULL);
- }
-
- ScrollMoved(dsw);
- }
-}
-
-void DSWScrollTo(w, x, y)
- Widget w;
- long x, y;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.scroll_to) (w, x, y);
-}
-
-static void SetScaleAndScroll(w, scale, psX, psY, xX, xY)
- Widget w;
- double scale;
- double psX, psY;
- long xX, xY;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- Arg arg;
- union {
- int i;
- float f;
- } kludge;
-
- dsw->sw.use_saved_scroll = True;
- dsw->sw.scroll_pic_x = psX;
- dsw->sw.scroll_pic_y = psY;
- dsw->sw.scroll_win_x = xX;
- dsw->sw.scroll_win_y = xY;
-
- kludge.f = scale;
- arg.name = XtNscale;
- if (sizeof(float) > sizeof(XtArgVal)) arg.value = (XtArgVal) &kludge.f;
- else arg.value = (XtArgVal) kludge.i;
- XtSetValues(w, &arg, 1);
-}
-
-void DSWSetScaleAndScroll(w, scale, psX, psY, xX, xY)
- Widget w;
- double scale;
- double psX, psY;
- long xX, xY;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.set_scale_and_scroll) (w, scale, psX, psY, xX, xY);
-}
-
-static void ConvertXToPS(w, xX, xY, psX, psY)
- Widget w;
- long xX, xY;
- float *psX, *psY;
-{
- ConvertToPS((DPSScrolledWindowWidget) w, (float) xX, (float) xY, psX, psY);
-}
-
-void DSWConvertXToPS(w, xX, xY, psX, psY)
- Widget w;
- long xX, xY;
- float *psX, *psY;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.convert_x_to_ps) (w, xX, xY, psX, psY);
-}
-
-static void ConvertPSToX(w, psX, psY, xX, xY)
- Widget w;
- double psX, psY;
- int *xX, *xY;
-{
- ConvertToX((DPSScrolledWindowWidget) w, psX, psY, xX, xY);
-}
-
-void DSWConvertPSToX(w, psX, psY, xX, xY)
- Widget w;
- double psX, psY;
- int *xX, *xY;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.convert_ps_to_x) (w, psX, psY, xX, xY);
-}
-
-static void AddToDirtyArea(w, rect, n)
- Widget w;
- float *rect;
- long n;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (n == 1 && rect[0] == 0 && rect[1] == 0 &&
- rect[2] == -1 && rect[2] == -1) {
- rect[2] = dsw->sw.area_width;
- rect[3] = dsw->sw.area_height;
- }
-
- XtVaSetValues(w, XtNdirtyAreas, rect, XtNnumDirtyAreas, n, NULL);
-}
-
-void DSWAddToDirtyArea(w, rect, n)
- Widget w;
- float *rect;
- long n;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.add_to_dirty_area) (w, rect, n);
-}
-
-static Boolean TakeFeedbackPixmap(w, p, width, height, depth, screen)
- Widget w;
- Pixmap *p;
- int *width, *height, *depth;
- Screen **screen;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (dsw->sw.doing_feedback) return False;
-
- *p = dsw->sw.feedback_pixmap;
- if (*p == None) {
- *width = *height = *depth;
- *screen = NULL;
- return True;
- }
-
- *width = dsw->sw.feedback_width;
- *height = dsw->sw.feedback_height;
- *depth = dsw->sw.drawing_area->core.depth;
- *screen = dsw->core.screen;
-
- dsw->sw.feedback_pixmap = None;
- dsw->sw.feedback_width = dsw->sw.feedback_height = 0;
- return True;
-}
-
-Boolean DSWTakeFeedbackPixmap(w, p, width, height, depth, screen)
- Widget w;
- Pixmap *p;
- int *width, *height, *depth;
- Screen **screen;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- return (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.take_feedback_pixmap) (w, p, width, height,
- depth, screen);
-}
-
-static void StartFeedbackDrawing(w, start_feedback_data)
- Widget w;
- XtPointer start_feedback_data;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- float *r;
-
- FinishDrawing(dsw);
- CheckFeedbackPixmap(dsw);
- if (dsw->sw.feedback_pixmap != None) {
- /* Initialize the feedback pixmap with a copy of the drawing */
- GrowRectList(&dsw->sw.prev_dirty_areas, &dsw->sw.prev_dirty_areas_size,
- 0, 1, 1);
- r = dsw->sw.prev_dirty_areas;
- ConvertToPS(dsw, 0 + DELTA, dsw->sw.drawing_area->core.height - DELTA,
- r, r+1);
- ConvertToPS(dsw, dsw->sw.drawing_area->core.width - DELTA, 0 + DELTA,
- r+2, r+3);
- r[2] -= r[0];
- r[3] -= r[1];
- dsw->sw.num_prev_dirty_areas = 1;
-
- if (dsw->sw.backing_pixmap != None) {
- CopyToFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- (void) ClipAndDraw(dsw, DSWFeedbackPixmap, DSWFinish, True);
- }
- }
- dsw->sw.num_prev_dirty_areas = 0;
- dsw->sw.doing_feedback = True;
- dsw->sw.start_feedback_data = start_feedback_data;
-}
-
-void DSWStartFeedbackDrawing(w, start_feedback_data)
- Widget w;
- XtPointer start_feedback_data;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.start_feedback_drawing) (w, start_feedback_data);
-}
-
-static void EndFeedbackDrawing(w, restore)
- Widget w;
- Boolean restore;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (restore) {
- if (dsw->sw.backing_pixmap != None) {
- UpdateWindowFromBackingPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- (void) ClipAndDraw(dsw, DSWWindow, DSWFinish, True);
- }
- }
- if (dsw->sw.feedback_gstate != 0) {
- XDPSFreeContextGState(dsw->sw.context, dsw->sw.feedback_gstate);
- }
- dsw->sw.doing_feedback = dsw->sw.feedback_displayed = False;
-}
-
-void DSWEndFeedbackDrawing(w, restore)
- Widget w;
- Bool restore;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.end_feedback_drawing) (w, restore);
-}
-
-static void SetFeedbackDirtyArea(w, rects, count, continue_feedback_data)
- Widget w;
- float *rects;
- int count;
- XtPointer continue_feedback_data;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- int i;
- float *r;
-
- for (i = 0; i < count; i++) {
- r = rects + (i * 4);
- if (WIDTH(r) < 0) {
- LEFT(r) += WIDTH(r);
- WIDTH(r) = -WIDTH(r);
- }
- if (HEIGHT(r) < 0) {
- BOTTOM(r) += HEIGHT(r);
- HEIGHT(r) = -HEIGHT(r);
- }
- }
-
- if (dsw->sw.backing_pixmap != None) {
- if (dsw->sw.feedback_pixmap != None) {
- CopyToFeedbackPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- } else {
- UpdateWindowFromBackingPixmap(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- }
- } else {
- CopyRectsToCurrentDrawing(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- (void) ClipAndDraw(dsw, (dsw->sw.feedback_pixmap == None ?
- DSWWindow : DSWFeedbackPixmap),
- DSWFinish, True);
- }
- dsw->sw.continue_feedback_data = continue_feedback_data;
- CallFeedbackCallback(dsw, rects, count);
-
- if (dsw->sw.feedback_pixmap != None) {
- CopyRectsToDirtyArea(dsw, dsw->sw.prev_dirty_areas,
- dsw->sw.num_prev_dirty_areas);
- AddRectsToDirtyArea(dsw, rects, count);
- SimplifyRects(dsw->sw.dirty_areas, &dsw->sw.num_dirty_areas);
- UpdateWindowFromFeedbackPixmap(dsw, dsw->sw.dirty_areas,
- dsw->sw.num_dirty_areas);
- dsw->sw.num_dirty_areas = 0;
- }
- CopyRectsToPrevDirtyArea(dsw, rects, count);
- dsw->sw.feedback_displayed = True;
-}
-
-void DSWSetFeedbackDirtyArea(w, rects, count, continue_feedback_data)
- Widget w;
- float *rects;
- int count;
- XtPointer continue_feedback_data;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.set_feedback_dirty_area) (w, rects, count,
- continue_feedback_data);
-}
-
-static void FinishPendingDrawing(w)
- Widget w;
-{
- FinishDrawing((DPSScrolledWindowWidget) w);
-}
-
-void DSWFinishPendingDrawing(w)
- Widget w;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.finish_pending_drawing) (w);
-}
-
-static void AbortPendingDrawing(w)
- Widget w;
-{
- AbortDrawing((DPSScrolledWindowWidget) w);
-}
-
-void DSWAbortPendingDrawing(w)
- Widget w;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.abort_pending_drawing) (w);
-}
-
-static void UpdateDrawing(w, rects, count)
- Widget w;
- float *rects;
- int count;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
- int i;
- float *r;
- int llx, lly, urx, ury;
- int dx, dy;
-
- if (dsw->sw.backing_pixmap == None) {
- AddToDirtyArea(w, rects, count);
- return;
- }
-
- ComputeOffsets(dsw, &dx, &dy);
-
- for (i = 0; i < count; i++) {
- r = rects + (i * 4);
- ConvertToX(dsw, LEFT(r), BOTTOM(r), &llx, &lly);
- ConvertToX(dsw, RIGHT(r), TOP(r), &urx, &ury);
- XCopyArea(XtDisplay(dsw), XtWindow(dsw->sw.drawing_area),
- dsw->sw.backing_pixmap, dsw->sw.no_ge_gc,
- llx-1, ury-1, urx-llx+2, lly-ury+2, llx+dx-1, ury+dy-1);
- }
-}
-
-void DSWUpdateDrawing(w, rects, count)
- Widget w;
- float *rects;
- int count;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.update_drawing) (w, rects, count);
-}
-
-static void GetScrollInfo(w, h_value, h_size, h_max, v_value, v_size, v_max)
- Widget w;
- int *h_value, *h_size, *h_max, *v_value, *v_size, *v_max;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (h_value != NULL) *h_value = dsw->sw.scroll_h_value;
- if (h_size != NULL) *h_size = dsw->sw.scroll_h_size;
- if (h_max != NULL) *h_max = dsw->sw.scroll_h_max;
- if (v_value != NULL) *v_value = dsw->sw.scroll_v_value;
- if (v_size != NULL) *v_size = dsw->sw.scroll_v_size;
- if (v_max != NULL) *v_max = dsw->sw.scroll_v_max;
-}
-
-void DSWGetScrollInfo(w, h_value, h_size, h_max, v_value, v_size, v_max)
- Widget w;
- int *h_value, *h_size, *h_max, *v_value, *v_size, *v_max;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.get_scroll_info) (w, h_value, h_size, h_max,
- v_value, v_size, v_max);
-}
-
-static void GetDrawingInfo(w, type, drawable, gstate, context)
- Widget w;
- DSWDrawableType *type;
- Drawable *drawable;
- DPSGState *gstate;
- DPSContext *context;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (dsw->sw.backing_pixmap != None) {
- *type = DSWBackingPixmap;
- *drawable = dsw->sw.backing_pixmap;
- *gstate = dsw->sw.backing_gstate;
- } else {
- *type = DSWWindow;
- *drawable = XtWindow(dsw->sw.drawing_area);
- *gstate = dsw->sw.window_gstate;
- }
- *context = dsw->sw.context;
-}
-
-void DSWGetDrawingInfo(w, type, drawable, gstate, context)
- Widget w;
- DSWDrawableType *type;
- Drawable *drawable;
- DPSGState *gstate;
- DPSContext *context;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.get_drawing_info) (w, type, drawable, gstate, context);
-}
-
-static Boolean GiveFeedbackPixmap(w, p, width, height, depth, screen)
- Widget w;
- Pixmap p;
- int width, height, depth;
- Screen *screen;
-{
- DPSScrolledWindowWidget dsw = (DPSScrolledWindowWidget) w;
-
- if (depth != dsw->sw.drawing_area->core.depth ||
- screen != dsw->core.screen ||
- dsw->sw.feedback_pixmap != None) return False;
-
- dsw->sw.feedback_pixmap = p;
- dsw->sw.feedback_width = width;
- dsw->sw.feedback_height = height;
-
- return True;
-}
-
-Boolean DSWGiveFeedbackPixmap(w, p, width, height, depth, screen)
- Widget w;
- Pixmap p;
- int width, height, depth;
- Screen *screen;
-{
- XtCheckSubclass(w, dpsScrolledWindowWidgetClass, NULL);
-
- return (*((DPSScrolledWindowWidgetClass) XtClass(w))->
- sw_class.give_feedback_pixmap) (w, p, width, height,
- depth, screen);
-}
-
-static void ConvertToX(dsw, psX, psY, xX, xY)
- DPSScrolledWindowWidget dsw;
- float psX, psY;
- int *xX, *xY;
-{
- *xX = dsw->sw.ctm[0] * psX + dsw->sw.ctm[2] * psY + dsw->sw.ctm[4] +
- dsw->sw.x_offset + 0.5;
- *xY = dsw->sw.ctm[1] * psX + dsw->sw.ctm[3] * psY + dsw->sw.ctm[5] +
- dsw->sw.y_offset + 0.5;
-}
-
-static void ConvertToPS(dsw, xX, xY, psX, psY)
- DPSScrolledWindowWidget dsw;
- float xX, xY;
- float *psX, *psY;
-{
- xX -= dsw->sw.x_offset;
- xY -= dsw->sw.y_offset;
-
- *psX = dsw->sw.inv_ctm[0] * xX + dsw->sw.inv_ctm[2] * xY +
- dsw->sw.inv_ctm[4];
- *psY = dsw->sw.inv_ctm[1] * xX + dsw->sw.inv_ctm[3] * xY +
- dsw->sw.inv_ctm[5];
-}
-
-static void ConvertToOrigPS(dsw, xX, xY, psX, psY)
- DPSScrolledWindowWidget dsw;
- int xX, xY;
- float *psX, *psY;
-{
- xX -= dsw->sw.x_offset;
- xY -= dsw->sw.y_offset;
-
- *psX = dsw->sw.orig_inv_ctm[0] * xX + dsw->sw.orig_inv_ctm[2] * xY +
- dsw->sw.orig_inv_ctm[4];
- *psY = dsw->sw.orig_inv_ctm[1] * xX + dsw->sw.orig_inv_ctm[3] * xY +
- dsw->sw.orig_inv_ctm[5];
-}
diff --git a/xc/lib/dpstk/DSWwraps.psw b/xc/lib/dpstk/DSWwraps.psw
deleted file mode 100644
index 84c4268a4..000000000
--- a/xc/lib/dpstk/DSWwraps.psw
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DSWwraps.psw
- *
- * (c) Copyright 1993-1994 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
- */
-
-defineps _DPSSWGetTransform(DPSContext ctxt | float ctm[6], invctm[6])
- matrix currentmatrix dup ctm
- matrix invertmatrix invctm
-endps
-
-defineps _DPSSWSetMatrixAndGetTransform(DPSContext ctxt;
- float tx, ty, s; int hx, hy
- | float ctm[6], invctm[6]; int *xoffset, *yoffset)
- initmatrix
- tx ty translate
- s s scale
- hx hy sethalftonephase
- initclip
- matrix currentmatrix dup ctm
- matrix invertmatrix invctm
- currentXoffset yoffset xoffset
-endps
-
-defineps _DPSSWSetMatrix(DPSContext ctxt; float tx, ty, s; int hx, hy)
- initmatrix
- tx ty translate
- s s scale
- hx hy sethalftonephase
- initclip
-endps
-
-defineps _DPSSWSetRectViewClip(DPSContext ctxt;
- float numstring rect[numrect]; int numrect)
- rect rectviewclip
-endps
-
-defineps _DPSSWColormapMatch(DPSContext ctxt; int colormap | boolean *match)
- currentXgcdrawablecolor % gc draw x y [....colormap...]
- 10 get colormap eq match % gc draw x y
- pop pop pop pop
-endps
-
diff --git a/xc/lib/dpstk/FSBwraps.psw b/xc/lib/dpstk/FSBwraps.psw
deleted file mode 100644
index c36a0d78c..000000000
--- a/xc/lib/dpstk/FSBwraps.psw
+++ /dev/null
@@ -1,491 +0,0 @@
-/*
- * FSBwraps.psw
- *
- * (c) Copyright 1991-1994 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
- */
-
-defineps _DPSFClearWindow(DPSContext ctxt)
- 1 setgray
- 0 0 2000 2000 rectfill
-endps
-
-defineps _DPSFPreviewString(DPSContext ctxt; char *font; float size;
- char *text; int height | boolean *bogus)
- mark {
- /font size selectfont
- 0 height neg 5 div itransform
- exch pop 5 exch moveto
- 0 setgray
- (text) show
- } stopped bogus cleartomark
-endps
-
-defineps _DPSFReclip(DPSContext ctxt)
- initclip
- initviewclip
-endps
-
-defineps _DPSFUndefineFont(DPSContext ctxt; char *font; boolean oldServer)
- currentshared true setshared % currentshared
- {/font undefinefont} stopped % currentshared [font] stopped
- {
- false setshared % currentshared font
- {undefinefont} stopped {
- pop
- } if
- } if
- setshared
- oldServer { 2 vmreclaim } if
-endps
-
-defineps _DPSFDefineFontEnumFunctions(DPSContext ctxt)
- $Adobe$DPS$Lib$Dict begin
- /GetFontName { % int GetFontName string
- $Adobe$DPS$Lib$Dict /FontDict get begin
- dup maxItems div truncate cvi baseArray exch get
- exch maxItems mod get
- end
- } bind def
-
- % (str) x y SafeBBox left bottom right top
- /SafeBBox {
- 3 copy % (str) x y (str) x y
- newpath
- moveto % (str) x y (str)
- {
- mark exch false charpath flattenpath pathbbox
- } stopped {
- cleartomark
- 3 -1 roll dup length dup % x y (str) len len
- 1 le {
- pop
- % punt; we can't divide it any more
- 0 0 moveto stringwidth pop % x y wx
- dup 2 index add exch 3 index add exch
- } {
- 2 copy % x y (str) len (str) len
- 2 idiv % x y (str) len (str) len/2
- 0 exch % x y (str) len (str) 0 len/2
- getinterval dup % x y (str) len (s1) (s1)
- 5 index 5 index % x y (str) len (s1) (s1) x y
- $Adobe$DPS$Lib$Dict /SafeBBox get exec
- % x y (str) len (s1) l1 b1 r1 t1
- 9 4 roll % l1 b1 r1 t1 x y (str) len (s1)
- stringwidth % ... x y (str) len wx wy
- 5 -1 roll add exch % ... x (str) len y+wy wx
- 5 -1 roll add exch % ... (str) len x+wx y+wy
- 4 2 roll % ... x+wx y+wy (str) len
- dup 2 idiv % ... x+wx y+wy (str) len len/2
- exch 2 div ceiling cvi
- % ... x+wx y+wy (str) len/2 ceil(len/2)
- getinterval % ... x+wx y+wy (s2)
- 3 1 roll % ... (s2) x+wx y+wy
- $Adobe$DPS$Lib$Dict /SafeBBox get exec
- % l1 b1 r1 t1 l2 b2 r2 t2
- 5 -1 roll 2 copy % l1 b1 r1 l2 b2 r2 t2 t1 t2 t1
- gt {pop} {exch pop} ifelse % l1 b1 r1 l2 b2 r2 t
- 7 1 roll % t l1 b1 r1 l2 b2 r2
- 4 -1 roll 2 copy % t l1 b1 l2 b2 r2 r1 r2 r1
- gt {pop} {exch pop} ifelse % t l1 b1 l2 b2 r
- 6 1 roll % r t l1 b1 l2 b2
- 3 -1 roll 2 copy % r t l1 l2 b2 b1 b2 b1
- lt {pop} {exch pop} ifelse % r t l1 l2 b
- 5 1 roll % b r t l1 l2
- 2 copy % b r t l1 l2 l1 l2
- lt {pop} {exch pop} ifelse % b r t l
- 4 1 roll % l b r t
- } ifelse
- } { % mark (str) x y l b r t
- 8 -4 roll pop pop pop pop
- } ifelse
- } bind def
- /DownloadPS {
- $Adobe$DPS$Lib$Dict /downloadSuccess false put
- (%stdin) (r) file
- cvx stopped
- pop % always true
- % Flush until you get the magic line
- {
- {currentfile 256 string readline} stopped
- pop % don't care stopped result
- pop % don't care readline bool result
-(Magic end of data line \)\)\)\)\)\)\)\)\)\) 99#2 2#99 <xyz> // 7gsad,32h4ghNmndFgj2)
- eq
- {exit} if
- } loop
- } bind def
- end
-endps
-
-defineps _DPSFEnumFonts(DPSContext ctxt | int *count; int *totalLength)
- $Adobe$DPS$Lib$Dict begin
- /FontDict 5 dict def
- FontDict begin
- /currentItem 0 def
- /maxItems 100 def
- /maxArrays 20 def % This is the max index, not the array size!
- /baseArray maxArrays 1 add array def
- /currentArray 0 def
- baseArray 0 maxItems array put
- end
-
- /AddFontName { % string AddFontName success
- $Adobe$DPS$Lib$Dict /FontDict get begin
- 1 { % provides enclosing loop for exit
- currentItem maxItems eq
- {
- currentArray maxArrays eq {pop false exit} if
- /currentArray currentArray 1 add def
- baseArray currentArray maxItems array put
- /currentItem 0 def
- } if
- dup length string copy
- baseArray currentArray get currentItem 3 -1 roll put
- /currentItem currentItem 1 add def
- true
- } repeat % provides enclosing loop for exit
- end
- } bind def
-
- 3 dict begin
- /$listString 256 string def
- /countFonts 0 def
- /totalLen 0 def
-
- % Enumerate SharedFontDirectory
- SharedFontDirectory { % forall
- pop % /fontname
- $listString cvs % (fontname)
- dup AddFontName % (name) success
- {
- /countFonts countFonts 1 add def
- length 1 add totalLen add /totalLen exch def
- } {
- pop
- } ifelse
- } forall
-
- % Enumerate %font% storage device, if available.
- /filenameforall where { % if
- pop
- (%font%*) { % filenameforall
- % Check if name is something we really believe
- % is a font. Leave either "false" or "(name) true"
- % on stack
-
- % Discard filenames containing "."
- (.) search { % if
- pop pop pop null false
- } { % else
- dup % (%font%name) (%font%name)
- (%font%) anchorsearch { % if
- % (%font%name) (name) (%font%)
- pop exch pop % (name)
- dup AddFontName % (name) success
- } { % else
- pop null false
- } ifelse
- } ifelse
-
- % Stack is either "<something> false" or "(name) true"
- {
- /countFonts countFonts 1 add def
- length 1 add totalLen add /totalLen exch def
- } {
- pop
- } ifelse
- } $listString filenameforall
- } if
- totalLen totalLength countFonts count
- end
- end
-
- $Adobe$DPS$Lib$Dict /AddFontName undef
-endps
-
-defineps _DPSFGetAllFontNames(DPSContext ctxt; int fontCount; int arrLen |
- char fontNames[arrLen])
- $Adobe$DPS$Lib$Dict begin
- FontDict begin
- 0 1 fontCount 1 sub {
- GetFontName fontNames
- ( ) fontNames
- } for
- end
- end
-endps
-
-defineps _DPSFGetFontInfo(DPSContext ctxt; int fontNum; boolean oldServer |
- char *familyName; char *fullName; char *weight;
- boolean *blendedFont, *undefineIt, *bogus)
- fontNum $Adobe$DPS$Lib$Dict /GetFontName get exec
-
- dup dup % fontname fontname fontname
- SharedFontDirectory exch known % fontname fontname known
- dup undefineIt exch % fontname known fontname
- % (leave fontname and known on stack
- % for the duration of this call
- % even though I don't list them in
- % the comments)
- { % stopped
- findfont dup % fontdir fontdir
- /FontInfo known { % fontdir bool
- /FontInfo get dup dup % fontinfo fontinfo fontinfo
- /FamilyName known { % fontinfo fontinfo bool
- /FamilyName get % fontinfo (familyname)
- } {
- pop ()
- } ifelse
- exch dup dup % (familyname) fontinfo fontinfo fontinfo
- /FullName known { % (familyname) fontinfo fontinfo bool
- /FullName get % (familyname) fontinfo (fullname)
- } {
- pop ()
- } ifelse
- exch dup dup % (familyname) (fullname) fontinfo*3
- /Weight known { % (familyname) (fullname) fontinfo*2 bool
- /Weight get % (familyname) (fullname) fontinfo (weight)
- } {
- pop (Medium)
- } ifelse
- exch % (familyname) (fullname) (weight) fontinfo
- /BlendAxisTypes known % (familyname) (fullname) (weight) blendedFont
-
- dup blendedFont % (familyname) (fullname) (weight) blendedFont
- } {
- pop () () ()
- false false blendedFont
- } ifelse % (familyname) (fullname) (weight) blendedFont
- false bogus
-
- } stopped {
- () () ()
- false false blendedFont
- true bogus
- } if
-
- 4 1 roll % blendedFont (familyname) (fullname) (weight)
- weight fullName familyName
- % fontname known is still on the stack so...
- % fontname known blendedFont
-
- % if blendedFont (the bool on the stack) is true, don't undefine things
- % just yet since we'll be coming back quite soon for more stuff
-
- not and { % undefine font if we just defined
- % it to get this information
- currentshared true setshared
- exch % currentshared fontname
- {undefinefont} stopped % currentshared [fontname] stopped
- {
- false setshared % currentshared fontname
-
- {undefinefont} stopped {
- pop
- } if
- } if
- setshared
-
- oldServer {2 vmreclaim} if
- } {
- pop
- } ifelse
-endps
-
-defineps _DPSFFreeFontInfo(DPSContext ctxt)
- $Adobe$DPS$Lib$Dict /FontDict undef
- $Adobe$DPS$Lib$Dict /GetFontName undef
- 1 vmreclaim
-endps
-
-defineps _DPSFIsFontResident(DPSContext ctxt; char *name; | boolean *resident)
- SharedFontDirectory /name known {
- true resident
- } {
- /buf (name) length 6 add string def
- buf 0 (%font%) putinterval
- buf 6 (name) putinterval
- buf status dup resident { pop pop pop pop } if
- } ifelse
-endps
-
-defineps _DPSFGetBlendedFontInfo(DPSContext ctxt; int fontNum;
- boolean undefineIt; boolean oldServer |
- int *axes; int *designs;
- char axisNames[256];
- float blendPos[64]; int breakCount[4];
- int blendBreak[48]; float blendBreakValue[48];
- boolean *bogus)
-
- fontNum $Adobe$DPS$Lib$Dict /GetFontName get exec
- $Adobe$DPS$Lib$Dict /stringbuf 256 string put
- dup % duplicate fontname; we'll need it later
-
- findfont /FontInfo get dup % fontinfo fontinfo
- /BlendAxisTypes get % fontinfo array
- dup length axes % fontinfo array
- { % Concatenate all the names into axisNames
- $Adobe$DPS$Lib$Dict /stringbuf get cvs
- axisNames
- ( ) axisNames
- } forall
- dup dup % fontinfo fontinfo fontinfo
- /BlendDesignPositions known { % fontinfo fontinfo known
- /BlendDesignPositions get % fontinfo array
- dup length designs % fontinfo array
- { % enumerate the subarrays
- {
- blendPos
- } forall
- } forall
- false
- } {
- pop true
- } ifelse % fontinfo bool
- exch dup % bool fontinfo fontinfo
- /BlendDesignMap known { % bool fontinfo known
- /BlendDesignMap get % bool array
- {
- dup length % bool subarray len
- breakCount % bool subarray len
- {
- aload pop % bool break breakvalue
- blendBreakValue
- blendBreak
- } forall
- } forall
- false
- } {
- pop true
- } ifelse % bool bool
-
- or bogus
-
- undefineIt { % undefine font if we just defined
- % it to get this information
- currentshared true setshared
- exch % currentshared fontname
- {undefinefont} stopped % currentshared [fontname] stopped
- {
- false setshared % currentshared fontname
-
- {undefinefont} stopped {
- pop
- } if
- } if
- setshared
- oldServer { 2 vmreclaim } if
- } {
- pop
- } ifelse
- $Adobe$DPS$Lib$Dict /stringbuf undef
-endps
-
-defineps _DPSFShowText(DPSContext ctxt; char *text; char *font; float size;
- int x, y | boolean *bogus)
- mark {
- /font size selectfont
- x y moveto
- (text) show
- } stopped dup bogus cleartomark
-endps
-
-defineps _DPSFShowTextAndGetDimensions(DPSContext ctxt;
- char *text; char *font; float size;
- int x, y |
- float *width, *left, *right,
- *top, *bottom)
- mark {
- /font size selectfont
- x y moveto
- (text) show
- (text) stringwidth pop width
- (text) x y $Adobe$DPS$Lib$Dict /SafeBBox get exec
- } stopped {0 0 0 0} if
- top right bottom left
- cleartomark
-endps
-
-defineps _DPSFGetTextDimensions(DPSContext ctxt;
- char *text; char *font; float size;
- float x, y |
- float *width, *height,
- *left, *right, *top, *bottom;
- boolean *bogus)
- mark {
- /font size selectfont
- (text) stringwidth height width
-
- (text) x y $Adobe$DPS$Lib$Dict /SafeBBox get exec
- } stopped dup bogus {0 0 0 0} if
- top right bottom left
- cleartomark
-endps
-
-defineps _DPSFGetCTM(DPSContext ctx | float ctm[6], invctm[6])
- matrix currentmatrix dup ctm matrix invertmatrix invctm
-endps
-
-defineps _DPSFSetUpMM(DPSContext ctxt; char *font, *str; float size;
- int height; float p[n]; int n | boolean *bogus)
- userdict /fontDefined known {
- /tempfont undefinefont
- } if
- mark {
- /tempfont /font findfont p makeblendedfont definefont
- size scalefont setfont
- 0 height neg 5 div itransform
- exch pop 5 exch moveto
- (str) stringwidth pop pop
- /fontDefined true def
- } stopped bogus cleartomark
-endps
-
-defineps _DPSFDrawMM(DPSContext ctxt; char *str; int height)
- 0 height neg 5 div itransform
- exch pop 5 exch moveto
- (str) show
-endps
-
-defineps _DPSFPrepareToDownload(DPSContext ctxt; boolean makeShared |
- boolean *currShared)
- $Adobe$DPS$Lib$Dict /DownloadPS get
- currentshared currShared makeShared setshared
-endps
-
-defineps _DPSFFinishDownload(DPSContext ctxt; boolean shared | boolean *ok)
- shared setshared
- $Adobe$DPS$Lib$Dict /downloadSuccess get ok
-endps
diff --git a/xc/lib/dpstk/FontCreato.c b/xc/lib/dpstk/FontCreato.c
deleted file mode 100644
index 31a927b28..000000000
--- a/xc/lib/dpstk/FontCreato.c
+++ /dev/null
@@ -1,1643 +0,0 @@
-/*
- * FontCreato.c
- *
- * (c) Copyright 1992-1994 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
- */
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <X11/ShellP.h>
-#include <Xm/Xm.h>
-
-/* There are no words to describe how I feel about having to do this */
-
-#if XmVersion > 1001
-#include <Xm/ManagerP.h>
-#else
-#include <Xm/XmP.h>
-#endif
-
-#include <Xm/Form.h>
-#include <Xm/LabelG.h>
-#include <Xm/PushBG.h>
-#include <Xm/DrawingA.h>
-#include <Xm/Scale.h>
-#include <Xm/MessageB.h>
-#include <Xm/TextF.h>
-#include <Xm/PanedW.h>
-#include <Xm/List.h>
-#include <Xm/SeparatoG.h>
-#include <Xm/ToggleBG.h>
-#include <Xm/RowColumn.h>
-#include <DPS/dpsXclient.h>
-#include <DPS/dpsXshare.h>
-#include <DPS/FontSBP.h>
-#include <DPS/FontCreatP.h>
-#include <stdlib.h>
-#include <math.h>
-#include "FontSBI.h"
-#include "FSBwraps.h"
-
-/* Turn a string into a compound string */
-#define UnsharedCS(str) XmStringCreate(str, XmSTRING_DEFAULT_CHARSET)
-#define CS(str, w) _FSBCreateSharedCS(str, w)
-static XmString CSempty;
-static char *opticalSize = NULL;
-
-#define Canonical(str) XrmQuarkToString(XrmStringToQuark(str))
-
-static float defaultSizeList[] = {
-#ifndef CREATOR_DEFAULT_SIZE_LIST
- 8, 10, 12, 14, 16, 18, 24, 36, 48, 72
-#else
- CREATOR_DEFAULT_SIZE_LIST
-#endif /* CREATOR_DEFAULT_SIZE_LIST */
-};
-
-#ifndef CREATOR_DEFAULT_SIZE_LIST_COUNT
-#define CREATOR_DEFAULT_SIZE_LIST_COUNT 10
-#endif /* CREATOR_DEFAULT_SIZE_LIST_COUNT */
-
-#define Offset(field) XtOffsetOf(FontCreatorRec, creator.field)
-
-static XtResource resources[] = {
- {XtNsizes, XtCSizes, XtRFloatList, sizeof(float*),
- Offset(sizes), XtRImmediate, (XtPointer) defaultSizeList},
- {XtNsizeCount, XtCSizeCount, XtRInt, sizeof(int),
- Offset(size_count), XtRImmediate,
- (XtPointer) CREATOR_DEFAULT_SIZE_LIST_COUNT},
- {XtNdismissCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(dismiss_callback), XtRCallback, (XtPointer) NULL},
- {XtNfontSelectionBox, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(fsb), XtRWidget, (XtPointer) NULL},
-};
-
-/* Forward declarations */
-
-static void ClassInitialize(), Initialize(), Destroy(),
- ChangeManaged(), Resize();
-static Boolean SetValues();
-static XtGeometryResult GeometryManager();
-
-FontCreatorClassRec fontCreatorClassRec = {
- /* Core class part */
- {
- /* superclass */ (WidgetClass) &xmManagerClassRec,
- /* class_name */ "FontCreator",
- /* widget_size */ sizeof(FontCreatorRec),
- /* class_initialize */ ClassInitialize,
- /* class_part_initialize */ NULL,
- /* class_inited */ FALSE,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ TRUE,
- /* compress_exposure */ XtExposeCompressMultiple,
- /* compress_enterleave */ TRUE,
- /* visible_interest */ FALSE,
- /* destroy */ Destroy,
- /* resize */ Resize,
- /* expose */ NULL,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ XtInheritQueryGeometry,
- /* display_accelerator */ NULL,
- /* extension */ NULL,
- },
- /* Composite class part */
- {
- /* geometry_manager */ GeometryManager,
- /* change_managed */ ChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL,
- },
- /* Constraint class part */
- {
- /* resources */ NULL,
- /* num_resources */ 0,
- /* constraint_size */ 0,
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ NULL,
- /* extension */ NULL,
- },
- /* Manager class part */
- {
- /* translations */ XtInheritTranslations,
- /* syn_resources */ NULL,
- /* num_syn_resources */ 0,
- /* syn_constraint_resources */ NULL,
- /* num_syn_constraint_resources */ 0,
- /* parent_process */ XmInheritParentProcess,
- /* extension */ NULL,
- },
- /* FontCreator class part */
- {
- /* extension */ NULL,
- }
-};
-
-WidgetClass fontCreatorWidgetClass =
- (WidgetClass) &fontCreatorClassRec;
-
-static void ClassInitialize()
-{
- XtInitializeWidgetClass(fontSelectionBoxWidgetClass);
-
- CSempty = UnsharedCS("");
- opticalSize = Canonical("OpticalSize");
-}
-
-/* ARGSUSED */
-
-static void ResizePreview(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- Dimension height;
- Cardinal depth;
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- if (!XtIsRealized(widget) || fc->creator.gstate == 0) return;
-
- XtVaGetValues(widget, XmNheight, &height,
- XmNdepth, &depth, NULL);
-
- XDPSSetContextGState(fc->creator.fsb->fsb.context, fc->creator.gstate);
-
- XDPSSetContextParameters(fc->creator.fsb->fsb.context, XtScreen(widget),
- depth, XtWindow(widget), height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextScreenDepth | XDPSContextDrawable);
-
- _DPSFReclip(fc->creator.fsb->fsb.context);
-
- XDPSUpdateContextGState(fc->creator.fsb->fsb.context, fc->creator.gstate);
-}
-
-static void DrawMM(fc)
- FontCreatorWidget fc;
-{
- int i, j;
- String str;
- float p[MAX_AXES];
- float b[MAX_BLENDS];
- int val;
- float size;
- char *chSize;
- DPSContext context;
- Dimension hgt;
- BlendDataRec *bd = fc->creator.font->blend_data;
- float total;
- int bogusFont;
-
- str = XmTextFieldGetString(fc->creator.display_text_child);
-
- for (i = 0; i < bd->num_axes; i++) {
- XtVaGetValues(fc->creator.axis_scale_child[i], XmNvalue, &val, NULL);
- p[i] = _FSBNormalize(val, bd, i);
- }
-
- XtVaGetValues(fc->creator.preview_child, XtNheight, &hgt, NULL);
- context = fc->creator.fsb->fsb.context;
- if (fc->creator.gstate == 0) {
- XDPSSetContextDrawable(context,
- XtWindow(fc->creator.preview_child), hgt);
- XDPSCaptureContextGState(context, &fc->creator.gstate);
- } else XDPSSetContextGState(context, fc->creator.gstate);
-
- /* Force b[0] to be 1 - total(b[1..n]) to avoid round-off error */
-
- total = 0.0;
- for (i = 1; i < bd->num_designs; i++) {
- b[i] = 1.0;
- for (j = 0; j < bd->num_axes; j++) {
- if (bd->design_positions[i*bd->num_axes + j] == 1.0) b[i] *= p[j];
- else b[i] *= 1.0 - p[j];
- }
- total += b[i];
- }
- b[0] = 1.0 - total;
-
- XtVaGetValues(fc->creator.size_text_field_child,
- XmNvalue, &chSize, NULL);
-
- if (chSize == NULL || *chSize == '\0') return;
- size = atof(chSize);
-
- _DPSFSetUpMM(context, fc->creator.font->font_name,
- str, size, hgt, b, bd->num_designs, &bogusFont);
- DPSWaitContext(context);
- XClearWindow(XtDisplay(fc->creator.preview_child),
- XtWindow(fc->creator.preview_child));
- _DPSFDrawMM(context, str, hgt);
-}
-
-/* ARGSUSED */
-
-static void DrawMMCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- DrawMM(fc);
-}
-
-/* ARGSUSED */
-
-static void ExposeCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- XmDrawingAreaCallbackStruct *dac =
- (XmDrawingAreaCallbackStruct *) callData;
-
- if (!fc->creator.preview_fixed) {
- XSetWindowAttributes att;
- att.bit_gravity = ForgetGravity;
- XChangeWindowAttributes(XtDisplay(fc),
- XtWindow(fc->creator.preview_child),
- CWBitGravity, &att);
- fc->creator.preview_fixed = TRUE;
- }
-
- if (dac != NULL && dac->event->type == Expose &&
- dac->event->xexpose.count != 0) return;
-
- DrawMM(fc);
-}
-
-static void SetUpBlendList(fc)
- FontCreatorWidget fc;
-{
- XmString *CSblends;
- int count, i;
- BlendRec *b;
- char buf[256];
- FontRec *f = fc->creator.font;
-
- sprintf(buf, "%s Blends", f->face_name);
- XtVaSetValues(fc->creator.blend_label_child,
- XtVaTypedArg, XmNlabelString, XtRString,
- buf, strlen(buf)+1,
- NULL);
-
- if (f->blend_count == 0) {
- count = 1;
- CSblends = &CSempty;
-
- } else {
- count = f->blend_count;
- CSblends = (XmString *) XtCalloc(count, sizeof(XmString));
-
- for (i = 0, b = f->blend_data->blends; i < f->blend_count;
- i++, b = b->next) {
- CSblends[i] = b->CS_blend_name;
- }
- }
-
- XtVaSetValues(fc->creator.blend_scrolled_list_child, XmNitemCount, count,
- XmNitems, CSblends, NULL);
-
- if (f->blend_count != 0) XtFree((XtPointer) CSblends);
-}
-
-static void CalcCarryValues(fc, oldf, carry_values)
- FontCreatorWidget fc;
- FontRec *oldf;
- int *carry_values;
-{
- FontRec *f = fc->creator.font;
- BlendDataRec *bd = f->blend_data, *oldbd = oldf->blend_data;
- int i, j;
-
- for (i = 0; i < bd->num_axes; i++) {
- carry_values[i] = -1;
- for (j = 0; j < oldbd->num_axes; j++) {
- if (bd->name[i] == oldbd->name[j]) {
- XmScaleGetValue(fc->creator.axis_scale_child[j],
- carry_values+i);
- break;
- }
- }
- }
-}
-
-static void SetUpAxisLabels(fc, oldf, carry_values)
- FontCreatorWidget fc;
- FontRec *oldf;
- int *carry_values;
-{
- int i;
- char buf[20];
- XmString cs;
- BlendDataRec *bd = fc->creator.font->blend_data, *oldbd;
- char *value;
-
- if (oldf != NULL) oldbd = oldf->blend_data;
-
- for (i = 0; i < bd->num_axes; i++) {
- if (oldf == NULL || i >= oldbd->num_axes ||
- oldbd->name[i] != bd->name[i]) {
- cs = UnsharedCS(bd->name[i]);
- XtVaSetValues(fc->creator.axis_label_child[i],
- XmNlabelString, cs, NULL);
- XmStringFree(cs);
- }
- if (oldf == NULL || i >= oldbd->num_axes ||
- oldbd->min[i] != bd->min[i]) {
- sprintf(buf, "%d", bd->min[i]);
- cs = UnsharedCS(buf);
- XtVaSetValues(fc->creator.axis_min_label_child[i],
- XmNlabelString, cs, NULL);
- XmStringFree(cs);
- }
- if (oldf == NULL || i >= oldbd->num_axes ||
- oldbd->max[i] != bd->max[i]) {
- sprintf(buf, "%d", bd->max[i]);
- cs = UnsharedCS(buf);
- XtVaSetValues(fc->creator.axis_max_label_child[i],
- XmNlabelString, cs, NULL);
- XmStringFree(cs);
- }
- if (oldf == NULL || carry_values[i] == -1) {
- if (bd->name[i] == opticalSize &&
- XmToggleButtonGadgetGetState(
- fc->creator.follow_size_toggle_child)) {
- XtVaGetValues(fc->creator.fsb->fsb.size_text_field_child,
- XmNvalue, &value, NULL);
- if (value == NULL || *value == '\0') {
- carry_values[i] = bd->min[i];
- } else carry_values[i] = atof(value) + 0.5;
- } else carry_values[i] = bd->min[i];
- }
- if (carry_values[i] < bd->min[i]) carry_values[i] = bd->min[i];
- else if (carry_values[i] > bd->max[i]) carry_values[i] = bd->max[i];
- XtVaSetValues(fc->creator.axis_scale_child[i],
- XmNminimum, bd->min[i], XmNmaximum, bd->max[i],
- XmNvalue, carry_values[i], NULL);
- }
-}
-
-static void ManageAxes(fc)
- FontCreatorWidget fc;
-{
- Widget w[5*MAX_AXES];
- int i, j;
- int diff;
-
- diff = fc->creator.managed_axes - fc->creator.font->blend_data->num_axes;
-
- if (diff == 0) return;
-
- if (diff < 0) {
- for (i = fc->creator.managed_axes, j=0; j < -diff * 5; i++, j+=5) {
- w[j] = fc->creator.axis_label_child[i];
- w[j+1] = fc->creator.axis_scale_child[i];
- w[j+2] = fc->creator.axis_value_text_child[i];
- w[j+3] = fc->creator.axis_min_label_child[i];
- w[j+4] = fc->creator.axis_max_label_child[i];
- }
- XtManageChildren(w, -diff * 5);
- } else {
- for (i = fc->creator.font->blend_data->num_axes, j=0; j < diff * 5;
- i++, j+=5) {
- w[j] = fc->creator.axis_label_child[i];
- w[j+1] = fc->creator.axis_scale_child[i];
- w[j+2] = fc->creator.axis_value_text_child[i];
- w[j+3] = fc->creator.axis_min_label_child[i];
- w[j+4] = fc->creator.axis_max_label_child[i];
- }
- XtUnmanageChildren(w, diff * 5);
- }
- fc->creator.managed_axes = fc->creator.font->blend_data->num_axes;
-}
-
-static void SetScaleValues(fc)
- FontCreatorWidget fc;
-{
- int val;
- char buf[32];
- int i, axes;
-
- axes = fc->creator.font->blend_data->num_axes;
-
- for (i = 0; i < axes; i++) {
- XmScaleGetValue(fc->creator.axis_scale_child[i], &val);
- sprintf(buf, "%d", val);
- XmTextFieldSetString(fc->creator.axis_value_text_child[i], buf);
- }
-}
-
-static void SetUpAxes(fc, oldf)
- FontCreatorWidget fc;
- FontRec *oldf;
-{
- int carry_values[MAX_AXES];
-
- if (oldf != NULL) CalcCarryValues(fc, oldf, carry_values);
- SetUpAxisLabels(fc, oldf, carry_values);
- SetScaleValues(fc);
- ManageAxes(fc);
-}
-
-/* ARGSUSED */
-
-static void FaceSelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmListCallbackStruct *listCB = (XmListCallbackStruct *) callData;
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- FontRec *f, *oldf = fc->creator.font;
- int i;
-
- i = 0;
- f = fc->creator.family->fonts;
- while (f != NULL) {
- if (f->blend_data != NULL) i++;
- if (i == listCB->item_position) break;
- f = f->next;
- }
-
- if (f == NULL) return;
- if (!_FSBDownloadFontIfNecessary(f, fc->creator.fsb)) {
- _FSBFlushFont(fc->creator.fsb, f);
- return;
- }
- if (fc->creator.font != NULL) fc->creator.font->in_font_creator = False;
- fc->creator.font = f;
- f->in_font_creator = True;
- SetUpBlendList(fc);
- SetUpAxes(fc, oldf);
-
- DrawMM(fc);
-}
-
-static void HandleSelectedBlend(fc, n)
- FontCreatorWidget fc;
- int n;
-{
- BlendDataRec *bd = fc->creator.font->blend_data;
- BlendRec *b;
- int i;
- int value;
- char buf[32];
-
- b = bd->blends;
- /* List uses 1-based addressing!! */
- for (i = 1; i < n; i++) b = b->next;
-
- XmTextFieldSetString(fc->creator.name_text_child, b->blend_name);
-
- for (i = 0; i < bd->num_axes; i++) {
- value = _FSBUnnormalize(b->data[i], bd, i);
- XmScaleSetValue(fc->creator.axis_scale_child[i], value);
- sprintf(buf, "%d", value);
- XmTextFieldSetString(fc->creator.axis_value_text_child[i], buf);
- }
-}
-
-/* ARGSUSED */
-
-static void BlendSelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmListCallbackStruct *listCB = (XmListCallbackStruct *) callData;
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- if (fc->creator.font->blend_count == 0) return;
-
- HandleSelectedBlend(fc, listCB->item_position);
-
- DrawMM(fc);
-}
-
-/* ARGSUSED */
-
-static void SetValue(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmScaleCallbackStruct *scaleData = (XmScaleCallbackStruct *) callData;
- Widget text = (Widget) clientData;
- char buf[32];
-
- sprintf(buf, "%d", scaleData->value);
- XmTextFieldSetString(text, buf);
-}
-
-/* ARGSUSED */
-
-static void SetScale(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- Widget scale = (Widget) clientData;
- char *value;
- int val, min, max;
- char buf[32];
-
- value = XmTextFieldGetString(widget);
- val = atoi(value);
- XtVaGetValues(scale, XmNminimum, &min, XmNmaximum, &max, NULL);
- if (val < min) val = min;
- if (val > max) val = max;
- XmScaleSetValue(scale, val);
-
- /* Handle range and illegal characters this way...*/
-
- sprintf(buf, "%d", val);
- XmTextFieldSetString(widget, buf);
-}
-
-/* ARGSUSED */
-
-static void DeleteMessage(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XtDestroyWidget(widget);
-}
-
-static void PutUpDialog(fc, name)
- FontCreatorWidget fc;
- char *name;
-{
- Widget message, w;
-
- message = XmCreateInformationDialog((Widget) fc, name, (ArgList) NULL, 0);
- w = XmMessageBoxGetChild(message, XmDIALOG_CANCEL_BUTTON);
- XtUnmanageChild(w);
- w = XmMessageBoxGetChild(message, XmDIALOG_HELP_BUTTON);
- XtUnmanageChild(w);
- XtAddCallback(message, XmNokCallback, DeleteMessage, (XtPointer) NULL);
-
- XtManageChild(message);
-}
-
-static void NoName(fc)
- FontCreatorWidget fc;
-{
- PutUpDialog(fc, "noNameMessage");
-}
-
-static void UsedName(fc)
- FontCreatorWidget fc;
-{
- PutUpDialog(fc, "usedNameMessage");
-}
-
-static void SomeUsedName(fc)
- FontCreatorWidget fc;
-{
- PutUpDialog(fc, "someUsedNameMessage");
-}
-
-static void NoSuchName(fc)
- FontCreatorWidget fc;
-{
- PutUpDialog(fc, "noSuchNameMessage");
-}
-
-static Boolean DoAdd(fc, f, name)
- FontCreatorWidget fc;
- FontRec *f;
- String name;
-{
- char *spaceName;
- BlendRec *b, *newb, **last;
- BlendDataRec *bd = f->blend_data;
- int val[MAX_AXES], i;
-
- for (b = bd->blends; b != NULL; b = b->next) {
- if (strcmp(name, b->blend_name) == 0) return True;
- }
-
- newb = (BlendRec *) XtMalloc(sizeof(BlendRec));
- newb->blend_name = Canonical(name);
- newb->CS_blend_name = CS(newb->blend_name, (Widget) fc);
-
- spaceName = (char *) XtMalloc(strlen(name) + 4);
- spaceName[0] = spaceName[1] = spaceName[2] = ' ';
- strcpy(spaceName+3, name);
- newb->CS_space_blend_name = CS(spaceName, (Widget) fc);
- XtFree((XtPointer) spaceName);
-
- for (i = 0; i < bd->num_axes; i++) {
- XtVaGetValues(fc->creator.axis_scale_child[i],
- XmNvalue, val+i, NULL);
- newb->data[i] = _FSBNormalize(val[i], bd, i);
- }
- for (/**/; i < MAX_AXES; i++) newb->data[i] = 0.0;
-
- newb->font_name = _FSBGenFontName(f->font_name, val, bd);
-
- f->blend_count++;
- fc->creator.family->blend_count++;
-
- last = &bd->blends;
- for (b = bd->blends; b != NULL; b = b->next) {
- if (strcmp(name, b->blend_name) < 0) break;
- last = &b->next;
- }
- newb->next = b;
- *last = newb;
-
- SetUpBlendList(fc);
- _FSBSetUpFaceList(fc->creator.fsb, False);
- return False;
-}
-
-/* ARGSUSED */
-
-static void AddCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- char *value;
- FontRec *f;
- Boolean failures = False;
- BlendDataRec *bd = fc->creator.font->blend_data;
- int i;
-
- value = XmTextFieldGetString(fc->creator.name_text_child);
-
- if (value == NULL || *value == '\0') {
- NoName(fc);
- return;
- }
-
- if (XmToggleButtonGadgetGetState(fc->creator.do_all_toggle_child)) {
- for (f = fc->creator.family->fonts; f != NULL; f = f->next) {
- if (f->blend_data != NULL &&
- f->blend_data->num_axes == bd->num_axes) {
- for (i = 0; i < bd->num_axes; i++) {
- if (f->blend_data->name[i] != bd->name[i]) break;
- }
- if (i == bd->num_axes) failures |= DoAdd(fc, f, value);
- }
- }
- if (failures) SomeUsedName(fc);
- } else if (DoAdd(fc, fc->creator.font, value)) UsedName(fc);
-}
-
-static Boolean DoReplace(fc, f, name)
- FontCreatorWidget fc;
- FontRec *f;
- String name;
-{
- BlendDataRec *bd = f->blend_data;
- BlendRec *b;
- int val[MAX_AXES], i;
-
- name = Canonical(name);
- for (b = bd->blends; b != NULL; b = b->next) {
- if (name == b->blend_name) {
- for (i = 0; i < bd->num_axes; i++) {
- XtVaGetValues(fc->creator.axis_scale_child[i],
- XmNvalue, val+i, NULL);
- b->data[i] = _FSBNormalize(val[i], bd, i);
- }
- b->font_name = _FSBGenFontName(f->font_name, val, bd);
- if (fc->creator.fsb->fsb.currently_selected_blend == b) {
- _FSBSetUpFaceList(fc->creator.fsb, True);
- }
- return False;
- }
- }
- return True;
-}
-
-/* ARGSUSED */
-
-static void ReplaceCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- char *value;
- FontRec *f;
- Boolean failures = True;
- BlendDataRec *bd = fc->creator.font->blend_data;
- int i;
-
- value = XmTextFieldGetString(fc->creator.name_text_child);
-
- if (value == NULL || *value == '\0') {
- NoName(fc);
- return;
- }
-
- if (XmToggleButtonGadgetGetState(fc->creator.do_all_toggle_child)) {
- for (f = fc->creator.family->fonts; f != NULL; f = f->next) {
- if (f->blend_data != NULL &&
- f->blend_data->num_axes == bd->num_axes) {
- for (i = 0; i < bd->num_axes; i++) {
- if (f->blend_data->name[i] != bd->name[i]) break;
- }
- if (i == bd->num_axes) failures &= DoReplace(fc, f, value);
- }
- }
- if (failures) NoSuchName(fc);
- } else if (DoReplace(fc, fc->creator.font, value)) NoSuchName(fc);
-}
-
-static Boolean DoDelete(fc, f, name)
- FontCreatorWidget fc;
- FontRec *f;
- String name;
-{
- BlendDataRec *bd = f->blend_data;
- BlendRec *b, *oldb;
- Boolean current = FALSE;
-
- name = Canonical(name);
- for (b = bd->blends, oldb = NULL; b != NULL; oldb = b, b = b->next) {
- if (name == b->blend_name) {
- if (oldb == NULL) bd->blends = b->next;
- else oldb->next = b->next;
- if (fc->creator.fsb->fsb.currently_selected_blend == b) {
- fc->creator.fsb->fsb.currently_selected_blend = NULL;
- current = TRUE;
- }
- XtFree((XtPointer) b);
- f->blend_count--;
- fc->creator.family->blend_count--;
- SetUpBlendList(fc);
- _FSBSetUpFaceList(fc->creator.fsb, current);
- return False;
- }
- }
- return True;
-}
-
-/* ARGSUSED */
-
-static void DeleteCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- char *value;
- FontRec *f;
- Boolean failures = True;
-
- value = XmTextFieldGetString(fc->creator.name_text_child);
-
- if (value == NULL || *value == '\0') {
- NoName(fc);
- return;
- }
-
- if (XmToggleButtonGadgetGetState(fc->creator.do_all_toggle_child)) {
- for (f = fc->creator.family->fonts; f != NULL; f = f->next) {
- if (f->blend_data != NULL) {
- failures &= DoDelete(fc, f, value);
- }
- }
- if (failures) NoSuchName(fc);
- } else if (DoDelete(fc, fc->creator.font, value)) NoSuchName(fc);
-}
-
-/* ARGSUSED */
-
-static void UnmanageOptions(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- XtUnmanageChild(fc->creator.option_box);
-}
-
-/* ARGSUSED */
-
-static void ShowOptions(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- XtManageChild(fc->creator.option_box);
-}
-
-/* ARGSUSED */
-
-static void GenerateCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- BlendDataRec *bd = fc->creator.font->blend_data;
- int i, val[MAX_AXES];
- char nameBuf[256];
- char *ch;
-
- for (i = 0; i < bd->num_axes; i++) {
- XtVaGetValues(fc->creator.axis_scale_child[i],
- XmNvalue, val+i, NULL);
- }
-
- ch = nameBuf;
-
- for (i = 0; i < bd->num_axes - 1; i++) {
- sprintf(ch, "%d ", val[i]);
- ch = ch + strlen(ch);
- }
-
- sprintf(ch, "%d", val[bd->num_axes - 1]);
-
- XmTextFieldSetString(fc->creator.name_text_child, nameBuf);
-}
-
-/* ARGSUSED */
-
-static void DismissCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- if (XtIsShell(XtParent(fc))) XtPopdown(XtParent(fc));
- XtCallCallbackList(widget, fc->creator.dismiss_callback, (XtPointer) NULL);
-}
-
-/* ARGSUSED */
-
-static void SizeChanged(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- String value;
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- int size;
- FontRec *f = fc->creator.font;
- BlendDataRec *bd;
- int i;
- char buf[32];
-
- if (f == NULL || f->blend_data == NULL) return;
-
- /* See if we have an optical size scale */
- bd = f->blend_data;
-
- for (i = 0; i < bd->num_axes; i++) {
- if (bd->name[i] == opticalSize) break;
- }
- if (i == bd->num_axes) return;
-
- if (!XmToggleButtonGadgetGetState(fc->creator.follow_size_toggle_child)) {
- return;
- }
-
- XtVaGetValues(widget, XmNvalue, &value, NULL);
-
- if (value == NULL || *value == '\0') return;
- size = atof(value) + 0.5;
- sprintf(buf, "%d", size);
- XmTextFieldSetString(fc->creator.axis_value_text_child[i], buf);
-
- SetScale(fc->creator.axis_value_text_child[i],
- (XtPointer) fc->creator.axis_scale_child[i], (XtPointer) NULL);
- DrawMM(fc);
-}
-
-/* There's a problem; sometimes the change has already been made in the field,
- and sometimes it hasn't. The times when it has seem to correspond to
- making changes with the size option menu, so we use this disgusting
- global flag to notice when this happens. We also use this to tell whether
- or not the change is coming from internal to the widget or as a result
- of user interaction. */
-
-static Boolean changingSize = False;
-
-/* ARGSUSED */
-
-static void SizeSelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- String value;
- Widget option;
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
- char *ch;
-
- XtVaGetValues(widget, XmNvalue, &value, NULL);
-
- if (value == NULL) option = fc->creator.other_size;
- else {
- for (ch = value; *ch != '\0'; ch++) if (*ch == '.') *ch = '-';
-
- option = XtNameToWidget(fc->creator.size_menu, value);
- if (option == NULL) option = fc->creator.other_size;
- }
-
- XtVaSetValues(fc->creator.size_option_menu_child,
- XmNmenuHistory, option, NULL);
-}
-
-/* ARGSUSED */
-
-static void TextVerify(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmTextVerifyPtr v = (XmTextVerifyPtr) callData;
- char ch, *cp;
- int decimalPoints = 0;
- int i;
-
- if (changingSize) return; /* We know what we're doing; allow it */
-
- /* Should probably look at format field, but seems to contain garbage */
-
- if (v->text->length == 0) return;
-
- for (i = 0; i < v->text->length; i++) {
- ch = v->text->ptr[i];
- if (ch == '.') decimalPoints++;
- else if (!isdigit(ch)) {
- v->doit = False;
- return;
- }
- }
-
- if (decimalPoints > 1) {
- v->doit = False;
- return;
- }
-
- XtVaGetValues(widget, XmNvalue, &cp, NULL);
-
- for (/**/; *cp != '\0'; cp++) {
- if (*cp == '.') decimalPoints++;
- }
-
- if (decimalPoints > 1) v->doit = False;
-}
-
-/* ARGSUSED */
-
-static void SetSize(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- char buf[20];
- char *ch;
- FontCreatorWidget fc = (FontCreatorWidget) clientData;
-
- strcpy(buf, XtName(widget));
- for (ch = buf; *ch != '\0'; ch++) if (*ch == '-') *ch++ = '.';
-
- changingSize = True;
- XtVaSetValues(fc->creator.size_text_field_child, XmNvalue, buf, NULL);
- changingSize = False;
-}
-
-/* This makes sure the selected item is visible */
-
-static void ListSelectPos(w, pos, notify)
- Widget w;
- int pos;
- Boolean notify;
-{
- int topPos, items, visible;
-
- XmListSelectPos(w, pos, notify);
-
- XtVaGetValues(w, XmNtopItemPosition, &topPos,
- XmNvisibleItemCount, &visible,
- XmNitemCount, &items, NULL);
-
- if (pos >= topPos && pos < topPos + visible) return;
- topPos = pos - (visible-1)/2;
- if (topPos + visible > items) topPos = items - visible + 1;
- if (topPos < 1) topPos = 1;
-
- XtVaSetValues(w, XmNtopItemPosition, topPos, NULL);
-}
-
-static void CreateSizeMenu(fc, destroyOldChildren)
- FontCreatorWidget fc;
- Boolean destroyOldChildren;
-{
- Arg args[20];
- int i, j;
- Widget *sizes;
- char buf[20];
- Widget *children;
- Cardinal num_children;
- XmString csName;
- char *ch;
-
- if (destroyOldChildren) {
- XtVaGetValues(fc->creator.size_menu, XtNchildren, &children,
- XtNnumChildren, &num_children, NULL);
-
- /* Don't destroy first child ("other") */
- for (j = 1; j < num_children; j++) XtDestroyWidget(children[j]);
-
- sizes = (Widget *) XtMalloc((fc->creator.size_count+1) *
- sizeof(Widget));
- sizes[0] = children[0];
- } else {
- sizes = (Widget *) XtMalloc((fc->creator.size_count+1) *
- sizeof(Widget));
- i = 0;
- fc->creator.other_size = sizes[0] =
- XtCreateManagedWidget("other", xmPushButtonGadgetClass,
- fc->creator.size_menu, args, i);
- }
-
- for (j = 0; j < fc->creator.size_count; j++) {
- (void) sprintf(buf, "%g", fc->creator.sizes[j]);
- csName = UnsharedCS(buf);
- for (ch = buf; *ch != '\0'; ch++) if (*ch == '.') *ch = '-';
- i = 0;
- XtSetArg(args[i], XmNlabelString, csName); i++;
- sizes[j+1] =
- XmCreatePushButtonGadget(fc->creator.size_menu, buf, args, i);
- XmStringFree(csName);
- XtAddCallback(sizes[j+1], XmNactivateCallback,
- SetSize, (XtPointer) fc);
- XtAddCallback(sizes[j+1], XmNactivateCallback,
- DrawMMCallback, (XtPointer) fc);
- }
- XtManageChildren(sizes, j+1);
- XtFree((char *) sizes);
-}
-
-static void CreateChildren(fc)
- FontCreatorWidget fc;
-{
- Arg args[20];
- int i, j;
- Widget form, prev, w, label, sep, button;
- char buf[20];
-
- i = 0;
- fc->creator.pane_child =
- XtCreateManagedWidget("pane", xmPanedWindowWidgetClass,
- (Widget) fc, args, i);
-
- i = 0;
- fc->creator.preview_child =
- XtCreateManagedWidget("preview", xmDrawingAreaWidgetClass,
- fc->creator.pane_child, args, i);
- XtAddCallback(fc->creator.preview_child, XmNexposeCallback,
- ExposeCallback, (XtPointer) fc);
- XtAddCallback(fc->creator.preview_child, XmNresizeCallback,
- ResizePreview, (XtPointer) fc);
-
- i = 0;
- form = XtCreateManagedWidget("panel", xmFormWidgetClass,
- fc->creator.pane_child, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("deleteButton", xmPushButtonGadgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback, DeleteCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, button); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("replaceButton", xmPushButtonGadgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback,
- ReplaceCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, button); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("addButton", xmPushButtonGadgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback, AddCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, button); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- fc->creator.generate_button_child =
- XtCreateManagedWidget("generateButton", xmPushButtonGadgetClass,
- form, args, i);
- XtAddCallback(fc->creator.generate_button_child, XmNactivateCallback,
- GenerateCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, fc->creator.generate_button_child);i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("optionsButton", xmPushButtonGadgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback, ShowOptions, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- button = XtCreateManagedWidget("dismissButton", xmPushButtonGadgetClass,
- form, args, i);
- XtAddCallback(button, XmNactivateCallback,
- DismissCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, button); i++;
- sep = XtCreateManagedWidget("separator", xmSeparatorGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, sep); i++;
- label = XtCreateManagedWidget("sizeLabel", xmLabelGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, label); i++;
- fc->creator.size_text_field_child =
- XtCreateManagedWidget("sizeTextField", xmTextFieldWidgetClass,
- form, args, i);
- XtAddCallback(fc->creator.size_text_field_child, XmNvalueChangedCallback,
- SizeSelect, (XtPointer) fc);
- XtAddCallback(fc->creator.size_text_field_child, XmNmodifyVerifyCallback,
- TextVerify, (XtPointer) fc);
- XtAddCallback(fc->creator.size_text_field_child, XmNactivateCallback,
- DrawMMCallback, (XtPointer) fc);
-
- i = 0;
- fc->creator.size_menu = XmCreatePulldownMenu(form, "sizeMenu", args, i);
-
- CreateSizeMenu(fc, FALSE);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, fc->creator.size_text_field_child);i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, label); i++;
- XtSetArg(args[i], XmNsubMenuId, fc->creator.size_menu); i++;
- fc->creator.size_option_menu_child =
- XmCreateOptionMenu(form, "sizeOptionMenu", args, i);
- XtManageChild(fc->creator.size_option_menu_child);
-
- SizeSelect(fc->creator.size_text_field_child, (XtPointer) fc,
- (XtPointer) NULL);
-
- i = 0;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, sep); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- fc->creator.name_text_child =
- XtCreateManagedWidget("nameText", xmTextFieldWidgetClass,
- form, args, i);
- XtAddCallback(fc->creator.name_text_child, XmNactivateCallback,
- AddCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fc->creator.name_text_child); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- label = XtCreateManagedWidget("nameLabel", xmLabelGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- label = XtCreateManagedWidget("faceLabel",xmLabelGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNitemCount, 1); i++;
- XtSetArg(args[i], XmNitems, &CSempty); i++;
- fc->creator.face_scrolled_list_child =
- XmCreateScrolledList(form, "faceList", args, i);
- XtAddCallback(fc->creator.face_scrolled_list_child,
- XmNbrowseSelectionCallback, FaceSelect, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, label); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_POSITION); i++;
- XtSetValues(XtParent(fc->creator.face_scrolled_list_child), args, i);
- XtManageChild(fc->creator.face_scrolled_list_child);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- fc->creator.blend_label_child =
- XtCreateManagedWidget("blendLabel",xmLabelGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNitemCount, 1); i++;
- XtSetArg(args[i], XmNitems, &CSempty); i++;
- fc->creator.blend_scrolled_list_child =
- XmCreateScrolledList(form, "blendList", args, i);
- XtAddCallback(fc->creator.blend_scrolled_list_child,
- XmNbrowseSelectionCallback, BlendSelect, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, fc->creator.blend_label_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fc->creator.name_text_child); i++;
- XtSetValues(XtParent(fc->creator.blend_scrolled_list_child), args, i);
- XtManageChild(fc->creator.blend_scrolled_list_child);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget,
- XtParent(fc->creator.face_scrolled_list_child)); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- fc->creator.display_text_child =
- XtCreateManagedWidget("displayText", xmTextFieldWidgetClass,
- form, args, i);
- XtAddCallback(fc->creator.display_text_child, XmNactivateCallback,
- DrawMMCallback, (XtPointer) fc);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, fc->creator.display_text_child); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- label = XtCreateManagedWidget("displayTextLabel", xmLabelGadgetClass,
- form, args, i);
-
- prev = fc->creator.display_text_child;
-
- for (j = 0; j < 4; j++) {
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, prev); i++;
- sprintf(buf, "axisValue%d", j+1);
- fc->creator.axis_value_text_child[j] =
- XtCreateWidget(buf, xmTextFieldWidgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget,
- fc->creator.axis_value_text_child[j]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget,
- fc->creator.axis_value_text_child[j]); i++;
- sprintf(buf, "axisScale%d", j+1);
- fc->creator.axis_scale_child[j] =
- XtCreateWidget(buf, xmScaleWidgetClass, form, args, i);
- XtAddCallback(fc->creator.axis_scale_child[j],
- XmNvalueChangedCallback, DrawMMCallback, (XtPointer) fc);
- XtAddCallback(fc->creator.axis_scale_child[j],
- XmNdragCallback, DrawMMCallback, (XtPointer) fc);
- XtAddCallback(fc->creator.axis_scale_child[j],
- XmNvalueChangedCallback, SetValue,
- (XtPointer) fc->creator.axis_value_text_child[j]);
- XtAddCallback(fc->creator.axis_scale_child[j],
- XmNdragCallback, SetValue,
- (XtPointer) fc->creator.axis_value_text_child[j]);
- XtAddCallback(fc->creator.axis_value_text_child[j],
- XmNactivateCallback, SetScale,
- (XtPointer) fc->creator.axis_scale_child[j]);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget,
- fc->creator.axis_scale_child[j]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET);i++;
- XtSetArg(args[i], XmNrightWidget,
- fc->creator.axis_scale_child[j]); i++;
- sprintf(buf, "axisMax%d", j+1);
- fc->creator.axis_max_label_child[j] =
- XtCreateWidget(buf, xmLabelGadgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget,
- fc->creator.axis_scale_child[j]); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget,
- fc->creator.axis_scale_child[j]); i++;
- sprintf(buf, "axisMin%d", j+1);
- fc->creator.axis_min_label_child[j] =
- XtCreateWidget(buf, xmLabelGadgetClass, form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget,
- fc->creator.axis_value_text_child[j]); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- sprintf(buf, "axisLabel%d", j+1);
- fc->creator.axis_label_child[j] =
- XtCreateWidget(buf, xmLabelGadgetClass, form, args, i);
-
- prev = fc->creator.axis_value_text_child[j];
- }
-
- /* Create the options box so we have the toggles */
-
- fc->creator.option_box = XmCreateFormDialog((Widget) fc, "optionBox",
- (Arg *) NULL, 0);
- w = XtCreateManagedWidget("filterBox", xmRowColumnWidgetClass,
- fc->creator.option_box, (Arg *) NULL, 0);
- fc->creator.do_all_toggle_child =
- XtCreateManagedWidget("doAllToggle", xmToggleButtonGadgetClass,
- w, (Arg *) NULL, 0);
- fc->creator.follow_size_toggle_child =
- XtCreateManagedWidget("followSizeToggle",
- xmToggleButtonGadgetClass,
- w, (Arg *) NULL, 0);
- button = XtCreateManagedWidget("dismissOptionButton",
- xmPushButtonGadgetClass,
- w, (Arg *) NULL, 0);
- XtAddCallback(button, XmNactivateCallback,
- UnmanageOptions, (XtPointer) fc);
-}
-
-/* ARGSUSED */
-
-static void Initialize(request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
-{
- FontCreatorWidget fc = (FontCreatorWidget) new;
-
- /* Must have a fsb */
-
- if (fc->creator.fsb == NULL) {
- XtAppErrorMsg(XtWidgetToApplicationContext(new),
- "initializeFontCreator", "noFontSelectionBox",
- "FontSelectionBoxError",
- "No font selection box given to font creator",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- /* Verify size list */
-
- if (fc->creator.size_count > 0 && fc->creator.sizes == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontCreator", "sizeMismatch",
- "FontSelectionBoxError",
- "Size count specified but no sizes present",
- (String *) NULL, (Cardinal *) NULL);
- fc->creator.size_count = 0;
- }
-
- if (fc->creator.size_count < 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontCreator", "negativeSize",
- "FontSelectionBoxError",
- "Size count should not be negative",
- (String *) NULL, (Cardinal *) NULL);
- fc->creator.size_count = 0;
- }
-
- fc->creator.gstate = 0;
- fc->creator.family = NULL;
- fc->creator.font = NULL;
- fc->creator.managed_axes = 0;
- fc->creator.preview_fixed = False;
- fc->creator.option_box = NULL;
-
- CreateChildren(fc);
- XtAddCallback(fc->creator.fsb->fsb.size_text_field_child,
- XmNvalueChangedCallback, SizeChanged, (XtPointer) fc);
-}
-
-static void SelectBlend(fc, cur_b)
- FontCreatorWidget fc;
- BlendRec *cur_b;
-{
- int i, cur;
- BlendRec *b;
- int *selectList, selectCount;
-
- if (cur_b == NULL) {
- if (!XmListGetSelectedPos(fc->creator.blend_scrolled_list_child,
- &selectList, &selectCount)) return;
- if (selectCount == 0 || *selectList < 1) return;
- cur = *selectList;
- XtFree((XtPointer) selectList);
- } else {
- for (i = 0, b = fc->creator.font->blend_data->blends;
- i < fc->creator.font->blend_count; i++, b = b->next) {
- if (b == cur_b) {
- cur = i+1;
- break;
- }
- }
- }
- ListSelectPos(fc->creator.blend_scrolled_list_child, cur, FALSE);
- HandleSelectedBlend(fc, cur);
-}
-
-void _FSBSetCreatorFamily(w, ff)
- Widget w;
- FontFamilyRec *ff;
-{
- FontCreatorWidget fc = (FontCreatorWidget) w;
- int i, count = 0, cur = 1;
- FontRec *newf = NULL, *f, *oldf = fc->creator.font;
- XmString *CSfaces;
-
- if (ff != fc->creator.family) {
- fc->creator.family = ff;
-
- CSfaces = (XmString *) XtCalloc(ff->font_count, sizeof(XmString));
-
- for (i = 0, f = ff->fonts; i < ff->font_count; i++, f = f->next) {
- if (f->blend_data == NULL) continue;
-
- if (newf == NULL) newf = f;
- CSfaces[count] = f->CS_face_name;
- count++;
- if (f == fc->creator.fsb->fsb.currently_selected_face) {
- cur = count;
- newf = f;
- }
- }
-
- XtVaSetValues(fc->creator.face_scrolled_list_child,
- XmNitemCount, count, XmNitems, CSfaces, NULL);
-
- XtFree((XtPointer) CSfaces);
-
- } else {
- for (i = 0, f = ff->fonts; i < ff->font_count; i++, f = f->next) {
- if (f->blend_data == NULL) continue;
- count++;
- if (newf == NULL) newf = f;
- if (f == fc->creator.fsb->fsb.currently_selected_face) {
- cur = count;
- newf = f;
- break;
- }
- }
- }
-
- if (fc->creator.font != NULL) fc->creator.font->in_font_creator = False;
- fc->creator.font = newf;
- newf->in_font_creator = True;
- ListSelectPos(fc->creator.face_scrolled_list_child, cur, FALSE);
- SetUpBlendList(fc);
- SetUpAxes(fc, oldf);
- if (fc->creator.fsb->fsb.currently_selected_blend != 0) {
- SelectBlend(fc, fc->creator.fsb->fsb.currently_selected_blend);
- } else {
- SelectBlend(fc, NULL);
- }
- SetScaleValues(fc);
- XmTextFieldSetString(fc->creator.display_text_child, ff->family_name);
- DrawMM(fc);
-}
-
-static void Destroy(widget)
- Widget widget;
-{
- FontCreatorWidget fc = (FontCreatorWidget) widget;
-
- if (fc->creator.gstate != 0) {
- XDPSFreeContextGState(fc->creator.fsb->fsb.context,
- fc->creator.gstate);
- }
-}
-
-static void Resize(widget)
- Widget widget;
-{
- FontCreatorWidget fc = (FontCreatorWidget) widget;
-
- XtResizeWidget(fc->creator.pane_child, fc->core.width, fc->core.height, 0);
-}
-
-/* ARGSUSED */
-
-static Boolean SetValues(old, req, new, args, num_args)
- Widget old, req, new;
- ArgList args;
- Cardinal *num_args;
-{
- FontCreatorWidget oldfc = (FontCreatorWidget) old;
- FontCreatorWidget newfc = (FontCreatorWidget) new;
-
-#define NE(field) newfc->creator.field != oldfc->creator.field
-
- if (NE(fsb)) newfc->creator.fsb = oldfc->creator.fsb;
-
- if (newfc->creator.size_count > 0 && newfc->creator.sizes == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontCreator", "sizeMismatch",
- "FontSelectionBoxError",
- "Size count specified but no sizes present",
- (String *) NULL, (Cardinal *) NULL);
- newfc->creator.size_count = 0;
- }
-
- if (newfc->creator.size_count < 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontCreator", "negativeSize",
- "FontSelectionBoxError",
- "Size count should not be negative",
- (String *) NULL, (Cardinal *) NULL);
- newfc->creator.size_count = 0;
- }
-
- if (NE(sizes)) CreateSizeMenu(newfc, TRUE);
-#undef NE
- return False;
-}
-
-/* ARGSUSED */
-
-static XtGeometryResult GeometryManager(w, desired, allowed)
- Widget w;
- XtWidgetGeometry *desired, *allowed;
-{
-#define WANTS(flag) (desired->request_mode & flag)
-
- if (WANTS(XtCWQueryOnly)) return XtGeometryYes;
-
- if (WANTS(CWWidth)) w->core.width = desired->width;
- if (WANTS(CWHeight)) w->core.height = desired->height;
- if (WANTS(CWX)) w->core.x = desired->x;
- if (WANTS(CWY)) w->core.y = desired->y;
- if (WANTS(CWBorderWidth)) {
- w->core.border_width = desired->border_width;
- }
-
- return XtGeometryYes;
-#undef WANTS
-}
-
-static void ChangeManaged(w)
- Widget w;
-{
- FontCreatorWidget fc = (FontCreatorWidget) w;
-
- w->core.width = fc->composite.children[0]->core.width;
- w->core.height = fc->composite.children[0]->core.height;
-}
diff --git a/xc/lib/dpstk/FontSB.c b/xc/lib/dpstk/FontSB.c
deleted file mode 100644
index 1bb3bb54c..000000000
--- a/xc/lib/dpstk/FontSB.c
+++ /dev/null
@@ -1,4909 +0,0 @@
-/*
- * FontSB.c
- *
- * (c) Copyright 1991-1994 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
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <math.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <Xm/Xm.h>
-
-/* There are no words to describe how I feel about having to do this */
-
-#if XmVersion > 1001
-#include <Xm/ManagerP.h>
-#else
-#include <Xm/XmP.h>
-#endif
-
-#include <Xm/Form.h>
-#include <Xm/List.h>
-#include <Xm/Label.h>
-#include <Xm/LabelG.h>
-#include <Xm/PushB.h>
-#include <Xm/PanedW.h>
-#include <Xm/PushBG.h>
-#include <Xm/SeparatoG.h>
-#include <Xm/TextF.h>
-#include <Xm/RowColumn.h>
-#include <Xm/DrawingA.h>
-#include <Xm/MessageB.h>
-#include <DPS/dpsXclient.h>
-#include "dpsXcommonI.h"
-#include "DPS/dpsXcommon.h"
-#include "DPS/dpsXshare.h"
-#include <DPS/PSres.h>
-#include "DPS/FontSBP.h"
-#include "FSBwraps.h"
-#include "FontSBI.h"
-#include "DPS/FontSample.h"
-#include "DPS/FontCreato.h"
-#include <pwd.h>
-
-#define PATH_BUF_SIZE 1024
-
-/* Turn a string into a compound string */
-#define UnsharedCS(str) XmStringCreate(str, XmSTRING_DEFAULT_CHARSET)
-#define CS(str, w) _FSBCreateSharedCS(str, w)
-static XmString CSempty;
-
-/* Create a canonical representation of a string, and as a side effect
- make sure the string is in permanent storage. This implementation may
- not work under all Xlibs */
-
-#define Canonical(str) XrmQuarkToString(XrmStringToQuark(str))
-
-static float defaultSizeList[] = {
-#ifndef DEFAULT_SIZE_LIST
- 8, 10, 12, 14, 16, 18, 24, 36, 48, 72
-#else
- DEFAULT_SIZE_LIST
-#endif /* DEFAULT_SIZE_LIST */
-};
-
-#ifndef DEFAULT_SIZE_LIST_COUNT
-#define DEFAULT_SIZE_LIST_COUNT 10
-#endif /* DEFAULT_SIZE_LIST_COUNT */
-
-#ifndef DEFAULT_SIZE
-static float default_size = 12.0;
-#else
-static float default_size = DEFAULT_SIZE
-#endif /* DEFAULT_SIZE */
-
-#ifndef DEFAULT_RESOURCE_PATH
-#define DEFAULT_RESOURCE_PATH NULL
-#endif /* DEFAULT_RESOURCE_PATH */
-
-#ifndef DEFAULT_MAX_PENDING
-#define DEFAULT_MAX_PENDING 10
-#endif /* DEFAULT_MAX_PENDING */
-
-#define Offset(field) XtOffsetOf(FontSelectionBoxRec, fsb.field)
-
-static XtResource resources[] = {
- {XtNcontext, XtCContext, XtRDPSContext, sizeof(DPSContext),
- Offset(context), XtRDPSContext, (XtPointer) NULL},
- {XtNpreviewString, XtCPreviewString, XtRString, sizeof(String),
- Offset(preview_string), XtRString, (XtPointer) NULL},
- {XtNsizes, XtCSizes, XtRFloatList, sizeof(float*),
- Offset(sizes), XtRImmediate, (XtPointer) defaultSizeList},
- {XtNsizeCount, XtCSizeCount, XtRInt, sizeof(int),
- Offset(size_count), XtRImmediate, (XtPointer) DEFAULT_SIZE_LIST_COUNT},
- {XtNdefaultResourcePath, XtCDefaultResourcePath, XtRString, sizeof(String),
- Offset(default_resource_path), XtRImmediate,
- (XtPointer) DEFAULT_RESOURCE_PATH},
- {XtNresourcePathOverride, XtCResourcePathOverride,
- XtRString, sizeof(String),
- Offset(resource_path_override), XtRString, (XtPointer) NULL},
- {XtNuseFontName, XtCUseFontName, XtRBoolean, sizeof(Boolean),
- Offset(use_font_name), XtRImmediate, (XtPointer) True},
- {XtNfontName, XtCFontName, XtRString, sizeof(String),
- Offset(font_name), XtRString, (XtPointer) NULL},
- {XtNfontFamily, XtCFontFamily, XtRString, sizeof(String),
- Offset(font_family), XtRString, (XtPointer) NULL},
- {XtNfontFace, XtCFontFace, XtRString, sizeof(String),
- Offset(font_face), XtRString, (XtPointer) NULL},
- {XtNfontBlend, XtCFontBlend, XtRString, sizeof(String),
- Offset(font_blend), XtRString, (XtPointer) NULL},
- {XtNfontSize, XtCFontSize, XtRFloat, sizeof(String),
- Offset(font_size), XtRFloat, (XtPointer) &default_size},
- {XtNfontNameMultiple, XtCFontNameMultiple, XtRBoolean, sizeof(Boolean),
- Offset(font_name_multiple), XtRImmediate, (XtPointer) False},
- {XtNfontFamilyMultiple, XtCFontFamilyMultiple, XtRBoolean, sizeof(Boolean),
- Offset(font_family_multiple), XtRImmediate, (XtPointer) False},
- {XtNfontFaceMultiple, XtCFontFaceMultiple, XtRBoolean, sizeof(Boolean),
- Offset(font_face_multiple), XtRImmediate, (XtPointer) False},
- {XtNfontSizeMultiple, XtCFontSizeMultiple, XtRBoolean, sizeof(Boolean),
- Offset(font_size_multiple), XtRImmediate, (XtPointer) False},
- {XtNgetServerFonts, XtCGetServerFonts, XtRBoolean, sizeof(Boolean),
- Offset(get_server_fonts), XtRImmediate, (XtPointer) True},
- {XtNgetAFM, XtCGetAFM, XtRBoolean, sizeof(Boolean),
- Offset(get_afm), XtRImmediate, (XtPointer) False},
- {XtNautoPreview, XtCAutoPreview, XtRBoolean, sizeof(Boolean),
- Offset(auto_preview), XtRImmediate, (XtPointer) True},
- {XtNpreviewOnChange, XtCPreviewOnChange, XtRBoolean, sizeof(Boolean),
- Offset(preview_on_change), XtRImmediate, (XtPointer) True},
- {XtNundefUnusedFonts, XtCUndefUnusedFonts, XtRBoolean, sizeof(Boolean),
- Offset(undef_unused_fonts), XtRImmediate, (XtPointer) True},
- {XtNmaxPendingDeletes, XtCMaxPendingDeletes, XtRCardinal, sizeof(Cardinal),
- Offset(max_pending_deletes), XtRImmediate,
- (XtPointer) DEFAULT_MAX_PENDING},
- {XtNmakeFontsShared, XtCMakeFontsShared, XtRBoolean, sizeof(Boolean),
- Offset(make_fonts_shared), XtRImmediate, (XtPointer) True},
- {XtNshowSampler, XtCShowSampler, XtRBoolean, sizeof(Boolean),
- Offset(show_sampler), XtRImmediate, (XtPointer) False},
- {XtNshowSamplerButton, XtCShowSamplerButton, XtRBoolean, sizeof(Boolean),
- Offset(show_sampler_button), XtRImmediate, (XtPointer) True},
- {XtNtypographicSort, XtCTypographicSort, XtRBoolean, sizeof(Boolean),
- Offset(typographic_sort), XtRImmediate, (XtPointer) True},
-
- {XtNokCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(ok_callback), XtRCallback, (XtPointer) NULL},
- {XtNapplyCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(apply_callback), XtRCallback, (XtPointer) NULL},
- {XtNresetCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(reset_callback), XtRCallback, (XtPointer) NULL},
- {XtNcancelCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(cancel_callback), XtRCallback, (XtPointer) NULL},
- {XtNvalidateCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(validate_callback), XtRCallback, (XtPointer) NULL},
- {XtNfaceSelectCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(face_select_callback), XtRCallback, (XtPointer) NULL},
- {XtNcreateSamplerCallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), Offset(create_sampler_callback),
- XtRCallback, (XtPointer) NULL},
- {XtNcreateCreatorCallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), Offset(create_creator_callback),
- XtRCallback, (XtPointer) NULL},
- {XtNvalueChangedCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(value_changed_callback), XtRCallback, (XtPointer) NULL},
-
- {XtNpaneChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(pane_child), XtRWidget, (XtPointer) NULL},
- {XtNpreviewChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(preview_child), XtRWidget, (XtPointer) NULL},
- {XtNpanelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(panel_child), XtRWidget, (XtPointer) NULL},
- {XtNfamilyLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(family_label_child), XtRWidget, (XtPointer) NULL},
- {XtNfamilyMultipleLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(family_multiple_label_child), XtRWidget, (XtPointer) NULL},
- {XtNfamilyScrolledListChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(family_scrolled_list_child), XtRWidget, (XtPointer) NULL},
- {XtNfaceLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(face_label_child), XtRWidget, (XtPointer) NULL},
- {XtNfaceMultipleLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(face_multiple_label_child), XtRWidget, (XtPointer) NULL},
- {XtNfaceScrolledListChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(face_scrolled_list_child), XtRWidget, (XtPointer) NULL},
- {XtNsizeLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_label_child), XtRWidget, (XtPointer) NULL},
- {XtNsizeTextFieldChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_text_field_child), XtRWidget, (XtPointer) NULL},
- {XtNsizeOptionMenuChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_option_menu_child), XtRWidget, (XtPointer) NULL},
- {XtNsizeMultipleLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_multiple_label_child), XtRWidget, (XtPointer) NULL},
- {XtNpreviewButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(preview_button_child), XtRWidget, (XtPointer) NULL},
- {XtNsamplerButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(sampler_button_child), XtRWidget, (XtPointer) NULL},
- {XtNseparatorChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(separator_child), XtRWidget, (XtPointer) NULL},
- {XtNokButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(ok_button_child), XtRWidget, (XtPointer) NULL},
- {XtNapplyButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(apply_button_child), XtRWidget, (XtPointer) NULL},
- {XtNresetButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(reset_button_child), XtRWidget, (XtPointer) NULL},
- {XtNcancelButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(cancel_button_child), XtRWidget, (XtPointer) NULL},
- {XtNmultipleMasterButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(multiple_master_button_child), XtRWidget, (XtPointer) NULL}
-};
-
-/* Forward declarations */
-
-static void ClassInitialize(), ClassPartInitialize(), Initialize(), Destroy(),
- ChangeManaged(), Resize(),
- SetFontName(), SetFontFamilyFace(), SetFontSize(), RefreshFontList(),
- GetFamilyList(), GetFaceList(), UndefUnusedFonts(),
- FontNameToFamilyFace(), FontFamilyFaceToName(),
- GetTextDimensions(), WriteBlends(), ReadBlends(),
- SetFontFamilyFaceBlend(), FontNameToFamilyFaceBlend(),
- FontFamilyFaceBlendToName(), GetBlendList(),
- GetBlendInfo(), FreeFontRec(), DisplayFontFamilies(),
- SetUpCurrentSelections();
-static Boolean SetValues(), DownloadFontName(), MatchFontFace(),
- Verify(), ChangeBlends();
-static XtGeometryResult GeometryManager();
-static String FindAFM(), FindFontFile();
-
-FontSelectionBoxClassRec fontSelectionBoxClassRec = {
- /* Core class part */
- {
- /* superclass */ (WidgetClass) &xmManagerClassRec,
- /* class_name */ "FontSelectionBox",
- /* widget_size */ sizeof(FontSelectionBoxRec),
- /* class_initialize */ ClassInitialize,
- /* class_part_initialize */ ClassPartInitialize,
- /* class_inited */ False,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ NULL,
- /* num_actions */ 0,
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ True,
- /* compress_exposure */ XtExposeCompressMultiple,
- /* compress_enterleave */ True,
- /* visible_interest */ False,
- /* destroy */ Destroy,
- /* resize */ Resize,
- /* expose */ NULL,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ XtInheritQueryGeometry,
- /* display_accelerator */ NULL,
- /* extension */ NULL,
- },
- /* Composite class part */
- {
- /* geometry_manager */ GeometryManager,
- /* change_managed */ ChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL,
- },
- /* Constraint class part */
- {
- /* resources */ NULL,
- /* num_resources */ 0,
- /* constraint_size */ 0,
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ NULL,
- /* extension */ NULL,
- },
- /* Manager class part */
- {
- /* translations */ XtInheritTranslations,
- /* syn_resources */ NULL,
- /* num_syn_resources */ 0,
- /* syn_constraint_resources */ NULL,
- /* num_syn_constraint_resources */ 0,
- /* parent_process */ XmInheritParentProcess,
- /* extension */ NULL,
- },
- /* FontSelectionBox class part */
- {
- /* set_font_name */ SetFontName,
- /* set_font_family_face */ SetFontFamilyFace,
- /* set_font_size */ SetFontSize,
- /* refresh_font_list */ RefreshFontList,
- /* get_family_list */ GetFamilyList,
- /* get_face_list */ GetFaceList,
- /* undef_unused_fonts */ UndefUnusedFonts,
- /* download_font_name */ DownloadFontName,
- /* match_font_face */ MatchFontFace,
- /* font_name_to_family_face */ FontNameToFamilyFace,
- /* font_family_face_to_name */ FontFamilyFaceToName,
- /* find_afm */ FindAFM,
- /* find_font_file */ FindFontFile,
- /* get_text_dimensions */ GetTextDimensions,
- /* set_font_family_face_blend */ SetFontFamilyFaceBlend,
- /* font_name_to_family_face_blend */ FontNameToFamilyFaceBlend,
- /* font_family_face_blend_to_name */ FontFamilyFaceBlendToName,
- /* get_blend_list */ GetBlendList,
- /* get_blend_info */ GetBlendInfo,
- /* change_blends */ ChangeBlends,
- /* extension */ NULL,
- }
-};
-
-WidgetClass fontSelectionBoxWidgetClass =
- (WidgetClass) &fontSelectionBoxClassRec;
-
-/* ARGSUSED */
-
-static Boolean CvtStringToFloatList(dpy, args, num_args, from, to, data)
- Display *dpy;
- XrmValuePtr args;
- Cardinal *num_args;
- XrmValuePtr from, to;
- XtPointer *data;
-{
- register int i, count = 1;
- register char *ch, *start = from->addr;
- static float *list;
- char save;
-
- if (*num_args != 0) { /* Check for correct number */
- XtAppErrorMsg(XtDisplayToApplicationContext(dpy),
- "cvtStringToFloatList", "wrongParameters",
- "XtToolkitError",
- "String to integer list conversion needs no extra arguments",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- if (to->addr != NULL && to->size < sizeof(int *)) {
- to->size = sizeof(int *);
- return False;
- }
- if (start == NULL || *start == '\0') list = NULL;
- else {
- for (ch = start; *ch != '\0'; ch++) { /* Count floats */
- if (!isdigit(*ch) && *ch != '.' && *ch != ',') {
- XtDisplayStringConversionWarning(dpy, from->addr, "FloatList");
- return False;
- }
- if (*ch == ',') count++;
- }
- list = (float *) XtCalloc(count+1, sizeof(float));
-
- for (i = 0; i < count; i++) {
- for (ch = start; *ch != ',' && *ch != '\0'; ch++) {}
- save = *ch;
- *ch = '\0';
- list[i] = atof(start);
- *ch = save;
- start = ch + 1;
- }
- }
- if (to->addr == NULL) to->addr = (caddr_t) &list;
- else *(float **) to->addr = list;
- to->size = sizeof(int *);
- return True;
-}
-
-/* ARGSUSED */
-
-static void FloatListDestructor(app, to, converter_data, args, num_args)
- XtAppContext app;
- XrmValuePtr to;
- XtPointer converter_data;
- XrmValuePtr args;
- Cardinal *num_args;
-{
- float *list = (float *) to->addr;
-
- if (list == NULL) return;
- XtFree((XtPointer) list);
-}
-
-XmString _FSBCreateSharedCS(str, w)
- String str;
- Widget w;
-{
- XrmValue src, dst;
- XmString result;
-
- src.addr = str;
- src.size = strlen(str);
-
- dst.addr = (caddr_t) &result;
- dst.size = sizeof(result);
-
- if (XtConvertAndStore(w, XtRString, &src, XmRXmString, &dst)) {
- return result;
- } else return NULL;
-}
-
-static Boolean ScanFloat(src, f, past)
- char *src;
- float *f;
- char **past;
-{
- char buf[20], *ch;
- int countDecimals;
-
- ch = buf;
- countDecimals = 0;
- while (*src == '.' || isdigit(*src)) {
- if (*src == '.') {
- if (countDecimals) return False;
- else countDecimals++;
- }
- *ch++ = *src++;
- }
- if (ch == buf) return False;
- *ch++ = '\0';
- *f = atof(buf);
- *past = src;
- return True;
-}
-
-static Boolean ScanInt(src, i, past)
- char *src;
- int *i;
- char **past;
-{
- char buf[20], *ch;
-
- ch = buf;
- while (isdigit(*src)) *ch++ = *src++;
- if (ch == buf) return False;
- *ch++ = '\0';
- *i = atoi(buf);
- *past = src;
- return True;
-}
-
-static void ClassInitialize()
-{
- /* Register a converter for string to int list */
-
- XtSetTypeConverter(XtRString, XtRFloatList,
- CvtStringToFloatList, (XtConvertArgList) NULL, 0,
- XtCacheAll | XtCacheRefCount, FloatListDestructor);
-
- CSempty = UnsharedCS("");
-}
-
-static void ClassPartInitialize(widget_class)
- WidgetClass widget_class;
-{
- register FontSelectionBoxWidgetClass wc =
- (FontSelectionBoxWidgetClass) widget_class;
- FontSelectionBoxWidgetClass super =
- (FontSelectionBoxWidgetClass) wc->core_class.superclass;
-
- if (wc->fsb_class.set_font_name == InheritSetFontName) {
- wc->fsb_class.set_font_name = super->fsb_class.set_font_name;
- }
- if (wc->fsb_class.set_font_family_face == InheritSetFontFamilyFace) {
- wc->fsb_class.set_font_family_face =
- super->fsb_class.set_font_family_face;
- }
- if (wc->fsb_class.set_font_size == InheritSetFontSize) {
- wc->fsb_class.set_font_size = super->fsb_class.set_font_size;
- }
- if (wc->fsb_class.refresh_font_list == InheritRefreshFontList) {
- wc->fsb_class.refresh_font_list = super->fsb_class.refresh_font_list;
- }
- if (wc->fsb_class.get_family_list == InheritGetFamilyList) {
- wc->fsb_class.get_family_list = super->fsb_class.get_family_list;
- }
- if (wc->fsb_class.get_face_list == InheritGetFaceList) {
- wc->fsb_class.get_face_list = super->fsb_class.get_face_list;
- }
- if (wc->fsb_class.undef_unused_fonts == InheritUndefUnusedFonts) {
- wc->fsb_class.undef_unused_fonts = super->fsb_class.undef_unused_fonts;
- }
- if (wc->fsb_class.download_font_name == InheritDownloadFontName) {
- wc->fsb_class.download_font_name = super->fsb_class.download_font_name;
- }
- if (wc->fsb_class.match_font_face == InheritMatchFontFace) {
- wc->fsb_class.match_font_face = super->fsb_class.match_font_face;
- }
- if (wc->fsb_class.font_name_to_family_face ==
- InheritFontNameToFamilyFace) {
- wc->fsb_class.font_name_to_family_face =
- super->fsb_class.font_name_to_family_face;
- }
- if (wc->fsb_class.font_family_face_to_name ==
- InheritFontFamilyFaceToName) {
- wc->fsb_class.font_family_face_to_name =
- super->fsb_class.font_family_face_to_name;
- }
- if (wc->fsb_class.find_afm == InheritFindAFM) {
- wc->fsb_class.find_afm = super->fsb_class.find_afm;
- }
- if (wc->fsb_class.find_font_file == InheritFindFontFile) {
- wc->fsb_class.find_font_file = super->fsb_class.find_font_file;
- }
- if (wc->fsb_class.get_text_dimensions == InheritGetTextDimensions) {
- wc->fsb_class.get_text_dimensions =
- super->fsb_class.get_text_dimensions;
- }
- if (wc->fsb_class.set_font_family_face_blend ==
- InheritSetFontFamilyFaceBlend) {
- wc->fsb_class.set_font_family_face_blend =
- super->fsb_class.set_font_family_face_blend;
- }
- if (wc->fsb_class.font_name_to_family_face_blend ==
- InheritFontNameToFamilyFaceBlend) {
- wc->fsb_class.font_name_to_family_face_blend =
- super->fsb_class.font_name_to_family_face_blend;
- }
- if (wc->fsb_class.font_family_face_blend_to_name ==
- InheritFontFamilyFaceBlendToName) {
- wc->fsb_class.font_family_face_blend_to_name =
- super->fsb_class.font_family_face_blend_to_name;
- }
- if (wc->fsb_class.get_blend_list == InheritGetBlendList) {
- wc->fsb_class.get_blend_list =
- super->fsb_class.get_blend_list;
- }
- if (wc->fsb_class.get_blend_info == InheritGetBlendInfo) {
- wc->fsb_class.get_blend_info =
- super->fsb_class.get_blend_info;
- }
- if (wc->fsb_class.change_blends == InheritChangeBlends) {
- wc->fsb_class.change_blends =
- super->fsb_class.change_blends;
- }
-}
-
-static String bugFamilies[] = {
- "Berkeley", "CaslonFiveForty", "CaslonThree", "GaramondThree",
- "Music", "TimesTen", NULL
-};
-
-static String fixedFamilies[] = {
- "ITC Berkeley Oldstyle", "Caslon 540", "Caslon 3", "Garamond 3",
- "Sonata", "Times 10", NULL
-};
-
-static String missingFoundries[] = {
- "Berthold ", "ITC ", "Linotype ", NULL
-};
-
-static int missingFoundryLen[] = {
- 9, 4, 9, 0
-};
-
-/* I wish we didn't have to do this! */
-
-static void MungeFontNames(name, family, fullname, weight,
- familyReturn, fullnameReturn, faceReturn)
- String name, family, fullname, weight;
- String *familyReturn, *fullnameReturn, *faceReturn;
-{
- register char *src, *dst, prev;
- char buf[256];
- int digits = 0;
- int i, diff;
- static Bool inited = False;
- static String FetteFrakturDfr, LinotextDfr;
-
- /* Don't make bugFamilies canonical; we'd have to make the initial
- family canonical to do anything with it and there's no point in that */
-
- if (!inited) {
- for (i = 0; fixedFamilies[i] != NULL; i++) {
- fixedFamilies[i] = Canonical(fixedFamilies[i]);
- }
- FetteFrakturDfr = Canonical("FetteFraktur-Dfr");
- LinotextDfr = Canonical("Linotext-Dfr");
- inited = True;
- }
-
- /* Copy the fullname into buf, enforcing one space between words.
- Eliminate leading digits and spaces, ignore asterisks, if the
- full name ends with 5 digits strip them, and replace periods that
- aren't followed by a space with a space. If leading digits are
- followed by " pt " skip that too. */
-
- dst = buf;
- prev = ' ';
- src = fullname;
- while (isdigit(*src)) src++;
- while (*src == ' ' || *src == '\t') src++;
- if (strncmp(src, "pt ", 3) == 0) src += 3;
- else if (strncmp(src, "pt. ", 4) == 0) src += 4;
-
- while (*src != '\0') {
- if (*src == '*') {
- src++;
- continue;
- }
-
- if (*src == '.') {
- if (*(src+1) != ' ') {
- prev = *dst++ = ' ';
- } else prev = *dst++ = '.';
- src++;
- continue;
- }
-
- if (isdigit(*src)) digits++;
- else digits = 0;
-
- if (isupper(*src)) {
- if (prev != ' ' && (islower(*(src+1)) || islower(prev))) {
- *dst++ = ' ';
- prev = *dst++ = *src++;
- } else prev = *dst++ = *src++;
-
- } else if (*src == ' ' || *src == '\t') {
- if (prev == ' ') {
- src++;
- continue;
- }
- prev = *dst++ = ' ';
- src++;
-
- } else prev = *dst++ = *src++;
- }
-
- if (digits == 5) {
- dst -= 5;
- }
- if (dst > buf && *(dst-1) == ' ') dst--;
-
- *dst = '\0';
-
- /* Stupid Fette Fraktur */
-
- if (name == FetteFrakturDfr) {
- strcat(buf, " Black Dfr");
- } else if (name == LinotextDfr) {
- strcat(buf, " Dfr");
- }
-
- if (strncmp(fullname, "pt ", 3) == 0) {
- src = buf + 2;
- while (*++src != '\0') *(src-3) = *src;
- *(src-3) = '\0';
- }
- *fullnameReturn = XtNewString(buf);
-
- /* From here on fullname should not be used */
-
- /* Done with the full name; now onto the family */
-
- for (i = 0; bugFamilies[i] != NULL; i++) {
- diff = strcmp(family, bugFamilies[i]);
- if (diff < 0) break;
- if (diff == 0) {
- *familyReturn = fixedFamilies[i];
- goto FAMILY_DONE;
- }
- }
-
- /* Copy the family into buf, enforcing one space between words */
-
- dst = buf;
- prev = ' ';
- src = family;
-
- while (*src != '\0') {
- if (isupper(*src)) {
- if (prev != ' ' && (islower(*(src+1)) || islower(prev))) {
- *dst++ = ' ';
- prev = *dst++ = *src++;
- } else prev = *dst++ = *src++;
-
- } else if (*src == ' ' || *src == '\t') {
- if (prev == ' ') {
- src++;
- continue;
- }
- prev = *dst++ = ' ';
- src++;
-
- } else prev = *dst++ = *src++;
- }
-
- if (dst > buf && *(dst-1) == ' ') dst--;
- *dst = '\0';
-
- /* Compensate for fonts with foundries in the full name but not the
- family name by adding to the family name */
-
- for (i = 0; missingFoundries[i] != NULL; i++) {
- diff = strncmp(*fullnameReturn, missingFoundries[i],
- missingFoundryLen[i]);
- if (diff > 0) continue;
- if (diff == 0 && strncmp(buf, missingFoundries[i],
- missingFoundryLen[i] != 0)) {
- while (dst >= buf) {
- *(dst+missingFoundryLen[i]) = *dst;
- dst--;
- }
- strncpy(buf, missingFoundries[i], missingFoundryLen[i]);
- }
- break;
- }
-
- /* From here on dst no longer points to the end of the buffer */
-
- /* Stupid Helvetica Rounded! */
-
- if (strncmp(*fullnameReturn, "Helvetica Rounded ", 18) == 0) {
- strcat(buf, " Rounded");
- }
-
- *familyReturn = Canonical(buf);
-
- /* From here on family should not be used */
-
-FAMILY_DONE:
-
- /* Now to find the face in all this */
-
- src = *fullnameReturn;
- dst = *familyReturn;
- while (*dst == *src && *dst != '\0') {
- src++;
- dst++;
- }
- if (*src == ' ') src++;
-
- if (*src != '\0') *faceReturn = Canonical(src);
- else if (*weight != '\0') {
- /* Handle Multiple Master fonts */
- if (strcmp(weight, "All") == 0) *faceReturn = Canonical("Roman");
- else {
- if (islower(weight[0])) weight[0] = toupper(weight[0]);
- *faceReturn = Canonical(weight);
- }
- } else *faceReturn = Canonical("Medium");
-}
-
-static String strip[] = {
- "Adobe ", "Bauer ", "Berthold ", "ITC ", "Linotype ",
- "New ", "Simoncini ", "Stempel ", NULL};
-
-static int striplen[] = {6, 6, 9, 4, 9, 4, 10, 8, 0};
-
-#define STEMPELINDEX 7
-
-static Boolean CreateSortKey(family, key)
- register String family, key;
-{
- char newkey[256];
- int len = strlen(family);
- register int i, diff;
-
- if (family[len-2] == 'P' && family[len-1] == 'i') {
- key[0] = 'P';
- key[1] = 'i';
- key[2] = ' ';
- strcpy(key+3, family);
- key[len] = '\0';
- return True;
- }
-
- for (i = 0; strip[i] != NULL; i++) {
- diff = strncmp(family, strip[i], striplen[i]);
- if (diff < 0) break;
- if (diff == 0) {
- if (i == STEMPELINDEX) {
- if (strcmp(family, "Stempel Schneidler") == 0) break;
- }
- strcpy(key, family + striplen[i]);
- key[len - striplen[i]] = ' ';
- strcpy(key + len - striplen[i] + 1, strip[i]);
- key[len] = '\0';
- if (CreateSortKey(key, newkey)) strcpy(key, newkey);
- return True;
- }
- }
- strcpy(key, family);
- return False;
-}
-
-#define SKIP_SPACE(buf) while (*buf == ' ' || *buf == '\t') buf++;
-
-static int CountAxes(buf)
- char *buf;
-{
- int count = 0;
-
- while (*buf != '\0') {
- SKIP_SPACE(buf)
- if (*buf != '/') return 0;
- buf++;
- count++;
- if (*buf == ' ' || *buf == '\t' || *buf == '\0') return 0;
- while (*buf != ' ' && *buf != '\t' && *buf != '\0') buf++;
- }
- return count;
-}
-
-static Boolean ParseBlendPositions(buf, blendPos, axes, designs)
- char *buf;
- float *blendPos;
- int *axes, *designs;
-{
- int i, j = 0;
- float f;
-
- *designs = 0;
-
- while (*buf != '\0') {
- SKIP_SPACE(buf)
- if (*buf++ != '[') return True;
-
- /* Now there should be *axes positive floats, separated by space */
- SKIP_SPACE(buf)
- for (i = 0; i < *axes; i++) {
- if (!ScanFloat(buf, &f, &buf)) return True;
- blendPos[j++] = f;
- SKIP_SPACE(buf)
- }
- if (*buf++ != ']') return True;
- (*designs)++;
- }
- return False;
-}
-
-static Boolean ParseBlendMap(buf, breakCount, blendBreak,
- blendBreakValue, axes)
- char *buf;
- int *breakCount;
- int *blendBreak;
- float *blendBreakValue;
- int *axes;
-{
- int i, j = 0;
- int n;
- float f;
-
- /* OK. What we expect to see here is *axes arrays. Each one contains at
- least 2 and no more than 12 subarrays, each of which contains 2 values,
- an int and a float */
-
- for (i = 0; i < *axes; i++) {
-
- breakCount[i] = 0;
-
- SKIP_SPACE(buf)
- if (*buf++ != '[') return True;
- SKIP_SPACE(buf)
-
- while (*buf == '[') {
- buf++;
- SKIP_SPACE(buf)
- /* Now there should be an integer */
- if (!ScanInt(buf, &n, &buf)) return True;
- blendBreak[j] = n;
-
- SKIP_SPACE(buf)
-
- /* Now there should be a float */
- if (!ScanFloat(buf, &f, &buf)) return True;
- blendBreakValue[j++] = f;
- SKIP_SPACE(buf)
-
- /* Nothing more in the array */
- if (*buf++ != ']') return True;
- SKIP_SPACE(buf)
-
- breakCount[i]++;
- if (breakCount[i] == 12 && *buf != ']') return True;
- }
- if (*buf++ != ']') return True;
- }
- SKIP_SPACE(buf)
- if (*buf != '\0') return True;
- return False;
-}
-
-static Boolean ParseAxisNames(axes, buf, names)
- int axes;
- char *buf;
- char *names[];
-{
- int i = 0;
-
- /* We expect to see axes names, each optionally preceded with a / and
- separated by space */
-
- while (*buf != '\0') {
- SKIP_SPACE(buf)
- if (*buf == '/') buf++;
- names[i] = buf;
- while (*buf != ' ' && *buf != '\t' && *buf != '\0') buf++;
- if (buf != names[i]) i++;
- if (*buf != '\0') *buf++ = '\0';
- if (i >= axes) return True;
- }
- return False;
-}
-#undef SKIP_SPACE
-
-static void GetPSFontInfo(fsb, name, axes, designs, axisNames,
- blendPos, breakCount,
- blendBreak, blendBreakValue)
- FontSelectionBoxWidget fsb;
- char *name;
- int *axes, *designs;
- char *axisNames;
- int *breakCount, *blendBreak;
- float *blendBreakValue, *blendPos;
-{
- int entries;
- char **names, **data;
-
- entries = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- "FontAxes", name,
- &names, &data);
- if (entries < 1) {
- *axes = 0;
- return;
- }
- *axes = CountAxes(data[0]);
- if (*axes == 0) return;
- strcpy(axisNames, data[0]);
-
- entries = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- "FontBlendMap", name,
- &names, &data);
- if (entries < 1) {
- *axes = 0;
- return;
- }
- if (ParseBlendMap(data[0], breakCount,
- blendBreak, blendBreakValue, axes)) {
- *axes = 0;
- return;
- }
-
- entries = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- "FontBlendPositions", name,
- &names, &data);
- if (entries < 1) {
- *axes = 0;
- return;
- }
- if (ParseBlendPositions(data[0], blendPos, axes, designs)) {
- *axes = 0;
- return;
- }
-}
-
-static void AddFontRecord(fsb, serverNum, name, family,
- fullname, weight, resident)
- FontSelectionBoxWidget fsb;
- int serverNum;
- String name, family, fullname, weight;
- Boolean resident;
-{
- FontFamilyRec *ff;
- FontRec *f;
- String familyReturn, fullnameReturn, faceReturn;
- char axisNameBuf[256];
- char *axisName[MAX_AXES];
- int blendedFont, undefineIt, brokenFont;
- int axes, designs, breakCount[MAX_AXES],
- blendBreak[12 * MAX_AXES];
- float blendBreakValue[12 * MAX_AXES], blendPos[MAX_AXES * MAX_BLENDS];
- char key[256];
- int i, j, k, n;
-
- name = Canonical(name);
-
- /* First see if it's there already */
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == name) {
- if (!f->resident && resident) f->resident = True;
- return;
- }
- }
- }
-
- /* We believe that names gotten from PS resource files have been
- pre-munged, so no need to do it again */
-
- if (resident) {
- /* Have to get the info from the server */
- _DPSFGetFontInfo(fsb->fsb.context, serverNum, fsb->fsb.old_server,
- family, fullname,
- weight, &blendedFont, &undefineIt, &brokenFont);
-
- if (brokenFont) return;
-
- /* Deal with fonts that don't have useful information */
-
- if (family[0] == '\0') {
- if (fullname[0] == '\0') {
- strcpy(family, name);
- strcpy(fullname, name);
- } else strcpy(family, fullname);
- } else if (fullname[0] == '\0') strcpy(fullname, family);
-
- MungeFontNames(name, family, fullname, weight,
- &familyReturn, &fullnameReturn, &faceReturn);
- if (blendedFont) {
- _DPSFGetBlendedFontInfo(fsb->fsb.context, serverNum,
- undefineIt, fsb->fsb.old_server,
- &axes, &designs, axisNameBuf,
- blendPos, breakCount, blendBreak,
- blendBreakValue, &brokenFont);
- if (brokenFont) axes = 0;
- } else axes = 0;
-
- } else {
- familyReturn = Canonical(family);
- fullnameReturn = XtNewString(fullname);
- faceReturn = Canonical(weight);
- GetPSFontInfo(fsb, name, &axes, &designs, axisNameBuf, blendPos,
- breakCount, blendBreak, blendBreakValue);
- }
-
- /* We didn't get an exact match, go for family match */
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- if (ff->family_name == familyReturn) break;
- }
-
- if (ff == NULL) {
- ff = (FontFamilyRec *) XtMalloc(sizeof(FontFamilyRec));
- ff->next = fsb->fsb.known_families;
- ff->family_name = familyReturn;
- ff->fonts = NULL;
- ff->font_count = 0;
- ff->blend_count = 0;
- if (fsb->fsb.typographic_sort) {
- (void) CreateSortKey(familyReturn, key);
- ff->sort_key = XtNewString(key);
- } else ff->sort_key = ff->family_name;
- fsb->fsb.known_families = ff;
- fsb->fsb.family_count++;
- }
-
- f = (FontRec *) XtMalloc(sizeof(FontRec));
- f->next = ff->fonts;
- f->font_name = name;
- f->full_name = fullnameReturn;
- f->resident = resident;
- f->temp_resident = False;
- f->in_font_creator = False;
- f->pending_delete_next = NULL;
- f->face_name = faceReturn;
- f->CS_face_name = CS(f->face_name, (Widget) fsb);
- f->blend_count = 0;
-
- if (axes != 0 && ParseAxisNames(axes, axisNameBuf, axisName)) {
- BlendDataRec *b;
-
- f->blend_data = b = XtNew(BlendDataRec);
- b->num_axes = axes;
- b->num_designs = designs;
- k = 0;
-
- for (i = 0; i < axes; i++) {
- b->internal_points[i] = breakCount[i] - 2;
- if (b->internal_points[i] <= 0) {
- b->internal_break[i] = NULL;
- b->internal_value[i] = NULL;
- b->internal_points[i] = 0;
- } else {
- b->internal_break[i] = (int *)
- XtMalloc(b->internal_points[i] * sizeof(int));
- b->internal_value[i] = (float *)
- XtMalloc(b->internal_points[i] * sizeof(float));
- }
-
- n = 0;
- for (j = 0; j < breakCount[i]; j++) {
- if (blendBreakValue[k] == 0.0) b->min[i] = blendBreak[k];
- else if (blendBreakValue[k] == 1.0) b->max[i] = blendBreak[k];
- else {
- b->internal_break[i][n] = blendBreak[k];
- b->internal_value[i][n++] = blendBreakValue[k];
- }
- k++;
- }
- b->name[i] = Canonical(axisName[i]);
- }
-
- b->design_positions =
- (float *) XtMalloc(axes * designs * sizeof(float));
- for (i = 0; i < axes * designs; i++) {
- b->design_positions[i] = blendPos[i];
- }
- b->blends = NULL;
- } else f->blend_data = NULL;
-
- ff->fonts = f;
- ff->font_count++;
-}
-
-static void SortFontNames(ff)
- FontFamilyRec *ff;
-{
- FontRec *f, *highest, **prev, **highestPrev;
- FontRec *newFontList = NULL;
-
- while (ff->fonts != NULL) {
- prev = highestPrev = &ff->fonts;
- highest = ff->fonts;
-
- for (f = ff->fonts->next; f != NULL; f = f->next) {
- prev = &(*prev)->next;
- if (strcmp(f->face_name, highest->face_name) > 0) {
- highest = f;
- highestPrev = prev;
- }
- }
-
- *highestPrev = highest->next;
- highest->next = newFontList;
- newFontList = highest;
- }
- ff->fonts = newFontList;
-}
-
-static void SortFontFamilies(fsb)
- FontSelectionBoxWidget fsb;
-{
- FontFamilyRec *ff, *highest, **prev, **highestPrev;
- FontFamilyRec *newFamilyList = NULL;
-
- while (fsb->fsb.known_families != NULL) {
- prev = highestPrev = &fsb->fsb.known_families;
- highest = fsb->fsb.known_families;
-
- for (ff = fsb->fsb.known_families->next; ff != NULL; ff = ff->next) {
- prev = &(*prev)->next;
- if (strcmp(ff->sort_key, highest->sort_key) > 0) {
- highest = ff;
- highestPrev = prev;
- }
- }
-
- *highestPrev = highest->next;
- highest->next = newFamilyList;
- newFamilyList = highest;
- SortFontNames(highest);
- if (fsb->fsb.typographic_sort) XtFree(highest->sort_key);
- highest->sort_key = NULL;
- }
- fsb->fsb.known_families = newFamilyList;
-}
-
-static void AddFamily(fsb, family, fonts, weight, fullname, name)
- FontSelectionBoxWidget fsb;
- char *family, *fonts, *weight, *fullname, *name;
-{
- int j;
- char *ch;
-
- ch = fonts;
- while (*ch != '\0') {
- j = 0;
- while (1) {
- if (*ch == '\\' && (*(ch+1) == '\\' || *(ch+1) == ',')) {
- ch++;
- weight[j++] = *ch++;
- } else if (*ch == '\0' || *ch == ',') {
- weight[j] = '\0';
- break;
- } else weight[j++] = *ch++;
- }
- if (*ch == ',') {
- j = 0;
- ch++;
- while (1) {
- if (*ch == '\\' && (*(ch+1) == '\\' || *(ch+1) == ',')) {
- ch++;
- name[j++] = *ch++;
- } else if (*ch == '\0' || *ch == ',') {
- name[j] = '\0';
- break;
- } else name[j++] = *ch++;
- }
- strcpy(fullname, family);
- strcat(fullname, " ");
- strcat(fullname, weight);
- AddFontRecord(fsb, 0, name, family, fullname, weight, False);
- if (*ch == ',') ch++;
- }
- }
-}
-
-static void GetFontNames(fsb)
- FontSelectionBoxWidget fsb;
-{
- int i;
- char name[256], family[256], fullname[256], weight[256];
- char *buffer, *ch, *start;
- int fontCount, totalLength;
- char **loadableFamilies = NULL, **loadableFamilyFonts = NULL;
-
- fsb->fsb.family_count = 0;
-
- fontCount = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- PSResFontFamily, NULL,
- &loadableFamilies, &loadableFamilyFonts);
- for (i = 0; i < fontCount; i++) {
- AddFamily(fsb, loadableFamilies[i], loadableFamilyFonts[i],
- weight, fullname, name);
- }
-
- XtFree((XtPointer) loadableFamilies);
- XtFree((XtPointer) loadableFamilyFonts);
- FreePSResourceStorage(False);
-
- if (fsb->fsb.get_server_fonts) {
- _DPSFEnumFonts(fsb->fsb.context, &fontCount, &totalLength);
-
- buffer = XtMalloc(totalLength);
- _DPSFGetAllFontNames(fsb->fsb.context, fontCount, totalLength, buffer);
- ch = start = buffer;
- for (i = 0; i < fontCount; i++) {
- while (*ch != ' ') ch++;
- *ch = '\0';
- AddFontRecord(fsb, i, start, family, fullname, weight, True);
- start = ch+1;
- }
- XtFree(buffer);
- }
-
- _DPSFFreeFontInfo(fsb->fsb.context);
- SortFontFamilies(fsb);
- ReadBlends(fsb);
-}
-
-static void SensitizeReset(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtSetSensitive(fsb->fsb.reset_button_child, True);
-}
-
-static void DesensitizeReset(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtSetSensitive(fsb->fsb.reset_button_child, False);
-}
-
-static void ManageFamilyMultiple(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtManageChild(fsb->fsb.family_multiple_label_child);
-
- XtVaSetValues(XtParent(fsb->fsb.family_scrolled_list_child),
- XmNtopWidget, fsb->fsb.family_multiple_label_child, NULL);
-}
-
-static void ManageFaceMultiple(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtManageChild(fsb->fsb.face_multiple_label_child);
-
- XtVaSetValues(XtParent(fsb->fsb.face_scrolled_list_child),
- XmNtopWidget, fsb->fsb.face_multiple_label_child, NULL);
-}
-
-static void ManageMultipleMaster(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtManageChild(fsb->fsb.multiple_master_button_child);
-
- XtVaSetValues(XtParent(fsb->fsb.face_scrolled_list_child),
- XmNbottomWidget, fsb->fsb.multiple_master_button_child,
- NULL);
-}
-
-static void ManageSizeMultiple(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtManageChild(fsb->fsb.size_multiple_label_child);
-}
-
-static void UnmanageFamilyMultiple(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtVaSetValues(XtParent(fsb->fsb.family_scrolled_list_child),
- XmNtopWidget, fsb->fsb.family_label_child, NULL);
-
- XtUnmanageChild(fsb->fsb.family_multiple_label_child);
-}
-
-static void UnmanageFaceMultiple(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtVaSetValues(XtParent(fsb->fsb.face_scrolled_list_child),
- XmNtopWidget, fsb->fsb.face_label_child, NULL);
-
- XtUnmanageChild(fsb->fsb.face_multiple_label_child);
-}
-
-static void UnmanageMultipleMaster(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtUnmanageChild(fsb->fsb.multiple_master_button_child);
-
- XtVaSetValues(XtParent(fsb->fsb.face_scrolled_list_child),
- XmNbottomWidget, fsb->fsb.size_text_field_child, NULL);
-}
-
-static void UnmanageSizeMultiple(fsb)
- FontSelectionBoxWidget fsb;
-{
- XtUnmanageChild(fsb->fsb.size_multiple_label_child);
-}
-
-/* Callbacks for subwidgets */
-
-static Boolean DownloadFont(fsb, name, ctxt, make_shared)
- FontSelectionBoxWidget fsb;
- String name;
- DPSContext ctxt;
- Boolean make_shared;
-{
- int count;
- char **names, **files;
- FILE *f;
-#define BUFLEN 256
- char buf[BUFLEN];
- static char eobuf[] = "\n$Adobe$DPS$Lib$Dict /downloadSuccess true put\n\
-stop\n\
-Magic end of data line )))))))))) 99#2 2#99 <xyz> // 7gsad,32h4ghNmndFgj2\n";
- int currentShared, ok;
-
- /* Assume context is correct */
-
- count = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- PSResFontOutline, name,
- &names, &files);
- if (count == 0) return False;
-
- f = fopen(files[0], "r");
- if (f == NULL) return False;
-
- /* A bug in 1006.9 and earlier servers prevents the more robust
- downloading method from working reliably. */
-
- if (fsb->fsb.old_server) {
- DPSPrintf(ctxt, "\ncurrentshared %s setshared\n",
- (make_shared ? "true" : "false"));
- while (fgets(buf, BUFLEN, f) != NULL) {
- DPSWritePostScript(ctxt, buf, strlen(buf));
- }
- DPSWritePostScript(ctxt, "\nsetshared\n", 11);
- ok = True;
-
- } else {
- _DPSFPrepareToDownload(ctxt, make_shared, &currentShared);
- DPSWriteData(ctxt, "\nexec\n", 6);
-
- while (fgets(buf, BUFLEN, f) != NULL) {
- DPSWriteData(ctxt, buf, strlen(buf));
- }
-
- /* This marks the end of the data stream */
- DPSWriteData(ctxt, eobuf, strlen(eobuf));
-
- /* Check the results of the download by getting the error status */
- _DPSFFinishDownload(ctxt, currentShared, &ok);
- }
-
- fclose (f);
- free(names);
- free(files);
- return ok;
-
-#undef BUFLEN
-}
-
-static void UndefSomeUnusedFonts(fsb, all)
- FontSelectionBoxWidget fsb;
- Boolean all;
-{
- FontRec *f, *nextf, **start;
- int i;
-
- if (!all && fsb->fsb.pending_delete_count < fsb->fsb.max_pending_deletes) {
- return;
- }
-
- if (all) start = &fsb->fsb.pending_delete_font;
- else {
- /* Skip to the end of the ones we're keeping */
- f = fsb->fsb.pending_delete_font;
- for (i = 1; f != NULL && i < fsb->fsb.max_pending_deletes; i++) {
- f = f->pending_delete_next;
- }
- if (f == NULL) return;
- start = &f->pending_delete_next;
- }
-
- for (f = *start; f != NULL; f = nextf) {
- nextf = f->pending_delete_next;
- if (f == fsb->fsb.currently_previewed) {
- start = &f->pending_delete_next;
- continue;
- }
- *start = nextf;
- if (!f->resident && !f->in_font_creator) {
- _DPSFUndefineFont(fsb->fsb.context, f->font_name,
- fsb->fsb.old_server);
- }
- f->temp_resident = False;
- fsb->fsb.pending_delete_count--;
- f->pending_delete_next = NULL;
- }
-}
-
-static void UndefUnusedFonts(w)
- Widget w;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
-
- UndefSomeUnusedFonts(fsb, True);
-}
-
-Boolean _FSBDownloadFontIfNecessary(f, fsb)
- FontRec *f;
- FontSelectionBoxWidget fsb;
-{
- Boolean shared;
-
- if (!f->resident && !f->temp_resident) {
-
- shared = fsb->fsb.make_fonts_shared && !fsb->fsb.undef_unused_fonts;
- if (!fsb->fsb.get_server_fonts) {
- int resident;
- /* This font might already be there, so check before downloading */
- _DPSFIsFontResident(fsb->fsb.context, f->font_name, &resident);
- if (resident) {
- f->resident = True;
- return True;
- }
- }
- if (!DownloadFont(fsb, f->font_name, fsb->fsb.context, shared)) {
- _FSBFlushFont(fsb, f);
- return False;
- }
- if (shared) f->resident = True;
- else f->temp_resident = True;
-
- if (f->pending_delete_next == NULL && fsb->fsb.undef_unused_fonts) {
- f->pending_delete_next = fsb->fsb.pending_delete_font;
- fsb->fsb.pending_delete_font = f;
- fsb->fsb.pending_delete_count++;
- UndefSomeUnusedFonts(fsb, False);
- }
- }
- return True;
-}
-
-static void DoPreview(fsb, override)
- FontSelectionBoxWidget fsb;
- Boolean override;
-{
- int i, n;
- int *selectList, selectCount;
- float size;
- FontFamilyRec *ff = fsb->fsb.known_families;
- FontRec *f;
- BlendRec *b;
- char *chSize, *fontName;
- Dimension height;
- Cardinal depth;
- int bogusFont;
-
- if (!XtIsRealized(fsb)) return;
-
- XtVaGetValues(fsb->fsb.preview_child, XmNheight, &height,
- XmNdepth, &depth, NULL);
-
- if (fsb->fsb.gstate == 0) {
- XDPSSetContextParameters(fsb->fsb.context, XtScreen(fsb), depth,
- XtWindow(fsb->fsb.preview_child), height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextScreenDepth | XDPSContextDrawable |
- XDPSContextRGBMap | XDPSContextGrayMap);
- XDPSCaptureContextGState(fsb->fsb.context, &fsb->fsb.gstate);
- } else XDPSSetContextGState(fsb->fsb.context, fsb->fsb.gstate);
-
- _DPSFClearWindow(fsb->fsb.context);
-
- if (override) {
- if (fsb->fsb.current_family_multiple ||
- fsb->fsb.current_face_multiple ||
- fsb->fsb.current_size_multiple) return;
- f = fsb->fsb.currently_previewed;
- size = fsb->fsb.currently_previewed_size;
- b = fsb->fsb.currently_previewed_blend;
- }
-
- if (!override || f == NULL || size == 0.0) {
- if (!XmListGetSelectedPos(fsb->fsb.family_scrolled_list_child,
- &selectList, &selectCount)) return;
- if (selectCount == 0 ||
- *selectList < 1 || *selectList > fsb->fsb.family_count) return;
-
- for (i = 1; i < *selectList; i++) ff = ff->next;
-
- XtFree((XtPointer) selectList);
-
- if (!XmListGetSelectedPos(fsb->fsb.face_scrolled_list_child,
- &selectList, &selectCount)) return;
- if (selectCount == 0 ||
- *selectList < 1 ||
- *selectList > ff->font_count + ff->blend_count) return;
-
- f = ff->fonts;
- n = 0;
- while (1) {
- n += f->blend_count + 1;
- if (n >= *selectList) {
- n -= f->blend_count;
- if (n == *selectList) b = NULL;
- else for (b = f->blend_data->blends;
- n < *selectList - 1; b = b->next) n++;
- break;
- }
- f = f->next;
- }
-
- XtFree((XtPointer) selectList);
-
- XtVaGetValues(fsb->fsb.size_text_field_child,
- XmNvalue, &chSize, NULL);
-
- if (chSize == NULL || *chSize == '\0') return;
- size = atof(chSize);
- }
-
- if (size <= 0.0) return;
-
- fsb->fsb.currently_previewed = f;
- fsb->fsb.currently_previewed_blend = b;
- fsb->fsb.currently_previewed_size = size;
-
- if (!_FSBDownloadFontIfNecessary(f, fsb)) return;
-
- if (b == NULL) fontName = f->font_name;
- else fontName = b->font_name;
-
- if (fsb->fsb.preview_string == NULL) {
- _DPSFPreviewString(fsb->fsb.context, fontName, size,
- f->full_name, height, &bogusFont);
- } else _DPSFPreviewString(fsb->fsb.context, fontName, size,
- fsb->fsb.preview_string, height, &bogusFont);
- if (bogusFont) {
- _FSBBogusFont(fsb, f);
- }
-}
-
-static void DoValueChangedCallback(fsb)
- FontSelectionBoxWidget fsb;
-{
- String afm = NULL;
- FSBValidateCallbackRec cb;
-
- if (fsb->fsb.get_afm) {
- if (fsb->fsb.currently_selected_face == NULL) afm = NULL;
- else afm = FindAFM((Widget) fsb,
- fsb->fsb.currently_selected_face->font_name);
- }
-
- (void) Verify(fsb, &cb, afm, False);
- cb.reason = FSBValueChanged;
-
- XtCallCallbackList((Widget) fsb, fsb->fsb.value_changed_callback, &cb);
-}
-
-static void ValueChanged(fsb)
- FontSelectionBoxWidget fsb;
-{
- if (fsb->fsb.auto_preview) DoPreview(fsb, False);
- DoValueChangedCallback(fsb);
-}
-
-/* ARGSUSED */
-
-static void PreviewText(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
- XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) callData;
-
- if (!fsb->fsb.preview_fixed) {
- XSetWindowAttributes att;
- att.bit_gravity = ForgetGravity;
- XChangeWindowAttributes(XtDisplay(fsb),
- XtWindow(fsb->fsb.preview_child),
- CWBitGravity, &att);
- fsb->fsb.preview_fixed = True;
- }
-
- if (cb != NULL && cb->event->type == Expose &&
- cb->event->xexpose.count != 0) return;
-
- DoPreview(fsb, True);
-}
-
-/* ARGSUSED */
-
-static void PreviewCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- DoPreview(fsb, False);
-}
-
-/* ARGSUSED */
-
-static void DismissSamplerCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- fsb->fsb.show_sampler = False;
-}
-
-static void ShowSampler(fsb)
- FontSelectionBoxWidget fsb;
-{
- int i;
- Arg args[2];
- Widget s;
-
- if (fsb->fsb.sampler == NULL) {
- FSBCreateSamplerCallbackRec cs;
-
- cs.sampler_shell = NULL;
-
- XtCallCallbackList((Widget) fsb, fsb->fsb.create_sampler_callback,
- (XtPointer) &cs);
-
- if (cs.sampler_shell == NULL || cs.sampler == NULL) {
- fsb->fsb.sampler =
- XtCreatePopupShell("samplerShell",
- transientShellWidgetClass,
- (Widget) fsb, (ArgList) NULL, 0);
- i = 0;
- XtSetArg(args[i], XtNfontSelectionBox, fsb); i++;
- s = XtCreateManagedWidget("sampler", fontSamplerWidgetClass,
- fsb->fsb.sampler, args, i);
- XtAddCallback(s, XtNdismissCallback,
- DismissSamplerCallback, (XtPointer) fsb);
- } else {
- fsb->fsb.sampler = cs.sampler_shell;
- XtAddCallback(cs.sampler, XtNdismissCallback,
- DismissSamplerCallback, (XtPointer) fsb);
- }
- }
- XtPopup(fsb->fsb.sampler, XtGrabNone);
- XRaiseWindow(XtDisplay(fsb->fsb.sampler), XtWindow(fsb->fsb.sampler));
- fsb->fsb.show_sampler = True;
-}
-
-static void ShowCreator(fsb)
- FontSelectionBoxWidget fsb;
-{
- int i;
- Arg args[2];
- FSBCreateCreatorCallbackRec cc;
-
- if (fsb->fsb.creator == NULL) {
-
- cc.creator_shell = NULL;
-
- XtCallCallbackList((Widget) fsb, fsb->fsb.create_creator_callback,
- (XtPointer) &cc);
-
- if (cc.creator_shell == NULL || cc.creator == NULL) {
- cc.creator_shell =
- XtCreatePopupShell("creatorShell",
- transientShellWidgetClass,
- (Widget) fsb, (ArgList) NULL, 0);
- i = 0;
- XtSetArg(args[i], XtNfontSelectionBox, fsb); i++;
- cc.creator =
- XtCreateManagedWidget("creator", fontCreatorWidgetClass,
- cc.creator_shell, args, i);
- }
- fsb->fsb.creator_shell = cc.creator_shell;
- fsb->fsb.creator = cc.creator;
- }
-
- XtPopup(fsb->fsb.creator_shell, XtGrabNone);
- XRaiseWindow(XtDisplay(fsb->fsb.creator_shell),
- XtWindow(fsb->fsb.creator_shell));
-
- _FSBSetCreatorFamily(fsb->fsb.creator, fsb->fsb.currently_selected_family);
-}
-
-/* ARGSUSED */
-
-static void ShowCreatorCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- ShowCreator(fsb);
-}
-
-/* ARGSUSED */
-
-static void ShowSamplerCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- ShowSampler(fsb);
-}
-
-/* ARGSUSED */
-
-static void PreviewDoubleClick(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- DoPreview(fsb, False);
-}
-
-/* ARGSUSED */
-
-static void ResizePreview(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- Dimension height;
- Cardinal depth;
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- if (!XtIsRealized(widget) || fsb->fsb.gstate == 0) return;
-
- XtVaGetValues(widget, XmNheight, &height, XmNdepth, &depth, NULL);
-
- XDPSSetContextGState(fsb->fsb.context, fsb->fsb.gstate);
-
- XDPSSetContextParameters(fsb->fsb.context, XtScreen(widget), depth,
- XtWindow(widget), height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextScreenDepth | XDPSContextDrawable);
-
- _DPSFReclip(fsb->fsb.context);
-
- XDPSUpdateContextGState(fsb->fsb.context, fsb->fsb.gstate);
-}
-
-static String FindAFMRecursive(w, name, recur)
- Widget w;
- String name;
- Boolean recur;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- int count;
- char **names, **files;
- String ret, ch;
-
- if (name == NULL) return NULL;
-
- count = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- PSResFontAFM,
- name,
- &names, &files);
-
- if (count == 0 && recur) {
- for (ch = name; *ch != '_' && *ch != '\0'; ch++) {}
- if (*ch == '\0') return NULL;
- *ch = '\0';
- ret = FindAFMRecursive(w, name, False);
- *ch = '_';
- return ret;
- }
-
- if (count == 0) return NULL;
- ret = files[0];
- free(names);
- free(files);
- return ret;
-}
-
-static String FindAFM(w, name)
- Widget w;
- String name;
-{
- return FindAFMRecursive(w, name, True);
-}
-
-static String FindFontFileRecursive(w, name, recur)
- Widget w;
- String name;
- Boolean recur;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- int count;
- char **names, **files;
- String ret, ch;
-
- if (name == NULL) return NULL;
-
- count = ListPSResourceFiles(fsb->fsb.resource_path_override,
- fsb->fsb.default_resource_path,
- PSResFontOutline,
- name,
- &names, &files);
-
- if (count == 0 && recur) {
- for (ch = name; *ch != '_' && *ch != '\0'; ch++) {}
- if (*ch == '\0') return NULL;
- *ch = '\0';
- ret = FindFontFileRecursive(w, name, False);
- *ch = '_';
- return ret;
- }
-
- if (count == 0) return NULL;
- ret = files[0];
- free(names);
- free(files);
- return ret;
-}
-
-static String FindFontFile(w, name)
- Widget w;
- String name;
-{
- return FindFontFileRecursive(w, name, True);
-}
-
-static Boolean Verify(fsb, cb, afm, doIt)
- FontSelectionBoxWidget fsb;
- FSBValidateCallbackRec *cb;
- String afm;
- Boolean doIt;
-{
- char *chSize;
- int i;
-
- if (fsb->fsb.current_family_multiple) {
- cb->family = NULL;
- cb->family_selection = FSBMultiple;
- } else if (fsb->fsb.currently_selected_family == NULL) {
- cb->family = NULL;
- cb->family_selection = FSBNone;
- } else {
- cb->family = fsb->fsb.currently_selected_family->family_name;
- cb->family_selection = FSBOne;
- }
-
- if (fsb->fsb.current_face_multiple) {
- cb->face = NULL;
- cb->face_selection = FSBMultiple;
- } else if (fsb->fsb.currently_selected_face == NULL) {
- cb->face = NULL;
- cb->face_selection = FSBNone;
- } else {
- cb->face = fsb->fsb.currently_selected_face->face_name;
- cb->face_selection = FSBOne;
- }
-
- if (cb->family_selection == FSBMultiple ||
- cb->face_selection == FSBMultiple) {
- cb->name = NULL;
- cb->name_selection = FSBMultiple;
- } else if (fsb->fsb.currently_selected_face == NULL) {
- cb->name = NULL;
- cb->name_selection = FSBNone;
- } else {
- if (fsb->fsb.currently_selected_blend != NULL) {
- cb->name = fsb->fsb.currently_selected_blend->font_name;
- } else cb->name = fsb->fsb.currently_selected_face->font_name;
- cb->name_selection = FSBOne;
- }
-
- if (fsb->fsb.current_size_multiple) {
- cb->size = 0.0;
- cb->size_selection = FSBMultiple;
- } else {
- XtVaGetValues(fsb->fsb.size_text_field_child, XmNvalue, &chSize, NULL);
-
- if (chSize == NULL || *chSize == '\0') {
- cb->size = 0.0;
- cb->size_selection = FSBNone;
- } else {
- cb->size = atof(chSize);
- cb->size_selection = FSBOne;
- }
- }
-
- cb->afm_filename = afm;
- cb->afm_present = (afm != NULL);
- cb->doit = True;
-
- if (fsb->fsb.currently_selected_blend == NULL) {
- cb->blend = cb->base_name = NULL;
- for (i = 0; i < MAX_AXES; i++) cb->axis_percent[i] = 0.0;
- } else {
- cb->blend = fsb->fsb.currently_selected_blend->blend_name;
- cb->base_name = fsb->fsb.currently_selected_face->font_name;
- for (i = 0; i < MAX_AXES; i++) {
- cb->axis_percent[i] = fsb->fsb.currently_selected_blend->data[i];
- }
- }
-
- if (doIt) XtCallCallbackList((Widget) fsb, fsb->fsb.validate_callback, cb);
- return cb->doit;
-}
-
-static Boolean VerifyAndCallback(fsb, reason, callback)
- FontSelectionBoxWidget fsb;
- FSBCallbackReason reason;
- XtCallbackList callback;
-{
- String afm = NULL;
- FSBValidateCallbackRec cb;
- FontRec *fsave, *face;
-
- if (fsb->fsb.get_afm) {
- if (fsb->fsb.currently_selected_face == NULL) afm = NULL;
- else afm = FindAFM((Widget) fsb,
- fsb->fsb.currently_selected_face->font_name);
- }
-
- DoPreview(fsb, False);
-
- cb.reason = reason;
- if (!Verify(fsb, &cb, afm, True)) return False;
-
- fsb->fsb.font_family_multiple = fsb->fsb.current_family_multiple;
- if (!fsb->fsb.font_family_multiple &&
- fsb->fsb.currently_selected_family != NULL) {
- fsb->fsb.font_family =
- fsb->fsb.currently_selected_family->family_name;
- } else fsb->fsb.font_family = NULL;
-
- fsb->fsb.font_face_multiple = fsb->fsb.current_face_multiple;
- if (!fsb->fsb.font_face_multiple &&
- fsb->fsb.currently_selected_face != NULL) {
- fsb->fsb.font_face = fsb->fsb.currently_selected_face->face_name;
- } else fsb->fsb.font_face = NULL;
-
- fsb->fsb.font_name_multiple =
- fsb->fsb.font_family_multiple || fsb->fsb.font_face_multiple;
- if (!fsb->fsb.font_name_multiple &&
- fsb->fsb.currently_selected_face != NULL) {
- fsb->fsb.font_name = fsb->fsb.currently_selected_face->font_name;
- } else fsb->fsb.font_name = NULL;
-
- fsb->fsb.font_size_multiple = fsb->fsb.current_size_multiple;
- if (!fsb->fsb.font_size_multiple) {
- fsb->fsb.font_size = cb.size;
- }
-
- if (fsb->fsb.currently_selected_blend != NULL) {
- fsb->fsb.font_blend = fsb->fsb.currently_selected_blend->blend_name;
- } else fsb->fsb.font_blend = NULL;
-
- if (fsb->fsb.undef_unused_fonts) {
- fsave = fsb->fsb.currently_previewed;
- if (fsb->fsb.make_fonts_shared) {
- fsb->fsb.currently_previewed = NULL;
- }
- UndefUnusedFonts(fsb);
- fsb->fsb.currently_previewed = fsave;
- face = fsb->fsb.currently_selected_face;
- if (face != NULL && !face->resident) {
- face->resident = True;
- if (fsb->fsb.make_fonts_shared) {
- (void) DownloadFont(fsb, face->font_name,
- fsb->fsb.context, True);
- /* If making it shared, be sure to synchronize with
- the caller who might be using a different context */
- DPSWaitContext(fsb->fsb.context);
- }
- }
- }
-
- XtCallCallbackList((Widget) fsb, callback, &cb);
- return True;
-}
-
-/* ARGSUSED */
-
-static void OKCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- if (!VerifyAndCallback(fsb, FSBOK, fsb->fsb.ok_callback)) return;
- if (XtIsShell(XtParent(fsb))) XtPopdown(XtParent(fsb));
- WriteBlends(fsb);
- DesensitizeReset(fsb);
- if (fsb->fsb.show_sampler) XtPopdown(fsb->fsb.sampler);
-}
-
-/* ARGSUSED */
-
-static void ApplyCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- (void) VerifyAndCallback(fsb, FSBApply, fsb->fsb.apply_callback);
- WriteBlends(fsb);
- DesensitizeReset(fsb);
-}
-
-static void ResetFSB(fsb, reason)
- FontSelectionBoxWidget fsb;
- FSBCallbackReason reason;
-{
- FSBCallbackRec cb;
- int i;
-
- fsb->fsb.currently_previewed = NULL;
- fsb->fsb.currently_previewed_size = fsb->fsb.currently_selected_size = 0.0;
- SetUpCurrentSelections(fsb);
- if (fsb->fsb.undef_unused_fonts) UndefUnusedFonts(fsb);
-
- cb.reason = reason;
- if (fsb->fsb.font_family_multiple) {
- cb.family = NULL;
- cb.family_selection = FSBMultiple;
- } else if (fsb->fsb.font_family == NULL) {
- cb.family = NULL;
- cb.family_selection = FSBNone;
- } else {
- cb.family = fsb->fsb.font_family;
- cb.family_selection = FSBOne;
- }
-
- if (fsb->fsb.font_face_multiple) {
- cb.face = NULL;
- cb.face_selection = FSBMultiple;
- } else if (fsb->fsb.font_face == NULL) {
- cb.face = NULL;
- cb.face_selection = FSBNone;
- } else {
- cb.face = fsb->fsb.font_face;
- cb.face_selection = FSBOne;
- }
-
- if (cb.family_selection == FSBMultiple ||
- cb.face_selection == FSBMultiple) {
- cb.name = NULL;
- cb.name_selection = FSBMultiple;
- } else if (fsb->fsb.font_face == NULL) {
- cb.name = NULL;
- cb.name_selection = FSBNone;
- } else {
- cb.name = fsb->fsb.font_name;
- cb.name_selection = FSBOne;
- }
-
- if (fsb->fsb.font_size_multiple) {
- cb.size = 0.0;
- cb.size_selection = FSBMultiple;
- } else {
- cb.size = fsb->fsb.font_size;
- cb.size_selection = FSBOne;
- }
-
- cb.afm_filename = NULL;
- cb.afm_present = False;
-
- cb.blend = fsb->fsb.font_blend;
- if (cb.blend == NULL || fsb->fsb.currently_selected_blend == NULL) {
- cb.base_name = NULL;
- for (i = 0; i < MAX_AXES; i++) cb.axis_percent[i] = 0;
- } else {
- cb.base_name = fsb->fsb.currently_selected_face->font_name;
- for (i = 0; i < MAX_AXES; i++) {
- cb.axis_percent[i] = fsb->fsb.currently_selected_blend->data[i];
- }
- }
-
- if (reason == FSBReset) {
- XtCallCallbackList((Widget) fsb, fsb->fsb.reset_callback, &cb);
- } else XtCallCallbackList((Widget) fsb, fsb->fsb.cancel_callback, &cb);
-}
-
-/* ARGSUSED */
-
-static void ResetCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- ResetFSB(fsb, FSBReset);
- DesensitizeReset(fsb);
-}
-
-/* ARGSUSED */
-
-static void CancelCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- ResetFSB(fsb, FSBCancel);
- if (XtIsShell(XtParent(fsb))) XtPopdown(XtParent(fsb));
- DesensitizeReset(fsb);
- if (fsb->fsb.show_sampler) XtPopdown(fsb->fsb.sampler);
-}
-
-/* There's a problem; sometimes the change has already been made in the field,
- and sometimes it hasn't. The times when it has seem to correspond to
- making changes with the size option menu, so we use this disgusting
- global flag to notice when this happens. We also use this to tell whether
- or not the change is coming from internal to the widget or as a result
- of user interaction. */
-
-static Boolean changingSize = False;
-
-/* ARGSUSED */
-
-static void SizeSelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- String value;
- Widget option;
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
- char *ch;
-
- XtVaGetValues(widget, XmNvalue, &value, NULL);
-
- if (value == NULL) option = fsb->fsb.other_size;
- else {
- if (value[0] != '\0' && fsb->fsb.current_size_multiple) {
- fsb->fsb.current_size_multiple = False;
- UnmanageSizeMultiple(fsb);
- }
- for (ch = value; *ch != '\0'; ch++) if (*ch == '.') *ch = '-';
-
- option = XtNameToWidget(fsb->fsb.size_menu, value);
- if (option == NULL) option = fsb->fsb.other_size;
- }
-
- XtVaSetValues(fsb->fsb.size_option_menu_child,
- XmNmenuHistory, option, NULL);
-
- if (value != NULL && value[0] != '\0') {
- fsb->fsb.currently_selected_size = atof(value);
- } else fsb->fsb.currently_selected_size = 0.0;
-
- if (!changingSize) SensitizeReset(fsb);
- fsb->fsb.current_size_multiple = False;
-}
-
-/* ARGSUSED */
-
-static void TextVerify(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- int i;
- XmTextVerifyPtr v = (XmTextVerifyPtr) callData;
- char ch, *cp;
- int decimalPoints = 0;
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- if (changingSize) return; /* We know what we're doing; allow it */
-
- /* Should probably look at format field, but seems to contain garbage */
-
- if (v->text->length == 0) return;
-
- if (v->text->length == 1) {
- ch = v->text->ptr[0];
- if (ch == 'p' || ch == 'P') {
- XtCallCallbacks(fsb->fsb.preview_button_child,
- XmNactivateCallback, NULL);
- v->doit = False;
- return;
- }
- }
-
- for (i = 0; i < v->text->length; i++) {
- ch = v->text->ptr[i];
- if (ch == '.') decimalPoints++;
- else if (!isdigit(ch)) {
- v->doit = False;
- return;
- }
- }
-
- if (decimalPoints > 1) {
- v->doit = False;
- return;
- }
-
- XtVaGetValues(widget, XmNvalue, &cp, NULL);
-
- for (/**/; *cp != '\0'; cp++) {
- if (*cp == '.') decimalPoints++;
- }
-
- if (decimalPoints > 1) v->doit = False;
-}
-
-/* ARGSUSED */
-
-static void SetSize(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- char buf[20];
- char *ch;
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
-
- if (fsb->fsb.current_size_multiple) {
- fsb->fsb.current_size_multiple = False;
- UnmanageSizeMultiple(fsb);
- }
-
- strcpy(buf, XtName(widget));
- for (ch = buf; *ch != '\0'; ch++) if (*ch == '-') *ch++ = '.';
-
- changingSize = True;
- XtVaSetValues(fsb->fsb.size_text_field_child, XmNvalue, buf, NULL);
- changingSize = False;
-
- SensitizeReset(fsb);
- ValueChanged(fsb);
-}
-
-/* This makes sure the selected item is visible */
-
-static void ListSelectPos(w, pos, notify)
- Widget w;
- int pos;
- Boolean notify;
-{
- int topPos, items, visible;
-
- XmListSelectPos(w, pos, notify);
-
- XtVaGetValues(w, XmNtopItemPosition, &topPos,
- XmNvisibleItemCount, &visible, XmNitemCount, &items, NULL);
-
- if (pos >= topPos && pos < topPos + visible) return;
- topPos = pos - (visible-1)/2;
- if (topPos + visible > items) topPos = items - visible + 1;
- if (topPos < 1) topPos = 1;
-
- XtVaSetValues(w, XmNtopItemPosition, topPos, NULL);
-}
-
-/* The following function Copyright 1987, 1988 by Digital Equipment
-Corporation, Maynard, Massachusetts, and the Massachusetts Institute of
-Technology, Cambridge, Massachusetts. */
-
-static String GetRootDirName(buf)
- String buf;
-{
-#ifndef X_NOT_POSIX
- uid_t uid;
-#else
- int uid;
- extern int getuid();
-#ifndef SYSV386
- extern struct passwd *getpwuid(), *getpwnam();
-#endif
-#endif
- struct passwd *pw;
- static char *ptr = NULL;
-
- if (ptr == NULL) {
- if (!(ptr = getenv("HOME"))) {
- if ((ptr = getenv("USER")) != NULL) pw = getpwnam(ptr);
- else {
- uid = getuid();
- pw = getpwuid(uid);
- }
- if (pw) ptr = pw->pw_dir;
- else {
- ptr = NULL;
- *buf = '\0';
- }
- }
- }
-
- if (ptr)
- (void) strcpy(buf, ptr);
-
- buf += strlen(buf);
- *buf = '/';
- buf++;
- *buf = '\0';
- return buf;
-}
-
-static void WriteBlendLine(f, family, face, blend, name, axes, p)
- FILE *f;
- String family, face, blend, name;
- int axes;
- float *p;
-{
- register char *ch;
- int i;
-
- ch = family;
- while (*ch != '\0') {
- if (*ch == ',' || *ch == '\\') (void) putc('\\', f);
- (void) putc(*ch++, f);
- }
- putc(',', f);
- ch = face;
- while (*ch != '\0') {
- if (*ch == ',' || *ch == '\\') (void) putc('\\', f);
- (void) putc(*ch++, f);
- }
- putc(',', f);
- ch = blend;
- while (*ch != '\0') {
- if (*ch == ',' || *ch == '\\') (void) putc('\\', f);
- (void) putc(*ch++, f);
- }
- (void) putc(',', f);
- ch = name;
- while (*ch != '\0') {
- if (*ch == ',' || *ch == '\\') (void) putc('\\', f);
- (void) putc(*ch++, f);
- }
- for (i = 0; i < axes; i++) fprintf(f, ",%f", p[i]);
- (void) putc('\n', f);
-}
-
-static void WriteBlends(fsb)
- FontSelectionBoxWidget fsb;
-{
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
- String blendEnv;
- char homeDir[PATH_BUF_SIZE];
- FILE *blendFile = NULL;
- char fileName[PATH_BUF_SIZE];
-
- if (!fsb->fsb.blends_changed) return;
-
- blendEnv = getenv("DPSFONTRC");
-
- if (blendEnv != NULL) blendFile = fopen(blendEnv, "w");
-
- if (blendFile == NULL) {
- (void) GetRootDirName(homeDir);
- sprintf(fileName, "%s/.dpsfontrc", homeDir);
- blendFile = fopen(fileName, "w");
-
- if (blendFile == NULL) return;
- }
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->blend_data != NULL) {
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- WriteBlendLine(blendFile, ff->family_name, f->face_name,
- b->blend_name, b->font_name,
- f->blend_data->num_axes, b->data);
- }
- }
- }
- }
-
- fclose(blendFile);
- fsb->fsb.blends_changed = False;
-}
-
-static Boolean ParseBlendLine(buf, family, face, blend, name, p)
- String buf, family, face, blend, name;
- float *p;
-{
- char *src, *dst;
- int i;
- float f;
-
- src = buf;
- dst = family;
- while (*src != ',' && *src != '\0') {
- if (*src == '\\') src++;
- if (*src == '\0') return False;
- *dst++ = *src++;
- }
- if (*src == '\0') return False;
- *dst = '\0';
- src++;
- dst = face;
- while (*src != ',' && *src != '\0') {
- if (*src == '\\') src++;
- if (*src == '\0') return False;
- *dst++ = *src++;
- }
- if (*src == '\0') return False;
- *dst = '\0';
- src++;
- dst = blend;
- while (*src != ',' && *src != '\0') {
- if (*src == '\\') src++;
- if (*src == '\0') return False;
- *dst++ = *src++;
- }
- if (*src == '\0') return False;
- *dst = '\0';
- src++;
- dst = name;
- while (*src != ',' && *src != '\0') {
- if (*src == '\\') src++;
- if (*src == '\0') return False;
- *dst++ = *src++;
- }
- if (*src == '\0') return False;
- *dst = '\0';
- for (i = 0; i < MAX_AXES; i++) {
- src++;
- if (!ScanFloat(src, &f, &src)) {
- for (/**/; i < MAX_AXES; i++) p[i] = 0;
- return True;;
- }
- else p[i] = f;
- }
- return True;
-}
-
-static void ReadBlends(fsb)
- FontSelectionBoxWidget fsb;
-{
- String blendEnv;
- char homeDir[PATH_BUF_SIZE];
- FILE *blendFile = NULL;
- char fileName[PATH_BUF_SIZE];
-#define BUF 256
- char buf[BUF+1], family[BUF+1], face[BUF+1], blend[BUF+1], name[BUF+1];
- char *cfamily, *cface;
- float p[MAX_AXES];
- FontRec *f;
- FontFamilyRec *ff;
- BlendRec *b, *newb, **lastb;
- char *spaceBlend;
- char *lastFamily = NULL;
- int cmp, i;
-
- blendEnv = getenv("DPSFONTRC");
-
- if (blendEnv != NULL) blendFile = fopen(blendEnv, "r");
-
- if (blendFile == NULL) {
- (void) GetRootDirName(homeDir);
- sprintf(fileName, "%s/.dpsfontrc", homeDir);
- blendFile = fopen(fileName, "r");
-
- if (blendFile == NULL) return;
- }
-
- while (1) {
- if (fgets(buf, BUF, blendFile) == NULL) {
- fclose(blendFile);
- return;
- }
- if (ParseBlendLine(buf, family, face, blend, name, p)) {
- cfamily = Canonical(family);
- if (cfamily != lastFamily) {
- for (ff = fsb->fsb.known_families;
- ff != NULL && ff->family_name != cfamily;
- ff = ff->next) {}
- }
- if (ff == NULL) continue;
- lastFamily = cfamily;
- cface = Canonical(face);
- for (f = ff->fonts; f != NULL && f->face_name != cface;
- f = f->next) {}
- /* If the blend data is NULL, we have a blend line for a font
- that we don't believe is a MM font. Ignore it */
- if (f != NULL && f->blend_data != NULL) {
- lastb = &f->blend_data->blends;
- cmp = -1;
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- cmp = strcmp(blend, b->blend_name);
- if (cmp < 0) break;
- lastb = &b->next;
- }
- if (cmp != 0) {
- newb = XtNew(BlendRec);
- newb->blend_name = Canonical(blend);
- newb->CS_blend_name = CS(newb->blend_name, (Widget) fsb);
-
- spaceBlend = (char *) XtMalloc(strlen(blend) + 4);
- spaceBlend[0] = spaceBlend[1] = spaceBlend[2] = ' ';
- strcpy(spaceBlend+3, blend);
- newb->CS_space_blend_name = CS(spaceBlend, (Widget) fsb);
- XtFree((XtPointer) spaceBlend);
-
- for (i = 0; i < MAX_AXES; i++) newb->data[i] = p[i];
- newb->font_name = Canonical(name);
-
- f->blend_count++;
- ff->blend_count++;
-
- newb->next = b;
- *lastb = newb;
- }
- }
- }
- }
-}
-
-static void SetUpFaceList(fsb, ff)
- FontSelectionBoxWidget fsb;
- FontFamilyRec *ff;
-{
- FontRec *f;
- BlendRec *b;
- XmString *CSfaces;
- Boolean multiple = False;
- int i;
-
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->blend_data != NULL) {
- multiple = True;
- break;
- }
- }
- if (multiple) ManageMultipleMaster(fsb);
- else UnmanageMultipleMaster(fsb);
-
- CSfaces = (XmString *) XtCalloc(ff->font_count + ff->blend_count,
- sizeof(XmString));
-
- i = 0;
- for (f = ff->fonts; f != NULL; f = f->next) {
- CSfaces[i++] = f->CS_face_name;
- if (f->blend_data != NULL) {
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- CSfaces[i++] = b->CS_space_blend_name;
- }
- }
- }
-
- XtVaSetValues(fsb->fsb.face_scrolled_list_child,
- XmNitemCount, ff->font_count + ff->blend_count,
- XmNitems, CSfaces, NULL);
- XtFree((XtPointer) CSfaces);
-}
-
-/* ARGSUSED */
-
-static void DeleteMessage(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XtDestroyWidget(widget);
-}
-
-static void FlushFont(fsb, font)
- FontSelectionBoxWidget fsb;
- FontRec *font;
-{
- FontRec *f, *f1;
- FontFamilyRec *ff, *ff1;
- Boolean previewedFamily = False;
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f == font) goto FOUND_BOGUS;
- }
- }
-
-FOUND_BOGUS:
- if (f != NULL) {
- for (f1 = ff->fonts; f1 != NULL; f1 = f1->next) {
- if (f1 == fsb->fsb.currently_previewed) {
- previewedFamily = True;
- break;
- }
- }
-
- if (ff->fonts == f) {
- ff->fonts = f->next;
- } else {
- for (f1 = ff->fonts; f1 != NULL && f1->next != f; f1 = f1->next) {}
- if (f1 != NULL) f1->next = f->next;
- }
-
- ff->font_count--;
- ff->blend_count -= f->blend_count;
-
- if (f == fsb->fsb.currently_selected_face) {
- fsb->fsb.currently_selected_face = NULL;
- fsb->fsb.currently_selected_blend = NULL;
- }
-
- if (previewedFamily) SetUpFaceList(fsb, ff);
-
- if (f == fsb->fsb.currently_previewed) {
- fsb->fsb.currently_previewed = NULL;
- fsb->fsb.currently_previewed_blend = NULL;
- ValueChanged(fsb);
- }
-
- /* We do not free the FontRec or FontFamilyRec. In the long
- run we don't expect to leak much storage this way, since we
- shouldn't have many bogus fonts, and invalidating every
- reference here, in the sampler, and in the creator isn't
- worth the small storage waste. */
-
- if (ff->fonts == NULL) {
- if (fsb->fsb.known_families == ff) {
- fsb->fsb.known_families = ff->next;
- } else {
- for (ff1 = fsb->fsb.known_families;
- ff1 != NULL && ff1->next != ff; ff1 = ff1->next) {}
- if (ff1 != NULL) ff1->next = ff->next;
- }
-
- fsb->fsb.family_count--;
-
- if (ff == fsb->fsb.currently_selected_family) {
- fsb->fsb.currently_selected_family = NULL;
- }
-
- DisplayFontFamilies(fsb);
- }
- }
-}
-
-extern void _FSBFlushFont(fsb, font)
- FontSelectionBoxWidget fsb;
- FontRec *font;
-{
- if (font == fsb->fsb.currently_previewed) _FSBBogusFont(fsb, font);
- else FlushFont(fsb, font);
-}
-
-extern void _FSBBogusFont(fsb, font)
- FontSelectionBoxWidget fsb;
- FontRec *font;
-{
- Widget message, w;
-
- message = XmCreateInformationDialog((Widget) fsb, "invalidFontMessage",
- (ArgList) NULL, 0);
- w = XmMessageBoxGetChild(message, XmDIALOG_CANCEL_BUTTON);
- XtUnmanageChild(w);
- w = XmMessageBoxGetChild(message, XmDIALOG_HELP_BUTTON);
- XtUnmanageChild(w);
- XtAddCallback(message, XmNokCallback, DeleteMessage, (XtPointer) NULL);
-
- XtManageChild(message);
-
- /* Now get this blasted thing out of here */
- FlushFont(fsb, font);
-}
-
-void _FSBSetUpFaceList(fsb, redisplay)
- FontSelectionBoxWidget fsb;
- Bool redisplay;
-{
- FontRec *f;
- BlendRec *b;
- int i;
-
- SetUpFaceList(fsb, fsb->fsb.currently_selected_family);
-
- f = fsb->fsb.currently_selected_family->fonts;
- i = 1;
- while (f != NULL) {
- if (f == fsb->fsb.currently_selected_face) {
- if (f->blend_data != NULL) {
- b = f->blend_data->blends;
- if (fsb->fsb.currently_selected_blend != NULL) {
- i++;
- while (b != NULL &&
- b != fsb->fsb.currently_selected_blend) {
- i++;
- b = b->next;
- }
- }
- }
- break;
- } else {
- i += f->blend_count+1;
- f = f->next;
- }
- }
-
- ListSelectPos(fsb->fsb.face_scrolled_list_child, i, False);
- if (redisplay) ValueChanged(fsb);
- fsb->fsb.blends_changed = True;
-}
-
-static String categories[][6] = {
- {"Regular", "Roman", "Medium", "Book", "Light", NULL},
- {"Italic", "Slanted", "Oblique", NULL},
- {"Demi", "Semibold", "Heavy", "Bold", NULL},
- {NULL},
-};
-
-#define NORMALINDEX 0][0
-#define ITALICINDEX 1][0
-#define BOLDINDEX 2][3
-#define DEMIINDEX 2][0
-#define LIGHTINDEX 0][4
-#define BOOKINDEX 0][3
-
-static String extraNormalFaces[] = {"Demi", "Semibold", NULL};
-
-static int MatchFaceName(rec, gaveUp)
- FSBFaceSelectCallbackRec *rec;
- Boolean *gaveUp;
-{
- int i, j, k, face;
-#define PIECEMAX 10
- String pieces[PIECEMAX];
- int numPieces;
- int pass;
- char *ch, *start, *compare;
- char save;
- static Boolean categoriesInited = False;
- static char *canonicalBold, *canonicalLight, *canonicalBook;
-
- *gaveUp = False;
-
- if (!categoriesInited) {
- for (i = 0; categories[i][0] != NULL; i++) {
- for (j = 0; categories[i][j] != NULL; j++) {
- categories[i][j] = Canonical(categories[i][j]);
- }
- }
- for (i = 0; extraNormalFaces[i] != NULL; i++) {
- extraNormalFaces[i] = Canonical(extraNormalFaces[i]);
- }
- canonicalBold = categories[BOLDINDEX];
- canonicalLight = categories[LIGHTINDEX];
- canonicalBook = categories[BOOKINDEX];
- categoriesInited = True;
- }
-
- if (rec->current_face == NULL || rec->current_face[0] == '\0') {
- goto GIVE_UP;
- }
-
- /* First check for an exact match */
-
- for (i = 0; i < rec->num_available_faces; i++) {
- if (rec->available_faces[i] == rec->current_face) return i;
- }
-
- /* Try some category matching. We make two passes; in the first pass
- we remove "Bold" from the "Demi" family and "Light" and "Book" from
- the "Regular" family; in the second pass we include them. We ignore
- leading digits in the face name. */
-
- categories[BOLDINDEX] = categories[LIGHTINDEX] =
- categories[BOOKINDEX] = NULL;
-
- i = 0;
- ch = rec->current_face;
- while (*ch == ' ' || isdigit(*ch)) ch++;
- start = ch;
-
- while (1) {
- while (*ch != ' ' && *ch != '\0') ch++;
- save = *ch;
- *ch = '\0';
- compare = Canonical(start);
- for (j = 0; categories[j][0] != NULL; j++) {
- for (k = 0; categories[j][k] != NULL; k++) {
- if (compare == categories[j][k]) {
- pieces[i++] = categories[j][0];
- goto FOUND_PIECE;
- }
- }
- }
- pieces[i++] = compare; /* A unique piece */
-FOUND_PIECE:
- *ch = save;
- while (*ch == ' ') ch++;
- if (*ch == '\0') break;
- if (i >= PIECEMAX) goto GIVE_UP;
- start = ch;
- }
- numPieces = i;
- if (numPieces == 0) goto GIVE_UP;
-
- /* Special case starting with the italic category */
-
- if (pieces[0] == categories[ITALICINDEX] && numPieces < PIECEMAX-1) {
- for (i = numPieces; i > 0; i--) pieces[i] = pieces[i-1];
- pieces[0] = categories[NORMALINDEX];
- numPieces++;
- }
-
- for (pass = 0; pass < 2; pass++) {
- if (pass == 1) {
- categories[BOLDINDEX] = canonicalBold;
- categories[LIGHTINDEX] = canonicalLight;
- categories[BOOKINDEX] = canonicalBook;
- for (i = 0; i < numPieces; i++) {
- if (pieces[i] == canonicalBold) {
- pieces[i] = categories[DEMIINDEX];
- } else if (pieces[i] == canonicalLight) {
- pieces[i] = categories[NORMALINDEX];
- } else if (pieces[i] == canonicalBook) {
- pieces[i] = categories[NORMALINDEX];
- }
- }
- }
-
- /* Now match against each face */
-
- for (face = 0; face < rec->num_available_faces; face++) {
- i = 0;
- ch = rec->available_faces[face];
- while (*ch == ' ' || isdigit(*ch)) ch++;
- start = ch;
-
- while (1) {
- while (*ch != ' ' && *ch != '\0') ch++;
- save = *ch;
- *ch = '\0';
- compare = Canonical(start);
- for (j = 0; categories[j][0] != NULL; j++) {
- for (k = 0; categories[j][k] != NULL; k++) {
- if (compare == categories[j][k]) {
- compare = categories[j][0];
- goto MATCH;
- }
- }
- }
- MATCH:
- /* Special case matching the italic category again */
-
- if (i == 0 && compare == categories[ITALICINDEX] &&
- pieces[0] == categories[NORMALINDEX] &&
- numPieces > 1 &&
- pieces[1] == categories[ITALICINDEX]) i = 1;
-
- if (pieces[i] != compare) {
- *ch = save;
- goto NEXT_FACE;
- } else i++;
-
- *ch = save;
- while (*ch == ' ') ch++;
- if (*ch == '\0') break;
- if (i >= numPieces) goto NEXT_FACE;
- start = ch;
- }
- if (i == numPieces) return face; /* Found a match! */
- NEXT_FACE:
- ;
- }
- }
-
- /* Couldn't find a match. Look for a "normal face". Make sure "Light"
- and "Book" are installed. Again, ignore leading spaces. */
-GIVE_UP:
- *gaveUp = True;
- categories[LIGHTINDEX] = canonicalLight;
- categories[BOOKINDEX] = canonicalBook;
-
- for (i = 0; categories[0][i] != NULL; i++) {
- for (face = 0; face < rec->num_available_faces; face++) {
- compare = rec->available_faces[face];
- while (*compare == ' ' || isdigit(*compare)) compare++;
- if (compare != rec->available_faces[face]) {
- compare = Canonical(compare);
- }
- if (categories[0][i] == compare) return face;
- }
- }
-
- for (i = 0; extraNormalFaces[i] != NULL; i++) {
- for (face = 0; face < rec->num_available_faces; face++) {
- compare = rec->available_faces[face];
- while (*compare == ' ' || isdigit(*compare)) compare++;
- if (compare != rec->available_faces[face]) {
- compare = Canonical(compare);
- }
- if (extraNormalFaces[i] == compare) return face;
- }
- }
-
- /* Oh, well. Use the first one */
- return 0;
-}
-
-static void GetInitialFace(fsb, ff)
- FontSelectionBoxWidget fsb;
- FontFamilyRec *ff;
-{
- FSBFaceSelectCallbackRec rec;
- String *faces;
- int i, j;
- FontRec *f;
- Boolean junk;
-
- faces = (String *) XtMalloc(ff->font_count * sizeof(String));
- i = 0;
- for (f = ff->fonts; f != NULL; f = f->next) faces[i++] = f->face_name;
-
- rec.available_faces = faces;
- rec.num_available_faces = ff->font_count;
-
- if (fsb->fsb.currently_selected_face != NULL) {
- rec.current_face = fsb->fsb.currently_selected_face->face_name;
- } else rec.current_face = fsb->fsb.font_face;
-
- rec.new_face = NULL;
-
- XtCallCallbackList((Widget) fsb, fsb->fsb.face_select_callback, &rec);
- if (rec.new_face != NULL) {
- for (i = 0; i < ff->font_count; i++) {
- if (rec.new_face == faces[i]) break;
- }
- }
- if (rec.new_face == NULL || i >= ff->font_count) {
- i = MatchFaceName(&rec, &junk);
- }
- XtFree((XtPointer) faces);
-
- j = 0;
- for (f = ff->fonts; i != 0; f= f->next) {
- j += f->blend_count + 1;
- i--;
- }
-
- ListSelectPos(fsb->fsb.face_scrolled_list_child, j+1, False);
- fsb->fsb.currently_selected_face = f;
- fsb->fsb.currently_selected_blend = NULL;
-}
-
-/* ARGSUSED */
-
-static void FamilySelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmListCallbackStruct *listCB = (XmListCallbackStruct *) callData;
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
- FontFamilyRec *ff = fsb->fsb.known_families;
- int i;
-
- if (fsb->fsb.current_family_multiple) {
- fsb->fsb.current_family_multiple = False;
- UnmanageFamilyMultiple(fsb);
- }
-
- /* List uses 1-based addressing!! */
- for (i = 1; i < listCB->item_position; i++) ff = ff->next;
-
- fsb->fsb.currently_selected_family = ff;
-
- SensitizeReset(fsb);
- SetUpFaceList(fsb, ff);
- if (!fsb->fsb.current_face_multiple) GetInitialFace(fsb, ff);
- ValueChanged(fsb);
-}
-
-/* ARGSUSED */
-
-static void FaceSelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmListCallbackStruct *listCB = (XmListCallbackStruct *) callData;
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) clientData;
- FontRec *f;
- BlendRec *b;
- int n;
-
- if (fsb->fsb.currently_selected_family == NULL) return;
- f = fsb->fsb.currently_selected_family->fonts;
-
- if (fsb->fsb.current_face_multiple) {
- fsb->fsb.current_face_multiple = False;
- UnmanageFaceMultiple(fsb);
- }
-
- /* List uses 1-based addressing!! */
- n = 0;
- while (1) {
- n += f->blend_count + 1;
- if (n >= listCB->item_position) {
- n -= f->blend_count;
- if (n == listCB->item_position) b = NULL;
- else for (b = f->blend_data->blends; n < listCB->item_position - 1;
- b = b->next) n++;
- break;
- }
- f = f->next;
- }
-
- fsb->fsb.currently_selected_face = f;
- fsb->fsb.currently_selected_blend = b;
-
- SensitizeReset(fsb);
- ValueChanged(fsb);
-}
-
-static void CreateSizeMenu(fsb, destroyOldChildren)
- FontSelectionBoxWidget fsb;
- Boolean destroyOldChildren;
-{
- Arg args[20];
- int i, j;
- Widget *sizes;
- char buf[20];
- Widget *children;
- Cardinal num_children;
- XmString csName;
- char *ch;
-
- if (destroyOldChildren) {
- XtVaGetValues(fsb->fsb.size_menu, XtNchildren, &children,
- XtNnumChildren, &num_children, NULL);
-
- /* Don't destroy first child ("other") */
- for (j = 1; j < num_children; j++) XtDestroyWidget(children[j]);
-
- sizes = (Widget *) XtMalloc((fsb->fsb.size_count+1) * sizeof(Widget));
- sizes[0] = children[0];
- } else {
- i = 0;
- sizes = (Widget *) XtMalloc((fsb->fsb.size_count+1) * sizeof(Widget));
- fsb->fsb.other_size = sizes[0] =
- XtCreateManagedWidget("other", xmPushButtonGadgetClass,
- fsb->fsb.size_menu, args, i);
- }
-
- for (j = 0; j < fsb->fsb.size_count; j++) {
- (void) sprintf(buf, "%g", fsb->fsb.sizes[j]);
- csName = UnsharedCS(buf);
- for (ch = buf; *ch != '\0'; ch++) if (*ch == '.') *ch = '-';
- i = 0;
- XtSetArg(args[i], XmNlabelString, csName); i++;
- sizes[j+1] =
- XmCreatePushButtonGadget(fsb->fsb.size_menu, buf, args, i);
- XmStringFree(csName);
- XtAddCallback(sizes[j+1], XmNactivateCallback,
- SetSize, (XtPointer) fsb);
- }
- XtManageChildren(sizes, j+1);
- XtFree((char *) sizes);
-}
-
-static void CreateChildren(fsb)
- FontSelectionBoxWidget fsb;
-{
- Arg args[20];
- int i;
- Widget form;
-
- i = 0;
- fsb->fsb.pane_child =
- XtCreateManagedWidget("pane", xmPanedWindowWidgetClass,
- (Widget) fsb, args, i);
-
- i = 0;
- fsb->fsb.preview_child =
- XtCreateManagedWidget("preview", xmDrawingAreaWidgetClass,
- fsb->fsb.pane_child, args, i);
- XtAddCallback(fsb->fsb.preview_child, XmNexposeCallback,
- PreviewText, (XtPointer) fsb);
- XtAddCallback(fsb->fsb.preview_child, XmNresizeCallback,
- ResizePreview, (XtPointer) fsb);
-
- i = 0;
- form = XtCreateManagedWidget("panel", xmFormWidgetClass,
- fsb->fsb.pane_child, args, i);
- fsb->fsb.panel_child = form;
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- fsb->fsb.ok_button_child =
- XtCreateManagedWidget("okButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.ok_button_child, XmNactivateCallback,
- OKCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget,fsb->fsb.ok_button_child ); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- fsb->fsb.apply_button_child =
- XtCreateManagedWidget("applyButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.apply_button_child, XmNactivateCallback,
- ApplyCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget,fsb->fsb.apply_button_child ); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- fsb->fsb.reset_button_child =
- XtCreateManagedWidget("resetButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.reset_button_child, XmNactivateCallback,
- ResetCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget,fsb->fsb.reset_button_child ); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- fsb->fsb.cancel_button_child =
- XtCreateManagedWidget("cancelButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.cancel_button_child, XmNactivateCallback,
- CancelCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.ok_button_child); i++;
- fsb->fsb.separator_child =
- XtCreateManagedWidget("separator", xmSeparatorGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.separator_child); i++;
- fsb->fsb.size_label_child =
- XtCreateManagedWidget("sizeLabel", xmLabelWidgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, fsb->fsb.size_label_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.size_label_child); i++;
- fsb->fsb.size_text_field_child =
- XtCreateManagedWidget("sizeTextField", xmTextFieldWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.size_text_field_child, XmNvalueChangedCallback,
- SizeSelect, (XtPointer) fsb);
- XtAddCallback(fsb->fsb.size_text_field_child, XmNmodifyVerifyCallback,
- TextVerify, (XtPointer) fsb);
-
- i = 0;
- fsb->fsb.size_menu = XmCreatePulldownMenu(form, "sizeMenu", args, i);
-
- CreateSizeMenu(fsb, False);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, fsb->fsb.size_text_field_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.size_label_child); i++;
- XtSetArg(args[i], XmNsubMenuId, fsb->fsb.size_menu); i++;
- fsb->fsb.size_option_menu_child =
- XmCreateOptionMenu(form, "sizeOptionMenu", args, i);
- XtManageChild(fsb->fsb.size_option_menu_child);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, fsb->fsb.size_option_menu_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.separator_child); i++;
- fsb->fsb.size_multiple_label_child =
- XtCreateWidget("sizeMultipleLabel", xmLabelWidgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.size_label_child); i++;
- fsb->fsb.preview_button_child =
- XtCreateManagedWidget("previewButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.preview_button_child, XmNactivateCallback,
- PreviewCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, fsb->fsb.preview_button_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.preview_button_child); i++;
- fsb->fsb.sampler_button_child =
- XtCreateWidget("samplerButton", xmPushButtonWidgetClass,
- form, args, i);
- if (fsb->fsb.show_sampler_button) {
- XtManageChild(fsb->fsb.sampler_button_child);
- }
- XtAddCallback(fsb->fsb.sampler_button_child, XmNactivateCallback,
- ShowSamplerCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightPosition, 50); i++;
- fsb->fsb.family_label_child =
- XtCreateManagedWidget("familyLabel", xmLabelGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNleftPosition, 50); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- fsb->fsb.face_label_child =
- XtCreateManagedWidget("faceLabel", xmLabelGadgetClass,
- form, args, i);
-
- /* The next two must be widgets in order to be reversed in color */
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, fsb->fsb.family_label_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightPosition, 50); i++;
- fsb->fsb.family_multiple_label_child =
- XtCreateWidget("familyMultipleLabel", xmLabelWidgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, fsb->fsb.face_label_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNleftPosition, 50); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- fsb->fsb.face_multiple_label_child =
- XtCreateWidget("faceMultipleLabel", xmLabelWidgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNitemCount, 1); i++;
- XtSetArg(args[i], XmNitems, &CSempty); i++;
- fsb->fsb.family_scrolled_list_child =
- XmCreateScrolledList(form, "familyScrolledList", args, i);
- XtAddCallback(fsb->fsb.family_scrolled_list_child,
- XmNbrowseSelectionCallback, FamilySelect, (XtPointer) fsb);
- XtAddCallback(fsb->fsb.family_scrolled_list_child,
- XmNdefaultActionCallback,
- PreviewDoubleClick, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, fsb->fsb.family_label_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.size_text_field_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNrightPosition, 50); i++;
- XtSetValues(XtParent(fsb->fsb.family_scrolled_list_child), args, i);
- XtManageChild(fsb->fsb.family_scrolled_list_child);
-
- i = 0;
- XtSetArg(args[i], XmNitemCount, 1); i++;
- XtSetArg(args[i], XmNitems, &CSempty); i++;
- fsb->fsb.face_scrolled_list_child =
- XmCreateScrolledList(form, "faceScrolledList", args, i);
- XtAddCallback(fsb->fsb.face_scrolled_list_child,
- XmNbrowseSelectionCallback, FaceSelect, (XtPointer) fsb);
- XtAddCallback(fsb->fsb.face_scrolled_list_child,
- XmNdefaultActionCallback, PreviewDoubleClick,
- (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, fsb->fsb.face_label_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.size_text_field_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNleftPosition, 50); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- XtSetValues(XtParent(fsb->fsb.face_scrolled_list_child), args, i);
- XtManageChild(fsb->fsb.face_scrolled_list_child);
-
- i = 0;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, fsb->fsb.size_text_field_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_POSITION); i++;
- XtSetArg(args[i], XmNleftPosition, 50); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- fsb->fsb.multiple_master_button_child =
- XtCreateWidget("multipleMasterButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(fsb->fsb.multiple_master_button_child, XmNactivateCallback,
- ShowCreatorCallback, (XtPointer) fsb);
-
- i = 0;
- XtSetArg(args[i], XmNdefaultButton, fsb->fsb.ok_button_child); i++;
- XtSetValues(form, args, i);
-}
-
-static void DisplayFontFamilies(fsb)
- FontSelectionBoxWidget fsb;
-{
- FontFamilyRec *ff;
- XmString *CSlist, *str;
-
- CSlist = (XmString *) XtMalloc(fsb->fsb.family_count * sizeof(XmString));
- str = CSlist;
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- *str++ = UnsharedCS(ff->family_name);
- }
-
- XtVaSetValues(fsb->fsb.family_scrolled_list_child,
- XmNitemCount, fsb->fsb.family_count,
- XmNitems, CSlist, NULL);
-
- /* The list makes a copy, so we can delete the list */
- XtFree((char *) CSlist);
-}
-
-static void SetUpCurrentFontFromName(fsb)
- FontSelectionBoxWidget fsb;
-{
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
- int i, j;
-
- fsb->fsb.currently_selected_face = NULL;
- fsb->fsb.currently_selected_family = NULL;
- fsb->fsb.currently_selected_blend = NULL;
-
- if (fsb->fsb.font_name_multiple || fsb->fsb.font_name == NULL) {
- fsb->fsb.font_name = NULL;
- fsb->fsb.font_family = NULL;
- fsb->fsb.font_blend = NULL;
- fsb->fsb.font_face = NULL;
- if (fsb->fsb.font_name_multiple) {
- fsb->fsb.current_family_multiple = True;
- fsb->fsb.current_face_multiple = True;
- ManageFamilyMultiple(fsb);
- ManageFaceMultiple(fsb);
- }
- XmListDeselectAllItems(fsb->fsb.family_scrolled_list_child);
- XmListDeselectAllItems(fsb->fsb.face_scrolled_list_child);
- XmListDeleteAllItems(fsb->fsb.face_scrolled_list_child);
- XmListAddItem(fsb->fsb.face_scrolled_list_child, CSempty, 1);
- return;
- }
-
- if (!fsb->fsb.font_name_multiple) {
- fsb->fsb.current_family_multiple = False;
- fsb->fsb.current_face_multiple = False;
- UnmanageFamilyMultiple(fsb);
- UnmanageFaceMultiple(fsb);
- }
-
- fsb->fsb.font_name = Canonical(fsb->fsb.font_name);
- i = 1;
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- j = 1;
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == fsb->fsb.font_name) {
- fsb->fsb.font_family = ff->family_name;
- fsb->fsb.font_face = f->face_name;
- SetUpFaceList(fsb, ff);
- ListSelectPos(fsb->fsb.family_scrolled_list_child, i, False);
- ListSelectPos(fsb->fsb.face_scrolled_list_child, j, False);
- fsb->fsb.currently_selected_face = f;
- fsb->fsb.currently_selected_family = ff;
- fsb->fsb.currently_selected_blend = NULL;
- return;
- }
- j++;
- if (f->blend_data != NULL && f->blend_data->blends != NULL) {
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- if (b->font_name == fsb->fsb.font_name) {
- fsb->fsb.font_family = ff->family_name;
- fsb->fsb.font_face = f->face_name;
- SetUpFaceList(fsb, ff);
- ListSelectPos(fsb->fsb.family_scrolled_list_child, i,
- False);
- ListSelectPos(fsb->fsb.face_scrolled_list_child, j,
- False);
- fsb->fsb.currently_selected_face = f;
- fsb->fsb.currently_selected_family = ff;
- fsb->fsb.currently_selected_blend = b;
- return;
- }
- j++;
- }
- }
-
- }
- i++;
- }
-
- /* Didn't find it! */
- fsb->fsb.font_name = NULL;
- fsb->fsb.font_family = NULL;
- fsb->fsb.font_face = NULL;
- fsb->fsb.font_blend = NULL;
- XmListDeselectAllItems(fsb->fsb.family_scrolled_list_child);
- XmListDeselectAllItems(fsb->fsb.face_scrolled_list_child);
- XmListDeleteAllItems(fsb->fsb.face_scrolled_list_child);
- XmListAddItem(fsb->fsb.face_scrolled_list_child, CSempty, 1);
-}
-
-static void SetUpCurrentFontFromFamilyFace(fsb)
- FontSelectionBoxWidget fsb;
-{
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
- int i;
-
- fsb->fsb.currently_selected_face = NULL;
- fsb->fsb.currently_selected_family = NULL;
- fsb->fsb.currently_selected_blend = NULL;
-
- if (fsb->fsb.font_family_multiple) {
- fsb->fsb.font_family = NULL;
- fsb->fsb.current_family_multiple = True;
- ManageFamilyMultiple(fsb);
- } else {
- fsb->fsb.current_family_multiple = False;
- UnmanageFamilyMultiple(fsb);
- }
-
- if (fsb->fsb.font_face_multiple) {
- fsb->fsb.font_face = NULL;
- fsb->fsb.current_face_multiple = True;
- ManageFaceMultiple(fsb);
- } else {
- fsb->fsb.current_face_multiple = False;
- UnmanageFaceMultiple(fsb);
- }
-
- fsb->fsb.font_name_multiple =
- fsb->fsb.font_family_multiple || fsb->fsb.font_face_multiple;
-
- if (fsb->fsb.font_family != NULL) {
- fsb->fsb.font_family = Canonical(fsb->fsb.font_family);
- i = 1;
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- if (fsb->fsb.font_family == ff->family_name) {
- ListSelectPos(fsb->fsb.family_scrolled_list_child, i, False);
- fsb->fsb.currently_selected_family = ff;
- SetUpFaceList(fsb, ff);
- break;
- }
- i++;
- }
- if (ff == NULL) fsb->fsb.font_family = NULL;
- }
-
- if (fsb->fsb.font_family == NULL) {
- fsb->fsb.font_face = NULL;
- fsb->fsb.font_blend = NULL;
- fsb->fsb.font_name = NULL;
- XmListDeselectAllItems(fsb->fsb.family_scrolled_list_child);
- XmListDeselectAllItems(fsb->fsb.face_scrolled_list_child);
- XmListDeleteAllItems(fsb->fsb.face_scrolled_list_child);
- XmListAddItem(fsb->fsb.face_scrolled_list_child, CSempty, 1);
- return;
- }
-
- if (fsb->fsb.font_face != NULL) {
- fsb->fsb.font_face = Canonical(fsb->fsb.font_face);
-
- i = 1;
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (fsb->fsb.font_face == f->face_name) {
- fsb->fsb.currently_selected_face = f;
- if (fsb->fsb.font_blend != NULL) {
- fsb->fsb.font_blend = Canonical(fsb->fsb.font_blend);
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- i++;
- if (b->blend_name == fsb->fsb.font_blend) {
- fsb->fsb.currently_selected_blend = b;
- break;
- }
- }
- if (b == NULL) {
- fsb->fsb.font_blend = NULL;
- i -= f->blend_count;
- }
- }
- ListSelectPos(fsb->fsb.face_scrolled_list_child, i, False);
- break;
- }
- i += f->blend_count + 1;
- }
- if (f == NULL) fsb->fsb.font_face = NULL;
- } else {
- f = NULL;
- XmListDeselectAllItems(fsb->fsb.face_scrolled_list_child);
- }
-
- if (f == NULL && !fsb->fsb.font_face_multiple) GetInitialFace(fsb, ff);
-}
-
-static void SetUpCurrentFont(fsb)
- FontSelectionBoxWidget fsb;
-{
- if (fsb->fsb.use_font_name) SetUpCurrentFontFromName(fsb);
- else SetUpCurrentFontFromFamilyFace(fsb);
-}
-
-static void SetUpCurrentSize(fsb)
- FontSelectionBoxWidget fsb;
-{
- char buf[20];
-
- if (fsb->fsb.font_size_multiple) {
- changingSize = True;
- XtVaSetValues(fsb->fsb.size_text_field_child, XmNvalue, "", NULL);
- changingSize = False;
- fsb->fsb.current_size_multiple = True;
- ManageSizeMultiple(fsb);
- return;
- } else UnmanageSizeMultiple(fsb);
-
- if (fsb->fsb.currently_selected_size == 0.0) {
- sprintf(buf, "%g", fsb->fsb.font_size);
- } else sprintf(buf, "%g", fsb->fsb.currently_selected_size);
-
- changingSize = True;
- XtVaSetValues(fsb->fsb.size_text_field_child, XmNvalue, buf, NULL);
- changingSize = False;
-}
-
-static void SetUpCurrentSelections(fsb)
- FontSelectionBoxWidget fsb;
-{
- SetUpCurrentFont(fsb);
- SetUpCurrentSize(fsb);
- if (fsb->fsb.preview_on_change) DoPreview(fsb, False);
- DoValueChangedCallback(fsb);
-}
-
-/* ARGSUSED */
-
-static void Initialize(request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) new;
- Bool inited;
- char version[20];
-
- /* Verify size list */
-
- if (fsb->fsb.size_count > 0 && fsb->fsb.sizes == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontBox", "sizeMismatch",
- "FontSelectionBoxError",
- "Size count specified but no sizes present",
- (String *) NULL, (Cardinal *) NULL);
- fsb->fsb.size_count = 0;
- }
-
- if (fsb->fsb.size_count < 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontBox", "negativeSize",
- "FontSelectionBoxError",
- "Size count should not be negative",
- (String *) NULL, (Cardinal *) NULL);
- fsb->fsb.size_count = 0;
- }
-
- if (fsb->fsb.max_pending_deletes <= 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontBox", "nonPositivePendingDelete",
- "FontSelectionBoxError",
- "Pending delete max must be positive",
- (String *) NULL, (Cardinal *) NULL);
- fsb->fsb.max_pending_deletes = 1;
- }
-
- /* Copy strings. SetUpCurrentSelection will copy the font strings */
-
- if (fsb->fsb.preview_string != NULL) {
- fsb->fsb.preview_string = XtNewString(fsb->fsb.preview_string);
- }
- if (fsb->fsb.default_resource_path != NULL) {
- fsb->fsb.default_resource_path =
- XtNewString(fsb->fsb.default_resource_path);
- }
- if (fsb->fsb.resource_path_override != NULL) {
- fsb->fsb.resource_path_override =
- XtNewString(fsb->fsb.resource_path_override);
- }
-
- /* Get the context */
-
- if (fsb->fsb.context == NULL) {
- fsb->fsb.context = XDPSGetSharedContext(XtDisplay(fsb));
- }
-
- if (_XDPSTestComponentInitialized(fsb->fsb.context,
- dps_init_bit_fsb, &inited) ==
- dps_status_unregistered_context) {
- XDPSRegisterContext(fsb->fsb.context, False);
- }
-
- if (!inited) {
- (void) _XDPSSetComponentInitialized(fsb->fsb.context,
- dps_init_bit_fsb);
- _DPSFDefineFontEnumFunctions(fsb->fsb.context);
- }
-
- DPSversion(fsb->fsb.context, 20, version);
- fsb->fsb.old_server = (atof(version) < 1007);
-
- /* Initialize non-resource fields */
-
- fsb->fsb.gstate = 0;
- fsb->fsb.sampler = fsb->fsb.creator = NULL;
- fsb->fsb.known_families = NULL;
- fsb->fsb.family_count = 0;
- fsb->fsb.currently_previewed = NULL;
- fsb->fsb.currently_selected_face = NULL;
- fsb->fsb.currently_selected_family = NULL;
- fsb->fsb.currently_previewed_blend = NULL;
- fsb->fsb.currently_selected_blend = NULL;
- fsb->fsb.currently_previewed_size = 0.0;
- fsb->fsb.currently_selected_size = 0.0;
- fsb->fsb.pending_delete_count = 0;
- fsb->fsb.pending_delete_font = NULL;
- fsb->fsb.preview_fixed = False;
- fsb->fsb.current_family_multiple = False;
- fsb->fsb.current_face_multiple = False;
- fsb->fsb.current_size_multiple = False;
- fsb->fsb.blends_changed = False;
-
- GetFontNames(fsb);
- CreateChildren(fsb);
-
- DisplayFontFamilies(fsb);
- SetUpCurrentSelections(fsb);
- DesensitizeReset(fsb);
- if (fsb->fsb.show_sampler) ShowSampler(fsb);
-}
-
-static void FreeFontRec(f)
- FontRec *f;
-{
- BlendDataRec *bd;
- BlendRec *b, *next_b;
-
- if (f->blend_data != NULL) {
- bd = f->blend_data;
- for (b = bd->blends; b != NULL; b = next_b) {
- next_b = b->next;
- XtFree((char *) b);
- }
- XtFree((char *) bd->internal_break);
- XtFree((char *) bd->internal_value);
- XtFree((char *) bd->design_positions);
- XtFree((char *) bd);
- }
- XtFree(f->full_name);
-}
-
-static void FreeFontLists(fsb)
- FontSelectionBoxWidget fsb;
-{
- FontFamilyRec *ff, *next_ff;
- FontRec *f, *next_f;
-
- /* font_name, face_name, family_name, and blend_name are canonical
- strings and so should not be freed. The face and blend compound
- strings were gotten from converters and so should likewise remain. */
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = next_ff) {
- for (f = ff->fonts; f != NULL; f = next_f) {
- FreeFontRec(f);
- next_f = f->next;
- XtFree((char *) f);
- }
- next_ff = ff->next;
- XtFree((char *) ff);
- }
- fsb->fsb.known_families = NULL;
-}
-
-static void Destroy(widget)
- Widget widget;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) widget;
-
- /* Lots of stuff to destroy! */
-
- if (fsb->fsb.gstate != 0) XDPSFreeContextGState(fsb->fsb.context,
- fsb->fsb.gstate);
- if (fsb->fsb.preview_string != NULL) XtFree(fsb->fsb.preview_string);
- if (fsb->fsb.default_resource_path != NULL) {
- XtFree(fsb->fsb.default_resource_path);
- }
- if (fsb->fsb.resource_path_override != NULL) {
- XtFree(fsb->fsb.resource_path_override);
- }
-
- FreeFontLists(fsb);
-}
-
-static void Resize(widget)
- Widget widget;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) widget;
-
- XtResizeWidget(fsb->fsb.pane_child, fsb->core.width, fsb->core.height, 0);
-}
-
-/* ARGSUSED */
-
-static Boolean SetValues(old, req, new, args, num_args)
- Widget old, req, new;
- ArgList args;
- Cardinal *num_args;
-{
- FontSelectionBoxWidget oldfsb = (FontSelectionBoxWidget) old;
- FontSelectionBoxWidget newfsb = (FontSelectionBoxWidget) new;
- Boolean refreshLists = False, setSelection = False, do_preview = False;
- Bool inited;
-
-#define NE(field) newfsb->fsb.field != oldfsb->fsb.field
-#define DONT_CHANGE(field) \
- if (NE(field)) newfsb->fsb.field = oldfsb->fsb.field;
-
- DONT_CHANGE(typographic_sort);
- DONT_CHANGE(pane_child);
- DONT_CHANGE(preview_child);
- DONT_CHANGE(panel_child);
- DONT_CHANGE(family_label_child);
- DONT_CHANGE(family_multiple_label_child);
- DONT_CHANGE(family_scrolled_list_child);
- DONT_CHANGE(face_label_child);
- DONT_CHANGE(face_multiple_label_child);
- DONT_CHANGE(face_scrolled_list_child);
- DONT_CHANGE(size_label_child);
- DONT_CHANGE(size_text_field_child);
- DONT_CHANGE(size_option_menu_child);
- DONT_CHANGE(preview_button_child);
- DONT_CHANGE(sampler_button_child);
- DONT_CHANGE(separator_child);
- DONT_CHANGE(ok_button_child);
- DONT_CHANGE(apply_button_child);
- DONT_CHANGE(reset_button_child);
- DONT_CHANGE(cancel_button_child);
-#undef DONT_CHANGE
-
- if (newfsb->fsb.size_count > 0 && newfsb->fsb.sizes == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontBox", "sizeMismatch",
- "FontSelectionBoxError",
- "Size count specified but no sizes present",
- (String *) NULL, (Cardinal *) NULL);
- newfsb->fsb.size_count = 0;
- }
-
- if (newfsb->fsb.size_count < 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontBox", "negativeSize",
- "FontSelectionBoxError",
- "Size count should not be negative",
- (String *) NULL, (Cardinal *) NULL);
- newfsb->fsb.size_count = 0;
- }
-
- if (newfsb->fsb.max_pending_deletes <= 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontBox", "nonPositivePendingDelete",
- "FontSelectionBoxError",
- "Pending delete max must be positive",
- (String *) NULL, (Cardinal *) NULL);
- newfsb->fsb.max_pending_deletes = 1;
- }
-
- if (NE(preview_string)) {
- XtFree(oldfsb->fsb.preview_string);
- newfsb->fsb.preview_string = XtNewString(newfsb->fsb.preview_string);
- do_preview = True;
- }
-
- if (NE(default_resource_path)) {
- XtFree(oldfsb->fsb.default_resource_path);
- newfsb->fsb.default_resource_path =
- XtNewString(newfsb->fsb.default_resource_path);
- refreshLists = True;
- }
-
- if (NE(resource_path_override)) {
- XtFree(oldfsb->fsb.resource_path_override);
- newfsb->fsb.resource_path_override =
- XtNewString(newfsb->fsb.resource_path_override);
- refreshLists = True;
- }
-
- if (newfsb->fsb.undef_unused_fonts) UndefSomeUnusedFonts(newfsb, False);
-
- if (NE(context)) {
- if (newfsb->fsb.context == NULL) {
- newfsb->fsb.context = XDPSGetSharedContext(XtDisplay(newfsb));
- }
- if (_XDPSTestComponentInitialized(newfsb->fsb.context,
- dps_init_bit_fsb, &inited) ==
- dps_status_unregistered_context) {
- XDPSRegisterContext(newfsb->fsb.context, False);
- }
- if (!inited) {
- (void) _XDPSSetComponentInitialized(newfsb->fsb.context,
- dps_init_bit_fsb);
- _DPSFDefineFontEnumFunctions(newfsb->fsb.context);
- }
- }
-
- if (refreshLists) {
- UndefUnusedFonts(newfsb);
- newfsb->fsb.pending_delete_font = NULL;
- newfsb->fsb.pending_delete_count = 0;
- FreeFontLists(newfsb);
- GetFontNames(newfsb);
- DisplayFontFamilies(newfsb);
- setSelection = True;
- }
-
- if (NE(sizes)) {
- CreateSizeMenu(newfsb, True);
- setSelection = True;
- }
-
- if (NE(show_sampler)) {
- if (newfsb->fsb.show_sampler) ShowSampler(newfsb);
- else XtPopdown(newfsb->fsb.sampler);
- }
-
- if (NE(show_sampler_button)) {
- if (newfsb->fsb.show_sampler_button) {
- XtManageChild(newfsb->fsb.sampler_button_child);
- } else XtUnmanageChild(newfsb->fsb.sampler_button_child);
- }
-
- if (NE(font_size)) newfsb->fsb.currently_selected_size = 0.0;
-
- if (NE(use_font_name) || NE(font_name) || NE(font_family) ||
- NE(font_face) || NE(font_size) || NE(font_name_multiple) ||
- NE(font_family_multiple) || NE(font_face_multiple) ||
- NE(font_size_multiple) || NE(font_blend)) setSelection = True;
-
- if (setSelection) SetUpCurrentSelections(newfsb);
- else if (do_preview && newfsb->fsb.preview_on_change) {
- DoPreview(newfsb, False);
- }
-
- if ((NE(font_name) || NE(font_size)) &&
- XtIsSensitive(newfsb->fsb.reset_button_child)) {
-
- if ((newfsb->fsb.font_size_multiple ||
- newfsb->fsb.font_size == newfsb->fsb.currently_selected_size) &&
- (newfsb->fsb.font_name_multiple ||
- newfsb->fsb.currently_selected_face == NULL ||
- newfsb->fsb.font_name ==
- newfsb->fsb.currently_selected_face->font_name)) {
- DesensitizeReset(newfsb);
- }
- }
-
- return False;
-#undef NE
-}
-
-/* ARGSUSED */
-
-static XtGeometryResult GeometryManager(w, desired, allowed)
- Widget w;
- XtWidgetGeometry *desired, *allowed;
-{
-#define WANTS(flag) (desired->request_mode & flag)
-
- if (WANTS(XtCWQueryOnly)) return XtGeometryYes;
-
- if (WANTS(CWWidth)) w->core.width = desired->width;
- if (WANTS(CWHeight)) w->core.height = desired->height;
- if (WANTS(CWX)) w->core.x = desired->x;
- if (WANTS(CWY)) w->core.y = desired->y;
- if (WANTS(CWBorderWidth)) {
- w->core.border_width = desired->border_width;
- }
-
- return XtGeometryYes;
-#undef WANTS
-}
-
-static void ChangeManaged(w)
- Widget w;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
-
- w->core.width = fsb->composite.children[0]->core.width;
- w->core.height = fsb->composite.children[0]->core.height;
-}
-
-static void SetFontName(w, name, name_multiple)
- Widget w;
- String name;
- Bool name_multiple;
-{
- XtVaSetValues(w, XtNfontName, name, XtNuseFontName, True,
- XtNfontNameMultiple, name_multiple, NULL);
-}
-
-void FSBSetFontName(w, name, name_multiple)
- Widget w;
- String name;
- Bool name_multiple;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->fsb_class.set_font_name)
- (w, name, name_multiple);
-}
-
-static void SetFontFamilyFace(w, family, face, family_multiple, face_multiple)
- Widget w;
- String family, face;
- Bool family_multiple, face_multiple;
-{
- XtVaSetValues(w, XtNfontFamily, family, XtNfontFace, face,
- XtNuseFontName, False,
- XtNfontFamilyMultiple, family_multiple,
- XtNfontFaceMultiple, face_multiple, NULL);
-}
-
-void FSBSetFontFamilyFace(w, family, face, family_multiple, face_multiple)
- Widget w;
- String family, face;
- Bool family_multiple, face_multiple;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.set_font_family_face)
- (w, family, face, family_multiple, face_multiple);
-}
-
-static void SetFontSize(w, size, size_multiple)
- Widget w;
- double size;
- Bool size_multiple;
-{
- int i;
- Arg args[2];
-
- union {
- int i;
- float f;
- } kludge;
-
- kludge.f = size;
-
- i = 0;
- if (sizeof(float) > sizeof(XtArgVal)) {
- XtSetArg(args[i], XtNfontSize, &kludge.f); i++;
- } else XtSetArg(args[i], XtNfontSize, kludge.i); i++;
- XtSetArg(args[i], XtNfontSizeMultiple, size_multiple); i++;
- XtSetValues(w, args, i);
-}
-
-void FSBSetFontSize(w, size, size_multiple)
- Widget w;
- double size;
- Bool size_multiple;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->fsb_class.set_font_size)
- (w, size, size_multiple);
-}
-
-static void RefreshFontList(w)
- Widget w;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
-
- UndefUnusedFonts(fsb);
- fsb->fsb.pending_delete_font = NULL;
- fsb->fsb.pending_delete_count = 0;
- FreeFontLists(fsb);
- FreePSResourceStorage(True);
- GetFontNames(fsb);
- DisplayFontFamilies(fsb);
- SetUpCurrentSelections(fsb);
-}
-
-void FSBRefreshFontList(w)
- Widget w;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.refresh_font_list) (w);
-}
-
-static void GetFamilyList(w, count, list)
- Widget w;
- int *count;
- String **list;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- String *buf;
- FontFamilyRec *ff;
-
- *count = fsb->fsb.family_count;
- *list = buf = (String *) XtMalloc(*count * sizeof(String));
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- *buf++ = ff->family_name;
- }
-}
-
-void FSBGetFamilyList(w, count, list)
- Widget w;
- int *count;
- String **list;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.get_family_list) (w, count, list);
-}
-
-static void GetFaceList(w, family, count, face_list, font_list)
- Widget w;
- String family;
- int *count;
- String **face_list, **font_list;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- String *buf1, *buf2;
- FontFamilyRec *ff;
- FontRec *f;
-
- family = Canonical(family);
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- if (ff->family_name == family) break;
- }
-
- if (ff == NULL) {
- *count = 0;
- *face_list = *font_list = NULL;
- return;
- }
-
- *count = ff->font_count;
- *face_list = buf1 = (String *) XtMalloc(*count * sizeof(String));
- *font_list = buf2 = (String *) XtMalloc(*count * sizeof(String));
-
- for (f = ff->fonts; f != NULL; f = f->next) {
- *buf1++ = f->face_name;
- *buf2++ = f->font_name;
- }
-}
-
-void FSBGetFaceList(w, family, count_return, face_list, font_list)
- Widget w;
- String family;
- int *count_return;
- String **face_list, **font_list;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.get_face_list) (w, family, count_return,
- face_list, font_list);
-}
-
-void FSBUndefineUnusedFonts(w)
- Widget w;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.undef_unused_fonts) (w);
-}
-
-static Boolean DownloadFontName(w, name)
- Widget w;
- String name;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- FontFamilyRec *ff;
- FontRec *f;
- Boolean ret;
-
- name = Canonical(name);
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == name) {
- if (!fsb->fsb.get_server_fonts) {
- int resident;
- _DPSFIsFontResident(fsb->fsb.context, f->font_name,
- &resident);
- if (resident) f->resident = True;
- }
- if (f->resident) return True;
- else {
- ret = DownloadFont(fsb, name, fsb->fsb.context,
- fsb->fsb.make_fonts_shared);
- if (fsb->fsb.make_fonts_shared && ret) f->resident = True;
- return ret;
- }
- }
- }
- }
-
- return DownloadFont(fsb, name, fsb->fsb.context,
- fsb->fsb.make_fonts_shared);
-}
-
-Boolean FSBDownloadFontName(w, name)
- Widget w;
- String name;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- if (name == NULL) return False;
- return (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.download_font_name) (w, name);
-}
-
-static Boolean MatchFontFace(w, old_face, new_family, new_face)
- Widget w;
- String old_face, new_family;
- String *new_face;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- FSBFaceSelectCallbackRec rec;
- String *faces;
- int i;
- FontFamilyRec *ff;
- FontRec *f;
- Boolean retVal;
-
- new_family = Canonical(new_family);
- old_face = Canonical(old_face);
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- if (ff->family_name == new_family) break;
- }
- if (ff == NULL) {
- *new_face = NULL;
- return False;
- }
-
- faces = (String *) XtMalloc(ff->font_count * sizeof(String));
- i = 0;
- for (f = ff->fonts; f != NULL; f = f->next) faces[i++] = f->face_name;
-
- rec.available_faces = faces;
- rec.num_available_faces = ff->font_count;
- rec.current_face = old_face;
- rec.new_face = NULL;
-
- i = MatchFaceName(&rec, &retVal);
- *new_face = faces[i];
- XtFree((XtPointer) faces);
- return !retVal;
-}
-
-Boolean FSBMatchFontFace(w, old_face, new_family, new_face)
- Widget w;
- String old_face, new_family;
- String *new_face;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- return (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.match_font_face) (w, old_face,
- new_family, new_face);
-}
-
-static void FontNameToFamilyFaceBlend(w, font_name, family, face, blend)
- Widget w;
- String font_name;
- String *family, *face, *blend;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
-
- font_name = Canonical(font_name);
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == font_name) {
- *family = ff->family_name;
- *face = f->face_name;
- *blend = NULL;
- return;
- }
- if (f->blend_data != NULL) {
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- if (b->font_name == font_name) {
- *family = ff->family_name;
- *face = f->face_name;
- *blend = b->blend_name;
- return;
- }
- }
- }
- }
- }
-
- *family = NULL;
- *face = NULL;
- *blend = NULL;
-}
-
-static void FontNameToFamilyFace(w, font_name, family, face)
- Widget w;
- String font_name;
- String *family, *face;
-{
- String blend;
-
- FontNameToFamilyFaceBlend(w, font_name, family, face, &blend);
-}
-
-void FSBFontNameToFamilyFace(w, font_name, family, face)
- Widget w;
- String font_name;
- String *family, *face;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.font_name_to_family_face) (w, font_name,
- family, face);
-}
-
-static void FontFamilyFaceBlendToName(w, family, face, blend, font_name)
- Widget w;
- String family, face, blend;
- String *font_name;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
-
- family = Canonical(family);
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- if (ff->family_name == family) break;
- }
- if (ff == NULL) {
- *font_name = NULL;
- return;
- }
-
- face = Canonical(face);
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->face_name == face) break;
- }
- if (f == NULL) {
- *font_name = NULL;
- return;
- }
-
- if (blend == NULL) {
- *font_name = f->font_name;
- return;
- }
- if (f->blend_data == NULL) {
- *font_name = NULL;
- return;
- }
-
- blend = Canonical(blend);
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- if (b->blend_name == blend) {
- *font_name = b->font_name;
- return;
- }
- }
- *font_name = NULL;
-}
-
-static void FontFamilyFaceToName(w, family, face, font_name)
- Widget w;
- String family, face;
- String *font_name;
-{
- FontFamilyFaceBlendToName(w, family, face, NULL, font_name);
-}
-
-void FSBFontFamilyFaceToName(w, family, face, font_name)
- Widget w;
- String family, face;
- String *font_name;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass)
- XtClass(w))->fsb_class.font_family_face_to_name) (w, family, face,
- font_name);
-}
-
-String FSBFindAFM(w, font_name)
- Widget w;
- String font_name;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- return (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.find_afm) (w, font_name);
-}
-
-String FSBFindFontFile(w, font_name)
- Widget w;
- String font_name;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- return (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.find_font_file) (w, font_name);
-}
-
-static void GetTextDimensions(w, text, font, size, x, y, dx, dy,
- left, right, top, bottom)
- Widget w;
- String text, font;
- double size, x, y;
- float *dx, *dy, *left, *right, *top, *bottom;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- int bogusFont;
-
- _DPSFGetTextDimensions(fsb->fsb.context, text, font, size, x, y,
- dx, dy, left, right, top, bottom, &bogusFont);
-}
-
-void FSBGetTextDimensions(w, text, font, size, x, y, dx, dy,
- left, right, top, bottom)
- Widget w;
- String text, font;
- double size, x, y;
- float *dx, *dy, *left, *right, *top, *bottom;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.get_text_dimensions) (w, text, font, size, x, y,
- dx, dy, left, right, top, bottom);
-}
-
-static void SetFontFamilyFaceBlend(w, family, face, blend,
- family_multiple, face_multiple)
- Widget w;
- String family, face, blend;
- Bool family_multiple, face_multiple;
-{
- XtVaSetValues(w, XtNfontFamily, family, XtNfontFace, face,
- XtNfontBlend, blend, XtNuseFontName, False,
- XtNfontFamilyMultiple, family_multiple,
- XtNfontFaceMultiple, face_multiple, NULL);
-}
-
-void FSBSetFontFamilyFaceBlend(w, font_family, font_face, font_blend,
- font_family_multiple, font_face_multiple)
- Widget w;
- String font_family, font_face, font_blend;
- Bool font_family_multiple, font_face_multiple;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.set_font_family_face_blend) (w, font_family, font_face,
- font_blend,
- font_family_multiple,
- font_face_multiple);
-}
-
-void FSBFontNameToFamilyFaceBlend(w, font_name, family, face, blend)
- Widget w;
- String font_name;
- String *family, *face, *blend;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.font_name_to_family_face_blend) (w, font_name, family,
- face, blend);
-}
-
-void FSBFontFamilyFaceBlendToName(w, family, face, blend, font_name)
- Widget w;
- String family, face, blend;
- String *font_name;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.font_family_face_blend_to_name) (w, family, face,
- blend, font_name);
-}
-
-static void GetBlendList(w, name, count_return, blend_return,
- font_name_return, axis_values_return)
- Widget w;
- String name;
- int *count_return;
- String **blend_return, **font_name_return;
- float **axis_values_return;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- String *buf1, *buf2;
- float *buf3;
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
- int i;
-
- name = Canonical(name);
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == name) break;
- }
- }
-
- if (ff == NULL || f == NULL || f->blend_data == NULL) {
- *count_return = 0;
- *blend_return = *font_name_return = NULL;
- *axis_values_return = NULL;
- return;
- }
-
- *count_return = f->blend_count;
- *blend_return = buf1 = (String *) XtMalloc(*count_return * sizeof(String));
- *font_name_return = buf2 =
- (String *) XtMalloc(*count_return * sizeof(String));
- *axis_values_return = buf3 =
- (float *) XtMalloc(*count_return * MAX_AXES * sizeof(float));
-
-
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- *buf1++ = b->blend_name;
- *buf2++ = b->font_name;
- for (i = 0; i < MAX_AXES; i++) *buf3++ = b->data[i];
- }
-}
-
-void FSBGetBlendList(w, name, count_return, blend_return,
- font_name_return, axis_values_return)
- Widget w;
- String name;
- int *count_return;
- String **blend_return, **font_name_return;
- float **axis_values_return;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.get_blend_list) (w, name, count_return, blend_return,
- font_name_return, axis_values_return);
-}
-
-static void GetBlendInfo(w, name, num_axes_return, num_designs_return,
- axis_names_return, blend_positions_return,
- blend_map_count_return, blend_design_coords_return,
- blend_normalized_coords_return)
- Widget w;
- String name;
- int *num_axes_return, *num_designs_return;
- String **axis_names_return;
- float **blend_positions_return;
- int **blend_map_count_return, **blend_design_coords_return;
- float **blend_normalized_coords_return;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- FontFamilyRec *ff;
- FontRec *f;
- BlendDataRec *bd;
- int i, j;
- float *fbuf;
- int *ibuf;
- String *sbuf;
- int coords;
-
- name = Canonical(name);
- if (fsb->fsb.currently_selected_face->font_name == name) {
- bd = fsb->fsb.currently_selected_face->blend_data;
- } else {
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == name) goto FOUND_IT;
- }
- }
- *num_axes_return = *num_designs_return = 0;
- *axis_names_return = NULL;
- *blend_positions_return = *blend_normalized_coords_return = NULL;
- *blend_map_count_return = *blend_design_coords_return = NULL;
- return;
-
-FOUND_IT:
- bd = f->blend_data;
- }
-
- *num_axes_return = bd->num_axes;
- *num_designs_return = bd->num_designs;
-
- *axis_names_return = sbuf =
- (String *) XtMalloc(bd->num_axes * sizeof(String));
- *blend_map_count_return = ibuf =
- (int *) XtMalloc(bd->num_axes * sizeof(int));
- coords = 0;
- for (i = 0; i < bd->num_axes; i++) {
- *sbuf++ = bd->name[i];
- *ibuf++ = bd->internal_points[i] + 2;
- coords += bd->internal_points[i] + 2;
- }
-
- *blend_positions_return = fbuf =
- (float *) XtMalloc(bd->num_axes * bd->num_designs * sizeof(float));
- for (i = 0; i < bd->num_axes * bd->num_designs; i++) {
- *fbuf++ = bd->design_positions[i];
- }
-
- *blend_design_coords_return = ibuf =
- (int *) XtMalloc(coords * sizeof(int));
- *blend_normalized_coords_return = fbuf =
- (float *) XtMalloc(coords * sizeof(float));
-
- for (i = 0; i < bd->num_axes; i++) {
- *ibuf++ = bd->min[i];
- *fbuf++ = 0.0;
- for (j = 0; j < bd->internal_points[i]; j++) {
- *ibuf++ = bd->internal_break[i][j];
- *fbuf++ = bd->internal_value[i][j];
- }
- *ibuf++ = bd->max[i];
- *fbuf++ = 1.0;
- }
-}
-
-void FSBGetBlendInfo(w, name, num_axes_return, num_designs_return,
- axis_names_return, blend_positions_return,
- blend_map_count_return, blend_design_coords_return,
- blend_normalized_coords_return)
- Widget w;
- String name;
- int *num_axes_return, *num_designs_return;
- String **axis_names_return;
- float **blend_positions_return;
- int **blend_map_count_return, **blend_design_coords_return;
- float **blend_normalized_coords_return;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.get_blend_info) (w, name, num_axes_return,
- num_designs_return, axis_names_return,
- blend_positions_return,
- blend_map_count_return,
- blend_design_coords_return,
- blend_normalized_coords_return);
-}
-
-static Boolean ChangeBlends(w, base_name, blend_name, action, axis_values,
- axis_percents)
- Widget w;
- String base_name, blend_name;
- FSBBlendAction action;
- int *axis_values;
- float *axis_percents;
-{
- FontSelectionBoxWidget fsb = (FontSelectionBoxWidget) w;
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b = NULL, *newb, **lastb;
- BlendDataRec *bd;
- String spaceBlend;
- int val[4];
- float pct[4];
- int i;
-
- base_name = Canonical(base_name);
- blend_name = Canonical(blend_name);
-
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == base_name) {
- if ((bd = f->blend_data) == NULL) return False;
-
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- if (b->blend_name == blend_name) break;
- }
- goto FOUND_BASE;
- }
- }
- }
- return False;
-
-FOUND_BASE:
- if (action != FSBDeleteBlend) {
- if (axis_values != NULL) {
- for (i = 0; i < bd->num_axes; i++) {
- val[i] = axis_values[i];
- pct[i] = _FSBNormalize(val[i], bd, i);
- }
- for (/**/; i < 4; i++) pct[i] = 0.0;
- } else {
- if (axis_percents == NULL) return False;
- for (i = 0; i < bd->num_axes; i++) {
- pct[i] = axis_percents[i];
- val[i] = _FSBUnnormalize(pct[i], bd, i);
- }
- for (/**/; i < 4; i++) pct[i] = 0.0;
- }
- }
-
- switch (action) {
- case FSBAddBlend:
- if (b != NULL) return False;
- newb = XtNew(BlendRec);
- newb->blend_name = blend_name;
- newb->CS_blend_name = CS(blend_name, (Widget) fsb);
-
- spaceBlend = (char *) XtMalloc(strlen(blend_name) + 4);
- spaceBlend[0] = spaceBlend[1] = spaceBlend[2] = ' ';
- strcpy(spaceBlend+3, blend_name);
- newb->CS_space_blend_name = CS(spaceBlend, (Widget) fsb);
- XtFree((XtPointer) spaceBlend);
-
- for (i = 0; i < MAX_AXES; i++) newb->data[i] = pct[i];
- newb->font_name = _FSBGenFontName(base_name, val, bd);
-
- f->blend_count++;
- ff->blend_count++;
-
- lastb = &bd->blends;
- for (b = bd->blends; b != NULL; b = b->next) {
- if (strcmp(blend_name, b->blend_name) < 0) break;
- lastb = &b->next;
- }
-
- newb->next = b;
- *lastb = newb;
- break;
-
- case FSBReplaceBlend:
- if (b == NULL) return False;
-
- for (i = 0; i < MAX_AXES; i++) b->data[i] = pct[i];
- b->font_name = _FSBGenFontName(base_name, val, bd);
- if (b == fsb->fsb.currently_previewed_blend) DoPreview(fsb, False);
-
- break;
-
- case FSBDeleteBlend:
- if (b == NULL) return False;
-
- if (bd->blends == b) {
- bd->blends = b->next;
- } else {
- for (newb = bd->blends; newb->next != b; newb = newb->next) {}
- newb->next = b->next;
- }
-
- f->blend_count--;
- ff->blend_count--;
-
- /* Don't actually delete the blend record, in case it's displayed
- in the sampler. */
- break;
- }
- if (f->in_font_creator) _FSBSetCreatorFamily(fsb->fsb.creator, ff);
- if (ff == fsb->fsb.currently_selected_family) SetUpFaceList(fsb, ff);
- fsb->fsb.blends_changed = True;
- WriteBlends(fsb);
- return True;
-}
-
-Boolean FSBChangeBlends(w, base_name, blend_name, action, axis_values,
- axis_percents)
- Widget w;
- String base_name, blend_name;
- FSBBlendAction action;
- int *axis_values;
- float *axis_percents;
-{
- XtCheckSubclass(w, fontSelectionBoxWidgetClass, NULL);
-
- return (*((FontSelectionBoxWidgetClass) XtClass(w))->
- fsb_class.change_blends) (w, base_name, blend_name, action,
- axis_values, axis_percents);
-}
-
-void _FSBSetCurrentFont(fsb, name)
- FontSelectionBoxWidget fsb;
- String name;
-{
- FontFamilyRec *ff;
- FontRec *f;
- BlendRec *b;
- int i, j;
-
- fsb->fsb.current_family_multiple = False;
- fsb->fsb.current_face_multiple = False;
- UnmanageFamilyMultiple(fsb);
- UnmanageFaceMultiple(fsb);
-
- name = Canonical(name);
- i = 1;
- for (ff = fsb->fsb.known_families; ff != NULL; ff = ff->next) {
- j = 1;
- for (f = ff->fonts; f != NULL; f = f->next) {
- if (f->font_name == name) {
- b = NULL;
- goto FOUND_NAME;
- }
- j++;
- if (f->blend_data != NULL && f->blend_data->blends != NULL) {
- for (b = f->blend_data->blends; b != NULL; b = b->next) {
- if (b->font_name == name) {
- goto FOUND_NAME;
- }
- j++;
- }
- }
-
- }
- i++;
- }
- return;
-FOUND_NAME:
- SetUpFaceList(fsb, ff);
- ListSelectPos(fsb->fsb.family_scrolled_list_child, i, False);
- ListSelectPos(fsb->fsb.face_scrolled_list_child, j, False);
- fsb->fsb.currently_selected_face = f;
- fsb->fsb.currently_selected_family = ff;
- fsb->fsb.currently_selected_blend = b;
- SensitizeReset(fsb);
- DoPreview(fsb, False);
-}
-
-float _FSBNormalize(val, bd, i)
- int val;
- BlendDataRec *bd;
- int i;
-{
- int j;
- int lessBreak, moreBreak;
- float lessValue, moreValue;
-
- if (bd->internal_points[i] == 0) {
- return ((float) (val - bd->min[i])) /
- ((float) (bd->max[i] - bd->min[i]));
- }
-
- /* Find the largest breakpoint less than val and the smallest one greater
- than it */
-
- lessBreak = bd->min[i];
- lessValue = 0.0;
- moreBreak = bd->max[i];
- moreValue = 1.0;
-
- for (j = 0; j < bd->internal_points[i]; j++) {
- if (bd->internal_break[i][j] > lessBreak &&
- bd->internal_break[i][j] <= val) {
- lessBreak = bd->internal_break[i][j];
- lessValue = bd->internal_value[i][j];
- }
- if (bd->internal_break[i][j] < moreBreak &&
- bd->internal_break[i][j] >= val) {
- moreBreak = bd->internal_break[i][j];
- moreValue = bd->internal_value[i][j];
- }
- }
-
- if (moreBreak == lessBreak) return moreValue;
-
- return lessValue + (moreValue - lessValue) *
- ((float) (val - lessBreak)) / ((float) (moreBreak - lessBreak));
-}
-
-int _FSBUnnormalize(val, bd, i)
- float val;
- BlendDataRec *bd;
- int i;
-{
- int j;
- int lessBreak, moreBreak;
- float lessValue, moreValue;
-
- if (bd->internal_points[i] == 0) {
- return val * (bd->max[i] - bd->min[i]) + bd->min[i] + 0.5;
- }
-
- /* Find the largest breakpoint less than val and the smallest one greater
- than it */
-
- lessBreak = bd->min[i];
- lessValue = 0.0;
- moreBreak = bd->max[i];
- moreValue = 1.0;
-
- for (j = 0; j < bd->internal_points[i]; j++) {
- if (bd->internal_value[i][j] > lessValue &&
- bd->internal_value[i][j] <= val) {
- lessBreak = bd->internal_break[i][j];
- lessValue = bd->internal_value[i][j];
- }
- if (bd->internal_value[i][j] < moreBreak &&
- bd->internal_value[i][j] >= val) {
- moreBreak = bd->internal_break[i][j];
- moreValue = bd->internal_value[i][j];
- }
- }
-
- if (moreBreak == lessBreak) return moreBreak;
-
- return ((float) (val - lessValue)) / ((float) (moreValue - lessValue)) *
- (moreBreak - lessBreak) + lessBreak + 0.5;
-}
-
-String _FSBGenFontName(name, val, bd)
- String name;
- int *val;
- BlendDataRec *bd;
-{
- char nameBuf[256];
- int i;
- char *ch;
-
- strcpy(nameBuf, name);
- ch = nameBuf + strlen(nameBuf);
-
- for (i = 0; i < bd->num_axes; i++) {
- sprintf(ch, "_%d_%s", val[i], bd->name[i]);
- ch = ch + strlen(ch);
- }
-
- return Canonical(nameBuf);
-}
-
diff --git a/xc/lib/dpstk/FontSBI.h b/xc/lib/dpstk/FontSBI.h
deleted file mode 100644
index 129c93d88..000000000
--- a/xc/lib/dpstk/FontSBI.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * FontSBI.h
- *
- * (c) Copyright 1991-1994 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
- */
-
-#ifndef _FontSelectionBoxI_H
-#define _FontSelectionBoxI_H
-
-#ifdef _NO_PROTO
-
-extern Widget _FSBCreateFontSampler();
-extern Boolean _FSBDownloadFontIfNecessary();
-extern XmString _FSBCreateSharedCS();
-extern void _FSBSetCreatorFamily();
-extern void _FSBSetUpFaceList();
-extern void _FSBBogusFont();
-extern void _FSBFlushFont();
-extern void _FSBSetCurrentFont();
-extern float _FSBNormalize();
-extern int _FSBUnnormalize();
-extern String _FSBGenFontName();
-
-#else /* _NO_PROTO */
-
-extern Widget _FSBCreateFontSampler(FontSelectionBoxWidget fsb);
-extern Boolean _FSBDownloadFontIfNecessary(FontRec *f,
- FontSelectionBoxWidget fsb);
-extern XmString _FSBCreateSharedCS(String str, Widget w);
-extern void _FSBSetCreatorFamily(Widget w, FontFamilyRec *ff);
-extern void _FSBSetUpFaceList(FontSelectionBoxWidget fsb, Bool redisplay);
-extern void _FSBBogusFont(FontSelectionBoxWidget fsb, FontRec *f);
-extern void _FSBFlushFont(FontSelectionBoxWidget fsb, FontRec *f);
-extern void _FSBSetCurrentFont(FontSelectionBoxWidget fsb, String name);
-extern float _FSBNormalize(int val, BlendDataRec *bd, int i);
-extern int _FSBUnnormalize(double val, BlendDataRec *bd, int i);
-extern String _FSBGenFontName(String name, int *val, BlendDataRec *bd);
-
-#endif /* _NO_PROTO */
-
-#endif /* _FontSelectionBoxI_H */
-/* DON'T ADD ANYTHING AFTER THIS #endif */
diff --git a/xc/lib/dpstk/FontSample.c b/xc/lib/dpstk/FontSample.c
deleted file mode 100644
index f1019fdc8..000000000
--- a/xc/lib/dpstk/FontSample.c
+++ /dev/null
@@ -1,1852 +0,0 @@
-/*
- * FontSample.c
- *
- * (c) Copyright 1991-1994 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
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <X11/Xos.h>
-#include <stdlib.h>
-#include <math.h>
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-#include <Xm/Xm.h>
-
-/* There are no words to describe how I feel about having to do this */
-
-#if XmVersion > 1001
-#include <Xm/ManagerP.h>
-#else
-#include <Xm/XmP.h>
-#endif
-
-#include <Xm/Form.h>
-#include <Xm/List.h>
-#include <Xm/Label.h>
-#include <Xm/LabelG.h>
-#include <Xm/PushB.h>
-#include <Xm/PanedW.h>
-#include <Xm/PushBG.h>
-#include <Xm/SeparatoG.h>
-#include <Xm/TextF.h>
-#include <Xm/RowColumn.h>
-#include <Xm/DrawingA.h>
-#include <Xm/ScrolledW.h>
-#include <Xm/ToggleBG.h>
-#include <Xm/Frame.h>
-#include <Xm/RowColumn.h>
-#include <DPS/dpsXclient.h>
-#include <DPS/dpsops.h>
-#include "DPS/dpsXcommon.h"
-#include "DPS/dpsXshare.h"
-#include "DPS/FontSBP.h"
-#include "FSBwraps.h"
-#include "FontSBI.h"
-#include "DPS/FontSamplP.h"
-
-#if 0
-/* This is not in Xos.h for some reason */
-char *strstr();
-#endif
-
-#undef MAX
-#define MAX(x,y) ((x) > (y) ? (x) : (y))
-
-#define UnsharedCS(str) XmStringCreate(str, XmSTRING_DEFAULT_CHARSET)
-
-static float defaultSizeList[] = {
-#ifndef SAMPLER_DEFAULT_SIZE_LIST
- 8, 10, 12, 14, 16, 18, 24, 36, 48, 72
-#else
- SAMPLER_DEFAULT_SIZE_LIST
-#endif /* DEFAULT_SIZE_LIST */
-};
-
-#ifndef SAMPLER_DEFAULT_SIZE_LIST_COUNT
-#define SAMPLER_DEFAULT_SIZE_LIST_COUNT 10
-#endif /* DEFAULT_SIZE_LIST_COUNT */
-
-#ifndef SAMPLER_DEFAULT_SIZE
-#define SAMPLER_DEFAULT_SIZE 24.0
-#endif /* SAMPLER_DEFAULT_SIZE */
-
-static Boolean DisplayAllWorkProc(), DisplaySelectedWorkProc(),
- DisplaySelectedFamilyWorkProc(), DisplayFilteredWorkProc();
-
-#define Offset(field) XtOffsetOf(FontSamplerRec, sampler.field)
-
-static XtResource resources[] = {
- {XtNsizes, XtCSizes, XtRFloatList, sizeof(float*),
- Offset(sizes), XtRImmediate, (XtPointer) defaultSizeList},
- {XtNsizeCount, XtCSizeCount, XtRInt, sizeof(int),
- Offset(size_count), XtRImmediate,
- (XtPointer) SAMPLER_DEFAULT_SIZE_LIST_COUNT},
- {XtNdismissCallback, XtCCallback, XtRCallback, sizeof(XtCallbackList),
- Offset(dismiss_callback), XtRCallback, (XtPointer) NULL},
- {XtNfontSelectionBox, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(fsb), XtRWidget, (XtPointer) NULL},
- {XtNminimumWidth, XtCMinimumWidth, XtRDimension, sizeof(Dimension),
- Offset(minimum_width), XtRImmediate, (XtPointer) 100},
- {XtNminimumHeight, XtCMinimumHeight, XtRDimension, sizeof(Dimension),
- Offset(minimum_height), XtRImmediate, (XtPointer) 100},
- {XtNnoRoomMessage, XtCMessage, XmRXmString, sizeof(XmString),
- Offset(no_room_message), XtRString,
- "Current size is too large or panel is too small"},
- {XtNnoFontMessage, XtCMessage, XmRXmString, sizeof(XmString),
- Offset(no_font_message), XtRString,
- "There are no fonts!"},
- {XtNnoSelectedFontMessage, XtCMessage, XmRXmString, sizeof(XmString),
- Offset(no_selected_font_message), XtRString,
- "No font is currently selected"},
- {XtNnoSelectedFamilyMessage, XtCMessage, XmRXmString, sizeof(XmString),
- Offset(no_selected_family_message), XtRString,
- "No family is currently selected"},
- {XtNnoFamilyFontMessage, XtCMessage, XmRXmString, sizeof(XmString),
- Offset(no_family_font_message), XtRString,
- "Selected family has no fonts!"},
- {XtNnoMatchMessage, XtCMessage, XmRXmString, sizeof(XmString),
- Offset(no_match_message), XtRString,
- "No fonts match filters"},
- {XtNpanelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(panel_child), XtRImmediate, (XtPointer) NULL},
- {XtNareaChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(area_child), XtRImmediate, (XtPointer) NULL},
- {XtNtextChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(text_child), XtRImmediate, (XtPointer) NULL},
- {XtNfontLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(font_label_child), XtRImmediate, (XtPointer) NULL},
- {XtNscrolledWindowChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(scrolled_window_child), XtRImmediate, (XtPointer) NULL},
- {XtNdisplayButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(display_button_child), XtRImmediate, (XtPointer) NULL},
- {XtNdismissButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(dismiss_button_child), XtRImmediate, (XtPointer) NULL},
- {XtNstopButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(stop_button_child), XtRImmediate, (XtPointer) NULL},
- {XtNclearButtonChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(clear_button_child), XtRImmediate, (XtPointer) NULL},
- {XtNradioFrameChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(radio_frame_child), XtRImmediate, (XtPointer) NULL},
- {XtNradioBoxChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(radio_box_child), XtRImmediate, (XtPointer) NULL},
- {XtNallToggleChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(all_toggle_child), XtRImmediate, (XtPointer) NULL},
- {XtNselectedToggleChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(selected_toggle_child), XtRImmediate, (XtPointer) NULL},
- {XtNselectedFamilyToggleChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(selected_family_toggle_child), XtRImmediate, (XtPointer) NULL},
- {XtNfilterToggleChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(filter_toggle_child), XtRImmediate, (XtPointer) NULL},
- {XtNfilterTextChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(filter_text_child), XtRImmediate, (XtPointer) NULL},
- {XtNfilterBoxChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(filter_box_child), XtRImmediate, (XtPointer) NULL},
- {XtNfilterFrameChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(filter_frame_child), XtRImmediate, (XtPointer) NULL},
- {XtNsizeLabelChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_label_child), XtRWidget, (XtPointer) NULL},
- {XtNsizeTextFieldChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_text_field_child), XtRWidget, (XtPointer) NULL},
- {XtNsizeOptionMenuChild, XtCReadOnly, XtRWidget, sizeof(Widget),
- Offset(size_option_menu_child), XtRWidget, (XtPointer) NULL},
-};
-
-/* Forward declarations */
-
-static void ClassInitialize(), ClassPartInitialize(), Initialize(), Destroy(),
- ChangeManaged(), Resize(), ClickAction(), Cancel();
-static Boolean SetValues();
-static XtGeometryResult GeometryManager();
-
-static XtActionsRec actions[] = {
- {"FSBClickAction", ClickAction}
-};
-
-FontSamplerClassRec fontSamplerClassRec = {
- /* Core class part */
- {
- /* superclass */ (WidgetClass) &xmManagerClassRec,
- /* class_name */ "FontSampler",
- /* widget_size */ sizeof(FontSamplerRec),
- /* class_initialize */ ClassInitialize,
- /* class_part_initialize */ ClassPartInitialize,
- /* class_inited */ False,
- /* initialize */ Initialize,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ actions,
- /* num_actions */ XtNumber(actions),
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ True,
- /* compress_exposure */ XtExposeCompressMultiple,
- /* compress_enterleave */ True,
- /* visible_interest */ False,
- /* destroy */ Destroy,
- /* resize */ Resize,
- /* expose */ NULL,
- /* set_values */ SetValues,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ NULL,
- /* query_geometry */ XtInheritQueryGeometry,
- /* display_accelerator */ NULL,
- /* extension */ NULL,
- },
- /* Composite class part */
- {
- /* geometry_manager */ GeometryManager,
- /* change_managed */ ChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL,
- },
- /* Constraint class part */
- {
- /* resources */ NULL,
- /* num_resources */ 0,
- /* constraint_size */ 0,
- /* initialize */ NULL,
- /* destroy */ NULL,
- /* set_values */ NULL,
- /* extension */ NULL,
- },
- /* Manager class part */
- {
- /* translations */ XtInheritTranslations,
- /* syn_resources */ NULL,
- /* num_syn_resources */ 0,
- /* syn_constraint_resources */ NULL,
- /* num_syn_constraint_resources */ 0,
- /* parent_process */ XmInheritParentProcess,
- /* extension */ NULL,
- },
- /* FontSampler class part */
- {
- /* cancel */ Cancel,
- /* extension */ NULL,
- }
-};
-
-WidgetClass fontSamplerWidgetClass =
- (WidgetClass) &fontSamplerClassRec;
-
-typedef Boolean (*MatchProc)();
-
-typedef struct {
- char *name;
- char *particles[9];
- MatchProc special;
-} FilterRec;
-
-static Boolean MatchRoman(), MatchMedium(), MatchBlack();
-
-FilterRec filters[] = {
- {"roman", {"Roman", NULL}, MatchRoman},
- {"italic", {"Italic", "Kursiv", "Oblique", "Slanted", NULL}},
- {"symbol", {"Pi", "Symbol", "Logo", "Math", "Ornaments",
- "Carta", "Sonata", "Dingbats", NULL}},
- {"display", {"Display", "Titling", NULL}},
- {"alternate", {"Alternate", NULL}},
- {"expert", {"Expert", NULL}},
- {"oldstyle", {"Oldstyle Figures", "Old Style Figures",
- "Expert", NULL}},
- {"smallcaps", {"Small Caps", NULL}},
- {"swash", {"Swash", NULL}},
- {"script", {"Script", NULL}},
- {"separator1", { NULL}},
- {"condensed", {"Condensed", "Compressed", "Narrow", NULL}},
- {"extended", {"Extended", NULL}},
- {"separator2", { NULL}},
- {"light", {"Light", "Thin", NULL}},
- {"book", {"Book", NULL}},
- {"medium", {"Medium", "Normal", "Regular",
- "Roman", NULL}, MatchMedium},
- {"demi", {"Demi", "Semi", "Demibold", "Semibold", NULL}},
- {"bold", {"Bold", NULL}},
- {"black", {"Black", "Heavy", "Poster", "Scal",
- "Ultra", NULL}, MatchBlack},
- {"separator3", { NULL}},
- { NULL, { NULL}}
-};
-
-#define ITALIC_FILTER 1
-#define SYMBOL_FILTER 2
-#define TYPE_FILTERS 0
-#define WIDTH_FILTERS 11
-#define WEIGHT_FILTERS 14
-
-static int class_indices[] = {TYPE_FILTERS, WIDTH_FILTERS, WEIGHT_FILTERS, -1};
-
-static void ShowLabel(s, string)
- FontSamplerWidget s;
- XmString string;
-{
- XtVaSetValues(s->sampler.font_label_child, XmNlabelString, string, NULL);
-}
-
-static void UnhighlightFont(s)
- FontSamplerWidget s;
-{
- DisplayedFontRec *d = s->sampler.highlighted_font;
-
- XCopyArea(XtDisplay(s->sampler.area_child), s->sampler.pixmap,
- XtWindow(s->sampler.area_child),
- s->sampler.gc, d->l-1, d->t-1, d->r - d->l + 2, d->b - d->t + 2,
- d->l-1, d->t-1);
-}
-
-static void HighlightFont(s)
- FontSamplerWidget s;
-{
- DisplayedFontRec *d = s->sampler.highlighted_font;
- FontRec *f = d->font;
- BlendRec *b = d->blend;
- String fontName;
- int bogusFont;
-
- if (b == NULL) fontName = f->font_name;
- else fontName = b->font_name;
-
- (void) _FSBDownloadFontIfNecessary(d->font, s->sampler.fsb);
-
- XDPSSetContextGState(s->sampler.fsb->fsb.context, s->sampler.gstate);
- DPSsetrgbcolor(s->sampler.fsb->fsb.context, 1.0, 0.0, 0.0);
- _DPSFShowText(s->sampler.fsb->fsb.context, d->text->str,
- fontName, d->text->size, d->x, d->y, &bogusFont);
-}
-
-/* ARGSUSED */
-
-static void ClickAction(widget, event, params, num_params)
- Widget widget;
- XEvent *event;
- String *params;
- Cardinal *num_params;
-{
- XButtonEvent *b = (XButtonEvent *) event;
- DisplayedFontRec *f;
- FontSamplerWidget s =
- (FontSamplerWidget) XtParent(XtParent(XtParent(XtParent(widget))));
- XmString CSname;
- char buf[512];
-
- if (event->type != ButtonPress) return;
-
- if (s->sampler.current_display_info == NULL) return;
-
- f = s->sampler.current_display_info->shown_fonts;
-
- while (f != NULL &&
- (b->x < f->l || b->y < f->t || b->x > f->r || b->y > f->b)) {
- f = f->next;
- }
-
- if (f != NULL) {
- if (s->sampler.highlighted_font == f) return;
- if (s->sampler.highlighted_font != NULL) UnhighlightFont(s);
- s->sampler.highlighted_font = f;
- HighlightFont(s);
- if (f->blend == NULL) CSname = UnsharedCS(f->font->full_name);
- else {
- sprintf(buf, "%s %s", f->font->full_name, f->blend->blend_name);
- CSname = UnsharedCS(buf);
- }
- ShowLabel(s, CSname);
- XmStringFree(CSname);
- if (f->blend == NULL) {
- _FSBSetCurrentFont(s->sampler.fsb, f->font->font_name);
- } else {
- _FSBSetCurrentFont(s->sampler.fsb, f->blend->font_name);
- }
- }
-}
-
-static void UpdateDisplayedFontRecs(info, newHeight, oldHeight, newWidth)
- DisplayRecord *info;
- Position newHeight, oldHeight, newWidth;
-{
- float *m = info->sampler->sampler.invctm;
- float h, w;
- Position oldInfoHeight = info->height;
- DisplayedFontRec *f;
-
- info->window_height = newHeight;
- h = newHeight;
- w = newWidth;
-
- info->width = (int) (m[0] * w - m[2] * h + m[4]);
- info->height = (int) (m[1] * w - m[3] * h + m[5]);
-
- info->y += info->height - oldInfoHeight;
-
- for (f = info->shown_fonts; f != NULL; f = f->next) {
- f->y += info->height - oldInfoHeight;
- }
-}
-
-/* ARGSUSED */
-
-static void ResizeEventHandler(widget, clientData, event, continueToDispatch)
- Widget widget;
- XtPointer clientData;
- XEvent *event;
- Boolean *continueToDispatch;
-{
- Dimension clip_width, clip_height, new_width, new_height,
- area_width, area_height;
- int depth;
- FontSamplerWidget s = (FontSamplerWidget) clientData;
- Pixmap p;
-
- if (event->type != ConfigureNotify) return;
-
- XtVaGetValues(s->sampler.clip_widget, XtNwidth, &clip_width,
- XtNheight, &clip_height, NULL);
- XtVaGetValues(s->sampler.area_child, XtNwidth, &area_width,
- XtNheight, &area_height, XtNdepth, &depth, NULL);
-
- /* Trying to make it fit exactly causes looooping... */
-
- new_width = clip_width-2;
- new_height = clip_height-2;
-
- if (clip_width < s->sampler.minimum_width) {
- new_width = s->sampler.minimum_width;
- }
- if (clip_height < s->sampler.minimum_height) {
- new_height = s->sampler.minimum_height;
- }
-
- if (new_height != area_height || new_width != area_width) {
- XtVaSetValues(s->sampler.area_child, XtNwidth, new_width,
- XtNheight, new_height, NULL);
-
- p = XCreatePixmap(XtDisplay(s->sampler.area_child),
- RootWindowOfScreen(XtScreen(s->sampler.area_child)),
- new_width, new_height, depth);
-
- if (s->sampler.gstate != 0) {
- XDPSSetContextGState(s->sampler.fsb->fsb.context,
- s->sampler.gstate);
- XDPSSetContextParameters(s->sampler.fsb->fsb.context,
- XtScreen(s->sampler.area_child), depth,
- XtWindow(s->sampler.area_child),
- new_height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextScreenDepth | XDPSContextDrawable |
- XDPSContextRGBMap | XDPSContextGrayMap);
- _DPSFReclip(s->sampler.fsb->fsb.context);
- _DPSFGetCTM(s->sampler.fsb->fsb.context,
- s->sampler.ctm, s->sampler.invctm);
- XDPSUpdateContextGState(s->sampler.fsb->fsb.context,
- s->sampler.gstate);
- XDPSSetContextGState(s->sampler.fsb->fsb.context,
- s->sampler.pixmap_gstate);
- XDPSSetContextParameters(s->sampler.fsb->fsb.context,
- (Screen *) NULL, 0,
- p, new_height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextDrawable);
- XDPSUpdateContextGState(s->sampler.fsb->fsb.context,
- s->sampler.pixmap_gstate);
-
- _DPSFClearWindow(s->sampler.fsb->fsb.context);
- /* La di dah */
- DPSWaitContext(s->sampler.fsb->fsb.context);
- XCopyArea(XtDisplay(s), s->sampler.pixmap, p,
- s->sampler.gc, 0, 0, new_width, new_height, 0, 0);
- }
- XFreePixmap(XtDisplay(s), s->sampler.pixmap);
- s->sampler.pixmap = p;
- UpdateDisplayedFontRecs(s->sampler.current_display_info,
- new_height, area_height, new_width);
- }
-}
-
-static void ClassInitialize()
-{
- XtInitializeWidgetClass(fontSelectionBoxWidgetClass);
-}
-
-static void ClassPartInitialize(widget_class)
- WidgetClass widget_class;
-{
- register FontSamplerWidgetClass wc =
- (FontSamplerWidgetClass) widget_class;
- FontSamplerWidgetClass super =
- (FontSamplerWidgetClass) wc->core_class.superclass;
-
- if (wc->sampler_class.cancel == InheritCancel) {
- wc->sampler_class.cancel = super->sampler_class.cancel;
- }
-}
-
-static void FreeDisplayInfo(info)
- DisplayRecord *info;
-{
- DisplayedFontRec *f;
- DisplayedTextRec *t;
-
- if (info == NULL) return;
-
- XtVaSetValues(info->sampler->sampler.font_label_child,
- XtVaTypedArg, XmNlabelString, XtRString,
- " ", 2, NULL);
-
- while ((f = info->shown_fonts) != NULL) {
- info->shown_fonts = f->next;
- XtFree((char *) f);
- }
-
- while ((t = info->text_list) != NULL) {
- info->text_list = t->next;
- XtFree((char *) t->str);
- XtFree((char *) t);
- }
-
- XtFree((char *) info);
-}
-
-static Boolean IsSet(widget)
- Widget widget;
-{
- return XmToggleButtonGadgetGetState(widget);
-}
-
-/* ARGSUSED */
-
-static void DisplayCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XtAppContext app;
- float h, w;
- DisplayRecord *info;
- FontSamplerWidget s = (FontSamplerWidget) clientData;
- float *m;
- char *value;
- DisplayedTextRec *t;
-
- if (s->sampler.current_display_proc != None) {
- XtRemoveWorkProc(s->sampler.current_display_proc);
- }
- FreeDisplayInfo(s->sampler.current_display_info);
- s->sampler.highlighted_font = NULL;
-
- app = XtDisplayToApplicationContext(XtDisplay(widget));
-
- info = s->sampler.current_display_info =
- (DisplayRecord *) XtNew(DisplayRecord);
-
- XtVaGetValues(s->sampler.area_child,
- XtNwidth, &info->width,
- XtNheight, &info->window_height,
- XtNdepth, &info->depth,
- NULL);
-
- if (s->sampler.gstate == 0) {
- XDPSSetContextParameters(s->sampler.fsb->fsb.context,
- XtScreen(s->sampler.area_child), info->depth,
- XtWindow(s->sampler.area_child),
- info->window_height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextScreenDepth | XDPSContextDrawable |
- XDPSContextRGBMap | XDPSContextGrayMap);
- DPSsetgray(s->sampler.fsb->fsb.context, 0.0);
- XDPSCaptureContextGState(s->sampler.fsb->fsb.context,
- &s->sampler.gstate);
- _DPSFGetCTM(s->sampler.fsb->fsb.context,
- s->sampler.ctm, s->sampler.invctm);
- XDPSSetContextParameters(s->sampler.fsb->fsb.context,
- (Screen *) NULL, 0,
- s->sampler.pixmap, info->window_height,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextDrawable);
- DPSsetgray(s->sampler.fsb->fsb.context, 0.0);
- XDPSCaptureContextGState(s->sampler.fsb->fsb.context,
- &s->sampler.pixmap_gstate);
- }
-
- h = info->window_height;
- w = info->width;
-
- m = s->sampler.invctm;
-
- info->width = (int) (m[0] * w - m[2] * h + m[4]);
- info->height = (int) (m[1] * w - m[3] * h + m[5]);
- info->sampler = s;
- info->inited = info->any_shown = False;
- info->column_width = 0;
- info->x = 5;
- info->y = info->height;
- info->shown_fonts = NULL;
-
- t = info->text_list = XtNew(DisplayedTextRec);
- t->next = NULL;
- value = XmTextFieldGetString(s->sampler.text_child);
- t->str = XtNewString(value);
-
- value = XmTextFieldGetString(s->sampler.size_text_field_child);
-
- if (value == NULL || *value == '\0') t->size = SAMPLER_DEFAULT_SIZE;
- else {
- t->size = atof(value);
- if (t->size <= 0) t->size = SAMPLER_DEFAULT_SIZE;
- }
-
- s->sampler.displaying = True;
-
- XDPSSetContextGState(s->sampler.fsb->fsb.context, s->sampler.gstate);
- _DPSFClearWindow(s->sampler.fsb->fsb.context);
- XDPSSetContextGState(s->sampler.fsb->fsb.context,
- s->sampler.pixmap_gstate);
- _DPSFClearWindow(s->sampler.fsb->fsb.context);
-
- XtSetSensitive(s->sampler.stop_button_child, True);
-
- if (IsSet(s->sampler.all_toggle_child)) {
- s->sampler.current_display_proc =
- XtAppAddWorkProc(app, DisplayAllWorkProc,
- (XtPointer) info);
- } else if (IsSet(s->sampler.selected_toggle_child)) {
- s->sampler.current_display_proc =
- XtAppAddWorkProc(app, DisplaySelectedWorkProc,
- (XtPointer) info);
- } else if (IsSet(s->sampler.selected_family_toggle_child)) {
- s->sampler.current_display_proc =
- XtAppAddWorkProc(app, DisplaySelectedFamilyWorkProc,
- (XtPointer) info);
- } else if (IsSet(s->sampler.filter_toggle_child)) {
- s->sampler.current_display_proc =
- XtAppAddWorkProc(app, DisplayFilteredWorkProc,
- (XtPointer) info);
- }
-}
-
-static void FinishUpDisplaying(s)
- FontSamplerWidget s;
-{
- XtSetSensitive(s->sampler.stop_button_child, False);
- s->sampler.current_display_proc = None;
-}
-
-/* ARGSUSED */
-
-static void FilterCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSamplerWidget s = (FontSamplerWidget) clientData;
-
- s->sampler.filters_changed = True;
-
- if (IsSet(s->sampler.filter_toggle_child)) return;
-
- XmToggleButtonGadgetSetState(s->sampler.filter_toggle_child, True, True);
-
- XmToggleButtonGadgetSetState(s->sampler.all_toggle_child, False, False);
- XmToggleButtonGadgetSetState(s->sampler.selected_toggle_child,
- False, False);
- XmToggleButtonGadgetSetState(s->sampler.selected_family_toggle_child,
- False, False);
-}
-
-/* ARGSUSED */
-
-static void TextCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSamplerWidget s = (FontSamplerWidget) clientData;
- DisplayedTextRec *t;
- char *value;
-
- if (!s->sampler.displaying) return;
-
- t = XtNew(DisplayedTextRec);
-
- value = XmTextFieldGetString(s->sampler.text_child);
- t->str = XtNewString(value);
- t->size = s->sampler.current_display_info->text_list->size;
- t->next = s->sampler.current_display_info->text_list;
- s->sampler.current_display_info->text_list = t;
-}
-
-/* ARGSUSED */
-
-static void StopCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSamplerWidget s = (FontSamplerWidget) clientData;
-
- if (s->sampler.current_display_proc == None) return;
-
- XtRemoveWorkProc(s->sampler.current_display_proc);
- FinishUpDisplaying(s);
-}
-
-/* ARGSUSED */
-
-static void DismissCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSamplerWidget s = (FontSamplerWidget) clientData;
-
- if (XtIsShell(XtParent(s))) XtPopdown(XtParent(s));
-
- if (s->sampler.current_display_proc != None) {
- XtRemoveWorkProc(s->sampler.current_display_proc);
- }
- FinishUpDisplaying(s);
-
- XtCallCallbackList(widget, s->sampler.dismiss_callback, (XtPointer) NULL);
-}
-
-/* ARGSUSED */
-
-static void PopdownCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSamplerWidget s =
- (FontSamplerWidget)
- (((CompositeWidget) widget)->composite.children[0]);
-
- if (s->sampler.current_display_proc != None) {
- XtRemoveWorkProc(s->sampler.current_display_proc);
- }
-}
-
-/* ARGSUSED */
-
-static void ExposeCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- XmDrawingAreaCallbackStruct *da = (XmDrawingAreaCallbackStruct *) callData;
- XExposeEvent *ev = (XExposeEvent *) da->event;
- FontSamplerWidget s = (FontSamplerWidget) clientData;
-
- if (ev->type != Expose || !s->sampler.displaying) return;
-
- XCopyArea(XtDisplay(widget), s->sampler.pixmap, XtWindow(widget),
- s->sampler.gc, ev->x, ev->y, ev->width, ev->height,
- ev->x, ev->y);
- if (s->sampler.highlighted_font != NULL) HighlightFont(s);
-}
-
-/* ARGSUSED */
-
-static void ClearCallback(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- int j;
- FontSamplerWidget s = (FontSamplerWidget) clientData;
-
- for (j = 0; filters[j].name != NULL; j++) {
- if (filters[j].particles[0] != NULL) {
- XmToggleButtonGadgetSetState(s->sampler.filter_widgets[j],
- False, False);
- }
- }
-
- XmTextFieldSetString(s->sampler.filter_text_child, "");
-}
-
-/* ARGSUSED */
-
-static void SizeSelect(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- FontSamplerWidget s = (FontSamplerWidget) clientData;
- String value;
- Widget option;
- char *ch;
- DisplayedTextRec *t;
-
- value = XmTextFieldGetString(widget);
-
- if (value == NULL) option = s->sampler.other_size;
- else {
- for (ch = value; *ch != '\0'; ch++) if (*ch == '.') *ch = '-';
-
- option = XtNameToWidget(s->sampler.size_menu, value);
- if (option == NULL) option = s->sampler.other_size;
- }
-
- XtVaSetValues(s->sampler.size_option_menu_child,
- XmNmenuHistory, option, NULL);
-
- if (!s->sampler.displaying) return;
-
- t = XtNew(DisplayedTextRec);
-
- t->str = XtNewString(s->sampler.current_display_info->text_list->str);
- if (value == NULL || *value == '\0') t->size = SAMPLER_DEFAULT_SIZE;
- else {
- t->size = atof(value);
- if (t->size <= 0) t->size = SAMPLER_DEFAULT_SIZE;
- }
- t->next = s->sampler.current_display_info->text_list;
- s->sampler.current_display_info->text_list = t;
-}
-
-/* There's a problem; sometimes the change has already been made in the field,
- and sometimes it hasn't. The times when it has seem to correspond to
- making changes with the size option menu, so we use this disgusting
- global flag to notice when this happens. */
-
-static Boolean changingSize = False;
-
-/* ARGSUSED */
-
-static void TextVerify(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- int i;
- XmTextVerifyPtr v = (XmTextVerifyPtr) callData;
- char ch, *cp;
- int decimalPoints = 0;
-
- if (changingSize) return; /* We know what we're doing; allow it */
-
- /* Should probably look at format field, but seems to contain garbage */
-
- if (v->text->length == 0) return;
-
- for (i = 0; i < v->text->length; i++) {
- ch = v->text->ptr[i];
- if (ch == '.') decimalPoints++;
- else if (!isdigit(ch)) {
- v->doit = False;
- return;
- }
- }
-
- if (decimalPoints > 1) {
- v->doit = False;
- return;
- }
-
- cp = XmTextFieldGetString(widget);
-
- for (/**/; *cp != '\0'; cp++) {
- if (*cp == '.') decimalPoints++;
- }
-
- if (decimalPoints > 1) v->doit = False;
-}
-
-/* ARGSUSED */
-
-static void SetSize(widget, clientData, callData)
- Widget widget;
- XtPointer clientData, callData;
-{
- char buf[20], *ch;
- FontSamplerWidget s = (FontSamplerWidget) clientData;
-
- strcpy(buf, XtName(widget));
- for (ch = buf; *ch != '\0'; ch++) if (*ch == '-') *ch++ = '.';
-
- changingSize = True;
- XmTextFieldSetString(s->sampler.size_text_field_child, buf);
- changingSize = False;
-}
-
-static void CreateSizeMenu(s, destroyOldChildren)
- FontSamplerWidget s;
- Boolean destroyOldChildren;
-{
- Arg args[20];
- int i, j;
- Widget *sizes;
- char buf[20];
- Widget *children;
- Cardinal num_children;
- XmString csName;
- char *ch;
-
- if (destroyOldChildren) {
- XtVaGetValues(s->sampler.size_menu, XtNchildren, &children,
- XtNnumChildren, &num_children, NULL);
-
- /* Don't destroy first child ("other") */
- for (j = 1; j < num_children; j++) XtDestroyWidget(children[j]);
-
- sizes = (Widget *) XtMalloc((s->sampler.size_count+1) *
- sizeof(Widget));
- sizes[0] = children[0];
- } else {
- i = 0;
- sizes = (Widget *) XtMalloc((s->sampler.size_count+1) *
- sizeof(Widget));
- s->sampler.other_size = sizes[0] =
- XtCreateManagedWidget("other", xmPushButtonGadgetClass,
- s->sampler.size_menu, args, i);
- }
-
- for (j = 0; j < s->sampler.size_count; j++) {
- (void) sprintf(buf, "%g", s->sampler.sizes[j]);
- csName = UnsharedCS(buf);
- for (ch = buf; *ch != '\0'; ch++) if (*ch == '.') *ch = '-';
- i = 0;
- XtSetArg(args[i], XmNlabelString, csName); i++;
- sizes[j+1] =
- XmCreatePushButtonGadget(s->sampler.size_menu, buf, args, i);
- XmStringFree(csName);
- XtAddCallback(sizes[j+1], XmNactivateCallback, SetSize, (XtPointer) s);
- }
- XtManageChildren(sizes, j+1);
- XtFree((char *) sizes);
-}
-
-static void CreateFilters(s)
- FontSamplerWidget s;
-{
- FilterRec *f;
- int i;
-
- s->sampler.filter_widgets =
- (Widget *) XtCalloc(XtNumber(filters)-1, sizeof(Widget));
-
- s->sampler.filter_flags =
- (Boolean *) XtCalloc(XtNumber(filters)-1, sizeof(Boolean));
-
- for (i = 0; filters[i].name != NULL; i++) {
- f = filters+i;
- if (f->particles[0] == NULL) {
- s->sampler.filter_widgets[i] =
- XtCreateManagedWidget(f->name, xmSeparatorGadgetClass,
- s->sampler.filter_box_child,
- (ArgList) NULL, 0);
- } else {
- s->sampler.filter_widgets[i] =
- XtCreateManagedWidget(f->name, xmToggleButtonGadgetClass,
- s->sampler.filter_box_child,
- (ArgList) NULL, 0);
- XtAddCallback(s->sampler.filter_widgets[i],
- XmNvalueChangedCallback,
- FilterCallback, (XtPointer) s);
- }
- }
-}
-
-static void CreateChildren(s)
- FontSamplerWidget s;
-{
- Arg args[20];
- int i;
- Widget form;
- Dimension area_width, area_height;
- int depth;
- Widget w, rowcol;
-
- form = s->sampler.panel_child =
- XtCreateManagedWidget("panel", xmFormWidgetClass,
- (Widget) s, (ArgList) NULL, 0);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- s->sampler.display_button_child =
- XtCreateManagedWidget("displayButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(s->sampler.display_button_child, XmNactivateCallback,
- DisplayCallback, (XtPointer) s);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, s->sampler.display_button_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XtNsensitive, False); i++;
- s->sampler.stop_button_child =
- XtCreateManagedWidget("stopButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(s->sampler.stop_button_child, XmNactivateCallback,
- StopCallback, (XtPointer) s);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, s->sampler.stop_button_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- s->sampler.dismiss_button_child =
- XtCreateManagedWidget("dismissButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(s->sampler.dismiss_button_child, XmNactivateCallback,
- DismissCallback, (XtPointer) s);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, s->sampler.dismiss_button_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- s->sampler.size_label_child =
- XtCreateManagedWidget("sizeLabel", xmLabelWidgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, s->sampler.size_label_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, s->sampler.size_label_child); i++;
- s->sampler.size_text_field_child =
- XtCreateManagedWidget("sizeTextField",
- xmTextFieldWidgetClass,
- form, args, i);
- XtAddCallback(s->sampler.size_text_field_child, XmNvalueChangedCallback,
- SizeSelect, (XtPointer) s);
- XtAddCallback(s->sampler.size_text_field_child, XmNmodifyVerifyCallback,
- TextVerify, (XtPointer) NULL);
-
- i = 0;
- s->sampler.size_menu = XmCreatePulldownMenu(form, "sizeMenu", args, i);
-
- CreateSizeMenu(s, False);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, s->sampler.size_text_field_child); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, s->sampler.size_label_child); i++;
- XtSetArg(args[i], XmNsubMenuId, s->sampler.size_menu); i++;
- s->sampler.size_option_menu_child =
- XmCreateOptionMenu(form, "sizeOptionMenu", args, i);
- XtManageChild(s->sampler.size_option_menu_child);
-
- SizeSelect(s->sampler.size_text_field_child, (XtPointer) s,
- (XtPointer) NULL);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); i++;
- rowcol = XtCreateManagedWidget("rowColumn", xmRowColumnWidgetClass,
- form, args, i);
-
- i = 0;
- s->sampler.radio_frame_child =
- XtCreateManagedWidget("radioFrame", xmFrameWidgetClass,
- rowcol, args, i);
-
- i = 0;
- s->sampler.radio_box_child = XmCreateRadioBox(s->sampler.radio_frame_child,
- "radioBox", args, i);
- XtManageChild(s->sampler.radio_box_child);
-
- i = 0;
- s->sampler.all_toggle_child =
- XtCreateManagedWidget("allToggle", xmToggleButtonGadgetClass,
- s->sampler.radio_box_child, args, i);
-
- i = 0;
- s->sampler.selected_toggle_child =
- XtCreateManagedWidget("selectedToggle", xmToggleButtonGadgetClass,
- s->sampler.radio_box_child, args, i);
-
- i = 0;
- s->sampler.selected_family_toggle_child =
- XtCreateManagedWidget("selectedFamilyToggle",
- xmToggleButtonGadgetClass,
- s->sampler.radio_box_child, args, i);
-
- i = 0;
- s->sampler.filter_toggle_child =
- XtCreateManagedWidget("filterToggle",
- xmToggleButtonGadgetClass,
- s->sampler.radio_box_child, args, i);
-
- i = 0;
- s->sampler.filter_frame_child =
- XtCreateManagedWidget("filterFrame", xmFrameWidgetClass,
- rowcol, args, i);
-
- i = 0;
- s->sampler.filter_box_child =
- XtCreateManagedWidget("filterBox", xmRowColumnWidgetClass,
- s->sampler.filter_frame_child, args, i);
-
- CreateFilters(s);
-
- i = 0;
- s->sampler.filter_text_child =
- XtCreateManagedWidget("filterText", xmTextFieldWidgetClass,
- s->sampler.filter_box_child, args, i);
- XtAddCallback(s->sampler.filter_text_child,
- XmNvalueChangedCallback,
- FilterCallback, (XtPointer) s);
-
- i = 0;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, rowcol); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, rowcol); i++;
- s->sampler.clear_button_child =
- XtCreateManagedWidget("clearButton", xmPushButtonWidgetClass,
- form, args, i);
- XtAddCallback(s->sampler.clear_button_child, XmNactivateCallback,
- ClearCallback, (XtPointer) s);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, rowcol); i++;
- s->sampler.text_child =
- XtCreateManagedWidget("text", xmTextFieldWidgetClass,
- form, args, i);
- XtAddCallback(s->sampler.text_child,
- XmNvalueChangedCallback,
- TextCallback, (XtPointer) s);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, s->sampler.text_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNleftWidget, s->sampler.text_child); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_OPPOSITE_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, s->sampler.text_child); i++;
- s->sampler.font_label_child =
- XtCreateManagedWidget("fontLabel", xmLabelGadgetClass,
- form, args, i);
-
- i = 0;
- XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNtopWidget, s->sampler.font_label_child); i++;
- XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); i++;
- XtSetArg(args[i], XmNrightAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNrightWidget, rowcol); i++;
- XtSetArg(args[i], XmNbottomAttachment, XmATTACH_WIDGET); i++;
- XtSetArg(args[i], XmNbottomWidget, s->sampler.display_button_child);i++;
- XtSetArg(args[i], XmNscrollingPolicy, XmAUTOMATIC); i++;
- s->sampler.scrolled_window_child =
- XtCreateManagedWidget("scrolledWindow",
- xmScrolledWindowWidgetClass,
- form, args, i);
- i = 0;
- s->sampler.area_child =
- XtCreateManagedWidget("area", xmDrawingAreaWidgetClass,
- s->sampler.scrolled_window_child, args, i);
- XtAddCallback(s->sampler.area_child, XmNexposeCallback,
- ExposeCallback, (XtPointer) s);
-
- XtVaGetValues(s->sampler.scrolled_window_child,
- XmNclipWindow, &s->sampler.clip_widget,
- NULL);
-
- /* I would like to use translations for this, but Motif overwrites the
- clip window's translation. Grr... */
-
- XtAddEventHandler(s->sampler.clip_widget, StructureNotifyMask, False,
- ResizeEventHandler, (XtPointer) s);
-
- XtVaSetValues(s->sampler.scrolled_window_child,
- XmNworkWindow, s->sampler.area_child, NULL);
-
- XtVaGetValues(s->sampler.area_child,
- XtNheight, &area_height,
- XtNwidth, &area_width,
- XtNdepth, &depth,
- NULL);
-
- if (area_height < s->sampler.minimum_height ||
- area_width < s->sampler.minimum_width) {
- area_height = MAX(area_height, s->sampler.minimum_height);
- area_width = MAX(area_width, s->sampler.minimum_width);
-
- XtVaSetValues(s->sampler.area_child, XtNwidth, area_width,
- XtNheight, area_height, NULL);
- }
-
- s->sampler.pixmap =
- XCreatePixmap(XtDisplay(s->sampler.area_child),
- RootWindowOfScreen(XtScreen(s->sampler.area_child)),
- area_width, area_height, depth);
-
- XtVaSetValues(form, XmNdefaultButton, s->sampler.display_button_child,
- NULL);
-
- s->sampler.gc = XtGetGC(s->sampler.area_child, 0, (XGCValues *) NULL);
-
- for (w = XtParent(s); !XtIsShell(w); w = XtParent(w)) {}
- XtAddCallback(w, XtNpopdownCallback, PopdownCallback, (XtPointer) NULL);
-}
-
-/* ARGSUSED */
-
-static void Initialize(request, new, args, num_args)
- Widget request, new;
- ArgList args;
- Cardinal *num_args;
-{
- FontSamplerWidget sampler = (FontSamplerWidget) new;
-
- /* Must have a fsb */
-
- if (sampler->sampler.fsb == NULL) {
- XtAppErrorMsg(XtWidgetToApplicationContext(new),
- "initializeFontSampler", "noFontSelectionBox",
- "FontSelectionBoxError",
- "No font selection box given to font sampler",
- (String *) NULL, (Cardinal *) NULL);
- }
-
- /* Verify size list */
-
- if (sampler->sampler.size_count > 0 && sampler->sampler.sizes == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontSampler", "sizeMismatch",
- "FontSelectionBoxError",
- "Size count specified but no sizes present",
- (String *) NULL, (Cardinal *) NULL);
- sampler->sampler.size_count = 0;
- }
-
- if (sampler->sampler.size_count < 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "initializeFontSampler", "negativeSize",
- "FontSelectionBoxError",
- "Size count should not be negative",
- (String *) NULL, (Cardinal *) NULL);
- sampler->sampler.size_count = 0;
- }
-
- /* Initialize non-resource fields */
-
- sampler->sampler.displaying = False;
- sampler->sampler.current_display_proc = None;
- sampler->sampler.current_display_info = NULL;
- sampler->sampler.gstate = sampler->sampler.pixmap_gstate = 0;
-
- CreateChildren(sampler);
-}
-
-static void AdvanceInfoToNextFont(info)
- DisplayRecord *info;
-{
- if (info->current_font->blend_data != NULL) {
- if (info->current_blend == NULL) {
- info->current_blend = info->current_font->blend_data->blends;
- } else info->current_blend = info->current_blend->next;
- if (info->current_blend == NULL) {
- info->current_font = info->current_font->next;
- }
- } else info->current_font = info->current_font->next;
-
- if (info->current_font == NULL) {
- info->current_family = info->current_family->next;
- if (info->current_family != NULL) {
- info->current_font = info->current_family->fonts;
- }
- }
-}
-
-static Boolean ShowFont(info)
- DisplayRecord *info;
-{
- float width, left, right, top, bottom;
- FontRec *f = info->current_font;
- BlendRec *b = info->current_blend;
- DisplayedFontRec *d;
- FontSamplerWidget s = info->sampler;
- float *m;
- DisplayedTextRec *t = info->text_list;
- String fontName;
- int bogusFont;
- int oldx, oldy;
-
- if (f == NULL) return True;
-
- oldx = info->x;
- oldy = info->y;
-
- info->y -= t->size * 5 / 4;
-
- if (info->y < 0) {
- if (info->column_width == 0) return False;
- info->y = info->height - (t->size * 5 / 4);
- info->x += info->column_width + (t->size / 4);
- if (info->x > (int) info->width) return False;
- info->column_width = 0;
- }
-
- if (!_FSBDownloadFontIfNecessary(f, s->sampler.fsb)) {
- AdvanceInfoToNextFont(info);
- return True;
- }
-
- if (b == NULL) fontName = f->font_name;
- else fontName = b->font_name;
-
- /* Do ...AndGetDimensions on the pixmap to make sure that it's synced.
- That way we can reliably do an XCopyArea without first doing a
- WaitContext. */
-
- XDPSSetContextGState(s->sampler.fsb->fsb.context, s->sampler.gstate);
- _DPSFShowText(s->sampler.fsb->fsb.context, t->str, fontName,
- t->size, info->x, info->y, &bogusFont);
-
- AdvanceInfoToNextFont(info);
-
- if (bogusFont) {
- info->x = oldx;
- info->y = oldy;
-
- XCopyArea(XtDisplay(s), s->sampler.pixmap,
- XtWindow(s->sampler.area_child),
- s->sampler.gc, 0, 0, info->width, info->height, 0, 0);
-
- if (info->current_font == f) {
- /* Must be the same font, different blend */
- info->current_font = info->current_font->next;
-
- if (info->current_font == NULL) {
- info->current_family = info->current_family->next;
- if (info->current_family != NULL) {
- info->current_font = info->current_family->fonts;
- }
- }
- }
-
- _FSBFlushFont(s->sampler.fsb, f);
- return True;
- }
-
- XDPSSetContextGState(s->sampler.fsb->fsb.context,
- s->sampler.pixmap_gstate);
- _DPSFShowTextAndGetDimensions(s->sampler.fsb->fsb.context,
- t->str, fontName,
- t->size, info->x, info->y,
- &width, &left, &right, &top, &bottom);
-
- width = ceil(width);
-
- if (width > (int) info->column_width) info->column_width = (int) width;
-
- d = XtNew(DisplayedFontRec);
-
- m = s->sampler.ctm;
-
- d->l = (int) (m[0] * left + m[2] * top + m[4]);
- d->r = (int) ceil(m[0] * right + m[2] * bottom + m[4]);
- d->t = (int) ceil(m[1] * left + m[3] * top + m[5] + info->window_height);
- d->b = (int) (m[1] * right + m[3] * bottom + m[5] + info->window_height);
- d->x = info->x;
- d->y = info->y;
- d->font = f;
- d->blend = b;
- d->text = info->text_list;
- d->next = info->shown_fonts;
- info->shown_fonts = d;
-
- return True;
-}
-
-static Boolean DisplayAllWorkProc(client_data)
- XtPointer client_data;
-{
- DisplayRecord *info = (DisplayRecord *) client_data;
- FontSamplerWidget s = info->sampler;
-
- if (!info->inited) {
- info->inited = True;
- info->current_family = s->sampler.fsb->fsb.known_families;
- info->current_font = info->current_family->fonts;
- info->current_blend = NULL;
- }
-
- if (!ShowFont(info)) {
- if (!info->any_shown) ShowLabel(s, s->sampler.no_room_message);
- FinishUpDisplaying(s);
- return True;
- }
-
- info->any_shown = True;
- if (info->current_family == NULL) {
- if (!info->any_shown) ShowLabel(s, s->sampler.no_font_message);
- FinishUpDisplaying(s);
- return True;
- }
- return False;
-}
-
-static Boolean DisplaySelectedWorkProc(client_data)
- XtPointer client_data;
-{
- DisplayRecord *info = (DisplayRecord *) client_data;
- FontSamplerWidget s = info->sampler;
-
- info->current_family = s->sampler.fsb->fsb.currently_selected_family;
- info->current_font = s->sampler.fsb->fsb.currently_selected_face;
- info->current_blend = s->sampler.fsb->fsb.currently_selected_blend;
-
- if (info->current_font != NULL) {
- if (!ShowFont(info)) ShowLabel(s, s->sampler.no_room_message);
- } else ShowLabel(s, s->sampler.no_selected_font_message);
-
- FinishUpDisplaying(s);
- return True;
-}
-
-static Boolean DisplaySelectedFamilyWorkProc(client_data)
- XtPointer client_data;
-{
- DisplayRecord *info = (DisplayRecord *) client_data;
- FontSamplerWidget s = info->sampler;
- FontFamilyRec *currentFamily;
-
- if (!info->inited) {
- info->inited = True;
- info->current_family = s->sampler.fsb->fsb.currently_selected_family;
- if (info->current_family != NULL) {
- info->current_font = info->current_family->fonts;
- info->current_blend = NULL;
- } else {
- ShowLabel(s, s->sampler.no_selected_family_message);
- FinishUpDisplaying(s);
- return True;
- }
- }
-
- currentFamily = info->current_family;
-
- if (!ShowFont(info)) {
- if (!info->any_shown) ShowLabel(s, s->sampler.no_room_message);
- FinishUpDisplaying(s);
- return True;
- }
-
- info->any_shown = True;
- if (info->current_family != currentFamily) {
- if (!info->any_shown) ShowLabel(s, s->sampler.no_family_font_message);
- FinishUpDisplaying(s);
- return True;
- }
- return False;
-}
-
-/* ARGSUSED */
-
-static Boolean MatchRoman(name, filter)
- String name;
- FilterRec *filter;
-{
- FilterRec *f;
- char *ch, **search, *start;
- int len;
-
- /* Roman means not italic and not symbol */
-
- for (f = filters + ITALIC_FILTER; f <= filters + SYMBOL_FILTER; f++) {
- for (search = f->particles; *search != NULL; search++) {
- start = name;
- do {
- ch = strstr(start, *search);
- if (ch != NULL) {
- len = strlen(*search);
- if (ch[len] == ' ' || ch[len] == '\0') return False;
- else start = ch+1;
- }
- } while (ch != NULL);
- }
- }
- return True;
-}
-
-static Boolean MatchMedium(name, filter)
- String name;
- FilterRec *filter;
-{
- FilterRec *f;
- char *ch, **search, *start;
- int len;
-
- for (search = filter->particles; *search != NULL; search++) {
- start = name;
- do {
- ch = strstr(start, *search);
- if (ch != NULL) {
- len = strlen(*search);
- if (ch[len] == ' ' || ch[len] == '\0') return True;
- else start = ch+1;
- }
- } while (ch != NULL);
- }
-
- /* Also match anything that has none of the other weight particles */
-
- for (f = filters + WEIGHT_FILTERS; f->name != NULL; f++) {
- if (f == filter) continue;
- for (search = f->particles; *search != NULL; search++) {
- start = name;
- do {
- ch = strstr(start, *search);
- if (ch != NULL) {
- len = strlen(*search);
- if (ch[len] == ' ' || ch[len] == '\0') return False;
- else start = ch+1;
- }
- } while (ch != NULL);
- }
- }
- return True;
-}
-
-static Boolean MatchBlack(name, filter)
- String name;
- FilterRec *filter;
-{
- char *ch, **search, *start;
- int len;
- Boolean ultra;
-
- for (search = filter->particles; *search != NULL; search++) {
- ultra = (strcmp(*search, "Ultra") == 0);
- start = name;
- do {
- ch = strstr(start, *search);
- if (ch != NULL) {
- len = strlen(*search);
- if (ch[len] == '\0') return True;
- if (ch[len] == ' ') {
- if (!ultra) return True;
- /* Only match "Ultra" if not followed by "Compressed" or
- "Light". We'd also like to add "Condensed" to this
- list, but some fonts use "Ultra Condensed" to mean
- "Ultra & Condensed" while others use it to mean "Very
- much Condensed". Sigh... */
- start = ch+len+1;
- if (strncmp(start, "Compressed", 10) != 0 &&
- strncmp(start, "Light", 5) != 0) return True;
- else start = ch+1;
- }
- else start = ch+1;
- }
- } while (ch != NULL);
- }
- return False;
-}
-
-static void UpdateFilters(s)
- FontSamplerWidget s;
-{
- int i;
-
- for (i = 0; filters[i].name != NULL; i++) {
- if (filters[i].particles[0] != NULL) {
- s->sampler.filter_flags[i] = IsSet(s->sampler.filter_widgets[i]);
- }
- }
-
- s->sampler.filter_text =
- XmTextFieldGetString(s->sampler.filter_text_child);
-}
-
-static Boolean FontMatchesFilters(font, blend, s)
- FontRec *font;
- BlendRec *blend;
- FontSamplerWidget s;
-{
- int *cl, i;
- FilterRec *f;
- char *ch, **search, *start;
- int len;
- Boolean anyset, foundone, allmatch;
- char *name;
- char buf[512];
-
- if (blend != NULL) {
- sprintf(buf, "%s %s", font->full_name, blend->blend_name);
- name = buf;
- } else name = font->full_name;
-
- allmatch = False;
- if (s->sampler.filters_changed) UpdateFilters(s);
-
- for (cl = class_indices; *cl != -1; cl++) {
- anyset = foundone = False;
- for (i = *cl;
- filters[i].particles[0] != NULL && filters[i].name != NULL; i++) {
-
- f = filters+i;
-
- if (!s->sampler.filter_flags[i]) continue;
- anyset = True;
-
- if (f->special != NULL) {
- if ((*f->special)(name, f)) {
- foundone = True;
- goto NEXT_CLASS;
- }
- continue;
- }
-
- for (search = f->particles; *search != NULL; search++) {
- start = name;
- do {
- ch = strstr(start, *search);
- if (ch != NULL) {
- len = strlen(*search);
- if (ch[len] == ' ' || ch[len] == '\0') {
- foundone = True;
- goto NEXT_CLASS;
- }
- else start = ch+1;
- }
- } while (ch != NULL);
- }
- }
-NEXT_CLASS: ;
- /* If there were any filters set in this class, but we didn't match,
- return False */
- if (anyset && !foundone) return False;
- if (anyset && foundone) allmatch = True;
- }
-
- /* Now check against the text field */
-
- if (s->sampler.filter_text == NULL || s->sampler.filter_text[0] == '\0') {
- return allmatch;
- }
-
- ch = strstr(name, s->sampler.filter_text);
-
- return (ch != NULL);
-}
-
-static Boolean DisplayFilteredWorkProc(client_data)
- XtPointer client_data;
-{
- DisplayRecord *info = (DisplayRecord *) client_data;
- FontSamplerWidget s = info->sampler;
-
- if (!info->inited) {
- info->inited = True;
- info->current_family = s->sampler.fsb->fsb.known_families;
- info->current_font = info->current_family->fonts;
- info->current_blend = NULL;
- s->sampler.filters_changed = True;
- }
-
- if (FontMatchesFilters(info->current_font, info->current_blend, s)) {
- if (!ShowFont(info)) {
- if (!info->any_shown) ShowLabel(s, s->sampler.no_room_message);
- FinishUpDisplaying(s);
- return True;
- }
- info->any_shown = True;
- } else AdvanceInfoToNextFont(info);
-
- if (info->current_font == NULL) {
- if (!info->any_shown) ShowLabel(s, s->sampler.no_match_message);
- FinishUpDisplaying(s);
- return True;
- }
- return False;
-}
-
-static void Destroy(widget)
- Widget widget;
-{
- FontSamplerWidget s = (FontSamplerWidget) widget;
-
- if (s->sampler.gstate != 0) {
- XDPSFreeContextGState(s->sampler.fsb->fsb.context,
- s->sampler.pixmap_gstate);
- XDPSFreeContextGState(s->sampler.fsb->fsb.context, s->sampler.gstate);
- }
- XtReleaseGC(widget, s->sampler.gc);
- XFreePixmap(XtDisplay(widget), s->sampler.pixmap);
- if (s->sampler.current_display_proc != None) {
- XtRemoveWorkProc(s->sampler.current_display_proc);
- }
- if (s->sampler.current_display_info != NULL) {
- FreeDisplayInfo(s->sampler.current_display_info);
- }
- XtFree((char *) s->sampler.filter_widgets);
- XtFree((char *) s->sampler.filter_flags);
-}
-
-static void Resize(widget)
- Widget widget;
-{
- FontSamplerWidget s = (FontSamplerWidget) widget;
-
- XtResizeWidget(s->sampler.panel_child, s->core.width, s->core.height, 0);
-}
-
-/* ARGSUSED */
-
-static XtGeometryResult GeometryManager(w, desired, allowed)
- Widget w;
- XtWidgetGeometry *desired, *allowed;
-{
-#define WANTS(flag) (desired->request_mode & flag)
-
- if (WANTS(XtCWQueryOnly)) return XtGeometryYes;
-
- if (WANTS(CWWidth)) w->core.width = desired->width;
- if (WANTS(CWHeight)) w->core.height = desired->height;
- if (WANTS(CWX)) w->core.x = desired->x;
- if (WANTS(CWY)) w->core.y = desired->y;
- if (WANTS(CWBorderWidth)) {
- w->core.border_width = desired->border_width;
- }
-
- return XtGeometryYes;
-#undef WANTS
-}
-
-static void ChangeManaged(w)
- Widget w;
-{
- FontSamplerWidget s = (FontSamplerWidget) w;
-
- w->core.width = s->composite.children[0]->core.width;
- w->core.height = s->composite.children[0]->core.height;
-}
-
-/* ARGSUSED */
-
-static Boolean SetValues(old, req, new, args, num_args)
- Widget old, req, new;
- ArgList args;
- Cardinal *num_args;
-{
- FontSamplerWidget olds = (FontSamplerWidget) old;
- FontSamplerWidget news = (FontSamplerWidget) new;
-
-#define NE(field) news->sampler.field != olds->sampler.field
-#define DONT_CHANGE(field) \
- if (NE(field)) news->sampler.field = olds->sampler.field;
-
- DONT_CHANGE(panel_child);
- DONT_CHANGE(area_child);
- DONT_CHANGE(text_child);
- DONT_CHANGE(font_label_child);
- DONT_CHANGE(scrolled_window_child);
- DONT_CHANGE(display_button_child);
- DONT_CHANGE(dismiss_button_child);
- DONT_CHANGE(stop_button_child);
- DONT_CHANGE(clear_button_child);
- DONT_CHANGE(radio_frame_child);
- DONT_CHANGE(radio_box_child);
- DONT_CHANGE(all_toggle_child);
- DONT_CHANGE(selected_toggle_child);
- DONT_CHANGE(selected_family_toggle_child);
- DONT_CHANGE(filter_toggle_child);
- DONT_CHANGE(filter_box_child);
- DONT_CHANGE(filter_frame_child);
- DONT_CHANGE(size_option_menu_child);
- DONT_CHANGE(size_text_field_child);
- DONT_CHANGE(size_label_child);
- DONT_CHANGE(fsb);
-#undef DONT_CHANGE
-
- if (news->sampler.size_count > 0 && news->sampler.sizes == NULL) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontSampler", "sizeMismatch",
- "FontSelectionBoxError",
- "Size count specified but no sizes present",
- (String *) NULL, (Cardinal *) NULL);
- news->sampler.size_count = 0;
- }
-
- if (news->sampler.size_count < 0) {
- XtAppWarningMsg(XtWidgetToApplicationContext(new),
- "setValuesFontSampler", "negativeSize",
- "FontSelectionBoxError",
- "Size count should not be negative",
- (String *) NULL, (Cardinal *) NULL);
- news->sampler.size_count = 0;
- }
-
- if (NE(sizes)) CreateSizeMenu(news, True);
-
- return False;
-#undef NE
-}
-
-static void Cancel(w)
- Widget w;
-{
- FontSamplerWidget s = (FontSamplerWidget) w;
-
- if (s->sampler.current_display_proc != None) {
- XtRemoveWorkProc(s->sampler.current_display_proc);
- }
-}
-
-void FSBCancelSampler(w)
- Widget w;
-{
- XtCheckSubclass(w, fontSamplerWidgetClass, NULL);
-
- (*((FontSamplerWidgetClass) XtClass(w))->sampler_class.cancel) (w);
-}
-
-#ifdef NO_STRSTR_AVAILABLE
-String strstr(s1, s2)
- register String s1, s2;
-{
- register int len1, len2;
-
- len1 = strlen(s1);
- len2 = strlen(s2);
-
- while (len1 >= len2) {
- if (*s1 == *s2) {
- if (strncmp(s1+1, s2+1, len2-1) == 0) return s1;
- }
- len1--;
- s1++;
- }
-}
-#endif /* NO_STRSTR_AVAILABLE */
diff --git a/xc/lib/dpstk/FontSelect.ad b/xc/lib/dpstk/FontSelect.ad
deleted file mode 100644
index 6d3440a9e..000000000
--- a/xc/lib/dpstk/FontSelect.ad
+++ /dev/null
@@ -1,415 +0,0 @@
-! FontSelect
-!
-! (c) Copyright 1991-1994 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
-!
-! Resource file for Font Selection Box
-!
-! This resource file must be merged into the resource file for
-! any application that uses the Font Selection Box
-!
-!
-*FontSelectionBox*fontList: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1
-*FontSelectionBox*XmPushButton.marginLeft:5
-*FontSelectionBox*XmPushButton.marginRight:5
-
-*FontSelectionBox*preview.background: white
-*FontSelectionBox*preview.height: 40
-
-*FontSelectionBox*panel.width: 397
-*FontSelectionBox*panel.height: 286
-
-*FontSelectionBox*panel.horizontalSpacing: 5
-*FontSelectionBox*panel.verticalSpacing: 2
-
-*FontSelectionBox*okButton.labelString: OK
-
-*FontSelectionBox*applyButton.labelString: Apply
-
-*FontSelectionBox*resetButton.labelString: Reset
-
-*FontSelectionBox*cancelButton.labelString: Cancel
-
-*FontSelectionBox*sizeLabel.labelString: Size:
-*FontSelectionBox*sizeLabel.leftOffset: 10
-*FontSelectionBox*sizeLabel.bottomOffset: 12
-
-*FontSelectionBox*sizeTextField.columns: 4
-*FontSelectionBox*sizeTextField.leftOffset: 2
-*FontSelectionBox*sizeTextField.bottomOffset: -7
-*FontSelectionBox*sizeTextField.value: 12
-*FontSelectionBox*sizeTextField.verifyBell: False
-
-*FontSelectionBox*other.labelString: ...
-
-*FontSelectionBox*sizeOptionMenu.labelString:
-*FontSelectionBox*sizeOptionMenu.bottomOffset: -9
-*FontSelectionBox*sizeOptionMenu.leftOffset: -5
-
-*FontSelectionBox*sizeMultipleLabel.labelString: Multiple
-*FontSelectionBox*sizeMultipleLabel.leftOffset: 0
-*FontSelectionBox*sizeMultipleLabel.bottomOffset: 10
-
-*FontSelectionBox*previewButton.labelString: Preview
-*FontSelectionBox*previewButton.bottomOffset: -11
-*FontSelectionBox*previewButton.rightOffset: 5
-
-*FontSelectionBox*samplerButton.labelString: Sampler...
-*FontSelectionBox*samplerButton.bottomOffset: 0
-*FontSelectionBox*samplerButton.rightOffset: 0
-
-*FontSelectionBox*familyLabel.labelString: Family
-*FontSelectionBox*familyLabel.rightOffset: 7
-*FontSelectionBox*familyLabel.leftOffset: 10
-
-*FontSelectionBox*faceLabel.labelString: Face
-*FontSelectionBox*faceLabel.rightOffset: 10
-*FontSelectionBox*faceLabel.leftOffset: 7
-
-*FontSelectionBox*familyMultipleLabel.labelString: MULTIPLE
-*FontSelectionBox*familyMultipleLabel.background: black
-*FontSelectionBox*familyMultipleLabel.foreground: #729FFF
-*FontSelectionBox*familyMultipleLabel.leftOffset: 10
-*FontSelectionBox*familyMultipleLabel.rightOffset: 7
-*FontSelectionBox*familyMultipleLabel.topOffset: 2
-
-*FontSelectionBox*faceMultipleLabel.labelString: MULTIPLE
-*FontSelectionBox*faceMultipleLabel.background: black
-*FontSelectionBox*faceMultipleLabel.foreground: #729FFF
-*FontSelectionBox*faceMultipleLabel.leftOffset: 7
-*FontSelectionBox*faceMultipleLabel.topOffset: 2
-*FontSelectionBox*faceMultipleLabel.rightOffset: 10
-
-*FontSelectionBox*familyScrolledListSW.leftOffset: 10
-*FontSelectionBox*familyScrolledListSW.topOffset: 2
-*FontSelectionBox*familyScrolledListSW.rightOffset: 7
-
-*FontSelectionBox*faceScrolledListSW.topOffset: 2
-*FontSelectionBox*faceScrolledListSW.leftOffset: 7
-*FontSelectionBox*faceScrolledListSW.rightOffset: 10
-
-*FontSelectionBox*XmList.listSizePolicy: constant
-*FontSelectionBox*XmList.scrollBarDisplayPolicy: as_needed
-
-*FontSelectionBox*multipleMasterButton.labelString: Multiple Master...
-
-*FontSelectionBox*invalidFontMessage.dialogTitle: Font Alert
-*FontSelectionBox*invalidFontMessage.messageString: The selected font contains\n\
-an error and is not usable.
-
-! Font sampler resources
-
-! Keep mwm from deleting this window; it confuses everyone
-*FontSelectionBox*samplerShell.deleteResponse: unmap
-
-*FontSelectionBox*samplerShell.width: 530
-*FontSelectionBox*samplerShell.height: 620
-*FontSelectionBox*samplerShell.title: Font Sampler
-
-*FontSelectionBox*sampler.minimumWidth: 1000
-*FontSelectionBox*sampler.minimumHeight: 400
-
-*FontSelectionBox*sampler*panel.horizontalSpacing: 5
-*FontSelectionBox*sampler*panel.verticalSpacing: 5
-
-*FontSelectionBox*sampler*area.width: 1000
-*FontSelectionBox*sampler*area.height: 476
-*FontSelectionBox*sampler*area.background: white
-*FontSelectionBox*sampler*ScrolledWindowClipWindow.background: white
-
-*FontSelectionBox*sampler*area.translations: #override\n\
- <ButtonPress> : FSBClickAction()
-
-*FontSelectionBox*sampler*text.value: Abc
-
-*FontSelectionBox*sampler*fontLabel.labelString: \040
-*FontSelectionBox*sampler*fontLabel.recomputeSize: FALSE
-
-*FontSelectionBox*sampler*displayButton.labelString: Display
-*FontSelectionBox*sampler*stopButton.labelString: Stop
-*FontSelectionBox*sampler*dismissButton.labelString: Dismiss
-*FontSelectionBox*sampler*clearButton.labelString: Reset Filters
-
-*FontSelectionBox*sampler*allToggle.labelString: All
-*FontSelectionBox*sampler*allToggle.set: true
-*FontSelectionBox*sampler*selectedToggle.labelString: Selected
-*FontSelectionBox*sampler*selectedFamilyToggle.labelString: Family
-*FontSelectionBox*sampler*filterToggle.labelString: Filter
-
-*FontSelectionBox*sampler*filterText.leftOffset: 0
-*FontSelectionBox*sampler*filterText.columns:10
-*FontSelectionBox*sampler*filterText.marginHeight: 5
-
-*FontSelectionBox*sampler*radioBox*marginHeight: 1
-*FontSelectionBox*sampler*radioBox.spacing: 0
-*FontSelectionBox*sampler*filterBox*XmToggleButtonGadget.marginHeight: 0
-*FontSelectionBox*sampler*filterBox.spacing: 0
-*FontSelectionBox*sampler*filterBox*packing: PACK_TIGHT
-
-*FontSelectionBox*sampler*filterBox*XmSeparatorGadget.height: 8
-
-*FontSelectionBox*sampler*radioBox.width: 129
-*FontSelectionBox*sampler*radioBox.resizeWidth: FALSE
-
-*FontSelectionBox*sampler*roman.labelString: Roman
-*FontSelectionBox*sampler*italic.labelString: Italic
-*FontSelectionBox*sampler*symbol.labelString: Symbol
-*FontSelectionBox*sampler*display.labelString: Display
-*FontSelectionBox*sampler*alternate.labelString: Alternate
-*FontSelectionBox*sampler*expert.labelString: Expert
-*FontSelectionBox*sampler*oldstyle.labelString: Oldstyle Figures
-*FontSelectionBox*sampler*smallcaps.labelString: Small Caps
-*FontSelectionBox*sampler*swash.labelString: Swash
-*FontSelectionBox*sampler*script.labelString: Script
-
-*FontSelectionBox*sampler*condensed.labelString: Condensed
-*FontSelectionBox*sampler*extended.labelString: Extended
-
-*FontSelectionBox*sampler*light.labelString: Light
-*FontSelectionBox*sampler*book.labelString: Book
-*FontSelectionBox*sampler*medium.labelString: Medium
-*FontSelectionBox*sampler*demi.labelString: Demi
-*FontSelectionBox*sampler*bold.labelString: Bold
-*FontSelectionBox*sampler*black.labelString: Black +
-
-*FontSelectionBox*sampler*sizeLabel.labelString: Size:
-*FontSelectionBox*sampler*sizeLabel.bottomOffset: 15
-*FontSelectionBox*sampler*sizeLabel.leftOffset: 0
-
-*FontSelectionBox*sampler*sizeTextField.columns: 4
-*FontSelectionBox*sampler*sizeTextField.leftOffset: 2
-*FontSelectionBox*sampler*sizeTextField.bottomOffset: -7
-*FontSelectionBox*sampler*sizeTextField.value: 24
-*FontSelectionBox*sampler*sizeTextField.verifyBell: False
-
-*FontSelectionBox*sampler*sizeOptionMenu.labelString:
-*FontSelectionBox*sampler*sizeOptionMenu.bottomOffset: -9
-*FontSelectionBox*sampler*sizeOptionMenu.leftOffset: -5
-
-*FontSelectionBox*creatorShell.title: Multiple Master Font Creator
-
-*FontSelectionBox*creatorShell*preview.height: 50
-*FontSelectionBox*creatorShell*preview.leftOffset: 4
-*FontSelectionBox*creatorShell*preview.rightOffset: 4
-*FontSelectionBox*creatorShell*preview.topOffset: 4
-
-*FontSelectionBox*creatorShell*panel.horizontalSpacing: 10
-*FontSelectionBox*creatorShell*panel.verticalSpacing: 5
-*FontSelectionBox*creatorShell*panel.width: 500
-*FontSelectionBox*creatorShell*panel.height: 325
-*FontSelectionBox*creatorShell*panel.marginHeight: 5
-*FontSelectionBox*creatorShell*panel.marginWidth: 5
-
-*FontSelectionBox*creatorShell*displayTextLabel.labelString: String
-*FontSelectionBox*creatorShell*displayTextLabel.rightPosition: 15
-*FontSelectionBox*creatorShell*displayTextLabel.rightOffset: 5
-*FontSelectionBox*creatorShell*displayTextLabel.topOffset: 5
-
-*FontSelectionBox*creatorShell*displayText.leftPosition: 15
-*FontSelectionBox*creatorShell*displayText.rightPosition: 60
-*FontSelectionBox*creatorShell*displayText.rightOffset: 10
-*FontSelectionBox*creatorShell*displayText.topOffset: 0
-
-*FontSelectionBox*creatorShell*axisLabel1.rightPosition: 15
-*FontSelectionBox*creatorShell*axisLabel1.bottomOffset: 0
-*FontSelectionBox*creatorShell*axisLabel1.rightOffset: 5
-*FontSelectionBox*creatorShell*axisLabel1.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisValue1.rightPosition: 60
-*FontSelectionBox*creatorShell*axisValue1.rightOffset: 10
-*FontSelectionBox*creatorShell*axisValue1.columns: 4
-
-*FontSelectionBox*creatorShell*axisScale1.rightOffset: 5
-*FontSelectionBox*creatorShell*axisScale1.leftPosition: 15
-*FontSelectionBox*creatorShell*axisScale1.topOffset: 5
-*FontSelectionBox*creatorShell*axisScale1.decimalPoints: 0
-*FontSelectionBox*creatorShell*axisScale1.orientation: horizontal
-*FontSelectionBox*creatorShell*axisScale1.showValue: false
-
-*FontSelectionBox*creatorShell*axisMin1.topOffset: 0
-*FontSelectionBox*creatorShell*axisMin1.leftOffset: 0
-
-*FontSelectionBox*creatorShell*axisMax1.topOffset: 0
-*FontSelectionBox*creatorShell*axisMax1.rightOffset: 0
-
-*FontSelectionBox*creatorShell*axisLabel2.rightPosition: 15
-*FontSelectionBox*creatorShell*axisLabel2.bottomOffset: 0
-*FontSelectionBox*creatorShell*axisLabel2.rightOffset: 5
-*FontSelectionBox*creatorShell*axisLabel2.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisValue2.rightPosition: 60
-*FontSelectionBox*creatorShell*axisValue2.rightOffset: 10
-*FontSelectionBox*creatorShell*axisValue2.topOffset: 15
-*FontSelectionBox*creatorShell*axisValue2.columns: 4
-
-*FontSelectionBox*creatorShell*axisScale2.rightOffset: 5
-*FontSelectionBox*creatorShell*axisScale2.leftPosition: 15
-*FontSelectionBox*creatorShell*axisScale2.decimalPoints: 0
-*FontSelectionBox*creatorShell*axisScale2.orientation: horizontal
-*FontSelectionBox*creatorShell*axisScale2.showValue: false
-*FontSelectionBox*creatorShell*axisScale2.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisMin2.topOffset: 0
-*FontSelectionBox*creatorShell*axisMin2.leftOffset: 0
-
-*FontSelectionBox*creatorShell*axisMax2.topOffset: 0
-*FontSelectionBox*creatorShell*axisMax2.rightOffset: 0
-
-*FontSelectionBox*creatorShell*axisLabel3.rightPosition: 15
-*FontSelectionBox*creatorShell*axisLabel3.bottomOffset: 0
-*FontSelectionBox*creatorShell*axisLabel3.rightOffset: 5
-*FontSelectionBox*creatorShell*axisLabel3.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisValue3.rightPosition: 60
-*FontSelectionBox*creatorShell*axisValue3.rightOffset: 10
-*FontSelectionBox*creatorShell*axisValue3.topOffset: 15
-*FontSelectionBox*creatorShell*axisValue3.columns: 4
-
-*FontSelectionBox*creatorShell*axisScale3.rightOffset: 5
-*FontSelectionBox*creatorShell*axisScale3.leftPosition: 15
-*FontSelectionBox*creatorShell*axisScale3.decimalPoints: 0
-*FontSelectionBox*creatorShell*axisScale3.orientation: horizontal
-*FontSelectionBox*creatorShell*axisScale3.showValue: false
-*FontSelectionBox*creatorShell*axisScale3.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisMin3.topOffset: 0
-*FontSelectionBox*creatorShell*axisMin3.leftOffset: 0
-
-*FontSelectionBox*creatorShell*axisMax3.topOffset: 0
-*FontSelectionBox*creatorShell*axisMax3.rightOffset: 0
-
-*FontSelectionBox*creatorShell*axisLabel4.rightPosition: 15
-*FontSelectionBox*creatorShell*axisLabel4.bottomOffset: 0
-*FontSelectionBox*creatorShell*axisLabel4.rightOffset: 5
-*FontSelectionBox*creatorShell*axisLabel4.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisValue4.rightPosition: 60
-*FontSelectionBox*creatorShell*axisValue4.rightOffset: 10
-*FontSelectionBox*creatorShell*axisValue4.topOffset: 15
-*FontSelectionBox*creatorShell*axisValue4.columns: 4
-
-*FontSelectionBox*creatorShell*axisScale4.rightOffset: 5
-*FontSelectionBox*creatorShell*axisScale4.leftPosition: 15
-*FontSelectionBox*creatorShell*axisScale4.decimalPoints: 0
-*FontSelectionBox*creatorShell*axisScale4.orientation: horizontal
-*FontSelectionBox*creatorShell*axisScale4.showValue: false
-*FontSelectionBox*creatorShell*axisScale4.topOffset: 5
-
-*FontSelectionBox*creatorShell*axisMin4.topOffset: 0
-*FontSelectionBox*creatorShell*axisMin4.leftOffset: 0
-
-*FontSelectionBox*creatorShell*axisMax4.topOffset: 0
-*FontSelectionBox*creatorShell*axisMax4.rightOffset: 0
-
-*FontSelectionBox*creatorShell*faceLabel.leftPosition: 60
-*FontSelectionBox*creatorShell*faceLabel.leftOffset: 10
-*FontSelectionBox*creatorShell*faceLabel.labelString: Faces
-*FontSelectionBox*creatorShell*faceLabel.topOffset: 0
-
-*FontSelectionBox*creatorShell*faceListSW.leftPosition: 60
-*FontSelectionBox*creatorShell*faceListSW.leftOffset: 10
-*FontSelectionBox*creatorShell*faceListSW.topOffset: 0
-*FontSelectionBox*creatorShell*faceListSW.bottomPosition: 30
-
-*FontSelectionBox*creatorShell*blendLabel.leftPosition: 60
-*FontSelectionBox*creatorShell*blendLabel.leftOffset: 10
-*FontSelectionBox*creatorShell*blendLabel.topPosition: 30
-*FontSelectionBox*creatorShell*blendLabel.topOffset: 8
-*FontSelectionBox*creatorShell*blendLabel.labelString: Blends
-
-*FontSelectionBox*creatorShell*blendListSW.leftPosition: 60
-*FontSelectionBox*creatorShell*blendListSW.leftOffset: 10
-*FontSelectionBox*creatorShell*blendListSW.topOffset: 0
-
-*FontSelectionBox*creatorShell*nameLabel.labelString: Name
-*FontSelectionBox*creatorShell*nameLabel.rightPosition: 60
-*FontSelectionBox*creatorShell*nameLabel.rightOffset:-5
-*FontSelectionBox*creatorShell*nameLabel.bottomOffset: 8
-
-*FontSelectionBox*creatorShell*nameText.leftPosition: 60
-*FontSelectionBox*creatorShell*nameText.leftOffset: 8
-*FontSelectionBox*creatorShell*nameText.rightOffset: 3
-
-*FontSelectionBox*creatorShell*deleteButton.labelString: Delete
-
-*FontSelectionBox*creatorShell*replaceButton.labelString: Replace
-
-*FontSelectionBox*creatorShell*addButton.labelString: Add
-
-*FontSelectionBox*creatorShell*generateButton.labelString: Generate Name
-*FontSelectionBox*creatorShell*generateButton.rightOffset: 20
-
-*FontSelectionBox*creatorShell*optionsButton.labelString: Options...
-
-*FontSelectionBox*creatorShell*dismissButton.labelString: Dismiss
-
-*FontSelectionBox*creatorShell*noNameMessage.messageString: You must enter a\n\
-name in the Name field.
-*FontSelectionBox*creatorShell*noNameMessage.dialogTitle: Font Alert
-
-*FontSelectionBox*creatorShell*usedNameMessage.messageString: That name is already in use;\n\
-pick another or use the Replace button\n\
-to change its definition.
-*FontSelectionBox*creatorShell*usedNameMessage.dialogTitle: Font Alert
-
-*FontSelectionBox*creatorShell*someUsedNameMessage.messageString: That name was already in use in\n\
-some faces; use the Replace button\n\
-to change the definition in all faces.
-*FontSelectionBox*creatorShell*someUsedNameMessage.dialogTitle: Font Alert
-
-*FontSelectionBox*creatorShell*noSuchNameMessage.messageString: That blend does not exist.
-*FontSelectionBox*creatorShell*noSuchNameMessage.dialogTitle: Font Alert
-
-*FontSelectionBox*creatorShell*sizeLabel.labelString: Size
-*FontSelectionBox*creatorShell*sizeLabel.rightPosition: 15
-*FontSelectionBox*creatorShell*sizeLabel.rightOffset: 5
-*FontSelectionBox*creatorShell*sizeLabel.bottomOffset: 12
-
-*FontSelectionBox*creatorShell*sizeTextField.columns: 4
-*FontSelectionBox*creatorShell*sizeTextField.leftPosition: 15
-*FontSelectionBox*creatorShell*sizeTextField.bottomOffset: -7
-*FontSelectionBox*creatorShell*sizeTextField.verifyBell: False
-*FontSelectionBox*sizeTextField.value: 36
-
-*FontSelectionBox*creatorShell*other.labelString: ...
-
-*FontSelectionBox*creatorShell*sizeOptionMenu.labelString:
-*FontSelectionBox*creatorShell*sizeOptionMenu.bottomOffset: -9
-*FontSelectionBox*creatorShell*sizeOptionMenu.leftOffset: -5
-
-*FontSelectionBox*creatorShell*optionBox_popup.title: Font Creator Options
-*FontSelectionBox*creatorShell*doAllToggle.labelString: Apply blend list changes to all faces
-*FontSelectionBox*creatorShell*followSizeToggle.labelString: Reflect font size in OpticalSize axis
-*FontSelectionBox*creatorShell*dismissOptionButton.labelString: Dismiss
-
diff --git a/xc/lib/dpstk/Imakefile b/xc/lib/dpstk/Imakefile
deleted file mode 100644
index 04d0d1727..000000000
--- a/xc/lib/dpstk/Imakefile
+++ /dev/null
@@ -1,85 +0,0 @@
-XCOMM $XFree86: xc/lib/dpstk/Imakefile,v 1.3 2000/02/15 01:07:59 dawes Exp $
-
-#define DoNormalLib NormalLibDpsTk
-#define DoSharedLib SharedLibDpsTk
-#define DoExtraLib SharedLibDpsTk
-#define DoDebugLib DebugLibDpsTk
-#define DoProfileLib ProfileLibDpsTk
-#define LibName dpstk
-#define SoRev SODPSTKREV
-#define LibHeaders NO
-
- PSWRAP = $(TOP)/config/pswrap/pswrap
-
-#if HasMotif
-MOTIFSRCS = FSBwraps.c FontSample.c FontSB.c FontCreato.c \
- CSBwraps.c ColorSB.c DSWwraps.c DPSScrollW.c
-MOTIFOBJS = FSBwraps.o FontSample.o FontSB.o FontCreato.o \
- CSBwraps.o ColorSB.o DSWwraps.o DPSScrollW.o
-#endif
-
-#ifndef DefaultResourcePath
-#define DefaultResourcePath NULL
-#endif
-RESPATH = DefaultResourcePath
-
-#if NoStrstr
- DEFINES = -DNO_STRSTR_AVAILABLE -DDEFAULT_RESOURCE_PATH=\"${RESPATH}\"
-#else
- DEFINES = -DDEFAULT_RESOURCE_PATH=\"${RESPATH}\"
-#endif
-
-
-DERIVED_FILES = FSBwraps.c FSBwraps.h XDPSpwraps.c XDPSpwraps.h \
- XDPSswraps.c XDPSswraps.h CSBwraps.c CSBwraps.h \
- DSWwraps.c DSWwraps.h
-
-SRCS = XDPSpwraps.c XDPSswraps.c XDPSshare.c XDPSpreview.c \
- XDPSuserpath.c
-
-OBJS = XDPSpwraps.o XDPSswraps.o XDPSshare.o XDPSpreview.o \
- XDPSuserpath.o
-
-#include <Library.tmpl>
-
-.SUFFIXES: .psw
-
-.psw.c :
- RunProgram(PSWRAP,-o $*.c -h $*.h $<)
-
-includes:: $(SRCS)
-
-#if HasMotif
-
-includes:: $(MOTIFSRCS)
-
-#if DoSharedLib
-SharedLibraryTarget(dpstkXm,$(SODPSREV),$(MOTIFOBJS),.,.)
-InstallSharedLibrary(dpstkXm,$(SODPSREV),$(USRLIBDIR))
-#endif
-#if DoNormalLib
-#if DoSharedLib
-UnsharedLibraryTarget(dpstkXm,$(MOTIFOBJS),unshared,..)
-#else
-NormalLibraryTarget(dpstkXm,$(MOTIFOBJS))
-#endif
-InstallLibrary(dpstkXm,$(USRLIBDIR))
-#endif
-#if DebugLibDps
-DebuggedLibraryTarget(dpstkXm,$(MOTIFOBJS))
-InstallLibrary(dpstkXm_d,$(USRLIBDIR))
-#endif
-#if ProfileLibDps
-ProfiledLibraryTarget(dpstkXm,$(MOTIFOBJS))
-InstallDpsProfiledLibrary(dpstkXm_p,$(USRLIBDIR))
-#endif
-
-InstallAppDefaults(FontSelect)
-InstallAppDefaults(ColorSelect)
-#endif
-
-clean ::
- ${RM} $(DERIVED_FILES) $(MOTIFOBJS)
-
-DependTarget()
-
diff --git a/xc/lib/dpstk/XDPSpreview.c b/xc/lib/dpstk/XDPSpreview.c
deleted file mode 100644
index fccda200b..000000000
--- a/xc/lib/dpstk/XDPSpreview.c
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * XDPSpreview.c
- *
- * (c) Copyright 1990-1994 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
- */
-
-#include <X11/Xlib.h>
-#include <DPS/dpsXclient.h>
-#include <DPS/XDPSlib.h>
-#include <DPS/psops.h>
-#include <stdio.h>
-#ifndef NeXT
-#include <unistd.h>
-#endif
-#include "DPS/dpsXshare.h"
-#include "DPS/dpsXpreview.h"
-#include "XDPSpwraps.h"
-#include "dpsXcommonI.h"
-#include <math.h>
-#include <X11/Xos.h>
-
-#if defined(hpux) || defined(AIXV3)
-#define SELECT_TYPE int *
-#else
-#define SELECT_TYPE fd_set *
-#endif
-
-#define BEGINDOCUMENTLEN 15 /* Length of "%%BeginDocument" */
-#define BEGINBINARYLEN 14 /* Length of "%%BeginBinary:" */
-
-static int ParseFileForBBox();
-static void FillPixmapWithGray();
-
-static XDPSRewindFunction rewindFunction = XDPSFileRewindFunc;
-static DPSPointer rewindClientData = NULL;
-static XDPSGetsFunction getsFunction = XDPSFileGetsFunc;
-static DPSPointer getsClientData = NULL;
-
-int XDPSSetFileFunctions(rewindFunc, rewindData, getsFunc, getsData)
- XDPSRewindFunction rewindFunc;
- DPSPointer rewindData;
- XDPSGetsFunction getsFunc;
- DPSPointer getsData;
-{
- if (rewindFunc != NULL) {
- rewindFunction = rewindFunc;
- rewindClientData = rewindData;
- }
- if (getsFunc != NULL) {
- getsFunction = getsFunc;
- getsClientData = getsData;
- }
-}
-
-/* ARGSUSED */
-
-void XDPSFileRewindFunc(f, data)
- FILE *f;
- DPSPointer data;
-{
- rewind(f);
-}
-
-/* ARGSUSED */
-
-char *XDPSFileGetsFunc(buf, n, f, data)
- char *buf;
- int n;
- FILE *f;
- DPSPointer data;
-{
- return fgets(buf, n, f);
-}
-
-void XDPSEmbeddedEPSFRewindFunc(f, data)
- FILE *f;
- DPSPointer data;
-{
- XDPSPosition *p = (XDPSPosition *) data;
-
- p->nestingLevel = 0;
- p->continuedLine = False;
- p->binaryCount = 0;
-
- if (fseek(f, p->startPos, SEEK_SET) != 0) {
- (void) fseek(f, 0L, SEEK_END); /* Go to the end */
- }
-}
-
-static Bool imaging = False;
-
-char *XDPSEmbeddedGetsFunc(buf, n, f, data)
- char *buf;
- int n;
- FILE *f;
- DPSPointer data;
-{
- XDPSPosition *p = (XDPSPosition *) data;
- int count, len;
-
- if (fgets(buf, n, f) == NULL) {
- if (imaging) p->startPos = -1;
- return NULL;
- }
-
- /* If previous call didn't get a whole line, we're somewhere in the
- middle, so don't check for comments. Also, if we're in the middle of
- binary data, don't look for comments either. */
-
- len = strlen(buf);
-
- if (p->binaryCount != 0) {
- if (len > p->binaryCount) p->binaryCount = 0;
- else p->binaryCount -= len;
-
- } else if (!p->continuedLine) {
- if (strncmp(buf, "%%BeginDocument", BEGINDOCUMENTLEN) == 0) {
- p->nestingLevel++;
-
- } else if (strncmp(buf, "%%BeginBinary:", BEGINBINARYLEN) == 0) {
- count = sscanf(buf, "%%%%BeginBinary: %lu", &p->binaryCount);
- if (count != 1) p->binaryCount = 0; /* Malformed comment */
-
- } else if (strcmp(buf, "%%EndDocument\n") == 0) {
- if (p->nestingLevel == 0) {
- if (imaging) p->startPos = ftell(f);
- return NULL;
- }
- else p->nestingLevel--;
- }
- }
-
- if (len == n-1 && buf[n-1] != '\n') p->continuedLine = True;
- else p->continuedLine = False;
-
- return buf;
-}
-
-int XDPSCreatePixmapForEPSF(context, screen, epsf, depth,
- pixelsPerPoint, pixmap, pixelSize, bbox)
- DPSContext context;
- Screen *screen;
- FILE *epsf;
- int depth;
- double pixelsPerPoint;
- Pixmap *pixmap;
- XRectangle *pixelSize;
- XRectangle *bbox;
-{
- Pixmap p;
- int width, height;
- XRectangle bb;
-
- if (screen == NULL || depth <= 0 ||
- pixelsPerPoint <= 0) {
- return dps_status_illegal_value;
- }
-
- if (context == NULL) {
- context = XDPSGetSharedContext(DisplayOfScreen(screen));
- }
-
- (*rewindFunction)(epsf, rewindClientData);
-
- if (ParseFileForBBox(epsf, &bb) == dps_status_failure) {
- return dps_status_failure;
- }
-
- width = ceil(bb.width * pixelsPerPoint);
- height = ceil(bb.height * pixelsPerPoint);
- if (width <= 0 || height <= 0) return dps_status_failure;
-
- p = XCreatePixmap(DisplayOfScreen(screen), RootWindowOfScreen(screen),
- width, height, depth);
-
- if (pixmap != NULL) *pixmap = p;
- if (pixelSize != NULL) {
- pixelSize->x = pixelSize->y = 0;
- pixelSize->width = width;
- pixelSize->height = height;
- }
- if (bbox != NULL) *bbox = bb;
-
- if (context != NULL) return dps_status_success;
- else return dps_status_no_extension;
-}
-
-static int ParseFileForBBox(file, bb)
- FILE *file;
- XRectangle *bb;
-{
-#define BBOXLEN 14 /* Length of "%%BoundingBox:" */
-#define BUFLEN 256
-#define ATENDLEN 8 /* Length of "(atend)" plus one byte for \0 */
- char buf[BUFLEN];
- char buf2[ATENDLEN];
- Bool atend = False; /* Found a %%BoundingBox: (atend) */
- float x, y, r, t;
- int n;
- int nestingLevel = 0;
- unsigned long binaryCount = 0;
- Bool continuedLine = False;
- int len;
-
- while (1) {
- if ((*getsFunction)(buf, BUFLEN, file, getsClientData) == NULL) {
- return dps_status_failure;
- }
-
- len = strlen(buf);
-
- /* If in binary data or continued line, ignore everything */
-
- if (binaryCount != 0) {
- if (len > binaryCount) binaryCount = 0;
- else binaryCount -= len;
-
- } else if (!continuedLine) {
- if (strncmp(buf, "%%BeginBinary:", BEGINBINARYLEN) == 0) {
- n = sscanf(buf, "%%%%BeginBinary: %lu", &binaryCount);
- if (n != 1) binaryCount = 0; /* Malformed comment */
-
- } else if (strncmp(buf, "%%BeginDocument", BEGINDOCUMENTLEN) == 0) {
- nestingLevel++;
-
- } else if (strcmp(buf, "%%EndDocument\n") == 0) {
- nestingLevel--;
-
- /* Only check for bounding box comments at nesting level 0 */
-
- } else if (nestingLevel == 0) {
-
- /* If we haven't already hit an (atend), the end of the
- comments is a good place to stop looking for the bbox */
-
- if (!atend && (strcmp(buf, "%%EndComments\n") == 0 ||
- strcmp(buf, "%%EndProlog\n") == 0)) {
- return dps_status_failure;
- }
-
- if (strncmp(buf, "%%BoundingBox:", BBOXLEN) == 0) {
- n = sscanf(buf, "%%%%BoundingBox: %f %f %f %f",
- &x, &y, &r, &t);
-
- if (n != 4) {
- n = sscanf(buf, "%%%%BoundingBox: %7s", buf2);
-
- if (n == 1 && strcmp(buf2, "(atend)") == 0) {
- atend = True;
- } else return dps_status_failure;
-
- } else {
- bb->x = (int) x;
- bb->y = (int) y;
- bb->width = r - bb->x;
- if ((float)((int) r) != r) bb->width++;
- bb->height = t - bb->y;
- if ((float)((int) t) != t) bb->height++;
- return dps_status_success;
- }
- }
- }
- }
-
- /* See if this line fills the buffer */
- if (len == BUFLEN-1 && buf[BUFLEN-1] != '\n') continuedLine = True;
- }
-
-#undef ATENDLEN
-#undef BUFLEN
-#undef BBOXLEN
-}
-
-#define mmPerPoint (25.4/72.0)
-
-double XDPSPixelsPerPoint(screen)
- Screen *screen;
-{
- return (float) WidthOfScreen(screen) * mmPerPoint /
- (float) WidthMMOfScreen(screen);
-}
-
-static int timeStart = 200, maxDoubles = 3;
-
-void XDPSSetImagingTimeout(timeout, max)
- int timeout;
- int max;
-{
- timeStart = timeout;
- maxDoubles = max;
-}
-
-typedef struct _StatusInfo {
- DPSContext ctxt;
- DPSPointer cookie;
- Bool *doneFlag;
- unsigned long startReqNum, endReqNum;
- XDPSStatusProc oldProc;
- struct _StatusInfo *next, *prev;
-} StatusInfo;
-
-static StatusInfo *StatusList;
-
-static void SetUpStatusVariables(context, cookie, doneFlag, startReq, oldProc)
- DPSContext context;
- DPSPointer cookie;
- Bool *doneFlag;
- unsigned long startReq;
- XDPSStatusProc oldProc;
-{
- StatusInfo *info = (StatusInfo *) malloc(sizeof(StatusInfo));
-
- info->ctxt = context;
- info->cookie = cookie;
- info->doneFlag = doneFlag;
- info->startReqNum = startReq;
- info->endReqNum = 0xFFFFFFFF;
- info->oldProc = oldProc;
- if (StatusList != NULL) StatusList->prev = info;
- info->next = StatusList;
- info->prev = NULL;
- StatusList = info;
-}
-
-static void SetEndReqNum(context, endReq)
- DPSContext context;
- unsigned long endReq;
-{
- StatusInfo *info = StatusList;
-
- while (info != NULL && info->ctxt != context) info = info->next;
- if (info != NULL) info->endReqNum = endReq;
-}
-
-static void HandlePreviewStatus(context, status)
- DPSContext context;
- int status;
-{
- unsigned long serial;
- Display *dpy;
- StatusInfo *info = StatusList;
-
- while (info != NULL && info->ctxt != context) info = info->next;
- if (info == NULL) return;
-
- (void) XDPSXIDFromContext(&dpy, context);
- serial = LastKnownRequestProcessed(dpy);
-
- /* This event is from before our imaging; send to old status proc. */
- if (serial < info->startReqNum) {
- (*info->oldProc) (context, status);
- return;
- }
-
- /* This event is from during our imaging; ignore it */
- if (serial < info->endReqNum) return;
-
- /* This event is juuuuust right. */
- if (status == PSFROZEN) *info->doneFlag = True;
-}
-
-static int FinishUp(context, cookie)
- DPSContext context;
- DPSPointer cookie;
-{
- static char restorebuf[] =
- "\n$Adobe$DPS$Lib$Dict /EPSFsave get restore grestore\n";
- StatusInfo *info = StatusList;
- int err;
-
- /* Check the results of the imaging: Get the error status and restore the
- context */
-
- _DPSPCheckForError(context, &err);
-
- /* Can't do this is a wrap because of restore semantics */
- DPSWritePostScript(context, restorebuf, strlen(restorebuf));
-
- (void) XDPSPopContextParameters(cookie);
-
- /* See if we have an info record and delete it if so */
- while (info != NULL && info->ctxt != context) info = info->next;
- if (info != NULL) {
- if (info == StatusList) StatusList = info->next;
- else info->prev->next = info->next;
- if (info->next != NULL) info->next->prev = info->prev;
- XDPSRegisterStatusProc(context, info->oldProc);
- free(info);
- }
-
- if (err) return dps_status_postscript_error;
- else return dps_status_success;
-}
-
-int XDPSCheckImagingResults(context, screen)
- DPSContext context;
- Screen *screen;
-{
- StatusInfo *info = StatusList;
- int status;
-
- if (context == NULL) {
- context = XDPSGetSharedContext(DisplayOfScreen(screen));
- if (context == NULL) return dps_status_no_extension;
- }
-
- while (info != NULL && info->ctxt != context) info = info->next;
- if (info == NULL) return dps_status_illegal_value;
-
- status = XDPSGetContextStatus(context);
- if (status != PSFROZEN) return dps_status_imaging_incomplete;
-
- XDPSUnfreezeContext(context);
- return FinishUp(context, info->cookie);
-}
-
-static void msleep(ms)
- int ms;
-{
- struct timeval incr;
-
- incr.tv_sec = ms / 1000;
- incr.tv_usec = (ms % 1000) * 1000;
- (void) select (0, (SELECT_TYPE) NULL, (SELECT_TYPE) NULL,
- (SELECT_TYPE) NULL, &incr);
-}
-
-int XDPSImageFileIntoDrawable(context, screen, dest, file,
- drawableHeight, drawableDepth,
- bbox, xOffset, yOffset,
- pixelsPerPoint,
- clear, createMask, waitForCompletion, doneFlag)
- DPSContext context;
- Screen *screen;
- Drawable dest;
- FILE *file;
- int drawableHeight;
- int drawableDepth;
- XRectangle *bbox;
- int xOffset, yOffset;
- double pixelsPerPoint;
- Bool clear, createMask;
- Bool waitForCompletion;
- Bool *doneFlag;
-{
-#define BUFSIZE 256
-#define EXECLEN 6
- char buf[BUFSIZE];
- static char eobuf[] = "\n$Adobe$DPS$Lib$Dict /execSuccess true put\n\
-stop\n\
-Magic end of data line )))))))))) 99#2 2#99 <xyz> // 7gsad,32h4ghNmndFgj2\n";
- XDPSStandardColormap maskMap;
- XDPSStandardColormap rgbMap;
- unsigned int flags = 0;
- int status;
- Bool inited;
- DPSPointer cookie;
- int doublings;
- int ms;
- XDPSStatusProc oldProc;
- unsigned long startReqNum, endReqNum;
-
- if (screen == NULL || dest == None ||
- drawableHeight <= 0 || drawableDepth <= 0 ||
- pixelsPerPoint <= 0) {
- return dps_status_illegal_value;
- }
-
- if (context == NULL) {
- context = XDPSGetSharedContext(DisplayOfScreen(screen));
- if (context == NULL) {
- FillPixmapWithGray(screen, dest, bbox, xOffset, yOffset,
- pixelsPerPoint,
- createMask);
- return dps_status_no_extension;
- }
- }
-
- (*rewindFunction)(file, rewindClientData);
-
- if (!waitForCompletion) {
- DPSWaitContext(context);
- /* Any status events before this point go to old handler */
- startReqNum = NextRequest(DisplayOfScreen(screen));
- }
-
- status = _XDPSTestComponentInitialized(context,
- dps_init_bit_preview, &inited);
- if (status != dps_status_success) return status;
- if (!inited) {
- (void) _XDPSSetComponentInitialized(context, dps_init_bit_preview);
- _DPSPDefineExecFunction(context);
- }
-
- if (createMask) {
- if (drawableDepth != 1) return dps_status_illegal_value;
- maskMap.colormap = None;
- maskMap.red_max = 1;
- maskMap.red_mult = -1;
- maskMap.base_pixel = 1;
- rgbMap.colormap = None;
- rgbMap.red_max = rgbMap.green_max = rgbMap.blue_max =
- rgbMap.red_mult = rgbMap.green_mult = rgbMap.blue_mult =
- rgbMap.base_pixel = 0;
- flags = XDPSContextGrayMap | XDPSContextRGBMap;
- }
-
- status = XDPSPushContextParameters(context, screen, drawableDepth,
- dest, drawableHeight,
- &rgbMap, &maskMap,
- flags | XDPSContextScreenDepth |
- XDPSContextDrawable, &cookie);
-
- if (status != dps_status_success) return status;
-
- _DPSPSetMatrix(context, xOffset, yOffset, pixelsPerPoint);
-
- if (clear) _DPSPClearArea(context, (int) bbox->x, (int) bbox->y,
- (int) bbox->width, (int) bbox->height);
-
- if (createMask) _DPSPSetMaskTransfer(context);
-
- /* Prepare to read PostScript code */
- _DPSPSaveBeforeExec(context, !waitForCompletion);
- DPSWritePostScript(context, "\nexec\n", EXECLEN);
-
- imaging = True;
- while ((*getsFunction)(buf, BUFSIZE, file, getsClientData) != NULL) {
- DPSWritePostScript(context, buf, strlen(buf));
- }
- imaging = False;
-
- /* This marks the end of the data stream */
- DPSWritePostScript(context, eobuf, strlen(eobuf));
-
- if (!waitForCompletion) {
- *doneFlag = False;
- oldProc = XDPSRegisterStatusProc(context, HandlePreviewStatus);
- SetUpStatusVariables(context, cookie, doneFlag, startReqNum, oldProc);
- XDPSSetStatusMask(context, 0, 0, PSFROZENMASK);
-
- ms = timeStart;
-
- /* Check for done until we run out of time */
- doublings = 0;
- while (1) {
- if (XDPSGetContextStatus(context) == PSFROZEN) {
- waitForCompletion = True;
- XDPSUnfreezeContext(context);
- break;
- }
- if (doublings >= maxDoubles) break;
-
- /* Wait a while */
- msleep(ms);
- ms *= 2;
- doublings++;
- }
- }
-
- /* If previous decided imaging is done, it changed waitForCompletion */
-
- if (waitForCompletion) return FinishUp(context, cookie);
- else {
- endReqNum = NextRequest(DisplayOfScreen(screen)) - 1;
- SetEndReqNum(context, endReqNum);
- return dps_status_imaging_incomplete;
- }
-#undef EXECLEN
-#undef BUFSIZE
-}
-
-static void FillPixmapWithGray(screen, dest, bbox, xOffset, yOffset,
- pixelsPerPoint,
- createMask)
- Screen *screen;
- Drawable dest;
- XRectangle *bbox;
- int xOffset, yOffset;
- double pixelsPerPoint;
- Bool createMask;
-{
- int width, height, x, y;
- GC gc;
- XGCValues v;
- static char grayBits[] = {0x01, 0x02};
- Pixmap grayStipple;
- Display *dpy = DisplayOfScreen(screen);
-
- width = ceil(bbox->width * pixelsPerPoint);
- height = ceil(bbox->height * pixelsPerPoint);
- x = (bbox->x + xOffset) * pixelsPerPoint;
- y = (bbox->y + yOffset) * pixelsPerPoint;
-
- if (createMask) {
- v.foreground = 1;
- v.function = GXcopy;
-
- gc = XCreateGC(dpy, dest, GCForeground | GCFunction, &v);
- XFillRectangle(dpy, dest, gc, x, y, width, height);
- XFreeGC(dpy, gc);
- return;
- }
-
- grayStipple = XCreateBitmapFromData(dpy, dest, grayBits, 2, 2);
-
- v.foreground = BlackPixelOfScreen(screen);
- v.background = WhitePixelOfScreen(screen);
- v.function = GXcopy;
- v.stipple = grayStipple;
- v.fill_style = FillOpaqueStippled;
- gc = XCreateGC(dpy, dest, GCForeground | GCBackground | GCFunction |
- GCStipple | GCFillStyle, &v);
- XFillRectangle(dpy, dest, gc, x, y, width, height);
- XFreeGC(dpy, gc);
- XFreePixmap(dpy, grayStipple);
-}
diff --git a/xc/lib/dpstk/XDPSpwraps.psw b/xc/lib/dpstk/XDPSpwraps.psw
deleted file mode 100644
index b5ff4c4bd..000000000
--- a/xc/lib/dpstk/XDPSpwraps.psw
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * XDPSpwraps.psw
- *
- * (c) Copyright 1990-1994 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
- */
-
-defineps _DPSPSetMatrix(DPSContext ctxt; int xOffset, yOffset;
- double pixelsPerPoint)
- gsave
- initmatrix
- 1 1 idtransform abs exch abs exch scale
- % matrix is identity modulo sign
- pixelsPerPoint dup scale
- xOffset yOffset translate
-endps
-
-defineps _DPSPClearArea(DPSContext ctxt; int x, y, width, height)
- 1 setgray
- x y width height rectfill
-endps
-
-defineps _DPSPSetMaskTransfer(DPSContext ctxt)
- {pop 0} dup dup dup setcolortransfer
- {pop 0} settransfer
-endps
-
-defineps _DPSPDefineExecFunction(DPSContext ctxt)
- $Adobe$DPS$Lib$Dict begin
- /ExecPS {
- $Adobe$DPS$Lib$Dict /doclientsync 3 -1 roll put
- $Adobe$DPS$Lib$Dict /execSuccess false put
- (%stdin) (r) file
- cvx stopped
- pop % always true
- % Flush until you get the magic line
- {
- {currentfile 256 string readline} stopped
- pop % don't care stopped result
- pop % don't care readline bool result
-(Magic end of data line \)\)\)\)\)\)\)\)\)\) 99#2 2#99 <xyz> // 7gsad,32h4ghNmndFgj2)
- eq
- {exit} if
- } loop
- $Adobe$DPS$Lib$Dict /doclientsync get {
- clientsync
- } if
- } def end
-endps
-
-defineps _DPSPSaveBeforeExec(DPSContext ctxt; boolean noWait)
- $Adobe$DPS$Lib$Dict /EPSFsave save put
- clear cleardictstack
- /showpage {} def
- 0 setgray 0 setlinecap
- 1 setlinewidth 0 setlinejoin
- 10 setmiterlimit [] 0 setdash newpath
- noWait
- $Adobe$DPS$Lib$Dict /ExecPS get
-endps
-
-defineps _DPSPCheckForError(DPSContext ctxt | boolean *err)
- $Adobe$DPS$Lib$Dict /execSuccess get not err
- clear
- cleardictstack
-endps
diff --git a/xc/lib/dpstk/XDPSshare.c b/xc/lib/dpstk/XDPSshare.c
deleted file mode 100644
index a6b1fd2a8..000000000
--- a/xc/lib/dpstk/XDPSshare.c
+++ /dev/null
@@ -1,760 +0,0 @@
-/*
- * XDPSshare.c
- *
- * (c) Copyright 1990-1994 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
- */
-
-#include <X11/Xlib.h>
-#include <DPS/dpsXclient.h>
-#include <DPS/dpsops.h>
-#include <DPS/XDPSlib.h>
-#include "DPS/dpsXshare.h"
-#include "XDPSswraps.h"
-#include "dpsXcommonI.h"
-#include <stdio.h>
-
-static int extensionId = 0;
-
-/*
- Alloc...Info allocates an info entry and stores it at the head of the list.
- Find...Info looks for an info entry and returns NULL if not found.
- Lookup...Info looks for an info entry and creates one if not found.
-*/
-
-void _DPSSSetContextParameters(), _DPSSSetContextDrawable(),
- _DPSSInstallDPSlibDict();
-
-typedef struct _ContextInfoRec {
- int extensionId;
- DPSContextExtensionRec next;
- DPSContext text;
- Bool enableText;
- unsigned long initFlags;
- struct _DisplayInfoRec *displayInfo;
-} ContextInfoRec, *ContextInfo;
-
-typedef enum {ext_yes, ext_no, ext_no_idea} ExtensionStatus;
-
-typedef struct _DisplayInfoRec {
- Display *display;
- ExtensionStatus extensionPresent;
- DPSContext defaultContext;
- int *depthsForScreen;
- int **validDepths;
- GC **gcForDepth;
- struct _DisplayInfoRec *next;
-} DisplayInfoRec, *DisplayInfo;
-
-/* If a display is in displayList, it means that we have looked to see if
- the extension exists on the display. If context is not NULL, the
- display has a default context associated with it. */
-
-static DisplayInfo displayList = NULL;
-
-static DisplayInfo FindDisplayInfo(), LookupDisplayInfo();
-
-static ContextInfo AllocContextInfo(context)
- DPSContext context;
-{
- ContextInfo c = (ContextInfo) calloc(1, sizeof(ContextInfoRec));
-
- if (extensionId == 0) extensionId = DPSGenerateExtensionRecID();
-
- c->extensionId = extensionId;
- DPSAddContextExtensionRec(context, (DPSContextExtensionRec *) c);
-
- return c;
-}
-
-static ContextInfo FindContextInfo(context)
- DPSContext context;
-{
- if (extensionId == 0) extensionId = DPSGenerateExtensionRecID();
-
- return (ContextInfo) DPSGetContextExtensionRec(context, extensionId);
-}
-
-static ContextInfo RemoveContextInfo(context)
- DPSContext context;
-{
- return (ContextInfo) DPSRemoveContextExtensionRec(context,
- extensionId);
-}
-
-/* May only be called for a display in the display list. */
-
-static ContextInfo LookupContext(display, context)
- Display *display;
- DPSContext context;
-{
- ContextInfo c = FindContextInfo(context);
-
- if (c != NULL) return c;
-
- /* Create one */
-
- c = AllocContextInfo(context);
- c->displayInfo = LookupDisplayInfo(display);
- return c;
-}
-
-static DisplayInfo AllocDisplayInfo(display, context)
- Display *display;
- DPSContext context;
-{
- DisplayInfo d = (DisplayInfo) malloc(sizeof(DisplayInfoRec));
- register int i;
-
- if (d == NULL) return NULL;
- d->next = displayList;
- displayList = d;
-
- d->display = display;
- d->defaultContext = context;
- d->extensionPresent = (context == NULL) ? ext_no_idea : ext_yes;
-
- d->depthsForScreen = (int *) calloc(ScreenCount(display), sizeof(int));
- d->validDepths = (int **) calloc(ScreenCount(display), sizeof(int *));
- d->gcForDepth = (GC **) calloc(ScreenCount(display), sizeof(GC *));
-
- for (i = 0; i < ScreenCount(display); i++) {
- d->validDepths[i] = XListDepths(display, i, &d->depthsForScreen[i]);
- d->gcForDepth[i] = (GC *) calloc(d->depthsForScreen[i], sizeof(GC));
- }
-
- return d;
-}
-
-static DisplayInfo FindDisplayInfo(display)
- Display *display;
-{
- DisplayInfo d = displayList;
-
- while (d != NULL && d->display != display) d = d->next;
- return d;
-}
-
-static DisplayInfo LookupDisplayInfo(display)
- Display *display;
-{
- DisplayInfo d = FindDisplayInfo(display);
-
- if (d == NULL) d = AllocDisplayInfo(display, (DPSContext) NULL);
-
- return d;
-}
-
-int _XDPSSetComponentInitialized(context, bit)
- DPSContext context;
- unsigned long bit;
-{
- ContextInfo c = FindContextInfo(context);
-
- if (c == NULL) return dps_status_unregistered_context;
- c->initFlags |= bit;
- return dps_status_success;
-}
-
-int _XDPSTestComponentInitialized(context, bit, result)
- DPSContext context;
- unsigned long bit;
- Bool *result;
-{
- ContextInfo c = FindContextInfo(context);
-
- if (c == NULL) {
- *result = False;
- return dps_status_unregistered_context;
- }
- *result = ((c->initFlags & bit) != 0);
- return dps_status_success;
-}
-
-int XDPSSetContextDepth(context, screen, depth)
- DPSContext context;
- Screen *screen;
- int depth;
-{
- return XDPSSetContextParameters(context, screen, depth, None, 0,
- (XDPSStandardColormap *) NULL,
- (XDPSStandardColormap *) NULL,
- XDPSContextScreenDepth);
-}
-
-int XDPSSetContextDrawable(context, drawable, height)
- DPSContext context;
- Drawable drawable;
- int height;
-{
- if (drawable != None && height <= 0) return dps_status_illegal_value;
- _DPSSSetContextDrawable(context, drawable, height);
- return dps_status_success;
-}
-
-int XDPSSetContextRGBMap(context, map)
- DPSContext context;
- XDPSStandardColormap *map;
-{
- return XDPSSetContextParameters(context, (Screen *) NULL, 0, None, 0,
- map, (XDPSStandardColormap *) NULL,
- XDPSContextRGBMap);
-}
-
-int XDPSSetContextGrayMap(context, map)
- DPSContext context;
- XDPSStandardColormap *map;
-{
- return XDPSSetContextParameters(context, (Screen *) NULL, 0, None, 0,
- map, (XDPSStandardColormap *) NULL,
- XDPSContextGrayMap);
-}
-
-static GC DisplayInfoSharedGC(d, screen, depth)
- DisplayInfo d;
- Screen *screen;
- int depth;
-{
- int s = XScreenNumberOfScreen(screen);
- register int i;
- XGCValues v;
- Pixmap p;
-
- if (s >= ScreenCount(DisplayOfScreen(screen))) return NULL;
-
- for (i = 0; i < d->depthsForScreen[s] &&
- d->validDepths[s][i] != depth; i++) {}
-
- if (i >= d->depthsForScreen[s]) return NULL;
-
- if (d->gcForDepth[s][i] == 0) { /* Not "None" -- used calloc */
- if (depth == DefaultDepthOfScreen(screen)) {
- d->gcForDepth[s][i] = XCreateGC(d->display,
- RootWindowOfScreen(screen), 0, &v);
- } else {
- p = XCreatePixmap(d->display,
- RootWindowOfScreen(screen),
- 1, 1, depth);
- d->gcForDepth[s][i] = XCreateGC(d->display, p, 0, &v);
- XFreePixmap(d->display, p);
- }
- }
-
- return d->gcForDepth[s][i];
-}
-
-int XDPSSetContextParameters(context, screen, depth, drawable, height,
- rgbMap, grayMap, flags)
- DPSContext context;
- Screen *screen;
- int depth;
- Drawable drawable;
- int height;
- XDPSStandardColormap *rgbMap;
- XDPSStandardColormap *grayMap;
- unsigned int flags;
-{
- ContextInfo c = FindContextInfo(context);
- Bool doDepth = False, doDrawable = False, doRGB = False, doGray = False;
- Colormap map = None;
- XStandardColormap cmap;
- GC gc;
- GContext gctx = None;
- DisplayInfo d;
- Display *dpy;
- int rgb_base_pixel, red_max, red_mult, green_max, green_mult,
- blue_max, blue_mult, gray_base_pixel, gray_max, gray_mult;
-
- if (c == NULL) return dps_status_unregistered_context;
- d = c->displayInfo;
-
- (void) XDPSXIDFromContext(&dpy, context);
-
- if (flags & XDPSContextScreenDepth) {
- doDepth = True;
-
- if (DisplayOfScreen(screen) != dpy) {
- return dps_status_illegal_value;
- }
-
- gc = DisplayInfoSharedGC(d, screen, depth);
- if (gc == NULL) return dps_status_illegal_value;
-
- gctx = XGContextFromGC(gc);
- }
-
- if (flags & XDPSContextDrawable) {
- doDrawable = True;
- if (drawable != None && height <= 0) return dps_status_illegal_value;
- }
-
- if (flags & XDPSContextRGBMap) {
- doRGB = True;
- if (rgbMap == NULL) {
- XDPSGetDefaultColorMaps(dpy, screen, drawable, &cmap,
- (XStandardColormap *) NULL);
- rgb_base_pixel = cmap.base_pixel;
- red_max = cmap.red_max;
- red_mult = cmap.red_mult;
- green_max = cmap.green_max;
- green_mult = cmap.green_mult;
- blue_max = cmap.blue_max;
- blue_mult = cmap.blue_mult;
- map = cmap.colormap;
- } else {
- rgb_base_pixel = rgbMap->base_pixel;
- red_max = rgbMap->red_max;
- red_mult = rgbMap->red_mult;
- green_max = rgbMap->green_max;
- green_mult = rgbMap->green_mult;
- blue_max = rgbMap->blue_max;
- blue_mult = rgbMap->blue_mult;
- map = rgbMap->colormap;
- }
- }
-
- if (flags & XDPSContextGrayMap) {
- doGray = True;
- if (grayMap == NULL) {
- XDPSGetDefaultColorMaps(dpy, screen, drawable,
- (XStandardColormap *) NULL, &cmap);
- gray_base_pixel = cmap.base_pixel;
- gray_max = cmap.red_max;
- gray_mult = cmap.red_mult;
- if (doRGB && map != cmap.colormap) {
- return dps_status_illegal_value;
- } else map = cmap.colormap;
- } else {
- gray_base_pixel = grayMap->base_pixel;
- gray_max = grayMap->red_max;
- gray_mult = grayMap->red_mult;
- if (doRGB && map != grayMap->colormap) {
- return dps_status_illegal_value;
- } else map = grayMap->colormap;
- }
- }
-
- if (doDepth || doDrawable || doRGB || doGray) {
- _DPSSSetContextParameters(context, gctx, drawable, height, map,
- rgb_base_pixel, red_max, red_mult,
- green_max, green_mult, blue_max, blue_mult,
- gray_base_pixel, gray_max, gray_mult,
- doDepth, doDrawable, doRGB, doGray);
- }
- return dps_status_success;
-}
-
-int XDPSPushContextParameters(context, screen, depth, drawable, height,
- rgbMap, grayMap, flags, pushCookieReturn)
- DPSContext context;
- Screen *screen;
- int depth;
- Drawable drawable;
- int height;
- XDPSStandardColormap *rgbMap;
- XDPSStandardColormap *grayMap;
- unsigned int flags;
- DPSPointer *pushCookieReturn;
-{
- ContextInfo c = FindContextInfo(context);
- int status;
-
- if (c == NULL) return dps_status_unregistered_context;
-
- DPSgsave(context);
-
- status = XDPSSetContextParameters(context, screen, depth, drawable, height,
- rgbMap, grayMap, flags);
-
- *pushCookieReturn = (DPSPointer) context;
- return status;
-}
-
-int XDPSPopContextParameters(pushCookie)
- DPSPointer pushCookie;
-{
- DPSContext context = (DPSContext) pushCookie;
- ContextInfo c = FindContextInfo(context);
-
- if (c == NULL) return dps_status_illegal_value;
-
- DPSgrestore(context);
-
- return dps_status_success;
-}
-
-int XDPSCaptureContextGState(context, gsReturn)
- DPSContext context;
- DPSGState *gsReturn;
-{
- *gsReturn = DPSNewUserObjectIndex();
- /* We want to keep 0 as an unassigned value */
- if (*gsReturn == 0) *gsReturn = DPSNewUserObjectIndex();
-
- _DPSSCaptureGState(context, *gsReturn);
-
- return dps_status_success;
-}
-
-int XDPSUpdateContextGState(context, gs)
- DPSContext context;
- DPSGState gs;
-{
- _DPSSUpdateGState(context, gs);
-
- return dps_status_success;
-}
-
-int XDPSFreeContextGState(context, gs)
- DPSContext context;
- DPSGState gs;
-{
- _DPSSUndefineUserObject(context, gs);
-
- return dps_status_success;
-}
-
-int XDPSSetContextGState(context, gs)
- DPSContext context;
- DPSGState gs;
-{
- _DPSSRestoreGState(context, gs);
-
- return dps_status_success;
-}
-
-int XDPSPushContextGState(context, gs, pushCookieReturn)
- DPSContext context;
- DPSGState gs;
- DPSPointer *pushCookieReturn;
-{
- int status;
-
- DPSgsave(context);
-
- status = XDPSSetContextGState(context, gs);
- *pushCookieReturn = (DPSPointer) context;
- return status;
-}
-
-int XDPSPopContextGState(pushCookie)
- DPSPointer pushCookie;
-{
- DPSContext context = (DPSContext) pushCookie;
-
- DPSgrestore(context);
- return dps_status_success;
-}
-
-void XDPSRegisterContext(context, makeSharedContext)
- DPSContext context;
- Bool makeSharedContext;
-{
- Display *display;
- Bool inited;
- ContextInfo c;
-
- /* Get the display */
- (void) XDPSXIDFromContext(&display, context);
-
- if (makeSharedContext) { /* Install as shared ctxt for this display */
- c = LookupContext(display, context);
- c->displayInfo->defaultContext = context;
- } else { /* Just add to the context list */
- c = LookupContext(display, context);
- }
-
- c->displayInfo->extensionPresent = ext_yes;
-
- (void) _XDPSTestComponentInitialized(context, dps_init_bit_share, &inited);
- if (!inited) {
- (void) _XDPSSetComponentInitialized(context, dps_init_bit_share);
- _DPSSInstallDPSlibDict(context);
- }
-}
-
-DPSContext XDPSGetSharedContext(display)
- Display *display;
-{
- DisplayInfo d = LookupDisplayInfo(display);
- ContextInfo c;
- DPSContext context;
-
- if (d->extensionPresent == ext_no) return NULL;
-
- if (d->defaultContext != NULL) context = d->defaultContext;
- else {
- context = XDPSCreateSimpleContext(display,
- None, None, 0, 0,
- DPSDefaultTextBackstop,
- DPSDefaultErrorProc, NULL);
- if (context != NULL) {
- c = AllocContextInfo(context);
- d->defaultContext = context;
- c->displayInfo = d;
- (void) _XDPSSetComponentInitialized(context, dps_init_bit_share);
- _DPSSInstallDPSlibDict(context);
- (void) XDPSSetContextDepth(context,
- DefaultScreenOfDisplay(display),
- DefaultDepth(display,
- DefaultScreen(display)));
- }
- }
-
- if (context == NULL) d->extensionPresent = ext_no;
- else d->extensionPresent = ext_yes;
-
- return context;
-}
-
-void XDPSDestroySharedContext(context)
- DPSContext context;
-{
- ContextInfo c = RemoveContextInfo(context);
-
- if (c == NULL) return;
-
- if (c->displayInfo->defaultContext == context) {
- c->displayInfo->defaultContext = NULL;
- }
- DPSDestroySpace(DPSSpaceFromContext(context)); /* Also gets context */
- if (c->text != NULL) DPSDestroySpace(DPSSpaceFromContext(c->text));
- free((char *) c);
-}
-
-void XDPSUnregisterContext(context)
- DPSContext context;
-{
- ContextInfo c = RemoveContextInfo(context);
-
- if (c == NULL) return;
-
- if (c->displayInfo->defaultContext == context) {
- c->displayInfo->defaultContext = NULL;
- }
- if (c->text != NULL) DPSDestroySpace(DPSSpaceFromContext(c->text));
- free((char *) c);
-}
-
-void XDPSFreeDisplayInfo(display)
- Display *display;
-{
- DisplayInfo *dp = &displayList;
- DisplayInfo d;
- register int i, j;
-
- while (*dp != NULL && (*dp)->display != display) dp = &((*dp)->next);
-
- if (*dp == NULL) return;
-
- d = *dp;
- *dp = d->next; /* remove from list */
-
- for (i = 0; i < ScreenCount(display); i++) {
-#ifdef NO_XLISTDEPTHS
- free((char *) d->validDepths[i]);
-#else
- XFree((char *) d->validDepths[i]);
-#endif
- for (j = 0; j < d->depthsForScreen[i]; j++) {
- if (d->gcForDepth[i][j] != 0) {
- XFreeGC(display, d->gcForDepth[i][j]);
- }
- }
- free((char *) d->depthsForScreen[i]);
- }
-
- free((char *) d->depthsForScreen);
- free((char *) d->validDepths);
- free((char *) d->gcForDepth);
- free((char *) d);
-}
-
-int XDPSChainTextContext(context, enable)
- DPSContext context;
- Bool enable;
-{
- ContextInfo c = FindContextInfo(context);
-
- if (c == NULL) return dps_status_unregistered_context;
-
- /* Check if already in desired state */
-
- if (c->enableText == enable) return dps_status_success;
-
- if (enable) {
- if (c->text == NULL) {
- c->text = DPSCreateTextContext(DPSDefaultTextBackstop,
- DPSDefaultErrorProc);
- if (c->text == NULL) return dps_status_no_extension;
- }
- DPSChainContext(context, c->text);
- c->enableText = True;
- return dps_status_success;
- }
-
- /* disabling, currently enabled */
-
- DPSUnchainContext(c->text);
- c->enableText = False;
- return dps_status_success;
-}
-
-Bool XDPSExtensionPresent(display)
- Display *display;
-{
- DisplayInfo d = LookupDisplayInfo(display);
-
- if (d->extensionPresent != ext_no_idea) {
- return (d->extensionPresent == ext_yes);
- }
-
- /* Check if the extension is present by trying to initialize it */
-
- if (XDPSLInit(display, (int *) NULL, (char **) NULL) == -1) {
- d->extensionPresent = ext_no;
- } else d->extensionPresent = ext_yes;
-
- return (d->extensionPresent == ext_yes);
-}
-
-int PSDefineAsUserObj()
-{
- return DPSDefineAsUserObj(DPSGetCurrentContext());
-}
-
-void PSRedefineUserObj(uo)
- int uo;
-{
- DPSRedefineUserObj(DPSGetCurrentContext(), uo);
-}
-
-void PSUndefineUserObj(uo)
- int uo;
-{
- DPSUndefineUserObj(DPSGetCurrentContext(), uo);
-}
-
-int DPSDefineAsUserObj(ctxt)
- DPSContext ctxt;
-{
- int out = DPSNewUserObjectIndex();
- /* We want to keep 0 as an unassigned value */
- if (out == 0) out = DPSNewUserObjectIndex();
-
- _DPSSDefineUserObject(ctxt, out);
- return out;
-}
-
-void DPSRedefineUserObj(ctxt, uo)
- DPSContext ctxt;
- int uo;
-{
- _DPSSDefineUserObject(ctxt, uo);
-}
-
-void DPSUndefineUserObj(ctxt, uo)
- DPSContext ctxt;
- int uo;
-{
- _DPSSUndefineUserObject(ctxt, uo);
-}
-
-int PSReserveUserObjIndices(number)
- int number;
-{
- return DPSReserveUserObjIndices(DPSGetCurrentContext(), number);
-}
-
-int DPSReserveUserObjIndices(ctxt, number)
- DPSContext ctxt;
- int number;
-{
- int out = DPSNewUserObjectIndex();
-
- /* We want to keep 0 as an unassigned value */
- if (out == 0) out = DPSNewUserObjectIndex();
-
- number--;
- while (number-- > 0) (void) DPSNewUserObjectIndex();
- return out;
-}
-
-void PSReturnUserObjIndices(start, number)
- int start, number;
-{
- DPSReturnUserObjIndices(DPSGetCurrentContext(), start, number);
-}
-
-void DPSReturnUserObjIndices(ctxt, start, number)
- DPSContext ctxt;
- int start, number;
-{
- /* Nothing left any more */
-}
-
-#ifdef NO_XLISTDEPTHS
-/* This function copyright 1989 Massachusetts Institute of Technology */
-
-/*
- * XListDepths - return info from connection setup
- */
-int *XListDepths (dpy, scrnum, countp)
- Display *dpy;
- int scrnum;
- int *countp;
-{
- Screen *scr;
- int count;
- int *depths;
-
- if (scrnum < 0 || scrnum >= dpy->nscreens) return NULL;
-
- scr = &dpy->screens[scrnum];
- if ((count = scr->ndepths) > 0) {
- register Depth *dp;
- register int i;
-
- depths = (int *) malloc (count * sizeof(int));
- if (!depths) return NULL;
- for (i = 0, dp = scr->depths; i < count; i++, dp++)
- depths[i] = dp->depth;
- } else {
- /* a screen must have a depth */
- return NULL;
- }
- *countp = count;
- return depths;
-}
-#endif /* NO_XLISTDEPTHS */
diff --git a/xc/lib/dpstk/XDPSswraps.psw b/xc/lib/dpstk/XDPSswraps.psw
deleted file mode 100644
index f878c765a..000000000
--- a/xc/lib/dpstk/XDPSswraps.psw
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * XDPSswraps.psw
- *
- * (c) Copyright 1990-1994 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
- */
-
-defineps _DPSSSetContextParameters(DPSContext ctxt;
- int gc, drawable, drawableHeight,
- map, rgbBase, redMax, redMult,
- greenMax, greenMult, blueMax, blueMult,
- grayBase, grayMax, grayMult;
- boolean doGC, doDrawable, doRGB, doGray)
- $Adobe$DPS$Lib$Dict begin
- currentXgcdrawablecolor
- /colorinfo exch def
-
- doGC {
- 4 -1 roll pop gc 4 1 roll
- } if
-
- doDrawable {
- pop pop 0 drawableHeight
- 3 -1 roll pop drawable 3 1 roll
- } if
-
- doRGB {
- colorinfo 3 redMax put
- colorinfo 4 redMult put
- colorinfo 5 greenMax put
- colorinfo 6 greenMult put
- colorinfo 7 blueMax put
- colorinfo 8 blueMult put
- colorinfo 9 rgbBase put
- colorinfo 10 map put
- } if
-
- doGray {
- colorinfo 0 grayMax put
- colorinfo 1 grayMult put
- colorinfo 2 grayBase put
- colorinfo 10 map put
- } if
-
- colorinfo setXgcdrawablecolor
- end
-endps
-
-defineps _DPSSSetContextDrawable(DPSContext ctxt;
- int drawable, drawableHeight)
- currentXgcdrawable
- pop pop pop drawable 0 drawableHeight
- setXgcdrawable
-endps
-
-defineps _DPSSInstallDPSlibDict(DPSContext c)
- userdict /$Adobe$DPS$Lib$Dict 20 dict put
-endps
-
-defineps _DPSSCaptureGState(DPSContext c; int gs)
- gs gstate defineuserobject
-endps
-
-defineps _DPSSUpdateGState(DPSContext c; userobject gs)
- gs currentgstate pop
-endps
-
-defineps _DPSSRestoreGState(DPSContext c; userobject gs)
- gs setgstate
-endps
-
-defineps _DPSSDefineUserObject(DPSContext c; int uo)
- uo exch defineuserobject
-endps
-
-defineps _DPSSUndefineUserObject(DPSContext c; int uo)
- uo undefineuserobject
-endps
-
diff --git a/xc/lib/dpstk/XDPSuserpath.c b/xc/lib/dpstk/XDPSuserpath.c
deleted file mode 100644
index 6ceb40cff..000000000
--- a/xc/lib/dpstk/XDPSuserpath.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * XDPSuserpath.c
- *
- * (c) Copyright 1990-1994 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
- */
-
-#include <DPS/dpsXclient.h>
-#include <DPS/dpsops.h>
-#include "DPS/dpsXuserpath.h"
-
-typedef struct _t_NumStrHeader {
- unsigned char type;
- unsigned char representation;
- unsigned short length;
-} NumStrHeader;
-
-void PSDoUserPath(coords, numCoords, numType, ops, numOps, bbox, action)
- DPSPointer coords;
- int numCoords;
- DPSNumberFormat numType;
- DPSUserPathOp *ops;
- int numOps;
- DPSPointer bbox;
- DPSUserPathAction action;
-{
- DPSDoUserPath(DPSGetCurrentContext(), coords, numCoords, numType, ops,
- numOps, bbox, action);
-}
-
-void DPSDoUserPath(ctxt, coords, numCoords, numType, ops, numOps, bbox, action)
- DPSContext ctxt;
- DPSPointer coords;
- int numCoords;
- DPSNumberFormat numType;
- DPSUserPathOp *ops;
- int numOps;
- DPSPointer bbox;
- DPSUserPathAction action;
-{
- typedef struct {
- unsigned char tokenType;
- unsigned char topLevelCount;
- unsigned short nBytes;
- DPSBinObjGeneric obj0;
- DPSBinObjGeneric obj1;
- DPSBinObjGeneric obj2;
- DPSBinObjGeneric obj3;
- } _dpsQ;
- static _dpsQ _dpsF = {
- DPS_DEF_TOKENTYPE, 0, 36, /* will fill in topLevelCount later */
- {DPS_LITERAL|DPS_ARRAY, 0, 2, 16},
- {DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 0},
- {DPS_LITERAL|DPS_STRING, 0, 0, 32}, /* param nums */
- {DPS_LITERAL|DPS_STRING, 0, 0, 32}, /* param ops */
- }; /* _dpsQ */
- register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
- register int _dps_offset = 32;
- int needBBox, hasUCache, numberSize;
- DPSUserPathOp setbboxOp;
- NumStrHeader nsHeader;
-
- if (numType >= dps_short && numType < dps_float) numberSize = 2;
- else numberSize = 4;
-
- hasUCache = (*ops == dps_ucache);
-
- if (hasUCache) {
- needBBox = (numOps > 1 && ops[1] != dps_setbbox);
- } else needBBox = (*ops != dps_setbbox);
-
- if (needBBox) {
- numOps += 1;
- setbboxOp = dps_setbbox;
- }
-
- numCoords += 4; /* Account for bbox */
-
- nsHeader.type = 149; /* Homogeneous Number Array */
- nsHeader.representation = numType;
- nsHeader.length = numCoords;
-
- /* If we're using the send operation, we modify the sequence so that
- it never gets to the action. This leaves a hole in the sequence,
- but that's ok. */
-
- if (action == dps_send) _dpsF.topLevelCount = 1;
- else _dpsF.topLevelCount = 2;
-
- _dpsP[1].val.nameVal = action;
- _dpsP[2].length = (sizeof(NumStrHeader) + numCoords * numberSize);
- _dpsP[3].length = numOps;
- _dpsP[3].val.stringVal = _dps_offset;
- _dps_offset += numOps;
- _dpsP[2].val.stringVal = _dps_offset;
- _dps_offset += _dpsP[2].length;
- _dpsF.nBytes = _dps_offset+4;
-
- if (needBBox) numOps -= 1;
-
- numCoords -= 4; /* Unaccount for bbox */
-
- DPSBinObjSeqWrite(ctxt, (char *) &_dpsF, 36);
- if (needBBox) {
- if (hasUCache) {
- DPSWriteStringChars(ctxt, (char *) ops, 1);
- ops++; numOps--;
- }
- DPSWriteStringChars(ctxt, (char *) &setbboxOp, 1);
- }
- DPSWriteStringChars(ctxt, (char *) ops, numOps);
- DPSWriteStringChars(ctxt, (char *) &nsHeader, sizeof(NumStrHeader));
- DPSWriteStringChars(ctxt, (char *) bbox, 4 * numberSize);
- DPSWriteStringChars(ctxt, (char *) coords, numCoords * numberSize);
-}
-
-Bool PSHitUserPath(x, y, radius,
- coords, numCoords, numType, ops, numOps, bbox, action)
- double x, y, radius;
- DPSPointer coords;
- int numCoords;
- DPSNumberFormat numType;
- DPSUserPathOp *ops;
- int numOps;
- DPSPointer bbox;
- DPSUserPathAction action;
-{
- return DPSHitUserPath(DPSGetCurrentContext(), x, y, radius,
- coords, numCoords, numType, ops,
- numOps, bbox, action);
-}
-
-Bool DPSHitUserPath(ctxt, x, y, radius,
- coords, numCoords, numType, ops, numOps, bbox, action)
- DPSContext ctxt;
- double x, y, radius;
- DPSPointer coords;
- int numCoords;
- DPSNumberFormat numType;
- DPSUserPathOp *ops;
- int numOps;
- DPSPointer bbox;
- DPSUserPathAction action;
-{
- float aCoords[5];
- DPSUserPathOp aOps[1];
- float aBbox[4];
- int result;
-
- if (radius != 0.0) {
- aCoords[0] = x;
- aCoords[1] = y;
- aCoords[2] = radius;
- aCoords[3] = 0.0;
- aCoords[4] = 360.0;
- aOps[0] = dps_arc;
- aBbox[0] = x - radius;
- aBbox[1] = y - radius;
- aBbox[2] = x + radius;
- aBbox[3] = y + radius;
-
- switch (action) {
- case dps_infill:
- case dps_ineofill:
- case dps_instroke:
- DPSDoUserPath(ctxt, (DPSPointer) aCoords, 5, dps_float,
- aOps, 1, (DPSPointer) aBbox, action);
- break;
- case dps_inufill:
- case dps_inueofill:
- case dps_inustroke:
- DPSDoUserPath(ctxt, (DPSPointer) aCoords, 5, dps_float,
- aOps, 1, (DPSPointer) aBbox, dps_send);
- DPSDoUserPath(ctxt, coords, numCoords, numType, ops,
- numOps, bbox, action);
- break;
- default:
- return False;
- }
- DPSgetboolean(ctxt, &result);
-
- } else {
- switch (action) {
- case dps_infill:
- DPSinfill(ctxt, x, y, &result);
- break;
- case dps_ineofill:
- DPSineofill(ctxt, x, y, &result);
- break;
- case dps_instroke:
- DPSinstroke(ctxt, x, y, &result);
- break;
- case dps_inufill:
- case dps_inueofill:
- case dps_inustroke:
- DPSsendfloat(ctxt, x);
- DPSsendfloat(ctxt, y);
- DPSDoUserPath(ctxt, coords, numCoords, numType, ops,
- numOps, bbox, action);
- DPSgetboolean(ctxt, &result);
- break;
- default:
- return False;
- }
- }
- return result;
-}
-
diff --git a/xc/lib/dpstk/dpsXcommonI.h b/xc/lib/dpstk/dpsXcommonI.h
deleted file mode 100644
index 2e91dc629..000000000
--- a/xc/lib/dpstk/dpsXcommonI.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * dpsXcommonI.h
- *
- * (c) Copyright 1990-1994 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
- */
-
-#ifndef DPS_X_COMMON_I_H
-#define DPS_X_COMMON_I_H
-
-#define dps_init_bit_share (1<<0)
-#define dps_init_bit_preview (1<<1)
-#define dps_init_bit_fsb (1<<2)
-#define dps_init_bit_csb (1<<3)
-#define dps_init_bit_dsw (1<<4)
-
-#ifdef _NO_PROTO
-
-extern int _XDPSSetComponentInitialized();
-
-extern int _XDPSTestComponentInitialized();
-
-#else /* _NO_PROTO */
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-extern int _XDPSSetComponentInitialized(DPSContext context,
- unsigned long componentBit);
-
-extern int _XDPSTestComponentInitialized(DPSContext context,
- unsigned long componentBit,
- Bool *result);
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* _NO_PROTO */
-
-#endif /* DPS_X_COMMON_I_H */
diff --git a/xc/lib/dpstk/dpstk-def.cpp b/xc/lib/dpstk/dpstk-def.cpp
deleted file mode 100644
index 8304cfdf4..000000000
--- a/xc/lib/dpstk/dpstk-def.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-LIBRARY DPSTK
-VERSION LIBRARY_VERSION
-EXPORTS
-_DPSPCheckForError
-_DPSPClearArea
-_DPSPDefineExecFunction
-_DPSPSaveBeforeExec
-_DPSPSetMaskTransfer
-_DPSPSetMatrix
-_DPSSCaptureGState
-_DPSSDefineUserObject
-_DPSSInstallDPSlibDict
-_DPSSRestoreGState
-_DPSSSetContextDrawable
-_DPSSSetContextParameters
-_DPSSUndefineUserObject
-_DPSSUpdateGState
-DPSDefineAsUserObj
-DPSRedefineUserObj
-DPSReserveUserObjIndices
-DPSReturnUserObjIndices
-DPSUndefineUserObj
-PSDefineAsUserObj
-PSRedefineUserObj
-PSReserveUserObjIndices
-PSReturnUserObjIndices
-PSUndefineUserObj
-XDPSCaptureContextGState
-XDPSChainTextContext
-XDPSDestroySharedContext
-XDPSExtensionPresent
-XDPSFreeContextGState
-XDPSFreeDisplayInfo
-XDPSGetSharedContext
-XDPSPopContextGState
-XDPSPopContextParameters
-XDPSPushContextGState
-XDPSPushContextParameters
-XDPSRegisterContext
-XDPSSetContextDepth
-XDPSSetContextDrawable
-XDPSSetContextGState
-XDPSSetContextGrayMap
-XDPSSetContextParameters
-XDPSSetContextRGBMap
-XDPSUnregisterContext
-XDPSUpdateContextGState
-_XDPSSetComponentInitialized
-_XDPSTestComponentInitialized
-XDPSCheckImagingResults
-XDPSCreatePixmapForEPSF
-XDPSEmbeddedEPSFRewindFunc
-XDPSEmbeddedGetsFunc
-XDPSFileGetsFunc
-XDPSFileRewindFunc
-XDPSImageFileIntoDrawable
-XDPSPixelsPerPoint
-XDPSSetFileFunctions
-XDPSSetImagingTimeout
-DPSDoUserPath
-DPSHitUserPath
-PSDoUserPath
-PSHitUserPath
-
-/* $XFree86: xc/lib/dpstk/dpstk-def.cpp,v 1.1 2000/08/09 23:40:14 dawes Exp $ */
diff --git a/xc/lib/dpstk/dpstkos2.def b/xc/lib/dpstk/dpstkos2.def
deleted file mode 100644
index ef5beda5f..000000000
--- a/xc/lib/dpstk/dpstkos2.def
+++ /dev/null
@@ -1,69 +0,0 @@
-LIBRARY DPSTK
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/dpstk/dpstkos2.def,v 1.1 2000/04/05 18:13:23 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- XDPSSetFileFunctions @ 1
- XDPSFileRewindFunc @ 2
- XDPSFileGetsFunc @ 3
- XDPSEmbeddedEPSFRewindFunc @ 4
- XDPSEmbeddedGetsFunc @ 5
- XDPSCreatePixmapForEPSF @ 6
- XDPSPixelsPerPoint @ 7
- XDPSSetImagingTimeout @ 8
- XDPSCheckImagingResults @ 9
- XDPSImageFileIntoDrawable 10
- _DPSPSetMatrix @ 11
- _DPSPClearArea @ 12
- _DPSPSetMaskTransfer @ 13
- _DPSPDefineExecFunction @ 14
- _DPSPSaveBeforeExec @ 15
- _DPSPCheckForError @ 16
- _XDPSSetComponentInitialized @ 17
- _XDPSTestComponentInitialized @ 18
- XDPSSetContextDepth @ 19
- XDPSSetContextDrawable @ 20
- XDPSSetContextRGBMap @ 21
- XDPSSetContextGrayMap @ 22
- XDPSSetContextParameters @ 23
- XDPSPushContextParameters @ 24
- XDPSPopContextParameters @ 25
- XDPSCaptureContextGState @ 26
- XDPSUpdateContextGState @ 27
- XDPSFreeContextGState @ 28
- XDPSSetContextGState @ 29
- XDPSPushContextGState @ 30
- XDPSPopContextGState @ 31
- XDPSRegisterContext @ 32
- XDPSGetSharedContext @ 33
- XDPSDestroySharedContext @ 34
- XDPSUnregisterContext @ 35
- XDPSFreeDisplayInfo @ 36
- XDPSChainTextContext @ 37
- XDPSExtensionPresent @ 38
- PSDefineAsUserObj @ 39
- PSRedefineUserObj @ 40
- PSUndefineUserObj @ 41
- DPSDefineAsUserObj @ 42
- DPSRedefineUserObj @ 43
- DPSUndefineUserObj @ 44
- PSReserveUserObjIndices @ 45
- DPSReserveUserObjIndices @ 46
- PSReturnUserObjIndices @ 47
- DPSReturnUserObjIndices @ 48
- _DPSSSetContextParameters @ 49
- _DPSSSetContextDrawable @ 50
- _DPSSInstallDPSlibDict @ 51
- _DPSSCaptureGState @ 52
- _DPSSUpdateGState @ 53
- _DPSSRestoreGState @ 54
- _DPSSDefineUserObject @ 55
- _DPSSUndefineUserObject @ 56
- PSDoUserPath @ 57
- DPSDoUserPath @ 58
- PSHitUserPath @ 59
- DPSHitUserPath @ 60
-
diff --git a/xc/lib/dpstk/dpstkos2.rsp b/xc/lib/dpstk/dpstkos2.rsp
deleted file mode 100644
index 4cf7bb26f..000000000
--- a/xc/lib/dpstk/dpstkos2.rsp
+++ /dev/null
@@ -1,4 +0,0 @@
-XDPSpreview.obj XDPSpwraps.obj XDPSshare.obj XDPSswraps.obj+
-XDPSuserpath.obj /NOI /NOL /NOD /BAT
-dpstk.dll
-dpstk.map
diff --git a/xc/lib/dpstk/eyedrop16.xbm b/xc/lib/dpstk/eyedrop16.xbm
deleted file mode 100644
index 2f5a772d7..000000000
--- a/xc/lib/dpstk/eyedrop16.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define eyedrop16_width 16
-#define eyedrop16_height 16
-#define eyedrop16_x_hot 0
-#define eyedrop16_y_hot 13
-static unsigned char eyedrop16_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x03,
- 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x07, 0xf8, 0x03, 0xf8, 0x01, 0xf8, 0x00,
- 0x7c, 0x00, 0x0e, 0x00, 0x06, 0x00, 0x00, 0x00};
diff --git a/xc/lib/dpstk/eyedrop32.xbm b/xc/lib/dpstk/eyedrop32.xbm
deleted file mode 100644
index 5bc98a02c..000000000
--- a/xc/lib/dpstk/eyedrop32.xbm
+++ /dev/null
@@ -1,16 +0,0 @@
-#define eyedrop32_width 32
-#define eyedrop32_height 32
-#define eyedrop32_x_hot 0
-#define eyedrop32_y_hot 29
-static unsigned char eyedrop32_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, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x07, 0x00,
- 0x00, 0xf0, 0x0f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
- 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00,
- 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00,
- 0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00,
- 0xf8, 0x01, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xc/lib/dpstk/eyedropmask16.xbm b/xc/lib/dpstk/eyedropmask16.xbm
deleted file mode 100644
index e1a696dd6..000000000
--- a/xc/lib/dpstk/eyedropmask16.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define eyedropmask16_width 16
-#define eyedropmask16_height 16
-#define eyedropmask16_x_hot 0
-#define eyedropmask16_y_hot 13
-static unsigned char eyedropmask16_bits[] = {
- 0x00, 0x7c, 0x00, 0xfe, 0x80, 0xff, 0x00, 0xff, 0x80, 0xff, 0xc0, 0xff,
- 0xe0, 0x7f, 0xf0, 0x3f, 0xf8, 0x2f, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01,
- 0xfe, 0x00, 0x7f, 0x00, 0x0e, 0x00, 0x04, 0x00};
diff --git a/xc/lib/dpstk/eyedropmask32.xbm b/xc/lib/dpstk/eyedropmask32.xbm
deleted file mode 100644
index 8e12f00e7..000000000
--- a/xc/lib/dpstk/eyedropmask32.xbm
+++ /dev/null
@@ -1,16 +0,0 @@
-#define eyedropmask32_width 32
-#define eyedropmask32_height 32
-#define eyedropmask32_x_hot 0
-#define eyedropmask32_y_hot 29
-static unsigned char eyedropmask32_bits[] = {
- 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0xf0, 0x7f,
- 0x00, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0xff, 0x00, 0x00, 0xfe, 0xff,
- 0x00, 0x00, 0xff, 0xff, 0x00, 0xc0, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff,
- 0x00, 0xc0, 0xff, 0x7f, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xc0, 0xff, 0x3f,
- 0x00, 0xe0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x07,
- 0x00, 0xfc, 0xff, 0x03, 0x00, 0xfe, 0xff, 0x01, 0x00, 0xff, 0xdf, 0x01,
- 0x80, 0xff, 0x8f, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xe0, 0xff, 0x03, 0x00,
- 0xf0, 0xff, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,
- 0xfc, 0x3f, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00,
- 0xfc, 0x07, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00,
- 0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00};
diff --git a/xc/lib/dpstk/heyedrop.xbm b/xc/lib/dpstk/heyedrop.xbm
deleted file mode 100644
index ea51ae599..000000000
--- a/xc/lib/dpstk/heyedrop.xbm
+++ /dev/null
@@ -1,7 +0,0 @@
-#define heyedrop_width 32
-#define heyedrop_height 12
-static unsigned char heyedrop_bits[] = {
- 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0xe0, 0xff, 0xff, 0x7f,
- 0x38, 0x00, 0xf8, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x00, 0x00, 0xf8, 0xff,
- 0x00, 0x00, 0xf8, 0xff, 0x0f, 0x00, 0xf8, 0xff, 0x38, 0x00, 0xf8, 0xff,
- 0xe0, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x08, 0x00};
diff --git a/xc/lib/dpstk/square.xbm b/xc/lib/dpstk/square.xbm
deleted file mode 100644
index d05789431..000000000
--- a/xc/lib/dpstk/square.xbm
+++ /dev/null
@@ -1,8 +0,0 @@
-#define square_width 16
-#define square_height 16
-#define square_x_hot 6
-#define square_y_hot 6
-static unsigned char square_bits[] = {
- 0x00, 0x00, 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f,
- 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f, 0xfe, 0x0f,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xc/lib/dpstk/squaremask.xbm b/xc/lib/dpstk/squaremask.xbm
deleted file mode 100644
index ea2e0d96b..000000000
--- a/xc/lib/dpstk/squaremask.xbm
+++ /dev/null
@@ -1,6 +0,0 @@
-#define squaremask_width 16
-#define squaremask_height 16
-static unsigned char squaremask_bits[] = {
- 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f,
- 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f, 0xff, 0x1f,
- 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff --git a/xc/lib/fontenc/Imakefile b/xc/lib/fontenc/Imakefile
deleted file mode 100644
index b29bb8e4d..000000000
--- a/xc/lib/fontenc/Imakefile
+++ /dev/null
@@ -1,28 +0,0 @@
-XCOMM $XFree86: xc/lib/fontenc/Imakefile,v 1.2 2001/08/16 14:33:47 dawes Exp $
-
- INCLUDES = -I$(FONTINCSRC) -I$(FONTLIBSRC)/include -I$(FONTLIBSRC)/fontfile \
- -I$(XTOP)/include
-
-FONTENCDEFS = -DFONTENC_NO_LIBFONT \
- -DFONT_ENCODINGS_DIRECTORY=\"$(FONTDIR)/encodings/encodings.dir\"
-
- DEFINES = StrcasecmpDefines $(FONTENCDEFS)
-
- SRCS = fontenc.c encparse.c
- OBJS = fontenc.o encparse.o
-
-#define DoNormalLib NormalLibFontEnc
-#define DoSharedLib SharedLibFontEnc
-#define DoDebugLib DebugLibFontEnc
-#define DoProfileLib ProfileLibFontEnc
-#define LibName fontenc
-#define LibHeaders NO
-#define SoRev SOFONTENCREV
-
-#include <Library.tmpl>
-
-LinkSourceFile(fontenc.c,$(FONTLIBSRC)/fontfile)
-LinkSourceFile(encparse.c,$(FONTLIBSRC)/fontfile)
-
-DependTarget()
-
diff --git a/xc/lib/freetype2/Imakefile b/xc/lib/freetype2/Imakefile
deleted file mode 100644
index a015d09fd..000000000
--- a/xc/lib/freetype2/Imakefile
+++ /dev/null
@@ -1,105 +0,0 @@
-XCOMM $XFree86: xc/lib/freetype2/Imakefile,v 1.2 2001/02/08 00:55:40 keithp Exp $
-
-#define IHaveSubdirs
-#define PassCDebugFlags
-
-#define DoNormalLib NormalLibFreetype2
-#define DoSharedLib SharedLibFreetype2
-#define DoExtraLib SharedLibFreetype2
-#define DoDebugLib DebugLibFreetype2
-#define DoProfileLib ProfileLibFreetype2
-#define HasSharedData YES
-#define LibName freetype
-#define SoRev SOFREETYPE2REV
-#define LibHeaders NO
-
-#include <Threads.tmpl>
-
-FREETYPETOP = $(TOP)/extras/freetype2
-FREETYPESRC = $(FREETYPETOP)/src
-FREETYPEINC = $(FREETYPETOP)/include/freetype
-
-INCLUDES = $(FREETYPE2INCLUDES) -I$(FREETYPETOP)/src
-
-SUBDIRS=freetype
-
-
-
-SRCS_BASE = ftsystem.c ftinit.c ftdebug.c ftbase.c ftglyph.c ftbbox.c ftmm.c
-OBJS_BASE = ftsystem.o ftinit.o ftdebug.o ftbase.o ftglyph.o ftbbox.o ftmm.o
-
-SRCS_AUTOHINT = autohint.c
-OBJS_AUTOHINT = autohint.o
-
-SRCS_SFNT = sfnt.c
-OBJS_SFNT = sfnt.o
-
-SRCS_CFF = cff.c
-OBJS_CFF = cff.o
-
-SRCS_PSNAMES = psnames.c
-OBJS_PSNAMES = psnames.o
-
-SRCS_PSAUX = psaux.c
-OBJS_PSAUX = psaux.o
-
-SRCS_TRUETYPE = truetype.c
-OBJS_TRUETYPE = truetype.o
-
-SRCS_TYPE1 = type1.c
-OBJS_TYPE1 = type1.o
-
-SRCS_CID = type1cid.c
-OBJS_CID = type1cid.o
-
-SRCS_RASTER = raster.c
-OBJS_RASTER = raster.o
-
-SRCS_SMOOTH = smooth.c
-OBJS_SMOOTH = smooth.o
-
-SRCS_WINFONTS = winfnt.c
-OBJS_WINFONTS = winfnt.o
-
-
-SRCS = $(SRCS_BASE) $(SRCS_AUTOHINT) $(SRCS_SFNT) $(SRCS_CFF) \
- $(SRCS_PSNAMES) $(SRCS_PSAUX) $(SRCS_TRUETYPE) $(SRCS_TYPE1) \
- $(SRCS_CID) $(SRCS_RASTER) $(SRCS_SMOOTH) $(SRCS_WINFONTS)
-
-OBJS = $(OBJS_BASE) $(OBJS_AUTOHINT) $(OBJS_SFNT) $(OBJS_CFF) \
- $(OBJS_PSNAMES) $(OBJS_PSAUX) $(OBJS_TRUETYPE) $(OBJS_TYPE1) \
- $(OBJS_CID) $(OBJS_RASTER) $(OBJS_SMOOTH) $(OBJS_WINFONTS)
-
-#include <Library.tmpl>
-
-#if DoSharedLib && SharedDataSeparation
-SpecialCObjectRule(sharedlib,NullParameter,$(SHLIBDEF))
-#endif
-
-#if 0
-MANSUFFIX = $(LIBMANSUFFIX)
-InstallManPage(Freetype,$(LIBMANDIR))
-#endif
-
-
-LinkSourceFile(ftsystem.c,$(FREETYPESRC)/base)
-LinkSourceFile(ftinit.c,$(FREETYPESRC)/base)
-LinkSourceFile(ftdebug.c,$(FREETYPESRC)/base)
-LinkSourceFile(ftbase.c,$(FREETYPESRC)/base)
-LinkSourceFile(ftglyph.c,$(FREETYPESRC)/base)
-LinkSourceFile(ftbbox.c,$(FREETYPESRC)/base)
-LinkSourceFile(ftmm.c,$(FREETYPESRC)/base)
-LinkSourceFile(autohint.c,$(FREETYPESRC)/autohint)
-LinkSourceFile(sfnt.c,$(FREETYPESRC)/sfnt)
-LinkSourceFile(cff.c,$(FREETYPESRC)/cff)
-LinkSourceFile(psnames.c,$(FREETYPESRC)/psnames)
-LinkSourceFile(psaux.c,$(FREETYPESRC)/psaux)
-LinkSourceFile(truetype.c,$(FREETYPESRC)/truetype)
-LinkSourceFile(type1.c,$(FREETYPESRC)/type1)
-LinkSourceFile(type1cid.c,$(FREETYPESRC)/cid)
-LinkSourceFile(raster.c,$(FREETYPESRC)/raster)
-LinkSourceFile(smooth.c,$(FREETYPESRC)/smooth)
-LinkSourceFile(winfnt.c,$(FREETYPESRC)/winfonts)
-
-
-DependTarget()
diff --git a/xc/lib/freetype2/freetype-def.cpp b/xc/lib/freetype2/freetype-def.cpp
deleted file mode 100644
index a97135600..000000000
--- a/xc/lib/freetype2/freetype-def.cpp
+++ /dev/null
@@ -1,160 +0,0 @@
-LIBRARY libfreetype
-VERSION LIBRARY_VERSION
-
-EXPORTS
-ah_arctan
-autohint_module_class
-autohinter_interface
-cff_driver_class
-FT_Access_Frame
-FT_Add64
-FT_Add_Module
-FT_Alloc
-FT_Attach_File
-FT_Attach_Stream
-FT_Create_Extensions
-FT_Destroy_Extensions
-FT_Div64by32
-FT_DivFix
-FT_Done_Extensions
-FT_Done_Face
-FT_Done_GlyphSlot
-FT_Done_Library
-FT_Done_Size
-FT_Done_Stream
-FT_Extract_Frame
-FT_Forget_Frame
-FT_Free
-FT_Get_Char
-FT_Get_Char_Index
-FT_Get_Extension
-FT_Get_Glyph_Name
-FT_Get_Kerning
-FT_Get_Long
-FT_Get_LongLE
-FT_Get_Module
-FT_Get_Module_Interface
-FT_Get_Offset
-FT_Get_Renderer
-FT_Get_Sfnt_Name
-FT_Get_Sfnt_Name_Count
-FT_Get_Sfnt_Table
-FT_Get_Short
-FT_Get_ShortLE
-FT_GlyphLoader_Add
-FT_GlyphLoader_Check_Points
-FT_GlyphLoader_Check_Subglyphs
-FT_GlyphLoader_Copy_Points
-FT_GlyphLoader_Create_Extra
-FT_GlyphLoader_Done
-FT_GlyphLoader_New
-FT_GlyphLoader_Prepare
-FT_GlyphLoader_Reset
-FT_GlyphLoader_Rewind
-FT_Init_Extensions
-FT_List_Add
-FT_List_Finalize
-FT_List_Find
-FT_List_Insert
-FT_List_Iterate
-FT_List_Remove
-FT_List_Up
-FT_Load_Char
-FT_Load_Glyph
-FT_Lookup_Renderer
-FT_MulDiv
-FT_MulFix
-FT_MulTo64
-FT_New_Face
-FT_New_GlyphSlot
-FT_New_Library
-FT_New_Memory_Face
-FT_New_Memory_Stream
-FT_New_Size
-FT_Open_Face
-FT_Outline_Copy
-FT_Outline_Decompose
-FT_Outline_Done
-FT_Outline_Done_Internal
-FT_Outline_Get_Bitmap
-FT_Outline_Get_CBox
-FT_Outline_New
-FT_Outline_New_Internal
-FT_Outline_Render
-FT_Outline_Reverse
-FT_Outline_Transform
-FT_Outline_Translate
-FT_Read_Char
-FT_Read_Fields
-FT_Read_Long
-FT_Read_LongLE
-FT_Read_Offset
-FT_Read_Short
-FT_Read_ShortLE
-FT_Read_Stream
-FT_Read_Stream_At
-FT_Realloc
-FT_Register_Extension
-FT_Release_Frame
-FT_Remove_Module
-FT_Render_Glyph
-FT_Render_Glyph_Internal
-FT_Seek_Stream
-FT_Select_Charmap
-FT_Set_Char_Size
-FT_Set_Charmap
-FT_Set_Debug_Hook
-FT_Set_Pixel_Sizes
-FT_Set_Renderer
-FT_Set_Transform
-FT_Skip_Stream
-FT_Sqrt64
-FT_SqrtFixed
-FT_Stream_Pos
-FT_Vector_Transform
-FT_Outline_Get_BBox
-FT_Done_Glyph
-FT_Get_Glyph
-FT_Glyph_Copy
-FT_Glyph_Get_CBox
-FT_Glyph_To_Bitmap
-FT_Glyph_Transform
-FT_Matrix_Invert
-FT_Matrix_Multiply
-ft_bitmap_glyph_class
-ft_outline_glyph_class
-FT_Add_Default_Modules
-FT_Done_FreeType
-FT_Init_FreeType
-FT_Get_Multi_Master
-FT_Set_MM_Blend_Coordinates
-FT_Set_MM_Design_Coordinates
-FT_Done_Memory
-FT_New_Memory
-FT_New_Stream
-_cygwin_dll_entry@12
-_cygwin_noncygwin_dll_entry@12
-dll_main@12
-ps_table_funcs
-psaux_module_class
-t1_builder_funcs
-t1_decoder_funcs
-t1_parser_funcs
-psnames_module_class
-ft_raster1_renderer_class
-ft_raster5_renderer_class
-ft_standard_raster
-sbit_metrics_fields
-sfnt_module_class
-ft_grays_raster
-ft_smooth_renderer_class
-grays_raster_render
-TT_New_Context
-TT_RunIns
-tt_default_graphics_state
-tt_driver_class
-t1_driver_class
-t1cid_driver_class
-winfnt_driver_class
-
-/* $XFree86: xc/lib/freetype2/freetype-def.cpp,v 1.1 2001/04/05 19:29:38 dawes Exp $ */
diff --git a/xc/lib/freetype2/freetype/Imakefile b/xc/lib/freetype2/freetype/Imakefile
deleted file mode 100644
index beb44b31e..000000000
--- a/xc/lib/freetype2/freetype/Imakefile
+++ /dev/null
@@ -1,56 +0,0 @@
-XCOMM $XFree86: xc/lib/freetype2/freetype/Imakefile,v 1.2 2001/02/09 00:35:03 keithp Exp $
-
-#define IHaveSubdirs
-#define PassCDebugFlags
-
-SUBDIRS=config cache internal
-
-FREETYPETOP = $(TOP)/extras/freetype2
-FREETYPESRC = $(FREETYPETOP)/src
-FREETYPEINC = $(FREETYPETOP)/include/freetype
-
-HEADERS= \
- freetype.h \
- ftbbox.h \
- ftcache.h \
- fterrors.h \
- ftglyph.h \
- ftimage.h \
- ftlist.h \
- ftmac.h \
- ftmm.h \
- ftmodule.h \
- ftnames.h \
- ftoutln.h \
- ftrender.h \
- ftsynth.h \
- ftsystem.h \
- fttypes.h \
- t1tables.h \
- ttnameid.h \
- tttables.h \
- tttags.h
-
-BuildIncludes($(HEADERS),freetype2/freetype,../..)
-InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype,$(INSTINCFLAGS))
-
-LinkSourceFile(freetype.h,$(FREETYPEINC))
-LinkSourceFile(ftbbox.h,$(FREETYPEINC))
-LinkSourceFile(ftcache.h,$(FREETYPEINC))
-LinkSourceFile(fterrors.h,$(FREETYPEINC))
-LinkSourceFile(ftglyph.h,$(FREETYPEINC))
-LinkSourceFile(ftimage.h,$(FREETYPEINC))
-LinkSourceFile(ftlist.h,$(FREETYPEINC))
-LinkSourceFile(ftmac.h,$(FREETYPEINC))
-LinkSourceFile(ftmm.h,$(FREETYPEINC))
-LinkSourceFile(ftmodule.h,$(FREETYPEINC))
-LinkSourceFile(ftnames.h,$(FREETYPEINC))
-LinkSourceFile(ftoutln.h,$(FREETYPEINC))
-LinkSourceFile(ftrender.h,$(FREETYPEINC))
-LinkSourceFile(ftsynth.h,$(FREETYPEINC))
-LinkSourceFile(ftsystem.h,$(FREETYPEINC))
-LinkSourceFile(fttypes.h,$(FREETYPEINC))
-LinkSourceFile(t1tables.h,$(FREETYPEINC))
-LinkSourceFile(ttnameid.h,$(FREETYPEINC))
-LinkSourceFile(tttables.h,$(FREETYPEINC))
-LinkSourceFile(tttags.h,$(FREETYPEINC))
diff --git a/xc/lib/freetype2/freetype/cache/Imakefile b/xc/lib/freetype2/freetype/cache/Imakefile
deleted file mode 100644
index 8b2de539a..000000000
--- a/xc/lib/freetype2/freetype/cache/Imakefile
+++ /dev/null
@@ -1,23 +0,0 @@
-XCOMM $XFree86: xc/lib/freetype2/freetype/cache/Imakefile,v 1.1 2001/02/08 00:55:41 keithp Exp $
-
-FREETYPETOP = $(TOP)/extras/freetype2
-FREETYPESRC = $(FREETYPETOP)/src
-FREETYPEINC = $(FREETYPETOP)/include/freetype
-
-HEADERS= \
- ftcchunk.h \
- ftcglyph.h \
- ftcimage.h \
- ftcmanag.h \
- ftcsbits.h \
- ftlru.h
-
-BuildIncludes($(HEADERS),freetype2/freetype/cache,../../..)
-InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/cache,$(INSTINCFLAGS))
-
-LinkSourceFile(ftcchunk.h,$(FREETYPEINC)/cache)
-LinkSourceFile(ftcglyph.h,$(FREETYPEINC)/cache)
-LinkSourceFile(ftcimage.h,$(FREETYPEINC)/cache)
-LinkSourceFile(ftcmanag.h,$(FREETYPEINC)/cache)
-LinkSourceFile(ftcsbits.h,$(FREETYPEINC)/cache)
-LinkSourceFile(ftlru.h,$(FREETYPEINC)/cache)
diff --git a/xc/lib/freetype2/freetype/config/Imakefile b/xc/lib/freetype2/freetype/config/Imakefile
deleted file mode 100644
index 2e0a7583e..000000000
--- a/xc/lib/freetype2/freetype/config/Imakefile
+++ /dev/null
@@ -1,19 +0,0 @@
-XCOMM $XFree86: xc/lib/freetype2/freetype/config/Imakefile,v 1.1 2001/02/08 00:55:41 keithp Exp $
-
-FREETYPETOP = $(TOP)/extras/freetype2
-FREETYPESRC = $(FREETYPETOP)/src
-FREETYPEINC = $(FREETYPETOP)/include/freetype
-
-HEADERS= \
- ftbuild.h \
- ftconfig.h \
- ftmodule.h \
- ftoption.h
-
-BuildIncludes($(HEADERS),freetype2/freetype/config,../../..)
-InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/config,$(INSTINCFLAGS))
-
-LinkSourceFile(ftbuild.h,$(FREETYPEINC)/config)
-LinkSourceFile(ftconfig.h,$(FREETYPEINC)/config)
-LinkSourceFile(ftmodule.h,$(FREETYPEINC)/config)
-LinkSourceFile(ftoption.h,$(FREETYPEINC)/config)
diff --git a/xc/lib/freetype2/freetype/internal/Imakefile b/xc/lib/freetype2/freetype/internal/Imakefile
deleted file mode 100644
index 7814a43de..000000000
--- a/xc/lib/freetype2/freetype/internal/Imakefile
+++ /dev/null
@@ -1,49 +0,0 @@
-XCOMM $XFree86: xc/lib/freetype2/freetype/internal/Imakefile,v 1.1 2001/02/09 00:35:03 keithp Exp $
-
-FREETYPETOP = $(TOP)/extras/freetype2
-FREETYPESRC = $(FREETYPETOP)/src
-FREETYPEINC = $(FREETYPETOP)/include/freetype
-
-HEADERS= \
- autohint.h \
- fnttypes.h \
- ftcalc.h \
- ftdebug.h \
- ftdriver.h \
- ftextend.h \
- ftmemory.h \
- ftobjs.h \
- ftstream.h \
- internal.h \
- psaux.h \
- psnames.h \
- sfnt.h \
- t1errors.h \
- t1types.h \
- t2errors.h \
- t2types.h \
- tterrors.h \
- tttypes.h
-
-BuildIncludes($(HEADERS),freetype2/freetype/internal,../../..)
-InstallMultipleFlags($(HEADERS),$(INCDIR)/freetype2/freetype/internal,$(INSTINCFLAGS))
-
-LinkSourceFile(autohint.h,$(FREETYPEINC)/internal)
-LinkSourceFile(fnttypes.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftcalc.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftdebug.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftdriver.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftextend.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftmemory.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftobjs.h,$(FREETYPEINC)/internal)
-LinkSourceFile(ftstream.h,$(FREETYPEINC)/internal)
-LinkSourceFile(internal.h,$(FREETYPEINC)/internal)
-LinkSourceFile(psaux.h,$(FREETYPEINC)/internal)
-LinkSourceFile(psnames.h,$(FREETYPEINC)/internal)
-LinkSourceFile(sfnt.h,$(FREETYPEINC)/internal)
-LinkSourceFile(t1errors.h,$(FREETYPEINC)/internal)
-LinkSourceFile(t1types.h,$(FREETYPEINC)/internal)
-LinkSourceFile(t2errors.h,$(FREETYPEINC)/internal)
-LinkSourceFile(t2types.h,$(FREETYPEINC)/internal)
-LinkSourceFile(tterrors.h,$(FREETYPEINC)/internal)
-LinkSourceFile(tttypes.h,$(FREETYPEINC)/internal)
diff --git a/xc/lib/oldX/Imakefile b/xc/lib/oldX/Imakefile
deleted file mode 100644
index 9ca0955fa..000000000
--- a/xc/lib/oldX/Imakefile
+++ /dev/null
@@ -1,40 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/28 1996/09/28 16:49:50 rws $
-XCOMM $XFree86: xc/lib/oldX/Imakefile,v 1.2 1998/12/20 11:57:19 dawes Exp $
-#define DoNormalLib NormalOldX
-#define DoSharedLib SharedOldX
-#define DoExtraLib SharedOldX
-#define DoDebugLib DebugOldX
-#define DoProfileLib ProfileOldX
-#define LibName oldX
-#define SoRev SOOLDXREV
-#define IncSubdir X11
-
-#ifdef SharedOldXReqs
-REQUIREDLIBS = SharedOldXReqs
-#endif
-
-#if Malloc0ReturnsNull
- DEFINES = -DMALLOC_0_RETURNS_NULL
-#endif
- INCLUDES = -I$(XINCLUDESRC) -I$(XLIBSRC)
- SRCS = \
- XDraw.c \
- XCrAssoc.c \
- XDelAssoc.c \
- XDestAssoc.c \
- XLookAssoc.c \
- XMakeAssoc.c
- HEADERS = X10.h
- LINTLIBS =
-
- OBJS = \
- XDraw.o \
- XCrAssoc.o \
- XDelAssoc.o \
- XDestAssoc.o \
- XLookAssoc.o \
- XMakeAssoc.o
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/oldX/X10.h b/xc/lib/oldX/X10.h
deleted file mode 100644
index 80a928795..000000000
--- a/xc/lib/oldX/X10.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $TOG: X10.h /main/6 1998/02/06 16:14:20 kaleb $ */
-/*
- *
-Copyright 1985, 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.
- *
- * The X Window System is a Trademark of The Open Group.
- *
- */
-
-
-/*
- * X10.h - Header definition and support file for the C subroutine
- * interface library for V10 support routines.
- */
-#ifndef _X10_H_
-#define _X10_H_
-
-/* Used in XDraw and XDrawFilled */
-
-typedef struct {
- short x, y;
- unsigned short flags;
-} Vertex;
-
-/* The meanings of the flag bits. If the bit is 1 the predicate is true */
-
-#define VertexRelative 0x0001 /* else absolute */
-#define VertexDontDraw 0x0002 /* else draw */
-#define VertexCurved 0x0004 /* else straight */
-#define VertexStartClosed 0x0008 /* else not */
-#define VertexEndClosed 0x0010 /* else not */
-/*#define VertexDrawLastPoint 0x0020 */ /* else don't */
-
-/*
-The VertexDrawLastPoint option has not been implemented in XDraw and
-XDrawFilled so it shouldn't be defined.
-*/
-
-/*
- * XAssoc - Associations used in the XAssocTable data structure. The
- * associations are used as circular queue entries in the association table
- * which is contains an array of circular queues (buckets).
- */
-typedef struct _XAssoc {
- struct _XAssoc *next; /* Next object in this bucket. */
- struct _XAssoc *prev; /* Previous obejct in this bucket. */
- Display *display; /* Display which ownes the id. */
- XID x_id; /* X Window System id. */
- char *data; /* Pointer to untyped memory. */
-} XAssoc;
-
-/*
- * XAssocTable - X Window System id to data structure pointer association
- * table. An XAssocTable is a hash table whose buckets are circular
- * queues of XAssoc's. The XAssocTable is constructed from an array of
- * XAssoc's which are the circular queue headers (bucket headers).
- * An XAssocTable consists an XAssoc pointer that points to the first
- * bucket in the bucket array and an integer that indicates the number
- * of buckets in the array.
- */
-typedef struct {
- XAssoc *buckets; /* Pointer to first bucket in bucket array.*/
- int size; /* Table size (number of buckets). */
-} XAssocTable;
-
-XAssocTable *XCreateAssocTable();
-char *XLookUpAssoc();
-
-#endif /* _X10_H_ */
diff --git a/xc/lib/oldX/XCrAssoc.c b/xc/lib/oldX/XCrAssoc.c
deleted file mode 100644
index 15472e643..000000000
--- a/xc/lib/oldX/XCrAssoc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $TOG: XCrAssoc.c /main/6 1998/02/06 16:14:26 kaleb $ */
-/*
-
-Copyright 1985, 1998 The Open Group.
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "Xlibint.h"
-#include "X10.h"
-
-/*
- * XCreateAssocTable - Create an XAssocTable. The size argument should be
- * a power of two for efficiency reasons. Some size suggestions: use 32
- * buckets per 100 objects; a reasonable maximum number of object per
- * buckets is 8. If there is an error creating the XAssocTable, a NULL
- * pointer is returned.
- */
-XAssocTable *XCreateAssocTable(size)
- register int size; /* Desired size of the table. */
-{
- register XAssocTable *table; /* XAssocTable to be initialized. */
- register XAssoc *buckets; /* Pointer to the first bucket in */
- /* the bucket array. */
-
- /* XMalloc the XAssocTable. */
- if ((table = (XAssocTable *)Xmalloc(sizeof(XAssocTable))) == NULL) {
- /* XMalloc call failed! */
- errno = ENOMEM;
- return(NULL);
- }
-
- /* XMalloc the buckets (actually just their headers). */
- buckets = (XAssoc *)Xcalloc((unsigned)size, (unsigned)sizeof(XAssoc));
- if (buckets == NULL) {
- /* XCalloc call failed! */
- errno = ENOMEM;
- return(NULL);
- }
-
- /* Insert table data into the XAssocTable structure. */
- table->buckets = buckets;
- table->size = size;
-
- while (--size >= 0) {
- /* Initialize each bucket. */
- buckets->prev = buckets;
- buckets->next = buckets;
- buckets++;
- }
-
- return(table);
-}
diff --git a/xc/lib/oldX/XDelAssoc.c b/xc/lib/oldX/XDelAssoc.c
deleted file mode 100644
index c1ad4928a..000000000
--- a/xc/lib/oldX/XDelAssoc.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* $TOG: XDelAssoc.c /main/7 1998/02/06 16:14:31 kaleb $ */
-/*
-
-Copyright 1985, 1998 The Open Group.
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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/lib/oldX/XDelAssoc.c,v 1.2 1999/05/23 06:33:34 dawes Exp $ */
-
-#include "Xlibint.h"
-#include "X10.h"
-
-/*
- * XDeleteAssoc - Delete an association in an XAssocTable keyed on
- * an XId. An association may be removed only once. Redundant
- * deletes are meaningless (but cause no problems).
- */
-int
-XDeleteAssoc(dpy, table, x_id)
- register Display *dpy;
- register XAssocTable *table;
- register XID x_id;
-{
- int hash;
- register XAssoc *bucket;
- register XAssoc *Entry;
-
- /* Hash the XId to get the bucket number. */
- hash = x_id & (table->size - 1);
- /* Look up the bucket to get the entries in that bucket. */
- bucket = &table->buckets[hash];
- /* Get the first entry in the bucket. */
- Entry = bucket->next;
-
- /* Scan through the entries in the bucket for the right XId. */
- for (; Entry != bucket; Entry = Entry->next) {
- if (Entry->x_id == x_id) {
- /* We have the right XId. */
- if (Entry->display == dpy) {
- /* We have the right display. */
- /* We have the right entry! */
- /* Remove it from the queue and */
- /* free the entry. */
- Entry->prev->next = Entry->next;
- Entry->next->prev = Entry->prev;
- Xfree((char *)Entry);
- return 0;
- }
- /* Oops, identical XId's on different displays! */
- continue;
- }
- if (Entry->x_id > x_id) {
- /* We have gone past where it should be. */
- /* It is apparently not in the table. */
- return 0;
- }
- }
- /* It is apparently not in the table. */
- return 0;
-}
diff --git a/xc/lib/oldX/XDestAssoc.c b/xc/lib/oldX/XDestAssoc.c
deleted file mode 100644
index 1dc066683..000000000
--- a/xc/lib/oldX/XDestAssoc.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* $TOG: XDestAssoc.c /main/6 1998/02/06 16:14:37 kaleb $ */
-/*
-
-Copyright 1985, 1998 The Open Group.
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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/lib/oldX/XDestAssoc.c,v 1.2 1999/05/23 06:33:34 dawes Exp $ */
-
-#include "Xlibint.h"
-#include "X10.h"
-
-/*
- * XDestroyAssocTable - Destroy (free the memory associated with)
- * an XAssocTable.
- */
-int
-XDestroyAssocTable(table)
- register XAssocTable *table;
-{
- register int i;
- register XAssoc *bucket;
- register XAssoc *Entry, *entry_next;
-
- /* Free the buckets. */
- for (i = 0; i < table->size; i++) {
- bucket = &table->buckets[i];
- for (
- Entry = bucket->next;
- Entry != bucket;
- Entry = entry_next
- ) {
- entry_next = Entry->next;
- Xfree((char *)Entry);
- }
- }
-
- /* Free the bucket array. */
- Xfree((char *)table->buckets);
-
- /* Free the table. */
- Xfree((char *)table);
- return 0;
-}
-
diff --git a/xc/lib/oldX/XDraw.c b/xc/lib/oldX/XDraw.c
deleted file mode 100644
index 9fd20bfb1..000000000
--- a/xc/lib/oldX/XDraw.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* $TOG: XDraw.c /main/13 1998/02/06 16:14:41 kaleb $ */
-
-/*
-
-Copyright 1987, 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.
-
-*/
-/* $XFree86: xc/lib/oldX/XDraw.c,v 1.2 1999/05/23 06:33:35 dawes Exp $ */
-
-#include "Xlibint.h"
-#include "Xlib.h"
-#include "X10.h"
-
-#define OK_RETURN 1
-#define ERR_RETURN 0
-#ifndef NULL
-#define NULL 0
-#endif
-
-/*
-
-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.
-
-*/
-
-/*
- *
- * Vertices_converter: This internal routine takes a list of Vertices and
- * returns another list of Vertices such that the
- * following is true:
- *
- * (1) No Vertex has the VertexRelative flag on
- * (2) No Vertex has the VertexCurved flag on
- * (3) The first Vertex has the VertexDontDraw flag on
- * (4) The path that the return Vertex list specifies should
- * be drawn on the screen is very close to the path that the
- * Vertex list passed to vertices_converter specified should be
- * drawn. The difference is due solely to the approximation
- * of curved segments in the original Vertex list by many
- * small straight line segments that approximate the curve.
- *
- * Notes:
- *
- * (1) The first Vertex must have the VertexRelative flag
- * turned off. (This is not checked, just assumed)
- * (2) VertexDontDraw is automatically turned on for the first
- * Vertex because drawing to the first Vertex makes no sense.
- * (3) This routine is used only by XDraw & XDrawFilled.
- * (4) A 0 is returned iff no error occurs.
- * (5) The passed Vertex list not changed in any way.
- *
- * Implementation:
- *
- * A routine from the qvss device dependent code library from the
- * X version 10 sources written by DEC was used, abet slightly
- * modified as it provided 99% of the desired functionality.
- *
- */
-
-/*****************************************************************************/
-/* */
-/* WRITTEN BY DARYL F. HAZEL 8509.06 */
-/* */
-/* Modification history: */
-/* */
-/* Carver 8510.23 Fixed first time allocation of the coord buffer */
-/* to allocate max(200, pathcount) amount insted of just */
-/* 200. Potential Xserver crash problem. */
-/* */
-/* Carver 8510.21 Replaced old module by module worked on by Ram Rao and */
-/* Bob Scheifler to get better performace. */
-/* */
-/* Carver 8510.03 Changed the curve line converter to return the coord */
-/* path if a successor point does not exist for curve gen. */
-/* */
-/* Carver 8510.03 Fixed memory loss problem. A coord path is only */
-/* allocated if the current path will not fit in it and */
-/* before the new coord path is allocated the old one is */
-/* freed. */
-/* */
-/* Carver 8509.24 Fixed pointer/integer mismatch {*ppathaddr_new = ...} */
-/* */
-/* Corkum 8509.18 Modify code to intergrate into the draw curve command */
-/* */
-/* Modified by Mark Lillibridge 5/20/87 to make into */
-/* X11 Xlib XDraw() support. */
-/****************************************************************************/
-
-/*
- * Definitions:
- *
- */
-
-typedef short WORD;
-typedef short *WORD_POINTER;
-
-/*
- * Lookup tables, buffers used in the conversion:
- *
- */
-
-
-/*
- * modified path list storage information:
- */
-static Vertex *pathaddr_new = NULL; /*pointer to current modified path list*/
-static int pathlist_bytes = 0; /* size of modified path list in bytes */
-static int pathlist_segs = 0;/* size of modified path list in segments */
-static Vertex *pathaddr_coords = NULL; /*ptr to path list with coordinates */
-static int path_coord_list_bytes = 0; /* size of path list (w/coords) buff */
-static int path_coord_list_segs = 0; /* size of path list (w/coords) buff */
-
-/*
- * THE TABLE OF PSEUDO FLOATING-POINT NUMBERS WHICH MAKE UP THE
- * MULTIPLICATIVE COEFFICIENTS FOR THE CUBIC SPLINE ALGORITHM.
- */
-static unsigned short bntable[] = {
- 0xfc18, 0x7f97, 0x0476, 0xffde,
- 0xf8be, 0x7e5d, 0x0972, 0xff76,
- 0xf5f4, 0x7c56, 0x0eec, 0xfecc,
- 0xf3ba, 0x7988, 0x14da, 0xfde6,
- 0xf20b, 0x75fe, 0x1b2f, 0xfcca,
- 0xf0e2, 0x71c1, 0x21dd, 0xfb81,
- 0xf038, 0x6ce1, 0x28d3, 0xfa16,
- 0xf001, 0x676d, 0x3000, 0xf894,
- 0xf034, 0x6176, 0x3750, 0xf709,
- 0xf0c3, 0x5b0f, 0x3eae, 0xf583,
- 0xf1a1, 0x544b, 0x4605, 0xf410,
- 0xf2c0, 0x4d41, 0x4d41, 0xf2c0,
- 0xf410, 0x4605, 0x544b, 0xf1a1,
- 0xf583, 0x3eae, 0x5b0f, 0xf0c3,
- 0xf709, 0x3750, 0x6176, 0xf034,
- 0xf894, 0x3000, 0x676d, 0xf001,
- 0xfa16, 0x28d3, 0x6ce1, 0xf038,
- 0xfb81, 0x21dd, 0x71c1, 0xf0e2,
- 0xfcca, 0x1b2f, 0x75fe, 0xf20b,
- 0xfde6, 0x14da, 0x7988, 0xf3ba,
- 0xfecc, 0x0eec, 0x7c56, 0xf5f4,
- 0xff76, 0x0972, 0x7e5d, 0xf8be,
- 0xffde, 0x0476, 0x7f97, 0xfc18
- };
-
-/*
- * this is the table which determines how many straight-line segments to draw
- * for a given curved segment.
- */
-static short segtable[] = { 10, 3, 56, /* pl <= 10, 3 segments */
- 32, 4, 40, /* pl <= 32, 4 segments */
- 80, 6, 24, /* pl <= 80, 6 segments */
- 96, 8, 16, /* pl <= 96, 8 segments */
- 192, 12, 8, /* pl <= 192, 12 segments */
- 32767, 24, 00 /* pl <= 32767, 24 segments */
- };
-
-/*
- *
- * The Real routine:
- *
- */
-
-static int vertices_converter(pathaddr, pathcount, ppathaddr_new, newpathcnt)
- Vertex *pathaddr; /* address of original path list */
- int pathcount; /* number of points in original path list */
- Vertex **ppathaddr_new; /* ptr to addr of new path list */
- int *newpathcnt; /* ptr to new number of pts in path list */
-{
- int p0x, p0y; /* coordinates of curve's predecessor point */
- int p1x, p1y; /* coordinates of curve's starting point */
- int p2x, p2y; /* coordinates of curve's ending point */
- int p3x, p3y; /* coordinates of curve's successor point */
- int flag; /* flag word of current end-point in p.list */
- int successor_x = 0; /* X coordinate of curve's successor point */
- int successor_y = 0; /* Y coordinate of curve's successor point */
- int little_endian; /* stupid bntable is little-endian */
- WORD increment; /* bntable-ptr-increment value */
- WORD diffx, diffy; /* absolute values of x, y end-point diffs */
- WORD lmajoraxis; /* "length" of seg projected onto major axis */
- union /* accumulator variables for computing end-points... */
- { /* ...using the bntable. */
- struct
- {
- WORD low;
- WORD high;
- } sword;
- int lword;
- } xxe, yye;
- register Vertex *pnewpath;/* pointer for traversing modified path list */
- int newpathcount; /* number of end-points in modified path list*/
- register Vertex *pflag; /* pointer used for looking for fig's last pt*/
- int i; /* general-purpose loop variable */
- int ecf_flag_set; /* flag indicating existence of set ECF flag */
- int count;
- int curve_flag; /* 0 = no curves in path; 1 = curves in path */
-
- /*
- * The following is necessary because of the pseudo-floating point
- * calculations done down below.
- */
- i = 1;
- if (*(char *) &i)
- little_endian = 1;
- else
- little_endian = 0;
-
- {
- register Vertex *poldpath;/* pointer for traversing original path list */
- register Vertex *p_coord_path; /* ptr to path list with coordinates */
-
- /* Init the return path count to 0 in case of error */
- *newpathcnt = 0;
- newpathcount = 0;
-
- /* Use path buffers from last time */
- pnewpath = pathaddr_new;
- p_coord_path = pathaddr_coords;
-
- /*
- * if size of coordinate path list buffer is not at least large enough to
- * accommodate the specified path list, allocate enough memory to do so
- */
- if (path_coord_list_segs == 0) /* first time through*/
- {
- path_coord_list_segs = max (200, pathcount);
- path_coord_list_bytes = path_coord_list_segs * sizeof(Vertex);
- if ((pathaddr_coords = (Vertex *)Xmalloc(path_coord_list_bytes)) != 0)
- p_coord_path = pathaddr_coords;
- else
- return(ERR_RETURN);
- }
- else /* all but first time through */
- {
- /* If coord buffer is large enough for this path then reuse it, other
- wise free the old one and get a new one (Carver) 8510.03 */
- if (path_coord_list_segs < pathcount)
- {
- Xfree( pathaddr_coords);
- path_coord_list_segs = pathcount;
- path_coord_list_bytes = path_coord_list_segs * sizeof(Vertex);
- if ((pathaddr_coords =(Vertex *)Xmalloc(path_coord_list_bytes)) !=0)
- p_coord_path = pathaddr_coords;
- else
- return(ERR_RETURN);
- };
- }
-
- /*
- * Copy given Vertex list (pathaddr) to coordinate buffer converting
- * relative coordinates to absolute coordinates.
- *
- * Sets curve_flag iff at least one Vertex has the VertexCurved flag set.
- *
- */
-
- poldpath = pathaddr;
- curve_flag = 0;
-
- *p_coord_path = *poldpath++; /* First Vertex is a special case */
- p_coord_path->flags = (p_coord_path->flags | VertexDontDraw)
- & ~VertexRelative;
- if ((p_coord_path++)->flags & VertexCurved)
- curve_flag = 1;
- for (i = pathcount - 1; i > 0; i--)
- {
- if (poldpath->flags & VertexRelative)
- { /* compute coordinates using last pt */
- p_coord_path->x = poldpath->x + p_coord_path[-1].x;
- p_coord_path->y = poldpath->y + p_coord_path[-1].y;
- p_coord_path->flags = poldpath->flags & ~VertexRelative;
- }
- else *p_coord_path = *poldpath;
- p_coord_path++;
- if ((poldpath++)->flags & VertexCurved)
- curve_flag = 1;
- }
- } /* End of scope for poldaddr, p_coord_path */
-
- /*
- * if it has been determined that there are no curved segment end points in
- * the specified path list, return the path list containing the coordinates
- * to the calling routine.
- */
- if (!curve_flag)
- {
- *newpathcnt = pathcount;
- *ppathaddr_new = pathaddr_coords;
- return(OK_RETURN);
- }
-
- /*
- * if size of modified path list buffer is not at least large enough to
- * accommodate the specified path list allocate enough memory to do so
- */
- pathaddr = pathaddr_coords;
- if (pathlist_segs < pathcount)
- {
- if (pathlist_segs == 0) /* Fix storage leak -- MDL 5/20/87 */
- Xfree( pathaddr_new );
- pathlist_segs = pathcount;
- pathlist_bytes = pathcount * sizeof(Vertex);
- if ((pathaddr_new = (Vertex *)Xmalloc(pathlist_bytes)) != 0)
- pnewpath = pathaddr_new;
- else
- return(ERR_RETURN);
- }
-
- /*
- * initialize the beginning and ending coordinates of the first segment
- */
- p1x = 0;
- p1y = 0;
- p2x = 0;
- p2y = 0;
-
- {
- register WORD *pbntable; /* table of multiplicative coeffics.*/
- register WORD *psegtable; /* table used to detrmn num.sub-segs*/
- register WORD m; /* num segments into which curve is divided */
-
- /*
- * MAIN LOOP OF THE PATH_LIST_CONVERTER ROUTINE
- */
- for ( count=pathcount ; count > 0; count--)
- {
- p0x = p1x; /* save previous values of path-list coordinate pairs*/
- p0y = p1y;
- p1x = p2x;
- p1y = p2y;
-
- /*
- * read next end-point's coordinates from the path list
- */
- p2x = pathaddr->x;
- p2y = pathaddr->y;
- flag = (pathaddr++)->flags;
-
- /*
- * CURVED-segment considerations
- */
- if (flag & VertexCurved)
- {
- /*
- * determine which point to use as the successor point: the next
- * point in the list (if there is one), or a previously-saved point
- * (when drawing closed figures)
- */
- if (flag & VertexEndClosed) /* last segment of closed fig*/
- {
- p3x = successor_x;
- p3y = successor_y;
- }
- else /* stand-alone curved segment*/
- {
- if (count <= 1) /* no points to use as successor pt */
- {
-
- /* in this case draw the coord path */
- *newpathcnt = pathcount;
- *ppathaddr_new = pathaddr_coords;
- return(OK_RETURN);
- }
- else
- {
- /*
- * read next end-point's coordinates from the path list...
- */
- p3x = pathaddr->x;
- p3y = pathaddr->y;
-
- if (flag & VertexStartClosed)
- { /* first segment of closed figure */
- /*
- * save P3 as successor pt for closed-fig-ending curve
- */
- successor_x = p3x;
- successor_y = p3y;
-
- /*
- * Traverse the original path list looking for ECF flag
- * After finding it, back pointer up to previous point
- * and save the information for use as curve's pred. pt
- */
- ecf_flag_set = 0;
- pflag = pathaddr;
- for (i = count; i > 0; i--)
- {
- if (pflag->flags & VertexEndClosed)
- {
- pflag--;
- p1x = pflag->x;
- p1y = pflag->y;
- ecf_flag_set = 1;
- break;
- }
- pflag++;
- }
- if (!ecf_flag_set)
- return(ERR_RETURN);
- } /* end code pertaining to starting figure*/
- } /* end code pertaining to successor points */
- } /* end code pertaining to stand-alone curved segs*/
-
- if ((flag & VertexDontDraw) == 0)
- {
- /*
- * determine the "length" of the segment along the major axis
- */
- if ((diffx = p2x - p1x) < 0)
- diffx = ~diffx + 1;
- if ((diffy = p2y - p1y) < 0)
- diffy = ~diffy + 1;
- lmajoraxis = (diffx >= diffy) ? diffx : diffy;
- if (lmajoraxis == 0) /* for vector to have length of... */
- lmajoraxis = 1; /* ...at least one */
-
- /*
- * compute M, the number of sub-segments into which a curved
- * segment is divided
- */
- psegtable = segtable;
- while (lmajoraxis > *psegtable++)/* search for appropriate..*/
- psegtable += 2; /* ...table entry */
- m = *psegtable++; /* read number of segments */
- increment = *psegtable >> 1;
-
- /*
- * determine if there is enough room remaining in the modified
- * path-list buffer to hold ALL of the curve's sub-segment in-
- * formation; if not, double the buffer size (if possible).
- */
- while ((newpathcount + m) > pathlist_segs)
- {
- pathlist_segs *= 2;
- pathlist_bytes *= 2;
- if ((pathaddr_new = (Vertex *)Xrealloc(pathaddr_new,
- pathlist_bytes)) != 0)
- pnewpath = pathaddr_new + newpathcount;
- else
- return(ERR_RETURN);
- }
-
- /*
- * generate end-points of sub-segs into which curve is divided
- */
- pbntable = (WORD *) bntable; /* initialize the pointer to the Bn table*/
- for ( ; m > 1; m--)
- {
- pbntable += increment;
- xxe.lword = *pbntable * p0x;
- yye.lword = *pbntable++ * p0y;
- xxe.lword += *pbntable * p1x;
- yye.lword += *pbntable++ * p1y;
- xxe.lword += *pbntable * p2x;
- yye.lword += *pbntable++ * p2y;
- xxe.lword += *pbntable * p3x;
- yye.lword += *pbntable++ * p3y;
- xxe.lword = xxe.lword << 1; /* double values... */
- yye.lword = yye.lword << 1; /* ...bn accts for it*/
- xxe.lword += 0x8000; /* round off the accum value */
- yye.lword += 0x8000;
- if (little_endian) {
- pnewpath->x = xxe.sword.high;/* the X coordinate */
- pnewpath->y = yye.sword.high;/* the Y coordinate */
- } else {
- pnewpath->x = xxe.sword.low;/* the X coordinate */
- pnewpath->y = yye.sword.low;/* the Y coordinate */
- }
- (pnewpath++)->flags = 0; /* the flag word */
- newpathcount++;/* increment segment end-point countr*/
- } /* end sub-segment end-point compute loop*/
- } /* end DRAW-segment considerations code */
- } /* end CURVED-segment considerations code */
-
- /*
- * put end-point from original path list into modified list
- */
- pnewpath->x = p2x;
- pnewpath->y = p2y;
- (pnewpath++)->flags = flag & ~VertexCurved;
- newpathcount++;
-
- /*
- * determine whether or not the modified path list is full, and if so,
- * double its size
- */
- if (newpathcount == pathlist_segs)
- {
- pathlist_bytes *= 2;
- pathlist_segs *= 2;
- if ((pathaddr_new = (Vertex *)Xrealloc(pathaddr_new,
- pathlist_bytes)) != 0)
- pnewpath = pathaddr_new + newpathcount;
- else
- return(ERR_RETURN);
- }
- } /* END of PATH_LIST_CONVERTER's main loop */
-
- /*
- * return the address of the modified path list and the number of segment
- * end-points it contains
- */
- *newpathcnt = newpathcount;
- *ppathaddr_new = pathaddr_new;
- }
-
- return(OK_RETURN);
-}
-
-/* Written by Mark Lillibridge */
-
-static XPoint *XDraw_points = NULL; /* Buffer to hold list of points for */
-static int point_count = 0; /* use in calling XDrawLines */
-
-Status XDraw (dpy, d, gc, vlist, vcount)
- register Display *dpy;
- Drawable d;
- GC gc;
- Vertex *vlist;
- int vcount;
-{
- Vertex *newvlist;
- int newvcount;
- XPoint *p;
- int pcount;
-
- /* If less than 2 vertices, we don't have to do anything (no lines) */
- if (vcount<2)
- return(OK_RETURN);
-
- /* Convert curved lines to straight lines & change relative references to */
- /* absolute references. */
- if (!vertices_converter( vlist, vcount, &newvlist, &newvcount))
- return(ERR_RETURN);
-
- /* Insure we have enough buffer space */
- if (point_count < newvcount) {
- if (point_count != 0)
- Xfree( XDraw_points );
- if (!(XDraw_points = (XPoint *) Xmalloc( newvcount * sizeof(XPoint) )))
- return(ERR_RETURN);
- point_count = newvcount;
- }
-
- /*
- * Draw the lines defined by newvlist using seperate XDrawLines calls
- * to insure that all the lines that should be joined are and that closed
- * figures are joined correctly.
- */
- while (newvcount>0) {
- p = XDraw_points; /* Put points in buffer */
- pcount = 0;
- p->x = newvlist->x; /* Copy first point */
- (p++)->y = (newvlist++)->y;
- newvcount--; pcount++;
-
- /*
- * Copy more points until out of points or need to stop XDrawLine
- * because either we don't want to join to the next point
- * (VertexDontDraw) or we want to stop after the next point so that
- * a closed figure will be joined correctly. (We have to stop before
- * a VertexStartClosed because the vertex marked VertexStartClosed
- * must be the first vertex in its XDrawLines call to get joining
- * to work correctly.
- */
- while (newvcount > 0 && !(newvlist->flags & (VertexDontDraw |
- VertexStartClosed |
- VertexEndClosed))) {
- p->x = newvlist->x;
- (p++)->y = (newvlist++)->y;
- newvcount--; pcount++;
- }
-
- /*
- * If stopped only because of need to start a new XDrawLines, copy
- * next point but don't advance pointer so two XdrawLines act like one.
- */
- if ( newvcount > 0 && !(newvlist->flags & VertexDontDraw) ) {
- p->x = newvlist->x;
- (p++)->y = newvlist->y;
- pcount++;
- }
-
- /* Do the XDrawLines if there are any lines to draw */
- if (pcount>1)
- XDrawLines(dpy, d, gc, XDraw_points, pcount, CoordModeOrigin);
- }
-
- return(OK_RETURN);
-}
-
-Status XDrawFilled (dpy, d, gc, vlist, vcount)
- register Display *dpy;
- Drawable d;
- GC gc;
- Vertex *vlist;
- int vcount;
-{
- Vertex *newvlist;
- int newvcount;
- XPoint *p;
- int pcount;
-
- /* If less than 2 vertices, we don't have to do anything (no lines) */
- if (vcount<2)
- return(OK_RETURN);
-
- /* Convert curved lines to straight lines & change relative references to */
- /* absolute references. */
- if (!vertices_converter( vlist, vcount, &newvlist, &newvcount))
- return(ERR_RETURN);
-
- /* Insure we have enough buffer space */
- if (point_count < newvcount) {
- if (point_count != 0)
- Xfree( XDraw_points );
- if (!(XDraw_points = (XPoint *) Xmalloc( newvcount * sizeof(XPoint) )))
- return(ERR_RETURN);
- point_count = newvcount;
- }
-
- /*
- * Draw the lines defined by newvlist using seperate XDrawLines calls
- * to insure that all the lines that should be joined are and that closed
- * figures are joined correctly.
- */
- while (newvcount>0) {
- p = XDraw_points; /* Put points in buffer */
- pcount = 0;
- p->x = newvlist->x; /* Copy first point */
- (p++)->y = (newvlist++)->y;
- newvcount--; pcount++;
-
- /*
- * Copy more points until out of points or need to stop XDrawLine
- * because either we don't want to join to the next point
- * (VertexDontDraw) or we want to stop after the next point so that
- * a closed figure will be joined correctly. (We have to stop before
- * a VertexStartClosed because the vertex marked VertexStartClosed
- * must be the first vertex in its XDrawLines call to get joining
- * to work correctly.
- */
- while (newvcount > 0 && !(newvlist->flags & (VertexStartClosed |
- VertexEndClosed))) {
- p->x = newvlist->x;
- (p++)->y = (newvlist++)->y;
- newvcount--; pcount++;
- }
-
- /*
- * If stopped only because of need to start a new XDrawLines, copy
- * next point but don't advance pointer so two XdrawLines act like one.
- */
- if ( newvcount > 0 ) {
- p->x = newvlist->x;
- (p++)->y = newvlist->y;
- pcount++;
- }
-
- /* Do the XDrawLines if there are any lines to draw */
- if (pcount>1) {
- XFillPolygon(dpy, d, gc, XDraw_points, pcount, Complex,
- CoordModeOrigin);
- }
- }
-
- return(OK_RETURN);
-}
diff --git a/xc/lib/oldX/XLookAssoc.c b/xc/lib/oldX/XLookAssoc.c
deleted file mode 100644
index afae44287..000000000
--- a/xc/lib/oldX/XLookAssoc.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $TOG: XLookAssoc.c /main/7 1998/02/06 16:14:47 kaleb $ */
-/*
-
-Copyright 1985, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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 "Xlibint.h"
-#include "X10.h"
-
-/*
- * XLookUpAssoc - Retrieve the data stored in an XAssocTable by its XId.
- * If an appropriately matching XId can be found in the table the routine will
- * return apointer to the data associated with it. If the XId can not be found
- * in the table the routine will return a NULL pointer. All XId's are relative
- * to the currently active Display.
- */
-XPointer XLookUpAssoc(dpy, table, x_id)
- register Display *dpy;
- register XAssocTable *table; /* XAssocTable to search in. */
- register XID x_id; /* XId to search for. */
-{
- int hash;
- register XAssoc *bucket;
- register XAssoc *Entry;
-
- /* Hash the XId to get the bucket number. */
- hash = x_id & (table->size - 1);
- /* Look up the bucket to get the entries in that bucket. */
- bucket = &table->buckets[hash];
- /* Get the first entry in the bucket. */
- Entry = bucket->next;
-
- /* Scan through the entries in the bucket for the right XId. */
- for (; Entry != bucket; Entry = Entry->next) {
- if (Entry->x_id == x_id) {
- /* We have the right XId. */
- if (Entry->display == dpy) {
- /* We have the right display. */
- /* We have the right entry! */
- return(Entry->data);
- }
- /* Oops, identical XId's on different displays! */
- continue;
- }
- if (Entry->x_id > x_id) {
- /* We have gone past where it should be. */
- /* It is apparently not in the table. */
- return(NULL);
- }
- }
- /* It is apparently not in the table. */
- return(NULL);
-}
-
diff --git a/xc/lib/oldX/XMakeAssoc.c b/xc/lib/oldX/XMakeAssoc.c
deleted file mode 100644
index d4e32778f..000000000
--- a/xc/lib/oldX/XMakeAssoc.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* $TOG: XMakeAssoc.c /main/9 1998/02/06 16:14:52 kaleb $ */
-/*
-
-Copyright 1985, 1998 The Open Group.
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-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/lib/oldX/XMakeAssoc.c,v 1.2 1999/05/23 06:33:35 dawes Exp $ */
-
-#include "Xlibint.h"
-#include "X10.h"
-
-/*
- * XMakeAssoc - Insert data into an XAssocTable keyed on an XId.
- * Data is inserted into the table only once. Redundant inserts are
- * meaningless (but cause no problems). The queue in each association
- * bucket is sorted (lowest XId to highest XId).
- */
-int
-XMakeAssoc(dpy, table, x_id, data)
- register Display *dpy;
- register XAssocTable *table;
- register XID x_id;
- register XPointer data;
-{
- int hash;
- register XAssoc *bucket;
- register XAssoc *Entry;
- register XAssoc *new_entry;
-
- /* Hash the XId to get the bucket number. */
- hash = x_id & (table->size - 1);
- /* Look up the bucket to get the entries in that bucket. */
- bucket = &table->buckets[hash];
- /* Get the first entry in the bucket. */
- Entry = bucket->next;
-
- /* If (Entry != bucket), the bucket is empty so make */
- /* the new entry the first entry in the bucket. */
- /* if (Entry == bucket), the we have to search the */
- /* bucket. */
- if (Entry != bucket) {
- /* The bucket isn't empty, begin searching. */
- /* If we leave the for loop then we have either passed */
- /* where the entry should be or hit the end of the bucket. */
- /* In either case we should then insert the new entry */
- /* before the current value of "Entry". */
- for (; Entry != bucket; Entry = Entry->next) {
- if (Entry->x_id == x_id) {
- /* Entry has the same XId... */
- if (Entry->display == dpy) {
- /* Entry has the same Display... */
- /* Therefore there is already an */
- /* entry with this XId and Display, */
- /* reset its data value and return. */
- Entry->data = data;
- return 0;
- }
- /* We found an association with the right */
- /* id but the wrong display! */
- continue;
- }
- /* If the current entry's XId is greater than the */
- /* XId of the entry to be inserted then we have */
- /* passed the location where the new XId should */
- /* be inserted. */
- if (Entry->x_id > x_id) break;
- }
- }
-
- /* If we are here then the new entry should be inserted just */
- /* before the current value of "Entry". */
- /* Create a new XAssoc and load it with new provided data. */
- new_entry = (XAssoc *)Xmalloc(sizeof(XAssoc));
- if (new_entry == NULL) {
- /* Malloc failed! */
- errno = ENOMEM;
- _XIOError(dpy);
- }
- new_entry->display = dpy;
- new_entry->x_id = x_id;
- new_entry->data = data;
-
- /* Insert the new entry. */
- new_entry->prev = Entry->prev;
- new_entry->next = Entry;
- Entry->prev->next = new_entry;
- Entry->prev = new_entry;
- return 0;
-}
-
diff --git a/xc/lib/oldX/oldX-def.cpp b/xc/lib/oldX/oldX-def.cpp
deleted file mode 100644
index c793c23c2..000000000
--- a/xc/lib/oldX/oldX-def.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-LIBRARY OLDX
-VERSION LIBRARY_VERSION
-EXPORTS
- XDraw
- XDrawFilled
- XCreateAssocTable
- XDeleteAssoc
- XDestroyAssocTable
- XLookUpAssoc
- XMakeAssoc
-/* $XConsortium: oldX-def.cpp /main/2 1996/05/07 13:15:41 kaleb $ */
diff --git a/xc/lib/psres/Imakefile b/xc/lib/psres/Imakefile
deleted file mode 100644
index d387e336d..000000000
--- a/xc/lib/psres/Imakefile
+++ /dev/null
@@ -1,30 +0,0 @@
-XCOMM $XFree86: xc/lib/psres/Imakefile,v 1.3 2000/02/15 01:44:57 dawes Exp $
-
-#define DoNormalLib NormalLibPSRes
-#define DoSharedLib SharedLibPSRes
-#define DoExtraLib SharedLibPSRes
-#define DoDebugLib DebugLibPSRes
-#define DoProfileLib ProfileLibPSRes
-#define LibName psres
-#define SoRev SOPSRESREV
-#define LibHeaders NO
-
- PSWRAP = $(TOP)/config/pswrap/pswrap
-
-
-#if Malloc0ReturnsNull
- ALLOC_DEFS = -DMALLOC_0_RETURNS_NULL
-#else
- ALLOC_DEFS =
-#endif
-
- DEFINES = -DXENVIRONMENT $(ALLOC_DEFS)
-
-SRCS = PSres.c
-
-OBJS = PSres.o
-
-#include <Library.tmpl>
-
-DependTarget()
-
diff --git a/xc/lib/psres/PSres.c b/xc/lib/psres/PSres.c
deleted file mode 100644
index f9a38b121..000000000
--- a/xc/lib/psres/PSres.c
+++ /dev/null
@@ -1,1667 +0,0 @@
-/*
- * PSres.c
- *
- * (c) Copyright 1991-1994 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
- */
-
-#include <stdio.h>
-
-#ifdef XENVIRONMENT
-#include <X11/Xos.h>
-#else
-#include <string.h>
-#include <sys/types.h>
-#endif
-
-#define USE_POSIX
-
-#ifdef NeXT
-#undef USE_POSIX
-#endif /* NeXT */
-
-#ifdef USE_POSIX
-#include <dirent.h>
-#else
-#include <sys/dir.h>
-#endif
-
-#include <sys/stat.h>
-#include <DPS/PSres.h>
-
-#ifndef PSRES_NAME
-#define PSRES_NAME "PSres.upr"
-#endif /* PSRES_NAME */
-
-#ifndef PSRES_EXT
-#define PSRES_EXT ".upr"
-#endif /* PSRES_EXT */
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif /* SEEK_SET */
-
-void free();
-void *malloc();
-void *realloc();
-void exit();
-char *getenv();
-
-/* MT is the right pointer type to pass to memcpy, MST the size type */
-#define MT void *
-#define MST size_t
-
-#define MAXLEN 256
-typedef int (*ReadContentsFunction)();
-
-char *PSResFontOutline = "FontOutline",
- *PSResFontPrebuilt = "FontPrebuilt",
- *PSResFontAFM = "FontAFM",
- *PSResFontBDF = "FontBDF",
- *PSResFontFamily = "FontFamily",
- *PSResFontBDFSizes = "FontBDFSizes",
- *PSResForm = "Form",
- *PSResPattern = "Pattern",
- *PSResEncoding = "Encoding",
- *PSResProcSet = "ProcSet";
-
-typedef struct _ResourceNameStruct {
- char *name;
- char *file;
-} ResourceNameStruct, *ResourceName;
-
-typedef struct _ResourceTypeStruct {
- char *type;
- long fileOffset; /* -1 means not really in the file */
- ResourceName names;
- int nameCount;
- int filled; /* Whether has all names or just already found names */
- char *nameBuffer;
- char **oldNameBuffers;
- int oldNameCount;
-} ResourceTypeStruct, *ResourceType;
-
-typedef struct _ResourceDirectoryStruct {
- char *directory;
- ResourceType types;
- int typeCount;
- char *typeNameBuffer;
- char *filePrefix;
- long endOfHeader;
- int exclusive;
- struct _ResourceDirectoryStruct *next;
-} ResourceDirectoryStruct, *ResourceDirectory;
-
-typedef struct {
- char *type;
- char *name;
-} TypeName;
-
-typedef struct {
- PSResourceEnumerator func;
- char *type;
- char *name;
- char *private;
- int done;
-} EnumeratorStruct;
-
-static ResourceDirectory resDir = NULL, lastResDir;
-static char *savedPathOverride = NULL, *savedDefaultPath = NULL;
-static PSResourceSavePolicy currentPolicy = PSSaveByType;
-static int currentWillList;
-static char **currentResourceTypes = NULL;
-static char *resourceTypeBuffer = NULL;
-static time_t lastModifiedTime;
-static char nullStr = '\0';
-
-/* Wrappers */
-
-static char *mymalloc(size)
- int size;
-{
- char *ret;
-
-#ifdef XENVIRONMENT
-#ifdef MALLOC_0_RETURNS_NULL
- if (size < 1) size = 1;
-#endif
-#else
- if (size < 1) size = 1; /* Better safe than sorry */
-#endif
-
- ret = (char *) malloc((unsigned) size);
- if (ret != NULL) return ret;
- (void) fprintf(stderr, "malloc failed\n");
- exit(1);
- return NULL;
-}
-
-PSResMallocProc PSResMalloc = mymalloc;
-#define MALLOC (*PSResMalloc)
-
-static char *myrealloc(ptr, size)
- char *ptr;
- int size;
-{
- char *ret;
-
-#ifdef XENVIRONMENT
-#ifdef MALLOC_0_RETURNS_NULL
- if (size < 1) size = 1;
-#endif
-#else
- if (size < 1) size = 1; /* Better safe than sorry */
-#endif
-
- if (ptr == NULL) return MALLOC(size);
-#ifdef NO_VOID_STAR
- ret = (char *) realloc(ptr, (unsigned) size);
-#else
- ret = (char *) realloc((void *) ptr, (unsigned) size);
-#endif
- if (ret != NULL) return ret;
- (void) fprintf(stderr, "realloc failed\n");
- exit(1);
- return NULL;
-}
-
-PSResReallocProc PSResRealloc = myrealloc;
-#define REALLOC (*PSResRealloc)
-
-static void myfree(ptr)
- char *ptr;
-{
-#ifdef NO_VOID_STAR
- if (ptr != NULL) free(ptr);
-#else
- if (ptr != NULL) free((void *) ptr);
-#endif
-}
-
-PSResFreeProc PSResFree = myfree;
-#define FREE (*PSResFree)
-
-#define NewString(str) ((char *) strcpy(MALLOC((int) (strlen(str)+1)),(str)))
-
-static void FileWarningHandler(file, extraInfo)
- char *file;
- char *extraInfo;
-{
- fprintf(stderr,
- "Syntax error found in PostScript resource file %s:\n %s\n",
- file, extraInfo);
-}
-
-PSResFileWarningHandlerProc PSResFileWarningHandler = FileWarningHandler;
-
-/* Just like fgets, but strips trailing newline, eliminates trailing comments,
- skips trailing white space, skips blank lines, and chops lines longer
- than size */
-
-static char *myfgets(buf, size, f)
- char *buf;
- register int size;
- FILE *f;
-{
- register int ch;
- register int count = 0;
-
-#define STRIP_BLANKS \
- while (--count >= 0 && (buf[count] == ' ' || buf[count] == '\t')) \
- buf[count] = '\0';
-#define RETURN_BUF \
- if (buf[0] != '\0') return buf; \
- else return myfgets(buf, size, f);
-
- if (size == 0) return buf;
- size--;
-
- while (count < size) {
- ch = getc(f);
- if (ch == EOF) {
- buf[count] = '\0';
- STRIP_BLANKS;
- return NULL;
- }
- if (ch == '\n') {
- buf[count] = '\0';
- STRIP_BLANKS;
- RETURN_BUF;
- }
- if (ch == '%') { /* Comment */
- if (count == 0 || buf[count-1] != '\\') {
- buf[count] = '\0';
- do {
- ch = getc(f);
- } while (ch != EOF && ch != '\n');
- STRIP_BLANKS;
- if (ch == EOF) return NULL;
- else RETURN_BUF;
- }
- }
-
- buf[count] = ch;
- count++;
- }
-
- /* Overflow, flush */
- buf[count] = '\0';
- do {
- ch = getc(f);
- } while (ch != EOF && ch != '\n');
- STRIP_BLANKS;
- if (ch == EOF) return NULL;
- else RETURN_BUF;
-#undef RETURN_BUF
-#undef STRIP_BLANKS
-}
-
-static int Dequote(buf, dontDequote)
- char *buf;
- char dontDequote;
-{
- char *dst = buf, *src = buf;
-
- while (*src != '\0') {
- if (*src == '\\') {
- src++;
- if (*src == '\0') {
- *dst = '\0';
- return 1;
- } else if (*src == dontDequote) *dst++ = '\\';
- }
- *dst++ = *src++;
- }
- *dst = '\0';
- return 0;
-}
-
-/* Sep returns the first unquoted position of the break character. The
- dontDequote character only applies after the break character. If the
- separator character is doubled, doubleSep is set to 1 and only one
- of the separators is installed */
-
-static int DequoteAndBreak(buf, sep, bchar, dontDequote, doubleSep)
- char *buf;
- char **sep;
- char bchar;
- char dontDequote;
- int *doubleSep;
-{
- char *dst = buf, *src = buf;
-
- *doubleSep = 0;
- *sep = NULL;
-
- while (*src != '\0') {
- if (*src == '\\') {
- src++;
- if (*src == '\0') {
- *dst = '\0';
- return 1;
- } else if (*src == dontDequote && *sep != NULL) *dst++ = '\\';
- } else if (*sep == NULL && *src == bchar) {
- *sep = dst;
- if (*(src+1) == bchar) {
- src++;
- *doubleSep = 1;
- }
- }
- *dst++ = *src++;
- }
- *dst = '\0';
- return 0;
-}
-
-static float ParseVersion(f, excl)
- FILE *f;
- int *excl;
-{
- char inBuf[MAXLEN];
- float version = 0.0;
- int count;
-
- if (myfgets(inBuf, MAXLEN, f) == NULL) return 0.0;
-
- /* Compare against magic value */
-
- count = sscanf(inBuf, "PS-Resources-Exclusive-%f", &version);
- if (count == 1) {
- *excl = 1;
- return version;
- }
- count = sscanf(inBuf, "PS-Resources-%f", &version);
- if (count == 1) {
- *excl = 0;
- return version;
- }
- return 0.0;
-}
-
-static int ParseResourceTypes(f, dir)
- FILE *f;
- ResourceDirectory dir;
-{
- char inBuf[MAXLEN];
- char typebuf[MAXLEN];
- char *types = typebuf;
- int buflen = MAXLEN, typelen = 0, len;
- int count, i;
- int continued = 0, precontinued = 0;
-
- typebuf[0] = '\0';
- count = 0;
-
- while (1) {
- if (myfgets(inBuf, MAXLEN, f) == NULL) {
- if (types != typebuf) FREE((char *) types);
- return 1;
- }
- if (strcmp(inBuf, ".") == 0) break;
- precontinued = continued;
- continued = Dequote(inBuf, '\0');
-
- len = strlen(inBuf);
- if (typelen + len + 1 > buflen) {
- if (types == typebuf) {
- types = (char *) MALLOC(2*MAXLEN);
- (void) memcpy((MT) types, (MT) typebuf, (MST) typelen);
- } else types = REALLOC(types, buflen+MAXLEN);
- buflen += MAXLEN;
- }
-
- if (precontinued) typelen--; /* Write over previous \0 */
- else count++;
- (void) strncpy(&types[typelen], inBuf, len+1);
- typelen += len+1;
- }
-
- dir->typeCount = count;
- if (count == 0) dir->types = NULL;
- else {
- dir->types = (ResourceType)
- MALLOC((int) (count * sizeof(ResourceTypeStruct)));
- dir->typeNameBuffer = (char *) MALLOC(typelen);
- (void) memcpy((MT) dir->typeNameBuffer, (MT) types, (MST) typelen);
- }
-
- len = 0;
- for (i = 0; i < count; i++) {
- dir->types[i].type = &(dir->typeNameBuffer[len]);
- dir->types[i].fileOffset = 0;
- dir->types[i].names = NULL;
- dir->types[i].nameBuffer = NULL;
- dir->types[i].filled = 0;
- dir->types[i].oldNameBuffers = NULL;
- dir->types[i].oldNameCount = 0;
- dir->types[i].nameCount = 0;
- len += strlen(dir->types[i].type) + 1;
- }
-
- if (types != typebuf) FREE((char *) types);
- return 0;
-}
-
-static int ParseFilePrefix(f, dir, dirName)
- FILE *f;
- ResourceDirectory dir;
- char *dirName;
-{
- char inBuf[MAXLEN];
- int continued;
- int len;
- long savePos;
- char *prefix;
-
- dir->filePrefix = NULL;
-
- savePos = ftell(f);
- if (myfgets(inBuf, MAXLEN, f) == NULL) return 1;
-
- if (inBuf[0] != '/') {
- if (fseek(f, savePos, SEEK_SET) == -1) return 1;
- len = strlen(dirName);
- dir->filePrefix = strcpy((char *) MALLOC(len+2), dirName);
- dir->filePrefix[len] = '/';
- dir->filePrefix[len+1] = '\0';
- return 0;
- }
-
- continued = Dequote(inBuf, '\0');
- prefix = inBuf+1;
- len = strlen(prefix);
- dir->filePrefix = (char *) strcpy((char *) MALLOC(len+2), prefix);
- if (!continued) {
- dir->filePrefix[len] = '/';
- dir->filePrefix[len+1] = '\0';
- return 0;
- }
-
- while (1) {
- if (myfgets(inBuf, MAXLEN, f) == NULL) return 1;
- continued = Dequote(inBuf, '\0');
- len += strlen(inBuf);
- dir->filePrefix = (char *) REALLOC(dir->filePrefix, len+2);
- (void) strcat(dir->filePrefix, inBuf);
- if (!continued) {
- dir->filePrefix[len] = '/';
- dir->filePrefix[len+1] = '\0';
- return 0;
- }
- }
-}
-
-static ResourceDirectory ParseHeader(f, dirName, fileName)
- FILE *f;
- char *dirName, *fileName;
-{
- ResourceDirectory dir;
- float version;
- int exclusive;
-
- rewind(f);
-
- version = ParseVersion(f, &exclusive);
- if (version < 1.0) return NULL;
-
- dir = (ResourceDirectory) MALLOC(sizeof(ResourceDirectoryStruct));
- dir->directory = (char *) NewString(fileName);
- dir->exclusive = exclusive;
- dir->next = NULL;
-
- if (ParseResourceTypes(f, dir)) {
- FREE((char *) dir->directory);
- FREE((char *) dir);
- return NULL;
- }
-
- if (ParseFilePrefix(f, dir, dirName)) dir->endOfHeader = 0;
- else dir->endOfHeader = ftell(f);
-
- return dir;
-}
-
-/* Store away old name buffer so pointers to it do not become invalid */
-
-static void CacheOldNames(type)
- ResourceType type;
-{
- type->oldNameCount++;
- type->oldNameBuffers = (char **) REALLOC((char *) type->oldNameBuffers,
- type->oldNameCount);
- type->oldNameBuffers[type->oldNameCount-1] = type->nameBuffer;
- type->nameBuffer = NULL;
-}
-
-/* Verify that the name matches the name in the file */
-
-static int VerifyName(f, name)
- FILE *f;
- char *name;
-{
- char inBuf[MAXLEN];
- int continued = 0;
- int len;
- int start = 0;
-
- while (1) {
- if (myfgets(inBuf, MAXLEN, f) == NULL) return 1;
- continued = Dequote(inBuf, '\0');
- if (continued) {
- len = strlen(inBuf);
- if (strncmp(inBuf, &name[start], len) != 0) return 1;
- start += len;
- } else {
- if (strcmp(inBuf, &name[start]) != 0) return 1;
- else break;
- }
- }
- return 0;
-}
-
-static int LookupResourceInList(type, name)
- ResourceType type;
- char *name;
-{
- int i;
-
- for (i = 0; i < type->nameCount; i++) {
- if (strcmp(name, type->names[i].name) == 0) return 1;
- }
- return 0;
-}
-
-static int CheckInsertPrefix(type)
- char *type;
-{
- /* Insert the prefix unless one of these special values */
-
- if (strcmp(type, PSResFontFamily) == 0 ||
- strcmp(type, PSResFontBDFSizes) == 0 ||
- strcmp(type, "FontAxes") == 0 ||
- strcmp(type, "FontBlendMap") == 0 ||
- strcmp(type, "FontBlendPositions") == 0 ||
- strcmp(type, "mkpsresPrivate") == 0) return 0;
- return 1;
-}
-
-/* Returns a line, including continuations. Memory must be copied before
- calling this again. */
-
-static int linebuflen = 0;
-static char *inputline = NULL;
-
-static char *ReadFullLine(f)
- FILE *f;
-{
- char readbuf[MAXLEN];
- int start = 0;
- int len;
-
- while (1) {
- if (myfgets(readbuf, MAXLEN, f) == NULL) return NULL;
- len = strlen(readbuf);
- if (start + len + 1 > linebuflen) {
- linebuflen += MAXLEN + 1;
- inputline = REALLOC(inputline, linebuflen);
- }
- strncpy(inputline+start, readbuf, len+1);
-
- if (inputline[start+len-1] != '\\') break;
-
- start = start+len-1;
- }
- return inputline;
-}
-
-static FreeLineBuf()
-{
- if (inputline != NULL) FREE(inputline);
- inputline = NULL;
- linebuflen = 0;
-}
-
-/* Assumes being correctly positioned in the file */
-
-static int ReadResourceSection(f, dir, type, name)
- FILE *f;
- ResourceDirectory dir;
- ResourceType type;
- char *name; /* If NULL, enumerate */
-{
-#define GROW 1000
- char *linein;
- int start;
- int len;
- char namebuf[GROW];
- char *names = namebuf;
- int buflen = GROW, namelen = 0;
- int i, count = 0;
- char *sep;
- int prefixLen;
- int insertPrefix;
- char dontDequote;
- int doubleEquals;
- int addingPrefix;
- int newsize;
-
- if (type->nameBuffer != NULL) CacheOldNames(type);
-
- insertPrefix = CheckInsertPrefix(type->type);
- if (insertPrefix) {
- prefixLen = strlen(dir->filePrefix);
- dontDequote = '\0';
- } else {
- prefixLen = 0;
- dontDequote = ',';
- }
-
- while (1) {
- start = namelen;
-
- linein = ReadFullLine(f);
- if (linein == NULL) {
- if (names != namebuf) FREE((char *) names);
- FreeLineBuf();
- return 1;
- }
- if (strcmp(linein, ".") == 0) break;
-
- sep = NULL;
- (void) DequoteAndBreak(linein, &sep, '=', dontDequote, &doubleEquals);
-
- /* If no separator, a bogus line */
- if (sep == NULL) continue;
-
- /* Next line is UNIX specific! */
- addingPrefix = *(sep+1) != '/' && insertPrefix && !doubleEquals;
-
- len = strlen(linein) + 1 + (addingPrefix ? prefixLen : 0);
-
- if (namelen + len >= buflen) {
- newsize = buflen + GROW;
- if (namelen + len > newsize) newsize = namelen + len;
-
- if (names == namebuf) {
- names = (char *) MALLOC(newsize);
- (void) memcpy((MT) names, (MT) namebuf, (MST) namelen);
- } else names = REALLOC(names, newsize);
- buflen = newsize;
- }
-
- *sep = '\0';
- len = strlen(linein);
- (void) strncpy(&names[namelen], linein, len+1);
- namelen += len+1;
-
- if (addingPrefix) {
- (void) strncpy(&names[namelen], dir->filePrefix, prefixLen);
- namelen += prefixLen;
- }
-
- len = strlen(sep+1);
- (void) strncpy(&names[namelen], sep+1, len+1);
- namelen += len+1;
-
- if (name != NULL && strcmp(names, name) != 0) namelen = start;
- else count++;
- }
-
- type->nameCount = count;
- if (count == 0) type->names = NULL;
- else {
- type->names = (ResourceName)
- MALLOC((int) (count * sizeof(ResourceNameStruct)));
- type->nameBuffer = (char *) MALLOC(namelen);
- (void) memcpy((MT) type->nameBuffer, (MT) names, (MST) namelen);
- }
-
- len = 0;
- for (i = 0; i < count; i++) {
- type->names[i].name = &(type->nameBuffer[len]);
- len += strlen(type->names[i].name) + 1;
- type->names[i].file = &(type->nameBuffer[len]);
- len += strlen(type->names[i].file) + 1;
- }
-
- if (names != namebuf) FREE((char *) names);
- if (name == NULL) type->filled = 1;
- FreeLineBuf();
- return 0;
-
-#undef GROW
-}
-
-/* Assumes being correctly positioned in the file */
-
-static int SkipResourceSection(f, dir, type, checkName)
- FILE *f;
- ResourceDirectory dir;
- ResourceType type;
- int checkName;
-{
- char inBuf[MAXLEN];
- int i;
-
- /* If next type has offset, just go there */
-
- for (i = 0; i < dir->typeCount && dir->types + i != type; i++) {}
-
- if (dir->types + i == type) {
- for (i++; i < dir->typeCount; i++) {
- if (dir->types[i].fileOffset == -1) continue;
- if (dir->types[i].fileOffset > 0) {
- if (fseek(f, dir->types[i].fileOffset, SEEK_SET) != -1) {
- return 0;
- } else break;
- }
- }
- }
-
- if (checkName && VerifyName(f, type->type) != 0) return 1;
-
- while (1) {
- if (myfgets(inBuf, MAXLEN, f) == NULL) return 1;
- if (strcmp(inBuf, ".") == 0) return 0;
- }
-}
-
-/* Assumes being correctly positioned in the file */
-
-static int ParseResourceSection(f, dir, type, name, checkName)
- FILE *f;
- ResourceDirectory dir;
- ResourceType type;
- char *name; /* If NULL, enumerate */
- int checkName;
-{
- if (checkName && VerifyName(f, type->type) != 0) return 1;
-
- if (type->filled || (name != NULL && LookupResourceInList(type, name))) {
- return SkipResourceSection(f, dir, type, 0);
- }
-
- return ReadResourceSection(f, dir, type, name);
-}
-
-void FreePSResourceStorage(everything)
- int everything;
-{
- ResourceDirectory d;
- ResourceType t;
- int i, j;
-
- if (resDir == NULL) return;
-
- for (d = resDir; d != NULL; d = d->next) {
- for (i = 0; i < d->typeCount; i++) {
- t = d->types + i;
- FREE(t->nameBuffer);
- FREE((char *) t->names);
- t->nameCount = 0;
- for (j = 0; j < t->oldNameCount; j++) FREE(t->oldNameBuffers[j]);
- if (t->oldNameBuffers != NULL) FREE((char *) t->oldNameBuffers);
- t->oldNameCount = 0;
- t->nameCount = 0;
- t->filled = 0;
- }
- }
-
- if (!everything) return;
-
- while (resDir != NULL) {
- d = resDir->next;
- FREE(resDir->directory);
- FREE((char *) resDir->types);
- FREE(resDir->typeNameBuffer);
- FREE(resDir->filePrefix);
- FREE((char *) resDir);
- resDir = d;
- }
- lastResDir = NULL;
- FREE(savedPathOverride);
- savedPathOverride = NULL;
- FREE(savedDefaultPath);
- savedDefaultPath = NULL;
-}
-
-static ResourceDirectory ReadAndStoreFile(dir, name, len, readFunc, data)
- char *dir, *name;
- int len;
- ReadContentsFunction readFunc;
- char *data;
-{
- ResourceDirectory rd = NULL;
- FILE *f;
- char nameBuf[MAXLEN];
- char *fullName = nameBuf;
- int fullLen;
-
- fullLen = len + strlen(name) + 1;
- if (fullLen >= MAXLEN) fullName = MALLOC(fullLen+1);
- (void) strcpy(fullName, dir);
- fullName[len] = '/';
- (void) strcpy(fullName+len+1, name);
-
- f = fopen(fullName, "r");
- if (f != NULL) {
- rd = ParseHeader(f, dir, fullName);
-
- if (rd != NULL) {
- if (resDir == NULL) resDir = rd;
- else lastResDir->next = rd;
- lastResDir = rd;
- if (readFunc != NULL) (*readFunc) (f, rd, data);
- } else (*PSResFileWarningHandler)(fullName, "Malformed header");
- (void) fclose(f);
- }
- if (fullName != nameBuf) FREE(fullName);
- return rd;
-}
-
-static time_t ReadFilesInDirectory(dirName, readFunc, data)
- char *dirName;
- ReadContentsFunction readFunc;
- char *data;
-{
- DIR *dir;
-#ifdef USE_POSIX
- struct dirent *d;
-#else
- struct direct *d;
-#endif
- ResourceDirectory rd;
- int len = strlen(dirName);
- static int extensionLen = 0;
- struct stat buf;
- int namelen;
-
- if (extensionLen == 0) extensionLen = strlen(PSRES_EXT);
- if (stat(dirName, &buf) != 0) buf.st_mtime = 0;
-
- rd = ReadAndStoreFile(dirName, PSRES_NAME, len, readFunc, data);
-
- if (rd != 0 && rd->exclusive) return buf.st_mtime;
-
- dir = opendir(dirName);
- if (dir == NULL) return buf.st_mtime;
-
- while ((d = readdir(dir)) != NULL) {
- namelen = strlen(d->d_name);
- if (namelen < extensionLen) continue;
-
- if (strcmp(d->d_name + (namelen - extensionLen), PSRES_EXT) == 0
- && strcmp(d->d_name, PSRES_NAME) != 0) {
- (void) ReadAndStoreFile(dirName, d->d_name, len, readFunc, data);
- }
- }
- (void) closedir(dir);
- return buf.st_mtime;
-}
-
-/* Returns nonzero if current paths different from saved ones */
-
-static int SetUpSavedPaths(pathOverride, defaultPath)
- char *pathOverride;
- char *defaultPath;
-{
- if (pathOverride == NULL) pathOverride = &nullStr;
- if (defaultPath == NULL) defaultPath = &nullStr;
-
- if (savedPathOverride == NULL ||
- strcmp(pathOverride, savedPathOverride) != 0 ||
- strcmp(defaultPath, savedDefaultPath) != 0) {
-
- FreePSResourceStorage(1);
-
- savedPathOverride = NewString(pathOverride);
- savedDefaultPath = NewString(defaultPath);
-
- return 1;
- }
- return 0;
-}
-
-/* Like SetUpSavedPaths, but never affects saved state */
-
-static int CheckSavedPaths(pathOverride, defaultPath)
- char *pathOverride;
- char *defaultPath;
-{
- if (pathOverride == NULL) pathOverride = &nullStr;
- if (defaultPath == NULL) defaultPath = &nullStr;
-
- if (savedPathOverride == NULL ||
- strcmp(pathOverride, savedPathOverride) != 0 ||
- strcmp(defaultPath, savedDefaultPath) != 0) return 1;
- else return 0;
-}
-
-static time_t ReadFilesInPath(string, readFunc, data)
- char *string;
- ReadContentsFunction readFunc;
- char *data;
-{
- char *pathChar;
- char pathBuf[MAXLEN];
- char *path;
- register char *dir;
- int len;
- register char ch;
- time_t newTime, latestTime = 0;
-
- pathChar = string;
-
- if (*pathChar == ':') pathChar++;
-
- len = strlen(pathChar);
- if (len < MAXLEN) path = pathBuf;
- else path = MALLOC(len+1);
-
- do {
- dir = path;
- do {
- while (*pathChar == '\\') {
- pathChar++;
- if (*pathChar != '\0') *dir++ = *pathChar++;
- }
-
- *dir++ = ch = *pathChar++;
- } while (ch != '\0' && ch != ':');
- if (ch == ':') *(dir-1) = '\0';
-
- if (*path == '\0') {
- if (ch == ':' && string != savedDefaultPath) {
- newTime = ReadFilesInPath(savedDefaultPath, readFunc, data);
- if (newTime > latestTime) latestTime = newTime;
- }
- } else {
- newTime = ReadFilesInDirectory(path, readFunc, data);
- if (newTime > latestTime) latestTime = newTime;
- }
- } while (ch == ':');
- if (path != pathBuf) FREE(path);
- return latestTime;
-}
-
-static time_t MaxTimeInPath(string)
- char *string;
-{
- char *pathChar;
- char pathBuf[MAXLEN];
- char *path;
- register char *dir;
- int len;
- register char ch;
- time_t latestTime = 0;
- struct stat buf;
-
- pathChar = string;
-
- if (*pathChar == ':') pathChar++;
-
- len = strlen(pathChar);
- if (len < MAXLEN) path = pathBuf;
- else path = MALLOC(len+1);
-
- do {
- dir = path;
- do {
- while (*pathChar == '\\') {
- pathChar++;
- if (*pathChar != '\0') *dir++ = *pathChar++;
- }
-
- *dir++ = ch = *pathChar++;
- } while (ch != '\0' && ch != ':');
- if (ch == ':') *(dir-1) = '\0';
-
- if (*path == '\0') {
- if (ch == ':' && string != savedDefaultPath) {
- buf.st_mtime = MaxTimeInPath(savedDefaultPath);
- if (buf.st_mtime > latestTime) latestTime = buf.st_mtime;
- }
- } else {
- if (stat(path, &buf) != 0) buf.st_mtime = 0;
- if (buf.st_mtime > latestTime) latestTime = buf.st_mtime;
- }
- } while (ch == ':');
- if (path != pathBuf) FREE(path);
- return latestTime;
-}
-
-static char *GetPath()
-{
- static char defaultEnvironmentPath[] = "::";
- static char *environmentPath = NULL;
-
- if (savedPathOverride != NULL && *savedPathOverride != '\0') {
- return savedPathOverride;
- }
-
- if (environmentPath == NULL) {
- environmentPath = getenv("PSRESOURCEPATH");
- if (environmentPath == NULL) environmentPath = defaultEnvironmentPath;
- }
-
- return environmentPath;
-}
-
-void SetPSResourcePolicy(policy, willList, resourceTypes)
- PSResourceSavePolicy policy;
- int willList;
- char **resourceTypes;
-{
- currentPolicy = policy;
- currentWillList = willList;
-
- if (currentResourceTypes != NULL) FREE((char *) currentResourceTypes);
- if (resourceTypeBuffer != NULL) FREE((char *) resourceTypeBuffer);
-
- if (resourceTypes == NULL) {
- currentResourceTypes = NULL;
- resourceTypeBuffer = NULL;
- } else {
- int i = 0, len = 0;
- char **cp = resourceTypes;
-
- while (*cp != NULL) {
- i++;
- len += strlen(*cp) + 1;
- cp++;
- }
-
- currentResourceTypes =
- (char **) MALLOC((int) ((i+1) * sizeof(char *)));
- resourceTypeBuffer = MALLOC(len);
-
- len = 0;
- i = 0;
- cp = resourceTypes;
-
- while (*cp != NULL) {
- (void) strcpy(resourceTypeBuffer+len, *cp);
- currentResourceTypes[i++] = resourceTypeBuffer + len;
- len += strlen(*cp) + 1;
- cp++;
- }
- currentResourceTypes[i] = NULL;
- }
-}
-
-int InSavedList(type)
- char *type;
-{
- char **cp = currentResourceTypes;;
-
- if (cp == NULL) return 0;
-
- while (*cp != NULL) {
- if (strcmp(*cp++, type) == 0) return 1;
- }
- return 0;
-}
-
-/* ARGSUSED */
-static int ReadEverything(f, rd, data)
- FILE *f;
- ResourceDirectory rd;
- char *data;
-{
- int i;
- ResourceType t;
- long pos;
-
- /* We're at the start of the resource section; read all of them */
-
- for (i = 0; i < rd->typeCount; i++) {
- t = &rd->types[i];
-
- if (t->fileOffset == -1) continue; /* Not really there */
-
- if (t->fileOffset != 0 && fseek(f, t->fileOffset, SEEK_SET) != -1) {
- if (!t->filled) {
- if (ParseResourceSection(f, rd, t, (char *) NULL, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else {
- if (SkipResourceSection(f, rd, t, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- }
- continue;
- }
-
- pos = ftell(f);
- if (VerifyName(f, t->type) == 0) {
- t->fileOffset = pos;
- if (ParseResourceSection(f, rd, t, (char *) NULL, 0)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else {
- /* No resources of this type; try the next type */
- t->fileOffset = -1;
- if (fseek(f, pos, SEEK_SET)) {
- PSResFileWarningHandler(rd->directory,
- "File changed during execution");
- return 1;
- }
- }
- }
- return 0;
-}
-
-static int ReadType(f, rd, type)
- FILE *f;
- ResourceDirectory rd;
- char *type;
-{
- int i;
- ResourceType t;
- long pos;
-
- /* We're at the start of the resource section; read the sections that
- are in the cached type list or are the passed in type */
-
- for (i = 0; i < rd->typeCount; i++) {
- t = &rd->types[i];
-
- if (t->fileOffset == -1) continue; /* Not really there */
- if (t->fileOffset != 0 && fseek(f, t->fileOffset, SEEK_SET) != -1) {
- if (!t->filled &&
- (strcmp(t->type, type) == 0 || InSavedList(t->type))) {
- if (ParseResourceSection(f, rd, t, (char *) NULL, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else if (SkipResourceSection(f, rd, t, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- continue;
- }
-
- pos = ftell(f);
- if (VerifyName(f, t->type) == 0) {
- t->fileOffset = pos;
- if (strcmp(t->type, type) == 0 || InSavedList(t->type)) {
- if (ParseResourceSection(f, rd, t, (char *) NULL, 0)){
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else if (SkipResourceSection(f, rd, t, 0)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else {
- /* No resources of this type; try the next type */
- t->fileOffset = -1;
- if (fseek(f, pos, SEEK_SET) == -1) {
- PSResFileWarningHandler(rd->directory,
- "File changed during execution");
- return 1;
- }
- }
- }
- return 0;
-}
-
-static int ReadName(f, rd, data)
- FILE *f;
- ResourceDirectory rd;
- char *data;
-{
- TypeName *tn = (TypeName *) data;
- int i;
- ResourceType t;
- long pos;
-
- /* We're at the start of the resource section; read the name in the
- section for the passed in type */
-
- for (i = 0; i < rd->typeCount; i++) {
- t = &rd->types[i];
-
- if (t->fileOffset == -1) continue; /* Not really there */
- if (t->fileOffset != 0 && fseek(f, t->fileOffset, SEEK_SET)) {
- if (strcmp(t->type, tn->type) == 0) {
- if (ParseResourceSection(f, rd, t, tn->name, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else if (SkipResourceSection(f, rd, t, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- continue;
- }
-
- pos = ftell(f);
- if (VerifyName(f, t->type) == 0) {
- t->fileOffset = pos;
- if (fseek(f, pos, SEEK_SET) == -1) {
- PSResFileWarningHandler(rd->directory,
- "File changed during execution");
- return 1;
- }
- if (strcmp(t->type, tn->type) == 0) {
- if (ParseResourceSection(f, rd, t, tn->name, 0)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else if (SkipResourceSection(f, rd, t, 0)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- } else {
- /* No resources of this type; try the next type */
- t->fileOffset = -1;
- if (fseek(f, pos, SEEK_SET) == -1) {
- PSResFileWarningHandler(rd->directory,
- "File changed during execution");
- return 1;
- }
- }
- }
- return 0;
-}
-
-static void ReadHeadersAndData(resourceType, resourceName)
- char *resourceType;
- char *resourceName;
-{
- TypeName t;
-
- switch (currentPolicy) {
- case PSSaveEverything:
- lastModifiedTime =
- ReadFilesInPath(GetPath(), ReadEverything, (char *) NULL);
- break;
- case PSSaveByType:
- lastModifiedTime =
- ReadFilesInPath(GetPath(), ReadType, resourceType);
- break;
- case PSSaveReturnValues:
- t.type = resourceType;
- t.name = resourceName;
- lastModifiedTime =
- ReadFilesInPath(GetPath(), ReadName, (char *) &t);
- break;
- }
-}
-
-static void UpdateData(resourceType, resourceName)
- char *resourceType;
- char *resourceName;
-{
- ResourceDirectory rd;
- ResourceType rt;
- int i;
- FILE *f;
- TypeName tn;
-
- /* Make two passes; the first figures out if we're going to have to read
- the file to service this request. If we are, open the file and read
- in sections in the saved list (from SetPSResourcePolicy). If not
- just saving return values, make sure we read in everything
- in the section. */
-
- for (rd = resDir; rd != NULL; rd = rd->next) {
- f = NULL;
- for (i = 0; i < rd->typeCount; i++) {
- rt = rd->types + i;
- if (rt->filled) continue;
- if (strcmp(rt->type, resourceType) != 0) continue;
-
- if (resourceName != NULL &&
- LookupResourceInList(rt, resourceName)) continue;
-
- f = fopen(rd->directory, "r");
- break;
- }
- if (f == NULL) continue;
-
- /* Nuts, have to read the file */
-
- if (fseek(f, rd->endOfHeader, SEEK_SET) != -1) {
- switch (currentPolicy) {
- case PSSaveEverything:
- (void) ReadEverything(f, rd, (char *) NULL);
- break;
- case PSSaveByType:
- (void) ReadType(f, rd, resourceType);
- break;
- case PSSaveReturnValues:
- tn.type = resourceType;
- tn.name = resourceName;
- (void) ReadName(f, rd, (char *) &tn);
- break;
- }
- } else (*PSResFileWarningHandler)(rd->directory,
- "File changed during execution");
- (void) fclose(f);
- }
-}
-
-static int FindData(resourceType, resourceName,
- resourceNamesReturn, resourceFilesReturn)
- char *resourceType;
- char *resourceName;
- char ***resourceNamesReturn;
- char ***resourceFilesReturn;
-{
- ResourceDirectory rd;
- ResourceType rt;
- int i, j, k;
- int nameCount = 0;
- char **names, **files;
-
- /* Make two passes; first count, then set and return */
-
- for (rd = resDir; rd != NULL; rd = rd->next) {
- for (i = 0; i < rd->typeCount; i++) {
- rt = rd->types + i;
- if (strcmp(rt->type, resourceType) != 0) continue;
- if (resourceName == NULL) nameCount += rt->nameCount;
- else {
- for (j = 0; j < rt->nameCount; j++) {
- if (strcmp(rt->names[j].name, resourceName) == 0) {
- nameCount++;
- }
- }
- }
- }
- }
-
- if (nameCount == 0) return 0;
-
- names = (char **) MALLOC((int) (nameCount * sizeof(char *)));
- files = (char **) MALLOC((int) (nameCount * sizeof(char *)));
- k = 0;
-
- for (rd = resDir; rd != NULL; rd = rd->next) {
- for (i = 0; i < rd->typeCount; i++) {
- rt = rd->types + i;
- if (strcmp(rt->type, resourceType) != 0) continue;
- for (j = 0; j < rt->nameCount; j++) {
- if (resourceName == NULL ||
- strcmp(rt->names[j].name, resourceName) == 0) {
- names[k] = rt->names[j].name;
- files[k++] = rt->names[j].file;
- }
- }
- }
- }
-
- *resourceNamesReturn = names;
- *resourceFilesReturn = files;
- return nameCount;
-}
-
-extern int ListPSResourceFiles(psResourcePathOverride, defaultPath,
- resourceType, resourceName,
- resourceNamesReturn, resourceFilesReturn)
- char *psResourcePathOverride;
- char *defaultPath;
- char *resourceType;
- char *resourceName;
- char ***resourceNamesReturn;
- char ***resourceFilesReturn;
-{
- if (SetUpSavedPaths(psResourcePathOverride, defaultPath)) {
- ReadHeadersAndData(resourceType, resourceName);
- } else UpdateData(resourceType, resourceName);
- return FindData(resourceType, resourceName,
- resourceNamesReturn, resourceFilesReturn);
-}
-
-int ListPSResourceTypes(pathOverride, defaultPath, typesReturn)
- char *pathOverride;
- char *defaultPath;
- char ***typesReturn;
-{
-#define GROW 5
-#define START 15
- int typeCount = 0, i, j, typeBufSize = 0;
- ResourceDirectory d;
- register char **types = NULL;
- int sig;
- int *sigs = NULL;
- char *ch;
-
- if (SetUpSavedPaths(pathOverride, defaultPath)) {
- if (currentPolicy != PSSaveEverything) {
- lastModifiedTime =
- ReadFilesInPath(GetPath(), (ReadContentsFunction) NULL,
- (char *) NULL);
- } else lastModifiedTime =
- ReadFilesInPath(GetPath(), ReadEverything, (char *) NULL);
- }
-
- for (d = resDir; d != NULL; d = d->next) {
- for (i = 0; i < d->typeCount; i++) {
- for (sig = 0, ch = d->types[i].type; *ch != '\0'; sig += *ch++) {}
- for (j = 0; j < typeCount; j++) {
- if (sig == sigs[j] &&
- strcmp(types[j], d->types[i].type) == 0) break;
- }
- if (j >= typeCount) { /* Have to add */
- if (typeCount >= typeBufSize) {
- if (typeCount == 0) typeBufSize = START;
- else typeBufSize += GROW;
- types = (char **) REALLOC((char *) types,
- typeBufSize * sizeof(char *));
- sigs = (int *) REALLOC((char *) sigs,
- typeBufSize * sizeof(int));
- }
- types[typeCount] = d->types[i].type;
- sigs[typeCount++] = sig;
- }
- }
- }
-
- FREE((char *) sigs);
- *typesReturn = types;
- return typeCount;
-#undef START
-#undef GROW
-}
-
-/* Assumes being correctly positioned in the file */
-
-static int EnumerateResourceSection(f, dir, type, s, checkName)
- FILE *f;
- ResourceDirectory dir;
- ResourceType type;
- EnumeratorStruct *s;
- int checkName;
-{
-#define GROW 1000
- char *linein;
- int len;
- char namebuf[GROW];
- char *names = namebuf;
- int buflen = GROW, namelen = 0;
- char *sep;
- int prefixLen;
- int insertPrefix;
- char *file;
- char dontDequote;
- int doubleEquals;
- int addingPrefix;
-
- if (checkName && VerifyName(f, type->type) != 0) return 1;
-
- insertPrefix = CheckInsertPrefix(type->type);
- if (insertPrefix) {
- prefixLen = strlen(dir->filePrefix);
- dontDequote = '\0';
- } else {
- prefixLen = 0;
- dontDequote = ',';
- }
-
- while (1) {
- linein = ReadFullLine(f);
- if (linein == NULL) {
- if (names != namebuf) FREE((char *) names);
- FreeLineBuf();
- return 1;
- }
-
- if (strcmp(linein, ".") == 0) {
- if (names != namebuf) FREE((char *) names);
- FreeLineBuf();
- return 0;
- }
-
- sep = NULL;
- (void) DequoteAndBreak(linein, &sep, '=', dontDequote, &doubleEquals);
-
- /* If no separator, a bogus line */
- if (sep == NULL) continue;
-
- /* Next line is UNIX specific! */
- addingPrefix = *(sep+1) != '/' && insertPrefix && !doubleEquals;
-
- len = strlen(linein) + (addingPrefix ? 0 : prefixLen) + 1;
- if (len > buflen) {
- if (names != namebuf) FREE((char *) names);
- names = (char *) MALLOC(len);
- }
-
- *sep = '\0';
- len = strlen(linein);
- (void) strncpy(names, linein, len+1);
-
- namelen = len+1;
- file = &names[namelen];
-
- if (addingPrefix) {
- (void) strncpy(&names[namelen], dir->filePrefix, prefixLen);
- namelen += prefixLen;
- }
-
- len = strlen(sep+1);
- (void) strncpy(&names[namelen], sep+1, len+1);
-
- if (s->name == NULL || strcmp(names, s->name) == 0) {
- s->done = (*s->func) (s->type, names, file, s->private);
- if (s->done) {
- if (names != namebuf) FREE((char *) names);
- FreeLineBuf();
- return 0;
- }
- }
- }
-#undef GROW
-}
-
-static int Enumerate(f, rd, data)
- FILE *f;
- ResourceDirectory rd;
- char *data;
-{
- EnumeratorStruct *s = (EnumeratorStruct *) data;
- int i;
- ResourceType t;
- long pos;
-
- if (s->done) return 0;
-
- for (i = 0; i < rd->typeCount; i++) {
- t = &rd->types[i];
-
- if (t->fileOffset == -1) continue; /* Not really there */
- if (t->fileOffset != 0 && fseek(f, t->fileOffset, SEEK_SET) != -1) {
- if (strcmp(t->type, s->type) == 0) {
- if (EnumerateResourceSection(f, rd, t, s, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- if (s->done) return 0;;
- } else if (SkipResourceSection(f, rd, t, 1)) {
- char buf[256];
- sprintf(buf, "Trouble parsing resource type %s", t->type);
- PSResFileWarningHandler(rd->directory, buf);
- return 1;
- }
- continue;
- }
-
- pos = ftell(f);
- if (VerifyName(f, t->type) == 0) {
- t->fileOffset = pos;
- if (strcmp(t->type, s->type) == 0) {
- if (EnumerateResourceSection(f, rd, t, s, 0)) return 1;
- if (s->done) return 0;
- } else if (SkipResourceSection(f, rd, t, 0)) return 1;
- } else {
- /* No resources of this type; try the next type */
- t->fileOffset = -1;
- if (fseek(f, pos, SEEK_SET) == -1) return 1;
- }
- }
- return 0;
-}
-
-void EnumeratePSResourceFiles(pathOverride, defaultPath, resourceType,
- resourceName, enumerator, private)
- char *pathOverride;
- char *defaultPath;
- char *resourceType;
- char *resourceName;
- PSResourceEnumerator enumerator;
- char *private;
-{
- ResourceDirectory d;
- FILE *f;
- EnumeratorStruct s;
-
- s.func = enumerator;
- s.type = resourceType;
- s.name = resourceName;
- s.private = private;
- s.done = 0;
-
- if (SetUpSavedPaths(pathOverride, defaultPath)) {
- lastModifiedTime =
- ReadFilesInPath(GetPath(), Enumerate, (char *) &s);
- return;
- }
-
- for (d = resDir; d != NULL && !s.done; d = d->next) {
- f = fopen(d->directory, "r");
- if (f == NULL) continue;
- if (fseek(f, d->endOfHeader, SEEK_SET) != -1) {
- (void) Enumerate(f, d, (char *) &s);
- }
- (void) fclose(f);
- }
-}
-
-int CheckPSResourceTime(pathOverride, defaultPath)
- char *pathOverride;
- char *defaultPath;
-{
- if (CheckSavedPaths(pathOverride, defaultPath)) return 1;
- return MaxTimeInPath(GetPath()) > lastModifiedTime;
-}
diff --git a/xc/lib/psres/psres-def.cpp b/xc/lib/psres/psres-def.cpp
deleted file mode 100644
index e9f690f9d..000000000
--- a/xc/lib/psres/psres-def.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-LIBRARY psres
-VERSION LIBRARY_VERSION
-EXPORTS
-;TCheckPSResourceTime
-EnumeratePSResourceFiles
-InSavedList
-ListPSResourceFiles
-ListPSResourceTypes
-SetPSResourcePolicy
-
-/* $XFree86: xc/lib/psres/psres-def.cpp,v 1.1 2000/08/09 23:40:15 dawes Exp $ */
diff --git a/xc/lib/psres/psresos2.def b/xc/lib/psres/psresos2.def
deleted file mode 100644
index 27cbda37b..000000000
--- a/xc/lib/psres/psresos2.def
+++ /dev/null
@@ -1,29 +0,0 @@
-LIBRARY psres
-DESCRIPTION "@#XFREE86:4.0#@ $XFree86: xc/lib/psres/psresos2.def,v 1.1 2000/04/05 18:13:25 dawes Exp $"
-CODE
- PRELOAD
-DATA
- MULTIPLE NONSHARED
-STACKSIZE 32768
-EXPORTS
- CheckPSResourceTime @ 1
- EnumeratePSResourceFiles @ 2
- FreePSResourceStorage @ 3
- InSavedList @ 4
- ListPSResourceFiles @ 5
- ListPSResourceTypes @ 6
- PSResEncoding @ 7
- PSResFileWarningHandler @ 8
- PSResFontAFM @ 9
- PSResFontBDF @ 10
- PSResFontBDFSizes @ 11
- PSResFontFamily @ 12
- PSResFontOutline @ 13
- PSResFontPrebuilt @ 14
- PSResForm @ 15
- PSResFree @ 16
- PSResMalloc @ 17
- PSResPattern @ 18
- PSResProcSet @ 19
- PSResRealloc @ 20
- SetPSResourcePolicy @ 21
diff --git a/xc/lib/psres/psresos2.rsp b/xc/lib/psres/psresos2.rsp
deleted file mode 100644
index 58480af0f..000000000
--- a/xc/lib/psres/psresos2.rsp
+++ /dev/null
@@ -1,3 +0,0 @@
-PSres.obj /NOI /NOL /NOD /BAT
-psres.dll
-psres.map
diff --git a/xc/lib/xkbfile/Imakefile b/xc/lib/xkbfile/Imakefile
index 3c800a57f..7577296cd 100644
--- a/xc/lib/xkbfile/Imakefile
+++ b/xc/lib/xkbfile/Imakefile
@@ -1,5 +1,10 @@
-XCOMM $XConsortium: Imakefile /main/5 1996/09/28 16:49:56 rws $
-XCOMM $XFree86: xc/lib/xkbfile/Imakefile,v 3.2 1998/12/20 11:57:20 dawes Exp $
+XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:42 cpqbld Exp $
+
+
+
+
+XCOMM $XFree86: xc/lib/xkbfile/Imakefile,v 3.3 2001/01/17 19:43:39 dawes Exp $
+
#define DoNormalLib YES
#define DoSharedLib NO
#define DoExtraLib NO
@@ -11,6 +16,10 @@ XCOMM $XFree86: xc/lib/xkbfile/Imakefile,v 3.2 1998/12/20 11:57:20 dawes Exp $
#define IncSubdir X11
#define IncSubSubdir extensions
+#if !BuildXKBfilelib
+#define LibBuild NO
+#endif
+
SRCS = xkbtext.c xkbdraw.c xkbmisc.c xkbatom.c xkberrs.c \
cout.c xkbout.c xkmout.c \
xkmread.c srvmisc.c \
diff --git a/xc/lib/xkbui/Imakefile b/xc/lib/xkbui/Imakefile
deleted file mode 100644
index 725d11eed..000000000
--- a/xc/lib/xkbui/Imakefile
+++ /dev/null
@@ -1,20 +0,0 @@
-XCOMM $XConsortium: Imakefile /main/1 1995/11/30 19:00:42 kaleb $
-XCOMM $XFree86: xc/lib/xkbui/Imakefile,v 3.3 1999/03/14 03:21:21 dawes Exp $
-#define DoNormalLib YES
-#define DoSharedLib NO
-#define DoExtraLib NO
-#define DoDebugLib NO
-#define DoProfileLib NO
-#define HasSharedData NO
-#define LibName xkbui
-#define SoRev SOXKBFILEREV
-#define IncSubdir X11
-#define IncSubSubdir extensions
- SRCS = XKBui.c
- OBJS = XKBui.o
- HEADERS = XKBui.h
- INCLUDES = -I. -I$(EXTINCSRC) -I../xkbfile
-
-#include <Library.tmpl>
-
-DependTarget()
diff --git a/xc/lib/xkbui/XKBui.c b/xc/lib/xkbui/XKBui.c
deleted file mode 100644
index 9dc755310..000000000
--- a/xc/lib/xkbui/XKBui.c
+++ /dev/null
@@ -1,836 +0,0 @@
-/* $XConsortium: XKBui.c /main/2 1995/12/07 21:18:19 kaleb $ */
-/************************************************************
- Copyright (c) 1996 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/lib/xkbui/XKBui.c,v 3.6 1999/06/20 07:14:08 dawes Exp $ */
-
-#include <X11/Xos.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#if defined(SVR4) && defined(i386) && !defined(_XOPEN_SOURCE)
-# define _XOPEN_SOURCE
-# include <math.h>
-# undef _XOPEN_SOURCE
-#else
-# include <math.h>
-#endif /* _XOPEN_SOURCE */
-
-#include <X11/Xfuncs.h>
-#include "XKBuiPriv.h"
-#include "XKBfileInt.h"
-#include <X11/extensions/XKBfile.h>
-
-#ifndef M_PI
-# define M_PI 3.141592653589793238462
-#endif
-
-static XkbUI_ViewOptsRec dfltOpts = {
- XkbUI_AllViewOptsMask /* present */,
- 1 /* fg */,
- 0 /* bg */,
- XkbUI_KeyNames /* label_mode */,
- 0 /* color_mode */,
- {
- 0 /* viewport.x */,
- 0 /* viewport.y */,
- 640 /* viewport.width */,
- 480 /* viewport.height */
- },
- 10, 10, /* margin_width, margin_height */
- None
-};
-
-XkbUI_ViewPtr
-#if NeedFunctionPrototypes
-XkbUI_SimpleInit(Display *dpy,Window win,int width,int height)
-#else
-XkbUI_SimpleInit(dpy,win,width,height)
- Display * dpy;
- Window win;
- int width;
- int height;
-#endif
-{
-XkbDescPtr xkb;
-
- if ((!dpy)||(win==None)||(width<1)||(height<1))
- return NULL;
- xkb= XkbGetKeyboard(dpy,XkbGBN_AllComponentsMask,XkbUseCoreKbd);
- if (!xkb)
- return NULL;
- return XkbUI_Init(dpy,win,width,height,xkb,NULL);
-}
-
-static void
-#if NeedFunctionPrototypes
-_XkbUI_AllocateColors(XkbUI_ViewPtr view)
-#else
-_XkbUI_AllocateColors(view)
- XkbUI_ViewPtr view;
-#endif
-{
-register int i;
-Display * dpy;
-XColor sdef,xdef;
-XkbDescPtr xkb;
-
- dpy= view->dpy;
- xkb= view->xkb;
- if (view->opts.cmap==None)
- view->opts.cmap= DefaultColormap(dpy,DefaultScreen(dpy));
- for (i=0;i<xkb->geom->num_colors;i++) {
- char *spec;
- Bool found;
-
- spec= xkb->geom->colors[i].spec;
- found= False;
- if (XAllocNamedColor(view->dpy,view->opts.cmap,spec,&sdef,&xdef)) {
- xkb->geom->colors[i].pixel= sdef.pixel;
-#ifdef DEBUG
- fprintf(stderr,"got pixel %d for \"%s\"\n",sdef.pixel,spec);
-#endif
- found= True;
- }
- if ((!found)&&(XkbLookupCanonicalRGBColor(spec,&sdef))) {
- char buf[20];
- sprintf(buf,"#%02x%02x%02x",(sdef.red>>8)&0xff,
- (sdef.green>>8)&0xff,
- (sdef.blue>>8)&&0xff);
- if (XAllocNamedColor(view->dpy,view->opts.cmap,buf,&sdef,&xdef)) {
- xkb->geom->colors[i].pixel= sdef.pixel;
-#ifdef DEBUG
- fprintf(stderr,"got pixel %d for \"%s\"\n",sdef.pixel,spec);
-#endif
- found= True;
- }
- }
- if (!found) {
- xkb->geom->colors[i].pixel= view->opts.fg;
- fprintf(stderr,"Couldn't allocate color \"%s\"\n",spec);
- }
- }
- return;
-}
-
-XkbUI_ViewPtr
-#if NeedFunctionPrototypes
-XkbUI_Init( Display * dpy,
- Window win,
- int width,
- int height,
- XkbDescPtr xkb,
- XkbUI_ViewOptsPtr opts)
-#else
-XkbUI_Init(dpy,win,width,height,xkb,opts)
- Display * dpy;
- Window win;
- int width;
- int height;
- XkbDescPtr xkb;
- XkbUI_ViewOptsPtr opts;
-#endif
-{
-XGCValues xgcv;
-XkbUI_ViewPtr view;
-int scrn;
-
- if ((!dpy)||(!xkb)||(!xkb->geom)||(win==None)||(width<1)||(height<1))
- return NULL;
- view= _XkbTypedCalloc(1,XkbUI_ViewRec);
- if (!view)
- return NULL;
- scrn= DefaultScreen(dpy);
- view->dpy= dpy;
- view->xkb= xkb;
- view->win= win;
- view->opts= dfltOpts;
- view->opts.fg= WhitePixel(dpy,scrn);
- view->opts.bg= BlackPixel(dpy,scrn);
- view->opts.viewport.x= 0;
- view->opts.viewport.y= 0;
- view->opts.viewport.width= width;
- view->opts.viewport.height= height;
- if ((opts)&&(opts->present)) {
- if (opts->present&XkbUI_BackgroundMask)
- view->opts.bg= opts->bg;
- if (opts->present&XkbUI_ForegroundMask)
- view->opts.fg= opts->fg;
- if (opts->present&XkbUI_LabelModeMask)
- view->opts.label_mode= opts->label_mode;
- if (opts->present&XkbUI_ColorModeMask)
- view->opts.color_mode= opts->color_mode;
- if (opts->present&XkbUI_WidthMask)
- view->opts.viewport.width= opts->viewport.width;
- if (opts->present&XkbUI_HeightMask)
- view->opts.viewport.height= opts->viewport.height;
- if (opts->present&XkbUI_XOffsetMask)
- view->opts.viewport.x= opts->viewport.x;
- if (opts->present&XkbUI_YOffsetMask)
- view->opts.viewport.y= opts->viewport.y;
- if (opts->present&XkbUI_MarginWidthMask)
- view->opts.margin_width= opts->margin_width;
- if (opts->present&XkbUI_MarginHeightMask)
- view->opts.margin_height= opts->margin_height;
- if (opts->present&XkbUI_ColormapMask)
- view->opts.cmap= opts->cmap;
- }
- view->canvas_width= width+(2*view->opts.margin_width);
- view->canvas_height= height+(2*view->opts.margin_height);
- if (view->opts.viewport.width>view->canvas_width) {
- int tmp;
- tmp= (view->opts.viewport.width-view->canvas_width)/2;
- view->opts.margin_width+= tmp;
- }
- if (view->opts.viewport.height>view->canvas_height) {
- int tmp;
- tmp= (view->opts.viewport.height-view->canvas_height)/2;
- view->opts.margin_height+= tmp;
- }
- bzero(view->state,XkbMaxLegalKeyCode+1);
-
- xgcv.foreground= view->opts.fg;
- xgcv.background= view->opts.bg;
- view->gc= XCreateGC(view->dpy,view->win,GCForeground|GCBackground,&xgcv);
- view->xscale= ((double)width)/((double)xkb->geom->width_mm);
- view->yscale= ((double)height)/((double)xkb->geom->height_mm);
-
- _XkbUI_AllocateColors(view);
- return view;
-}
-
-Status
-#if NeedFunctionPrototypes
-XkbUI_SetViewOpts(XkbUI_ViewPtr view,XkbUI_ViewOptsPtr opts)
-#else
-XkbUI_SetViewOpts(view,opts)
- XkbUI_ViewPtr view;
- XkbUI_ViewOptsPtr opts;
-#endif
-{
- if ((!view)||(!opts))
- return BadValue;
- if (opts->present==0)
- return Success;
- if (opts->present&XkbUI_BackgroundMask)
- view->opts.bg= opts->bg;
- if (opts->present&XkbUI_ForegroundMask)
- view->opts.fg= opts->fg;
- if (opts->present&XkbUI_LabelModeMask)
- view->opts.label_mode= opts->label_mode;
- if (opts->present&XkbUI_ColorModeMask)
- view->opts.color_mode= opts->color_mode;
- if (opts->present&XkbUI_WidthMask)
- view->opts.viewport.width= opts->viewport.width;
- if (opts->present&XkbUI_HeightMask)
- view->opts.viewport.height= opts->viewport.height;
- if (opts->present&XkbUI_XOffsetMask)
- view->opts.viewport.x= opts->viewport.x;
- if (opts->present&XkbUI_YOffsetMask)
- view->opts.viewport.y= opts->viewport.y;
- if (opts->present&XkbUI_MarginWidthMask)
- view->opts.margin_width= opts->margin_width;
- if (opts->present&XkbUI_MarginHeightMask)
- view->opts.margin_height= opts->margin_height;
- if (opts->present&XkbUI_ColormapMask) {
- view->opts.cmap= opts->cmap;
- _XkbUI_AllocateColors(view);
- }
- return Success;
-}
-
-Status
-#if NeedFunctionPrototypes
-XbUI_GetViewOpts(XkbUI_ViewPtr view,XkbUI_ViewOptsPtr opts_rtrn)
-#else
-XbUI_GetViewOpts(view,opts_rtrn)
- XkbUI_ViewPtr view;
- XkbUI_ViewOptsPtr opts_rtrn;
-#endif
-{
- if ((!view)||(!opts_rtrn))
- return BadValue;
- *opts_rtrn= view->opts;
- return Success;
-}
-
-Status
-#if NeedFunctionPrototypes
-XkbUI_SetCanvasSize(XkbUI_ViewPtr view,int width,int height)
-#else
-XkbUI_SetCanvasSize(view,width,height)
- XkbUI_Viewtr view;
- int width;
- int height;
-#endif
-{
- if ((!view)||(!view->xkb)||(!view->xkb->geom))
- return BadValue;
- view->canvas_width= width;
- view->canvas_height= height;
- view->xscale= ((double)width)/((double)view->xkb->geom->width_mm);
- view->yscale= ((double)height)/((double)view->xkb->geom->height_mm);
- return Success;
-}
-
-Status
-#if NeedFunctionPrototypes
-XkbUI_GetCanvasSize(XkbUI_ViewPtr view,int *width_rtrn,int *height_rtrn)
-#else
-XkbUI_GetCanvasSize(view,width_rtrn,height_rtrn)
- XkbUI_ViewPtr view;
- int * width_rtrn;
- int * height_rtrn;
-#endif
-{
- if (!view)
- return BadValue;
- if (width_rtrn) *width_rtrn= view->canvas_width;
- if (height_rtrn) *height_rtrn= view->canvas_height;
- return Success;
-}
-
-/***====================================================================***/
-
-static void
-#if NeedFunctionPrototypes
-_RotatePoints( double rangle,
- int corner_x,
- int corner_y,
- int nPts,
- XkbUI_PointPtr pts)
-#else
-_RotatePoints(rangle,corner_x,corner_y,nPts,pts)
- double rangle;
- int corner_x;
- int corner_y;
- int nPts;
- XkbUI_PointPtr pts;
-#endif
-{
-register int i;
-double rr,rx,ry,rt;
-
- for (i=0;i<nPts;i++,pts++) {
- rx= pts->x-corner_x; ry= pts->y-corner_y; /* translate */
- rr= hypot(rx,ry);
- rt= atan2(ry,rx)+rangle;
- rx= rr*cos(rt);
- ry= rr*sin(rt);
- pts->x= rx+corner_x; pts->y= ry+corner_y;
- }
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawPoints(XkbUI_ViewPtr view,int nPts,XkbUI_PointPtr pts,XPoint *xpts)
-#else
-_DrawPoints(view,nPts,pts)
- XkbUI_ViewPtr view;
- int nPts;
- XkbUI_PointPtr pts;
- XPoint * xpts;
-#endif
-{
-register int i;
-
- for (i=0;i<nPts;i++) {
- if (pts[i].x>=0.0) xpts[i].x= pts[i].x*view->xscale+0.5;
- else xpts[i].x= pts[i].x*view->xscale-0.5;
- xpts[i].x+= view->opts.viewport.x;
- if (pts[i].y>=0.0) xpts[i].y= pts[i].y*view->yscale+0.5;
- else xpts[i].x= pts[i].y*view->yscale-0.5;
- xpts[i].y+= view->opts.viewport.y;
- }
- if ((xpts[nPts-1].x!=xpts[0].x)||(xpts[nPts-1].y!=xpts[0].y))
- xpts[nPts++]= xpts[0]; /* close the shape, if necessary */
- XDrawLines(view->dpy,view->win,view->gc,xpts,nPts,CoordModeOrigin);
-XFlush(view->dpy);
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawSolidPoints(XkbUI_ViewPtr view,int nPts,XkbUI_PointPtr pts,XPoint *xpts)
-#else
-_DrawSolidPoints(view,nPts,pts)
- XkbUI_ViewPtr view;
- int nPts;
- XkbUI_PointPtr pts;
- XPoint * xpts;
-#endif
-{
-register int i;
-
- for (i=0;i<nPts;i++) {
- if (pts[i].x>=0.0) xpts[i].x= pts[i].x*view->xscale+0.5;
- else xpts[i].x= pts[i].x*view->xscale-0.5;
- xpts[i].x+= view->opts.viewport.x;
- if (pts[i].y>=0.0) xpts[i].y= pts[i].y*view->yscale+0.5;
- else xpts[i].x= pts[i].y*view->yscale-0.5;
- xpts[i].y+= view->opts.viewport.y;
- }
- if ((xpts[nPts-1].x!=xpts[0].x)||(xpts[nPts-1].y!=xpts[0].y))
- xpts[nPts++]= xpts[0]; /* close the shape, if necessary */
- XFillPolygon(view->dpy,view->win,view->gc,xpts,nPts,Nonconvex,
- CoordModeOrigin);
-XFlush(view->dpy);
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawShape( XkbUI_ViewPtr view,
- double rangle,
- int xoff,
- int yoff,
- int rotx,
- int roty,
- XkbShapePtr shape,
- Bool key)
-#else
-_DrawShape(view,rangle,xoff,yoff,rotx,roty,shape,key)
- XkbUI_ViewPtr view;
- double rangle;
- int xoff;
- int yoff;
- int rotx;
- int roty;
- XkbShapePtr shape;
- Bool key;
-#endif
-{
-XkbOutlinePtr ol;
-register int o;
-int maxPts;
-XkbUI_PointPtr uipts;
-XPoint * xpts;
-
- for (maxPts=4,o=0,ol=shape->outlines;o<shape->num_outlines;o++,ol++) {
- if ((shape->num_outlines>1)&&(ol==shape->approx))
- continue;
- if (ol->num_points>maxPts)
- maxPts= ol->num_points;
- }
- uipts= _XkbTypedCalloc(maxPts,XkbUI_PointRec);
- xpts= _XkbTypedCalloc(maxPts+1,XPoint);
- XSetForeground(view->dpy,view->gc,view->xkb->geom->label_color->pixel);
- for (o=0,ol=shape->outlines;o<shape->num_outlines;o++,ol++) {
- XkbPointPtr gpts;
- register int p;
- if ((shape->num_outlines>1)&&(ol==shape->approx))
- continue;
- gpts= ol->points;
- if (ol->num_points==1) {
- uipts[0].x= xoff; uipts[0].y= yoff;
- uipts[1].x= xoff+gpts[0].x; uipts[1].y= yoff;
- uipts[2].x= xoff+gpts[0].x; uipts[2].y= yoff+gpts[0].y;
- uipts[3].x= xoff; uipts[3].y= yoff+gpts[0].y;
- p= 4;
- }
- else if (ol->num_points==2) {
- uipts[0].x= xoff+gpts[0].x; uipts[0].y= yoff+gpts[0].y;
- uipts[1].x= xoff+gpts[1].x; uipts[1].y= yoff+gpts[0].y;
- uipts[2].x= xoff+gpts[1].x; uipts[2].y= yoff+gpts[1].y;
- uipts[3].x= xoff+gpts[0].x; uipts[3].y= yoff+gpts[1].y;
- p= 4;
- }
- else {
- for (p=0;p<ol->num_points;p++) {
- uipts[p].x= xoff+gpts[p].x;
- uipts[p].y= yoff+gpts[p].y;
- }
- p= ol->num_points;
- }
- if (rangle!=0.0)
- _RotatePoints(rangle,rotx,roty,p,uipts);
- if (key) {
- if (o==0) {
- XSetForeground(view->dpy,view->gc,
- view->xkb->geom->base_color->pixel);
- _DrawSolidPoints(view,p,uipts,xpts);
- XSetForeground(view->dpy,view->gc,
- view->xkb->geom->label_color->pixel);
- }
- _DrawPoints(view,p,uipts,xpts);
- }
- else {
- _DrawPoints(view,p,uipts,xpts);
- }
- }
- _XkbFree(uipts);
- _XkbFree(xpts);
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawRect( XkbUI_ViewPtr view,
- double rangle,
- int x1,
- int y1,
- int x2,
- int y2,
- Bool key)
-#else
-_DrawRect(view,rangle,x1,y1,x2,y2,key)
- XkbUI_ViewPtr view;
- double rangle;
- int x1;
- int y1;
- int x2;
- int y2;
- Bool key;
-#endif
-{
-XkbUI_PointRec uipts[4];
-XPoint xpts[4];
-
- XSetForeground(view->dpy,view->gc,view->xkb->geom->label_color->pixel);
- uipts[0].x= x1; uipts[0].y= y1;
- uipts[1].x= x2; uipts[1].y= y1;
- uipts[2].x= x2; uipts[2].y= y2;
- uipts[3].x= x1; uipts[3].y= y2;
- if (rangle!=0.0)
- _RotatePoints(rangle,0,0,4,uipts);
- if (key) {
- XSetForeground(view->dpy,view->gc,view->xkb->geom->base_color->pixel);
- _DrawSolidPoints(view,4,uipts,xpts);
- XSetForeground(view->dpy,view->gc,view->xkb->geom->label_color->pixel);
- _DrawPoints(view,4,uipts,xpts);
- }
- else {
- _DrawPoints(view,4,uipts,xpts);
- }
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawDoodad( XkbUI_ViewPtr view,
- double rangle,
- int xoff,
- int yoff,
- XkbDoodadPtr doodad)
-#else
-_DrawDoodad(view,rangle,xoff,yoff,doodad)
- XkbUI_ViewPtr view;
- double rangle;
- int xoff;
- int yoff;
- XkbDoodadPtr doodad;
-#endif
-{
-int x;
-int y;
-XkbShapePtr shape;
-Bool solid;
-
- x= doodad->any.left+xoff;
- y= doodad->any.top+yoff;
- shape= NULL;
- solid= False;
- switch (doodad->any.type) {
- case XkbOutlineDoodad:
- shape= XkbShapeDoodadShape(view->xkb->geom,(&doodad->shape));
- break;
- case XkbSolidDoodad:
- shape= XkbShapeDoodadShape(view->xkb->geom,(&doodad->shape));
- solid= True;
- break;
- case XkbTextDoodad:
- break;
- case XkbIndicatorDoodad:
- shape= XkbIndicatorDoodadShape(view->xkb->geom,&doodad->indicator);
- solid= True;
- break;
- case XkbLogoDoodad:
- shape= XkbLogoDoodadShape(view->xkb->geom,&doodad->logo);
- solid= True;
- break;
- }
- if (shape)
- _DrawShape(view,rangle,x,y,x,y,shape,solid);
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawRow( XkbUI_ViewPtr view,
- double rangle,
- int xoff,
- int yoff,
- XkbRowPtr row)
-#else
-_DrawRow(view,rangle,xoff,yoff,row)
- XkbUI_ViewPtr view;
- double rangle;
- int xoff;
- int yoff;
- XkbRowPtr row;
-#endif
-{
-register int k,x,y;
-XkbKeyPtr key;
-
- x= xoff+row->left; y= yoff+row->top;
- for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
- XkbShapePtr shape;
- shape= XkbKeyShape(view->xkb->geom,key);
- if (row->vertical) {
- y+= key->gap;
- _DrawShape(view,rangle,x,y,xoff,yoff,shape,True);
- y+= shape->bounds.y2;
- }
- else {
- x+= key->gap;
- _DrawShape(view,rangle,x,y,xoff,yoff,shape,True);
- x+= shape->bounds.x2;
- }
- }
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawSection(XkbUI_ViewPtr view,XkbSectionPtr section)
-#else
-_DrawSection(view,section)
- XkbUI_ViewPtr view;
- XkbSectionPtr section;
-#endif
-{
-double rangle;
-
- rangle= ((((double)(section->angle%3600))/3600.0)*(2.0*M_PI));
- if (section->doodads) {
- XkbDrawablePtr first,draw;
- first= XkbGetOrderedDrawables(NULL,section);
- if (first) {
- for (draw=first;draw!=NULL;draw=draw->next) {
- _DrawDoodad(view,rangle,section->left,section->top,draw->u.doodad);
- }
- XkbFreeOrderedDrawables(first);
- }
- }
- if (section->rows) {
- register int r;
- XkbRowPtr row;
- for (r=0,row=section->rows;r<section->num_rows;r++,row++) {
- _DrawRow(view,rangle,section->left,section->top,row);
- }
- }
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_DrawAll(XkbUI_ViewPtr view)
-#else
-_DrawAll(view)
- XkbUI_ViewPtr view;
-#endif
-{
-XkbGeometryPtr geom;
-XkbDrawablePtr first,draw;
-Bool dfltBorder;
-
- geom= view->xkb->geom;
- first= XkbGetOrderedDrawables(geom,NULL);
- if (first) {
- dfltBorder= True;
- for (draw=first;draw!=NULL;draw=draw->next) {
- char *name;
- if ((draw->type!=XkbDW_Doodad)||
- ((draw->u.doodad->any.type!=XkbOutlineDoodad)&&
- (draw->u.doodad->any.type!=XkbSolidDoodad))) {
- continue;
- }
- name= XkbAtomGetString(view->dpy,draw->u.doodad->any.name);
- if ((name!=NULL)&&(_XkbStrCaseCmp(name,"edges")==0)) {
- dfltBorder= False;
- break;
- }
- }
- if (dfltBorder)
- _DrawRect(view,0.0,0,0,geom->width_mm,geom->height_mm,True);
- for (draw=first;draw!=NULL;draw=draw->next) {
- switch (draw->type) {
- case XkbDW_Section:
- _DrawSection(view,draw->u.section);
- break;
- case XkbDW_Doodad:
- _DrawDoodad(view,0.0,0,0,draw->u.doodad);
- break;
- }
- }
- XkbFreeOrderedDrawables(first);
- }
- XFlush(view->dpy);
- return;
-}
-
-static void
-#if NeedFunctionPrototypes
-_RedrawKey(XkbUI_ViewPtr view,KeyCode kc)
-#else
-_RedrawKey(view,kc)
- XkbUI_ViewPtr view;
- KeyCode kc;
-#endif
-{
-/* _DrawAll(view);*/
- return;
-}
-
-/***====================================================================***/
-
-Bool
-#if NeedFunctionPrototypes
-XkbUI_SetKeyAppearance(XkbUI_ViewPtr view,KeyCode kc,unsigned int flags)
-#else
-XkbUI_SetKeyAppearance(view,kc,flags)
- XkbUI_ViewPtr view;
- KeyCode kc;
- unsigned int flags;
-#endif
-{
-XkbDescPtr xkb;
-unsigned old;
-
- if ((!view)||(!view->xkb))
- return False;
- xkb= view->xkb;
- if ((kc<xkb->min_key_code)||(kc>xkb->max_key_code))
- return False;
- old= view->state[kc];
- view->state[kc]= (flags&(~XkbUI_Obscured));
- if (old&XkbUI_Obscured)
- view->state[kc]|= XkbUI_Obscured;
- else if (old!=view->state[kc])
- _RedrawKey(view,kc);
- return True;
-}
-
-Bool
-#if NeedFunctionPrototypes
-XkbUI_SetKeyAppearanceByName( XkbUI_ViewPtr view,
- XkbKeyNamePtr name,
- unsigned int flags)
-#else
-XkbUI_SetKeyAppearanceByName(view,name,flags)
- XkbUI_ViewPtr view;
- XkbKeyNamePtr name;
- unsigned int flags;
-#endif
-{
-KeyCode kc;
-
- if ((!view)||(!view->xkb)||(!name))
- return False;
- kc= XkbFindKeycodeByName(view->xkb,name->name,True);
- if (!kc)
- return False;
- return XkbUI_SetKeyAppearance(view,kc,flags);
-}
-
-Bool
-#if NeedFunctionPrototypes
-XkbUI_ResetKeyAppearance( XkbUI_ViewPtr view,
- unsigned int mask,
- unsigned int values)
-#else
-XkbUI_ResetKeyAppearance(view,mask,values)
- XkbUI_ViewPtr view;
- unsigned int mask;
- unsigned int values;
-#endif
-{
-register int i;
-unsigned new_val;
-
- if ((!view)||(!view->xkb))
- return False;
- if (!mask)
- return True;
- for (i=view->xkb->min_key_code;i<=view->xkb->max_key_code;i++) {
- new_val= (view->state[i]&(~mask));
- new_val|= (mask&values);
- XkbUI_SetKeyAppearance(view,i,new_val);
- }
- return True;
-}
-
-Bool
-#if NeedFunctionPrototypes
-XkbUI_DrawRegion(XkbUI_ViewPtr view,XRectangle *viewport)
-#else
-XkbUI_DrawRegion(view,viewport)
- XkbUI_ViewPtr view;
- XRectangle * viewport;
-#endif
-{
- if (!view)
- return False;
- _DrawAll(view);
- return True;
-}
-
-Bool
-#if NeedFunctionPrototypes
-XkbUI_DrawChanged( XkbUI_ViewPtr view,
- XRectangle * viewport,
- XkbChangesPtr changes,
- int num_keys,
- XkbKeyNamePtr keys)
-#else
-XkbUI_DrawChanged(view,viewport,changesnum_keys,keys)
- XkbUI_ViewPtr view;
- XRectangle * viewport;
- XkbChangesPtr changes;
- int num_keys;
- XkbKeyNamePtr keys;
-#endif
-{
- return False;
-}
-
-Bool
-#if NeedFunctionPrototypes
-XkbUI_Select( XkbUI_ViewPtr view,
- XPoint * coord,
- unsigned int which,
- XkbSectionPtr section)
-#else
-XkbUI_Select(view,coord,which,section)
- XkbUI_ViewPtr view;
- XPoint * coord;
- unsigned int which;
- XkbSectionPtr section;
-#endif
-{
- return False;
-}
diff --git a/xc/lib/xkbui/XKBui.h b/xc/lib/xkbui/XKBui.h
deleted file mode 100644
index aeb9cb527..000000000
--- a/xc/lib/xkbui/XKBui.h
+++ /dev/null
@@ -1,217 +0,0 @@
-#ifndef XKBUI_H
-#define XKBUI_H 1
-/* $XConsortium: XKBui.h /main/2 1995/12/07 21:18:19 kaleb $ */
-/************************************************************
- Copyright (c) 1996 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 <X11/Xlib.h>
-#include <X11/XKBlib.h>
-#include <X11/extensions/XKBgeom.h>
-
-typedef struct _XkbUI_View *XkbUI_ViewPtr;
-
-typedef struct _XkbUI_ViewOpts {
- unsigned int present;
- unsigned int fg;
- unsigned int bg;
- unsigned int label_mode;
- unsigned int color_mode;
- XRectangle viewport;
- unsigned int margin_width;
- unsigned int margin_height;
- Colormap cmap;
-} XkbUI_ViewOptsRec,*XkbUI_ViewOptsPtr;
-
- /*
- * legal values for present field of a view options
- */
-#define XkbUI_BackgroundMask (1<<0)
-#define XkbUI_ForegroundMask (1<<1)
-#define XkbUI_LabelModeMask (1<<2)
-#define XkbUI_ColorModeMask (1<<3)
-#define XkbUI_WidthMask (1<<4)
-#define XkbUI_HeightMask (1<<5)
-#define XkbUI_XOffsetMask (1<<6)
-#define XkbUI_YOffsetMask (1<<7)
-#define XkbUI_ColormapMask (1<<8)
-#define XkbUI_MarginWidthMask (1<<9)
-#define XkbUI_MarginHeightMask (1<<10)
-
-#define XkbUI_SizeMask (XkbUI_WidthMask|XkbUI_HeightMask)
-#define XkbUI_OffsetMask (XkbUI_XOffsetMask|XkbUI_YOffsetMask)
-#define XkbUI_MarginMask (XkbUI_MarginWidthMask|XkbUI_MarginHeightMask)
-#define XkbUI_AllViewOptsMask (0x7ff)
-
- /*
- * legal values for the label_mode of a view options
- */
-#define XkbUI_NoLabels 0
-#define XkbUI_KeyCodes 1
-#define XkbUI_KeyNames 2
-#define XkbUI_StateSyms 3
-#define XkbUI_MultiSyms 4
-
-typedef struct _XkbUI_Select {
- unsigned type;
- XkbSectionPtr section;
- XkbKeyPtr key;
- XkbDoodadPtr doodad;
-} XkbUI_SelectRec,*XkbUI_SelectPtr;
-
- /*
- * legal values for 'type' field of a selection report
- */
-
-#define XkbUI_Keys 0
-#define XkbUI_Indicators 1
-#define XkbUI_TextLabels 2
-#define XkbUI_SolidShapes 3
-#define XkbUI_Outlines 4
-#define XkbUI_Logos 5
-#define XkbUI_Sections 6
-
- /*
- * legal values for 'which' field of a select call
- */
-#define XkbUI_KeysMask (1<<0)
-#define XkbUI_IndicatorsMask (1<<1)
-#define XkbUI_TextLabelsMask (1<<2)
-#define XkbUI_SolidShapesMask (1<<3)
-#define XkbUI_OutlinesMask (1<<4)
-#define XkbUI_LogosMask (1<<5)
-#define XkbUI_SectionsMask (1<<6)
-
- /*
- * legal values for key appearance flag
- */
-#define XkbUI_KeyDown (1<<0)
-#define XkbUI_Highlight (1<<1)
-
-_XFUNCPROTOBEGIN
-
-extern XkbUI_ViewPtr XkbUI_SimpleInit(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- Window /* win */,
- int /* width */,
- int /* height */
-#endif
-);
-
-extern XkbUI_ViewPtr XkbUI_Init(
-#if NeedFunctionPrototypes
- Display * /* dpy */,
- Window /* win */,
- int /* width */,
- int /* height */,
- XkbDescPtr /* xkb */,
- XkbUI_ViewOptsPtr /* view */
-#endif
-);
-
-extern Status XkbUI_SetViewOpts(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- XkbUI_ViewOptsPtr /* opts */
-#endif
-);
-
-extern Status XbUI_GetViewOpts(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- XkbUI_ViewOptsPtr /* opts_rtrn */
-#endif
-);
-
-extern Status XkbUI_SetCanvasSize(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- int /* width */,
- int /* height */
-#endif
-);
-
-extern Status XkbUI_GetCanvasSize(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- int * /* width_rtrn */,
- int * /* height_rtrn */
-#endif
-);
-
-extern Bool XkbUI_SetKeyAppearance(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- KeyCode /* kc */,
- unsigned /* flags */
-#endif
-);
-
-extern Bool XkbUI_SetKeyAppearanceByName(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- XkbKeyNamePtr /* name */,
- unsigned /* flags */
-#endif
-);
-
-extern Bool XkbUI_ResetKeyAppearance(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- unsigned int /* mask */,
- unsigned int /* values */
-#endif
-);
-
-extern Bool XkbUI_DrawRegion(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- XRectangle * /* viewport */
-#endif
-);
-
-extern Bool XkbUI_DrawChanged(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- XRectangle * /* viewport */,
- XkbChangesPtr /* changes */,
- int /* num_keys */,
- XkbKeyNamePtr /* keys */
-#endif
-);
-
-extern Bool XkbUI_Select(
-#if NeedFunctionPrototypes
- XkbUI_ViewPtr /* view */,
- XPoint * /* coord */,
- unsigned int /* which */,
- XkbSectionPtr /* section */
-#endif
-);
-
-_XFUNCPROTOEND
-
-#endif /* XKBUI_H */
diff --git a/xc/lib/xkbui/XKBuiPriv.h b/xc/lib/xkbui/XKBuiPriv.h
deleted file mode 100644
index c78b08e5c..000000000
--- a/xc/lib/xkbui/XKBuiPriv.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef XKBUIPRIV_H
-#define XKBUIPRIV_H 1
-/* $XConsortium: XKBuiPriv.h /main/2 1995/12/07 21:18:19 kaleb $ */
-/************************************************************
- Copyright (c) 1996 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 "XKBui.h"
-
-typedef struct _XkbUI_Point {
- double x;
- double y;
-} XkbUI_PointRec,*XkbUI_PointPtr;
-
-typedef struct _XkbUI_View {
- Display * dpy;
- XkbDescPtr xkb;
- Window win;
- GC gc;
- XkbUI_ViewOptsRec opts;
- unsigned int canvas_width;
- unsigned int canvas_height;
- unsigned char state[XkbMaxLegalKeyCode];
-
- double xscale;
- double yscale;
-} XkbUI_ViewRec;
-
-#define _XkbAlloc(s) malloc((s))
-#define _XkbCalloc(n,s) calloc((n),(s))
-#define _XkbRealloc(o,s) realloc((o),(s))
-#define _XkbTypedAlloc(t) ((t *)malloc(sizeof(t)))
-#define _XkbTypedCalloc(n,t) ((t *)calloc((n),sizeof(t)))
-#define _XkbTypedRealloc(o,n,t) \
- ((o)?(t *)realloc((o),(n)*sizeof(t)):_XkbTypedCalloc(n,t))
-#define _XkbClearElems(a,f,l,t) bzero(&(a)[f],((l)-(f)+1)*sizeof(t))
-#define _XkbFree(p) free(p)
-
- /*
- * private values for key appearance flags
- * must not conflict with values from XKBui.h
- */
-#define XkbUI_Obscured (1<<7)
-
-_XFUNCPROTOBEGIN
-
-_XFUNCPROTOEND
-
-#endif /* XKBUIPRIV_H */